changeset 13:cbf34dd4d7e6

commons-math-2.1 added
author dwinter
date Tue, 04 Jan 2011 10:02:07 +0100
parents 970d26a94fb7
children d6bddffc2fbb
files libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ArgumentOutsideDomainException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ConvergenceException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ConvergingAlgorithm.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ConvergingAlgorithmImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/DimensionMismatchException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/DuplicateSampleAbscissaException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/Field.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/FieldElement.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/FunctionEvaluationException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/MathConfigurationException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/MathException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/MathRuntimeException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/MaxEvaluationsExceededException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/MaxIterationsExceededException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/MessagesResources_fr.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/BinaryFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/BivariateRealFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/ComposableFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/DifferentiableMultivariateRealFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/DifferentiableMultivariateVectorialFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/DifferentiableUnivariateMatrixFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/DifferentiableUnivariateRealFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/DifferentiableUnivariateVectorialFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/MultivariateMatrixFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/MultivariateRealFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/MultivariateVectorialFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/UnivariateMatrixFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/UnivariateRealFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/UnivariateVectorialFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/integration/LegendreGaussIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/integration/RombergIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/integration/SimpsonIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/integration/TrapezoidIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/integration/UnivariateRealIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/integration/UnivariateRealIntegratorImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatingFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/BivariateRealGridInterpolator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/DividedDifferenceInterpolator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/LoessInterpolator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/MicrosphereInterpolatingFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/MicrosphereInterpolator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/MultivariateRealInterpolator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/NevilleInterpolator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/SmoothingBicubicSplineInterpolator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/SplineInterpolator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/UnivariateRealInterpolator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/polynomials/PolynomialFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/polynomials/PolynomialFunctionLagrangeForm.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/polynomials/PolynomialFunctionNewtonForm.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/polynomials/PolynomialsUtils.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/BisectionSolver.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/BrentSolver.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/LaguerreSolver.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/MullerSolver.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/NewtonSolver.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/RiddersSolver.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/SecantSolver.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/UnivariateRealSolverFactory.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/UnivariateRealSolverFactoryImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/complex/Complex.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/complex/ComplexField.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/complex/ComplexFormat.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/complex/ComplexUtils.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/AbstractContinuousDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/AbstractDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/AbstractIntegerDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/BetaDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/BetaDistributionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/BinomialDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/BinomialDistributionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/CauchyDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/CauchyDistributionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/ChiSquaredDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/ContinuousDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/DiscreteDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/Distribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/ExponentialDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/ExponentialDistributionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/FDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/FDistributionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/GammaDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/GammaDistributionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/HasDensity.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/HypergeometricDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/HypergeometricDistributionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/IntegerDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/NormalDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/NormalDistributionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/PascalDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/PascalDistributionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/PoissonDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/PoissonDistributionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/TDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/TDistributionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/WeibullDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/WeibullDistributionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/ZipfDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/ZipfDistributionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/estimation/AbstractEstimator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/estimation/EstimatedParameter.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/estimation/EstimationException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/estimation/EstimationProblem.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/estimation/Estimator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/estimation/GaussNewtonEstimator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/estimation/LevenbergMarquardtEstimator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/estimation/SimpleEstimationProblem.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/estimation/WeightedMeasurement.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/AbstractFormat.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/BigFraction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/BigFractionField.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/BigFractionFormat.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/Fraction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/FractionConversionException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/FractionField.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/FractionFormat.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/ProperBigFractionFormat.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/ProperFractionFormat.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/AbstractListChromosome.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/BinaryChromosome.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/BinaryMutation.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/Chromosome.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/ChromosomePair.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/CrossoverPolicy.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/ElitisticListPopulation.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/Fitness.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/FixedGenerationCount.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/GeneticAlgorithm.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/InvalidRepresentationException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/ListPopulation.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/MutationPolicy.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/OnePointCrossover.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/PermutationChromosome.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/Population.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/RandomKey.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/RandomKeyMutation.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/SelectionPolicy.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/StoppingCondition.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/TournamentSelection.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/geometry/CardanEulerSingularityException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/geometry/NotARotationMatrixException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/geometry/Rotation.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/geometry/RotationOrder.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/geometry/Vector3D.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/geometry/Vector3DFormat.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/AbstractFieldMatrix.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/AbstractRealMatrix.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/AbstractRealVector.EntryImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/AbstractRealVector.SparseEntryIterator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/AbstractRealVector.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/AnyMatrix.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/Array2DRowFieldMatrix.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/Array2DRowRealMatrix.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/ArrayFieldVector.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/ArrayRealVector.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/BigMatrix.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/BigMatrixImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/BlockFieldMatrix.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/BlockRealMatrix.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/CholeskyDecomposition.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/CholeskyDecompositionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/DecompositionSolver.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/DefaultFieldMatrixChangingVisitor.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/DefaultFieldMatrixPreservingVisitor.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/DefaultRealMatrixChangingVisitor.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/DefaultRealMatrixPreservingVisitor.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/EigenDecomposition.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/EigenDecompositionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/FieldDecompositionSolver.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/FieldLUDecomposition.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/FieldLUDecompositionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/FieldMatrix.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/FieldMatrixChangingVisitor.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/FieldMatrixPreservingVisitor.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/FieldVector.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/InvalidMatrixException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/LUDecomposition.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/LUDecompositionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/MatrixIndexException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/MatrixUtils.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/MatrixVisitorException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/NonSquareMatrixException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/NotPositiveDefiniteMatrixException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/NotSymmetricMatrixException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/OpenMapRealMatrix.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/OpenMapRealVector.OpenMapEntry.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/OpenMapRealVector.OpenMapSparseIterator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/OpenMapRealVector.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/QRDecomposition.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/QRDecompositionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/RealMatrix.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/RealMatrixChangingVisitor.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/RealMatrixImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/RealMatrixPreservingVisitor.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/RealVector.Entry.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/RealVector.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/RealVectorFormat.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/SingularMatrixException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/SingularValueDecomposition.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/SingularValueDecompositionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/SparseFieldMatrix.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/SparseFieldVector.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/SparseRealMatrix.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/SparseRealVector.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/AbstractIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/ContinuousOutputModel.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/DerivativeException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/FirstOrderConverter.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/FirstOrderDifferentialEquations.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/FirstOrderIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/IntegratorException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/MultistepIntegrator.NordsieckTransformer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/MultistepIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/ODEIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/SecondOrderDifferentialEquations.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/SecondOrderIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/events/CombinedEventsManager.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/events/EventException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/events/EventHandler.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/events/EventState.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/jacobians/EventHandlerWithJacobians.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/jacobians/FirstOrderIntegratorWithJacobians.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/jacobians/ODEWithJacobians.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/jacobians/ParameterizedODE.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/jacobians/StepHandlerWithJacobians.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/jacobians/StepInterpolatorWithJacobians.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/AdamsIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/AdamsNordsieckTransformer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/DormandPrince54Integrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/DormandPrince853Integrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/EulerIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/GillIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/HighamHall54Integrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/MidpointIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegrator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/sampling/AbstractStepInterpolator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/sampling/DummyStepHandler.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/sampling/DummyStepInterpolator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/sampling/FixedStepHandler.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/sampling/NordsieckStepInterpolator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/sampling/StepHandler.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/sampling/StepInterpolator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/sampling/StepNormalizer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/DifferentiableMultivariateRealOptimizer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/DifferentiableMultivariateVectorialOptimizer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/GoalType.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/LeastSquaresConverter.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateRealOptimizer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateVectorialOptimizer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/MultiStartMultivariateRealOptimizer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/MultiStartUnivariateRealOptimizer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/MultivariateRealOptimizer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/OptimizationException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/RealConvergenceChecker.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/RealPointValuePair.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/SimpleRealPointChecker.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/SimpleScalarValueChecker.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/SimpleVectorialPointChecker.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/SimpleVectorialValueChecker.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/UnivariateRealOptimizer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/VectorialConvergenceChecker.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/VectorialPointValuePair.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/direct/MultiDirectional.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/direct/NelderMead.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/fitting/CurveFitter.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/fitting/HarmonicCoefficientsGuesser.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/fitting/HarmonicFitter.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/fitting/HarmonicFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/fitting/ParametricRealFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/fitting/PolynomialFitter.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/fitting/WeightedObservedPoint.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/general/AbstractScalarDifferentiableOptimizer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/general/ConjugateGradientFormula.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/general/Preconditioner.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/linear/AbstractLinearOptimizer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/linear/LinearConstraint.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/linear/LinearObjectiveFunction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/linear/LinearOptimizer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/linear/NoFeasibleSolutionException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/linear/Relationship.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/linear/SimplexSolver.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/linear/UnboundedSolutionException.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/univariate/BrentOptimizer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/AbstractRandomGenerator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/BitsStreamGenerator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/CorrelatedRandomVectorGenerator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/EmpiricalDistribution.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/EmpiricalDistributionImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/GaussianRandomGenerator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/JDKRandomGenerator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/MersenneTwister.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/NormalizedRandomGenerator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/RandomAdaptor.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/RandomData.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/RandomDataImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/RandomGenerator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/RandomVectorGenerator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/UncorrelatedRandomVectorGenerator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/UniformRandomGenerator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/UnitSphereRandomVectorGenerator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/ValueServer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/special/Beta.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/special/Erf.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/special/Gamma.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/Frequency.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/StatUtils.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/clustering/Cluster.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/clustering/Clusterable.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/clustering/EuclideanIntegerPoint.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/clustering/KMeansPlusPlusClusterer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/correlation/Covariance.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/correlation/PearsonsCorrelation.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/correlation/SpearmansCorrelation.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/AbstractStorelessUnivariateStatistic.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/AbstractUnivariateStatistic.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/AggregateSummaryStatistics.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/StatisticalMultivariateSummary.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/StatisticalSummary.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/StatisticalSummaryValues.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/StorelessUnivariateStatistic.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/SummaryStatistics.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/SynchronizedDescriptiveStatistics.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/SynchronizedMultivariateSummaryStatistics.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/SynchronizedSummaryStatistics.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/UnivariateStatistic.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/WeightedEvaluation.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/FirstMoment.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/FourthMoment.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/GeometricMean.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/Kurtosis.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/Mean.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/SecondMoment.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/SemiVariance.Direction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/SemiVariance.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/Skewness.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/StandardDeviation.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/ThirdMoment.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/Variance.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/VectorialCovariance.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/VectorialMean.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/rank/Max.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/rank/Median.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/rank/Min.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/rank/Percentile.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/summary/Product.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/summary/Sum.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/summary/SumOfLogs.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/summary/SumOfSquares.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/inference/ChiSquareTest.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/inference/ChiSquareTestImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/inference/OneWayAnova.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/inference/OneWayAnovaImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/inference/TTest.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/inference/TTestImpl.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/inference/TestUtils.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/inference/UnknownDistributionChiSquareTest.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/ranking/NaNStrategy.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/ranking/NaturalRanking.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/ranking/RankingAlgorithm.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/ranking/TiesStrategy.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/regression/AbstractMultipleLinearRegression.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/regression/GLSMultipleLinearRegression.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/regression/MultipleLinearRegression.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/regression/OLSMultipleLinearRegression.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/regression/SimpleRegression.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/transform/FastCosineTransformer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/transform/FastFourierTransformer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/transform/FastHadamardTransformer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/transform/FastSineTransformer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/transform/RealTransformer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/BigReal.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/BigRealField.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/CompositeFormat.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/ContinuedFraction.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/DefaultTransformer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/DoubleArray.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/MathUtils.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/NumberTransformer.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/OpenIntToDoubleHashMap.Iterator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/OpenIntToDoubleHashMap.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/OpenIntToFieldHashMap.Iterator.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/OpenIntToFieldHashMap.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/ResizableDoubleArray.html libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/TransformerMap.html
diffstat 403 files changed, 126571 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ArgumentOutsideDomainException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,109 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Error thrown when a method is called with an out of bounds argument.<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @since 1.2<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     */<a name="line.25"></a>
+<FONT color="green">026</FONT>    public class ArgumentOutsideDomainException extends FunctionEvaluationException {<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>        /** Serializable version identifier. */<a name="line.28"></a>
+<FONT color="green">029</FONT>        private static final long serialVersionUID = -4965972841162580234L;<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /**<a name="line.31"></a>
+<FONT color="green">032</FONT>         * Constructs an exception with specified formatted detail message.<a name="line.32"></a>
+<FONT color="green">033</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @param argument  the failing function argument<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @param lower lower bound of the domain<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @param upper upper bound of the domain<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        public ArgumentOutsideDomainException(double argument, double lower, double upper) {<a name="line.38"></a>
+<FONT color="green">039</FONT>            super(argument,<a name="line.39"></a>
+<FONT color="green">040</FONT>                  "Argument {0} outside domain [{1} ; {2}]", argument, lower, upper);<a name="line.40"></a>
+<FONT color="green">041</FONT>        }<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>    }<a name="line.43"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ConvergenceException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,134 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Error thrown when a numerical computation can not be performed because the<a name="line.20"></a>
+<FONT color="green">021</FONT>     * numerical result failed to converge to a finite value.<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     */<a name="line.24"></a>
+<FONT color="green">025</FONT>    public class ConvergenceException extends MathException {<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>        /** Serializable version identifier */<a name="line.27"></a>
+<FONT color="green">028</FONT>        private static final long serialVersionUID = 4883703247677159141L;<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /**<a name="line.30"></a>
+<FONT color="green">031</FONT>         * Default constructor.<a name="line.31"></a>
+<FONT color="green">032</FONT>         */<a name="line.32"></a>
+<FONT color="green">033</FONT>        public ConvergenceException() {<a name="line.33"></a>
+<FONT color="green">034</FONT>            super("Convergence failed");<a name="line.34"></a>
+<FONT color="green">035</FONT>        }<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /**<a name="line.37"></a>
+<FONT color="green">038</FONT>         * Constructs an exception with specified formatted detail message.<a name="line.38"></a>
+<FONT color="green">039</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @param pattern format specifier<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @param arguments format arguments<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @since 1.2<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        public ConvergenceException(String pattern, Object ... arguments) {<a name="line.44"></a>
+<FONT color="green">045</FONT>            super(pattern, arguments);<a name="line.45"></a>
+<FONT color="green">046</FONT>        }<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /**<a name="line.48"></a>
+<FONT color="green">049</FONT>         * Create an exception with a given root cause.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @param cause  the exception or error that caused this exception to be thrown<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        public ConvergenceException(Throwable cause) {<a name="line.52"></a>
+<FONT color="green">053</FONT>            super(cause);<a name="line.53"></a>
+<FONT color="green">054</FONT>        }<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /**<a name="line.56"></a>
+<FONT color="green">057</FONT>         * Constructs an exception with specified formatted detail message and root cause.<a name="line.57"></a>
+<FONT color="green">058</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @param cause  the exception or error that caused this exception to be thrown<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @param pattern format specifier<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param arguments format arguments<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @since 1.2<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public ConvergenceException(Throwable cause, String pattern, Object ... arguments) {<a name="line.64"></a>
+<FONT color="green">065</FONT>            super(cause, pattern, arguments);<a name="line.65"></a>
+<FONT color="green">066</FONT>        }<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>    }<a name="line.68"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ConvergingAlgorithm.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,202 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Interface for algorithms handling convergence settings.<a name="line.21"></a>
+<FONT color="green">022</FONT>     * &lt;p&gt;<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This interface only deals with convergence parameters setting, not<a name="line.23"></a>
+<FONT color="green">024</FONT>     * execution of the algorithms per se.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;/p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @see ConvergenceException<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @since 2.0<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public interface ConvergingAlgorithm {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /**<a name="line.32"></a>
+<FONT color="green">033</FONT>         * Set the upper limit for the number of iterations.<a name="line.33"></a>
+<FONT color="green">034</FONT>         * &lt;p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>         * Usually a high iteration count indicates convergence problems. However,<a name="line.35"></a>
+<FONT color="green">036</FONT>         * the "reasonable value" varies widely for different algorithms. Users are<a name="line.36"></a>
+<FONT color="green">037</FONT>         * advised to use the default value supplied by the algorithm.&lt;/p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>         * &lt;p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>         * A {@link ConvergenceException} will be thrown if this number<a name="line.39"></a>
+<FONT color="green">040</FONT>         * is exceeded.&lt;/p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>         *<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @param count maximum number of iterations<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        void setMaximalIterationCount(int count);<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /**<a name="line.46"></a>
+<FONT color="green">047</FONT>         * Get the upper limit for the number of iterations.<a name="line.47"></a>
+<FONT color="green">048</FONT>         *<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @return the actual upper limit<a name="line.49"></a>
+<FONT color="green">050</FONT>         */<a name="line.50"></a>
+<FONT color="green">051</FONT>        int getMaximalIterationCount();<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Reset the upper limit for the number of iterations to the default.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * &lt;p&gt;<a name="line.55"></a>
+<FONT color="green">056</FONT>         * The default value is supplied by the algorithm implementation.&lt;/p&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>         *<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @see #setMaximalIterationCount(int)<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        void resetMaximalIterationCount();<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /**<a name="line.62"></a>
+<FONT color="green">063</FONT>         * Set the absolute accuracy.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * &lt;p&gt;<a name="line.64"></a>
+<FONT color="green">065</FONT>         * The default is usually chosen so that results in the interval<a name="line.65"></a>
+<FONT color="green">066</FONT>         * -10..-0.1 and +0.1..+10 can be found with a reasonable accuracy. If the<a name="line.66"></a>
+<FONT color="green">067</FONT>         * expected absolute value of your results is of much smaller magnitude, set<a name="line.67"></a>
+<FONT color="green">068</FONT>         * this to a smaller value.&lt;/p&gt;<a name="line.68"></a>
+<FONT color="green">069</FONT>         * &lt;p&gt;<a name="line.69"></a>
+<FONT color="green">070</FONT>         * Algorithms are advised to do a plausibility check with the relative<a name="line.70"></a>
+<FONT color="green">071</FONT>         * accuracy, but clients should not rely on this.&lt;/p&gt;<a name="line.71"></a>
+<FONT color="green">072</FONT>         *<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @param accuracy the accuracy.<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @throws IllegalArgumentException if the accuracy can't be achieved by<a name="line.74"></a>
+<FONT color="green">075</FONT>         * the solver or is otherwise deemed unreasonable.<a name="line.75"></a>
+<FONT color="green">076</FONT>         */<a name="line.76"></a>
+<FONT color="green">077</FONT>        void setAbsoluteAccuracy(double accuracy);<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        /**<a name="line.79"></a>
+<FONT color="green">080</FONT>         * Get the actual absolute accuracy.<a name="line.80"></a>
+<FONT color="green">081</FONT>         *<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @return the accuracy<a name="line.82"></a>
+<FONT color="green">083</FONT>         */<a name="line.83"></a>
+<FONT color="green">084</FONT>        double getAbsoluteAccuracy();<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /**<a name="line.86"></a>
+<FONT color="green">087</FONT>         * Reset the absolute accuracy to the default.<a name="line.87"></a>
+<FONT color="green">088</FONT>         * &lt;p&gt;<a name="line.88"></a>
+<FONT color="green">089</FONT>         * The default value is provided by the algorithm implementation.&lt;/p&gt;<a name="line.89"></a>
+<FONT color="green">090</FONT>         */<a name="line.90"></a>
+<FONT color="green">091</FONT>        void resetAbsoluteAccuracy();<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /**<a name="line.93"></a>
+<FONT color="green">094</FONT>         * Set the relative accuracy.<a name="line.94"></a>
+<FONT color="green">095</FONT>         * &lt;p&gt;<a name="line.95"></a>
+<FONT color="green">096</FONT>         * This is used to stop iterations if the absolute accuracy can't be<a name="line.96"></a>
+<FONT color="green">097</FONT>         * achieved due to large values or short mantissa length.&lt;/p&gt;<a name="line.97"></a>
+<FONT color="green">098</FONT>         * &lt;p&gt;<a name="line.98"></a>
+<FONT color="green">099</FONT>         * If this should be the primary criterion for convergence rather then a<a name="line.99"></a>
+<FONT color="green">100</FONT>         * safety measure, set the absolute accuracy to a ridiculously small value,<a name="line.100"></a>
+<FONT color="green">101</FONT>         * like {@link org.apache.commons.math.util.MathUtils#SAFE_MIN MathUtils.SAFE_MIN}.&lt;/p&gt;<a name="line.101"></a>
+<FONT color="green">102</FONT>         *<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @param accuracy the relative accuracy.<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @throws IllegalArgumentException if the accuracy can't be achieved by<a name="line.104"></a>
+<FONT color="green">105</FONT>         *  the algorithm or is otherwise deemed unreasonable.<a name="line.105"></a>
+<FONT color="green">106</FONT>         */<a name="line.106"></a>
+<FONT color="green">107</FONT>        void setRelativeAccuracy(double accuracy);<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /**<a name="line.109"></a>
+<FONT color="green">110</FONT>         * Get the actual relative accuracy.<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @return the accuracy<a name="line.111"></a>
+<FONT color="green">112</FONT>         */<a name="line.112"></a>
+<FONT color="green">113</FONT>        double getRelativeAccuracy();<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>        /**<a name="line.115"></a>
+<FONT color="green">116</FONT>         * Reset the relative accuracy to the default.<a name="line.116"></a>
+<FONT color="green">117</FONT>         * The default value is provided by the algorithm implementation.<a name="line.117"></a>
+<FONT color="green">118</FONT>         */<a name="line.118"></a>
+<FONT color="green">119</FONT>        void resetRelativeAccuracy();<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /**<a name="line.121"></a>
+<FONT color="green">122</FONT>         * Get the number of iterations in the last run of the algorithm.<a name="line.122"></a>
+<FONT color="green">123</FONT>         * &lt;p&gt;<a name="line.123"></a>
+<FONT color="green">124</FONT>         * This is mainly meant for testing purposes. It may occasionally<a name="line.124"></a>
+<FONT color="green">125</FONT>         * help track down performance problems: if the iteration count<a name="line.125"></a>
+<FONT color="green">126</FONT>         * is notoriously high, check whether the problem is evaluated<a name="line.126"></a>
+<FONT color="green">127</FONT>         * properly, and whether another algorithm is more amenable to the<a name="line.127"></a>
+<FONT color="green">128</FONT>         * problem.&lt;/p&gt;<a name="line.128"></a>
+<FONT color="green">129</FONT>         *<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @return the last iteration count.<a name="line.130"></a>
+<FONT color="green">131</FONT>         * @throws IllegalStateException if there is no result available, either<a name="line.131"></a>
+<FONT color="green">132</FONT>         * because no result was yet computed or the last attempt failed.<a name="line.132"></a>
+<FONT color="green">133</FONT>         */<a name="line.133"></a>
+<FONT color="green">134</FONT>        int getIterationCount();<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>    }<a name="line.136"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ConvergingAlgorithmImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,187 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Provide a default implementation for several functions useful to generic<a name="line.22"></a>
+<FONT color="green">023</FONT>     * converging algorithms.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 2.0<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public abstract class ConvergingAlgorithmImpl implements ConvergingAlgorithm{<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /** Maximum absolute error. */<a name="line.30"></a>
+<FONT color="green">031</FONT>        protected double absoluteAccuracy;<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** Maximum relative error. */<a name="line.33"></a>
+<FONT color="green">034</FONT>        protected double relativeAccuracy;<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Maximum number of iterations. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        protected int maximalIterationCount;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Default maximum absolute error. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        protected double defaultAbsoluteAccuracy;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Default maximum relative error. */<a name="line.42"></a>
+<FONT color="green">043</FONT>        protected double defaultRelativeAccuracy;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Default maximum number of iterations. */<a name="line.45"></a>
+<FONT color="green">046</FONT>        protected int defaultMaximalIterationCount;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        // Mainly for test framework.<a name="line.48"></a>
+<FONT color="green">049</FONT>        /** The last iteration count. */<a name="line.49"></a>
+<FONT color="green">050</FONT>        protected int iterationCount;<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * Construct an algorithm with given iteration count and accuracy.<a name="line.53"></a>
+<FONT color="green">054</FONT>         *<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param defaultAbsoluteAccuracy maximum absolute error<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param defaultMaximalIterationCount maximum number of iterations<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @throws IllegalArgumentException if f is null or the<a name="line.57"></a>
+<FONT color="green">058</FONT>         * defaultAbsoluteAccuracy is not valid<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        protected ConvergingAlgorithmImpl(final int defaultMaximalIterationCount,<a name="line.60"></a>
+<FONT color="green">061</FONT>                                          final double defaultAbsoluteAccuracy) {<a name="line.61"></a>
+<FONT color="green">062</FONT>            this.defaultAbsoluteAccuracy = defaultAbsoluteAccuracy;<a name="line.62"></a>
+<FONT color="green">063</FONT>            this.defaultRelativeAccuracy = 1.0e-14;<a name="line.63"></a>
+<FONT color="green">064</FONT>            this.absoluteAccuracy = defaultAbsoluteAccuracy;<a name="line.64"></a>
+<FONT color="green">065</FONT>            this.relativeAccuracy = defaultRelativeAccuracy;<a name="line.65"></a>
+<FONT color="green">066</FONT>            this.defaultMaximalIterationCount = defaultMaximalIterationCount;<a name="line.66"></a>
+<FONT color="green">067</FONT>            this.maximalIterationCount = defaultMaximalIterationCount;<a name="line.67"></a>
+<FONT color="green">068</FONT>            this.iterationCount = 0;<a name="line.68"></a>
+<FONT color="green">069</FONT>        }<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** {@inheritDoc} */<a name="line.71"></a>
+<FONT color="green">072</FONT>        public int getIterationCount() {<a name="line.72"></a>
+<FONT color="green">073</FONT>            return iterationCount;<a name="line.73"></a>
+<FONT color="green">074</FONT>        }<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        /** {@inheritDoc} */<a name="line.76"></a>
+<FONT color="green">077</FONT>        public void setAbsoluteAccuracy(double accuracy) {<a name="line.77"></a>
+<FONT color="green">078</FONT>            absoluteAccuracy = accuracy;<a name="line.78"></a>
+<FONT color="green">079</FONT>        }<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /** {@inheritDoc} */<a name="line.81"></a>
+<FONT color="green">082</FONT>        public double getAbsoluteAccuracy() {<a name="line.82"></a>
+<FONT color="green">083</FONT>            return absoluteAccuracy;<a name="line.83"></a>
+<FONT color="green">084</FONT>        }<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /** {@inheritDoc} */<a name="line.86"></a>
+<FONT color="green">087</FONT>        public void resetAbsoluteAccuracy() {<a name="line.87"></a>
+<FONT color="green">088</FONT>            absoluteAccuracy = defaultAbsoluteAccuracy;<a name="line.88"></a>
+<FONT color="green">089</FONT>        }<a name="line.89"></a>
+<FONT color="green">090</FONT>    <a name="line.90"></a>
+<FONT color="green">091</FONT>        /** {@inheritDoc} */<a name="line.91"></a>
+<FONT color="green">092</FONT>        public void setMaximalIterationCount(int count) {<a name="line.92"></a>
+<FONT color="green">093</FONT>            maximalIterationCount = count;<a name="line.93"></a>
+<FONT color="green">094</FONT>        }<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /** {@inheritDoc} */<a name="line.96"></a>
+<FONT color="green">097</FONT>        public int getMaximalIterationCount() {<a name="line.97"></a>
+<FONT color="green">098</FONT>            return maximalIterationCount;<a name="line.98"></a>
+<FONT color="green">099</FONT>        }<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /** {@inheritDoc} */<a name="line.101"></a>
+<FONT color="green">102</FONT>        public void resetMaximalIterationCount() {<a name="line.102"></a>
+<FONT color="green">103</FONT>            maximalIterationCount = defaultMaximalIterationCount;<a name="line.103"></a>
+<FONT color="green">104</FONT>        }<a name="line.104"></a>
+<FONT color="green">105</FONT>    <a name="line.105"></a>
+<FONT color="green">106</FONT>        /** {@inheritDoc} */<a name="line.106"></a>
+<FONT color="green">107</FONT>        public void setRelativeAccuracy(double accuracy) {<a name="line.107"></a>
+<FONT color="green">108</FONT>            relativeAccuracy = accuracy;<a name="line.108"></a>
+<FONT color="green">109</FONT>        }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /** {@inheritDoc} */<a name="line.111"></a>
+<FONT color="green">112</FONT>        public double getRelativeAccuracy() {<a name="line.112"></a>
+<FONT color="green">113</FONT>            return relativeAccuracy;<a name="line.113"></a>
+<FONT color="green">114</FONT>        }<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>        /** {@inheritDoc} */<a name="line.116"></a>
+<FONT color="green">117</FONT>        public void resetRelativeAccuracy() {<a name="line.117"></a>
+<FONT color="green">118</FONT>            relativeAccuracy = defaultRelativeAccuracy;<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>    }<a name="line.121"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/DimensionMismatchException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,129 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Error thrown when two dimensions differ.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>     * @since 1.2<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     */<a name="line.24"></a>
+<FONT color="green">025</FONT>    public class DimensionMismatchException extends MathException {<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>        /** Serializable version identifier */<a name="line.27"></a>
+<FONT color="green">028</FONT>        private static final long serialVersionUID = -1316089546353786411L;<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /** First dimension. */<a name="line.30"></a>
+<FONT color="green">031</FONT>        private final int dimension1;<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** Second dimension. */<a name="line.33"></a>
+<FONT color="green">034</FONT>        private final int dimension2;<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /**<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Construct an exception from the mismatched dimensions<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @param dimension1 first dimension<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @param dimension2 second dimension<a name="line.39"></a>
+<FONT color="green">040</FONT>         */<a name="line.40"></a>
+<FONT color="green">041</FONT>        public DimensionMismatchException(final int dimension1, final int dimension2) {<a name="line.41"></a>
+<FONT color="green">042</FONT>            super("dimension mismatch {0} != {1}", dimension1, dimension2);<a name="line.42"></a>
+<FONT color="green">043</FONT>            this.dimension1 = dimension1;<a name="line.43"></a>
+<FONT color="green">044</FONT>            this.dimension2 = dimension2;<a name="line.44"></a>
+<FONT color="green">045</FONT>        }<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Get the first dimension<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @return first dimension<a name="line.49"></a>
+<FONT color="green">050</FONT>         */<a name="line.50"></a>
+<FONT color="green">051</FONT>        public int getDimension1() {<a name="line.51"></a>
+<FONT color="green">052</FONT>            return dimension1;<a name="line.52"></a>
+<FONT color="green">053</FONT>        }<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * Get the second dimension<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @return second dimension<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public int getDimension2() {<a name="line.59"></a>
+<FONT color="green">060</FONT>            return dimension2;<a name="line.60"></a>
+<FONT color="green">061</FONT>        }<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>    }<a name="line.63"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/DuplicateSampleAbscissaException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,115 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Exception thrown when a sample contains several entries at the same abscissa.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>     * @since 1.2<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 822454 $ $Date: 2009-10-06 15:29:52 -0400 (Tue, 06 Oct 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     */<a name="line.24"></a>
+<FONT color="green">025</FONT>    public class DuplicateSampleAbscissaException extends MathException  {<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>        /** Serializable version identifier */<a name="line.27"></a>
+<FONT color="green">028</FONT>        private static final long serialVersionUID = -2271007547170169872L;<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /**<a name="line.30"></a>
+<FONT color="green">031</FONT>         * Construct an exception indicating the duplicate abscissa.<a name="line.31"></a>
+<FONT color="green">032</FONT>         * @param abscissa duplicate abscissa<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @param i1 index of one entry having the duplicate abscissa<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @param i2 index of another entry having the duplicate abscissa<a name="line.34"></a>
+<FONT color="green">035</FONT>         */<a name="line.35"></a>
+<FONT color="green">036</FONT>        public DuplicateSampleAbscissaException(double abscissa, int i1, int i2) {<a name="line.36"></a>
+<FONT color="green">037</FONT>            super("Abscissa {0} is duplicated at both indices {1} and {2}",<a name="line.37"></a>
+<FONT color="green">038</FONT>                  abscissa, i1, i2);<a name="line.38"></a>
+<FONT color="green">039</FONT>        }<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * Get the duplicate abscissa.<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @return duplicate abscissa<a name="line.43"></a>
+<FONT color="green">044</FONT>         */<a name="line.44"></a>
+<FONT color="green">045</FONT>        public double getDuplicateAbscissa() {<a name="line.45"></a>
+<FONT color="green">046</FONT>            return ((Double) getArguments()[0]).doubleValue();<a name="line.46"></a>
+<FONT color="green">047</FONT>        }<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>    }<a name="line.49"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/Field.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,117 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Interface representing a &lt;a href="http://mathworld.wolfram.com/Field.html"&gt;field&lt;/a&gt;.<a name="line.20"></a>
+<FONT color="green">021</FONT>     * &lt;p&gt;<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Classes implementing this interface will often be singletons.<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;/p&gt;<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @param &lt;T&gt; the type of the field elements<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @see FieldElement<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @since 2.0<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public interface Field&lt;T&gt; {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /** Get the additive identity of the field.<a name="line.31"></a>
+<FONT color="green">032</FONT>         * &lt;p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>         * The additive identity is the element e&lt;sub&gt;0&lt;/sub&gt; of the field such that<a name="line.33"></a>
+<FONT color="green">034</FONT>         * for all elements a of the field, the equalities a + e&lt;sub&gt;0&lt;/sub&gt; =<a name="line.34"></a>
+<FONT color="green">035</FONT>         * e&lt;sub&gt;0&lt;/sub&gt; + a = a hold.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * &lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @return additive identity of the field<a name="line.37"></a>
+<FONT color="green">038</FONT>         */<a name="line.38"></a>
+<FONT color="green">039</FONT>        T getZero();<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Get the multiplicative identity of the field.<a name="line.41"></a>
+<FONT color="green">042</FONT>         * &lt;p&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>         * The multiplicative identity is the element e&lt;sub&gt;1&lt;/sub&gt; of the field such that<a name="line.43"></a>
+<FONT color="green">044</FONT>         * for all elements a of the field, the equalities a &amp;times; e&lt;sub&gt;1&lt;/sub&gt; =<a name="line.44"></a>
+<FONT color="green">045</FONT>         * e&lt;sub&gt;1&lt;/sub&gt; &amp;times; a = a hold.<a name="line.45"></a>
+<FONT color="green">046</FONT>         * &lt;/p&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @return multiplicative identity of the field<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        T getOne();<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>    }<a name="line.51"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/FieldElement.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,126 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Interface representing &lt;a href="http://mathworld.wolfram.com/Field.html"&gt;field&lt;/a&gt; elements.<a name="line.21"></a>
+<FONT color="green">022</FONT>     * @param &lt;T&gt; the type of the field elements<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @see Field<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @since 2.0<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public interface FieldElement&lt;T&gt; {<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>        /** Compute this + a.<a name="line.29"></a>
+<FONT color="green">030</FONT>         * @param a element to add<a name="line.30"></a>
+<FONT color="green">031</FONT>         * @return a new element representing this + a<a name="line.31"></a>
+<FONT color="green">032</FONT>         */<a name="line.32"></a>
+<FONT color="green">033</FONT>        T add(T a);<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Compute this - a.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @param a element to subtract<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @return a new element representing this - a<a name="line.37"></a>
+<FONT color="green">038</FONT>         */<a name="line.38"></a>
+<FONT color="green">039</FONT>        T subtract(T a);<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Compute this &amp;times; a.<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @param a element to multiply<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @return a new element representing this &amp;times; a<a name="line.43"></a>
+<FONT color="green">044</FONT>         */<a name="line.44"></a>
+<FONT color="green">045</FONT>        T multiply(T a);<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** Compute this &amp;divide; a.<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @param a element to add<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @return a new element representing this &amp;divide; a<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @exception ArithmeticException if a is the zero of the<a name="line.50"></a>
+<FONT color="green">051</FONT>         * additive operation (i.e. additive identity)<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        T divide(T a) throws ArithmeticException;<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** Get the {@link Field} to which the instance belongs.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @return {@link Field} to which the instance belongs<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        Field&lt;T&gt; getField();<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>    }<a name="line.60"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/FunctionEvaluationException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,223 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.linear.ArrayRealVector;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Exception thrown when an error occurs evaluating a function.<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;p&gt;<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Maintains an &lt;code&gt;argument&lt;/code&gt; property holding the input value that<a name="line.24"></a>
+<FONT color="green">025</FONT>     * caused the function evaluation to fail.<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 885278 $ $Date: 2009-11-29 16:47:51 -0500 (Sun, 29 Nov 2009) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public class FunctionEvaluationException extends MathException  {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /** Serializable version identifier. */<a name="line.31"></a>
+<FONT color="green">032</FONT>        private static final long serialVersionUID = -4305020489115478365L;<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /** Message for failed evaluation. */<a name="line.34"></a>
+<FONT color="green">035</FONT>        private static final String FAILED_EVALUATION_MESSAGE =<a name="line.35"></a>
+<FONT color="green">036</FONT>            "evaluation failed for argument = {0}";<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Argument causing function evaluation failure */<a name="line.38"></a>
+<FONT color="green">039</FONT>        private double[] argument;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * Construct an exception indicating the argument value<a name="line.42"></a>
+<FONT color="green">043</FONT>         * that caused the function evaluation to fail.<a name="line.43"></a>
+<FONT color="green">044</FONT>         *<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @param argument  the failing function argument<a name="line.45"></a>
+<FONT color="green">046</FONT>         */<a name="line.46"></a>
+<FONT color="green">047</FONT>        public FunctionEvaluationException(double argument) {<a name="line.47"></a>
+<FONT color="green">048</FONT>            super(FAILED_EVALUATION_MESSAGE, argument);<a name="line.48"></a>
+<FONT color="green">049</FONT>            this.argument = new double[] { argument };<a name="line.49"></a>
+<FONT color="green">050</FONT>        }<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * Construct an exception indicating the argument value<a name="line.53"></a>
+<FONT color="green">054</FONT>         * that caused the function evaluation to fail.<a name="line.54"></a>
+<FONT color="green">055</FONT>         *<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param argument  the failing function argument<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @since 2.0<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public FunctionEvaluationException(double[] argument) {<a name="line.59"></a>
+<FONT color="green">060</FONT>            super(FAILED_EVALUATION_MESSAGE, new ArrayRealVector(argument));<a name="line.60"></a>
+<FONT color="green">061</FONT>            this.argument = argument.clone();<a name="line.61"></a>
+<FONT color="green">062</FONT>        }<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /**<a name="line.64"></a>
+<FONT color="green">065</FONT>         * Constructs an exception with specified formatted detail message.<a name="line.65"></a>
+<FONT color="green">066</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @param argument  the failing function argument<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param pattern format specifier<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @param arguments format arguments<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @since 1.2<a name="line.70"></a>
+<FONT color="green">071</FONT>         */<a name="line.71"></a>
+<FONT color="green">072</FONT>        public FunctionEvaluationException(double argument,<a name="line.72"></a>
+<FONT color="green">073</FONT>                                           String pattern, Object ... arguments) {<a name="line.73"></a>
+<FONT color="green">074</FONT>            super(pattern, arguments);<a name="line.74"></a>
+<FONT color="green">075</FONT>            this.argument = new double[] { argument };<a name="line.75"></a>
+<FONT color="green">076</FONT>        }<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /**<a name="line.78"></a>
+<FONT color="green">079</FONT>         * Constructs an exception with specified formatted detail message.<a name="line.79"></a>
+<FONT color="green">080</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @param argument  the failing function argument<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @param pattern format specifier<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param arguments format arguments<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @since 2.0<a name="line.84"></a>
+<FONT color="green">085</FONT>         */<a name="line.85"></a>
+<FONT color="green">086</FONT>        public FunctionEvaluationException(double[] argument,<a name="line.86"></a>
+<FONT color="green">087</FONT>                                           String pattern, Object ... arguments) {<a name="line.87"></a>
+<FONT color="green">088</FONT>            super(pattern, arguments);<a name="line.88"></a>
+<FONT color="green">089</FONT>            this.argument = argument.clone();<a name="line.89"></a>
+<FONT color="green">090</FONT>        }<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /**<a name="line.92"></a>
+<FONT color="green">093</FONT>         * Constructs an exception with specified root cause.<a name="line.93"></a>
+<FONT color="green">094</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.94"></a>
+<FONT color="green">095</FONT>         * @param cause  the exception or error that caused this exception to be thrown<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @param argument  the failing function argument<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @since 1.2<a name="line.97"></a>
+<FONT color="green">098</FONT>         */<a name="line.98"></a>
+<FONT color="green">099</FONT>        public FunctionEvaluationException(Throwable cause, double argument) {<a name="line.99"></a>
+<FONT color="green">100</FONT>            super(cause);<a name="line.100"></a>
+<FONT color="green">101</FONT>            this.argument = new double[] { argument };<a name="line.101"></a>
+<FONT color="green">102</FONT>        }<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /**<a name="line.104"></a>
+<FONT color="green">105</FONT>         * Constructs an exception with specified root cause.<a name="line.105"></a>
+<FONT color="green">106</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @param cause  the exception or error that caused this exception to be thrown<a name="line.107"></a>
+<FONT color="green">108</FONT>         * @param argument  the failing function argument<a name="line.108"></a>
+<FONT color="green">109</FONT>         * @since 2.0<a name="line.109"></a>
+<FONT color="green">110</FONT>         */<a name="line.110"></a>
+<FONT color="green">111</FONT>        public FunctionEvaluationException(Throwable cause, double[] argument) {<a name="line.111"></a>
+<FONT color="green">112</FONT>            super(cause);<a name="line.112"></a>
+<FONT color="green">113</FONT>            this.argument = argument.clone();<a name="line.113"></a>
+<FONT color="green">114</FONT>        }<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>        /**<a name="line.116"></a>
+<FONT color="green">117</FONT>         * Constructs an exception with specified formatted detail message and root cause.<a name="line.117"></a>
+<FONT color="green">118</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @param cause  the exception or error that caused this exception to be thrown<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @param argument  the failing function argument<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @param pattern format specifier<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @param arguments format arguments<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @since 1.2<a name="line.123"></a>
+<FONT color="green">124</FONT>         */<a name="line.124"></a>
+<FONT color="green">125</FONT>        public FunctionEvaluationException(Throwable cause,<a name="line.125"></a>
+<FONT color="green">126</FONT>                                           double argument, String pattern,<a name="line.126"></a>
+<FONT color="green">127</FONT>                                           Object ... arguments) {<a name="line.127"></a>
+<FONT color="green">128</FONT>            super(cause, pattern, arguments);<a name="line.128"></a>
+<FONT color="green">129</FONT>            this.argument = new double[] { argument };<a name="line.129"></a>
+<FONT color="green">130</FONT>        }<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>        /**<a name="line.132"></a>
+<FONT color="green">133</FONT>         * Constructs an exception with specified formatted detail message and root cause.<a name="line.133"></a>
+<FONT color="green">134</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @param cause  the exception or error that caused this exception to be thrown<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @param argument  the failing function argument<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @param pattern format specifier<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @param arguments format arguments<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @since 2.0<a name="line.139"></a>
+<FONT color="green">140</FONT>         */<a name="line.140"></a>
+<FONT color="green">141</FONT>        public FunctionEvaluationException(Throwable cause,<a name="line.141"></a>
+<FONT color="green">142</FONT>                                           double[] argument, String pattern,<a name="line.142"></a>
+<FONT color="green">143</FONT>                                           Object ... arguments) {<a name="line.143"></a>
+<FONT color="green">144</FONT>            super(cause, pattern, arguments);<a name="line.144"></a>
+<FONT color="green">145</FONT>            this.argument = argument.clone();<a name="line.145"></a>
+<FONT color="green">146</FONT>        }<a name="line.146"></a>
+<FONT color="green">147</FONT>    <a name="line.147"></a>
+<FONT color="green">148</FONT>        /**<a name="line.148"></a>
+<FONT color="green">149</FONT>         * Returns the function argument that caused this exception.<a name="line.149"></a>
+<FONT color="green">150</FONT>         *<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @return  argument that caused function evaluation to fail<a name="line.151"></a>
+<FONT color="green">152</FONT>         */<a name="line.152"></a>
+<FONT color="green">153</FONT>        public double[] getArgument() {<a name="line.153"></a>
+<FONT color="green">154</FONT>            return argument.clone();<a name="line.154"></a>
+<FONT color="green">155</FONT>        }<a name="line.155"></a>
+<FONT color="green">156</FONT>    <a name="line.156"></a>
+<FONT color="green">157</FONT>    }<a name="line.157"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/MathConfigurationException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,134 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Signals a configuration problem with any of the factory methods.<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     */<a name="line.24"></a>
+<FONT color="green">025</FONT>    public class MathConfigurationException extends MathException implements Serializable{<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>        /** Serializable version identifier */<a name="line.27"></a>
+<FONT color="green">028</FONT>        private static final long serialVersionUID = 5261476508226103366L;<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /**<a name="line.30"></a>
+<FONT color="green">031</FONT>         * Default constructor.<a name="line.31"></a>
+<FONT color="green">032</FONT>         */<a name="line.32"></a>
+<FONT color="green">033</FONT>        public MathConfigurationException() {<a name="line.33"></a>
+<FONT color="green">034</FONT>            super();<a name="line.34"></a>
+<FONT color="green">035</FONT>        }<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /**<a name="line.37"></a>
+<FONT color="green">038</FONT>         * Constructs an exception with specified formatted detail message.<a name="line.38"></a>
+<FONT color="green">039</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @param pattern format specifier<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @param arguments format arguments<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @since 1.2<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        public MathConfigurationException(String pattern, Object ... arguments) {<a name="line.44"></a>
+<FONT color="green">045</FONT>            super(pattern, arguments);<a name="line.45"></a>
+<FONT color="green">046</FONT>        }<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /**<a name="line.48"></a>
+<FONT color="green">049</FONT>         * Create an exception with a given root cause.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @param cause  the exception or error that caused this exception to be thrown<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        public MathConfigurationException(Throwable cause) {<a name="line.52"></a>
+<FONT color="green">053</FONT>            super(cause);<a name="line.53"></a>
+<FONT color="green">054</FONT>        }<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /**<a name="line.56"></a>
+<FONT color="green">057</FONT>         * Constructs an exception with specified formatted detail message and root cause.<a name="line.57"></a>
+<FONT color="green">058</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @param cause  the exception or error that caused this exception to be thrown<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @param pattern format specifier<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param arguments format arguments<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @since 1.2<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public MathConfigurationException(Throwable cause, String pattern, Object ... arguments) {<a name="line.64"></a>
+<FONT color="green">065</FONT>            super(cause, pattern, arguments);<a name="line.65"></a>
+<FONT color="green">066</FONT>        }<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>    }<a name="line.68"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/MathException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,257 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.PrintStream;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.PrintWriter;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.text.MessageFormat;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.util.Locale;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.util.MissingResourceException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import java.util.ResourceBundle;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    /**<a name="line.27"></a>
+<FONT color="green">028</FONT>    * Base class for commons-math checked exceptions.<a name="line.28"></a>
+<FONT color="green">029</FONT>    * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>    * Supports nesting, emulating JDK 1.4 behavior if necessary.&lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>    * &lt;p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>    * Adapted from &lt;a href="http://commons.apache.org/collections/api-release/org/apache/commons/collections/FunctorException.html"/&gt;.&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>    *<a name="line.33"></a>
+<FONT color="green">034</FONT>    * @version $Revision: 822850 $ $Date: 2009-10-07 14:56:42 -0400 (Wed, 07 Oct 2009) $<a name="line.34"></a>
+<FONT color="green">035</FONT>    */<a name="line.35"></a>
+<FONT color="green">036</FONT>    public class MathException extends Exception {<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Serializable version identifier. */<a name="line.38"></a>
+<FONT color="green">039</FONT>        private static final long serialVersionUID = -9004610152740737812L;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * Pattern used to build the message.<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        private final String pattern;<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /**<a name="line.46"></a>
+<FONT color="green">047</FONT>         * Arguments used to build the message.<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        private final Object[] arguments;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /**<a name="line.51"></a>
+<FONT color="green">052</FONT>         * Constructs a new &lt;code&gt;MathException&lt;/code&gt; with no<a name="line.52"></a>
+<FONT color="green">053</FONT>         * detail message.<a name="line.53"></a>
+<FONT color="green">054</FONT>         */<a name="line.54"></a>
+<FONT color="green">055</FONT>        public MathException() {<a name="line.55"></a>
+<FONT color="green">056</FONT>            this.pattern   = null;<a name="line.56"></a>
+<FONT color="green">057</FONT>            this.arguments = new Object[0];<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /**<a name="line.60"></a>
+<FONT color="green">061</FONT>         * Constructs a new &lt;code&gt;MathException&lt;/code&gt; with specified<a name="line.61"></a>
+<FONT color="green">062</FONT>         * formatted detail message.<a name="line.62"></a>
+<FONT color="green">063</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @param pattern format specifier<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param arguments format arguments<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        public MathException(String pattern, Object ... arguments) {<a name="line.67"></a>
+<FONT color="green">068</FONT>          this.pattern   = pattern;<a name="line.68"></a>
+<FONT color="green">069</FONT>          this.arguments = (arguments == null) ? new Object[0] : arguments.clone();<a name="line.69"></a>
+<FONT color="green">070</FONT>        }<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /**<a name="line.72"></a>
+<FONT color="green">073</FONT>         * Constructs a new &lt;code&gt;MathException&lt;/code&gt; with specified<a name="line.73"></a>
+<FONT color="green">074</FONT>         * nested &lt;code&gt;Throwable&lt;/code&gt; root cause.<a name="line.74"></a>
+<FONT color="green">075</FONT>         *<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @param rootCause  the exception or error that caused this exception<a name="line.76"></a>
+<FONT color="green">077</FONT>         *                   to be thrown.<a name="line.77"></a>
+<FONT color="green">078</FONT>         */<a name="line.78"></a>
+<FONT color="green">079</FONT>        public MathException(Throwable rootCause) {<a name="line.79"></a>
+<FONT color="green">080</FONT>            super(rootCause);<a name="line.80"></a>
+<FONT color="green">081</FONT>            this.pattern   = getMessage();<a name="line.81"></a>
+<FONT color="green">082</FONT>            this.arguments = new Object[0];<a name="line.82"></a>
+<FONT color="green">083</FONT>        }<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>        /**<a name="line.85"></a>
+<FONT color="green">086</FONT>         * Constructs a new &lt;code&gt;MathException&lt;/code&gt; with specified<a name="line.86"></a>
+<FONT color="green">087</FONT>         * formatted detail message and nested &lt;code&gt;Throwable&lt;/code&gt; root cause.<a name="line.87"></a>
+<FONT color="green">088</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @param rootCause the exception or error that caused this exception<a name="line.89"></a>
+<FONT color="green">090</FONT>         * to be thrown.<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @param pattern format specifier<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @param arguments format arguments<a name="line.92"></a>
+<FONT color="green">093</FONT>         * @since 1.2<a name="line.93"></a>
+<FONT color="green">094</FONT>         */<a name="line.94"></a>
+<FONT color="green">095</FONT>        public MathException(Throwable rootCause, String pattern, Object ... arguments) {<a name="line.95"></a>
+<FONT color="green">096</FONT>          super(rootCause);<a name="line.96"></a>
+<FONT color="green">097</FONT>          this.pattern   = pattern;<a name="line.97"></a>
+<FONT color="green">098</FONT>          this.arguments = (arguments == null) ? new Object[0] : arguments.clone();<a name="line.98"></a>
+<FONT color="green">099</FONT>        }<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /**<a name="line.101"></a>
+<FONT color="green">102</FONT>         * Translate a string to a given locale.<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @param s string to translate<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @param locale locale into which to translate the string<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @return translated string or original string<a name="line.105"></a>
+<FONT color="green">106</FONT>         * for unsupported locales or unknown strings<a name="line.106"></a>
+<FONT color="green">107</FONT>         */<a name="line.107"></a>
+<FONT color="green">108</FONT>        private static String translate(String s, Locale locale) {<a name="line.108"></a>
+<FONT color="green">109</FONT>            try {<a name="line.109"></a>
+<FONT color="green">110</FONT>                ResourceBundle bundle =<a name="line.110"></a>
+<FONT color="green">111</FONT>                        ResourceBundle.getBundle("org.apache.commons.math.MessagesResources", locale);<a name="line.111"></a>
+<FONT color="green">112</FONT>                if (bundle.getLocale().getLanguage().equals(locale.getLanguage())) {<a name="line.112"></a>
+<FONT color="green">113</FONT>                    // the value of the resource is the translated string<a name="line.113"></a>
+<FONT color="green">114</FONT>                    return bundle.getString(s);<a name="line.114"></a>
+<FONT color="green">115</FONT>                }<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>            } catch (MissingResourceException mre) {<a name="line.117"></a>
+<FONT color="green">118</FONT>                // do nothing here<a name="line.118"></a>
+<FONT color="green">119</FONT>            }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>            // the locale is not supported or the resource is unknown<a name="line.121"></a>
+<FONT color="green">122</FONT>            // don't translate and fall back to using the string as is<a name="line.122"></a>
+<FONT color="green">123</FONT>            return s;<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>        }<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>        /** Gets the pattern used to build the message of this throwable.<a name="line.127"></a>
+<FONT color="green">128</FONT>         *<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @return the pattern used to build the message of this throwable<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @since 1.2<a name="line.130"></a>
+<FONT color="green">131</FONT>         */<a name="line.131"></a>
+<FONT color="green">132</FONT>        public String getPattern() {<a name="line.132"></a>
+<FONT color="green">133</FONT>            return pattern;<a name="line.133"></a>
+<FONT color="green">134</FONT>        }<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>        /** Gets the arguments used to build the message of this throwable.<a name="line.136"></a>
+<FONT color="green">137</FONT>         *<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @return the arguments used to build the message of this throwable<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @since 1.2<a name="line.139"></a>
+<FONT color="green">140</FONT>         */<a name="line.140"></a>
+<FONT color="green">141</FONT>        public Object[] getArguments() {<a name="line.141"></a>
+<FONT color="green">142</FONT>            return arguments.clone();<a name="line.142"></a>
+<FONT color="green">143</FONT>        }<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>        /** Gets the message in a specified locale.<a name="line.145"></a>
+<FONT color="green">146</FONT>         *<a name="line.146"></a>
+<FONT color="green">147</FONT>         * @param locale Locale in which the message should be translated<a name="line.147"></a>
+<FONT color="green">148</FONT>         *<a name="line.148"></a>
+<FONT color="green">149</FONT>         * @return localized message<a name="line.149"></a>
+<FONT color="green">150</FONT>         * @since 1.2<a name="line.150"></a>
+<FONT color="green">151</FONT>         */<a name="line.151"></a>
+<FONT color="green">152</FONT>        public String getMessage(final Locale locale) {<a name="line.152"></a>
+<FONT color="green">153</FONT>            return (pattern == null) ? "" : new MessageFormat(translate(pattern, locale), locale).format(arguments);<a name="line.153"></a>
+<FONT color="green">154</FONT>        }<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>        /** {@inheritDoc} */<a name="line.156"></a>
+<FONT color="green">157</FONT>        @Override<a name="line.157"></a>
+<FONT color="green">158</FONT>        public String getMessage() {<a name="line.158"></a>
+<FONT color="green">159</FONT>            return getMessage(Locale.US);<a name="line.159"></a>
+<FONT color="green">160</FONT>        }<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>        /** {@inheritDoc} */<a name="line.162"></a>
+<FONT color="green">163</FONT>        @Override<a name="line.163"></a>
+<FONT color="green">164</FONT>        public String getLocalizedMessage() {<a name="line.164"></a>
+<FONT color="green">165</FONT>            return getMessage(Locale.getDefault());<a name="line.165"></a>
+<FONT color="green">166</FONT>        }<a name="line.166"></a>
+<FONT color="green">167</FONT>    <a name="line.167"></a>
+<FONT color="green">168</FONT>        /**<a name="line.168"></a>
+<FONT color="green">169</FONT>         * Prints the stack trace of this exception to the standard error stream.<a name="line.169"></a>
+<FONT color="green">170</FONT>         */<a name="line.170"></a>
+<FONT color="green">171</FONT>        @Override<a name="line.171"></a>
+<FONT color="green">172</FONT>        public void printStackTrace() {<a name="line.172"></a>
+<FONT color="green">173</FONT>            printStackTrace(System.err);<a name="line.173"></a>
+<FONT color="green">174</FONT>        }<a name="line.174"></a>
+<FONT color="green">175</FONT>    <a name="line.175"></a>
+<FONT color="green">176</FONT>        /**<a name="line.176"></a>
+<FONT color="green">177</FONT>         * Prints the stack trace of this exception to the specified stream.<a name="line.177"></a>
+<FONT color="green">178</FONT>         *<a name="line.178"></a>
+<FONT color="green">179</FONT>         * @param out  the &lt;code&gt;PrintStream&lt;/code&gt; to use for output<a name="line.179"></a>
+<FONT color="green">180</FONT>         */<a name="line.180"></a>
+<FONT color="green">181</FONT>        @Override<a name="line.181"></a>
+<FONT color="green">182</FONT>        public void printStackTrace(PrintStream out) {<a name="line.182"></a>
+<FONT color="green">183</FONT>            synchronized (out) {<a name="line.183"></a>
+<FONT color="green">184</FONT>                PrintWriter pw = new PrintWriter(out, false);<a name="line.184"></a>
+<FONT color="green">185</FONT>                printStackTrace(pw);<a name="line.185"></a>
+<FONT color="green">186</FONT>                // Flush the PrintWriter before it's GC'ed.<a name="line.186"></a>
+<FONT color="green">187</FONT>                pw.flush();<a name="line.187"></a>
+<FONT color="green">188</FONT>            }<a name="line.188"></a>
+<FONT color="green">189</FONT>        }<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>    }<a name="line.191"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/MathRuntimeException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,582 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.EOFException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.IOException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.io.PrintStream;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.io.PrintWriter;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.text.MessageFormat;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import java.text.ParseException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import java.util.ConcurrentModificationException;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import java.util.Locale;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import java.util.MissingResourceException;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import java.util.NoSuchElementException;<a name="line.28"></a>
+<FONT color="green">029</FONT>    import java.util.ResourceBundle;<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>    /**<a name="line.31"></a>
+<FONT color="green">032</FONT>    * Base class for commons-math unchecked exceptions.<a name="line.32"></a>
+<FONT color="green">033</FONT>    *<a name="line.33"></a>
+<FONT color="green">034</FONT>    * @version $Revision: 822850 $ $Date: 2009-10-07 14:56:42 -0400 (Wed, 07 Oct 2009) $<a name="line.34"></a>
+<FONT color="green">035</FONT>    * @since 2.0<a name="line.35"></a>
+<FONT color="green">036</FONT>    */<a name="line.36"></a>
+<FONT color="green">037</FONT>    public class MathRuntimeException extends RuntimeException {<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Serializable version identifier. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private static final long serialVersionUID = -5128983364075381060L;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /**<a name="line.42"></a>
+<FONT color="green">043</FONT>         * Pattern used to build the message.<a name="line.43"></a>
+<FONT color="green">044</FONT>         */<a name="line.44"></a>
+<FONT color="green">045</FONT>        private final String pattern;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Arguments used to build the message.<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        private final Object[] arguments;<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * Constructs a new &lt;code&gt;MathRuntimeException&lt;/code&gt; with specified<a name="line.53"></a>
+<FONT color="green">054</FONT>         * formatted detail message.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param pattern format specifier<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @param arguments format arguments<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public MathRuntimeException(final String pattern, final Object ... arguments) {<a name="line.59"></a>
+<FONT color="green">060</FONT>            this.pattern   = pattern;<a name="line.60"></a>
+<FONT color="green">061</FONT>            this.arguments = (arguments == null) ? new Object[0] : arguments.clone();<a name="line.61"></a>
+<FONT color="green">062</FONT>        }<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /**<a name="line.64"></a>
+<FONT color="green">065</FONT>         * Constructs a new &lt;code&gt;MathRuntimeException&lt;/code&gt; with specified<a name="line.65"></a>
+<FONT color="green">066</FONT>         * nested &lt;code&gt;Throwable&lt;/code&gt; root cause.<a name="line.66"></a>
+<FONT color="green">067</FONT>         *<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param rootCause  the exception or error that caused this exception<a name="line.68"></a>
+<FONT color="green">069</FONT>         *                   to be thrown.<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        public MathRuntimeException(final Throwable rootCause) {<a name="line.71"></a>
+<FONT color="green">072</FONT>            super(rootCause);<a name="line.72"></a>
+<FONT color="green">073</FONT>            this.pattern   = getMessage();<a name="line.73"></a>
+<FONT color="green">074</FONT>            this.arguments = new Object[0];<a name="line.74"></a>
+<FONT color="green">075</FONT>        }<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /**<a name="line.77"></a>
+<FONT color="green">078</FONT>         * Constructs a new &lt;code&gt;MathRuntimeException&lt;/code&gt; with specified<a name="line.78"></a>
+<FONT color="green">079</FONT>         * formatted detail message and nested &lt;code&gt;Throwable&lt;/code&gt; root cause.<a name="line.79"></a>
+<FONT color="green">080</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @param rootCause the exception or error that caused this exception<a name="line.81"></a>
+<FONT color="green">082</FONT>         * to be thrown.<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param pattern format specifier<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @param arguments format arguments<a name="line.84"></a>
+<FONT color="green">085</FONT>         */<a name="line.85"></a>
+<FONT color="green">086</FONT>        public MathRuntimeException(final Throwable rootCause,<a name="line.86"></a>
+<FONT color="green">087</FONT>                                    final String pattern, final Object ... arguments) {<a name="line.87"></a>
+<FONT color="green">088</FONT>            super(rootCause);<a name="line.88"></a>
+<FONT color="green">089</FONT>            this.pattern   = pattern;<a name="line.89"></a>
+<FONT color="green">090</FONT>            this.arguments = (arguments == null) ? new Object[0] : arguments.clone();<a name="line.90"></a>
+<FONT color="green">091</FONT>        }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /**<a name="line.93"></a>
+<FONT color="green">094</FONT>         * Translate a string to a given locale.<a name="line.94"></a>
+<FONT color="green">095</FONT>         * @param s string to translate<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @param locale locale into which to translate the string<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @return translated string or original string<a name="line.97"></a>
+<FONT color="green">098</FONT>         * for unsupported locales or unknown strings<a name="line.98"></a>
+<FONT color="green">099</FONT>         */<a name="line.99"></a>
+<FONT color="green">100</FONT>        private static String translate(final String s, final Locale locale) {<a name="line.100"></a>
+<FONT color="green">101</FONT>            try {<a name="line.101"></a>
+<FONT color="green">102</FONT>                ResourceBundle bundle =<a name="line.102"></a>
+<FONT color="green">103</FONT>                        ResourceBundle.getBundle("org.apache.commons.math.MessagesResources", locale);<a name="line.103"></a>
+<FONT color="green">104</FONT>                if (bundle.getLocale().getLanguage().equals(locale.getLanguage())) {<a name="line.104"></a>
+<FONT color="green">105</FONT>                    // the value of the resource is the translated string<a name="line.105"></a>
+<FONT color="green">106</FONT>                    return bundle.getString(s);<a name="line.106"></a>
+<FONT color="green">107</FONT>                }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>            } catch (MissingResourceException mre) {<a name="line.109"></a>
+<FONT color="green">110</FONT>                // do nothing here<a name="line.110"></a>
+<FONT color="green">111</FONT>            }<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>            // the locale is not supported or the resource is unknown<a name="line.113"></a>
+<FONT color="green">114</FONT>            // don't translate and fall back to using the string as is<a name="line.114"></a>
+<FONT color="green">115</FONT>            return s;<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>        }<a name="line.117"></a>
+<FONT color="green">118</FONT>    <a name="line.118"></a>
+<FONT color="green">119</FONT>        /**<a name="line.119"></a>
+<FONT color="green">120</FONT>         * Builds a message string by from a pattern and its arguments.<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @param locale Locale in which the message should be translated<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @param pattern format specifier<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @param arguments format arguments<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @return a message string<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        private static String buildMessage(final Locale locale, final String pattern,<a name="line.126"></a>
+<FONT color="green">127</FONT>                                           final Object ... arguments) {<a name="line.127"></a>
+<FONT color="green">128</FONT>            return (pattern == null) ? "" : new MessageFormat(translate(pattern, locale), locale).format(arguments);<a name="line.128"></a>
+<FONT color="green">129</FONT>        }<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>        /** Gets the pattern used to build the message of this throwable.<a name="line.131"></a>
+<FONT color="green">132</FONT>         *<a name="line.132"></a>
+<FONT color="green">133</FONT>         * @return the pattern used to build the message of this throwable<a name="line.133"></a>
+<FONT color="green">134</FONT>         */<a name="line.134"></a>
+<FONT color="green">135</FONT>        public String getPattern() {<a name="line.135"></a>
+<FONT color="green">136</FONT>            return pattern;<a name="line.136"></a>
+<FONT color="green">137</FONT>        }<a name="line.137"></a>
+<FONT color="green">138</FONT>    <a name="line.138"></a>
+<FONT color="green">139</FONT>        /** Gets the arguments used to build the message of this throwable.<a name="line.139"></a>
+<FONT color="green">140</FONT>         *<a name="line.140"></a>
+<FONT color="green">141</FONT>         * @return the arguments used to build the message of this throwable<a name="line.141"></a>
+<FONT color="green">142</FONT>         */<a name="line.142"></a>
+<FONT color="green">143</FONT>        public Object[] getArguments() {<a name="line.143"></a>
+<FONT color="green">144</FONT>            return arguments.clone();<a name="line.144"></a>
+<FONT color="green">145</FONT>        }<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>        /** Gets the message in a specified locale.<a name="line.147"></a>
+<FONT color="green">148</FONT>         *<a name="line.148"></a>
+<FONT color="green">149</FONT>         * @param locale Locale in which the message should be translated<a name="line.149"></a>
+<FONT color="green">150</FONT>         *<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @return localized message<a name="line.151"></a>
+<FONT color="green">152</FONT>         */<a name="line.152"></a>
+<FONT color="green">153</FONT>        public String getMessage(final Locale locale) {<a name="line.153"></a>
+<FONT color="green">154</FONT>            return buildMessage(locale, pattern, arguments);<a name="line.154"></a>
+<FONT color="green">155</FONT>        }<a name="line.155"></a>
+<FONT color="green">156</FONT>    <a name="line.156"></a>
+<FONT color="green">157</FONT>        /** {@inheritDoc} */<a name="line.157"></a>
+<FONT color="green">158</FONT>        @Override<a name="line.158"></a>
+<FONT color="green">159</FONT>        public String getMessage() {<a name="line.159"></a>
+<FONT color="green">160</FONT>            return getMessage(Locale.US);<a name="line.160"></a>
+<FONT color="green">161</FONT>        }<a name="line.161"></a>
+<FONT color="green">162</FONT>    <a name="line.162"></a>
+<FONT color="green">163</FONT>        /** {@inheritDoc} */<a name="line.163"></a>
+<FONT color="green">164</FONT>        @Override<a name="line.164"></a>
+<FONT color="green">165</FONT>        public String getLocalizedMessage() {<a name="line.165"></a>
+<FONT color="green">166</FONT>            return getMessage(Locale.getDefault());<a name="line.166"></a>
+<FONT color="green">167</FONT>        }<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>        /**<a name="line.169"></a>
+<FONT color="green">170</FONT>         * Prints the stack trace of this exception to the standard error stream.<a name="line.170"></a>
+<FONT color="green">171</FONT>         */<a name="line.171"></a>
+<FONT color="green">172</FONT>        @Override<a name="line.172"></a>
+<FONT color="green">173</FONT>        public void printStackTrace() {<a name="line.173"></a>
+<FONT color="green">174</FONT>            printStackTrace(System.err);<a name="line.174"></a>
+<FONT color="green">175</FONT>        }<a name="line.175"></a>
+<FONT color="green">176</FONT>    <a name="line.176"></a>
+<FONT color="green">177</FONT>        /**<a name="line.177"></a>
+<FONT color="green">178</FONT>         * Prints the stack trace of this exception to the specified stream.<a name="line.178"></a>
+<FONT color="green">179</FONT>         *<a name="line.179"></a>
+<FONT color="green">180</FONT>         * @param out  the &lt;code&gt;PrintStream&lt;/code&gt; to use for output<a name="line.180"></a>
+<FONT color="green">181</FONT>         */<a name="line.181"></a>
+<FONT color="green">182</FONT>        @Override<a name="line.182"></a>
+<FONT color="green">183</FONT>        public void printStackTrace(final PrintStream out) {<a name="line.183"></a>
+<FONT color="green">184</FONT>            synchronized (out) {<a name="line.184"></a>
+<FONT color="green">185</FONT>                PrintWriter pw = new PrintWriter(out, false);<a name="line.185"></a>
+<FONT color="green">186</FONT>                printStackTrace(pw);<a name="line.186"></a>
+<FONT color="green">187</FONT>                // Flush the PrintWriter before it's GC'ed.<a name="line.187"></a>
+<FONT color="green">188</FONT>                pw.flush();<a name="line.188"></a>
+<FONT color="green">189</FONT>            }<a name="line.189"></a>
+<FONT color="green">190</FONT>        }<a name="line.190"></a>
+<FONT color="green">191</FONT>    <a name="line.191"></a>
+<FONT color="green">192</FONT>        /**<a name="line.192"></a>
+<FONT color="green">193</FONT>         * Constructs a new &lt;code&gt;ArithmeticException&lt;/code&gt; with specified formatted detail message.<a name="line.193"></a>
+<FONT color="green">194</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @param pattern format specifier<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @param arguments format arguments<a name="line.196"></a>
+<FONT color="green">197</FONT>         * @return built exception<a name="line.197"></a>
+<FONT color="green">198</FONT>         */<a name="line.198"></a>
+<FONT color="green">199</FONT>        public static ArithmeticException createArithmeticException(final String pattern,<a name="line.199"></a>
+<FONT color="green">200</FONT>                                                                    final Object ... arguments) {<a name="line.200"></a>
+<FONT color="green">201</FONT>            return new ArithmeticException() {<a name="line.201"></a>
+<FONT color="green">202</FONT>    <a name="line.202"></a>
+<FONT color="green">203</FONT>                /** Serializable version identifier. */<a name="line.203"></a>
+<FONT color="green">204</FONT>                private static final long serialVersionUID = 7705628723242533939L;<a name="line.204"></a>
+<FONT color="green">205</FONT>    <a name="line.205"></a>
+<FONT color="green">206</FONT>                /** {@inheritDoc} */<a name="line.206"></a>
+<FONT color="green">207</FONT>                @Override<a name="line.207"></a>
+<FONT color="green">208</FONT>                public String getMessage() {<a name="line.208"></a>
+<FONT color="green">209</FONT>                    return buildMessage(Locale.US, pattern, arguments);<a name="line.209"></a>
+<FONT color="green">210</FONT>                }<a name="line.210"></a>
+<FONT color="green">211</FONT>    <a name="line.211"></a>
+<FONT color="green">212</FONT>                /** {@inheritDoc} */<a name="line.212"></a>
+<FONT color="green">213</FONT>                @Override<a name="line.213"></a>
+<FONT color="green">214</FONT>                public String getLocalizedMessage() {<a name="line.214"></a>
+<FONT color="green">215</FONT>                    return buildMessage(Locale.getDefault(), pattern, arguments);<a name="line.215"></a>
+<FONT color="green">216</FONT>                }<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>            };<a name="line.218"></a>
+<FONT color="green">219</FONT>        }<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>        /**<a name="line.221"></a>
+<FONT color="green">222</FONT>         * Constructs a new &lt;code&gt;ArrayIndexOutOfBoundsException&lt;/code&gt; with specified formatted detail message.<a name="line.222"></a>
+<FONT color="green">223</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.223"></a>
+<FONT color="green">224</FONT>         * @param pattern format specifier<a name="line.224"></a>
+<FONT color="green">225</FONT>         * @param arguments format arguments<a name="line.225"></a>
+<FONT color="green">226</FONT>         * @return built exception<a name="line.226"></a>
+<FONT color="green">227</FONT>         */<a name="line.227"></a>
+<FONT color="green">228</FONT>        public static ArrayIndexOutOfBoundsException createArrayIndexOutOfBoundsException(final String pattern,<a name="line.228"></a>
+<FONT color="green">229</FONT>                                                                                          final Object ... arguments) {<a name="line.229"></a>
+<FONT color="green">230</FONT>            return new ArrayIndexOutOfBoundsException() {<a name="line.230"></a>
+<FONT color="green">231</FONT>    <a name="line.231"></a>
+<FONT color="green">232</FONT>                /** Serializable version identifier. */<a name="line.232"></a>
+<FONT color="green">233</FONT>                private static final long serialVersionUID = -3394748305449283486L;<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>                /** {@inheritDoc} */<a name="line.235"></a>
+<FONT color="green">236</FONT>                @Override<a name="line.236"></a>
+<FONT color="green">237</FONT>                public String getMessage() {<a name="line.237"></a>
+<FONT color="green">238</FONT>                    return buildMessage(Locale.US, pattern, arguments);<a name="line.238"></a>
+<FONT color="green">239</FONT>                }<a name="line.239"></a>
+<FONT color="green">240</FONT>    <a name="line.240"></a>
+<FONT color="green">241</FONT>                /** {@inheritDoc} */<a name="line.241"></a>
+<FONT color="green">242</FONT>                @Override<a name="line.242"></a>
+<FONT color="green">243</FONT>                public String getLocalizedMessage() {<a name="line.243"></a>
+<FONT color="green">244</FONT>                    return buildMessage(Locale.getDefault(), pattern, arguments);<a name="line.244"></a>
+<FONT color="green">245</FONT>                }<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>            };<a name="line.247"></a>
+<FONT color="green">248</FONT>        }<a name="line.248"></a>
+<FONT color="green">249</FONT>    <a name="line.249"></a>
+<FONT color="green">250</FONT>        /**<a name="line.250"></a>
+<FONT color="green">251</FONT>         * Constructs a new &lt;code&gt;EOFException&lt;/code&gt; with specified formatted detail message.<a name="line.251"></a>
+<FONT color="green">252</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.252"></a>
+<FONT color="green">253</FONT>         * @param pattern format specifier<a name="line.253"></a>
+<FONT color="green">254</FONT>         * @param arguments format arguments<a name="line.254"></a>
+<FONT color="green">255</FONT>         * @return built exception<a name="line.255"></a>
+<FONT color="green">256</FONT>         */<a name="line.256"></a>
+<FONT color="green">257</FONT>        public static EOFException createEOFException(final String pattern,<a name="line.257"></a>
+<FONT color="green">258</FONT>                                                      final Object ... arguments) {<a name="line.258"></a>
+<FONT color="green">259</FONT>            return new EOFException() {<a name="line.259"></a>
+<FONT color="green">260</FONT>    <a name="line.260"></a>
+<FONT color="green">261</FONT>                /** Serializable version identifier. */<a name="line.261"></a>
+<FONT color="green">262</FONT>                private static final long serialVersionUID = 279461544586092584L;<a name="line.262"></a>
+<FONT color="green">263</FONT>    <a name="line.263"></a>
+<FONT color="green">264</FONT>                /** {@inheritDoc} */<a name="line.264"></a>
+<FONT color="green">265</FONT>                @Override<a name="line.265"></a>
+<FONT color="green">266</FONT>                public String getMessage() {<a name="line.266"></a>
+<FONT color="green">267</FONT>                    return buildMessage(Locale.US, pattern, arguments);<a name="line.267"></a>
+<FONT color="green">268</FONT>                }<a name="line.268"></a>
+<FONT color="green">269</FONT>    <a name="line.269"></a>
+<FONT color="green">270</FONT>                /** {@inheritDoc} */<a name="line.270"></a>
+<FONT color="green">271</FONT>                @Override<a name="line.271"></a>
+<FONT color="green">272</FONT>                public String getLocalizedMessage() {<a name="line.272"></a>
+<FONT color="green">273</FONT>                    return buildMessage(Locale.getDefault(), pattern, arguments);<a name="line.273"></a>
+<FONT color="green">274</FONT>                }<a name="line.274"></a>
+<FONT color="green">275</FONT>    <a name="line.275"></a>
+<FONT color="green">276</FONT>            };<a name="line.276"></a>
+<FONT color="green">277</FONT>        }<a name="line.277"></a>
+<FONT color="green">278</FONT>    <a name="line.278"></a>
+<FONT color="green">279</FONT>        /**<a name="line.279"></a>
+<FONT color="green">280</FONT>         * Constructs a new &lt;code&gt;IOException&lt;/code&gt; with specified nested<a name="line.280"></a>
+<FONT color="green">281</FONT>         * &lt;code&gt;Throwable&lt;/code&gt; root cause.<a name="line.281"></a>
+<FONT color="green">282</FONT>         * &lt;p&gt;This factory method allows chaining of other exceptions within an<a name="line.282"></a>
+<FONT color="green">283</FONT>         * &lt;code&gt;IOException&lt;/code&gt; even for Java 5. The constructor for<a name="line.283"></a>
+<FONT color="green">284</FONT>         * &lt;code&gt;IOException&lt;/code&gt; with a cause parameter was introduced only<a name="line.284"></a>
+<FONT color="green">285</FONT>         * with Java 6.&lt;/p&gt;<a name="line.285"></a>
+<FONT color="green">286</FONT>         * @param rootCause the exception or error that caused this exception<a name="line.286"></a>
+<FONT color="green">287</FONT>         * to be thrown.<a name="line.287"></a>
+<FONT color="green">288</FONT>         * @return built exception<a name="line.288"></a>
+<FONT color="green">289</FONT>         */<a name="line.289"></a>
+<FONT color="green">290</FONT>        public static IOException createIOException(final Throwable rootCause) {<a name="line.290"></a>
+<FONT color="green">291</FONT>            IOException ioe = new IOException(rootCause.getLocalizedMessage());<a name="line.291"></a>
+<FONT color="green">292</FONT>            ioe.initCause(rootCause);<a name="line.292"></a>
+<FONT color="green">293</FONT>            return ioe;<a name="line.293"></a>
+<FONT color="green">294</FONT>        }<a name="line.294"></a>
+<FONT color="green">295</FONT>    <a name="line.295"></a>
+<FONT color="green">296</FONT>        /**<a name="line.296"></a>
+<FONT color="green">297</FONT>         * Constructs a new &lt;code&gt;IllegalArgumentException&lt;/code&gt; with specified formatted detail message.<a name="line.297"></a>
+<FONT color="green">298</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.298"></a>
+<FONT color="green">299</FONT>         * @param pattern format specifier<a name="line.299"></a>
+<FONT color="green">300</FONT>         * @param arguments format arguments<a name="line.300"></a>
+<FONT color="green">301</FONT>         * @return built exception<a name="line.301"></a>
+<FONT color="green">302</FONT>         */<a name="line.302"></a>
+<FONT color="green">303</FONT>        public static IllegalArgumentException createIllegalArgumentException(final String pattern,<a name="line.303"></a>
+<FONT color="green">304</FONT>                                                                              final Object ... arguments) {<a name="line.304"></a>
+<FONT color="green">305</FONT>            return new IllegalArgumentException() {<a name="line.305"></a>
+<FONT color="green">306</FONT>    <a name="line.306"></a>
+<FONT color="green">307</FONT>                /** Serializable version identifier. */<a name="line.307"></a>
+<FONT color="green">308</FONT>                private static final long serialVersionUID = -6555453980658317913L;<a name="line.308"></a>
+<FONT color="green">309</FONT>    <a name="line.309"></a>
+<FONT color="green">310</FONT>                /** {@inheritDoc} */<a name="line.310"></a>
+<FONT color="green">311</FONT>                @Override<a name="line.311"></a>
+<FONT color="green">312</FONT>                public String getMessage() {<a name="line.312"></a>
+<FONT color="green">313</FONT>                    return buildMessage(Locale.US, pattern, arguments);<a name="line.313"></a>
+<FONT color="green">314</FONT>                }<a name="line.314"></a>
+<FONT color="green">315</FONT>    <a name="line.315"></a>
+<FONT color="green">316</FONT>                /** {@inheritDoc} */<a name="line.316"></a>
+<FONT color="green">317</FONT>                @Override<a name="line.317"></a>
+<FONT color="green">318</FONT>                public String getLocalizedMessage() {<a name="line.318"></a>
+<FONT color="green">319</FONT>                    return buildMessage(Locale.getDefault(), pattern, arguments);<a name="line.319"></a>
+<FONT color="green">320</FONT>                }<a name="line.320"></a>
+<FONT color="green">321</FONT>    <a name="line.321"></a>
+<FONT color="green">322</FONT>            };<a name="line.322"></a>
+<FONT color="green">323</FONT>        }<a name="line.323"></a>
+<FONT color="green">324</FONT>    <a name="line.324"></a>
+<FONT color="green">325</FONT>        /**<a name="line.325"></a>
+<FONT color="green">326</FONT>         * Constructs a new &lt;code&gt;IllegalArgumentException&lt;/code&gt; with specified nested<a name="line.326"></a>
+<FONT color="green">327</FONT>         * &lt;code&gt;Throwable&lt;/code&gt; root cause.<a name="line.327"></a>
+<FONT color="green">328</FONT>         * @param rootCause the exception or error that caused this exception<a name="line.328"></a>
+<FONT color="green">329</FONT>         * to be thrown.<a name="line.329"></a>
+<FONT color="green">330</FONT>         * @return built exception<a name="line.330"></a>
+<FONT color="green">331</FONT>         */<a name="line.331"></a>
+<FONT color="green">332</FONT>        public static IllegalArgumentException createIllegalArgumentException(final Throwable rootCause) {<a name="line.332"></a>
+<FONT color="green">333</FONT>            IllegalArgumentException iae = new IllegalArgumentException(rootCause.getLocalizedMessage());<a name="line.333"></a>
+<FONT color="green">334</FONT>            iae.initCause(rootCause);<a name="line.334"></a>
+<FONT color="green">335</FONT>            return iae;<a name="line.335"></a>
+<FONT color="green">336</FONT>        }<a name="line.336"></a>
+<FONT color="green">337</FONT>    <a name="line.337"></a>
+<FONT color="green">338</FONT>        /**<a name="line.338"></a>
+<FONT color="green">339</FONT>         * Constructs a new &lt;code&gt;IllegalStateException&lt;/code&gt; with specified formatted detail message.<a name="line.339"></a>
+<FONT color="green">340</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.340"></a>
+<FONT color="green">341</FONT>         * @param pattern format specifier<a name="line.341"></a>
+<FONT color="green">342</FONT>         * @param arguments format arguments<a name="line.342"></a>
+<FONT color="green">343</FONT>         * @return built exception<a name="line.343"></a>
+<FONT color="green">344</FONT>         */<a name="line.344"></a>
+<FONT color="green">345</FONT>        public static IllegalStateException createIllegalStateException(final String pattern,<a name="line.345"></a>
+<FONT color="green">346</FONT>                                                                        final Object ... arguments) {<a name="line.346"></a>
+<FONT color="green">347</FONT>            return new IllegalStateException() {<a name="line.347"></a>
+<FONT color="green">348</FONT>    <a name="line.348"></a>
+<FONT color="green">349</FONT>                /** Serializable version identifier. */<a name="line.349"></a>
+<FONT color="green">350</FONT>                private static final long serialVersionUID = -95247648156277208L;<a name="line.350"></a>
+<FONT color="green">351</FONT>    <a name="line.351"></a>
+<FONT color="green">352</FONT>                /** {@inheritDoc} */<a name="line.352"></a>
+<FONT color="green">353</FONT>                @Override<a name="line.353"></a>
+<FONT color="green">354</FONT>                public String getMessage() {<a name="line.354"></a>
+<FONT color="green">355</FONT>                    return buildMessage(Locale.US, pattern, arguments);<a name="line.355"></a>
+<FONT color="green">356</FONT>                }<a name="line.356"></a>
+<FONT color="green">357</FONT>    <a name="line.357"></a>
+<FONT color="green">358</FONT>                /** {@inheritDoc} */<a name="line.358"></a>
+<FONT color="green">359</FONT>                @Override<a name="line.359"></a>
+<FONT color="green">360</FONT>                public String getLocalizedMessage() {<a name="line.360"></a>
+<FONT color="green">361</FONT>                    return buildMessage(Locale.getDefault(), pattern, arguments);<a name="line.361"></a>
+<FONT color="green">362</FONT>                }<a name="line.362"></a>
+<FONT color="green">363</FONT>    <a name="line.363"></a>
+<FONT color="green">364</FONT>            };<a name="line.364"></a>
+<FONT color="green">365</FONT>        }<a name="line.365"></a>
+<FONT color="green">366</FONT>    <a name="line.366"></a>
+<FONT color="green">367</FONT>        /**<a name="line.367"></a>
+<FONT color="green">368</FONT>         * Constructs a new &lt;code&gt;ConcurrentModificationException&lt;/code&gt; with specified formatted detail message.<a name="line.368"></a>
+<FONT color="green">369</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.369"></a>
+<FONT color="green">370</FONT>         * @param pattern format specifier<a name="line.370"></a>
+<FONT color="green">371</FONT>         * @param arguments format arguments<a name="line.371"></a>
+<FONT color="green">372</FONT>         * @return built exception<a name="line.372"></a>
+<FONT color="green">373</FONT>         */<a name="line.373"></a>
+<FONT color="green">374</FONT>        public static ConcurrentModificationException createConcurrentModificationException(final String pattern,<a name="line.374"></a>
+<FONT color="green">375</FONT>                                                                                            final Object ... arguments) {<a name="line.375"></a>
+<FONT color="green">376</FONT>            return new ConcurrentModificationException() {<a name="line.376"></a>
+<FONT color="green">377</FONT>    <a name="line.377"></a>
+<FONT color="green">378</FONT>                /** Serializable version identifier. */<a name="line.378"></a>
+<FONT color="green">379</FONT>                private static final long serialVersionUID = 6134247282754009421L;<a name="line.379"></a>
+<FONT color="green">380</FONT>    <a name="line.380"></a>
+<FONT color="green">381</FONT>                /** {@inheritDoc} */<a name="line.381"></a>
+<FONT color="green">382</FONT>                @Override<a name="line.382"></a>
+<FONT color="green">383</FONT>                public String getMessage() {<a name="line.383"></a>
+<FONT color="green">384</FONT>                    return buildMessage(Locale.US, pattern, arguments);<a name="line.384"></a>
+<FONT color="green">385</FONT>                }<a name="line.385"></a>
+<FONT color="green">386</FONT>    <a name="line.386"></a>
+<FONT color="green">387</FONT>                /** {@inheritDoc} */<a name="line.387"></a>
+<FONT color="green">388</FONT>                @Override<a name="line.388"></a>
+<FONT color="green">389</FONT>                public String getLocalizedMessage() {<a name="line.389"></a>
+<FONT color="green">390</FONT>                    return buildMessage(Locale.getDefault(), pattern, arguments);<a name="line.390"></a>
+<FONT color="green">391</FONT>                }<a name="line.391"></a>
+<FONT color="green">392</FONT>    <a name="line.392"></a>
+<FONT color="green">393</FONT>            };<a name="line.393"></a>
+<FONT color="green">394</FONT>        }<a name="line.394"></a>
+<FONT color="green">395</FONT>    <a name="line.395"></a>
+<FONT color="green">396</FONT>        /**<a name="line.396"></a>
+<FONT color="green">397</FONT>         * Constructs a new &lt;code&gt;NoSuchElementException&lt;/code&gt; with specified formatted detail message.<a name="line.397"></a>
+<FONT color="green">398</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.398"></a>
+<FONT color="green">399</FONT>         * @param pattern format specifier<a name="line.399"></a>
+<FONT color="green">400</FONT>         * @param arguments format arguments<a name="line.400"></a>
+<FONT color="green">401</FONT>         * @return built exception<a name="line.401"></a>
+<FONT color="green">402</FONT>         */<a name="line.402"></a>
+<FONT color="green">403</FONT>        public static NoSuchElementException createNoSuchElementException(final String pattern,<a name="line.403"></a>
+<FONT color="green">404</FONT>                                                                          final Object ... arguments) {<a name="line.404"></a>
+<FONT color="green">405</FONT>            return new NoSuchElementException() {<a name="line.405"></a>
+<FONT color="green">406</FONT>    <a name="line.406"></a>
+<FONT color="green">407</FONT>                /** Serializable version identifier. */<a name="line.407"></a>
+<FONT color="green">408</FONT>                private static final long serialVersionUID = 7304273322489425799L;<a name="line.408"></a>
+<FONT color="green">409</FONT>    <a name="line.409"></a>
+<FONT color="green">410</FONT>                /** {@inheritDoc} */<a name="line.410"></a>
+<FONT color="green">411</FONT>                @Override<a name="line.411"></a>
+<FONT color="green">412</FONT>                public String getMessage() {<a name="line.412"></a>
+<FONT color="green">413</FONT>                    return buildMessage(Locale.US, pattern, arguments);<a name="line.413"></a>
+<FONT color="green">414</FONT>                }<a name="line.414"></a>
+<FONT color="green">415</FONT>    <a name="line.415"></a>
+<FONT color="green">416</FONT>                /** {@inheritDoc} */<a name="line.416"></a>
+<FONT color="green">417</FONT>                @Override<a name="line.417"></a>
+<FONT color="green">418</FONT>                public String getLocalizedMessage() {<a name="line.418"></a>
+<FONT color="green">419</FONT>                    return buildMessage(Locale.getDefault(), pattern, arguments);<a name="line.419"></a>
+<FONT color="green">420</FONT>                }<a name="line.420"></a>
+<FONT color="green">421</FONT>    <a name="line.421"></a>
+<FONT color="green">422</FONT>            };<a name="line.422"></a>
+<FONT color="green">423</FONT>        }<a name="line.423"></a>
+<FONT color="green">424</FONT>    <a name="line.424"></a>
+<FONT color="green">425</FONT>        /**<a name="line.425"></a>
+<FONT color="green">426</FONT>         * Constructs a new &lt;code&gt;NullPointerException&lt;/code&gt; with specified formatted detail message.<a name="line.426"></a>
+<FONT color="green">427</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.427"></a>
+<FONT color="green">428</FONT>         * @param pattern format specifier<a name="line.428"></a>
+<FONT color="green">429</FONT>         * @param arguments format arguments<a name="line.429"></a>
+<FONT color="green">430</FONT>         * @return built exception<a name="line.430"></a>
+<FONT color="green">431</FONT>         */<a name="line.431"></a>
+<FONT color="green">432</FONT>        public static NullPointerException createNullPointerException(final String pattern,<a name="line.432"></a>
+<FONT color="green">433</FONT>                                                                      final Object ... arguments) {<a name="line.433"></a>
+<FONT color="green">434</FONT>            return new NullPointerException() {<a name="line.434"></a>
+<FONT color="green">435</FONT>    <a name="line.435"></a>
+<FONT color="green">436</FONT>                /** Serializable version identifier. */<a name="line.436"></a>
+<FONT color="green">437</FONT>                private static final long serialVersionUID = -3075660477939965216L;<a name="line.437"></a>
+<FONT color="green">438</FONT>    <a name="line.438"></a>
+<FONT color="green">439</FONT>                /** {@inheritDoc} */<a name="line.439"></a>
+<FONT color="green">440</FONT>                @Override<a name="line.440"></a>
+<FONT color="green">441</FONT>                public String getMessage() {<a name="line.441"></a>
+<FONT color="green">442</FONT>                    return buildMessage(Locale.US, pattern, arguments);<a name="line.442"></a>
+<FONT color="green">443</FONT>                }<a name="line.443"></a>
+<FONT color="green">444</FONT>    <a name="line.444"></a>
+<FONT color="green">445</FONT>                /** {@inheritDoc} */<a name="line.445"></a>
+<FONT color="green">446</FONT>                @Override<a name="line.446"></a>
+<FONT color="green">447</FONT>                public String getLocalizedMessage() {<a name="line.447"></a>
+<FONT color="green">448</FONT>                    return buildMessage(Locale.getDefault(), pattern, arguments);<a name="line.448"></a>
+<FONT color="green">449</FONT>                }<a name="line.449"></a>
+<FONT color="green">450</FONT>    <a name="line.450"></a>
+<FONT color="green">451</FONT>            };<a name="line.451"></a>
+<FONT color="green">452</FONT>        }<a name="line.452"></a>
+<FONT color="green">453</FONT>    <a name="line.453"></a>
+<FONT color="green">454</FONT>       /**<a name="line.454"></a>
+<FONT color="green">455</FONT>         * Constructs a new &lt;code&gt;ParseException&lt;/code&gt; with specified<a name="line.455"></a>
+<FONT color="green">456</FONT>         * formatted detail message.<a name="line.456"></a>
+<FONT color="green">457</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.457"></a>
+<FONT color="green">458</FONT>         * @param offset offset at which error occurred<a name="line.458"></a>
+<FONT color="green">459</FONT>         * @param pattern format specifier<a name="line.459"></a>
+<FONT color="green">460</FONT>         * @param arguments format arguments<a name="line.460"></a>
+<FONT color="green">461</FONT>         * @return built exception<a name="line.461"></a>
+<FONT color="green">462</FONT>         */<a name="line.462"></a>
+<FONT color="green">463</FONT>        public static ParseException createParseException(final int offset,<a name="line.463"></a>
+<FONT color="green">464</FONT>                                                          final String pattern,<a name="line.464"></a>
+<FONT color="green">465</FONT>                                                          final Object ... arguments) {<a name="line.465"></a>
+<FONT color="green">466</FONT>            return new ParseException(null, offset) {<a name="line.466"></a>
+<FONT color="green">467</FONT>    <a name="line.467"></a>
+<FONT color="green">468</FONT>                /** Serializable version identifier. */<a name="line.468"></a>
+<FONT color="green">469</FONT>                private static final long serialVersionUID = -1103502177342465975L;<a name="line.469"></a>
+<FONT color="green">470</FONT>    <a name="line.470"></a>
+<FONT color="green">471</FONT>                /** {@inheritDoc} */<a name="line.471"></a>
+<FONT color="green">472</FONT>                @Override<a name="line.472"></a>
+<FONT color="green">473</FONT>                public String getMessage() {<a name="line.473"></a>
+<FONT color="green">474</FONT>                    return buildMessage(Locale.US, pattern, arguments);<a name="line.474"></a>
+<FONT color="green">475</FONT>                }<a name="line.475"></a>
+<FONT color="green">476</FONT>    <a name="line.476"></a>
+<FONT color="green">477</FONT>                /** {@inheritDoc} */<a name="line.477"></a>
+<FONT color="green">478</FONT>                @Override<a name="line.478"></a>
+<FONT color="green">479</FONT>                public String getLocalizedMessage() {<a name="line.479"></a>
+<FONT color="green">480</FONT>                    return buildMessage(Locale.getDefault(), pattern, arguments);<a name="line.480"></a>
+<FONT color="green">481</FONT>                }<a name="line.481"></a>
+<FONT color="green">482</FONT>    <a name="line.482"></a>
+<FONT color="green">483</FONT>            };<a name="line.483"></a>
+<FONT color="green">484</FONT>        }<a name="line.484"></a>
+<FONT color="green">485</FONT>    <a name="line.485"></a>
+<FONT color="green">486</FONT>        /** Create an {@link java.lang.RuntimeException} for an internal error.<a name="line.486"></a>
+<FONT color="green">487</FONT>         * @param cause underlying cause<a name="line.487"></a>
+<FONT color="green">488</FONT>         * @return an {@link java.lang.RuntimeException} for an internal error<a name="line.488"></a>
+<FONT color="green">489</FONT>         */<a name="line.489"></a>
+<FONT color="green">490</FONT>        public static RuntimeException createInternalError(final Throwable cause) {<a name="line.490"></a>
+<FONT color="green">491</FONT>    <a name="line.491"></a>
+<FONT color="green">492</FONT>            final String pattern  = "internal error, please fill a bug report at {0}";<a name="line.492"></a>
+<FONT color="green">493</FONT>            final String argument = "https://issues.apache.org/jira/browse/MATH";<a name="line.493"></a>
+<FONT color="green">494</FONT>    <a name="line.494"></a>
+<FONT color="green">495</FONT>            return new RuntimeException() {<a name="line.495"></a>
+<FONT color="green">496</FONT>    <a name="line.496"></a>
+<FONT color="green">497</FONT>                /** Serializable version identifier. */<a name="line.497"></a>
+<FONT color="green">498</FONT>                private static final long serialVersionUID = -201865440834027016L;<a name="line.498"></a>
+<FONT color="green">499</FONT>    <a name="line.499"></a>
+<FONT color="green">500</FONT>                /** {@inheritDoc} */<a name="line.500"></a>
+<FONT color="green">501</FONT>                @Override<a name="line.501"></a>
+<FONT color="green">502</FONT>                public String getMessage() {<a name="line.502"></a>
+<FONT color="green">503</FONT>                    return buildMessage(Locale.US, pattern, argument);<a name="line.503"></a>
+<FONT color="green">504</FONT>                }<a name="line.504"></a>
+<FONT color="green">505</FONT>    <a name="line.505"></a>
+<FONT color="green">506</FONT>                /** {@inheritDoc} */<a name="line.506"></a>
+<FONT color="green">507</FONT>                @Override<a name="line.507"></a>
+<FONT color="green">508</FONT>                public String getLocalizedMessage() {<a name="line.508"></a>
+<FONT color="green">509</FONT>                    return buildMessage(Locale.getDefault(), pattern, argument);<a name="line.509"></a>
+<FONT color="green">510</FONT>                }<a name="line.510"></a>
+<FONT color="green">511</FONT>    <a name="line.511"></a>
+<FONT color="green">512</FONT>            };<a name="line.512"></a>
+<FONT color="green">513</FONT>    <a name="line.513"></a>
+<FONT color="green">514</FONT>        }<a name="line.514"></a>
+<FONT color="green">515</FONT>    <a name="line.515"></a>
+<FONT color="green">516</FONT>    }<a name="line.516"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/MaxEvaluationsExceededException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,133 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Error thrown when a numerical computation exceeds its allowed<a name="line.23"></a>
+<FONT color="green">024</FONT>     * number of functions evaluations.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 779273 $ $Date: 2009-05-27 14:54:48 -0400 (Wed, 27 May 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @since 2.0<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public class MaxEvaluationsExceededException extends ConvergenceException {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /** Serializable version identifier. */<a name="line.31"></a>
+<FONT color="green">032</FONT>        private static final long serialVersionUID = -5921271447220129118L;<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /** Maximal number of evaluations allowed. */<a name="line.34"></a>
+<FONT color="green">035</FONT>        private final int maxEvaluations;<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /**<a name="line.37"></a>
+<FONT color="green">038</FONT>         * Constructs an exception with specified formatted detail message.<a name="line.38"></a>
+<FONT color="green">039</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @param maxEvaluations maximal number of evaluations allowed<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        public MaxEvaluationsExceededException(final int maxEvaluations) {<a name="line.42"></a>
+<FONT color="green">043</FONT>            super("Maximal number of evaluations ({0}) exceeded", maxEvaluations);<a name="line.43"></a>
+<FONT color="green">044</FONT>            this.maxEvaluations = maxEvaluations;<a name="line.44"></a>
+<FONT color="green">045</FONT>        }<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Constructs an exception with specified formatted detail message.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @param maxEvaluations the exceeded maximal number of evaluations<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @param pattern format specifier<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @param arguments format arguments<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        public MaxEvaluationsExceededException(final int maxEvaluations,<a name="line.54"></a>
+<FONT color="green">055</FONT>                                              final String pattern, final Object ... arguments) {<a name="line.55"></a>
+<FONT color="green">056</FONT>            super(pattern, arguments);<a name="line.56"></a>
+<FONT color="green">057</FONT>            this.maxEvaluations = maxEvaluations;<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Get the maximal number of evaluations allowed.<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @return maximal number of evaluations allowed<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        public int getMaxEvaluations() {<a name="line.63"></a>
+<FONT color="green">064</FONT>            return maxEvaluations;<a name="line.64"></a>
+<FONT color="green">065</FONT>        }<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>    }<a name="line.67"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/MaxIterationsExceededException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,133 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Error thrown when a numerical computation exceeds its allowed<a name="line.23"></a>
+<FONT color="green">024</FONT>     * number of iterations.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 746578 $ $Date: 2009-02-21 15:01:14 -0500 (Sat, 21 Feb 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @since 1.2<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public class MaxIterationsExceededException extends ConvergenceException {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /** Serializable version identifier. */<a name="line.31"></a>
+<FONT color="green">032</FONT>        private static final long serialVersionUID = -7821226672760574694L;<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /** Maximal number of iterations allowed. */<a name="line.34"></a>
+<FONT color="green">035</FONT>        private final int maxIterations;<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /**<a name="line.37"></a>
+<FONT color="green">038</FONT>         * Constructs an exception with specified formatted detail message.<a name="line.38"></a>
+<FONT color="green">039</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @param maxIterations maximal number of iterations allowed<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        public MaxIterationsExceededException(final int maxIterations) {<a name="line.42"></a>
+<FONT color="green">043</FONT>            super("Maximal number of iterations ({0}) exceeded", maxIterations);<a name="line.43"></a>
+<FONT color="green">044</FONT>            this.maxIterations = maxIterations;<a name="line.44"></a>
+<FONT color="green">045</FONT>        }<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Constructs an exception with specified formatted detail message.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @param maxIterations the exceeded maximal number of iterations<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @param pattern format specifier<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @param arguments format arguments<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        public MaxIterationsExceededException(final int maxIterations,<a name="line.54"></a>
+<FONT color="green">055</FONT>                                              final String pattern, final Object ... arguments) {<a name="line.55"></a>
+<FONT color="green">056</FONT>            super(pattern, arguments);<a name="line.56"></a>
+<FONT color="green">057</FONT>            this.maxIterations = maxIterations;<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Get the maximal number of iterations allowed.<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @return maximal number of iterations allowed<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        public int getMaxIterations() {<a name="line.63"></a>
+<FONT color="green">064</FONT>            return maxIterations;<a name="line.64"></a>
+<FONT color="green">065</FONT>        }<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>    }<a name="line.67"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/MessagesResources_fr.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,942 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.ListResourceBundle;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * French localization message resources for the commons-math library.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 927009 $ $Date: 2010-03-24 07:14:07 -0400 (Wed, 24 Mar 2010) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @since 1.2<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public class MessagesResources_fr<a name="line.27"></a>
+<FONT color="green">028</FONT>      extends ListResourceBundle {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>      /** Non-translated/translated messages arrays. */<a name="line.30"></a>
+<FONT color="green">031</FONT>      private static final Object[][] CONTENTS = {<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        // org.apache.commons.math.util.MathUtils<a name="line.33"></a>
+<FONT color="green">034</FONT>        { "must have n &gt;= k for binomial coefficient (n,k), got n = {0}, k = {1}",<a name="line.34"></a>
+<FONT color="green">035</FONT>          "n doit \u00eatre sup\u00e9rieur ou \u00e9gal \u00e0 k " +<a name="line.35"></a>
+<FONT color="green">036</FONT>          "pour le coefficient du bin\u00f4me (n,k), or n = {0}, k = {1}" },<a name="line.36"></a>
+<FONT color="green">037</FONT>        { "must have n &gt;= 0 for binomial coefficient (n,k), got n = {0}",<a name="line.37"></a>
+<FONT color="green">038</FONT>          "n doit \u00eatre positif pour le coefficient du bin\u00f4me (n,k), or n = {0}" },<a name="line.38"></a>
+<FONT color="green">039</FONT>        { "must have n &gt;= 0 for n!, got n = {0}",<a name="line.39"></a>
+<FONT color="green">040</FONT>          "n doit \u00eatre positif pour le calcul de n!, or n = {0}" },<a name="line.40"></a>
+<FONT color="green">041</FONT>        { "overflow: gcd({0}, {1}) is 2^31",<a name="line.41"></a>
+<FONT color="green">042</FONT>          "d\u00e9passement de capacit\u00e9 : le PGCD de {0} et {1} vaut 2^31" },<a name="line.42"></a>
+<FONT color="green">043</FONT>        { "overflow: gcd({0}, {1}) is 2^63",<a name="line.43"></a>
+<FONT color="green">044</FONT>          "d\u00e9passement de capacit\u00e9 : le PGCD de {0} et {1} vaut 2^63" },<a name="line.44"></a>
+<FONT color="green">045</FONT>        { "overflow: lcm({0}, {1}) is 2^31",<a name="line.45"></a>
+<FONT color="green">046</FONT>          "d\u00e9passement de capacit\u00e9 : le MCM de {0} et {1} vaut 2^31" },<a name="line.46"></a>
+<FONT color="green">047</FONT>        { "overflow: lcm({0}, {1}) is 2^63",<a name="line.47"></a>
+<FONT color="green">048</FONT>          "d\u00e9passement de capacit\u00e9 : le MCM de {0} et {1} vaut 2^63" },<a name="line.48"></a>
+<FONT color="green">049</FONT>        { "cannot raise an integral value to a negative power ({0}^{1})",<a name="line.49"></a>
+<FONT color="green">050</FONT>          "impossible d''\u00e9lever une valeur enti\u00e8re " +<a name="line.50"></a>
+<FONT color="green">051</FONT>          "\u00e0 une puissance n\u00e9gative ({0}^{1})" },<a name="line.51"></a>
+<FONT color="green">052</FONT>        { "invalid rounding method {0}, valid methods: {1} ({2}), {3} ({4}), {5} ({6}), {7} ({8}), {9} ({10}), {11} ({12}), {13} ({14}), {15} ({16})",<a name="line.52"></a>
+<FONT color="green">053</FONT>          "m\u00e9thode d''arondi {0} invalide, m\u00e9thodes valides : {1} ({2}), {3} ({4}), {5} ({6}), {7} ({8}), {9} ({10}), {11} ({12}), {13} ({14}), {15} ({16})" },<a name="line.53"></a>
+<FONT color="green">054</FONT>        { "Cannot normalize to an infinite value",<a name="line.54"></a>
+<FONT color="green">055</FONT>          "impossible de normaliser vers une valeur infinie" },<a name="line.55"></a>
+<FONT color="green">056</FONT>        { "Cannot normalize to NaN",<a name="line.56"></a>
+<FONT color="green">057</FONT>          "impossible de normaliser vers NaN" },<a name="line.57"></a>
+<FONT color="green">058</FONT>        { "Array contains an infinite element, {0} at index {1}",<a name="line.58"></a>
+<FONT color="green">059</FONT>          "le tableau contient l''\u00e9l\u00e9ment infini {0} \u00e0 l''index {1}" },<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        // org.apache.commons.math.FunctionEvaluationException<a name="line.61"></a>
+<FONT color="green">062</FONT>        { "evaluation failed for argument = {0}",<a name="line.62"></a>
+<FONT color="green">063</FONT>          "erreur d''\u00e9valuation pour l''argument {0}" },<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        // org.apache.commons.math.DuplicateSampleAbscissaException<a name="line.65"></a>
+<FONT color="green">066</FONT>        { "Abscissa {0} is duplicated at both indices {1} and {2}",<a name="line.66"></a>
+<FONT color="green">067</FONT>          "Abscisse {0} dupliqu\u00e9e aux indices {1} et {2}" },<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        // org.apache.commons.math.ConvergenceException<a name="line.69"></a>
+<FONT color="green">070</FONT>        { "Convergence failed",<a name="line.70"></a>
+<FONT color="green">071</FONT>          "\u00c9chec de convergence" },<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        // org.apache.commons.math.ArgumentOutsideDomainException<a name="line.73"></a>
+<FONT color="green">074</FONT>        { "Argument {0} outside domain [{1} ; {2}]",<a name="line.74"></a>
+<FONT color="green">075</FONT>          "Argument {0} hors du domaine [{1} ; {2}]" },<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        // org.apache.commons.math.MaxIterationsExceededException<a name="line.77"></a>
+<FONT color="green">078</FONT>        { "Maximal number of iterations ({0}) exceeded",<a name="line.78"></a>
+<FONT color="green">079</FONT>          "Nombre maximal d''it\u00e9rations ({0}) d\u00e9pass\u00e9" },<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        // org.apache.commons.math.MaxEvaluationsExceededException<a name="line.81"></a>
+<FONT color="green">082</FONT>        { "Maximal number of evaluations ({0}) exceeded",<a name="line.82"></a>
+<FONT color="green">083</FONT>          "Nombre maximal d''\u00e9valuations ({0}) d\u00e9pass\u00e9" },<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>        // org.apache.commons.math.analysis.interpolation.SplineInterpolator<a name="line.85"></a>
+<FONT color="green">086</FONT>        // org.apache.commons.math.analysis.polynomials.PolynomialFunctionLagrangeForm<a name="line.86"></a>
+<FONT color="green">087</FONT>        // org.apache.commons.math.DimensionMismatchException<a name="line.87"></a>
+<FONT color="green">088</FONT>        // org.apache.commons.math.optimization.LeastSquaresConverter<a name="line.88"></a>
+<FONT color="green">089</FONT>        // org.apache.commons.math.optimization.direct.DirectSearchOptimizer<a name="line.89"></a>
+<FONT color="green">090</FONT>        // org.apache.commons.math.optimization.general.AbstractLeastSquaresOptimizer<a name="line.90"></a>
+<FONT color="green">091</FONT>        // org.apache.commons.math.ode.ContinuousOutputModel<a name="line.91"></a>
+<FONT color="green">092</FONT>        // org.apache.commons.math.random.UncorrelatedRandomVectorGenerator<a name="line.92"></a>
+<FONT color="green">093</FONT>        // org.apache.commons.math.stat.regression.AbstractMultipleLinearRegression<a name="line.93"></a>
+<FONT color="green">094</FONT>        // org.apache.commons.math.stat.inference.ChiSquareTestImpl<a name="line.94"></a>
+<FONT color="green">095</FONT>        // org.apache.commons.math.analysis.interpolation.MicrosphereInterpolatingFunction<a name="line.95"></a>
+<FONT color="green">096</FONT>        { "dimension mismatch {0} != {1}",<a name="line.96"></a>
+<FONT color="green">097</FONT>          "dimensions incompatibles {0} != {1}" },<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>        // org.apache.commons.math.analysis.interpolation.MicrosphereInterpolatingFunction<a name="line.99"></a>
+<FONT color="green">100</FONT>        { "no data",<a name="line.100"></a>
+<FONT color="green">101</FONT>          "aucune donn\u00e9e" },<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        // org.apache.commons.math.analysis.interpolation.MicrosphereInterpolator<a name="line.103"></a>
+<FONT color="green">104</FONT>        { "brightness exponent should be positive or null, but got {0}",<a name="line.104"></a>
+<FONT color="green">105</FONT>          "l''exposant de brillance devrait \u00eatre positif ou null, or e = {0}" },<a name="line.105"></a>
+<FONT color="green">106</FONT>        { "number of microsphere elements must be positive, but got {0}",<a name="line.106"></a>
+<FONT color="green">107</FONT>          "le nombre d''\u00e9l\u00e9ments de la microsph\u00e8re devrait \u00eatre positif, or n = {0}" },<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>       // org.apache.commons.math.linear.decomposition.NotPositiveDefiniteMatrixException<a name="line.109"></a>
+<FONT color="green">110</FONT>        { "not positive definite matrix",<a name="line.110"></a>
+<FONT color="green">111</FONT>          "matrice non d\u00e9finie positive" },<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>        // org.apache.commons.math.linear.decomposition.NotSymmetricMatrixException<a name="line.113"></a>
+<FONT color="green">114</FONT>        { "not symmetric matrix",<a name="line.114"></a>
+<FONT color="green">115</FONT>          "matrice non symm\u00e9trique" },<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>        // org.apache.commons.math.fraction.FractionConversionException<a name="line.117"></a>
+<FONT color="green">118</FONT>        { "Unable to convert {0} to fraction after {1} iterations",<a name="line.118"></a>
+<FONT color="green">119</FONT>          "Impossible de convertir {0} en fraction apr\u00e8s {1} it\u00e9rations" },<a name="line.119"></a>
+<FONT color="green">120</FONT>        { "Overflow trying to convert {0} to fraction ({1}/{2})",<a name="line.120"></a>
+<FONT color="green">121</FONT>          "D\u00e9passement de capacit\u00e9 lors de la conversion de {0} en fraction ({1}/{2})" },<a name="line.121"></a>
+<FONT color="green">122</FONT>    <a name="line.122"></a>
+<FONT color="green">123</FONT>        // org.apache.commons.math.fraction.BigFraction<a name="line.123"></a>
+<FONT color="green">124</FONT>        { "numerator is null",<a name="line.124"></a>
+<FONT color="green">125</FONT>          "le num\u00e9rateur est null" },<a name="line.125"></a>
+<FONT color="green">126</FONT>        { "denimonator is null",<a name="line.126"></a>
+<FONT color="green">127</FONT>          "le d\u00e9nominateur est null" },<a name="line.127"></a>
+<FONT color="green">128</FONT>        { "denominator must be different from 0",<a name="line.128"></a>
+<FONT color="green">129</FONT>          "le d\u00e9nominateur doit \u00eatre diff\u00e9rent de 0" },<a name="line.129"></a>
+<FONT color="green">130</FONT>        { "cannot convert NaN value",<a name="line.130"></a>
+<FONT color="green">131</FONT>          "les valeurs NaN ne peuvent \u00eatre converties" },<a name="line.131"></a>
+<FONT color="green">132</FONT>        { "cannot convert infinite value",<a name="line.132"></a>
+<FONT color="green">133</FONT>          "les valeurs infinies ne peuvent \u00eatre converties" },<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>        // org.apache.commons.math.fraction.AbstractFormat<a name="line.135"></a>
+<FONT color="green">136</FONT>        { "denominator format can not be null",<a name="line.136"></a>
+<FONT color="green">137</FONT>          "le format du d\u00e9nominateur ne doit pas \u00eatre nul" },<a name="line.137"></a>
+<FONT color="green">138</FONT>        { "numerator format can not be null",<a name="line.138"></a>
+<FONT color="green">139</FONT>          "le format du num\u00e9rateur ne doit pas \u00eatre nul" },<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>        // org.apache.commons.math.fraction.FractionFormat<a name="line.141"></a>
+<FONT color="green">142</FONT>        { "cannot convert given object to a fraction number: {0}",<a name="line.142"></a>
+<FONT color="green">143</FONT>          "impossible de convertir l''objet sous forme d''un nombre rationnel : {0}" },<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>        // org.apache.commons.math.fraction.FractionFormat<a name="line.145"></a>
+<FONT color="green">146</FONT>        // org.apache.commons.math.fraction.BigFractionFormat<a name="line.146"></a>
+<FONT color="green">147</FONT>        { "unparseable fraction number: \"{0}\"",<a name="line.147"></a>
+<FONT color="green">148</FONT>          "\u00e9chec d''analyse du nombre rationnel \"{0}\"" },<a name="line.148"></a>
+<FONT color="green">149</FONT>        { "cannot format given object as a fraction number",<a name="line.149"></a>
+<FONT color="green">150</FONT>          "impossible de formater l''objet sous forme d''un nombre rationnel" },<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>        // org.apache.commons.math.fraction.ProperFractionFormat<a name="line.152"></a>
+<FONT color="green">153</FONT>        // org.apache.commons.math.fraction.ProperBigFractionFormat<a name="line.153"></a>
+<FONT color="green">154</FONT>        { "whole format can not be null",<a name="line.154"></a>
+<FONT color="green">155</FONT>          "le format complet ne doit pas \u00eatre nul" },<a name="line.155"></a>
+<FONT color="green">156</FONT>    <a name="line.156"></a>
+<FONT color="green">157</FONT>        // org.apache.commons.math.analysis.solvers.UnivariateRealSolverUtils<a name="line.157"></a>
+<FONT color="green">158</FONT>        { "function is null",<a name="line.158"></a>
+<FONT color="green">159</FONT>          "la fonction est nulle" },<a name="line.159"></a>
+<FONT color="green">160</FONT>        { "bad value for maximum iterations number: {0}",<a name="line.160"></a>
+<FONT color="green">161</FONT>          "valeur invalide pour le nombre maximal d''it\u00e9rations : {0}" },<a name="line.161"></a>
+<FONT color="green">162</FONT>        { "invalid bracketing parameters:  lower bound={0},  initial={1}, upper bound={2}",<a name="line.162"></a>
+<FONT color="green">163</FONT>          "param\u00e8tres d''encadrement invalides : borne inf\u00e9rieure = {0}, valeur initiale = {1}, borne sup\u00e9rieure = {2}" },<a name="line.163"></a>
+<FONT color="green">164</FONT>        { "number of iterations={0}, maximum iterations={1}, initial={2}, lower bound={3}, upper bound={4}," +<a name="line.164"></a>
+<FONT color="green">165</FONT>            " final a value={5}, final b value={6}, f(a)={7}, f(b)={8}",<a name="line.165"></a>
+<FONT color="green">166</FONT>          "nombre d''it\u00e9rations = {0}, it\u00e9rations maximum = {1}, valeur initiale = {2}," +<a name="line.166"></a>
+<FONT color="green">167</FONT>            " borne inf\u00e9rieure = {3}, borne sup\u00e9rieure = {4}," +<a name="line.167"></a>
+<FONT color="green">168</FONT>            " valeur a finale = {5}, valeur b finale = {6}, f(a) = {7}, f(b) = {8}" },<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>        // org.apache.commons.math.analysis.solvers.LaguerreSolver<a name="line.170"></a>
+<FONT color="green">171</FONT>        { "polynomial degree must be positive: degree={0}",<a name="line.171"></a>
+<FONT color="green">172</FONT>          "le polyn\u00f4me doit \u00eatre de degr\u00e9 positif : degr\u00e9 = {0}" },<a name="line.172"></a>
+<FONT color="green">173</FONT>    <a name="line.173"></a>
+<FONT color="green">174</FONT>        // org.apache.commons.math.analysis.solvers.SecantSolver<a name="line.174"></a>
+<FONT color="green">175</FONT>        { "function values at endpoints do not have different signs, endpoints: [{0}, {1}], values: [{2}, {3}]",<a name="line.175"></a>
+<FONT color="green">176</FONT>          "les valeurs de la fonctions aux bornes sont de m\u00eame signe, bornes : [{0}, {1}], valeurs : [{2}, {3}]" },<a name="line.176"></a>
+<FONT color="green">177</FONT>    <a name="line.177"></a>
+<FONT color="green">178</FONT>        // org.apache.commons.math.analysis.interpolation.SplineInterpolator<a name="line.178"></a>
+<FONT color="green">179</FONT>        // org.apache.commons.math.analysis.polynomials.PolynomialFunctionLagrangeForm<a name="line.179"></a>
+<FONT color="green">180</FONT>        { "{0} points are required, got only {1}",<a name="line.180"></a>
+<FONT color="green">181</FONT>          "{0} sont n\u00e9cessaires, seuls {1} ont \u00e9t\u00e9 fournis" },<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>        // org.apache.commons.math.analysis.interpolation.SplineInterpolator<a name="line.183"></a>
+<FONT color="green">184</FONT>        { "points {0} and {1} are not strictly increasing ({2} &gt;= {3})",<a name="line.184"></a>
+<FONT color="green">185</FONT>          "les points {0} et {1} ne sont pas strictement croissants ({2} &gt;= {3})" },<a name="line.185"></a>
+<FONT color="green">186</FONT>        { "points {0} and {1} are not strictly decreasing ({2} &lt;= {3})",<a name="line.186"></a>
+<FONT color="green">187</FONT>          "les points {0} et {1} ne sont pas strictement d\u00e9croissants ({2} &lt;= {3})" },<a name="line.187"></a>
+<FONT color="green">188</FONT>        { "points {0} and {1} are not increasing ({2} &gt; {3})",<a name="line.188"></a>
+<FONT color="green">189</FONT>          "les points {0} et {1} ne sont pas croissants ({2} &gt; {3})" },<a name="line.189"></a>
+<FONT color="green">190</FONT>        { "points {0} and {1} are not decreasing ({2} &lt; {3})",<a name="line.190"></a>
+<FONT color="green">191</FONT>          "les points {0} et {1} ne sont pas d\u00e9croissants ({2} &lt; {3})" },<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>        // org.apache.commons.math.analysis.interpolation.LoessInterpolator<a name="line.193"></a>
+<FONT color="green">194</FONT>        { "bandwidth must be in the interval [0,1], but got {0}",<a name="line.194"></a>
+<FONT color="green">195</FONT>          "la largeur de bande doit \u00eatre dans l''intervalle [0, 1], alors qu'elle vaut {0}" },<a name="line.195"></a>
+<FONT color="green">196</FONT>        { "the number of robustness iterations must be non-negative, but got {0}",<a name="line.196"></a>
+<FONT color="green">197</FONT>          "le nombre d''it\u00e9rations robuste ne peut \u00eatre n\u00e9gatif, alors qu''il est de {0}" },<a name="line.197"></a>
+<FONT color="green">198</FONT>        { "Loess expects the abscissa and ordinate arrays to be of the same size, " +<a name="line.198"></a>
+<FONT color="green">199</FONT>          "but got {0} abscissae and {1} ordinatae",<a name="line.199"></a>
+<FONT color="green">200</FONT>          "la r\u00e9gression Loess n\u00e9cessite autant d''abscisses que d''ordonn\u00e9es, " +<a name="line.200"></a>
+<FONT color="green">201</FONT>          "mais {0} abscisses et {1} ordonn\u00e9es ont \u00e9t\u00e9 fournies" },<a name="line.201"></a>
+<FONT color="green">202</FONT>        { "Loess expects at least 1 point",<a name="line.202"></a>
+<FONT color="green">203</FONT>          "la r\u00e9gression Loess n\u00e9cessite au moins un point" },<a name="line.203"></a>
+<FONT color="green">204</FONT>        { "the bandwidth must be large enough to accomodate at least 2 points. There are {0} " +<a name="line.204"></a>
+<FONT color="green">205</FONT>          " data points, and bandwidth must be at least {1}  but it is only {2}",<a name="line.205"></a>
+<FONT color="green">206</FONT>          "la largeur de bande doit \u00eatre assez grande pour supporter au moins 2 points. Il y a {0}" +<a name="line.206"></a>
+<FONT color="green">207</FONT>          "donn\u00e9es et la largeur de bande doit \u00eatre au moins de {1}, or elle est seulement de {2}" },<a name="line.207"></a>
+<FONT color="green">208</FONT>        { "all abscissae must be finite real numbers, but {0}-th is {1}",<a name="line.208"></a>
+<FONT color="green">209</FONT>          "toutes les abscisses doivent \u00eatre des nombres r\u00e9els finis, mais l''abscisse {0} vaut {1}" },<a name="line.209"></a>
+<FONT color="green">210</FONT>        { "all ordinatae must be finite real numbers, but {0}-th is {1}",<a name="line.210"></a>
+<FONT color="green">211</FONT>          "toutes les ordonn\u00e9es doivent \u00eatre des nombres r\u00e9els finis, mais l''ordonn\u00e9e {0} vaut {1}" },<a name="line.211"></a>
+<FONT color="green">212</FONT>        { "all weights must be finite real numbers, but {0}-th is {1}",<a name="line.212"></a>
+<FONT color="green">213</FONT>          "tous les poids doivent \u00eatre des nombres r\u00e9els finis, mais le poids {0} vaut {1}" },<a name="line.213"></a>
+<FONT color="green">214</FONT>        { "the abscissae array must be sorted in a strictly increasing order, " +<a name="line.214"></a>
+<FONT color="green">215</FONT>          "but the {0}-th element is {1} whereas {2}-th is {3}",<a name="line.215"></a>
+<FONT color="green">216</FONT>          "les abscisses doivent \u00eatre en ordre strictement croissant, " +<a name="line.216"></a>
+<FONT color="green">217</FONT>          "mais l''\u00e9l\u00e9ment {0} vaut {1} alors que l''\u00e9l\u00e9ment {2} vaut {3}" },<a name="line.217"></a>
+<FONT color="green">218</FONT>    <a name="line.218"></a>
+<FONT color="green">219</FONT>        // org.apache.commons.math.util.ContinuedFraction<a name="line.219"></a>
+<FONT color="green">220</FONT>        { "Continued fraction convergents diverged to +/- infinity for value {0}",<a name="line.220"></a>
+<FONT color="green">221</FONT>          "Divergence de fraction continue \u00e0 l''infini pour la valeur {0}" },<a name="line.221"></a>
+<FONT color="green">222</FONT>        { "Continued fraction convergents failed to converge for value {0}",<a name="line.222"></a>
+<FONT color="green">223</FONT>          "\u00c9chec de convergence de fraction continue pour la valeur {0}" },<a name="line.223"></a>
+<FONT color="green">224</FONT>        { "Continued fraction diverged to NaN for value {0}",<a name="line.224"></a>
+<FONT color="green">225</FONT>          "Divergence de fraction continue \u00e0 NaN pour la valeur {0}"},<a name="line.225"></a>
+<FONT color="green">226</FONT>    <a name="line.226"></a>
+<FONT color="green">227</FONT>        // org.apache.commons.math.util.DefaultTransformer<a name="line.227"></a>
+<FONT color="green">228</FONT>        { "Conversion Exception in Transformation, Object is null",<a name="line.228"></a>
+<FONT color="green">229</FONT>          "Exception de conversion dans une transformation, l''objet est nul" },<a name="line.229"></a>
+<FONT color="green">230</FONT>        { "Conversion Exception in Transformation: {0}",<a name="line.230"></a>
+<FONT color="green">231</FONT>          "Exception de conversion dans une transformation : {0}" },<a name="line.231"></a>
+<FONT color="green">232</FONT>    <a name="line.232"></a>
+<FONT color="green">233</FONT>        // org.apache.commons.math.optimization.MultiStartOptimizer<a name="line.233"></a>
+<FONT color="green">234</FONT>        { "no optimum computed yet",<a name="line.234"></a>
+<FONT color="green">235</FONT>          "aucun optimum n''a encore \u00e9t\u00e9 calcul\u00e9" },<a name="line.235"></a>
+<FONT color="green">236</FONT>    <a name="line.236"></a>
+<FONT color="green">237</FONT>        // org.apache.commons.math.optimization.direct.DirectSearchOptimizer<a name="line.237"></a>
+<FONT color="green">238</FONT>        { "simplex must contain at least one point",<a name="line.238"></a>
+<FONT color="green">239</FONT>          "le simplex doit contenir au moins un point" },<a name="line.239"></a>
+<FONT color="green">240</FONT>        { "equal vertices {0} and {1} in simplex configuration",<a name="line.240"></a>
+<FONT color="green">241</FONT>          "sommets {0} et {1} \u00e9gaux dans la configuration du simplex" },<a name="line.241"></a>
+<FONT color="green">242</FONT>    <a name="line.242"></a>
+<FONT color="green">243</FONT>        // org.apache.commons.math.estimation.AbstractEstimation<a name="line.243"></a>
+<FONT color="green">244</FONT>        { "maximal number of evaluations exceeded ({0})",<a name="line.244"></a>
+<FONT color="green">245</FONT>          "nombre maximal d''\u00e9valuations d\u00e9pass\u00e9 ({0})" },<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>        // org.apache.commons.math.optimization.general.AbstractLeastSquaresOptimizer<a name="line.247"></a>
+<FONT color="green">248</FONT>        { "unable to compute covariances: singular problem",<a name="line.248"></a>
+<FONT color="green">249</FONT>          "impossible de calculer les covariances : probl\u00e8me singulier"},<a name="line.249"></a>
+<FONT color="green">250</FONT>        { "no degrees of freedom ({0} measurements, {1} parameters)",<a name="line.250"></a>
+<FONT color="green">251</FONT>          "aucun degr\u00e9 de libert\u00e9 ({0} mesures, {1} param\u00e8tres)" },<a name="line.251"></a>
+<FONT color="green">252</FONT>    <a name="line.252"></a>
+<FONT color="green">253</FONT>        // org.apache.commons.math.optimization.general.GaussNewtonOptimizer<a name="line.253"></a>
+<FONT color="green">254</FONT>        { "unable to solve: singular problem",<a name="line.254"></a>
+<FONT color="green">255</FONT>          "r\u00e9solution impossible : probl\u00e8me singulier" },<a name="line.255"></a>
+<FONT color="green">256</FONT>    <a name="line.256"></a>
+<FONT color="green">257</FONT>        // org.apache.commons.math.optimization.general.LevenbergMarquardtEstimator<a name="line.257"></a>
+<FONT color="green">258</FONT>        { "cost relative tolerance is too small ({0}), no further reduction in the sum of squares is possible",<a name="line.258"></a>
+<FONT color="green">259</FONT>          "trop petite tol\u00e9rance relative sur le co\u00fbt ({0}), aucune r\u00e9duction de la somme des carr\u00e9s n''est possible" },<a name="line.259"></a>
+<FONT color="green">260</FONT>        { "parameters relative tolerance is too small ({0}), no further improvement in the approximate solution is possible",<a name="line.260"></a>
+<FONT color="green">261</FONT>          "trop petite tol\u00e9rance relative sur les param\u00e8tres ({0}), aucune am\u00e9lioration de la solution approximative n''est possible" },<a name="line.261"></a>
+<FONT color="green">262</FONT>        { "orthogonality tolerance is too small ({0}), solution is orthogonal to the jacobian",<a name="line.262"></a>
+<FONT color="green">263</FONT>          "trop petite tol\u00e9rance sur l''orthogonalit\u00e9 ({0}), la solution est orthogonale \u00e0 la jacobienne" },<a name="line.263"></a>
+<FONT color="green">264</FONT>        { "unable to perform Q.R decomposition on the {0}x{1} jacobian matrix",<a name="line.264"></a>
+<FONT color="green">265</FONT>          "impossible de calculer la factorisation Q.R de la matrice jacobienne {0}x{1}" },<a name="line.265"></a>
+<FONT color="green">266</FONT>    <a name="line.266"></a>
+<FONT color="green">267</FONT>        // org.apache.commons.math.optimization.general.NonLinearConjugateGradientOptimizer<a name="line.267"></a>
+<FONT color="green">268</FONT>        { "unable to bracket optimum in line search",<a name="line.268"></a>
+<FONT color="green">269</FONT>          "impossible d''encadrer l''optimum lors de la recherche lin\u00e9aire" },<a name="line.269"></a>
+<FONT color="green">270</FONT>    <a name="line.270"></a>
+<FONT color="green">271</FONT>        // org.apache.commons.math.optimization.fitting.HarmonicCoefficientsGuesser<a name="line.271"></a>
+<FONT color="green">272</FONT>        { "unable to first guess the harmonic coefficients",<a name="line.272"></a>
+<FONT color="green">273</FONT>          "impossible de faire une premi\u00e8re estimation des coefficients harmoniques" },<a name="line.273"></a>
+<FONT color="green">274</FONT>    <a name="line.274"></a>
+<FONT color="green">275</FONT>        // org.apache.commons.math.optimization.fitting.HarmonicCoefficientsGuesser<a name="line.275"></a>
+<FONT color="green">276</FONT>        { "sample contains {0} observed points, at least {1} are required",<a name="line.276"></a>
+<FONT color="green">277</FONT>          "l''\u00e9chantillon ne contient que {0} points alors qu''au moins {1} sont n\u00e9cessaires" },<a name="line.277"></a>
+<FONT color="green">278</FONT>    <a name="line.278"></a>
+<FONT color="green">279</FONT>        // org.apache.commons.math.optimization.linear.NoFeasibleSolutionException<a name="line.279"></a>
+<FONT color="green">280</FONT>        { "no feasible solution",<a name="line.280"></a>
+<FONT color="green">281</FONT>          "aucune solution r\u00e9alisable" },<a name="line.281"></a>
+<FONT color="green">282</FONT>    <a name="line.282"></a>
+<FONT color="green">283</FONT>        // org.apache.commons.math.optimization.linear.UnboundedSolutionException<a name="line.283"></a>
+<FONT color="green">284</FONT>        { "unbounded solution",<a name="line.284"></a>
+<FONT color="green">285</FONT>          "solution non born\u00e9e" },<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>        // org.apache.commons.math.geometry.CardanEulerSingularityException<a name="line.287"></a>
+<FONT color="green">288</FONT>        { "Cardan angles singularity",<a name="line.288"></a>
+<FONT color="green">289</FONT>          "singularit\u00e9 d''angles de Cardan" },<a name="line.289"></a>
+<FONT color="green">290</FONT>        { "Euler angles singularity",<a name="line.290"></a>
+<FONT color="green">291</FONT>          "singularit\u00e9 d''angles d''Euler" },<a name="line.291"></a>
+<FONT color="green">292</FONT>    <a name="line.292"></a>
+<FONT color="green">293</FONT>        // org.apache.commons.math.geometry.Rotation<a name="line.293"></a>
+<FONT color="green">294</FONT>        { "a {0}x{1} matrix cannot be a rotation matrix",<a name="line.294"></a>
+<FONT color="green">295</FONT>          "une matrice {0}x{1} ne peut pas \u00eatre une matrice de rotation" },<a name="line.295"></a>
+<FONT color="green">296</FONT>        { "the closest orthogonal matrix has a negative determinant {0}",<a name="line.296"></a>
+<FONT color="green">297</FONT>          "la matrice orthogonale la plus proche a un d\u00e9terminant n\u00e9gatif {0}" },<a name="line.297"></a>
+<FONT color="green">298</FONT>        { "unable to orthogonalize matrix in {0} iterations",<a name="line.298"></a>
+<FONT color="green">299</FONT>          "impossible de rendre la matrice orthogonale en {0} it\u00e9rations" },<a name="line.299"></a>
+<FONT color="green">300</FONT>    <a name="line.300"></a>
+<FONT color="green">301</FONT>        // org.apache.commons.math.ode.nonstiff.AdaptiveStepsizeIntegrator<a name="line.301"></a>
+<FONT color="green">302</FONT>        { "minimal step size ({0,number,0.00E00}) reached, integration needs {1,number,0.00E00}",<a name="line.302"></a>
+<FONT color="green">303</FONT>          "pas minimal ({0,number,0.00E00}) atteint, l''int\u00e9gration n\u00e9cessite {1,number,0.00E00}" },<a name="line.303"></a>
+<FONT color="green">304</FONT>        { "dimensions mismatch: state vector has dimension {0}, absolute tolerance vector has dimension {1}",<a name="line.304"></a>
+<FONT color="green">305</FONT>          "incompatibilit\u00e9 de dimensions entre le vecteur d''\u00e9tat ({0}), et le vecteur de tol\u00e9rance absolue ({1})" },<a name="line.305"></a>
+<FONT color="green">306</FONT>        { "dimensions mismatch: state vector has dimension {0}, relative tolerance vector has dimension {1}",<a name="line.306"></a>
+<FONT color="green">307</FONT>          "incompatibilit\u00e9 de dimensions entre le vecteur d''\u00e9tat ({0}), et le vecteur de tol\u00e9rance relative ({1})" },<a name="line.307"></a>
+<FONT color="green">308</FONT>    <a name="line.308"></a>
+<FONT color="green">309</FONT>        // org.apache.commons.math.ode.nonstiff.AdaptiveStepsizeIntegrator,<a name="line.309"></a>
+<FONT color="green">310</FONT>        // org.apache.commons.math.ode.nonstiff.RungeKuttaIntegrator<a name="line.310"></a>
+<FONT color="green">311</FONT>        { "dimensions mismatch: ODE problem has dimension {0}, initial state vector has dimension {1}",<a name="line.311"></a>
+<FONT color="green">312</FONT>          "incompatibilit\u00e9 de dimensions entre le probl\u00e8me ODE ({0}), et le vecteur d''\u00e9tat initial ({1})" },<a name="line.312"></a>
+<FONT color="green">313</FONT>        { "dimensions mismatch: ODE problem has dimension {0}, final state vector has dimension {1}",<a name="line.313"></a>
+<FONT color="green">314</FONT>          "incompatibilit\u00e9 de dimensions entre le probl\u00e8me ODE ({0}), et le vecteur d''\u00e9tat final ({1})" },<a name="line.314"></a>
+<FONT color="green">315</FONT>        { "too small integration interval: length = {0}",<a name="line.315"></a>
+<FONT color="green">316</FONT>          "intervalle d''int\u00e9gration trop petit : {0}" },<a name="line.316"></a>
+<FONT color="green">317</FONT>    <a name="line.317"></a>
+<FONT color="green">318</FONT>        // org.apache.commons.math.ode.MultistepIntegrator<a name="line.318"></a>
+<FONT color="green">319</FONT>        { "{0} method needs at least one previous point",<a name="line.319"></a>
+<FONT color="green">320</FONT>          "la m\u00e9thode {0} n\u00e9cessite au moins un point pr\u00e9c\u00e9dent" },<a name="line.320"></a>
+<FONT color="green">321</FONT>    <a name="line.321"></a>
+<FONT color="green">322</FONT>        // org.apache.commons.math.ode.ContinuousOutputModel<a name="line.322"></a>
+<FONT color="green">323</FONT>        // org.apache.commons.math.optimization.direct.DirectSearchOptimizer<a name="line.323"></a>
+<FONT color="green">324</FONT>        { "unexpected exception caught",<a name="line.324"></a>
+<FONT color="green">325</FONT>          "exception inattendue lev\u00e9e" },<a name="line.325"></a>
+<FONT color="green">326</FONT>        { "propagation direction mismatch",<a name="line.326"></a>
+<FONT color="green">327</FONT>          "directions de propagation incoh\u00e9rentes" },<a name="line.327"></a>
+<FONT color="green">328</FONT>        { "{0} wide hole between models time ranges",<a name="line.328"></a>
+<FONT color="green">329</FONT>          "trou de longueur {0} entre les domaines temporels des mod\u00e8les" },<a name="line.329"></a>
+<FONT color="green">330</FONT>    <a name="line.330"></a>
+<FONT color="green">331</FONT>        // org.apache.commons.math.optimization.direct.DirectSearchOptimizer<a name="line.331"></a>
+<FONT color="green">332</FONT>        { "none of the {0} start points lead to convergence",<a name="line.332"></a>
+<FONT color="green">333</FONT>          "aucun des {0} points de d\u00e9part n''aboutit \u00e0 une convergence"  },<a name="line.333"></a>
+<FONT color="green">334</FONT>    <a name="line.334"></a>
+<FONT color="green">335</FONT>        // org.apache.commons.math.random.ValueServer<a name="line.335"></a>
+<FONT color="green">336</FONT>        { "unknown mode {0}, known modes: {1} ({2}), {3} ({4}), {5} ({6}), {7} ({8}), {9} ({10}) and {11} ({12})",<a name="line.336"></a>
+<FONT color="green">337</FONT>          "mode {0} inconnu, modes connus : {1} ({2}), {3} ({4}), {5} ({6}), {7} ({8}), {9} ({10}) et {11} ({12})" },<a name="line.337"></a>
+<FONT color="green">338</FONT>        { "digest not initialized",<a name="line.338"></a>
+<FONT color="green">339</FONT>          "mod\u00e8le empirique non initialis\u00e9" },<a name="line.339"></a>
+<FONT color="green">340</FONT>    <a name="line.340"></a>
+<FONT color="green">341</FONT>        // org.apache.commons.math.random.EmpiricalDistributionImpl<a name="line.341"></a>
+<FONT color="green">342</FONT>        { "distribution not loaded",<a name="line.342"></a>
+<FONT color="green">343</FONT>          "aucune distribution n''a \u00e9t\u00e9 charg\u00e9e" },<a name="line.343"></a>
+<FONT color="green">344</FONT>        { "no bin selected",<a name="line.344"></a>
+<FONT color="green">345</FONT>          "aucun compartiment s\u00e9lectionn\u00e9" },<a name="line.345"></a>
+<FONT color="green">346</FONT>        { "input data comes from unsupported datasource: {0}, supported sources: {1}, {2}",<a name="line.346"></a>
+<FONT color="green">347</FONT>          "les donn\u00e9es d''entr\u00e9e proviennent " +<a name="line.347"></a>
+<FONT color="green">348</FONT>          "d''une source non support\u00e9e : {0}, sources support\u00e9es : {1}, {2}" },<a name="line.348"></a>
+<FONT color="green">349</FONT>    <a name="line.349"></a>
+<FONT color="green">350</FONT>        // org.apache.commons.math.random.EmpiricalDistributionImpl<a name="line.350"></a>
+<FONT color="green">351</FONT>        // org.apache.commons.math.random.ValueServer<a name="line.351"></a>
+<FONT color="green">352</FONT>        { "URL {0} contains no data",<a name="line.352"></a>
+<FONT color="green">353</FONT>          "l''adresse {0} ne contient aucune donn\u00e9e" },<a name="line.353"></a>
+<FONT color="green">354</FONT>    <a name="line.354"></a>
+<FONT color="green">355</FONT>        // org.apache.commons.math.random.AbstractRandomGenerator<a name="line.355"></a>
+<FONT color="green">356</FONT>        // org.apache.commons.math.random.BitsStreamGenerator<a name="line.356"></a>
+<FONT color="green">357</FONT>        { "upper bound must be positive ({0})",<a name="line.357"></a>
+<FONT color="green">358</FONT>          "la borne sup\u00e9rieure doit \u00eatre positive ({0})" },<a name="line.358"></a>
+<FONT color="green">359</FONT>    <a name="line.359"></a>
+<FONT color="green">360</FONT>        // org.apache.commons.math.random.RandomDataImpl<a name="line.360"></a>
+<FONT color="green">361</FONT>        { "length must be positive ({0})",<a name="line.361"></a>
+<FONT color="green">362</FONT>          "la longueur doit \u00eatre positive ({0})" },<a name="line.362"></a>
+<FONT color="green">363</FONT>        { "upper bound ({0}) must be greater than lower bound ({1})",<a name="line.363"></a>
+<FONT color="green">364</FONT>          "la borne sup\u00e9rieure ({0}) doit \u00eatre sup\u00e9rieure" +<a name="line.364"></a>
+<FONT color="green">365</FONT>          " \u00e0 la borne inf\u00e9rieure ({1})" },<a name="line.365"></a>
+<FONT color="green">366</FONT>        { "permutation k ({0}) exceeds n ({1})",<a name="line.366"></a>
+<FONT color="green">367</FONT>          "la permutation k ({0}) d\u00e9passe n ({1})" },<a name="line.367"></a>
+<FONT color="green">368</FONT>        { "permutation k ({0}) must be positive",<a name="line.368"></a>
+<FONT color="green">369</FONT>          "la permutation k ({0}) doit \u00eatre positive" },<a name="line.369"></a>
+<FONT color="green">370</FONT>        { "sample size ({0}) exceeds collection size ({1})",<a name="line.370"></a>
+<FONT color="green">371</FONT>          "la taille de l''\u00e9chantillon ({0}) d\u00e9passe la taille de la collection ({1})" },<a name="line.371"></a>
+<FONT color="green">372</FONT>    <a name="line.372"></a>
+<FONT color="green">373</FONT>        // org.apache.commons.math.linear.decomposition.EigenDecompositionImpl<a name="line.373"></a>
+<FONT color="green">374</FONT>        { "cannot solve degree {0} equation",<a name="line.374"></a>
+<FONT color="green">375</FONT>          "impossible de r\u00e9soudre une \u00e9quation de degr\u00e9 {0}" },<a name="line.375"></a>
+<FONT color="green">376</FONT>        { "eigen decomposition of assymetric matrices not supported yet",<a name="line.376"></a>
+<FONT color="green">377</FONT>          "la d\u00e9composition en valeurs/vecteurs propres de matrices " +<a name="line.377"></a>
+<FONT color="green">378</FONT>          "non sym\u00e9triques n''est pas encore disponible" },<a name="line.378"></a>
+<FONT color="green">379</FONT>    <a name="line.379"></a>
+<FONT color="green">380</FONT>        // org.apache.commons.math.linear.decomposition.NonSquareMatrixException<a name="line.380"></a>
+<FONT color="green">381</FONT>        // org.apache.commons.math.stat.regression.AbstractMultipleLinearRegression<a name="line.381"></a>
+<FONT color="green">382</FONT>        { "a {0}x{1} matrix was provided instead of a square matrix",<a name="line.382"></a>
+<FONT color="green">383</FONT>          "une matrice {0}x{1} a \u00e9t\u00e9 fournie \u00e0 la place d''une matrice carr\u00e9e" },<a name="line.383"></a>
+<FONT color="green">384</FONT>    <a name="line.384"></a>
+<FONT color="green">385</FONT>        // org.apache.commons.math.linear.decomposition.SingularMatrixException<a name="line.385"></a>
+<FONT color="green">386</FONT>        { "matrix is singular",<a name="line.386"></a>
+<FONT color="green">387</FONT>          "matrice singuli\u00e8re" },<a name="line.387"></a>
+<FONT color="green">388</FONT>    <a name="line.388"></a>
+<FONT color="green">389</FONT>        // org.apache.commons.math.linear.decomposition.SingularValueDecompositionImpl<a name="line.389"></a>
+<FONT color="green">390</FONT>        { "cutoff singular value is {0}, should be at most {1}",<a name="line.390"></a>
+<FONT color="green">391</FONT>          "la valeur singuli\u00e8re de coupure vaut {0}, elle ne devrait pas d\u00e9passer {1}" },<a name="line.391"></a>
+<FONT color="green">392</FONT>    <a name="line.392"></a>
+<FONT color="green">393</FONT>        // org.apache.commons.math.linear.decomposition.CholeskyDecompositionImpl<a name="line.393"></a>
+<FONT color="green">394</FONT>        // org.apache.commons.math.linear.decomposition.EigenDecompositionImpl<a name="line.394"></a>
+<FONT color="green">395</FONT>        // org.apache.commons.math.linear.decomposition.LUDecompositionImpl<a name="line.395"></a>
+<FONT color="green">396</FONT>        // org.apache.commons.math.linear.decomposition.QRDecompositionImpl<a name="line.396"></a>
+<FONT color="green">397</FONT>        // org.apache.commons.math.linear.decomposition.SingularValueDecompositionImpl<a name="line.397"></a>
+<FONT color="green">398</FONT>        { "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.398"></a>
+<FONT color="green">399</FONT>          "dimensions incoh\u00e9rentes : {0}x{1} \u00e0 la place de {2}x{3}" },<a name="line.399"></a>
+<FONT color="green">400</FONT>    <a name="line.400"></a>
+<FONT color="green">401</FONT>        // org.apache.commons.math.linear.decomposition.CholeskyDecompositionImpl<a name="line.401"></a>
+<FONT color="green">402</FONT>        // org.apache.commons.math.linear.decomposition.EigenDecompositionImpl<a name="line.402"></a>
+<FONT color="green">403</FONT>        // org.apache.commons.math.linear.decomposition.LUDecompositionImpl<a name="line.403"></a>
+<FONT color="green">404</FONT>        // org.apache.commons.math.linear.decomposition.QRDecompositionImpl<a name="line.404"></a>
+<FONT color="green">405</FONT>        // org.apache.commons.math.linear.decomposition.SingularValueDecompositionImpl<a name="line.405"></a>
+<FONT color="green">406</FONT>        // org.apache.commons.math.linear.ArrayRealVector<a name="line.406"></a>
+<FONT color="green">407</FONT>        // org.apache.commons.math.linear.SparseRealVector<a name="line.407"></a>
+<FONT color="green">408</FONT>        { "vector length mismatch: got {0} but expected {1}",<a name="line.408"></a>
+<FONT color="green">409</FONT>          "taille de vecteur invalide : {0} au lieu de {1} attendue" },<a name="line.409"></a>
+<FONT color="green">410</FONT>    <a name="line.410"></a>
+<FONT color="green">411</FONT>        // org.apache.commons.math.linear.ArrayRealVector<a name="line.411"></a>
+<FONT color="green">412</FONT>        // org.apache.commons.math.linear.ArrayFieldVector<a name="line.412"></a>
+<FONT color="green">413</FONT>        // org.apache.commons.math.linear.SparseRealVector<a name="line.413"></a>
+<FONT color="green">414</FONT>        { "index {0} out of allowed range [{1}, {2}]",<a name="line.414"></a>
+<FONT color="green">415</FONT>          "index {0} hors de la plage autoris\u00e9e [{1}, {2}]" },<a name="line.415"></a>
+<FONT color="green">416</FONT>        { "vector must have at least one element",<a name="line.416"></a>
+<FONT color="green">417</FONT>          "un vecteur doit comporter au moins un \u00e9l\u00e9ment" },<a name="line.417"></a>
+<FONT color="green">418</FONT>        { "position {0} and size {1} don't fit to the size of the input array {2}",<a name="line.418"></a>
+<FONT color="green">419</FONT>          "la position {0} et la taille {1} sont incompatibles avec la taille du tableau d''entr\u00e9e {2}"},<a name="line.419"></a>
+<FONT color="green">420</FONT>    <a name="line.420"></a>
+<FONT color="green">421</FONT>        // org.apache.commons.math.linear.AbstractRealMatrix<a name="line.421"></a>
+<FONT color="green">422</FONT>        // org.apache.commons.math.linear.AbstractFieldMatrix<a name="line.422"></a>
+<FONT color="green">423</FONT>        { "invalid row dimension: {0} (must be positive)",<a name="line.423"></a>
+<FONT color="green">424</FONT>          "nombre de lignes invalide : {0} (doit \u00eatre positif)" },<a name="line.424"></a>
+<FONT color="green">425</FONT>        { "invalid column dimension: {0} (must be positive)",<a name="line.425"></a>
+<FONT color="green">426</FONT>          "nombre de colonnes invalide : {0} (doit \u00eatre positif)" },<a name="line.426"></a>
+<FONT color="green">427</FONT>        { "matrix must have at least one row",<a name="line.427"></a>
+<FONT color="green">428</FONT>          "une matrice doit comporter au moins une ligne" },<a name="line.428"></a>
+<FONT color="green">429</FONT>        { "matrix must have at least one column",<a name="line.429"></a>
+<FONT color="green">430</FONT>          "une matrice doit comporter au moins une colonne" },<a name="line.430"></a>
+<FONT color="green">431</FONT>    <a name="line.431"></a>
+<FONT color="green">432</FONT>        // org.apache.commons.math.linear.AbstractRealMatrix<a name="line.432"></a>
+<FONT color="green">433</FONT>        // org.apache.commons.math.linear.AbstractFieldMatrix<a name="line.433"></a>
+<FONT color="green">434</FONT>        // org.apache.commons.math.stat.inference.ChiSquareTestImpl<a name="line.434"></a>
+<FONT color="green">435</FONT>        { "some rows have length {0} while others have length {1}",<a name="line.435"></a>
+<FONT color="green">436</FONT>          "certaines lignes ont une longueur de {0} alors que d''autres ont une longueur de {1}" },<a name="line.436"></a>
+<FONT color="green">437</FONT>    <a name="line.437"></a>
+<FONT color="green">438</FONT>        // org.apache.commons.math.linear.MatrixUtils<a name="line.438"></a>
+<FONT color="green">439</FONT>        { "row index {0} out of allowed range [{1}, {2}]",<a name="line.439"></a>
+<FONT color="green">440</FONT>          "index de ligne {0} hors de la plage autoris\u00e9e [{1}, {2}]" },<a name="line.440"></a>
+<FONT color="green">441</FONT>        { "column index {0} out of allowed range [{1}, {2}]",<a name="line.441"></a>
+<FONT color="green">442</FONT>          "index de colonne {0} hors de la plage autoris\u00e9e [{1}, {2}]" },<a name="line.442"></a>
+<FONT color="green">443</FONT>        { "initial row {0} after final row {1}",<a name="line.443"></a>
+<FONT color="green">444</FONT>          "ligne initiale {0} apr\u00e8s la ligne finale {1}" },<a name="line.444"></a>
+<FONT color="green">445</FONT>        { "initial column {0} after final column {1}",<a name="line.445"></a>
+<FONT color="green">446</FONT>          "colonne initiale {0} apr\u00e8s la colonne finale {1}" },<a name="line.446"></a>
+<FONT color="green">447</FONT>        { "empty selected row index array",<a name="line.447"></a>
+<FONT color="green">448</FONT>          "tableau des indices de lignes s\u00e9lectionn\u00e9es vide" },<a name="line.448"></a>
+<FONT color="green">449</FONT>        { "empty selected column index array",<a name="line.449"></a>
+<FONT color="green">450</FONT>          "tableau des indices de colonnes s\u00e9lectionn\u00e9es vide" },<a name="line.450"></a>
+<FONT color="green">451</FONT>        { "{0}x{1} and {2}x{3} matrices are not addition compatible",<a name="line.451"></a>
+<FONT color="green">452</FONT>          "les dimensions {0}x{1} et {2}x{3} sont incompatibles pour l'addition matricielle" },<a name="line.452"></a>
+<FONT color="green">453</FONT>        { "{0}x{1} and {2}x{3} matrices are not subtraction compatible",<a name="line.453"></a>
+<FONT color="green">454</FONT>          "les dimensions {0}x{1} et {2}x{3} sont incompatibles pour la soustraction matricielle" },<a name="line.454"></a>
+<FONT color="green">455</FONT>        { "{0}x{1} and {2}x{3} matrices are not multiplication compatible",<a name="line.455"></a>
+<FONT color="green">456</FONT>          "les dimensions {0}x{1} et {2}x{3} sont incompatibles pour la multiplication matricielle" },<a name="line.456"></a>
+<FONT color="green">457</FONT>    <a name="line.457"></a>
+<FONT color="green">458</FONT>        // org.apache.commons.math.linear.BlockRealMatrix<a name="line.458"></a>
+<FONT color="green">459</FONT>        { "wrong array shape (block length = {0}, expected {1})",<a name="line.459"></a>
+<FONT color="green">460</FONT>          "forme de tableau erron\u00e9e (bloc de longueur {0} au lieu des {1} attendus)" },<a name="line.460"></a>
+<FONT color="green">461</FONT>    <a name="line.461"></a>
+<FONT color="green">462</FONT>        // org.apache.commons.math.complex.Complex<a name="line.462"></a>
+<FONT color="green">463</FONT>        { "cannot compute nth root for null or negative n: {0}",<a name="line.463"></a>
+<FONT color="green">464</FONT>         "impossible de calculer la racine ni\u00e8me pour n n\u00e9gatif ou nul : {0}" },<a name="line.464"></a>
+<FONT color="green">465</FONT>    <a name="line.465"></a>
+<FONT color="green">466</FONT>       // org.apache.commons.math.complex.ComplexFormat<a name="line.466"></a>
+<FONT color="green">467</FONT>       { "unparseable complex number: \"{0}\"",<a name="line.467"></a>
+<FONT color="green">468</FONT>         "\u00e9chec d''analyse du nombre complexe \"{0}\"" },<a name="line.468"></a>
+<FONT color="green">469</FONT>       { "cannot format a {0} instance as a complex number",<a name="line.469"></a>
+<FONT color="green">470</FONT>         "impossible de formater une instance de {0} comme un nombre complexe" },<a name="line.470"></a>
+<FONT color="green">471</FONT>       { "empty string for imaginary character",<a name="line.471"></a>
+<FONT color="green">472</FONT>         "cha\u00eene vide pour le caract\u00e8 imaginaire" },<a name="line.472"></a>
+<FONT color="green">473</FONT>       { "null imaginary format",<a name="line.473"></a>
+<FONT color="green">474</FONT>         "format imaginaire nul" },<a name="line.474"></a>
+<FONT color="green">475</FONT>       { "null real format",<a name="line.475"></a>
+<FONT color="green">476</FONT>         "format r\u00e9el nul" },<a name="line.476"></a>
+<FONT color="green">477</FONT>    <a name="line.477"></a>
+<FONT color="green">478</FONT>       // org.apache.commons.math.complex.ComplexUtils<a name="line.478"></a>
+<FONT color="green">479</FONT>       { "negative complex module {0}",<a name="line.479"></a>
+<FONT color="green">480</FONT>         "module n\u00e9gatif ({0}) pour un nombre complexe" },<a name="line.480"></a>
+<FONT color="green">481</FONT>    <a name="line.481"></a>
+<FONT color="green">482</FONT>       // org.apache.commons.math.geometry.Vector3DFormat<a name="line.482"></a>
+<FONT color="green">483</FONT>       { "unparseable 3D vector: \"{0}\"",<a name="line.483"></a>
+<FONT color="green">484</FONT>         "\u00e9chec d''analyse du vecteur de dimension 3 \"{0}\"" },<a name="line.484"></a>
+<FONT color="green">485</FONT>       { "cannot format a {0} instance as a 3D vector",<a name="line.485"></a>
+<FONT color="green">486</FONT>         "impossible de formater une instance de {0} comme un vecteur de dimension 3" },<a name="line.486"></a>
+<FONT color="green">487</FONT>    <a name="line.487"></a>
+<FONT color="green">488</FONT>       // org.apache.commons.math.linear.RealVectorFormat<a name="line.488"></a>
+<FONT color="green">489</FONT>       { "unparseable real vector: \"{0}\"",<a name="line.489"></a>
+<FONT color="green">490</FONT>         "\u00e9chec d''analyse du vecteur r\u00e9el \"{0}\"" },<a name="line.490"></a>
+<FONT color="green">491</FONT>       { "cannot format a {0} instance as a real vector",<a name="line.491"></a>
+<FONT color="green">492</FONT>         "impossible de formater une instance de {0} comme un vecteur r\u00e9el" },<a name="line.492"></a>
+<FONT color="green">493</FONT>    <a name="line.493"></a>
+<FONT color="green">494</FONT>       // org.apache.commons.math.util.ResizableDoubleArray<a name="line.494"></a>
+<FONT color="green">495</FONT>       { "the index specified: {0} is larger than the current maximal index {1}",<a name="line.495"></a>
+<FONT color="green">496</FONT>         "l''index sp\u00e9cifi\u00e9 ({0}) d\u00e9passe l''index maximal courant ({1})" },<a name="line.496"></a>
+<FONT color="green">497</FONT>       { "elements cannot be retrieved from a negative array index {0}",<a name="line.497"></a>
+<FONT color="green">498</FONT>         "impossible d''extraire un \u00e9l\u00e9ment \u00e0 un index n\u00e9gatif ({0})" },<a name="line.498"></a>
+<FONT color="green">499</FONT>       { "cannot set an element at a negative index {0}",<a name="line.499"></a>
+<FONT color="green">500</FONT>         "impossible de mettre un \u00e9l\u00e9ment \u00e0 un index n\u00e9gatif ({0})" },<a name="line.500"></a>
+<FONT color="green">501</FONT>       { "cannot substitute an element from an empty array",<a name="line.501"></a>
+<FONT color="green">502</FONT>         "impossible de substituer un \u00e9l\u00e9ment dans un tableau vide" },<a name="line.502"></a>
+<FONT color="green">503</FONT>       { "contraction criteria ({0}) smaller than the expansion factor ({1}).  This would " +<a name="line.503"></a>
+<FONT color="green">504</FONT>         "lead to a never ending loop of expansion and contraction as a newly expanded " +<a name="line.504"></a>
+<FONT color="green">505</FONT>         "internal storage array would immediately satisfy the criteria for contraction.",<a name="line.505"></a>
+<FONT color="green">506</FONT>         "crit\u00e8re de contraction ({0}) inf\u00e9rieur au facteur d''extension. Ceci " +<a name="line.506"></a>
+<FONT color="green">507</FONT>         "induit une boucle infinie d''extensions/contractions car tout tableau de stockage " +<a name="line.507"></a>
+<FONT color="green">508</FONT>         "fra\u00eechement \u00e9tendu respecte imm\u00e9diatement le crit\u00e8re de contraction."},<a name="line.508"></a>
+<FONT color="green">509</FONT>       { "contraction criteria smaller than one ({0}).  This would lead to a never ending " +<a name="line.509"></a>
+<FONT color="green">510</FONT>         "loop of expansion and contraction as an internal storage array length equal " +<a name="line.510"></a>
+<FONT color="green">511</FONT>         "to the number of elements would satisfy the contraction criteria.",<a name="line.511"></a>
+<FONT color="green">512</FONT>         "crit\u00e8re de contraction inf\u00e9rieur \u00e0 un ({0}). Ceci induit une boucle " +<a name="line.512"></a>
+<FONT color="green">513</FONT>         "infinie d''extensions/contractions car tout tableau de stockage de longueur \u00e9gale " +<a name="line.513"></a>
+<FONT color="green">514</FONT>         "au nombre d''\u00e9l\u00e9ments respecte le crit\u00e8re de contraction." },<a name="line.514"></a>
+<FONT color="green">515</FONT>       { "expansion factor smaller than one ({0})",<a name="line.515"></a>
+<FONT color="green">516</FONT>         "facteur d''extension inf\u00e9rieur \u00e0 un ({0})"},<a name="line.516"></a>
+<FONT color="green">517</FONT>       { "cannot discard {0} elements from a {1} elements array",<a name="line.517"></a>
+<FONT color="green">518</FONT>         "impossible d''enlever {0} \u00e9l\u00e9ments d''un tableau en contenant {1}"},<a name="line.518"></a>
+<FONT color="green">519</FONT>       { "cannot discard a negative number of elements ({0})",<a name="line.519"></a>
+<FONT color="green">520</FONT>         "impossible d''enlever un nombre d''\u00e9l\u00e9ments{0} n\u00e9gatif"},<a name="line.520"></a>
+<FONT color="green">521</FONT>       { "unsupported expansion mode {0}, supported modes are {1} ({2}) and {3} ({4})",<a name="line.521"></a>
+<FONT color="green">522</FONT>         "mode d''extension {0} no support\u00e9, les modes support\u00e9s sont {1} ({2}) et {3} ({4})" },<a name="line.522"></a>
+<FONT color="green">523</FONT>       { "initial capacity ({0}) is not positive",<a name="line.523"></a>
+<FONT color="green">524</FONT>         "la capacit\u00e9 initiale ({0}) n''est pas positive" },<a name="line.524"></a>
+<FONT color="green">525</FONT>       { "index ({0}) is not positive",<a name="line.525"></a>
+<FONT color="green">526</FONT>         "l''indice ({0}) n''est pas positif" },<a name="line.526"></a>
+<FONT color="green">527</FONT>    <a name="line.527"></a>
+<FONT color="green">528</FONT>       // org.apache.commons.math.analysis.polynomials.PolynomialFunction<a name="line.528"></a>
+<FONT color="green">529</FONT>       // org.apache.commons.math.analysis.polynomials.PolynomialFunctionNewtonForm<a name="line.529"></a>
+<FONT color="green">530</FONT>       { "empty polynomials coefficients array",<a name="line.530"></a>
+<FONT color="green">531</FONT>         "tableau de coefficients polyn\u00f4miaux vide" },<a name="line.531"></a>
+<FONT color="green">532</FONT>    <a name="line.532"></a>
+<FONT color="green">533</FONT>       // org.apache.commons.math.analysis.polynomials.PolynomialFunctionNewtonForm<a name="line.533"></a>
+<FONT color="green">534</FONT>       { "array sizes should have difference 1 ({0} != {1} + 1)",<a name="line.534"></a>
+<FONT color="green">535</FONT>         "les tableaux devraient avoir une diff\u00e9rence de taille de 1 ({0} != {1} + 1)" },<a name="line.535"></a>
+<FONT color="green">536</FONT>    <a name="line.536"></a>
+<FONT color="green">537</FONT>       // org.apache.commons.math.analysis.polynomials.PolynomialFunctionLagrangeForm<a name="line.537"></a>
+<FONT color="green">538</FONT>       { "identical abscissas x[{0}] == x[{1}] == {2} cause division by zero",<a name="line.538"></a>
+<FONT color="green">539</FONT>         "division par z\u00e9ro caus\u00e9e par les abscisses identiques x[{0}] == x[{1}] == {2}" },<a name="line.539"></a>
+<FONT color="green">540</FONT>    <a name="line.540"></a>
+<FONT color="green">541</FONT>       // org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction<a name="line.541"></a>
+<FONT color="green">542</FONT>       { "spline partition must have at least {0} points, got {1}",<a name="line.542"></a>
+<FONT color="green">543</FONT>         "une partiction spline n\u00e9cessite au moins {0} points, seuls {1} ont \u00e9t\u00e9 fournis" },<a name="line.543"></a>
+<FONT color="green">544</FONT>       { "knot values must be strictly increasing",<a name="line.544"></a>
+<FONT color="green">545</FONT>         "les n\u0153uds d''interpolation doivent \u00eatre strictement croissants" },<a name="line.545"></a>
+<FONT color="green">546</FONT>       { "number of polynomial interpolants must match the number of segments ({0} != {1} - 1)",<a name="line.546"></a>
+<FONT color="green">547</FONT>         "le nombre d''interpolants polyn\u00f4miaux doit correspondre au nombre de segments ({0} != {1} - 1)" },<a name="line.547"></a>
+<FONT color="green">548</FONT>    <a name="line.548"></a>
+<FONT color="green">549</FONT>       // org.apache.commons.math.analysis.solvers.UnivariateRealSolverImpl<a name="line.549"></a>
+<FONT color="green">550</FONT>       { "function to solve cannot be null",<a name="line.550"></a>
+<FONT color="green">551</FONT>         "la fonction \u00e0 r\u00e9soudre ne peux pas \u00eatre nulle" },<a name="line.551"></a>
+<FONT color="green">552</FONT>       { "invalid interval, initial value parameters:  lower={0}, initial={1}, upper={2}",<a name="line.552"></a>
+<FONT color="green">553</FONT>         "param\u00e8tres de l''intervalle initial invalides : borne inf = {0}, valeur initiale = {1}, borne sup = {2}" },<a name="line.553"></a>
+<FONT color="green">554</FONT>    <a name="line.554"></a>
+<FONT color="green">555</FONT>       // org.apache.commons.math.analysis.solvers.UnivariateRealSolverImpl<a name="line.555"></a>
+<FONT color="green">556</FONT>       // org.apache.commons.math.analysis.solvers.BrentSolver<a name="line.556"></a>
+<FONT color="green">557</FONT>       { "function values at endpoints do not have different signs.  Endpoints: [{0}, {1}], Values: [{2}, {3}]",<a name="line.557"></a>
+<FONT color="green">558</FONT>         "les valeurs de la fonction aux bornes n''ont pas des signes diff\u00e9rents. Bornes : [{0}, {1}], valeurs : [{2}, {3}]" },<a name="line.558"></a>
+<FONT color="green">559</FONT>    <a name="line.559"></a>
+<FONT color="green">560</FONT>       // org.apache.commons.math.analysis.solvers.UnivariateRealSolverImpl<a name="line.560"></a>
+<FONT color="green">561</FONT>       // org.apache.commons.math.analysis.integration.UnivariateRealIntegratorImpl<a name="line.561"></a>
+<FONT color="green">562</FONT>       // org.apache.commons.math.transform.FastFourierTransformer<a name="line.562"></a>
+<FONT color="green">563</FONT>       { "endpoints do not specify an interval: [{0}, {1}]",<a name="line.563"></a>
+<FONT color="green">564</FONT>         "les extr\u00e9mit\u00e9s ne constituent pas un intervalle : [{0}, {1}]" },<a name="line.564"></a>
+<FONT color="green">565</FONT>    <a name="line.565"></a>
+<FONT color="green">566</FONT>       // org.apache.commons.math.analysis.solvers.LaguerreSolver<a name="line.566"></a>
+<FONT color="green">567</FONT>       { "function is not polynomial",<a name="line.567"></a>
+<FONT color="green">568</FONT>         "la fonction n''est pas p\u00f4lynomiale" },<a name="line.568"></a>
+<FONT color="green">569</FONT>    <a name="line.569"></a>
+<FONT color="green">570</FONT>       // org.apache.commons.math.analysis.solvers.NewtonSolver<a name="line.570"></a>
+<FONT color="green">571</FONT>       { "function is not differentiable",<a name="line.571"></a>
+<FONT color="green">572</FONT>         "la fonction n''est pas diff\u00e9rentiable" },<a name="line.572"></a>
+<FONT color="green">573</FONT>    <a name="line.573"></a>
+<FONT color="green">574</FONT>       // org.apache.commons.math.analysis.integration.UnivariateRealIntegratorImpl<a name="line.574"></a>
+<FONT color="green">575</FONT>       { "invalid iteration limits: min={0}, max={1}",<a name="line.575"></a>
+<FONT color="green">576</FONT>         "limites d''it\u00e9rations invalides : min = {0}, max = {1}" },<a name="line.576"></a>
+<FONT color="green">577</FONT>    <a name="line.577"></a>
+<FONT color="green">578</FONT>       // org.apache.commons.math.analysis.integration.LegendreGaussIntegrator<a name="line.578"></a>
+<FONT color="green">579</FONT>       { "{0} points Legendre-Gauss integrator not supported," +<a name="line.579"></a>
+<FONT color="green">580</FONT>         " number of points must be in the {1}-{2} range",<a name="line.580"></a>
+<FONT color="green">581</FONT>         "int\u00e9grateur de Legendre-Gauss non support\u00e9 en {0} points, " +<a name="line.581"></a>
+<FONT color="green">582</FONT>         "le nombre de points doit \u00eatre entre {1} et {2}" },<a name="line.582"></a>
+<FONT color="green">583</FONT>    <a name="line.583"></a>
+<FONT color="green">584</FONT>       // org.apache.commons.math.fraction.Fraction<a name="line.584"></a>
+<FONT color="green">585</FONT>       { "zero denominator in fraction {0}/{1}",<a name="line.585"></a>
+<FONT color="green">586</FONT>         "d\u00e9nominateur null dans le nombre rationnel {0}/{1}" },<a name="line.586"></a>
+<FONT color="green">587</FONT>       { "overflow in fraction {0}/{1}, cannot negate",<a name="line.587"></a>
+<FONT color="green">588</FONT>         "d\u00e9passement de capacit\u00e9 pour la fraction {0}/{1}, son signe ne peut \u00eatre chang\u00e9" },<a name="line.588"></a>
+<FONT color="green">589</FONT>       { "overflow, numerator too large after multiply: {0}",<a name="line.589"></a>
+<FONT color="green">590</FONT>         "d\u00e9passement de capacit\u00e9 pour le num\u00e9rateur apr\u00e8s multiplication : {0}" },<a name="line.590"></a>
+<FONT color="green">591</FONT>       { "the fraction to divide by must not be zero: {0}/{1}",<a name="line.591"></a>
+<FONT color="green">592</FONT>         "division par un nombre rationnel nul : {0}/{1}" },<a name="line.592"></a>
+<FONT color="green">593</FONT>       { "null fraction",<a name="line.593"></a>
+<FONT color="green">594</FONT>         "fraction nulle" },<a name="line.594"></a>
+<FONT color="green">595</FONT>    <a name="line.595"></a>
+<FONT color="green">596</FONT>       // org.apache.commons.math.geometry.Rotation<a name="line.596"></a>
+<FONT color="green">597</FONT>       { "zero norm for rotation axis",<a name="line.597"></a>
+<FONT color="green">598</FONT>         "norme nulle pour un axe de rotation" },<a name="line.598"></a>
+<FONT color="green">599</FONT>       { "zero norm for rotation defining vector",<a name="line.599"></a>
+<FONT color="green">600</FONT>         "norme nulle pour un axe de d\u00e9finition de rotation" },<a name="line.600"></a>
+<FONT color="green">601</FONT>    <a name="line.601"></a>
+<FONT color="green">602</FONT>       // org.apache.commons.math.geometry.Vector3D<a name="line.602"></a>
+<FONT color="green">603</FONT>       // org.apache.commons.math.linear.ArrayRealVector<a name="line.603"></a>
+<FONT color="green">604</FONT>       { "cannot normalize a zero norm vector",<a name="line.604"></a>
+<FONT color="green">605</FONT>         "impossible de normer un vecteur de norme nulle" },<a name="line.605"></a>
+<FONT color="green">606</FONT>       { "zero norm",<a name="line.606"></a>
+<FONT color="green">607</FONT>         "norme nulle" },<a name="line.607"></a>
+<FONT color="green">608</FONT>    <a name="line.608"></a>
+<FONT color="green">609</FONT>       // org.apache.commons.math.ConvergingAlgorithmImpl<a name="line.609"></a>
+<FONT color="green">610</FONT>       { "no result available",<a name="line.610"></a>
+<FONT color="green">611</FONT>         "aucun r\u00e9sultat n''est disponible" },<a name="line.611"></a>
+<FONT color="green">612</FONT>    <a name="line.612"></a>
+<FONT color="green">613</FONT>       // org.apache.commons.math.linear.BigMatrixImpl<a name="line.613"></a>
+<FONT color="green">614</FONT>       { "first {0} rows are not initialized yet",<a name="line.614"></a>
+<FONT color="green">615</FONT>         "les {0} premi\u00e8res lignes ne sont pas encore initialis\u00e9es" },<a name="line.615"></a>
+<FONT color="green">616</FONT>       { "first {0} columns are not initialized yet",<a name="line.616"></a>
+<FONT color="green">617</FONT>         "les {0} premi\u00e8res colonnes ne sont pas encore initialis\u00e9es" },<a name="line.617"></a>
+<FONT color="green">618</FONT>    <a name="line.618"></a>
+<FONT color="green">619</FONT>       // org.apache.commons.math.stat.Frequency<a name="line.619"></a>
+<FONT color="green">620</FONT>       { "class ({0}) does not implement Comparable",<a name="line.620"></a>
+<FONT color="green">621</FONT>         "la classe ({0}) n''implante pas l''interface Comparable" },<a name="line.621"></a>
+<FONT color="green">622</FONT>       { "instance of class {0} not comparable to existing values",<a name="line.622"></a>
+<FONT color="green">623</FONT>         "l''instance de la classe {0} n''est pas comparable aux valeurs existantes" },<a name="line.623"></a>
+<FONT color="green">624</FONT>    <a name="line.624"></a>
+<FONT color="green">625</FONT>       // org.apache.commons.math.stat.StatUtils<a name="line.625"></a>
+<FONT color="green">626</FONT>       { "input arrays must have the same positive length ({0} and {1})",<a name="line.626"></a>
+<FONT color="green">627</FONT>         "les tableaux d''entr\u00e9e doivent avoir la m\u00eame taille positive ({0} et {1})" },<a name="line.627"></a>
+<FONT color="green">628</FONT>       { "input arrays must have the same length and at least two elements ({0} and {1})",<a name="line.628"></a>
+<FONT color="green">629</FONT>         "les tableaux d''entr\u00e9e doivent avoir la m\u00eame taille" +<a name="line.629"></a>
+<FONT color="green">630</FONT>         " et au moins deux \u00e9l\u00e9ments ({0} et {1})" },<a name="line.630"></a>
+<FONT color="green">631</FONT>    <a name="line.631"></a>
+<FONT color="green">632</FONT>       // org.apache.commons.math.stat.correlation.Covariance<a name="line.632"></a>
+<FONT color="green">633</FONT>       { "arrays must have the same length and both must have at " +<a name="line.633"></a>
+<FONT color="green">634</FONT>         "least two elements. xArray has size {0}, yArray has {1} elements",<a name="line.634"></a>
+<FONT color="green">635</FONT>         "les tableaux doivent avoir la m\u00eame taille " +<a name="line.635"></a>
+<FONT color="green">636</FONT>         "et comporter au moins deux \u00e9l\u00e9ments. " +<a name="line.636"></a>
+<FONT color="green">637</FONT>         "xArray a une taille de {0}, yArray a {1} \u00e9l\u00e9ments"},<a name="line.637"></a>
+<FONT color="green">638</FONT>       { "insufficient data: only {0} rows and {1} columns.",<a name="line.638"></a>
+<FONT color="green">639</FONT>         "donn\u00e9es insuffisantes : seulement {0} lignes et {1} colonnes." },<a name="line.639"></a>
+<FONT color="green">640</FONT>    <a name="line.640"></a>
+<FONT color="green">641</FONT>       // org.apache.commons.math.stat.correlation.PearsonsCorrelation<a name="line.641"></a>
+<FONT color="green">642</FONT>       { "covariance matrix is null",<a name="line.642"></a>
+<FONT color="green">643</FONT>         "la matrice de covariance est nulle" },<a name="line.643"></a>
+<FONT color="green">644</FONT>       { "invalid array dimensions. xArray has size {0}; yArray has {1} elements",<a name="line.644"></a>
+<FONT color="green">645</FONT>         "dimensions de tableaux invalides. xArray a une taille de {0}, " +<a name="line.645"></a>
+<FONT color="green">646</FONT>         "yArray a {1} \u00e9l\u00e9ments" },<a name="line.646"></a>
+<FONT color="green">647</FONT>    <a name="line.647"></a>
+<FONT color="green">648</FONT>       // org.apache.commons.math.stat.descriptive.DescriptiveStatistics<a name="line.648"></a>
+<FONT color="green">649</FONT>       { "window size must be positive ({0})",<a name="line.649"></a>
+<FONT color="green">650</FONT>         "la taille de la fen\u00eatre doit \u00eatre positive ({0})" },<a name="line.650"></a>
+<FONT color="green">651</FONT>       { "percentile implementation {0} does not support {1}",<a name="line.651"></a>
+<FONT color="green">652</FONT>         "l''implantation de pourcentage {0} ne dispose pas de la m\u00e9thode {1}" },<a name="line.652"></a>
+<FONT color="green">653</FONT>       { "cannot access {0} method in percentile implementation {1}",<a name="line.653"></a>
+<FONT color="green">654</FONT>         "acc\u00e8s impossible \u00e0 la m\u00e9thode {0}" +<a name="line.654"></a>
+<FONT color="green">655</FONT>         " dans l''implantation de pourcentage {1}" },<a name="line.655"></a>
+<FONT color="green">656</FONT>       { "out of bounds quantile value: {0}, must be in (0, 100]",<a name="line.656"></a>
+<FONT color="green">657</FONT>         "valeur de quantile {0} hors bornes, doit \u00eatre dans l''intervalle ]0, 100]" },<a name="line.657"></a>
+<FONT color="green">658</FONT>    <a name="line.658"></a>
+<FONT color="green">659</FONT>       // org.apache.commons.math.stat.descriptive.moment.Variance<a name="line.659"></a>
+<FONT color="green">660</FONT>       // org.apache.commons.math.stat.descriptive.moment.SemiVariance<a name="line.660"></a>
+<FONT color="green">661</FONT>       // org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic<a name="line.661"></a>
+<FONT color="green">662</FONT>       // org.apache.commons.math.stat.descriptive.AbstractUnivariateStatistic<a name="line.662"></a>
+<FONT color="green">663</FONT>       { "input values array is null",<a name="line.663"></a>
+<FONT color="green">664</FONT>         "le tableau des valeurs d''entr\u00e9es est nul" },<a name="line.664"></a>
+<FONT color="green">665</FONT>    <a name="line.665"></a>
+<FONT color="green">666</FONT>       // org.apache.commons.math.stat.descriptive.AbstractUnivariateStatistic<a name="line.666"></a>
+<FONT color="green">667</FONT>       { "start position cannot be negative ({0})",<a name="line.667"></a>
+<FONT color="green">668</FONT>         "la position de d\u00e9part ne peut pas \u00eatre n\u00e9gative" },<a name="line.668"></a>
+<FONT color="green">669</FONT>       { "length cannot be negative ({0})",<a name="line.669"></a>
+<FONT color="green">670</FONT>         "la longueur ne peut pas \u00eatre n\u00e9gative" },<a name="line.670"></a>
+<FONT color="green">671</FONT>       { "subarray ends after array end",<a name="line.671"></a>
+<FONT color="green">672</FONT>         "le sous-tableau se termine apr\u00e8s la fin du tableau" },<a name="line.672"></a>
+<FONT color="green">673</FONT>    <a name="line.673"></a>
+<FONT color="green">674</FONT>       // org.apache.commons.math.stat.descriptive.moment.GeometricMean<a name="line.674"></a>
+<FONT color="green">675</FONT>       // org.apache.commons.math.stat.descriptive.MultivariateSummaryStatistics<a name="line.675"></a>
+<FONT color="green">676</FONT>       // org.apache.commons.math.stat.descriptive.SummaryStatistics<a name="line.676"></a>
+<FONT color="green">677</FONT>       { "{0} values have been added before statistic is configured",<a name="line.677"></a>
+<FONT color="green">678</FONT>         "{0} valeurs ont \u00e9t\u00e9 ajout\u00e9es " +<a name="line.678"></a>
+<FONT color="green">679</FONT>         "avant que la statistique ne soit configur\u00e9e" },<a name="line.679"></a>
+<FONT color="green">680</FONT>    <a name="line.680"></a>
+<FONT color="green">681</FONT>       // org.apache.commons.math.stat.descriptive.moment.Kurtosis<a name="line.681"></a>
+<FONT color="green">682</FONT>       { "statistics constructed from external moments cannot be incremented",<a name="line.682"></a>
+<FONT color="green">683</FONT>         "les statistiques bas\u00e9es sur des moments externes ne peuvent pas \u00eatre incr\u00e9ment\u00e9es" },<a name="line.683"></a>
+<FONT color="green">684</FONT>       { "statistics constructed from external moments cannot be cleared",<a name="line.684"></a>
+<FONT color="green">685</FONT>         "les statistiques bas\u00e9es sur des moments externes ne peuvent pas \u00eatre remises \u00e0 z\u00e9ro" },<a name="line.685"></a>
+<FONT color="green">686</FONT>    <a name="line.686"></a>
+<FONT color="green">687</FONT>       // org.apache.commons.math.stat.inference.ChiSquareTestImpl<a name="line.687"></a>
+<FONT color="green">688</FONT>       { "expected array length = {0}, must be at least 2",<a name="line.688"></a>
+<FONT color="green">689</FONT>         "le tableau des valeurs attendues a une longueur de {0}, elle devrait \u00eatre au moins de 2" },<a name="line.689"></a>
+<FONT color="green">690</FONT>       { "observed array length = {0}, must be at least 2",<a name="line.690"></a>
+<FONT color="green">691</FONT>         "le tableau des valeurs observ\u00e9es a une longueur de {0}, elle devrait \u00eatre au moins de 2" },<a name="line.691"></a>
+<FONT color="green">692</FONT>       { "observed counts are all 0 in first observed array",<a name="line.692"></a>
+<FONT color="green">693</FONT>         "aucune occurrence dans le premier tableau des observations" },<a name="line.693"></a>
+<FONT color="green">694</FONT>       { "observed counts are all 0 in second observed array",<a name="line.694"></a>
+<FONT color="green">695</FONT>         "aucune occurrence dans le second tableau des observations" },<a name="line.695"></a>
+<FONT color="green">696</FONT>       { "observed counts are both zero for entry {0}",<a name="line.696"></a>
+<FONT color="green">697</FONT>         "les occurrences observ\u00e9es sont toutes deux nulles pour l'entr\u00e9e {0}" },<a name="line.697"></a>
+<FONT color="green">698</FONT>       { "invalid row dimension: {0} (must be at least 2)",<a name="line.698"></a>
+<FONT color="green">699</FONT>         "nombre de lignes invalide : {0} (doit \u00eatre au moins de 2)" },<a name="line.699"></a>
+<FONT color="green">700</FONT>       { "invalid column dimension: {0} (must be at least 2)",<a name="line.700"></a>
+<FONT color="green">701</FONT>         "nombre de colonnes invalide : {0} (doit \u00eatre au moins de 2)" },<a name="line.701"></a>
+<FONT color="green">702</FONT>       { "element {0} is not positive: {1}",<a name="line.702"></a>
+<FONT color="green">703</FONT>         "l''\u00e9l\u00e9ment {0} n''est pas positif : {1}" },<a name="line.703"></a>
+<FONT color="green">704</FONT>       { "element {0} is negative: {1}",<a name="line.704"></a>
+<FONT color="green">705</FONT>         "l''\u00e9l\u00e9ment {0} est n\u00e9gatif : {1}" },<a name="line.705"></a>
+<FONT color="green">706</FONT>       { "element ({0}, {1}) is negative: {2}",<a name="line.706"></a>
+<FONT color="green">707</FONT>         "l''\u00e9l\u00e9ment ({0}, {1}) est n\u00e9gatif : {2}" },<a name="line.707"></a>
+<FONT color="green">708</FONT>    <a name="line.708"></a>
+<FONT color="green">709</FONT>       // org.apache.commons.math.stat.inference.OneWayAnovaImpl<a name="line.709"></a>
+<FONT color="green">710</FONT>       { "two or more categories required, got {0}",<a name="line.710"></a>
+<FONT color="green">711</FONT>         "deux cat\u00e9gories ou plus sont n\u00e9cessaires, il y en a {0}" },<a name="line.711"></a>
+<FONT color="green">712</FONT>       { "two or more values required in each category, one has {0}",<a name="line.712"></a>
+<FONT color="green">713</FONT>         "deux valeurs ou plus sont n\u00e9cessaires pour chaque cat\u00e9gorie, une cat\u00e9gorie en a {0}" },<a name="line.713"></a>
+<FONT color="green">714</FONT>    <a name="line.714"></a>
+<FONT color="green">715</FONT>       // org.apache.commons.math.stat.inference.TTestImpl<a name="line.715"></a>
+<FONT color="green">716</FONT>       { "insufficient data for t statistic, needs at least 2, got {0}",<a name="line.716"></a>
+<FONT color="green">717</FONT>         "deux valeurs ou plus sont n\u00e9cessaires pour la statistique t, il y en a {0}" },<a name="line.717"></a>
+<FONT color="green">718</FONT>    <a name="line.718"></a>
+<FONT color="green">719</FONT>       // org.apache.commons.math.stat.inference.ChiSquareTestImpl<a name="line.719"></a>
+<FONT color="green">720</FONT>       // org.apache.commons.math.stat.inference.TTestImpl<a name="line.720"></a>
+<FONT color="green">721</FONT>       // org.apache.commons.math.stat.inference.OneWayAnovaImpl<a name="line.721"></a>
+<FONT color="green">722</FONT>       // org.apache.commons.math.stat.Regression<a name="line.722"></a>
+<FONT color="green">723</FONT>       { "out of bounds significance level {0}, must be between {1} and {2}",<a name="line.723"></a>
+<FONT color="green">724</FONT>         "niveau de signification {0} hors domaine, doit \u00eatre entre {1} et {2}" },<a name="line.724"></a>
+<FONT color="green">725</FONT>    <a name="line.725"></a>
+<FONT color="green">726</FONT>       // org.apache.commons.math.stat.regression.AbstractMultipleLinearRegression<a name="line.726"></a>
+<FONT color="green">727</FONT>       { "not enough data ({0} rows) for this many predictors ({1} predictors)",<a name="line.727"></a>
+<FONT color="green">728</FONT>         "pas assez de donn\u00e9es ({0} lignes) pour {1} pr\u00e9dicteurs" },<a name="line.728"></a>
+<FONT color="green">729</FONT>    <a name="line.729"></a>
+<FONT color="green">730</FONT>       // org.apache.commons.math.distribution.AbstractContinuousDistribution<a name="line.730"></a>
+<FONT color="green">731</FONT>       // org.apache.commons.math.distribution.AbstractIntegerDistribution<a name="line.731"></a>
+<FONT color="green">732</FONT>       // org.apache.commons.math.distribution.ExponentialDistributionImpl<a name="line.732"></a>
+<FONT color="green">733</FONT>       // org.apache.commons.math.distribution.BinomialDistributionImpl<a name="line.733"></a>
+<FONT color="green">734</FONT>       // org.apache.commons.math.distribution.CauchyDistributionImpl<a name="line.734"></a>
+<FONT color="green">735</FONT>       // org.apache.commons.math.distribution.PascalDistributionImpl<a name="line.735"></a>
+<FONT color="green">736</FONT>       // org.apache.commons.math.distribution.WeibullDistributionImpl<a name="line.736"></a>
+<FONT color="green">737</FONT>       { "{0} out of [{1}, {2}] range",<a name="line.737"></a>
+<FONT color="green">738</FONT>         "{0} hors du domaine [{1}, {2}]" },<a name="line.738"></a>
+<FONT color="green">739</FONT>    <a name="line.739"></a>
+<FONT color="green">740</FONT>       // org.apache.commons.math.distribution.AbstractDistribution<a name="line.740"></a>
+<FONT color="green">741</FONT>       // org.apache.commons.math.distribution.AbstractIntegerDistribution<a name="line.741"></a>
+<FONT color="green">742</FONT>       { "lower endpoint ({0}) must be less than or equal to upper endpoint ({1})",<a name="line.742"></a>
+<FONT color="green">743</FONT>         "la borne inf\u00e9rieure ({0}) devrait \u00eatre inf\u00e9rieure " +<a name="line.743"></a>
+<FONT color="green">744</FONT>         "ou \u00e9gale \u00e0 la borne sup\u00e9rieure ({1})" },<a name="line.744"></a>
+<FONT color="green">745</FONT>    <a name="line.745"></a>
+<FONT color="green">746</FONT>       // org.apache.commons.math.distribution.AbstractContinuousDistribution<a name="line.746"></a>
+<FONT color="green">747</FONT>       { "Cumulative probability function returned NaN for argument {0} p = {1}",<a name="line.747"></a>
+<FONT color="green">748</FONT>         "Fonction de probabilit\u00e9 cumulative retourn\u00e9 NaN \u00e0 l''argument de {0} p = {1}" },<a name="line.748"></a>
+<FONT color="green">749</FONT>       { "This distribution does not have a density function implemented",<a name="line.749"></a>
+<FONT color="green">750</FONT>         "La fonction de densit\u00e9 pour cette distribution n'a pas \u00e9t\u00e9 mis en oeuvre" },<a name="line.750"></a>
+<FONT color="green">751</FONT>    <a name="line.751"></a>
+<FONT color="green">752</FONT>       // org.apache.commons.math.distribution.AbstractIntegerDistribution<a name="line.752"></a>
+<FONT color="green">753</FONT>       { "Discrete cumulative probability function returned NaN for argument {0}",<a name="line.753"></a>
+<FONT color="green">754</FONT>         "Discr\u00e8tes fonction de probabilit\u00e9 cumulative retourn\u00e9 NaN \u00e0 l''argument de {0}" },<a name="line.754"></a>
+<FONT color="green">755</FONT>    <a name="line.755"></a>
+<FONT color="green">756</FONT>    <a name="line.756"></a>
+<FONT color="green">757</FONT>       // org.apache.commons.math.distribution.BinomialDistributionImpl<a name="line.757"></a>
+<FONT color="green">758</FONT>       { "number of trials must be non-negative ({0})",<a name="line.758"></a>
+<FONT color="green">759</FONT>         "le nombre d''essais ne doit pas \u00eatre n\u00e9gatif ({0})" },<a name="line.759"></a>
+<FONT color="green">760</FONT>    <a name="line.760"></a>
+<FONT color="green">761</FONT>       // org.apache.commons.math.distribution.ExponentialDistributionImpl<a name="line.761"></a>
+<FONT color="green">762</FONT>       // org.apache.commons.math.random.RandomDataImpl<a name="line.762"></a>
+<FONT color="green">763</FONT>       { "mean must be positive ({0})",<a name="line.763"></a>
+<FONT color="green">764</FONT>         "la moyenne doit \u00eatre positive ({0})" },<a name="line.764"></a>
+<FONT color="green">765</FONT>    <a name="line.765"></a>
+<FONT color="green">766</FONT>       // org.apache.commons.math.distribution.FDistributionImpl<a name="line.766"></a>
+<FONT color="green">767</FONT>       // org.apache.commons.math.distribution.TDistributionImpl<a name="line.767"></a>
+<FONT color="green">768</FONT>       { "degrees of freedom must be positive ({0})",<a name="line.768"></a>
+<FONT color="green">769</FONT>         "les degr\u00e9s de libert\u00e9 doivent \u00eatre positifs ({0})" },<a name="line.769"></a>
+<FONT color="green">770</FONT>    <a name="line.770"></a>
+<FONT color="green">771</FONT>       // org.apache.commons.math.distribution.GammaDistributionImpl<a name="line.771"></a>
+<FONT color="green">772</FONT>       { "alpha must be positive ({0})",<a name="line.772"></a>
+<FONT color="green">773</FONT>         "alpha doit \u00eatre positif ({0})" },<a name="line.773"></a>
+<FONT color="green">774</FONT>       { "beta must be positive ({0})",<a name="line.774"></a>
+<FONT color="green">775</FONT>         "beta doit \u00eatre positif ({0})" },<a name="line.775"></a>
+<FONT color="green">776</FONT>    <a name="line.776"></a>
+<FONT color="green">777</FONT>       // org.apache.commons.math.distribution.HypergeometricDistributionImpl<a name="line.777"></a>
+<FONT color="green">778</FONT>       { "number of successes ({0}) must be less than or equal to population size ({1})",<a name="line.778"></a>
+<FONT color="green">779</FONT>         "le nombre de succ\u00e8s doit \u00eatre inf\u00e9rieur " +<a name="line.779"></a>
+<FONT color="green">780</FONT>         "ou \u00e9gal \u00e0 la taille de la population ({1})" },<a name="line.780"></a>
+<FONT color="green">781</FONT>       { "sample size ({0}) must be less than or equal to population size ({1})",<a name="line.781"></a>
+<FONT color="green">782</FONT>         "la taille de l''\u00e9chantillon doit \u00eatre inf\u00e9rieure " +<a name="line.782"></a>
+<FONT color="green">783</FONT>         "ou \u00e9gale \u00e0 la taille de la population ({1})" },<a name="line.783"></a>
+<FONT color="green">784</FONT>       { "population size must be positive ({0})",<a name="line.784"></a>
+<FONT color="green">785</FONT>         "la taille de la population doit \u00eatre positive ({0})" },<a name="line.785"></a>
+<FONT color="green">786</FONT>    <a name="line.786"></a>
+<FONT color="green">787</FONT>       // org.apache.commons.math.distribution.HypergeometricDistributionImpl<a name="line.787"></a>
+<FONT color="green">788</FONT>       // org.apache.commons.math.random.RandomDataImpl<a name="line.788"></a>
+<FONT color="green">789</FONT>       { "sample size must be positive ({0})",<a name="line.789"></a>
+<FONT color="green">790</FONT>         "la taille de l''\u00e9chantillon doit \u00eatre positive ({0})" },<a name="line.790"></a>
+<FONT color="green">791</FONT>    <a name="line.791"></a>
+<FONT color="green">792</FONT>       // org.apache.commons.math.distribution.HypergeometricDistributionImpl<a name="line.792"></a>
+<FONT color="green">793</FONT>       // org.apache.commons.math.distribution.PascalDistributionImpl<a name="line.793"></a>
+<FONT color="green">794</FONT>       { "number of successes must be non-negative ({0})",<a name="line.794"></a>
+<FONT color="green">795</FONT>         "le nombre de succ\u00e8s ne doit pas \u00eatre n\u00e9gatif ({0})" },<a name="line.795"></a>
+<FONT color="green">796</FONT>    <a name="line.796"></a>
+<FONT color="green">797</FONT>       // org.apache.commons.math.distribution.NormalDistributionImpl<a name="line.797"></a>
+<FONT color="green">798</FONT>       // org.apache.commons.math.random.RandomDataImpl<a name="line.798"></a>
+<FONT color="green">799</FONT>       { "standard deviation must be positive ({0})",<a name="line.799"></a>
+<FONT color="green">800</FONT>         "l''\u00e9cart type doit \u00eatre positif ({0})" },<a name="line.800"></a>
+<FONT color="green">801</FONT>    <a name="line.801"></a>
+<FONT color="green">802</FONT>       // org.apache.commons.math.distribution.PoissonDistributionImpl<a name="line.802"></a>
+<FONT color="green">803</FONT>       // org.apache.commons.math.random.RandomDataImpl<a name="line.803"></a>
+<FONT color="green">804</FONT>       { "the Poisson mean must be positive ({0})",<a name="line.804"></a>
+<FONT color="green">805</FONT>         "la moyenne de Poisson doit \u00eatre positive ({0})" },<a name="line.805"></a>
+<FONT color="green">806</FONT>    <a name="line.806"></a>
+<FONT color="green">807</FONT>       // org.apache.commons.math.distribution.WeibullDistributionImpl<a name="line.807"></a>
+<FONT color="green">808</FONT>       { "shape must be positive ({0})",<a name="line.808"></a>
+<FONT color="green">809</FONT>         "le facteur de forme doit \u00eatre positif ({0})" },<a name="line.809"></a>
+<FONT color="green">810</FONT>    <a name="line.810"></a>
+<FONT color="green">811</FONT>       // org.apache.commons.math.distribution.WeibullDistributionImpl<a name="line.811"></a>
+<FONT color="green">812</FONT>       // org.apache.commons.math.distribution.CauchyDistributionImpl<a name="line.812"></a>
+<FONT color="green">813</FONT>       { "scale must be positive ({0})",<a name="line.813"></a>
+<FONT color="green">814</FONT>         "l''\u00e9chelle doit \u00eatre positive ({0})" },<a name="line.814"></a>
+<FONT color="green">815</FONT>    <a name="line.815"></a>
+<FONT color="green">816</FONT>       // org.apache.commons.math.distribution.ZipfDistributionImpl<a name="line.816"></a>
+<FONT color="green">817</FONT>       { "invalid number of elements {0} (must be positive)",<a name="line.817"></a>
+<FONT color="green">818</FONT>         "nombre d''\u00e9l\u00e9ments {0} invalide (doit \u00eatre positif)" },<a name="line.818"></a>
+<FONT color="green">819</FONT>       { "invalid exponent {0} (must be positive)",<a name="line.819"></a>
+<FONT color="green">820</FONT>         "exposant {0} invalide (doit \u00eatre positif)" },<a name="line.820"></a>
+<FONT color="green">821</FONT>    <a name="line.821"></a>
+<FONT color="green">822</FONT>       // org.apache.commons.math.transform.FastHadamardTransformer<a name="line.822"></a>
+<FONT color="green">823</FONT>       { "{0} is not a power of 2",<a name="line.823"></a>
+<FONT color="green">824</FONT>         "{0} n''est pas une puissance de 2" },<a name="line.824"></a>
+<FONT color="green">825</FONT>    <a name="line.825"></a>
+<FONT color="green">826</FONT>       // org.apache.commons.math.transform.FastFourierTransformer<a name="line.826"></a>
+<FONT color="green">827</FONT>       { "cannot compute 0-th root of unity, indefinite result",<a name="line.827"></a>
+<FONT color="green">828</FONT>         "impossible de calculer la racine z\u00e9roi\u00e8me de l''unit\u00e9, " +<a name="line.828"></a>
+<FONT color="green">829</FONT>         "r\u00e9sultat ind\u00e9fini" },<a name="line.829"></a>
+<FONT color="green">830</FONT>       { "roots of unity have not been computed yet",<a name="line.830"></a>
+<FONT color="green">831</FONT>         "les racines de l''unit\u00e9 n''ont pas encore \u00e9t\u00e9 calcul\u00e9es" },<a name="line.831"></a>
+<FONT color="green">832</FONT>       { "out of range root of unity index {0} (must be in [{1};{2}])",<a name="line.832"></a>
+<FONT color="green">833</FONT>         "index de racine de l''unit\u00e9 hors domaine (devrait \u00eatre dans [{1}; {2}])" },<a name="line.833"></a>
+<FONT color="green">834</FONT>       { "number of sample is not positive: {0}",<a name="line.834"></a>
+<FONT color="green">835</FONT>         "le nombre d''\u00e9chantillons n''est pas positif : {0}" },<a name="line.835"></a>
+<FONT color="green">836</FONT>       { "{0} is not a power of 2, consider padding for fix",<a name="line.836"></a>
+<FONT color="green">837</FONT>         "{0} n''est pas une puissance de 2, ajoutez des \u00e9l\u00e9ments pour corriger" },<a name="line.837"></a>
+<FONT color="green">838</FONT>       { "some dimensions don't match: {0} != {1}",<a name="line.838"></a>
+<FONT color="green">839</FONT>         "certaines dimensions sont incoh\u00e9rentes : {0} != {1}" },<a name="line.839"></a>
+<FONT color="green">840</FONT>    <a name="line.840"></a>
+<FONT color="green">841</FONT>       // org.apache.commons.math.transform.FastCosineTransformer<a name="line.841"></a>
+<FONT color="green">842</FONT>       { "{0} is not a power of 2 plus one",<a name="line.842"></a>
+<FONT color="green">843</FONT>         "{0} n''est pas une puissance de 2 plus un" },<a name="line.843"></a>
+<FONT color="green">844</FONT>    <a name="line.844"></a>
+<FONT color="green">845</FONT>       // org.apache.commons.math.transform.FastSineTransformer<a name="line.845"></a>
+<FONT color="green">846</FONT>       { "first element is not 0: {0}",<a name="line.846"></a>
+<FONT color="green">847</FONT>         "le premier \u00e9l\u00e9ment n''est pas nul : {0}" },<a name="line.847"></a>
+<FONT color="green">848</FONT>    <a name="line.848"></a>
+<FONT color="green">849</FONT>       // org.apache.commons.math.util.OpenIntToDoubleHashMap<a name="line.849"></a>
+<FONT color="green">850</FONT>       { "map has been modified while iterating",<a name="line.850"></a>
+<FONT color="green">851</FONT>         "la table d''adressage a \u00e9t\u00e9 modifi\u00e9e pendant l''it\u00e9ration" },<a name="line.851"></a>
+<FONT color="green">852</FONT>       { "iterator exhausted",<a name="line.852"></a>
+<FONT color="green">853</FONT>         "it\u00e9ration achev\u00e9e" },<a name="line.853"></a>
+<FONT color="green">854</FONT>    <a name="line.854"></a>
+<FONT color="green">855</FONT>       // org.apache.commons.math.MathRuntimeException<a name="line.855"></a>
+<FONT color="green">856</FONT>       { "internal error, please fill a bug report at {0}",<a name="line.856"></a>
+<FONT color="green">857</FONT>         "erreur interne, veuillez signaler l''erreur \u00e0 {0}" }<a name="line.857"></a>
+<FONT color="green">858</FONT>    <a name="line.858"></a>
+<FONT color="green">859</FONT>      };<a name="line.859"></a>
+<FONT color="green">860</FONT>    <a name="line.860"></a>
+<FONT color="green">861</FONT>      /**<a name="line.861"></a>
+<FONT color="green">862</FONT>       * Simple constructor.<a name="line.862"></a>
+<FONT color="green">863</FONT>       */<a name="line.863"></a>
+<FONT color="green">864</FONT>      public MessagesResources_fr() {<a name="line.864"></a>
+<FONT color="green">865</FONT>      }<a name="line.865"></a>
+<FONT color="green">866</FONT>    <a name="line.866"></a>
+<FONT color="green">867</FONT>      /**<a name="line.867"></a>
+<FONT color="green">868</FONT>       * Get the non-translated/translated messages arrays from this resource bundle.<a name="line.868"></a>
+<FONT color="green">869</FONT>       * @return non-translated/translated messages arrays<a name="line.869"></a>
+<FONT color="green">870</FONT>       */<a name="line.870"></a>
+<FONT color="green">871</FONT>      @Override<a name="line.871"></a>
+<FONT color="green">872</FONT>      public Object[][] getContents() {<a name="line.872"></a>
+<FONT color="green">873</FONT>        return CONTENTS.clone();<a name="line.873"></a>
+<FONT color="green">874</FONT>      }<a name="line.874"></a>
+<FONT color="green">875</FONT>    <a name="line.875"></a>
+<FONT color="green">876</FONT>    }<a name="line.876"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/BinaryFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,183 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.analysis;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Base class for {@link BivariateRealFunction} that can be composed with other functions.<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @since 2.1<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @version $Revision: 924453 $ $Date: 2010-03-17 16:05:20 -0400 (Wed, 17 Mar 2010) $<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public abstract class BinaryFunction implements BivariateRealFunction {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** The + operator method wrapped as a {@link BinaryFunction}. */<a name="line.32"></a>
+<FONT color="green">033</FONT>        public static final BinaryFunction ADD = new BinaryFunction() {<a name="line.33"></a>
+<FONT color="green">034</FONT>            /** {@inheritDoc} */<a name="line.34"></a>
+<FONT color="green">035</FONT>            @Override<a name="line.35"></a>
+<FONT color="green">036</FONT>            public double value(double x, double y) {<a name="line.36"></a>
+<FONT color="green">037</FONT>                return x + y;<a name="line.37"></a>
+<FONT color="green">038</FONT>            }<a name="line.38"></a>
+<FONT color="green">039</FONT>        };<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** The - operator method wrapped as a {@link BinaryFunction}. */<a name="line.41"></a>
+<FONT color="green">042</FONT>        public static final BinaryFunction SUBTRACT = new BinaryFunction() {<a name="line.42"></a>
+<FONT color="green">043</FONT>            /** {@inheritDoc} */<a name="line.43"></a>
+<FONT color="green">044</FONT>            @Override<a name="line.44"></a>
+<FONT color="green">045</FONT>            public double value(double x, double y) {<a name="line.45"></a>
+<FONT color="green">046</FONT>                return x - y;<a name="line.46"></a>
+<FONT color="green">047</FONT>            }<a name="line.47"></a>
+<FONT color="green">048</FONT>        };<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** The * operator method wrapped as a {@link BinaryFunction}. */<a name="line.50"></a>
+<FONT color="green">051</FONT>        public static final BinaryFunction MULTIPLY = new BinaryFunction() {<a name="line.51"></a>
+<FONT color="green">052</FONT>            /** {@inheritDoc} */<a name="line.52"></a>
+<FONT color="green">053</FONT>            @Override<a name="line.53"></a>
+<FONT color="green">054</FONT>            public double value(double x, double y) {<a name="line.54"></a>
+<FONT color="green">055</FONT>                return x * y;<a name="line.55"></a>
+<FONT color="green">056</FONT>            }<a name="line.56"></a>
+<FONT color="green">057</FONT>        };<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** The / operator method wrapped as a {@link BinaryFunction}. */<a name="line.59"></a>
+<FONT color="green">060</FONT>        public static final BinaryFunction DIVIDE = new BinaryFunction() {<a name="line.60"></a>
+<FONT color="green">061</FONT>            /** {@inheritDoc} */<a name="line.61"></a>
+<FONT color="green">062</FONT>            @Override<a name="line.62"></a>
+<FONT color="green">063</FONT>            public double value(double x, double y) {<a name="line.63"></a>
+<FONT color="green">064</FONT>                return x / y;<a name="line.64"></a>
+<FONT color="green">065</FONT>            }<a name="line.65"></a>
+<FONT color="green">066</FONT>        };<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /** The {@code Math.pow} method wrapped as a {@link BinaryFunction}. */<a name="line.68"></a>
+<FONT color="green">069</FONT>        public static final BinaryFunction POW = new BinaryFunction() {<a name="line.69"></a>
+<FONT color="green">070</FONT>            /** {@inheritDoc} */<a name="line.70"></a>
+<FONT color="green">071</FONT>            @Override<a name="line.71"></a>
+<FONT color="green">072</FONT>            public double value(double x, double y) {<a name="line.72"></a>
+<FONT color="green">073</FONT>                return Math.pow(x, y);<a name="line.73"></a>
+<FONT color="green">074</FONT>            }<a name="line.74"></a>
+<FONT color="green">075</FONT>        };<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** The {@code Math.atan2} method wrapped as a {@link BinaryFunction}. */<a name="line.77"></a>
+<FONT color="green">078</FONT>        public static final BinaryFunction ATAN2 = new BinaryFunction() {<a name="line.78"></a>
+<FONT color="green">079</FONT>            /** {@inheritDoc} */<a name="line.79"></a>
+<FONT color="green">080</FONT>            @Override<a name="line.80"></a>
+<FONT color="green">081</FONT>            public double value(double x, double y) {<a name="line.81"></a>
+<FONT color="green">082</FONT>                return Math.atan2(x, y);<a name="line.82"></a>
+<FONT color="green">083</FONT>            }<a name="line.83"></a>
+<FONT color="green">084</FONT>        };<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /** {@inheritDoc} */<a name="line.86"></a>
+<FONT color="green">087</FONT>        public abstract double value(double x, double y) throws FunctionEvaluationException;<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /** Get a composable function by fixing the first argument of the instance.<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @param fixedX fixed value of the first argument<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @return a function such that {@code f.value(y) == value(fixedX, y)}<a name="line.91"></a>
+<FONT color="green">092</FONT>         */<a name="line.92"></a>
+<FONT color="green">093</FONT>        public ComposableFunction fix1stArgument(final double fixedX) {<a name="line.93"></a>
+<FONT color="green">094</FONT>            return new ComposableFunction() {<a name="line.94"></a>
+<FONT color="green">095</FONT>                @Override<a name="line.95"></a>
+<FONT color="green">096</FONT>                /** {@inheritDoc} */<a name="line.96"></a>
+<FONT color="green">097</FONT>                public double value(double x) throws FunctionEvaluationException {<a name="line.97"></a>
+<FONT color="green">098</FONT>                    return BinaryFunction.this.value(fixedX, x);<a name="line.98"></a>
+<FONT color="green">099</FONT>                }<a name="line.99"></a>
+<FONT color="green">100</FONT>            };<a name="line.100"></a>
+<FONT color="green">101</FONT>        }<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        /** Get a composable function by fixing the second argument of the instance.<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @param fixedY fixed value of the second argument<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @return a function such that {@code f.value(x) == value(x, fixedY)}<a name="line.105"></a>
+<FONT color="green">106</FONT>         */<a name="line.106"></a>
+<FONT color="green">107</FONT>        public ComposableFunction fix2ndArgument(final double fixedY) {<a name="line.107"></a>
+<FONT color="green">108</FONT>            return new ComposableFunction() {<a name="line.108"></a>
+<FONT color="green">109</FONT>                @Override<a name="line.109"></a>
+<FONT color="green">110</FONT>                /** {@inheritDoc} */<a name="line.110"></a>
+<FONT color="green">111</FONT>                public double value(double x) throws FunctionEvaluationException {<a name="line.111"></a>
+<FONT color="green">112</FONT>                    return BinaryFunction.this.value(x, fixedY);<a name="line.112"></a>
+<FONT color="green">113</FONT>                }<a name="line.113"></a>
+<FONT color="green">114</FONT>            };<a name="line.114"></a>
+<FONT color="green">115</FONT>        }<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>    }<a name="line.117"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/BivariateRealFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,107 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.analysis;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * An interface representing a bivariate real function.<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @since 2.1<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @version $Revision: 924453 $ $Date: 2010-03-17 16:05:20 -0400 (Wed, 17 Mar 2010) $<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public interface BivariateRealFunction {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /**<a name="line.32"></a>
+<FONT color="green">033</FONT>         * Compute the value for the function.<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @param x abscissa for which the function value should be computed<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @param y ordinate for which the function value should be computed<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @return the value<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @throws FunctionEvaluationException if the function evaluation fails<a name="line.37"></a>
+<FONT color="green">038</FONT>         */<a name="line.38"></a>
+<FONT color="green">039</FONT>        double value(double x, double y) throws FunctionEvaluationException;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>    }<a name="line.41"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/ComposableFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,571 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.analysis;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Base class for {@link UnivariateRealFunction} that can be composed with other functions.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 2.1<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 924453 $ $Date: 2010-03-17 16:05:20 -0400 (Wed, 17 Mar 2010) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public abstract class ComposableFunction implements UnivariateRealFunction {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /** The constant function always returning 0. */<a name="line.31"></a>
+<FONT color="green">032</FONT>        public static final ComposableFunction ZERO = new ComposableFunction() {<a name="line.32"></a>
+<FONT color="green">033</FONT>            /** {@inheritDoc} */<a name="line.33"></a>
+<FONT color="green">034</FONT>            @Override<a name="line.34"></a>
+<FONT color="green">035</FONT>            public double value(double d) {<a name="line.35"></a>
+<FONT color="green">036</FONT>                return 0;<a name="line.36"></a>
+<FONT color="green">037</FONT>            }<a name="line.37"></a>
+<FONT color="green">038</FONT>        };<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** The constant function always returning 1. */<a name="line.40"></a>
+<FONT color="green">041</FONT>        public static final ComposableFunction ONE = new ComposableFunction() {<a name="line.41"></a>
+<FONT color="green">042</FONT>            /** {@inheritDoc} */<a name="line.42"></a>
+<FONT color="green">043</FONT>            @Override<a name="line.43"></a>
+<FONT color="green">044</FONT>            public double value(double d) {<a name="line.44"></a>
+<FONT color="green">045</FONT>                return 1;<a name="line.45"></a>
+<FONT color="green">046</FONT>            }<a name="line.46"></a>
+<FONT color="green">047</FONT>        };<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** The identity function. */<a name="line.49"></a>
+<FONT color="green">050</FONT>        public static final ComposableFunction IDENTITY = new ComposableFunction() {<a name="line.50"></a>
+<FONT color="green">051</FONT>            /** {@inheritDoc} */<a name="line.51"></a>
+<FONT color="green">052</FONT>            @Override<a name="line.52"></a>
+<FONT color="green">053</FONT>            public double value(double d) {<a name="line.53"></a>
+<FONT color="green">054</FONT>                return d;<a name="line.54"></a>
+<FONT color="green">055</FONT>            }<a name="line.55"></a>
+<FONT color="green">056</FONT>        };<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /** The {@code Math.abs} method wrapped as a {@link ComposableFunction}. */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public static final ComposableFunction ABS = new ComposableFunction() {<a name="line.59"></a>
+<FONT color="green">060</FONT>            /** {@inheritDoc} */<a name="line.60"></a>
+<FONT color="green">061</FONT>            @Override<a name="line.61"></a>
+<FONT color="green">062</FONT>            public double value(double d) {<a name="line.62"></a>
+<FONT color="green">063</FONT>                return Math.abs(d);<a name="line.63"></a>
+<FONT color="green">064</FONT>            }<a name="line.64"></a>
+<FONT color="green">065</FONT>        };<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /** The - operator wrapped as a {@link ComposableFunction}. */<a name="line.67"></a>
+<FONT color="green">068</FONT>        public static final ComposableFunction NEGATE = new ComposableFunction() {<a name="line.68"></a>
+<FONT color="green">069</FONT>            /** {@inheritDoc} */<a name="line.69"></a>
+<FONT color="green">070</FONT>            @Override<a name="line.70"></a>
+<FONT color="green">071</FONT>            public double value(double d) {<a name="line.71"></a>
+<FONT color="green">072</FONT>                return -d;<a name="line.72"></a>
+<FONT color="green">073</FONT>            }<a name="line.73"></a>
+<FONT color="green">074</FONT>        };<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        /** The invert operator wrapped as a {@link ComposableFunction}. */<a name="line.76"></a>
+<FONT color="green">077</FONT>        public static final ComposableFunction INVERT = new ComposableFunction () {<a name="line.77"></a>
+<FONT color="green">078</FONT>            /** {@inheritDoc} */<a name="line.78"></a>
+<FONT color="green">079</FONT>            @Override<a name="line.79"></a>
+<FONT color="green">080</FONT>            public double value(double d){<a name="line.80"></a>
+<FONT color="green">081</FONT>                return 1/d;<a name="line.81"></a>
+<FONT color="green">082</FONT>            }<a name="line.82"></a>
+<FONT color="green">083</FONT>        };<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>        /** The {@code Math.sin} method wrapped as a {@link ComposableFunction}. */<a name="line.85"></a>
+<FONT color="green">086</FONT>        public static final ComposableFunction SIN = new ComposableFunction() {<a name="line.86"></a>
+<FONT color="green">087</FONT>            /** {@inheritDoc} */<a name="line.87"></a>
+<FONT color="green">088</FONT>            @Override<a name="line.88"></a>
+<FONT color="green">089</FONT>            public double value(double d) {<a name="line.89"></a>
+<FONT color="green">090</FONT>                return Math.sin(d);<a name="line.90"></a>
+<FONT color="green">091</FONT>            }<a name="line.91"></a>
+<FONT color="green">092</FONT>        };<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>        /** The {@code Math.sqrt} method wrapped as a {@link ComposableFunction}. */<a name="line.94"></a>
+<FONT color="green">095</FONT>        public static final ComposableFunction SQRT = new ComposableFunction() {<a name="line.95"></a>
+<FONT color="green">096</FONT>            /** {@inheritDoc} */<a name="line.96"></a>
+<FONT color="green">097</FONT>            @Override<a name="line.97"></a>
+<FONT color="green">098</FONT>            public double value(double d) {<a name="line.98"></a>
+<FONT color="green">099</FONT>                return Math.sqrt(d);<a name="line.99"></a>
+<FONT color="green">100</FONT>            }<a name="line.100"></a>
+<FONT color="green">101</FONT>        };<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        /** The {@code Math.sinh} method wrapped as a {@link ComposableFunction}. */<a name="line.103"></a>
+<FONT color="green">104</FONT>        public static final ComposableFunction SINH = new ComposableFunction() {<a name="line.104"></a>
+<FONT color="green">105</FONT>            /** {@inheritDoc} */<a name="line.105"></a>
+<FONT color="green">106</FONT>            @Override<a name="line.106"></a>
+<FONT color="green">107</FONT>            public double value(double d) {<a name="line.107"></a>
+<FONT color="green">108</FONT>                return Math.sinh(d);<a name="line.108"></a>
+<FONT color="green">109</FONT>            }<a name="line.109"></a>
+<FONT color="green">110</FONT>        };<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>        /** The {@code Math.exp} method wrapped as a {@link ComposableFunction}. */<a name="line.112"></a>
+<FONT color="green">113</FONT>        public static final ComposableFunction EXP = new ComposableFunction() {<a name="line.113"></a>
+<FONT color="green">114</FONT>            /** {@inheritDoc} */<a name="line.114"></a>
+<FONT color="green">115</FONT>            @Override<a name="line.115"></a>
+<FONT color="green">116</FONT>            public double value(double d) {<a name="line.116"></a>
+<FONT color="green">117</FONT>                return Math.exp(d);<a name="line.117"></a>
+<FONT color="green">118</FONT>            }<a name="line.118"></a>
+<FONT color="green">119</FONT>        };<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /** The {@code Math.expm1} method wrapped as a {@link ComposableFunction}. */<a name="line.121"></a>
+<FONT color="green">122</FONT>        public static final ComposableFunction EXPM1 = new ComposableFunction() {<a name="line.122"></a>
+<FONT color="green">123</FONT>            /** {@inheritDoc} */<a name="line.123"></a>
+<FONT color="green">124</FONT>            @Override<a name="line.124"></a>
+<FONT color="green">125</FONT>            public double value(double d) {<a name="line.125"></a>
+<FONT color="green">126</FONT>                return Math.expm1(d);<a name="line.126"></a>
+<FONT color="green">127</FONT>            }<a name="line.127"></a>
+<FONT color="green">128</FONT>        };<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /** The {@code Math.asin} method wrapped as a {@link ComposableFunction}. */<a name="line.130"></a>
+<FONT color="green">131</FONT>        public static final ComposableFunction ASIN = new ComposableFunction() {<a name="line.131"></a>
+<FONT color="green">132</FONT>            /** {@inheritDoc} */<a name="line.132"></a>
+<FONT color="green">133</FONT>            @Override<a name="line.133"></a>
+<FONT color="green">134</FONT>            public double value(double d) {<a name="line.134"></a>
+<FONT color="green">135</FONT>                return Math.asin(d);<a name="line.135"></a>
+<FONT color="green">136</FONT>            }<a name="line.136"></a>
+<FONT color="green">137</FONT>        };<a name="line.137"></a>
+<FONT color="green">138</FONT>    <a name="line.138"></a>
+<FONT color="green">139</FONT>        /** The {@code Math.atan} method wrapped as a {@link ComposableFunction}. */<a name="line.139"></a>
+<FONT color="green">140</FONT>        public static final ComposableFunction ATAN = new ComposableFunction() {<a name="line.140"></a>
+<FONT color="green">141</FONT>            /** {@inheritDoc} */<a name="line.141"></a>
+<FONT color="green">142</FONT>            @Override<a name="line.142"></a>
+<FONT color="green">143</FONT>            public double value(double d) {<a name="line.143"></a>
+<FONT color="green">144</FONT>                return Math.atan(d);<a name="line.144"></a>
+<FONT color="green">145</FONT>            }<a name="line.145"></a>
+<FONT color="green">146</FONT>        };<a name="line.146"></a>
+<FONT color="green">147</FONT>    <a name="line.147"></a>
+<FONT color="green">148</FONT>        /** The {@code Math.tan} method wrapped as a {@link ComposableFunction}. */<a name="line.148"></a>
+<FONT color="green">149</FONT>        public static final ComposableFunction TAN = new ComposableFunction() {<a name="line.149"></a>
+<FONT color="green">150</FONT>            /** {@inheritDoc} */<a name="line.150"></a>
+<FONT color="green">151</FONT>            @Override<a name="line.151"></a>
+<FONT color="green">152</FONT>            public double value(double d) {<a name="line.152"></a>
+<FONT color="green">153</FONT>                return Math.tan(d);<a name="line.153"></a>
+<FONT color="green">154</FONT>            }<a name="line.154"></a>
+<FONT color="green">155</FONT>        };<a name="line.155"></a>
+<FONT color="green">156</FONT>    <a name="line.156"></a>
+<FONT color="green">157</FONT>        /** The {@code Math.tanh} method wrapped as a {@link ComposableFunction}. */<a name="line.157"></a>
+<FONT color="green">158</FONT>        public static final ComposableFunction TANH = new ComposableFunction() {<a name="line.158"></a>
+<FONT color="green">159</FONT>            /** {@inheritDoc} */<a name="line.159"></a>
+<FONT color="green">160</FONT>            @Override<a name="line.160"></a>
+<FONT color="green">161</FONT>            public double value(double d) {<a name="line.161"></a>
+<FONT color="green">162</FONT>                return Math.tanh(d);<a name="line.162"></a>
+<FONT color="green">163</FONT>            }<a name="line.163"></a>
+<FONT color="green">164</FONT>        };<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>        /** The {@code Math.cbrt} method wrapped as a {@link ComposableFunction}. */<a name="line.166"></a>
+<FONT color="green">167</FONT>        public static final ComposableFunction CBRT = new ComposableFunction() {<a name="line.167"></a>
+<FONT color="green">168</FONT>            /** {@inheritDoc} */<a name="line.168"></a>
+<FONT color="green">169</FONT>            @Override<a name="line.169"></a>
+<FONT color="green">170</FONT>            public double value(double d) {<a name="line.170"></a>
+<FONT color="green">171</FONT>                return Math.cbrt(d);<a name="line.171"></a>
+<FONT color="green">172</FONT>            }<a name="line.172"></a>
+<FONT color="green">173</FONT>        };<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>        /** The {@code Math.ceil} method wrapped as a {@link ComposableFunction}. */<a name="line.175"></a>
+<FONT color="green">176</FONT>        public static final ComposableFunction CEIL = new ComposableFunction() {<a name="line.176"></a>
+<FONT color="green">177</FONT>            /** {@inheritDoc} */<a name="line.177"></a>
+<FONT color="green">178</FONT>            @Override<a name="line.178"></a>
+<FONT color="green">179</FONT>            public double value(double d) {<a name="line.179"></a>
+<FONT color="green">180</FONT>                return Math.ceil(d);<a name="line.180"></a>
+<FONT color="green">181</FONT>            }<a name="line.181"></a>
+<FONT color="green">182</FONT>        };<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>        /** The {@code Math.floor} method wrapped as a {@link ComposableFunction}. */<a name="line.184"></a>
+<FONT color="green">185</FONT>        public static final ComposableFunction FLOOR = new ComposableFunction() {<a name="line.185"></a>
+<FONT color="green">186</FONT>            /** {@inheritDoc} */<a name="line.186"></a>
+<FONT color="green">187</FONT>            @Override<a name="line.187"></a>
+<FONT color="green">188</FONT>            public double value(double d) {<a name="line.188"></a>
+<FONT color="green">189</FONT>                return Math.floor(d);<a name="line.189"></a>
+<FONT color="green">190</FONT>            }<a name="line.190"></a>
+<FONT color="green">191</FONT>        };<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>        /** The {@code Math.log} method wrapped as a {@link ComposableFunction}. */<a name="line.193"></a>
+<FONT color="green">194</FONT>        public static final ComposableFunction LOG = new ComposableFunction() {<a name="line.194"></a>
+<FONT color="green">195</FONT>            /** {@inheritDoc} */<a name="line.195"></a>
+<FONT color="green">196</FONT>            @Override<a name="line.196"></a>
+<FONT color="green">197</FONT>            public double value(double d) {<a name="line.197"></a>
+<FONT color="green">198</FONT>                return Math.log(d);<a name="line.198"></a>
+<FONT color="green">199</FONT>            }<a name="line.199"></a>
+<FONT color="green">200</FONT>        };<a name="line.200"></a>
+<FONT color="green">201</FONT>    <a name="line.201"></a>
+<FONT color="green">202</FONT>        /** The {@code Math.log10} method wrapped as a {@link ComposableFunction}. */<a name="line.202"></a>
+<FONT color="green">203</FONT>        public static final ComposableFunction LOG10 = new ComposableFunction() {<a name="line.203"></a>
+<FONT color="green">204</FONT>            /** {@inheritDoc} */<a name="line.204"></a>
+<FONT color="green">205</FONT>            @Override<a name="line.205"></a>
+<FONT color="green">206</FONT>            public double value(double d) {<a name="line.206"></a>
+<FONT color="green">207</FONT>                return Math.log10(d);<a name="line.207"></a>
+<FONT color="green">208</FONT>            }<a name="line.208"></a>
+<FONT color="green">209</FONT>        };<a name="line.209"></a>
+<FONT color="green">210</FONT>    <a name="line.210"></a>
+<FONT color="green">211</FONT>        /** The {@code Math.log1p} method wrapped as a {@link ComposableFunction}. */<a name="line.211"></a>
+<FONT color="green">212</FONT>        public static final ComposableFunction LOG1P = new ComposableFunction () {<a name="line.212"></a>
+<FONT color="green">213</FONT>            @Override<a name="line.213"></a>
+<FONT color="green">214</FONT>            public double value(double d){<a name="line.214"></a>
+<FONT color="green">215</FONT>                return Math.log1p(d);<a name="line.215"></a>
+<FONT color="green">216</FONT>            }<a name="line.216"></a>
+<FONT color="green">217</FONT>        };<a name="line.217"></a>
+<FONT color="green">218</FONT>    <a name="line.218"></a>
+<FONT color="green">219</FONT>        /** The {@code Math.cos} method wrapped as a {@link ComposableFunction}. */<a name="line.219"></a>
+<FONT color="green">220</FONT>        public static final ComposableFunction COS = new ComposableFunction() {<a name="line.220"></a>
+<FONT color="green">221</FONT>            /** {@inheritDoc} */<a name="line.221"></a>
+<FONT color="green">222</FONT>            @Override<a name="line.222"></a>
+<FONT color="green">223</FONT>            public double value(double d) {<a name="line.223"></a>
+<FONT color="green">224</FONT>                return Math.cos(d);<a name="line.224"></a>
+<FONT color="green">225</FONT>            }<a name="line.225"></a>
+<FONT color="green">226</FONT>        };<a name="line.226"></a>
+<FONT color="green">227</FONT>    <a name="line.227"></a>
+<FONT color="green">228</FONT>        /** The {@code Math.abs} method wrapped as a {@link ComposableFunction}. */<a name="line.228"></a>
+<FONT color="green">229</FONT>        public static final ComposableFunction ACOS = new ComposableFunction() {<a name="line.229"></a>
+<FONT color="green">230</FONT>            /** {@inheritDoc} */<a name="line.230"></a>
+<FONT color="green">231</FONT>            @Override<a name="line.231"></a>
+<FONT color="green">232</FONT>            public double value(double d) {<a name="line.232"></a>
+<FONT color="green">233</FONT>                return Math.acos(d);<a name="line.233"></a>
+<FONT color="green">234</FONT>            }<a name="line.234"></a>
+<FONT color="green">235</FONT>        };<a name="line.235"></a>
+<FONT color="green">236</FONT>    <a name="line.236"></a>
+<FONT color="green">237</FONT>        /** The {@code Math.cosh} method wrapped as a {@link ComposableFunction}. */<a name="line.237"></a>
+<FONT color="green">238</FONT>        public static final ComposableFunction COSH = new ComposableFunction() {<a name="line.238"></a>
+<FONT color="green">239</FONT>            /** {@inheritDoc} */<a name="line.239"></a>
+<FONT color="green">240</FONT>            @Override<a name="line.240"></a>
+<FONT color="green">241</FONT>            public double value(double d) {<a name="line.241"></a>
+<FONT color="green">242</FONT>                return Math.cosh(d);<a name="line.242"></a>
+<FONT color="green">243</FONT>            }<a name="line.243"></a>
+<FONT color="green">244</FONT>        };<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>        /** The {@code Math.rint} method wrapped as a {@link ComposableFunction}. */<a name="line.246"></a>
+<FONT color="green">247</FONT>        public static final ComposableFunction RINT = new ComposableFunction() {<a name="line.247"></a>
+<FONT color="green">248</FONT>            /** {@inheritDoc} */<a name="line.248"></a>
+<FONT color="green">249</FONT>            @Override<a name="line.249"></a>
+<FONT color="green">250</FONT>            public double value(double d) {<a name="line.250"></a>
+<FONT color="green">251</FONT>                return Math.rint(d);<a name="line.251"></a>
+<FONT color="green">252</FONT>            }<a name="line.252"></a>
+<FONT color="green">253</FONT>        };<a name="line.253"></a>
+<FONT color="green">254</FONT>    <a name="line.254"></a>
+<FONT color="green">255</FONT>        /** The {@code Math.signum} method wrapped as a {@link ComposableFunction}. */<a name="line.255"></a>
+<FONT color="green">256</FONT>        public static final ComposableFunction SIGNUM = new ComposableFunction() {<a name="line.256"></a>
+<FONT color="green">257</FONT>            /** {@inheritDoc} */<a name="line.257"></a>
+<FONT color="green">258</FONT>            @Override<a name="line.258"></a>
+<FONT color="green">259</FONT>            public double value(double d) {<a name="line.259"></a>
+<FONT color="green">260</FONT>                return Math.signum(d);<a name="line.260"></a>
+<FONT color="green">261</FONT>            }<a name="line.261"></a>
+<FONT color="green">262</FONT>        };<a name="line.262"></a>
+<FONT color="green">263</FONT>    <a name="line.263"></a>
+<FONT color="green">264</FONT>        /** The {@code Math.ulp} method wrapped as a {@link ComposableFunction}. */<a name="line.264"></a>
+<FONT color="green">265</FONT>        public static final ComposableFunction ULP = new ComposableFunction() {<a name="line.265"></a>
+<FONT color="green">266</FONT>            /** {@inheritDoc} */<a name="line.266"></a>
+<FONT color="green">267</FONT>            @Override<a name="line.267"></a>
+<FONT color="green">268</FONT>            public double value(double d) {<a name="line.268"></a>
+<FONT color="green">269</FONT>                return Math.ulp(d);<a name="line.269"></a>
+<FONT color="green">270</FONT>            }<a name="line.270"></a>
+<FONT color="green">271</FONT>        };<a name="line.271"></a>
+<FONT color="green">272</FONT>    <a name="line.272"></a>
+<FONT color="green">273</FONT>        /** Precompose the instance with another function.<a name="line.273"></a>
+<FONT color="green">274</FONT>         * &lt;p&gt;<a name="line.274"></a>
+<FONT color="green">275</FONT>         * The composed function h created by {@code h = g.of(f)} is such<a name="line.275"></a>
+<FONT color="green">276</FONT>         * that {@code h.value(x) == g.value(f.value(x))} for all x.<a name="line.276"></a>
+<FONT color="green">277</FONT>         * &lt;/p&gt;<a name="line.277"></a>
+<FONT color="green">278</FONT>         * @param f function to compose with<a name="line.278"></a>
+<FONT color="green">279</FONT>         * @return a new function which computes {@code this.value(f.value(x))}<a name="line.279"></a>
+<FONT color="green">280</FONT>         * @see #postCompose(UnivariateRealFunction)<a name="line.280"></a>
+<FONT color="green">281</FONT>         */<a name="line.281"></a>
+<FONT color="green">282</FONT>        public ComposableFunction of(final UnivariateRealFunction f) {<a name="line.282"></a>
+<FONT color="green">283</FONT>            return new ComposableFunction() {<a name="line.283"></a>
+<FONT color="green">284</FONT>                @Override<a name="line.284"></a>
+<FONT color="green">285</FONT>                /** {@inheritDoc} */<a name="line.285"></a>
+<FONT color="green">286</FONT>                public double value(double x) throws FunctionEvaluationException {<a name="line.286"></a>
+<FONT color="green">287</FONT>                    return ComposableFunction.this.value(f.value(x));<a name="line.287"></a>
+<FONT color="green">288</FONT>                }<a name="line.288"></a>
+<FONT color="green">289</FONT>            };<a name="line.289"></a>
+<FONT color="green">290</FONT>        }<a name="line.290"></a>
+<FONT color="green">291</FONT>    <a name="line.291"></a>
+<FONT color="green">292</FONT>        /** Postcompose the instance with another function.<a name="line.292"></a>
+<FONT color="green">293</FONT>         * &lt;p&gt;<a name="line.293"></a>
+<FONT color="green">294</FONT>         * The composed function h created by {@code h = g.postCompose(f)} is such<a name="line.294"></a>
+<FONT color="green">295</FONT>         * that {@code h.value(x) == f.value(g.value(x))} for all x.<a name="line.295"></a>
+<FONT color="green">296</FONT>         * &lt;/p&gt;<a name="line.296"></a>
+<FONT color="green">297</FONT>         * @param f function to compose with<a name="line.297"></a>
+<FONT color="green">298</FONT>         * @return a new function which computes {@code f.value(this.value(x))}<a name="line.298"></a>
+<FONT color="green">299</FONT>         * @see #of(UnivariateRealFunction)<a name="line.299"></a>
+<FONT color="green">300</FONT>         */<a name="line.300"></a>
+<FONT color="green">301</FONT>        public ComposableFunction postCompose(final UnivariateRealFunction f) {<a name="line.301"></a>
+<FONT color="green">302</FONT>            return new ComposableFunction() {<a name="line.302"></a>
+<FONT color="green">303</FONT>                @Override<a name="line.303"></a>
+<FONT color="green">304</FONT>                /** {@inheritDoc} */<a name="line.304"></a>
+<FONT color="green">305</FONT>                public double value(double x) throws FunctionEvaluationException {<a name="line.305"></a>
+<FONT color="green">306</FONT>                    return f.value(ComposableFunction.this.value(x));<a name="line.306"></a>
+<FONT color="green">307</FONT>                }<a name="line.307"></a>
+<FONT color="green">308</FONT>            };<a name="line.308"></a>
+<FONT color="green">309</FONT>        }<a name="line.309"></a>
+<FONT color="green">310</FONT>    <a name="line.310"></a>
+<FONT color="green">311</FONT>        /**<a name="line.311"></a>
+<FONT color="green">312</FONT>         * Return a function combining the instance and another function.<a name="line.312"></a>
+<FONT color="green">313</FONT>         * &lt;p&gt;<a name="line.313"></a>
+<FONT color="green">314</FONT>         * The function h created by {@code h = g.combine(f, combiner)} is such that<a name="line.314"></a>
+<FONT color="green">315</FONT>         * {@code h.value(x) == combiner.value(g.value(x), f.value(x))} for all x.<a name="line.315"></a>
+<FONT color="green">316</FONT>         * &lt;/p&gt;<a name="line.316"></a>
+<FONT color="green">317</FONT>         * @param f function to combine with the instance<a name="line.317"></a>
+<FONT color="green">318</FONT>         * @param combiner bivariate function used for combining<a name="line.318"></a>
+<FONT color="green">319</FONT>         * @return a new function which computes {@code combine.value(this.value(x), f.value(x))}<a name="line.319"></a>
+<FONT color="green">320</FONT>         */<a name="line.320"></a>
+<FONT color="green">321</FONT>        public ComposableFunction combine(final UnivariateRealFunction f,<a name="line.321"></a>
+<FONT color="green">322</FONT>                                          final BivariateRealFunction combiner) {<a name="line.322"></a>
+<FONT color="green">323</FONT>            return new ComposableFunction() {<a name="line.323"></a>
+<FONT color="green">324</FONT>                @Override<a name="line.324"></a>
+<FONT color="green">325</FONT>                /** {@inheritDoc} */<a name="line.325"></a>
+<FONT color="green">326</FONT>                public double value(double x) throws FunctionEvaluationException {<a name="line.326"></a>
+<FONT color="green">327</FONT>                    return combiner.value(ComposableFunction.this.value(x), f.value(x));<a name="line.327"></a>
+<FONT color="green">328</FONT>                }<a name="line.328"></a>
+<FONT color="green">329</FONT>            };<a name="line.329"></a>
+<FONT color="green">330</FONT>        }<a name="line.330"></a>
+<FONT color="green">331</FONT>    <a name="line.331"></a>
+<FONT color="green">332</FONT>        /**<a name="line.332"></a>
+<FONT color="green">333</FONT>         * Return a function adding the instance and another function.<a name="line.333"></a>
+<FONT color="green">334</FONT>         * @param f function to combine with the instance<a name="line.334"></a>
+<FONT color="green">335</FONT>         * @return a new function which computes {@code this.value(x) + f.value(x)}<a name="line.335"></a>
+<FONT color="green">336</FONT>         */<a name="line.336"></a>
+<FONT color="green">337</FONT>        public ComposableFunction add(final UnivariateRealFunction f) {<a name="line.337"></a>
+<FONT color="green">338</FONT>            return new ComposableFunction() {<a name="line.338"></a>
+<FONT color="green">339</FONT>                @Override<a name="line.339"></a>
+<FONT color="green">340</FONT>                /** {@inheritDoc} */<a name="line.340"></a>
+<FONT color="green">341</FONT>                public double value(double x) throws FunctionEvaluationException {<a name="line.341"></a>
+<FONT color="green">342</FONT>                    return ComposableFunction.this.value(x) + f.value(x);<a name="line.342"></a>
+<FONT color="green">343</FONT>                }<a name="line.343"></a>
+<FONT color="green">344</FONT>            };<a name="line.344"></a>
+<FONT color="green">345</FONT>        }<a name="line.345"></a>
+<FONT color="green">346</FONT>    <a name="line.346"></a>
+<FONT color="green">347</FONT>        /**<a name="line.347"></a>
+<FONT color="green">348</FONT>         * Return a function adding a constant term to the instance.<a name="line.348"></a>
+<FONT color="green">349</FONT>         * @param a term to add<a name="line.349"></a>
+<FONT color="green">350</FONT>         * @return a new function which computes {@code this.value(x) + a}<a name="line.350"></a>
+<FONT color="green">351</FONT>         */<a name="line.351"></a>
+<FONT color="green">352</FONT>        public ComposableFunction add(final double a) {<a name="line.352"></a>
+<FONT color="green">353</FONT>            return new ComposableFunction() {<a name="line.353"></a>
+<FONT color="green">354</FONT>                @Override<a name="line.354"></a>
+<FONT color="green">355</FONT>                /** {@inheritDoc} */<a name="line.355"></a>
+<FONT color="green">356</FONT>                public double value(double x) throws FunctionEvaluationException {<a name="line.356"></a>
+<FONT color="green">357</FONT>                    return ComposableFunction.this.value(x) + a;<a name="line.357"></a>
+<FONT color="green">358</FONT>                }<a name="line.358"></a>
+<FONT color="green">359</FONT>            };<a name="line.359"></a>
+<FONT color="green">360</FONT>        }<a name="line.360"></a>
+<FONT color="green">361</FONT>    <a name="line.361"></a>
+<FONT color="green">362</FONT>        /**<a name="line.362"></a>
+<FONT color="green">363</FONT>         * Return a function subtracting another function from the instance.<a name="line.363"></a>
+<FONT color="green">364</FONT>         * @param f function to combine with the instance<a name="line.364"></a>
+<FONT color="green">365</FONT>         * @return a new function which computes {@code this.value(x) - f.value(x)}<a name="line.365"></a>
+<FONT color="green">366</FONT>         */<a name="line.366"></a>
+<FONT color="green">367</FONT>        public ComposableFunction subtract(final UnivariateRealFunction f) {<a name="line.367"></a>
+<FONT color="green">368</FONT>            return new ComposableFunction() {<a name="line.368"></a>
+<FONT color="green">369</FONT>                @Override<a name="line.369"></a>
+<FONT color="green">370</FONT>                /** {@inheritDoc} */<a name="line.370"></a>
+<FONT color="green">371</FONT>                public double value(double x) throws FunctionEvaluationException {<a name="line.371"></a>
+<FONT color="green">372</FONT>                    return ComposableFunction.this.value(x) - f.value(x);<a name="line.372"></a>
+<FONT color="green">373</FONT>                }<a name="line.373"></a>
+<FONT color="green">374</FONT>            };<a name="line.374"></a>
+<FONT color="green">375</FONT>        }<a name="line.375"></a>
+<FONT color="green">376</FONT>    <a name="line.376"></a>
+<FONT color="green">377</FONT>        /**<a name="line.377"></a>
+<FONT color="green">378</FONT>         * Return a function multiplying the instance and another function.<a name="line.378"></a>
+<FONT color="green">379</FONT>         * @param f function to combine with the instance<a name="line.379"></a>
+<FONT color="green">380</FONT>         * @return a new function which computes {@code this.value(x) * f.value(x)}<a name="line.380"></a>
+<FONT color="green">381</FONT>         */<a name="line.381"></a>
+<FONT color="green">382</FONT>        public ComposableFunction multiply(final UnivariateRealFunction f) {<a name="line.382"></a>
+<FONT color="green">383</FONT>            return new ComposableFunction() {<a name="line.383"></a>
+<FONT color="green">384</FONT>                @Override<a name="line.384"></a>
+<FONT color="green">385</FONT>                /** {@inheritDoc} */<a name="line.385"></a>
+<FONT color="green">386</FONT>                public double value(double x) throws FunctionEvaluationException {<a name="line.386"></a>
+<FONT color="green">387</FONT>                    return ComposableFunction.this.value(x) * f.value(x);<a name="line.387"></a>
+<FONT color="green">388</FONT>                }<a name="line.388"></a>
+<FONT color="green">389</FONT>            };<a name="line.389"></a>
+<FONT color="green">390</FONT>        }<a name="line.390"></a>
+<FONT color="green">391</FONT>    <a name="line.391"></a>
+<FONT color="green">392</FONT>        /**<a name="line.392"></a>
+<FONT color="green">393</FONT>         * Return a function scaling the instance by a constant factor.<a name="line.393"></a>
+<FONT color="green">394</FONT>         * @param scaleFactor constant scaling factor<a name="line.394"></a>
+<FONT color="green">395</FONT>         * @return a new function which computes {@code this.value(x) * scaleFactor}<a name="line.395"></a>
+<FONT color="green">396</FONT>         */<a name="line.396"></a>
+<FONT color="green">397</FONT>        public ComposableFunction multiply(final double scaleFactor) {<a name="line.397"></a>
+<FONT color="green">398</FONT>            return new ComposableFunction() {<a name="line.398"></a>
+<FONT color="green">399</FONT>                @Override<a name="line.399"></a>
+<FONT color="green">400</FONT>                /** {@inheritDoc} */<a name="line.400"></a>
+<FONT color="green">401</FONT>                public double value(double x) throws FunctionEvaluationException {<a name="line.401"></a>
+<FONT color="green">402</FONT>                    return ComposableFunction.this.value(x) * scaleFactor;<a name="line.402"></a>
+<FONT color="green">403</FONT>                }<a name="line.403"></a>
+<FONT color="green">404</FONT>            };<a name="line.404"></a>
+<FONT color="green">405</FONT>        }<a name="line.405"></a>
+<FONT color="green">406</FONT>        /**<a name="line.406"></a>
+<FONT color="green">407</FONT>         * Return a function dividing the instance by another function.<a name="line.407"></a>
+<FONT color="green">408</FONT>         * @param f function to combine with the instance<a name="line.408"></a>
+<FONT color="green">409</FONT>         * @return a new function which computes {@code this.value(x) / f.value(x)}<a name="line.409"></a>
+<FONT color="green">410</FONT>         */<a name="line.410"></a>
+<FONT color="green">411</FONT>        public ComposableFunction divide(final UnivariateRealFunction f) {<a name="line.411"></a>
+<FONT color="green">412</FONT>            return new ComposableFunction() {<a name="line.412"></a>
+<FONT color="green">413</FONT>                @Override<a name="line.413"></a>
+<FONT color="green">414</FONT>                /** {@inheritDoc} */<a name="line.414"></a>
+<FONT color="green">415</FONT>                public double value(double x) throws FunctionEvaluationException {<a name="line.415"></a>
+<FONT color="green">416</FONT>                    return ComposableFunction.this.value(x) / f.value(x);<a name="line.416"></a>
+<FONT color="green">417</FONT>                }<a name="line.417"></a>
+<FONT color="green">418</FONT>            };<a name="line.418"></a>
+<FONT color="green">419</FONT>        }<a name="line.419"></a>
+<FONT color="green">420</FONT>    <a name="line.420"></a>
+<FONT color="green">421</FONT>        /**<a name="line.421"></a>
+<FONT color="green">422</FONT>         * Generates a function that iteratively apply instance function on all<a name="line.422"></a>
+<FONT color="green">423</FONT>         * elements of an array.<a name="line.423"></a>
+<FONT color="green">424</FONT>         * &lt;p&gt;<a name="line.424"></a>
+<FONT color="green">425</FONT>         * The generated function behaves as follows:<a name="line.425"></a>
+<FONT color="green">426</FONT>         * &lt;ul&gt;<a name="line.426"></a>
+<FONT color="green">427</FONT>         *   &lt;li&gt;initialize result = initialValue&lt;/li&gt;<a name="line.427"></a>
+<FONT color="green">428</FONT>         *   &lt;li&gt;iterate: {@code result = combiner.value(result,<a name="line.428"></a>
+<FONT color="green">429</FONT>         *   this.value(nextMultivariateEntry));}&lt;/li&gt;<a name="line.429"></a>
+<FONT color="green">430</FONT>         *   &lt;li&gt;return result&lt;/li&gt;<a name="line.430"></a>
+<FONT color="green">431</FONT>         * &lt;/ul&gt;<a name="line.431"></a>
+<FONT color="green">432</FONT>         * &lt;/p&gt;<a name="line.432"></a>
+<FONT color="green">433</FONT>         * @param combiner combiner to use between entries<a name="line.433"></a>
+<FONT color="green">434</FONT>         * @param initialValue initial value to use before first entry<a name="line.434"></a>
+<FONT color="green">435</FONT>         * @return a new function that iteratively applie instance function on all<a name="line.435"></a>
+<FONT color="green">436</FONT>         * elements of an array.<a name="line.436"></a>
+<FONT color="green">437</FONT>         */<a name="line.437"></a>
+<FONT color="green">438</FONT>        public MultivariateRealFunction asCollector(final BivariateRealFunction combiner,<a name="line.438"></a>
+<FONT color="green">439</FONT>                                                    final double initialValue) {<a name="line.439"></a>
+<FONT color="green">440</FONT>            return new MultivariateRealFunction() {<a name="line.440"></a>
+<FONT color="green">441</FONT>                /** {@inheritDoc} */<a name="line.441"></a>
+<FONT color="green">442</FONT>                public double value(double[] point)<a name="line.442"></a>
+<FONT color="green">443</FONT>                    throws FunctionEvaluationException, IllegalArgumentException {<a name="line.443"></a>
+<FONT color="green">444</FONT>                    double result = initialValue;<a name="line.444"></a>
+<FONT color="green">445</FONT>                    for (final double entry : point) {<a name="line.445"></a>
+<FONT color="green">446</FONT>                        result = combiner.value(result, ComposableFunction.this.value(entry));<a name="line.446"></a>
+<FONT color="green">447</FONT>                    }<a name="line.447"></a>
+<FONT color="green">448</FONT>                    return result;<a name="line.448"></a>
+<FONT color="green">449</FONT>                }<a name="line.449"></a>
+<FONT color="green">450</FONT>            };<a name="line.450"></a>
+<FONT color="green">451</FONT>        }<a name="line.451"></a>
+<FONT color="green">452</FONT>    <a name="line.452"></a>
+<FONT color="green">453</FONT>        /**<a name="line.453"></a>
+<FONT color="green">454</FONT>         * Generates a function that iteratively apply instance function on all<a name="line.454"></a>
+<FONT color="green">455</FONT>         * elements of an array.<a name="line.455"></a>
+<FONT color="green">456</FONT>         * &lt;p&gt;<a name="line.456"></a>
+<FONT color="green">457</FONT>         * Calling this method is equivalent to call {@link<a name="line.457"></a>
+<FONT color="green">458</FONT>         * #asCollector(BivariateRealFunction, double) asCollector(BivariateRealFunction, 0.0)}.<a name="line.458"></a>
+<FONT color="green">459</FONT>         * &lt;/p&gt;<a name="line.459"></a>
+<FONT color="green">460</FONT>         * @param combiner combiner to use between entries<a name="line.460"></a>
+<FONT color="green">461</FONT>         * @return a new function that iteratively applie instance function on all<a name="line.461"></a>
+<FONT color="green">462</FONT>         * elements of an array.<a name="line.462"></a>
+<FONT color="green">463</FONT>         * @see #asCollector(BivariateRealFunction, double)<a name="line.463"></a>
+<FONT color="green">464</FONT>         */<a name="line.464"></a>
+<FONT color="green">465</FONT>        public  MultivariateRealFunction asCollector(final BivariateRealFunction combiner) {<a name="line.465"></a>
+<FONT color="green">466</FONT>            return asCollector(combiner, 0.0);<a name="line.466"></a>
+<FONT color="green">467</FONT>        }<a name="line.467"></a>
+<FONT color="green">468</FONT>    <a name="line.468"></a>
+<FONT color="green">469</FONT>        /**<a name="line.469"></a>
+<FONT color="green">470</FONT>         * Generates a function that iteratively apply instance function on all<a name="line.470"></a>
+<FONT color="green">471</FONT>         * elements of an array.<a name="line.471"></a>
+<FONT color="green">472</FONT>         * &lt;p&gt;<a name="line.472"></a>
+<FONT color="green">473</FONT>         * Calling this method is equivalent to call {@link<a name="line.473"></a>
+<FONT color="green">474</FONT>         * #asCollector(BivariateRealFunction, double) asCollector(BinaryFunction.ADD, initialValue)}.<a name="line.474"></a>
+<FONT color="green">475</FONT>         * &lt;/p&gt;<a name="line.475"></a>
+<FONT color="green">476</FONT>         * @param initialValue initial value to use before first entry<a name="line.476"></a>
+<FONT color="green">477</FONT>         * @return a new function that iteratively applie instance function on all<a name="line.477"></a>
+<FONT color="green">478</FONT>         * elements of an array.<a name="line.478"></a>
+<FONT color="green">479</FONT>         * @see #asCollector(BivariateRealFunction, double)<a name="line.479"></a>
+<FONT color="green">480</FONT>         * @see BinaryFunction#ADD<a name="line.480"></a>
+<FONT color="green">481</FONT>         */<a name="line.481"></a>
+<FONT color="green">482</FONT>        public  MultivariateRealFunction asCollector(final double initialValue) {<a name="line.482"></a>
+<FONT color="green">483</FONT>            return asCollector(BinaryFunction.ADD, initialValue);<a name="line.483"></a>
+<FONT color="green">484</FONT>        }<a name="line.484"></a>
+<FONT color="green">485</FONT>    <a name="line.485"></a>
+<FONT color="green">486</FONT>        /**<a name="line.486"></a>
+<FONT color="green">487</FONT>         * Generates a function that iteratively apply instance function on all<a name="line.487"></a>
+<FONT color="green">488</FONT>         * elements of an array.<a name="line.488"></a>
+<FONT color="green">489</FONT>         * &lt;p&gt;<a name="line.489"></a>
+<FONT color="green">490</FONT>         * Calling this method is equivalent to call {@link<a name="line.490"></a>
+<FONT color="green">491</FONT>         * #asCollector(BivariateRealFunction, double) asCollector(BinaryFunction.ADD, 0.0)}.<a name="line.491"></a>
+<FONT color="green">492</FONT>         * &lt;/p&gt;<a name="line.492"></a>
+<FONT color="green">493</FONT>         * @return a new function that iteratively applie instance function on all<a name="line.493"></a>
+<FONT color="green">494</FONT>         * elements of an array.<a name="line.494"></a>
+<FONT color="green">495</FONT>         * @see #asCollector(BivariateRealFunction, double)<a name="line.495"></a>
+<FONT color="green">496</FONT>         * @see BinaryFunction#ADD<a name="line.496"></a>
+<FONT color="green">497</FONT>         */<a name="line.497"></a>
+<FONT color="green">498</FONT>        public  MultivariateRealFunction asCollector() {<a name="line.498"></a>
+<FONT color="green">499</FONT>            return asCollector(BinaryFunction.ADD, 0.0);<a name="line.499"></a>
+<FONT color="green">500</FONT>        }<a name="line.500"></a>
+<FONT color="green">501</FONT>    <a name="line.501"></a>
+<FONT color="green">502</FONT>        /** {@inheritDoc} */<a name="line.502"></a>
+<FONT color="green">503</FONT>        public abstract double value(double x) throws FunctionEvaluationException;<a name="line.503"></a>
+<FONT color="green">504</FONT>    <a name="line.504"></a>
+<FONT color="green">505</FONT>    }<a name="line.505"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/DifferentiableMultivariateRealFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,117 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.analysis;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Extension of {@link MultivariateRealFunction} representing a differentiable<a name="line.21"></a>
+<FONT color="green">022</FONT>     * multivariate real function.<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @since 2.0<a name="line.24"></a>
+<FONT color="green">025</FONT>     */<a name="line.25"></a>
+<FONT color="green">026</FONT>    public interface DifferentiableMultivariateRealFunction extends MultivariateRealFunction {<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>        /**<a name="line.28"></a>
+<FONT color="green">029</FONT>         * Returns the partial derivative of the function with respect to a point coordinate.<a name="line.29"></a>
+<FONT color="green">030</FONT>         * &lt;p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>         * The partial derivative is defined with respect to point coordinate<a name="line.31"></a>
+<FONT color="green">032</FONT>         * x&lt;sub&gt;k&lt;/sub&gt;. If the partial derivatives with respect to all coordinates are<a name="line.32"></a>
+<FONT color="green">033</FONT>         * needed, it may be more efficient to use the {@link #gradient()} method which will<a name="line.33"></a>
+<FONT color="green">034</FONT>         * compute them all at once.<a name="line.34"></a>
+<FONT color="green">035</FONT>         * &lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @param k index of the coordinate with respect to which the partial<a name="line.36"></a>
+<FONT color="green">037</FONT>         * derivative is computed<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @return the partial derivative function with respect to k&lt;sup&gt;th&lt;/sup&gt; point coordinate<a name="line.38"></a>
+<FONT color="green">039</FONT>         */<a name="line.39"></a>
+<FONT color="green">040</FONT>        MultivariateRealFunction partialDerivative(int k);<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /**<a name="line.42"></a>
+<FONT color="green">043</FONT>         * Returns the gradient function.<a name="line.43"></a>
+<FONT color="green">044</FONT>         * &lt;p&gt;If only one partial derivative with respect to a specific coordinate is<a name="line.44"></a>
+<FONT color="green">045</FONT>         * needed, it may be more efficient to use the {@link #partialDerivative(int)} method<a name="line.45"></a>
+<FONT color="green">046</FONT>         * which will compute only the specified component.&lt;/p&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @return the gradient function<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        MultivariateVectorialFunction gradient();<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>    }<a name="line.51"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/DifferentiableMultivariateVectorialFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,102 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.analysis;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Extension of {@link MultivariateVectorialFunction} representing a differentiable<a name="line.22"></a>
+<FONT color="green">023</FONT>     * multivariate vectorial function.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @since 2.0<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public interface DifferentiableMultivariateVectorialFunction<a name="line.27"></a>
+<FONT color="green">028</FONT>        extends MultivariateVectorialFunction {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /**<a name="line.30"></a>
+<FONT color="green">031</FONT>         * Returns the jacobian function.<a name="line.31"></a>
+<FONT color="green">032</FONT>         * @return the jacobian function<a name="line.32"></a>
+<FONT color="green">033</FONT>         */<a name="line.33"></a>
+<FONT color="green">034</FONT>        MultivariateMatrixFunction jacobian();<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>    }<a name="line.36"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/DifferentiableUnivariateMatrixFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,101 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Extension of {@link UnivariateMatrixFunction} representing a differentiable univariate matrix function.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @since 2.0<a name="line.23"></a>
+<FONT color="green">024</FONT>     */<a name="line.24"></a>
+<FONT color="green">025</FONT>    public interface DifferentiableUnivariateMatrixFunction<a name="line.25"></a>
+<FONT color="green">026</FONT>        extends UnivariateMatrixFunction {<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>        /**<a name="line.28"></a>
+<FONT color="green">029</FONT>         * Returns the derivative of the function<a name="line.29"></a>
+<FONT color="green">030</FONT>         *<a name="line.30"></a>
+<FONT color="green">031</FONT>         * @return  the derivative function<a name="line.31"></a>
+<FONT color="green">032</FONT>         */<a name="line.32"></a>
+<FONT color="green">033</FONT>        UnivariateMatrixFunction derivative();<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>    }<a name="line.35"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/DifferentiableUnivariateRealFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,100 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Extension of {@link UnivariateRealFunction} representing a differentiable univariate real function.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.22"></a>
+<FONT color="green">023</FONT>     */<a name="line.23"></a>
+<FONT color="green">024</FONT>    public interface DifferentiableUnivariateRealFunction<a name="line.24"></a>
+<FONT color="green">025</FONT>        extends UnivariateRealFunction {<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>        /**<a name="line.27"></a>
+<FONT color="green">028</FONT>         * Returns the derivative of the function<a name="line.28"></a>
+<FONT color="green">029</FONT>         *<a name="line.29"></a>
+<FONT color="green">030</FONT>         * @return  the derivative function<a name="line.30"></a>
+<FONT color="green">031</FONT>         */<a name="line.31"></a>
+<FONT color="green">032</FONT>        UnivariateRealFunction derivative();<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>    }<a name="line.34"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/DifferentiableUnivariateVectorialFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,101 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Extension of {@link UnivariateVectorialFunction} representing a differentiable univariate vectorial function.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @since 2.0<a name="line.23"></a>
+<FONT color="green">024</FONT>     */<a name="line.24"></a>
+<FONT color="green">025</FONT>    public interface DifferentiableUnivariateVectorialFunction<a name="line.25"></a>
+<FONT color="green">026</FONT>        extends UnivariateVectorialFunction {<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>        /**<a name="line.28"></a>
+<FONT color="green">029</FONT>         * Returns the derivative of the function<a name="line.29"></a>
+<FONT color="green">030</FONT>         *<a name="line.30"></a>
+<FONT color="green">031</FONT>         * @return  the derivative function<a name="line.31"></a>
+<FONT color="green">032</FONT>         */<a name="line.32"></a>
+<FONT color="green">033</FONT>        UnivariateVectorialFunction derivative();<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>    }<a name="line.35"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/MultivariateMatrixFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,106 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.analysis;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * An interface representing a multivariate matrix function.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 2.0<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public interface MultivariateMatrixFunction {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /**<a name="line.30"></a>
+<FONT color="green">031</FONT>         * Compute the value for the function at the given point.<a name="line.31"></a>
+<FONT color="green">032</FONT>         * @param point point at which the function must be evaluated<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @return function value for the given point<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @exception FunctionEvaluationException if the function evaluation fails<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @exception IllegalArgumentException if points dimension is wrong<a name="line.35"></a>
+<FONT color="green">036</FONT>         */<a name="line.36"></a>
+<FONT color="green">037</FONT>        double[][] value(double[] point)<a name="line.37"></a>
+<FONT color="green">038</FONT>            throws FunctionEvaluationException, IllegalArgumentException;<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>    }<a name="line.40"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/MultivariateRealFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,105 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.analysis;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * An interface representing a multivariate real function.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @since 2.0<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public interface MultivariateRealFunction {<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>        /**<a name="line.29"></a>
+<FONT color="green">030</FONT>         * Compute the value for the function at the given point.<a name="line.30"></a>
+<FONT color="green">031</FONT>         * @param point point at which the function must be evaluated<a name="line.31"></a>
+<FONT color="green">032</FONT>         * @return function value for the given point<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @exception FunctionEvaluationException if the function evaluation fails<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @exception IllegalArgumentException if points dimension is wrong<a name="line.34"></a>
+<FONT color="green">035</FONT>         */<a name="line.35"></a>
+<FONT color="green">036</FONT>        double value(double[] point)<a name="line.36"></a>
+<FONT color="green">037</FONT>            throws FunctionEvaluationException, IllegalArgumentException;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>    }<a name="line.39"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/MultivariateVectorialFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,105 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.analysis;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * An interface representing a multivariate vectorial function.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @since 2.0<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public interface MultivariateVectorialFunction {<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>        /**<a name="line.29"></a>
+<FONT color="green">030</FONT>         * Compute the value for the function at the given point.<a name="line.30"></a>
+<FONT color="green">031</FONT>         * @param point point at which the function must be evaluated<a name="line.31"></a>
+<FONT color="green">032</FONT>         * @return function value for the given point<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @exception FunctionEvaluationException if the function evaluation fails<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @exception IllegalArgumentException if points dimension is wrong<a name="line.34"></a>
+<FONT color="green">035</FONT>         */<a name="line.35"></a>
+<FONT color="green">036</FONT>        double[] value(double[] point)<a name="line.36"></a>
+<FONT color="green">037</FONT>            throws FunctionEvaluationException, IllegalArgumentException;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>    }<a name="line.39"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/UnivariateMatrixFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,103 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * An interface representing a univariate matrix function.<a name="line.22"></a>
+<FONT color="green">023</FONT>     *<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @since 2.0<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public interface UnivariateMatrixFunction {<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>        /**<a name="line.29"></a>
+<FONT color="green">030</FONT>         * Compute the value for the function.<a name="line.30"></a>
+<FONT color="green">031</FONT>         * @param x the point for which the function value should be computed<a name="line.31"></a>
+<FONT color="green">032</FONT>         * @return the value<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @throws FunctionEvaluationException if the function evaluation fails<a name="line.33"></a>
+<FONT color="green">034</FONT>         */<a name="line.34"></a>
+<FONT color="green">035</FONT>        double[][] value(double x) throws FunctionEvaluationException;<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>    }<a name="line.37"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/UnivariateRealFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,102 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * An interface representing a univariate real function.<a name="line.22"></a>
+<FONT color="green">023</FONT>     *<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     */<a name="line.25"></a>
+<FONT color="green">026</FONT>    public interface UnivariateRealFunction {<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>        /**<a name="line.28"></a>
+<FONT color="green">029</FONT>         * Compute the value for the function.<a name="line.29"></a>
+<FONT color="green">030</FONT>         * @param x the point for which the function value should be computed<a name="line.30"></a>
+<FONT color="green">031</FONT>         * @return the value<a name="line.31"></a>
+<FONT color="green">032</FONT>         * @throws FunctionEvaluationException if the function evaluation fails<a name="line.32"></a>
+<FONT color="green">033</FONT>         */<a name="line.33"></a>
+<FONT color="green">034</FONT>        double value(double x) throws FunctionEvaluationException;<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>    }<a name="line.36"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/UnivariateVectorialFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,103 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * An interface representing a univariate vectorial function.<a name="line.22"></a>
+<FONT color="green">023</FONT>     *<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @since 2.0<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public interface UnivariateVectorialFunction {<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>        /**<a name="line.29"></a>
+<FONT color="green">030</FONT>         * Compute the value for the function.<a name="line.30"></a>
+<FONT color="green">031</FONT>         * @param x the point for which the function value should be computed<a name="line.31"></a>
+<FONT color="green">032</FONT>         * @return the value<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @throws FunctionEvaluationException if the function evaluation fails<a name="line.33"></a>
+<FONT color="green">034</FONT>         */<a name="line.34"></a>
+<FONT color="green">035</FONT>        double[] value(double x) throws FunctionEvaluationException;<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>    }<a name="line.37"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/integration/LegendreGaussIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,301 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.integration;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Implements the &lt;a href="http://mathworld.wolfram.com/Legendre-GaussQuadrature.html"&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Legendre-Gauss&lt;/a&gt; quadrature formula.<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * Legendre-Gauss integrators are efficient integrators that can<a name="line.29"></a>
+<FONT color="green">030</FONT>     * accurately integrate functions with few functions evaluations. A<a name="line.30"></a>
+<FONT color="green">031</FONT>     * Legendre-Gauss integrator using an n-points quadrature formula can<a name="line.31"></a>
+<FONT color="green">032</FONT>     * integrate exactly 2n-1 degree polynomialss.<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * These integrators evaluate the function on n carefully chosen<a name="line.35"></a>
+<FONT color="green">036</FONT>     * abscissas in each step interval (mapped to the canonical [-1  1] interval).<a name="line.36"></a>
+<FONT color="green">037</FONT>     * The evaluation abscissas are not evenly spaced and none of them are<a name="line.37"></a>
+<FONT color="green">038</FONT>     * at the interval endpoints. This implies the function integrated can be<a name="line.38"></a>
+<FONT color="green">039</FONT>     * undefined at integration interval endpoints.<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;/p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;p&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * The evaluation abscissas x&lt;sub&gt;i&lt;/sub&gt; are the roots of the degree n<a name="line.42"></a>
+<FONT color="green">043</FONT>     * Legendre polynomial. The weights a&lt;sub&gt;i&lt;/sub&gt; of the quadrature formula<a name="line.43"></a>
+<FONT color="green">044</FONT>     * integrals from -1 to +1 &amp;int; Li&lt;sup&gt;2&lt;/sup&gt; where Li (x) =<a name="line.44"></a>
+<FONT color="green">045</FONT>     * &amp;prod; (x-x&lt;sub&gt;k&lt;/sub&gt;)/(x&lt;sub&gt;i&lt;/sub&gt;-x&lt;sub&gt;k&lt;/sub&gt;) for k != i.<a name="line.45"></a>
+<FONT color="green">046</FONT>     * &lt;/p&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     * &lt;p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.48"></a>
+<FONT color="green">049</FONT>     * @since 1.2<a name="line.49"></a>
+<FONT color="green">050</FONT>     */<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>    public class LegendreGaussIntegrator extends UnivariateRealIntegratorImpl {<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /** Abscissas for the 2 points method. */<a name="line.54"></a>
+<FONT color="green">055</FONT>        private static final double[] ABSCISSAS_2 = {<a name="line.55"></a>
+<FONT color="green">056</FONT>            -1.0 / Math.sqrt(3.0),<a name="line.56"></a>
+<FONT color="green">057</FONT>             1.0 / Math.sqrt(3.0)<a name="line.57"></a>
+<FONT color="green">058</FONT>        };<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Weights for the 2 points method. */<a name="line.60"></a>
+<FONT color="green">061</FONT>        private static final double[] WEIGHTS_2 = {<a name="line.61"></a>
+<FONT color="green">062</FONT>            1.0,<a name="line.62"></a>
+<FONT color="green">063</FONT>            1.0<a name="line.63"></a>
+<FONT color="green">064</FONT>        };<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /** Abscissas for the 3 points method. */<a name="line.66"></a>
+<FONT color="green">067</FONT>        private static final double[] ABSCISSAS_3 = {<a name="line.67"></a>
+<FONT color="green">068</FONT>            -Math.sqrt(0.6),<a name="line.68"></a>
+<FONT color="green">069</FONT>             0.0,<a name="line.69"></a>
+<FONT color="green">070</FONT>             Math.sqrt(0.6)<a name="line.70"></a>
+<FONT color="green">071</FONT>        };<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /** Weights for the 3 points method. */<a name="line.73"></a>
+<FONT color="green">074</FONT>        private static final double[] WEIGHTS_3 = {<a name="line.74"></a>
+<FONT color="green">075</FONT>            5.0 / 9.0,<a name="line.75"></a>
+<FONT color="green">076</FONT>            8.0 / 9.0,<a name="line.76"></a>
+<FONT color="green">077</FONT>            5.0 / 9.0<a name="line.77"></a>
+<FONT color="green">078</FONT>        };<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /** Abscissas for the 4 points method. */<a name="line.80"></a>
+<FONT color="green">081</FONT>        private static final double[] ABSCISSAS_4 = {<a name="line.81"></a>
+<FONT color="green">082</FONT>            -Math.sqrt((15.0 + 2.0 * Math.sqrt(30.0)) / 35.0),<a name="line.82"></a>
+<FONT color="green">083</FONT>            -Math.sqrt((15.0 - 2.0 * Math.sqrt(30.0)) / 35.0),<a name="line.83"></a>
+<FONT color="green">084</FONT>             Math.sqrt((15.0 - 2.0 * Math.sqrt(30.0)) / 35.0),<a name="line.84"></a>
+<FONT color="green">085</FONT>             Math.sqrt((15.0 + 2.0 * Math.sqrt(30.0)) / 35.0)<a name="line.85"></a>
+<FONT color="green">086</FONT>        };<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>        /** Weights for the 4 points method. */<a name="line.88"></a>
+<FONT color="green">089</FONT>        private static final double[] WEIGHTS_4 = {<a name="line.89"></a>
+<FONT color="green">090</FONT>            (90.0 - 5.0 * Math.sqrt(30.0)) / 180.0,<a name="line.90"></a>
+<FONT color="green">091</FONT>            (90.0 + 5.0 * Math.sqrt(30.0)) / 180.0,<a name="line.91"></a>
+<FONT color="green">092</FONT>            (90.0 + 5.0 * Math.sqrt(30.0)) / 180.0,<a name="line.92"></a>
+<FONT color="green">093</FONT>            (90.0 - 5.0 * Math.sqrt(30.0)) / 180.0<a name="line.93"></a>
+<FONT color="green">094</FONT>        };<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /** Abscissas for the 5 points method. */<a name="line.96"></a>
+<FONT color="green">097</FONT>        private static final double[] ABSCISSAS_5 = {<a name="line.97"></a>
+<FONT color="green">098</FONT>            -Math.sqrt((35.0 + 2.0 * Math.sqrt(70.0)) / 63.0),<a name="line.98"></a>
+<FONT color="green">099</FONT>            -Math.sqrt((35.0 - 2.0 * Math.sqrt(70.0)) / 63.0),<a name="line.99"></a>
+<FONT color="green">100</FONT>             0.0,<a name="line.100"></a>
+<FONT color="green">101</FONT>             Math.sqrt((35.0 - 2.0 * Math.sqrt(70.0)) / 63.0),<a name="line.101"></a>
+<FONT color="green">102</FONT>             Math.sqrt((35.0 + 2.0 * Math.sqrt(70.0)) / 63.0)<a name="line.102"></a>
+<FONT color="green">103</FONT>        };<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /** Weights for the 5 points method. */<a name="line.105"></a>
+<FONT color="green">106</FONT>        private static final double[] WEIGHTS_5 = {<a name="line.106"></a>
+<FONT color="green">107</FONT>            (322.0 - 13.0 * Math.sqrt(70.0)) / 900.0,<a name="line.107"></a>
+<FONT color="green">108</FONT>            (322.0 + 13.0 * Math.sqrt(70.0)) / 900.0,<a name="line.108"></a>
+<FONT color="green">109</FONT>            128.0 / 225.0,<a name="line.109"></a>
+<FONT color="green">110</FONT>            (322.0 + 13.0 * Math.sqrt(70.0)) / 900.0,<a name="line.110"></a>
+<FONT color="green">111</FONT>            (322.0 - 13.0 * Math.sqrt(70.0)) / 900.0<a name="line.111"></a>
+<FONT color="green">112</FONT>        };<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /** Abscissas for the current method. */<a name="line.114"></a>
+<FONT color="green">115</FONT>        private final double[] abscissas;<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>        /** Weights for the current method. */<a name="line.117"></a>
+<FONT color="green">118</FONT>        private final double[] weights;<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /** Build a Legendre-Gauss integrator.<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @param n number of points desired (must be between 2 and 5 inclusive)<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @param defaultMaximalIterationCount maximum number of iterations<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @exception IllegalArgumentException if the number of points is not<a name="line.123"></a>
+<FONT color="green">124</FONT>         * in the supported range<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        public LegendreGaussIntegrator(final int n, final int defaultMaximalIterationCount)<a name="line.126"></a>
+<FONT color="green">127</FONT>            throws IllegalArgumentException {<a name="line.127"></a>
+<FONT color="green">128</FONT>            super(defaultMaximalIterationCount);<a name="line.128"></a>
+<FONT color="green">129</FONT>            switch(n) {<a name="line.129"></a>
+<FONT color="green">130</FONT>            case 2 :<a name="line.130"></a>
+<FONT color="green">131</FONT>                abscissas = ABSCISSAS_2;<a name="line.131"></a>
+<FONT color="green">132</FONT>                weights   = WEIGHTS_2;<a name="line.132"></a>
+<FONT color="green">133</FONT>                break;<a name="line.133"></a>
+<FONT color="green">134</FONT>            case 3 :<a name="line.134"></a>
+<FONT color="green">135</FONT>                abscissas = ABSCISSAS_3;<a name="line.135"></a>
+<FONT color="green">136</FONT>                weights   = WEIGHTS_3;<a name="line.136"></a>
+<FONT color="green">137</FONT>                break;<a name="line.137"></a>
+<FONT color="green">138</FONT>            case 4 :<a name="line.138"></a>
+<FONT color="green">139</FONT>                abscissas = ABSCISSAS_4;<a name="line.139"></a>
+<FONT color="green">140</FONT>                weights   = WEIGHTS_4;<a name="line.140"></a>
+<FONT color="green">141</FONT>                break;<a name="line.141"></a>
+<FONT color="green">142</FONT>            case 5 :<a name="line.142"></a>
+<FONT color="green">143</FONT>                abscissas = ABSCISSAS_5;<a name="line.143"></a>
+<FONT color="green">144</FONT>                weights   = WEIGHTS_5;<a name="line.144"></a>
+<FONT color="green">145</FONT>                break;<a name="line.145"></a>
+<FONT color="green">146</FONT>            default :<a name="line.146"></a>
+<FONT color="green">147</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.147"></a>
+<FONT color="green">148</FONT>                        "{0} points Legendre-Gauss integrator not supported, " +<a name="line.148"></a>
+<FONT color="green">149</FONT>                        "number of points must be in the {1}-{2} range",<a name="line.149"></a>
+<FONT color="green">150</FONT>                        n, 2, 5);<a name="line.150"></a>
+<FONT color="green">151</FONT>            }<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>        }<a name="line.153"></a>
+<FONT color="green">154</FONT>    <a name="line.154"></a>
+<FONT color="green">155</FONT>        /** {@inheritDoc} */<a name="line.155"></a>
+<FONT color="green">156</FONT>        @Deprecated<a name="line.156"></a>
+<FONT color="green">157</FONT>        public double integrate(final double min, final double max)<a name="line.157"></a>
+<FONT color="green">158</FONT>            throws ConvergenceException,  FunctionEvaluationException, IllegalArgumentException {<a name="line.158"></a>
+<FONT color="green">159</FONT>            return integrate(f, min, max);<a name="line.159"></a>
+<FONT color="green">160</FONT>        }<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>        /** {@inheritDoc} */<a name="line.162"></a>
+<FONT color="green">163</FONT>        public double integrate(final UnivariateRealFunction f,<a name="line.163"></a>
+<FONT color="green">164</FONT>                final double min, final double max)<a name="line.164"></a>
+<FONT color="green">165</FONT>            throws ConvergenceException,  FunctionEvaluationException, IllegalArgumentException {<a name="line.165"></a>
+<FONT color="green">166</FONT>    <a name="line.166"></a>
+<FONT color="green">167</FONT>            clearResult();<a name="line.167"></a>
+<FONT color="green">168</FONT>            verifyInterval(min, max);<a name="line.168"></a>
+<FONT color="green">169</FONT>            verifyIterationCount();<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>            // compute first estimate with a single step<a name="line.171"></a>
+<FONT color="green">172</FONT>            double oldt = stage(f, min, max, 1);<a name="line.172"></a>
+<FONT color="green">173</FONT>    <a name="line.173"></a>
+<FONT color="green">174</FONT>            int n = 2;<a name="line.174"></a>
+<FONT color="green">175</FONT>            for (int i = 0; i &lt; maximalIterationCount; ++i) {<a name="line.175"></a>
+<FONT color="green">176</FONT>    <a name="line.176"></a>
+<FONT color="green">177</FONT>                // improve integral with a larger number of steps<a name="line.177"></a>
+<FONT color="green">178</FONT>                final double t = stage(f, min, max, n);<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>                // estimate error<a name="line.180"></a>
+<FONT color="green">181</FONT>                final double delta = Math.abs(t - oldt);<a name="line.181"></a>
+<FONT color="green">182</FONT>                final double limit =<a name="line.182"></a>
+<FONT color="green">183</FONT>                    Math.max(absoluteAccuracy,<a name="line.183"></a>
+<FONT color="green">184</FONT>                             relativeAccuracy * (Math.abs(oldt) + Math.abs(t)) * 0.5);<a name="line.184"></a>
+<FONT color="green">185</FONT>    <a name="line.185"></a>
+<FONT color="green">186</FONT>                // check convergence<a name="line.186"></a>
+<FONT color="green">187</FONT>                if ((i + 1 &gt;= minimalIterationCount) &amp;&amp; (delta &lt;= limit)) {<a name="line.187"></a>
+<FONT color="green">188</FONT>                    setResult(t, i);<a name="line.188"></a>
+<FONT color="green">189</FONT>                    return result;<a name="line.189"></a>
+<FONT color="green">190</FONT>                }<a name="line.190"></a>
+<FONT color="green">191</FONT>    <a name="line.191"></a>
+<FONT color="green">192</FONT>                // prepare next iteration<a name="line.192"></a>
+<FONT color="green">193</FONT>                double ratio = Math.min(4, Math.pow(delta / limit, 0.5 / abscissas.length));<a name="line.193"></a>
+<FONT color="green">194</FONT>                n = Math.max((int) (ratio * n), n + 1);<a name="line.194"></a>
+<FONT color="green">195</FONT>                oldt = t;<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>            }<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>            throw new MaxIterationsExceededException(maximalIterationCount);<a name="line.199"></a>
+<FONT color="green">200</FONT>    <a name="line.200"></a>
+<FONT color="green">201</FONT>        }<a name="line.201"></a>
+<FONT color="green">202</FONT>    <a name="line.202"></a>
+<FONT color="green">203</FONT>        /**<a name="line.203"></a>
+<FONT color="green">204</FONT>         * Compute the n-th stage integral.<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @param f the integrand function<a name="line.205"></a>
+<FONT color="green">206</FONT>         * @param min the lower bound for the interval<a name="line.206"></a>
+<FONT color="green">207</FONT>         * @param max the upper bound for the interval<a name="line.207"></a>
+<FONT color="green">208</FONT>         * @param n number of steps<a name="line.208"></a>
+<FONT color="green">209</FONT>         * @return the value of n-th stage integral<a name="line.209"></a>
+<FONT color="green">210</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.210"></a>
+<FONT color="green">211</FONT>         * function<a name="line.211"></a>
+<FONT color="green">212</FONT>         */<a name="line.212"></a>
+<FONT color="green">213</FONT>        private double stage(final UnivariateRealFunction f,<a name="line.213"></a>
+<FONT color="green">214</FONT>                             final double min, final double max, final int n)<a name="line.214"></a>
+<FONT color="green">215</FONT>            throws FunctionEvaluationException {<a name="line.215"></a>
+<FONT color="green">216</FONT>    <a name="line.216"></a>
+<FONT color="green">217</FONT>            // set up the step for the current stage<a name="line.217"></a>
+<FONT color="green">218</FONT>            final double step     = (max - min) / n;<a name="line.218"></a>
+<FONT color="green">219</FONT>            final double halfStep = step / 2.0;<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>            // integrate over all elementary steps<a name="line.221"></a>
+<FONT color="green">222</FONT>            double midPoint = min + halfStep;<a name="line.222"></a>
+<FONT color="green">223</FONT>            double sum = 0.0;<a name="line.223"></a>
+<FONT color="green">224</FONT>            for (int i = 0; i &lt; n; ++i) {<a name="line.224"></a>
+<FONT color="green">225</FONT>                for (int j = 0; j &lt; abscissas.length; ++j) {<a name="line.225"></a>
+<FONT color="green">226</FONT>                    sum += weights[j] * f.value(midPoint + halfStep * abscissas[j]);<a name="line.226"></a>
+<FONT color="green">227</FONT>                }<a name="line.227"></a>
+<FONT color="green">228</FONT>                midPoint += step;<a name="line.228"></a>
+<FONT color="green">229</FONT>            }<a name="line.229"></a>
+<FONT color="green">230</FONT>    <a name="line.230"></a>
+<FONT color="green">231</FONT>            return halfStep * sum;<a name="line.231"></a>
+<FONT color="green">232</FONT>    <a name="line.232"></a>
+<FONT color="green">233</FONT>        }<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>    }<a name="line.235"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/integration/RombergIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,186 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.integration;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Implements the &lt;a href="http://mathworld.wolfram.com/RombergIntegration.html"&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Romberg Algorithm&lt;/a&gt; for integration of real univariate functions. For<a name="line.26"></a>
+<FONT color="green">027</FONT>     * reference, see &lt;b&gt;Introduction to Numerical Analysis&lt;/b&gt;, ISBN 038795452X,<a name="line.27"></a>
+<FONT color="green">028</FONT>     * chapter 3.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * Romberg integration employs k successive refinements of the trapezoid<a name="line.30"></a>
+<FONT color="green">031</FONT>     * rule to remove error terms less than order O(N^(-2k)). Simpson's rule<a name="line.31"></a>
+<FONT color="green">032</FONT>     * is a special case of k = 2.&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @version $Revision: 824822 $ $Date: 2009-10-13 11:56:51 -0400 (Tue, 13 Oct 2009) $<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @since 1.2<a name="line.35"></a>
+<FONT color="green">036</FONT>     */<a name="line.36"></a>
+<FONT color="green">037</FONT>    public class RombergIntegrator extends UnivariateRealIntegratorImpl {<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /**<a name="line.39"></a>
+<FONT color="green">040</FONT>         * Construct an integrator for the given function.<a name="line.40"></a>
+<FONT color="green">041</FONT>         *<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @param f function to integrate<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @deprecated as of 2.0 the integrand function is passed as an argument<a name="line.43"></a>
+<FONT color="green">044</FONT>         * to the {@link #integrate(UnivariateRealFunction, double, double)}method.<a name="line.44"></a>
+<FONT color="green">045</FONT>         */<a name="line.45"></a>
+<FONT color="green">046</FONT>        @Deprecated<a name="line.46"></a>
+<FONT color="green">047</FONT>        public RombergIntegrator(UnivariateRealFunction f) {<a name="line.47"></a>
+<FONT color="green">048</FONT>            super(f, 32);<a name="line.48"></a>
+<FONT color="green">049</FONT>        }<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /**<a name="line.51"></a>
+<FONT color="green">052</FONT>         * Construct an integrator.<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        public RombergIntegrator() {<a name="line.54"></a>
+<FONT color="green">055</FONT>            super(32);<a name="line.55"></a>
+<FONT color="green">056</FONT>        }<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /** {@inheritDoc} */<a name="line.58"></a>
+<FONT color="green">059</FONT>        @Deprecated<a name="line.59"></a>
+<FONT color="green">060</FONT>        public double integrate(final double min, final double max)<a name="line.60"></a>
+<FONT color="green">061</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException, IllegalArgumentException {<a name="line.61"></a>
+<FONT color="green">062</FONT>            return integrate(f, min, max);<a name="line.62"></a>
+<FONT color="green">063</FONT>        }<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** {@inheritDoc} */<a name="line.65"></a>
+<FONT color="green">066</FONT>        public double integrate(final UnivariateRealFunction f,<a name="line.66"></a>
+<FONT color="green">067</FONT>                                final double min, final double max)<a name="line.67"></a>
+<FONT color="green">068</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException, IllegalArgumentException {<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>            final int m = maximalIterationCount + 1;<a name="line.70"></a>
+<FONT color="green">071</FONT>            double previousRow[] = new double[m];<a name="line.71"></a>
+<FONT color="green">072</FONT>            double currentRow[]  = new double[m];<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>            clearResult();<a name="line.74"></a>
+<FONT color="green">075</FONT>            verifyInterval(min, max);<a name="line.75"></a>
+<FONT color="green">076</FONT>            verifyIterationCount();<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>            TrapezoidIntegrator qtrap = new TrapezoidIntegrator();<a name="line.78"></a>
+<FONT color="green">079</FONT>            currentRow[0] = qtrap.stage(f, min, max, 0);<a name="line.79"></a>
+<FONT color="green">080</FONT>            double olds = currentRow[0];<a name="line.80"></a>
+<FONT color="green">081</FONT>            for (int i = 1; i &lt;= maximalIterationCount; ++i) {<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>                // switch rows<a name="line.83"></a>
+<FONT color="green">084</FONT>                final double[] tmpRow = previousRow;<a name="line.84"></a>
+<FONT color="green">085</FONT>                previousRow = currentRow;<a name="line.85"></a>
+<FONT color="green">086</FONT>                currentRow = tmpRow;<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>                currentRow[0] = qtrap.stage(f, min, max, i);<a name="line.88"></a>
+<FONT color="green">089</FONT>                for (int j = 1; j &lt;= i; j++) {<a name="line.89"></a>
+<FONT color="green">090</FONT>                    // Richardson extrapolation coefficient<a name="line.90"></a>
+<FONT color="green">091</FONT>                    final double r = (1L &lt;&lt; (2 * j)) - 1;<a name="line.91"></a>
+<FONT color="green">092</FONT>                    final double tIJm1 = currentRow[j - 1];<a name="line.92"></a>
+<FONT color="green">093</FONT>                    currentRow[j] = tIJm1 + (tIJm1 - previousRow[j - 1]) / r;<a name="line.93"></a>
+<FONT color="green">094</FONT>                }<a name="line.94"></a>
+<FONT color="green">095</FONT>                final double s = currentRow[i];<a name="line.95"></a>
+<FONT color="green">096</FONT>                if (i &gt;= minimalIterationCount) {<a name="line.96"></a>
+<FONT color="green">097</FONT>                    final double delta  = Math.abs(s - olds);<a name="line.97"></a>
+<FONT color="green">098</FONT>                    final double rLimit = relativeAccuracy * (Math.abs(olds) + Math.abs(s)) * 0.5;<a name="line.98"></a>
+<FONT color="green">099</FONT>                    if ((delta &lt;= rLimit) || (delta &lt;= absoluteAccuracy)) {<a name="line.99"></a>
+<FONT color="green">100</FONT>                        setResult(s, i);<a name="line.100"></a>
+<FONT color="green">101</FONT>                        return result;<a name="line.101"></a>
+<FONT color="green">102</FONT>                    }<a name="line.102"></a>
+<FONT color="green">103</FONT>                }<a name="line.103"></a>
+<FONT color="green">104</FONT>                olds = s;<a name="line.104"></a>
+<FONT color="green">105</FONT>            }<a name="line.105"></a>
+<FONT color="green">106</FONT>            throw new MaxIterationsExceededException(maximalIterationCount);<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /** {@inheritDoc} */<a name="line.109"></a>
+<FONT color="green">110</FONT>        @Override<a name="line.110"></a>
+<FONT color="green">111</FONT>        protected void verifyIterationCount() throws IllegalArgumentException {<a name="line.111"></a>
+<FONT color="green">112</FONT>            super.verifyIterationCount();<a name="line.112"></a>
+<FONT color="green">113</FONT>            // at most 32 bisection refinements due to higher order divider<a name="line.113"></a>
+<FONT color="green">114</FONT>            if (maximalIterationCount &gt; 32) {<a name="line.114"></a>
+<FONT color="green">115</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.115"></a>
+<FONT color="green">116</FONT>                        "invalid iteration limits: min={0}, max={1}",<a name="line.116"></a>
+<FONT color="green">117</FONT>                        0, 32);<a name="line.117"></a>
+<FONT color="green">118</FONT>            }<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    }<a name="line.120"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/integration/SimpsonIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,177 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.integration;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Implements the &lt;a href="http://mathworld.wolfram.com/SimpsonsRule.html"&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Simpson's Rule&lt;/a&gt; for integration of real univariate functions. For<a name="line.26"></a>
+<FONT color="green">027</FONT>     * reference, see &lt;b&gt;Introduction to Numerical Analysis&lt;/b&gt;, ISBN 038795452X,<a name="line.27"></a>
+<FONT color="green">028</FONT>     * chapter 3.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * This implementation employs basic trapezoid rule as building blocks to<a name="line.30"></a>
+<FONT color="green">031</FONT>     * calculate the Simpson's rule of alternating 2/3 and 4/3.&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     *<a name="line.32"></a>
+<FONT color="green">033</FONT>     * @version $Revision: 825919 $ $Date: 2009-10-16 10:51:55 -0400 (Fri, 16 Oct 2009) $<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @since 1.2<a name="line.34"></a>
+<FONT color="green">035</FONT>     */<a name="line.35"></a>
+<FONT color="green">036</FONT>    public class SimpsonIntegrator extends UnivariateRealIntegratorImpl {<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /**<a name="line.38"></a>
+<FONT color="green">039</FONT>         * Construct an integrator for the given function.<a name="line.39"></a>
+<FONT color="green">040</FONT>         *<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @param f function to integrate<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @deprecated as of 2.0 the integrand function is passed as an argument<a name="line.42"></a>
+<FONT color="green">043</FONT>         * to the {@link #integrate(UnivariateRealFunction, double, double)}method.<a name="line.43"></a>
+<FONT color="green">044</FONT>         */<a name="line.44"></a>
+<FONT color="green">045</FONT>        @Deprecated<a name="line.45"></a>
+<FONT color="green">046</FONT>        public SimpsonIntegrator(UnivariateRealFunction f) {<a name="line.46"></a>
+<FONT color="green">047</FONT>            super(f, 64);<a name="line.47"></a>
+<FONT color="green">048</FONT>        }<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Construct an integrator.<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        public SimpsonIntegrator() {<a name="line.53"></a>
+<FONT color="green">054</FONT>            super(64);<a name="line.54"></a>
+<FONT color="green">055</FONT>        }<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /** {@inheritDoc} */<a name="line.57"></a>
+<FONT color="green">058</FONT>        @Deprecated<a name="line.58"></a>
+<FONT color="green">059</FONT>        public double integrate(final double min, final double max)<a name="line.59"></a>
+<FONT color="green">060</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException, IllegalArgumentException {<a name="line.60"></a>
+<FONT color="green">061</FONT>            return integrate(f, min, max);<a name="line.61"></a>
+<FONT color="green">062</FONT>        }<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /** {@inheritDoc} */<a name="line.64"></a>
+<FONT color="green">065</FONT>        public double integrate(final UnivariateRealFunction f,<a name="line.65"></a>
+<FONT color="green">066</FONT>                                final double min, final double max)<a name="line.66"></a>
+<FONT color="green">067</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException, IllegalArgumentException {<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>            clearResult();<a name="line.69"></a>
+<FONT color="green">070</FONT>            verifyInterval(min, max);<a name="line.70"></a>
+<FONT color="green">071</FONT>            verifyIterationCount();<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>            TrapezoidIntegrator qtrap = new TrapezoidIntegrator();<a name="line.73"></a>
+<FONT color="green">074</FONT>            if (minimalIterationCount == 1) {<a name="line.74"></a>
+<FONT color="green">075</FONT>                final double s = (4 * qtrap.stage(f, min, max, 1) - qtrap.stage(f, min, max, 0)) / 3.0;<a name="line.75"></a>
+<FONT color="green">076</FONT>                setResult(s, 1);<a name="line.76"></a>
+<FONT color="green">077</FONT>                return result;<a name="line.77"></a>
+<FONT color="green">078</FONT>            }<a name="line.78"></a>
+<FONT color="green">079</FONT>            // Simpson's rule requires at least two trapezoid stages.<a name="line.79"></a>
+<FONT color="green">080</FONT>            double olds = 0;<a name="line.80"></a>
+<FONT color="green">081</FONT>            double oldt = qtrap.stage(f, min, max, 0);<a name="line.81"></a>
+<FONT color="green">082</FONT>            for (int i = 1; i &lt;= maximalIterationCount; ++i) {<a name="line.82"></a>
+<FONT color="green">083</FONT>                final double t = qtrap.stage(f, min, max, i);<a name="line.83"></a>
+<FONT color="green">084</FONT>                final double s = (4 * t - oldt) / 3.0;<a name="line.84"></a>
+<FONT color="green">085</FONT>                if (i &gt;= minimalIterationCount) {<a name="line.85"></a>
+<FONT color="green">086</FONT>                    final double delta = Math.abs(s - olds);<a name="line.86"></a>
+<FONT color="green">087</FONT>                    final double rLimit =<a name="line.87"></a>
+<FONT color="green">088</FONT>                        relativeAccuracy * (Math.abs(olds) + Math.abs(s)) * 0.5;<a name="line.88"></a>
+<FONT color="green">089</FONT>                    if ((delta &lt;= rLimit) || (delta &lt;= absoluteAccuracy)) {<a name="line.89"></a>
+<FONT color="green">090</FONT>                        setResult(s, i);<a name="line.90"></a>
+<FONT color="green">091</FONT>                        return result;<a name="line.91"></a>
+<FONT color="green">092</FONT>                    }<a name="line.92"></a>
+<FONT color="green">093</FONT>                }<a name="line.93"></a>
+<FONT color="green">094</FONT>                olds = s;<a name="line.94"></a>
+<FONT color="green">095</FONT>                oldt = t;<a name="line.95"></a>
+<FONT color="green">096</FONT>            }<a name="line.96"></a>
+<FONT color="green">097</FONT>            throw new MaxIterationsExceededException(maximalIterationCount);<a name="line.97"></a>
+<FONT color="green">098</FONT>        }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>        /** {@inheritDoc} */<a name="line.100"></a>
+<FONT color="green">101</FONT>        @Override<a name="line.101"></a>
+<FONT color="green">102</FONT>        protected void verifyIterationCount() throws IllegalArgumentException {<a name="line.102"></a>
+<FONT color="green">103</FONT>            super.verifyIterationCount();<a name="line.103"></a>
+<FONT color="green">104</FONT>            // at most 64 bisection refinements<a name="line.104"></a>
+<FONT color="green">105</FONT>            if (maximalIterationCount &gt; 64) {<a name="line.105"></a>
+<FONT color="green">106</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.106"></a>
+<FONT color="green">107</FONT>                        "invalid iteration limits: min={0}, max={1}",<a name="line.107"></a>
+<FONT color="green">108</FONT>                        0, 64);<a name="line.108"></a>
+<FONT color="green">109</FONT>            }<a name="line.109"></a>
+<FONT color="green">110</FONT>        }<a name="line.110"></a>
+<FONT color="green">111</FONT>    }<a name="line.111"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/integration/TrapezoidIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,208 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.integration;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Implements the &lt;a href="http://mathworld.wolfram.com/TrapezoidalRule.html"&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Trapezoidal Rule&lt;/a&gt; for integration of real univariate functions. For<a name="line.26"></a>
+<FONT color="green">027</FONT>     * reference, see &lt;b&gt;Introduction to Numerical Analysis&lt;/b&gt;, ISBN 038795452X,<a name="line.27"></a>
+<FONT color="green">028</FONT>     * chapter 3.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * The function should be integrable.&lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     *<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @version $Revision: 825919 $ $Date: 2009-10-16 10:51:55 -0400 (Fri, 16 Oct 2009) $<a name="line.32"></a>
+<FONT color="green">033</FONT>     * @since 1.2<a name="line.33"></a>
+<FONT color="green">034</FONT>     */<a name="line.34"></a>
+<FONT color="green">035</FONT>    public class TrapezoidIntegrator extends UnivariateRealIntegratorImpl {<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /** Intermediate result. */<a name="line.37"></a>
+<FONT color="green">038</FONT>        private double s;<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /**<a name="line.40"></a>
+<FONT color="green">041</FONT>         * Construct an integrator for the given function.<a name="line.41"></a>
+<FONT color="green">042</FONT>         *<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @param f function to integrate<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @deprecated as of 2.0 the integrand function is passed as an argument<a name="line.44"></a>
+<FONT color="green">045</FONT>         * to the {@link #integrate(UnivariateRealFunction, double, double)}method.<a name="line.45"></a>
+<FONT color="green">046</FONT>         */<a name="line.46"></a>
+<FONT color="green">047</FONT>        @Deprecated<a name="line.47"></a>
+<FONT color="green">048</FONT>        public TrapezoidIntegrator(UnivariateRealFunction f) {<a name="line.48"></a>
+<FONT color="green">049</FONT>            super(f, 64);<a name="line.49"></a>
+<FONT color="green">050</FONT>        }<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * Construct an integrator.<a name="line.53"></a>
+<FONT color="green">054</FONT>         */<a name="line.54"></a>
+<FONT color="green">055</FONT>        public TrapezoidIntegrator() {<a name="line.55"></a>
+<FONT color="green">056</FONT>            super(64);<a name="line.56"></a>
+<FONT color="green">057</FONT>        }<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /**<a name="line.59"></a>
+<FONT color="green">060</FONT>         * Compute the n-th stage integral of trapezoid rule. This function<a name="line.60"></a>
+<FONT color="green">061</FONT>         * should only be called by API &lt;code&gt;integrate()&lt;/code&gt; in the package.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * To save time it does not verify arguments - caller does.<a name="line.62"></a>
+<FONT color="green">063</FONT>         * &lt;p&gt;<a name="line.63"></a>
+<FONT color="green">064</FONT>         * The interval is divided equally into 2^n sections rather than an<a name="line.64"></a>
+<FONT color="green">065</FONT>         * arbitrary m sections because this configuration can best utilize the<a name="line.65"></a>
+<FONT color="green">066</FONT>         * alrealy computed values.&lt;/p&gt;<a name="line.66"></a>
+<FONT color="green">067</FONT>         *<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param f the integrand function<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @param min the lower bound for the interval<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @param max the upper bound for the interval<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param n the stage of 1/2 refinement, n = 0 is no refinement<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @return the value of n-th stage integral<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.73"></a>
+<FONT color="green">074</FONT>         * function<a name="line.74"></a>
+<FONT color="green">075</FONT>         */<a name="line.75"></a>
+<FONT color="green">076</FONT>        double stage(final UnivariateRealFunction f,<a name="line.76"></a>
+<FONT color="green">077</FONT>                     final double min, final double max, final int n)<a name="line.77"></a>
+<FONT color="green">078</FONT>            throws FunctionEvaluationException {<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>            if (n == 0) {<a name="line.80"></a>
+<FONT color="green">081</FONT>                s = 0.5 * (max - min) * (f.value(min) + f.value(max));<a name="line.81"></a>
+<FONT color="green">082</FONT>                return s;<a name="line.82"></a>
+<FONT color="green">083</FONT>            } else {<a name="line.83"></a>
+<FONT color="green">084</FONT>                final long np = 1L &lt;&lt; (n-1);           // number of new points in this stage<a name="line.84"></a>
+<FONT color="green">085</FONT>                double sum = 0;<a name="line.85"></a>
+<FONT color="green">086</FONT>                final double spacing = (max - min) / np; // spacing between adjacent new points<a name="line.86"></a>
+<FONT color="green">087</FONT>                double x = min + 0.5 * spacing;    // the first new point<a name="line.87"></a>
+<FONT color="green">088</FONT>                for (long i = 0; i &lt; np; i++) {<a name="line.88"></a>
+<FONT color="green">089</FONT>                    sum += f.value(x);<a name="line.89"></a>
+<FONT color="green">090</FONT>                    x += spacing;<a name="line.90"></a>
+<FONT color="green">091</FONT>                }<a name="line.91"></a>
+<FONT color="green">092</FONT>                // add the new sum to previously calculated result<a name="line.92"></a>
+<FONT color="green">093</FONT>                s = 0.5 * (s + sum * spacing);<a name="line.93"></a>
+<FONT color="green">094</FONT>                return s;<a name="line.94"></a>
+<FONT color="green">095</FONT>            }<a name="line.95"></a>
+<FONT color="green">096</FONT>        }<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /** {@inheritDoc} */<a name="line.98"></a>
+<FONT color="green">099</FONT>        @Deprecated<a name="line.99"></a>
+<FONT color="green">100</FONT>        public double integrate(final double min, final double max)<a name="line.100"></a>
+<FONT color="green">101</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException, IllegalArgumentException {<a name="line.101"></a>
+<FONT color="green">102</FONT>            return integrate(f, min, max);<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /** {@inheritDoc} */<a name="line.105"></a>
+<FONT color="green">106</FONT>        public double integrate(final UnivariateRealFunction f,<a name="line.106"></a>
+<FONT color="green">107</FONT>                                final double min, final double max)<a name="line.107"></a>
+<FONT color="green">108</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException, IllegalArgumentException {<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>            clearResult();<a name="line.110"></a>
+<FONT color="green">111</FONT>            verifyInterval(min, max);<a name="line.111"></a>
+<FONT color="green">112</FONT>            verifyIterationCount();<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>            double oldt = stage(f, min, max, 0);<a name="line.114"></a>
+<FONT color="green">115</FONT>            for (int i = 1; i &lt;= maximalIterationCount; ++i) {<a name="line.115"></a>
+<FONT color="green">116</FONT>                final double t = stage(f, min, max, i);<a name="line.116"></a>
+<FONT color="green">117</FONT>                if (i &gt;= minimalIterationCount) {<a name="line.117"></a>
+<FONT color="green">118</FONT>                    final double delta = Math.abs(t - oldt);<a name="line.118"></a>
+<FONT color="green">119</FONT>                    final double rLimit =<a name="line.119"></a>
+<FONT color="green">120</FONT>                        relativeAccuracy * (Math.abs(oldt) + Math.abs(t)) * 0.5;<a name="line.120"></a>
+<FONT color="green">121</FONT>                    if ((delta &lt;= rLimit) || (delta &lt;= absoluteAccuracy)) {<a name="line.121"></a>
+<FONT color="green">122</FONT>                        setResult(t, i);<a name="line.122"></a>
+<FONT color="green">123</FONT>                        return result;<a name="line.123"></a>
+<FONT color="green">124</FONT>                    }<a name="line.124"></a>
+<FONT color="green">125</FONT>                }<a name="line.125"></a>
+<FONT color="green">126</FONT>                oldt = t;<a name="line.126"></a>
+<FONT color="green">127</FONT>            }<a name="line.127"></a>
+<FONT color="green">128</FONT>            throw new MaxIterationsExceededException(maximalIterationCount);<a name="line.128"></a>
+<FONT color="green">129</FONT>        }<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>        /** {@inheritDoc} */<a name="line.131"></a>
+<FONT color="green">132</FONT>        @Override<a name="line.132"></a>
+<FONT color="green">133</FONT>        protected void verifyIterationCount() throws IllegalArgumentException {<a name="line.133"></a>
+<FONT color="green">134</FONT>            super.verifyIterationCount();<a name="line.134"></a>
+<FONT color="green">135</FONT>            // at most 64 bisection refinements<a name="line.135"></a>
+<FONT color="green">136</FONT>            if (maximalIterationCount &gt; 64) {<a name="line.136"></a>
+<FONT color="green">137</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.137"></a>
+<FONT color="green">138</FONT>                        "invalid iteration limits: min={0}, max={1}",<a name="line.138"></a>
+<FONT color="green">139</FONT>                        0, 64);<a name="line.139"></a>
+<FONT color="green">140</FONT>            }<a name="line.140"></a>
+<FONT color="green">141</FONT>        }<a name="line.141"></a>
+<FONT color="green">142</FONT>    }<a name="line.142"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/integration/UnivariateRealIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,173 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.integration;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ConvergingAlgorithm;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Interface for univariate real integration algorithms.<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @since 1.2<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public interface UnivariateRealIntegrator extends ConvergingAlgorithm {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>       /**<a name="line.32"></a>
+<FONT color="green">033</FONT>         * Set the lower limit for the number of iterations.<a name="line.33"></a>
+<FONT color="green">034</FONT>         * &lt;p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>         * Minimal iteration is needed to avoid false early convergence, e.g.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * the sample points happen to be zeroes of the function. Users can<a name="line.36"></a>
+<FONT color="green">037</FONT>         * use the default value or choose one that they see as appropriate.&lt;/p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>         * &lt;p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>         * A &lt;code&gt;ConvergenceException&lt;/code&gt; will be thrown if this number<a name="line.39"></a>
+<FONT color="green">040</FONT>         * is not met.&lt;/p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>         *<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @param count minimum number of iterations<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        void setMinimalIterationCount(int count);<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /**<a name="line.46"></a>
+<FONT color="green">047</FONT>         * Get the lower limit for the number of iterations.<a name="line.47"></a>
+<FONT color="green">048</FONT>         *<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @return the actual lower limit<a name="line.49"></a>
+<FONT color="green">050</FONT>         */<a name="line.50"></a>
+<FONT color="green">051</FONT>        int getMinimalIterationCount();<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Reset the lower limit for the number of iterations to the default.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * &lt;p&gt;<a name="line.55"></a>
+<FONT color="green">056</FONT>         * The default value is supplied by the implementation.&lt;/p&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>         *<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @see #setMinimalIterationCount(int)<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        void resetMinimalIterationCount();<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /**<a name="line.62"></a>
+<FONT color="green">063</FONT>         * Integrate the function in the given interval.<a name="line.63"></a>
+<FONT color="green">064</FONT>         *<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param min the lower bound for the interval<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @param max the upper bound for the interval<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @return the value of integral<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @throws ConvergenceException if the maximum iteration count is exceeded<a name="line.68"></a>
+<FONT color="green">069</FONT>         * or the integrator detects convergence problems otherwise<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.70"></a>
+<FONT color="green">071</FONT>         * function<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @throws IllegalArgumentException if min &gt; max or the endpoints do not<a name="line.72"></a>
+<FONT color="green">073</FONT>         * satisfy the requirements specified by the integrator<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @deprecated replaced by {@link #integrate(UnivariateRealFunction, double, double)}<a name="line.74"></a>
+<FONT color="green">075</FONT>         * since 2.0<a name="line.75"></a>
+<FONT color="green">076</FONT>         */<a name="line.76"></a>
+<FONT color="green">077</FONT>        @Deprecated<a name="line.77"></a>
+<FONT color="green">078</FONT>        double integrate(double min, double max) throws ConvergenceException,<a name="line.78"></a>
+<FONT color="green">079</FONT>            FunctionEvaluationException, IllegalArgumentException;<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /**<a name="line.81"></a>
+<FONT color="green">082</FONT>         * Integrate the function in the given interval.<a name="line.82"></a>
+<FONT color="green">083</FONT>         *<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @param f the integrand function<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @param min the lower bound for the interval<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @param max the upper bound for the interval<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @return the value of integral<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @throws ConvergenceException if the maximum iteration count is exceeded<a name="line.88"></a>
+<FONT color="green">089</FONT>         * or the integrator detects convergence problems otherwise<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.90"></a>
+<FONT color="green">091</FONT>         * function<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @throws IllegalArgumentException if min &gt; max or the endpoints do not<a name="line.92"></a>
+<FONT color="green">093</FONT>         * satisfy the requirements specified by the integrator<a name="line.93"></a>
+<FONT color="green">094</FONT>         */<a name="line.94"></a>
+<FONT color="green">095</FONT>        double integrate(UnivariateRealFunction f, double min, double max) throws ConvergenceException,<a name="line.95"></a>
+<FONT color="green">096</FONT>            FunctionEvaluationException, IllegalArgumentException;<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /**<a name="line.98"></a>
+<FONT color="green">099</FONT>         * Get the result of the last run of the integrator.<a name="line.99"></a>
+<FONT color="green">100</FONT>         *<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @return the last result<a name="line.101"></a>
+<FONT color="green">102</FONT>         * @throws IllegalStateException if there is no result available, either<a name="line.102"></a>
+<FONT color="green">103</FONT>         * because no result was yet computed or the last attempt failed<a name="line.103"></a>
+<FONT color="green">104</FONT>         */<a name="line.104"></a>
+<FONT color="green">105</FONT>        double getResult() throws IllegalStateException;<a name="line.105"></a>
+<FONT color="green">106</FONT>    <a name="line.106"></a>
+<FONT color="green">107</FONT>    }<a name="line.107"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/integration/UnivariateRealIntegratorImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,244 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.integration;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.ConvergingAlgorithmImpl;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Provide a default implementation for several generic functions.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @since 1.2<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public abstract class UnivariateRealIntegratorImpl<a name="line.29"></a>
+<FONT color="green">030</FONT>        extends ConvergingAlgorithmImpl implements UnivariateRealIntegrator {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** Serializable version identifier. */<a name="line.32"></a>
+<FONT color="green">033</FONT>        private static final long serialVersionUID = 6248808456637441533L;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** minimum number of iterations */<a name="line.35"></a>
+<FONT color="green">036</FONT>        protected int minimalIterationCount;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** default minimum number of iterations */<a name="line.38"></a>
+<FONT color="green">039</FONT>        protected int defaultMinimalIterationCount;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** indicates whether an integral has been computed */<a name="line.41"></a>
+<FONT color="green">042</FONT>        protected boolean resultComputed = false;<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** the last computed integral */<a name="line.44"></a>
+<FONT color="green">045</FONT>        protected double result;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** The integrand functione.<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @deprecated as of 2.0 the integrand function is passed as an argument<a name="line.48"></a>
+<FONT color="green">049</FONT>         * to the {@link #integrate(UnivariateRealFunction, double, double)}method. */<a name="line.49"></a>
+<FONT color="green">050</FONT>        @Deprecated<a name="line.50"></a>
+<FONT color="green">051</FONT>        protected UnivariateRealFunction f;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Construct an integrator with given iteration count and accuracy.<a name="line.54"></a>
+<FONT color="green">055</FONT>         *<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param f the integrand function<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @param defaultMaximalIterationCount maximum number of iterations<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @throws IllegalArgumentException if f is null or the iteration<a name="line.58"></a>
+<FONT color="green">059</FONT>         * limits are not valid<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @deprecated as of 2.0 the integrand function is passed as an argument<a name="line.60"></a>
+<FONT color="green">061</FONT>         * to the {@link #integrate(UnivariateRealFunction, double, double)}method.<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        @Deprecated<a name="line.63"></a>
+<FONT color="green">064</FONT>        protected UnivariateRealIntegratorImpl(final UnivariateRealFunction f,<a name="line.64"></a>
+<FONT color="green">065</FONT>                                               final int defaultMaximalIterationCount)<a name="line.65"></a>
+<FONT color="green">066</FONT>            throws IllegalArgumentException {<a name="line.66"></a>
+<FONT color="green">067</FONT>            super(defaultMaximalIterationCount, 1.0e-15);<a name="line.67"></a>
+<FONT color="green">068</FONT>            if (f == null) {<a name="line.68"></a>
+<FONT color="green">069</FONT>                throw MathRuntimeException.createIllegalArgumentException("function is null");<a name="line.69"></a>
+<FONT color="green">070</FONT>            }<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>            this.f = f;<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>            // parameters that are problem specific<a name="line.74"></a>
+<FONT color="green">075</FONT>            setRelativeAccuracy(1.0e-6);<a name="line.75"></a>
+<FONT color="green">076</FONT>            this.defaultMinimalIterationCount = 3;<a name="line.76"></a>
+<FONT color="green">077</FONT>            this.minimalIterationCount = defaultMinimalIterationCount;<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>            verifyIterationCount();<a name="line.79"></a>
+<FONT color="green">080</FONT>        }<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>        /**<a name="line.82"></a>
+<FONT color="green">083</FONT>         * Construct an integrator with given iteration count and accuracy.<a name="line.83"></a>
+<FONT color="green">084</FONT>         *<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @param defaultMaximalIterationCount maximum number of iterations<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @throws IllegalArgumentException if f is null or the iteration<a name="line.86"></a>
+<FONT color="green">087</FONT>         * limits are not valid<a name="line.87"></a>
+<FONT color="green">088</FONT>         */<a name="line.88"></a>
+<FONT color="green">089</FONT>        protected UnivariateRealIntegratorImpl(final int defaultMaximalIterationCount)<a name="line.89"></a>
+<FONT color="green">090</FONT>            throws IllegalArgumentException {<a name="line.90"></a>
+<FONT color="green">091</FONT>            super(defaultMaximalIterationCount, 1.0e-15);<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>            // parameters that are problem specific<a name="line.93"></a>
+<FONT color="green">094</FONT>            setRelativeAccuracy(1.0e-6);<a name="line.94"></a>
+<FONT color="green">095</FONT>            this.defaultMinimalIterationCount = 3;<a name="line.95"></a>
+<FONT color="green">096</FONT>            this.minimalIterationCount = defaultMinimalIterationCount;<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>            verifyIterationCount();<a name="line.98"></a>
+<FONT color="green">099</FONT>        }<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /**<a name="line.101"></a>
+<FONT color="green">102</FONT>         * Access the last computed integral.<a name="line.102"></a>
+<FONT color="green">103</FONT>         *<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @return the last computed integral<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @throws IllegalStateException if no integral has been computed<a name="line.105"></a>
+<FONT color="green">106</FONT>         */<a name="line.106"></a>
+<FONT color="green">107</FONT>        public double getResult() throws IllegalStateException {<a name="line.107"></a>
+<FONT color="green">108</FONT>            if (resultComputed) {<a name="line.108"></a>
+<FONT color="green">109</FONT>                return result;<a name="line.109"></a>
+<FONT color="green">110</FONT>            } else {<a name="line.110"></a>
+<FONT color="green">111</FONT>                throw MathRuntimeException.createIllegalStateException("no result available");<a name="line.111"></a>
+<FONT color="green">112</FONT>            }<a name="line.112"></a>
+<FONT color="green">113</FONT>        }<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>        /**<a name="line.115"></a>
+<FONT color="green">116</FONT>         * Convenience function for implementations.<a name="line.116"></a>
+<FONT color="green">117</FONT>         *<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @param newResult the result to set<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @param iterationCount the iteration count to set<a name="line.119"></a>
+<FONT color="green">120</FONT>         */<a name="line.120"></a>
+<FONT color="green">121</FONT>        protected final void setResult(double newResult, int iterationCount) {<a name="line.121"></a>
+<FONT color="green">122</FONT>            this.result         = newResult;<a name="line.122"></a>
+<FONT color="green">123</FONT>            this.iterationCount = iterationCount;<a name="line.123"></a>
+<FONT color="green">124</FONT>            this.resultComputed = true;<a name="line.124"></a>
+<FONT color="green">125</FONT>        }<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>        /**<a name="line.127"></a>
+<FONT color="green">128</FONT>         * Convenience function for implementations.<a name="line.128"></a>
+<FONT color="green">129</FONT>         */<a name="line.129"></a>
+<FONT color="green">130</FONT>        protected final void clearResult() {<a name="line.130"></a>
+<FONT color="green">131</FONT>            this.iterationCount = 0;<a name="line.131"></a>
+<FONT color="green">132</FONT>            this.resultComputed = false;<a name="line.132"></a>
+<FONT color="green">133</FONT>        }<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>        /** {@inheritDoc} */<a name="line.135"></a>
+<FONT color="green">136</FONT>        public void setMinimalIterationCount(int count) {<a name="line.136"></a>
+<FONT color="green">137</FONT>            minimalIterationCount = count;<a name="line.137"></a>
+<FONT color="green">138</FONT>        }<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>        /** {@inheritDoc} */<a name="line.140"></a>
+<FONT color="green">141</FONT>        public int getMinimalIterationCount() {<a name="line.141"></a>
+<FONT color="green">142</FONT>            return minimalIterationCount;<a name="line.142"></a>
+<FONT color="green">143</FONT>        }<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>        /** {@inheritDoc} */<a name="line.145"></a>
+<FONT color="green">146</FONT>        public void resetMinimalIterationCount() {<a name="line.146"></a>
+<FONT color="green">147</FONT>            minimalIterationCount = defaultMinimalIterationCount;<a name="line.147"></a>
+<FONT color="green">148</FONT>        }<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>        /**<a name="line.150"></a>
+<FONT color="green">151</FONT>         * Verifies that the endpoints specify an interval.<a name="line.151"></a>
+<FONT color="green">152</FONT>         *<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @param lower lower endpoint<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @param upper upper endpoint<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @throws IllegalArgumentException if not interval<a name="line.155"></a>
+<FONT color="green">156</FONT>         */<a name="line.156"></a>
+<FONT color="green">157</FONT>        protected void verifyInterval(double lower, double upper) throws<a name="line.157"></a>
+<FONT color="green">158</FONT>            IllegalArgumentException {<a name="line.158"></a>
+<FONT color="green">159</FONT>            if (lower &gt;= upper) {<a name="line.159"></a>
+<FONT color="green">160</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.160"></a>
+<FONT color="green">161</FONT>                        "endpoints do not specify an interval: [{0}, {1}]",<a name="line.161"></a>
+<FONT color="green">162</FONT>                        lower, upper);<a name="line.162"></a>
+<FONT color="green">163</FONT>            }<a name="line.163"></a>
+<FONT color="green">164</FONT>        }<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>        /**<a name="line.166"></a>
+<FONT color="green">167</FONT>         * Verifies that the upper and lower limits of iterations are valid.<a name="line.167"></a>
+<FONT color="green">168</FONT>         *<a name="line.168"></a>
+<FONT color="green">169</FONT>         * @throws IllegalArgumentException if not valid<a name="line.169"></a>
+<FONT color="green">170</FONT>         */<a name="line.170"></a>
+<FONT color="green">171</FONT>        protected void verifyIterationCount() throws IllegalArgumentException {<a name="line.171"></a>
+<FONT color="green">172</FONT>            if ((minimalIterationCount &lt;= 0) || (maximalIterationCount &lt;= minimalIterationCount)) {<a name="line.172"></a>
+<FONT color="green">173</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.173"></a>
+<FONT color="green">174</FONT>                        "invalid iteration limits: min={0}, max={1}",<a name="line.174"></a>
+<FONT color="green">175</FONT>                        minimalIterationCount, maximalIterationCount);<a name="line.175"></a>
+<FONT color="green">176</FONT>            }<a name="line.176"></a>
+<FONT color="green">177</FONT>        }<a name="line.177"></a>
+<FONT color="green">178</FONT>    }<a name="line.178"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatingFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,356 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.interpolation;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.DimensionMismatchException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.analysis.BivariateRealFunction;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Function that implements the<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;a href="http://en.wikipedia.org/wiki/Bicubic_interpolation"&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * bicubic spline interpolation&lt;/a&gt;.<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @version $Revision$ $Date$<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @since 2.1<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    public class BicubicSplineInterpolatingFunction<a name="line.32"></a>
+<FONT color="green">033</FONT>        implements BivariateRealFunction {<a name="line.33"></a>
+<FONT color="green">034</FONT>        /**<a name="line.34"></a>
+<FONT color="green">035</FONT>         * Matrix to compute the spline coefficients from the function values<a name="line.35"></a>
+<FONT color="green">036</FONT>         * and function derivatives values<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        private static final double[][] AINV = {<a name="line.38"></a>
+<FONT color="green">039</FONT>            { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },<a name="line.39"></a>
+<FONT color="green">040</FONT>            { 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0 },<a name="line.40"></a>
+<FONT color="green">041</FONT>            { -3,3,0,0,-2,-1,0,0,0,0,0,0,0,0,0,0 },<a name="line.41"></a>
+<FONT color="green">042</FONT>            { 2,-2,0,0,1,1,0,0,0,0,0,0,0,0,0,0 },<a name="line.42"></a>
+<FONT color="green">043</FONT>            { 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0 },<a name="line.43"></a>
+<FONT color="green">044</FONT>            { 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 },<a name="line.44"></a>
+<FONT color="green">045</FONT>            { 0,0,0,0,0,0,0,0,-3,3,0,0,-2,-1,0,0 },<a name="line.45"></a>
+<FONT color="green">046</FONT>            { 0,0,0,0,0,0,0,0,2,-2,0,0,1,1,0,0 },<a name="line.46"></a>
+<FONT color="green">047</FONT>            { -3,0,3,0,0,0,0,0,-2,0,-1,0,0,0,0,0 },<a name="line.47"></a>
+<FONT color="green">048</FONT>            { 0,0,0,0,-3,0,3,0,0,0,0,0,-2,0,-1,0 },<a name="line.48"></a>
+<FONT color="green">049</FONT>            { 9,-9,-9,9,6,3,-6,-3,6,-6,3,-3,4,2,2,1 },<a name="line.49"></a>
+<FONT color="green">050</FONT>            { -6,6,6,-6,-3,-3,3,3,-4,4,-2,2,-2,-2,-1,-1 },<a name="line.50"></a>
+<FONT color="green">051</FONT>            { 2,0,-2,0,0,0,0,0,1,0,1,0,0,0,0,0 },<a name="line.51"></a>
+<FONT color="green">052</FONT>            { 0,0,0,0,2,0,-2,0,0,0,0,0,1,0,1,0 },<a name="line.52"></a>
+<FONT color="green">053</FONT>            { -6,6,6,-6,-4,-2,4,2,-3,3,-3,3,-2,-1,-2,-1 },<a name="line.53"></a>
+<FONT color="green">054</FONT>            { 4,-4,-4,4,2,2,-2,-2,2,-2,2,-2,1,1,1,1 }<a name="line.54"></a>
+<FONT color="green">055</FONT>        };<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /** Samples x-coordinates */<a name="line.57"></a>
+<FONT color="green">058</FONT>        private final double[] xval;<a name="line.58"></a>
+<FONT color="green">059</FONT>        /** Samples y-coordinates */<a name="line.59"></a>
+<FONT color="green">060</FONT>        private final double[] yval;<a name="line.60"></a>
+<FONT color="green">061</FONT>        /** Set of cubic splines pacthing the whole data grid */<a name="line.61"></a>
+<FONT color="green">062</FONT>        private final BicubicSplineFunction[][] splines;<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /**<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param x Sample values of the x-coordinate, in increasing order<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @param y Sample values of the y-coordinate, in increasing order<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @param z Values of the function on every grid point<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param dZdX Values of the partial derivative of function with respect<a name="line.68"></a>
+<FONT color="green">069</FONT>         * to x on every grid point<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @param dZdY Values of the partial derivative of function with respect<a name="line.70"></a>
+<FONT color="green">071</FONT>         * to y on every grid point<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param dZdXdY Values of the cross partial derivative of function on<a name="line.72"></a>
+<FONT color="green">073</FONT>         * every grid point<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @throws DimensionMismatchException if the various arrays do not contain<a name="line.74"></a>
+<FONT color="green">075</FONT>         * the expected number of elements.<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @throws IllegalArgumentException if {@code x} or {@code y} are not strictly<a name="line.76"></a>
+<FONT color="green">077</FONT>         * increasing.<a name="line.77"></a>
+<FONT color="green">078</FONT>         */<a name="line.78"></a>
+<FONT color="green">079</FONT>        public BicubicSplineInterpolatingFunction(double[] x,<a name="line.79"></a>
+<FONT color="green">080</FONT>                                                  double[] y,<a name="line.80"></a>
+<FONT color="green">081</FONT>                                                  double[][] z,<a name="line.81"></a>
+<FONT color="green">082</FONT>                                                  double[][] dZdX,<a name="line.82"></a>
+<FONT color="green">083</FONT>                                                  double[][] dZdY,<a name="line.83"></a>
+<FONT color="green">084</FONT>                                                  double[][] dZdXdY)<a name="line.84"></a>
+<FONT color="green">085</FONT>            throws DimensionMismatchException {<a name="line.85"></a>
+<FONT color="green">086</FONT>            final int xLen = x.length;<a name="line.86"></a>
+<FONT color="green">087</FONT>            final int yLen = y.length;<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>            if (xLen == 0 || yLen == 0 || z.length == 0 || z[0].length == 0) {<a name="line.89"></a>
+<FONT color="green">090</FONT>                throw MathRuntimeException.createIllegalArgumentException("no data");<a name="line.90"></a>
+<FONT color="green">091</FONT>            }<a name="line.91"></a>
+<FONT color="green">092</FONT>            if (xLen != z.length) {<a name="line.92"></a>
+<FONT color="green">093</FONT>                throw new DimensionMismatchException(xLen, z.length);<a name="line.93"></a>
+<FONT color="green">094</FONT>            }<a name="line.94"></a>
+<FONT color="green">095</FONT>            if (xLen != dZdX.length) {<a name="line.95"></a>
+<FONT color="green">096</FONT>                throw new DimensionMismatchException(xLen, dZdX.length);<a name="line.96"></a>
+<FONT color="green">097</FONT>            }<a name="line.97"></a>
+<FONT color="green">098</FONT>            if (xLen != dZdY.length) {<a name="line.98"></a>
+<FONT color="green">099</FONT>                throw new DimensionMismatchException(xLen, dZdY.length);<a name="line.99"></a>
+<FONT color="green">100</FONT>            }<a name="line.100"></a>
+<FONT color="green">101</FONT>            if (xLen != dZdXdY.length) {<a name="line.101"></a>
+<FONT color="green">102</FONT>                throw new DimensionMismatchException(xLen, dZdXdY.length);<a name="line.102"></a>
+<FONT color="green">103</FONT>            }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>            MathUtils.checkOrder(x, 1, true);<a name="line.105"></a>
+<FONT color="green">106</FONT>            MathUtils.checkOrder(y, 1, true);<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>            xval = x.clone();<a name="line.108"></a>
+<FONT color="green">109</FONT>            yval = y.clone();<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>            final int lastI = xLen - 1;<a name="line.111"></a>
+<FONT color="green">112</FONT>            final int lastJ = yLen - 1;<a name="line.112"></a>
+<FONT color="green">113</FONT>            splines = new BicubicSplineFunction[lastI][lastJ];<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>            for (int i = 0; i &lt; lastI; i++) {<a name="line.115"></a>
+<FONT color="green">116</FONT>                if (z[i].length != yLen) {<a name="line.116"></a>
+<FONT color="green">117</FONT>                    throw new DimensionMismatchException(z[i].length, yLen);<a name="line.117"></a>
+<FONT color="green">118</FONT>                }<a name="line.118"></a>
+<FONT color="green">119</FONT>                if (dZdX[i].length != yLen) {<a name="line.119"></a>
+<FONT color="green">120</FONT>                    throw new DimensionMismatchException(dZdX[i].length, yLen);<a name="line.120"></a>
+<FONT color="green">121</FONT>                }<a name="line.121"></a>
+<FONT color="green">122</FONT>                if (dZdY[i].length != yLen) {<a name="line.122"></a>
+<FONT color="green">123</FONT>                    throw new DimensionMismatchException(dZdY[i].length, yLen);<a name="line.123"></a>
+<FONT color="green">124</FONT>                }<a name="line.124"></a>
+<FONT color="green">125</FONT>                if (dZdXdY[i].length != yLen) {<a name="line.125"></a>
+<FONT color="green">126</FONT>                    throw new DimensionMismatchException(dZdXdY[i].length, yLen);<a name="line.126"></a>
+<FONT color="green">127</FONT>                }<a name="line.127"></a>
+<FONT color="green">128</FONT>                final int ip1 = i + 1;<a name="line.128"></a>
+<FONT color="green">129</FONT>                for (int j = 0; j &lt; lastJ; j++) {<a name="line.129"></a>
+<FONT color="green">130</FONT>                    final int jp1 = j + 1;<a name="line.130"></a>
+<FONT color="green">131</FONT>                    final double[] beta = new double[] {<a name="line.131"></a>
+<FONT color="green">132</FONT>                        z[i][j],      z[ip1][j],      z[i][jp1],      z[ip1][jp1],<a name="line.132"></a>
+<FONT color="green">133</FONT>                        dZdX[i][j],   dZdX[ip1][j],   dZdX[i][jp1],   dZdX[ip1][jp1],<a name="line.133"></a>
+<FONT color="green">134</FONT>                        dZdY[i][j],   dZdY[ip1][j],   dZdY[i][jp1],   dZdY[ip1][jp1],<a name="line.134"></a>
+<FONT color="green">135</FONT>                        dZdXdY[i][j], dZdXdY[ip1][j], dZdXdY[i][jp1], dZdXdY[ip1][jp1]<a name="line.135"></a>
+<FONT color="green">136</FONT>                    };<a name="line.136"></a>
+<FONT color="green">137</FONT>    <a name="line.137"></a>
+<FONT color="green">138</FONT>                    splines[i][j] = new BicubicSplineFunction(computeSplineCoefficients(beta));<a name="line.138"></a>
+<FONT color="green">139</FONT>                }<a name="line.139"></a>
+<FONT color="green">140</FONT>            }<a name="line.140"></a>
+<FONT color="green">141</FONT>        }<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>        /**<a name="line.143"></a>
+<FONT color="green">144</FONT>         * {@inheritDoc}<a name="line.144"></a>
+<FONT color="green">145</FONT>         */<a name="line.145"></a>
+<FONT color="green">146</FONT>        public double value(double x, double y) {<a name="line.146"></a>
+<FONT color="green">147</FONT>            final int i = searchIndex(x, xval);<a name="line.147"></a>
+<FONT color="green">148</FONT>            if (i == -1) {<a name="line.148"></a>
+<FONT color="green">149</FONT>                throw MathRuntimeException.createIllegalArgumentException("{0} out of [{1}, {2}] range",<a name="line.149"></a>
+<FONT color="green">150</FONT>                                                                          x, xval[0], xval[xval.length - 1]);<a name="line.150"></a>
+<FONT color="green">151</FONT>            }<a name="line.151"></a>
+<FONT color="green">152</FONT>            final int j = searchIndex(y, yval);<a name="line.152"></a>
+<FONT color="green">153</FONT>            if (j == -1) {<a name="line.153"></a>
+<FONT color="green">154</FONT>                throw MathRuntimeException.createIllegalArgumentException("{0} out of [{1}, {2}] range",<a name="line.154"></a>
+<FONT color="green">155</FONT>                                                                          y, yval[0], yval[yval.length - 1]);<a name="line.155"></a>
+<FONT color="green">156</FONT>            }<a name="line.156"></a>
+<FONT color="green">157</FONT>    <a name="line.157"></a>
+<FONT color="green">158</FONT>            final double xN = (x - xval[i]) / (xval[i + 1] - xval[i]);<a name="line.158"></a>
+<FONT color="green">159</FONT>            final double yN = (y - yval[j]) / (yval[j + 1] - yval[j]);<a name="line.159"></a>
+<FONT color="green">160</FONT>    <a name="line.160"></a>
+<FONT color="green">161</FONT>            return splines[i][j].value(xN, yN);<a name="line.161"></a>
+<FONT color="green">162</FONT>        }<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>        /**<a name="line.164"></a>
+<FONT color="green">165</FONT>         * @param c coordinate<a name="line.165"></a>
+<FONT color="green">166</FONT>         * @param val coordinate samples<a name="line.166"></a>
+<FONT color="green">167</FONT>         * @return the index in {@code val} corresponding to the interval<a name="line.167"></a>
+<FONT color="green">168</FONT>         * containing {@code c}, or {@code -1} if {@code c} is out of the<a name="line.168"></a>
+<FONT color="green">169</FONT>         * range defined by the end values of {@code val}<a name="line.169"></a>
+<FONT color="green">170</FONT>         */<a name="line.170"></a>
+<FONT color="green">171</FONT>        private int searchIndex(double c, double[] val) {<a name="line.171"></a>
+<FONT color="green">172</FONT>            if (c &lt; val[0]) {<a name="line.172"></a>
+<FONT color="green">173</FONT>                return -1;<a name="line.173"></a>
+<FONT color="green">174</FONT>            }<a name="line.174"></a>
+<FONT color="green">175</FONT>    <a name="line.175"></a>
+<FONT color="green">176</FONT>            int max = val.length;<a name="line.176"></a>
+<FONT color="green">177</FONT>            for (int i = 1; i &lt; max; i++) {<a name="line.177"></a>
+<FONT color="green">178</FONT>                if (c &lt;= val[i]) {<a name="line.178"></a>
+<FONT color="green">179</FONT>                    return i - 1;<a name="line.179"></a>
+<FONT color="green">180</FONT>                }<a name="line.180"></a>
+<FONT color="green">181</FONT>            }<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>            return -1;<a name="line.183"></a>
+<FONT color="green">184</FONT>        }<a name="line.184"></a>
+<FONT color="green">185</FONT>    <a name="line.185"></a>
+<FONT color="green">186</FONT>        /**<a name="line.186"></a>
+<FONT color="green">187</FONT>         * Compute the spline coefficients from the list of function values and<a name="line.187"></a>
+<FONT color="green">188</FONT>         * function partial derivatives values at the four corners of a grid<a name="line.188"></a>
+<FONT color="green">189</FONT>         * element. They must be specified in the following order:<a name="line.189"></a>
+<FONT color="green">190</FONT>         * &lt;ul&gt;<a name="line.190"></a>
+<FONT color="green">191</FONT>         *  &lt;li&gt;f(0,0)&lt;/li&gt;<a name="line.191"></a>
+<FONT color="green">192</FONT>         *  &lt;li&gt;f(1,0)&lt;/li&gt;<a name="line.192"></a>
+<FONT color="green">193</FONT>         *  &lt;li&gt;f(0,1)&lt;/li&gt;<a name="line.193"></a>
+<FONT color="green">194</FONT>         *  &lt;li&gt;f(1,1)&lt;/li&gt;<a name="line.194"></a>
+<FONT color="green">195</FONT>         *  &lt;li&gt;fx(0,0)&lt;/li&gt;<a name="line.195"></a>
+<FONT color="green">196</FONT>         *  &lt;li&gt;fx(1,0)&lt;/li&gt;<a name="line.196"></a>
+<FONT color="green">197</FONT>         *  &lt;li&gt;fx(0,1)&lt;/li&gt;<a name="line.197"></a>
+<FONT color="green">198</FONT>         *  &lt;li&gt;fx(1,1)&lt;/li&gt;<a name="line.198"></a>
+<FONT color="green">199</FONT>         *  &lt;li&gt;fy(0,0)&lt;/li&gt;<a name="line.199"></a>
+<FONT color="green">200</FONT>         *  &lt;li&gt;fy(1,0)&lt;/li&gt;<a name="line.200"></a>
+<FONT color="green">201</FONT>         *  &lt;li&gt;fy(0,1)&lt;/li&gt;<a name="line.201"></a>
+<FONT color="green">202</FONT>         *  &lt;li&gt;fy(1,1)&lt;/li&gt;<a name="line.202"></a>
+<FONT color="green">203</FONT>         *  &lt;li&gt;fxy(0,0)&lt;/li&gt;<a name="line.203"></a>
+<FONT color="green">204</FONT>         *  &lt;li&gt;fxy(1,0)&lt;/li&gt;<a name="line.204"></a>
+<FONT color="green">205</FONT>         *  &lt;li&gt;fxy(0,1)&lt;/li&gt;<a name="line.205"></a>
+<FONT color="green">206</FONT>         *  &lt;li&gt;fxy(1,1)&lt;/li&gt;<a name="line.206"></a>
+<FONT color="green">207</FONT>         * &lt;/ul&gt;<a name="line.207"></a>
+<FONT color="green">208</FONT>         * @param beta List of function values and function partial derivatives<a name="line.208"></a>
+<FONT color="green">209</FONT>         * values<a name="line.209"></a>
+<FONT color="green">210</FONT>         * @return the spline coefficients<a name="line.210"></a>
+<FONT color="green">211</FONT>         */<a name="line.211"></a>
+<FONT color="green">212</FONT>        private double[] computeSplineCoefficients(double[] beta) {<a name="line.212"></a>
+<FONT color="green">213</FONT>            final double[] a = new double[16];<a name="line.213"></a>
+<FONT color="green">214</FONT>    <a name="line.214"></a>
+<FONT color="green">215</FONT>            for (int i = 0; i &lt; 16; i++) {<a name="line.215"></a>
+<FONT color="green">216</FONT>                double result = 0;<a name="line.216"></a>
+<FONT color="green">217</FONT>                final double[] row = AINV[i];<a name="line.217"></a>
+<FONT color="green">218</FONT>                for (int j = 0; j &lt; 16; j++) {<a name="line.218"></a>
+<FONT color="green">219</FONT>                    result += row[j] * beta[j];<a name="line.219"></a>
+<FONT color="green">220</FONT>                }<a name="line.220"></a>
+<FONT color="green">221</FONT>                a[i] = result;<a name="line.221"></a>
+<FONT color="green">222</FONT>            }<a name="line.222"></a>
+<FONT color="green">223</FONT>    <a name="line.223"></a>
+<FONT color="green">224</FONT>            return a;<a name="line.224"></a>
+<FONT color="green">225</FONT>        }<a name="line.225"></a>
+<FONT color="green">226</FONT>    }<a name="line.226"></a>
+<FONT color="green">227</FONT>    /**<a name="line.227"></a>
+<FONT color="green">228</FONT>     * 2D-spline function.<a name="line.228"></a>
+<FONT color="green">229</FONT>     *<a name="line.229"></a>
+<FONT color="green">230</FONT>     * @version $Revision$ $Date$<a name="line.230"></a>
+<FONT color="green">231</FONT>     */<a name="line.231"></a>
+<FONT color="green">232</FONT>    class BicubicSplineFunction<a name="line.232"></a>
+<FONT color="green">233</FONT>        implements BivariateRealFunction {<a name="line.233"></a>
+<FONT color="green">234</FONT>    //CHECKSTYLE: stop MultipleVariableDeclarations<a name="line.234"></a>
+<FONT color="green">235</FONT>        /** Coefficients */<a name="line.235"></a>
+<FONT color="green">236</FONT>        private final double<a name="line.236"></a>
+<FONT color="green">237</FONT>            a00, a01, a02, a03,<a name="line.237"></a>
+<FONT color="green">238</FONT>            a10, a11, a12, a13,<a name="line.238"></a>
+<FONT color="green">239</FONT>            a20, a21, a22, a23,<a name="line.239"></a>
+<FONT color="green">240</FONT>            a30, a31, a32, a33;<a name="line.240"></a>
+<FONT color="green">241</FONT>    //CHECKSTYLE: resume MultipleVariableDeclarations<a name="line.241"></a>
+<FONT color="green">242</FONT>    <a name="line.242"></a>
+<FONT color="green">243</FONT>        /**<a name="line.243"></a>
+<FONT color="green">244</FONT>         * @param a Spline coefficients<a name="line.244"></a>
+<FONT color="green">245</FONT>         */<a name="line.245"></a>
+<FONT color="green">246</FONT>        public BicubicSplineFunction(double[] a) {<a name="line.246"></a>
+<FONT color="green">247</FONT>            this.a00 = a[0];<a name="line.247"></a>
+<FONT color="green">248</FONT>            this.a10 = a[1];<a name="line.248"></a>
+<FONT color="green">249</FONT>            this.a20 = a[2];<a name="line.249"></a>
+<FONT color="green">250</FONT>            this.a30 = a[3];<a name="line.250"></a>
+<FONT color="green">251</FONT>            this.a01 = a[4];<a name="line.251"></a>
+<FONT color="green">252</FONT>            this.a11 = a[5];<a name="line.252"></a>
+<FONT color="green">253</FONT>            this.a21 = a[6];<a name="line.253"></a>
+<FONT color="green">254</FONT>            this.a31 = a[7];<a name="line.254"></a>
+<FONT color="green">255</FONT>            this.a02 = a[8];<a name="line.255"></a>
+<FONT color="green">256</FONT>            this.a12 = a[9];<a name="line.256"></a>
+<FONT color="green">257</FONT>            this.a22 = a[10];<a name="line.257"></a>
+<FONT color="green">258</FONT>            this.a32 = a[11];<a name="line.258"></a>
+<FONT color="green">259</FONT>            this.a03 = a[12];<a name="line.259"></a>
+<FONT color="green">260</FONT>            this.a13 = a[13];<a name="line.260"></a>
+<FONT color="green">261</FONT>            this.a23 = a[14];<a name="line.261"></a>
+<FONT color="green">262</FONT>            this.a33 = a[15];<a name="line.262"></a>
+<FONT color="green">263</FONT>        }<a name="line.263"></a>
+<FONT color="green">264</FONT>    <a name="line.264"></a>
+<FONT color="green">265</FONT>        /**<a name="line.265"></a>
+<FONT color="green">266</FONT>         * @param x x-coordinate of the interpolation point<a name="line.266"></a>
+<FONT color="green">267</FONT>         * @param y y-coordinate of the interpolation point<a name="line.267"></a>
+<FONT color="green">268</FONT>         * @return the interpolated value.<a name="line.268"></a>
+<FONT color="green">269</FONT>         */<a name="line.269"></a>
+<FONT color="green">270</FONT>        public double value(double x, double y) {<a name="line.270"></a>
+<FONT color="green">271</FONT>            if (x &lt; 0 || x &gt; 1) {<a name="line.271"></a>
+<FONT color="green">272</FONT>                throw MathRuntimeException.createIllegalArgumentException("{0} out of [{1}, {2}] range",<a name="line.272"></a>
+<FONT color="green">273</FONT>                                                                          x, 0, 1);<a name="line.273"></a>
+<FONT color="green">274</FONT>            }<a name="line.274"></a>
+<FONT color="green">275</FONT>            if (y &lt; 0 || y &gt; 1) {<a name="line.275"></a>
+<FONT color="green">276</FONT>                throw MathRuntimeException.createIllegalArgumentException("{0} out of [{1}, {2}] range",<a name="line.276"></a>
+<FONT color="green">277</FONT>                                                                          y, 0, 1);<a name="line.277"></a>
+<FONT color="green">278</FONT>            }<a name="line.278"></a>
+<FONT color="green">279</FONT>    <a name="line.279"></a>
+<FONT color="green">280</FONT>            final double x2 = x * x;<a name="line.280"></a>
+<FONT color="green">281</FONT>            final double x3 = x2 * x;<a name="line.281"></a>
+<FONT color="green">282</FONT>            final double y2 = y * y;<a name="line.282"></a>
+<FONT color="green">283</FONT>            final double y3 = y2 * y;<a name="line.283"></a>
+<FONT color="green">284</FONT>    <a name="line.284"></a>
+<FONT color="green">285</FONT>            return a00 + a01 * y + a02 * y2 + a03 * y3 +<a name="line.285"></a>
+<FONT color="green">286</FONT>                a10 * x + a11 * x * y + a12 * x * y2 + a13 * x * y3 +<a name="line.286"></a>
+<FONT color="green">287</FONT>                a20 * x2 + a21 * x2 * y + a22 * x2 * y2 + a23 * x2 * y3 +<a name="line.287"></a>
+<FONT color="green">288</FONT>                a30 * x3 + a31 * x3 * y + a32 * x3 * y2 + a33 * x3 * y3;<a name="line.288"></a>
+<FONT color="green">289</FONT>        }<a name="line.289"></a>
+<FONT color="green">290</FONT>    }<a name="line.290"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/BivariateRealGridInterpolator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,111 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.interpolation;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.analysis.BivariateRealFunction;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Interface representing a bivariate real interpolating function where the<a name="line.23"></a>
+<FONT color="green">024</FONT>     * sample points must be specified on a regular grid.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision$ $Date$<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public interface BivariateRealGridInterpolator {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /**<a name="line.30"></a>
+<FONT color="green">031</FONT>         * Computes an interpolating function for the data set.<a name="line.31"></a>
+<FONT color="green">032</FONT>         *<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @param xval all the x-coordinates of the interpolation points, sorted<a name="line.33"></a>
+<FONT color="green">034</FONT>         * in increasing order.<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @param yval all the y-coordinates of the interpolation points, sorted<a name="line.35"></a>
+<FONT color="green">036</FONT>         * in increasing order.<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @param zval the values of the interpolation points on all the grid knots:<a name="line.37"></a>
+<FONT color="green">038</FONT>         * {@code zval[i][j] = f(xval[i], yval[j])}<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @return a function which interpolates the data set<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @throws MathException if arguments violate assumptions made by the<a name="line.40"></a>
+<FONT color="green">041</FONT>         *         interpolation algorithm<a name="line.41"></a>
+<FONT color="green">042</FONT>         */<a name="line.42"></a>
+<FONT color="green">043</FONT>        BivariateRealFunction interpolate(double[] xval, double[] yval, double[][] zval)<a name="line.43"></a>
+<FONT color="green">044</FONT>            throws MathException;<a name="line.44"></a>
+<FONT color="green">045</FONT>    }<a name="line.45"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/DividedDifferenceInterpolator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,183 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.interpolation;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.DuplicateSampleAbscissaException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.analysis.polynomials.PolynomialFunctionLagrangeForm;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.analysis.polynomials.PolynomialFunctionNewtonForm;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Implements the &lt;a href="<a name="line.26"></a>
+<FONT color="green">027</FONT>     * "http://mathworld.wolfram.com/NewtonsDividedDifferenceInterpolationFormula.html"&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Divided Difference Algorithm&lt;/a&gt; for interpolation of real univariate<a name="line.28"></a>
+<FONT color="green">029</FONT>     * functions. For reference, see &lt;b&gt;Introduction to Numerical Analysis&lt;/b&gt;,<a name="line.29"></a>
+<FONT color="green">030</FONT>     * ISBN 038795452X, chapter 2.<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * The actual code of Neville's evaluation is in PolynomialFunctionLagrangeForm,<a name="line.32"></a>
+<FONT color="green">033</FONT>     * this class provides an easy-to-use interface to it.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     *<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @version $Revision: 825919 $ $Date: 2009-10-16 10:51:55 -0400 (Fri, 16 Oct 2009) $<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @since 1.2<a name="line.36"></a>
+<FONT color="green">037</FONT>     */<a name="line.37"></a>
+<FONT color="green">038</FONT>    public class DividedDifferenceInterpolator implements UnivariateRealInterpolator,<a name="line.38"></a>
+<FONT color="green">039</FONT>        Serializable {<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** serializable version identifier */<a name="line.41"></a>
+<FONT color="green">042</FONT>        private static final long serialVersionUID = 107049519551235069L;<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /**<a name="line.44"></a>
+<FONT color="green">045</FONT>         * Computes an interpolating function for the data set.<a name="line.45"></a>
+<FONT color="green">046</FONT>         *<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @param x the interpolating points array<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @param y the interpolating values array<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @return a function which interpolates the data set<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @throws DuplicateSampleAbscissaException if arguments are invalid<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        public PolynomialFunctionNewtonForm interpolate(double x[], double y[]) throws<a name="line.52"></a>
+<FONT color="green">053</FONT>            DuplicateSampleAbscissaException {<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>            /**<a name="line.55"></a>
+<FONT color="green">056</FONT>             * a[] and c[] are defined in the general formula of Newton form:<a name="line.56"></a>
+<FONT color="green">057</FONT>             * p(x) = a[0] + a[1](x-c[0]) + a[2](x-c[0])(x-c[1]) + ... +<a name="line.57"></a>
+<FONT color="green">058</FONT>             *        a[n](x-c[0])(x-c[1])...(x-c[n-1])<a name="line.58"></a>
+<FONT color="green">059</FONT>             */<a name="line.59"></a>
+<FONT color="green">060</FONT>            PolynomialFunctionLagrangeForm.verifyInterpolationArray(x, y);<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>            /**<a name="line.62"></a>
+<FONT color="green">063</FONT>             * When used for interpolation, the Newton form formula becomes<a name="line.63"></a>
+<FONT color="green">064</FONT>             * p(x) = f[x0] + f[x0,x1](x-x0) + f[x0,x1,x2](x-x0)(x-x1) + ... +<a name="line.64"></a>
+<FONT color="green">065</FONT>             *        f[x0,x1,...,x[n-1]](x-x0)(x-x1)...(x-x[n-2])<a name="line.65"></a>
+<FONT color="green">066</FONT>             * Therefore, a[k] = f[x0,x1,...,xk], c[k] = x[k].<a name="line.66"></a>
+<FONT color="green">067</FONT>             * &lt;p&gt;<a name="line.67"></a>
+<FONT color="green">068</FONT>             * Note x[], y[], a[] have the same length but c[]'s size is one less.&lt;/p&gt;<a name="line.68"></a>
+<FONT color="green">069</FONT>             */<a name="line.69"></a>
+<FONT color="green">070</FONT>            final double[] c = new double[x.length-1];<a name="line.70"></a>
+<FONT color="green">071</FONT>            System.arraycopy(x, 0, c, 0, c.length);<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>            final double[] a = computeDividedDifference(x, y);<a name="line.73"></a>
+<FONT color="green">074</FONT>            return new PolynomialFunctionNewtonForm(a, c);<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        }<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /**<a name="line.78"></a>
+<FONT color="green">079</FONT>         * Returns a copy of the divided difference array.<a name="line.79"></a>
+<FONT color="green">080</FONT>         * &lt;p&gt;<a name="line.80"></a>
+<FONT color="green">081</FONT>         * The divided difference array is defined recursively by &lt;pre&gt;<a name="line.81"></a>
+<FONT color="green">082</FONT>         * f[x0] = f(x0)<a name="line.82"></a>
+<FONT color="green">083</FONT>         * f[x0,x1,...,xk] = (f(x1,...,xk) - f(x0,...,x[k-1])) / (xk - x0)<a name="line.83"></a>
+<FONT color="green">084</FONT>         * &lt;/pre&gt;&lt;/p&gt;<a name="line.84"></a>
+<FONT color="green">085</FONT>         * &lt;p&gt;<a name="line.85"></a>
+<FONT color="green">086</FONT>         * The computational complexity is O(N^2).&lt;/p&gt;<a name="line.86"></a>
+<FONT color="green">087</FONT>         *<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @param x the interpolating points array<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @param y the interpolating values array<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @return a fresh copy of the divided difference array<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @throws DuplicateSampleAbscissaException if any abscissas coincide<a name="line.91"></a>
+<FONT color="green">092</FONT>         */<a name="line.92"></a>
+<FONT color="green">093</FONT>        protected static double[] computeDividedDifference(final double x[], final double y[])<a name="line.93"></a>
+<FONT color="green">094</FONT>            throws DuplicateSampleAbscissaException {<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>            PolynomialFunctionLagrangeForm.verifyInterpolationArray(x, y);<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>            final double[] divdiff = y.clone(); // initialization<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>            final int n = x.length;<a name="line.100"></a>
+<FONT color="green">101</FONT>            final double[] a = new double [n];<a name="line.101"></a>
+<FONT color="green">102</FONT>            a[0] = divdiff[0];<a name="line.102"></a>
+<FONT color="green">103</FONT>            for (int i = 1; i &lt; n; i++) {<a name="line.103"></a>
+<FONT color="green">104</FONT>                for (int j = 0; j &lt; n-i; j++) {<a name="line.104"></a>
+<FONT color="green">105</FONT>                    final double denominator = x[j+i] - x[j];<a name="line.105"></a>
+<FONT color="green">106</FONT>                    if (denominator == 0.0) {<a name="line.106"></a>
+<FONT color="green">107</FONT>                        // This happens only when two abscissas are identical.<a name="line.107"></a>
+<FONT color="green">108</FONT>                        throw new DuplicateSampleAbscissaException(x[j], j, j+i);<a name="line.108"></a>
+<FONT color="green">109</FONT>                    }<a name="line.109"></a>
+<FONT color="green">110</FONT>                    divdiff[j] = (divdiff[j+1] - divdiff[j]) / denominator;<a name="line.110"></a>
+<FONT color="green">111</FONT>                }<a name="line.111"></a>
+<FONT color="green">112</FONT>                a[i] = divdiff[0];<a name="line.112"></a>
+<FONT color="green">113</FONT>            }<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>            return a;<a name="line.115"></a>
+<FONT color="green">116</FONT>        }<a name="line.116"></a>
+<FONT color="green">117</FONT>    }<a name="line.117"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/LoessInterpolator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,541 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.interpolation;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Implements the &lt;a href="http://en.wikipedia.org/wiki/Local_regression"&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Local Regression Algorithm&lt;/a&gt; (also Loess, Lowess) for interpolation of<a name="line.27"></a>
+<FONT color="green">028</FONT>     * real univariate functions.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p/&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * For reference, see<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;a href="http://www.math.tau.ac.il/~yekutiel/MA seminar/Cleveland 1979.pdf"&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * William S. Cleveland - Robust Locally Weighted Regression and Smoothing<a name="line.32"></a>
+<FONT color="green">033</FONT>     * Scatterplots&lt;/a&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;p/&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * This class implements both the loess method and serves as an interpolation<a name="line.35"></a>
+<FONT color="green">036</FONT>     * adapter to it, allowing to build a spline on the obtained loess fit.<a name="line.36"></a>
+<FONT color="green">037</FONT>     *<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @version $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @since 2.0<a name="line.39"></a>
+<FONT color="green">040</FONT>     */<a name="line.40"></a>
+<FONT color="green">041</FONT>    public class LoessInterpolator<a name="line.41"></a>
+<FONT color="green">042</FONT>            implements UnivariateRealInterpolator, Serializable {<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Default value of the bandwidth parameter. */<a name="line.44"></a>
+<FONT color="green">045</FONT>        public static final double DEFAULT_BANDWIDTH = 0.3;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** Default value of the number of robustness iterations. */<a name="line.47"></a>
+<FONT color="green">048</FONT>        public static final int DEFAULT_ROBUSTNESS_ITERS = 2;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Default value for accuracy.<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @since 2.1<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        public static final double DEFAULT_ACCURACY = 1e-12;<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** serializable version identifier. */<a name="line.56"></a>
+<FONT color="green">057</FONT>        private static final long serialVersionUID = 5204927143605193821L;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /**<a name="line.59"></a>
+<FONT color="green">060</FONT>         * The bandwidth parameter: when computing the loess fit at<a name="line.60"></a>
+<FONT color="green">061</FONT>         * a particular point, this fraction of source points closest<a name="line.61"></a>
+<FONT color="green">062</FONT>         * to the current point is taken into account for computing<a name="line.62"></a>
+<FONT color="green">063</FONT>         * a least-squares regression.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * &lt;p/&gt;<a name="line.64"></a>
+<FONT color="green">065</FONT>         * A sensible value is usually 0.25 to 0.5.<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        private final double bandwidth;<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * The number of robustness iterations parameter: this many<a name="line.70"></a>
+<FONT color="green">071</FONT>         * robustness iterations are done.<a name="line.71"></a>
+<FONT color="green">072</FONT>         * &lt;p/&gt;<a name="line.72"></a>
+<FONT color="green">073</FONT>         * A sensible value is usually 0 (just the initial fit without any<a name="line.73"></a>
+<FONT color="green">074</FONT>         * robustness iterations) to 4.<a name="line.74"></a>
+<FONT color="green">075</FONT>         */<a name="line.75"></a>
+<FONT color="green">076</FONT>        private final int robustnessIters;<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /**<a name="line.78"></a>
+<FONT color="green">079</FONT>         * If the median residual at a certain robustness iteration<a name="line.79"></a>
+<FONT color="green">080</FONT>         * is less than this amount, no more iterations are done.<a name="line.80"></a>
+<FONT color="green">081</FONT>         */<a name="line.81"></a>
+<FONT color="green">082</FONT>        private final double accuracy;<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /**<a name="line.84"></a>
+<FONT color="green">085</FONT>         * Constructs a new {@link LoessInterpolator}<a name="line.85"></a>
+<FONT color="green">086</FONT>         * with a bandwidth of {@link #DEFAULT_BANDWIDTH},<a name="line.86"></a>
+<FONT color="green">087</FONT>         * {@link #DEFAULT_ROBUSTNESS_ITERS} robustness iterations<a name="line.87"></a>
+<FONT color="green">088</FONT>         * and an accuracy of {#link #DEFAULT_ACCURACY}.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * See {@link #LoessInterpolator(double, int, double)} for an explanation of<a name="line.89"></a>
+<FONT color="green">090</FONT>         * the parameters.<a name="line.90"></a>
+<FONT color="green">091</FONT>         */<a name="line.91"></a>
+<FONT color="green">092</FONT>        public LoessInterpolator() {<a name="line.92"></a>
+<FONT color="green">093</FONT>            this.bandwidth = DEFAULT_BANDWIDTH;<a name="line.93"></a>
+<FONT color="green">094</FONT>            this.robustnessIters = DEFAULT_ROBUSTNESS_ITERS;<a name="line.94"></a>
+<FONT color="green">095</FONT>            this.accuracy = DEFAULT_ACCURACY;<a name="line.95"></a>
+<FONT color="green">096</FONT>        }<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /**<a name="line.98"></a>
+<FONT color="green">099</FONT>         * Constructs a new {@link LoessInterpolator}<a name="line.99"></a>
+<FONT color="green">100</FONT>         * with given bandwidth and number of robustness iterations.<a name="line.100"></a>
+<FONT color="green">101</FONT>         * &lt;p&gt;<a name="line.101"></a>
+<FONT color="green">102</FONT>         * Calling this constructor is equivalent to calling {link {@link<a name="line.102"></a>
+<FONT color="green">103</FONT>         * #LoessInterpolator(double, int, double) LoessInterpolator(bandwidth,<a name="line.103"></a>
+<FONT color="green">104</FONT>         * robustnessIters, LoessInterpolator.DEFAULT_ACCURACY)}<a name="line.104"></a>
+<FONT color="green">105</FONT>         * &lt;/p&gt;<a name="line.105"></a>
+<FONT color="green">106</FONT>         *<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @param bandwidth  when computing the loess fit at<a name="line.107"></a>
+<FONT color="green">108</FONT>         * a particular point, this fraction of source points closest<a name="line.108"></a>
+<FONT color="green">109</FONT>         * to the current point is taken into account for computing<a name="line.109"></a>
+<FONT color="green">110</FONT>         * a least-squares regression.&lt;/br&gt;<a name="line.110"></a>
+<FONT color="green">111</FONT>         * A sensible value is usually 0.25 to 0.5, the default value is<a name="line.111"></a>
+<FONT color="green">112</FONT>         * {@link #DEFAULT_BANDWIDTH}.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param robustnessIters This many robustness iterations are done.&lt;/br&gt;<a name="line.113"></a>
+<FONT color="green">114</FONT>         * A sensible value is usually 0 (just the initial fit without any<a name="line.114"></a>
+<FONT color="green">115</FONT>         * robustness iterations) to 4, the default value is<a name="line.115"></a>
+<FONT color="green">116</FONT>         * {@link #DEFAULT_ROBUSTNESS_ITERS}.<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @throws MathException if bandwidth does not lie in the interval [0,1]<a name="line.117"></a>
+<FONT color="green">118</FONT>         * or if robustnessIters is negative.<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @see #LoessInterpolator(double, int, double)<a name="line.119"></a>
+<FONT color="green">120</FONT>         */<a name="line.120"></a>
+<FONT color="green">121</FONT>        public LoessInterpolator(double bandwidth, int robustnessIters) throws MathException {<a name="line.121"></a>
+<FONT color="green">122</FONT>            this(bandwidth, robustnessIters, DEFAULT_ACCURACY);<a name="line.122"></a>
+<FONT color="green">123</FONT>        }<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>        /**<a name="line.125"></a>
+<FONT color="green">126</FONT>         * Constructs a new {@link LoessInterpolator}<a name="line.126"></a>
+<FONT color="green">127</FONT>         * with given bandwidth, number of robustness iterations and accuracy.<a name="line.127"></a>
+<FONT color="green">128</FONT>         *<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @param bandwidth  when computing the loess fit at<a name="line.129"></a>
+<FONT color="green">130</FONT>         * a particular point, this fraction of source points closest<a name="line.130"></a>
+<FONT color="green">131</FONT>         * to the current point is taken into account for computing<a name="line.131"></a>
+<FONT color="green">132</FONT>         * a least-squares regression.&lt;/br&gt;<a name="line.132"></a>
+<FONT color="green">133</FONT>         * A sensible value is usually 0.25 to 0.5, the default value is<a name="line.133"></a>
+<FONT color="green">134</FONT>         * {@link #DEFAULT_BANDWIDTH}.<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @param robustnessIters This many robustness iterations are done.&lt;/br&gt;<a name="line.135"></a>
+<FONT color="green">136</FONT>         * A sensible value is usually 0 (just the initial fit without any<a name="line.136"></a>
+<FONT color="green">137</FONT>         * robustness iterations) to 4, the default value is<a name="line.137"></a>
+<FONT color="green">138</FONT>         * {@link #DEFAULT_ROBUSTNESS_ITERS}.<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @param accuracy If the median residual at a certain robustness iteration<a name="line.139"></a>
+<FONT color="green">140</FONT>         * is less than this amount, no more iterations are done.<a name="line.140"></a>
+<FONT color="green">141</FONT>         * @throws MathException if bandwidth does not lie in the interval [0,1]<a name="line.141"></a>
+<FONT color="green">142</FONT>         * or if robustnessIters is negative.<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @see #LoessInterpolator(double, int)<a name="line.143"></a>
+<FONT color="green">144</FONT>         * @since 2.1<a name="line.144"></a>
+<FONT color="green">145</FONT>         */<a name="line.145"></a>
+<FONT color="green">146</FONT>        public LoessInterpolator(double bandwidth, int robustnessIters, double accuracy) throws MathException {<a name="line.146"></a>
+<FONT color="green">147</FONT>            if (bandwidth &lt; 0 || bandwidth &gt; 1) {<a name="line.147"></a>
+<FONT color="green">148</FONT>                throw new MathException("bandwidth must be in the interval [0,1], but got {0}",<a name="line.148"></a>
+<FONT color="green">149</FONT>                                        bandwidth);<a name="line.149"></a>
+<FONT color="green">150</FONT>            }<a name="line.150"></a>
+<FONT color="green">151</FONT>            this.bandwidth = bandwidth;<a name="line.151"></a>
+<FONT color="green">152</FONT>            if (robustnessIters &lt; 0) {<a name="line.152"></a>
+<FONT color="green">153</FONT>                throw new MathException("the number of robustness iterations must " +<a name="line.153"></a>
+<FONT color="green">154</FONT>                                        "be non-negative, but got {0}",<a name="line.154"></a>
+<FONT color="green">155</FONT>                                        robustnessIters);<a name="line.155"></a>
+<FONT color="green">156</FONT>            }<a name="line.156"></a>
+<FONT color="green">157</FONT>            this.robustnessIters = robustnessIters;<a name="line.157"></a>
+<FONT color="green">158</FONT>            this.accuracy = accuracy;<a name="line.158"></a>
+<FONT color="green">159</FONT>        }<a name="line.159"></a>
+<FONT color="green">160</FONT>    <a name="line.160"></a>
+<FONT color="green">161</FONT>        /**<a name="line.161"></a>
+<FONT color="green">162</FONT>         * Compute an interpolating function by performing a loess fit<a name="line.162"></a>
+<FONT color="green">163</FONT>         * on the data at the original abscissae and then building a cubic spline<a name="line.163"></a>
+<FONT color="green">164</FONT>         * with a<a name="line.164"></a>
+<FONT color="green">165</FONT>         * {@link org.apache.commons.math.analysis.interpolation.SplineInterpolator}<a name="line.165"></a>
+<FONT color="green">166</FONT>         * on the resulting fit.<a name="line.166"></a>
+<FONT color="green">167</FONT>         *<a name="line.167"></a>
+<FONT color="green">168</FONT>         * @param xval the arguments for the interpolation points<a name="line.168"></a>
+<FONT color="green">169</FONT>         * @param yval the values for the interpolation points<a name="line.169"></a>
+<FONT color="green">170</FONT>         * @return A cubic spline built upon a loess fit to the data at the original abscissae<a name="line.170"></a>
+<FONT color="green">171</FONT>         * @throws MathException  if some of the following conditions are false:<a name="line.171"></a>
+<FONT color="green">172</FONT>         * &lt;ul&gt;<a name="line.172"></a>
+<FONT color="green">173</FONT>         * &lt;li&gt; Arguments and values are of the same size that is greater than zero&lt;/li&gt;<a name="line.173"></a>
+<FONT color="green">174</FONT>         * &lt;li&gt; The arguments are in a strictly increasing order&lt;/li&gt;<a name="line.174"></a>
+<FONT color="green">175</FONT>         * &lt;li&gt; All arguments and values are finite real numbers&lt;/li&gt;<a name="line.175"></a>
+<FONT color="green">176</FONT>         * &lt;/ul&gt;<a name="line.176"></a>
+<FONT color="green">177</FONT>         */<a name="line.177"></a>
+<FONT color="green">178</FONT>        public final PolynomialSplineFunction interpolate(<a name="line.178"></a>
+<FONT color="green">179</FONT>                final double[] xval, final double[] yval) throws MathException {<a name="line.179"></a>
+<FONT color="green">180</FONT>            return new SplineInterpolator().interpolate(xval, smooth(xval, yval));<a name="line.180"></a>
+<FONT color="green">181</FONT>        }<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>        /**<a name="line.183"></a>
+<FONT color="green">184</FONT>         * Compute a weighted loess fit on the data at the original abscissae.<a name="line.184"></a>
+<FONT color="green">185</FONT>         *<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @param xval the arguments for the interpolation points<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @param yval the values for the interpolation points<a name="line.187"></a>
+<FONT color="green">188</FONT>         * @param weights point weights: coefficients by which the robustness weight of a point is multiplied<a name="line.188"></a>
+<FONT color="green">189</FONT>         * @return values of the loess fit at corresponding original abscissae<a name="line.189"></a>
+<FONT color="green">190</FONT>         * @throws MathException if some of the following conditions are false:<a name="line.190"></a>
+<FONT color="green">191</FONT>         * &lt;ul&gt;<a name="line.191"></a>
+<FONT color="green">192</FONT>         * &lt;li&gt; Arguments and values are of the same size that is greater than zero&lt;/li&gt;<a name="line.192"></a>
+<FONT color="green">193</FONT>         * &lt;li&gt; The arguments are in a strictly increasing order&lt;/li&gt;<a name="line.193"></a>
+<FONT color="green">194</FONT>         * &lt;li&gt; All arguments and values are finite real numbers&lt;/li&gt;<a name="line.194"></a>
+<FONT color="green">195</FONT>         * &lt;/ul&gt;<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @since 2.1<a name="line.196"></a>
+<FONT color="green">197</FONT>         */<a name="line.197"></a>
+<FONT color="green">198</FONT>        public final double[] smooth(final double[] xval, final double[] yval, final double[] weights)<a name="line.198"></a>
+<FONT color="green">199</FONT>                throws MathException {<a name="line.199"></a>
+<FONT color="green">200</FONT>            if (xval.length != yval.length) {<a name="line.200"></a>
+<FONT color="green">201</FONT>                throw new MathException(<a name="line.201"></a>
+<FONT color="green">202</FONT>                        "Loess expects the abscissa and ordinate arrays " +<a name="line.202"></a>
+<FONT color="green">203</FONT>                        "to be of the same size, " +<a name="line.203"></a>
+<FONT color="green">204</FONT>                        "but got {0} abscissae and {1} ordinatae",<a name="line.204"></a>
+<FONT color="green">205</FONT>                        xval.length, yval.length);<a name="line.205"></a>
+<FONT color="green">206</FONT>            }<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>            final int n = xval.length;<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>            if (n == 0) {<a name="line.210"></a>
+<FONT color="green">211</FONT>                throw new MathException("Loess expects at least 1 point");<a name="line.211"></a>
+<FONT color="green">212</FONT>            }<a name="line.212"></a>
+<FONT color="green">213</FONT>    <a name="line.213"></a>
+<FONT color="green">214</FONT>            checkAllFiniteReal(xval, "all abscissae must be finite real numbers, but {0}-th is {1}");<a name="line.214"></a>
+<FONT color="green">215</FONT>            checkAllFiniteReal(yval, "all ordinatae must be finite real numbers, but {0}-th is {1}");<a name="line.215"></a>
+<FONT color="green">216</FONT>            checkAllFiniteReal(weights, "all weights must be finite real numbers, but {0}-th is {1}");<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>            checkStrictlyIncreasing(xval);<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>            if (n == 1) {<a name="line.220"></a>
+<FONT color="green">221</FONT>                return new double[]{yval[0]};<a name="line.221"></a>
+<FONT color="green">222</FONT>            }<a name="line.222"></a>
+<FONT color="green">223</FONT>    <a name="line.223"></a>
+<FONT color="green">224</FONT>            if (n == 2) {<a name="line.224"></a>
+<FONT color="green">225</FONT>                return new double[]{yval[0], yval[1]};<a name="line.225"></a>
+<FONT color="green">226</FONT>            }<a name="line.226"></a>
+<FONT color="green">227</FONT>    <a name="line.227"></a>
+<FONT color="green">228</FONT>            int bandwidthInPoints = (int) (bandwidth * n);<a name="line.228"></a>
+<FONT color="green">229</FONT>    <a name="line.229"></a>
+<FONT color="green">230</FONT>            if (bandwidthInPoints &lt; 2) {<a name="line.230"></a>
+<FONT color="green">231</FONT>                throw new MathException(<a name="line.231"></a>
+<FONT color="green">232</FONT>                        "the bandwidth must be large enough to " +<a name="line.232"></a>
+<FONT color="green">233</FONT>                        "accomodate at least 2 points. There are {0} " +<a name="line.233"></a>
+<FONT color="green">234</FONT>                        " data points, and bandwidth must be at least {1} " +<a name="line.234"></a>
+<FONT color="green">235</FONT>                        " but it is only {2}",<a name="line.235"></a>
+<FONT color="green">236</FONT>                        n, 2.0 / n, bandwidth);<a name="line.236"></a>
+<FONT color="green">237</FONT>            }<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>            final double[] res = new double[n];<a name="line.239"></a>
+<FONT color="green">240</FONT>    <a name="line.240"></a>
+<FONT color="green">241</FONT>            final double[] residuals = new double[n];<a name="line.241"></a>
+<FONT color="green">242</FONT>            final double[] sortedResiduals = new double[n];<a name="line.242"></a>
+<FONT color="green">243</FONT>    <a name="line.243"></a>
+<FONT color="green">244</FONT>            final double[] robustnessWeights = new double[n];<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>            // Do an initial fit and 'robustnessIters' robustness iterations.<a name="line.246"></a>
+<FONT color="green">247</FONT>            // This is equivalent to doing 'robustnessIters+1' robustness iterations<a name="line.247"></a>
+<FONT color="green">248</FONT>            // starting with all robustness weights set to 1.<a name="line.248"></a>
+<FONT color="green">249</FONT>            Arrays.fill(robustnessWeights, 1);<a name="line.249"></a>
+<FONT color="green">250</FONT>    <a name="line.250"></a>
+<FONT color="green">251</FONT>            for (int iter = 0; iter &lt;= robustnessIters; ++iter) {<a name="line.251"></a>
+<FONT color="green">252</FONT>                final int[] bandwidthInterval = {0, bandwidthInPoints - 1};<a name="line.252"></a>
+<FONT color="green">253</FONT>                // At each x, compute a local weighted linear regression<a name="line.253"></a>
+<FONT color="green">254</FONT>                for (int i = 0; i &lt; n; ++i) {<a name="line.254"></a>
+<FONT color="green">255</FONT>                    final double x = xval[i];<a name="line.255"></a>
+<FONT color="green">256</FONT>    <a name="line.256"></a>
+<FONT color="green">257</FONT>                    // Find out the interval of source points on which<a name="line.257"></a>
+<FONT color="green">258</FONT>                    // a regression is to be made.<a name="line.258"></a>
+<FONT color="green">259</FONT>                    if (i &gt; 0) {<a name="line.259"></a>
+<FONT color="green">260</FONT>                        updateBandwidthInterval(xval, weights, i, bandwidthInterval);<a name="line.260"></a>
+<FONT color="green">261</FONT>                    }<a name="line.261"></a>
+<FONT color="green">262</FONT>    <a name="line.262"></a>
+<FONT color="green">263</FONT>                    final int ileft = bandwidthInterval[0];<a name="line.263"></a>
+<FONT color="green">264</FONT>                    final int iright = bandwidthInterval[1];<a name="line.264"></a>
+<FONT color="green">265</FONT>    <a name="line.265"></a>
+<FONT color="green">266</FONT>                    // Compute the point of the bandwidth interval that is<a name="line.266"></a>
+<FONT color="green">267</FONT>                    // farthest from x<a name="line.267"></a>
+<FONT color="green">268</FONT>                    final int edge;<a name="line.268"></a>
+<FONT color="green">269</FONT>                    if (xval[i] - xval[ileft] &gt; xval[iright] - xval[i]) {<a name="line.269"></a>
+<FONT color="green">270</FONT>                        edge = ileft;<a name="line.270"></a>
+<FONT color="green">271</FONT>                    } else {<a name="line.271"></a>
+<FONT color="green">272</FONT>                        edge = iright;<a name="line.272"></a>
+<FONT color="green">273</FONT>                    }<a name="line.273"></a>
+<FONT color="green">274</FONT>    <a name="line.274"></a>
+<FONT color="green">275</FONT>                    // Compute a least-squares linear fit weighted by<a name="line.275"></a>
+<FONT color="green">276</FONT>                    // the product of robustness weights and the tricube<a name="line.276"></a>
+<FONT color="green">277</FONT>                    // weight function.<a name="line.277"></a>
+<FONT color="green">278</FONT>                    // See http://en.wikipedia.org/wiki/Linear_regression<a name="line.278"></a>
+<FONT color="green">279</FONT>                    // (section "Univariate linear case")<a name="line.279"></a>
+<FONT color="green">280</FONT>                    // and http://en.wikipedia.org/wiki/Weighted_least_squares<a name="line.280"></a>
+<FONT color="green">281</FONT>                    // (section "Weighted least squares")<a name="line.281"></a>
+<FONT color="green">282</FONT>                    double sumWeights = 0;<a name="line.282"></a>
+<FONT color="green">283</FONT>                    double sumX = 0;<a name="line.283"></a>
+<FONT color="green">284</FONT>                    double sumXSquared = 0;<a name="line.284"></a>
+<FONT color="green">285</FONT>                    double sumY = 0;<a name="line.285"></a>
+<FONT color="green">286</FONT>                    double sumXY = 0;<a name="line.286"></a>
+<FONT color="green">287</FONT>                    double denom = Math.abs(1.0 / (xval[edge] - x));<a name="line.287"></a>
+<FONT color="green">288</FONT>                    for (int k = ileft; k &lt;= iright; ++k) {<a name="line.288"></a>
+<FONT color="green">289</FONT>                        final double xk   = xval[k];<a name="line.289"></a>
+<FONT color="green">290</FONT>                        final double yk   = yval[k];<a name="line.290"></a>
+<FONT color="green">291</FONT>                        final double dist = (k &lt; i) ? x - xk : xk - x;<a name="line.291"></a>
+<FONT color="green">292</FONT>                        final double w    = tricube(dist * denom) * robustnessWeights[k] * weights[k];<a name="line.292"></a>
+<FONT color="green">293</FONT>                        final double xkw  = xk * w;<a name="line.293"></a>
+<FONT color="green">294</FONT>                        sumWeights += w;<a name="line.294"></a>
+<FONT color="green">295</FONT>                        sumX += xkw;<a name="line.295"></a>
+<FONT color="green">296</FONT>                        sumXSquared += xk * xkw;<a name="line.296"></a>
+<FONT color="green">297</FONT>                        sumY += yk * w;<a name="line.297"></a>
+<FONT color="green">298</FONT>                        sumXY += yk * xkw;<a name="line.298"></a>
+<FONT color="green">299</FONT>                    }<a name="line.299"></a>
+<FONT color="green">300</FONT>    <a name="line.300"></a>
+<FONT color="green">301</FONT>                    final double meanX = sumX / sumWeights;<a name="line.301"></a>
+<FONT color="green">302</FONT>                    final double meanY = sumY / sumWeights;<a name="line.302"></a>
+<FONT color="green">303</FONT>                    final double meanXY = sumXY / sumWeights;<a name="line.303"></a>
+<FONT color="green">304</FONT>                    final double meanXSquared = sumXSquared / sumWeights;<a name="line.304"></a>
+<FONT color="green">305</FONT>    <a name="line.305"></a>
+<FONT color="green">306</FONT>                    final double beta;<a name="line.306"></a>
+<FONT color="green">307</FONT>                    if (Math.sqrt(Math.abs(meanXSquared - meanX * meanX)) &lt; accuracy) {<a name="line.307"></a>
+<FONT color="green">308</FONT>                        beta = 0;<a name="line.308"></a>
+<FONT color="green">309</FONT>                    } else {<a name="line.309"></a>
+<FONT color="green">310</FONT>                        beta = (meanXY - meanX * meanY) / (meanXSquared - meanX * meanX);<a name="line.310"></a>
+<FONT color="green">311</FONT>                    }<a name="line.311"></a>
+<FONT color="green">312</FONT>    <a name="line.312"></a>
+<FONT color="green">313</FONT>                    final double alpha = meanY - beta * meanX;<a name="line.313"></a>
+<FONT color="green">314</FONT>    <a name="line.314"></a>
+<FONT color="green">315</FONT>                    res[i] = beta * x + alpha;<a name="line.315"></a>
+<FONT color="green">316</FONT>                    residuals[i] = Math.abs(yval[i] - res[i]);<a name="line.316"></a>
+<FONT color="green">317</FONT>                }<a name="line.317"></a>
+<FONT color="green">318</FONT>    <a name="line.318"></a>
+<FONT color="green">319</FONT>                // No need to recompute the robustness weights at the last<a name="line.319"></a>
+<FONT color="green">320</FONT>                // iteration, they won't be needed anymore<a name="line.320"></a>
+<FONT color="green">321</FONT>                if (iter == robustnessIters) {<a name="line.321"></a>
+<FONT color="green">322</FONT>                    break;<a name="line.322"></a>
+<FONT color="green">323</FONT>                }<a name="line.323"></a>
+<FONT color="green">324</FONT>    <a name="line.324"></a>
+<FONT color="green">325</FONT>                // Recompute the robustness weights.<a name="line.325"></a>
+<FONT color="green">326</FONT>    <a name="line.326"></a>
+<FONT color="green">327</FONT>                // Find the median residual.<a name="line.327"></a>
+<FONT color="green">328</FONT>                // An arraycopy and a sort are completely tractable here,<a name="line.328"></a>
+<FONT color="green">329</FONT>                // because the preceding loop is a lot more expensive<a name="line.329"></a>
+<FONT color="green">330</FONT>                System.arraycopy(residuals, 0, sortedResiduals, 0, n);<a name="line.330"></a>
+<FONT color="green">331</FONT>                Arrays.sort(sortedResiduals);<a name="line.331"></a>
+<FONT color="green">332</FONT>                final double medianResidual = sortedResiduals[n / 2];<a name="line.332"></a>
+<FONT color="green">333</FONT>    <a name="line.333"></a>
+<FONT color="green">334</FONT>                if (Math.abs(medianResidual) &lt; accuracy) {<a name="line.334"></a>
+<FONT color="green">335</FONT>                    break;<a name="line.335"></a>
+<FONT color="green">336</FONT>                }<a name="line.336"></a>
+<FONT color="green">337</FONT>    <a name="line.337"></a>
+<FONT color="green">338</FONT>                for (int i = 0; i &lt; n; ++i) {<a name="line.338"></a>
+<FONT color="green">339</FONT>                    final double arg = residuals[i] / (6 * medianResidual);<a name="line.339"></a>
+<FONT color="green">340</FONT>                    if (arg &gt;= 1) {<a name="line.340"></a>
+<FONT color="green">341</FONT>                        robustnessWeights[i] = 0;<a name="line.341"></a>
+<FONT color="green">342</FONT>                    } else {<a name="line.342"></a>
+<FONT color="green">343</FONT>                        final double w = 1 - arg * arg;<a name="line.343"></a>
+<FONT color="green">344</FONT>                        robustnessWeights[i] = w * w;<a name="line.344"></a>
+<FONT color="green">345</FONT>                    }<a name="line.345"></a>
+<FONT color="green">346</FONT>                }<a name="line.346"></a>
+<FONT color="green">347</FONT>            }<a name="line.347"></a>
+<FONT color="green">348</FONT>    <a name="line.348"></a>
+<FONT color="green">349</FONT>            return res;<a name="line.349"></a>
+<FONT color="green">350</FONT>        }<a name="line.350"></a>
+<FONT color="green">351</FONT>    <a name="line.351"></a>
+<FONT color="green">352</FONT>        /**<a name="line.352"></a>
+<FONT color="green">353</FONT>         * Compute a loess fit on the data at the original abscissae.<a name="line.353"></a>
+<FONT color="green">354</FONT>         *<a name="line.354"></a>
+<FONT color="green">355</FONT>         * @param xval the arguments for the interpolation points<a name="line.355"></a>
+<FONT color="green">356</FONT>         * @param yval the values for the interpolation points<a name="line.356"></a>
+<FONT color="green">357</FONT>         * @return values of the loess fit at corresponding original abscissae<a name="line.357"></a>
+<FONT color="green">358</FONT>         * @throws MathException if some of the following conditions are false:<a name="line.358"></a>
+<FONT color="green">359</FONT>         * &lt;ul&gt;<a name="line.359"></a>
+<FONT color="green">360</FONT>         * &lt;li&gt; Arguments and values are of the same size that is greater than zero&lt;/li&gt;<a name="line.360"></a>
+<FONT color="green">361</FONT>         * &lt;li&gt; The arguments are in a strictly increasing order&lt;/li&gt;<a name="line.361"></a>
+<FONT color="green">362</FONT>         * &lt;li&gt; All arguments and values are finite real numbers&lt;/li&gt;<a name="line.362"></a>
+<FONT color="green">363</FONT>         * &lt;/ul&gt;<a name="line.363"></a>
+<FONT color="green">364</FONT>         */<a name="line.364"></a>
+<FONT color="green">365</FONT>        public final double[] smooth(final double[] xval, final double[] yval)<a name="line.365"></a>
+<FONT color="green">366</FONT>                throws MathException {<a name="line.366"></a>
+<FONT color="green">367</FONT>            if (xval.length != yval.length) {<a name="line.367"></a>
+<FONT color="green">368</FONT>                throw new MathException(<a name="line.368"></a>
+<FONT color="green">369</FONT>                        "Loess expects the abscissa and ordinate arrays " +<a name="line.369"></a>
+<FONT color="green">370</FONT>                        "to be of the same size, " +<a name="line.370"></a>
+<FONT color="green">371</FONT>                        "but got {0} abscissae and {1} ordinatae",<a name="line.371"></a>
+<FONT color="green">372</FONT>                        xval.length, yval.length);<a name="line.372"></a>
+<FONT color="green">373</FONT>            }<a name="line.373"></a>
+<FONT color="green">374</FONT>    <a name="line.374"></a>
+<FONT color="green">375</FONT>            final double[] unitWeights = new double[xval.length];<a name="line.375"></a>
+<FONT color="green">376</FONT>            Arrays.fill(unitWeights, 1.0);<a name="line.376"></a>
+<FONT color="green">377</FONT>    <a name="line.377"></a>
+<FONT color="green">378</FONT>            return smooth(xval, yval, unitWeights);<a name="line.378"></a>
+<FONT color="green">379</FONT>        }<a name="line.379"></a>
+<FONT color="green">380</FONT>    <a name="line.380"></a>
+<FONT color="green">381</FONT>        /**<a name="line.381"></a>
+<FONT color="green">382</FONT>         * Given an index interval into xval that embraces a certain number of<a name="line.382"></a>
+<FONT color="green">383</FONT>         * points closest to xval[i-1], update the interval so that it embraces<a name="line.383"></a>
+<FONT color="green">384</FONT>         * the same number of points closest to xval[i], ignoring zero weights.<a name="line.384"></a>
+<FONT color="green">385</FONT>         *<a name="line.385"></a>
+<FONT color="green">386</FONT>         * @param xval arguments array<a name="line.386"></a>
+<FONT color="green">387</FONT>         * @param weights weights array<a name="line.387"></a>
+<FONT color="green">388</FONT>         * @param i the index around which the new interval should be computed<a name="line.388"></a>
+<FONT color="green">389</FONT>         * @param bandwidthInterval a two-element array {left, right} such that: &lt;p/&gt;<a name="line.389"></a>
+<FONT color="green">390</FONT>         * &lt;tt&gt;(left==0 or xval[i] - xval[left-1] &gt; xval[right] - xval[i])&lt;/tt&gt;<a name="line.390"></a>
+<FONT color="green">391</FONT>         * &lt;p/&gt; and also &lt;p/&gt;<a name="line.391"></a>
+<FONT color="green">392</FONT>         * &lt;tt&gt;(right==xval.length-1 or xval[right+1] - xval[i] &gt; xval[i] - xval[left])&lt;/tt&gt;.<a name="line.392"></a>
+<FONT color="green">393</FONT>         * The array will be updated.<a name="line.393"></a>
+<FONT color="green">394</FONT>         */<a name="line.394"></a>
+<FONT color="green">395</FONT>        private static void updateBandwidthInterval(final double[] xval, final double[] weights,<a name="line.395"></a>
+<FONT color="green">396</FONT>                                                    final int i,<a name="line.396"></a>
+<FONT color="green">397</FONT>                                                    final int[] bandwidthInterval) {<a name="line.397"></a>
+<FONT color="green">398</FONT>            final int left = bandwidthInterval[0];<a name="line.398"></a>
+<FONT color="green">399</FONT>            final int right = bandwidthInterval[1];<a name="line.399"></a>
+<FONT color="green">400</FONT>    <a name="line.400"></a>
+<FONT color="green">401</FONT>            // The right edge should be adjusted if the next point to the right<a name="line.401"></a>
+<FONT color="green">402</FONT>            // is closer to xval[i] than the leftmost point of the current interval<a name="line.402"></a>
+<FONT color="green">403</FONT>            int nextRight = nextNonzero(weights, right);<a name="line.403"></a>
+<FONT color="green">404</FONT>            if (nextRight &lt; xval.length &amp;&amp; xval[nextRight] - xval[i] &lt; xval[i] - xval[left]) {<a name="line.404"></a>
+<FONT color="green">405</FONT>                int nextLeft = nextNonzero(weights, bandwidthInterval[0]);<a name="line.405"></a>
+<FONT color="green">406</FONT>                bandwidthInterval[0] = nextLeft;<a name="line.406"></a>
+<FONT color="green">407</FONT>                bandwidthInterval[1] = nextRight;<a name="line.407"></a>
+<FONT color="green">408</FONT>            }<a name="line.408"></a>
+<FONT color="green">409</FONT>        }<a name="line.409"></a>
+<FONT color="green">410</FONT>    <a name="line.410"></a>
+<FONT color="green">411</FONT>        /**<a name="line.411"></a>
+<FONT color="green">412</FONT>         * Returns the smallest index j such that j &gt; i &amp;&amp; (j==weights.length || weights[j] != 0)<a name="line.412"></a>
+<FONT color="green">413</FONT>         * @param weights weights array<a name="line.413"></a>
+<FONT color="green">414</FONT>         * @param i the index from which to start search; must be &lt; weights.length<a name="line.414"></a>
+<FONT color="green">415</FONT>         * @return the smallest index j such that j &gt; i &amp;&amp; (j==weights.length || weights[j] != 0)<a name="line.415"></a>
+<FONT color="green">416</FONT>         */<a name="line.416"></a>
+<FONT color="green">417</FONT>        private static int nextNonzero(final double[] weights, final int i) {<a name="line.417"></a>
+<FONT color="green">418</FONT>            int j = i + 1;<a name="line.418"></a>
+<FONT color="green">419</FONT>            while(j &lt; weights.length &amp;&amp; weights[j] == 0) {<a name="line.419"></a>
+<FONT color="green">420</FONT>                j++;<a name="line.420"></a>
+<FONT color="green">421</FONT>            }<a name="line.421"></a>
+<FONT color="green">422</FONT>            return j;<a name="line.422"></a>
+<FONT color="green">423</FONT>        }<a name="line.423"></a>
+<FONT color="green">424</FONT>    <a name="line.424"></a>
+<FONT color="green">425</FONT>        /**<a name="line.425"></a>
+<FONT color="green">426</FONT>         * Compute the<a name="line.426"></a>
+<FONT color="green">427</FONT>         * &lt;a href="http://en.wikipedia.org/wiki/Local_regression#Weight_function"&gt;tricube&lt;/a&gt;<a name="line.427"></a>
+<FONT color="green">428</FONT>         * weight function<a name="line.428"></a>
+<FONT color="green">429</FONT>         *<a name="line.429"></a>
+<FONT color="green">430</FONT>         * @param x the argument<a name="line.430"></a>
+<FONT color="green">431</FONT>         * @return (1-|x|^3)^3<a name="line.431"></a>
+<FONT color="green">432</FONT>         */<a name="line.432"></a>
+<FONT color="green">433</FONT>        private static double tricube(final double x) {<a name="line.433"></a>
+<FONT color="green">434</FONT>            final double tmp = 1 - x * x * x;<a name="line.434"></a>
+<FONT color="green">435</FONT>            return tmp * tmp * tmp;<a name="line.435"></a>
+<FONT color="green">436</FONT>        }<a name="line.436"></a>
+<FONT color="green">437</FONT>    <a name="line.437"></a>
+<FONT color="green">438</FONT>        /**<a name="line.438"></a>
+<FONT color="green">439</FONT>         * Check that all elements of an array are finite real numbers.<a name="line.439"></a>
+<FONT color="green">440</FONT>         *<a name="line.440"></a>
+<FONT color="green">441</FONT>         * @param values the values array<a name="line.441"></a>
+<FONT color="green">442</FONT>         * @param pattern pattern of the error message<a name="line.442"></a>
+<FONT color="green">443</FONT>         * @throws MathException if one of the values is not a finite real number<a name="line.443"></a>
+<FONT color="green">444</FONT>         */<a name="line.444"></a>
+<FONT color="green">445</FONT>        private static void checkAllFiniteReal(final double[] values, final String pattern)<a name="line.445"></a>
+<FONT color="green">446</FONT>            throws MathException {<a name="line.446"></a>
+<FONT color="green">447</FONT>            for (int i = 0; i &lt; values.length; i++) {<a name="line.447"></a>
+<FONT color="green">448</FONT>                final double x = values[i];<a name="line.448"></a>
+<FONT color="green">449</FONT>                if (Double.isInfinite(x) || Double.isNaN(x)) {<a name="line.449"></a>
+<FONT color="green">450</FONT>                    throw new MathException(pattern, i, x);<a name="line.450"></a>
+<FONT color="green">451</FONT>                }<a name="line.451"></a>
+<FONT color="green">452</FONT>            }<a name="line.452"></a>
+<FONT color="green">453</FONT>        }<a name="line.453"></a>
+<FONT color="green">454</FONT>    <a name="line.454"></a>
+<FONT color="green">455</FONT>        /**<a name="line.455"></a>
+<FONT color="green">456</FONT>         * Check that elements of the abscissae array are in a strictly<a name="line.456"></a>
+<FONT color="green">457</FONT>         * increasing order.<a name="line.457"></a>
+<FONT color="green">458</FONT>         *<a name="line.458"></a>
+<FONT color="green">459</FONT>         * @param xval the abscissae array<a name="line.459"></a>
+<FONT color="green">460</FONT>         * @throws MathException if the abscissae array<a name="line.460"></a>
+<FONT color="green">461</FONT>         * is not in a strictly increasing order<a name="line.461"></a>
+<FONT color="green">462</FONT>         */<a name="line.462"></a>
+<FONT color="green">463</FONT>        private static void checkStrictlyIncreasing(final double[] xval)<a name="line.463"></a>
+<FONT color="green">464</FONT>            throws MathException {<a name="line.464"></a>
+<FONT color="green">465</FONT>            for (int i = 0; i &lt; xval.length; ++i) {<a name="line.465"></a>
+<FONT color="green">466</FONT>                if (i &gt;= 1 &amp;&amp; xval[i - 1] &gt;= xval[i]) {<a name="line.466"></a>
+<FONT color="green">467</FONT>                    throw new MathException(<a name="line.467"></a>
+<FONT color="green">468</FONT>                            "the abscissae array must be sorted in a strictly " +<a name="line.468"></a>
+<FONT color="green">469</FONT>                            "increasing order, but the {0}-th element is {1} " +<a name="line.469"></a>
+<FONT color="green">470</FONT>                            "whereas {2}-th is {3}",<a name="line.470"></a>
+<FONT color="green">471</FONT>                            i - 1, xval[i - 1], i, xval[i]);<a name="line.471"></a>
+<FONT color="green">472</FONT>                }<a name="line.472"></a>
+<FONT color="green">473</FONT>            }<a name="line.473"></a>
+<FONT color="green">474</FONT>        }<a name="line.474"></a>
+<FONT color="green">475</FONT>    }<a name="line.475"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/MicrosphereInterpolatingFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,309 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.interpolation;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.ArrayList;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.HashMap;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.List;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.util.Map;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.DimensionMismatchException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.analysis.MultivariateRealFunction;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.linear.ArrayRealVector;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.linear.RealVector;<a name="line.28"></a>
+<FONT color="green">029</FONT>    import org.apache.commons.math.random.UnitSphereRandomVectorGenerator;<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>    /**<a name="line.31"></a>
+<FONT color="green">032</FONT>     * Interpolating function that implements the<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;a href="http://www.dudziak.com/microsphere.php"&gt;Microsphere Projection&lt;/a&gt;.<a name="line.33"></a>
+<FONT color="green">034</FONT>     *<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @version $Revision: 825919 $ $Date: 2009-10-16 10:51:55 -0400 (Fri, 16 Oct 2009) $<a name="line.35"></a>
+<FONT color="green">036</FONT>     */<a name="line.36"></a>
+<FONT color="green">037</FONT>    public class MicrosphereInterpolatingFunction<a name="line.37"></a>
+<FONT color="green">038</FONT>        implements MultivariateRealFunction {<a name="line.38"></a>
+<FONT color="green">039</FONT>        /**<a name="line.39"></a>
+<FONT color="green">040</FONT>         * Space dimension.<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        private final int dimension;<a name="line.42"></a>
+<FONT color="green">043</FONT>        /**<a name="line.43"></a>
+<FONT color="green">044</FONT>         * Internal accounting data for the interpolation algorithm.<a name="line.44"></a>
+<FONT color="green">045</FONT>         * Each element of the list corresponds to one surface element of<a name="line.45"></a>
+<FONT color="green">046</FONT>         * the microsphere.<a name="line.46"></a>
+<FONT color="green">047</FONT>         */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private final List&lt;MicrosphereSurfaceElement&gt; microsphere;<a name="line.48"></a>
+<FONT color="green">049</FONT>        /**<a name="line.49"></a>
+<FONT color="green">050</FONT>         * Exponent used in the power law that computes the weights of the<a name="line.50"></a>
+<FONT color="green">051</FONT>         * sample data.<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        private final double brightnessExponent;<a name="line.53"></a>
+<FONT color="green">054</FONT>        /**<a name="line.54"></a>
+<FONT color="green">055</FONT>         * Sample data.<a name="line.55"></a>
+<FONT color="green">056</FONT>         */<a name="line.56"></a>
+<FONT color="green">057</FONT>        private final Map&lt;RealVector, Double&gt; samples;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /**<a name="line.59"></a>
+<FONT color="green">060</FONT>         * Class for storing the accounting data needed to perform the<a name="line.60"></a>
+<FONT color="green">061</FONT>         * microsphere projection.<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        private static class MicrosphereSurfaceElement {<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>            /** Normal vector characterizing a surface element. */<a name="line.65"></a>
+<FONT color="green">066</FONT>            private final RealVector normal;<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>            /** Illumination received from the brightest sample. */<a name="line.68"></a>
+<FONT color="green">069</FONT>            private double brightestIllumination;<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>            /** Brightest sample. */<a name="line.71"></a>
+<FONT color="green">072</FONT>            private Map.Entry&lt;RealVector, Double&gt; brightestSample;<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>            /**<a name="line.74"></a>
+<FONT color="green">075</FONT>             * @param n Normal vector characterizing a surface element<a name="line.75"></a>
+<FONT color="green">076</FONT>             * of the microsphere.<a name="line.76"></a>
+<FONT color="green">077</FONT>             */<a name="line.77"></a>
+<FONT color="green">078</FONT>            MicrosphereSurfaceElement(double[] n) {<a name="line.78"></a>
+<FONT color="green">079</FONT>                normal = new ArrayRealVector(n);<a name="line.79"></a>
+<FONT color="green">080</FONT>            }<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>            /**<a name="line.82"></a>
+<FONT color="green">083</FONT>             * Return the normal vector.<a name="line.83"></a>
+<FONT color="green">084</FONT>             * @return the normal vector<a name="line.84"></a>
+<FONT color="green">085</FONT>             */<a name="line.85"></a>
+<FONT color="green">086</FONT>            RealVector normal() {<a name="line.86"></a>
+<FONT color="green">087</FONT>                return normal;<a name="line.87"></a>
+<FONT color="green">088</FONT>            }<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>            /**<a name="line.90"></a>
+<FONT color="green">091</FONT>             * Reset "illumination" and "sampleIndex".<a name="line.91"></a>
+<FONT color="green">092</FONT>             */<a name="line.92"></a>
+<FONT color="green">093</FONT>            void reset() {<a name="line.93"></a>
+<FONT color="green">094</FONT>                brightestIllumination = 0;<a name="line.94"></a>
+<FONT color="green">095</FONT>                brightestSample = null;<a name="line.95"></a>
+<FONT color="green">096</FONT>            }<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>            /**<a name="line.98"></a>
+<FONT color="green">099</FONT>             * Store the illumination and index of the brightest sample.<a name="line.99"></a>
+<FONT color="green">100</FONT>             * @param illuminationFromSample illumination received from sample<a name="line.100"></a>
+<FONT color="green">101</FONT>             * @param sample current sample illuminating the element<a name="line.101"></a>
+<FONT color="green">102</FONT>             */<a name="line.102"></a>
+<FONT color="green">103</FONT>            void store(final double illuminationFromSample,<a name="line.103"></a>
+<FONT color="green">104</FONT>                       final Map.Entry&lt;RealVector, Double&gt; sample) {<a name="line.104"></a>
+<FONT color="green">105</FONT>                if (illuminationFromSample &gt; this.brightestIllumination) {<a name="line.105"></a>
+<FONT color="green">106</FONT>                    this.brightestIllumination = illuminationFromSample;<a name="line.106"></a>
+<FONT color="green">107</FONT>                    this.brightestSample = sample;<a name="line.107"></a>
+<FONT color="green">108</FONT>                }<a name="line.108"></a>
+<FONT color="green">109</FONT>            }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>            /**<a name="line.111"></a>
+<FONT color="green">112</FONT>             * Get the illumination of the element.<a name="line.112"></a>
+<FONT color="green">113</FONT>             * @return the illumination.<a name="line.113"></a>
+<FONT color="green">114</FONT>             */<a name="line.114"></a>
+<FONT color="green">115</FONT>            double illumination() {<a name="line.115"></a>
+<FONT color="green">116</FONT>                return brightestIllumination;<a name="line.116"></a>
+<FONT color="green">117</FONT>            }<a name="line.117"></a>
+<FONT color="green">118</FONT>    <a name="line.118"></a>
+<FONT color="green">119</FONT>            /**<a name="line.119"></a>
+<FONT color="green">120</FONT>             * Get the sample illuminating the element the most.<a name="line.120"></a>
+<FONT color="green">121</FONT>             * @return the sample.<a name="line.121"></a>
+<FONT color="green">122</FONT>             */<a name="line.122"></a>
+<FONT color="green">123</FONT>            Map.Entry&lt;RealVector, Double&gt; sample() {<a name="line.123"></a>
+<FONT color="green">124</FONT>                return brightestSample;<a name="line.124"></a>
+<FONT color="green">125</FONT>            }<a name="line.125"></a>
+<FONT color="green">126</FONT>        }<a name="line.126"></a>
+<FONT color="green">127</FONT>    <a name="line.127"></a>
+<FONT color="green">128</FONT>        /**<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @param xval the arguments for the interpolation points.<a name="line.129"></a>
+<FONT color="green">130</FONT>         * {@code xval[i][0]} is the first component of interpolation point<a name="line.130"></a>
+<FONT color="green">131</FONT>         * {@code i}, {@code xval[i][1]} is the second component, and so on<a name="line.131"></a>
+<FONT color="green">132</FONT>         * until {@code xval[i][d-1]}, the last component of that interpolation<a name="line.132"></a>
+<FONT color="green">133</FONT>         * point (where {@code dimension} is thus the dimension of the sampled<a name="line.133"></a>
+<FONT color="green">134</FONT>         * space).<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @param yval the values for the interpolation points<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @param brightnessExponent Brightness dimming factor.<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @param microsphereElements Number of surface elements of the<a name="line.137"></a>
+<FONT color="green">138</FONT>         * microsphere.<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @param rand Unit vector generator for creating the microsphere.<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @throws DimensionMismatchException if the lengths of {@code yval} and<a name="line.140"></a>
+<FONT color="green">141</FONT>         * {@code xval} (equal to {@code n}, the number of interpolation points)<a name="line.141"></a>
+<FONT color="green">142</FONT>         * do not match, or the the arrays {@code xval[0]} ... {@code xval[n]},<a name="line.142"></a>
+<FONT color="green">143</FONT>         * have lengths different from {@code dimension}.<a name="line.143"></a>
+<FONT color="green">144</FONT>         * @throws IllegalArgumentException if there are no data (xval null or zero length)<a name="line.144"></a>
+<FONT color="green">145</FONT>         */<a name="line.145"></a>
+<FONT color="green">146</FONT>        public MicrosphereInterpolatingFunction(double[][] xval,<a name="line.146"></a>
+<FONT color="green">147</FONT>                                                double[] yval,<a name="line.147"></a>
+<FONT color="green">148</FONT>                                                int brightnessExponent,<a name="line.148"></a>
+<FONT color="green">149</FONT>                                                int microsphereElements,<a name="line.149"></a>
+<FONT color="green">150</FONT>                                                UnitSphereRandomVectorGenerator rand)<a name="line.150"></a>
+<FONT color="green">151</FONT>            throws DimensionMismatchException, IllegalArgumentException {<a name="line.151"></a>
+<FONT color="green">152</FONT>            if (xval.length == 0 || xval[0] == null) {<a name="line.152"></a>
+<FONT color="green">153</FONT>                throw MathRuntimeException.createIllegalArgumentException("no data");<a name="line.153"></a>
+<FONT color="green">154</FONT>            }<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>            if (xval.length != yval.length) {<a name="line.156"></a>
+<FONT color="green">157</FONT>                throw new DimensionMismatchException(xval.length, yval.length);<a name="line.157"></a>
+<FONT color="green">158</FONT>            }<a name="line.158"></a>
+<FONT color="green">159</FONT>    <a name="line.159"></a>
+<FONT color="green">160</FONT>            dimension = xval[0].length;<a name="line.160"></a>
+<FONT color="green">161</FONT>            this.brightnessExponent = brightnessExponent;<a name="line.161"></a>
+<FONT color="green">162</FONT>    <a name="line.162"></a>
+<FONT color="green">163</FONT>            // Copy data samples.<a name="line.163"></a>
+<FONT color="green">164</FONT>            samples = new HashMap&lt;RealVector, Double&gt;(yval.length);<a name="line.164"></a>
+<FONT color="green">165</FONT>            for (int i = 0; i &lt; xval.length; ++i) {<a name="line.165"></a>
+<FONT color="green">166</FONT>                final double[] xvalI = xval[i];<a name="line.166"></a>
+<FONT color="green">167</FONT>                if ( xvalI.length != dimension) {<a name="line.167"></a>
+<FONT color="green">168</FONT>                    throw new DimensionMismatchException(xvalI.length, dimension);<a name="line.168"></a>
+<FONT color="green">169</FONT>                }<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>                samples.put(new ArrayRealVector(xvalI), yval[i]);<a name="line.171"></a>
+<FONT color="green">172</FONT>            }<a name="line.172"></a>
+<FONT color="green">173</FONT>    <a name="line.173"></a>
+<FONT color="green">174</FONT>            microsphere = new ArrayList&lt;MicrosphereSurfaceElement&gt;(microsphereElements);<a name="line.174"></a>
+<FONT color="green">175</FONT>            // Generate the microsphere, assuming that a fairly large number of<a name="line.175"></a>
+<FONT color="green">176</FONT>            // randomly generated normals will represent a sphere.<a name="line.176"></a>
+<FONT color="green">177</FONT>            for (int i = 0; i &lt; microsphereElements; i++) {<a name="line.177"></a>
+<FONT color="green">178</FONT>                microsphere.add(new MicrosphereSurfaceElement(rand.nextVector()));<a name="line.178"></a>
+<FONT color="green">179</FONT>            }<a name="line.179"></a>
+<FONT color="green">180</FONT>    <a name="line.180"></a>
+<FONT color="green">181</FONT>        }<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>        /**<a name="line.183"></a>
+<FONT color="green">184</FONT>         * @param point Interpolation point.<a name="line.184"></a>
+<FONT color="green">185</FONT>         * @return the interpolated value.<a name="line.185"></a>
+<FONT color="green">186</FONT>         */<a name="line.186"></a>
+<FONT color="green">187</FONT>        public double value(double[] point) {<a name="line.187"></a>
+<FONT color="green">188</FONT>    <a name="line.188"></a>
+<FONT color="green">189</FONT>            final RealVector p = new ArrayRealVector(point);<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>            // Reset.<a name="line.191"></a>
+<FONT color="green">192</FONT>            for (MicrosphereSurfaceElement md : microsphere) {<a name="line.192"></a>
+<FONT color="green">193</FONT>                md.reset();<a name="line.193"></a>
+<FONT color="green">194</FONT>            }<a name="line.194"></a>
+<FONT color="green">195</FONT>    <a name="line.195"></a>
+<FONT color="green">196</FONT>            // Compute contribution of each sample points to the microsphere elements illumination<a name="line.196"></a>
+<FONT color="green">197</FONT>            for (Map.Entry&lt;RealVector, Double&gt; sd : samples.entrySet()) {<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>                // Vector between interpolation point and current sample point.<a name="line.199"></a>
+<FONT color="green">200</FONT>                final RealVector diff = sd.getKey().subtract(p);<a name="line.200"></a>
+<FONT color="green">201</FONT>                final double diffNorm = diff.getNorm();<a name="line.201"></a>
+<FONT color="green">202</FONT>    <a name="line.202"></a>
+<FONT color="green">203</FONT>                if (Math.abs(diffNorm) &lt; Math.ulp(1d)) {<a name="line.203"></a>
+<FONT color="green">204</FONT>                    // No need to interpolate, as the interpolation point is<a name="line.204"></a>
+<FONT color="green">205</FONT>                    // actually (very close to) one of the sampled points.<a name="line.205"></a>
+<FONT color="green">206</FONT>                    return sd.getValue();<a name="line.206"></a>
+<FONT color="green">207</FONT>                }<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>                for (MicrosphereSurfaceElement md : microsphere) {<a name="line.209"></a>
+<FONT color="green">210</FONT>                    final double w = Math.pow(diffNorm, -brightnessExponent);<a name="line.210"></a>
+<FONT color="green">211</FONT>                    md.store(cosAngle(diff, md.normal()) * w, sd);<a name="line.211"></a>
+<FONT color="green">212</FONT>                }<a name="line.212"></a>
+<FONT color="green">213</FONT>    <a name="line.213"></a>
+<FONT color="green">214</FONT>            }<a name="line.214"></a>
+<FONT color="green">215</FONT>    <a name="line.215"></a>
+<FONT color="green">216</FONT>            // Interpolation calculation.<a name="line.216"></a>
+<FONT color="green">217</FONT>            double value = 0;<a name="line.217"></a>
+<FONT color="green">218</FONT>            double totalWeight = 0;<a name="line.218"></a>
+<FONT color="green">219</FONT>            for (MicrosphereSurfaceElement md : microsphere) {<a name="line.219"></a>
+<FONT color="green">220</FONT>                final double iV = md.illumination();<a name="line.220"></a>
+<FONT color="green">221</FONT>                final Map.Entry&lt;RealVector, Double&gt; sd = md.sample();<a name="line.221"></a>
+<FONT color="green">222</FONT>                if (sd != null) {<a name="line.222"></a>
+<FONT color="green">223</FONT>                    value += iV * sd.getValue();<a name="line.223"></a>
+<FONT color="green">224</FONT>                    totalWeight += iV;<a name="line.224"></a>
+<FONT color="green">225</FONT>                }<a name="line.225"></a>
+<FONT color="green">226</FONT>            }<a name="line.226"></a>
+<FONT color="green">227</FONT>    <a name="line.227"></a>
+<FONT color="green">228</FONT>            return value / totalWeight;<a name="line.228"></a>
+<FONT color="green">229</FONT>    <a name="line.229"></a>
+<FONT color="green">230</FONT>        }<a name="line.230"></a>
+<FONT color="green">231</FONT>    <a name="line.231"></a>
+<FONT color="green">232</FONT>        /**<a name="line.232"></a>
+<FONT color="green">233</FONT>         * Compute the cosine of the angle between 2 vectors.<a name="line.233"></a>
+<FONT color="green">234</FONT>         *<a name="line.234"></a>
+<FONT color="green">235</FONT>         * @param v Vector.<a name="line.235"></a>
+<FONT color="green">236</FONT>         * @param w Vector.<a name="line.236"></a>
+<FONT color="green">237</FONT>         * @return cosine of the angle<a name="line.237"></a>
+<FONT color="green">238</FONT>         */<a name="line.238"></a>
+<FONT color="green">239</FONT>        private double cosAngle(final RealVector v, final RealVector w) {<a name="line.239"></a>
+<FONT color="green">240</FONT>            return v.dotProduct(w) / (v.getNorm() * w.getNorm());<a name="line.240"></a>
+<FONT color="green">241</FONT>        }<a name="line.241"></a>
+<FONT color="green">242</FONT>    <a name="line.242"></a>
+<FONT color="green">243</FONT>    }<a name="line.243"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/MicrosphereInterpolator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,189 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.interpolation;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.analysis.MultivariateRealFunction;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.random.UnitSphereRandomVectorGenerator;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Interpolator that implements the algorithm described in<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;em&gt;William Dudziak&lt;/em&gt;'s<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;a href="http://www.dudziak.com/microsphere.pdf"&gt;MS thesis&lt;/a&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @since 2.1<a name="line.28"></a>
+<FONT color="green">029</FONT>     *<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 924794 $ $Date: 2010-03-18 10:15:50 -0400 (Thu, 18 Mar 2010) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    public class MicrosphereInterpolator<a name="line.32"></a>
+<FONT color="green">033</FONT>        implements MultivariateRealInterpolator {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /**<a name="line.35"></a>
+<FONT color="green">036</FONT>         * Default number of surface elements that composes the microsphere.<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        public static final int DEFAULT_MICROSPHERE_ELEMENTS = 2000;<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /**<a name="line.40"></a>
+<FONT color="green">041</FONT>         * Default exponent used the weights calculation.<a name="line.41"></a>
+<FONT color="green">042</FONT>         */<a name="line.42"></a>
+<FONT color="green">043</FONT>        public static final int DEFAULT_BRIGHTNESS_EXPONENT = 2;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**<a name="line.45"></a>
+<FONT color="green">046</FONT>         * Number of surface elements of the microsphere.<a name="line.46"></a>
+<FONT color="green">047</FONT>         */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private int microsphereElements;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Exponent used in the power law that computes the weights of the<a name="line.51"></a>
+<FONT color="green">052</FONT>         * sample data.<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        private int brightnessExponent;<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** Create a microsphere interpolator with default settings.<a name="line.56"></a>
+<FONT color="green">057</FONT>         * &lt;p&gt;Calling this constructor is equivalent to call {@link<a name="line.57"></a>
+<FONT color="green">058</FONT>         * #MicrosphereInterpolator(int, int)<a name="line.58"></a>
+<FONT color="green">059</FONT>         * MicrosphereInterpolator(MicrosphereInterpolator.DEFAULT_MICROSPHERE_ELEMENTS,<a name="line.59"></a>
+<FONT color="green">060</FONT>         * MicrosphereInterpolator.DEFAULT_BRIGHTNESS_EXPONENT)}.&lt;/p&gt;<a name="line.60"></a>
+<FONT color="green">061</FONT>         * weights of the sample data<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        public MicrosphereInterpolator() {<a name="line.63"></a>
+<FONT color="green">064</FONT>            this(DEFAULT_MICROSPHERE_ELEMENTS, DEFAULT_BRIGHTNESS_EXPONENT);<a name="line.64"></a>
+<FONT color="green">065</FONT>        }<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /** Create a microsphere interpolator.<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param microsphereElements number of surface elements of the microsphere<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @param brightnessExponent exponent used in the power law that computes the<a name="line.69"></a>
+<FONT color="green">070</FONT>         * weights of the sample data<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @throws IllegalArgumentException if {@code microsphereElements &lt;= 0}<a name="line.71"></a>
+<FONT color="green">072</FONT>         * or {@code brightnessExponent &lt; 0}<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        public MicrosphereInterpolator(final int microsphereElements,<a name="line.74"></a>
+<FONT color="green">075</FONT>                                       final int brightnessExponent) {<a name="line.75"></a>
+<FONT color="green">076</FONT>            setMicropshereElements(microsphereElements);<a name="line.76"></a>
+<FONT color="green">077</FONT>            setBrightnessExponent(brightnessExponent);<a name="line.77"></a>
+<FONT color="green">078</FONT>        }<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /**<a name="line.80"></a>
+<FONT color="green">081</FONT>         * {@inheritDoc}<a name="line.81"></a>
+<FONT color="green">082</FONT>         */<a name="line.82"></a>
+<FONT color="green">083</FONT>        public MultivariateRealFunction interpolate(final double[][] xval,<a name="line.83"></a>
+<FONT color="green">084</FONT>                                                    final double[] yval)<a name="line.84"></a>
+<FONT color="green">085</FONT>            throws MathException, IllegalArgumentException {<a name="line.85"></a>
+<FONT color="green">086</FONT>            final UnitSphereRandomVectorGenerator rand<a name="line.86"></a>
+<FONT color="green">087</FONT>                = new UnitSphereRandomVectorGenerator(xval[0].length);<a name="line.87"></a>
+<FONT color="green">088</FONT>            return new MicrosphereInterpolatingFunction(xval, yval,<a name="line.88"></a>
+<FONT color="green">089</FONT>                                                        brightnessExponent,<a name="line.89"></a>
+<FONT color="green">090</FONT>                                                        microsphereElements,<a name="line.90"></a>
+<FONT color="green">091</FONT>                                                        rand);<a name="line.91"></a>
+<FONT color="green">092</FONT>        }<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>        /**<a name="line.94"></a>
+<FONT color="green">095</FONT>         * Set the brightness exponent.<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @param brightnessExponent Exponent for computing the distance dimming<a name="line.96"></a>
+<FONT color="green">097</FONT>         * factor.<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @throws IllegalArgumentException if {@code brightnessExponent &lt; 0}.<a name="line.98"></a>
+<FONT color="green">099</FONT>         */<a name="line.99"></a>
+<FONT color="green">100</FONT>        public void setBrightnessExponent(final int brightnessExponent) {<a name="line.100"></a>
+<FONT color="green">101</FONT>            if (brightnessExponent &lt; 0) {<a name="line.101"></a>
+<FONT color="green">102</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.102"></a>
+<FONT color="green">103</FONT>                    "brightness exponent should be positive or null, but got {0}",<a name="line.103"></a>
+<FONT color="green">104</FONT>                    brightnessExponent);<a name="line.104"></a>
+<FONT color="green">105</FONT>            }<a name="line.105"></a>
+<FONT color="green">106</FONT>            this.brightnessExponent = brightnessExponent;<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /**<a name="line.109"></a>
+<FONT color="green">110</FONT>         * Set the number of microsphere elements.<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @param elements Number of surface elements of the microsphere.<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @throws IllegalArgumentException if {@code microsphereElements &lt;= 0}.<a name="line.112"></a>
+<FONT color="green">113</FONT>         */<a name="line.113"></a>
+<FONT color="green">114</FONT>        public void setMicropshereElements(final int elements) {<a name="line.114"></a>
+<FONT color="green">115</FONT>            if (microsphereElements &lt; 0) {<a name="line.115"></a>
+<FONT color="green">116</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.116"></a>
+<FONT color="green">117</FONT>                    "number of microsphere elements must be positive, but got {0}",<a name="line.117"></a>
+<FONT color="green">118</FONT>                    microsphereElements);<a name="line.118"></a>
+<FONT color="green">119</FONT>            }<a name="line.119"></a>
+<FONT color="green">120</FONT>            this.microsphereElements = elements;<a name="line.120"></a>
+<FONT color="green">121</FONT>        }<a name="line.121"></a>
+<FONT color="green">122</FONT>    <a name="line.122"></a>
+<FONT color="green">123</FONT>    }<a name="line.123"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/MultivariateRealInterpolator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,112 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.interpolation;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.analysis.MultivariateRealFunction;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Interface representing a univariate real interpolating function.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @since 2.1<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 924794 $ $Date: 2010-03-18 10:15:50 -0400 (Thu, 18 Mar 2010) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public interface MultivariateRealInterpolator {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /**<a name="line.30"></a>
+<FONT color="green">031</FONT>         * Computes an interpolating function for the data set.<a name="line.31"></a>
+<FONT color="green">032</FONT>         *<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @param xval the arguments for the interpolation points.<a name="line.33"></a>
+<FONT color="green">034</FONT>         * {@code xval[i][0]} is the first component of interpolation point<a name="line.34"></a>
+<FONT color="green">035</FONT>         * {@code i}, {@code xval[i][1]} is the second component, and so on<a name="line.35"></a>
+<FONT color="green">036</FONT>         * until {@code xval[i][d-1]}, the last component of that interpolation<a name="line.36"></a>
+<FONT color="green">037</FONT>         * point (where {@code d} is thus the dimension of the space).<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @param yval the values for the interpolation points<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @return a function which interpolates the data set<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @throws MathException if arguments violate assumptions made by the<a name="line.40"></a>
+<FONT color="green">041</FONT>         *         interpolation algorithm or some dimension mismatch occurs<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @throws IllegalArgumentException if there are no data (xval null or zero length)<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        MultivariateRealFunction interpolate(double[][] xval, double[] yval)<a name="line.44"></a>
+<FONT color="green">045</FONT>            throws MathException, IllegalArgumentException;<a name="line.45"></a>
+<FONT color="green">046</FONT>    }<a name="line.46"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/NevilleInterpolator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,120 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.interpolation;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.analysis.polynomials.PolynomialFunctionLagrangeForm;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Implements the &lt;a href="http://mathworld.wolfram.com/NevillesAlgorithm.html"&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Neville's Algorithm&lt;/a&gt; for interpolation of real univariate functions. For<a name="line.26"></a>
+<FONT color="green">027</FONT>     * reference, see &lt;b&gt;Introduction to Numerical Analysis&lt;/b&gt;, ISBN 038795452X,<a name="line.27"></a>
+<FONT color="green">028</FONT>     * chapter 2.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * The actual code of Neville's evalution is in PolynomialFunctionLagrangeForm,<a name="line.30"></a>
+<FONT color="green">031</FONT>     * this class provides an easy-to-use interface to it.&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     *<a name="line.32"></a>
+<FONT color="green">033</FONT>     * @version $Revision: 799857 $ $Date: 2009-08-01 09:07:12 -0400 (Sat, 01 Aug 2009) $<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @since 1.2<a name="line.34"></a>
+<FONT color="green">035</FONT>     */<a name="line.35"></a>
+<FONT color="green">036</FONT>    public class NevilleInterpolator implements UnivariateRealInterpolator,<a name="line.36"></a>
+<FONT color="green">037</FONT>        Serializable {<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** serializable version identifier */<a name="line.39"></a>
+<FONT color="green">040</FONT>        static final long serialVersionUID = 3003707660147873733L;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /**<a name="line.42"></a>
+<FONT color="green">043</FONT>         * Computes an interpolating function for the data set.<a name="line.43"></a>
+<FONT color="green">044</FONT>         *<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @param x the interpolating points array<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param y the interpolating values array<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @return a function which interpolates the data set<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @throws MathException if arguments are invalid<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        public PolynomialFunctionLagrangeForm interpolate(double x[], double y[])<a name="line.50"></a>
+<FONT color="green">051</FONT>            throws MathException {<a name="line.51"></a>
+<FONT color="green">052</FONT>            return new PolynomialFunctionLagrangeForm(x, y);<a name="line.52"></a>
+<FONT color="green">053</FONT>        }<a name="line.53"></a>
+<FONT color="green">054</FONT>    }<a name="line.54"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/SmoothingBicubicSplineInterpolator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,236 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.interpolation;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.DimensionMismatchException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.analysis.BivariateRealFunction;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    /**<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Generates a bicubic interpolation function.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * Before interpolating, smoothing of the input data is performed using<a name="line.29"></a>
+<FONT color="green">030</FONT>     * splines.<a name="line.30"></a>
+<FONT color="green">031</FONT>     * See &lt;b&gt;Handbook on splines for the user&lt;/b&gt;, ISBN 084939404X,<a name="line.31"></a>
+<FONT color="green">032</FONT>     * chapter 2.<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @version $Revision$ $Date$<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @since 2.1<a name="line.35"></a>
+<FONT color="green">036</FONT>     */<a name="line.36"></a>
+<FONT color="green">037</FONT>    public class SmoothingBicubicSplineInterpolator<a name="line.37"></a>
+<FONT color="green">038</FONT>        implements BivariateRealGridInterpolator {<a name="line.38"></a>
+<FONT color="green">039</FONT>        /**<a name="line.39"></a>
+<FONT color="green">040</FONT>         * {@inheritDoc}<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        public BivariateRealFunction interpolate(final double[] xval,<a name="line.42"></a>
+<FONT color="green">043</FONT>                                                 final double[] yval,<a name="line.43"></a>
+<FONT color="green">044</FONT>                                                 final double[][] zval)<a name="line.44"></a>
+<FONT color="green">045</FONT>            throws MathException, IllegalArgumentException {<a name="line.45"></a>
+<FONT color="green">046</FONT>            if (xval.length == 0 || yval.length == 0 || zval.length == 0) {<a name="line.46"></a>
+<FONT color="green">047</FONT>                throw MathRuntimeException.createIllegalArgumentException("no data");<a name="line.47"></a>
+<FONT color="green">048</FONT>            }<a name="line.48"></a>
+<FONT color="green">049</FONT>            if (xval.length != zval.length) {<a name="line.49"></a>
+<FONT color="green">050</FONT>                throw new DimensionMismatchException(xval.length, zval.length);<a name="line.50"></a>
+<FONT color="green">051</FONT>            }<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>            MathUtils.checkOrder(xval, 1, true);<a name="line.53"></a>
+<FONT color="green">054</FONT>            MathUtils.checkOrder(yval, 1, true);<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>            final int xLen = xval.length;<a name="line.56"></a>
+<FONT color="green">057</FONT>            final int yLen = yval.length;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>            // Samples (first index is y-coordinate, i.e. subarray variable is x)<a name="line.59"></a>
+<FONT color="green">060</FONT>            // 0 &lt;= i &lt; xval.length<a name="line.60"></a>
+<FONT color="green">061</FONT>            // 0 &lt;= j &lt; yval.length<a name="line.61"></a>
+<FONT color="green">062</FONT>            // zX[j][i] = f(xval[i], yval[j])<a name="line.62"></a>
+<FONT color="green">063</FONT>            final double[][] zX = new double[yLen][xLen];<a name="line.63"></a>
+<FONT color="green">064</FONT>            for (int i = 0; i &lt; xLen; i++) {<a name="line.64"></a>
+<FONT color="green">065</FONT>                if (zval[i].length != yLen) {<a name="line.65"></a>
+<FONT color="green">066</FONT>                    throw new DimensionMismatchException(zval[i].length, yLen);<a name="line.66"></a>
+<FONT color="green">067</FONT>                }<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>                for (int j = 0; j &lt; yLen; j++) {<a name="line.69"></a>
+<FONT color="green">070</FONT>                    zX[j][i] = zval[i][j];<a name="line.70"></a>
+<FONT color="green">071</FONT>                }<a name="line.71"></a>
+<FONT color="green">072</FONT>            }<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>            final SplineInterpolator spInterpolator = new SplineInterpolator();<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>            // For each line y[j] (0 &lt;= j &lt; yLen), construct a 1D spline with<a name="line.76"></a>
+<FONT color="green">077</FONT>            // respect to variable x<a name="line.77"></a>
+<FONT color="green">078</FONT>            final PolynomialSplineFunction[] ySplineX = new PolynomialSplineFunction[yLen];<a name="line.78"></a>
+<FONT color="green">079</FONT>            for (int j = 0; j &lt; yLen; j++) {<a name="line.79"></a>
+<FONT color="green">080</FONT>                ySplineX[j] = spInterpolator.interpolate(xval, zX[j]);<a name="line.80"></a>
+<FONT color="green">081</FONT>            }<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>            // For every knot (xval[i], yval[j]) of the grid, calculate corrected<a name="line.83"></a>
+<FONT color="green">084</FONT>            // values zY_1<a name="line.84"></a>
+<FONT color="green">085</FONT>            final double[][] zY_1 = new double[xLen][yLen];<a name="line.85"></a>
+<FONT color="green">086</FONT>            for (int j = 0; j &lt; yLen; j++) {<a name="line.86"></a>
+<FONT color="green">087</FONT>                final PolynomialSplineFunction f = ySplineX[j];<a name="line.87"></a>
+<FONT color="green">088</FONT>                for (int i = 0; i &lt; xLen; i++) {<a name="line.88"></a>
+<FONT color="green">089</FONT>                    zY_1[i][j] = f.value(xval[i]);<a name="line.89"></a>
+<FONT color="green">090</FONT>                }<a name="line.90"></a>
+<FONT color="green">091</FONT>            }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>            // For each line x[i] (0 &lt;= i &lt; xLen), construct a 1D spline with<a name="line.93"></a>
+<FONT color="green">094</FONT>            // respect to variable y generated by array zY_1[i]<a name="line.94"></a>
+<FONT color="green">095</FONT>            final PolynomialSplineFunction[] xSplineY = new PolynomialSplineFunction[xLen];<a name="line.95"></a>
+<FONT color="green">096</FONT>            for (int i = 0; i &lt; xLen; i++) {<a name="line.96"></a>
+<FONT color="green">097</FONT>                xSplineY[i] = spInterpolator.interpolate(yval, zY_1[i]);<a name="line.97"></a>
+<FONT color="green">098</FONT>            }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>            // For every knot (xval[i], yval[j]) of the grid, calculate corrected<a name="line.100"></a>
+<FONT color="green">101</FONT>            // values zY_2<a name="line.101"></a>
+<FONT color="green">102</FONT>            final double[][] zY_2 = new double[xLen][yLen];<a name="line.102"></a>
+<FONT color="green">103</FONT>            for (int i = 0; i &lt; xLen; i++) {<a name="line.103"></a>
+<FONT color="green">104</FONT>                final PolynomialSplineFunction f = xSplineY[i];<a name="line.104"></a>
+<FONT color="green">105</FONT>                for (int j = 0; j &lt; yLen; j++) {<a name="line.105"></a>
+<FONT color="green">106</FONT>                    zY_2[i][j] = f.value(yval[j]);<a name="line.106"></a>
+<FONT color="green">107</FONT>                }<a name="line.107"></a>
+<FONT color="green">108</FONT>            }<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>            // Partial derivatives with respect to x at the grid knots<a name="line.110"></a>
+<FONT color="green">111</FONT>            final double[][] dZdX = new double[xLen][yLen];<a name="line.111"></a>
+<FONT color="green">112</FONT>            for (int j = 0; j &lt; yLen; j++) {<a name="line.112"></a>
+<FONT color="green">113</FONT>                final UnivariateRealFunction f = ySplineX[j].derivative();<a name="line.113"></a>
+<FONT color="green">114</FONT>                for (int i = 0; i &lt; xLen; i++) {<a name="line.114"></a>
+<FONT color="green">115</FONT>                    dZdX[i][j] = f.value(xval[i]);<a name="line.115"></a>
+<FONT color="green">116</FONT>                }<a name="line.116"></a>
+<FONT color="green">117</FONT>            }<a name="line.117"></a>
+<FONT color="green">118</FONT>    <a name="line.118"></a>
+<FONT color="green">119</FONT>            // Partial derivatives with respect to y at the grid knots<a name="line.119"></a>
+<FONT color="green">120</FONT>            final double[][] dZdY = new double[xLen][yLen];<a name="line.120"></a>
+<FONT color="green">121</FONT>            for (int i = 0; i &lt; xLen; i++) {<a name="line.121"></a>
+<FONT color="green">122</FONT>                final UnivariateRealFunction f = xSplineY[i].derivative();<a name="line.122"></a>
+<FONT color="green">123</FONT>                for (int j = 0; j &lt; yLen; j++) {<a name="line.123"></a>
+<FONT color="green">124</FONT>                    dZdY[i][j] = f.value(yval[j]);<a name="line.124"></a>
+<FONT color="green">125</FONT>                }<a name="line.125"></a>
+<FONT color="green">126</FONT>            }<a name="line.126"></a>
+<FONT color="green">127</FONT>    <a name="line.127"></a>
+<FONT color="green">128</FONT>            // Cross partial derivatives<a name="line.128"></a>
+<FONT color="green">129</FONT>            final double[][] dZdXdY = new double[xLen][yLen];<a name="line.129"></a>
+<FONT color="green">130</FONT>            for (int i = 0; i &lt; xLen ; i++) {<a name="line.130"></a>
+<FONT color="green">131</FONT>                final int nI = nextIndex(i, xLen);<a name="line.131"></a>
+<FONT color="green">132</FONT>                final int pI = previousIndex(i);<a name="line.132"></a>
+<FONT color="green">133</FONT>                for (int j = 0; j &lt; yLen; j++) {<a name="line.133"></a>
+<FONT color="green">134</FONT>                    final int nJ = nextIndex(j, yLen);<a name="line.134"></a>
+<FONT color="green">135</FONT>                    final int pJ = previousIndex(j);<a name="line.135"></a>
+<FONT color="green">136</FONT>                    dZdXdY[i][j] =  (zY_2[nI][nJ] - zY_2[nI][pJ] -<a name="line.136"></a>
+<FONT color="green">137</FONT>                                     zY_2[pI][nJ] + zY_2[pI][pJ]) /<a name="line.137"></a>
+<FONT color="green">138</FONT>                        ((xval[nI] - xval[pI]) * (yval[nJ] - yval[pJ])) ;<a name="line.138"></a>
+<FONT color="green">139</FONT>                }<a name="line.139"></a>
+<FONT color="green">140</FONT>            }<a name="line.140"></a>
+<FONT color="green">141</FONT>    <a name="line.141"></a>
+<FONT color="green">142</FONT>            // Create the interpolating splines<a name="line.142"></a>
+<FONT color="green">143</FONT>            return new BicubicSplineInterpolatingFunction(xval, yval, zY_2,<a name="line.143"></a>
+<FONT color="green">144</FONT>                                                          dZdX, dZdY, dZdXdY);<a name="line.144"></a>
+<FONT color="green">145</FONT>        }<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>        /**<a name="line.147"></a>
+<FONT color="green">148</FONT>         * Compute the next index of an array, clipping if necessary.<a name="line.148"></a>
+<FONT color="green">149</FONT>         * It is assumed (but not checked) that {@code i} is larger than or equal to 0}.<a name="line.149"></a>
+<FONT color="green">150</FONT>         *<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @param i Index<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @param max Upper limit of the array<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @return the next index<a name="line.153"></a>
+<FONT color="green">154</FONT>         */<a name="line.154"></a>
+<FONT color="green">155</FONT>        private int nextIndex(int i, int max) {<a name="line.155"></a>
+<FONT color="green">156</FONT>            final int index = i + 1;<a name="line.156"></a>
+<FONT color="green">157</FONT>            return index &lt; max ? index : index - 1;<a name="line.157"></a>
+<FONT color="green">158</FONT>        }<a name="line.158"></a>
+<FONT color="green">159</FONT>        /**<a name="line.159"></a>
+<FONT color="green">160</FONT>         * Compute the previous index of an array, clipping if necessary.<a name="line.160"></a>
+<FONT color="green">161</FONT>         * It is assumed (but not checked) that {@code i} is smaller than the size of the array.<a name="line.161"></a>
+<FONT color="green">162</FONT>         *<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @param i Index<a name="line.163"></a>
+<FONT color="green">164</FONT>         * @return the previous index<a name="line.164"></a>
+<FONT color="green">165</FONT>         */<a name="line.165"></a>
+<FONT color="green">166</FONT>        private int previousIndex(int i) {<a name="line.166"></a>
+<FONT color="green">167</FONT>            final int index = i - 1;<a name="line.167"></a>
+<FONT color="green">168</FONT>            return index &gt;= 0 ? index : 0;<a name="line.168"></a>
+<FONT color="green">169</FONT>        }<a name="line.169"></a>
+<FONT color="green">170</FONT>    }<a name="line.170"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/SplineInterpolator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,191 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.interpolation;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.analysis.polynomials.PolynomialFunction;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Computes a natural (also known as "free", "unclamped") cubic spline interpolation for the data set.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * The {@link #interpolate(double[], double[])} method returns a {@link PolynomialSplineFunction}<a name="line.26"></a>
+<FONT color="green">027</FONT>     * consisting of n cubic polynomials, defined over the subintervals determined by the x values,<a name="line.27"></a>
+<FONT color="green">028</FONT>     * x[0] &lt; x[i] ... &lt; x[n].  The x values are referred to as "knot points."&lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * The value of the PolynomialSplineFunction at a point x that is greater than or equal to the smallest<a name="line.30"></a>
+<FONT color="green">031</FONT>     * knot point and strictly less than the largest knot point is computed by finding the subinterval to which<a name="line.31"></a>
+<FONT color="green">032</FONT>     * x belongs and computing the value of the corresponding polynomial at &lt;code&gt;x - x[i] &lt;/code&gt; where<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;code&gt;i&lt;/code&gt; is the index of the subinterval.  See {@link PolynomialSplineFunction} for more details.<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;/p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * The interpolating polynomials satisfy: &lt;ol&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;li&gt;The value of the PolynomialSplineFunction at each of the input x values equals the<a name="line.37"></a>
+<FONT color="green">038</FONT>     *  corresponding y value.&lt;/li&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;li&gt;Adjacent polynomials are equal through two derivatives at the knot points (i.e., adjacent polynomials<a name="line.39"></a>
+<FONT color="green">040</FONT>     *  "match up" at the knot points, as do their first and second derivatives).&lt;/li&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;/ol&gt;&lt;/p&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;p&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     * The cubic spline interpolation algorithm implemented is as described in R.L. Burden, J.D. Faires,<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;u&gt;Numerical Analysis&lt;/u&gt;, 4th Ed., 1989, PWS-Kent, ISBN 0-53491-585-X, pp 126-131.<a name="line.44"></a>
+<FONT color="green">045</FONT>     * &lt;/p&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     *<a name="line.46"></a>
+<FONT color="green">047</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.47"></a>
+<FONT color="green">048</FONT>     *<a name="line.48"></a>
+<FONT color="green">049</FONT>     */<a name="line.49"></a>
+<FONT color="green">050</FONT>    public class SplineInterpolator implements UnivariateRealInterpolator {<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * Computes an interpolating function for the data set.<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @param x the arguments for the interpolation points<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param y the values for the interpolation points<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @return a function which interpolates the data set<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        public PolynomialSplineFunction interpolate(double x[], double y[]) {<a name="line.58"></a>
+<FONT color="green">059</FONT>            if (x.length != y.length) {<a name="line.59"></a>
+<FONT color="green">060</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.60"></a>
+<FONT color="green">061</FONT>                      "dimension mismatch {0} != {1}", x.length, y.length);<a name="line.61"></a>
+<FONT color="green">062</FONT>            }<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>            if (x.length &lt; 3) {<a name="line.64"></a>
+<FONT color="green">065</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.65"></a>
+<FONT color="green">066</FONT>                      "{0} points are required, got only {1}", 3, x.length);<a name="line.66"></a>
+<FONT color="green">067</FONT>            }<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>            // Number of intervals.  The number of data points is n + 1.<a name="line.69"></a>
+<FONT color="green">070</FONT>            int n = x.length - 1;<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.72"></a>
+<FONT color="green">073</FONT>                if (x[i]  &gt;= x[i + 1]) {<a name="line.73"></a>
+<FONT color="green">074</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.74"></a>
+<FONT color="green">075</FONT>                          "points {0} and {1} are not strictly increasing ({2} &gt;= {3})",<a name="line.75"></a>
+<FONT color="green">076</FONT>                          i, i+1, x[i], x[i+1]);<a name="line.76"></a>
+<FONT color="green">077</FONT>                }<a name="line.77"></a>
+<FONT color="green">078</FONT>            }<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>            // Differences between knot points<a name="line.80"></a>
+<FONT color="green">081</FONT>            double h[] = new double[n];<a name="line.81"></a>
+<FONT color="green">082</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.82"></a>
+<FONT color="green">083</FONT>                h[i] = x[i + 1] - x[i];<a name="line.83"></a>
+<FONT color="green">084</FONT>            }<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>            double mu[] = new double[n];<a name="line.86"></a>
+<FONT color="green">087</FONT>            double z[] = new double[n + 1];<a name="line.87"></a>
+<FONT color="green">088</FONT>            mu[0] = 0d;<a name="line.88"></a>
+<FONT color="green">089</FONT>            z[0] = 0d;<a name="line.89"></a>
+<FONT color="green">090</FONT>            double g = 0;<a name="line.90"></a>
+<FONT color="green">091</FONT>            for (int i = 1; i &lt; n; i++) {<a name="line.91"></a>
+<FONT color="green">092</FONT>                g = 2d * (x[i+1]  - x[i - 1]) - h[i - 1] * mu[i -1];<a name="line.92"></a>
+<FONT color="green">093</FONT>                mu[i] = h[i] / g;<a name="line.93"></a>
+<FONT color="green">094</FONT>                z[i] = (3d * (y[i + 1] * h[i - 1] - y[i] * (x[i + 1] - x[i - 1])+ y[i - 1] * h[i]) /<a name="line.94"></a>
+<FONT color="green">095</FONT>                        (h[i - 1] * h[i]) - h[i - 1] * z[i - 1]) / g;<a name="line.95"></a>
+<FONT color="green">096</FONT>            }<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>            // cubic spline coefficients --  b is linear, c quadratic, d is cubic (original y's are constants)<a name="line.98"></a>
+<FONT color="green">099</FONT>            double b[] = new double[n];<a name="line.99"></a>
+<FONT color="green">100</FONT>            double c[] = new double[n + 1];<a name="line.100"></a>
+<FONT color="green">101</FONT>            double d[] = new double[n];<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>            z[n] = 0d;<a name="line.103"></a>
+<FONT color="green">104</FONT>            c[n] = 0d;<a name="line.104"></a>
+<FONT color="green">105</FONT>    <a name="line.105"></a>
+<FONT color="green">106</FONT>            for (int j = n -1; j &gt;=0; j--) {<a name="line.106"></a>
+<FONT color="green">107</FONT>                c[j] = z[j] - mu[j] * c[j + 1];<a name="line.107"></a>
+<FONT color="green">108</FONT>                b[j] = (y[j + 1] - y[j]) / h[j] - h[j] * (c[j + 1] + 2d * c[j]) / 3d;<a name="line.108"></a>
+<FONT color="green">109</FONT>                d[j] = (c[j + 1] - c[j]) / (3d * h[j]);<a name="line.109"></a>
+<FONT color="green">110</FONT>            }<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>            PolynomialFunction polynomials[] = new PolynomialFunction[n];<a name="line.112"></a>
+<FONT color="green">113</FONT>            double coefficients[] = new double[4];<a name="line.113"></a>
+<FONT color="green">114</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.114"></a>
+<FONT color="green">115</FONT>                coefficients[0] = y[i];<a name="line.115"></a>
+<FONT color="green">116</FONT>                coefficients[1] = b[i];<a name="line.116"></a>
+<FONT color="green">117</FONT>                coefficients[2] = c[i];<a name="line.117"></a>
+<FONT color="green">118</FONT>                coefficients[3] = d[i];<a name="line.118"></a>
+<FONT color="green">119</FONT>                polynomials[i] = new PolynomialFunction(coefficients);<a name="line.119"></a>
+<FONT color="green">120</FONT>            }<a name="line.120"></a>
+<FONT color="green">121</FONT>    <a name="line.121"></a>
+<FONT color="green">122</FONT>            return new PolynomialSplineFunction(x, polynomials);<a name="line.122"></a>
+<FONT color="green">123</FONT>        }<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>    }<a name="line.125"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/interpolation/UnivariateRealInterpolator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,105 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.interpolation;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Interface representing a univariate real interpolating function.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 821626 $ $Date: 2009-10-04 17:57:30 -0400 (Sun, 04 Oct 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public interface UnivariateRealInterpolator {<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>        /**<a name="line.29"></a>
+<FONT color="green">030</FONT>         * Computes an interpolating function for the data set.<a name="line.30"></a>
+<FONT color="green">031</FONT>         * @param xval the arguments for the interpolation points<a name="line.31"></a>
+<FONT color="green">032</FONT>         * @param yval the values for the interpolation points<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @return a function which interpolates the data set<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @throws MathException if arguments violate assumptions made by the<a name="line.34"></a>
+<FONT color="green">035</FONT>         *         interpolation algorithm<a name="line.35"></a>
+<FONT color="green">036</FONT>         */<a name="line.36"></a>
+<FONT color="green">037</FONT>        UnivariateRealFunction interpolate(double xval[], double yval[])<a name="line.37"></a>
+<FONT color="green">038</FONT>            throws MathException;<a name="line.38"></a>
+<FONT color="green">039</FONT>    }<a name="line.39"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/polynomials/PolynomialFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,418 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.polynomials;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.analysis.DifferentiableUnivariateRealFunction;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Immutable representation of a real polynomial function with real coefficients.<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;a href="http://mathworld.wolfram.com/HornersMethod.html"&gt;Horner's Method&lt;/a&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     *  is used to evaluate the function.&lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     *<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @version $Revision: 922714 $ $Date: 2010-03-13 20:35:14 -0500 (Sat, 13 Mar 2010) $<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public class PolynomialFunction implements DifferentiableUnivariateRealFunction, Serializable {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Message for empty coefficients array. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private static final String EMPTY_ARRAY_MESSAGE =<a name="line.37"></a>
+<FONT color="green">038</FONT>            "empty polynomials coefficients array";<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /**<a name="line.40"></a>
+<FONT color="green">041</FONT>         * Serialization identifier<a name="line.41"></a>
+<FONT color="green">042</FONT>         */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private static final long serialVersionUID = -7726511984200295583L;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**<a name="line.45"></a>
+<FONT color="green">046</FONT>         * The coefficients of the polynomial, ordered by degree -- i.e.,<a name="line.46"></a>
+<FONT color="green">047</FONT>         * coefficients[0] is the constant term and coefficients[n] is the<a name="line.47"></a>
+<FONT color="green">048</FONT>         * coefficient of x^n where n is the degree of the polynomial.<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        private final double coefficients[];<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * Construct a polynomial with the given coefficients.  The first element<a name="line.53"></a>
+<FONT color="green">054</FONT>         * of the coefficients array is the constant term.  Higher degree<a name="line.54"></a>
+<FONT color="green">055</FONT>         * coefficients follow in sequence.  The degree of the resulting polynomial<a name="line.55"></a>
+<FONT color="green">056</FONT>         * is the index of the last non-null element of the array, or 0 if all elements<a name="line.56"></a>
+<FONT color="green">057</FONT>         * are null.<a name="line.57"></a>
+<FONT color="green">058</FONT>         * &lt;p&gt;<a name="line.58"></a>
+<FONT color="green">059</FONT>         * The constructor makes a copy of the input array and assigns the copy to<a name="line.59"></a>
+<FONT color="green">060</FONT>         * the coefficients property.&lt;/p&gt;<a name="line.60"></a>
+<FONT color="green">061</FONT>         *<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param c polynomial coefficients<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @throws NullPointerException if c is null<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @throws IllegalArgumentException if c is empty<a name="line.64"></a>
+<FONT color="green">065</FONT>         */<a name="line.65"></a>
+<FONT color="green">066</FONT>        public PolynomialFunction(double c[]) {<a name="line.66"></a>
+<FONT color="green">067</FONT>            super();<a name="line.67"></a>
+<FONT color="green">068</FONT>            if (c.length &lt; 1) {<a name="line.68"></a>
+<FONT color="green">069</FONT>                throw MathRuntimeException.createIllegalArgumentException(EMPTY_ARRAY_MESSAGE);<a name="line.69"></a>
+<FONT color="green">070</FONT>            }<a name="line.70"></a>
+<FONT color="green">071</FONT>            int l = c.length;<a name="line.71"></a>
+<FONT color="green">072</FONT>            while ((l &gt; 1) &amp;&amp; (c[l - 1] == 0)) {<a name="line.72"></a>
+<FONT color="green">073</FONT>                --l;<a name="line.73"></a>
+<FONT color="green">074</FONT>            }<a name="line.74"></a>
+<FONT color="green">075</FONT>            this.coefficients = new double[l];<a name="line.75"></a>
+<FONT color="green">076</FONT>            System.arraycopy(c, 0, this.coefficients, 0, l);<a name="line.76"></a>
+<FONT color="green">077</FONT>        }<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        /**<a name="line.79"></a>
+<FONT color="green">080</FONT>         * Compute the value of the function for the given argument.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * &lt;p&gt;<a name="line.81"></a>
+<FONT color="green">082</FONT>         *  The value returned is &lt;br&gt;<a name="line.82"></a>
+<FONT color="green">083</FONT>         *   &lt;code&gt;coefficients[n] * x^n + ... + coefficients[1] * x  + coefficients[0]&lt;/code&gt;<a name="line.83"></a>
+<FONT color="green">084</FONT>         * &lt;/p&gt;<a name="line.84"></a>
+<FONT color="green">085</FONT>         *<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @param x the argument for which the function value should be computed<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @return the value of the polynomial at the given point<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @see UnivariateRealFunction#value(double)<a name="line.88"></a>
+<FONT color="green">089</FONT>         */<a name="line.89"></a>
+<FONT color="green">090</FONT>        public double value(double x) {<a name="line.90"></a>
+<FONT color="green">091</FONT>           return evaluate(coefficients, x);<a name="line.91"></a>
+<FONT color="green">092</FONT>        }<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /**<a name="line.95"></a>
+<FONT color="green">096</FONT>         *  Returns the degree of the polynomial<a name="line.96"></a>
+<FONT color="green">097</FONT>         *<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @return the degree of the polynomial<a name="line.98"></a>
+<FONT color="green">099</FONT>         */<a name="line.99"></a>
+<FONT color="green">100</FONT>        public int degree() {<a name="line.100"></a>
+<FONT color="green">101</FONT>            return coefficients.length - 1;<a name="line.101"></a>
+<FONT color="green">102</FONT>        }<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /**<a name="line.104"></a>
+<FONT color="green">105</FONT>         * Returns a copy of the coefficients array.<a name="line.105"></a>
+<FONT color="green">106</FONT>         * &lt;p&gt;<a name="line.106"></a>
+<FONT color="green">107</FONT>         * Changes made to the returned copy will not affect the coefficients of<a name="line.107"></a>
+<FONT color="green">108</FONT>         * the polynomial.&lt;/p&gt;<a name="line.108"></a>
+<FONT color="green">109</FONT>         *<a name="line.109"></a>
+<FONT color="green">110</FONT>         * @return  a fresh copy of the coefficients array<a name="line.110"></a>
+<FONT color="green">111</FONT>         */<a name="line.111"></a>
+<FONT color="green">112</FONT>        public double[] getCoefficients() {<a name="line.112"></a>
+<FONT color="green">113</FONT>            return coefficients.clone();<a name="line.113"></a>
+<FONT color="green">114</FONT>        }<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>        /**<a name="line.116"></a>
+<FONT color="green">117</FONT>         * Uses Horner's Method to evaluate the polynomial with the given coefficients at<a name="line.117"></a>
+<FONT color="green">118</FONT>         * the argument.<a name="line.118"></a>
+<FONT color="green">119</FONT>         *<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @param coefficients  the coefficients of the polynomial to evaluate<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @param argument  the input value<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @return  the value of the polynomial<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @throws IllegalArgumentException if coefficients is empty<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @throws NullPointerException if coefficients is null<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        protected static double evaluate(double[] coefficients, double argument) {<a name="line.126"></a>
+<FONT color="green">127</FONT>            int n = coefficients.length;<a name="line.127"></a>
+<FONT color="green">128</FONT>            if (n &lt; 1) {<a name="line.128"></a>
+<FONT color="green">129</FONT>                throw MathRuntimeException.createIllegalArgumentException(EMPTY_ARRAY_MESSAGE);<a name="line.129"></a>
+<FONT color="green">130</FONT>            }<a name="line.130"></a>
+<FONT color="green">131</FONT>            double result = coefficients[n - 1];<a name="line.131"></a>
+<FONT color="green">132</FONT>            for (int j = n -2; j &gt;=0; j--) {<a name="line.132"></a>
+<FONT color="green">133</FONT>                result = argument * result + coefficients[j];<a name="line.133"></a>
+<FONT color="green">134</FONT>            }<a name="line.134"></a>
+<FONT color="green">135</FONT>            return result;<a name="line.135"></a>
+<FONT color="green">136</FONT>        }<a name="line.136"></a>
+<FONT color="green">137</FONT>    <a name="line.137"></a>
+<FONT color="green">138</FONT>        /**<a name="line.138"></a>
+<FONT color="green">139</FONT>         * Add a polynomial to the instance.<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @param p polynomial to add<a name="line.140"></a>
+<FONT color="green">141</FONT>         * @return a new polynomial which is the sum of the instance and p<a name="line.141"></a>
+<FONT color="green">142</FONT>         */<a name="line.142"></a>
+<FONT color="green">143</FONT>        public PolynomialFunction add(final PolynomialFunction p) {<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>            // identify the lowest degree polynomial<a name="line.145"></a>
+<FONT color="green">146</FONT>            final int lowLength  = Math.min(coefficients.length, p.coefficients.length);<a name="line.146"></a>
+<FONT color="green">147</FONT>            final int highLength = Math.max(coefficients.length, p.coefficients.length);<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>            // build the coefficients array<a name="line.149"></a>
+<FONT color="green">150</FONT>            double[] newCoefficients = new double[highLength];<a name="line.150"></a>
+<FONT color="green">151</FONT>            for (int i = 0; i &lt; lowLength; ++i) {<a name="line.151"></a>
+<FONT color="green">152</FONT>                newCoefficients[i] = coefficients[i] + p.coefficients[i];<a name="line.152"></a>
+<FONT color="green">153</FONT>            }<a name="line.153"></a>
+<FONT color="green">154</FONT>            System.arraycopy((coefficients.length &lt; p.coefficients.length) ?<a name="line.154"></a>
+<FONT color="green">155</FONT>                             p.coefficients : coefficients,<a name="line.155"></a>
+<FONT color="green">156</FONT>                             lowLength,<a name="line.156"></a>
+<FONT color="green">157</FONT>                             newCoefficients, lowLength,<a name="line.157"></a>
+<FONT color="green">158</FONT>                             highLength - lowLength);<a name="line.158"></a>
+<FONT color="green">159</FONT>    <a name="line.159"></a>
+<FONT color="green">160</FONT>            return new PolynomialFunction(newCoefficients);<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>        }<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>        /**<a name="line.164"></a>
+<FONT color="green">165</FONT>         * Subtract a polynomial from the instance.<a name="line.165"></a>
+<FONT color="green">166</FONT>         * @param p polynomial to subtract<a name="line.166"></a>
+<FONT color="green">167</FONT>         * @return a new polynomial which is the difference the instance minus p<a name="line.167"></a>
+<FONT color="green">168</FONT>         */<a name="line.168"></a>
+<FONT color="green">169</FONT>        public PolynomialFunction subtract(final PolynomialFunction p) {<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>            // identify the lowest degree polynomial<a name="line.171"></a>
+<FONT color="green">172</FONT>            int lowLength  = Math.min(coefficients.length, p.coefficients.length);<a name="line.172"></a>
+<FONT color="green">173</FONT>            int highLength = Math.max(coefficients.length, p.coefficients.length);<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>            // build the coefficients array<a name="line.175"></a>
+<FONT color="green">176</FONT>            double[] newCoefficients = new double[highLength];<a name="line.176"></a>
+<FONT color="green">177</FONT>            for (int i = 0; i &lt; lowLength; ++i) {<a name="line.177"></a>
+<FONT color="green">178</FONT>                newCoefficients[i] = coefficients[i] - p.coefficients[i];<a name="line.178"></a>
+<FONT color="green">179</FONT>            }<a name="line.179"></a>
+<FONT color="green">180</FONT>            if (coefficients.length &lt; p.coefficients.length) {<a name="line.180"></a>
+<FONT color="green">181</FONT>                for (int i = lowLength; i &lt; highLength; ++i) {<a name="line.181"></a>
+<FONT color="green">182</FONT>                    newCoefficients[i] = -p.coefficients[i];<a name="line.182"></a>
+<FONT color="green">183</FONT>                }<a name="line.183"></a>
+<FONT color="green">184</FONT>            } else {<a name="line.184"></a>
+<FONT color="green">185</FONT>                System.arraycopy(coefficients, lowLength, newCoefficients, lowLength,<a name="line.185"></a>
+<FONT color="green">186</FONT>                                 highLength - lowLength);<a name="line.186"></a>
+<FONT color="green">187</FONT>            }<a name="line.187"></a>
+<FONT color="green">188</FONT>    <a name="line.188"></a>
+<FONT color="green">189</FONT>            return new PolynomialFunction(newCoefficients);<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>        }<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>        /**<a name="line.193"></a>
+<FONT color="green">194</FONT>         * Negate the instance.<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @return a new polynomial<a name="line.195"></a>
+<FONT color="green">196</FONT>         */<a name="line.196"></a>
+<FONT color="green">197</FONT>        public PolynomialFunction negate() {<a name="line.197"></a>
+<FONT color="green">198</FONT>            double[] newCoefficients = new double[coefficients.length];<a name="line.198"></a>
+<FONT color="green">199</FONT>            for (int i = 0; i &lt; coefficients.length; ++i) {<a name="line.199"></a>
+<FONT color="green">200</FONT>                newCoefficients[i] = -coefficients[i];<a name="line.200"></a>
+<FONT color="green">201</FONT>            }<a name="line.201"></a>
+<FONT color="green">202</FONT>            return new PolynomialFunction(newCoefficients);<a name="line.202"></a>
+<FONT color="green">203</FONT>        }<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>        /**<a name="line.205"></a>
+<FONT color="green">206</FONT>         * Multiply the instance by a polynomial.<a name="line.206"></a>
+<FONT color="green">207</FONT>         * @param p polynomial to multiply by<a name="line.207"></a>
+<FONT color="green">208</FONT>         * @return a new polynomial<a name="line.208"></a>
+<FONT color="green">209</FONT>         */<a name="line.209"></a>
+<FONT color="green">210</FONT>        public PolynomialFunction multiply(final PolynomialFunction p) {<a name="line.210"></a>
+<FONT color="green">211</FONT>    <a name="line.211"></a>
+<FONT color="green">212</FONT>            double[] newCoefficients = new double[coefficients.length + p.coefficients.length - 1];<a name="line.212"></a>
+<FONT color="green">213</FONT>    <a name="line.213"></a>
+<FONT color="green">214</FONT>            for (int i = 0; i &lt; newCoefficients.length; ++i) {<a name="line.214"></a>
+<FONT color="green">215</FONT>                newCoefficients[i] = 0.0;<a name="line.215"></a>
+<FONT color="green">216</FONT>                for (int j = Math.max(0, i + 1 - p.coefficients.length);<a name="line.216"></a>
+<FONT color="green">217</FONT>                     j &lt; Math.min(coefficients.length, i + 1);<a name="line.217"></a>
+<FONT color="green">218</FONT>                     ++j) {<a name="line.218"></a>
+<FONT color="green">219</FONT>                    newCoefficients[i] += coefficients[j] * p.coefficients[i-j];<a name="line.219"></a>
+<FONT color="green">220</FONT>                }<a name="line.220"></a>
+<FONT color="green">221</FONT>            }<a name="line.221"></a>
+<FONT color="green">222</FONT>    <a name="line.222"></a>
+<FONT color="green">223</FONT>            return new PolynomialFunction(newCoefficients);<a name="line.223"></a>
+<FONT color="green">224</FONT>    <a name="line.224"></a>
+<FONT color="green">225</FONT>        }<a name="line.225"></a>
+<FONT color="green">226</FONT>    <a name="line.226"></a>
+<FONT color="green">227</FONT>        /**<a name="line.227"></a>
+<FONT color="green">228</FONT>         * Returns the coefficients of the derivative of the polynomial with the given coefficients.<a name="line.228"></a>
+<FONT color="green">229</FONT>         *<a name="line.229"></a>
+<FONT color="green">230</FONT>         * @param coefficients  the coefficients of the polynomial to differentiate<a name="line.230"></a>
+<FONT color="green">231</FONT>         * @return the coefficients of the derivative or null if coefficients has length 1.<a name="line.231"></a>
+<FONT color="green">232</FONT>         * @throws IllegalArgumentException if coefficients is empty<a name="line.232"></a>
+<FONT color="green">233</FONT>         * @throws NullPointerException if coefficients is null<a name="line.233"></a>
+<FONT color="green">234</FONT>         */<a name="line.234"></a>
+<FONT color="green">235</FONT>        protected static double[] differentiate(double[] coefficients) {<a name="line.235"></a>
+<FONT color="green">236</FONT>            int n = coefficients.length;<a name="line.236"></a>
+<FONT color="green">237</FONT>            if (n &lt; 1) {<a name="line.237"></a>
+<FONT color="green">238</FONT>                throw MathRuntimeException.createIllegalArgumentException(EMPTY_ARRAY_MESSAGE);<a name="line.238"></a>
+<FONT color="green">239</FONT>            }<a name="line.239"></a>
+<FONT color="green">240</FONT>            if (n == 1) {<a name="line.240"></a>
+<FONT color="green">241</FONT>                return new double[]{0};<a name="line.241"></a>
+<FONT color="green">242</FONT>            }<a name="line.242"></a>
+<FONT color="green">243</FONT>            double[] result = new double[n - 1];<a name="line.243"></a>
+<FONT color="green">244</FONT>            for (int i = n - 1; i  &gt; 0; i--) {<a name="line.244"></a>
+<FONT color="green">245</FONT>                result[i - 1] = i * coefficients[i];<a name="line.245"></a>
+<FONT color="green">246</FONT>            }<a name="line.246"></a>
+<FONT color="green">247</FONT>            return result;<a name="line.247"></a>
+<FONT color="green">248</FONT>        }<a name="line.248"></a>
+<FONT color="green">249</FONT>    <a name="line.249"></a>
+<FONT color="green">250</FONT>        /**<a name="line.250"></a>
+<FONT color="green">251</FONT>         * Returns the derivative as a PolynomialRealFunction<a name="line.251"></a>
+<FONT color="green">252</FONT>         *<a name="line.252"></a>
+<FONT color="green">253</FONT>         * @return  the derivative polynomial<a name="line.253"></a>
+<FONT color="green">254</FONT>         */<a name="line.254"></a>
+<FONT color="green">255</FONT>        public PolynomialFunction polynomialDerivative() {<a name="line.255"></a>
+<FONT color="green">256</FONT>            return new PolynomialFunction(differentiate(coefficients));<a name="line.256"></a>
+<FONT color="green">257</FONT>        }<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>        /**<a name="line.259"></a>
+<FONT color="green">260</FONT>         * Returns the derivative as a UnivariateRealFunction<a name="line.260"></a>
+<FONT color="green">261</FONT>         *<a name="line.261"></a>
+<FONT color="green">262</FONT>         * @return  the derivative function<a name="line.262"></a>
+<FONT color="green">263</FONT>         */<a name="line.263"></a>
+<FONT color="green">264</FONT>        public UnivariateRealFunction derivative() {<a name="line.264"></a>
+<FONT color="green">265</FONT>            return polynomialDerivative();<a name="line.265"></a>
+<FONT color="green">266</FONT>        }<a name="line.266"></a>
+<FONT color="green">267</FONT>    <a name="line.267"></a>
+<FONT color="green">268</FONT>        /** Returns a string representation of the polynomial.<a name="line.268"></a>
+<FONT color="green">269</FONT>    <a name="line.269"></a>
+<FONT color="green">270</FONT>         * &lt;p&gt;The representation is user oriented. Terms are displayed lowest<a name="line.270"></a>
+<FONT color="green">271</FONT>         * degrees first. The multiplications signs, coefficients equals to<a name="line.271"></a>
+<FONT color="green">272</FONT>         * one and null terms are not displayed (except if the polynomial is 0,<a name="line.272"></a>
+<FONT color="green">273</FONT>         * in which case the 0 constant term is displayed). Addition of terms<a name="line.273"></a>
+<FONT color="green">274</FONT>         * with negative coefficients are replaced by subtraction of terms<a name="line.274"></a>
+<FONT color="green">275</FONT>         * with positive coefficients except for the first displayed term<a name="line.275"></a>
+<FONT color="green">276</FONT>         * (i.e. we display &lt;code&gt;-3&lt;/code&gt; for a constant negative polynomial,<a name="line.276"></a>
+<FONT color="green">277</FONT>         * but &lt;code&gt;1 - 3 x + x^2&lt;/code&gt; if the negative coefficient is not<a name="line.277"></a>
+<FONT color="green">278</FONT>         * the first one displayed).&lt;/p&gt;<a name="line.278"></a>
+<FONT color="green">279</FONT>    <a name="line.279"></a>
+<FONT color="green">280</FONT>         * @return a string representation of the polynomial<a name="line.280"></a>
+<FONT color="green">281</FONT>    <a name="line.281"></a>
+<FONT color="green">282</FONT>         */<a name="line.282"></a>
+<FONT color="green">283</FONT>        @Override<a name="line.283"></a>
+<FONT color="green">284</FONT>         public String toString() {<a name="line.284"></a>
+<FONT color="green">285</FONT>    <a name="line.285"></a>
+<FONT color="green">286</FONT>           StringBuffer s = new StringBuffer();<a name="line.286"></a>
+<FONT color="green">287</FONT>           if (coefficients[0] == 0.0) {<a name="line.287"></a>
+<FONT color="green">288</FONT>             if (coefficients.length == 1) {<a name="line.288"></a>
+<FONT color="green">289</FONT>               return "0";<a name="line.289"></a>
+<FONT color="green">290</FONT>             }<a name="line.290"></a>
+<FONT color="green">291</FONT>           } else {<a name="line.291"></a>
+<FONT color="green">292</FONT>             s.append(Double.toString(coefficients[0]));<a name="line.292"></a>
+<FONT color="green">293</FONT>           }<a name="line.293"></a>
+<FONT color="green">294</FONT>    <a name="line.294"></a>
+<FONT color="green">295</FONT>           for (int i = 1; i &lt; coefficients.length; ++i) {<a name="line.295"></a>
+<FONT color="green">296</FONT>    <a name="line.296"></a>
+<FONT color="green">297</FONT>             if (coefficients[i] != 0) {<a name="line.297"></a>
+<FONT color="green">298</FONT>    <a name="line.298"></a>
+<FONT color="green">299</FONT>               if (s.length() &gt; 0) {<a name="line.299"></a>
+<FONT color="green">300</FONT>                 if (coefficients[i] &lt; 0) {<a name="line.300"></a>
+<FONT color="green">301</FONT>                   s.append(" - ");<a name="line.301"></a>
+<FONT color="green">302</FONT>                 } else {<a name="line.302"></a>
+<FONT color="green">303</FONT>                   s.append(" + ");<a name="line.303"></a>
+<FONT color="green">304</FONT>                 }<a name="line.304"></a>
+<FONT color="green">305</FONT>               } else {<a name="line.305"></a>
+<FONT color="green">306</FONT>                 if (coefficients[i] &lt; 0) {<a name="line.306"></a>
+<FONT color="green">307</FONT>                   s.append("-");<a name="line.307"></a>
+<FONT color="green">308</FONT>                 }<a name="line.308"></a>
+<FONT color="green">309</FONT>               }<a name="line.309"></a>
+<FONT color="green">310</FONT>    <a name="line.310"></a>
+<FONT color="green">311</FONT>               double absAi = Math.abs(coefficients[i]);<a name="line.311"></a>
+<FONT color="green">312</FONT>               if ((absAi - 1) != 0) {<a name="line.312"></a>
+<FONT color="green">313</FONT>                 s.append(Double.toString(absAi));<a name="line.313"></a>
+<FONT color="green">314</FONT>                 s.append(' ');<a name="line.314"></a>
+<FONT color="green">315</FONT>               }<a name="line.315"></a>
+<FONT color="green">316</FONT>    <a name="line.316"></a>
+<FONT color="green">317</FONT>               s.append("x");<a name="line.317"></a>
+<FONT color="green">318</FONT>               if (i &gt; 1) {<a name="line.318"></a>
+<FONT color="green">319</FONT>                 s.append('^');<a name="line.319"></a>
+<FONT color="green">320</FONT>                 s.append(Integer.toString(i));<a name="line.320"></a>
+<FONT color="green">321</FONT>               }<a name="line.321"></a>
+<FONT color="green">322</FONT>             }<a name="line.322"></a>
+<FONT color="green">323</FONT>    <a name="line.323"></a>
+<FONT color="green">324</FONT>           }<a name="line.324"></a>
+<FONT color="green">325</FONT>    <a name="line.325"></a>
+<FONT color="green">326</FONT>           return s.toString();<a name="line.326"></a>
+<FONT color="green">327</FONT>    <a name="line.327"></a>
+<FONT color="green">328</FONT>         }<a name="line.328"></a>
+<FONT color="green">329</FONT>    <a name="line.329"></a>
+<FONT color="green">330</FONT>        /** {@inheritDoc} */<a name="line.330"></a>
+<FONT color="green">331</FONT>        @Override<a name="line.331"></a>
+<FONT color="green">332</FONT>        public int hashCode() {<a name="line.332"></a>
+<FONT color="green">333</FONT>            final int prime = 31;<a name="line.333"></a>
+<FONT color="green">334</FONT>            int result = 1;<a name="line.334"></a>
+<FONT color="green">335</FONT>            result = prime * result + Arrays.hashCode(coefficients);<a name="line.335"></a>
+<FONT color="green">336</FONT>            return result;<a name="line.336"></a>
+<FONT color="green">337</FONT>        }<a name="line.337"></a>
+<FONT color="green">338</FONT>    <a name="line.338"></a>
+<FONT color="green">339</FONT>        /** {@inheritDoc} */<a name="line.339"></a>
+<FONT color="green">340</FONT>        @Override<a name="line.340"></a>
+<FONT color="green">341</FONT>        public boolean equals(Object obj) {<a name="line.341"></a>
+<FONT color="green">342</FONT>            if (this == obj)<a name="line.342"></a>
+<FONT color="green">343</FONT>                return true;<a name="line.343"></a>
+<FONT color="green">344</FONT>            if (!(obj instanceof PolynomialFunction))<a name="line.344"></a>
+<FONT color="green">345</FONT>                return false;<a name="line.345"></a>
+<FONT color="green">346</FONT>            PolynomialFunction other = (PolynomialFunction) obj;<a name="line.346"></a>
+<FONT color="green">347</FONT>            if (!Arrays.equals(coefficients, other.coefficients))<a name="line.347"></a>
+<FONT color="green">348</FONT>                return false;<a name="line.348"></a>
+<FONT color="green">349</FONT>            return true;<a name="line.349"></a>
+<FONT color="green">350</FONT>        }<a name="line.350"></a>
+<FONT color="green">351</FONT>    <a name="line.351"></a>
+<FONT color="green">352</FONT>    }<a name="line.352"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/polynomials/PolynomialFunctionLagrangeForm.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,375 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.polynomials;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.DuplicateSampleAbscissaException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Implements the representation of a real polynomial function in<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;a href="http://mathworld.wolfram.com/LagrangeInterpolatingPolynomial.html"&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Lagrange Form&lt;/a&gt;. For reference, see &lt;b&gt;Introduction to Numerical<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Analysis&lt;/b&gt;, ISBN 038795452X, chapter 2.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * The approximated function should be smooth enough for Lagrange polynomial<a name="line.30"></a>
+<FONT color="green">031</FONT>     * to work well. Otherwise, consider using splines instead.&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     *<a name="line.32"></a>
+<FONT color="green">033</FONT>     * @version $Revision: 922708 $ $Date: 2010-03-13 20:15:47 -0500 (Sat, 13 Mar 2010) $<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @since 1.2<a name="line.34"></a>
+<FONT color="green">035</FONT>     */<a name="line.35"></a>
+<FONT color="green">036</FONT>    public class PolynomialFunctionLagrangeForm implements UnivariateRealFunction {<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /**<a name="line.38"></a>
+<FONT color="green">039</FONT>         * The coefficients of the polynomial, ordered by degree -- i.e.<a name="line.39"></a>
+<FONT color="green">040</FONT>         * coefficients[0] is the constant term and coefficients[n] is the<a name="line.40"></a>
+<FONT color="green">041</FONT>         * coefficient of x^n where n is the degree of the polynomial.<a name="line.41"></a>
+<FONT color="green">042</FONT>         */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private double coefficients[];<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**<a name="line.45"></a>
+<FONT color="green">046</FONT>         * Interpolating points (abscissas).<a name="line.46"></a>
+<FONT color="green">047</FONT>         */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private final double x[];<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Function values at interpolating points.<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        private final double y[];<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * Whether the polynomial coefficients are available.<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        private boolean coefficientsComputed;<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /**<a name="line.60"></a>
+<FONT color="green">061</FONT>         * Construct a Lagrange polynomial with the given abscissas and function<a name="line.61"></a>
+<FONT color="green">062</FONT>         * values. The order of interpolating points are not important.<a name="line.62"></a>
+<FONT color="green">063</FONT>         * &lt;p&gt;<a name="line.63"></a>
+<FONT color="green">064</FONT>         * The constructor makes copy of the input arrays and assigns them.&lt;/p&gt;<a name="line.64"></a>
+<FONT color="green">065</FONT>         *<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @param x interpolating points<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @param y function values at interpolating points<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @throws IllegalArgumentException if input arrays are not valid<a name="line.68"></a>
+<FONT color="green">069</FONT>         */<a name="line.69"></a>
+<FONT color="green">070</FONT>        public PolynomialFunctionLagrangeForm(double x[], double y[])<a name="line.70"></a>
+<FONT color="green">071</FONT>            throws IllegalArgumentException {<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>            verifyInterpolationArray(x, y);<a name="line.73"></a>
+<FONT color="green">074</FONT>            this.x = new double[x.length];<a name="line.74"></a>
+<FONT color="green">075</FONT>            this.y = new double[y.length];<a name="line.75"></a>
+<FONT color="green">076</FONT>            System.arraycopy(x, 0, this.x, 0, x.length);<a name="line.76"></a>
+<FONT color="green">077</FONT>            System.arraycopy(y, 0, this.y, 0, y.length);<a name="line.77"></a>
+<FONT color="green">078</FONT>            coefficientsComputed = false;<a name="line.78"></a>
+<FONT color="green">079</FONT>        }<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /**<a name="line.81"></a>
+<FONT color="green">082</FONT>         * Calculate the function value at the given point.<a name="line.82"></a>
+<FONT color="green">083</FONT>         *<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @param z the point at which the function value is to be computed<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @return the function value<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @throws FunctionEvaluationException if a runtime error occurs<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @see UnivariateRealFunction#value(double)<a name="line.87"></a>
+<FONT color="green">088</FONT>         */<a name="line.88"></a>
+<FONT color="green">089</FONT>        public double value(double z) throws FunctionEvaluationException {<a name="line.89"></a>
+<FONT color="green">090</FONT>            try {<a name="line.90"></a>
+<FONT color="green">091</FONT>                return evaluate(x, y, z);<a name="line.91"></a>
+<FONT color="green">092</FONT>            } catch (DuplicateSampleAbscissaException e) {<a name="line.92"></a>
+<FONT color="green">093</FONT>                throw new FunctionEvaluationException(e, z, e.getPattern(), e.getArguments());<a name="line.93"></a>
+<FONT color="green">094</FONT>            }<a name="line.94"></a>
+<FONT color="green">095</FONT>        }<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /**<a name="line.97"></a>
+<FONT color="green">098</FONT>         * Returns the degree of the polynomial.<a name="line.98"></a>
+<FONT color="green">099</FONT>         *<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @return the degree of the polynomial<a name="line.100"></a>
+<FONT color="green">101</FONT>         */<a name="line.101"></a>
+<FONT color="green">102</FONT>        public int degree() {<a name="line.102"></a>
+<FONT color="green">103</FONT>            return x.length - 1;<a name="line.103"></a>
+<FONT color="green">104</FONT>        }<a name="line.104"></a>
+<FONT color="green">105</FONT>    <a name="line.105"></a>
+<FONT color="green">106</FONT>        /**<a name="line.106"></a>
+<FONT color="green">107</FONT>         * Returns a copy of the interpolating points array.<a name="line.107"></a>
+<FONT color="green">108</FONT>         * &lt;p&gt;<a name="line.108"></a>
+<FONT color="green">109</FONT>         * Changes made to the returned copy will not affect the polynomial.&lt;/p&gt;<a name="line.109"></a>
+<FONT color="green">110</FONT>         *<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @return a fresh copy of the interpolating points array<a name="line.111"></a>
+<FONT color="green">112</FONT>         */<a name="line.112"></a>
+<FONT color="green">113</FONT>        public double[] getInterpolatingPoints() {<a name="line.113"></a>
+<FONT color="green">114</FONT>            double[] out = new double[x.length];<a name="line.114"></a>
+<FONT color="green">115</FONT>            System.arraycopy(x, 0, out, 0, x.length);<a name="line.115"></a>
+<FONT color="green">116</FONT>            return out;<a name="line.116"></a>
+<FONT color="green">117</FONT>        }<a name="line.117"></a>
+<FONT color="green">118</FONT>    <a name="line.118"></a>
+<FONT color="green">119</FONT>        /**<a name="line.119"></a>
+<FONT color="green">120</FONT>         * Returns a copy of the interpolating values array.<a name="line.120"></a>
+<FONT color="green">121</FONT>         * &lt;p&gt;<a name="line.121"></a>
+<FONT color="green">122</FONT>         * Changes made to the returned copy will not affect the polynomial.&lt;/p&gt;<a name="line.122"></a>
+<FONT color="green">123</FONT>         *<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @return a fresh copy of the interpolating values array<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        public double[] getInterpolatingValues() {<a name="line.126"></a>
+<FONT color="green">127</FONT>            double[] out = new double[y.length];<a name="line.127"></a>
+<FONT color="green">128</FONT>            System.arraycopy(y, 0, out, 0, y.length);<a name="line.128"></a>
+<FONT color="green">129</FONT>            return out;<a name="line.129"></a>
+<FONT color="green">130</FONT>        }<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>        /**<a name="line.132"></a>
+<FONT color="green">133</FONT>         * Returns a copy of the coefficients array.<a name="line.133"></a>
+<FONT color="green">134</FONT>         * &lt;p&gt;<a name="line.134"></a>
+<FONT color="green">135</FONT>         * Changes made to the returned copy will not affect the polynomial.&lt;/p&gt;<a name="line.135"></a>
+<FONT color="green">136</FONT>         * &lt;p&gt;<a name="line.136"></a>
+<FONT color="green">137</FONT>         * Note that coefficients computation can be ill-conditioned. Use with caution<a name="line.137"></a>
+<FONT color="green">138</FONT>         * and only when it is necessary.&lt;/p&gt;<a name="line.138"></a>
+<FONT color="green">139</FONT>         *<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @return a fresh copy of the coefficients array<a name="line.140"></a>
+<FONT color="green">141</FONT>         */<a name="line.141"></a>
+<FONT color="green">142</FONT>        public double[] getCoefficients() {<a name="line.142"></a>
+<FONT color="green">143</FONT>            if (!coefficientsComputed) {<a name="line.143"></a>
+<FONT color="green">144</FONT>                computeCoefficients();<a name="line.144"></a>
+<FONT color="green">145</FONT>            }<a name="line.145"></a>
+<FONT color="green">146</FONT>            double[] out = new double[coefficients.length];<a name="line.146"></a>
+<FONT color="green">147</FONT>            System.arraycopy(coefficients, 0, out, 0, coefficients.length);<a name="line.147"></a>
+<FONT color="green">148</FONT>            return out;<a name="line.148"></a>
+<FONT color="green">149</FONT>        }<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>        /**<a name="line.151"></a>
+<FONT color="green">152</FONT>         * Evaluate the Lagrange polynomial using<a name="line.152"></a>
+<FONT color="green">153</FONT>         * &lt;a href="http://mathworld.wolfram.com/NevillesAlgorithm.html"&gt;<a name="line.153"></a>
+<FONT color="green">154</FONT>         * Neville's Algorithm&lt;/a&gt;. It takes O(N^2) time.<a name="line.154"></a>
+<FONT color="green">155</FONT>         * &lt;p&gt;<a name="line.155"></a>
+<FONT color="green">156</FONT>         * This function is made public static so that users can call it directly<a name="line.156"></a>
+<FONT color="green">157</FONT>         * without instantiating PolynomialFunctionLagrangeForm object.&lt;/p&gt;<a name="line.157"></a>
+<FONT color="green">158</FONT>         *<a name="line.158"></a>
+<FONT color="green">159</FONT>         * @param x the interpolating points array<a name="line.159"></a>
+<FONT color="green">160</FONT>         * @param y the interpolating values array<a name="line.160"></a>
+<FONT color="green">161</FONT>         * @param z the point at which the function value is to be computed<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @return the function value<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @throws DuplicateSampleAbscissaException if the sample has duplicate abscissas<a name="line.163"></a>
+<FONT color="green">164</FONT>         * @throws IllegalArgumentException if inputs are not valid<a name="line.164"></a>
+<FONT color="green">165</FONT>         */<a name="line.165"></a>
+<FONT color="green">166</FONT>        public static double evaluate(double x[], double y[], double z) throws<a name="line.166"></a>
+<FONT color="green">167</FONT>            DuplicateSampleAbscissaException, IllegalArgumentException {<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>            verifyInterpolationArray(x, y);<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>            int nearest = 0;<a name="line.171"></a>
+<FONT color="green">172</FONT>            final int n = x.length;<a name="line.172"></a>
+<FONT color="green">173</FONT>            final double[] c = new double[n];<a name="line.173"></a>
+<FONT color="green">174</FONT>            final double[] d = new double[n];<a name="line.174"></a>
+<FONT color="green">175</FONT>            double min_dist = Double.POSITIVE_INFINITY;<a name="line.175"></a>
+<FONT color="green">176</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.176"></a>
+<FONT color="green">177</FONT>                // initialize the difference arrays<a name="line.177"></a>
+<FONT color="green">178</FONT>                c[i] = y[i];<a name="line.178"></a>
+<FONT color="green">179</FONT>                d[i] = y[i];<a name="line.179"></a>
+<FONT color="green">180</FONT>                // find out the abscissa closest to z<a name="line.180"></a>
+<FONT color="green">181</FONT>                final double dist = Math.abs(z - x[i]);<a name="line.181"></a>
+<FONT color="green">182</FONT>                if (dist &lt; min_dist) {<a name="line.182"></a>
+<FONT color="green">183</FONT>                    nearest = i;<a name="line.183"></a>
+<FONT color="green">184</FONT>                    min_dist = dist;<a name="line.184"></a>
+<FONT color="green">185</FONT>                }<a name="line.185"></a>
+<FONT color="green">186</FONT>            }<a name="line.186"></a>
+<FONT color="green">187</FONT>    <a name="line.187"></a>
+<FONT color="green">188</FONT>            // initial approximation to the function value at z<a name="line.188"></a>
+<FONT color="green">189</FONT>            double value = y[nearest];<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>            for (int i = 1; i &lt; n; i++) {<a name="line.191"></a>
+<FONT color="green">192</FONT>                for (int j = 0; j &lt; n-i; j++) {<a name="line.192"></a>
+<FONT color="green">193</FONT>                    final double tc = x[j] - z;<a name="line.193"></a>
+<FONT color="green">194</FONT>                    final double td = x[i+j] - z;<a name="line.194"></a>
+<FONT color="green">195</FONT>                    final double divider = x[j] - x[i+j];<a name="line.195"></a>
+<FONT color="green">196</FONT>                    if (divider == 0.0) {<a name="line.196"></a>
+<FONT color="green">197</FONT>                        // This happens only when two abscissas are identical.<a name="line.197"></a>
+<FONT color="green">198</FONT>                        throw new DuplicateSampleAbscissaException(x[i], i, i+j);<a name="line.198"></a>
+<FONT color="green">199</FONT>                    }<a name="line.199"></a>
+<FONT color="green">200</FONT>                    // update the difference arrays<a name="line.200"></a>
+<FONT color="green">201</FONT>                    final double w = (c[j+1] - d[j]) / divider;<a name="line.201"></a>
+<FONT color="green">202</FONT>                    c[j] = tc * w;<a name="line.202"></a>
+<FONT color="green">203</FONT>                    d[j] = td * w;<a name="line.203"></a>
+<FONT color="green">204</FONT>                }<a name="line.204"></a>
+<FONT color="green">205</FONT>                // sum up the difference terms to get the final value<a name="line.205"></a>
+<FONT color="green">206</FONT>                if (nearest &lt; 0.5*(n-i+1)) {<a name="line.206"></a>
+<FONT color="green">207</FONT>                    value += c[nearest];    // fork down<a name="line.207"></a>
+<FONT color="green">208</FONT>                } else {<a name="line.208"></a>
+<FONT color="green">209</FONT>                    nearest--;<a name="line.209"></a>
+<FONT color="green">210</FONT>                    value += d[nearest];    // fork up<a name="line.210"></a>
+<FONT color="green">211</FONT>                }<a name="line.211"></a>
+<FONT color="green">212</FONT>            }<a name="line.212"></a>
+<FONT color="green">213</FONT>    <a name="line.213"></a>
+<FONT color="green">214</FONT>            return value;<a name="line.214"></a>
+<FONT color="green">215</FONT>        }<a name="line.215"></a>
+<FONT color="green">216</FONT>    <a name="line.216"></a>
+<FONT color="green">217</FONT>        /**<a name="line.217"></a>
+<FONT color="green">218</FONT>         * Calculate the coefficients of Lagrange polynomial from the<a name="line.218"></a>
+<FONT color="green">219</FONT>         * interpolation data. It takes O(N^2) time.<a name="line.219"></a>
+<FONT color="green">220</FONT>         * &lt;p&gt;<a name="line.220"></a>
+<FONT color="green">221</FONT>         * Note this computation can be ill-conditioned. Use with caution<a name="line.221"></a>
+<FONT color="green">222</FONT>         * and only when it is necessary.&lt;/p&gt;<a name="line.222"></a>
+<FONT color="green">223</FONT>         *<a name="line.223"></a>
+<FONT color="green">224</FONT>         * @throws ArithmeticException if any abscissas coincide<a name="line.224"></a>
+<FONT color="green">225</FONT>         */<a name="line.225"></a>
+<FONT color="green">226</FONT>        protected void computeCoefficients() throws ArithmeticException {<a name="line.226"></a>
+<FONT color="green">227</FONT>    <a name="line.227"></a>
+<FONT color="green">228</FONT>            final int n = degree() + 1;<a name="line.228"></a>
+<FONT color="green">229</FONT>            coefficients = new double[n];<a name="line.229"></a>
+<FONT color="green">230</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.230"></a>
+<FONT color="green">231</FONT>                coefficients[i] = 0.0;<a name="line.231"></a>
+<FONT color="green">232</FONT>            }<a name="line.232"></a>
+<FONT color="green">233</FONT>    <a name="line.233"></a>
+<FONT color="green">234</FONT>            // c[] are the coefficients of P(x) = (x-x[0])(x-x[1])...(x-x[n-1])<a name="line.234"></a>
+<FONT color="green">235</FONT>            final double[] c = new double[n+1];<a name="line.235"></a>
+<FONT color="green">236</FONT>            c[0] = 1.0;<a name="line.236"></a>
+<FONT color="green">237</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.237"></a>
+<FONT color="green">238</FONT>                for (int j = i; j &gt; 0; j--) {<a name="line.238"></a>
+<FONT color="green">239</FONT>                    c[j] = c[j-1] - c[j] * x[i];<a name="line.239"></a>
+<FONT color="green">240</FONT>                }<a name="line.240"></a>
+<FONT color="green">241</FONT>                c[0] *= -x[i];<a name="line.241"></a>
+<FONT color="green">242</FONT>                c[i+1] = 1;<a name="line.242"></a>
+<FONT color="green">243</FONT>            }<a name="line.243"></a>
+<FONT color="green">244</FONT>    <a name="line.244"></a>
+<FONT color="green">245</FONT>            final double[] tc = new double[n];<a name="line.245"></a>
+<FONT color="green">246</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.246"></a>
+<FONT color="green">247</FONT>                // d = (x[i]-x[0])...(x[i]-x[i-1])(x[i]-x[i+1])...(x[i]-x[n-1])<a name="line.247"></a>
+<FONT color="green">248</FONT>                double d = 1;<a name="line.248"></a>
+<FONT color="green">249</FONT>                for (int j = 0; j &lt; n; j++) {<a name="line.249"></a>
+<FONT color="green">250</FONT>                    if (i != j) {<a name="line.250"></a>
+<FONT color="green">251</FONT>                        d *= x[i] - x[j];<a name="line.251"></a>
+<FONT color="green">252</FONT>                    }<a name="line.252"></a>
+<FONT color="green">253</FONT>                }<a name="line.253"></a>
+<FONT color="green">254</FONT>                if (d == 0.0) {<a name="line.254"></a>
+<FONT color="green">255</FONT>                    // This happens only when two abscissas are identical.<a name="line.255"></a>
+<FONT color="green">256</FONT>                    for (int k = 0; k &lt; n; ++k) {<a name="line.256"></a>
+<FONT color="green">257</FONT>                        if ((i != k) &amp;&amp; (x[i] == x[k])) {<a name="line.257"></a>
+<FONT color="green">258</FONT>                            throw MathRuntimeException.createArithmeticException("identical abscissas x[{0}] == x[{1}] == {2} cause division by zero",<a name="line.258"></a>
+<FONT color="green">259</FONT>                                                                                 i, k, x[i]);<a name="line.259"></a>
+<FONT color="green">260</FONT>                        }<a name="line.260"></a>
+<FONT color="green">261</FONT>                    }<a name="line.261"></a>
+<FONT color="green">262</FONT>                }<a name="line.262"></a>
+<FONT color="green">263</FONT>                final double t = y[i] / d;<a name="line.263"></a>
+<FONT color="green">264</FONT>                // Lagrange polynomial is the sum of n terms, each of which is a<a name="line.264"></a>
+<FONT color="green">265</FONT>                // polynomial of degree n-1. tc[] are the coefficients of the i-th<a name="line.265"></a>
+<FONT color="green">266</FONT>                // numerator Pi(x) = (x-x[0])...(x-x[i-1])(x-x[i+1])...(x-x[n-1]).<a name="line.266"></a>
+<FONT color="green">267</FONT>                tc[n-1] = c[n];     // actually c[n] = 1<a name="line.267"></a>
+<FONT color="green">268</FONT>                coefficients[n-1] += t * tc[n-1];<a name="line.268"></a>
+<FONT color="green">269</FONT>                for (int j = n-2; j &gt;= 0; j--) {<a name="line.269"></a>
+<FONT color="green">270</FONT>                    tc[j] = c[j+1] + tc[j+1] * x[i];<a name="line.270"></a>
+<FONT color="green">271</FONT>                    coefficients[j] += t * tc[j];<a name="line.271"></a>
+<FONT color="green">272</FONT>                }<a name="line.272"></a>
+<FONT color="green">273</FONT>            }<a name="line.273"></a>
+<FONT color="green">274</FONT>    <a name="line.274"></a>
+<FONT color="green">275</FONT>            coefficientsComputed = true;<a name="line.275"></a>
+<FONT color="green">276</FONT>        }<a name="line.276"></a>
+<FONT color="green">277</FONT>    <a name="line.277"></a>
+<FONT color="green">278</FONT>        /**<a name="line.278"></a>
+<FONT color="green">279</FONT>         * Verifies that the interpolation arrays are valid.<a name="line.279"></a>
+<FONT color="green">280</FONT>         * &lt;p&gt;<a name="line.280"></a>
+<FONT color="green">281</FONT>         * The arrays features checked by this method are that both arrays have the<a name="line.281"></a>
+<FONT color="green">282</FONT>         * same length and this length is at least 2.<a name="line.282"></a>
+<FONT color="green">283</FONT>         * &lt;/p&gt;<a name="line.283"></a>
+<FONT color="green">284</FONT>         * &lt;p&gt;<a name="line.284"></a>
+<FONT color="green">285</FONT>         * The interpolating points must be distinct. However it is not<a name="line.285"></a>
+<FONT color="green">286</FONT>         * verified here, it is checked in evaluate() and computeCoefficients().<a name="line.286"></a>
+<FONT color="green">287</FONT>         * &lt;/p&gt;<a name="line.287"></a>
+<FONT color="green">288</FONT>         *<a name="line.288"></a>
+<FONT color="green">289</FONT>         * @param x the interpolating points array<a name="line.289"></a>
+<FONT color="green">290</FONT>         * @param y the interpolating values array<a name="line.290"></a>
+<FONT color="green">291</FONT>         * @throws IllegalArgumentException if not valid<a name="line.291"></a>
+<FONT color="green">292</FONT>         * @see #evaluate(double[], double[], double)<a name="line.292"></a>
+<FONT color="green">293</FONT>         * @see #computeCoefficients()<a name="line.293"></a>
+<FONT color="green">294</FONT>         */<a name="line.294"></a>
+<FONT color="green">295</FONT>        public static void verifyInterpolationArray(double x[], double y[])<a name="line.295"></a>
+<FONT color="green">296</FONT>            throws IllegalArgumentException {<a name="line.296"></a>
+<FONT color="green">297</FONT>    <a name="line.297"></a>
+<FONT color="green">298</FONT>            if (x.length != y.length) {<a name="line.298"></a>
+<FONT color="green">299</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.299"></a>
+<FONT color="green">300</FONT>                      "dimension mismatch {0} != {1}", x.length, y.length);<a name="line.300"></a>
+<FONT color="green">301</FONT>            }<a name="line.301"></a>
+<FONT color="green">302</FONT>    <a name="line.302"></a>
+<FONT color="green">303</FONT>            if (x.length &lt; 2) {<a name="line.303"></a>
+<FONT color="green">304</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.304"></a>
+<FONT color="green">305</FONT>                      "{0} points are required, got only {1}", 2, x.length);<a name="line.305"></a>
+<FONT color="green">306</FONT>            }<a name="line.306"></a>
+<FONT color="green">307</FONT>    <a name="line.307"></a>
+<FONT color="green">308</FONT>        }<a name="line.308"></a>
+<FONT color="green">309</FONT>    }<a name="line.309"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/polynomials/PolynomialFunctionNewtonForm.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,286 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.polynomials;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Implements the representation of a real polynomial function in<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Newton Form. For reference, see &lt;b&gt;Elementary Numerical Analysis&lt;/b&gt;,<a name="line.25"></a>
+<FONT color="green">026</FONT>     * ISBN 0070124477, chapter 2.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * The formula of polynomial in Newton form is<a name="line.28"></a>
+<FONT color="green">029</FONT>     *     p(x) = a[0] + a[1](x-c[0]) + a[2](x-c[0])(x-c[1]) + ... +<a name="line.29"></a>
+<FONT color="green">030</FONT>     *            a[n](x-c[0])(x-c[1])...(x-c[n-1])<a name="line.30"></a>
+<FONT color="green">031</FONT>     * Note that the length of a[] is one more than the length of c[]&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     *<a name="line.32"></a>
+<FONT color="green">033</FONT>     * @version $Revision: 922708 $ $Date: 2010-03-13 20:15:47 -0500 (Sat, 13 Mar 2010) $<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @since 1.2<a name="line.34"></a>
+<FONT color="green">035</FONT>     */<a name="line.35"></a>
+<FONT color="green">036</FONT>    public class PolynomialFunctionNewtonForm implements UnivariateRealFunction {<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /**<a name="line.38"></a>
+<FONT color="green">039</FONT>         * The coefficients of the polynomial, ordered by degree -- i.e.<a name="line.39"></a>
+<FONT color="green">040</FONT>         * coefficients[0] is the constant term and coefficients[n] is the<a name="line.40"></a>
+<FONT color="green">041</FONT>         * coefficient of x^n where n is the degree of the polynomial.<a name="line.41"></a>
+<FONT color="green">042</FONT>         */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private double coefficients[];<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**<a name="line.45"></a>
+<FONT color="green">046</FONT>         * Centers of the Newton polynomial.<a name="line.46"></a>
+<FONT color="green">047</FONT>         */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private final double c[];<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * When all c[i] = 0, a[] becomes normal polynomial coefficients,<a name="line.51"></a>
+<FONT color="green">052</FONT>         * i.e. a[i] = coefficients[i].<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        private final double a[];<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /**<a name="line.56"></a>
+<FONT color="green">057</FONT>         * Whether the polynomial coefficients are available.<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        private boolean coefficientsComputed;<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Construct a Newton polynomial with the given a[] and c[]. The order of<a name="line.62"></a>
+<FONT color="green">063</FONT>         * centers are important in that if c[] shuffle, then values of a[] would<a name="line.63"></a>
+<FONT color="green">064</FONT>         * completely change, not just a permutation of old a[].<a name="line.64"></a>
+<FONT color="green">065</FONT>         * &lt;p&gt;<a name="line.65"></a>
+<FONT color="green">066</FONT>         * The constructor makes copy of the input arrays and assigns them.&lt;/p&gt;<a name="line.66"></a>
+<FONT color="green">067</FONT>         *<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param a the coefficients in Newton form formula<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @param c the centers<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @throws IllegalArgumentException if input arrays are not valid<a name="line.70"></a>
+<FONT color="green">071</FONT>         */<a name="line.71"></a>
+<FONT color="green">072</FONT>        public PolynomialFunctionNewtonForm(double a[], double c[])<a name="line.72"></a>
+<FONT color="green">073</FONT>            throws IllegalArgumentException {<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>            verifyInputArray(a, c);<a name="line.75"></a>
+<FONT color="green">076</FONT>            this.a = new double[a.length];<a name="line.76"></a>
+<FONT color="green">077</FONT>            this.c = new double[c.length];<a name="line.77"></a>
+<FONT color="green">078</FONT>            System.arraycopy(a, 0, this.a, 0, a.length);<a name="line.78"></a>
+<FONT color="green">079</FONT>            System.arraycopy(c, 0, this.c, 0, c.length);<a name="line.79"></a>
+<FONT color="green">080</FONT>            coefficientsComputed = false;<a name="line.80"></a>
+<FONT color="green">081</FONT>        }<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /**<a name="line.83"></a>
+<FONT color="green">084</FONT>         * Calculate the function value at the given point.<a name="line.84"></a>
+<FONT color="green">085</FONT>         *<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @param z the point at which the function value is to be computed<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @return the function value<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @throws FunctionEvaluationException if a runtime error occurs<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @see UnivariateRealFunction#value(double)<a name="line.89"></a>
+<FONT color="green">090</FONT>         */<a name="line.90"></a>
+<FONT color="green">091</FONT>        public double value(double z) throws FunctionEvaluationException {<a name="line.91"></a>
+<FONT color="green">092</FONT>           return evaluate(a, c, z);<a name="line.92"></a>
+<FONT color="green">093</FONT>        }<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /**<a name="line.95"></a>
+<FONT color="green">096</FONT>         * Returns the degree of the polynomial.<a name="line.96"></a>
+<FONT color="green">097</FONT>         *<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @return the degree of the polynomial<a name="line.98"></a>
+<FONT color="green">099</FONT>         */<a name="line.99"></a>
+<FONT color="green">100</FONT>        public int degree() {<a name="line.100"></a>
+<FONT color="green">101</FONT>            return c.length;<a name="line.101"></a>
+<FONT color="green">102</FONT>        }<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /**<a name="line.104"></a>
+<FONT color="green">105</FONT>         * Returns a copy of coefficients in Newton form formula.<a name="line.105"></a>
+<FONT color="green">106</FONT>         * &lt;p&gt;<a name="line.106"></a>
+<FONT color="green">107</FONT>         * Changes made to the returned copy will not affect the polynomial.&lt;/p&gt;<a name="line.107"></a>
+<FONT color="green">108</FONT>         *<a name="line.108"></a>
+<FONT color="green">109</FONT>         * @return a fresh copy of coefficients in Newton form formula<a name="line.109"></a>
+<FONT color="green">110</FONT>         */<a name="line.110"></a>
+<FONT color="green">111</FONT>        public double[] getNewtonCoefficients() {<a name="line.111"></a>
+<FONT color="green">112</FONT>            double[] out = new double[a.length];<a name="line.112"></a>
+<FONT color="green">113</FONT>            System.arraycopy(a, 0, out, 0, a.length);<a name="line.113"></a>
+<FONT color="green">114</FONT>            return out;<a name="line.114"></a>
+<FONT color="green">115</FONT>        }<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>        /**<a name="line.117"></a>
+<FONT color="green">118</FONT>         * Returns a copy of the centers array.<a name="line.118"></a>
+<FONT color="green">119</FONT>         * &lt;p&gt;<a name="line.119"></a>
+<FONT color="green">120</FONT>         * Changes made to the returned copy will not affect the polynomial.&lt;/p&gt;<a name="line.120"></a>
+<FONT color="green">121</FONT>         *<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @return a fresh copy of the centers array<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        public double[] getCenters() {<a name="line.124"></a>
+<FONT color="green">125</FONT>            double[] out = new double[c.length];<a name="line.125"></a>
+<FONT color="green">126</FONT>            System.arraycopy(c, 0, out, 0, c.length);<a name="line.126"></a>
+<FONT color="green">127</FONT>            return out;<a name="line.127"></a>
+<FONT color="green">128</FONT>        }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /**<a name="line.130"></a>
+<FONT color="green">131</FONT>         * Returns a copy of the coefficients array.<a name="line.131"></a>
+<FONT color="green">132</FONT>         * &lt;p&gt;<a name="line.132"></a>
+<FONT color="green">133</FONT>         * Changes made to the returned copy will not affect the polynomial.&lt;/p&gt;<a name="line.133"></a>
+<FONT color="green">134</FONT>         *<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @return a fresh copy of the coefficients array<a name="line.135"></a>
+<FONT color="green">136</FONT>         */<a name="line.136"></a>
+<FONT color="green">137</FONT>        public double[] getCoefficients() {<a name="line.137"></a>
+<FONT color="green">138</FONT>            if (!coefficientsComputed) {<a name="line.138"></a>
+<FONT color="green">139</FONT>                computeCoefficients();<a name="line.139"></a>
+<FONT color="green">140</FONT>            }<a name="line.140"></a>
+<FONT color="green">141</FONT>            double[] out = new double[coefficients.length];<a name="line.141"></a>
+<FONT color="green">142</FONT>            System.arraycopy(coefficients, 0, out, 0, coefficients.length);<a name="line.142"></a>
+<FONT color="green">143</FONT>            return out;<a name="line.143"></a>
+<FONT color="green">144</FONT>        }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>        /**<a name="line.146"></a>
+<FONT color="green">147</FONT>         * Evaluate the Newton polynomial using nested multiplication. It is<a name="line.147"></a>
+<FONT color="green">148</FONT>         * also called &lt;a href="http://mathworld.wolfram.com/HornersRule.html"&gt;<a name="line.148"></a>
+<FONT color="green">149</FONT>         * Horner's Rule&lt;/a&gt; and takes O(N) time.<a name="line.149"></a>
+<FONT color="green">150</FONT>         *<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @param a the coefficients in Newton form formula<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @param c the centers<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @param z the point at which the function value is to be computed<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @return the function value<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @throws FunctionEvaluationException if a runtime error occurs<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @throws IllegalArgumentException if inputs are not valid<a name="line.156"></a>
+<FONT color="green">157</FONT>         */<a name="line.157"></a>
+<FONT color="green">158</FONT>        public static double evaluate(double a[], double c[], double z) throws<a name="line.158"></a>
+<FONT color="green">159</FONT>            FunctionEvaluationException, IllegalArgumentException {<a name="line.159"></a>
+<FONT color="green">160</FONT>    <a name="line.160"></a>
+<FONT color="green">161</FONT>            verifyInputArray(a, c);<a name="line.161"></a>
+<FONT color="green">162</FONT>    <a name="line.162"></a>
+<FONT color="green">163</FONT>            int n = c.length;<a name="line.163"></a>
+<FONT color="green">164</FONT>            double value = a[n];<a name="line.164"></a>
+<FONT color="green">165</FONT>            for (int i = n-1; i &gt;= 0; i--) {<a name="line.165"></a>
+<FONT color="green">166</FONT>                value = a[i] + (z - c[i]) * value;<a name="line.166"></a>
+<FONT color="green">167</FONT>            }<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>            return value;<a name="line.169"></a>
+<FONT color="green">170</FONT>        }<a name="line.170"></a>
+<FONT color="green">171</FONT>    <a name="line.171"></a>
+<FONT color="green">172</FONT>        /**<a name="line.172"></a>
+<FONT color="green">173</FONT>         * Calculate the normal polynomial coefficients given the Newton form.<a name="line.173"></a>
+<FONT color="green">174</FONT>         * It also uses nested multiplication but takes O(N^2) time.<a name="line.174"></a>
+<FONT color="green">175</FONT>         */<a name="line.175"></a>
+<FONT color="green">176</FONT>        protected void computeCoefficients() {<a name="line.176"></a>
+<FONT color="green">177</FONT>            final int n = degree();<a name="line.177"></a>
+<FONT color="green">178</FONT>    <a name="line.178"></a>
+<FONT color="green">179</FONT>            coefficients = new double[n+1];<a name="line.179"></a>
+<FONT color="green">180</FONT>            for (int i = 0; i &lt;= n; i++) {<a name="line.180"></a>
+<FONT color="green">181</FONT>                coefficients[i] = 0.0;<a name="line.181"></a>
+<FONT color="green">182</FONT>            }<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>            coefficients[0] = a[n];<a name="line.184"></a>
+<FONT color="green">185</FONT>            for (int i = n-1; i &gt;= 0; i--) {<a name="line.185"></a>
+<FONT color="green">186</FONT>                for (int j = n-i; j &gt; 0; j--) {<a name="line.186"></a>
+<FONT color="green">187</FONT>                    coefficients[j] = coefficients[j-1] - c[i] * coefficients[j];<a name="line.187"></a>
+<FONT color="green">188</FONT>                }<a name="line.188"></a>
+<FONT color="green">189</FONT>                coefficients[0] = a[i] - c[i] * coefficients[0];<a name="line.189"></a>
+<FONT color="green">190</FONT>            }<a name="line.190"></a>
+<FONT color="green">191</FONT>    <a name="line.191"></a>
+<FONT color="green">192</FONT>            coefficientsComputed = true;<a name="line.192"></a>
+<FONT color="green">193</FONT>        }<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>        /**<a name="line.195"></a>
+<FONT color="green">196</FONT>         * Verifies that the input arrays are valid.<a name="line.196"></a>
+<FONT color="green">197</FONT>         * &lt;p&gt;<a name="line.197"></a>
+<FONT color="green">198</FONT>         * The centers must be distinct for interpolation purposes, but not<a name="line.198"></a>
+<FONT color="green">199</FONT>         * for general use. Thus it is not verified here.&lt;/p&gt;<a name="line.199"></a>
+<FONT color="green">200</FONT>         *<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @param a the coefficients in Newton form formula<a name="line.201"></a>
+<FONT color="green">202</FONT>         * @param c the centers<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @throws IllegalArgumentException if not valid<a name="line.203"></a>
+<FONT color="green">204</FONT>         * @see org.apache.commons.math.analysis.interpolation.DividedDifferenceInterpolator#computeDividedDifference(double[],<a name="line.204"></a>
+<FONT color="green">205</FONT>         * double[])<a name="line.205"></a>
+<FONT color="green">206</FONT>         */<a name="line.206"></a>
+<FONT color="green">207</FONT>        protected static void verifyInputArray(double a[], double c[]) throws<a name="line.207"></a>
+<FONT color="green">208</FONT>            IllegalArgumentException {<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>            if (a.length &lt; 1 || c.length &lt; 1) {<a name="line.210"></a>
+<FONT color="green">211</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.211"></a>
+<FONT color="green">212</FONT>                      "empty polynomials coefficients array");<a name="line.212"></a>
+<FONT color="green">213</FONT>            }<a name="line.213"></a>
+<FONT color="green">214</FONT>            if (a.length != c.length + 1) {<a name="line.214"></a>
+<FONT color="green">215</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.215"></a>
+<FONT color="green">216</FONT>                      "array sizes should have difference 1 ({0} != {1} + 1)",<a name="line.216"></a>
+<FONT color="green">217</FONT>                      a.length, c.length);<a name="line.217"></a>
+<FONT color="green">218</FONT>            }<a name="line.218"></a>
+<FONT color="green">219</FONT>        }<a name="line.219"></a>
+<FONT color="green">220</FONT>    }<a name="line.220"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,293 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.polynomials;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.Arrays;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.ArgumentOutsideDomainException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.analysis.DifferentiableUnivariateRealFunction;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Represents a polynomial spline function.<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * A &lt;strong&gt;polynomial spline function&lt;/strong&gt; consists of a set of<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;i&gt;interpolating polynomials&lt;/i&gt; and an ascending array of domain<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;i&gt;knot points&lt;/i&gt;, determining the intervals over which the spline function<a name="line.31"></a>
+<FONT color="green">032</FONT>     * is defined by the constituent polynomials.  The polynomials are assumed to<a name="line.32"></a>
+<FONT color="green">033</FONT>     * have been computed to match the values of another function at the knot<a name="line.33"></a>
+<FONT color="green">034</FONT>     * points.  The value consistency constraints are not currently enforced by<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;code&gt;PolynomialSplineFunction&lt;/code&gt; itself, but are assumed to hold among<a name="line.35"></a>
+<FONT color="green">036</FONT>     * the polynomials and knot points passed to the constructor.&lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * N.B.:  The polynomials in the &lt;code&gt;polynomials&lt;/code&gt; property must be<a name="line.38"></a>
+<FONT color="green">039</FONT>     * centered on the knot points to compute the spline function values.<a name="line.39"></a>
+<FONT color="green">040</FONT>     * See below.&lt;/p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;p&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * The domain of the polynomial spline function is<a name="line.42"></a>
+<FONT color="green">043</FONT>     * &lt;code&gt;[smallest knot, largest knot]&lt;/code&gt;.  Attempts to evaluate the<a name="line.43"></a>
+<FONT color="green">044</FONT>     * function at values outside of this range generate IllegalArgumentExceptions.<a name="line.44"></a>
+<FONT color="green">045</FONT>     * &lt;/p&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     * &lt;p&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     * The value of the polynomial spline function for an argument &lt;code&gt;x&lt;/code&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     * is computed as follows:<a name="line.48"></a>
+<FONT color="green">049</FONT>     * &lt;ol&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     * &lt;li&gt;The knot array is searched to find the segment to which &lt;code&gt;x&lt;/code&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>     * belongs.  If &lt;code&gt;x&lt;/code&gt; is less than the smallest knot point or greater<a name="line.51"></a>
+<FONT color="green">052</FONT>     * than the largest one, an &lt;code&gt;IllegalArgumentException&lt;/code&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>     * is thrown.&lt;/li&gt;<a name="line.53"></a>
+<FONT color="green">054</FONT>     * &lt;li&gt; Let &lt;code&gt;j&lt;/code&gt; be the index of the largest knot point that is less<a name="line.54"></a>
+<FONT color="green">055</FONT>     * than or equal to &lt;code&gt;x&lt;/code&gt;.  The value returned is &lt;br&gt;<a name="line.55"></a>
+<FONT color="green">056</FONT>     * &lt;code&gt;polynomials[j](x - knot[j])&lt;/code&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>     *<a name="line.57"></a>
+<FONT color="green">058</FONT>     * @version $Revision: 922708 $ $Date: 2010-03-13 20:15:47 -0500 (Sat, 13 Mar 2010) $<a name="line.58"></a>
+<FONT color="green">059</FONT>     */<a name="line.59"></a>
+<FONT color="green">060</FONT>    public class PolynomialSplineFunction<a name="line.60"></a>
+<FONT color="green">061</FONT>        implements DifferentiableUnivariateRealFunction {<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /** Spline segment interval delimiters (knots).   Size is n+1 for n segments. */<a name="line.63"></a>
+<FONT color="green">064</FONT>        private final double knots[];<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /**<a name="line.66"></a>
+<FONT color="green">067</FONT>         * The polynomial functions that make up the spline.  The first element<a name="line.67"></a>
+<FONT color="green">068</FONT>         * determines the value of the spline over the first subinterval, the<a name="line.68"></a>
+<FONT color="green">069</FONT>         * second over the second, etc.   Spline function values are determined by<a name="line.69"></a>
+<FONT color="green">070</FONT>         * evaluating these functions at &lt;code&gt;(x - knot[i])&lt;/code&gt; where i is the<a name="line.70"></a>
+<FONT color="green">071</FONT>         * knot segment to which x belongs.<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        private final PolynomialFunction polynomials[];<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /**<a name="line.75"></a>
+<FONT color="green">076</FONT>         * Number of spline segments = number of polynomials<a name="line.76"></a>
+<FONT color="green">077</FONT>         *  = number of partition points - 1<a name="line.77"></a>
+<FONT color="green">078</FONT>         */<a name="line.78"></a>
+<FONT color="green">079</FONT>        private final int n;<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>        /**<a name="line.82"></a>
+<FONT color="green">083</FONT>         * Construct a polynomial spline function with the given segment delimiters<a name="line.83"></a>
+<FONT color="green">084</FONT>         * and interpolating polynomials.<a name="line.84"></a>
+<FONT color="green">085</FONT>         * &lt;p&gt;<a name="line.85"></a>
+<FONT color="green">086</FONT>         * The constructor copies both arrays and assigns the copies to the knots<a name="line.86"></a>
+<FONT color="green">087</FONT>         * and polynomials properties, respectively.&lt;/p&gt;<a name="line.87"></a>
+<FONT color="green">088</FONT>         *<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @param knots spline segment interval delimiters<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @param polynomials polynomial functions that make up the spline<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @throws NullPointerException if either of the input arrays is null<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @throws IllegalArgumentException if knots has length less than 2,<a name="line.92"></a>
+<FONT color="green">093</FONT>         * &lt;code&gt;polynomials.length != knots.length - 1 &lt;/code&gt;, or the knots array<a name="line.93"></a>
+<FONT color="green">094</FONT>         * is not strictly increasing.<a name="line.94"></a>
+<FONT color="green">095</FONT>         *<a name="line.95"></a>
+<FONT color="green">096</FONT>         */<a name="line.96"></a>
+<FONT color="green">097</FONT>        public PolynomialSplineFunction(double knots[], PolynomialFunction polynomials[]) {<a name="line.97"></a>
+<FONT color="green">098</FONT>            if (knots.length &lt; 2) {<a name="line.98"></a>
+<FONT color="green">099</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.99"></a>
+<FONT color="green">100</FONT>                      "spline partition must have at least {0} points, got {1}",<a name="line.100"></a>
+<FONT color="green">101</FONT>                      2, knots.length);<a name="line.101"></a>
+<FONT color="green">102</FONT>            }<a name="line.102"></a>
+<FONT color="green">103</FONT>            if (knots.length - 1 != polynomials.length) {<a name="line.103"></a>
+<FONT color="green">104</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.104"></a>
+<FONT color="green">105</FONT>                      "number of polynomial interpolants must match the number of segments ({0} != {1} - 1)",<a name="line.105"></a>
+<FONT color="green">106</FONT>                      polynomials.length, knots.length);<a name="line.106"></a>
+<FONT color="green">107</FONT>            }<a name="line.107"></a>
+<FONT color="green">108</FONT>            if (!isStrictlyIncreasing(knots)) {<a name="line.108"></a>
+<FONT color="green">109</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.109"></a>
+<FONT color="green">110</FONT>                      "knot values must be strictly increasing");<a name="line.110"></a>
+<FONT color="green">111</FONT>            }<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>            this.n = knots.length -1;<a name="line.113"></a>
+<FONT color="green">114</FONT>            this.knots = new double[n + 1];<a name="line.114"></a>
+<FONT color="green">115</FONT>            System.arraycopy(knots, 0, this.knots, 0, n + 1);<a name="line.115"></a>
+<FONT color="green">116</FONT>            this.polynomials = new PolynomialFunction[n];<a name="line.116"></a>
+<FONT color="green">117</FONT>            System.arraycopy(polynomials, 0, this.polynomials, 0, n);<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /**<a name="line.120"></a>
+<FONT color="green">121</FONT>         * Compute the value for the function.<a name="line.121"></a>
+<FONT color="green">122</FONT>         * &lt;p&gt;<a name="line.122"></a>
+<FONT color="green">123</FONT>         * Throws FunctionEvaluationException if v is outside of the domain of the<a name="line.123"></a>
+<FONT color="green">124</FONT>         * function.  The domain is [smallest knot, largest knot].&lt;/p&gt;<a name="line.124"></a>
+<FONT color="green">125</FONT>         * &lt;p&gt;<a name="line.125"></a>
+<FONT color="green">126</FONT>         * See {@link PolynomialSplineFunction} for details on the algorithm for<a name="line.126"></a>
+<FONT color="green">127</FONT>         * computing the value of the function.&lt;/p&gt;<a name="line.127"></a>
+<FONT color="green">128</FONT>         *<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @param v the point for which the function value should be computed<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @return the value<a name="line.130"></a>
+<FONT color="green">131</FONT>         * @throws ArgumentOutsideDomainException if v is outside of the domain of<a name="line.131"></a>
+<FONT color="green">132</FONT>         * of the spline function (less than the smallest knot point or greater<a name="line.132"></a>
+<FONT color="green">133</FONT>         * than the largest knot point)<a name="line.133"></a>
+<FONT color="green">134</FONT>         */<a name="line.134"></a>
+<FONT color="green">135</FONT>        public double value(double v) throws ArgumentOutsideDomainException {<a name="line.135"></a>
+<FONT color="green">136</FONT>            if (v &lt; knots[0] || v &gt; knots[n]) {<a name="line.136"></a>
+<FONT color="green">137</FONT>                throw new ArgumentOutsideDomainException(v, knots[0], knots[n]);<a name="line.137"></a>
+<FONT color="green">138</FONT>            }<a name="line.138"></a>
+<FONT color="green">139</FONT>            int i = Arrays.binarySearch(knots, v);<a name="line.139"></a>
+<FONT color="green">140</FONT>            if (i &lt; 0) {<a name="line.140"></a>
+<FONT color="green">141</FONT>                i = -i - 2;<a name="line.141"></a>
+<FONT color="green">142</FONT>            }<a name="line.142"></a>
+<FONT color="green">143</FONT>            //This will handle the case where v is the last knot value<a name="line.143"></a>
+<FONT color="green">144</FONT>            //There are only n-1 polynomials, so if v is the last knot<a name="line.144"></a>
+<FONT color="green">145</FONT>            //then we will use the last polynomial to calculate the value.<a name="line.145"></a>
+<FONT color="green">146</FONT>            if ( i &gt;= polynomials.length ) {<a name="line.146"></a>
+<FONT color="green">147</FONT>                i--;<a name="line.147"></a>
+<FONT color="green">148</FONT>            }<a name="line.148"></a>
+<FONT color="green">149</FONT>            return polynomials[i].value(v - knots[i]);<a name="line.149"></a>
+<FONT color="green">150</FONT>        }<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>        /**<a name="line.152"></a>
+<FONT color="green">153</FONT>         * Returns the derivative of the polynomial spline function as a UnivariateRealFunction<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @return  the derivative function<a name="line.154"></a>
+<FONT color="green">155</FONT>         */<a name="line.155"></a>
+<FONT color="green">156</FONT>        public UnivariateRealFunction derivative() {<a name="line.156"></a>
+<FONT color="green">157</FONT>            return polynomialSplineDerivative();<a name="line.157"></a>
+<FONT color="green">158</FONT>        }<a name="line.158"></a>
+<FONT color="green">159</FONT>    <a name="line.159"></a>
+<FONT color="green">160</FONT>        /**<a name="line.160"></a>
+<FONT color="green">161</FONT>         * Returns the derivative of the polynomial spline function as a PolynomialSplineFunction<a name="line.161"></a>
+<FONT color="green">162</FONT>         *<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @return  the derivative function<a name="line.163"></a>
+<FONT color="green">164</FONT>         */<a name="line.164"></a>
+<FONT color="green">165</FONT>        public PolynomialSplineFunction polynomialSplineDerivative() {<a name="line.165"></a>
+<FONT color="green">166</FONT>            PolynomialFunction derivativePolynomials[] = new PolynomialFunction[n];<a name="line.166"></a>
+<FONT color="green">167</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.167"></a>
+<FONT color="green">168</FONT>                derivativePolynomials[i] = polynomials[i].polynomialDerivative();<a name="line.168"></a>
+<FONT color="green">169</FONT>            }<a name="line.169"></a>
+<FONT color="green">170</FONT>            return new PolynomialSplineFunction(knots, derivativePolynomials);<a name="line.170"></a>
+<FONT color="green">171</FONT>        }<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>        /**<a name="line.173"></a>
+<FONT color="green">174</FONT>         * Returns the number of spline segments = the number of polynomials<a name="line.174"></a>
+<FONT color="green">175</FONT>         * = the number of knot points - 1.<a name="line.175"></a>
+<FONT color="green">176</FONT>         *<a name="line.176"></a>
+<FONT color="green">177</FONT>         * @return the number of spline segments<a name="line.177"></a>
+<FONT color="green">178</FONT>         */<a name="line.178"></a>
+<FONT color="green">179</FONT>        public int getN() {<a name="line.179"></a>
+<FONT color="green">180</FONT>            return n;<a name="line.180"></a>
+<FONT color="green">181</FONT>        }<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>        /**<a name="line.183"></a>
+<FONT color="green">184</FONT>         * Returns a copy of the interpolating polynomials array.<a name="line.184"></a>
+<FONT color="green">185</FONT>         * &lt;p&gt;<a name="line.185"></a>
+<FONT color="green">186</FONT>         * Returns a fresh copy of the array. Changes made to the copy will<a name="line.186"></a>
+<FONT color="green">187</FONT>         * not affect the polynomials property.&lt;/p&gt;<a name="line.187"></a>
+<FONT color="green">188</FONT>         *<a name="line.188"></a>
+<FONT color="green">189</FONT>         * @return the interpolating polynomials<a name="line.189"></a>
+<FONT color="green">190</FONT>         */<a name="line.190"></a>
+<FONT color="green">191</FONT>        public PolynomialFunction[] getPolynomials() {<a name="line.191"></a>
+<FONT color="green">192</FONT>            PolynomialFunction p[] = new PolynomialFunction[n];<a name="line.192"></a>
+<FONT color="green">193</FONT>            System.arraycopy(polynomials, 0, p, 0, n);<a name="line.193"></a>
+<FONT color="green">194</FONT>            return p;<a name="line.194"></a>
+<FONT color="green">195</FONT>        }<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>        /**<a name="line.197"></a>
+<FONT color="green">198</FONT>         * Returns an array copy of the knot points.<a name="line.198"></a>
+<FONT color="green">199</FONT>         * &lt;p&gt;<a name="line.199"></a>
+<FONT color="green">200</FONT>         * Returns a fresh copy of the array. Changes made to the copy<a name="line.200"></a>
+<FONT color="green">201</FONT>         * will not affect the knots property.&lt;/p&gt;<a name="line.201"></a>
+<FONT color="green">202</FONT>         *<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @return the knot points<a name="line.203"></a>
+<FONT color="green">204</FONT>         */<a name="line.204"></a>
+<FONT color="green">205</FONT>        public double[] getKnots() {<a name="line.205"></a>
+<FONT color="green">206</FONT>            double out[] = new double[n + 1];<a name="line.206"></a>
+<FONT color="green">207</FONT>            System.arraycopy(knots, 0, out, 0, n + 1);<a name="line.207"></a>
+<FONT color="green">208</FONT>            return out;<a name="line.208"></a>
+<FONT color="green">209</FONT>        }<a name="line.209"></a>
+<FONT color="green">210</FONT>    <a name="line.210"></a>
+<FONT color="green">211</FONT>        /**<a name="line.211"></a>
+<FONT color="green">212</FONT>         * Determines if the given array is ordered in a strictly increasing<a name="line.212"></a>
+<FONT color="green">213</FONT>         * fashion.<a name="line.213"></a>
+<FONT color="green">214</FONT>         *<a name="line.214"></a>
+<FONT color="green">215</FONT>         * @param x the array to examine.<a name="line.215"></a>
+<FONT color="green">216</FONT>         * @return &lt;code&gt;true&lt;/code&gt; if the elements in &lt;code&gt;x&lt;/code&gt; are ordered<a name="line.216"></a>
+<FONT color="green">217</FONT>         * in a stricly increasing manner.  &lt;code&gt;false&lt;/code&gt;, otherwise.<a name="line.217"></a>
+<FONT color="green">218</FONT>         */<a name="line.218"></a>
+<FONT color="green">219</FONT>        private static boolean isStrictlyIncreasing(double[] x) {<a name="line.219"></a>
+<FONT color="green">220</FONT>            for (int i = 1; i &lt; x.length; ++i) {<a name="line.220"></a>
+<FONT color="green">221</FONT>                if (x[i - 1] &gt;= x[i]) {<a name="line.221"></a>
+<FONT color="green">222</FONT>                    return false;<a name="line.222"></a>
+<FONT color="green">223</FONT>                }<a name="line.223"></a>
+<FONT color="green">224</FONT>            }<a name="line.224"></a>
+<FONT color="green">225</FONT>            return true;<a name="line.225"></a>
+<FONT color="green">226</FONT>        }<a name="line.226"></a>
+<FONT color="green">227</FONT>    }<a name="line.227"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/polynomials/PolynomialsUtils.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,346 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.polynomials;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.ArrayList;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.fraction.BigFraction;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * A collection of static methods that operate on or return polynomials.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @since 2.0<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public class PolynomialsUtils {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /** Coefficients for Chebyshev polynomials. */<a name="line.31"></a>
+<FONT color="green">032</FONT>        private static final ArrayList&lt;BigFraction&gt; CHEBYSHEV_COEFFICIENTS;<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /** Coefficients for Hermite polynomials. */<a name="line.34"></a>
+<FONT color="green">035</FONT>        private static final ArrayList&lt;BigFraction&gt; HERMITE_COEFFICIENTS;<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /** Coefficients for Laguerre polynomials. */<a name="line.37"></a>
+<FONT color="green">038</FONT>        private static final ArrayList&lt;BigFraction&gt; LAGUERRE_COEFFICIENTS;<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Coefficients for Legendre polynomials. */<a name="line.40"></a>
+<FONT color="green">041</FONT>        private static final ArrayList&lt;BigFraction&gt; LEGENDRE_COEFFICIENTS;<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        static {<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>            // initialize recurrence for Chebyshev polynomials<a name="line.45"></a>
+<FONT color="green">046</FONT>            // T0(X) = 1, T1(X) = 0 + 1 * X<a name="line.46"></a>
+<FONT color="green">047</FONT>            CHEBYSHEV_COEFFICIENTS = new ArrayList&lt;BigFraction&gt;();<a name="line.47"></a>
+<FONT color="green">048</FONT>            CHEBYSHEV_COEFFICIENTS.add(BigFraction.ONE);<a name="line.48"></a>
+<FONT color="green">049</FONT>            CHEBYSHEV_COEFFICIENTS.add(BigFraction.ZERO);<a name="line.49"></a>
+<FONT color="green">050</FONT>            CHEBYSHEV_COEFFICIENTS.add(BigFraction.ONE);<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>            // initialize recurrence for Hermite polynomials<a name="line.52"></a>
+<FONT color="green">053</FONT>            // H0(X) = 1, H1(X) = 0 + 2 * X<a name="line.53"></a>
+<FONT color="green">054</FONT>            HERMITE_COEFFICIENTS = new ArrayList&lt;BigFraction&gt;();<a name="line.54"></a>
+<FONT color="green">055</FONT>            HERMITE_COEFFICIENTS.add(BigFraction.ONE);<a name="line.55"></a>
+<FONT color="green">056</FONT>            HERMITE_COEFFICIENTS.add(BigFraction.ZERO);<a name="line.56"></a>
+<FONT color="green">057</FONT>            HERMITE_COEFFICIENTS.add(BigFraction.TWO);<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>            // initialize recurrence for Laguerre polynomials<a name="line.59"></a>
+<FONT color="green">060</FONT>            // L0(X) = 1, L1(X) = 1 - 1 * X<a name="line.60"></a>
+<FONT color="green">061</FONT>            LAGUERRE_COEFFICIENTS = new ArrayList&lt;BigFraction&gt;();<a name="line.61"></a>
+<FONT color="green">062</FONT>            LAGUERRE_COEFFICIENTS.add(BigFraction.ONE);<a name="line.62"></a>
+<FONT color="green">063</FONT>            LAGUERRE_COEFFICIENTS.add(BigFraction.ONE);<a name="line.63"></a>
+<FONT color="green">064</FONT>            LAGUERRE_COEFFICIENTS.add(BigFraction.MINUS_ONE);<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>            // initialize recurrence for Legendre polynomials<a name="line.66"></a>
+<FONT color="green">067</FONT>            // P0(X) = 1, P1(X) = 0 + 1 * X<a name="line.67"></a>
+<FONT color="green">068</FONT>            LEGENDRE_COEFFICIENTS = new ArrayList&lt;BigFraction&gt;();<a name="line.68"></a>
+<FONT color="green">069</FONT>            LEGENDRE_COEFFICIENTS.add(BigFraction.ONE);<a name="line.69"></a>
+<FONT color="green">070</FONT>            LEGENDRE_COEFFICIENTS.add(BigFraction.ZERO);<a name="line.70"></a>
+<FONT color="green">071</FONT>            LEGENDRE_COEFFICIENTS.add(BigFraction.ONE);<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        }<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /**<a name="line.75"></a>
+<FONT color="green">076</FONT>         * Private constructor, to prevent instantiation.<a name="line.76"></a>
+<FONT color="green">077</FONT>         */<a name="line.77"></a>
+<FONT color="green">078</FONT>        private PolynomialsUtils() {<a name="line.78"></a>
+<FONT color="green">079</FONT>        }<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /**<a name="line.81"></a>
+<FONT color="green">082</FONT>         * Create a Chebyshev polynomial of the first kind.<a name="line.82"></a>
+<FONT color="green">083</FONT>         * &lt;p&gt;&lt;a href="http://mathworld.wolfram.com/ChebyshevPolynomialoftheFirstKind.html"&gt;Chebyshev<a name="line.83"></a>
+<FONT color="green">084</FONT>         * polynomials of the first kind&lt;/a&gt; are orthogonal polynomials.<a name="line.84"></a>
+<FONT color="green">085</FONT>         * They can be defined by the following recurrence relations:<a name="line.85"></a>
+<FONT color="green">086</FONT>         * &lt;pre&gt;<a name="line.86"></a>
+<FONT color="green">087</FONT>         *  T&lt;sub&gt;0&lt;/sub&gt;(X)   = 1<a name="line.87"></a>
+<FONT color="green">088</FONT>         *  T&lt;sub&gt;1&lt;/sub&gt;(X)   = X<a name="line.88"></a>
+<FONT color="green">089</FONT>         *  T&lt;sub&gt;k+1&lt;/sub&gt;(X) = 2X T&lt;sub&gt;k&lt;/sub&gt;(X) - T&lt;sub&gt;k-1&lt;/sub&gt;(X)<a name="line.89"></a>
+<FONT color="green">090</FONT>         * &lt;/pre&gt;&lt;/p&gt;<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @param degree degree of the polynomial<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @return Chebyshev polynomial of specified degree<a name="line.92"></a>
+<FONT color="green">093</FONT>         */<a name="line.93"></a>
+<FONT color="green">094</FONT>        public static PolynomialFunction createChebyshevPolynomial(final int degree) {<a name="line.94"></a>
+<FONT color="green">095</FONT>            return buildPolynomial(degree, CHEBYSHEV_COEFFICIENTS,<a name="line.95"></a>
+<FONT color="green">096</FONT>                    new RecurrenceCoefficientsGenerator() {<a name="line.96"></a>
+<FONT color="green">097</FONT>                private final BigFraction[] coeffs = { BigFraction.ZERO, BigFraction.TWO, BigFraction.ONE };<a name="line.97"></a>
+<FONT color="green">098</FONT>                /** {@inheritDoc} */<a name="line.98"></a>
+<FONT color="green">099</FONT>                public BigFraction[] generate(int k) {<a name="line.99"></a>
+<FONT color="green">100</FONT>                    return coeffs;<a name="line.100"></a>
+<FONT color="green">101</FONT>                }<a name="line.101"></a>
+<FONT color="green">102</FONT>            });<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /**<a name="line.105"></a>
+<FONT color="green">106</FONT>         * Create a Hermite polynomial.<a name="line.106"></a>
+<FONT color="green">107</FONT>         * &lt;p&gt;&lt;a href="http://mathworld.wolfram.com/HermitePolynomial.html"&gt;Hermite<a name="line.107"></a>
+<FONT color="green">108</FONT>         * polynomials&lt;/a&gt; are orthogonal polynomials.<a name="line.108"></a>
+<FONT color="green">109</FONT>         * They can be defined by the following recurrence relations:<a name="line.109"></a>
+<FONT color="green">110</FONT>         * &lt;pre&gt;<a name="line.110"></a>
+<FONT color="green">111</FONT>         *  H&lt;sub&gt;0&lt;/sub&gt;(X)   = 1<a name="line.111"></a>
+<FONT color="green">112</FONT>         *  H&lt;sub&gt;1&lt;/sub&gt;(X)   = 2X<a name="line.112"></a>
+<FONT color="green">113</FONT>         *  H&lt;sub&gt;k+1&lt;/sub&gt;(X) = 2X H&lt;sub&gt;k&lt;/sub&gt;(X) - 2k H&lt;sub&gt;k-1&lt;/sub&gt;(X)<a name="line.113"></a>
+<FONT color="green">114</FONT>         * &lt;/pre&gt;&lt;/p&gt;<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>         * @param degree degree of the polynomial<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @return Hermite polynomial of specified degree<a name="line.117"></a>
+<FONT color="green">118</FONT>         */<a name="line.118"></a>
+<FONT color="green">119</FONT>        public static PolynomialFunction createHermitePolynomial(final int degree) {<a name="line.119"></a>
+<FONT color="green">120</FONT>            return buildPolynomial(degree, HERMITE_COEFFICIENTS,<a name="line.120"></a>
+<FONT color="green">121</FONT>                    new RecurrenceCoefficientsGenerator() {<a name="line.121"></a>
+<FONT color="green">122</FONT>                /** {@inheritDoc} */<a name="line.122"></a>
+<FONT color="green">123</FONT>                public BigFraction[] generate(int k) {<a name="line.123"></a>
+<FONT color="green">124</FONT>                    return new BigFraction[] {<a name="line.124"></a>
+<FONT color="green">125</FONT>                            BigFraction.ZERO,<a name="line.125"></a>
+<FONT color="green">126</FONT>                            BigFraction.TWO,<a name="line.126"></a>
+<FONT color="green">127</FONT>                            new BigFraction(2 * k)};<a name="line.127"></a>
+<FONT color="green">128</FONT>                }<a name="line.128"></a>
+<FONT color="green">129</FONT>            });<a name="line.129"></a>
+<FONT color="green">130</FONT>        }<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>        /**<a name="line.132"></a>
+<FONT color="green">133</FONT>         * Create a Laguerre polynomial.<a name="line.133"></a>
+<FONT color="green">134</FONT>         * &lt;p&gt;&lt;a href="http://mathworld.wolfram.com/LaguerrePolynomial.html"&gt;Laguerre<a name="line.134"></a>
+<FONT color="green">135</FONT>         * polynomials&lt;/a&gt; are orthogonal polynomials.<a name="line.135"></a>
+<FONT color="green">136</FONT>         * They can be defined by the following recurrence relations:<a name="line.136"></a>
+<FONT color="green">137</FONT>         * &lt;pre&gt;<a name="line.137"></a>
+<FONT color="green">138</FONT>         *        L&lt;sub&gt;0&lt;/sub&gt;(X)   = 1<a name="line.138"></a>
+<FONT color="green">139</FONT>         *        L&lt;sub&gt;1&lt;/sub&gt;(X)   = 1 - X<a name="line.139"></a>
+<FONT color="green">140</FONT>         *  (k+1) L&lt;sub&gt;k+1&lt;/sub&gt;(X) = (2k + 1 - X) L&lt;sub&gt;k&lt;/sub&gt;(X) - k L&lt;sub&gt;k-1&lt;/sub&gt;(X)<a name="line.140"></a>
+<FONT color="green">141</FONT>         * &lt;/pre&gt;&lt;/p&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>         * @param degree degree of the polynomial<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @return Laguerre polynomial of specified degree<a name="line.143"></a>
+<FONT color="green">144</FONT>         */<a name="line.144"></a>
+<FONT color="green">145</FONT>        public static PolynomialFunction createLaguerrePolynomial(final int degree) {<a name="line.145"></a>
+<FONT color="green">146</FONT>            return buildPolynomial(degree, LAGUERRE_COEFFICIENTS,<a name="line.146"></a>
+<FONT color="green">147</FONT>                    new RecurrenceCoefficientsGenerator() {<a name="line.147"></a>
+<FONT color="green">148</FONT>                /** {@inheritDoc} */<a name="line.148"></a>
+<FONT color="green">149</FONT>                public BigFraction[] generate(int k) {<a name="line.149"></a>
+<FONT color="green">150</FONT>                    final int kP1 = k + 1;<a name="line.150"></a>
+<FONT color="green">151</FONT>                    return new BigFraction[] {<a name="line.151"></a>
+<FONT color="green">152</FONT>                            new BigFraction(2 * k + 1, kP1),<a name="line.152"></a>
+<FONT color="green">153</FONT>                            new BigFraction(-1, kP1),<a name="line.153"></a>
+<FONT color="green">154</FONT>                            new BigFraction(k, kP1)};<a name="line.154"></a>
+<FONT color="green">155</FONT>                }<a name="line.155"></a>
+<FONT color="green">156</FONT>            });<a name="line.156"></a>
+<FONT color="green">157</FONT>        }<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>        /**<a name="line.159"></a>
+<FONT color="green">160</FONT>         * Create a Legendre polynomial.<a name="line.160"></a>
+<FONT color="green">161</FONT>         * &lt;p&gt;&lt;a href="http://mathworld.wolfram.com/LegendrePolynomial.html"&gt;Legendre<a name="line.161"></a>
+<FONT color="green">162</FONT>         * polynomials&lt;/a&gt; are orthogonal polynomials.<a name="line.162"></a>
+<FONT color="green">163</FONT>         * They can be defined by the following recurrence relations:<a name="line.163"></a>
+<FONT color="green">164</FONT>         * &lt;pre&gt;<a name="line.164"></a>
+<FONT color="green">165</FONT>         *        P&lt;sub&gt;0&lt;/sub&gt;(X)   = 1<a name="line.165"></a>
+<FONT color="green">166</FONT>         *        P&lt;sub&gt;1&lt;/sub&gt;(X)   = X<a name="line.166"></a>
+<FONT color="green">167</FONT>         *  (k+1) P&lt;sub&gt;k+1&lt;/sub&gt;(X) = (2k+1) X P&lt;sub&gt;k&lt;/sub&gt;(X) - k P&lt;sub&gt;k-1&lt;/sub&gt;(X)<a name="line.167"></a>
+<FONT color="green">168</FONT>         * &lt;/pre&gt;&lt;/p&gt;<a name="line.168"></a>
+<FONT color="green">169</FONT>         * @param degree degree of the polynomial<a name="line.169"></a>
+<FONT color="green">170</FONT>         * @return Legendre polynomial of specified degree<a name="line.170"></a>
+<FONT color="green">171</FONT>         */<a name="line.171"></a>
+<FONT color="green">172</FONT>        public static PolynomialFunction createLegendrePolynomial(final int degree) {<a name="line.172"></a>
+<FONT color="green">173</FONT>            return buildPolynomial(degree, LEGENDRE_COEFFICIENTS,<a name="line.173"></a>
+<FONT color="green">174</FONT>                                   new RecurrenceCoefficientsGenerator() {<a name="line.174"></a>
+<FONT color="green">175</FONT>                /** {@inheritDoc} */<a name="line.175"></a>
+<FONT color="green">176</FONT>                public BigFraction[] generate(int k) {<a name="line.176"></a>
+<FONT color="green">177</FONT>                    final int kP1 = k + 1;<a name="line.177"></a>
+<FONT color="green">178</FONT>                    return new BigFraction[] {<a name="line.178"></a>
+<FONT color="green">179</FONT>                            BigFraction.ZERO,<a name="line.179"></a>
+<FONT color="green">180</FONT>                            new BigFraction(k + kP1, kP1),<a name="line.180"></a>
+<FONT color="green">181</FONT>                            new BigFraction(k, kP1)};<a name="line.181"></a>
+<FONT color="green">182</FONT>                }<a name="line.182"></a>
+<FONT color="green">183</FONT>            });<a name="line.183"></a>
+<FONT color="green">184</FONT>        }<a name="line.184"></a>
+<FONT color="green">185</FONT>    <a name="line.185"></a>
+<FONT color="green">186</FONT>        /** Get the coefficients array for a given degree.<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @param degree degree of the polynomial<a name="line.187"></a>
+<FONT color="green">188</FONT>         * @param coefficients list where the computed coefficients are stored<a name="line.188"></a>
+<FONT color="green">189</FONT>         * @param generator recurrence coefficients generator<a name="line.189"></a>
+<FONT color="green">190</FONT>         * @return coefficients array<a name="line.190"></a>
+<FONT color="green">191</FONT>         */<a name="line.191"></a>
+<FONT color="green">192</FONT>        private static PolynomialFunction buildPolynomial(final int degree,<a name="line.192"></a>
+<FONT color="green">193</FONT>                                                          final ArrayList&lt;BigFraction&gt; coefficients,<a name="line.193"></a>
+<FONT color="green">194</FONT>                                                          final RecurrenceCoefficientsGenerator generator) {<a name="line.194"></a>
+<FONT color="green">195</FONT>    <a name="line.195"></a>
+<FONT color="green">196</FONT>            final int maxDegree = (int) Math.floor(Math.sqrt(2 * coefficients.size())) - 1;<a name="line.196"></a>
+<FONT color="green">197</FONT>            synchronized (PolynomialsUtils.class) {<a name="line.197"></a>
+<FONT color="green">198</FONT>                if (degree &gt; maxDegree) {<a name="line.198"></a>
+<FONT color="green">199</FONT>                    computeUpToDegree(degree, maxDegree, generator, coefficients);<a name="line.199"></a>
+<FONT color="green">200</FONT>                }<a name="line.200"></a>
+<FONT color="green">201</FONT>            }<a name="line.201"></a>
+<FONT color="green">202</FONT>    <a name="line.202"></a>
+<FONT color="green">203</FONT>            // coefficient  for polynomial 0 is  l [0]<a name="line.203"></a>
+<FONT color="green">204</FONT>            // coefficients for polynomial 1 are l [1] ... l [2] (degrees 0 ... 1)<a name="line.204"></a>
+<FONT color="green">205</FONT>            // coefficients for polynomial 2 are l [3] ... l [5] (degrees 0 ... 2)<a name="line.205"></a>
+<FONT color="green">206</FONT>            // coefficients for polynomial 3 are l [6] ... l [9] (degrees 0 ... 3)<a name="line.206"></a>
+<FONT color="green">207</FONT>            // coefficients for polynomial 4 are l[10] ... l[14] (degrees 0 ... 4)<a name="line.207"></a>
+<FONT color="green">208</FONT>            // coefficients for polynomial 5 are l[15] ... l[20] (degrees 0 ... 5)<a name="line.208"></a>
+<FONT color="green">209</FONT>            // coefficients for polynomial 6 are l[21] ... l[27] (degrees 0 ... 6)<a name="line.209"></a>
+<FONT color="green">210</FONT>            // ...<a name="line.210"></a>
+<FONT color="green">211</FONT>            final int start = degree * (degree + 1) / 2;<a name="line.211"></a>
+<FONT color="green">212</FONT>    <a name="line.212"></a>
+<FONT color="green">213</FONT>            final double[] a = new double[degree + 1];<a name="line.213"></a>
+<FONT color="green">214</FONT>            for (int i = 0; i &lt;= degree; ++i) {<a name="line.214"></a>
+<FONT color="green">215</FONT>                a[i] = coefficients.get(start + i).doubleValue();<a name="line.215"></a>
+<FONT color="green">216</FONT>            }<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>            // build the polynomial<a name="line.218"></a>
+<FONT color="green">219</FONT>            return new PolynomialFunction(a);<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>        }<a name="line.221"></a>
+<FONT color="green">222</FONT>    <a name="line.222"></a>
+<FONT color="green">223</FONT>        /** Compute polynomial coefficients up to a given degree.<a name="line.223"></a>
+<FONT color="green">224</FONT>         * @param degree maximal degree<a name="line.224"></a>
+<FONT color="green">225</FONT>         * @param maxDegree current maximal degree<a name="line.225"></a>
+<FONT color="green">226</FONT>         * @param generator recurrence coefficients generator<a name="line.226"></a>
+<FONT color="green">227</FONT>         * @param coefficients list where the computed coefficients should be appended<a name="line.227"></a>
+<FONT color="green">228</FONT>         */<a name="line.228"></a>
+<FONT color="green">229</FONT>        private static void computeUpToDegree(final int degree, final int maxDegree,<a name="line.229"></a>
+<FONT color="green">230</FONT>                                              final RecurrenceCoefficientsGenerator generator,<a name="line.230"></a>
+<FONT color="green">231</FONT>                                              final ArrayList&lt;BigFraction&gt; coefficients) {<a name="line.231"></a>
+<FONT color="green">232</FONT>    <a name="line.232"></a>
+<FONT color="green">233</FONT>            int startK = (maxDegree - 1) * maxDegree / 2;<a name="line.233"></a>
+<FONT color="green">234</FONT>            for (int k = maxDegree; k &lt; degree; ++k) {<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>                // start indices of two previous polynomials Pk(X) and Pk-1(X)<a name="line.236"></a>
+<FONT color="green">237</FONT>                int startKm1 = startK;<a name="line.237"></a>
+<FONT color="green">238</FONT>                startK += k;<a name="line.238"></a>
+<FONT color="green">239</FONT>    <a name="line.239"></a>
+<FONT color="green">240</FONT>                // Pk+1(X) = (a[0] + a[1] X) Pk(X) - a[2] Pk-1(X)<a name="line.240"></a>
+<FONT color="green">241</FONT>                BigFraction[] ai = generator.generate(k);<a name="line.241"></a>
+<FONT color="green">242</FONT>    <a name="line.242"></a>
+<FONT color="green">243</FONT>                BigFraction ck     = coefficients.get(startK);<a name="line.243"></a>
+<FONT color="green">244</FONT>                BigFraction ckm1   = coefficients.get(startKm1);<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>                // degree 0 coefficient<a name="line.246"></a>
+<FONT color="green">247</FONT>                coefficients.add(ck.multiply(ai[0]).subtract(ckm1.multiply(ai[2])));<a name="line.247"></a>
+<FONT color="green">248</FONT>    <a name="line.248"></a>
+<FONT color="green">249</FONT>                // degree 1 to degree k-1 coefficients<a name="line.249"></a>
+<FONT color="green">250</FONT>                for (int i = 1; i &lt; k; ++i) {<a name="line.250"></a>
+<FONT color="green">251</FONT>                    final BigFraction ckPrev = ck;<a name="line.251"></a>
+<FONT color="green">252</FONT>                    ck     = coefficients.get(startK + i);<a name="line.252"></a>
+<FONT color="green">253</FONT>                    ckm1   = coefficients.get(startKm1 + i);<a name="line.253"></a>
+<FONT color="green">254</FONT>                    coefficients.add(ck.multiply(ai[0]).add(ckPrev.multiply(ai[1])).subtract(ckm1.multiply(ai[2])));<a name="line.254"></a>
+<FONT color="green">255</FONT>                }<a name="line.255"></a>
+<FONT color="green">256</FONT>    <a name="line.256"></a>
+<FONT color="green">257</FONT>                // degree k coefficient<a name="line.257"></a>
+<FONT color="green">258</FONT>                final BigFraction ckPrev = ck;<a name="line.258"></a>
+<FONT color="green">259</FONT>                ck = coefficients.get(startK + k);<a name="line.259"></a>
+<FONT color="green">260</FONT>                coefficients.add(ck.multiply(ai[0]).add(ckPrev.multiply(ai[1])));<a name="line.260"></a>
+<FONT color="green">261</FONT>    <a name="line.261"></a>
+<FONT color="green">262</FONT>                // degree k+1 coefficient<a name="line.262"></a>
+<FONT color="green">263</FONT>                coefficients.add(ck.multiply(ai[1]));<a name="line.263"></a>
+<FONT color="green">264</FONT>    <a name="line.264"></a>
+<FONT color="green">265</FONT>            }<a name="line.265"></a>
+<FONT color="green">266</FONT>    <a name="line.266"></a>
+<FONT color="green">267</FONT>        }<a name="line.267"></a>
+<FONT color="green">268</FONT>    <a name="line.268"></a>
+<FONT color="green">269</FONT>        /** Interface for recurrence coefficients generation. */<a name="line.269"></a>
+<FONT color="green">270</FONT>        private static interface RecurrenceCoefficientsGenerator {<a name="line.270"></a>
+<FONT color="green">271</FONT>            /**<a name="line.271"></a>
+<FONT color="green">272</FONT>             * Generate recurrence coefficients.<a name="line.272"></a>
+<FONT color="green">273</FONT>             * @param k highest degree of the polynomials used in the recurrence<a name="line.273"></a>
+<FONT color="green">274</FONT>             * @return an array of three coefficients such that<a name="line.274"></a>
+<FONT color="green">275</FONT>             * P&lt;sub&gt;k+1&lt;/sub&gt;(X) = (a[0] + a[1] X) P&lt;sub&gt;k&lt;/sub&gt;(X) - a[2] P&lt;sub&gt;k-1&lt;/sub&gt;(X)<a name="line.275"></a>
+<FONT color="green">276</FONT>             */<a name="line.276"></a>
+<FONT color="green">277</FONT>            BigFraction[] generate(int k);<a name="line.277"></a>
+<FONT color="green">278</FONT>        }<a name="line.278"></a>
+<FONT color="green">279</FONT>    <a name="line.279"></a>
+<FONT color="green">280</FONT>    }<a name="line.280"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/BisectionSolver.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,175 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.solvers;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Implements the &lt;a href="http://mathworld.wolfram.com/Bisection.html"&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * bisection algorithm&lt;/a&gt; for finding zeros of univariate real functions.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * The function should be continuous but not necessarily smooth.&lt;/p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.29"></a>
+<FONT color="green">030</FONT>     */<a name="line.30"></a>
+<FONT color="green">031</FONT>    public class BisectionSolver extends UnivariateRealSolverImpl {<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /**<a name="line.33"></a>
+<FONT color="green">034</FONT>         * Construct a solver for the given function.<a name="line.34"></a>
+<FONT color="green">035</FONT>         *<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @param f function to solve.<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @deprecated as of 2.0 the function to solve is passed as an argument<a name="line.37"></a>
+<FONT color="green">038</FONT>         * to the {@link #solve(UnivariateRealFunction, double, double)} or<a name="line.38"></a>
+<FONT color="green">039</FONT>         * {@link UnivariateRealSolverImpl#solve(UnivariateRealFunction, double, double, double)}<a name="line.39"></a>
+<FONT color="green">040</FONT>         * method.<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        @Deprecated<a name="line.42"></a>
+<FONT color="green">043</FONT>        public BisectionSolver(UnivariateRealFunction f) {<a name="line.43"></a>
+<FONT color="green">044</FONT>            super(f, 100, 1E-6);<a name="line.44"></a>
+<FONT color="green">045</FONT>        }<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Construct a solver.<a name="line.48"></a>
+<FONT color="green">049</FONT>         *<a name="line.49"></a>
+<FONT color="green">050</FONT>         */<a name="line.50"></a>
+<FONT color="green">051</FONT>        public BisectionSolver() {<a name="line.51"></a>
+<FONT color="green">052</FONT>            super(100, 1E-6);<a name="line.52"></a>
+<FONT color="green">053</FONT>        }<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** {@inheritDoc} */<a name="line.55"></a>
+<FONT color="green">056</FONT>        @Deprecated<a name="line.56"></a>
+<FONT color="green">057</FONT>        public double solve(double min, double max, double initial)<a name="line.57"></a>
+<FONT color="green">058</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.58"></a>
+<FONT color="green">059</FONT>            return solve(f, min, max);<a name="line.59"></a>
+<FONT color="green">060</FONT>        }<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** {@inheritDoc} */<a name="line.62"></a>
+<FONT color="green">063</FONT>        @Deprecated<a name="line.63"></a>
+<FONT color="green">064</FONT>        public double solve(double min, double max)<a name="line.64"></a>
+<FONT color="green">065</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.65"></a>
+<FONT color="green">066</FONT>            return solve(f, min, max);<a name="line.66"></a>
+<FONT color="green">067</FONT>        }<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /** {@inheritDoc} */<a name="line.69"></a>
+<FONT color="green">070</FONT>        public double solve(final UnivariateRealFunction f, double min, double max, double initial)<a name="line.70"></a>
+<FONT color="green">071</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.71"></a>
+<FONT color="green">072</FONT>            return solve(min, max);<a name="line.72"></a>
+<FONT color="green">073</FONT>        }<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /** {@inheritDoc} */<a name="line.75"></a>
+<FONT color="green">076</FONT>        public double solve(final UnivariateRealFunction f, double min, double max)<a name="line.76"></a>
+<FONT color="green">077</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>            clearResult();<a name="line.79"></a>
+<FONT color="green">080</FONT>            verifyInterval(min,max);<a name="line.80"></a>
+<FONT color="green">081</FONT>            double m;<a name="line.81"></a>
+<FONT color="green">082</FONT>            double fm;<a name="line.82"></a>
+<FONT color="green">083</FONT>            double fmin;<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>            int i = 0;<a name="line.85"></a>
+<FONT color="green">086</FONT>            while (i &lt; maximalIterationCount) {<a name="line.86"></a>
+<FONT color="green">087</FONT>                m = UnivariateRealSolverUtils.midpoint(min, max);<a name="line.87"></a>
+<FONT color="green">088</FONT>               fmin = f.value(min);<a name="line.88"></a>
+<FONT color="green">089</FONT>               fm = f.value(m);<a name="line.89"></a>
+<FONT color="green">090</FONT>    <a name="line.90"></a>
+<FONT color="green">091</FONT>                if (fm * fmin &gt; 0.0) {<a name="line.91"></a>
+<FONT color="green">092</FONT>                    // max and m bracket the root.<a name="line.92"></a>
+<FONT color="green">093</FONT>                    min = m;<a name="line.93"></a>
+<FONT color="green">094</FONT>                } else {<a name="line.94"></a>
+<FONT color="green">095</FONT>                    // min and m bracket the root.<a name="line.95"></a>
+<FONT color="green">096</FONT>                    max = m;<a name="line.96"></a>
+<FONT color="green">097</FONT>                }<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>                if (Math.abs(max - min) &lt;= absoluteAccuracy) {<a name="line.99"></a>
+<FONT color="green">100</FONT>                    m = UnivariateRealSolverUtils.midpoint(min, max);<a name="line.100"></a>
+<FONT color="green">101</FONT>                    setResult(m, i);<a name="line.101"></a>
+<FONT color="green">102</FONT>                    return m;<a name="line.102"></a>
+<FONT color="green">103</FONT>                }<a name="line.103"></a>
+<FONT color="green">104</FONT>                ++i;<a name="line.104"></a>
+<FONT color="green">105</FONT>            }<a name="line.105"></a>
+<FONT color="green">106</FONT>    <a name="line.106"></a>
+<FONT color="green">107</FONT>            throw new MaxIterationsExceededException(maximalIterationCount);<a name="line.107"></a>
+<FONT color="green">108</FONT>        }<a name="line.108"></a>
+<FONT color="green">109</FONT>    }<a name="line.109"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/BrentSolver.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,416 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.solvers;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Implements the &lt;a href="http://mathworld.wolfram.com/BrentsMethod.html"&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Brent algorithm&lt;/a&gt; for  finding zeros of real univariate functions.<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * The function should be continuous but not necessarily smooth.&lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision:670469 $ $Date:2008-06-23 10:01:38 +0200 (lun., 23 juin 2008) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public class BrentSolver extends UnivariateRealSolverImpl {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /**<a name="line.35"></a>
+<FONT color="green">036</FONT>         * Default absolute accuracy<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @since 2.1<a name="line.37"></a>
+<FONT color="green">038</FONT>         */<a name="line.38"></a>
+<FONT color="green">039</FONT>        public static final double DEFAULT_ABSOLUTE_ACCURACY = 1E-6;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Default maximum number of iterations<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @since 2.1<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        public static final int DEFAULT_MAXIMUM_ITERATIONS = 100;<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** Error message for non-bracketing interval. */<a name="line.46"></a>
+<FONT color="green">047</FONT>        private static final String NON_BRACKETING_MESSAGE =<a name="line.47"></a>
+<FONT color="green">048</FONT>            "function values at endpoints do not have different signs.  " +<a name="line.48"></a>
+<FONT color="green">049</FONT>            "Endpoints: [{0}, {1}], Values: [{2}, {3}]";<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /** Serializable version identifier */<a name="line.51"></a>
+<FONT color="green">052</FONT>        private static final long serialVersionUID = 7694577816772532779L;<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /**<a name="line.54"></a>
+<FONT color="green">055</FONT>         * Construct a solver for the given function.<a name="line.55"></a>
+<FONT color="green">056</FONT>         *<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @param f function to solve.<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @deprecated as of 2.0 the function to solve is passed as an argument<a name="line.58"></a>
+<FONT color="green">059</FONT>         * to the {@link #solve(UnivariateRealFunction, double, double)} or<a name="line.59"></a>
+<FONT color="green">060</FONT>         * {@link UnivariateRealSolverImpl#solve(UnivariateRealFunction, double, double, double)}<a name="line.60"></a>
+<FONT color="green">061</FONT>         * method.<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        @Deprecated<a name="line.63"></a>
+<FONT color="green">064</FONT>        public BrentSolver(UnivariateRealFunction f) {<a name="line.64"></a>
+<FONT color="green">065</FONT>            super(f, DEFAULT_MAXIMUM_ITERATIONS, DEFAULT_ABSOLUTE_ACCURACY);<a name="line.65"></a>
+<FONT color="green">066</FONT>        }<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /**<a name="line.68"></a>
+<FONT color="green">069</FONT>         * Construct a solver with default properties.<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        public BrentSolver() {<a name="line.71"></a>
+<FONT color="green">072</FONT>            super(DEFAULT_MAXIMUM_ITERATIONS, DEFAULT_ABSOLUTE_ACCURACY);<a name="line.72"></a>
+<FONT color="green">073</FONT>        }<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /**<a name="line.75"></a>
+<FONT color="green">076</FONT>         * Construct a solver with the given absolute accuracy.<a name="line.76"></a>
+<FONT color="green">077</FONT>         *<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @param absoluteAccuracy lower bound for absolute accuracy of solutions returned by the solver<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @since 2.1<a name="line.79"></a>
+<FONT color="green">080</FONT>         */<a name="line.80"></a>
+<FONT color="green">081</FONT>        public BrentSolver(double absoluteAccuracy) {<a name="line.81"></a>
+<FONT color="green">082</FONT>            super(DEFAULT_MAXIMUM_ITERATIONS, absoluteAccuracy);<a name="line.82"></a>
+<FONT color="green">083</FONT>        }<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>        /**<a name="line.85"></a>
+<FONT color="green">086</FONT>         * Contstruct a solver with the given maximum iterations and absolute accuracy.<a name="line.86"></a>
+<FONT color="green">087</FONT>         *<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @param maximumIterations maximum number of iterations<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @param absoluteAccuracy lower bound for absolute accuracy of solutions returned by the solver<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @since 2.1<a name="line.90"></a>
+<FONT color="green">091</FONT>         */<a name="line.91"></a>
+<FONT color="green">092</FONT>        public BrentSolver(int maximumIterations, double absoluteAccuracy) {<a name="line.92"></a>
+<FONT color="green">093</FONT>            super(maximumIterations, absoluteAccuracy);<a name="line.93"></a>
+<FONT color="green">094</FONT>        }<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /** {@inheritDoc} */<a name="line.96"></a>
+<FONT color="green">097</FONT>        @Deprecated<a name="line.97"></a>
+<FONT color="green">098</FONT>        public double solve(double min, double max)<a name="line.98"></a>
+<FONT color="green">099</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.99"></a>
+<FONT color="green">100</FONT>            return solve(f, min, max);<a name="line.100"></a>
+<FONT color="green">101</FONT>        }<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        /** {@inheritDoc} */<a name="line.103"></a>
+<FONT color="green">104</FONT>        @Deprecated<a name="line.104"></a>
+<FONT color="green">105</FONT>        public double solve(double min, double max, double initial)<a name="line.105"></a>
+<FONT color="green">106</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.106"></a>
+<FONT color="green">107</FONT>            return solve(f, min, max, initial);<a name="line.107"></a>
+<FONT color="green">108</FONT>        }<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>        /**<a name="line.110"></a>
+<FONT color="green">111</FONT>         * Find a zero in the given interval with an initial guess.<a name="line.111"></a>
+<FONT color="green">112</FONT>         * &lt;p&gt;Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the values of the<a name="line.112"></a>
+<FONT color="green">113</FONT>         * function at the three points have the same sign (note that it is<a name="line.113"></a>
+<FONT color="green">114</FONT>         * allowed to have endpoints with the same sign if the initial point has<a name="line.114"></a>
+<FONT color="green">115</FONT>         * opposite sign function-wise).&lt;/p&gt;<a name="line.115"></a>
+<FONT color="green">116</FONT>         *<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @param f function to solve.<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @param min the lower bound for the interval.<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @param max the upper bound for the interval.<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @param initial the start value to use (must be set to min if no<a name="line.120"></a>
+<FONT color="green">121</FONT>         * initial point is known).<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @return the value where the function is zero<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @throws MaxIterationsExceededException the maximum iteration count<a name="line.123"></a>
+<FONT color="green">124</FONT>         * is exceeded<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating<a name="line.125"></a>
+<FONT color="green">126</FONT>         *  the function<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @throws IllegalArgumentException if initial is not between min and max<a name="line.127"></a>
+<FONT color="green">128</FONT>         * (even if it &lt;em&gt;is&lt;/em&gt; a root)<a name="line.128"></a>
+<FONT color="green">129</FONT>         */<a name="line.129"></a>
+<FONT color="green">130</FONT>        public double solve(final UnivariateRealFunction f,<a name="line.130"></a>
+<FONT color="green">131</FONT>                            final double min, final double max, final double initial)<a name="line.131"></a>
+<FONT color="green">132</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>            clearResult();<a name="line.134"></a>
+<FONT color="green">135</FONT>            if ((initial &lt; min) || (initial &gt; max)) {<a name="line.135"></a>
+<FONT color="green">136</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.136"></a>
+<FONT color="green">137</FONT>                      "invalid interval, initial value parameters:  lower={0}, initial={1}, upper={2}",<a name="line.137"></a>
+<FONT color="green">138</FONT>                      min, initial, max);<a name="line.138"></a>
+<FONT color="green">139</FONT>            }<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>            // return the initial guess if it is good enough<a name="line.141"></a>
+<FONT color="green">142</FONT>            double yInitial = f.value(initial);<a name="line.142"></a>
+<FONT color="green">143</FONT>            if (Math.abs(yInitial) &lt;= functionValueAccuracy) {<a name="line.143"></a>
+<FONT color="green">144</FONT>                setResult(initial, 0);<a name="line.144"></a>
+<FONT color="green">145</FONT>                return result;<a name="line.145"></a>
+<FONT color="green">146</FONT>            }<a name="line.146"></a>
+<FONT color="green">147</FONT>    <a name="line.147"></a>
+<FONT color="green">148</FONT>            // return the first endpoint if it is good enough<a name="line.148"></a>
+<FONT color="green">149</FONT>            double yMin = f.value(min);<a name="line.149"></a>
+<FONT color="green">150</FONT>            if (Math.abs(yMin) &lt;= functionValueAccuracy) {<a name="line.150"></a>
+<FONT color="green">151</FONT>                setResult(min, 0);<a name="line.151"></a>
+<FONT color="green">152</FONT>                return result;<a name="line.152"></a>
+<FONT color="green">153</FONT>            }<a name="line.153"></a>
+<FONT color="green">154</FONT>    <a name="line.154"></a>
+<FONT color="green">155</FONT>            // reduce interval if min and initial bracket the root<a name="line.155"></a>
+<FONT color="green">156</FONT>            if (yInitial * yMin &lt; 0) {<a name="line.156"></a>
+<FONT color="green">157</FONT>                return solve(f, min, yMin, initial, yInitial, min, yMin);<a name="line.157"></a>
+<FONT color="green">158</FONT>            }<a name="line.158"></a>
+<FONT color="green">159</FONT>    <a name="line.159"></a>
+<FONT color="green">160</FONT>            // return the second endpoint if it is good enough<a name="line.160"></a>
+<FONT color="green">161</FONT>            double yMax = f.value(max);<a name="line.161"></a>
+<FONT color="green">162</FONT>            if (Math.abs(yMax) &lt;= functionValueAccuracy) {<a name="line.162"></a>
+<FONT color="green">163</FONT>                setResult(max, 0);<a name="line.163"></a>
+<FONT color="green">164</FONT>                return result;<a name="line.164"></a>
+<FONT color="green">165</FONT>            }<a name="line.165"></a>
+<FONT color="green">166</FONT>    <a name="line.166"></a>
+<FONT color="green">167</FONT>            // reduce interval if initial and max bracket the root<a name="line.167"></a>
+<FONT color="green">168</FONT>            if (yInitial * yMax &lt; 0) {<a name="line.168"></a>
+<FONT color="green">169</FONT>                return solve(f, initial, yInitial, max, yMax, initial, yInitial);<a name="line.169"></a>
+<FONT color="green">170</FONT>            }<a name="line.170"></a>
+<FONT color="green">171</FONT>    <a name="line.171"></a>
+<FONT color="green">172</FONT>            throw MathRuntimeException.createIllegalArgumentException(<a name="line.172"></a>
+<FONT color="green">173</FONT>                  NON_BRACKETING_MESSAGE, min, max, yMin, yMax);<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>        }<a name="line.175"></a>
+<FONT color="green">176</FONT>    <a name="line.176"></a>
+<FONT color="green">177</FONT>        /**<a name="line.177"></a>
+<FONT color="green">178</FONT>         * Find a zero in the given interval.<a name="line.178"></a>
+<FONT color="green">179</FONT>         * &lt;p&gt;<a name="line.179"></a>
+<FONT color="green">180</FONT>         * Requires that the values of the function at the endpoints have opposite<a name="line.180"></a>
+<FONT color="green">181</FONT>         * signs. An &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown if this is not<a name="line.181"></a>
+<FONT color="green">182</FONT>         * the case.&lt;/p&gt;<a name="line.182"></a>
+<FONT color="green">183</FONT>         *<a name="line.183"></a>
+<FONT color="green">184</FONT>         * @param f the function to solve<a name="line.184"></a>
+<FONT color="green">185</FONT>         * @param min the lower bound for the interval.<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @param max the upper bound for the interval.<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @return the value where the function is zero<a name="line.187"></a>
+<FONT color="green">188</FONT>         * @throws MaxIterationsExceededException if the maximum iteration count is exceeded<a name="line.188"></a>
+<FONT color="green">189</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.189"></a>
+<FONT color="green">190</FONT>         * function<a name="line.190"></a>
+<FONT color="green">191</FONT>         * @throws IllegalArgumentException if min is not less than max or the<a name="line.191"></a>
+<FONT color="green">192</FONT>         * signs of the values of the function at the endpoints are not opposites<a name="line.192"></a>
+<FONT color="green">193</FONT>         */<a name="line.193"></a>
+<FONT color="green">194</FONT>        public double solve(final UnivariateRealFunction f,<a name="line.194"></a>
+<FONT color="green">195</FONT>                            final double min, final double max)<a name="line.195"></a>
+<FONT color="green">196</FONT>            throws MaxIterationsExceededException,<a name="line.196"></a>
+<FONT color="green">197</FONT>            FunctionEvaluationException {<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>            clearResult();<a name="line.199"></a>
+<FONT color="green">200</FONT>            verifyInterval(min, max);<a name="line.200"></a>
+<FONT color="green">201</FONT>    <a name="line.201"></a>
+<FONT color="green">202</FONT>            double ret = Double.NaN;<a name="line.202"></a>
+<FONT color="green">203</FONT>    <a name="line.203"></a>
+<FONT color="green">204</FONT>            double yMin = f.value(min);<a name="line.204"></a>
+<FONT color="green">205</FONT>            double yMax = f.value(max);<a name="line.205"></a>
+<FONT color="green">206</FONT>    <a name="line.206"></a>
+<FONT color="green">207</FONT>            // Verify bracketing<a name="line.207"></a>
+<FONT color="green">208</FONT>            double sign = yMin * yMax;<a name="line.208"></a>
+<FONT color="green">209</FONT>            if (sign &gt; 0) {<a name="line.209"></a>
+<FONT color="green">210</FONT>                // check if either value is close to a zero<a name="line.210"></a>
+<FONT color="green">211</FONT>                if (Math.abs(yMin) &lt;= functionValueAccuracy) {<a name="line.211"></a>
+<FONT color="green">212</FONT>                    setResult(min, 0);<a name="line.212"></a>
+<FONT color="green">213</FONT>                    ret = min;<a name="line.213"></a>
+<FONT color="green">214</FONT>                } else if (Math.abs(yMax) &lt;= functionValueAccuracy) {<a name="line.214"></a>
+<FONT color="green">215</FONT>                    setResult(max, 0);<a name="line.215"></a>
+<FONT color="green">216</FONT>                    ret = max;<a name="line.216"></a>
+<FONT color="green">217</FONT>                } else {<a name="line.217"></a>
+<FONT color="green">218</FONT>                    // neither value is close to zero and min and max do not bracket root.<a name="line.218"></a>
+<FONT color="green">219</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.219"></a>
+<FONT color="green">220</FONT>                            NON_BRACKETING_MESSAGE, min, max, yMin, yMax);<a name="line.220"></a>
+<FONT color="green">221</FONT>                }<a name="line.221"></a>
+<FONT color="green">222</FONT>            } else if (sign &lt; 0){<a name="line.222"></a>
+<FONT color="green">223</FONT>                // solve using only the first endpoint as initial guess<a name="line.223"></a>
+<FONT color="green">224</FONT>                ret = solve(f, min, yMin, max, yMax, min, yMin);<a name="line.224"></a>
+<FONT color="green">225</FONT>            } else {<a name="line.225"></a>
+<FONT color="green">226</FONT>                // either min or max is a root<a name="line.226"></a>
+<FONT color="green">227</FONT>                if (yMin == 0.0) {<a name="line.227"></a>
+<FONT color="green">228</FONT>                    ret = min;<a name="line.228"></a>
+<FONT color="green">229</FONT>                } else {<a name="line.229"></a>
+<FONT color="green">230</FONT>                    ret = max;<a name="line.230"></a>
+<FONT color="green">231</FONT>                }<a name="line.231"></a>
+<FONT color="green">232</FONT>            }<a name="line.232"></a>
+<FONT color="green">233</FONT>    <a name="line.233"></a>
+<FONT color="green">234</FONT>            return ret;<a name="line.234"></a>
+<FONT color="green">235</FONT>        }<a name="line.235"></a>
+<FONT color="green">236</FONT>    <a name="line.236"></a>
+<FONT color="green">237</FONT>        /**<a name="line.237"></a>
+<FONT color="green">238</FONT>         * Find a zero starting search according to the three provided points.<a name="line.238"></a>
+<FONT color="green">239</FONT>         * @param f the function to solve<a name="line.239"></a>
+<FONT color="green">240</FONT>         * @param x0 old approximation for the root<a name="line.240"></a>
+<FONT color="green">241</FONT>         * @param y0 function value at the approximation for the root<a name="line.241"></a>
+<FONT color="green">242</FONT>         * @param x1 last calculated approximation for the root<a name="line.242"></a>
+<FONT color="green">243</FONT>         * @param y1 function value at the last calculated approximation<a name="line.243"></a>
+<FONT color="green">244</FONT>         * for the root<a name="line.244"></a>
+<FONT color="green">245</FONT>         * @param x2 bracket point (must be set to x0 if no bracket point is<a name="line.245"></a>
+<FONT color="green">246</FONT>         * known, this will force starting with linear interpolation)<a name="line.246"></a>
+<FONT color="green">247</FONT>         * @param y2 function value at the bracket point.<a name="line.247"></a>
+<FONT color="green">248</FONT>         * @return the value where the function is zero<a name="line.248"></a>
+<FONT color="green">249</FONT>         * @throws MaxIterationsExceededException if the maximum iteration count<a name="line.249"></a>
+<FONT color="green">250</FONT>         * is exceeded<a name="line.250"></a>
+<FONT color="green">251</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating<a name="line.251"></a>
+<FONT color="green">252</FONT>         * the function<a name="line.252"></a>
+<FONT color="green">253</FONT>         */<a name="line.253"></a>
+<FONT color="green">254</FONT>        private double solve(final UnivariateRealFunction f,<a name="line.254"></a>
+<FONT color="green">255</FONT>                             double x0, double y0,<a name="line.255"></a>
+<FONT color="green">256</FONT>                             double x1, double y1,<a name="line.256"></a>
+<FONT color="green">257</FONT>                             double x2, double y2)<a name="line.257"></a>
+<FONT color="green">258</FONT>        throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>            double delta = x1 - x0;<a name="line.260"></a>
+<FONT color="green">261</FONT>            double oldDelta = delta;<a name="line.261"></a>
+<FONT color="green">262</FONT>    <a name="line.262"></a>
+<FONT color="green">263</FONT>            int i = 0;<a name="line.263"></a>
+<FONT color="green">264</FONT>            while (i &lt; maximalIterationCount) {<a name="line.264"></a>
+<FONT color="green">265</FONT>                if (Math.abs(y2) &lt; Math.abs(y1)) {<a name="line.265"></a>
+<FONT color="green">266</FONT>                    // use the bracket point if is better than last approximation<a name="line.266"></a>
+<FONT color="green">267</FONT>                    x0 = x1;<a name="line.267"></a>
+<FONT color="green">268</FONT>                    x1 = x2;<a name="line.268"></a>
+<FONT color="green">269</FONT>                    x2 = x0;<a name="line.269"></a>
+<FONT color="green">270</FONT>                    y0 = y1;<a name="line.270"></a>
+<FONT color="green">271</FONT>                    y1 = y2;<a name="line.271"></a>
+<FONT color="green">272</FONT>                    y2 = y0;<a name="line.272"></a>
+<FONT color="green">273</FONT>                }<a name="line.273"></a>
+<FONT color="green">274</FONT>                if (Math.abs(y1) &lt;= functionValueAccuracy) {<a name="line.274"></a>
+<FONT color="green">275</FONT>                    // Avoid division by very small values. Assume<a name="line.275"></a>
+<FONT color="green">276</FONT>                    // the iteration has converged (the problem may<a name="line.276"></a>
+<FONT color="green">277</FONT>                    // still be ill conditioned)<a name="line.277"></a>
+<FONT color="green">278</FONT>                    setResult(x1, i);<a name="line.278"></a>
+<FONT color="green">279</FONT>                    return result;<a name="line.279"></a>
+<FONT color="green">280</FONT>                }<a name="line.280"></a>
+<FONT color="green">281</FONT>                double dx = x2 - x1;<a name="line.281"></a>
+<FONT color="green">282</FONT>                double tolerance =<a name="line.282"></a>
+<FONT color="green">283</FONT>                    Math.max(relativeAccuracy * Math.abs(x1), absoluteAccuracy);<a name="line.283"></a>
+<FONT color="green">284</FONT>                if (Math.abs(dx) &lt;= tolerance) {<a name="line.284"></a>
+<FONT color="green">285</FONT>                    setResult(x1, i);<a name="line.285"></a>
+<FONT color="green">286</FONT>                    return result;<a name="line.286"></a>
+<FONT color="green">287</FONT>                }<a name="line.287"></a>
+<FONT color="green">288</FONT>                if ((Math.abs(oldDelta) &lt; tolerance) ||<a name="line.288"></a>
+<FONT color="green">289</FONT>                        (Math.abs(y0) &lt;= Math.abs(y1))) {<a name="line.289"></a>
+<FONT color="green">290</FONT>                    // Force bisection.<a name="line.290"></a>
+<FONT color="green">291</FONT>                    delta = 0.5 * dx;<a name="line.291"></a>
+<FONT color="green">292</FONT>                    oldDelta = delta;<a name="line.292"></a>
+<FONT color="green">293</FONT>                } else {<a name="line.293"></a>
+<FONT color="green">294</FONT>                    double r3 = y1 / y0;<a name="line.294"></a>
+<FONT color="green">295</FONT>                    double p;<a name="line.295"></a>
+<FONT color="green">296</FONT>                    double p1;<a name="line.296"></a>
+<FONT color="green">297</FONT>                    // the equality test (x0 == x2) is intentional,<a name="line.297"></a>
+<FONT color="green">298</FONT>                    // it is part of the original Brent's method,<a name="line.298"></a>
+<FONT color="green">299</FONT>                    // it should NOT be replaced by proximity test<a name="line.299"></a>
+<FONT color="green">300</FONT>                    if (x0 == x2) {<a name="line.300"></a>
+<FONT color="green">301</FONT>                        // Linear interpolation.<a name="line.301"></a>
+<FONT color="green">302</FONT>                        p = dx * r3;<a name="line.302"></a>
+<FONT color="green">303</FONT>                        p1 = 1.0 - r3;<a name="line.303"></a>
+<FONT color="green">304</FONT>                    } else {<a name="line.304"></a>
+<FONT color="green">305</FONT>                        // Inverse quadratic interpolation.<a name="line.305"></a>
+<FONT color="green">306</FONT>                        double r1 = y0 / y2;<a name="line.306"></a>
+<FONT color="green">307</FONT>                        double r2 = y1 / y2;<a name="line.307"></a>
+<FONT color="green">308</FONT>                        p = r3 * (dx * r1 * (r1 - r2) - (x1 - x0) * (r2 - 1.0));<a name="line.308"></a>
+<FONT color="green">309</FONT>                        p1 = (r1 - 1.0) * (r2 - 1.0) * (r3 - 1.0);<a name="line.309"></a>
+<FONT color="green">310</FONT>                    }<a name="line.310"></a>
+<FONT color="green">311</FONT>                    if (p &gt; 0.0) {<a name="line.311"></a>
+<FONT color="green">312</FONT>                        p1 = -p1;<a name="line.312"></a>
+<FONT color="green">313</FONT>                    } else {<a name="line.313"></a>
+<FONT color="green">314</FONT>                        p = -p;<a name="line.314"></a>
+<FONT color="green">315</FONT>                    }<a name="line.315"></a>
+<FONT color="green">316</FONT>                    if (2.0 * p &gt;= 1.5 * dx * p1 - Math.abs(tolerance * p1) ||<a name="line.316"></a>
+<FONT color="green">317</FONT>                            p &gt;= Math.abs(0.5 * oldDelta * p1)) {<a name="line.317"></a>
+<FONT color="green">318</FONT>                        // Inverse quadratic interpolation gives a value<a name="line.318"></a>
+<FONT color="green">319</FONT>                        // in the wrong direction, or progress is slow.<a name="line.319"></a>
+<FONT color="green">320</FONT>                        // Fall back to bisection.<a name="line.320"></a>
+<FONT color="green">321</FONT>                        delta = 0.5 * dx;<a name="line.321"></a>
+<FONT color="green">322</FONT>                        oldDelta = delta;<a name="line.322"></a>
+<FONT color="green">323</FONT>                    } else {<a name="line.323"></a>
+<FONT color="green">324</FONT>                        oldDelta = delta;<a name="line.324"></a>
+<FONT color="green">325</FONT>                        delta = p / p1;<a name="line.325"></a>
+<FONT color="green">326</FONT>                    }<a name="line.326"></a>
+<FONT color="green">327</FONT>                }<a name="line.327"></a>
+<FONT color="green">328</FONT>                // Save old X1, Y1<a name="line.328"></a>
+<FONT color="green">329</FONT>                x0 = x1;<a name="line.329"></a>
+<FONT color="green">330</FONT>                y0 = y1;<a name="line.330"></a>
+<FONT color="green">331</FONT>                // Compute new X1, Y1<a name="line.331"></a>
+<FONT color="green">332</FONT>                if (Math.abs(delta) &gt; tolerance) {<a name="line.332"></a>
+<FONT color="green">333</FONT>                    x1 = x1 + delta;<a name="line.333"></a>
+<FONT color="green">334</FONT>                } else if (dx &gt; 0.0) {<a name="line.334"></a>
+<FONT color="green">335</FONT>                    x1 = x1 + 0.5 * tolerance;<a name="line.335"></a>
+<FONT color="green">336</FONT>                } else if (dx &lt;= 0.0) {<a name="line.336"></a>
+<FONT color="green">337</FONT>                    x1 = x1 - 0.5 * tolerance;<a name="line.337"></a>
+<FONT color="green">338</FONT>                }<a name="line.338"></a>
+<FONT color="green">339</FONT>                y1 = f.value(x1);<a name="line.339"></a>
+<FONT color="green">340</FONT>                if ((y1 &gt; 0) == (y2 &gt; 0)) {<a name="line.340"></a>
+<FONT color="green">341</FONT>                    x2 = x0;<a name="line.341"></a>
+<FONT color="green">342</FONT>                    y2 = y0;<a name="line.342"></a>
+<FONT color="green">343</FONT>                    delta = x1 - x0;<a name="line.343"></a>
+<FONT color="green">344</FONT>                    oldDelta = delta;<a name="line.344"></a>
+<FONT color="green">345</FONT>                }<a name="line.345"></a>
+<FONT color="green">346</FONT>                i++;<a name="line.346"></a>
+<FONT color="green">347</FONT>            }<a name="line.347"></a>
+<FONT color="green">348</FONT>            throw new MaxIterationsExceededException(maximalIterationCount);<a name="line.348"></a>
+<FONT color="green">349</FONT>        }<a name="line.349"></a>
+<FONT color="green">350</FONT>    }<a name="line.350"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/LaguerreSolver.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,449 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.solvers;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.analysis.polynomials.PolynomialFunction;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.complex.Complex;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    /**<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Implements the &lt;a href="http://mathworld.wolfram.com/LaguerresMethod.html"&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * Laguerre's Method&lt;/a&gt; for root finding of real coefficient polynomials.<a name="line.29"></a>
+<FONT color="green">030</FONT>     * For reference, see &lt;b&gt;A First Course in Numerical Analysis&lt;/b&gt;,<a name="line.30"></a>
+<FONT color="green">031</FONT>     * ISBN 048641454X, chapter 8.<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * Laguerre's method is global in the sense that it can start with any initial<a name="line.33"></a>
+<FONT color="green">034</FONT>     * approximation and be able to solve all roots from that point.&lt;/p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     *<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @version $Revision: 922708 $ $Date: 2010-03-13 20:15:47 -0500 (Sat, 13 Mar 2010) $<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @since 1.2<a name="line.37"></a>
+<FONT color="green">038</FONT>     */<a name="line.38"></a>
+<FONT color="green">039</FONT>    public class LaguerreSolver extends UnivariateRealSolverImpl {<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Message for non-polynomial function. */<a name="line.41"></a>
+<FONT color="green">042</FONT>        private static final String NON_POLYNOMIAL_FUNCTION_MESSAGE =<a name="line.42"></a>
+<FONT color="green">043</FONT>            "function is not polynomial";<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Message for non-positive degree. */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private static final String NON_POSITIVE_DEGREE_MESSAGE =<a name="line.46"></a>
+<FONT color="green">047</FONT>            "polynomial degree must be positive: degree={0}";<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** polynomial function to solve.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @deprecated as of 2.0 the function is not stored anymore in the instance<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        @Deprecated<a name="line.52"></a>
+<FONT color="green">053</FONT>        private final PolynomialFunction p;<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * Construct a solver for the given function.<a name="line.56"></a>
+<FONT color="green">057</FONT>         *<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @param f function to solve<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @throws IllegalArgumentException if function is not polynomial<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @deprecated as of 2.0 the function to solve is passed as an argument<a name="line.60"></a>
+<FONT color="green">061</FONT>         * to the {@link #solve(UnivariateRealFunction, double, double)} or<a name="line.61"></a>
+<FONT color="green">062</FONT>         * {@link UnivariateRealSolverImpl#solve(UnivariateRealFunction, double, double, double)}<a name="line.62"></a>
+<FONT color="green">063</FONT>         * method.<a name="line.63"></a>
+<FONT color="green">064</FONT>         */<a name="line.64"></a>
+<FONT color="green">065</FONT>        @Deprecated<a name="line.65"></a>
+<FONT color="green">066</FONT>        public LaguerreSolver(UnivariateRealFunction f) throws<a name="line.66"></a>
+<FONT color="green">067</FONT>            IllegalArgumentException {<a name="line.67"></a>
+<FONT color="green">068</FONT>            super(f, 100, 1E-6);<a name="line.68"></a>
+<FONT color="green">069</FONT>            if (f instanceof PolynomialFunction) {<a name="line.69"></a>
+<FONT color="green">070</FONT>                p = (PolynomialFunction) f;<a name="line.70"></a>
+<FONT color="green">071</FONT>            } else {<a name="line.71"></a>
+<FONT color="green">072</FONT>                throw MathRuntimeException.createIllegalArgumentException(NON_POLYNOMIAL_FUNCTION_MESSAGE);<a name="line.72"></a>
+<FONT color="green">073</FONT>            }<a name="line.73"></a>
+<FONT color="green">074</FONT>        }<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        /**<a name="line.76"></a>
+<FONT color="green">077</FONT>         * Construct a solver.<a name="line.77"></a>
+<FONT color="green">078</FONT>         */<a name="line.78"></a>
+<FONT color="green">079</FONT>        public LaguerreSolver() {<a name="line.79"></a>
+<FONT color="green">080</FONT>            super(100, 1E-6);<a name="line.80"></a>
+<FONT color="green">081</FONT>            p = null;<a name="line.81"></a>
+<FONT color="green">082</FONT>        }<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /**<a name="line.84"></a>
+<FONT color="green">085</FONT>         * Returns a copy of the polynomial function.<a name="line.85"></a>
+<FONT color="green">086</FONT>         *<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @return a fresh copy of the polynomial function<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @deprecated as of 2.0 the function is not stored anymore within the instance.<a name="line.88"></a>
+<FONT color="green">089</FONT>         */<a name="line.89"></a>
+<FONT color="green">090</FONT>        @Deprecated<a name="line.90"></a>
+<FONT color="green">091</FONT>        public PolynomialFunction getPolynomialFunction() {<a name="line.91"></a>
+<FONT color="green">092</FONT>            return new PolynomialFunction(p.getCoefficients());<a name="line.92"></a>
+<FONT color="green">093</FONT>        }<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /** {@inheritDoc} */<a name="line.95"></a>
+<FONT color="green">096</FONT>        @Deprecated<a name="line.96"></a>
+<FONT color="green">097</FONT>        public double solve(final double min, final double max)<a name="line.97"></a>
+<FONT color="green">098</FONT>            throws ConvergenceException, FunctionEvaluationException {<a name="line.98"></a>
+<FONT color="green">099</FONT>            return solve(p, min, max);<a name="line.99"></a>
+<FONT color="green">100</FONT>        }<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>        /** {@inheritDoc} */<a name="line.102"></a>
+<FONT color="green">103</FONT>        @Deprecated<a name="line.103"></a>
+<FONT color="green">104</FONT>        public double solve(final double min, final double max, final double initial)<a name="line.104"></a>
+<FONT color="green">105</FONT>            throws ConvergenceException, FunctionEvaluationException {<a name="line.105"></a>
+<FONT color="green">106</FONT>            return solve(p, min, max, initial);<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /**<a name="line.109"></a>
+<FONT color="green">110</FONT>         * Find a real root in the given interval with initial value.<a name="line.110"></a>
+<FONT color="green">111</FONT>         * &lt;p&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>         * Requires bracketing condition.&lt;/p&gt;<a name="line.112"></a>
+<FONT color="green">113</FONT>         *<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param f function to solve (must be polynomial)<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @param min the lower bound for the interval<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @param max the upper bound for the interval<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @param initial the start value to use<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @return the point at which the function value is zero<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @throws ConvergenceException if the maximum iteration count is exceeded<a name="line.119"></a>
+<FONT color="green">120</FONT>         * or the solver detects convergence problems otherwise<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.121"></a>
+<FONT color="green">122</FONT>         * function<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.123"></a>
+<FONT color="green">124</FONT>         */<a name="line.124"></a>
+<FONT color="green">125</FONT>        public double solve(final UnivariateRealFunction f,<a name="line.125"></a>
+<FONT color="green">126</FONT>                            final double min, final double max, final double initial)<a name="line.126"></a>
+<FONT color="green">127</FONT>            throws ConvergenceException, FunctionEvaluationException {<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>            // check for zeros before verifying bracketing<a name="line.129"></a>
+<FONT color="green">130</FONT>            if (f.value(min) == 0.0) {<a name="line.130"></a>
+<FONT color="green">131</FONT>                return min;<a name="line.131"></a>
+<FONT color="green">132</FONT>            }<a name="line.132"></a>
+<FONT color="green">133</FONT>            if (f.value(max) == 0.0) {<a name="line.133"></a>
+<FONT color="green">134</FONT>                return max;<a name="line.134"></a>
+<FONT color="green">135</FONT>            }<a name="line.135"></a>
+<FONT color="green">136</FONT>            if (f.value(initial) == 0.0) {<a name="line.136"></a>
+<FONT color="green">137</FONT>                return initial;<a name="line.137"></a>
+<FONT color="green">138</FONT>            }<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>            verifyBracketing(min, max, f);<a name="line.140"></a>
+<FONT color="green">141</FONT>            verifySequence(min, initial, max);<a name="line.141"></a>
+<FONT color="green">142</FONT>            if (isBracketing(min, initial, f)) {<a name="line.142"></a>
+<FONT color="green">143</FONT>                return solve(f, min, initial);<a name="line.143"></a>
+<FONT color="green">144</FONT>            } else {<a name="line.144"></a>
+<FONT color="green">145</FONT>                return solve(f, initial, max);<a name="line.145"></a>
+<FONT color="green">146</FONT>            }<a name="line.146"></a>
+<FONT color="green">147</FONT>    <a name="line.147"></a>
+<FONT color="green">148</FONT>        }<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>        /**<a name="line.150"></a>
+<FONT color="green">151</FONT>         * Find a real root in the given interval.<a name="line.151"></a>
+<FONT color="green">152</FONT>         * &lt;p&gt;<a name="line.152"></a>
+<FONT color="green">153</FONT>         * Despite the bracketing condition, the root returned by solve(Complex[],<a name="line.153"></a>
+<FONT color="green">154</FONT>         * Complex) may not be a real zero inside [min, max]. For example,<a name="line.154"></a>
+<FONT color="green">155</FONT>         * p(x) = x^3 + 1, min = -2, max = 2, initial = 0. We can either try<a name="line.155"></a>
+<FONT color="green">156</FONT>         * another initial value, or, as we did here, call solveAll() to obtain<a name="line.156"></a>
+<FONT color="green">157</FONT>         * all roots and pick up the one that we're looking for.&lt;/p&gt;<a name="line.157"></a>
+<FONT color="green">158</FONT>         *<a name="line.158"></a>
+<FONT color="green">159</FONT>         * @param f the function to solve<a name="line.159"></a>
+<FONT color="green">160</FONT>         * @param min the lower bound for the interval<a name="line.160"></a>
+<FONT color="green">161</FONT>         * @param max the upper bound for the interval<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @return the point at which the function value is zero<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @throws ConvergenceException if the maximum iteration count is exceeded<a name="line.163"></a>
+<FONT color="green">164</FONT>         * or the solver detects convergence problems otherwise<a name="line.164"></a>
+<FONT color="green">165</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.165"></a>
+<FONT color="green">166</FONT>         * function<a name="line.166"></a>
+<FONT color="green">167</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.167"></a>
+<FONT color="green">168</FONT>         */<a name="line.168"></a>
+<FONT color="green">169</FONT>        public double solve(final UnivariateRealFunction f,<a name="line.169"></a>
+<FONT color="green">170</FONT>                            final double min, final double max)<a name="line.170"></a>
+<FONT color="green">171</FONT>            throws ConvergenceException, FunctionEvaluationException {<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>            // check function type<a name="line.173"></a>
+<FONT color="green">174</FONT>            if (!(f instanceof PolynomialFunction)) {<a name="line.174"></a>
+<FONT color="green">175</FONT>                throw MathRuntimeException.createIllegalArgumentException(NON_POLYNOMIAL_FUNCTION_MESSAGE);<a name="line.175"></a>
+<FONT color="green">176</FONT>            }<a name="line.176"></a>
+<FONT color="green">177</FONT>    <a name="line.177"></a>
+<FONT color="green">178</FONT>            // check for zeros before verifying bracketing<a name="line.178"></a>
+<FONT color="green">179</FONT>            if (f.value(min) == 0.0) { return min; }<a name="line.179"></a>
+<FONT color="green">180</FONT>            if (f.value(max) == 0.0) { return max; }<a name="line.180"></a>
+<FONT color="green">181</FONT>            verifyBracketing(min, max, f);<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>            double coefficients[] = ((PolynomialFunction) f).getCoefficients();<a name="line.183"></a>
+<FONT color="green">184</FONT>            Complex c[] = new Complex[coefficients.length];<a name="line.184"></a>
+<FONT color="green">185</FONT>            for (int i = 0; i &lt; coefficients.length; i++) {<a name="line.185"></a>
+<FONT color="green">186</FONT>                c[i] = new Complex(coefficients[i], 0.0);<a name="line.186"></a>
+<FONT color="green">187</FONT>            }<a name="line.187"></a>
+<FONT color="green">188</FONT>            Complex initial = new Complex(0.5 * (min + max), 0.0);<a name="line.188"></a>
+<FONT color="green">189</FONT>            Complex z = solve(c, initial);<a name="line.189"></a>
+<FONT color="green">190</FONT>            if (isRootOK(min, max, z)) {<a name="line.190"></a>
+<FONT color="green">191</FONT>                setResult(z.getReal(), iterationCount);<a name="line.191"></a>
+<FONT color="green">192</FONT>                return result;<a name="line.192"></a>
+<FONT color="green">193</FONT>            }<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>            // solve all roots and select the one we're seeking<a name="line.195"></a>
+<FONT color="green">196</FONT>            Complex[] root = solveAll(c, initial);<a name="line.196"></a>
+<FONT color="green">197</FONT>            for (int i = 0; i &lt; root.length; i++) {<a name="line.197"></a>
+<FONT color="green">198</FONT>                if (isRootOK(min, max, root[i])) {<a name="line.198"></a>
+<FONT color="green">199</FONT>                    setResult(root[i].getReal(), iterationCount);<a name="line.199"></a>
+<FONT color="green">200</FONT>                    return result;<a name="line.200"></a>
+<FONT color="green">201</FONT>                }<a name="line.201"></a>
+<FONT color="green">202</FONT>            }<a name="line.202"></a>
+<FONT color="green">203</FONT>    <a name="line.203"></a>
+<FONT color="green">204</FONT>            // should never happen<a name="line.204"></a>
+<FONT color="green">205</FONT>            throw new ConvergenceException();<a name="line.205"></a>
+<FONT color="green">206</FONT>        }<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>        /**<a name="line.208"></a>
+<FONT color="green">209</FONT>         * Returns true iff the given complex root is actually a real zero<a name="line.209"></a>
+<FONT color="green">210</FONT>         * in the given interval, within the solver tolerance level.<a name="line.210"></a>
+<FONT color="green">211</FONT>         *<a name="line.211"></a>
+<FONT color="green">212</FONT>         * @param min the lower bound for the interval<a name="line.212"></a>
+<FONT color="green">213</FONT>         * @param max the upper bound for the interval<a name="line.213"></a>
+<FONT color="green">214</FONT>         * @param z the complex root<a name="line.214"></a>
+<FONT color="green">215</FONT>         * @return true iff z is the sought-after real zero<a name="line.215"></a>
+<FONT color="green">216</FONT>         */<a name="line.216"></a>
+<FONT color="green">217</FONT>        protected boolean isRootOK(double min, double max, Complex z) {<a name="line.217"></a>
+<FONT color="green">218</FONT>            double tolerance = Math.max(relativeAccuracy * z.abs(), absoluteAccuracy);<a name="line.218"></a>
+<FONT color="green">219</FONT>            return (isSequence(min, z.getReal(), max)) &amp;&amp;<a name="line.219"></a>
+<FONT color="green">220</FONT>                   (Math.abs(z.getImaginary()) &lt;= tolerance ||<a name="line.220"></a>
+<FONT color="green">221</FONT>                    z.abs() &lt;= functionValueAccuracy);<a name="line.221"></a>
+<FONT color="green">222</FONT>        }<a name="line.222"></a>
+<FONT color="green">223</FONT>    <a name="line.223"></a>
+<FONT color="green">224</FONT>        /**<a name="line.224"></a>
+<FONT color="green">225</FONT>         * Find all complex roots for the polynomial with the given coefficients,<a name="line.225"></a>
+<FONT color="green">226</FONT>         * starting from the given initial value.<a name="line.226"></a>
+<FONT color="green">227</FONT>         *<a name="line.227"></a>
+<FONT color="green">228</FONT>         * @param coefficients the polynomial coefficients array<a name="line.228"></a>
+<FONT color="green">229</FONT>         * @param initial the start value to use<a name="line.229"></a>
+<FONT color="green">230</FONT>         * @return the point at which the function value is zero<a name="line.230"></a>
+<FONT color="green">231</FONT>         * @throws ConvergenceException if the maximum iteration count is exceeded<a name="line.231"></a>
+<FONT color="green">232</FONT>         * or the solver detects convergence problems otherwise<a name="line.232"></a>
+<FONT color="green">233</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.233"></a>
+<FONT color="green">234</FONT>         * function<a name="line.234"></a>
+<FONT color="green">235</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.235"></a>
+<FONT color="green">236</FONT>         */<a name="line.236"></a>
+<FONT color="green">237</FONT>        public Complex[] solveAll(double coefficients[], double initial) throws<a name="line.237"></a>
+<FONT color="green">238</FONT>            ConvergenceException, FunctionEvaluationException {<a name="line.238"></a>
+<FONT color="green">239</FONT>    <a name="line.239"></a>
+<FONT color="green">240</FONT>            Complex c[] = new Complex[coefficients.length];<a name="line.240"></a>
+<FONT color="green">241</FONT>            Complex z = new Complex(initial, 0.0);<a name="line.241"></a>
+<FONT color="green">242</FONT>            for (int i = 0; i &lt; c.length; i++) {<a name="line.242"></a>
+<FONT color="green">243</FONT>                c[i] = new Complex(coefficients[i], 0.0);<a name="line.243"></a>
+<FONT color="green">244</FONT>            }<a name="line.244"></a>
+<FONT color="green">245</FONT>            return solveAll(c, z);<a name="line.245"></a>
+<FONT color="green">246</FONT>        }<a name="line.246"></a>
+<FONT color="green">247</FONT>    <a name="line.247"></a>
+<FONT color="green">248</FONT>        /**<a name="line.248"></a>
+<FONT color="green">249</FONT>         * Find all complex roots for the polynomial with the given coefficients,<a name="line.249"></a>
+<FONT color="green">250</FONT>         * starting from the given initial value.<a name="line.250"></a>
+<FONT color="green">251</FONT>         *<a name="line.251"></a>
+<FONT color="green">252</FONT>         * @param coefficients the polynomial coefficients array<a name="line.252"></a>
+<FONT color="green">253</FONT>         * @param initial the start value to use<a name="line.253"></a>
+<FONT color="green">254</FONT>         * @return the point at which the function value is zero<a name="line.254"></a>
+<FONT color="green">255</FONT>         * @throws MaxIterationsExceededException if the maximum iteration count is exceeded<a name="line.255"></a>
+<FONT color="green">256</FONT>         * or the solver detects convergence problems otherwise<a name="line.256"></a>
+<FONT color="green">257</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.257"></a>
+<FONT color="green">258</FONT>         * function<a name="line.258"></a>
+<FONT color="green">259</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.259"></a>
+<FONT color="green">260</FONT>         */<a name="line.260"></a>
+<FONT color="green">261</FONT>        public Complex[] solveAll(Complex coefficients[], Complex initial) throws<a name="line.261"></a>
+<FONT color="green">262</FONT>            MaxIterationsExceededException, FunctionEvaluationException {<a name="line.262"></a>
+<FONT color="green">263</FONT>    <a name="line.263"></a>
+<FONT color="green">264</FONT>            int n = coefficients.length - 1;<a name="line.264"></a>
+<FONT color="green">265</FONT>            int iterationCount = 0;<a name="line.265"></a>
+<FONT color="green">266</FONT>            if (n &lt; 1) {<a name="line.266"></a>
+<FONT color="green">267</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.267"></a>
+<FONT color="green">268</FONT>                      NON_POSITIVE_DEGREE_MESSAGE, n);<a name="line.268"></a>
+<FONT color="green">269</FONT>            }<a name="line.269"></a>
+<FONT color="green">270</FONT>            Complex c[] = new Complex[n+1];    // coefficients for deflated polynomial<a name="line.270"></a>
+<FONT color="green">271</FONT>            for (int i = 0; i &lt;= n; i++) {<a name="line.271"></a>
+<FONT color="green">272</FONT>                c[i] = coefficients[i];<a name="line.272"></a>
+<FONT color="green">273</FONT>            }<a name="line.273"></a>
+<FONT color="green">274</FONT>    <a name="line.274"></a>
+<FONT color="green">275</FONT>            // solve individual root successively<a name="line.275"></a>
+<FONT color="green">276</FONT>            Complex root[] = new Complex[n];<a name="line.276"></a>
+<FONT color="green">277</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.277"></a>
+<FONT color="green">278</FONT>                Complex subarray[] = new Complex[n-i+1];<a name="line.278"></a>
+<FONT color="green">279</FONT>                System.arraycopy(c, 0, subarray, 0, subarray.length);<a name="line.279"></a>
+<FONT color="green">280</FONT>                root[i] = solve(subarray, initial);<a name="line.280"></a>
+<FONT color="green">281</FONT>                // polynomial deflation using synthetic division<a name="line.281"></a>
+<FONT color="green">282</FONT>                Complex newc = c[n-i];<a name="line.282"></a>
+<FONT color="green">283</FONT>                Complex oldc = null;<a name="line.283"></a>
+<FONT color="green">284</FONT>                for (int j = n-i-1; j &gt;= 0; j--) {<a name="line.284"></a>
+<FONT color="green">285</FONT>                    oldc = c[j];<a name="line.285"></a>
+<FONT color="green">286</FONT>                    c[j] = newc;<a name="line.286"></a>
+<FONT color="green">287</FONT>                    newc = oldc.add(newc.multiply(root[i]));<a name="line.287"></a>
+<FONT color="green">288</FONT>                }<a name="line.288"></a>
+<FONT color="green">289</FONT>                iterationCount += this.iterationCount;<a name="line.289"></a>
+<FONT color="green">290</FONT>            }<a name="line.290"></a>
+<FONT color="green">291</FONT>    <a name="line.291"></a>
+<FONT color="green">292</FONT>            resultComputed = true;<a name="line.292"></a>
+<FONT color="green">293</FONT>            this.iterationCount = iterationCount;<a name="line.293"></a>
+<FONT color="green">294</FONT>            return root;<a name="line.294"></a>
+<FONT color="green">295</FONT>        }<a name="line.295"></a>
+<FONT color="green">296</FONT>    <a name="line.296"></a>
+<FONT color="green">297</FONT>        /**<a name="line.297"></a>
+<FONT color="green">298</FONT>         * Find a complex root for the polynomial with the given coefficients,<a name="line.298"></a>
+<FONT color="green">299</FONT>         * starting from the given initial value.<a name="line.299"></a>
+<FONT color="green">300</FONT>         *<a name="line.300"></a>
+<FONT color="green">301</FONT>         * @param coefficients the polynomial coefficients array<a name="line.301"></a>
+<FONT color="green">302</FONT>         * @param initial the start value to use<a name="line.302"></a>
+<FONT color="green">303</FONT>         * @return the point at which the function value is zero<a name="line.303"></a>
+<FONT color="green">304</FONT>         * @throws MaxIterationsExceededException if the maximum iteration count is exceeded<a name="line.304"></a>
+<FONT color="green">305</FONT>         * or the solver detects convergence problems otherwise<a name="line.305"></a>
+<FONT color="green">306</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.306"></a>
+<FONT color="green">307</FONT>         * function<a name="line.307"></a>
+<FONT color="green">308</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.308"></a>
+<FONT color="green">309</FONT>         */<a name="line.309"></a>
+<FONT color="green">310</FONT>        public Complex solve(Complex coefficients[], Complex initial) throws<a name="line.310"></a>
+<FONT color="green">311</FONT>            MaxIterationsExceededException, FunctionEvaluationException {<a name="line.311"></a>
+<FONT color="green">312</FONT>    <a name="line.312"></a>
+<FONT color="green">313</FONT>            int n = coefficients.length - 1;<a name="line.313"></a>
+<FONT color="green">314</FONT>            if (n &lt; 1) {<a name="line.314"></a>
+<FONT color="green">315</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.315"></a>
+<FONT color="green">316</FONT>                      NON_POSITIVE_DEGREE_MESSAGE, n);<a name="line.316"></a>
+<FONT color="green">317</FONT>            }<a name="line.317"></a>
+<FONT color="green">318</FONT>            Complex N  = new Complex(n,     0.0);<a name="line.318"></a>
+<FONT color="green">319</FONT>            Complex N1 = new Complex(n - 1, 0.0);<a name="line.319"></a>
+<FONT color="green">320</FONT>    <a name="line.320"></a>
+<FONT color="green">321</FONT>            int i = 1;<a name="line.321"></a>
+<FONT color="green">322</FONT>            Complex pv = null;<a name="line.322"></a>
+<FONT color="green">323</FONT>            Complex dv = null;<a name="line.323"></a>
+<FONT color="green">324</FONT>            Complex d2v = null;<a name="line.324"></a>
+<FONT color="green">325</FONT>            Complex G = null;<a name="line.325"></a>
+<FONT color="green">326</FONT>            Complex G2 = null;<a name="line.326"></a>
+<FONT color="green">327</FONT>            Complex H = null;<a name="line.327"></a>
+<FONT color="green">328</FONT>            Complex delta = null;<a name="line.328"></a>
+<FONT color="green">329</FONT>            Complex denominator = null;<a name="line.329"></a>
+<FONT color="green">330</FONT>            Complex z = initial;<a name="line.330"></a>
+<FONT color="green">331</FONT>            Complex oldz = new Complex(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);<a name="line.331"></a>
+<FONT color="green">332</FONT>            while (i &lt;= maximalIterationCount) {<a name="line.332"></a>
+<FONT color="green">333</FONT>                // Compute pv (polynomial value), dv (derivative value), and<a name="line.333"></a>
+<FONT color="green">334</FONT>                // d2v (second derivative value) simultaneously.<a name="line.334"></a>
+<FONT color="green">335</FONT>                pv = coefficients[n];<a name="line.335"></a>
+<FONT color="green">336</FONT>                dv = Complex.ZERO;<a name="line.336"></a>
+<FONT color="green">337</FONT>                d2v = Complex.ZERO;<a name="line.337"></a>
+<FONT color="green">338</FONT>                for (int j = n-1; j &gt;= 0; j--) {<a name="line.338"></a>
+<FONT color="green">339</FONT>                    d2v = dv.add(z.multiply(d2v));<a name="line.339"></a>
+<FONT color="green">340</FONT>                    dv = pv.add(z.multiply(dv));<a name="line.340"></a>
+<FONT color="green">341</FONT>                    pv = coefficients[j].add(z.multiply(pv));<a name="line.341"></a>
+<FONT color="green">342</FONT>                }<a name="line.342"></a>
+<FONT color="green">343</FONT>                d2v = d2v.multiply(new Complex(2.0, 0.0));<a name="line.343"></a>
+<FONT color="green">344</FONT>    <a name="line.344"></a>
+<FONT color="green">345</FONT>                // check for convergence<a name="line.345"></a>
+<FONT color="green">346</FONT>                double tolerance = Math.max(relativeAccuracy * z.abs(),<a name="line.346"></a>
+<FONT color="green">347</FONT>                                            absoluteAccuracy);<a name="line.347"></a>
+<FONT color="green">348</FONT>                if ((z.subtract(oldz)).abs() &lt;= tolerance) {<a name="line.348"></a>
+<FONT color="green">349</FONT>                    resultComputed = true;<a name="line.349"></a>
+<FONT color="green">350</FONT>                    iterationCount = i;<a name="line.350"></a>
+<FONT color="green">351</FONT>                    return z;<a name="line.351"></a>
+<FONT color="green">352</FONT>                }<a name="line.352"></a>
+<FONT color="green">353</FONT>                if (pv.abs() &lt;= functionValueAccuracy) {<a name="line.353"></a>
+<FONT color="green">354</FONT>                    resultComputed = true;<a name="line.354"></a>
+<FONT color="green">355</FONT>                    iterationCount = i;<a name="line.355"></a>
+<FONT color="green">356</FONT>                    return z;<a name="line.356"></a>
+<FONT color="green">357</FONT>                }<a name="line.357"></a>
+<FONT color="green">358</FONT>    <a name="line.358"></a>
+<FONT color="green">359</FONT>                // now pv != 0, calculate the new approximation<a name="line.359"></a>
+<FONT color="green">360</FONT>                G = dv.divide(pv);<a name="line.360"></a>
+<FONT color="green">361</FONT>                G2 = G.multiply(G);<a name="line.361"></a>
+<FONT color="green">362</FONT>                H = G2.subtract(d2v.divide(pv));<a name="line.362"></a>
+<FONT color="green">363</FONT>                delta = N1.multiply((N.multiply(H)).subtract(G2));<a name="line.363"></a>
+<FONT color="green">364</FONT>                // choose a denominator larger in magnitude<a name="line.364"></a>
+<FONT color="green">365</FONT>                Complex deltaSqrt = delta.sqrt();<a name="line.365"></a>
+<FONT color="green">366</FONT>                Complex dplus = G.add(deltaSqrt);<a name="line.366"></a>
+<FONT color="green">367</FONT>                Complex dminus = G.subtract(deltaSqrt);<a name="line.367"></a>
+<FONT color="green">368</FONT>                denominator = dplus.abs() &gt; dminus.abs() ? dplus : dminus;<a name="line.368"></a>
+<FONT color="green">369</FONT>                // Perturb z if denominator is zero, for instance,<a name="line.369"></a>
+<FONT color="green">370</FONT>                // p(x) = x^3 + 1, z = 0.<a name="line.370"></a>
+<FONT color="green">371</FONT>                if (denominator.equals(new Complex(0.0, 0.0))) {<a name="line.371"></a>
+<FONT color="green">372</FONT>                    z = z.add(new Complex(absoluteAccuracy, absoluteAccuracy));<a name="line.372"></a>
+<FONT color="green">373</FONT>                    oldz = new Complex(Double.POSITIVE_INFINITY,<a name="line.373"></a>
+<FONT color="green">374</FONT>                                       Double.POSITIVE_INFINITY);<a name="line.374"></a>
+<FONT color="green">375</FONT>                } else {<a name="line.375"></a>
+<FONT color="green">376</FONT>                    oldz = z;<a name="line.376"></a>
+<FONT color="green">377</FONT>                    z = z.subtract(N.divide(denominator));<a name="line.377"></a>
+<FONT color="green">378</FONT>                }<a name="line.378"></a>
+<FONT color="green">379</FONT>                i++;<a name="line.379"></a>
+<FONT color="green">380</FONT>            }<a name="line.380"></a>
+<FONT color="green">381</FONT>            throw new MaxIterationsExceededException(maximalIterationCount);<a name="line.381"></a>
+<FONT color="green">382</FONT>        }<a name="line.382"></a>
+<FONT color="green">383</FONT>    }<a name="line.383"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/MullerSolver.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,419 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.solvers;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Implements the &lt;a href="http://mathworld.wolfram.com/MullersMethod.html"&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Muller's Method&lt;/a&gt; for root finding of real univariate functions. For<a name="line.27"></a>
+<FONT color="green">028</FONT>     * reference, see &lt;b&gt;Elementary Numerical Analysis&lt;/b&gt;, ISBN 0070124477,<a name="line.28"></a>
+<FONT color="green">029</FONT>     * chapter 3.<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * Muller's method applies to both real and complex functions, but here we<a name="line.31"></a>
+<FONT color="green">032</FONT>     * restrict ourselves to real functions. Methods solve() and solve2() find<a name="line.32"></a>
+<FONT color="green">033</FONT>     * real zeros, using different ways to bypass complex arithmetics.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     *<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @version $Revision: 825919 $ $Date: 2009-10-16 10:51:55 -0400 (Fri, 16 Oct 2009) $<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @since 1.2<a name="line.36"></a>
+<FONT color="green">037</FONT>     */<a name="line.37"></a>
+<FONT color="green">038</FONT>    public class MullerSolver extends UnivariateRealSolverImpl {<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /**<a name="line.40"></a>
+<FONT color="green">041</FONT>         * Construct a solver for the given function.<a name="line.41"></a>
+<FONT color="green">042</FONT>         *<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @param f function to solve<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @deprecated as of 2.0 the function to solve is passed as an argument<a name="line.44"></a>
+<FONT color="green">045</FONT>         * to the {@link #solve(UnivariateRealFunction, double, double)} or<a name="line.45"></a>
+<FONT color="green">046</FONT>         * {@link UnivariateRealSolverImpl#solve(UnivariateRealFunction, double, double, double)}<a name="line.46"></a>
+<FONT color="green">047</FONT>         * method.<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        @Deprecated<a name="line.49"></a>
+<FONT color="green">050</FONT>        public MullerSolver(UnivariateRealFunction f) {<a name="line.50"></a>
+<FONT color="green">051</FONT>            super(f, 100, 1E-6);<a name="line.51"></a>
+<FONT color="green">052</FONT>        }<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /**<a name="line.54"></a>
+<FONT color="green">055</FONT>         * Construct a solver.<a name="line.55"></a>
+<FONT color="green">056</FONT>         */<a name="line.56"></a>
+<FONT color="green">057</FONT>        public MullerSolver() {<a name="line.57"></a>
+<FONT color="green">058</FONT>            super(100, 1E-6);<a name="line.58"></a>
+<FONT color="green">059</FONT>        }<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /** {@inheritDoc} */<a name="line.61"></a>
+<FONT color="green">062</FONT>        @Deprecated<a name="line.62"></a>
+<FONT color="green">063</FONT>        public double solve(final double min, final double max)<a name="line.63"></a>
+<FONT color="green">064</FONT>            throws ConvergenceException, FunctionEvaluationException {<a name="line.64"></a>
+<FONT color="green">065</FONT>            return solve(f, min, max);<a name="line.65"></a>
+<FONT color="green">066</FONT>        }<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /** {@inheritDoc} */<a name="line.68"></a>
+<FONT color="green">069</FONT>        @Deprecated<a name="line.69"></a>
+<FONT color="green">070</FONT>        public double solve(final double min, final double max, final double initial)<a name="line.70"></a>
+<FONT color="green">071</FONT>            throws ConvergenceException, FunctionEvaluationException {<a name="line.71"></a>
+<FONT color="green">072</FONT>            return solve(f, min, max, initial);<a name="line.72"></a>
+<FONT color="green">073</FONT>        }<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /**<a name="line.75"></a>
+<FONT color="green">076</FONT>         * Find a real root in the given interval with initial value.<a name="line.76"></a>
+<FONT color="green">077</FONT>         * &lt;p&gt;<a name="line.77"></a>
+<FONT color="green">078</FONT>         * Requires bracketing condition.&lt;/p&gt;<a name="line.78"></a>
+<FONT color="green">079</FONT>         *<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @param f the function to solve<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @param min the lower bound for the interval<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @param max the upper bound for the interval<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param initial the start value to use<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @return the point at which the function value is zero<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @throws MaxIterationsExceededException if the maximum iteration count is exceeded<a name="line.85"></a>
+<FONT color="green">086</FONT>         * or the solver detects convergence problems otherwise<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.87"></a>
+<FONT color="green">088</FONT>         * function<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.89"></a>
+<FONT color="green">090</FONT>         */<a name="line.90"></a>
+<FONT color="green">091</FONT>        public double solve(final UnivariateRealFunction f,<a name="line.91"></a>
+<FONT color="green">092</FONT>                            final double min, final double max, final double initial)<a name="line.92"></a>
+<FONT color="green">093</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>            // check for zeros before verifying bracketing<a name="line.95"></a>
+<FONT color="green">096</FONT>            if (f.value(min) == 0.0) { return min; }<a name="line.96"></a>
+<FONT color="green">097</FONT>            if (f.value(max) == 0.0) { return max; }<a name="line.97"></a>
+<FONT color="green">098</FONT>            if (f.value(initial) == 0.0) { return initial; }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>            verifyBracketing(min, max, f);<a name="line.100"></a>
+<FONT color="green">101</FONT>            verifySequence(min, initial, max);<a name="line.101"></a>
+<FONT color="green">102</FONT>            if (isBracketing(min, initial, f)) {<a name="line.102"></a>
+<FONT color="green">103</FONT>                return solve(f, min, initial);<a name="line.103"></a>
+<FONT color="green">104</FONT>            } else {<a name="line.104"></a>
+<FONT color="green">105</FONT>                return solve(f, initial, max);<a name="line.105"></a>
+<FONT color="green">106</FONT>            }<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /**<a name="line.109"></a>
+<FONT color="green">110</FONT>         * Find a real root in the given interval.<a name="line.110"></a>
+<FONT color="green">111</FONT>         * &lt;p&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>         * Original Muller's method would have function evaluation at complex point.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * Since our f(x) is real, we have to find ways to avoid that. Bracketing<a name="line.113"></a>
+<FONT color="green">114</FONT>         * condition is one way to go: by requiring bracketing in every iteration,<a name="line.114"></a>
+<FONT color="green">115</FONT>         * the newly computed approximation is guaranteed to be real.&lt;/p&gt;<a name="line.115"></a>
+<FONT color="green">116</FONT>         * &lt;p&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * Normally Muller's method converges quadratically in the vicinity of a<a name="line.117"></a>
+<FONT color="green">118</FONT>         * zero, however it may be very slow in regions far away from zeros. For<a name="line.118"></a>
+<FONT color="green">119</FONT>         * example, f(x) = exp(x) - 1, min = -50, max = 100. In such case we use<a name="line.119"></a>
+<FONT color="green">120</FONT>         * bisection as a safety backup if it performs very poorly.&lt;/p&gt;<a name="line.120"></a>
+<FONT color="green">121</FONT>         * &lt;p&gt;<a name="line.121"></a>
+<FONT color="green">122</FONT>         * The formulas here use divided differences directly.&lt;/p&gt;<a name="line.122"></a>
+<FONT color="green">123</FONT>         *<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @param f the function to solve<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @param min the lower bound for the interval<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @param max the upper bound for the interval<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @return the point at which the function value is zero<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @throws MaxIterationsExceededException if the maximum iteration count is exceeded<a name="line.128"></a>
+<FONT color="green">129</FONT>         * or the solver detects convergence problems otherwise<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.130"></a>
+<FONT color="green">131</FONT>         * function<a name="line.131"></a>
+<FONT color="green">132</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.132"></a>
+<FONT color="green">133</FONT>         */<a name="line.133"></a>
+<FONT color="green">134</FONT>        public double solve(final UnivariateRealFunction f,<a name="line.134"></a>
+<FONT color="green">135</FONT>                            final double min, final double max)<a name="line.135"></a>
+<FONT color="green">136</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.136"></a>
+<FONT color="green">137</FONT>    <a name="line.137"></a>
+<FONT color="green">138</FONT>            // [x0, x2] is the bracketing interval in each iteration<a name="line.138"></a>
+<FONT color="green">139</FONT>            // x1 is the last approximation and an interpolation point in (x0, x2)<a name="line.139"></a>
+<FONT color="green">140</FONT>            // x is the new root approximation and new x1 for next round<a name="line.140"></a>
+<FONT color="green">141</FONT>            // d01, d12, d012 are divided differences<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>            double x0 = min;<a name="line.143"></a>
+<FONT color="green">144</FONT>            double y0 = f.value(x0);<a name="line.144"></a>
+<FONT color="green">145</FONT>            double x2 = max;<a name="line.145"></a>
+<FONT color="green">146</FONT>            double y2 = f.value(x2);<a name="line.146"></a>
+<FONT color="green">147</FONT>            double x1 = 0.5 * (x0 + x2);<a name="line.147"></a>
+<FONT color="green">148</FONT>            double y1 = f.value(x1);<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>            // check for zeros before verifying bracketing<a name="line.150"></a>
+<FONT color="green">151</FONT>            if (y0 == 0.0) {<a name="line.151"></a>
+<FONT color="green">152</FONT>                return min;<a name="line.152"></a>
+<FONT color="green">153</FONT>            }<a name="line.153"></a>
+<FONT color="green">154</FONT>            if (y2 == 0.0) {<a name="line.154"></a>
+<FONT color="green">155</FONT>                return max;<a name="line.155"></a>
+<FONT color="green">156</FONT>            }<a name="line.156"></a>
+<FONT color="green">157</FONT>            verifyBracketing(min, max, f);<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>            double oldx = Double.POSITIVE_INFINITY;<a name="line.159"></a>
+<FONT color="green">160</FONT>            for (int i = 1; i &lt;= maximalIterationCount; ++i) {<a name="line.160"></a>
+<FONT color="green">161</FONT>                // Muller's method employs quadratic interpolation through<a name="line.161"></a>
+<FONT color="green">162</FONT>                // x0, x1, x2 and x is the zero of the interpolating parabola.<a name="line.162"></a>
+<FONT color="green">163</FONT>                // Due to bracketing condition, this parabola must have two<a name="line.163"></a>
+<FONT color="green">164</FONT>                // real roots and we choose one in [x0, x2] to be x.<a name="line.164"></a>
+<FONT color="green">165</FONT>                final double d01 = (y1 - y0) / (x1 - x0);<a name="line.165"></a>
+<FONT color="green">166</FONT>                final double d12 = (y2 - y1) / (x2 - x1);<a name="line.166"></a>
+<FONT color="green">167</FONT>                final double d012 = (d12 - d01) / (x2 - x0);<a name="line.167"></a>
+<FONT color="green">168</FONT>                final double c1 = d01 + (x1 - x0) * d012;<a name="line.168"></a>
+<FONT color="green">169</FONT>                final double delta = c1 * c1 - 4 * y1 * d012;<a name="line.169"></a>
+<FONT color="green">170</FONT>                final double xplus = x1 + (-2.0 * y1) / (c1 + Math.sqrt(delta));<a name="line.170"></a>
+<FONT color="green">171</FONT>                final double xminus = x1 + (-2.0 * y1) / (c1 - Math.sqrt(delta));<a name="line.171"></a>
+<FONT color="green">172</FONT>                // xplus and xminus are two roots of parabola and at least<a name="line.172"></a>
+<FONT color="green">173</FONT>                // one of them should lie in (x0, x2)<a name="line.173"></a>
+<FONT color="green">174</FONT>                final double x = isSequence(x0, xplus, x2) ? xplus : xminus;<a name="line.174"></a>
+<FONT color="green">175</FONT>                final double y = f.value(x);<a name="line.175"></a>
+<FONT color="green">176</FONT>    <a name="line.176"></a>
+<FONT color="green">177</FONT>                // check for convergence<a name="line.177"></a>
+<FONT color="green">178</FONT>                final double tolerance = Math.max(relativeAccuracy * Math.abs(x), absoluteAccuracy);<a name="line.178"></a>
+<FONT color="green">179</FONT>                if (Math.abs(x - oldx) &lt;= tolerance) {<a name="line.179"></a>
+<FONT color="green">180</FONT>                    setResult(x, i);<a name="line.180"></a>
+<FONT color="green">181</FONT>                    return result;<a name="line.181"></a>
+<FONT color="green">182</FONT>                }<a name="line.182"></a>
+<FONT color="green">183</FONT>                if (Math.abs(y) &lt;= functionValueAccuracy) {<a name="line.183"></a>
+<FONT color="green">184</FONT>                    setResult(x, i);<a name="line.184"></a>
+<FONT color="green">185</FONT>                    return result;<a name="line.185"></a>
+<FONT color="green">186</FONT>                }<a name="line.186"></a>
+<FONT color="green">187</FONT>    <a name="line.187"></a>
+<FONT color="green">188</FONT>                // Bisect if convergence is too slow. Bisection would waste<a name="line.188"></a>
+<FONT color="green">189</FONT>                // our calculation of x, hopefully it won't happen often.<a name="line.189"></a>
+<FONT color="green">190</FONT>                // the real number equality test x == x1 is intentional and<a name="line.190"></a>
+<FONT color="green">191</FONT>                // completes the proximity tests above it<a name="line.191"></a>
+<FONT color="green">192</FONT>                boolean bisect = (x &lt; x1 &amp;&amp; (x1 - x0) &gt; 0.95 * (x2 - x0)) ||<a name="line.192"></a>
+<FONT color="green">193</FONT>                                 (x &gt; x1 &amp;&amp; (x2 - x1) &gt; 0.95 * (x2 - x0)) ||<a name="line.193"></a>
+<FONT color="green">194</FONT>                                 (x == x1);<a name="line.194"></a>
+<FONT color="green">195</FONT>                // prepare the new bracketing interval for next iteration<a name="line.195"></a>
+<FONT color="green">196</FONT>                if (!bisect) {<a name="line.196"></a>
+<FONT color="green">197</FONT>                    x0 = x &lt; x1 ? x0 : x1;<a name="line.197"></a>
+<FONT color="green">198</FONT>                    y0 = x &lt; x1 ? y0 : y1;<a name="line.198"></a>
+<FONT color="green">199</FONT>                    x2 = x &gt; x1 ? x2 : x1;<a name="line.199"></a>
+<FONT color="green">200</FONT>                    y2 = x &gt; x1 ? y2 : y1;<a name="line.200"></a>
+<FONT color="green">201</FONT>                    x1 = x; y1 = y;<a name="line.201"></a>
+<FONT color="green">202</FONT>                    oldx = x;<a name="line.202"></a>
+<FONT color="green">203</FONT>                } else {<a name="line.203"></a>
+<FONT color="green">204</FONT>                    double xm = 0.5 * (x0 + x2);<a name="line.204"></a>
+<FONT color="green">205</FONT>                    double ym = f.value(xm);<a name="line.205"></a>
+<FONT color="green">206</FONT>                    if (MathUtils.sign(y0) + MathUtils.sign(ym) == 0.0) {<a name="line.206"></a>
+<FONT color="green">207</FONT>                        x2 = xm; y2 = ym;<a name="line.207"></a>
+<FONT color="green">208</FONT>                    } else {<a name="line.208"></a>
+<FONT color="green">209</FONT>                        x0 = xm; y0 = ym;<a name="line.209"></a>
+<FONT color="green">210</FONT>                    }<a name="line.210"></a>
+<FONT color="green">211</FONT>                    x1 = 0.5 * (x0 + x2);<a name="line.211"></a>
+<FONT color="green">212</FONT>                    y1 = f.value(x1);<a name="line.212"></a>
+<FONT color="green">213</FONT>                    oldx = Double.POSITIVE_INFINITY;<a name="line.213"></a>
+<FONT color="green">214</FONT>                }<a name="line.214"></a>
+<FONT color="green">215</FONT>            }<a name="line.215"></a>
+<FONT color="green">216</FONT>            throw new MaxIterationsExceededException(maximalIterationCount);<a name="line.216"></a>
+<FONT color="green">217</FONT>        }<a name="line.217"></a>
+<FONT color="green">218</FONT>    <a name="line.218"></a>
+<FONT color="green">219</FONT>        /**<a name="line.219"></a>
+<FONT color="green">220</FONT>         * Find a real root in the given interval.<a name="line.220"></a>
+<FONT color="green">221</FONT>         * &lt;p&gt;<a name="line.221"></a>
+<FONT color="green">222</FONT>         * solve2() differs from solve() in the way it avoids complex operations.<a name="line.222"></a>
+<FONT color="green">223</FONT>         * Except for the initial [min, max], solve2() does not require bracketing<a name="line.223"></a>
+<FONT color="green">224</FONT>         * condition, e.g. f(x0), f(x1), f(x2) can have the same sign. If complex<a name="line.224"></a>
+<FONT color="green">225</FONT>         * number arises in the computation, we simply use its modulus as real<a name="line.225"></a>
+<FONT color="green">226</FONT>         * approximation.&lt;/p&gt;<a name="line.226"></a>
+<FONT color="green">227</FONT>         * &lt;p&gt;<a name="line.227"></a>
+<FONT color="green">228</FONT>         * Because the interval may not be bracketing, bisection alternative is<a name="line.228"></a>
+<FONT color="green">229</FONT>         * not applicable here. However in practice our treatment usually works<a name="line.229"></a>
+<FONT color="green">230</FONT>         * well, especially near real zeros where the imaginary part of complex<a name="line.230"></a>
+<FONT color="green">231</FONT>         * approximation is often negligible.&lt;/p&gt;<a name="line.231"></a>
+<FONT color="green">232</FONT>         * &lt;p&gt;<a name="line.232"></a>
+<FONT color="green">233</FONT>         * The formulas here do not use divided differences directly.&lt;/p&gt;<a name="line.233"></a>
+<FONT color="green">234</FONT>         *<a name="line.234"></a>
+<FONT color="green">235</FONT>         * @param min the lower bound for the interval<a name="line.235"></a>
+<FONT color="green">236</FONT>         * @param max the upper bound for the interval<a name="line.236"></a>
+<FONT color="green">237</FONT>         * @return the point at which the function value is zero<a name="line.237"></a>
+<FONT color="green">238</FONT>         * @throws MaxIterationsExceededException if the maximum iteration count is exceeded<a name="line.238"></a>
+<FONT color="green">239</FONT>         * or the solver detects convergence problems otherwise<a name="line.239"></a>
+<FONT color="green">240</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.240"></a>
+<FONT color="green">241</FONT>         * function<a name="line.241"></a>
+<FONT color="green">242</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.242"></a>
+<FONT color="green">243</FONT>         * @deprecated replaced by {@link #solve2(UnivariateRealFunction, double, double)}<a name="line.243"></a>
+<FONT color="green">244</FONT>         * since 2.0<a name="line.244"></a>
+<FONT color="green">245</FONT>         */<a name="line.245"></a>
+<FONT color="green">246</FONT>        @Deprecated<a name="line.246"></a>
+<FONT color="green">247</FONT>        public double solve2(final double min, final double max)<a name="line.247"></a>
+<FONT color="green">248</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.248"></a>
+<FONT color="green">249</FONT>            return solve2(f, min, max);<a name="line.249"></a>
+<FONT color="green">250</FONT>        }<a name="line.250"></a>
+<FONT color="green">251</FONT>    <a name="line.251"></a>
+<FONT color="green">252</FONT>        /**<a name="line.252"></a>
+<FONT color="green">253</FONT>         * Find a real root in the given interval.<a name="line.253"></a>
+<FONT color="green">254</FONT>         * &lt;p&gt;<a name="line.254"></a>
+<FONT color="green">255</FONT>         * solve2() differs from solve() in the way it avoids complex operations.<a name="line.255"></a>
+<FONT color="green">256</FONT>         * Except for the initial [min, max], solve2() does not require bracketing<a name="line.256"></a>
+<FONT color="green">257</FONT>         * condition, e.g. f(x0), f(x1), f(x2) can have the same sign. If complex<a name="line.257"></a>
+<FONT color="green">258</FONT>         * number arises in the computation, we simply use its modulus as real<a name="line.258"></a>
+<FONT color="green">259</FONT>         * approximation.&lt;/p&gt;<a name="line.259"></a>
+<FONT color="green">260</FONT>         * &lt;p&gt;<a name="line.260"></a>
+<FONT color="green">261</FONT>         * Because the interval may not be bracketing, bisection alternative is<a name="line.261"></a>
+<FONT color="green">262</FONT>         * not applicable here. However in practice our treatment usually works<a name="line.262"></a>
+<FONT color="green">263</FONT>         * well, especially near real zeros where the imaginary part of complex<a name="line.263"></a>
+<FONT color="green">264</FONT>         * approximation is often negligible.&lt;/p&gt;<a name="line.264"></a>
+<FONT color="green">265</FONT>         * &lt;p&gt;<a name="line.265"></a>
+<FONT color="green">266</FONT>         * The formulas here do not use divided differences directly.&lt;/p&gt;<a name="line.266"></a>
+<FONT color="green">267</FONT>         *<a name="line.267"></a>
+<FONT color="green">268</FONT>         * @param f the function to solve<a name="line.268"></a>
+<FONT color="green">269</FONT>         * @param min the lower bound for the interval<a name="line.269"></a>
+<FONT color="green">270</FONT>         * @param max the upper bound for the interval<a name="line.270"></a>
+<FONT color="green">271</FONT>         * @return the point at which the function value is zero<a name="line.271"></a>
+<FONT color="green">272</FONT>         * @throws MaxIterationsExceededException if the maximum iteration count is exceeded<a name="line.272"></a>
+<FONT color="green">273</FONT>         * or the solver detects convergence problems otherwise<a name="line.273"></a>
+<FONT color="green">274</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.274"></a>
+<FONT color="green">275</FONT>         * function<a name="line.275"></a>
+<FONT color="green">276</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.276"></a>
+<FONT color="green">277</FONT>         */<a name="line.277"></a>
+<FONT color="green">278</FONT>        public double solve2(final UnivariateRealFunction f,<a name="line.278"></a>
+<FONT color="green">279</FONT>                             final double min, final double max)<a name="line.279"></a>
+<FONT color="green">280</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.280"></a>
+<FONT color="green">281</FONT>    <a name="line.281"></a>
+<FONT color="green">282</FONT>            // x2 is the last root approximation<a name="line.282"></a>
+<FONT color="green">283</FONT>            // x is the new approximation and new x2 for next round<a name="line.283"></a>
+<FONT color="green">284</FONT>            // x0 &lt; x1 &lt; x2 does not hold here<a name="line.284"></a>
+<FONT color="green">285</FONT>    <a name="line.285"></a>
+<FONT color="green">286</FONT>            double x0 = min;<a name="line.286"></a>
+<FONT color="green">287</FONT>            double y0 = f.value(x0);<a name="line.287"></a>
+<FONT color="green">288</FONT>            double x1 = max;<a name="line.288"></a>
+<FONT color="green">289</FONT>            double y1 = f.value(x1);<a name="line.289"></a>
+<FONT color="green">290</FONT>            double x2 = 0.5 * (x0 + x1);<a name="line.290"></a>
+<FONT color="green">291</FONT>            double y2 = f.value(x2);<a name="line.291"></a>
+<FONT color="green">292</FONT>    <a name="line.292"></a>
+<FONT color="green">293</FONT>            // check for zeros before verifying bracketing<a name="line.293"></a>
+<FONT color="green">294</FONT>            if (y0 == 0.0) { return min; }<a name="line.294"></a>
+<FONT color="green">295</FONT>            if (y1 == 0.0) { return max; }<a name="line.295"></a>
+<FONT color="green">296</FONT>            verifyBracketing(min, max, f);<a name="line.296"></a>
+<FONT color="green">297</FONT>    <a name="line.297"></a>
+<FONT color="green">298</FONT>            double oldx = Double.POSITIVE_INFINITY;<a name="line.298"></a>
+<FONT color="green">299</FONT>            for (int i = 1; i &lt;= maximalIterationCount; ++i) {<a name="line.299"></a>
+<FONT color="green">300</FONT>                // quadratic interpolation through x0, x1, x2<a name="line.300"></a>
+<FONT color="green">301</FONT>                final double q = (x2 - x1) / (x1 - x0);<a name="line.301"></a>
+<FONT color="green">302</FONT>                final double a = q * (y2 - (1 + q) * y1 + q * y0);<a name="line.302"></a>
+<FONT color="green">303</FONT>                final double b = (2 * q + 1) * y2 - (1 + q) * (1 + q) * y1 + q * q * y0;<a name="line.303"></a>
+<FONT color="green">304</FONT>                final double c = (1 + q) * y2;<a name="line.304"></a>
+<FONT color="green">305</FONT>                final double delta = b * b - 4 * a * c;<a name="line.305"></a>
+<FONT color="green">306</FONT>                double x;<a name="line.306"></a>
+<FONT color="green">307</FONT>                final double denominator;<a name="line.307"></a>
+<FONT color="green">308</FONT>                if (delta &gt;= 0.0) {<a name="line.308"></a>
+<FONT color="green">309</FONT>                    // choose a denominator larger in magnitude<a name="line.309"></a>
+<FONT color="green">310</FONT>                    double dplus = b + Math.sqrt(delta);<a name="line.310"></a>
+<FONT color="green">311</FONT>                    double dminus = b - Math.sqrt(delta);<a name="line.311"></a>
+<FONT color="green">312</FONT>                    denominator = Math.abs(dplus) &gt; Math.abs(dminus) ? dplus : dminus;<a name="line.312"></a>
+<FONT color="green">313</FONT>                } else {<a name="line.313"></a>
+<FONT color="green">314</FONT>                    // take the modulus of (B +/- Math.sqrt(delta))<a name="line.314"></a>
+<FONT color="green">315</FONT>                    denominator = Math.sqrt(b * b - delta);<a name="line.315"></a>
+<FONT color="green">316</FONT>                }<a name="line.316"></a>
+<FONT color="green">317</FONT>                if (denominator != 0) {<a name="line.317"></a>
+<FONT color="green">318</FONT>                    x = x2 - 2.0 * c * (x2 - x1) / denominator;<a name="line.318"></a>
+<FONT color="green">319</FONT>                    // perturb x if it exactly coincides with x1 or x2<a name="line.319"></a>
+<FONT color="green">320</FONT>                    // the equality tests here are intentional<a name="line.320"></a>
+<FONT color="green">321</FONT>                    while (x == x1 || x == x2) {<a name="line.321"></a>
+<FONT color="green">322</FONT>                        x += absoluteAccuracy;<a name="line.322"></a>
+<FONT color="green">323</FONT>                    }<a name="line.323"></a>
+<FONT color="green">324</FONT>                } else {<a name="line.324"></a>
+<FONT color="green">325</FONT>                    // extremely rare case, get a random number to skip it<a name="line.325"></a>
+<FONT color="green">326</FONT>                    x = min + Math.random() * (max - min);<a name="line.326"></a>
+<FONT color="green">327</FONT>                    oldx = Double.POSITIVE_INFINITY;<a name="line.327"></a>
+<FONT color="green">328</FONT>                }<a name="line.328"></a>
+<FONT color="green">329</FONT>                final double y = f.value(x);<a name="line.329"></a>
+<FONT color="green">330</FONT>    <a name="line.330"></a>
+<FONT color="green">331</FONT>                // check for convergence<a name="line.331"></a>
+<FONT color="green">332</FONT>                final double tolerance = Math.max(relativeAccuracy * Math.abs(x), absoluteAccuracy);<a name="line.332"></a>
+<FONT color="green">333</FONT>                if (Math.abs(x - oldx) &lt;= tolerance) {<a name="line.333"></a>
+<FONT color="green">334</FONT>                    setResult(x, i);<a name="line.334"></a>
+<FONT color="green">335</FONT>                    return result;<a name="line.335"></a>
+<FONT color="green">336</FONT>                }<a name="line.336"></a>
+<FONT color="green">337</FONT>                if (Math.abs(y) &lt;= functionValueAccuracy) {<a name="line.337"></a>
+<FONT color="green">338</FONT>                    setResult(x, i);<a name="line.338"></a>
+<FONT color="green">339</FONT>                    return result;<a name="line.339"></a>
+<FONT color="green">340</FONT>                }<a name="line.340"></a>
+<FONT color="green">341</FONT>    <a name="line.341"></a>
+<FONT color="green">342</FONT>                // prepare the next iteration<a name="line.342"></a>
+<FONT color="green">343</FONT>                x0 = x1;<a name="line.343"></a>
+<FONT color="green">344</FONT>                y0 = y1;<a name="line.344"></a>
+<FONT color="green">345</FONT>                x1 = x2;<a name="line.345"></a>
+<FONT color="green">346</FONT>                y1 = y2;<a name="line.346"></a>
+<FONT color="green">347</FONT>                x2 = x;<a name="line.347"></a>
+<FONT color="green">348</FONT>                y2 = y;<a name="line.348"></a>
+<FONT color="green">349</FONT>                oldx = x;<a name="line.349"></a>
+<FONT color="green">350</FONT>            }<a name="line.350"></a>
+<FONT color="green">351</FONT>            throw new MaxIterationsExceededException(maximalIterationCount);<a name="line.351"></a>
+<FONT color="green">352</FONT>        }<a name="line.352"></a>
+<FONT color="green">353</FONT>    }<a name="line.353"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/NewtonSolver.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,202 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.analysis.solvers;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.analysis.DifferentiableUnivariateRealFunction;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Implements &lt;a href="http://mathworld.wolfram.com/NewtonsMethod.html"&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Newton's Method&lt;/a&gt; for finding zeros of real univariate functions.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * The function should be continuous but not necessarily smooth.&lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     *<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public class NewtonSolver extends UnivariateRealSolverImpl {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /**<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Construct a solver for the given function.<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @param f function to solve.<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @deprecated as of 2.0 the function to solve is passed as an argument<a name="line.39"></a>
+<FONT color="green">040</FONT>         * to the {@link #solve(UnivariateRealFunction, double, double)} or<a name="line.40"></a>
+<FONT color="green">041</FONT>         * {@link UnivariateRealSolverImpl#solve(UnivariateRealFunction, double, double, double)}<a name="line.41"></a>
+<FONT color="green">042</FONT>         * method.<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        @Deprecated<a name="line.44"></a>
+<FONT color="green">045</FONT>        public NewtonSolver(DifferentiableUnivariateRealFunction f) {<a name="line.45"></a>
+<FONT color="green">046</FONT>            super(f, 100, 1E-6);<a name="line.46"></a>
+<FONT color="green">047</FONT>        }<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /**<a name="line.49"></a>
+<FONT color="green">050</FONT>         * Construct a solver.<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        public NewtonSolver() {<a name="line.52"></a>
+<FONT color="green">053</FONT>            super(100, 1E-6);<a name="line.53"></a>
+<FONT color="green">054</FONT>        }<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** {@inheritDoc} */<a name="line.56"></a>
+<FONT color="green">057</FONT>        @Deprecated<a name="line.57"></a>
+<FONT color="green">058</FONT>        public double solve(final double min, final double max)<a name="line.58"></a>
+<FONT color="green">059</FONT>            throws MaxIterationsExceededException,<a name="line.59"></a>
+<FONT color="green">060</FONT>            FunctionEvaluationException  {<a name="line.60"></a>
+<FONT color="green">061</FONT>            return solve(f, min, max);<a name="line.61"></a>
+<FONT color="green">062</FONT>        }<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /** {@inheritDoc} */<a name="line.64"></a>
+<FONT color="green">065</FONT>        @Deprecated<a name="line.65"></a>
+<FONT color="green">066</FONT>        public double solve(final double min, final double max, final double startValue)<a name="line.66"></a>
+<FONT color="green">067</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException  {<a name="line.67"></a>
+<FONT color="green">068</FONT>            return solve(f, min, max, startValue);<a name="line.68"></a>
+<FONT color="green">069</FONT>        }<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /**<a name="line.71"></a>
+<FONT color="green">072</FONT>         * Find a zero near the midpoint of &lt;code&gt;min&lt;/code&gt; and &lt;code&gt;max&lt;/code&gt;.<a name="line.72"></a>
+<FONT color="green">073</FONT>         *<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @param f the function to solve<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @param min the lower bound for the interval<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @param max the upper bound for the interval<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @return the value where the function is zero<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @throws MaxIterationsExceededException if the maximum iteration count is exceeded<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.79"></a>
+<FONT color="green">080</FONT>         * function or derivative<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @throws IllegalArgumentException if min is not less than max<a name="line.81"></a>
+<FONT color="green">082</FONT>         */<a name="line.82"></a>
+<FONT color="green">083</FONT>        public double solve(final UnivariateRealFunction f,<a name="line.83"></a>
+<FONT color="green">084</FONT>                            final double min, final double max)<a name="line.84"></a>
+<FONT color="green">085</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException  {<a name="line.85"></a>
+<FONT color="green">086</FONT>            return solve(f, min, max, UnivariateRealSolverUtils.midpoint(min, max));<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /**<a name="line.89"></a>
+<FONT color="green">090</FONT>         * Find a zero near the value &lt;code&gt;startValue&lt;/code&gt;.<a name="line.90"></a>
+<FONT color="green">091</FONT>         *<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @param f the function to solve<a name="line.92"></a>
+<FONT color="green">093</FONT>         * @param min the lower bound for the interval (ignored).<a name="line.93"></a>
+<FONT color="green">094</FONT>         * @param max the upper bound for the interval (ignored).<a name="line.94"></a>
+<FONT color="green">095</FONT>         * @param startValue the start value to use.<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @return the value where the function is zero<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @throws MaxIterationsExceededException if the maximum iteration count is exceeded<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.98"></a>
+<FONT color="green">099</FONT>         * function or derivative<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @throws IllegalArgumentException if startValue is not between min and max or<a name="line.100"></a>
+<FONT color="green">101</FONT>         * if function is not a {@link DifferentiableUnivariateRealFunction} instance<a name="line.101"></a>
+<FONT color="green">102</FONT>         */<a name="line.102"></a>
+<FONT color="green">103</FONT>        public double solve(final UnivariateRealFunction f,<a name="line.103"></a>
+<FONT color="green">104</FONT>                            final double min, final double max, final double startValue)<a name="line.104"></a>
+<FONT color="green">105</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.105"></a>
+<FONT color="green">106</FONT>    <a name="line.106"></a>
+<FONT color="green">107</FONT>            try {<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>                final UnivariateRealFunction derivative =<a name="line.109"></a>
+<FONT color="green">110</FONT>                    ((DifferentiableUnivariateRealFunction) f).derivative();<a name="line.110"></a>
+<FONT color="green">111</FONT>                clearResult();<a name="line.111"></a>
+<FONT color="green">112</FONT>                verifySequence(min, startValue, max);<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>                double x0 = startValue;<a name="line.114"></a>
+<FONT color="green">115</FONT>                double x1;<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>                int i = 0;<a name="line.117"></a>
+<FONT color="green">118</FONT>                while (i &lt; maximalIterationCount) {<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>                    x1 = x0 - (f.value(x0) / derivative.value(x0));<a name="line.120"></a>
+<FONT color="green">121</FONT>                    if (Math.abs(x1 - x0) &lt;= absoluteAccuracy) {<a name="line.121"></a>
+<FONT color="green">122</FONT>                        setResult(x1, i);<a name="line.122"></a>
+<FONT color="green">123</FONT>                        return x1;<a name="line.123"></a>
+<FONT color="green">124</FONT>                    }<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>                    x0 = x1;<a name="line.126"></a>
+<FONT color="green">127</FONT>                    ++i;<a name="line.127"></a>
+<FONT color="green">128</FONT>                }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>                throw new MaxIterationsExceededException(maximalIterationCount);<a name="line.130"></a>
+<FONT color="green">131</FONT>            } catch (ClassCastException cce) {<a name="line.131"></a>
+<FONT color="green">132</FONT>                throw MathRuntimeException.createIllegalArgumentException("function is not differentiable");<a name="line.132"></a>
+<FONT color="green">133</FONT>            }<a name="line.133"></a>
+<FONT color="green">134</FONT>        }<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>    }<a name="line.136"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/RiddersSolver.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,263 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.solvers;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Implements the &lt;a href="http://mathworld.wolfram.com/RiddersMethod.html"&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Ridders' Method&lt;/a&gt; for root finding of real univariate functions. For<a name="line.27"></a>
+<FONT color="green">028</FONT>     * reference, see C. Ridders, &lt;i&gt;A new algorithm for computing a single root<a name="line.28"></a>
+<FONT color="green">029</FONT>     * of a real continuous function &lt;/i&gt;, IEEE Transactions on Circuits and<a name="line.29"></a>
+<FONT color="green">030</FONT>     * Systems, 26 (1979), 979 - 980.<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * The function should be continuous but not necessarily smooth.&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @version $Revision: 825919 $ $Date: 2009-10-16 10:51:55 -0400 (Fri, 16 Oct 2009) $<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @since 1.2<a name="line.35"></a>
+<FONT color="green">036</FONT>     */<a name="line.36"></a>
+<FONT color="green">037</FONT>    public class RiddersSolver extends UnivariateRealSolverImpl {<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /**<a name="line.39"></a>
+<FONT color="green">040</FONT>         * Construct a solver for the given function.<a name="line.40"></a>
+<FONT color="green">041</FONT>         *<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @param f function to solve<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @deprecated as of 2.0 the function to solve is passed as an argument<a name="line.43"></a>
+<FONT color="green">044</FONT>         * to the {@link #solve(UnivariateRealFunction, double, double)} or<a name="line.44"></a>
+<FONT color="green">045</FONT>         * {@link UnivariateRealSolverImpl#solve(UnivariateRealFunction, double, double, double)}<a name="line.45"></a>
+<FONT color="green">046</FONT>         * method.<a name="line.46"></a>
+<FONT color="green">047</FONT>         */<a name="line.47"></a>
+<FONT color="green">048</FONT>        @Deprecated<a name="line.48"></a>
+<FONT color="green">049</FONT>        public RiddersSolver(UnivariateRealFunction f) {<a name="line.49"></a>
+<FONT color="green">050</FONT>            super(f, 100, 1E-6);<a name="line.50"></a>
+<FONT color="green">051</FONT>        }<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Construct a solver.<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public RiddersSolver() {<a name="line.56"></a>
+<FONT color="green">057</FONT>            super(100, 1E-6);<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** {@inheritDoc} */<a name="line.60"></a>
+<FONT color="green">061</FONT>        @Deprecated<a name="line.61"></a>
+<FONT color="green">062</FONT>        public double solve(final double min, final double max)<a name="line.62"></a>
+<FONT color="green">063</FONT>            throws ConvergenceException, FunctionEvaluationException {<a name="line.63"></a>
+<FONT color="green">064</FONT>            return solve(f, min, max);<a name="line.64"></a>
+<FONT color="green">065</FONT>        }<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /** {@inheritDoc} */<a name="line.67"></a>
+<FONT color="green">068</FONT>        @Deprecated<a name="line.68"></a>
+<FONT color="green">069</FONT>        public double solve(final double min, final double max, final double initial)<a name="line.69"></a>
+<FONT color="green">070</FONT>            throws ConvergenceException, FunctionEvaluationException {<a name="line.70"></a>
+<FONT color="green">071</FONT>            return solve(f, min, max, initial);<a name="line.71"></a>
+<FONT color="green">072</FONT>        }<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /**<a name="line.74"></a>
+<FONT color="green">075</FONT>         * Find a root in the given interval with initial value.<a name="line.75"></a>
+<FONT color="green">076</FONT>         * &lt;p&gt;<a name="line.76"></a>
+<FONT color="green">077</FONT>         * Requires bracketing condition.&lt;/p&gt;<a name="line.77"></a>
+<FONT color="green">078</FONT>         *<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @param f the function to solve<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @param min the lower bound for the interval<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @param max the upper bound for the interval<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @param initial the start value to use<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @return the point at which the function value is zero<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @throws MaxIterationsExceededException if the maximum iteration count is exceeded<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.85"></a>
+<FONT color="green">086</FONT>         * function<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.87"></a>
+<FONT color="green">088</FONT>         */<a name="line.88"></a>
+<FONT color="green">089</FONT>        public double solve(final UnivariateRealFunction f,<a name="line.89"></a>
+<FONT color="green">090</FONT>                            final double min, final double max, final double initial)<a name="line.90"></a>
+<FONT color="green">091</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>            // check for zeros before verifying bracketing<a name="line.93"></a>
+<FONT color="green">094</FONT>            if (f.value(min) == 0.0) { return min; }<a name="line.94"></a>
+<FONT color="green">095</FONT>            if (f.value(max) == 0.0) { return max; }<a name="line.95"></a>
+<FONT color="green">096</FONT>            if (f.value(initial) == 0.0) { return initial; }<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>            verifyBracketing(min, max, f);<a name="line.98"></a>
+<FONT color="green">099</FONT>            verifySequence(min, initial, max);<a name="line.99"></a>
+<FONT color="green">100</FONT>            if (isBracketing(min, initial, f)) {<a name="line.100"></a>
+<FONT color="green">101</FONT>                return solve(f, min, initial);<a name="line.101"></a>
+<FONT color="green">102</FONT>            } else {<a name="line.102"></a>
+<FONT color="green">103</FONT>                return solve(f, initial, max);<a name="line.103"></a>
+<FONT color="green">104</FONT>            }<a name="line.104"></a>
+<FONT color="green">105</FONT>        }<a name="line.105"></a>
+<FONT color="green">106</FONT>    <a name="line.106"></a>
+<FONT color="green">107</FONT>        /**<a name="line.107"></a>
+<FONT color="green">108</FONT>         * Find a root in the given interval.<a name="line.108"></a>
+<FONT color="green">109</FONT>         * &lt;p&gt;<a name="line.109"></a>
+<FONT color="green">110</FONT>         * Requires bracketing condition.&lt;/p&gt;<a name="line.110"></a>
+<FONT color="green">111</FONT>         *<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @param f the function to solve<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param min the lower bound for the interval<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param max the upper bound for the interval<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @return the point at which the function value is zero<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @throws MaxIterationsExceededException if the maximum iteration count is exceeded<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.117"></a>
+<FONT color="green">118</FONT>         * function<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.119"></a>
+<FONT color="green">120</FONT>         */<a name="line.120"></a>
+<FONT color="green">121</FONT>        public double solve(final UnivariateRealFunction f,<a name="line.121"></a>
+<FONT color="green">122</FONT>                            final double min, final double max)<a name="line.122"></a>
+<FONT color="green">123</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>            // [x1, x2] is the bracketing interval in each iteration<a name="line.125"></a>
+<FONT color="green">126</FONT>            // x3 is the midpoint of [x1, x2]<a name="line.126"></a>
+<FONT color="green">127</FONT>            // x is the new root approximation and an endpoint of the new interval<a name="line.127"></a>
+<FONT color="green">128</FONT>            double x1 = min;<a name="line.128"></a>
+<FONT color="green">129</FONT>            double y1 = f.value(x1);<a name="line.129"></a>
+<FONT color="green">130</FONT>            double x2 = max;<a name="line.130"></a>
+<FONT color="green">131</FONT>            double y2 = f.value(x2);<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>            // check for zeros before verifying bracketing<a name="line.133"></a>
+<FONT color="green">134</FONT>            if (y1 == 0.0) {<a name="line.134"></a>
+<FONT color="green">135</FONT>                return min;<a name="line.135"></a>
+<FONT color="green">136</FONT>            }<a name="line.136"></a>
+<FONT color="green">137</FONT>            if (y2 == 0.0) {<a name="line.137"></a>
+<FONT color="green">138</FONT>                return max;<a name="line.138"></a>
+<FONT color="green">139</FONT>            }<a name="line.139"></a>
+<FONT color="green">140</FONT>            verifyBracketing(min, max, f);<a name="line.140"></a>
+<FONT color="green">141</FONT>    <a name="line.141"></a>
+<FONT color="green">142</FONT>            int i = 1;<a name="line.142"></a>
+<FONT color="green">143</FONT>            double oldx = Double.POSITIVE_INFINITY;<a name="line.143"></a>
+<FONT color="green">144</FONT>            while (i &lt;= maximalIterationCount) {<a name="line.144"></a>
+<FONT color="green">145</FONT>                // calculate the new root approximation<a name="line.145"></a>
+<FONT color="green">146</FONT>                final double x3 = 0.5 * (x1 + x2);<a name="line.146"></a>
+<FONT color="green">147</FONT>                final double y3 = f.value(x3);<a name="line.147"></a>
+<FONT color="green">148</FONT>                if (Math.abs(y3) &lt;= functionValueAccuracy) {<a name="line.148"></a>
+<FONT color="green">149</FONT>                    setResult(x3, i);<a name="line.149"></a>
+<FONT color="green">150</FONT>                    return result;<a name="line.150"></a>
+<FONT color="green">151</FONT>                }<a name="line.151"></a>
+<FONT color="green">152</FONT>                final double delta = 1 - (y1 * y2) / (y3 * y3);  // delta &gt; 1 due to bracketing<a name="line.152"></a>
+<FONT color="green">153</FONT>                final double correction = (MathUtils.sign(y2) * MathUtils.sign(y3)) *<a name="line.153"></a>
+<FONT color="green">154</FONT>                                          (x3 - x1) / Math.sqrt(delta);<a name="line.154"></a>
+<FONT color="green">155</FONT>                final double x = x3 - correction;                // correction != 0<a name="line.155"></a>
+<FONT color="green">156</FONT>                final double y = f.value(x);<a name="line.156"></a>
+<FONT color="green">157</FONT>    <a name="line.157"></a>
+<FONT color="green">158</FONT>                // check for convergence<a name="line.158"></a>
+<FONT color="green">159</FONT>                final double tolerance = Math.max(relativeAccuracy * Math.abs(x), absoluteAccuracy);<a name="line.159"></a>
+<FONT color="green">160</FONT>                if (Math.abs(x - oldx) &lt;= tolerance) {<a name="line.160"></a>
+<FONT color="green">161</FONT>                    setResult(x, i);<a name="line.161"></a>
+<FONT color="green">162</FONT>                    return result;<a name="line.162"></a>
+<FONT color="green">163</FONT>                }<a name="line.163"></a>
+<FONT color="green">164</FONT>                if (Math.abs(y) &lt;= functionValueAccuracy) {<a name="line.164"></a>
+<FONT color="green">165</FONT>                    setResult(x, i);<a name="line.165"></a>
+<FONT color="green">166</FONT>                    return result;<a name="line.166"></a>
+<FONT color="green">167</FONT>                }<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>                // prepare the new interval for next iteration<a name="line.169"></a>
+<FONT color="green">170</FONT>                // Ridders' method guarantees x1 &lt; x &lt; x2<a name="line.170"></a>
+<FONT color="green">171</FONT>                if (correction &gt; 0.0) {             // x1 &lt; x &lt; x3<a name="line.171"></a>
+<FONT color="green">172</FONT>                    if (MathUtils.sign(y1) + MathUtils.sign(y) == 0.0) {<a name="line.172"></a>
+<FONT color="green">173</FONT>                        x2 = x;<a name="line.173"></a>
+<FONT color="green">174</FONT>                        y2 = y;<a name="line.174"></a>
+<FONT color="green">175</FONT>                    } else {<a name="line.175"></a>
+<FONT color="green">176</FONT>                        x1 = x;<a name="line.176"></a>
+<FONT color="green">177</FONT>                        x2 = x3;<a name="line.177"></a>
+<FONT color="green">178</FONT>                        y1 = y;<a name="line.178"></a>
+<FONT color="green">179</FONT>                        y2 = y3;<a name="line.179"></a>
+<FONT color="green">180</FONT>                    }<a name="line.180"></a>
+<FONT color="green">181</FONT>                } else {                            // x3 &lt; x &lt; x2<a name="line.181"></a>
+<FONT color="green">182</FONT>                    if (MathUtils.sign(y2) + MathUtils.sign(y) == 0.0) {<a name="line.182"></a>
+<FONT color="green">183</FONT>                        x1 = x;<a name="line.183"></a>
+<FONT color="green">184</FONT>                        y1 = y;<a name="line.184"></a>
+<FONT color="green">185</FONT>                    } else {<a name="line.185"></a>
+<FONT color="green">186</FONT>                        x1 = x3;<a name="line.186"></a>
+<FONT color="green">187</FONT>                        x2 = x;<a name="line.187"></a>
+<FONT color="green">188</FONT>                        y1 = y3;<a name="line.188"></a>
+<FONT color="green">189</FONT>                        y2 = y;<a name="line.189"></a>
+<FONT color="green">190</FONT>                    }<a name="line.190"></a>
+<FONT color="green">191</FONT>                }<a name="line.191"></a>
+<FONT color="green">192</FONT>                oldx = x;<a name="line.192"></a>
+<FONT color="green">193</FONT>                i++;<a name="line.193"></a>
+<FONT color="green">194</FONT>            }<a name="line.194"></a>
+<FONT color="green">195</FONT>            throw new MaxIterationsExceededException(maximalIterationCount);<a name="line.195"></a>
+<FONT color="green">196</FONT>        }<a name="line.196"></a>
+<FONT color="green">197</FONT>    }<a name="line.197"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/SecantSolver.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,250 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.solvers;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Implements a modified version of the<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;a href="http://mathworld.wolfram.com/SecantMethod.html"&gt;secant method&lt;/a&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * for approximating a zero of a real univariate function.<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * The algorithm is modified to maintain bracketing of a root by successive<a name="line.31"></a>
+<FONT color="green">032</FONT>     * approximations. Because of forced bracketing, convergence may be slower than<a name="line.32"></a>
+<FONT color="green">033</FONT>     * the unrestricted secant algorithm. However, this implementation should in<a name="line.33"></a>
+<FONT color="green">034</FONT>     * general outperform the<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;a href="http://mathworld.wolfram.com/MethodofFalsePosition.html"&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * regula falsi method.&lt;/a&gt;&lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * The function is assumed to be continuous but not necessarily smooth.&lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     *<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.40"></a>
+<FONT color="green">041</FONT>     */<a name="line.41"></a>
+<FONT color="green">042</FONT>    public class SecantSolver extends UnivariateRealSolverImpl {<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /**<a name="line.44"></a>
+<FONT color="green">045</FONT>         * Construct a solver for the given function.<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param f function to solve.<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @deprecated as of 2.0 the function to solve is passed as an argument<a name="line.47"></a>
+<FONT color="green">048</FONT>         * to the {@link #solve(UnivariateRealFunction, double, double)} or<a name="line.48"></a>
+<FONT color="green">049</FONT>         * {@link UnivariateRealSolverImpl#solve(UnivariateRealFunction, double, double, double)}<a name="line.49"></a>
+<FONT color="green">050</FONT>         * method.<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        @Deprecated<a name="line.52"></a>
+<FONT color="green">053</FONT>        public SecantSolver(UnivariateRealFunction f) {<a name="line.53"></a>
+<FONT color="green">054</FONT>            super(f, 100, 1E-6);<a name="line.54"></a>
+<FONT color="green">055</FONT>        }<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /**<a name="line.57"></a>
+<FONT color="green">058</FONT>         * Construct a solver.<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        public SecantSolver() {<a name="line.60"></a>
+<FONT color="green">061</FONT>            super(100, 1E-6);<a name="line.61"></a>
+<FONT color="green">062</FONT>        }<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /** {@inheritDoc} */<a name="line.64"></a>
+<FONT color="green">065</FONT>        @Deprecated<a name="line.65"></a>
+<FONT color="green">066</FONT>        public double solve(final double min, final double max)<a name="line.66"></a>
+<FONT color="green">067</FONT>            throws ConvergenceException, FunctionEvaluationException {<a name="line.67"></a>
+<FONT color="green">068</FONT>            return solve(f, min, max);<a name="line.68"></a>
+<FONT color="green">069</FONT>        }<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** {@inheritDoc} */<a name="line.71"></a>
+<FONT color="green">072</FONT>        @Deprecated<a name="line.72"></a>
+<FONT color="green">073</FONT>        public double solve(final double min, final double max, final double initial)<a name="line.73"></a>
+<FONT color="green">074</FONT>            throws ConvergenceException, FunctionEvaluationException {<a name="line.74"></a>
+<FONT color="green">075</FONT>            return solve(f, min, max, initial);<a name="line.75"></a>
+<FONT color="green">076</FONT>        }<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /**<a name="line.78"></a>
+<FONT color="green">079</FONT>         * Find a zero in the given interval.<a name="line.79"></a>
+<FONT color="green">080</FONT>         *<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @param f the function to solve<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @param min the lower bound for the interval<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param max the upper bound for the interval<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @param initial the start value to use (ignored)<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @return the value where the function is zero<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @throws MaxIterationsExceededException if the maximum iteration count is exceeded<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.87"></a>
+<FONT color="green">088</FONT>         * function<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @throws IllegalArgumentException if min is not less than max or the<a name="line.89"></a>
+<FONT color="green">090</FONT>         * signs of the values of the function at the endpoints are not opposites<a name="line.90"></a>
+<FONT color="green">091</FONT>         */<a name="line.91"></a>
+<FONT color="green">092</FONT>        public double solve(final UnivariateRealFunction f,<a name="line.92"></a>
+<FONT color="green">093</FONT>                            final double min, final double max, final double initial)<a name="line.93"></a>
+<FONT color="green">094</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.94"></a>
+<FONT color="green">095</FONT>            return solve(f, min, max);<a name="line.95"></a>
+<FONT color="green">096</FONT>        }<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /**<a name="line.98"></a>
+<FONT color="green">099</FONT>         * Find a zero in the given interval.<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @param f the function to solve<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @param min the lower bound for the interval.<a name="line.101"></a>
+<FONT color="green">102</FONT>         * @param max the upper bound for the interval.<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @return the value where the function is zero<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @throws MaxIterationsExceededException  if the maximum iteration count is exceeded<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.105"></a>
+<FONT color="green">106</FONT>         * function<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @throws IllegalArgumentException if min is not less than max or the<a name="line.107"></a>
+<FONT color="green">108</FONT>         * signs of the values of the function at the endpoints are not opposites<a name="line.108"></a>
+<FONT color="green">109</FONT>         */<a name="line.109"></a>
+<FONT color="green">110</FONT>        public double solve(final UnivariateRealFunction f,<a name="line.110"></a>
+<FONT color="green">111</FONT>                            final double min, final double max)<a name="line.111"></a>
+<FONT color="green">112</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>            clearResult();<a name="line.114"></a>
+<FONT color="green">115</FONT>            verifyInterval(min, max);<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>            // Index 0 is the old approximation for the root.<a name="line.117"></a>
+<FONT color="green">118</FONT>            // Index 1 is the last calculated approximation  for the root.<a name="line.118"></a>
+<FONT color="green">119</FONT>            // Index 2 is a bracket for the root with respect to x0.<a name="line.119"></a>
+<FONT color="green">120</FONT>            // OldDelta is the length of the bracketing interval of the last<a name="line.120"></a>
+<FONT color="green">121</FONT>            // iteration.<a name="line.121"></a>
+<FONT color="green">122</FONT>            double x0 = min;<a name="line.122"></a>
+<FONT color="green">123</FONT>            double x1 = max;<a name="line.123"></a>
+<FONT color="green">124</FONT>            double y0 = f.value(x0);<a name="line.124"></a>
+<FONT color="green">125</FONT>            double y1 = f.value(x1);<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>            // Verify bracketing<a name="line.127"></a>
+<FONT color="green">128</FONT>            if (y0 * y1 &gt;= 0) {<a name="line.128"></a>
+<FONT color="green">129</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.129"></a>
+<FONT color="green">130</FONT>                      "function values at endpoints do not have different signs, " +<a name="line.130"></a>
+<FONT color="green">131</FONT>                      "endpoints: [{0}, {1}], values: [{2}, {3}]",<a name="line.131"></a>
+<FONT color="green">132</FONT>                      min, max, y0, y1);<a name="line.132"></a>
+<FONT color="green">133</FONT>            }<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>            double x2 = x0;<a name="line.135"></a>
+<FONT color="green">136</FONT>            double y2 = y0;<a name="line.136"></a>
+<FONT color="green">137</FONT>            double oldDelta = x2 - x1;<a name="line.137"></a>
+<FONT color="green">138</FONT>            int i = 0;<a name="line.138"></a>
+<FONT color="green">139</FONT>            while (i &lt; maximalIterationCount) {<a name="line.139"></a>
+<FONT color="green">140</FONT>                if (Math.abs(y2) &lt; Math.abs(y1)) {<a name="line.140"></a>
+<FONT color="green">141</FONT>                    x0 = x1;<a name="line.141"></a>
+<FONT color="green">142</FONT>                    x1 = x2;<a name="line.142"></a>
+<FONT color="green">143</FONT>                    x2 = x0;<a name="line.143"></a>
+<FONT color="green">144</FONT>                    y0 = y1;<a name="line.144"></a>
+<FONT color="green">145</FONT>                    y1 = y2;<a name="line.145"></a>
+<FONT color="green">146</FONT>                    y2 = y0;<a name="line.146"></a>
+<FONT color="green">147</FONT>                }<a name="line.147"></a>
+<FONT color="green">148</FONT>                if (Math.abs(y1) &lt;= functionValueAccuracy) {<a name="line.148"></a>
+<FONT color="green">149</FONT>                    setResult(x1, i);<a name="line.149"></a>
+<FONT color="green">150</FONT>                    return result;<a name="line.150"></a>
+<FONT color="green">151</FONT>                }<a name="line.151"></a>
+<FONT color="green">152</FONT>                if (Math.abs(oldDelta) &lt;<a name="line.152"></a>
+<FONT color="green">153</FONT>                    Math.max(relativeAccuracy * Math.abs(x1), absoluteAccuracy)) {<a name="line.153"></a>
+<FONT color="green">154</FONT>                    setResult(x1, i);<a name="line.154"></a>
+<FONT color="green">155</FONT>                    return result;<a name="line.155"></a>
+<FONT color="green">156</FONT>                }<a name="line.156"></a>
+<FONT color="green">157</FONT>                double delta;<a name="line.157"></a>
+<FONT color="green">158</FONT>                if (Math.abs(y1) &gt; Math.abs(y0)) {<a name="line.158"></a>
+<FONT color="green">159</FONT>                    // Function value increased in last iteration. Force bisection.<a name="line.159"></a>
+<FONT color="green">160</FONT>                    delta = 0.5 * oldDelta;<a name="line.160"></a>
+<FONT color="green">161</FONT>                } else {<a name="line.161"></a>
+<FONT color="green">162</FONT>                    delta = (x0 - x1) / (1 - y0 / y1);<a name="line.162"></a>
+<FONT color="green">163</FONT>                    if (delta / oldDelta &gt; 1) {<a name="line.163"></a>
+<FONT color="green">164</FONT>                        // New approximation falls outside bracket.<a name="line.164"></a>
+<FONT color="green">165</FONT>                        // Fall back to bisection.<a name="line.165"></a>
+<FONT color="green">166</FONT>                        delta = 0.5 * oldDelta;<a name="line.166"></a>
+<FONT color="green">167</FONT>                    }<a name="line.167"></a>
+<FONT color="green">168</FONT>                }<a name="line.168"></a>
+<FONT color="green">169</FONT>                x0 = x1;<a name="line.169"></a>
+<FONT color="green">170</FONT>                y0 = y1;<a name="line.170"></a>
+<FONT color="green">171</FONT>                x1 = x1 + delta;<a name="line.171"></a>
+<FONT color="green">172</FONT>                y1 = f.value(x1);<a name="line.172"></a>
+<FONT color="green">173</FONT>                if ((y1 &gt; 0) == (y2 &gt; 0)) {<a name="line.173"></a>
+<FONT color="green">174</FONT>                    // New bracket is (x0,x1).<a name="line.174"></a>
+<FONT color="green">175</FONT>                    x2 = x0;<a name="line.175"></a>
+<FONT color="green">176</FONT>                    y2 = y0;<a name="line.176"></a>
+<FONT color="green">177</FONT>                }<a name="line.177"></a>
+<FONT color="green">178</FONT>                oldDelta = x2 - x1;<a name="line.178"></a>
+<FONT color="green">179</FONT>                i++;<a name="line.179"></a>
+<FONT color="green">180</FONT>            }<a name="line.180"></a>
+<FONT color="green">181</FONT>            throw new MaxIterationsExceededException(maximalIterationCount);<a name="line.181"></a>
+<FONT color="green">182</FONT>        }<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>    }<a name="line.184"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,233 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.solvers;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ConvergingAlgorithm;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Interface for (univariate real) rootfinding algorithms.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Implementations will search for only one zero in the given interval.&lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     *<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    public interface UnivariateRealSolver extends ConvergingAlgorithm {<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /**<a name="line.34"></a>
+<FONT color="green">035</FONT>         * Set the function value accuracy.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * &lt;p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>         * This is used to determine when an evaluated function value or some other<a name="line.37"></a>
+<FONT color="green">038</FONT>         * value which is used as divisor is zero.&lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>         * &lt;p&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>         * This is a safety guard and it shouldn't be necessary to change this in<a name="line.40"></a>
+<FONT color="green">041</FONT>         * general.&lt;/p&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>         *<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @param accuracy the accuracy.<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @throws IllegalArgumentException if the accuracy can't be achieved by<a name="line.44"></a>
+<FONT color="green">045</FONT>         * the solver or is otherwise deemed unreasonable.<a name="line.45"></a>
+<FONT color="green">046</FONT>         */<a name="line.46"></a>
+<FONT color="green">047</FONT>        void setFunctionValueAccuracy(double accuracy);<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /**<a name="line.49"></a>
+<FONT color="green">050</FONT>         * Get the actual function value accuracy.<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @return the accuracy<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        double getFunctionValueAccuracy();<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * Reset the actual function accuracy to the default.<a name="line.56"></a>
+<FONT color="green">057</FONT>         * The default value is provided by the solver implementation.<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        void resetFunctionValueAccuracy();<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Solve for a zero root in the given interval.<a name="line.62"></a>
+<FONT color="green">063</FONT>         * &lt;p&gt;A solver may require that the interval brackets a single zero root.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * Solvers that do require bracketing should be able to handle the case<a name="line.64"></a>
+<FONT color="green">065</FONT>         * where one of the endpoints is itself a root.&lt;/p&gt;<a name="line.65"></a>
+<FONT color="green">066</FONT>         *<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @param min the lower bound for the interval.<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param max the upper bound for the interval.<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @return a value where the function is zero<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @throws ConvergenceException if the maximum iteration count is exceeded<a name="line.70"></a>
+<FONT color="green">071</FONT>         * or the solver detects convergence problems otherwise.<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.72"></a>
+<FONT color="green">073</FONT>         * function<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @throws IllegalArgumentException if min &gt; max or the endpoints do not<a name="line.74"></a>
+<FONT color="green">075</FONT>         * satisfy the requirements specified by the solver<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @deprecated replaced by {@link #solve(UnivariateRealFunction, double, double)}<a name="line.76"></a>
+<FONT color="green">077</FONT>         * since 2.0<a name="line.77"></a>
+<FONT color="green">078</FONT>         */<a name="line.78"></a>
+<FONT color="green">079</FONT>        @Deprecated<a name="line.79"></a>
+<FONT color="green">080</FONT>        double solve(double min, double max) throws ConvergenceException,<a name="line.80"></a>
+<FONT color="green">081</FONT>            FunctionEvaluationException;<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /**<a name="line.83"></a>
+<FONT color="green">084</FONT>         * Solve for a zero root in the given interval.<a name="line.84"></a>
+<FONT color="green">085</FONT>         * &lt;p&gt;A solver may require that the interval brackets a single zero root.<a name="line.85"></a>
+<FONT color="green">086</FONT>         * Solvers that do require bracketing should be able to handle the case<a name="line.86"></a>
+<FONT color="green">087</FONT>         * where one of the endpoints is itself a root.&lt;/p&gt;<a name="line.87"></a>
+<FONT color="green">088</FONT>         *<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @param f the function to solve.<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @param min the lower bound for the interval.<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @param max the upper bound for the interval.<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @return a value where the function is zero<a name="line.92"></a>
+<FONT color="green">093</FONT>         * @throws ConvergenceException if the maximum iteration count is exceeded<a name="line.93"></a>
+<FONT color="green">094</FONT>         * or the solver detects convergence problems otherwise.<a name="line.94"></a>
+<FONT color="green">095</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.95"></a>
+<FONT color="green">096</FONT>         * function<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @throws IllegalArgumentException if min &gt; max or the endpoints do not<a name="line.97"></a>
+<FONT color="green">098</FONT>         * satisfy the requirements specified by the solver<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @since 2.0<a name="line.99"></a>
+<FONT color="green">100</FONT>         */<a name="line.100"></a>
+<FONT color="green">101</FONT>        double solve(UnivariateRealFunction f, double min, double max)<a name="line.101"></a>
+<FONT color="green">102</FONT>            throws ConvergenceException,<a name="line.102"></a>
+<FONT color="green">103</FONT>            FunctionEvaluationException;<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /**<a name="line.105"></a>
+<FONT color="green">106</FONT>         * Solve for a zero in the given interval, start at startValue.<a name="line.106"></a>
+<FONT color="green">107</FONT>         * &lt;p&gt;A solver may require that the interval brackets a single zero root.<a name="line.107"></a>
+<FONT color="green">108</FONT>         * Solvers that do require bracketing should be able to handle the case<a name="line.108"></a>
+<FONT color="green">109</FONT>         * where one of the endpoints is itself a root.&lt;/p&gt;<a name="line.109"></a>
+<FONT color="green">110</FONT>         *<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @param min the lower bound for the interval.<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @param max the upper bound for the interval.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param startValue the start value to use<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @return a value where the function is zero<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @throws ConvergenceException if the maximum iteration count is exceeded<a name="line.115"></a>
+<FONT color="green">116</FONT>         * or the solver detects convergence problems otherwise.<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.117"></a>
+<FONT color="green">118</FONT>         * function<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @throws IllegalArgumentException if min &gt; max or the arguments do not<a name="line.119"></a>
+<FONT color="green">120</FONT>         * satisfy the requirements specified by the solver<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @deprecated replaced by {@link #solve(UnivariateRealFunction, double, double, double)}<a name="line.121"></a>
+<FONT color="green">122</FONT>         * since 2.0<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        @Deprecated<a name="line.124"></a>
+<FONT color="green">125</FONT>        double solve(double min, double max, double startValue)<a name="line.125"></a>
+<FONT color="green">126</FONT>            throws ConvergenceException, FunctionEvaluationException, IllegalArgumentException;<a name="line.126"></a>
+<FONT color="green">127</FONT>    <a name="line.127"></a>
+<FONT color="green">128</FONT>        /**<a name="line.128"></a>
+<FONT color="green">129</FONT>         * Solve for a zero in the given interval, start at startValue.<a name="line.129"></a>
+<FONT color="green">130</FONT>         * &lt;p&gt;A solver may require that the interval brackets a single zero root.<a name="line.130"></a>
+<FONT color="green">131</FONT>         * Solvers that do require bracketing should be able to handle the case<a name="line.131"></a>
+<FONT color="green">132</FONT>         * where one of the endpoints is itself a root.&lt;/p&gt;<a name="line.132"></a>
+<FONT color="green">133</FONT>         *<a name="line.133"></a>
+<FONT color="green">134</FONT>         * @param f the function to solve.<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @param min the lower bound for the interval.<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @param max the upper bound for the interval.<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @param startValue the start value to use<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @return a value where the function is zero<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @throws ConvergenceException if the maximum iteration count is exceeded<a name="line.139"></a>
+<FONT color="green">140</FONT>         * or the solver detects convergence problems otherwise.<a name="line.140"></a>
+<FONT color="green">141</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.141"></a>
+<FONT color="green">142</FONT>         * function<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @throws IllegalArgumentException if min &gt; max or the arguments do not<a name="line.143"></a>
+<FONT color="green">144</FONT>         * satisfy the requirements specified by the solver<a name="line.144"></a>
+<FONT color="green">145</FONT>         * @since 2.0<a name="line.145"></a>
+<FONT color="green">146</FONT>         */<a name="line.146"></a>
+<FONT color="green">147</FONT>        double solve(UnivariateRealFunction f, double min, double max, double startValue)<a name="line.147"></a>
+<FONT color="green">148</FONT>            throws ConvergenceException, FunctionEvaluationException, IllegalArgumentException;<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>        /**<a name="line.150"></a>
+<FONT color="green">151</FONT>         * Get the result of the last run of the solver.<a name="line.151"></a>
+<FONT color="green">152</FONT>         *<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @return the last result.<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @throws IllegalStateException if there is no result available, either<a name="line.154"></a>
+<FONT color="green">155</FONT>         * because no result was yet computed or the last attempt failed.<a name="line.155"></a>
+<FONT color="green">156</FONT>         */<a name="line.156"></a>
+<FONT color="green">157</FONT>        double getResult();<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>        /**<a name="line.159"></a>
+<FONT color="green">160</FONT>         * Get the result of the last run of the solver.<a name="line.160"></a>
+<FONT color="green">161</FONT>         *<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @return the value of the function at the last result.<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @throws IllegalStateException if there is no result available, either<a name="line.163"></a>
+<FONT color="green">164</FONT>         * because no result was yet computed or the last attempt failed.<a name="line.164"></a>
+<FONT color="green">165</FONT>         */<a name="line.165"></a>
+<FONT color="green">166</FONT>        double getFunctionValue();<a name="line.166"></a>
+<FONT color="green">167</FONT>    }<a name="line.167"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/UnivariateRealSolverFactory.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,156 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.solvers;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Abstract factory class used to create {@link UnivariateRealSolver} instances.<a name="line.20"></a>
+<FONT color="green">021</FONT>     * &lt;p&gt;<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Solvers implementing the following algorithms are supported:<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;ul&gt;<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;li&gt;Bisection&lt;/li&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;li&gt;Brent's method&lt;/li&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;li&gt;Secant method&lt;/li&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;/ul&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Concrete factories extending this class also specify a default solver, instances of which<a name="line.28"></a>
+<FONT color="green">029</FONT>     * are returned by &lt;code&gt;newDefaultSolver()&lt;/code&gt;.&lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * Common usage:&lt;pre&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * SolverFactory factory = UnivariateRealSolverFactory.newInstance();&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * // create a Brent solver to use<a name="line.34"></a>
+<FONT color="green">035</FONT>     * BrentSolver solver = factory.newBrentSolver();<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;/pre&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.38"></a>
+<FONT color="green">039</FONT>     */<a name="line.39"></a>
+<FONT color="green">040</FONT>    public abstract class UnivariateRealSolverFactory {<a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * Default constructor.<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        protected UnivariateRealSolverFactory() {<a name="line.44"></a>
+<FONT color="green">045</FONT>        }<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Create a new factory.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @return a new factory.<a name="line.49"></a>
+<FONT color="green">050</FONT>         */<a name="line.50"></a>
+<FONT color="green">051</FONT>        public static UnivariateRealSolverFactory newInstance() {<a name="line.51"></a>
+<FONT color="green">052</FONT>            return new UnivariateRealSolverFactoryImpl();<a name="line.52"></a>
+<FONT color="green">053</FONT>        }<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * Create a new {@link UnivariateRealSolver}.  The<a name="line.56"></a>
+<FONT color="green">057</FONT>         * actual solver returned is determined by the underlying factory.<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @return the new solver.<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        public abstract UnivariateRealSolver newDefaultSolver();<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /**<a name="line.62"></a>
+<FONT color="green">063</FONT>         * Create a new {@link UnivariateRealSolver}.  The<a name="line.63"></a>
+<FONT color="green">064</FONT>         * solver is an implementation of the bisection method.<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @return the new solver.<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        public abstract UnivariateRealSolver newBisectionSolver();<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * Create a new {@link UnivariateRealSolver}.  The<a name="line.70"></a>
+<FONT color="green">071</FONT>         * solver is an implementation of the Brent method.<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @return the new solver.<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        public abstract UnivariateRealSolver newBrentSolver();<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        /**<a name="line.76"></a>
+<FONT color="green">077</FONT>         * Create a new {@link UnivariateRealSolver}.  The<a name="line.77"></a>
+<FONT color="green">078</FONT>         * solver is an implementation of Newton's Method.<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @return the new solver.<a name="line.79"></a>
+<FONT color="green">080</FONT>         */<a name="line.80"></a>
+<FONT color="green">081</FONT>        public abstract UnivariateRealSolver newNewtonSolver();<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /**<a name="line.83"></a>
+<FONT color="green">084</FONT>         * Create a new {@link UnivariateRealSolver}.  The<a name="line.84"></a>
+<FONT color="green">085</FONT>         * solver is an implementation of the secant method.<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @return the new solver.<a name="line.86"></a>
+<FONT color="green">087</FONT>         */<a name="line.87"></a>
+<FONT color="green">088</FONT>        public abstract UnivariateRealSolver newSecantSolver();<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>    }<a name="line.90"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/UnivariateRealSolverFactoryImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,130 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.solvers;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * A concrete {@link  UnivariateRealSolverFactory}.  This is the default solver factory<a name="line.20"></a>
+<FONT color="green">021</FONT>     * used by commons-math.<a name="line.21"></a>
+<FONT color="green">022</FONT>     * &lt;p&gt;<a name="line.22"></a>
+<FONT color="green">023</FONT>     * The default solver returned by this factory is a {@link BrentSolver}.&lt;/p&gt;<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public class UnivariateRealSolverFactoryImpl extends UnivariateRealSolverFactory {<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>        /**<a name="line.29"></a>
+<FONT color="green">030</FONT>         * Default constructor.<a name="line.30"></a>
+<FONT color="green">031</FONT>         */<a name="line.31"></a>
+<FONT color="green">032</FONT>        public UnivariateRealSolverFactoryImpl() {<a name="line.32"></a>
+<FONT color="green">033</FONT>        }<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** {@inheritDoc} */<a name="line.35"></a>
+<FONT color="green">036</FONT>        @Override<a name="line.36"></a>
+<FONT color="green">037</FONT>        public UnivariateRealSolver newDefaultSolver() {<a name="line.37"></a>
+<FONT color="green">038</FONT>            return newBrentSolver();<a name="line.38"></a>
+<FONT color="green">039</FONT>        }<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** {@inheritDoc} */<a name="line.41"></a>
+<FONT color="green">042</FONT>        @Override<a name="line.42"></a>
+<FONT color="green">043</FONT>        public UnivariateRealSolver newBisectionSolver() {<a name="line.43"></a>
+<FONT color="green">044</FONT>            return new BisectionSolver();<a name="line.44"></a>
+<FONT color="green">045</FONT>        }<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** {@inheritDoc} */<a name="line.47"></a>
+<FONT color="green">048</FONT>        @Override<a name="line.48"></a>
+<FONT color="green">049</FONT>        public UnivariateRealSolver newBrentSolver() {<a name="line.49"></a>
+<FONT color="green">050</FONT>            return new BrentSolver();<a name="line.50"></a>
+<FONT color="green">051</FONT>        }<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** {@inheritDoc} */<a name="line.53"></a>
+<FONT color="green">054</FONT>        @Override<a name="line.54"></a>
+<FONT color="green">055</FONT>        public UnivariateRealSolver newNewtonSolver() {<a name="line.55"></a>
+<FONT color="green">056</FONT>            return new NewtonSolver();<a name="line.56"></a>
+<FONT color="green">057</FONT>        }<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** {@inheritDoc} */<a name="line.59"></a>
+<FONT color="green">060</FONT>        @Override<a name="line.60"></a>
+<FONT color="green">061</FONT>        public UnivariateRealSolver newSecantSolver() {<a name="line.61"></a>
+<FONT color="green">062</FONT>            return new SecantSolver();<a name="line.62"></a>
+<FONT color="green">063</FONT>        }<a name="line.63"></a>
+<FONT color="green">064</FONT>    }<a name="line.64"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,321 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.analysis.solvers;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ConvergingAlgorithmImpl;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Provide a default implementation for several functions useful to generic<a name="line.26"></a>
+<FONT color="green">027</FONT>     * solvers.<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @version $Revision: 811833 $ $Date: 2009-09-06 12:27:50 -0400 (Sun, 06 Sep 2009) $<a name="line.29"></a>
+<FONT color="green">030</FONT>     */<a name="line.30"></a>
+<FONT color="green">031</FONT>    public abstract class UnivariateRealSolverImpl<a name="line.31"></a>
+<FONT color="green">032</FONT>        extends ConvergingAlgorithmImpl implements UnivariateRealSolver {<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /** Maximum error of function. */<a name="line.34"></a>
+<FONT color="green">035</FONT>        protected double functionValueAccuracy;<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /** Default maximum error of function. */<a name="line.37"></a>
+<FONT color="green">038</FONT>        protected double defaultFunctionValueAccuracy;<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Indicates where a root has been computed. */<a name="line.40"></a>
+<FONT color="green">041</FONT>        protected boolean resultComputed = false;<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** The last computed root. */<a name="line.43"></a>
+<FONT color="green">044</FONT>        protected double result;<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** Value of the function at the last computed result. */<a name="line.46"></a>
+<FONT color="green">047</FONT>        protected double functionValue;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** The function to solve.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @deprecated as of 2.0 the function to solve is passed as an argument<a name="line.50"></a>
+<FONT color="green">051</FONT>         * to the {@link #solve(UnivariateRealFunction, double, double)} or<a name="line.51"></a>
+<FONT color="green">052</FONT>         * {@link UnivariateRealSolverImpl#solve(UnivariateRealFunction, double, double, double)}<a name="line.52"></a>
+<FONT color="green">053</FONT>         * method. */<a name="line.53"></a>
+<FONT color="green">054</FONT>        @Deprecated<a name="line.54"></a>
+<FONT color="green">055</FONT>        protected UnivariateRealFunction f;<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /**<a name="line.57"></a>
+<FONT color="green">058</FONT>         * Construct a solver with given iteration count and accuracy.<a name="line.58"></a>
+<FONT color="green">059</FONT>         *<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @param f the function to solve.<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param defaultAbsoluteAccuracy maximum absolute error<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param defaultMaximalIterationCount maximum number of iterations<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @throws IllegalArgumentException if f is null or the<a name="line.63"></a>
+<FONT color="green">064</FONT>         * defaultAbsoluteAccuracy is not valid<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @deprecated as of 2.0 the function to solve is passed as an argument<a name="line.65"></a>
+<FONT color="green">066</FONT>         * to the {@link #solve(UnivariateRealFunction, double, double)} or<a name="line.66"></a>
+<FONT color="green">067</FONT>         * {@link UnivariateRealSolverImpl#solve(UnivariateRealFunction, double, double, double)}<a name="line.67"></a>
+<FONT color="green">068</FONT>         * method.<a name="line.68"></a>
+<FONT color="green">069</FONT>         */<a name="line.69"></a>
+<FONT color="green">070</FONT>        @Deprecated<a name="line.70"></a>
+<FONT color="green">071</FONT>        protected UnivariateRealSolverImpl(final UnivariateRealFunction f,<a name="line.71"></a>
+<FONT color="green">072</FONT>                                           final int defaultMaximalIterationCount,<a name="line.72"></a>
+<FONT color="green">073</FONT>                                           final double defaultAbsoluteAccuracy) {<a name="line.73"></a>
+<FONT color="green">074</FONT>            super(defaultMaximalIterationCount, defaultAbsoluteAccuracy);<a name="line.74"></a>
+<FONT color="green">075</FONT>            if (f == null) {<a name="line.75"></a>
+<FONT color="green">076</FONT>                throw MathRuntimeException.createIllegalArgumentException("function to solve cannot be null");<a name="line.76"></a>
+<FONT color="green">077</FONT>            }<a name="line.77"></a>
+<FONT color="green">078</FONT>            this.f = f;<a name="line.78"></a>
+<FONT color="green">079</FONT>            this.defaultFunctionValueAccuracy = 1.0e-15;<a name="line.79"></a>
+<FONT color="green">080</FONT>            this.functionValueAccuracy = defaultFunctionValueAccuracy;<a name="line.80"></a>
+<FONT color="green">081</FONT>        }<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /**<a name="line.83"></a>
+<FONT color="green">084</FONT>         * Construct a solver with given iteration count and accuracy.<a name="line.84"></a>
+<FONT color="green">085</FONT>         *<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @param defaultAbsoluteAccuracy maximum absolute error<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @param defaultMaximalIterationCount maximum number of iterations<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @throws IllegalArgumentException if f is null or the<a name="line.88"></a>
+<FONT color="green">089</FONT>         * defaultAbsoluteAccuracy is not valid<a name="line.89"></a>
+<FONT color="green">090</FONT>         */<a name="line.90"></a>
+<FONT color="green">091</FONT>        protected UnivariateRealSolverImpl(final int defaultMaximalIterationCount,<a name="line.91"></a>
+<FONT color="green">092</FONT>                                           final double defaultAbsoluteAccuracy) {<a name="line.92"></a>
+<FONT color="green">093</FONT>            super(defaultMaximalIterationCount, defaultAbsoluteAccuracy);<a name="line.93"></a>
+<FONT color="green">094</FONT>            this.defaultFunctionValueAccuracy = 1.0e-15;<a name="line.94"></a>
+<FONT color="green">095</FONT>            this.functionValueAccuracy = defaultFunctionValueAccuracy;<a name="line.95"></a>
+<FONT color="green">096</FONT>        }<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /** Check if a result has been computed.<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @exception IllegalStateException if no result has been computed<a name="line.99"></a>
+<FONT color="green">100</FONT>         */<a name="line.100"></a>
+<FONT color="green">101</FONT>        protected void checkResultComputed() throws IllegalStateException {<a name="line.101"></a>
+<FONT color="green">102</FONT>            if (!resultComputed) {<a name="line.102"></a>
+<FONT color="green">103</FONT>                throw MathRuntimeException.createIllegalStateException("no result available");<a name="line.103"></a>
+<FONT color="green">104</FONT>            }<a name="line.104"></a>
+<FONT color="green">105</FONT>        }<a name="line.105"></a>
+<FONT color="green">106</FONT>    <a name="line.106"></a>
+<FONT color="green">107</FONT>        /** {@inheritDoc} */<a name="line.107"></a>
+<FONT color="green">108</FONT>        public double getResult() {<a name="line.108"></a>
+<FONT color="green">109</FONT>            checkResultComputed();<a name="line.109"></a>
+<FONT color="green">110</FONT>            return result;<a name="line.110"></a>
+<FONT color="green">111</FONT>        }<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>        /** {@inheritDoc} */<a name="line.113"></a>
+<FONT color="green">114</FONT>        public double getFunctionValue() {<a name="line.114"></a>
+<FONT color="green">115</FONT>            checkResultComputed();<a name="line.115"></a>
+<FONT color="green">116</FONT>            return functionValue;<a name="line.116"></a>
+<FONT color="green">117</FONT>        }<a name="line.117"></a>
+<FONT color="green">118</FONT>    <a name="line.118"></a>
+<FONT color="green">119</FONT>        /** {@inheritDoc} */<a name="line.119"></a>
+<FONT color="green">120</FONT>        public void setFunctionValueAccuracy(final double accuracy) {<a name="line.120"></a>
+<FONT color="green">121</FONT>            functionValueAccuracy = accuracy;<a name="line.121"></a>
+<FONT color="green">122</FONT>        }<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>        /** {@inheritDoc} */<a name="line.124"></a>
+<FONT color="green">125</FONT>        public double getFunctionValueAccuracy() {<a name="line.125"></a>
+<FONT color="green">126</FONT>            return functionValueAccuracy;<a name="line.126"></a>
+<FONT color="green">127</FONT>        }<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>        /** {@inheritDoc} */<a name="line.129"></a>
+<FONT color="green">130</FONT>        public void resetFunctionValueAccuracy() {<a name="line.130"></a>
+<FONT color="green">131</FONT>            functionValueAccuracy = defaultFunctionValueAccuracy;<a name="line.131"></a>
+<FONT color="green">132</FONT>        }<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>        /**<a name="line.134"></a>
+<FONT color="green">135</FONT>         * Convenience function for implementations.<a name="line.135"></a>
+<FONT color="green">136</FONT>         *<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @param newResult the result to set<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @param iterationCount the iteration count to set<a name="line.138"></a>
+<FONT color="green">139</FONT>         */<a name="line.139"></a>
+<FONT color="green">140</FONT>        protected final void setResult(final double newResult, final int iterationCount) {<a name="line.140"></a>
+<FONT color="green">141</FONT>            this.result         = newResult;<a name="line.141"></a>
+<FONT color="green">142</FONT>            this.iterationCount = iterationCount;<a name="line.142"></a>
+<FONT color="green">143</FONT>            this.resultComputed = true;<a name="line.143"></a>
+<FONT color="green">144</FONT>        }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>        /**<a name="line.146"></a>
+<FONT color="green">147</FONT>         * Convenience function for implementations.<a name="line.147"></a>
+<FONT color="green">148</FONT>         *<a name="line.148"></a>
+<FONT color="green">149</FONT>         * @param x the result to set<a name="line.149"></a>
+<FONT color="green">150</FONT>         * @param fx the result to set<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @param iterationCount the iteration count to set<a name="line.151"></a>
+<FONT color="green">152</FONT>         */<a name="line.152"></a>
+<FONT color="green">153</FONT>        protected final void setResult(final double x, final double fx,<a name="line.153"></a>
+<FONT color="green">154</FONT>                                       final int iterationCount) {<a name="line.154"></a>
+<FONT color="green">155</FONT>            this.result         = x;<a name="line.155"></a>
+<FONT color="green">156</FONT>            this.functionValue  = fx;<a name="line.156"></a>
+<FONT color="green">157</FONT>            this.iterationCount = iterationCount;<a name="line.157"></a>
+<FONT color="green">158</FONT>            this.resultComputed = true;<a name="line.158"></a>
+<FONT color="green">159</FONT>        }<a name="line.159"></a>
+<FONT color="green">160</FONT>    <a name="line.160"></a>
+<FONT color="green">161</FONT>        /**<a name="line.161"></a>
+<FONT color="green">162</FONT>         * Convenience function for implementations.<a name="line.162"></a>
+<FONT color="green">163</FONT>         */<a name="line.163"></a>
+<FONT color="green">164</FONT>        protected final void clearResult() {<a name="line.164"></a>
+<FONT color="green">165</FONT>            this.iterationCount = 0;<a name="line.165"></a>
+<FONT color="green">166</FONT>            this.resultComputed = false;<a name="line.166"></a>
+<FONT color="green">167</FONT>        }<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>        /**<a name="line.169"></a>
+<FONT color="green">170</FONT>         * Returns true iff the function takes opposite signs at the endpoints.<a name="line.170"></a>
+<FONT color="green">171</FONT>         *<a name="line.171"></a>
+<FONT color="green">172</FONT>         * @param lower  the lower endpoint<a name="line.172"></a>
+<FONT color="green">173</FONT>         * @param upper  the upper endpoint<a name="line.173"></a>
+<FONT color="green">174</FONT>         * @param function the function<a name="line.174"></a>
+<FONT color="green">175</FONT>         * @return true if f(lower) * f(upper) &lt; 0<a name="line.175"></a>
+<FONT color="green">176</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.176"></a>
+<FONT color="green">177</FONT>         * function at the endpoints<a name="line.177"></a>
+<FONT color="green">178</FONT>         */<a name="line.178"></a>
+<FONT color="green">179</FONT>        protected boolean isBracketing(final double lower, final double upper,<a name="line.179"></a>
+<FONT color="green">180</FONT>                                       final UnivariateRealFunction function)<a name="line.180"></a>
+<FONT color="green">181</FONT>            throws FunctionEvaluationException {<a name="line.181"></a>
+<FONT color="green">182</FONT>            final double f1 = function.value(lower);<a name="line.182"></a>
+<FONT color="green">183</FONT>            final double f2 = function.value(upper);<a name="line.183"></a>
+<FONT color="green">184</FONT>            return (f1 &gt; 0 &amp;&amp; f2 &lt; 0) || (f1 &lt; 0 &amp;&amp; f2 &gt; 0);<a name="line.184"></a>
+<FONT color="green">185</FONT>        }<a name="line.185"></a>
+<FONT color="green">186</FONT>    <a name="line.186"></a>
+<FONT color="green">187</FONT>        /**<a name="line.187"></a>
+<FONT color="green">188</FONT>         * Returns true if the arguments form a (strictly) increasing sequence<a name="line.188"></a>
+<FONT color="green">189</FONT>         *<a name="line.189"></a>
+<FONT color="green">190</FONT>         * @param start  first number<a name="line.190"></a>
+<FONT color="green">191</FONT>         * @param mid   second number<a name="line.191"></a>
+<FONT color="green">192</FONT>         * @param end  third number<a name="line.192"></a>
+<FONT color="green">193</FONT>         * @return true if the arguments form an increasing sequence<a name="line.193"></a>
+<FONT color="green">194</FONT>         */<a name="line.194"></a>
+<FONT color="green">195</FONT>        protected boolean isSequence(final double start, final double mid, final double end) {<a name="line.195"></a>
+<FONT color="green">196</FONT>            return (start &lt; mid) &amp;&amp; (mid &lt; end);<a name="line.196"></a>
+<FONT color="green">197</FONT>        }<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>        /**<a name="line.199"></a>
+<FONT color="green">200</FONT>         * Verifies that the endpoints specify an interval,<a name="line.200"></a>
+<FONT color="green">201</FONT>         * throws IllegalArgumentException if not<a name="line.201"></a>
+<FONT color="green">202</FONT>         *<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @param lower  lower endpoint<a name="line.203"></a>
+<FONT color="green">204</FONT>         * @param upper upper endpoint<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @throws IllegalArgumentException<a name="line.205"></a>
+<FONT color="green">206</FONT>         */<a name="line.206"></a>
+<FONT color="green">207</FONT>        protected void verifyInterval(final double lower, final double upper) {<a name="line.207"></a>
+<FONT color="green">208</FONT>            if (lower &gt;= upper) {<a name="line.208"></a>
+<FONT color="green">209</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.209"></a>
+<FONT color="green">210</FONT>                        "endpoints do not specify an interval: [{0}, {1}]",<a name="line.210"></a>
+<FONT color="green">211</FONT>                        lower, upper);<a name="line.211"></a>
+<FONT color="green">212</FONT>            }<a name="line.212"></a>
+<FONT color="green">213</FONT>        }<a name="line.213"></a>
+<FONT color="green">214</FONT>    <a name="line.214"></a>
+<FONT color="green">215</FONT>        /**<a name="line.215"></a>
+<FONT color="green">216</FONT>         * Verifies that &lt;code&gt;lower &lt; initial &lt; upper&lt;/code&gt;<a name="line.216"></a>
+<FONT color="green">217</FONT>         * throws IllegalArgumentException if not<a name="line.217"></a>
+<FONT color="green">218</FONT>         *<a name="line.218"></a>
+<FONT color="green">219</FONT>         * @param lower  lower endpoint<a name="line.219"></a>
+<FONT color="green">220</FONT>         * @param initial initial value<a name="line.220"></a>
+<FONT color="green">221</FONT>         * @param upper upper endpoint<a name="line.221"></a>
+<FONT color="green">222</FONT>         * @throws IllegalArgumentException<a name="line.222"></a>
+<FONT color="green">223</FONT>         */<a name="line.223"></a>
+<FONT color="green">224</FONT>        protected void verifySequence(final double lower, final double initial, final double upper) {<a name="line.224"></a>
+<FONT color="green">225</FONT>            if (!isSequence(lower, initial, upper)) {<a name="line.225"></a>
+<FONT color="green">226</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.226"></a>
+<FONT color="green">227</FONT>                        "invalid interval, initial value parameters:  lower={0}, initial={1}, upper={2}",<a name="line.227"></a>
+<FONT color="green">228</FONT>                        lower, initial, upper);<a name="line.228"></a>
+<FONT color="green">229</FONT>            }<a name="line.229"></a>
+<FONT color="green">230</FONT>        }<a name="line.230"></a>
+<FONT color="green">231</FONT>    <a name="line.231"></a>
+<FONT color="green">232</FONT>        /**<a name="line.232"></a>
+<FONT color="green">233</FONT>         * Verifies that the endpoints specify an interval and the function takes<a name="line.233"></a>
+<FONT color="green">234</FONT>         * opposite signs at the enpoints, throws IllegalArgumentException if not<a name="line.234"></a>
+<FONT color="green">235</FONT>         *<a name="line.235"></a>
+<FONT color="green">236</FONT>         * @param lower  lower endpoint<a name="line.236"></a>
+<FONT color="green">237</FONT>         * @param upper upper endpoint<a name="line.237"></a>
+<FONT color="green">238</FONT>         * @param function function<a name="line.238"></a>
+<FONT color="green">239</FONT>         * @throws IllegalArgumentException<a name="line.239"></a>
+<FONT color="green">240</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.240"></a>
+<FONT color="green">241</FONT>         * function at the endpoints<a name="line.241"></a>
+<FONT color="green">242</FONT>         */<a name="line.242"></a>
+<FONT color="green">243</FONT>        protected void verifyBracketing(final double lower, final double upper,<a name="line.243"></a>
+<FONT color="green">244</FONT>                                        final UnivariateRealFunction function)<a name="line.244"></a>
+<FONT color="green">245</FONT>            throws FunctionEvaluationException {<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>            verifyInterval(lower, upper);<a name="line.247"></a>
+<FONT color="green">248</FONT>            if (!isBracketing(lower, upper, function)) {<a name="line.248"></a>
+<FONT color="green">249</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.249"></a>
+<FONT color="green">250</FONT>                        "function values at endpoints do not have different signs.  " +<a name="line.250"></a>
+<FONT color="green">251</FONT>                        "Endpoints: [{0}, {1}], Values: [{2}, {3}]",<a name="line.251"></a>
+<FONT color="green">252</FONT>                        lower, upper, function.value(lower), function.value(upper));<a name="line.252"></a>
+<FONT color="green">253</FONT>            }<a name="line.253"></a>
+<FONT color="green">254</FONT>        }<a name="line.254"></a>
+<FONT color="green">255</FONT>    }<a name="line.255"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,313 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.analysis.solvers;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Utility routines for {@link UnivariateRealSolver} objects.<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 885278 $ $Date: 2009-11-29 16:47:51 -0500 (Sun, 29 Nov 2009) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public class UnivariateRealSolverUtils {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /** Message for null function.*/<a name="line.31"></a>
+<FONT color="green">032</FONT>        private static final String NULL_FUNCTION_MESSAGE =<a name="line.32"></a>
+<FONT color="green">033</FONT>            "function is null";<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /**<a name="line.35"></a>
+<FONT color="green">036</FONT>         * Default constructor.<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        private UnivariateRealSolverUtils() {<a name="line.38"></a>
+<FONT color="green">039</FONT>            super();<a name="line.39"></a>
+<FONT color="green">040</FONT>        }<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /**<a name="line.42"></a>
+<FONT color="green">043</FONT>         * Convenience method to find a zero of a univariate real function.  A default<a name="line.43"></a>
+<FONT color="green">044</FONT>         * solver is used.<a name="line.44"></a>
+<FONT color="green">045</FONT>         *<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param f the function.<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @param x0 the lower bound for the interval.<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @param x1 the upper bound for the interval.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @return a value where the function is zero.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @throws ConvergenceException if the iteration count was exceeded<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating<a name="line.51"></a>
+<FONT color="green">052</FONT>         * the function<a name="line.52"></a>
+<FONT color="green">053</FONT>         * @throws IllegalArgumentException if f is null or the endpoints do not<a name="line.53"></a>
+<FONT color="green">054</FONT>         * specify a valid interval<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public static double solve(UnivariateRealFunction f, double x0, double x1)<a name="line.56"></a>
+<FONT color="green">057</FONT>        throws ConvergenceException, FunctionEvaluationException {<a name="line.57"></a>
+<FONT color="green">058</FONT>            setup(f);<a name="line.58"></a>
+<FONT color="green">059</FONT>            return LazyHolder.FACTORY.newDefaultSolver().solve(f, x0, x1);<a name="line.59"></a>
+<FONT color="green">060</FONT>        }<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /**<a name="line.62"></a>
+<FONT color="green">063</FONT>         * Convenience method to find a zero of a univariate real function.  A default<a name="line.63"></a>
+<FONT color="green">064</FONT>         * solver is used.<a name="line.64"></a>
+<FONT color="green">065</FONT>         *<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @param f the function<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @param x0 the lower bound for the interval<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param x1 the upper bound for the interval<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @param absoluteAccuracy the accuracy to be used by the solver<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @return a value where the function is zero<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @throws ConvergenceException if the iteration count is exceeded<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.72"></a>
+<FONT color="green">073</FONT>         * function<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @throws IllegalArgumentException if f is null, the endpoints do not<a name="line.74"></a>
+<FONT color="green">075</FONT>         * specify a valid interval, or the absoluteAccuracy is not valid for the<a name="line.75"></a>
+<FONT color="green">076</FONT>         * default solver<a name="line.76"></a>
+<FONT color="green">077</FONT>         */<a name="line.77"></a>
+<FONT color="green">078</FONT>        public static double solve(UnivariateRealFunction f, double x0, double x1,<a name="line.78"></a>
+<FONT color="green">079</FONT>                double absoluteAccuracy) throws ConvergenceException,<a name="line.79"></a>
+<FONT color="green">080</FONT>                FunctionEvaluationException {<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>            setup(f);<a name="line.82"></a>
+<FONT color="green">083</FONT>            UnivariateRealSolver solver = LazyHolder.FACTORY.newDefaultSolver();<a name="line.83"></a>
+<FONT color="green">084</FONT>            solver.setAbsoluteAccuracy(absoluteAccuracy);<a name="line.84"></a>
+<FONT color="green">085</FONT>            return solver.solve(f, x0, x1);<a name="line.85"></a>
+<FONT color="green">086</FONT>        }<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>        /**<a name="line.88"></a>
+<FONT color="green">089</FONT>         * This method attempts to find two values a and b satisfying &lt;ul&gt;<a name="line.89"></a>
+<FONT color="green">090</FONT>        * &lt;li&gt; &lt;code&gt; lowerBound &lt;= a &lt; initial &lt; b &lt;= upperBound&lt;/code&gt; &lt;/li&gt;<a name="line.90"></a>
+<FONT color="green">091</FONT>         * &lt;li&gt; &lt;code&gt; f(a) * f(b) &lt; 0 &lt;/code&gt;&lt;/li&gt;<a name="line.91"></a>
+<FONT color="green">092</FONT>         * &lt;/ul&gt;<a name="line.92"></a>
+<FONT color="green">093</FONT>         * If f is continuous on &lt;code&gt;[a,b],&lt;/code&gt; this means that &lt;code&gt;a&lt;/code&gt;<a name="line.93"></a>
+<FONT color="green">094</FONT>         * and &lt;code&gt;b&lt;/code&gt; bracket a root of f.<a name="line.94"></a>
+<FONT color="green">095</FONT>         * &lt;p&gt;<a name="line.95"></a>
+<FONT color="green">096</FONT>         * The algorithm starts by setting<a name="line.96"></a>
+<FONT color="green">097</FONT>         * &lt;code&gt;a := initial -1; b := initial +1,&lt;/code&gt; examines the value of the<a name="line.97"></a>
+<FONT color="green">098</FONT>         * function at &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt; and keeps moving<a name="line.98"></a>
+<FONT color="green">099</FONT>         * the endpoints out by one unit each time through a loop that terminates<a name="line.99"></a>
+<FONT color="green">100</FONT>         * when one of the following happens: &lt;ul&gt;<a name="line.100"></a>
+<FONT color="green">101</FONT>         * &lt;li&gt; &lt;code&gt; f(a) * f(b) &lt; 0 &lt;/code&gt; --  success!&lt;/li&gt;<a name="line.101"></a>
+<FONT color="green">102</FONT>         * &lt;li&gt; &lt;code&gt; a = lower &lt;/code&gt; and &lt;code&gt; b = upper&lt;/code&gt;<a name="line.102"></a>
+<FONT color="green">103</FONT>         * -- ConvergenceException &lt;/li&gt;<a name="line.103"></a>
+<FONT color="green">104</FONT>         * &lt;li&gt; &lt;code&gt; Integer.MAX_VALUE&lt;/code&gt; iterations elapse<a name="line.104"></a>
+<FONT color="green">105</FONT>         * -- ConvergenceException &lt;/li&gt;<a name="line.105"></a>
+<FONT color="green">106</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.106"></a>
+<FONT color="green">107</FONT>         * &lt;p&gt;<a name="line.107"></a>
+<FONT color="green">108</FONT>         * &lt;strong&gt;Note: &lt;/strong&gt; this method can take<a name="line.108"></a>
+<FONT color="green">109</FONT>         * &lt;code&gt;Integer.MAX_VALUE&lt;/code&gt; iterations to throw a<a name="line.109"></a>
+<FONT color="green">110</FONT>         * &lt;code&gt;ConvergenceException.&lt;/code&gt;  Unless you are confident that there<a name="line.110"></a>
+<FONT color="green">111</FONT>         * is a root between &lt;code&gt;lowerBound&lt;/code&gt; and &lt;code&gt;upperBound&lt;/code&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>         * near &lt;code&gt;initial,&lt;/code&gt; it is better to use<a name="line.112"></a>
+<FONT color="green">113</FONT>         * {@link #bracket(UnivariateRealFunction, double, double, double, int)},<a name="line.113"></a>
+<FONT color="green">114</FONT>         * explicitly specifying the maximum number of iterations.&lt;/p&gt;<a name="line.114"></a>
+<FONT color="green">115</FONT>         *<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @param function the function<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @param initial initial midpoint of interval being expanded to<a name="line.117"></a>
+<FONT color="green">118</FONT>         * bracket a root<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @param lowerBound lower bound (a is never lower than this value)<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @param upperBound upper bound (b never is greater than this<a name="line.120"></a>
+<FONT color="green">121</FONT>         * value)<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @return a two element array holding {a, b}<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @throws ConvergenceException if a root can not be bracketted<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.124"></a>
+<FONT color="green">125</FONT>         * function<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @throws IllegalArgumentException if function is null, maximumIterations<a name="line.126"></a>
+<FONT color="green">127</FONT>         * is not positive, or initial is not between lowerBound and upperBound<a name="line.127"></a>
+<FONT color="green">128</FONT>         */<a name="line.128"></a>
+<FONT color="green">129</FONT>        public static double[] bracket(UnivariateRealFunction function,<a name="line.129"></a>
+<FONT color="green">130</FONT>                double initial, double lowerBound, double upperBound)<a name="line.130"></a>
+<FONT color="green">131</FONT>        throws ConvergenceException, FunctionEvaluationException {<a name="line.131"></a>
+<FONT color="green">132</FONT>            return bracket( function, initial, lowerBound, upperBound,<a name="line.132"></a>
+<FONT color="green">133</FONT>                Integer.MAX_VALUE ) ;<a name="line.133"></a>
+<FONT color="green">134</FONT>        }<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>         /**<a name="line.136"></a>
+<FONT color="green">137</FONT>         * This method attempts to find two values a and b satisfying &lt;ul&gt;<a name="line.137"></a>
+<FONT color="green">138</FONT>         * &lt;li&gt; &lt;code&gt; lowerBound &lt;= a &lt; initial &lt; b &lt;= upperBound&lt;/code&gt; &lt;/li&gt;<a name="line.138"></a>
+<FONT color="green">139</FONT>         * &lt;li&gt; &lt;code&gt; f(a) * f(b) &lt;= 0 &lt;/code&gt; &lt;/li&gt;<a name="line.139"></a>
+<FONT color="green">140</FONT>         * &lt;/ul&gt;<a name="line.140"></a>
+<FONT color="green">141</FONT>         * If f is continuous on &lt;code&gt;[a,b],&lt;/code&gt; this means that &lt;code&gt;a&lt;/code&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>         * and &lt;code&gt;b&lt;/code&gt; bracket a root of f.<a name="line.142"></a>
+<FONT color="green">143</FONT>         * &lt;p&gt;<a name="line.143"></a>
+<FONT color="green">144</FONT>         * The algorithm starts by setting<a name="line.144"></a>
+<FONT color="green">145</FONT>         * &lt;code&gt;a := initial -1; b := initial +1,&lt;/code&gt; examines the value of the<a name="line.145"></a>
+<FONT color="green">146</FONT>         * function at &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt; and keeps moving<a name="line.146"></a>
+<FONT color="green">147</FONT>         * the endpoints out by one unit each time through a loop that terminates<a name="line.147"></a>
+<FONT color="green">148</FONT>         * when one of the following happens: &lt;ul&gt;<a name="line.148"></a>
+<FONT color="green">149</FONT>         * &lt;li&gt; &lt;code&gt; f(a) * f(b) &lt;= 0 &lt;/code&gt; --  success!&lt;/li&gt;<a name="line.149"></a>
+<FONT color="green">150</FONT>         * &lt;li&gt; &lt;code&gt; a = lower &lt;/code&gt; and &lt;code&gt; b = upper&lt;/code&gt;<a name="line.150"></a>
+<FONT color="green">151</FONT>         * -- ConvergenceException &lt;/li&gt;<a name="line.151"></a>
+<FONT color="green">152</FONT>         * &lt;li&gt; &lt;code&gt; maximumIterations&lt;/code&gt; iterations elapse<a name="line.152"></a>
+<FONT color="green">153</FONT>         * -- ConvergenceException &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.153"></a>
+<FONT color="green">154</FONT>         *<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @param function the function<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @param initial initial midpoint of interval being expanded to<a name="line.156"></a>
+<FONT color="green">157</FONT>         * bracket a root<a name="line.157"></a>
+<FONT color="green">158</FONT>         * @param lowerBound lower bound (a is never lower than this value)<a name="line.158"></a>
+<FONT color="green">159</FONT>         * @param upperBound upper bound (b never is greater than this<a name="line.159"></a>
+<FONT color="green">160</FONT>         * value)<a name="line.160"></a>
+<FONT color="green">161</FONT>         * @param maximumIterations maximum number of iterations to perform<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @return a two element array holding {a, b}.<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @throws ConvergenceException if the algorithm fails to find a and b<a name="line.163"></a>
+<FONT color="green">164</FONT>         * satisfying the desired conditions<a name="line.164"></a>
+<FONT color="green">165</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.165"></a>
+<FONT color="green">166</FONT>         * function<a name="line.166"></a>
+<FONT color="green">167</FONT>         * @throws IllegalArgumentException if function is null, maximumIterations<a name="line.167"></a>
+<FONT color="green">168</FONT>         * is not positive, or initial is not between lowerBound and upperBound<a name="line.168"></a>
+<FONT color="green">169</FONT>         */<a name="line.169"></a>
+<FONT color="green">170</FONT>        public static double[] bracket(UnivariateRealFunction function,<a name="line.170"></a>
+<FONT color="green">171</FONT>                double initial, double lowerBound, double upperBound,<a name="line.171"></a>
+<FONT color="green">172</FONT>                int maximumIterations) throws ConvergenceException,<a name="line.172"></a>
+<FONT color="green">173</FONT>                FunctionEvaluationException {<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>            if (function == null) {<a name="line.175"></a>
+<FONT color="green">176</FONT>                throw MathRuntimeException.createIllegalArgumentException(NULL_FUNCTION_MESSAGE);<a name="line.176"></a>
+<FONT color="green">177</FONT>            }<a name="line.177"></a>
+<FONT color="green">178</FONT>            if (maximumIterations &lt;= 0)  {<a name="line.178"></a>
+<FONT color="green">179</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.179"></a>
+<FONT color="green">180</FONT>                      "bad value for maximum iterations number: {0}", maximumIterations);<a name="line.180"></a>
+<FONT color="green">181</FONT>            }<a name="line.181"></a>
+<FONT color="green">182</FONT>            if (initial &lt; lowerBound || initial &gt; upperBound || lowerBound &gt;= upperBound) {<a name="line.182"></a>
+<FONT color="green">183</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.183"></a>
+<FONT color="green">184</FONT>                      "invalid bracketing parameters:  lower bound={0},  initial={1}, upper bound={2}",<a name="line.184"></a>
+<FONT color="green">185</FONT>                      lowerBound, initial, upperBound);<a name="line.185"></a>
+<FONT color="green">186</FONT>            }<a name="line.186"></a>
+<FONT color="green">187</FONT>            double a = initial;<a name="line.187"></a>
+<FONT color="green">188</FONT>            double b = initial;<a name="line.188"></a>
+<FONT color="green">189</FONT>            double fa;<a name="line.189"></a>
+<FONT color="green">190</FONT>            double fb;<a name="line.190"></a>
+<FONT color="green">191</FONT>            int numIterations = 0 ;<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>            do {<a name="line.193"></a>
+<FONT color="green">194</FONT>                a = Math.max(a - 1.0, lowerBound);<a name="line.194"></a>
+<FONT color="green">195</FONT>                b = Math.min(b + 1.0, upperBound);<a name="line.195"></a>
+<FONT color="green">196</FONT>                fa = function.value(a);<a name="line.196"></a>
+<FONT color="green">197</FONT>    <a name="line.197"></a>
+<FONT color="green">198</FONT>                fb = function.value(b);<a name="line.198"></a>
+<FONT color="green">199</FONT>                numIterations++ ;<a name="line.199"></a>
+<FONT color="green">200</FONT>            } while ((fa * fb &gt; 0.0) &amp;&amp; (numIterations &lt; maximumIterations) &amp;&amp;<a name="line.200"></a>
+<FONT color="green">201</FONT>                    ((a &gt; lowerBound) || (b &lt; upperBound)));<a name="line.201"></a>
+<FONT color="green">202</FONT>    <a name="line.202"></a>
+<FONT color="green">203</FONT>            if (fa * fb &gt; 0.0 ) {<a name="line.203"></a>
+<FONT color="green">204</FONT>                throw new ConvergenceException(<a name="line.204"></a>
+<FONT color="green">205</FONT>                          "number of iterations={0}, maximum iterations={1}, " +<a name="line.205"></a>
+<FONT color="green">206</FONT>                          "initial={2}, lower bound={3}, upper bound={4}, final a value={5}, " +<a name="line.206"></a>
+<FONT color="green">207</FONT>                          "final b value={6}, f(a)={7}, f(b)={8}",<a name="line.207"></a>
+<FONT color="green">208</FONT>                          numIterations, maximumIterations, initial,<a name="line.208"></a>
+<FONT color="green">209</FONT>                          lowerBound, upperBound, a, b, fa, fb);<a name="line.209"></a>
+<FONT color="green">210</FONT>            }<a name="line.210"></a>
+<FONT color="green">211</FONT>    <a name="line.211"></a>
+<FONT color="green">212</FONT>            return new double[]{a, b};<a name="line.212"></a>
+<FONT color="green">213</FONT>        }<a name="line.213"></a>
+<FONT color="green">214</FONT>    <a name="line.214"></a>
+<FONT color="green">215</FONT>        /**<a name="line.215"></a>
+<FONT color="green">216</FONT>         * Compute the midpoint of two values.<a name="line.216"></a>
+<FONT color="green">217</FONT>         *<a name="line.217"></a>
+<FONT color="green">218</FONT>         * @param a first value.<a name="line.218"></a>
+<FONT color="green">219</FONT>         * @param b second value.<a name="line.219"></a>
+<FONT color="green">220</FONT>         * @return the midpoint.<a name="line.220"></a>
+<FONT color="green">221</FONT>         */<a name="line.221"></a>
+<FONT color="green">222</FONT>        public static double midpoint(double a, double b) {<a name="line.222"></a>
+<FONT color="green">223</FONT>            return (a + b) * .5;<a name="line.223"></a>
+<FONT color="green">224</FONT>        }<a name="line.224"></a>
+<FONT color="green">225</FONT>    <a name="line.225"></a>
+<FONT color="green">226</FONT>        /**<a name="line.226"></a>
+<FONT color="green">227</FONT>         * Checks to see if f is null, throwing IllegalArgumentException if so.<a name="line.227"></a>
+<FONT color="green">228</FONT>         * @param f  input function<a name="line.228"></a>
+<FONT color="green">229</FONT>         * @throws IllegalArgumentException if f is null<a name="line.229"></a>
+<FONT color="green">230</FONT>         */<a name="line.230"></a>
+<FONT color="green">231</FONT>        private static void setup(UnivariateRealFunction f) {<a name="line.231"></a>
+<FONT color="green">232</FONT>            if (f == null) {<a name="line.232"></a>
+<FONT color="green">233</FONT>                throw MathRuntimeException.createIllegalArgumentException(NULL_FUNCTION_MESSAGE);<a name="line.233"></a>
+<FONT color="green">234</FONT>            }<a name="line.234"></a>
+<FONT color="green">235</FONT>        }<a name="line.235"></a>
+<FONT color="green">236</FONT>    <a name="line.236"></a>
+<FONT color="green">237</FONT>        // CHECKSTYLE: stop HideUtilityClassConstructor<a name="line.237"></a>
+<FONT color="green">238</FONT>        /** Holder for the factory.<a name="line.238"></a>
+<FONT color="green">239</FONT>         * &lt;p&gt;We use here the Initialization On Demand Holder Idiom.&lt;/p&gt;<a name="line.239"></a>
+<FONT color="green">240</FONT>         */<a name="line.240"></a>
+<FONT color="green">241</FONT>        private static class LazyHolder {<a name="line.241"></a>
+<FONT color="green">242</FONT>            /** Cached solver factory */<a name="line.242"></a>
+<FONT color="green">243</FONT>            private static final UnivariateRealSolverFactory FACTORY = UnivariateRealSolverFactory.newInstance();<a name="line.243"></a>
+<FONT color="green">244</FONT>        }<a name="line.244"></a>
+<FONT color="green">245</FONT>        // CHECKSTYLE: resume HideUtilityClassConstructor<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>    }<a name="line.247"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/complex/Complex.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,1071 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.complex;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.ArrayList;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.util.List;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.FieldElement;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    /**<a name="line.28"></a>
+<FONT color="green">029</FONT>     * Representation of a Complex number - a number which has both a<a name="line.29"></a>
+<FONT color="green">030</FONT>     * real and imaginary part.<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * Implementations of arithmetic operations handle &lt;code&gt;NaN&lt;/code&gt; and<a name="line.32"></a>
+<FONT color="green">033</FONT>     * infinite values according to the rules for {@link java.lang.Double}<a name="line.33"></a>
+<FONT color="green">034</FONT>     * arithmetic, applying definitional formulas and returning &lt;code&gt;NaN&lt;/code&gt; or<a name="line.34"></a>
+<FONT color="green">035</FONT>     * infinite values in real or imaginary parts as these arise in computation.<a name="line.35"></a>
+<FONT color="green">036</FONT>     * See individual method javadocs for details.&lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * {@link #equals} identifies all values with &lt;code&gt;NaN&lt;/code&gt; in either real<a name="line.38"></a>
+<FONT color="green">039</FONT>     * or imaginary part - e.g., &lt;pre&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;code&gt;1 + NaNi  == NaN + i == NaN + NaNi.&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     *<a name="line.41"></a>
+<FONT color="green">042</FONT>     * implements Serializable since 2.0<a name="line.42"></a>
+<FONT color="green">043</FONT>     *<a name="line.43"></a>
+<FONT color="green">044</FONT>     * @version $Revision: 922713 $ $Date: 2010-03-13 20:26:13 -0500 (Sat, 13 Mar 2010) $<a name="line.44"></a>
+<FONT color="green">045</FONT>     */<a name="line.45"></a>
+<FONT color="green">046</FONT>    public class Complex implements FieldElement&lt;Complex&gt;, Serializable  {<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** The square root of -1. A number representing "0.0 + 1.0i" */<a name="line.48"></a>
+<FONT color="green">049</FONT>        public static final Complex I = new Complex(0.0, 1.0);<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        // CHECKSTYLE: stop ConstantName<a name="line.51"></a>
+<FONT color="green">052</FONT>        /** A complex number representing "NaN + NaNi" */<a name="line.52"></a>
+<FONT color="green">053</FONT>        public static final Complex NaN = new Complex(Double.NaN, Double.NaN);<a name="line.53"></a>
+<FONT color="green">054</FONT>        // CHECKSTYLE: resume ConstantName<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** A complex number representing "+INF + INFi" */<a name="line.56"></a>
+<FONT color="green">057</FONT>        public static final Complex INF = new Complex(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** A complex number representing "1.0 + 0.0i" */<a name="line.59"></a>
+<FONT color="green">060</FONT>        public static final Complex ONE = new Complex(1.0, 0.0);<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** A complex number representing "0.0 + 0.0i" */<a name="line.62"></a>
+<FONT color="green">063</FONT>        public static final Complex ZERO = new Complex(0.0, 0.0);<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Serializable version identifier */<a name="line.65"></a>
+<FONT color="green">066</FONT>        private static final long serialVersionUID = -6195664516687396620L;<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /** The imaginary part. */<a name="line.68"></a>
+<FONT color="green">069</FONT>        private final double imaginary;<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** The real part. */<a name="line.71"></a>
+<FONT color="green">072</FONT>        private final double real;<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /** Record whether this complex number is equal to NaN. */<a name="line.74"></a>
+<FONT color="green">075</FONT>        private final transient boolean isNaN;<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** Record whether this complex number is infinite. */<a name="line.77"></a>
+<FONT color="green">078</FONT>        private final transient boolean isInfinite;<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /**<a name="line.80"></a>
+<FONT color="green">081</FONT>         * Create a complex number given the real and imaginary parts.<a name="line.81"></a>
+<FONT color="green">082</FONT>         *<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param real the real part<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @param imaginary the imaginary part<a name="line.84"></a>
+<FONT color="green">085</FONT>         */<a name="line.85"></a>
+<FONT color="green">086</FONT>        public Complex(double real, double imaginary) {<a name="line.86"></a>
+<FONT color="green">087</FONT>            super();<a name="line.87"></a>
+<FONT color="green">088</FONT>            this.real = real;<a name="line.88"></a>
+<FONT color="green">089</FONT>            this.imaginary = imaginary;<a name="line.89"></a>
+<FONT color="green">090</FONT>    <a name="line.90"></a>
+<FONT color="green">091</FONT>            isNaN = Double.isNaN(real) || Double.isNaN(imaginary);<a name="line.91"></a>
+<FONT color="green">092</FONT>            isInfinite = !isNaN &amp;&amp;<a name="line.92"></a>
+<FONT color="green">093</FONT>            (Double.isInfinite(real) || Double.isInfinite(imaginary));<a name="line.93"></a>
+<FONT color="green">094</FONT>        }<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /**<a name="line.96"></a>
+<FONT color="green">097</FONT>         * Return the absolute value of this complex number.<a name="line.97"></a>
+<FONT color="green">098</FONT>         * &lt;p&gt;<a name="line.98"></a>
+<FONT color="green">099</FONT>         * Returns &lt;code&gt;NaN&lt;/code&gt; if either real or imaginary part is<a name="line.99"></a>
+<FONT color="green">100</FONT>         * &lt;code&gt;NaN&lt;/code&gt; and &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt; if<a name="line.100"></a>
+<FONT color="green">101</FONT>         * neither part is &lt;code&gt;NaN&lt;/code&gt;, but at least one part takes an infinite<a name="line.101"></a>
+<FONT color="green">102</FONT>         * value.&lt;/p&gt;<a name="line.102"></a>
+<FONT color="green">103</FONT>         *<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @return the absolute value<a name="line.104"></a>
+<FONT color="green">105</FONT>         */<a name="line.105"></a>
+<FONT color="green">106</FONT>        public double abs() {<a name="line.106"></a>
+<FONT color="green">107</FONT>            if (isNaN()) {<a name="line.107"></a>
+<FONT color="green">108</FONT>                return Double.NaN;<a name="line.108"></a>
+<FONT color="green">109</FONT>            }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>            if (isInfinite()) {<a name="line.111"></a>
+<FONT color="green">112</FONT>                return Double.POSITIVE_INFINITY;<a name="line.112"></a>
+<FONT color="green">113</FONT>            }<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>            if (Math.abs(real) &lt; Math.abs(imaginary)) {<a name="line.115"></a>
+<FONT color="green">116</FONT>                if (imaginary == 0.0) {<a name="line.116"></a>
+<FONT color="green">117</FONT>                    return Math.abs(real);<a name="line.117"></a>
+<FONT color="green">118</FONT>                }<a name="line.118"></a>
+<FONT color="green">119</FONT>                double q = real / imaginary;<a name="line.119"></a>
+<FONT color="green">120</FONT>                return Math.abs(imaginary) * Math.sqrt(1 + q * q);<a name="line.120"></a>
+<FONT color="green">121</FONT>            } else {<a name="line.121"></a>
+<FONT color="green">122</FONT>                if (real == 0.0) {<a name="line.122"></a>
+<FONT color="green">123</FONT>                    return Math.abs(imaginary);<a name="line.123"></a>
+<FONT color="green">124</FONT>                }<a name="line.124"></a>
+<FONT color="green">125</FONT>                double q = imaginary / real;<a name="line.125"></a>
+<FONT color="green">126</FONT>                return Math.abs(real) * Math.sqrt(1 + q * q);<a name="line.126"></a>
+<FONT color="green">127</FONT>            }<a name="line.127"></a>
+<FONT color="green">128</FONT>        }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /**<a name="line.130"></a>
+<FONT color="green">131</FONT>         * Return the sum of this complex number and the given complex number.<a name="line.131"></a>
+<FONT color="green">132</FONT>         * &lt;p&gt;<a name="line.132"></a>
+<FONT color="green">133</FONT>         * Uses the definitional formula<a name="line.133"></a>
+<FONT color="green">134</FONT>         * &lt;pre&gt;<a name="line.134"></a>
+<FONT color="green">135</FONT>         * (a + bi) + (c + di) = (a+c) + (b+d)i<a name="line.135"></a>
+<FONT color="green">136</FONT>         * &lt;/pre&gt;&lt;/p&gt;<a name="line.136"></a>
+<FONT color="green">137</FONT>         * &lt;p&gt;<a name="line.137"></a>
+<FONT color="green">138</FONT>         * If either this or &lt;code&gt;rhs&lt;/code&gt; has a NaN value in either part,<a name="line.138"></a>
+<FONT color="green">139</FONT>         * {@link #NaN} is returned; otherwise Inifinite and NaN values are<a name="line.139"></a>
+<FONT color="green">140</FONT>         * returned in the parts of the result according to the rules for<a name="line.140"></a>
+<FONT color="green">141</FONT>         * {@link java.lang.Double} arithmetic.&lt;/p&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>         *<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @param rhs the other complex number<a name="line.143"></a>
+<FONT color="green">144</FONT>         * @return the complex number sum<a name="line.144"></a>
+<FONT color="green">145</FONT>         * @throws NullPointerException if &lt;code&gt;rhs&lt;/code&gt; is null<a name="line.145"></a>
+<FONT color="green">146</FONT>         */<a name="line.146"></a>
+<FONT color="green">147</FONT>        public Complex add(Complex rhs) {<a name="line.147"></a>
+<FONT color="green">148</FONT>            return createComplex(real + rhs.getReal(),<a name="line.148"></a>
+<FONT color="green">149</FONT>                imaginary + rhs.getImaginary());<a name="line.149"></a>
+<FONT color="green">150</FONT>        }<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>        /**<a name="line.152"></a>
+<FONT color="green">153</FONT>         * Return the conjugate of this complex number. The conjugate of<a name="line.153"></a>
+<FONT color="green">154</FONT>         * "A + Bi" is "A - Bi".<a name="line.154"></a>
+<FONT color="green">155</FONT>         * &lt;p&gt;<a name="line.155"></a>
+<FONT color="green">156</FONT>         * {@link #NaN} is returned if either the real or imaginary<a name="line.156"></a>
+<FONT color="green">157</FONT>         * part of this Complex number equals &lt;code&gt;Double.NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.157"></a>
+<FONT color="green">158</FONT>         * &lt;p&gt;<a name="line.158"></a>
+<FONT color="green">159</FONT>         * If the imaginary part is infinite, and the real part is not NaN,<a name="line.159"></a>
+<FONT color="green">160</FONT>         * the returned value has infinite imaginary part of the opposite<a name="line.160"></a>
+<FONT color="green">161</FONT>         * sign - e.g. the conjugate of &lt;code&gt;1 + POSITIVE_INFINITY i&lt;/code&gt;<a name="line.161"></a>
+<FONT color="green">162</FONT>         * is &lt;code&gt;1 - NEGATIVE_INFINITY i&lt;/code&gt;&lt;/p&gt;<a name="line.162"></a>
+<FONT color="green">163</FONT>         *<a name="line.163"></a>
+<FONT color="green">164</FONT>         * @return the conjugate of this Complex object<a name="line.164"></a>
+<FONT color="green">165</FONT>         */<a name="line.165"></a>
+<FONT color="green">166</FONT>        public Complex conjugate() {<a name="line.166"></a>
+<FONT color="green">167</FONT>            if (isNaN()) {<a name="line.167"></a>
+<FONT color="green">168</FONT>                return NaN;<a name="line.168"></a>
+<FONT color="green">169</FONT>            }<a name="line.169"></a>
+<FONT color="green">170</FONT>            return createComplex(real, -imaginary);<a name="line.170"></a>
+<FONT color="green">171</FONT>        }<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>        /**<a name="line.173"></a>
+<FONT color="green">174</FONT>         * Return the quotient of this complex number and the given complex number.<a name="line.174"></a>
+<FONT color="green">175</FONT>         * &lt;p&gt;<a name="line.175"></a>
+<FONT color="green">176</FONT>         * Implements the definitional formula<a name="line.176"></a>
+<FONT color="green">177</FONT>         * &lt;pre&gt;&lt;code&gt;<a name="line.177"></a>
+<FONT color="green">178</FONT>         *    a + bi          ac + bd + (bc - ad)i<a name="line.178"></a>
+<FONT color="green">179</FONT>         *    ----------- = -------------------------<a name="line.179"></a>
+<FONT color="green">180</FONT>         *    c + di         c&lt;sup&gt;2&lt;/sup&gt; + d&lt;sup&gt;2&lt;/sup&gt;<a name="line.180"></a>
+<FONT color="green">181</FONT>         * &lt;/code&gt;&lt;/pre&gt;<a name="line.181"></a>
+<FONT color="green">182</FONT>         * but uses<a name="line.182"></a>
+<FONT color="green">183</FONT>         * &lt;a href="http://doi.acm.org/10.1145/1039813.1039814"&gt;<a name="line.183"></a>
+<FONT color="green">184</FONT>         * prescaling of operands&lt;/a&gt; to limit the effects of overflows and<a name="line.184"></a>
+<FONT color="green">185</FONT>         * underflows in the computation.&lt;/p&gt;<a name="line.185"></a>
+<FONT color="green">186</FONT>         * &lt;p&gt;<a name="line.186"></a>
+<FONT color="green">187</FONT>         * Infinite and NaN values are handled / returned according to the<a name="line.187"></a>
+<FONT color="green">188</FONT>         * following rules, applied in the order presented:<a name="line.188"></a>
+<FONT color="green">189</FONT>         * &lt;ul&gt;<a name="line.189"></a>
+<FONT color="green">190</FONT>         * &lt;li&gt;If either this or &lt;code&gt;rhs&lt;/code&gt; has a NaN value in either part,<a name="line.190"></a>
+<FONT color="green">191</FONT>         *  {@link #NaN} is returned.&lt;/li&gt;<a name="line.191"></a>
+<FONT color="green">192</FONT>         * &lt;li&gt;If &lt;code&gt;rhs&lt;/code&gt; equals {@link #ZERO}, {@link #NaN} is returned.<a name="line.192"></a>
+<FONT color="green">193</FONT>         * &lt;/li&gt;<a name="line.193"></a>
+<FONT color="green">194</FONT>         * &lt;li&gt;If this and &lt;code&gt;rhs&lt;/code&gt; are both infinite,<a name="line.194"></a>
+<FONT color="green">195</FONT>         * {@link #NaN} is returned.&lt;/li&gt;<a name="line.195"></a>
+<FONT color="green">196</FONT>         * &lt;li&gt;If this is finite (i.e., has no infinite or NaN parts) and<a name="line.196"></a>
+<FONT color="green">197</FONT>         *  &lt;code&gt;rhs&lt;/code&gt; is infinite (one or both parts infinite),<a name="line.197"></a>
+<FONT color="green">198</FONT>         * {@link #ZERO} is returned.&lt;/li&gt;<a name="line.198"></a>
+<FONT color="green">199</FONT>         * &lt;li&gt;If this is infinite and &lt;code&gt;rhs&lt;/code&gt; is finite, NaN values are<a name="line.199"></a>
+<FONT color="green">200</FONT>         * returned in the parts of the result if the {@link java.lang.Double}<a name="line.200"></a>
+<FONT color="green">201</FONT>         * rules applied to the definitional formula force NaN results.&lt;/li&gt;<a name="line.201"></a>
+<FONT color="green">202</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.202"></a>
+<FONT color="green">203</FONT>         *<a name="line.203"></a>
+<FONT color="green">204</FONT>         * @param rhs the other complex number<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @return the complex number quotient<a name="line.205"></a>
+<FONT color="green">206</FONT>         * @throws NullPointerException if &lt;code&gt;rhs&lt;/code&gt; is null<a name="line.206"></a>
+<FONT color="green">207</FONT>         */<a name="line.207"></a>
+<FONT color="green">208</FONT>        public Complex divide(Complex rhs) {<a name="line.208"></a>
+<FONT color="green">209</FONT>            if (isNaN() || rhs.isNaN()) {<a name="line.209"></a>
+<FONT color="green">210</FONT>                return NaN;<a name="line.210"></a>
+<FONT color="green">211</FONT>            }<a name="line.211"></a>
+<FONT color="green">212</FONT>    <a name="line.212"></a>
+<FONT color="green">213</FONT>            double c = rhs.getReal();<a name="line.213"></a>
+<FONT color="green">214</FONT>            double d = rhs.getImaginary();<a name="line.214"></a>
+<FONT color="green">215</FONT>            if (c == 0.0 &amp;&amp; d == 0.0) {<a name="line.215"></a>
+<FONT color="green">216</FONT>                return NaN;<a name="line.216"></a>
+<FONT color="green">217</FONT>            }<a name="line.217"></a>
+<FONT color="green">218</FONT>    <a name="line.218"></a>
+<FONT color="green">219</FONT>            if (rhs.isInfinite() &amp;&amp; !isInfinite()) {<a name="line.219"></a>
+<FONT color="green">220</FONT>                return ZERO;<a name="line.220"></a>
+<FONT color="green">221</FONT>            }<a name="line.221"></a>
+<FONT color="green">222</FONT>    <a name="line.222"></a>
+<FONT color="green">223</FONT>            if (Math.abs(c) &lt; Math.abs(d)) {<a name="line.223"></a>
+<FONT color="green">224</FONT>                double q = c / d;<a name="line.224"></a>
+<FONT color="green">225</FONT>                double denominator = c * q + d;<a name="line.225"></a>
+<FONT color="green">226</FONT>                return createComplex((real * q + imaginary) / denominator,<a name="line.226"></a>
+<FONT color="green">227</FONT>                    (imaginary * q - real) / denominator);<a name="line.227"></a>
+<FONT color="green">228</FONT>            } else {<a name="line.228"></a>
+<FONT color="green">229</FONT>                double q = d / c;<a name="line.229"></a>
+<FONT color="green">230</FONT>                double denominator = d * q + c;<a name="line.230"></a>
+<FONT color="green">231</FONT>                return createComplex((imaginary * q + real) / denominator,<a name="line.231"></a>
+<FONT color="green">232</FONT>                    (imaginary - real * q) / denominator);<a name="line.232"></a>
+<FONT color="green">233</FONT>            }<a name="line.233"></a>
+<FONT color="green">234</FONT>        }<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>        /**<a name="line.236"></a>
+<FONT color="green">237</FONT>         * Test for the equality of two Complex objects.<a name="line.237"></a>
+<FONT color="green">238</FONT>         * &lt;p&gt;<a name="line.238"></a>
+<FONT color="green">239</FONT>         * If both the real and imaginary parts of two Complex numbers<a name="line.239"></a>
+<FONT color="green">240</FONT>         * are exactly the same, and neither is &lt;code&gt;Double.NaN&lt;/code&gt;, the two<a name="line.240"></a>
+<FONT color="green">241</FONT>         * Complex objects are considered to be equal.&lt;/p&gt;<a name="line.241"></a>
+<FONT color="green">242</FONT>         * &lt;p&gt;<a name="line.242"></a>
+<FONT color="green">243</FONT>         * All &lt;code&gt;NaN&lt;/code&gt; values are considered to be equal - i.e, if either<a name="line.243"></a>
+<FONT color="green">244</FONT>         * (or both) real and imaginary parts of the complex number are equal<a name="line.244"></a>
+<FONT color="green">245</FONT>         * to &lt;code&gt;Double.NaN&lt;/code&gt;, the complex number is equal to<a name="line.245"></a>
+<FONT color="green">246</FONT>         * &lt;code&gt;Complex.NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.246"></a>
+<FONT color="green">247</FONT>         *<a name="line.247"></a>
+<FONT color="green">248</FONT>         * @param other Object to test for equality to this<a name="line.248"></a>
+<FONT color="green">249</FONT>         * @return true if two Complex objects are equal, false if<a name="line.249"></a>
+<FONT color="green">250</FONT>         *         object is null, not an instance of Complex, or<a name="line.250"></a>
+<FONT color="green">251</FONT>         *         not equal to this Complex instance<a name="line.251"></a>
+<FONT color="green">252</FONT>         *<a name="line.252"></a>
+<FONT color="green">253</FONT>         */<a name="line.253"></a>
+<FONT color="green">254</FONT>        @Override<a name="line.254"></a>
+<FONT color="green">255</FONT>        public boolean equals(Object other) {<a name="line.255"></a>
+<FONT color="green">256</FONT>            if (this == other) {<a name="line.256"></a>
+<FONT color="green">257</FONT>                return true;<a name="line.257"></a>
+<FONT color="green">258</FONT>            }<a name="line.258"></a>
+<FONT color="green">259</FONT>            if (other instanceof Complex){<a name="line.259"></a>
+<FONT color="green">260</FONT>                Complex rhs = (Complex)other;<a name="line.260"></a>
+<FONT color="green">261</FONT>                if (rhs.isNaN()) {<a name="line.261"></a>
+<FONT color="green">262</FONT>                    return this.isNaN();<a name="line.262"></a>
+<FONT color="green">263</FONT>                } else {<a name="line.263"></a>
+<FONT color="green">264</FONT>                    return (real == rhs.real) &amp;&amp; (imaginary == rhs.imaginary);<a name="line.264"></a>
+<FONT color="green">265</FONT>                }<a name="line.265"></a>
+<FONT color="green">266</FONT>            }<a name="line.266"></a>
+<FONT color="green">267</FONT>            return false;<a name="line.267"></a>
+<FONT color="green">268</FONT>        }<a name="line.268"></a>
+<FONT color="green">269</FONT>    <a name="line.269"></a>
+<FONT color="green">270</FONT>        /**<a name="line.270"></a>
+<FONT color="green">271</FONT>         * Get a hashCode for the complex number.<a name="line.271"></a>
+<FONT color="green">272</FONT>         * &lt;p&gt;<a name="line.272"></a>
+<FONT color="green">273</FONT>         * All NaN values have the same hash code.&lt;/p&gt;<a name="line.273"></a>
+<FONT color="green">274</FONT>         *<a name="line.274"></a>
+<FONT color="green">275</FONT>         * @return a hash code value for this object<a name="line.275"></a>
+<FONT color="green">276</FONT>         */<a name="line.276"></a>
+<FONT color="green">277</FONT>        @Override<a name="line.277"></a>
+<FONT color="green">278</FONT>        public int hashCode() {<a name="line.278"></a>
+<FONT color="green">279</FONT>            if (isNaN()) {<a name="line.279"></a>
+<FONT color="green">280</FONT>                return 7;<a name="line.280"></a>
+<FONT color="green">281</FONT>            }<a name="line.281"></a>
+<FONT color="green">282</FONT>            return 37 * (17 * MathUtils.hash(imaginary) +<a name="line.282"></a>
+<FONT color="green">283</FONT>                MathUtils.hash(real));<a name="line.283"></a>
+<FONT color="green">284</FONT>        }<a name="line.284"></a>
+<FONT color="green">285</FONT>    <a name="line.285"></a>
+<FONT color="green">286</FONT>        /**<a name="line.286"></a>
+<FONT color="green">287</FONT>         * Access the imaginary part.<a name="line.287"></a>
+<FONT color="green">288</FONT>         *<a name="line.288"></a>
+<FONT color="green">289</FONT>         * @return the imaginary part<a name="line.289"></a>
+<FONT color="green">290</FONT>         */<a name="line.290"></a>
+<FONT color="green">291</FONT>        public double getImaginary() {<a name="line.291"></a>
+<FONT color="green">292</FONT>            return imaginary;<a name="line.292"></a>
+<FONT color="green">293</FONT>        }<a name="line.293"></a>
+<FONT color="green">294</FONT>    <a name="line.294"></a>
+<FONT color="green">295</FONT>        /**<a name="line.295"></a>
+<FONT color="green">296</FONT>         * Access the real part.<a name="line.296"></a>
+<FONT color="green">297</FONT>         *<a name="line.297"></a>
+<FONT color="green">298</FONT>         * @return the real part<a name="line.298"></a>
+<FONT color="green">299</FONT>         */<a name="line.299"></a>
+<FONT color="green">300</FONT>        public double getReal() {<a name="line.300"></a>
+<FONT color="green">301</FONT>            return real;<a name="line.301"></a>
+<FONT color="green">302</FONT>        }<a name="line.302"></a>
+<FONT color="green">303</FONT>    <a name="line.303"></a>
+<FONT color="green">304</FONT>        /**<a name="line.304"></a>
+<FONT color="green">305</FONT>         * Returns true if either or both parts of this complex number is NaN;<a name="line.305"></a>
+<FONT color="green">306</FONT>         * false otherwise<a name="line.306"></a>
+<FONT color="green">307</FONT>         *<a name="line.307"></a>
+<FONT color="green">308</FONT>         * @return  true if either or both parts of this complex number is NaN;<a name="line.308"></a>
+<FONT color="green">309</FONT>         * false otherwise<a name="line.309"></a>
+<FONT color="green">310</FONT>         */<a name="line.310"></a>
+<FONT color="green">311</FONT>        public boolean isNaN() {<a name="line.311"></a>
+<FONT color="green">312</FONT>            return isNaN;<a name="line.312"></a>
+<FONT color="green">313</FONT>        }<a name="line.313"></a>
+<FONT color="green">314</FONT>    <a name="line.314"></a>
+<FONT color="green">315</FONT>        /**<a name="line.315"></a>
+<FONT color="green">316</FONT>         * Returns true if either the real or imaginary part of this complex number<a name="line.316"></a>
+<FONT color="green">317</FONT>         * takes an infinite value (either &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt; or<a name="line.317"></a>
+<FONT color="green">318</FONT>         * &lt;code&gt;Double.NEGATIVE_INFINITY&lt;/code&gt;) and neither part<a name="line.318"></a>
+<FONT color="green">319</FONT>         * is &lt;code&gt;NaN&lt;/code&gt;.<a name="line.319"></a>
+<FONT color="green">320</FONT>         *<a name="line.320"></a>
+<FONT color="green">321</FONT>         * @return true if one or both parts of this complex number are infinite<a name="line.321"></a>
+<FONT color="green">322</FONT>         * and neither part is &lt;code&gt;NaN&lt;/code&gt;<a name="line.322"></a>
+<FONT color="green">323</FONT>         */<a name="line.323"></a>
+<FONT color="green">324</FONT>        public boolean isInfinite() {<a name="line.324"></a>
+<FONT color="green">325</FONT>            return isInfinite;<a name="line.325"></a>
+<FONT color="green">326</FONT>        }<a name="line.326"></a>
+<FONT color="green">327</FONT>    <a name="line.327"></a>
+<FONT color="green">328</FONT>        /**<a name="line.328"></a>
+<FONT color="green">329</FONT>         * Return the product of this complex number and the given complex number.<a name="line.329"></a>
+<FONT color="green">330</FONT>         * &lt;p&gt;<a name="line.330"></a>
+<FONT color="green">331</FONT>         * Implements preliminary checks for NaN and infinity followed by<a name="line.331"></a>
+<FONT color="green">332</FONT>         * the definitional formula:<a name="line.332"></a>
+<FONT color="green">333</FONT>         * &lt;pre&gt;&lt;code&gt;<a name="line.333"></a>
+<FONT color="green">334</FONT>         * (a + bi)(c + di) = (ac - bd) + (ad + bc)i<a name="line.334"></a>
+<FONT color="green">335</FONT>         * &lt;/code&gt;&lt;/pre&gt;<a name="line.335"></a>
+<FONT color="green">336</FONT>         * &lt;/p&gt;<a name="line.336"></a>
+<FONT color="green">337</FONT>         * &lt;p&gt;<a name="line.337"></a>
+<FONT color="green">338</FONT>         * Returns {@link #NaN} if either this or &lt;code&gt;rhs&lt;/code&gt; has one or more<a name="line.338"></a>
+<FONT color="green">339</FONT>         * NaN parts.<a name="line.339"></a>
+<FONT color="green">340</FONT>         * &lt;/p&gt;<a name="line.340"></a>
+<FONT color="green">341</FONT>         * Returns {@link #INF} if neither this nor &lt;code&gt;rhs&lt;/code&gt; has one or more<a name="line.341"></a>
+<FONT color="green">342</FONT>         * NaN parts and if either this or &lt;code&gt;rhs&lt;/code&gt; has one or more<a name="line.342"></a>
+<FONT color="green">343</FONT>         * infinite parts (same result is returned regardless of the sign of the<a name="line.343"></a>
+<FONT color="green">344</FONT>         * components).<a name="line.344"></a>
+<FONT color="green">345</FONT>         * &lt;/p&gt;<a name="line.345"></a>
+<FONT color="green">346</FONT>         * &lt;p&gt;<a name="line.346"></a>
+<FONT color="green">347</FONT>         * Returns finite values in components of the result per the<a name="line.347"></a>
+<FONT color="green">348</FONT>         * definitional formula in all remaining cases.<a name="line.348"></a>
+<FONT color="green">349</FONT>         *  &lt;/p&gt;<a name="line.349"></a>
+<FONT color="green">350</FONT>         *<a name="line.350"></a>
+<FONT color="green">351</FONT>         * @param rhs the other complex number<a name="line.351"></a>
+<FONT color="green">352</FONT>         * @return the complex number product<a name="line.352"></a>
+<FONT color="green">353</FONT>         * @throws NullPointerException if &lt;code&gt;rhs&lt;/code&gt; is null<a name="line.353"></a>
+<FONT color="green">354</FONT>         */<a name="line.354"></a>
+<FONT color="green">355</FONT>        public Complex multiply(Complex rhs) {<a name="line.355"></a>
+<FONT color="green">356</FONT>            if (isNaN() || rhs.isNaN()) {<a name="line.356"></a>
+<FONT color="green">357</FONT>                return NaN;<a name="line.357"></a>
+<FONT color="green">358</FONT>            }<a name="line.358"></a>
+<FONT color="green">359</FONT>            if (Double.isInfinite(real) || Double.isInfinite(imaginary) ||<a name="line.359"></a>
+<FONT color="green">360</FONT>                Double.isInfinite(rhs.real)|| Double.isInfinite(rhs.imaginary)) {<a name="line.360"></a>
+<FONT color="green">361</FONT>                // we don't use Complex.isInfinite() to avoid testing for NaN again<a name="line.361"></a>
+<FONT color="green">362</FONT>                return INF;<a name="line.362"></a>
+<FONT color="green">363</FONT>            }<a name="line.363"></a>
+<FONT color="green">364</FONT>            return createComplex(real * rhs.real - imaginary * rhs.imaginary,<a name="line.364"></a>
+<FONT color="green">365</FONT>                    real * rhs.imaginary + imaginary * rhs.real);<a name="line.365"></a>
+<FONT color="green">366</FONT>        }<a name="line.366"></a>
+<FONT color="green">367</FONT>    <a name="line.367"></a>
+<FONT color="green">368</FONT>        /**<a name="line.368"></a>
+<FONT color="green">369</FONT>         * Return the product of this complex number and the given scalar number.<a name="line.369"></a>
+<FONT color="green">370</FONT>         * &lt;p&gt;<a name="line.370"></a>
+<FONT color="green">371</FONT>         * Implements preliminary checks for NaN and infinity followed by<a name="line.371"></a>
+<FONT color="green">372</FONT>         * the definitional formula:<a name="line.372"></a>
+<FONT color="green">373</FONT>         * &lt;pre&gt;&lt;code&gt;<a name="line.373"></a>
+<FONT color="green">374</FONT>         * c(a + bi) = (ca) + (cb)i<a name="line.374"></a>
+<FONT color="green">375</FONT>         * &lt;/code&gt;&lt;/pre&gt;<a name="line.375"></a>
+<FONT color="green">376</FONT>         * &lt;/p&gt;<a name="line.376"></a>
+<FONT color="green">377</FONT>         * &lt;p&gt;<a name="line.377"></a>
+<FONT color="green">378</FONT>         * Returns {@link #NaN} if either this or &lt;code&gt;rhs&lt;/code&gt; has one or more<a name="line.378"></a>
+<FONT color="green">379</FONT>         * NaN parts.<a name="line.379"></a>
+<FONT color="green">380</FONT>         * &lt;/p&gt;<a name="line.380"></a>
+<FONT color="green">381</FONT>         * Returns {@link #INF} if neither this nor &lt;code&gt;rhs&lt;/code&gt; has one or more<a name="line.381"></a>
+<FONT color="green">382</FONT>         * NaN parts and if either this or &lt;code&gt;rhs&lt;/code&gt; has one or more<a name="line.382"></a>
+<FONT color="green">383</FONT>         * infinite parts (same result is returned regardless of the sign of the<a name="line.383"></a>
+<FONT color="green">384</FONT>         * components).<a name="line.384"></a>
+<FONT color="green">385</FONT>         * &lt;/p&gt;<a name="line.385"></a>
+<FONT color="green">386</FONT>         * &lt;p&gt;<a name="line.386"></a>
+<FONT color="green">387</FONT>         * Returns finite values in components of the result per the<a name="line.387"></a>
+<FONT color="green">388</FONT>         * definitional formula in all remaining cases.<a name="line.388"></a>
+<FONT color="green">389</FONT>         *  &lt;/p&gt;<a name="line.389"></a>
+<FONT color="green">390</FONT>         *<a name="line.390"></a>
+<FONT color="green">391</FONT>         * @param rhs the scalar number<a name="line.391"></a>
+<FONT color="green">392</FONT>         * @return the complex number product<a name="line.392"></a>
+<FONT color="green">393</FONT>         */<a name="line.393"></a>
+<FONT color="green">394</FONT>        public Complex multiply(double rhs) {<a name="line.394"></a>
+<FONT color="green">395</FONT>            if (isNaN() || Double.isNaN(rhs)) {<a name="line.395"></a>
+<FONT color="green">396</FONT>                return NaN;<a name="line.396"></a>
+<FONT color="green">397</FONT>            }<a name="line.397"></a>
+<FONT color="green">398</FONT>            if (Double.isInfinite(real) || Double.isInfinite(imaginary) ||<a name="line.398"></a>
+<FONT color="green">399</FONT>                Double.isInfinite(rhs)) {<a name="line.399"></a>
+<FONT color="green">400</FONT>                // we don't use Complex.isInfinite() to avoid testing for NaN again<a name="line.400"></a>
+<FONT color="green">401</FONT>                return INF;<a name="line.401"></a>
+<FONT color="green">402</FONT>            }<a name="line.402"></a>
+<FONT color="green">403</FONT>            return createComplex(real * rhs, imaginary * rhs);<a name="line.403"></a>
+<FONT color="green">404</FONT>        }<a name="line.404"></a>
+<FONT color="green">405</FONT>    <a name="line.405"></a>
+<FONT color="green">406</FONT>        /**<a name="line.406"></a>
+<FONT color="green">407</FONT>         * Return the additive inverse of this complex number.<a name="line.407"></a>
+<FONT color="green">408</FONT>         * &lt;p&gt;<a name="line.408"></a>
+<FONT color="green">409</FONT>         * Returns &lt;code&gt;Complex.NaN&lt;/code&gt; if either real or imaginary<a name="line.409"></a>
+<FONT color="green">410</FONT>         * part of this Complex number equals &lt;code&gt;Double.NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.410"></a>
+<FONT color="green">411</FONT>         *<a name="line.411"></a>
+<FONT color="green">412</FONT>         * @return the negation of this complex number<a name="line.412"></a>
+<FONT color="green">413</FONT>         */<a name="line.413"></a>
+<FONT color="green">414</FONT>        public Complex negate() {<a name="line.414"></a>
+<FONT color="green">415</FONT>            if (isNaN()) {<a name="line.415"></a>
+<FONT color="green">416</FONT>                return NaN;<a name="line.416"></a>
+<FONT color="green">417</FONT>            }<a name="line.417"></a>
+<FONT color="green">418</FONT>    <a name="line.418"></a>
+<FONT color="green">419</FONT>            return createComplex(-real, -imaginary);<a name="line.419"></a>
+<FONT color="green">420</FONT>        }<a name="line.420"></a>
+<FONT color="green">421</FONT>    <a name="line.421"></a>
+<FONT color="green">422</FONT>        /**<a name="line.422"></a>
+<FONT color="green">423</FONT>         * Return the difference between this complex number and the given complex<a name="line.423"></a>
+<FONT color="green">424</FONT>         * number.<a name="line.424"></a>
+<FONT color="green">425</FONT>          * &lt;p&gt;<a name="line.425"></a>
+<FONT color="green">426</FONT>         * Uses the definitional formula<a name="line.426"></a>
+<FONT color="green">427</FONT>         * &lt;pre&gt;<a name="line.427"></a>
+<FONT color="green">428</FONT>         * (a + bi) - (c + di) = (a-c) + (b-d)i<a name="line.428"></a>
+<FONT color="green">429</FONT>         * &lt;/pre&gt;&lt;/p&gt;<a name="line.429"></a>
+<FONT color="green">430</FONT>         * &lt;p&gt;<a name="line.430"></a>
+<FONT color="green">431</FONT>         * If either this or &lt;code&gt;rhs&lt;/code&gt; has a NaN value in either part,<a name="line.431"></a>
+<FONT color="green">432</FONT>         * {@link #NaN} is returned; otherwise inifinite and NaN values are<a name="line.432"></a>
+<FONT color="green">433</FONT>         * returned in the parts of the result according to the rules for<a name="line.433"></a>
+<FONT color="green">434</FONT>         * {@link java.lang.Double} arithmetic. &lt;/p&gt;<a name="line.434"></a>
+<FONT color="green">435</FONT>         *<a name="line.435"></a>
+<FONT color="green">436</FONT>         * @param rhs the other complex number<a name="line.436"></a>
+<FONT color="green">437</FONT>         * @return the complex number difference<a name="line.437"></a>
+<FONT color="green">438</FONT>         * @throws NullPointerException if &lt;code&gt;rhs&lt;/code&gt; is null<a name="line.438"></a>
+<FONT color="green">439</FONT>         */<a name="line.439"></a>
+<FONT color="green">440</FONT>        public Complex subtract(Complex rhs) {<a name="line.440"></a>
+<FONT color="green">441</FONT>            if (isNaN() || rhs.isNaN()) {<a name="line.441"></a>
+<FONT color="green">442</FONT>                return NaN;<a name="line.442"></a>
+<FONT color="green">443</FONT>            }<a name="line.443"></a>
+<FONT color="green">444</FONT>    <a name="line.444"></a>
+<FONT color="green">445</FONT>            return createComplex(real - rhs.getReal(),<a name="line.445"></a>
+<FONT color="green">446</FONT>                imaginary - rhs.getImaginary());<a name="line.446"></a>
+<FONT color="green">447</FONT>        }<a name="line.447"></a>
+<FONT color="green">448</FONT>    <a name="line.448"></a>
+<FONT color="green">449</FONT>        /**<a name="line.449"></a>
+<FONT color="green">450</FONT>         * Compute the<a name="line.450"></a>
+<FONT color="green">451</FONT>         * &lt;a href="http://mathworld.wolfram.com/InverseCosine.html" TARGET="_top"&gt;<a name="line.451"></a>
+<FONT color="green">452</FONT>         * inverse cosine&lt;/a&gt; of this complex number.<a name="line.452"></a>
+<FONT color="green">453</FONT>         * &lt;p&gt;<a name="line.453"></a>
+<FONT color="green">454</FONT>         * Implements the formula: &lt;pre&gt;<a name="line.454"></a>
+<FONT color="green">455</FONT>         * &lt;code&gt; acos(z) = -i (log(z + i (sqrt(1 - z&lt;sup&gt;2&lt;/sup&gt;))))&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;<a name="line.455"></a>
+<FONT color="green">456</FONT>         * &lt;p&gt;<a name="line.456"></a>
+<FONT color="green">457</FONT>         * Returns {@link Complex#NaN} if either real or imaginary part of the<a name="line.457"></a>
+<FONT color="green">458</FONT>         * input argument is &lt;code&gt;NaN&lt;/code&gt; or infinite.&lt;/p&gt;<a name="line.458"></a>
+<FONT color="green">459</FONT>         *<a name="line.459"></a>
+<FONT color="green">460</FONT>         * @return the inverse cosine of this complex number<a name="line.460"></a>
+<FONT color="green">461</FONT>         * @since 1.2<a name="line.461"></a>
+<FONT color="green">462</FONT>         */<a name="line.462"></a>
+<FONT color="green">463</FONT>        public Complex acos() {<a name="line.463"></a>
+<FONT color="green">464</FONT>            if (isNaN()) {<a name="line.464"></a>
+<FONT color="green">465</FONT>                return Complex.NaN;<a name="line.465"></a>
+<FONT color="green">466</FONT>            }<a name="line.466"></a>
+<FONT color="green">467</FONT>    <a name="line.467"></a>
+<FONT color="green">468</FONT>            return this.add(this.sqrt1z().multiply(Complex.I)).log()<a name="line.468"></a>
+<FONT color="green">469</FONT>                  .multiply(Complex.I.negate());<a name="line.469"></a>
+<FONT color="green">470</FONT>        }<a name="line.470"></a>
+<FONT color="green">471</FONT>    <a name="line.471"></a>
+<FONT color="green">472</FONT>        /**<a name="line.472"></a>
+<FONT color="green">473</FONT>         * Compute the<a name="line.473"></a>
+<FONT color="green">474</FONT>         * &lt;a href="http://mathworld.wolfram.com/InverseSine.html" TARGET="_top"&gt;<a name="line.474"></a>
+<FONT color="green">475</FONT>         * inverse sine&lt;/a&gt; of this complex number.<a name="line.475"></a>
+<FONT color="green">476</FONT>         * &lt;p&gt;<a name="line.476"></a>
+<FONT color="green">477</FONT>         * Implements the formula: &lt;pre&gt;<a name="line.477"></a>
+<FONT color="green">478</FONT>         * &lt;code&gt; asin(z) = -i (log(sqrt(1 - z&lt;sup&gt;2&lt;/sup&gt;) + iz)) &lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;<a name="line.478"></a>
+<FONT color="green">479</FONT>         * &lt;p&gt;<a name="line.479"></a>
+<FONT color="green">480</FONT>         * Returns {@link Complex#NaN} if either real or imaginary part of the<a name="line.480"></a>
+<FONT color="green">481</FONT>         * input argument is &lt;code&gt;NaN&lt;/code&gt; or infinite.&lt;/p&gt;<a name="line.481"></a>
+<FONT color="green">482</FONT>         *<a name="line.482"></a>
+<FONT color="green">483</FONT>         * @return the inverse sine of this complex number.<a name="line.483"></a>
+<FONT color="green">484</FONT>         * @since 1.2<a name="line.484"></a>
+<FONT color="green">485</FONT>         */<a name="line.485"></a>
+<FONT color="green">486</FONT>        public Complex asin() {<a name="line.486"></a>
+<FONT color="green">487</FONT>            if (isNaN()) {<a name="line.487"></a>
+<FONT color="green">488</FONT>                return Complex.NaN;<a name="line.488"></a>
+<FONT color="green">489</FONT>            }<a name="line.489"></a>
+<FONT color="green">490</FONT>    <a name="line.490"></a>
+<FONT color="green">491</FONT>            return sqrt1z().add(this.multiply(Complex.I)).log()<a name="line.491"></a>
+<FONT color="green">492</FONT>                  .multiply(Complex.I.negate());<a name="line.492"></a>
+<FONT color="green">493</FONT>        }<a name="line.493"></a>
+<FONT color="green">494</FONT>    <a name="line.494"></a>
+<FONT color="green">495</FONT>        /**<a name="line.495"></a>
+<FONT color="green">496</FONT>         * Compute the<a name="line.496"></a>
+<FONT color="green">497</FONT>         * &lt;a href="http://mathworld.wolfram.com/InverseTangent.html" TARGET="_top"&gt;<a name="line.497"></a>
+<FONT color="green">498</FONT>         * inverse tangent&lt;/a&gt; of this complex number.<a name="line.498"></a>
+<FONT color="green">499</FONT>         * &lt;p&gt;<a name="line.499"></a>
+<FONT color="green">500</FONT>         * Implements the formula: &lt;pre&gt;<a name="line.500"></a>
+<FONT color="green">501</FONT>         * &lt;code&gt; atan(z) = (i/2) log((i + z)/(i - z)) &lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;<a name="line.501"></a>
+<FONT color="green">502</FONT>         * &lt;p&gt;<a name="line.502"></a>
+<FONT color="green">503</FONT>         * Returns {@link Complex#NaN} if either real or imaginary part of the<a name="line.503"></a>
+<FONT color="green">504</FONT>         * input argument is &lt;code&gt;NaN&lt;/code&gt; or infinite.&lt;/p&gt;<a name="line.504"></a>
+<FONT color="green">505</FONT>         *<a name="line.505"></a>
+<FONT color="green">506</FONT>         * @return the inverse tangent of this complex number<a name="line.506"></a>
+<FONT color="green">507</FONT>         * @since 1.2<a name="line.507"></a>
+<FONT color="green">508</FONT>         */<a name="line.508"></a>
+<FONT color="green">509</FONT>        public Complex atan() {<a name="line.509"></a>
+<FONT color="green">510</FONT>            if (isNaN()) {<a name="line.510"></a>
+<FONT color="green">511</FONT>                return Complex.NaN;<a name="line.511"></a>
+<FONT color="green">512</FONT>            }<a name="line.512"></a>
+<FONT color="green">513</FONT>    <a name="line.513"></a>
+<FONT color="green">514</FONT>            return this.add(Complex.I).divide(Complex.I.subtract(this)).log()<a name="line.514"></a>
+<FONT color="green">515</FONT>                .multiply(Complex.I.divide(createComplex(2.0, 0.0)));<a name="line.515"></a>
+<FONT color="green">516</FONT>        }<a name="line.516"></a>
+<FONT color="green">517</FONT>    <a name="line.517"></a>
+<FONT color="green">518</FONT>        /**<a name="line.518"></a>
+<FONT color="green">519</FONT>         * Compute the<a name="line.519"></a>
+<FONT color="green">520</FONT>         * &lt;a href="http://mathworld.wolfram.com/Cosine.html" TARGET="_top"&gt;<a name="line.520"></a>
+<FONT color="green">521</FONT>         * cosine&lt;/a&gt;<a name="line.521"></a>
+<FONT color="green">522</FONT>         * of this complex number.<a name="line.522"></a>
+<FONT color="green">523</FONT>         * &lt;p&gt;<a name="line.523"></a>
+<FONT color="green">524</FONT>         * Implements the formula: &lt;pre&gt;<a name="line.524"></a>
+<FONT color="green">525</FONT>         * &lt;code&gt; cos(a + bi) = cos(a)cosh(b) - sin(a)sinh(b)i&lt;/code&gt;&lt;/pre&gt;<a name="line.525"></a>
+<FONT color="green">526</FONT>         * where the (real) functions on the right-hand side are<a name="line.526"></a>
+<FONT color="green">527</FONT>         * {@link java.lang.Math#sin}, {@link java.lang.Math#cos},<a name="line.527"></a>
+<FONT color="green">528</FONT>         * {@link MathUtils#cosh} and {@link MathUtils#sinh}.&lt;/p&gt;<a name="line.528"></a>
+<FONT color="green">529</FONT>         * &lt;p&gt;<a name="line.529"></a>
+<FONT color="green">530</FONT>         * Returns {@link Complex#NaN} if either real or imaginary part of the<a name="line.530"></a>
+<FONT color="green">531</FONT>         * input argument is &lt;code&gt;NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.531"></a>
+<FONT color="green">532</FONT>         * &lt;p&gt;<a name="line.532"></a>
+<FONT color="green">533</FONT>         * Infinite values in real or imaginary parts of the input may result in<a name="line.533"></a>
+<FONT color="green">534</FONT>         * infinite or NaN values returned in parts of the result.&lt;pre&gt;<a name="line.534"></a>
+<FONT color="green">535</FONT>         * Examples:<a name="line.535"></a>
+<FONT color="green">536</FONT>         * &lt;code&gt;<a name="line.536"></a>
+<FONT color="green">537</FONT>         * cos(1 &amp;plusmn; INFINITY i) = 1 &amp;#x2213; INFINITY i<a name="line.537"></a>
+<FONT color="green">538</FONT>         * cos(&amp;plusmn;INFINITY + i) = NaN + NaN i<a name="line.538"></a>
+<FONT color="green">539</FONT>         * cos(&amp;plusmn;INFINITY &amp;plusmn; INFINITY i) = NaN + NaN i&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;<a name="line.539"></a>
+<FONT color="green">540</FONT>         *<a name="line.540"></a>
+<FONT color="green">541</FONT>         * @return the cosine of this complex number<a name="line.541"></a>
+<FONT color="green">542</FONT>         * @since 1.2<a name="line.542"></a>
+<FONT color="green">543</FONT>         */<a name="line.543"></a>
+<FONT color="green">544</FONT>        public Complex cos() {<a name="line.544"></a>
+<FONT color="green">545</FONT>            if (isNaN()) {<a name="line.545"></a>
+<FONT color="green">546</FONT>                return Complex.NaN;<a name="line.546"></a>
+<FONT color="green">547</FONT>            }<a name="line.547"></a>
+<FONT color="green">548</FONT>    <a name="line.548"></a>
+<FONT color="green">549</FONT>            return createComplex(Math.cos(real) * MathUtils.cosh(imaginary),<a name="line.549"></a>
+<FONT color="green">550</FONT>                -Math.sin(real) * MathUtils.sinh(imaginary));<a name="line.550"></a>
+<FONT color="green">551</FONT>        }<a name="line.551"></a>
+<FONT color="green">552</FONT>    <a name="line.552"></a>
+<FONT color="green">553</FONT>        /**<a name="line.553"></a>
+<FONT color="green">554</FONT>         * Compute the<a name="line.554"></a>
+<FONT color="green">555</FONT>         * &lt;a href="http://mathworld.wolfram.com/HyperbolicCosine.html" TARGET="_top"&gt;<a name="line.555"></a>
+<FONT color="green">556</FONT>         * hyperbolic cosine&lt;/a&gt; of this complex number.<a name="line.556"></a>
+<FONT color="green">557</FONT>         * &lt;p&gt;<a name="line.557"></a>
+<FONT color="green">558</FONT>         * Implements the formula: &lt;pre&gt;<a name="line.558"></a>
+<FONT color="green">559</FONT>         * &lt;code&gt; cosh(a + bi) = cosh(a)cos(b) + sinh(a)sin(b)i&lt;/code&gt;&lt;/pre&gt;<a name="line.559"></a>
+<FONT color="green">560</FONT>         * where the (real) functions on the right-hand side are<a name="line.560"></a>
+<FONT color="green">561</FONT>         * {@link java.lang.Math#sin}, {@link java.lang.Math#cos},<a name="line.561"></a>
+<FONT color="green">562</FONT>         * {@link MathUtils#cosh} and {@link MathUtils#sinh}.&lt;/p&gt;<a name="line.562"></a>
+<FONT color="green">563</FONT>         * &lt;p&gt;<a name="line.563"></a>
+<FONT color="green">564</FONT>         * Returns {@link Complex#NaN} if either real or imaginary part of the<a name="line.564"></a>
+<FONT color="green">565</FONT>         * input argument is &lt;code&gt;NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.565"></a>
+<FONT color="green">566</FONT>         * &lt;p&gt;<a name="line.566"></a>
+<FONT color="green">567</FONT>         * Infinite values in real or imaginary parts of the input may result in<a name="line.567"></a>
+<FONT color="green">568</FONT>         * infinite or NaN values returned in parts of the result.&lt;pre&gt;<a name="line.568"></a>
+<FONT color="green">569</FONT>         * Examples:<a name="line.569"></a>
+<FONT color="green">570</FONT>         * &lt;code&gt;<a name="line.570"></a>
+<FONT color="green">571</FONT>         * cosh(1 &amp;plusmn; INFINITY i) = NaN + NaN i<a name="line.571"></a>
+<FONT color="green">572</FONT>         * cosh(&amp;plusmn;INFINITY + i) = INFINITY &amp;plusmn; INFINITY i<a name="line.572"></a>
+<FONT color="green">573</FONT>         * cosh(&amp;plusmn;INFINITY &amp;plusmn; INFINITY i) = NaN + NaN i&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;<a name="line.573"></a>
+<FONT color="green">574</FONT>         *<a name="line.574"></a>
+<FONT color="green">575</FONT>         * @return the hyperbolic cosine of this complex number.<a name="line.575"></a>
+<FONT color="green">576</FONT>         * @since 1.2<a name="line.576"></a>
+<FONT color="green">577</FONT>         */<a name="line.577"></a>
+<FONT color="green">578</FONT>        public Complex cosh() {<a name="line.578"></a>
+<FONT color="green">579</FONT>            if (isNaN()) {<a name="line.579"></a>
+<FONT color="green">580</FONT>                return Complex.NaN;<a name="line.580"></a>
+<FONT color="green">581</FONT>            }<a name="line.581"></a>
+<FONT color="green">582</FONT>    <a name="line.582"></a>
+<FONT color="green">583</FONT>            return createComplex(MathUtils.cosh(real) * Math.cos(imaginary),<a name="line.583"></a>
+<FONT color="green">584</FONT>                MathUtils.sinh(real) * Math.sin(imaginary));<a name="line.584"></a>
+<FONT color="green">585</FONT>        }<a name="line.585"></a>
+<FONT color="green">586</FONT>    <a name="line.586"></a>
+<FONT color="green">587</FONT>        /**<a name="line.587"></a>
+<FONT color="green">588</FONT>         * Compute the<a name="line.588"></a>
+<FONT color="green">589</FONT>         * &lt;a href="http://mathworld.wolfram.com/ExponentialFunction.html" TARGET="_top"&gt;<a name="line.589"></a>
+<FONT color="green">590</FONT>         * exponential function&lt;/a&gt; of this complex number.<a name="line.590"></a>
+<FONT color="green">591</FONT>         * &lt;p&gt;<a name="line.591"></a>
+<FONT color="green">592</FONT>         * Implements the formula: &lt;pre&gt;<a name="line.592"></a>
+<FONT color="green">593</FONT>         * &lt;code&gt; exp(a + bi) = exp(a)cos(b) + exp(a)sin(b)i&lt;/code&gt;&lt;/pre&gt;<a name="line.593"></a>
+<FONT color="green">594</FONT>         * where the (real) functions on the right-hand side are<a name="line.594"></a>
+<FONT color="green">595</FONT>         * {@link java.lang.Math#exp}, {@link java.lang.Math#cos}, and<a name="line.595"></a>
+<FONT color="green">596</FONT>         * {@link java.lang.Math#sin}.&lt;/p&gt;<a name="line.596"></a>
+<FONT color="green">597</FONT>         * &lt;p&gt;<a name="line.597"></a>
+<FONT color="green">598</FONT>         * Returns {@link Complex#NaN} if either real or imaginary part of the<a name="line.598"></a>
+<FONT color="green">599</FONT>         * input argument is &lt;code&gt;NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.599"></a>
+<FONT color="green">600</FONT>         * &lt;p&gt;<a name="line.600"></a>
+<FONT color="green">601</FONT>         * Infinite values in real or imaginary parts of the input may result in<a name="line.601"></a>
+<FONT color="green">602</FONT>         * infinite or NaN values returned in parts of the result.&lt;pre&gt;<a name="line.602"></a>
+<FONT color="green">603</FONT>         * Examples:<a name="line.603"></a>
+<FONT color="green">604</FONT>         * &lt;code&gt;<a name="line.604"></a>
+<FONT color="green">605</FONT>         * exp(1 &amp;plusmn; INFINITY i) = NaN + NaN i<a name="line.605"></a>
+<FONT color="green">606</FONT>         * exp(INFINITY + i) = INFINITY + INFINITY i<a name="line.606"></a>
+<FONT color="green">607</FONT>         * exp(-INFINITY + i) = 0 + 0i<a name="line.607"></a>
+<FONT color="green">608</FONT>         * exp(&amp;plusmn;INFINITY &amp;plusmn; INFINITY i) = NaN + NaN i&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;<a name="line.608"></a>
+<FONT color="green">609</FONT>         *<a name="line.609"></a>
+<FONT color="green">610</FONT>         * @return &lt;i&gt;e&lt;/i&gt;&lt;sup&gt;&lt;code&gt;this&lt;/code&gt;&lt;/sup&gt;<a name="line.610"></a>
+<FONT color="green">611</FONT>         * @since 1.2<a name="line.611"></a>
+<FONT color="green">612</FONT>         */<a name="line.612"></a>
+<FONT color="green">613</FONT>        public Complex exp() {<a name="line.613"></a>
+<FONT color="green">614</FONT>            if (isNaN()) {<a name="line.614"></a>
+<FONT color="green">615</FONT>                return Complex.NaN;<a name="line.615"></a>
+<FONT color="green">616</FONT>            }<a name="line.616"></a>
+<FONT color="green">617</FONT>    <a name="line.617"></a>
+<FONT color="green">618</FONT>            double expReal = Math.exp(real);<a name="line.618"></a>
+<FONT color="green">619</FONT>            return createComplex(expReal *  Math.cos(imaginary), expReal * Math.sin(imaginary));<a name="line.619"></a>
+<FONT color="green">620</FONT>        }<a name="line.620"></a>
+<FONT color="green">621</FONT>    <a name="line.621"></a>
+<FONT color="green">622</FONT>        /**<a name="line.622"></a>
+<FONT color="green">623</FONT>         * Compute the<a name="line.623"></a>
+<FONT color="green">624</FONT>         * &lt;a href="http://mathworld.wolfram.com/NaturalLogarithm.html" TARGET="_top"&gt;<a name="line.624"></a>
+<FONT color="green">625</FONT>         * natural logarithm&lt;/a&gt; of this complex number.<a name="line.625"></a>
+<FONT color="green">626</FONT>         * &lt;p&gt;<a name="line.626"></a>
+<FONT color="green">627</FONT>         * Implements the formula: &lt;pre&gt;<a name="line.627"></a>
+<FONT color="green">628</FONT>         * &lt;code&gt; log(a + bi) = ln(|a + bi|) + arg(a + bi)i&lt;/code&gt;&lt;/pre&gt;<a name="line.628"></a>
+<FONT color="green">629</FONT>         * where ln on the right hand side is {@link java.lang.Math#log},<a name="line.629"></a>
+<FONT color="green">630</FONT>         * &lt;code&gt;|a + bi|&lt;/code&gt; is the modulus, {@link Complex#abs},  and<a name="line.630"></a>
+<FONT color="green">631</FONT>         * &lt;code&gt;arg(a + bi) = {@link java.lang.Math#atan2}(b, a)&lt;/code&gt;&lt;/p&gt;<a name="line.631"></a>
+<FONT color="green">632</FONT>         * &lt;p&gt;<a name="line.632"></a>
+<FONT color="green">633</FONT>         * Returns {@link Complex#NaN} if either real or imaginary part of the<a name="line.633"></a>
+<FONT color="green">634</FONT>         * input argument is &lt;code&gt;NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.634"></a>
+<FONT color="green">635</FONT>         * &lt;p&gt;<a name="line.635"></a>
+<FONT color="green">636</FONT>         * Infinite (or critical) values in real or imaginary parts of the input may<a name="line.636"></a>
+<FONT color="green">637</FONT>         * result in infinite or NaN values returned in parts of the result.&lt;pre&gt;<a name="line.637"></a>
+<FONT color="green">638</FONT>         * Examples:<a name="line.638"></a>
+<FONT color="green">639</FONT>         * &lt;code&gt;<a name="line.639"></a>
+<FONT color="green">640</FONT>         * log(1 &amp;plusmn; INFINITY i) = INFINITY &amp;plusmn; (&amp;pi;/2)i<a name="line.640"></a>
+<FONT color="green">641</FONT>         * log(INFINITY + i) = INFINITY + 0i<a name="line.641"></a>
+<FONT color="green">642</FONT>         * log(-INFINITY + i) = INFINITY + &amp;pi;i<a name="line.642"></a>
+<FONT color="green">643</FONT>         * log(INFINITY &amp;plusmn; INFINITY i) = INFINITY &amp;plusmn; (&amp;pi;/4)i<a name="line.643"></a>
+<FONT color="green">644</FONT>         * log(-INFINITY &amp;plusmn; INFINITY i) = INFINITY &amp;plusmn; (3&amp;pi;/4)i<a name="line.644"></a>
+<FONT color="green">645</FONT>         * log(0 + 0i) = -INFINITY + 0i<a name="line.645"></a>
+<FONT color="green">646</FONT>         * &lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;<a name="line.646"></a>
+<FONT color="green">647</FONT>         *<a name="line.647"></a>
+<FONT color="green">648</FONT>         * @return ln of this complex number.<a name="line.648"></a>
+<FONT color="green">649</FONT>         * @since 1.2<a name="line.649"></a>
+<FONT color="green">650</FONT>         */<a name="line.650"></a>
+<FONT color="green">651</FONT>        public Complex log() {<a name="line.651"></a>
+<FONT color="green">652</FONT>            if (isNaN()) {<a name="line.652"></a>
+<FONT color="green">653</FONT>                return Complex.NaN;<a name="line.653"></a>
+<FONT color="green">654</FONT>            }<a name="line.654"></a>
+<FONT color="green">655</FONT>    <a name="line.655"></a>
+<FONT color="green">656</FONT>            return createComplex(Math.log(abs()),<a name="line.656"></a>
+<FONT color="green">657</FONT>                Math.atan2(imaginary, real));<a name="line.657"></a>
+<FONT color="green">658</FONT>        }<a name="line.658"></a>
+<FONT color="green">659</FONT>    <a name="line.659"></a>
+<FONT color="green">660</FONT>        /**<a name="line.660"></a>
+<FONT color="green">661</FONT>         * Returns of value of this complex number raised to the power of &lt;code&gt;x&lt;/code&gt;.<a name="line.661"></a>
+<FONT color="green">662</FONT>         * &lt;p&gt;<a name="line.662"></a>
+<FONT color="green">663</FONT>         * Implements the formula: &lt;pre&gt;<a name="line.663"></a>
+<FONT color="green">664</FONT>         * &lt;code&gt; y&lt;sup&gt;x&lt;/sup&gt; = exp(x&amp;middot;log(y))&lt;/code&gt;&lt;/pre&gt;<a name="line.664"></a>
+<FONT color="green">665</FONT>         * where &lt;code&gt;exp&lt;/code&gt; and &lt;code&gt;log&lt;/code&gt; are {@link #exp} and<a name="line.665"></a>
+<FONT color="green">666</FONT>         * {@link #log}, respectively.&lt;/p&gt;<a name="line.666"></a>
+<FONT color="green">667</FONT>         * &lt;p&gt;<a name="line.667"></a>
+<FONT color="green">668</FONT>         * Returns {@link Complex#NaN} if either real or imaginary part of the<a name="line.668"></a>
+<FONT color="green">669</FONT>         * input argument is &lt;code&gt;NaN&lt;/code&gt; or infinite, or if &lt;code&gt;y&lt;/code&gt;<a name="line.669"></a>
+<FONT color="green">670</FONT>         * equals {@link Complex#ZERO}.&lt;/p&gt;<a name="line.670"></a>
+<FONT color="green">671</FONT>         *<a name="line.671"></a>
+<FONT color="green">672</FONT>         * @param x the exponent.<a name="line.672"></a>
+<FONT color="green">673</FONT>         * @return &lt;code&gt;this&lt;/code&gt;&lt;sup&gt;&lt;code&gt;x&lt;/code&gt;&lt;/sup&gt;<a name="line.673"></a>
+<FONT color="green">674</FONT>         * @throws NullPointerException if x is null<a name="line.674"></a>
+<FONT color="green">675</FONT>         * @since 1.2<a name="line.675"></a>
+<FONT color="green">676</FONT>         */<a name="line.676"></a>
+<FONT color="green">677</FONT>        public Complex pow(Complex x) {<a name="line.677"></a>
+<FONT color="green">678</FONT>            if (x == null) {<a name="line.678"></a>
+<FONT color="green">679</FONT>                throw new NullPointerException();<a name="line.679"></a>
+<FONT color="green">680</FONT>            }<a name="line.680"></a>
+<FONT color="green">681</FONT>            return this.log().multiply(x).exp();<a name="line.681"></a>
+<FONT color="green">682</FONT>        }<a name="line.682"></a>
+<FONT color="green">683</FONT>    <a name="line.683"></a>
+<FONT color="green">684</FONT>        /**<a name="line.684"></a>
+<FONT color="green">685</FONT>         * Compute the<a name="line.685"></a>
+<FONT color="green">686</FONT>         * &lt;a href="http://mathworld.wolfram.com/Sine.html" TARGET="_top"&gt;<a name="line.686"></a>
+<FONT color="green">687</FONT>         * sine&lt;/a&gt;<a name="line.687"></a>
+<FONT color="green">688</FONT>         * of this complex number.<a name="line.688"></a>
+<FONT color="green">689</FONT>         * &lt;p&gt;<a name="line.689"></a>
+<FONT color="green">690</FONT>         * Implements the formula: &lt;pre&gt;<a name="line.690"></a>
+<FONT color="green">691</FONT>         * &lt;code&gt; sin(a + bi) = sin(a)cosh(b) - cos(a)sinh(b)i&lt;/code&gt;&lt;/pre&gt;<a name="line.691"></a>
+<FONT color="green">692</FONT>         * where the (real) functions on the right-hand side are<a name="line.692"></a>
+<FONT color="green">693</FONT>         * {@link java.lang.Math#sin}, {@link java.lang.Math#cos},<a name="line.693"></a>
+<FONT color="green">694</FONT>         * {@link MathUtils#cosh} and {@link MathUtils#sinh}.&lt;/p&gt;<a name="line.694"></a>
+<FONT color="green">695</FONT>         * &lt;p&gt;<a name="line.695"></a>
+<FONT color="green">696</FONT>         * Returns {@link Complex#NaN} if either real or imaginary part of the<a name="line.696"></a>
+<FONT color="green">697</FONT>         * input argument is &lt;code&gt;NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.697"></a>
+<FONT color="green">698</FONT>         * &lt;p&gt;<a name="line.698"></a>
+<FONT color="green">699</FONT>         * Infinite values in real or imaginary parts of the input may result in<a name="line.699"></a>
+<FONT color="green">700</FONT>         * infinite or NaN values returned in parts of the result.&lt;pre&gt;<a name="line.700"></a>
+<FONT color="green">701</FONT>         * Examples:<a name="line.701"></a>
+<FONT color="green">702</FONT>         * &lt;code&gt;<a name="line.702"></a>
+<FONT color="green">703</FONT>         * sin(1 &amp;plusmn; INFINITY i) = 1 &amp;plusmn; INFINITY i<a name="line.703"></a>
+<FONT color="green">704</FONT>         * sin(&amp;plusmn;INFINITY + i) = NaN + NaN i<a name="line.704"></a>
+<FONT color="green">705</FONT>         * sin(&amp;plusmn;INFINITY &amp;plusmn; INFINITY i) = NaN + NaN i&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;<a name="line.705"></a>
+<FONT color="green">706</FONT>         *<a name="line.706"></a>
+<FONT color="green">707</FONT>         * @return the sine of this complex number.<a name="line.707"></a>
+<FONT color="green">708</FONT>         * @since 1.2<a name="line.708"></a>
+<FONT color="green">709</FONT>         */<a name="line.709"></a>
+<FONT color="green">710</FONT>        public Complex sin() {<a name="line.710"></a>
+<FONT color="green">711</FONT>            if (isNaN()) {<a name="line.711"></a>
+<FONT color="green">712</FONT>                return Complex.NaN;<a name="line.712"></a>
+<FONT color="green">713</FONT>            }<a name="line.713"></a>
+<FONT color="green">714</FONT>    <a name="line.714"></a>
+<FONT color="green">715</FONT>            return createComplex(Math.sin(real) * MathUtils.cosh(imaginary),<a name="line.715"></a>
+<FONT color="green">716</FONT>                Math.cos(real) * MathUtils.sinh(imaginary));<a name="line.716"></a>
+<FONT color="green">717</FONT>        }<a name="line.717"></a>
+<FONT color="green">718</FONT>    <a name="line.718"></a>
+<FONT color="green">719</FONT>        /**<a name="line.719"></a>
+<FONT color="green">720</FONT>         * Compute the<a name="line.720"></a>
+<FONT color="green">721</FONT>         * &lt;a href="http://mathworld.wolfram.com/HyperbolicSine.html" TARGET="_top"&gt;<a name="line.721"></a>
+<FONT color="green">722</FONT>         * hyperbolic sine&lt;/a&gt; of this complex number.<a name="line.722"></a>
+<FONT color="green">723</FONT>         * &lt;p&gt;<a name="line.723"></a>
+<FONT color="green">724</FONT>         * Implements the formula: &lt;pre&gt;<a name="line.724"></a>
+<FONT color="green">725</FONT>         * &lt;code&gt; sinh(a + bi) = sinh(a)cos(b)) + cosh(a)sin(b)i&lt;/code&gt;&lt;/pre&gt;<a name="line.725"></a>
+<FONT color="green">726</FONT>         * where the (real) functions on the right-hand side are<a name="line.726"></a>
+<FONT color="green">727</FONT>         * {@link java.lang.Math#sin}, {@link java.lang.Math#cos},<a name="line.727"></a>
+<FONT color="green">728</FONT>         * {@link MathUtils#cosh} and {@link MathUtils#sinh}.&lt;/p&gt;<a name="line.728"></a>
+<FONT color="green">729</FONT>         * &lt;p&gt;<a name="line.729"></a>
+<FONT color="green">730</FONT>         * Returns {@link Complex#NaN} if either real or imaginary part of the<a name="line.730"></a>
+<FONT color="green">731</FONT>         * input argument is &lt;code&gt;NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.731"></a>
+<FONT color="green">732</FONT>         * &lt;p&gt;<a name="line.732"></a>
+<FONT color="green">733</FONT>         * Infinite values in real or imaginary parts of the input may result in<a name="line.733"></a>
+<FONT color="green">734</FONT>         * infinite or NaN values returned in parts of the result.&lt;pre&gt;<a name="line.734"></a>
+<FONT color="green">735</FONT>         * Examples:<a name="line.735"></a>
+<FONT color="green">736</FONT>         * &lt;code&gt;<a name="line.736"></a>
+<FONT color="green">737</FONT>         * sinh(1 &amp;plusmn; INFINITY i) = NaN + NaN i<a name="line.737"></a>
+<FONT color="green">738</FONT>         * sinh(&amp;plusmn;INFINITY + i) = &amp;plusmn; INFINITY + INFINITY i<a name="line.738"></a>
+<FONT color="green">739</FONT>         * sinh(&amp;plusmn;INFINITY &amp;plusmn; INFINITY i) = NaN + NaN i&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;<a name="line.739"></a>
+<FONT color="green">740</FONT>         *<a name="line.740"></a>
+<FONT color="green">741</FONT>         * @return the hyperbolic sine of this complex number<a name="line.741"></a>
+<FONT color="green">742</FONT>         * @since 1.2<a name="line.742"></a>
+<FONT color="green">743</FONT>         */<a name="line.743"></a>
+<FONT color="green">744</FONT>        public Complex sinh() {<a name="line.744"></a>
+<FONT color="green">745</FONT>            if (isNaN()) {<a name="line.745"></a>
+<FONT color="green">746</FONT>                return Complex.NaN;<a name="line.746"></a>
+<FONT color="green">747</FONT>            }<a name="line.747"></a>
+<FONT color="green">748</FONT>    <a name="line.748"></a>
+<FONT color="green">749</FONT>            return createComplex(MathUtils.sinh(real) * Math.cos(imaginary),<a name="line.749"></a>
+<FONT color="green">750</FONT>                MathUtils.cosh(real) * Math.sin(imaginary));<a name="line.750"></a>
+<FONT color="green">751</FONT>        }<a name="line.751"></a>
+<FONT color="green">752</FONT>    <a name="line.752"></a>
+<FONT color="green">753</FONT>        /**<a name="line.753"></a>
+<FONT color="green">754</FONT>         * Compute the<a name="line.754"></a>
+<FONT color="green">755</FONT>         * &lt;a href="http://mathworld.wolfram.com/SquareRoot.html" TARGET="_top"&gt;<a name="line.755"></a>
+<FONT color="green">756</FONT>         * square root&lt;/a&gt; of this complex number.<a name="line.756"></a>
+<FONT color="green">757</FONT>         * &lt;p&gt;<a name="line.757"></a>
+<FONT color="green">758</FONT>         * Implements the following algorithm to compute &lt;code&gt;sqrt(a + bi)&lt;/code&gt;:<a name="line.758"></a>
+<FONT color="green">759</FONT>         * &lt;ol&gt;&lt;li&gt;Let &lt;code&gt;t = sqrt((|a| + |a + bi|) / 2)&lt;/code&gt;&lt;/li&gt;<a name="line.759"></a>
+<FONT color="green">760</FONT>         * &lt;li&gt;&lt;pre&gt;if &lt;code&gt; a &amp;#8805; 0&lt;/code&gt; return &lt;code&gt;t + (b/2t)i&lt;/code&gt;<a name="line.760"></a>
+<FONT color="green">761</FONT>         *  else return &lt;code&gt;|b|/2t + sign(b)t i &lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;<a name="line.761"></a>
+<FONT color="green">762</FONT>         * &lt;/ol&gt;<a name="line.762"></a>
+<FONT color="green">763</FONT>         * where &lt;ul&gt;<a name="line.763"></a>
+<FONT color="green">764</FONT>         * &lt;li&gt;&lt;code&gt;|a| = {@link Math#abs}(a)&lt;/code&gt;&lt;/li&gt;<a name="line.764"></a>
+<FONT color="green">765</FONT>         * &lt;li&gt;&lt;code&gt;|a + bi| = {@link Complex#abs}(a + bi) &lt;/code&gt;&lt;/li&gt;<a name="line.765"></a>
+<FONT color="green">766</FONT>         * &lt;li&gt;&lt;code&gt;sign(b) =  {@link MathUtils#indicator}(b) &lt;/code&gt;<a name="line.766"></a>
+<FONT color="green">767</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.767"></a>
+<FONT color="green">768</FONT>         * &lt;p&gt;<a name="line.768"></a>
+<FONT color="green">769</FONT>         * Returns {@link Complex#NaN} if either real or imaginary part of the<a name="line.769"></a>
+<FONT color="green">770</FONT>         * input argument is &lt;code&gt;NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.770"></a>
+<FONT color="green">771</FONT>         * &lt;p&gt;<a name="line.771"></a>
+<FONT color="green">772</FONT>         * Infinite values in real or imaginary parts of the input may result in<a name="line.772"></a>
+<FONT color="green">773</FONT>         * infinite or NaN values returned in parts of the result.&lt;pre&gt;<a name="line.773"></a>
+<FONT color="green">774</FONT>         * Examples:<a name="line.774"></a>
+<FONT color="green">775</FONT>         * &lt;code&gt;<a name="line.775"></a>
+<FONT color="green">776</FONT>         * sqrt(1 &amp;plusmn; INFINITY i) = INFINITY + NaN i<a name="line.776"></a>
+<FONT color="green">777</FONT>         * sqrt(INFINITY + i) = INFINITY + 0i<a name="line.777"></a>
+<FONT color="green">778</FONT>         * sqrt(-INFINITY + i) = 0 + INFINITY i<a name="line.778"></a>
+<FONT color="green">779</FONT>         * sqrt(INFINITY &amp;plusmn; INFINITY i) = INFINITY + NaN i<a name="line.779"></a>
+<FONT color="green">780</FONT>         * sqrt(-INFINITY &amp;plusmn; INFINITY i) = NaN &amp;plusmn; INFINITY i<a name="line.780"></a>
+<FONT color="green">781</FONT>         * &lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;<a name="line.781"></a>
+<FONT color="green">782</FONT>         *<a name="line.782"></a>
+<FONT color="green">783</FONT>         * @return the square root of this complex number<a name="line.783"></a>
+<FONT color="green">784</FONT>         * @since 1.2<a name="line.784"></a>
+<FONT color="green">785</FONT>         */<a name="line.785"></a>
+<FONT color="green">786</FONT>        public Complex sqrt() {<a name="line.786"></a>
+<FONT color="green">787</FONT>            if (isNaN()) {<a name="line.787"></a>
+<FONT color="green">788</FONT>                return Complex.NaN;<a name="line.788"></a>
+<FONT color="green">789</FONT>            }<a name="line.789"></a>
+<FONT color="green">790</FONT>    <a name="line.790"></a>
+<FONT color="green">791</FONT>            if (real == 0.0 &amp;&amp; imaginary == 0.0) {<a name="line.791"></a>
+<FONT color="green">792</FONT>                return createComplex(0.0, 0.0);<a name="line.792"></a>
+<FONT color="green">793</FONT>            }<a name="line.793"></a>
+<FONT color="green">794</FONT>    <a name="line.794"></a>
+<FONT color="green">795</FONT>            double t = Math.sqrt((Math.abs(real) + abs()) / 2.0);<a name="line.795"></a>
+<FONT color="green">796</FONT>            if (real &gt;= 0.0) {<a name="line.796"></a>
+<FONT color="green">797</FONT>                return createComplex(t, imaginary / (2.0 * t));<a name="line.797"></a>
+<FONT color="green">798</FONT>            } else {<a name="line.798"></a>
+<FONT color="green">799</FONT>                return createComplex(Math.abs(imaginary) / (2.0 * t),<a name="line.799"></a>
+<FONT color="green">800</FONT>                    MathUtils.indicator(imaginary) * t);<a name="line.800"></a>
+<FONT color="green">801</FONT>            }<a name="line.801"></a>
+<FONT color="green">802</FONT>        }<a name="line.802"></a>
+<FONT color="green">803</FONT>    <a name="line.803"></a>
+<FONT color="green">804</FONT>        /**<a name="line.804"></a>
+<FONT color="green">805</FONT>         * Compute the<a name="line.805"></a>
+<FONT color="green">806</FONT>         * &lt;a href="http://mathworld.wolfram.com/SquareRoot.html" TARGET="_top"&gt;<a name="line.806"></a>
+<FONT color="green">807</FONT>         * square root&lt;/a&gt; of 1 - &lt;code&gt;this&lt;/code&gt;&lt;sup&gt;2&lt;/sup&gt; for this complex<a name="line.807"></a>
+<FONT color="green">808</FONT>         * number.<a name="line.808"></a>
+<FONT color="green">809</FONT>         * &lt;p&gt;<a name="line.809"></a>
+<FONT color="green">810</FONT>         * Computes the result directly as<a name="line.810"></a>
+<FONT color="green">811</FONT>         * &lt;code&gt;sqrt(Complex.ONE.subtract(z.multiply(z)))&lt;/code&gt;.&lt;/p&gt;<a name="line.811"></a>
+<FONT color="green">812</FONT>         * &lt;p&gt;<a name="line.812"></a>
+<FONT color="green">813</FONT>         * Returns {@link Complex#NaN} if either real or imaginary part of the<a name="line.813"></a>
+<FONT color="green">814</FONT>         * input argument is &lt;code&gt;NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.814"></a>
+<FONT color="green">815</FONT>         * &lt;p&gt;<a name="line.815"></a>
+<FONT color="green">816</FONT>         * Infinite values in real or imaginary parts of the input may result in<a name="line.816"></a>
+<FONT color="green">817</FONT>         * infinite or NaN values returned in parts of the result.&lt;/p&gt;<a name="line.817"></a>
+<FONT color="green">818</FONT>         *<a name="line.818"></a>
+<FONT color="green">819</FONT>         * @return the square root of 1 - &lt;code&gt;this&lt;/code&gt;&lt;sup&gt;2&lt;/sup&gt;<a name="line.819"></a>
+<FONT color="green">820</FONT>         * @since 1.2<a name="line.820"></a>
+<FONT color="green">821</FONT>         */<a name="line.821"></a>
+<FONT color="green">822</FONT>        public Complex sqrt1z() {<a name="line.822"></a>
+<FONT color="green">823</FONT>            return createComplex(1.0, 0.0).subtract(this.multiply(this)).sqrt();<a name="line.823"></a>
+<FONT color="green">824</FONT>        }<a name="line.824"></a>
+<FONT color="green">825</FONT>    <a name="line.825"></a>
+<FONT color="green">826</FONT>        /**<a name="line.826"></a>
+<FONT color="green">827</FONT>         * Compute the<a name="line.827"></a>
+<FONT color="green">828</FONT>         * &lt;a href="http://mathworld.wolfram.com/Tangent.html" TARGET="_top"&gt;<a name="line.828"></a>
+<FONT color="green">829</FONT>         * tangent&lt;/a&gt; of this complex number.<a name="line.829"></a>
+<FONT color="green">830</FONT>         * &lt;p&gt;<a name="line.830"></a>
+<FONT color="green">831</FONT>         * Implements the formula: &lt;pre&gt;<a name="line.831"></a>
+<FONT color="green">832</FONT>         * &lt;code&gt;tan(a + bi) = sin(2a)/(cos(2a)+cosh(2b)) + [sinh(2b)/(cos(2a)+cosh(2b))]i&lt;/code&gt;&lt;/pre&gt;<a name="line.832"></a>
+<FONT color="green">833</FONT>         * where the (real) functions on the right-hand side are<a name="line.833"></a>
+<FONT color="green">834</FONT>         * {@link java.lang.Math#sin}, {@link java.lang.Math#cos},<a name="line.834"></a>
+<FONT color="green">835</FONT>         * {@link MathUtils#cosh} and {@link MathUtils#sinh}.&lt;/p&gt;<a name="line.835"></a>
+<FONT color="green">836</FONT>         * &lt;p&gt;<a name="line.836"></a>
+<FONT color="green">837</FONT>         * Returns {@link Complex#NaN} if either real or imaginary part of the<a name="line.837"></a>
+<FONT color="green">838</FONT>         * input argument is &lt;code&gt;NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.838"></a>
+<FONT color="green">839</FONT>         * &lt;p&gt;<a name="line.839"></a>
+<FONT color="green">840</FONT>         * Infinite (or critical) values in real or imaginary parts of the input may<a name="line.840"></a>
+<FONT color="green">841</FONT>         * result in infinite or NaN values returned in parts of the result.&lt;pre&gt;<a name="line.841"></a>
+<FONT color="green">842</FONT>         * Examples:<a name="line.842"></a>
+<FONT color="green">843</FONT>         * &lt;code&gt;<a name="line.843"></a>
+<FONT color="green">844</FONT>         * tan(1 &amp;plusmn; INFINITY i) = 0 + NaN i<a name="line.844"></a>
+<FONT color="green">845</FONT>         * tan(&amp;plusmn;INFINITY + i) = NaN + NaN i<a name="line.845"></a>
+<FONT color="green">846</FONT>         * tan(&amp;plusmn;INFINITY &amp;plusmn; INFINITY i) = NaN + NaN i<a name="line.846"></a>
+<FONT color="green">847</FONT>         * tan(&amp;plusmn;&amp;pi;/2 + 0 i) = &amp;plusmn;INFINITY + NaN i&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;<a name="line.847"></a>
+<FONT color="green">848</FONT>         *<a name="line.848"></a>
+<FONT color="green">849</FONT>         * @return the tangent of this complex number<a name="line.849"></a>
+<FONT color="green">850</FONT>         * @since 1.2<a name="line.850"></a>
+<FONT color="green">851</FONT>         */<a name="line.851"></a>
+<FONT color="green">852</FONT>        public Complex tan() {<a name="line.852"></a>
+<FONT color="green">853</FONT>            if (isNaN()) {<a name="line.853"></a>
+<FONT color="green">854</FONT>                return Complex.NaN;<a name="line.854"></a>
+<FONT color="green">855</FONT>            }<a name="line.855"></a>
+<FONT color="green">856</FONT>    <a name="line.856"></a>
+<FONT color="green">857</FONT>            double real2 = 2.0 * real;<a name="line.857"></a>
+<FONT color="green">858</FONT>            double imaginary2 = 2.0 * imaginary;<a name="line.858"></a>
+<FONT color="green">859</FONT>            double d = Math.cos(real2) + MathUtils.cosh(imaginary2);<a name="line.859"></a>
+<FONT color="green">860</FONT>    <a name="line.860"></a>
+<FONT color="green">861</FONT>            return createComplex(Math.sin(real2) / d, MathUtils.sinh(imaginary2) / d);<a name="line.861"></a>
+<FONT color="green">862</FONT>        }<a name="line.862"></a>
+<FONT color="green">863</FONT>    <a name="line.863"></a>
+<FONT color="green">864</FONT>        /**<a name="line.864"></a>
+<FONT color="green">865</FONT>         * Compute the<a name="line.865"></a>
+<FONT color="green">866</FONT>         * &lt;a href="http://mathworld.wolfram.com/HyperbolicTangent.html" TARGET="_top"&gt;<a name="line.866"></a>
+<FONT color="green">867</FONT>         * hyperbolic tangent&lt;/a&gt; of this complex number.<a name="line.867"></a>
+<FONT color="green">868</FONT>         * &lt;p&gt;<a name="line.868"></a>
+<FONT color="green">869</FONT>         * Implements the formula: &lt;pre&gt;<a name="line.869"></a>
+<FONT color="green">870</FONT>         * &lt;code&gt;tan(a + bi) = sinh(2a)/(cosh(2a)+cos(2b)) + [sin(2b)/(cosh(2a)+cos(2b))]i&lt;/code&gt;&lt;/pre&gt;<a name="line.870"></a>
+<FONT color="green">871</FONT>         * where the (real) functions on the right-hand side are<a name="line.871"></a>
+<FONT color="green">872</FONT>         * {@link java.lang.Math#sin}, {@link java.lang.Math#cos},<a name="line.872"></a>
+<FONT color="green">873</FONT>         * {@link MathUtils#cosh} and {@link MathUtils#sinh}.&lt;/p&gt;<a name="line.873"></a>
+<FONT color="green">874</FONT>         * &lt;p&gt;<a name="line.874"></a>
+<FONT color="green">875</FONT>         * Returns {@link Complex#NaN} if either real or imaginary part of the<a name="line.875"></a>
+<FONT color="green">876</FONT>         * input argument is &lt;code&gt;NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.876"></a>
+<FONT color="green">877</FONT>         * &lt;p&gt;<a name="line.877"></a>
+<FONT color="green">878</FONT>         * Infinite values in real or imaginary parts of the input may result in<a name="line.878"></a>
+<FONT color="green">879</FONT>         * infinite or NaN values returned in parts of the result.&lt;pre&gt;<a name="line.879"></a>
+<FONT color="green">880</FONT>         * Examples:<a name="line.880"></a>
+<FONT color="green">881</FONT>         * &lt;code&gt;<a name="line.881"></a>
+<FONT color="green">882</FONT>         * tanh(1 &amp;plusmn; INFINITY i) = NaN + NaN i<a name="line.882"></a>
+<FONT color="green">883</FONT>         * tanh(&amp;plusmn;INFINITY + i) = NaN + 0 i<a name="line.883"></a>
+<FONT color="green">884</FONT>         * tanh(&amp;plusmn;INFINITY &amp;plusmn; INFINITY i) = NaN + NaN i<a name="line.884"></a>
+<FONT color="green">885</FONT>         * tanh(0 + (&amp;pi;/2)i) = NaN + INFINITY i&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;<a name="line.885"></a>
+<FONT color="green">886</FONT>         *<a name="line.886"></a>
+<FONT color="green">887</FONT>         * @return the hyperbolic tangent of this complex number<a name="line.887"></a>
+<FONT color="green">888</FONT>         * @since 1.2<a name="line.888"></a>
+<FONT color="green">889</FONT>         */<a name="line.889"></a>
+<FONT color="green">890</FONT>        public Complex tanh() {<a name="line.890"></a>
+<FONT color="green">891</FONT>            if (isNaN()) {<a name="line.891"></a>
+<FONT color="green">892</FONT>                return Complex.NaN;<a name="line.892"></a>
+<FONT color="green">893</FONT>            }<a name="line.893"></a>
+<FONT color="green">894</FONT>    <a name="line.894"></a>
+<FONT color="green">895</FONT>            double real2 = 2.0 * real;<a name="line.895"></a>
+<FONT color="green">896</FONT>            double imaginary2 = 2.0 * imaginary;<a name="line.896"></a>
+<FONT color="green">897</FONT>            double d = MathUtils.cosh(real2) + Math.cos(imaginary2);<a name="line.897"></a>
+<FONT color="green">898</FONT>    <a name="line.898"></a>
+<FONT color="green">899</FONT>            return createComplex(MathUtils.sinh(real2) / d, Math.sin(imaginary2) / d);<a name="line.899"></a>
+<FONT color="green">900</FONT>        }<a name="line.900"></a>
+<FONT color="green">901</FONT>    <a name="line.901"></a>
+<FONT color="green">902</FONT>    <a name="line.902"></a>
+<FONT color="green">903</FONT>    <a name="line.903"></a>
+<FONT color="green">904</FONT>        /**<a name="line.904"></a>
+<FONT color="green">905</FONT>         * &lt;p&gt;Compute the argument of this complex number.<a name="line.905"></a>
+<FONT color="green">906</FONT>         * &lt;/p&gt;<a name="line.906"></a>
+<FONT color="green">907</FONT>         * &lt;p&gt;The argument is the angle phi between the positive real axis and the point<a name="line.907"></a>
+<FONT color="green">908</FONT>         * representing this number in the complex plane. The value returned is between -PI (not inclusive)<a name="line.908"></a>
+<FONT color="green">909</FONT>         * and PI (inclusive), with negative values returned for numbers with negative imaginary parts.<a name="line.909"></a>
+<FONT color="green">910</FONT>         * &lt;/p&gt;<a name="line.910"></a>
+<FONT color="green">911</FONT>         * &lt;p&gt;If either real or imaginary part (or both) is NaN, NaN is returned.  Infinite parts are handled<a name="line.911"></a>
+<FONT color="green">912</FONT>         * as java.Math.atan2 handles them, essentially treating finite parts as zero in the presence of<a name="line.912"></a>
+<FONT color="green">913</FONT>         * an infinite coordinate and returning a multiple of pi/4 depending on the signs of the infinite<a name="line.913"></a>
+<FONT color="green">914</FONT>         * parts.  See the javadoc for java.Math.atan2 for full details.&lt;/p&gt;<a name="line.914"></a>
+<FONT color="green">915</FONT>         *<a name="line.915"></a>
+<FONT color="green">916</FONT>         * @return the argument of this complex number<a name="line.916"></a>
+<FONT color="green">917</FONT>         */<a name="line.917"></a>
+<FONT color="green">918</FONT>        public double getArgument() {<a name="line.918"></a>
+<FONT color="green">919</FONT>            return Math.atan2(getImaginary(), getReal());<a name="line.919"></a>
+<FONT color="green">920</FONT>        }<a name="line.920"></a>
+<FONT color="green">921</FONT>    <a name="line.921"></a>
+<FONT color="green">922</FONT>        /**<a name="line.922"></a>
+<FONT color="green">923</FONT>         * &lt;p&gt;Computes the n-th roots of this complex number.<a name="line.923"></a>
+<FONT color="green">924</FONT>         * &lt;/p&gt;<a name="line.924"></a>
+<FONT color="green">925</FONT>         * &lt;p&gt;The nth roots are defined by the formula: &lt;pre&gt;<a name="line.925"></a>
+<FONT color="green">926</FONT>         * &lt;code&gt; z&lt;sub&gt;k&lt;/sub&gt; = abs&lt;sup&gt; 1/n&lt;/sup&gt; (cos(phi + 2&amp;pi;k/n) + i (sin(phi + 2&amp;pi;k/n))&lt;/code&gt;&lt;/pre&gt;<a name="line.926"></a>
+<FONT color="green">927</FONT>         * for &lt;i&gt;&lt;code&gt;k=0, 1, ..., n-1&lt;/code&gt;&lt;/i&gt;, where &lt;code&gt;abs&lt;/code&gt; and &lt;code&gt;phi&lt;/code&gt; are<a name="line.927"></a>
+<FONT color="green">928</FONT>         * respectively the {@link #abs() modulus} and {@link #getArgument() argument} of this complex number.<a name="line.928"></a>
+<FONT color="green">929</FONT>         * &lt;/p&gt;<a name="line.929"></a>
+<FONT color="green">930</FONT>         * &lt;p&gt;If one or both parts of this complex number is NaN, a list with just one element,<a name="line.930"></a>
+<FONT color="green">931</FONT>         *  {@link #NaN} is returned.&lt;/p&gt;<a name="line.931"></a>
+<FONT color="green">932</FONT>         * &lt;p&gt;if neither part is NaN, but at least one part is infinite, the result is a one-element<a name="line.932"></a>
+<FONT color="green">933</FONT>         * list containing {@link #INF}.&lt;/p&gt;<a name="line.933"></a>
+<FONT color="green">934</FONT>         *<a name="line.934"></a>
+<FONT color="green">935</FONT>         * @param n degree of root<a name="line.935"></a>
+<FONT color="green">936</FONT>         * @return List&lt;Complex&gt; all nth roots of this complex number<a name="line.936"></a>
+<FONT color="green">937</FONT>         * @throws IllegalArgumentException if parameter n is less than or equal to 0<a name="line.937"></a>
+<FONT color="green">938</FONT>         * @since 2.0<a name="line.938"></a>
+<FONT color="green">939</FONT>         */<a name="line.939"></a>
+<FONT color="green">940</FONT>        public List&lt;Complex&gt; nthRoot(int n) throws IllegalArgumentException {<a name="line.940"></a>
+<FONT color="green">941</FONT>    <a name="line.941"></a>
+<FONT color="green">942</FONT>            if (n &lt;= 0) {<a name="line.942"></a>
+<FONT color="green">943</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.943"></a>
+<FONT color="green">944</FONT>                        "cannot compute nth root for null or negative n: {0}",<a name="line.944"></a>
+<FONT color="green">945</FONT>                        n);<a name="line.945"></a>
+<FONT color="green">946</FONT>            }<a name="line.946"></a>
+<FONT color="green">947</FONT>    <a name="line.947"></a>
+<FONT color="green">948</FONT>            List&lt;Complex&gt; result = new ArrayList&lt;Complex&gt;();<a name="line.948"></a>
+<FONT color="green">949</FONT>    <a name="line.949"></a>
+<FONT color="green">950</FONT>            if (isNaN()) {<a name="line.950"></a>
+<FONT color="green">951</FONT>                result.add(Complex.NaN);<a name="line.951"></a>
+<FONT color="green">952</FONT>                return result;<a name="line.952"></a>
+<FONT color="green">953</FONT>            }<a name="line.953"></a>
+<FONT color="green">954</FONT>    <a name="line.954"></a>
+<FONT color="green">955</FONT>            if (isInfinite()) {<a name="line.955"></a>
+<FONT color="green">956</FONT>                result.add(Complex.INF);<a name="line.956"></a>
+<FONT color="green">957</FONT>                return result;<a name="line.957"></a>
+<FONT color="green">958</FONT>            }<a name="line.958"></a>
+<FONT color="green">959</FONT>    <a name="line.959"></a>
+<FONT color="green">960</FONT>            // nth root of abs -- faster / more accurate to use a solver here?<a name="line.960"></a>
+<FONT color="green">961</FONT>            final double nthRootOfAbs = Math.pow(abs(), 1.0 / n);<a name="line.961"></a>
+<FONT color="green">962</FONT>    <a name="line.962"></a>
+<FONT color="green">963</FONT>            // Compute nth roots of complex number with k = 0, 1, ... n-1<a name="line.963"></a>
+<FONT color="green">964</FONT>            final double nthPhi = getArgument()/n;<a name="line.964"></a>
+<FONT color="green">965</FONT>            final double slice = 2 * Math.PI / n;<a name="line.965"></a>
+<FONT color="green">966</FONT>            double innerPart = nthPhi;<a name="line.966"></a>
+<FONT color="green">967</FONT>            for (int k = 0; k &lt; n ; k++) {<a name="line.967"></a>
+<FONT color="green">968</FONT>                // inner part<a name="line.968"></a>
+<FONT color="green">969</FONT>                final double realPart      = nthRootOfAbs *  Math.cos(innerPart);<a name="line.969"></a>
+<FONT color="green">970</FONT>                final double imaginaryPart = nthRootOfAbs *  Math.sin(innerPart);<a name="line.970"></a>
+<FONT color="green">971</FONT>                result.add(createComplex(realPart, imaginaryPart));<a name="line.971"></a>
+<FONT color="green">972</FONT>                innerPart += slice;<a name="line.972"></a>
+<FONT color="green">973</FONT>            }<a name="line.973"></a>
+<FONT color="green">974</FONT>    <a name="line.974"></a>
+<FONT color="green">975</FONT>            return result;<a name="line.975"></a>
+<FONT color="green">976</FONT>        }<a name="line.976"></a>
+<FONT color="green">977</FONT>    <a name="line.977"></a>
+<FONT color="green">978</FONT>        /**<a name="line.978"></a>
+<FONT color="green">979</FONT>         * Create a complex number given the real and imaginary parts.<a name="line.979"></a>
+<FONT color="green">980</FONT>         *<a name="line.980"></a>
+<FONT color="green">981</FONT>         * @param realPart the real part<a name="line.981"></a>
+<FONT color="green">982</FONT>         * @param imaginaryPart the imaginary part<a name="line.982"></a>
+<FONT color="green">983</FONT>         * @return a new complex number instance<a name="line.983"></a>
+<FONT color="green">984</FONT>         * @since 1.2<a name="line.984"></a>
+<FONT color="green">985</FONT>         */<a name="line.985"></a>
+<FONT color="green">986</FONT>        protected Complex createComplex(double realPart, double imaginaryPart) {<a name="line.986"></a>
+<FONT color="green">987</FONT>            return new Complex(realPart, imaginaryPart);<a name="line.987"></a>
+<FONT color="green">988</FONT>        }<a name="line.988"></a>
+<FONT color="green">989</FONT>    <a name="line.989"></a>
+<FONT color="green">990</FONT>        /**<a name="line.990"></a>
+<FONT color="green">991</FONT>         * &lt;p&gt;Resolve the transient fields in a deserialized Complex Object.&lt;/p&gt;<a name="line.991"></a>
+<FONT color="green">992</FONT>         * &lt;p&gt;Subclasses will need to override {@link #createComplex} to deserialize properly&lt;/p&gt;<a name="line.992"></a>
+<FONT color="green">993</FONT>         * @return A Complex instance with all fields resolved.<a name="line.993"></a>
+<FONT color="green">994</FONT>         * @since 2.0<a name="line.994"></a>
+<FONT color="green">995</FONT>         */<a name="line.995"></a>
+<FONT color="green">996</FONT>        protected final Object readResolve() {<a name="line.996"></a>
+<FONT color="green">997</FONT>            return createComplex(real, imaginary);<a name="line.997"></a>
+<FONT color="green">998</FONT>        }<a name="line.998"></a>
+<FONT color="green">999</FONT>    <a name="line.999"></a>
+<FONT color="green">1000</FONT>        /** {@inheritDoc} */<a name="line.1000"></a>
+<FONT color="green">1001</FONT>        public ComplexField getField() {<a name="line.1001"></a>
+<FONT color="green">1002</FONT>            return ComplexField.getInstance();<a name="line.1002"></a>
+<FONT color="green">1003</FONT>        }<a name="line.1003"></a>
+<FONT color="green">1004</FONT>    <a name="line.1004"></a>
+<FONT color="green">1005</FONT>    }<a name="line.1005"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/complex/ComplexField.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,144 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.complex;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.Field;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Representation of the complex numbers field.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * This class is a singleton.<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @see Complex<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 2.0<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public class ComplexField implements Field&lt;Complex&gt;, Serializable  {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Serializable version identifier. */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private static final long serialVersionUID = -6130362688700788798L;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Private constructor for the singleton.<a name="line.38"></a>
+<FONT color="green">039</FONT>         */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private ComplexField() {<a name="line.40"></a>
+<FONT color="green">041</FONT>        }<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** Get the unique instance.<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @return the unique instance<a name="line.44"></a>
+<FONT color="green">045</FONT>         */<a name="line.45"></a>
+<FONT color="green">046</FONT>        public static ComplexField getInstance() {<a name="line.46"></a>
+<FONT color="green">047</FONT>            return LazyHolder.INSTANCE;<a name="line.47"></a>
+<FONT color="green">048</FONT>        }<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** {@inheritDoc} */<a name="line.50"></a>
+<FONT color="green">051</FONT>        public Complex getOne() {<a name="line.51"></a>
+<FONT color="green">052</FONT>            return Complex.ONE;<a name="line.52"></a>
+<FONT color="green">053</FONT>        }<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** {@inheritDoc} */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public Complex getZero() {<a name="line.56"></a>
+<FONT color="green">057</FONT>            return Complex.ZERO;<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        // CHECKSTYLE: stop HideUtilityClassConstructor<a name="line.60"></a>
+<FONT color="green">061</FONT>        /** Holder for the instance.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * &lt;p&gt;We use here the Initialization On Demand Holder Idiom.&lt;/p&gt;<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        private static class LazyHolder {<a name="line.64"></a>
+<FONT color="green">065</FONT>            /** Cached field instance. */<a name="line.65"></a>
+<FONT color="green">066</FONT>            private static final ComplexField INSTANCE = new ComplexField();<a name="line.66"></a>
+<FONT color="green">067</FONT>        }<a name="line.67"></a>
+<FONT color="green">068</FONT>        // CHECKSTYLE: resume HideUtilityClassConstructor<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /** Handle deserialization of the singleton.<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @return the singleton instance<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        private Object readResolve() {<a name="line.73"></a>
+<FONT color="green">074</FONT>            // return the singleton instance<a name="line.74"></a>
+<FONT color="green">075</FONT>            return LazyHolder.INSTANCE;<a name="line.75"></a>
+<FONT color="green">076</FONT>        }<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>    }<a name="line.78"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/complex/ComplexFormat.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,451 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.complex;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.text.FieldPosition;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.text.NumberFormat;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.text.ParseException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.text.ParsePosition;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import java.util.Locale;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.util.CompositeFormat;<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>    /**<a name="line.29"></a>
+<FONT color="green">030</FONT>     * Formats a Complex number in cartesian format "Re(c) + Im(c)i".  'i' can<a name="line.30"></a>
+<FONT color="green">031</FONT>     * be replaced with 'j' (or anything else), and the number format for both real<a name="line.31"></a>
+<FONT color="green">032</FONT>     * and imaginary parts can be configured.<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @version $Revision: 811783 $ $Date: 2009-09-06 04:56:58 -0400 (Sun, 06 Sep 2009) $<a name="line.34"></a>
+<FONT color="green">035</FONT>     */<a name="line.35"></a>
+<FONT color="green">036</FONT>    public class ComplexFormat extends CompositeFormat {<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Serializable version identifier */<a name="line.38"></a>
+<FONT color="green">039</FONT>        private static final long serialVersionUID = -3343698360149467646L;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>         /** The default imaginary character. */<a name="line.41"></a>
+<FONT color="green">042</FONT>        private static final String DEFAULT_IMAGINARY_CHARACTER = "i";<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** The notation used to signify the imaginary part of the complex number. */<a name="line.44"></a>
+<FONT color="green">045</FONT>        private String imaginaryCharacter;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** The format used for the imaginary part. */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private NumberFormat imaginaryFormat;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** The format used for the real part. */<a name="line.50"></a>
+<FONT color="green">051</FONT>        private NumberFormat realFormat;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Create an instance with the default imaginary character, 'i', and the<a name="line.54"></a>
+<FONT color="green">055</FONT>         * default number format for both real and imaginary parts.<a name="line.55"></a>
+<FONT color="green">056</FONT>         */<a name="line.56"></a>
+<FONT color="green">057</FONT>        public ComplexFormat() {<a name="line.57"></a>
+<FONT color="green">058</FONT>            this(DEFAULT_IMAGINARY_CHARACTER, getDefaultNumberFormat());<a name="line.58"></a>
+<FONT color="green">059</FONT>        }<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Create an instance with a custom number format for both real and<a name="line.62"></a>
+<FONT color="green">063</FONT>         * imaginary parts.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @param format the custom format for both real and imaginary parts.<a name="line.64"></a>
+<FONT color="green">065</FONT>         */<a name="line.65"></a>
+<FONT color="green">066</FONT>        public ComplexFormat(NumberFormat format) {<a name="line.66"></a>
+<FONT color="green">067</FONT>            this(DEFAULT_IMAGINARY_CHARACTER, format);<a name="line.67"></a>
+<FONT color="green">068</FONT>        }<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /**<a name="line.70"></a>
+<FONT color="green">071</FONT>         * Create an instance with a custom number format for the real part and a<a name="line.71"></a>
+<FONT color="green">072</FONT>         * custom number format for the imaginary part.<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @param realFormat the custom format for the real part.<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @param imaginaryFormat the custom format for the imaginary part.<a name="line.74"></a>
+<FONT color="green">075</FONT>         */<a name="line.75"></a>
+<FONT color="green">076</FONT>        public ComplexFormat(NumberFormat realFormat, NumberFormat imaginaryFormat) {<a name="line.76"></a>
+<FONT color="green">077</FONT>            this(DEFAULT_IMAGINARY_CHARACTER, realFormat, imaginaryFormat);<a name="line.77"></a>
+<FONT color="green">078</FONT>        }<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /**<a name="line.80"></a>
+<FONT color="green">081</FONT>         * Create an instance with a custom imaginary character, and the default<a name="line.81"></a>
+<FONT color="green">082</FONT>         * number format for both real and imaginary parts.<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param imaginaryCharacter The custom imaginary character.<a name="line.83"></a>
+<FONT color="green">084</FONT>         */<a name="line.84"></a>
+<FONT color="green">085</FONT>        public ComplexFormat(String imaginaryCharacter) {<a name="line.85"></a>
+<FONT color="green">086</FONT>            this(imaginaryCharacter, getDefaultNumberFormat());<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /**<a name="line.89"></a>
+<FONT color="green">090</FONT>         * Create an instance with a custom imaginary character, and a custom number<a name="line.90"></a>
+<FONT color="green">091</FONT>         * format for both real and imaginary parts.<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @param imaginaryCharacter The custom imaginary character.<a name="line.92"></a>
+<FONT color="green">093</FONT>         * @param format the custom format for both real and imaginary parts.<a name="line.93"></a>
+<FONT color="green">094</FONT>         */<a name="line.94"></a>
+<FONT color="green">095</FONT>        public ComplexFormat(String imaginaryCharacter, NumberFormat format) {<a name="line.95"></a>
+<FONT color="green">096</FONT>            this(imaginaryCharacter, format, (NumberFormat)format.clone());<a name="line.96"></a>
+<FONT color="green">097</FONT>        }<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>        /**<a name="line.99"></a>
+<FONT color="green">100</FONT>         * Create an instance with a custom imaginary character, a custom number<a name="line.100"></a>
+<FONT color="green">101</FONT>         * format for the real part, and a custom number format for the imaginary<a name="line.101"></a>
+<FONT color="green">102</FONT>         * part.<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @param imaginaryCharacter The custom imaginary character.<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @param realFormat the custom format for the real part.<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @param imaginaryFormat the custom format for the imaginary part.<a name="line.105"></a>
+<FONT color="green">106</FONT>         */<a name="line.106"></a>
+<FONT color="green">107</FONT>        public ComplexFormat(String imaginaryCharacter, NumberFormat realFormat,<a name="line.107"></a>
+<FONT color="green">108</FONT>                NumberFormat imaginaryFormat) {<a name="line.108"></a>
+<FONT color="green">109</FONT>            super();<a name="line.109"></a>
+<FONT color="green">110</FONT>            setImaginaryCharacter(imaginaryCharacter);<a name="line.110"></a>
+<FONT color="green">111</FONT>            setImaginaryFormat(imaginaryFormat);<a name="line.111"></a>
+<FONT color="green">112</FONT>            setRealFormat(realFormat);<a name="line.112"></a>
+<FONT color="green">113</FONT>        }<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>        /**<a name="line.115"></a>
+<FONT color="green">116</FONT>         * Get the set of locales for which complex formats are available.<a name="line.116"></a>
+<FONT color="green">117</FONT>         * &lt;p&gt;This is the same set as the {@link NumberFormat} set.&lt;/p&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @return available complex format locales.<a name="line.118"></a>
+<FONT color="green">119</FONT>         */<a name="line.119"></a>
+<FONT color="green">120</FONT>        public static Locale[] getAvailableLocales() {<a name="line.120"></a>
+<FONT color="green">121</FONT>            return NumberFormat.getAvailableLocales();<a name="line.121"></a>
+<FONT color="green">122</FONT>        }<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>        /**<a name="line.124"></a>
+<FONT color="green">125</FONT>         * This static method calls {@link #format(Object)} on a default instance of<a name="line.125"></a>
+<FONT color="green">126</FONT>         * ComplexFormat.<a name="line.126"></a>
+<FONT color="green">127</FONT>         *<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @param c Complex object to format<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @return A formatted number in the form "Re(c) + Im(c)i"<a name="line.129"></a>
+<FONT color="green">130</FONT>         */<a name="line.130"></a>
+<FONT color="green">131</FONT>        public static String formatComplex(Complex c) {<a name="line.131"></a>
+<FONT color="green">132</FONT>            return getInstance().format(c);<a name="line.132"></a>
+<FONT color="green">133</FONT>        }<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>        /**<a name="line.135"></a>
+<FONT color="green">136</FONT>         * Formats a {@link Complex} object to produce a string.<a name="line.136"></a>
+<FONT color="green">137</FONT>         *<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @param complex the object to format.<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @param toAppendTo where the text is to be appended<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @param pos On input: an alignment field, if desired. On output: the<a name="line.140"></a>
+<FONT color="green">141</FONT>         *            offsets of the alignment field<a name="line.141"></a>
+<FONT color="green">142</FONT>         * @return the value passed in as toAppendTo.<a name="line.142"></a>
+<FONT color="green">143</FONT>         */<a name="line.143"></a>
+<FONT color="green">144</FONT>        public StringBuffer format(Complex complex, StringBuffer toAppendTo,<a name="line.144"></a>
+<FONT color="green">145</FONT>                FieldPosition pos) {<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>            pos.setBeginIndex(0);<a name="line.147"></a>
+<FONT color="green">148</FONT>            pos.setEndIndex(0);<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>            // format real<a name="line.150"></a>
+<FONT color="green">151</FONT>            double re = complex.getReal();<a name="line.151"></a>
+<FONT color="green">152</FONT>            formatDouble(re, getRealFormat(), toAppendTo, pos);<a name="line.152"></a>
+<FONT color="green">153</FONT>    <a name="line.153"></a>
+<FONT color="green">154</FONT>            // format sign and imaginary<a name="line.154"></a>
+<FONT color="green">155</FONT>            double im = complex.getImaginary();<a name="line.155"></a>
+<FONT color="green">156</FONT>            if (im &lt; 0.0) {<a name="line.156"></a>
+<FONT color="green">157</FONT>                toAppendTo.append(" - ");<a name="line.157"></a>
+<FONT color="green">158</FONT>                formatDouble(-im, getImaginaryFormat(), toAppendTo, pos);<a name="line.158"></a>
+<FONT color="green">159</FONT>                toAppendTo.append(getImaginaryCharacter());<a name="line.159"></a>
+<FONT color="green">160</FONT>            } else if (im &gt; 0.0 || Double.isNaN(im)) {<a name="line.160"></a>
+<FONT color="green">161</FONT>                toAppendTo.append(" + ");<a name="line.161"></a>
+<FONT color="green">162</FONT>                formatDouble(im, getImaginaryFormat(), toAppendTo, pos);<a name="line.162"></a>
+<FONT color="green">163</FONT>                toAppendTo.append(getImaginaryCharacter());<a name="line.163"></a>
+<FONT color="green">164</FONT>            }<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>            return toAppendTo;<a name="line.166"></a>
+<FONT color="green">167</FONT>        }<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>        /**<a name="line.169"></a>
+<FONT color="green">170</FONT>         * Formats a object to produce a string.  &lt;code&gt;obj&lt;/code&gt; must be either a<a name="line.170"></a>
+<FONT color="green">171</FONT>         * {@link Complex} object or a {@link Number} object.  Any other type of<a name="line.171"></a>
+<FONT color="green">172</FONT>         * object will result in an {@link IllegalArgumentException} being thrown.<a name="line.172"></a>
+<FONT color="green">173</FONT>         *<a name="line.173"></a>
+<FONT color="green">174</FONT>         * @param obj the object to format.<a name="line.174"></a>
+<FONT color="green">175</FONT>         * @param toAppendTo where the text is to be appended<a name="line.175"></a>
+<FONT color="green">176</FONT>         * @param pos On input: an alignment field, if desired. On output: the<a name="line.176"></a>
+<FONT color="green">177</FONT>         *            offsets of the alignment field<a name="line.177"></a>
+<FONT color="green">178</FONT>         * @return the value passed in as toAppendTo.<a name="line.178"></a>
+<FONT color="green">179</FONT>         * @see java.text.Format#format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)<a name="line.179"></a>
+<FONT color="green">180</FONT>         * @throws IllegalArgumentException is &lt;code&gt;obj&lt;/code&gt; is not a valid type.<a name="line.180"></a>
+<FONT color="green">181</FONT>         */<a name="line.181"></a>
+<FONT color="green">182</FONT>        @Override<a name="line.182"></a>
+<FONT color="green">183</FONT>        public StringBuffer format(Object obj, StringBuffer toAppendTo,<a name="line.183"></a>
+<FONT color="green">184</FONT>                FieldPosition pos) {<a name="line.184"></a>
+<FONT color="green">185</FONT>    <a name="line.185"></a>
+<FONT color="green">186</FONT>            StringBuffer ret = null;<a name="line.186"></a>
+<FONT color="green">187</FONT>    <a name="line.187"></a>
+<FONT color="green">188</FONT>            if (obj instanceof Complex) {<a name="line.188"></a>
+<FONT color="green">189</FONT>                ret = format( (Complex)obj, toAppendTo, pos);<a name="line.189"></a>
+<FONT color="green">190</FONT>            } else if (obj instanceof Number) {<a name="line.190"></a>
+<FONT color="green">191</FONT>                ret = format( new Complex(((Number)obj).doubleValue(), 0.0),<a name="line.191"></a>
+<FONT color="green">192</FONT>                    toAppendTo, pos);<a name="line.192"></a>
+<FONT color="green">193</FONT>            } else {<a name="line.193"></a>
+<FONT color="green">194</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.194"></a>
+<FONT color="green">195</FONT>                      "cannot format a {0} instance as a complex number",<a name="line.195"></a>
+<FONT color="green">196</FONT>                      obj.getClass().getName());<a name="line.196"></a>
+<FONT color="green">197</FONT>            }<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>            return ret;<a name="line.199"></a>
+<FONT color="green">200</FONT>        }<a name="line.200"></a>
+<FONT color="green">201</FONT>    <a name="line.201"></a>
+<FONT color="green">202</FONT>        /**<a name="line.202"></a>
+<FONT color="green">203</FONT>         * Access the imaginaryCharacter.<a name="line.203"></a>
+<FONT color="green">204</FONT>         * @return the imaginaryCharacter.<a name="line.204"></a>
+<FONT color="green">205</FONT>         */<a name="line.205"></a>
+<FONT color="green">206</FONT>        public String getImaginaryCharacter() {<a name="line.206"></a>
+<FONT color="green">207</FONT>            return imaginaryCharacter;<a name="line.207"></a>
+<FONT color="green">208</FONT>        }<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>        /**<a name="line.210"></a>
+<FONT color="green">211</FONT>         * Access the imaginaryFormat.<a name="line.211"></a>
+<FONT color="green">212</FONT>         * @return the imaginaryFormat.<a name="line.212"></a>
+<FONT color="green">213</FONT>         */<a name="line.213"></a>
+<FONT color="green">214</FONT>        public NumberFormat getImaginaryFormat() {<a name="line.214"></a>
+<FONT color="green">215</FONT>            return imaginaryFormat;<a name="line.215"></a>
+<FONT color="green">216</FONT>        }<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>        /**<a name="line.218"></a>
+<FONT color="green">219</FONT>         * Returns the default complex format for the current locale.<a name="line.219"></a>
+<FONT color="green">220</FONT>         * @return the default complex format.<a name="line.220"></a>
+<FONT color="green">221</FONT>         */<a name="line.221"></a>
+<FONT color="green">222</FONT>        public static ComplexFormat getInstance() {<a name="line.222"></a>
+<FONT color="green">223</FONT>            return getInstance(Locale.getDefault());<a name="line.223"></a>
+<FONT color="green">224</FONT>        }<a name="line.224"></a>
+<FONT color="green">225</FONT>    <a name="line.225"></a>
+<FONT color="green">226</FONT>        /**<a name="line.226"></a>
+<FONT color="green">227</FONT>         * Returns the default complex format for the given locale.<a name="line.227"></a>
+<FONT color="green">228</FONT>         * @param locale the specific locale used by the format.<a name="line.228"></a>
+<FONT color="green">229</FONT>         * @return the complex format specific to the given locale.<a name="line.229"></a>
+<FONT color="green">230</FONT>         */<a name="line.230"></a>
+<FONT color="green">231</FONT>        public static ComplexFormat getInstance(Locale locale) {<a name="line.231"></a>
+<FONT color="green">232</FONT>            NumberFormat f = getDefaultNumberFormat(locale);<a name="line.232"></a>
+<FONT color="green">233</FONT>            return new ComplexFormat(f);<a name="line.233"></a>
+<FONT color="green">234</FONT>        }<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>        /**<a name="line.236"></a>
+<FONT color="green">237</FONT>         * Access the realFormat.<a name="line.237"></a>
+<FONT color="green">238</FONT>         * @return the realFormat.<a name="line.238"></a>
+<FONT color="green">239</FONT>         */<a name="line.239"></a>
+<FONT color="green">240</FONT>        public NumberFormat getRealFormat() {<a name="line.240"></a>
+<FONT color="green">241</FONT>            return realFormat;<a name="line.241"></a>
+<FONT color="green">242</FONT>        }<a name="line.242"></a>
+<FONT color="green">243</FONT>    <a name="line.243"></a>
+<FONT color="green">244</FONT>        /**<a name="line.244"></a>
+<FONT color="green">245</FONT>         * Parses a string to produce a {@link Complex} object.<a name="line.245"></a>
+<FONT color="green">246</FONT>         *<a name="line.246"></a>
+<FONT color="green">247</FONT>         * @param source the string to parse<a name="line.247"></a>
+<FONT color="green">248</FONT>         * @return the parsed {@link Complex} object.<a name="line.248"></a>
+<FONT color="green">249</FONT>         * @exception ParseException if the beginning of the specified string<a name="line.249"></a>
+<FONT color="green">250</FONT>         *            cannot be parsed.<a name="line.250"></a>
+<FONT color="green">251</FONT>         */<a name="line.251"></a>
+<FONT color="green">252</FONT>        public Complex parse(String source) throws ParseException {<a name="line.252"></a>
+<FONT color="green">253</FONT>            ParsePosition parsePosition = new ParsePosition(0);<a name="line.253"></a>
+<FONT color="green">254</FONT>            Complex result = parse(source, parsePosition);<a name="line.254"></a>
+<FONT color="green">255</FONT>            if (parsePosition.getIndex() == 0) {<a name="line.255"></a>
+<FONT color="green">256</FONT>                throw MathRuntimeException.createParseException(<a name="line.256"></a>
+<FONT color="green">257</FONT>                        parsePosition.getErrorIndex(),<a name="line.257"></a>
+<FONT color="green">258</FONT>                        "unparseable complex number: \"{0}\"", source);<a name="line.258"></a>
+<FONT color="green">259</FONT>            }<a name="line.259"></a>
+<FONT color="green">260</FONT>            return result;<a name="line.260"></a>
+<FONT color="green">261</FONT>        }<a name="line.261"></a>
+<FONT color="green">262</FONT>    <a name="line.262"></a>
+<FONT color="green">263</FONT>        /**<a name="line.263"></a>
+<FONT color="green">264</FONT>         * Parses a string to produce a {@link Complex} object.<a name="line.264"></a>
+<FONT color="green">265</FONT>         *<a name="line.265"></a>
+<FONT color="green">266</FONT>         * @param source the string to parse<a name="line.266"></a>
+<FONT color="green">267</FONT>         * @param pos input/ouput parsing parameter.<a name="line.267"></a>
+<FONT color="green">268</FONT>         * @return the parsed {@link Complex} object.<a name="line.268"></a>
+<FONT color="green">269</FONT>         */<a name="line.269"></a>
+<FONT color="green">270</FONT>        public Complex parse(String source, ParsePosition pos) {<a name="line.270"></a>
+<FONT color="green">271</FONT>            int initialIndex = pos.getIndex();<a name="line.271"></a>
+<FONT color="green">272</FONT>    <a name="line.272"></a>
+<FONT color="green">273</FONT>            // parse whitespace<a name="line.273"></a>
+<FONT color="green">274</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.274"></a>
+<FONT color="green">275</FONT>    <a name="line.275"></a>
+<FONT color="green">276</FONT>            // parse real<a name="line.276"></a>
+<FONT color="green">277</FONT>            Number re = parseNumber(source, getRealFormat(), pos);<a name="line.277"></a>
+<FONT color="green">278</FONT>            if (re == null) {<a name="line.278"></a>
+<FONT color="green">279</FONT>                // invalid real number<a name="line.279"></a>
+<FONT color="green">280</FONT>                // set index back to initial, error index should already be set<a name="line.280"></a>
+<FONT color="green">281</FONT>                pos.setIndex(initialIndex);<a name="line.281"></a>
+<FONT color="green">282</FONT>                return null;<a name="line.282"></a>
+<FONT color="green">283</FONT>            }<a name="line.283"></a>
+<FONT color="green">284</FONT>    <a name="line.284"></a>
+<FONT color="green">285</FONT>            // parse sign<a name="line.285"></a>
+<FONT color="green">286</FONT>            int startIndex = pos.getIndex();<a name="line.286"></a>
+<FONT color="green">287</FONT>            char c = parseNextCharacter(source, pos);<a name="line.287"></a>
+<FONT color="green">288</FONT>            int sign = 0;<a name="line.288"></a>
+<FONT color="green">289</FONT>            switch (c) {<a name="line.289"></a>
+<FONT color="green">290</FONT>            case 0 :<a name="line.290"></a>
+<FONT color="green">291</FONT>                // no sign<a name="line.291"></a>
+<FONT color="green">292</FONT>                // return real only complex number<a name="line.292"></a>
+<FONT color="green">293</FONT>                return new Complex(re.doubleValue(), 0.0);<a name="line.293"></a>
+<FONT color="green">294</FONT>            case '-' :<a name="line.294"></a>
+<FONT color="green">295</FONT>                sign = -1;<a name="line.295"></a>
+<FONT color="green">296</FONT>                break;<a name="line.296"></a>
+<FONT color="green">297</FONT>            case '+' :<a name="line.297"></a>
+<FONT color="green">298</FONT>                sign = 1;<a name="line.298"></a>
+<FONT color="green">299</FONT>                break;<a name="line.299"></a>
+<FONT color="green">300</FONT>            default :<a name="line.300"></a>
+<FONT color="green">301</FONT>                // invalid sign<a name="line.301"></a>
+<FONT color="green">302</FONT>                // set index back to initial, error index should be the last<a name="line.302"></a>
+<FONT color="green">303</FONT>                // character examined.<a name="line.303"></a>
+<FONT color="green">304</FONT>                pos.setIndex(initialIndex);<a name="line.304"></a>
+<FONT color="green">305</FONT>                pos.setErrorIndex(startIndex);<a name="line.305"></a>
+<FONT color="green">306</FONT>                return null;<a name="line.306"></a>
+<FONT color="green">307</FONT>            }<a name="line.307"></a>
+<FONT color="green">308</FONT>    <a name="line.308"></a>
+<FONT color="green">309</FONT>            // parse whitespace<a name="line.309"></a>
+<FONT color="green">310</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.310"></a>
+<FONT color="green">311</FONT>    <a name="line.311"></a>
+<FONT color="green">312</FONT>            // parse imaginary<a name="line.312"></a>
+<FONT color="green">313</FONT>            Number im = parseNumber(source, getRealFormat(), pos);<a name="line.313"></a>
+<FONT color="green">314</FONT>            if (im == null) {<a name="line.314"></a>
+<FONT color="green">315</FONT>                // invalid imaginary number<a name="line.315"></a>
+<FONT color="green">316</FONT>                // set index back to initial, error index should already be set<a name="line.316"></a>
+<FONT color="green">317</FONT>                pos.setIndex(initialIndex);<a name="line.317"></a>
+<FONT color="green">318</FONT>                return null;<a name="line.318"></a>
+<FONT color="green">319</FONT>            }<a name="line.319"></a>
+<FONT color="green">320</FONT>    <a name="line.320"></a>
+<FONT color="green">321</FONT>            // parse imaginary character<a name="line.321"></a>
+<FONT color="green">322</FONT>            if (!parseFixedstring(source, getImaginaryCharacter(), pos)) {<a name="line.322"></a>
+<FONT color="green">323</FONT>                return null;<a name="line.323"></a>
+<FONT color="green">324</FONT>            }<a name="line.324"></a>
+<FONT color="green">325</FONT>    <a name="line.325"></a>
+<FONT color="green">326</FONT>            return new Complex(re.doubleValue(), im.doubleValue() * sign);<a name="line.326"></a>
+<FONT color="green">327</FONT>    <a name="line.327"></a>
+<FONT color="green">328</FONT>        }<a name="line.328"></a>
+<FONT color="green">329</FONT>    <a name="line.329"></a>
+<FONT color="green">330</FONT>        /**<a name="line.330"></a>
+<FONT color="green">331</FONT>         * Parses a string to produce a object.<a name="line.331"></a>
+<FONT color="green">332</FONT>         *<a name="line.332"></a>
+<FONT color="green">333</FONT>         * @param source the string to parse<a name="line.333"></a>
+<FONT color="green">334</FONT>         * @param pos input/ouput parsing parameter.<a name="line.334"></a>
+<FONT color="green">335</FONT>         * @return the parsed object.<a name="line.335"></a>
+<FONT color="green">336</FONT>         * @see java.text.Format#parseObject(java.lang.String, java.text.ParsePosition)<a name="line.336"></a>
+<FONT color="green">337</FONT>         */<a name="line.337"></a>
+<FONT color="green">338</FONT>        @Override<a name="line.338"></a>
+<FONT color="green">339</FONT>        public Object parseObject(String source, ParsePosition pos) {<a name="line.339"></a>
+<FONT color="green">340</FONT>            return parse(source, pos);<a name="line.340"></a>
+<FONT color="green">341</FONT>        }<a name="line.341"></a>
+<FONT color="green">342</FONT>    <a name="line.342"></a>
+<FONT color="green">343</FONT>        /**<a name="line.343"></a>
+<FONT color="green">344</FONT>         * Modify the imaginaryCharacter.<a name="line.344"></a>
+<FONT color="green">345</FONT>         * @param imaginaryCharacter The new imaginaryCharacter value.<a name="line.345"></a>
+<FONT color="green">346</FONT>         * @throws IllegalArgumentException if &lt;code&gt;imaginaryCharacter&lt;/code&gt; is<a name="line.346"></a>
+<FONT color="green">347</FONT>         *         &lt;code&gt;null&lt;/code&gt; or an empty string.<a name="line.347"></a>
+<FONT color="green">348</FONT>         */<a name="line.348"></a>
+<FONT color="green">349</FONT>        public void setImaginaryCharacter(String imaginaryCharacter) {<a name="line.349"></a>
+<FONT color="green">350</FONT>            if (imaginaryCharacter == null || imaginaryCharacter.length() == 0) {<a name="line.350"></a>
+<FONT color="green">351</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.351"></a>
+<FONT color="green">352</FONT>                      "empty string for imaginary character");<a name="line.352"></a>
+<FONT color="green">353</FONT>            }<a name="line.353"></a>
+<FONT color="green">354</FONT>            this.imaginaryCharacter = imaginaryCharacter;<a name="line.354"></a>
+<FONT color="green">355</FONT>        }<a name="line.355"></a>
+<FONT color="green">356</FONT>    <a name="line.356"></a>
+<FONT color="green">357</FONT>        /**<a name="line.357"></a>
+<FONT color="green">358</FONT>         * Modify the imaginaryFormat.<a name="line.358"></a>
+<FONT color="green">359</FONT>         * @param imaginaryFormat The new imaginaryFormat value.<a name="line.359"></a>
+<FONT color="green">360</FONT>         * @throws IllegalArgumentException if &lt;code&gt;imaginaryFormat&lt;/code&gt; is<a name="line.360"></a>
+<FONT color="green">361</FONT>         *         &lt;code&gt;null&lt;/code&gt;.<a name="line.361"></a>
+<FONT color="green">362</FONT>         */<a name="line.362"></a>
+<FONT color="green">363</FONT>        public void setImaginaryFormat(NumberFormat imaginaryFormat) {<a name="line.363"></a>
+<FONT color="green">364</FONT>            if (imaginaryFormat == null) {<a name="line.364"></a>
+<FONT color="green">365</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.365"></a>
+<FONT color="green">366</FONT>                      "null imaginary format");<a name="line.366"></a>
+<FONT color="green">367</FONT>            }<a name="line.367"></a>
+<FONT color="green">368</FONT>            this.imaginaryFormat = imaginaryFormat;<a name="line.368"></a>
+<FONT color="green">369</FONT>        }<a name="line.369"></a>
+<FONT color="green">370</FONT>    <a name="line.370"></a>
+<FONT color="green">371</FONT>        /**<a name="line.371"></a>
+<FONT color="green">372</FONT>         * Modify the realFormat.<a name="line.372"></a>
+<FONT color="green">373</FONT>         * @param realFormat The new realFormat value.<a name="line.373"></a>
+<FONT color="green">374</FONT>         * @throws IllegalArgumentException if &lt;code&gt;realFormat&lt;/code&gt; is<a name="line.374"></a>
+<FONT color="green">375</FONT>         *         &lt;code&gt;null&lt;/code&gt;.<a name="line.375"></a>
+<FONT color="green">376</FONT>         */<a name="line.376"></a>
+<FONT color="green">377</FONT>        public void setRealFormat(NumberFormat realFormat) {<a name="line.377"></a>
+<FONT color="green">378</FONT>            if (realFormat == null) {<a name="line.378"></a>
+<FONT color="green">379</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.379"></a>
+<FONT color="green">380</FONT>                      "null real format");<a name="line.380"></a>
+<FONT color="green">381</FONT>            }<a name="line.381"></a>
+<FONT color="green">382</FONT>            this.realFormat = realFormat;<a name="line.382"></a>
+<FONT color="green">383</FONT>        }<a name="line.383"></a>
+<FONT color="green">384</FONT>    <a name="line.384"></a>
+<FONT color="green">385</FONT>    }<a name="line.385"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/complex/ComplexUtils.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,136 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.complex;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Static implementations of common<a name="line.23"></a>
+<FONT color="green">024</FONT>     * {@link org.apache.commons.math.complex.Complex} utilities functions.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public class ComplexUtils {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /**<a name="line.30"></a>
+<FONT color="green">031</FONT>         * Default constructor.<a name="line.31"></a>
+<FONT color="green">032</FONT>         */<a name="line.32"></a>
+<FONT color="green">033</FONT>        private ComplexUtils() {<a name="line.33"></a>
+<FONT color="green">034</FONT>            super();<a name="line.34"></a>
+<FONT color="green">035</FONT>        }<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /**<a name="line.37"></a>
+<FONT color="green">038</FONT>         * Creates a complex number from the given polar representation.<a name="line.38"></a>
+<FONT color="green">039</FONT>         * &lt;p&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>         * The value returned is &lt;code&gt;r&amp;middot;e&lt;sup&gt;i&amp;middot;theta&lt;/sup&gt;&lt;/code&gt;,<a name="line.40"></a>
+<FONT color="green">041</FONT>         * computed as &lt;code&gt;r&amp;middot;cos(theta) + r&amp;middot;sin(theta)i&lt;/code&gt;&lt;/p&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>         * &lt;p&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>         * If either &lt;code&gt;r&lt;/code&gt; or &lt;code&gt;theta&lt;/code&gt; is NaN, or<a name="line.43"></a>
+<FONT color="green">044</FONT>         * &lt;code&gt;theta&lt;/code&gt; is infinite, {@link Complex#NaN} is returned.&lt;/p&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>         * &lt;p&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>         * If &lt;code&gt;r&lt;/code&gt; is infinite and &lt;code&gt;theta&lt;/code&gt; is finite,<a name="line.46"></a>
+<FONT color="green">047</FONT>         * infinite or NaN values may be returned in parts of the result, following<a name="line.47"></a>
+<FONT color="green">048</FONT>         * the rules for double arithmetic.&lt;pre&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>         * Examples:<a name="line.49"></a>
+<FONT color="green">050</FONT>         * &lt;code&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>         * polar2Complex(INFINITY, &amp;pi;/4) = INFINITY + INFINITY i<a name="line.51"></a>
+<FONT color="green">052</FONT>         * polar2Complex(INFINITY, 0) = INFINITY + NaN i<a name="line.52"></a>
+<FONT color="green">053</FONT>         * polar2Complex(INFINITY, -&amp;pi;/4) = INFINITY - INFINITY i<a name="line.53"></a>
+<FONT color="green">054</FONT>         * polar2Complex(INFINITY, 5&amp;pi;/4) = -INFINITY - INFINITY i &lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>         *<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param r the modulus of the complex number to create<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @param theta  the argument of the complex number to create<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @return &lt;code&gt;r&amp;middot;e&lt;sup&gt;i&amp;middot;theta&lt;/sup&gt;&lt;/code&gt;<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @throws IllegalArgumentException  if r is negative<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @since 1.1<a name="line.60"></a>
+<FONT color="green">061</FONT>         */<a name="line.61"></a>
+<FONT color="green">062</FONT>        public static Complex polar2Complex(double r, double theta) {<a name="line.62"></a>
+<FONT color="green">063</FONT>            if (r &lt; 0) {<a name="line.63"></a>
+<FONT color="green">064</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.64"></a>
+<FONT color="green">065</FONT>                      "negative complex module {0}", r);<a name="line.65"></a>
+<FONT color="green">066</FONT>            }<a name="line.66"></a>
+<FONT color="green">067</FONT>            return new Complex(r * Math.cos(theta), r * Math.sin(theta));<a name="line.67"></a>
+<FONT color="green">068</FONT>        }<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>    }<a name="line.70"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/AbstractContinuousDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,244 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.MathException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.analysis.solvers.BrentSolver;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.analysis.solvers.UnivariateRealSolverUtils;<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>    /**<a name="line.29"></a>
+<FONT color="green">030</FONT>     * Base class for continuous distributions.  Default implementations are<a name="line.30"></a>
+<FONT color="green">031</FONT>     * provided for some of the methods that do not vary from distribution to<a name="line.31"></a>
+<FONT color="green">032</FONT>     * distribution.<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @version $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $<a name="line.34"></a>
+<FONT color="green">035</FONT>     */<a name="line.35"></a>
+<FONT color="green">036</FONT>    public abstract class AbstractContinuousDistribution<a name="line.36"></a>
+<FONT color="green">037</FONT>        extends AbstractDistribution<a name="line.37"></a>
+<FONT color="green">038</FONT>        implements ContinuousDistribution, Serializable {<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Serializable version identifier */<a name="line.40"></a>
+<FONT color="green">041</FONT>        private static final long serialVersionUID = -38038050983108802L;<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /**<a name="line.43"></a>
+<FONT color="green">044</FONT>         * Solver absolute accuracy for inverse cum computation<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @since 2.1<a name="line.45"></a>
+<FONT color="green">046</FONT>         */<a name="line.46"></a>
+<FONT color="green">047</FONT>        private double solverAbsoluteAccuracy = BrentSolver.DEFAULT_ABSOLUTE_ACCURACY;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /**<a name="line.49"></a>
+<FONT color="green">050</FONT>         * Default constructor.<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        protected AbstractContinuousDistribution() {<a name="line.52"></a>
+<FONT color="green">053</FONT>            super();<a name="line.53"></a>
+<FONT color="green">054</FONT>        }<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /**<a name="line.56"></a>
+<FONT color="green">057</FONT>         * Return the probability density for a particular point.<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @param x  The point at which the density should be computed.<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @return  The pdf at point x.<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @throws MathRuntimeException if the specialized class hasn't implemented this function<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @since 2.1<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        public double density(double x) throws MathRuntimeException {<a name="line.63"></a>
+<FONT color="green">064</FONT>            throw new MathRuntimeException(new UnsupportedOperationException(),<a name="line.64"></a>
+<FONT color="green">065</FONT>                    "This distribution does not have a density function implemented");<a name="line.65"></a>
+<FONT color="green">066</FONT>        }<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /**<a name="line.68"></a>
+<FONT color="green">069</FONT>         * For this distribution, X, this method returns the critical point x, such<a name="line.69"></a>
+<FONT color="green">070</FONT>         * that P(X &amp;lt; x) = &lt;code&gt;p&lt;/code&gt;.<a name="line.70"></a>
+<FONT color="green">071</FONT>         *<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param p the desired probability<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @return x, such that P(X &amp;lt; x) = &lt;code&gt;p&lt;/code&gt;<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @throws MathException if the inverse cumulative probability can not be<a name="line.74"></a>
+<FONT color="green">075</FONT>         *         computed due to convergence or other numerical errors.<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @throws IllegalArgumentException if &lt;code&gt;p&lt;/code&gt; is not a valid<a name="line.76"></a>
+<FONT color="green">077</FONT>         *         probability.<a name="line.77"></a>
+<FONT color="green">078</FONT>         */<a name="line.78"></a>
+<FONT color="green">079</FONT>        public double inverseCumulativeProbability(final double p)<a name="line.79"></a>
+<FONT color="green">080</FONT>            throws MathException {<a name="line.80"></a>
+<FONT color="green">081</FONT>            if (p &lt; 0.0 || p &gt; 1.0) {<a name="line.81"></a>
+<FONT color="green">082</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.82"></a>
+<FONT color="green">083</FONT>                      "{0} out of [{1}, {2}] range", p, 0.0, 1.0);<a name="line.83"></a>
+<FONT color="green">084</FONT>            }<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>            // by default, do simple root finding using bracketing and default solver.<a name="line.86"></a>
+<FONT color="green">087</FONT>            // subclasses can override if there is a better method.<a name="line.87"></a>
+<FONT color="green">088</FONT>            UnivariateRealFunction rootFindingFunction =<a name="line.88"></a>
+<FONT color="green">089</FONT>                new UnivariateRealFunction() {<a name="line.89"></a>
+<FONT color="green">090</FONT>                public double value(double x) throws FunctionEvaluationException {<a name="line.90"></a>
+<FONT color="green">091</FONT>                    double ret = Double.NaN;<a name="line.91"></a>
+<FONT color="green">092</FONT>                    try {<a name="line.92"></a>
+<FONT color="green">093</FONT>                        ret = cumulativeProbability(x) - p;<a name="line.93"></a>
+<FONT color="green">094</FONT>                    } catch (MathException ex) {<a name="line.94"></a>
+<FONT color="green">095</FONT>                        throw new FunctionEvaluationException(ex, x, ex.getPattern(), ex.getArguments());<a name="line.95"></a>
+<FONT color="green">096</FONT>                    }<a name="line.96"></a>
+<FONT color="green">097</FONT>                    if (Double.isNaN(ret)) {<a name="line.97"></a>
+<FONT color="green">098</FONT>                        throw new FunctionEvaluationException(x,<a name="line.98"></a>
+<FONT color="green">099</FONT>                            "Cumulative probability function returned NaN for argument {0} p = {1}", x, p);<a name="line.99"></a>
+<FONT color="green">100</FONT>                    }<a name="line.100"></a>
+<FONT color="green">101</FONT>                    return ret;<a name="line.101"></a>
+<FONT color="green">102</FONT>                }<a name="line.102"></a>
+<FONT color="green">103</FONT>            };<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>            // Try to bracket root, test domain endoints if this fails<a name="line.105"></a>
+<FONT color="green">106</FONT>            double lowerBound = getDomainLowerBound(p);<a name="line.106"></a>
+<FONT color="green">107</FONT>            double upperBound = getDomainUpperBound(p);<a name="line.107"></a>
+<FONT color="green">108</FONT>            double[] bracket = null;<a name="line.108"></a>
+<FONT color="green">109</FONT>            try {<a name="line.109"></a>
+<FONT color="green">110</FONT>                bracket = UnivariateRealSolverUtils.bracket(<a name="line.110"></a>
+<FONT color="green">111</FONT>                        rootFindingFunction, getInitialDomain(p),<a name="line.111"></a>
+<FONT color="green">112</FONT>                        lowerBound, upperBound);<a name="line.112"></a>
+<FONT color="green">113</FONT>            }  catch (ConvergenceException ex) {<a name="line.113"></a>
+<FONT color="green">114</FONT>                /*<a name="line.114"></a>
+<FONT color="green">115</FONT>                 * Check domain endpoints to see if one gives value that is within<a name="line.115"></a>
+<FONT color="green">116</FONT>                 * the default solver's defaultAbsoluteAccuracy of 0 (will be the<a name="line.116"></a>
+<FONT color="green">117</FONT>                 * case if density has bounded support and p is 0 or 1).<a name="line.117"></a>
+<FONT color="green">118</FONT>                 */<a name="line.118"></a>
+<FONT color="green">119</FONT>                if (Math.abs(rootFindingFunction.value(lowerBound)) &lt; getSolverAbsoluteAccuracy()) {<a name="line.119"></a>
+<FONT color="green">120</FONT>                    return lowerBound;<a name="line.120"></a>
+<FONT color="green">121</FONT>                }<a name="line.121"></a>
+<FONT color="green">122</FONT>                if (Math.abs(rootFindingFunction.value(upperBound)) &lt; getSolverAbsoluteAccuracy()) {<a name="line.122"></a>
+<FONT color="green">123</FONT>                    return upperBound;<a name="line.123"></a>
+<FONT color="green">124</FONT>                }<a name="line.124"></a>
+<FONT color="green">125</FONT>                // Failed bracket convergence was not because of corner solution<a name="line.125"></a>
+<FONT color="green">126</FONT>                throw new MathException(ex);<a name="line.126"></a>
+<FONT color="green">127</FONT>            }<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>            // find root<a name="line.129"></a>
+<FONT color="green">130</FONT>            double root = UnivariateRealSolverUtils.solve(rootFindingFunction,<a name="line.130"></a>
+<FONT color="green">131</FONT>                    // override getSolverAbsoluteAccuracy() to use a Brent solver with<a name="line.131"></a>
+<FONT color="green">132</FONT>                    // absolute accuracy different from BrentSolver default<a name="line.132"></a>
+<FONT color="green">133</FONT>                    bracket[0],bracket[1], getSolverAbsoluteAccuracy());<a name="line.133"></a>
+<FONT color="green">134</FONT>            return root;<a name="line.134"></a>
+<FONT color="green">135</FONT>        }<a name="line.135"></a>
+<FONT color="green">136</FONT>    <a name="line.136"></a>
+<FONT color="green">137</FONT>        /**<a name="line.137"></a>
+<FONT color="green">138</FONT>         * Access the initial domain value, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.138"></a>
+<FONT color="green">139</FONT>         * bracket a CDF root.  This method is used by<a name="line.139"></a>
+<FONT color="green">140</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.140"></a>
+<FONT color="green">141</FONT>         *<a name="line.141"></a>
+<FONT color="green">142</FONT>         * @param p the desired probability for the critical value<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @return initial domain value<a name="line.143"></a>
+<FONT color="green">144</FONT>         */<a name="line.144"></a>
+<FONT color="green">145</FONT>        protected abstract double getInitialDomain(double p);<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>        /**<a name="line.147"></a>
+<FONT color="green">148</FONT>         * Access the domain value lower bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.148"></a>
+<FONT color="green">149</FONT>         * bracket a CDF root.  This method is used by<a name="line.149"></a>
+<FONT color="green">150</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.150"></a>
+<FONT color="green">151</FONT>         *<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @param p the desired probability for the critical value<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @return domain value lower bound, i.e.<a name="line.153"></a>
+<FONT color="green">154</FONT>         *         P(X &amp;lt; &lt;i&gt;lower bound&lt;/i&gt;) &amp;lt; &lt;code&gt;p&lt;/code&gt;<a name="line.154"></a>
+<FONT color="green">155</FONT>         */<a name="line.155"></a>
+<FONT color="green">156</FONT>        protected abstract double getDomainLowerBound(double p);<a name="line.156"></a>
+<FONT color="green">157</FONT>    <a name="line.157"></a>
+<FONT color="green">158</FONT>        /**<a name="line.158"></a>
+<FONT color="green">159</FONT>         * Access the domain value upper bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.159"></a>
+<FONT color="green">160</FONT>         * bracket a CDF root.  This method is used by<a name="line.160"></a>
+<FONT color="green">161</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.161"></a>
+<FONT color="green">162</FONT>         *<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @param p the desired probability for the critical value<a name="line.163"></a>
+<FONT color="green">164</FONT>         * @return domain value upper bound, i.e.<a name="line.164"></a>
+<FONT color="green">165</FONT>         *         P(X &amp;lt; &lt;i&gt;upper bound&lt;/i&gt;) &amp;gt; &lt;code&gt;p&lt;/code&gt;<a name="line.165"></a>
+<FONT color="green">166</FONT>         */<a name="line.166"></a>
+<FONT color="green">167</FONT>        protected abstract double getDomainUpperBound(double p);<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>        /**<a name="line.169"></a>
+<FONT color="green">170</FONT>         * Returns the solver absolute accuracy for inverse cum computation.<a name="line.170"></a>
+<FONT color="green">171</FONT>         *<a name="line.171"></a>
+<FONT color="green">172</FONT>         * @return the maximum absolute error in inverse cumulative probability estimates<a name="line.172"></a>
+<FONT color="green">173</FONT>         * @since 2.1<a name="line.173"></a>
+<FONT color="green">174</FONT>         */<a name="line.174"></a>
+<FONT color="green">175</FONT>        protected double getSolverAbsoluteAccuracy() {<a name="line.175"></a>
+<FONT color="green">176</FONT>            return solverAbsoluteAccuracy;<a name="line.176"></a>
+<FONT color="green">177</FONT>        }<a name="line.177"></a>
+<FONT color="green">178</FONT>    }<a name="line.178"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/AbstractDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,134 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Base class for probability distributions.<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public abstract class AbstractDistribution<a name="line.29"></a>
+<FONT color="green">030</FONT>        implements Distribution, Serializable {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** Serializable version identifier */<a name="line.32"></a>
+<FONT color="green">033</FONT>        private static final long serialVersionUID = -38038050983108802L;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /**<a name="line.35"></a>
+<FONT color="green">036</FONT>         * Default constructor.<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        protected AbstractDistribution() {<a name="line.38"></a>
+<FONT color="green">039</FONT>            super();<a name="line.39"></a>
+<FONT color="green">040</FONT>        }<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /**<a name="line.42"></a>
+<FONT color="green">043</FONT>         * For a random variable X whose values are distributed according<a name="line.43"></a>
+<FONT color="green">044</FONT>         * to this distribution, this method returns P(x0 &amp;le; X &amp;le; x1).<a name="line.44"></a>
+<FONT color="green">045</FONT>         * &lt;p&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>         * The default implementation uses the identity&lt;/p&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>         * &lt;p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>         * P(x0 &amp;le; X &amp;le; x1) = P(X &amp;le; x1) - P(X &amp;le; x0) &lt;/p&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>         *<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @param x0 the (inclusive) lower bound<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @param x1 the (inclusive) upper bound<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @return the probability that a random variable with this distribution<a name="line.52"></a>
+<FONT color="green">053</FONT>         * will take a value between &lt;code&gt;x0&lt;/code&gt; and &lt;code&gt;x1&lt;/code&gt;,<a name="line.53"></a>
+<FONT color="green">054</FONT>         * including the endpoints.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @throws MathException if the cumulative probability can not be<a name="line.55"></a>
+<FONT color="green">056</FONT>         * computed due to convergence or other numerical errors.<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @throws IllegalArgumentException if &lt;code&gt;x0 &gt; x1&lt;/code&gt;<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public double cumulativeProbability(double x0, double x1)<a name="line.59"></a>
+<FONT color="green">060</FONT>            throws MathException {<a name="line.60"></a>
+<FONT color="green">061</FONT>            if (x0 &gt; x1) {<a name="line.61"></a>
+<FONT color="green">062</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.62"></a>
+<FONT color="green">063</FONT>                      "lower endpoint ({0}) must be less than or equal to upper endpoint ({1})",<a name="line.63"></a>
+<FONT color="green">064</FONT>                      x0, x1);<a name="line.64"></a>
+<FONT color="green">065</FONT>            }<a name="line.65"></a>
+<FONT color="green">066</FONT>            return cumulativeProbability(x1) - cumulativeProbability(x0);<a name="line.66"></a>
+<FONT color="green">067</FONT>        }<a name="line.67"></a>
+<FONT color="green">068</FONT>    }<a name="line.68"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/AbstractIntegerDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,322 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Base class for integer-valued discrete distributions.  Default<a name="line.27"></a>
+<FONT color="green">028</FONT>     * implementations are provided for some of the methods that do not vary<a name="line.28"></a>
+<FONT color="green">029</FONT>     * from distribution to distribution.<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 920558 $ $Date: 2010-03-08 17:57:32 -0500 (Mon, 08 Mar 2010) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public abstract class AbstractIntegerDistribution extends AbstractDistribution<a name="line.33"></a>
+<FONT color="green">034</FONT>        implements IntegerDistribution, Serializable {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Message for endpoints in wrong order. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private static final String WRONG_ORDER_ENDPOINTS_MESSAGE =<a name="line.37"></a>
+<FONT color="green">038</FONT>            "lower endpoint ({0}) must be less than or equal to upper endpoint ({1})";<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Message for out of range point. */<a name="line.40"></a>
+<FONT color="green">041</FONT>        private static final String OUT_OF_RANGE_POINT =<a name="line.41"></a>
+<FONT color="green">042</FONT>            "{0} out of [{1}, {2}] range";<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Serializable version identifier */<a name="line.44"></a>
+<FONT color="green">045</FONT>        private static final long serialVersionUID = -1146319659338487221L;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Default constructor.<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        protected AbstractIntegerDistribution() {<a name="line.50"></a>
+<FONT color="green">051</FONT>            super();<a name="line.51"></a>
+<FONT color="green">052</FONT>        }<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /**<a name="line.54"></a>
+<FONT color="green">055</FONT>         * For a random variable X whose values are distributed according<a name="line.55"></a>
+<FONT color="green">056</FONT>         * to this distribution, this method returns P(X &amp;le; x).  In other words,<a name="line.56"></a>
+<FONT color="green">057</FONT>         * this method represents the  (cumulative) distribution function, or<a name="line.57"></a>
+<FONT color="green">058</FONT>         * CDF, for this distribution.<a name="line.58"></a>
+<FONT color="green">059</FONT>         * &lt;p&gt;<a name="line.59"></a>
+<FONT color="green">060</FONT>         * If &lt;code&gt;x&lt;/code&gt; does not represent an integer value, the CDF is<a name="line.60"></a>
+<FONT color="green">061</FONT>         * evaluated at the greatest integer less than x.<a name="line.61"></a>
+<FONT color="green">062</FONT>         *<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @param x the value at which the distribution function is evaluated.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @return cumulative probability that a random variable with this<a name="line.64"></a>
+<FONT color="green">065</FONT>         * distribution takes a value less than or equal to &lt;code&gt;x&lt;/code&gt;<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @throws MathException if the cumulative probability can not be<a name="line.66"></a>
+<FONT color="green">067</FONT>         * computed due to convergence or other numerical errors.<a name="line.67"></a>
+<FONT color="green">068</FONT>         */<a name="line.68"></a>
+<FONT color="green">069</FONT>        public double cumulativeProbability(double x) throws MathException {<a name="line.69"></a>
+<FONT color="green">070</FONT>            return cumulativeProbability((int) Math.floor(x));<a name="line.70"></a>
+<FONT color="green">071</FONT>        }<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /**<a name="line.73"></a>
+<FONT color="green">074</FONT>         * For a random variable X whose values are distributed according<a name="line.74"></a>
+<FONT color="green">075</FONT>         * to this distribution, this method returns P(x0 &amp;le; X &amp;le; x1).<a name="line.75"></a>
+<FONT color="green">076</FONT>         *<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @param x0 the (inclusive) lower bound<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @param x1 the (inclusive) upper bound<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @return the probability that a random variable with this distribution<a name="line.79"></a>
+<FONT color="green">080</FONT>         * will take a value between &lt;code&gt;x0&lt;/code&gt; and &lt;code&gt;x1&lt;/code&gt;,<a name="line.80"></a>
+<FONT color="green">081</FONT>         * including the endpoints.<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @throws MathException if the cumulative probability can not be<a name="line.82"></a>
+<FONT color="green">083</FONT>         * computed due to convergence or other numerical errors.<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @throws IllegalArgumentException if &lt;code&gt;x0 &gt; x1&lt;/code&gt;<a name="line.84"></a>
+<FONT color="green">085</FONT>         */<a name="line.85"></a>
+<FONT color="green">086</FONT>        @Override<a name="line.86"></a>
+<FONT color="green">087</FONT>        public double cumulativeProbability(double x0, double x1)<a name="line.87"></a>
+<FONT color="green">088</FONT>            throws MathException {<a name="line.88"></a>
+<FONT color="green">089</FONT>            if (x0 &gt; x1) {<a name="line.89"></a>
+<FONT color="green">090</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.90"></a>
+<FONT color="green">091</FONT>                      WRONG_ORDER_ENDPOINTS_MESSAGE, x0, x1);<a name="line.91"></a>
+<FONT color="green">092</FONT>            }<a name="line.92"></a>
+<FONT color="green">093</FONT>            if (Math.floor(x0) &lt; x0) {<a name="line.93"></a>
+<FONT color="green">094</FONT>                return cumulativeProbability(((int) Math.floor(x0)) + 1,<a name="line.94"></a>
+<FONT color="green">095</FONT>                   (int) Math.floor(x1)); // don't want to count mass below x0<a name="line.95"></a>
+<FONT color="green">096</FONT>            } else { // x0 is mathematical integer, so use as is<a name="line.96"></a>
+<FONT color="green">097</FONT>                return cumulativeProbability((int) Math.floor(x0),<a name="line.97"></a>
+<FONT color="green">098</FONT>                    (int) Math.floor(x1));<a name="line.98"></a>
+<FONT color="green">099</FONT>            }<a name="line.99"></a>
+<FONT color="green">100</FONT>        }<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>        /**<a name="line.102"></a>
+<FONT color="green">103</FONT>         * For a random variable X whose values are distributed according<a name="line.103"></a>
+<FONT color="green">104</FONT>         * to this distribution, this method returns P(X &amp;le; x).  In other words,<a name="line.104"></a>
+<FONT color="green">105</FONT>         * this method represents the probability distribution function, or PDF,<a name="line.105"></a>
+<FONT color="green">106</FONT>         * for this distribution.<a name="line.106"></a>
+<FONT color="green">107</FONT>         *<a name="line.107"></a>
+<FONT color="green">108</FONT>         * @param x the value at which the PDF is evaluated.<a name="line.108"></a>
+<FONT color="green">109</FONT>         * @return PDF for this distribution.<a name="line.109"></a>
+<FONT color="green">110</FONT>         * @throws MathException if the cumulative probability can not be<a name="line.110"></a>
+<FONT color="green">111</FONT>         *            computed due to convergence or other numerical errors.<a name="line.111"></a>
+<FONT color="green">112</FONT>         */<a name="line.112"></a>
+<FONT color="green">113</FONT>        public abstract double cumulativeProbability(int x) throws MathException;<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>        /**<a name="line.115"></a>
+<FONT color="green">116</FONT>         * For a random variable X whose values are distributed according<a name="line.116"></a>
+<FONT color="green">117</FONT>         * to this distribution, this method returns P(X = x). In other words, this<a name="line.117"></a>
+<FONT color="green">118</FONT>         * method represents the probability mass function,  or PMF, for the distribution.<a name="line.118"></a>
+<FONT color="green">119</FONT>         * &lt;p&gt;<a name="line.119"></a>
+<FONT color="green">120</FONT>         * If &lt;code&gt;x&lt;/code&gt; does not represent an integer value, 0 is returned.<a name="line.120"></a>
+<FONT color="green">121</FONT>         *<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @param x the value at which the probability density function is evaluated<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @return the value of the probability density function at x<a name="line.123"></a>
+<FONT color="green">124</FONT>         */<a name="line.124"></a>
+<FONT color="green">125</FONT>        public double probability(double x) {<a name="line.125"></a>
+<FONT color="green">126</FONT>            double fl = Math.floor(x);<a name="line.126"></a>
+<FONT color="green">127</FONT>            if (fl == x) {<a name="line.127"></a>
+<FONT color="green">128</FONT>                return this.probability((int) x);<a name="line.128"></a>
+<FONT color="green">129</FONT>            } else {<a name="line.129"></a>
+<FONT color="green">130</FONT>                return 0;<a name="line.130"></a>
+<FONT color="green">131</FONT>            }<a name="line.131"></a>
+<FONT color="green">132</FONT>        }<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>        /**<a name="line.134"></a>
+<FONT color="green">135</FONT>        * For a random variable X whose values are distributed according<a name="line.135"></a>
+<FONT color="green">136</FONT>         * to this distribution, this method returns P(x0 &amp;le; X &amp;le; x1).<a name="line.136"></a>
+<FONT color="green">137</FONT>         *<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @param x0 the inclusive, lower bound<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @param x1 the inclusive, upper bound<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @return the cumulative probability.<a name="line.140"></a>
+<FONT color="green">141</FONT>         * @throws MathException if the cumulative probability can not be<a name="line.141"></a>
+<FONT color="green">142</FONT>         *            computed due to convergence or other numerical errors.<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @throws IllegalArgumentException if x0 &gt; x1<a name="line.143"></a>
+<FONT color="green">144</FONT>         */<a name="line.144"></a>
+<FONT color="green">145</FONT>        public double cumulativeProbability(int x0, int x1) throws MathException {<a name="line.145"></a>
+<FONT color="green">146</FONT>            if (x0 &gt; x1) {<a name="line.146"></a>
+<FONT color="green">147</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.147"></a>
+<FONT color="green">148</FONT>                      WRONG_ORDER_ENDPOINTS_MESSAGE, x0, x1);<a name="line.148"></a>
+<FONT color="green">149</FONT>            }<a name="line.149"></a>
+<FONT color="green">150</FONT>            return cumulativeProbability(x1) - cumulativeProbability(x0 - 1);<a name="line.150"></a>
+<FONT color="green">151</FONT>        }<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>        /**<a name="line.153"></a>
+<FONT color="green">154</FONT>         * For a random variable X whose values are distributed according<a name="line.154"></a>
+<FONT color="green">155</FONT>         * to this distribution, this method returns the largest x, such<a name="line.155"></a>
+<FONT color="green">156</FONT>         * that P(X &amp;le; x) &amp;le; &lt;code&gt;p&lt;/code&gt;.<a name="line.156"></a>
+<FONT color="green">157</FONT>         *<a name="line.157"></a>
+<FONT color="green">158</FONT>         * @param p the desired probability<a name="line.158"></a>
+<FONT color="green">159</FONT>         * @return the largest x such that P(X &amp;le; x) &lt;= p<a name="line.159"></a>
+<FONT color="green">160</FONT>         * @throws MathException if the inverse cumulative probability can not be<a name="line.160"></a>
+<FONT color="green">161</FONT>         *            computed due to convergence or other numerical errors.<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @throws IllegalArgumentException if p &lt; 0 or p &gt; 1<a name="line.162"></a>
+<FONT color="green">163</FONT>         */<a name="line.163"></a>
+<FONT color="green">164</FONT>        public int inverseCumulativeProbability(final double p) throws MathException{<a name="line.164"></a>
+<FONT color="green">165</FONT>            if (p &lt; 0.0 || p &gt; 1.0) {<a name="line.165"></a>
+<FONT color="green">166</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.166"></a>
+<FONT color="green">167</FONT>                      OUT_OF_RANGE_POINT, p, 0.0, 1.0);<a name="line.167"></a>
+<FONT color="green">168</FONT>            }<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>            // by default, do simple bisection.<a name="line.170"></a>
+<FONT color="green">171</FONT>            // subclasses can override if there is a better method.<a name="line.171"></a>
+<FONT color="green">172</FONT>            int x0 = getDomainLowerBound(p);<a name="line.172"></a>
+<FONT color="green">173</FONT>            int x1 = getDomainUpperBound(p);<a name="line.173"></a>
+<FONT color="green">174</FONT>            double pm;<a name="line.174"></a>
+<FONT color="green">175</FONT>            while (x0 &lt; x1) {<a name="line.175"></a>
+<FONT color="green">176</FONT>                int xm = x0 + (x1 - x0) / 2;<a name="line.176"></a>
+<FONT color="green">177</FONT>                pm = checkedCumulativeProbability(xm);<a name="line.177"></a>
+<FONT color="green">178</FONT>                if (pm &gt; p) {<a name="line.178"></a>
+<FONT color="green">179</FONT>                    // update x1<a name="line.179"></a>
+<FONT color="green">180</FONT>                    if (xm == x1) {<a name="line.180"></a>
+<FONT color="green">181</FONT>                        // this can happen with integer division<a name="line.181"></a>
+<FONT color="green">182</FONT>                        // simply decrement x1<a name="line.182"></a>
+<FONT color="green">183</FONT>                        --x1;<a name="line.183"></a>
+<FONT color="green">184</FONT>                    } else {<a name="line.184"></a>
+<FONT color="green">185</FONT>                        // update x1 normally<a name="line.185"></a>
+<FONT color="green">186</FONT>                        x1 = xm;<a name="line.186"></a>
+<FONT color="green">187</FONT>                    }<a name="line.187"></a>
+<FONT color="green">188</FONT>                } else {<a name="line.188"></a>
+<FONT color="green">189</FONT>                    // update x0<a name="line.189"></a>
+<FONT color="green">190</FONT>                    if (xm == x0) {<a name="line.190"></a>
+<FONT color="green">191</FONT>                        // this can happen with integer division<a name="line.191"></a>
+<FONT color="green">192</FONT>                        // simply increment x0<a name="line.192"></a>
+<FONT color="green">193</FONT>                        ++x0;<a name="line.193"></a>
+<FONT color="green">194</FONT>                    } else {<a name="line.194"></a>
+<FONT color="green">195</FONT>                        // update x0 normally<a name="line.195"></a>
+<FONT color="green">196</FONT>                        x0 = xm;<a name="line.196"></a>
+<FONT color="green">197</FONT>                    }<a name="line.197"></a>
+<FONT color="green">198</FONT>                }<a name="line.198"></a>
+<FONT color="green">199</FONT>            }<a name="line.199"></a>
+<FONT color="green">200</FONT>    <a name="line.200"></a>
+<FONT color="green">201</FONT>            // insure x0 is the correct critical point<a name="line.201"></a>
+<FONT color="green">202</FONT>            pm = checkedCumulativeProbability(x0);<a name="line.202"></a>
+<FONT color="green">203</FONT>            while (pm &gt; p) {<a name="line.203"></a>
+<FONT color="green">204</FONT>                --x0;<a name="line.204"></a>
+<FONT color="green">205</FONT>                pm = checkedCumulativeProbability(x0);<a name="line.205"></a>
+<FONT color="green">206</FONT>            }<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>            return x0;<a name="line.208"></a>
+<FONT color="green">209</FONT>        }<a name="line.209"></a>
+<FONT color="green">210</FONT>    <a name="line.210"></a>
+<FONT color="green">211</FONT>        /**<a name="line.211"></a>
+<FONT color="green">212</FONT>         * Computes the cumulative probablity function and checks for NaN values returned.<a name="line.212"></a>
+<FONT color="green">213</FONT>         * Throws MathException if the value is NaN. Wraps and rethrows any MathException encountered<a name="line.213"></a>
+<FONT color="green">214</FONT>         * evaluating the cumulative probability function in a FunctionEvaluationException. Throws<a name="line.214"></a>
+<FONT color="green">215</FONT>         * FunctionEvaluationException of the cumulative probability function returns NaN.<a name="line.215"></a>
+<FONT color="green">216</FONT>         *<a name="line.216"></a>
+<FONT color="green">217</FONT>         * @param argument input value<a name="line.217"></a>
+<FONT color="green">218</FONT>         * @return cumulative probability<a name="line.218"></a>
+<FONT color="green">219</FONT>         * @throws FunctionEvaluationException if a MathException occurs computing the cumulative probability<a name="line.219"></a>
+<FONT color="green">220</FONT>         */<a name="line.220"></a>
+<FONT color="green">221</FONT>        private double checkedCumulativeProbability(int argument) throws FunctionEvaluationException {<a name="line.221"></a>
+<FONT color="green">222</FONT>            double result = Double.NaN;<a name="line.222"></a>
+<FONT color="green">223</FONT>            try {<a name="line.223"></a>
+<FONT color="green">224</FONT>                result = cumulativeProbability(argument);<a name="line.224"></a>
+<FONT color="green">225</FONT>            } catch (MathException ex) {<a name="line.225"></a>
+<FONT color="green">226</FONT>                throw new FunctionEvaluationException(ex, argument, ex.getPattern(), ex.getArguments());<a name="line.226"></a>
+<FONT color="green">227</FONT>            }<a name="line.227"></a>
+<FONT color="green">228</FONT>            if (Double.isNaN(result)) {<a name="line.228"></a>
+<FONT color="green">229</FONT>                throw new FunctionEvaluationException(argument,<a name="line.229"></a>
+<FONT color="green">230</FONT>                    "Discrete cumulative probability function returned NaN for argument {0}", argument);<a name="line.230"></a>
+<FONT color="green">231</FONT>            }<a name="line.231"></a>
+<FONT color="green">232</FONT>            return result;<a name="line.232"></a>
+<FONT color="green">233</FONT>        }<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>        /**<a name="line.235"></a>
+<FONT color="green">236</FONT>         * Access the domain value lower bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.236"></a>
+<FONT color="green">237</FONT>         * bracket a PDF root.  This method is used by<a name="line.237"></a>
+<FONT color="green">238</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.238"></a>
+<FONT color="green">239</FONT>         *<a name="line.239"></a>
+<FONT color="green">240</FONT>         * @param p the desired probability for the critical value<a name="line.240"></a>
+<FONT color="green">241</FONT>         * @return domain value lower bound, i.e.<a name="line.241"></a>
+<FONT color="green">242</FONT>         *         P(X &amp;lt; &lt;i&gt;lower bound&lt;/i&gt;) &amp;lt; &lt;code&gt;p&lt;/code&gt;<a name="line.242"></a>
+<FONT color="green">243</FONT>         */<a name="line.243"></a>
+<FONT color="green">244</FONT>        protected abstract int getDomainLowerBound(double p);<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>        /**<a name="line.246"></a>
+<FONT color="green">247</FONT>         * Access the domain value upper bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.247"></a>
+<FONT color="green">248</FONT>         * bracket a PDF root.  This method is used by<a name="line.248"></a>
+<FONT color="green">249</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.249"></a>
+<FONT color="green">250</FONT>         *<a name="line.250"></a>
+<FONT color="green">251</FONT>         * @param p the desired probability for the critical value<a name="line.251"></a>
+<FONT color="green">252</FONT>         * @return domain value upper bound, i.e.<a name="line.252"></a>
+<FONT color="green">253</FONT>         *         P(X &amp;lt; &lt;i&gt;upper bound&lt;/i&gt;) &amp;gt; &lt;code&gt;p&lt;/code&gt;<a name="line.253"></a>
+<FONT color="green">254</FONT>         */<a name="line.254"></a>
+<FONT color="green">255</FONT>        protected abstract int getDomainUpperBound(double p);<a name="line.255"></a>
+<FONT color="green">256</FONT>    }<a name="line.256"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/BetaDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,131 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Computes the cumulative, inverse cumulative and density functions for the beta distribuiton.<a name="line.22"></a>
+<FONT color="green">023</FONT>     *<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @see &lt;a href="http://en.wikipedia.org/wiki/Beta_distribution"&gt;Beta_distribution&lt;/a&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 920852 $ $Date: 2010-03-09 07:53:44 -0500 (Tue, 09 Mar 2010) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 2.0<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public interface BetaDistribution extends ContinuousDistribution, HasDensity&lt;Double&gt; {<a name="line.28"></a>
+<FONT color="green">029</FONT>        /**<a name="line.29"></a>
+<FONT color="green">030</FONT>         * Modify the shape parameter, alpha.<a name="line.30"></a>
+<FONT color="green">031</FONT>         * @param alpha the new shape parameter.<a name="line.31"></a>
+<FONT color="green">032</FONT>         * @deprecated as of 2.1<a name="line.32"></a>
+<FONT color="green">033</FONT>         */<a name="line.33"></a>
+<FONT color="green">034</FONT>        @Deprecated<a name="line.34"></a>
+<FONT color="green">035</FONT>        void setAlpha(double alpha);<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>         /**<a name="line.37"></a>
+<FONT color="green">038</FONT>          * Access the shape parameter, alpha<a name="line.38"></a>
+<FONT color="green">039</FONT>          * @return alpha.<a name="line.39"></a>
+<FONT color="green">040</FONT>          */<a name="line.40"></a>
+<FONT color="green">041</FONT>         double getAlpha();<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>         /**<a name="line.43"></a>
+<FONT color="green">044</FONT>          * Modify the shape parameter, beta.<a name="line.44"></a>
+<FONT color="green">045</FONT>          * @param beta the new scale parameter.<a name="line.45"></a>
+<FONT color="green">046</FONT>          * @deprecated as of 2.1<a name="line.46"></a>
+<FONT color="green">047</FONT>          */<a name="line.47"></a>
+<FONT color="green">048</FONT>         @Deprecated<a name="line.48"></a>
+<FONT color="green">049</FONT>         void setBeta(double beta);<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>         /**<a name="line.51"></a>
+<FONT color="green">052</FONT>          * Access the shape parameter, beta<a name="line.52"></a>
+<FONT color="green">053</FONT>          * @return beta.<a name="line.53"></a>
+<FONT color="green">054</FONT>          */<a name="line.54"></a>
+<FONT color="green">055</FONT>         double getBeta();<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>         /**<a name="line.57"></a>
+<FONT color="green">058</FONT>          * Return the probability density for a particular point.<a name="line.58"></a>
+<FONT color="green">059</FONT>          * @param x  The point at which the density should be computed.<a name="line.59"></a>
+<FONT color="green">060</FONT>          * @return  The pdf at point x.<a name="line.60"></a>
+<FONT color="green">061</FONT>          * @exception MathException if probability density cannot be computed<a name="line.61"></a>
+<FONT color="green">062</FONT>          */<a name="line.62"></a>
+<FONT color="green">063</FONT>         double density(Double x) throws MathException;<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>    }<a name="line.65"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/BetaDistributionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,288 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.special.Gamma;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.special.Beta;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Implements the Beta distribution.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * References:<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;ul&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Beta_distribution"&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * Beta distribution&lt;/a&gt;&lt;/li&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;/ul&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * @version $Revision: 925900 $ $Date: 2010-03-21 17:10:07 -0400 (Sun, 21 Mar 2010) $<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @since 2.0<a name="line.34"></a>
+<FONT color="green">035</FONT>     */<a name="line.35"></a>
+<FONT color="green">036</FONT>    public class BetaDistributionImpl<a name="line.36"></a>
+<FONT color="green">037</FONT>        extends AbstractContinuousDistribution implements BetaDistribution {<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /**<a name="line.39"></a>
+<FONT color="green">040</FONT>         * Default inverse cumulative probability accurac<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @since 2.1<a name="line.41"></a>
+<FONT color="green">042</FONT>         */<a name="line.42"></a>
+<FONT color="green">043</FONT>        public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Serializable version identifier. */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private static final long serialVersionUID = -1221965979403477668L;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** First shape parameter. */<a name="line.48"></a>
+<FONT color="green">049</FONT>        private double alpha;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /** Second shape parameter. */<a name="line.51"></a>
+<FONT color="green">052</FONT>        private double beta;<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /** Normalizing factor used in density computations.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * updated whenever alpha or beta are changed.<a name="line.55"></a>
+<FONT color="green">056</FONT>         */<a name="line.56"></a>
+<FONT color="green">057</FONT>        private double z;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** Inverse cumulative probability accuracy */<a name="line.59"></a>
+<FONT color="green">060</FONT>        private final double solverAbsoluteAccuracy;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /**<a name="line.62"></a>
+<FONT color="green">063</FONT>         * Build a new instance.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @param alpha first shape parameter (must be positive)<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param beta second shape parameter (must be positive)<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @param inverseCumAccuracy the maximum absolute error in inverse cumulative probability estimates<a name="line.66"></a>
+<FONT color="green">067</FONT>         * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY})<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @since 2.1<a name="line.68"></a>
+<FONT color="green">069</FONT>         */<a name="line.69"></a>
+<FONT color="green">070</FONT>        public BetaDistributionImpl(double alpha, double beta, double inverseCumAccuracy) {<a name="line.70"></a>
+<FONT color="green">071</FONT>            this.alpha = alpha;<a name="line.71"></a>
+<FONT color="green">072</FONT>            this.beta = beta;<a name="line.72"></a>
+<FONT color="green">073</FONT>            z = Double.NaN;<a name="line.73"></a>
+<FONT color="green">074</FONT>            solverAbsoluteAccuracy = inverseCumAccuracy;<a name="line.74"></a>
+<FONT color="green">075</FONT>        }<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /**<a name="line.77"></a>
+<FONT color="green">078</FONT>         * Build a new instance.<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @param alpha first shape parameter (must be positive)<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @param beta second shape parameter (must be positive)<a name="line.80"></a>
+<FONT color="green">081</FONT>         */<a name="line.81"></a>
+<FONT color="green">082</FONT>        public BetaDistributionImpl(double alpha, double beta) {<a name="line.82"></a>
+<FONT color="green">083</FONT>            this(alpha, beta, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);<a name="line.83"></a>
+<FONT color="green">084</FONT>        }<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /** {@inheritDoc}<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.87"></a>
+<FONT color="green">088</FONT>         */<a name="line.88"></a>
+<FONT color="green">089</FONT>        @Deprecated<a name="line.89"></a>
+<FONT color="green">090</FONT>        public void setAlpha(double alpha) {<a name="line.90"></a>
+<FONT color="green">091</FONT>            this.alpha = alpha;<a name="line.91"></a>
+<FONT color="green">092</FONT>            z = Double.NaN;<a name="line.92"></a>
+<FONT color="green">093</FONT>        }<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /** {@inheritDoc} */<a name="line.95"></a>
+<FONT color="green">096</FONT>        public double getAlpha() {<a name="line.96"></a>
+<FONT color="green">097</FONT>            return alpha;<a name="line.97"></a>
+<FONT color="green">098</FONT>        }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>        /** {@inheritDoc}<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.101"></a>
+<FONT color="green">102</FONT>         */<a name="line.102"></a>
+<FONT color="green">103</FONT>        @Deprecated<a name="line.103"></a>
+<FONT color="green">104</FONT>        public void setBeta(double beta) {<a name="line.104"></a>
+<FONT color="green">105</FONT>            this.beta = beta;<a name="line.105"></a>
+<FONT color="green">106</FONT>            z = Double.NaN;<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /** {@inheritDoc} */<a name="line.109"></a>
+<FONT color="green">110</FONT>        public double getBeta() {<a name="line.110"></a>
+<FONT color="green">111</FONT>            return beta;<a name="line.111"></a>
+<FONT color="green">112</FONT>        }<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /**<a name="line.114"></a>
+<FONT color="green">115</FONT>         * Recompute the normalization factor.<a name="line.115"></a>
+<FONT color="green">116</FONT>         */<a name="line.116"></a>
+<FONT color="green">117</FONT>        private void recomputeZ() {<a name="line.117"></a>
+<FONT color="green">118</FONT>            if (Double.isNaN(z)) {<a name="line.118"></a>
+<FONT color="green">119</FONT>                z = Gamma.logGamma(alpha) + Gamma.logGamma(beta) - Gamma.logGamma(alpha + beta);<a name="line.119"></a>
+<FONT color="green">120</FONT>            }<a name="line.120"></a>
+<FONT color="green">121</FONT>        }<a name="line.121"></a>
+<FONT color="green">122</FONT>    <a name="line.122"></a>
+<FONT color="green">123</FONT>        /**<a name="line.123"></a>
+<FONT color="green">124</FONT>         * Return the probability density for a particular point.<a name="line.124"></a>
+<FONT color="green">125</FONT>         *<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @param x The point at which the density should be computed.<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @return The pdf at point x.<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @deprecated<a name="line.128"></a>
+<FONT color="green">129</FONT>         */<a name="line.129"></a>
+<FONT color="green">130</FONT>        public double density(Double x) {<a name="line.130"></a>
+<FONT color="green">131</FONT>            return density(x.doubleValue());<a name="line.131"></a>
+<FONT color="green">132</FONT>        }<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>        /**<a name="line.134"></a>
+<FONT color="green">135</FONT>         * Return the probability density for a particular point.<a name="line.135"></a>
+<FONT color="green">136</FONT>         *<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @param x The point at which the density should be computed.<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @return The pdf at point x.<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @since 2.1<a name="line.139"></a>
+<FONT color="green">140</FONT>         */<a name="line.140"></a>
+<FONT color="green">141</FONT>        public double density(double x) {<a name="line.141"></a>
+<FONT color="green">142</FONT>            recomputeZ();<a name="line.142"></a>
+<FONT color="green">143</FONT>            if (x &lt; 0 || x &gt; 1) {<a name="line.143"></a>
+<FONT color="green">144</FONT>                return 0;<a name="line.144"></a>
+<FONT color="green">145</FONT>            } else if (x == 0) {<a name="line.145"></a>
+<FONT color="green">146</FONT>                if (alpha &lt; 1) {<a name="line.146"></a>
+<FONT color="green">147</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.147"></a>
+<FONT color="green">148</FONT>                            "Cannot compute beta density at 0 when alpha = {0,number}", alpha);<a name="line.148"></a>
+<FONT color="green">149</FONT>                }<a name="line.149"></a>
+<FONT color="green">150</FONT>                return 0;<a name="line.150"></a>
+<FONT color="green">151</FONT>            } else if (x == 1) {<a name="line.151"></a>
+<FONT color="green">152</FONT>                if (beta &lt; 1) {<a name="line.152"></a>
+<FONT color="green">153</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.153"></a>
+<FONT color="green">154</FONT>                            "Cannot compute beta density at 1 when beta = %.3g", beta);<a name="line.154"></a>
+<FONT color="green">155</FONT>                }<a name="line.155"></a>
+<FONT color="green">156</FONT>                return 0;<a name="line.156"></a>
+<FONT color="green">157</FONT>            } else {<a name="line.157"></a>
+<FONT color="green">158</FONT>                double logX = Math.log(x);<a name="line.158"></a>
+<FONT color="green">159</FONT>                double log1mX = Math.log1p(-x);<a name="line.159"></a>
+<FONT color="green">160</FONT>                return Math.exp((alpha - 1) * logX + (beta - 1) * log1mX - z);<a name="line.160"></a>
+<FONT color="green">161</FONT>            }<a name="line.161"></a>
+<FONT color="green">162</FONT>        }<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>        /** {@inheritDoc} */<a name="line.164"></a>
+<FONT color="green">165</FONT>        @Override<a name="line.165"></a>
+<FONT color="green">166</FONT>        public double inverseCumulativeProbability(double p) throws MathException {<a name="line.166"></a>
+<FONT color="green">167</FONT>            if (p == 0) {<a name="line.167"></a>
+<FONT color="green">168</FONT>                return 0;<a name="line.168"></a>
+<FONT color="green">169</FONT>            } else if (p == 1) {<a name="line.169"></a>
+<FONT color="green">170</FONT>                return 1;<a name="line.170"></a>
+<FONT color="green">171</FONT>            } else {<a name="line.171"></a>
+<FONT color="green">172</FONT>                return super.inverseCumulativeProbability(p);<a name="line.172"></a>
+<FONT color="green">173</FONT>            }<a name="line.173"></a>
+<FONT color="green">174</FONT>        }<a name="line.174"></a>
+<FONT color="green">175</FONT>    <a name="line.175"></a>
+<FONT color="green">176</FONT>        /** {@inheritDoc} */<a name="line.176"></a>
+<FONT color="green">177</FONT>        @Override<a name="line.177"></a>
+<FONT color="green">178</FONT>        protected double getInitialDomain(double p) {<a name="line.178"></a>
+<FONT color="green">179</FONT>            return p;<a name="line.179"></a>
+<FONT color="green">180</FONT>        }<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>        /** {@inheritDoc} */<a name="line.182"></a>
+<FONT color="green">183</FONT>        @Override<a name="line.183"></a>
+<FONT color="green">184</FONT>        protected double getDomainLowerBound(double p) {<a name="line.184"></a>
+<FONT color="green">185</FONT>            return 0;<a name="line.185"></a>
+<FONT color="green">186</FONT>        }<a name="line.186"></a>
+<FONT color="green">187</FONT>    <a name="line.187"></a>
+<FONT color="green">188</FONT>        /** {@inheritDoc} */<a name="line.188"></a>
+<FONT color="green">189</FONT>        @Override<a name="line.189"></a>
+<FONT color="green">190</FONT>        protected double getDomainUpperBound(double p) {<a name="line.190"></a>
+<FONT color="green">191</FONT>            return 1;<a name="line.191"></a>
+<FONT color="green">192</FONT>        }<a name="line.192"></a>
+<FONT color="green">193</FONT>    <a name="line.193"></a>
+<FONT color="green">194</FONT>        /** {@inheritDoc} */<a name="line.194"></a>
+<FONT color="green">195</FONT>        public double cumulativeProbability(double x) throws MathException {<a name="line.195"></a>
+<FONT color="green">196</FONT>            if (x &lt;= 0) {<a name="line.196"></a>
+<FONT color="green">197</FONT>                return 0;<a name="line.197"></a>
+<FONT color="green">198</FONT>            } else if (x &gt;= 1) {<a name="line.198"></a>
+<FONT color="green">199</FONT>                return 1;<a name="line.199"></a>
+<FONT color="green">200</FONT>            } else {<a name="line.200"></a>
+<FONT color="green">201</FONT>                return Beta.regularizedBeta(x, alpha, beta);<a name="line.201"></a>
+<FONT color="green">202</FONT>            }<a name="line.202"></a>
+<FONT color="green">203</FONT>        }<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>        /** {@inheritDoc} */<a name="line.205"></a>
+<FONT color="green">206</FONT>        @Override<a name="line.206"></a>
+<FONT color="green">207</FONT>        public double cumulativeProbability(double x0, double x1) throws MathException {<a name="line.207"></a>
+<FONT color="green">208</FONT>            return cumulativeProbability(x1) - cumulativeProbability(x0);<a name="line.208"></a>
+<FONT color="green">209</FONT>        }<a name="line.209"></a>
+<FONT color="green">210</FONT>    <a name="line.210"></a>
+<FONT color="green">211</FONT>        /**<a name="line.211"></a>
+<FONT color="green">212</FONT>         * Return the absolute accuracy setting of the solver used to estimate<a name="line.212"></a>
+<FONT color="green">213</FONT>         * inverse cumulative probabilities.<a name="line.213"></a>
+<FONT color="green">214</FONT>         *<a name="line.214"></a>
+<FONT color="green">215</FONT>         * @return the solver absolute accuracy<a name="line.215"></a>
+<FONT color="green">216</FONT>         * @since 2.1<a name="line.216"></a>
+<FONT color="green">217</FONT>         */<a name="line.217"></a>
+<FONT color="green">218</FONT>        @Override<a name="line.218"></a>
+<FONT color="green">219</FONT>        protected double getSolverAbsoluteAccuracy() {<a name="line.219"></a>
+<FONT color="green">220</FONT>            return solverAbsoluteAccuracy;<a name="line.220"></a>
+<FONT color="green">221</FONT>        }<a name="line.221"></a>
+<FONT color="green">222</FONT>    }<a name="line.222"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/BinomialDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,126 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * The Binomial Distribution.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>     * &lt;p&gt;<a name="line.22"></a>
+<FONT color="green">023</FONT>     * References:<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;ul&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/BinomialDistribution.html"&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Binomial Distribution&lt;/a&gt;&lt;/li&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;/ul&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     *<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 920852 $ $Date: 2010-03-09 07:53:44 -0500 (Tue, 09 Mar 2010) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    public interface BinomialDistribution extends IntegerDistribution {<a name="line.32"></a>
+<FONT color="green">033</FONT>        /**<a name="line.33"></a>
+<FONT color="green">034</FONT>         * Access the number of trials for this distribution.<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @return the number of trials.<a name="line.35"></a>
+<FONT color="green">036</FONT>         */<a name="line.36"></a>
+<FONT color="green">037</FONT>        int getNumberOfTrials();<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /**<a name="line.39"></a>
+<FONT color="green">040</FONT>         * Access the probability of success for this distribution.<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @return the probability of success.<a name="line.41"></a>
+<FONT color="green">042</FONT>         */<a name="line.42"></a>
+<FONT color="green">043</FONT>        double getProbabilityOfSuccess();<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**<a name="line.45"></a>
+<FONT color="green">046</FONT>         * Change the number of trials for this distribution.<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @param trials the new number of trials.<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @deprecated as of v2.1<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        @Deprecated<a name="line.50"></a>
+<FONT color="green">051</FONT>        void setNumberOfTrials(int trials);<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Change the probability of success for this distribution.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param p the new probability of success.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @deprecated as of v2.1<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        @Deprecated<a name="line.58"></a>
+<FONT color="green">059</FONT>        void setProbabilityOfSuccess(double p);<a name="line.59"></a>
+<FONT color="green">060</FONT>    }<a name="line.60"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/BinomialDistributionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,287 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.special.Beta;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * The default implementation of {@link BinomialDistribution}.<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @version $Revision: 920852 $ $Date: 2010-03-09 07:53:44 -0500 (Tue, 09 Mar 2010) $<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public class BinomialDistributionImpl extends AbstractIntegerDistribution<a name="line.30"></a>
+<FONT color="green">031</FONT>            implements BinomialDistribution, Serializable {<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** Serializable version identifier */<a name="line.33"></a>
+<FONT color="green">034</FONT>        private static final long serialVersionUID = 6751309484392813623L;<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** The number of trials. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private int numberOfTrials;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** The probability of success. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private double probabilityOfSuccess;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /**<a name="line.42"></a>
+<FONT color="green">043</FONT>         * Create a binomial distribution with the given number of trials and<a name="line.43"></a>
+<FONT color="green">044</FONT>         * probability of success.<a name="line.44"></a>
+<FONT color="green">045</FONT>         *<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param trials the number of trials.<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @param p the probability of success.<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        public BinomialDistributionImpl(int trials, double p) {<a name="line.49"></a>
+<FONT color="green">050</FONT>            super();<a name="line.50"></a>
+<FONT color="green">051</FONT>            setNumberOfTrialsInternal(trials);<a name="line.51"></a>
+<FONT color="green">052</FONT>            setProbabilityOfSuccessInternal(p);<a name="line.52"></a>
+<FONT color="green">053</FONT>        }<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * Access the number of trials for this distribution.<a name="line.56"></a>
+<FONT color="green">057</FONT>         *<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @return the number of trials.<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        public int getNumberOfTrials() {<a name="line.60"></a>
+<FONT color="green">061</FONT>            return numberOfTrials;<a name="line.61"></a>
+<FONT color="green">062</FONT>        }<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /**<a name="line.64"></a>
+<FONT color="green">065</FONT>         * Access the probability of success for this distribution.<a name="line.65"></a>
+<FONT color="green">066</FONT>         *<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @return the probability of success.<a name="line.67"></a>
+<FONT color="green">068</FONT>         */<a name="line.68"></a>
+<FONT color="green">069</FONT>        public double getProbabilityOfSuccess() {<a name="line.69"></a>
+<FONT color="green">070</FONT>            return probabilityOfSuccess;<a name="line.70"></a>
+<FONT color="green">071</FONT>        }<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /**<a name="line.73"></a>
+<FONT color="green">074</FONT>         * Change the number of trials for this distribution.<a name="line.74"></a>
+<FONT color="green">075</FONT>         *<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @param trials the new number of trials.<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @throws IllegalArgumentException if &lt;code&gt;trials&lt;/code&gt; is not a valid<a name="line.77"></a>
+<FONT color="green">078</FONT>         *             number of trials.<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.79"></a>
+<FONT color="green">080</FONT>         */<a name="line.80"></a>
+<FONT color="green">081</FONT>        @Deprecated<a name="line.81"></a>
+<FONT color="green">082</FONT>        public void setNumberOfTrials(int trials) {<a name="line.82"></a>
+<FONT color="green">083</FONT>            setNumberOfTrialsInternal(trials);<a name="line.83"></a>
+<FONT color="green">084</FONT>        }<a name="line.84"></a>
+<FONT color="green">085</FONT>        /**<a name="line.85"></a>
+<FONT color="green">086</FONT>         * Change the number of trials for this distribution.<a name="line.86"></a>
+<FONT color="green">087</FONT>         *<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @param trials the new number of trials.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @throws IllegalArgumentException if &lt;code&gt;trials&lt;/code&gt; is not a valid<a name="line.89"></a>
+<FONT color="green">090</FONT>         *             number of trials.<a name="line.90"></a>
+<FONT color="green">091</FONT>         */<a name="line.91"></a>
+<FONT color="green">092</FONT>        private void setNumberOfTrialsInternal(int trials) {<a name="line.92"></a>
+<FONT color="green">093</FONT>            if (trials &lt; 0) {<a name="line.93"></a>
+<FONT color="green">094</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.94"></a>
+<FONT color="green">095</FONT>                        "number of trials must be non-negative ({0})", trials);<a name="line.95"></a>
+<FONT color="green">096</FONT>            }<a name="line.96"></a>
+<FONT color="green">097</FONT>            numberOfTrials = trials;<a name="line.97"></a>
+<FONT color="green">098</FONT>        }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>        /**<a name="line.100"></a>
+<FONT color="green">101</FONT>         * Change the probability of success for this distribution.<a name="line.101"></a>
+<FONT color="green">102</FONT>         *<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @param p the new probability of success.<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @throws IllegalArgumentException if &lt;code&gt;p&lt;/code&gt; is not a valid<a name="line.104"></a>
+<FONT color="green">105</FONT>         *             probability.<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.106"></a>
+<FONT color="green">107</FONT>         */<a name="line.107"></a>
+<FONT color="green">108</FONT>        @Deprecated<a name="line.108"></a>
+<FONT color="green">109</FONT>        public void setProbabilityOfSuccess(double p) {<a name="line.109"></a>
+<FONT color="green">110</FONT>            setProbabilityOfSuccessInternal(p);<a name="line.110"></a>
+<FONT color="green">111</FONT>        }<a name="line.111"></a>
+<FONT color="green">112</FONT>        /**<a name="line.112"></a>
+<FONT color="green">113</FONT>         * Change the probability of success for this distribution.<a name="line.113"></a>
+<FONT color="green">114</FONT>         *<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @param p the new probability of success.<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @throws IllegalArgumentException if &lt;code&gt;p&lt;/code&gt; is not a valid<a name="line.116"></a>
+<FONT color="green">117</FONT>         *             probability.<a name="line.117"></a>
+<FONT color="green">118</FONT>         */<a name="line.118"></a>
+<FONT color="green">119</FONT>        private void setProbabilityOfSuccessInternal(double p) {<a name="line.119"></a>
+<FONT color="green">120</FONT>            if (p &lt; 0.0 || p &gt; 1.0) {<a name="line.120"></a>
+<FONT color="green">121</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.121"></a>
+<FONT color="green">122</FONT>                        "{0} out of [{1}, {2}] range", p, 0.0, 1.0);<a name="line.122"></a>
+<FONT color="green">123</FONT>            }<a name="line.123"></a>
+<FONT color="green">124</FONT>            probabilityOfSuccess = p;<a name="line.124"></a>
+<FONT color="green">125</FONT>        }<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>        /**<a name="line.127"></a>
+<FONT color="green">128</FONT>         * Access the domain value lower bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.128"></a>
+<FONT color="green">129</FONT>         * bracket a PDF root.<a name="line.129"></a>
+<FONT color="green">130</FONT>         *<a name="line.130"></a>
+<FONT color="green">131</FONT>         * @param p the desired probability for the critical value<a name="line.131"></a>
+<FONT color="green">132</FONT>         * @return domain value lower bound, i.e. P(X &amp;lt; &lt;i&gt;lower bound&lt;/i&gt;) &amp;lt;<a name="line.132"></a>
+<FONT color="green">133</FONT>         *         &lt;code&gt;p&lt;/code&gt;<a name="line.133"></a>
+<FONT color="green">134</FONT>         */<a name="line.134"></a>
+<FONT color="green">135</FONT>        @Override<a name="line.135"></a>
+<FONT color="green">136</FONT>        protected int getDomainLowerBound(double p) {<a name="line.136"></a>
+<FONT color="green">137</FONT>            return -1;<a name="line.137"></a>
+<FONT color="green">138</FONT>        }<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>        /**<a name="line.140"></a>
+<FONT color="green">141</FONT>         * Access the domain value upper bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.141"></a>
+<FONT color="green">142</FONT>         * bracket a PDF root.<a name="line.142"></a>
+<FONT color="green">143</FONT>         *<a name="line.143"></a>
+<FONT color="green">144</FONT>         * @param p the desired probability for the critical value<a name="line.144"></a>
+<FONT color="green">145</FONT>         * @return domain value upper bound, i.e. P(X &amp;lt; &lt;i&gt;upper bound&lt;/i&gt;) &amp;gt;<a name="line.145"></a>
+<FONT color="green">146</FONT>         *         &lt;code&gt;p&lt;/code&gt;<a name="line.146"></a>
+<FONT color="green">147</FONT>         */<a name="line.147"></a>
+<FONT color="green">148</FONT>        @Override<a name="line.148"></a>
+<FONT color="green">149</FONT>        protected int getDomainUpperBound(double p) {<a name="line.149"></a>
+<FONT color="green">150</FONT>            return numberOfTrials;<a name="line.150"></a>
+<FONT color="green">151</FONT>        }<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>        /**<a name="line.153"></a>
+<FONT color="green">154</FONT>         * For this distribution, X, this method returns P(X &amp;le; x).<a name="line.154"></a>
+<FONT color="green">155</FONT>         *<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @param x the value at which the PDF is evaluated.<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @return PDF for this distribution.<a name="line.157"></a>
+<FONT color="green">158</FONT>         * @throws MathException if the cumulative probability can not be computed<a name="line.158"></a>
+<FONT color="green">159</FONT>         *             due to convergence or other numerical errors.<a name="line.159"></a>
+<FONT color="green">160</FONT>         */<a name="line.160"></a>
+<FONT color="green">161</FONT>        @Override<a name="line.161"></a>
+<FONT color="green">162</FONT>        public double cumulativeProbability(int x) throws MathException {<a name="line.162"></a>
+<FONT color="green">163</FONT>            double ret;<a name="line.163"></a>
+<FONT color="green">164</FONT>            if (x &lt; 0) {<a name="line.164"></a>
+<FONT color="green">165</FONT>                ret = 0.0;<a name="line.165"></a>
+<FONT color="green">166</FONT>            } else if (x &gt;= numberOfTrials) {<a name="line.166"></a>
+<FONT color="green">167</FONT>                ret = 1.0;<a name="line.167"></a>
+<FONT color="green">168</FONT>            } else {<a name="line.168"></a>
+<FONT color="green">169</FONT>                ret = 1.0 - Beta.regularizedBeta(getProbabilityOfSuccess(),<a name="line.169"></a>
+<FONT color="green">170</FONT>                        x + 1.0, numberOfTrials - x);<a name="line.170"></a>
+<FONT color="green">171</FONT>            }<a name="line.171"></a>
+<FONT color="green">172</FONT>            return ret;<a name="line.172"></a>
+<FONT color="green">173</FONT>        }<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>        /**<a name="line.175"></a>
+<FONT color="green">176</FONT>         * For this distribution, X, this method returns P(X = x).<a name="line.176"></a>
+<FONT color="green">177</FONT>         *<a name="line.177"></a>
+<FONT color="green">178</FONT>         * @param x the value at which the PMF is evaluated.<a name="line.178"></a>
+<FONT color="green">179</FONT>         * @return PMF for this distribution.<a name="line.179"></a>
+<FONT color="green">180</FONT>         */<a name="line.180"></a>
+<FONT color="green">181</FONT>        public double probability(int x) {<a name="line.181"></a>
+<FONT color="green">182</FONT>            double ret;<a name="line.182"></a>
+<FONT color="green">183</FONT>            if (x &lt; 0 || x &gt; numberOfTrials) {<a name="line.183"></a>
+<FONT color="green">184</FONT>                ret = 0.0;<a name="line.184"></a>
+<FONT color="green">185</FONT>            } else {<a name="line.185"></a>
+<FONT color="green">186</FONT>                ret = Math.exp(SaddlePointExpansion.logBinomialProbability(x,<a name="line.186"></a>
+<FONT color="green">187</FONT>                        numberOfTrials, probabilityOfSuccess,<a name="line.187"></a>
+<FONT color="green">188</FONT>                        1.0 - probabilityOfSuccess));<a name="line.188"></a>
+<FONT color="green">189</FONT>            }<a name="line.189"></a>
+<FONT color="green">190</FONT>            return ret;<a name="line.190"></a>
+<FONT color="green">191</FONT>        }<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>        /**<a name="line.193"></a>
+<FONT color="green">194</FONT>         * For this distribution, X, this method returns the largest x, such that<a name="line.194"></a>
+<FONT color="green">195</FONT>         * P(X &amp;le; x) &amp;le; &lt;code&gt;p&lt;/code&gt;.<a name="line.195"></a>
+<FONT color="green">196</FONT>         * &lt;p&gt;<a name="line.196"></a>
+<FONT color="green">197</FONT>         * Returns &lt;code&gt;-1&lt;/code&gt; for p=0 and &lt;code&gt;Integer.MAX_VALUE&lt;/code&gt; for<a name="line.197"></a>
+<FONT color="green">198</FONT>         * p=1.<a name="line.198"></a>
+<FONT color="green">199</FONT>         * &lt;/p&gt;<a name="line.199"></a>
+<FONT color="green">200</FONT>         *<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @param p the desired probability<a name="line.201"></a>
+<FONT color="green">202</FONT>         * @return the largest x such that P(X &amp;le; x) &lt;= p<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @throws MathException if the inverse cumulative probability can not be<a name="line.203"></a>
+<FONT color="green">204</FONT>         *             computed due to convergence or other numerical errors.<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @throws IllegalArgumentException if p &lt; 0 or p &gt; 1<a name="line.205"></a>
+<FONT color="green">206</FONT>         */<a name="line.206"></a>
+<FONT color="green">207</FONT>        @Override<a name="line.207"></a>
+<FONT color="green">208</FONT>        public int inverseCumulativeProbability(final double p)<a name="line.208"></a>
+<FONT color="green">209</FONT>                throws MathException {<a name="line.209"></a>
+<FONT color="green">210</FONT>            // handle extreme values explicitly<a name="line.210"></a>
+<FONT color="green">211</FONT>            if (p == 0) {<a name="line.211"></a>
+<FONT color="green">212</FONT>                return -1;<a name="line.212"></a>
+<FONT color="green">213</FONT>            }<a name="line.213"></a>
+<FONT color="green">214</FONT>            if (p == 1) {<a name="line.214"></a>
+<FONT color="green">215</FONT>                return Integer.MAX_VALUE;<a name="line.215"></a>
+<FONT color="green">216</FONT>            }<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>            // use default bisection impl<a name="line.218"></a>
+<FONT color="green">219</FONT>            return super.inverseCumulativeProbability(p);<a name="line.219"></a>
+<FONT color="green">220</FONT>        }<a name="line.220"></a>
+<FONT color="green">221</FONT>    }<a name="line.221"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/CauchyDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,129 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.distribution;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Cauchy Distribution.<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;p&gt;<a name="line.23"></a>
+<FONT color="green">024</FONT>     * References:<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;ul&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/CauchyDistribution.html"&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Cauchy Distribution&lt;/a&gt;&lt;/li&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;/ul&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 1.1<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @version $Revision: 920852 $ $Date: 2010-03-09 07:53:44 -0500 (Tue, 09 Mar 2010) $<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public interface CauchyDistribution extends ContinuousDistribution {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /**<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Access the median.<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @return median for this distribution<a name="line.38"></a>
+<FONT color="green">039</FONT>         */<a name="line.39"></a>
+<FONT color="green">040</FONT>        double getMedian();<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /**<a name="line.42"></a>
+<FONT color="green">043</FONT>         * Access the scale parameter.<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @return scale parameter for this distribution<a name="line.44"></a>
+<FONT color="green">045</FONT>         */<a name="line.45"></a>
+<FONT color="green">046</FONT>        double getScale();<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /**<a name="line.48"></a>
+<FONT color="green">049</FONT>         * Modify the median.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @param median for this distribution<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @deprecated as of v2.1<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        @Deprecated<a name="line.53"></a>
+<FONT color="green">054</FONT>        void setMedian(double median);<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /**<a name="line.56"></a>
+<FONT color="green">057</FONT>         * Modify the scale parameter.<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @param s scale parameter for this distribution<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @deprecated as of v2.1<a name="line.59"></a>
+<FONT color="green">060</FONT>         */<a name="line.60"></a>
+<FONT color="green">061</FONT>        @Deprecated<a name="line.61"></a>
+<FONT color="green">062</FONT>        void setScale(double s);<a name="line.62"></a>
+<FONT color="green">063</FONT>    }<a name="line.63"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/CauchyDistributionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,334 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.distribution;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Default implementation of<a name="line.25"></a>
+<FONT color="green">026</FONT>     * {@link org.apache.commons.math.distribution.CauchyDistribution}.<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @since 1.1<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @version $Revision: 925900 $ $Date: 2010-03-21 17:10:07 -0400 (Sun, 21 Mar 2010) $<a name="line.29"></a>
+<FONT color="green">030</FONT>     */<a name="line.30"></a>
+<FONT color="green">031</FONT>    public class CauchyDistributionImpl extends AbstractContinuousDistribution<a name="line.31"></a>
+<FONT color="green">032</FONT>            implements CauchyDistribution, Serializable {<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /**<a name="line.34"></a>
+<FONT color="green">035</FONT>         * Default inverse cumulative probability accuracy<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @since 2.1<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Serializable version identifier */<a name="line.40"></a>
+<FONT color="green">041</FONT>        private static final long serialVersionUID = 8589540077390120676L;<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** The median of this distribution. */<a name="line.43"></a>
+<FONT color="green">044</FONT>        private double median = 0;<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** The scale of this distribution. */<a name="line.46"></a>
+<FONT color="green">047</FONT>        private double scale = 1;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** Inverse cumulative probability accuracy */<a name="line.49"></a>
+<FONT color="green">050</FONT>        private final double solverAbsoluteAccuracy;<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * Creates cauchy distribution with the medain equal to zero and scale<a name="line.53"></a>
+<FONT color="green">054</FONT>         * equal to one.<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public CauchyDistributionImpl(){<a name="line.56"></a>
+<FONT color="green">057</FONT>            this(0.0, 1.0);<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /**<a name="line.60"></a>
+<FONT color="green">061</FONT>         * Create a cauchy distribution using the given median and scale.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param median median for this distribution<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @param s scale parameter for this distribution<a name="line.63"></a>
+<FONT color="green">064</FONT>         */<a name="line.64"></a>
+<FONT color="green">065</FONT>        public CauchyDistributionImpl(double median, double s){<a name="line.65"></a>
+<FONT color="green">066</FONT>            this(median, s, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);<a name="line.66"></a>
+<FONT color="green">067</FONT>        }<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * Create a cauchy distribution using the given median and scale.<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param median median for this distribution<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param s scale parameter for this distribution<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @param inverseCumAccuracy the maximum absolute error in inverse cumulative probability estimates<a name="line.73"></a>
+<FONT color="green">074</FONT>         * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY})<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @since 2.1<a name="line.75"></a>
+<FONT color="green">076</FONT>         */<a name="line.76"></a>
+<FONT color="green">077</FONT>        public CauchyDistributionImpl(double median, double s, double inverseCumAccuracy) {<a name="line.77"></a>
+<FONT color="green">078</FONT>            super();<a name="line.78"></a>
+<FONT color="green">079</FONT>            setMedianInternal(median);<a name="line.79"></a>
+<FONT color="green">080</FONT>            setScaleInternal(s);<a name="line.80"></a>
+<FONT color="green">081</FONT>            solverAbsoluteAccuracy = inverseCumAccuracy;<a name="line.81"></a>
+<FONT color="green">082</FONT>        }<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /**<a name="line.84"></a>
+<FONT color="green">085</FONT>         * For this distribution, X, this method returns P(X &amp;lt; &lt;code&gt;x&lt;/code&gt;).<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @param x the value at which the CDF is evaluated.<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @return CDF evaluted at &lt;code&gt;x&lt;/code&gt;.<a name="line.87"></a>
+<FONT color="green">088</FONT>         */<a name="line.88"></a>
+<FONT color="green">089</FONT>        public double cumulativeProbability(double x) {<a name="line.89"></a>
+<FONT color="green">090</FONT>            return 0.5 + (Math.atan((x - median) / scale) / Math.PI);<a name="line.90"></a>
+<FONT color="green">091</FONT>        }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /**<a name="line.93"></a>
+<FONT color="green">094</FONT>         * Access the median.<a name="line.94"></a>
+<FONT color="green">095</FONT>         * @return median for this distribution<a name="line.95"></a>
+<FONT color="green">096</FONT>         */<a name="line.96"></a>
+<FONT color="green">097</FONT>        public double getMedian() {<a name="line.97"></a>
+<FONT color="green">098</FONT>            return median;<a name="line.98"></a>
+<FONT color="green">099</FONT>        }<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /**<a name="line.101"></a>
+<FONT color="green">102</FONT>         * Access the scale parameter.<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @return scale parameter for this distribution<a name="line.103"></a>
+<FONT color="green">104</FONT>         */<a name="line.104"></a>
+<FONT color="green">105</FONT>        public double getScale() {<a name="line.105"></a>
+<FONT color="green">106</FONT>            return scale;<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /**<a name="line.109"></a>
+<FONT color="green">110</FONT>         * Returns the probability density for a particular point.<a name="line.110"></a>
+<FONT color="green">111</FONT>         *<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @param x The point at which the density should be computed.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @return The pdf at point x.<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @since 2.1<a name="line.114"></a>
+<FONT color="green">115</FONT>         */<a name="line.115"></a>
+<FONT color="green">116</FONT>        @Override<a name="line.116"></a>
+<FONT color="green">117</FONT>        public double density(double x) {<a name="line.117"></a>
+<FONT color="green">118</FONT>            final double dev = x - median;<a name="line.118"></a>
+<FONT color="green">119</FONT>            return (1 / Math.PI) * (scale / (dev * dev + scale * scale));<a name="line.119"></a>
+<FONT color="green">120</FONT>        }<a name="line.120"></a>
+<FONT color="green">121</FONT>    <a name="line.121"></a>
+<FONT color="green">122</FONT>        /**<a name="line.122"></a>
+<FONT color="green">123</FONT>         * For this distribution, X, this method returns the critical point x, such<a name="line.123"></a>
+<FONT color="green">124</FONT>         * that P(X &amp;lt; x) = &lt;code&gt;p&lt;/code&gt;.<a name="line.124"></a>
+<FONT color="green">125</FONT>         * &lt;p&gt;<a name="line.125"></a>
+<FONT color="green">126</FONT>         * Returns &lt;code&gt;Double.NEGATIVE_INFINITY&lt;/code&gt; for p=0 and<a name="line.126"></a>
+<FONT color="green">127</FONT>         * &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt; for p=1.&lt;/p&gt;<a name="line.127"></a>
+<FONT color="green">128</FONT>         *<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @param p the desired probability<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @return x, such that P(X &amp;lt; x) = &lt;code&gt;p&lt;/code&gt;<a name="line.130"></a>
+<FONT color="green">131</FONT>         * @throws IllegalArgumentException if &lt;code&gt;p&lt;/code&gt; is not a valid<a name="line.131"></a>
+<FONT color="green">132</FONT>         *         probability.<a name="line.132"></a>
+<FONT color="green">133</FONT>         */<a name="line.133"></a>
+<FONT color="green">134</FONT>        @Override<a name="line.134"></a>
+<FONT color="green">135</FONT>        public double inverseCumulativeProbability(double p) {<a name="line.135"></a>
+<FONT color="green">136</FONT>            double ret;<a name="line.136"></a>
+<FONT color="green">137</FONT>            if (p &lt; 0.0 || p &gt; 1.0) {<a name="line.137"></a>
+<FONT color="green">138</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.138"></a>
+<FONT color="green">139</FONT>                      "{0} out of [{1}, {2}] range", p, 0.0, 1.0);<a name="line.139"></a>
+<FONT color="green">140</FONT>            } else if (p == 0) {<a name="line.140"></a>
+<FONT color="green">141</FONT>                ret = Double.NEGATIVE_INFINITY;<a name="line.141"></a>
+<FONT color="green">142</FONT>            } else  if (p == 1) {<a name="line.142"></a>
+<FONT color="green">143</FONT>                ret = Double.POSITIVE_INFINITY;<a name="line.143"></a>
+<FONT color="green">144</FONT>            } else {<a name="line.144"></a>
+<FONT color="green">145</FONT>                ret = median + scale * Math.tan(Math.PI * (p - .5));<a name="line.145"></a>
+<FONT color="green">146</FONT>            }<a name="line.146"></a>
+<FONT color="green">147</FONT>            return ret;<a name="line.147"></a>
+<FONT color="green">148</FONT>        }<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>        /**<a name="line.150"></a>
+<FONT color="green">151</FONT>         * Modify the median.<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @param median for this distribution<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.153"></a>
+<FONT color="green">154</FONT>         */<a name="line.154"></a>
+<FONT color="green">155</FONT>        @Deprecated<a name="line.155"></a>
+<FONT color="green">156</FONT>        public void setMedian(double median) {<a name="line.156"></a>
+<FONT color="green">157</FONT>            setMedianInternal(median);<a name="line.157"></a>
+<FONT color="green">158</FONT>        }<a name="line.158"></a>
+<FONT color="green">159</FONT>        /**<a name="line.159"></a>
+<FONT color="green">160</FONT>         * Modify the median.<a name="line.160"></a>
+<FONT color="green">161</FONT>         * @param newMedian for this distribution<a name="line.161"></a>
+<FONT color="green">162</FONT>         */<a name="line.162"></a>
+<FONT color="green">163</FONT>        private void setMedianInternal(double newMedian) {<a name="line.163"></a>
+<FONT color="green">164</FONT>            this.median = newMedian;<a name="line.164"></a>
+<FONT color="green">165</FONT>        }<a name="line.165"></a>
+<FONT color="green">166</FONT>    <a name="line.166"></a>
+<FONT color="green">167</FONT>        /**<a name="line.167"></a>
+<FONT color="green">168</FONT>         * Modify the scale parameter.<a name="line.168"></a>
+<FONT color="green">169</FONT>         * @param s scale parameter for this distribution<a name="line.169"></a>
+<FONT color="green">170</FONT>         * @throws IllegalArgumentException if &lt;code&gt;sd&lt;/code&gt; is not positive.<a name="line.170"></a>
+<FONT color="green">171</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.171"></a>
+<FONT color="green">172</FONT>         */<a name="line.172"></a>
+<FONT color="green">173</FONT>        @Deprecated<a name="line.173"></a>
+<FONT color="green">174</FONT>        public void setScale(double s) {<a name="line.174"></a>
+<FONT color="green">175</FONT>            setScaleInternal(s);<a name="line.175"></a>
+<FONT color="green">176</FONT>        }<a name="line.176"></a>
+<FONT color="green">177</FONT>        /**<a name="line.177"></a>
+<FONT color="green">178</FONT>         * Modify the scale parameter.<a name="line.178"></a>
+<FONT color="green">179</FONT>         * @param s scale parameter for this distribution<a name="line.179"></a>
+<FONT color="green">180</FONT>         * @throws IllegalArgumentException if &lt;code&gt;sd&lt;/code&gt; is not positive.<a name="line.180"></a>
+<FONT color="green">181</FONT>         */<a name="line.181"></a>
+<FONT color="green">182</FONT>        private void setScaleInternal(double s) {<a name="line.182"></a>
+<FONT color="green">183</FONT>            if (s &lt;= 0.0) {<a name="line.183"></a>
+<FONT color="green">184</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.184"></a>
+<FONT color="green">185</FONT>                      "scale must be positive ({0})", s);<a name="line.185"></a>
+<FONT color="green">186</FONT>            }<a name="line.186"></a>
+<FONT color="green">187</FONT>            scale = s;<a name="line.187"></a>
+<FONT color="green">188</FONT>        }<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>        /**<a name="line.190"></a>
+<FONT color="green">191</FONT>         * Access the domain value lower bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.191"></a>
+<FONT color="green">192</FONT>         * bracket a CDF root.  This method is used by<a name="line.192"></a>
+<FONT color="green">193</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.193"></a>
+<FONT color="green">194</FONT>         *<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @param p the desired probability for the critical value<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @return domain value lower bound, i.e.<a name="line.196"></a>
+<FONT color="green">197</FONT>         *         P(X &amp;lt; &lt;i&gt;lower bound&lt;/i&gt;) &amp;lt; &lt;code&gt;p&lt;/code&gt;<a name="line.197"></a>
+<FONT color="green">198</FONT>         */<a name="line.198"></a>
+<FONT color="green">199</FONT>        @Override<a name="line.199"></a>
+<FONT color="green">200</FONT>        protected double getDomainLowerBound(double p) {<a name="line.200"></a>
+<FONT color="green">201</FONT>            double ret;<a name="line.201"></a>
+<FONT color="green">202</FONT>    <a name="line.202"></a>
+<FONT color="green">203</FONT>            if (p &lt; .5) {<a name="line.203"></a>
+<FONT color="green">204</FONT>                ret = -Double.MAX_VALUE;<a name="line.204"></a>
+<FONT color="green">205</FONT>            } else {<a name="line.205"></a>
+<FONT color="green">206</FONT>                ret = median;<a name="line.206"></a>
+<FONT color="green">207</FONT>            }<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>            return ret;<a name="line.209"></a>
+<FONT color="green">210</FONT>        }<a name="line.210"></a>
+<FONT color="green">211</FONT>    <a name="line.211"></a>
+<FONT color="green">212</FONT>        /**<a name="line.212"></a>
+<FONT color="green">213</FONT>         * Access the domain value upper bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.213"></a>
+<FONT color="green">214</FONT>         * bracket a CDF root.  This method is used by<a name="line.214"></a>
+<FONT color="green">215</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.215"></a>
+<FONT color="green">216</FONT>         *<a name="line.216"></a>
+<FONT color="green">217</FONT>         * @param p the desired probability for the critical value<a name="line.217"></a>
+<FONT color="green">218</FONT>         * @return domain value upper bound, i.e.<a name="line.218"></a>
+<FONT color="green">219</FONT>         *         P(X &amp;lt; &lt;i&gt;upper bound&lt;/i&gt;) &amp;gt; &lt;code&gt;p&lt;/code&gt;<a name="line.219"></a>
+<FONT color="green">220</FONT>         */<a name="line.220"></a>
+<FONT color="green">221</FONT>        @Override<a name="line.221"></a>
+<FONT color="green">222</FONT>        protected double getDomainUpperBound(double p) {<a name="line.222"></a>
+<FONT color="green">223</FONT>            double ret;<a name="line.223"></a>
+<FONT color="green">224</FONT>    <a name="line.224"></a>
+<FONT color="green">225</FONT>            if (p &lt; .5) {<a name="line.225"></a>
+<FONT color="green">226</FONT>                ret = median;<a name="line.226"></a>
+<FONT color="green">227</FONT>            } else {<a name="line.227"></a>
+<FONT color="green">228</FONT>                ret = Double.MAX_VALUE;<a name="line.228"></a>
+<FONT color="green">229</FONT>            }<a name="line.229"></a>
+<FONT color="green">230</FONT>    <a name="line.230"></a>
+<FONT color="green">231</FONT>            return ret;<a name="line.231"></a>
+<FONT color="green">232</FONT>        }<a name="line.232"></a>
+<FONT color="green">233</FONT>    <a name="line.233"></a>
+<FONT color="green">234</FONT>        /**<a name="line.234"></a>
+<FONT color="green">235</FONT>         * Access the initial domain value, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.235"></a>
+<FONT color="green">236</FONT>         * bracket a CDF root.  This method is used by<a name="line.236"></a>
+<FONT color="green">237</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.237"></a>
+<FONT color="green">238</FONT>         *<a name="line.238"></a>
+<FONT color="green">239</FONT>         * @param p the desired probability for the critical value<a name="line.239"></a>
+<FONT color="green">240</FONT>         * @return initial domain value<a name="line.240"></a>
+<FONT color="green">241</FONT>         */<a name="line.241"></a>
+<FONT color="green">242</FONT>        @Override<a name="line.242"></a>
+<FONT color="green">243</FONT>        protected double getInitialDomain(double p) {<a name="line.243"></a>
+<FONT color="green">244</FONT>            double ret;<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>            if (p &lt; .5) {<a name="line.246"></a>
+<FONT color="green">247</FONT>                ret = median - scale;<a name="line.247"></a>
+<FONT color="green">248</FONT>            } else if (p &gt; .5) {<a name="line.248"></a>
+<FONT color="green">249</FONT>                ret = median + scale;<a name="line.249"></a>
+<FONT color="green">250</FONT>            } else {<a name="line.250"></a>
+<FONT color="green">251</FONT>                ret = median;<a name="line.251"></a>
+<FONT color="green">252</FONT>            }<a name="line.252"></a>
+<FONT color="green">253</FONT>    <a name="line.253"></a>
+<FONT color="green">254</FONT>            return ret;<a name="line.254"></a>
+<FONT color="green">255</FONT>        }<a name="line.255"></a>
+<FONT color="green">256</FONT>    <a name="line.256"></a>
+<FONT color="green">257</FONT>        /**<a name="line.257"></a>
+<FONT color="green">258</FONT>         * Return the absolute accuracy setting of the solver used to estimate<a name="line.258"></a>
+<FONT color="green">259</FONT>         * inverse cumulative probabilities.<a name="line.259"></a>
+<FONT color="green">260</FONT>         *<a name="line.260"></a>
+<FONT color="green">261</FONT>         * @return the solver absolute accuracy<a name="line.261"></a>
+<FONT color="green">262</FONT>         * @since 2.1<a name="line.262"></a>
+<FONT color="green">263</FONT>         */<a name="line.263"></a>
+<FONT color="green">264</FONT>        @Override<a name="line.264"></a>
+<FONT color="green">265</FONT>        protected double getSolverAbsoluteAccuracy() {<a name="line.265"></a>
+<FONT color="green">266</FONT>            return solverAbsoluteAccuracy;<a name="line.266"></a>
+<FONT color="green">267</FONT>        }<a name="line.267"></a>
+<FONT color="green">268</FONT>    }<a name="line.268"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/ChiSquaredDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,119 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * The Chi-Squared Distribution.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>     * &lt;p&gt;<a name="line.22"></a>
+<FONT color="green">023</FONT>     * References:<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;ul&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/Chi-SquaredDistribution.html"&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Chi-Squared Distribution&lt;/a&gt;&lt;/li&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;/ul&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     *<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 920852 $ $Date: 2010-03-09 07:53:44 -0500 (Tue, 09 Mar 2010) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    public interface ChiSquaredDistribution extends ContinuousDistribution, HasDensity&lt;Double&gt; {<a name="line.32"></a>
+<FONT color="green">033</FONT>        /**<a name="line.33"></a>
+<FONT color="green">034</FONT>         * Modify the degrees of freedom.<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @param degreesOfFreedom the new degrees of freedom.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @deprecated as of v2.1<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        @Deprecated<a name="line.38"></a>
+<FONT color="green">039</FONT>        void setDegreesOfFreedom(double degreesOfFreedom);<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * Access the degrees of freedom.<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @return the degrees of freedom.<a name="line.43"></a>
+<FONT color="green">044</FONT>         */<a name="line.44"></a>
+<FONT color="green">045</FONT>        double getDegreesOfFreedom();<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Return the probability density for a particular point.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @param x  The point at which the density should be computed.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @return  The pdf at point x.<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        double density(Double x);<a name="line.52"></a>
+<FONT color="green">053</FONT>    }<a name="line.53"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,337 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * The default implementation of {@link ChiSquaredDistribution}<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public class ChiSquaredDistributionImpl<a name="line.28"></a>
+<FONT color="green">029</FONT>        extends AbstractContinuousDistribution<a name="line.29"></a>
+<FONT color="green">030</FONT>        implements ChiSquaredDistribution, Serializable  {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /**<a name="line.32"></a>
+<FONT color="green">033</FONT>         * Default inverse cumulative probability accuracy<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @since 2.1<a name="line.34"></a>
+<FONT color="green">035</FONT>         */<a name="line.35"></a>
+<FONT color="green">036</FONT>        public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Serializable version identifier */<a name="line.38"></a>
+<FONT color="green">039</FONT>        private static final long serialVersionUID = -8352658048349159782L;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Internal Gamma distribution. */<a name="line.41"></a>
+<FONT color="green">042</FONT>        private GammaDistribution gamma;<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Inverse cumulative probability accuracy */<a name="line.44"></a>
+<FONT color="green">045</FONT>        private final double solverAbsoluteAccuracy;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Create a Chi-Squared distribution with the given degrees of freedom.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @param df degrees of freedom.<a name="line.49"></a>
+<FONT color="green">050</FONT>         */<a name="line.50"></a>
+<FONT color="green">051</FONT>        public ChiSquaredDistributionImpl(double df) {<a name="line.51"></a>
+<FONT color="green">052</FONT>            this(df, new GammaDistributionImpl(df / 2.0, 2.0));<a name="line.52"></a>
+<FONT color="green">053</FONT>        }<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * Create a Chi-Squared distribution with the given degrees of freedom.<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @param df degrees of freedom.<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @param g the underlying gamma distribution used to compute probabilities.<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @since 1.2<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @deprecated as of 2.1 (to avoid possibly inconsistent state, the<a name="line.60"></a>
+<FONT color="green">061</FONT>         * "GammaDistribution" will be instantiated internally)<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        @Deprecated<a name="line.63"></a>
+<FONT color="green">064</FONT>        public ChiSquaredDistributionImpl(double df, GammaDistribution g) {<a name="line.64"></a>
+<FONT color="green">065</FONT>            super();<a name="line.65"></a>
+<FONT color="green">066</FONT>            setGammaInternal(g);<a name="line.66"></a>
+<FONT color="green">067</FONT>            setDegreesOfFreedomInternal(df);<a name="line.67"></a>
+<FONT color="green">068</FONT>            solverAbsoluteAccuracy = DEFAULT_INVERSE_ABSOLUTE_ACCURACY;<a name="line.68"></a>
+<FONT color="green">069</FONT>        }<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /**<a name="line.71"></a>
+<FONT color="green">072</FONT>         * Create a Chi-Squared distribution with the given degrees of freedom and<a name="line.72"></a>
+<FONT color="green">073</FONT>         * inverse cumulative probability accuracy.<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @param df degrees of freedom.<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @param inverseCumAccuracy the maximum absolute error in inverse cumulative probability estimates<a name="line.75"></a>
+<FONT color="green">076</FONT>         * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY})<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @since 2.1<a name="line.77"></a>
+<FONT color="green">078</FONT>         */<a name="line.78"></a>
+<FONT color="green">079</FONT>        public ChiSquaredDistributionImpl(double df, double inverseCumAccuracy) {<a name="line.79"></a>
+<FONT color="green">080</FONT>            super();<a name="line.80"></a>
+<FONT color="green">081</FONT>            gamma = new GammaDistributionImpl(df / 2.0, 2.0);<a name="line.81"></a>
+<FONT color="green">082</FONT>            setDegreesOfFreedomInternal(df);<a name="line.82"></a>
+<FONT color="green">083</FONT>            solverAbsoluteAccuracy = inverseCumAccuracy;<a name="line.83"></a>
+<FONT color="green">084</FONT>        }<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /**<a name="line.86"></a>
+<FONT color="green">087</FONT>         * Modify the degrees of freedom.<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @param degreesOfFreedom the new degrees of freedom.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.89"></a>
+<FONT color="green">090</FONT>         */<a name="line.90"></a>
+<FONT color="green">091</FONT>        @Deprecated<a name="line.91"></a>
+<FONT color="green">092</FONT>        public void setDegreesOfFreedom(double degreesOfFreedom) {<a name="line.92"></a>
+<FONT color="green">093</FONT>            setDegreesOfFreedomInternal(degreesOfFreedom);<a name="line.93"></a>
+<FONT color="green">094</FONT>        }<a name="line.94"></a>
+<FONT color="green">095</FONT>        /**<a name="line.95"></a>
+<FONT color="green">096</FONT>         * Modify the degrees of freedom.<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @param degreesOfFreedom the new degrees of freedom.<a name="line.97"></a>
+<FONT color="green">098</FONT>         */<a name="line.98"></a>
+<FONT color="green">099</FONT>        private void setDegreesOfFreedomInternal(double degreesOfFreedom) {<a name="line.99"></a>
+<FONT color="green">100</FONT>            gamma.setAlpha(degreesOfFreedom / 2.0);<a name="line.100"></a>
+<FONT color="green">101</FONT>        }<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        /**<a name="line.103"></a>
+<FONT color="green">104</FONT>         * Access the degrees of freedom.<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @return the degrees of freedom.<a name="line.105"></a>
+<FONT color="green">106</FONT>         */<a name="line.106"></a>
+<FONT color="green">107</FONT>        public double getDegreesOfFreedom() {<a name="line.107"></a>
+<FONT color="green">108</FONT>            return gamma.getAlpha() * 2.0;<a name="line.108"></a>
+<FONT color="green">109</FONT>        }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /**<a name="line.111"></a>
+<FONT color="green">112</FONT>         * Return the probability density for a particular point.<a name="line.112"></a>
+<FONT color="green">113</FONT>         *<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param x The point at which the density should be computed.<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @return The pdf at point x.<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @deprecated<a name="line.116"></a>
+<FONT color="green">117</FONT>         */<a name="line.117"></a>
+<FONT color="green">118</FONT>        public double density(Double x) {<a name="line.118"></a>
+<FONT color="green">119</FONT>            return density(x.doubleValue());<a name="line.119"></a>
+<FONT color="green">120</FONT>        }<a name="line.120"></a>
+<FONT color="green">121</FONT>    <a name="line.121"></a>
+<FONT color="green">122</FONT>        /**<a name="line.122"></a>
+<FONT color="green">123</FONT>         * Return the probability density for a particular point.<a name="line.123"></a>
+<FONT color="green">124</FONT>         *<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @param x The point at which the density should be computed.<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @return The pdf at point x.<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @since 2.1<a name="line.127"></a>
+<FONT color="green">128</FONT>         */<a name="line.128"></a>
+<FONT color="green">129</FONT>        @Override<a name="line.129"></a>
+<FONT color="green">130</FONT>        public double density(double x) {<a name="line.130"></a>
+<FONT color="green">131</FONT>            return gamma.density(x);<a name="line.131"></a>
+<FONT color="green">132</FONT>        }<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>        /**<a name="line.134"></a>
+<FONT color="green">135</FONT>         * For this distribution, X, this method returns P(X &amp;lt; x).<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @param x the value at which the CDF is evaluated.<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @return CDF for this distribution.<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @throws MathException if the cumulative probability can not be<a name="line.138"></a>
+<FONT color="green">139</FONT>         *            computed due to convergence or other numerical errors.<a name="line.139"></a>
+<FONT color="green">140</FONT>         */<a name="line.140"></a>
+<FONT color="green">141</FONT>        public double cumulativeProbability(double x) throws MathException {<a name="line.141"></a>
+<FONT color="green">142</FONT>            return gamma.cumulativeProbability(x);<a name="line.142"></a>
+<FONT color="green">143</FONT>        }<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>        /**<a name="line.145"></a>
+<FONT color="green">146</FONT>         * For this distribution, X, this method returns the critical point x, such<a name="line.146"></a>
+<FONT color="green">147</FONT>         * that P(X &amp;lt; x) = &lt;code&gt;p&lt;/code&gt;.<a name="line.147"></a>
+<FONT color="green">148</FONT>         * &lt;p&gt;<a name="line.148"></a>
+<FONT color="green">149</FONT>         * Returns 0 for p=0 and &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt; for p=1.&lt;/p&gt;<a name="line.149"></a>
+<FONT color="green">150</FONT>         *<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @param p the desired probability<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @return x, such that P(X &amp;lt; x) = &lt;code&gt;p&lt;/code&gt;<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @throws MathException if the inverse cumulative probability can not be<a name="line.153"></a>
+<FONT color="green">154</FONT>         *         computed due to convergence or other numerical errors.<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @throws IllegalArgumentException if &lt;code&gt;p&lt;/code&gt; is not a valid<a name="line.155"></a>
+<FONT color="green">156</FONT>         *         probability.<a name="line.156"></a>
+<FONT color="green">157</FONT>         */<a name="line.157"></a>
+<FONT color="green">158</FONT>        @Override<a name="line.158"></a>
+<FONT color="green">159</FONT>        public double inverseCumulativeProbability(final double p)<a name="line.159"></a>
+<FONT color="green">160</FONT>            throws MathException {<a name="line.160"></a>
+<FONT color="green">161</FONT>            if (p == 0) {<a name="line.161"></a>
+<FONT color="green">162</FONT>                return 0d;<a name="line.162"></a>
+<FONT color="green">163</FONT>            }<a name="line.163"></a>
+<FONT color="green">164</FONT>            if (p == 1) {<a name="line.164"></a>
+<FONT color="green">165</FONT>                return Double.POSITIVE_INFINITY;<a name="line.165"></a>
+<FONT color="green">166</FONT>            }<a name="line.166"></a>
+<FONT color="green">167</FONT>            return super.inverseCumulativeProbability(p);<a name="line.167"></a>
+<FONT color="green">168</FONT>        }<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>        /**<a name="line.170"></a>
+<FONT color="green">171</FONT>         * Access the domain value lower bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.171"></a>
+<FONT color="green">172</FONT>         * bracket a CDF root.  This method is used by<a name="line.172"></a>
+<FONT color="green">173</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.173"></a>
+<FONT color="green">174</FONT>         *<a name="line.174"></a>
+<FONT color="green">175</FONT>         * @param p the desired probability for the critical value<a name="line.175"></a>
+<FONT color="green">176</FONT>         * @return domain value lower bound, i.e.<a name="line.176"></a>
+<FONT color="green">177</FONT>         *         P(X &amp;lt; &lt;i&gt;lower bound&lt;/i&gt;) &amp;lt; &lt;code&gt;p&lt;/code&gt;<a name="line.177"></a>
+<FONT color="green">178</FONT>         */<a name="line.178"></a>
+<FONT color="green">179</FONT>        @Override<a name="line.179"></a>
+<FONT color="green">180</FONT>        protected double getDomainLowerBound(double p) {<a name="line.180"></a>
+<FONT color="green">181</FONT>            return Double.MIN_VALUE * gamma.getBeta();<a name="line.181"></a>
+<FONT color="green">182</FONT>        }<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>        /**<a name="line.184"></a>
+<FONT color="green">185</FONT>         * Access the domain value upper bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.185"></a>
+<FONT color="green">186</FONT>         * bracket a CDF root.  This method is used by<a name="line.186"></a>
+<FONT color="green">187</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.187"></a>
+<FONT color="green">188</FONT>         *<a name="line.188"></a>
+<FONT color="green">189</FONT>         * @param p the desired probability for the critical value<a name="line.189"></a>
+<FONT color="green">190</FONT>         * @return domain value upper bound, i.e.<a name="line.190"></a>
+<FONT color="green">191</FONT>         *         P(X &amp;lt; &lt;i&gt;upper bound&lt;/i&gt;) &amp;gt; &lt;code&gt;p&lt;/code&gt;<a name="line.191"></a>
+<FONT color="green">192</FONT>         */<a name="line.192"></a>
+<FONT color="green">193</FONT>        @Override<a name="line.193"></a>
+<FONT color="green">194</FONT>        protected double getDomainUpperBound(double p) {<a name="line.194"></a>
+<FONT color="green">195</FONT>            // NOTE: chi squared is skewed to the left<a name="line.195"></a>
+<FONT color="green">196</FONT>            // NOTE: therefore, P(X &lt; &amp;mu;) &gt; .5<a name="line.196"></a>
+<FONT color="green">197</FONT>    <a name="line.197"></a>
+<FONT color="green">198</FONT>            double ret;<a name="line.198"></a>
+<FONT color="green">199</FONT>    <a name="line.199"></a>
+<FONT color="green">200</FONT>            if (p &lt; .5) {<a name="line.200"></a>
+<FONT color="green">201</FONT>                // use mean<a name="line.201"></a>
+<FONT color="green">202</FONT>                ret = getDegreesOfFreedom();<a name="line.202"></a>
+<FONT color="green">203</FONT>            } else {<a name="line.203"></a>
+<FONT color="green">204</FONT>                // use max<a name="line.204"></a>
+<FONT color="green">205</FONT>                ret = Double.MAX_VALUE;<a name="line.205"></a>
+<FONT color="green">206</FONT>            }<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>            return ret;<a name="line.208"></a>
+<FONT color="green">209</FONT>        }<a name="line.209"></a>
+<FONT color="green">210</FONT>    <a name="line.210"></a>
+<FONT color="green">211</FONT>        /**<a name="line.211"></a>
+<FONT color="green">212</FONT>         * Access the initial domain value, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.212"></a>
+<FONT color="green">213</FONT>         * bracket a CDF root.  This method is used by<a name="line.213"></a>
+<FONT color="green">214</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.214"></a>
+<FONT color="green">215</FONT>         *<a name="line.215"></a>
+<FONT color="green">216</FONT>         * @param p the desired probability for the critical value<a name="line.216"></a>
+<FONT color="green">217</FONT>         * @return initial domain value<a name="line.217"></a>
+<FONT color="green">218</FONT>         */<a name="line.218"></a>
+<FONT color="green">219</FONT>        @Override<a name="line.219"></a>
+<FONT color="green">220</FONT>        protected double getInitialDomain(double p) {<a name="line.220"></a>
+<FONT color="green">221</FONT>            // NOTE: chi squared is skewed to the left<a name="line.221"></a>
+<FONT color="green">222</FONT>            // NOTE: therefore, P(X &lt; &amp;mu;) &gt; .5<a name="line.222"></a>
+<FONT color="green">223</FONT>    <a name="line.223"></a>
+<FONT color="green">224</FONT>            double ret;<a name="line.224"></a>
+<FONT color="green">225</FONT>    <a name="line.225"></a>
+<FONT color="green">226</FONT>            if (p &lt; .5) {<a name="line.226"></a>
+<FONT color="green">227</FONT>                // use 1/2 mean<a name="line.227"></a>
+<FONT color="green">228</FONT>                ret = getDegreesOfFreedom() * .5;<a name="line.228"></a>
+<FONT color="green">229</FONT>            } else {<a name="line.229"></a>
+<FONT color="green">230</FONT>                // use mean<a name="line.230"></a>
+<FONT color="green">231</FONT>                ret = getDegreesOfFreedom();<a name="line.231"></a>
+<FONT color="green">232</FONT>            }<a name="line.232"></a>
+<FONT color="green">233</FONT>    <a name="line.233"></a>
+<FONT color="green">234</FONT>            return ret;<a name="line.234"></a>
+<FONT color="green">235</FONT>        }<a name="line.235"></a>
+<FONT color="green">236</FONT>    <a name="line.236"></a>
+<FONT color="green">237</FONT>        /**<a name="line.237"></a>
+<FONT color="green">238</FONT>         * Modify the underlying gamma distribution.  The caller is responsible for<a name="line.238"></a>
+<FONT color="green">239</FONT>         * insuring the gamma distribution has the proper parameter settings.<a name="line.239"></a>
+<FONT color="green">240</FONT>         * @param g the new distribution.<a name="line.240"></a>
+<FONT color="green">241</FONT>         * @since 1.2 made public<a name="line.241"></a>
+<FONT color="green">242</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.242"></a>
+<FONT color="green">243</FONT>         */<a name="line.243"></a>
+<FONT color="green">244</FONT>        @Deprecated<a name="line.244"></a>
+<FONT color="green">245</FONT>        public void setGamma(GammaDistribution g) {<a name="line.245"></a>
+<FONT color="green">246</FONT>            setGammaInternal(g);<a name="line.246"></a>
+<FONT color="green">247</FONT>        }<a name="line.247"></a>
+<FONT color="green">248</FONT>        /**<a name="line.248"></a>
+<FONT color="green">249</FONT>         * Modify the underlying gamma distribution.  The caller is responsible for<a name="line.249"></a>
+<FONT color="green">250</FONT>         * insuring the gamma distribution has the proper parameter settings.<a name="line.250"></a>
+<FONT color="green">251</FONT>         * @param g the new distribution.<a name="line.251"></a>
+<FONT color="green">252</FONT>         * @since 1.2 made public<a name="line.252"></a>
+<FONT color="green">253</FONT>         */<a name="line.253"></a>
+<FONT color="green">254</FONT>        private void setGammaInternal(GammaDistribution g) {<a name="line.254"></a>
+<FONT color="green">255</FONT>            this.gamma = g;<a name="line.255"></a>
+<FONT color="green">256</FONT>    <a name="line.256"></a>
+<FONT color="green">257</FONT>        }<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>        /**<a name="line.260"></a>
+<FONT color="green">261</FONT>         * Return the absolute accuracy setting of the solver used to estimate<a name="line.261"></a>
+<FONT color="green">262</FONT>         * inverse cumulative probabilities.<a name="line.262"></a>
+<FONT color="green">263</FONT>         *<a name="line.263"></a>
+<FONT color="green">264</FONT>         * @return the solver absolute accuracy<a name="line.264"></a>
+<FONT color="green">265</FONT>         * @since 2.1<a name="line.265"></a>
+<FONT color="green">266</FONT>         */<a name="line.266"></a>
+<FONT color="green">267</FONT>        @Override<a name="line.267"></a>
+<FONT color="green">268</FONT>        protected double getSolverAbsoluteAccuracy() {<a name="line.268"></a>
+<FONT color="green">269</FONT>            return solverAbsoluteAccuracy;<a name="line.269"></a>
+<FONT color="green">270</FONT>        }<a name="line.270"></a>
+<FONT color="green">271</FONT>    }<a name="line.271"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/ContinuousDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,109 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * &lt;p&gt;Base interface for continuous distributions.&lt;/p&gt;<a name="line.22"></a>
+<FONT color="green">023</FONT>     *<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;Note: this interface will be extended in version 3.0 to include<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;br/&gt;&lt;code&gt;public double density(double x)&lt;/code&gt;&lt;br/&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * that is, from version 3.0 forward, continuous distributions &lt;strong&gt;must&lt;/strong&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * include implementations of probability density functions. As of version<a name="line.27"></a>
+<FONT color="green">028</FONT>     * 2.1, all continuous distribution implementations included in commons-math<a name="line.28"></a>
+<FONT color="green">029</FONT>     * provide implementations of this method.&lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 924362 $ $Date: 2010-03-17 12:45:31 -0400 (Wed, 17 Mar 2010) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public interface ContinuousDistribution extends Distribution {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /**<a name="line.35"></a>
+<FONT color="green">036</FONT>         * For this distribution, X, this method returns x such that P(X &amp;lt; x) = p.<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @param p the cumulative probability.<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @return x.<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @throws MathException if the inverse cumulative probability can not be<a name="line.39"></a>
+<FONT color="green">040</FONT>         *            computed due to convergence or other numerical errors.<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        double inverseCumulativeProbability(double p) throws MathException;<a name="line.42"></a>
+<FONT color="green">043</FONT>    }<a name="line.43"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/DiscreteDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,101 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Base interface for discrete distributions.<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     */<a name="line.24"></a>
+<FONT color="green">025</FONT>    public interface DiscreteDistribution extends Distribution {<a name="line.25"></a>
+<FONT color="green">026</FONT>        /**<a name="line.26"></a>
+<FONT color="green">027</FONT>         * For a random variable X whose values are distributed according<a name="line.27"></a>
+<FONT color="green">028</FONT>         * to this distribution, this method returns P(X = x). In other words, this<a name="line.28"></a>
+<FONT color="green">029</FONT>         * method represents the probability mass function, or PMF for the distribution.<a name="line.29"></a>
+<FONT color="green">030</FONT>         *<a name="line.30"></a>
+<FONT color="green">031</FONT>         * @param x the value at which the probability mass function is evaluated.<a name="line.31"></a>
+<FONT color="green">032</FONT>         * @return the value of the probability mass function at x<a name="line.32"></a>
+<FONT color="green">033</FONT>         */<a name="line.33"></a>
+<FONT color="green">034</FONT>        double probability(double x);<a name="line.34"></a>
+<FONT color="green">035</FONT>    }<a name="line.35"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/Distribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,121 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Base interface for probability distributions.<a name="line.22"></a>
+<FONT color="green">023</FONT>     *<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     */<a name="line.25"></a>
+<FONT color="green">026</FONT>    public interface Distribution {<a name="line.26"></a>
+<FONT color="green">027</FONT>        /**<a name="line.27"></a>
+<FONT color="green">028</FONT>         * For a random variable X whose values are distributed according<a name="line.28"></a>
+<FONT color="green">029</FONT>         * to this distribution, this method returns P(X &amp;le; x).  In other words,<a name="line.29"></a>
+<FONT color="green">030</FONT>         * this method represents the  (cumulative) distribution function, or<a name="line.30"></a>
+<FONT color="green">031</FONT>         * CDF, for this distribution.<a name="line.31"></a>
+<FONT color="green">032</FONT>         *<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @param x the value at which the distribution function is evaluated.<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @return the probability that a random variable with this<a name="line.34"></a>
+<FONT color="green">035</FONT>         * distribution takes a value less than or equal to &lt;code&gt;x&lt;/code&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @throws MathException if the cumulative probability can not be<a name="line.36"></a>
+<FONT color="green">037</FONT>         * computed due to convergence or other numerical errors.<a name="line.37"></a>
+<FONT color="green">038</FONT>         */<a name="line.38"></a>
+<FONT color="green">039</FONT>        double cumulativeProbability(double x) throws MathException;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * For a random variable X whose values are distributed according<a name="line.42"></a>
+<FONT color="green">043</FONT>         * to this distribution, this method returns P(x0 &amp;le; X &amp;le; x1).<a name="line.43"></a>
+<FONT color="green">044</FONT>         *<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @param x0 the (inclusive) lower bound<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param x1 the (inclusive) upper bound<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @return the probability that a random variable with this distribution<a name="line.47"></a>
+<FONT color="green">048</FONT>         * will take a value between &lt;code&gt;x0&lt;/code&gt; and &lt;code&gt;x1&lt;/code&gt;,<a name="line.48"></a>
+<FONT color="green">049</FONT>         * including the endpoints<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @throws MathException if the cumulative probability can not be<a name="line.50"></a>
+<FONT color="green">051</FONT>         * computed due to convergence or other numerical errors.<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @throws IllegalArgumentException if &lt;code&gt;x0 &gt; x1&lt;/code&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        double cumulativeProbability(double x0, double x1) throws MathException;<a name="line.54"></a>
+<FONT color="green">055</FONT>    }<a name="line.55"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/ExponentialDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,119 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * The Exponential Distribution.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>     * &lt;p&gt;<a name="line.22"></a>
+<FONT color="green">023</FONT>     * References:<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;ul&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/ExponentialDistribution.html"&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Exponential Distribution&lt;/a&gt;&lt;/li&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;/ul&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     *<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 920852 $ $Date: 2010-03-09 07:53:44 -0500 (Tue, 09 Mar 2010) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    public interface ExponentialDistribution extends ContinuousDistribution, HasDensity&lt;Double&gt; {<a name="line.32"></a>
+<FONT color="green">033</FONT>        /**<a name="line.33"></a>
+<FONT color="green">034</FONT>         * Modify the mean.<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @param mean the new mean.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @deprecated as of v2.1<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        @Deprecated<a name="line.38"></a>
+<FONT color="green">039</FONT>        void setMean(double mean);<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * Access the mean.<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @return the mean.<a name="line.43"></a>
+<FONT color="green">044</FONT>         */<a name="line.44"></a>
+<FONT color="green">045</FONT>        double getMean();<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Return the probability density for a particular point.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @param x  The point at which the density should be computed.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @return  The pdf at point x.<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        double density(Double x);<a name="line.52"></a>
+<FONT color="green">053</FONT>    }<a name="line.53"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/ExponentialDistributionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,312 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * The default implementation of {@link ExponentialDistribution}.<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 925900 $ $Date: 2010-03-21 17:10:07 -0400 (Sun, 21 Mar 2010) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public class ExponentialDistributionImpl extends AbstractContinuousDistribution<a name="line.29"></a>
+<FONT color="green">030</FONT>        implements ExponentialDistribution, Serializable {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /**<a name="line.32"></a>
+<FONT color="green">033</FONT>         * Default inverse cumulative probability accuracy<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @since 2.1<a name="line.34"></a>
+<FONT color="green">035</FONT>         */<a name="line.35"></a>
+<FONT color="green">036</FONT>        public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Serializable version identifier */<a name="line.38"></a>
+<FONT color="green">039</FONT>        private static final long serialVersionUID = 2401296428283614780L;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** The mean of this distribution. */<a name="line.41"></a>
+<FONT color="green">042</FONT>        private double mean;<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Inverse cumulative probability accuracy */<a name="line.44"></a>
+<FONT color="green">045</FONT>        private final double solverAbsoluteAccuracy;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Create a exponential distribution with the given mean.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @param mean mean of this distribution.<a name="line.49"></a>
+<FONT color="green">050</FONT>         */<a name="line.50"></a>
+<FONT color="green">051</FONT>        public ExponentialDistributionImpl(double mean) {<a name="line.51"></a>
+<FONT color="green">052</FONT>            this(mean, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);<a name="line.52"></a>
+<FONT color="green">053</FONT>        }<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * Create a exponential distribution with the given mean.<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @param mean mean of this distribution.<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @param inverseCumAccuracy the maximum absolute error in inverse cumulative probability estimates<a name="line.58"></a>
+<FONT color="green">059</FONT>         * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY})<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @since 2.1<a name="line.60"></a>
+<FONT color="green">061</FONT>         */<a name="line.61"></a>
+<FONT color="green">062</FONT>        public ExponentialDistributionImpl(double mean, double inverseCumAccuracy) {<a name="line.62"></a>
+<FONT color="green">063</FONT>            super();<a name="line.63"></a>
+<FONT color="green">064</FONT>            setMeanInternal(mean);<a name="line.64"></a>
+<FONT color="green">065</FONT>            solverAbsoluteAccuracy = inverseCumAccuracy;<a name="line.65"></a>
+<FONT color="green">066</FONT>        }<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /**<a name="line.68"></a>
+<FONT color="green">069</FONT>         * Modify the mean.<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @param mean the new mean.<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @throws IllegalArgumentException if &lt;code&gt;mean&lt;/code&gt; is not positive.<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        @Deprecated<a name="line.74"></a>
+<FONT color="green">075</FONT>        public void setMean(double mean) {<a name="line.75"></a>
+<FONT color="green">076</FONT>            setMeanInternal(mean);<a name="line.76"></a>
+<FONT color="green">077</FONT>        }<a name="line.77"></a>
+<FONT color="green">078</FONT>        /**<a name="line.78"></a>
+<FONT color="green">079</FONT>         * Modify the mean.<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @param newMean the new mean.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @throws IllegalArgumentException if &lt;code&gt;newMean&lt;/code&gt; is not positive.<a name="line.81"></a>
+<FONT color="green">082</FONT>         */<a name="line.82"></a>
+<FONT color="green">083</FONT>        private void setMeanInternal(double newMean) {<a name="line.83"></a>
+<FONT color="green">084</FONT>            if (newMean &lt;= 0.0) {<a name="line.84"></a>
+<FONT color="green">085</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.85"></a>
+<FONT color="green">086</FONT>                      "mean must be positive ({0})", newMean);<a name="line.86"></a>
+<FONT color="green">087</FONT>            }<a name="line.87"></a>
+<FONT color="green">088</FONT>            this.mean = newMean;<a name="line.88"></a>
+<FONT color="green">089</FONT>        }<a name="line.89"></a>
+<FONT color="green">090</FONT>    <a name="line.90"></a>
+<FONT color="green">091</FONT>        /**<a name="line.91"></a>
+<FONT color="green">092</FONT>         * Access the mean.<a name="line.92"></a>
+<FONT color="green">093</FONT>         * @return the mean.<a name="line.93"></a>
+<FONT color="green">094</FONT>         */<a name="line.94"></a>
+<FONT color="green">095</FONT>        public double getMean() {<a name="line.95"></a>
+<FONT color="green">096</FONT>            return mean;<a name="line.96"></a>
+<FONT color="green">097</FONT>        }<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>        /**<a name="line.99"></a>
+<FONT color="green">100</FONT>         * Return the probability density for a particular point.<a name="line.100"></a>
+<FONT color="green">101</FONT>         *<a name="line.101"></a>
+<FONT color="green">102</FONT>         * @param x The point at which the density should be computed.<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @return The pdf at point x.<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @deprecated - use density(double)<a name="line.104"></a>
+<FONT color="green">105</FONT>         */<a name="line.105"></a>
+<FONT color="green">106</FONT>        public double density(Double x) {<a name="line.106"></a>
+<FONT color="green">107</FONT>            return density(x.doubleValue());<a name="line.107"></a>
+<FONT color="green">108</FONT>        }<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>        /**<a name="line.110"></a>
+<FONT color="green">111</FONT>         * Return the probability density for a particular point.<a name="line.111"></a>
+<FONT color="green">112</FONT>         *<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param x The point at which the density should be computed.<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @return The pdf at point x.<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @since 2.1<a name="line.115"></a>
+<FONT color="green">116</FONT>         */<a name="line.116"></a>
+<FONT color="green">117</FONT>        @Override<a name="line.117"></a>
+<FONT color="green">118</FONT>        public double density(double x) {<a name="line.118"></a>
+<FONT color="green">119</FONT>            if (x &lt; 0) {<a name="line.119"></a>
+<FONT color="green">120</FONT>                return 0;<a name="line.120"></a>
+<FONT color="green">121</FONT>            }<a name="line.121"></a>
+<FONT color="green">122</FONT>            return Math.exp(-x / mean) / mean;<a name="line.122"></a>
+<FONT color="green">123</FONT>        }<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>        /**<a name="line.125"></a>
+<FONT color="green">126</FONT>         * For this distribution, X, this method returns P(X &amp;lt; x).<a name="line.126"></a>
+<FONT color="green">127</FONT>         *<a name="line.127"></a>
+<FONT color="green">128</FONT>         * The implementation of this method is based on:<a name="line.128"></a>
+<FONT color="green">129</FONT>         * &lt;ul&gt;<a name="line.129"></a>
+<FONT color="green">130</FONT>         * &lt;li&gt;<a name="line.130"></a>
+<FONT color="green">131</FONT>         * &lt;a href="http://mathworld.wolfram.com/ExponentialDistribution.html"&gt;<a name="line.131"></a>
+<FONT color="green">132</FONT>         * Exponential Distribution&lt;/a&gt;, equation (1).&lt;/li&gt;<a name="line.132"></a>
+<FONT color="green">133</FONT>         * &lt;/ul&gt;<a name="line.133"></a>
+<FONT color="green">134</FONT>         *<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @param x the value at which the CDF is evaluated.<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @return CDF for this distribution.<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @throws MathException if the cumulative probability can not be<a name="line.137"></a>
+<FONT color="green">138</FONT>         *            computed due to convergence or other numerical errors.<a name="line.138"></a>
+<FONT color="green">139</FONT>         */<a name="line.139"></a>
+<FONT color="green">140</FONT>        public double cumulativeProbability(double x) throws MathException{<a name="line.140"></a>
+<FONT color="green">141</FONT>            double ret;<a name="line.141"></a>
+<FONT color="green">142</FONT>            if (x &lt;= 0.0) {<a name="line.142"></a>
+<FONT color="green">143</FONT>                ret = 0.0;<a name="line.143"></a>
+<FONT color="green">144</FONT>            } else {<a name="line.144"></a>
+<FONT color="green">145</FONT>                ret = 1.0 - Math.exp(-x / mean);<a name="line.145"></a>
+<FONT color="green">146</FONT>            }<a name="line.146"></a>
+<FONT color="green">147</FONT>            return ret;<a name="line.147"></a>
+<FONT color="green">148</FONT>        }<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>        /**<a name="line.150"></a>
+<FONT color="green">151</FONT>         * For this distribution, X, this method returns the critical point x, such<a name="line.151"></a>
+<FONT color="green">152</FONT>         * that P(X &amp;lt; x) = &lt;code&gt;p&lt;/code&gt;.<a name="line.152"></a>
+<FONT color="green">153</FONT>         * &lt;p&gt;<a name="line.153"></a>
+<FONT color="green">154</FONT>         * Returns 0 for p=0 and &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt; for p=1.&lt;/p&gt;<a name="line.154"></a>
+<FONT color="green">155</FONT>         *<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @param p the desired probability<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @return x, such that P(X &amp;lt; x) = &lt;code&gt;p&lt;/code&gt;<a name="line.157"></a>
+<FONT color="green">158</FONT>         * @throws MathException if the inverse cumulative probability can not be<a name="line.158"></a>
+<FONT color="green">159</FONT>         *            computed due to convergence or other numerical errors.<a name="line.159"></a>
+<FONT color="green">160</FONT>         * @throws IllegalArgumentException if p &lt; 0 or p &gt; 1.<a name="line.160"></a>
+<FONT color="green">161</FONT>         */<a name="line.161"></a>
+<FONT color="green">162</FONT>        @Override<a name="line.162"></a>
+<FONT color="green">163</FONT>        public double inverseCumulativeProbability(double p) throws MathException {<a name="line.163"></a>
+<FONT color="green">164</FONT>            double ret;<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>            if (p &lt; 0.0 || p &gt; 1.0) {<a name="line.166"></a>
+<FONT color="green">167</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.167"></a>
+<FONT color="green">168</FONT>                      "{0} out of [{1}, {2}] range", p, 0.0, 1.0);<a name="line.168"></a>
+<FONT color="green">169</FONT>            } else if (p == 1.0) {<a name="line.169"></a>
+<FONT color="green">170</FONT>                ret = Double.POSITIVE_INFINITY;<a name="line.170"></a>
+<FONT color="green">171</FONT>            } else {<a name="line.171"></a>
+<FONT color="green">172</FONT>                ret = -mean * Math.log(1.0 - p);<a name="line.172"></a>
+<FONT color="green">173</FONT>            }<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>            return ret;<a name="line.175"></a>
+<FONT color="green">176</FONT>        }<a name="line.176"></a>
+<FONT color="green">177</FONT>    <a name="line.177"></a>
+<FONT color="green">178</FONT>        /**<a name="line.178"></a>
+<FONT color="green">179</FONT>         * Access the domain value lower bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.179"></a>
+<FONT color="green">180</FONT>         * bracket a CDF root.<a name="line.180"></a>
+<FONT color="green">181</FONT>         *<a name="line.181"></a>
+<FONT color="green">182</FONT>         * @param p the desired probability for the critical value<a name="line.182"></a>
+<FONT color="green">183</FONT>         * @return domain value lower bound, i.e.<a name="line.183"></a>
+<FONT color="green">184</FONT>         *         P(X &amp;lt; &lt;i&gt;lower bound&lt;/i&gt;) &amp;lt; &lt;code&gt;p&lt;/code&gt;<a name="line.184"></a>
+<FONT color="green">185</FONT>         */<a name="line.185"></a>
+<FONT color="green">186</FONT>        @Override<a name="line.186"></a>
+<FONT color="green">187</FONT>        protected double getDomainLowerBound(double p) {<a name="line.187"></a>
+<FONT color="green">188</FONT>            return 0;<a name="line.188"></a>
+<FONT color="green">189</FONT>        }<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>        /**<a name="line.191"></a>
+<FONT color="green">192</FONT>         * Access the domain value upper bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.192"></a>
+<FONT color="green">193</FONT>         * bracket a CDF root.<a name="line.193"></a>
+<FONT color="green">194</FONT>         *<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @param p the desired probability for the critical value<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @return domain value upper bound, i.e.<a name="line.196"></a>
+<FONT color="green">197</FONT>         *         P(X &amp;lt; &lt;i&gt;upper bound&lt;/i&gt;) &amp;gt; &lt;code&gt;p&lt;/code&gt;<a name="line.197"></a>
+<FONT color="green">198</FONT>         */<a name="line.198"></a>
+<FONT color="green">199</FONT>        @Override<a name="line.199"></a>
+<FONT color="green">200</FONT>        protected double getDomainUpperBound(double p) {<a name="line.200"></a>
+<FONT color="green">201</FONT>            // NOTE: exponential is skewed to the left<a name="line.201"></a>
+<FONT color="green">202</FONT>            // NOTE: therefore, P(X &lt; &amp;mu;) &gt; .5<a name="line.202"></a>
+<FONT color="green">203</FONT>    <a name="line.203"></a>
+<FONT color="green">204</FONT>            if (p &lt; .5) {<a name="line.204"></a>
+<FONT color="green">205</FONT>                // use mean<a name="line.205"></a>
+<FONT color="green">206</FONT>                return mean;<a name="line.206"></a>
+<FONT color="green">207</FONT>            } else {<a name="line.207"></a>
+<FONT color="green">208</FONT>                // use max<a name="line.208"></a>
+<FONT color="green">209</FONT>                return Double.MAX_VALUE;<a name="line.209"></a>
+<FONT color="green">210</FONT>            }<a name="line.210"></a>
+<FONT color="green">211</FONT>        }<a name="line.211"></a>
+<FONT color="green">212</FONT>    <a name="line.212"></a>
+<FONT color="green">213</FONT>        /**<a name="line.213"></a>
+<FONT color="green">214</FONT>         * Access the initial domain value, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.214"></a>
+<FONT color="green">215</FONT>         * bracket a CDF root.<a name="line.215"></a>
+<FONT color="green">216</FONT>         *<a name="line.216"></a>
+<FONT color="green">217</FONT>         * @param p the desired probability for the critical value<a name="line.217"></a>
+<FONT color="green">218</FONT>         * @return initial domain value<a name="line.218"></a>
+<FONT color="green">219</FONT>         */<a name="line.219"></a>
+<FONT color="green">220</FONT>        @Override<a name="line.220"></a>
+<FONT color="green">221</FONT>        protected double getInitialDomain(double p) {<a name="line.221"></a>
+<FONT color="green">222</FONT>            // TODO: try to improve on this estimate<a name="line.222"></a>
+<FONT color="green">223</FONT>            // TODO: what should really happen here is not derive from AbstractContinuousDistribution<a name="line.223"></a>
+<FONT color="green">224</FONT>            // TODO: because the inverse cumulative distribution is simple.<a name="line.224"></a>
+<FONT color="green">225</FONT>            // Exponential is skewed to the left, therefore, P(X &lt; &amp;mu;) &gt; .5<a name="line.225"></a>
+<FONT color="green">226</FONT>            if (p &lt; .5) {<a name="line.226"></a>
+<FONT color="green">227</FONT>                // use 1/2 mean<a name="line.227"></a>
+<FONT color="green">228</FONT>                return mean * .5;<a name="line.228"></a>
+<FONT color="green">229</FONT>            } else {<a name="line.229"></a>
+<FONT color="green">230</FONT>                // use mean<a name="line.230"></a>
+<FONT color="green">231</FONT>                return mean;<a name="line.231"></a>
+<FONT color="green">232</FONT>            }<a name="line.232"></a>
+<FONT color="green">233</FONT>        }<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>        /**<a name="line.235"></a>
+<FONT color="green">236</FONT>         * Return the absolute accuracy setting of the solver used to estimate<a name="line.236"></a>
+<FONT color="green">237</FONT>         * inverse cumulative probabilities.<a name="line.237"></a>
+<FONT color="green">238</FONT>         *<a name="line.238"></a>
+<FONT color="green">239</FONT>         * @return the solver absolute accuracy<a name="line.239"></a>
+<FONT color="green">240</FONT>         * @since 2.1<a name="line.240"></a>
+<FONT color="green">241</FONT>         */<a name="line.241"></a>
+<FONT color="green">242</FONT>        @Override<a name="line.242"></a>
+<FONT color="green">243</FONT>        protected double getSolverAbsoluteAccuracy() {<a name="line.243"></a>
+<FONT color="green">244</FONT>            return solverAbsoluteAccuracy;<a name="line.244"></a>
+<FONT color="green">245</FONT>        }<a name="line.245"></a>
+<FONT color="green">246</FONT>    }<a name="line.246"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/FDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,126 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * F-Distribution.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>     * &lt;p&gt;<a name="line.22"></a>
+<FONT color="green">023</FONT>     * References:<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;ul&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/F-Distribution.html"&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * F-Distribution&lt;/a&gt;&lt;/li&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;/ul&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     *<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 920852 $ $Date: 2010-03-09 07:53:44 -0500 (Tue, 09 Mar 2010) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    public interface FDistribution extends ContinuousDistribution {<a name="line.32"></a>
+<FONT color="green">033</FONT>        /**<a name="line.33"></a>
+<FONT color="green">034</FONT>         * Modify the numerator degrees of freedom.<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @param degreesOfFreedom the new numerator degrees of freedom.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @deprecated as of v2.1<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        @Deprecated<a name="line.38"></a>
+<FONT color="green">039</FONT>        void setNumeratorDegreesOfFreedom(double degreesOfFreedom);<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * Access the numerator degrees of freedom.<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @return the numerator degrees of freedom.<a name="line.43"></a>
+<FONT color="green">044</FONT>         */<a name="line.44"></a>
+<FONT color="green">045</FONT>        double getNumeratorDegreesOfFreedom();<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Modify the denominator degrees of freedom.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @param degreesOfFreedom the new denominator degrees of freedom.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @deprecated as of v2.1<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        @Deprecated<a name="line.52"></a>
+<FONT color="green">053</FONT>        void setDenominatorDegreesOfFreedom(double degreesOfFreedom);<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * Access the denominator degrees of freedom.<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @return the denominator degrees of freedom.<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        double getDenominatorDegreesOfFreedom();<a name="line.59"></a>
+<FONT color="green">060</FONT>    }<a name="line.60"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/FDistributionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,349 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.special.Beta;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Default implementation of<a name="line.26"></a>
+<FONT color="green">027</FONT>     * {@link org.apache.commons.math.distribution.FDistribution}.<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @version $Revision: 925897 $ $Date: 2010-03-21 17:06:46 -0400 (Sun, 21 Mar 2010) $<a name="line.29"></a>
+<FONT color="green">030</FONT>     */<a name="line.30"></a>
+<FONT color="green">031</FONT>    public class FDistributionImpl<a name="line.31"></a>
+<FONT color="green">032</FONT>        extends AbstractContinuousDistribution<a name="line.32"></a>
+<FONT color="green">033</FONT>        implements FDistribution, Serializable  {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /**<a name="line.35"></a>
+<FONT color="green">036</FONT>         * Default inverse cumulative probability accuracy<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @since 2.1<a name="line.37"></a>
+<FONT color="green">038</FONT>         */<a name="line.38"></a>
+<FONT color="green">039</FONT>        public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Message for non positive degrees of freddom. */<a name="line.41"></a>
+<FONT color="green">042</FONT>        private static final String NON_POSITIVE_DEGREES_OF_FREEDOM_MESSAGE =<a name="line.42"></a>
+<FONT color="green">043</FONT>            "degrees of freedom must be positive ({0})";<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Serializable version identifier */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private static final long serialVersionUID = -8516354193418641566L;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** The numerator degrees of freedom*/<a name="line.48"></a>
+<FONT color="green">049</FONT>        private double numeratorDegreesOfFreedom;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /** The numerator degrees of freedom*/<a name="line.51"></a>
+<FONT color="green">052</FONT>        private double denominatorDegreesOfFreedom;<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /** Inverse cumulative probability accuracy */<a name="line.54"></a>
+<FONT color="green">055</FONT>        private final double solverAbsoluteAccuracy;<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /**<a name="line.57"></a>
+<FONT color="green">058</FONT>         * Create a F distribution using the given degrees of freedom.<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @param numeratorDegreesOfFreedom the numerator degrees of freedom.<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @param denominatorDegreesOfFreedom the denominator degrees of freedom.<a name="line.60"></a>
+<FONT color="green">061</FONT>         */<a name="line.61"></a>
+<FONT color="green">062</FONT>        public FDistributionImpl(double numeratorDegreesOfFreedom,<a name="line.62"></a>
+<FONT color="green">063</FONT>                                 double denominatorDegreesOfFreedom) {<a name="line.63"></a>
+<FONT color="green">064</FONT>            this(numeratorDegreesOfFreedom, denominatorDegreesOfFreedom, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);<a name="line.64"></a>
+<FONT color="green">065</FONT>        }<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /**<a name="line.67"></a>
+<FONT color="green">068</FONT>         * Create a F distribution using the given degrees of freedom and inverse cumulative probability accuracy.<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @param numeratorDegreesOfFreedom the numerator degrees of freedom.<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @param denominatorDegreesOfFreedom the denominator degrees of freedom.<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param inverseCumAccuracy the maximum absolute error in inverse cumulative probability estimates<a name="line.71"></a>
+<FONT color="green">072</FONT>         * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY})<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @since 2.1<a name="line.73"></a>
+<FONT color="green">074</FONT>         */<a name="line.74"></a>
+<FONT color="green">075</FONT>        public FDistributionImpl(double numeratorDegreesOfFreedom, double denominatorDegreesOfFreedom,<a name="line.75"></a>
+<FONT color="green">076</FONT>                double inverseCumAccuracy) {<a name="line.76"></a>
+<FONT color="green">077</FONT>            super();<a name="line.77"></a>
+<FONT color="green">078</FONT>            setNumeratorDegreesOfFreedomInternal(numeratorDegreesOfFreedom);<a name="line.78"></a>
+<FONT color="green">079</FONT>            setDenominatorDegreesOfFreedomInternal(denominatorDegreesOfFreedom);<a name="line.79"></a>
+<FONT color="green">080</FONT>            solverAbsoluteAccuracy = inverseCumAccuracy;<a name="line.80"></a>
+<FONT color="green">081</FONT>        }<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /**<a name="line.83"></a>
+<FONT color="green">084</FONT>         * Returns the probability density for a particular point.<a name="line.84"></a>
+<FONT color="green">085</FONT>         *<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @param x The point at which the density should be computed.<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @return The pdf at point x.<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @since 2.1<a name="line.88"></a>
+<FONT color="green">089</FONT>         */<a name="line.89"></a>
+<FONT color="green">090</FONT>        @Override<a name="line.90"></a>
+<FONT color="green">091</FONT>        public double density(double x) {<a name="line.91"></a>
+<FONT color="green">092</FONT>            final double nhalf = numeratorDegreesOfFreedom / 2;<a name="line.92"></a>
+<FONT color="green">093</FONT>            final double mhalf = denominatorDegreesOfFreedom / 2;<a name="line.93"></a>
+<FONT color="green">094</FONT>            final double logx = Math.log(x);<a name="line.94"></a>
+<FONT color="green">095</FONT>            final double logn = Math.log(numeratorDegreesOfFreedom);<a name="line.95"></a>
+<FONT color="green">096</FONT>            final double logm = Math.log(denominatorDegreesOfFreedom);<a name="line.96"></a>
+<FONT color="green">097</FONT>            final double lognxm = Math.log(numeratorDegreesOfFreedom * x + denominatorDegreesOfFreedom);<a name="line.97"></a>
+<FONT color="green">098</FONT>            return Math.exp(nhalf*logn + nhalf*logx - logx + mhalf*logm - nhalf*lognxm -<a name="line.98"></a>
+<FONT color="green">099</FONT>                   mhalf*lognxm - Beta.logBeta(nhalf, mhalf));<a name="line.99"></a>
+<FONT color="green">100</FONT>        }<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>        /**<a name="line.102"></a>
+<FONT color="green">103</FONT>         * For this distribution, X, this method returns P(X &amp;lt; x).<a name="line.103"></a>
+<FONT color="green">104</FONT>         *<a name="line.104"></a>
+<FONT color="green">105</FONT>         * The implementation of this method is based on:<a name="line.105"></a>
+<FONT color="green">106</FONT>         * &lt;ul&gt;<a name="line.106"></a>
+<FONT color="green">107</FONT>         * &lt;li&gt;<a name="line.107"></a>
+<FONT color="green">108</FONT>         * &lt;a href="http://mathworld.wolfram.com/F-Distribution.html"&gt;<a name="line.108"></a>
+<FONT color="green">109</FONT>         * F-Distribution&lt;/a&gt;, equation (4).&lt;/li&gt;<a name="line.109"></a>
+<FONT color="green">110</FONT>         * &lt;/ul&gt;<a name="line.110"></a>
+<FONT color="green">111</FONT>         *<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @param x the value at which the CDF is evaluated.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @return CDF for this distribution.<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @throws MathException if the cumulative probability can not be<a name="line.114"></a>
+<FONT color="green">115</FONT>         *            computed due to convergence or other numerical errors.<a name="line.115"></a>
+<FONT color="green">116</FONT>         */<a name="line.116"></a>
+<FONT color="green">117</FONT>        public double cumulativeProbability(double x) throws MathException {<a name="line.117"></a>
+<FONT color="green">118</FONT>            double ret;<a name="line.118"></a>
+<FONT color="green">119</FONT>            if (x &lt;= 0.0) {<a name="line.119"></a>
+<FONT color="green">120</FONT>                ret = 0.0;<a name="line.120"></a>
+<FONT color="green">121</FONT>            } else {<a name="line.121"></a>
+<FONT color="green">122</FONT>                double n = numeratorDegreesOfFreedom;<a name="line.122"></a>
+<FONT color="green">123</FONT>                double m = denominatorDegreesOfFreedom;<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>                ret = Beta.regularizedBeta((n * x) / (m + n * x),<a name="line.125"></a>
+<FONT color="green">126</FONT>                    0.5 * n,<a name="line.126"></a>
+<FONT color="green">127</FONT>                    0.5 * m);<a name="line.127"></a>
+<FONT color="green">128</FONT>            }<a name="line.128"></a>
+<FONT color="green">129</FONT>            return ret;<a name="line.129"></a>
+<FONT color="green">130</FONT>        }<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>        /**<a name="line.132"></a>
+<FONT color="green">133</FONT>         * For this distribution, X, this method returns the critical point x, such<a name="line.133"></a>
+<FONT color="green">134</FONT>         * that P(X &amp;lt; x) = &lt;code&gt;p&lt;/code&gt;.<a name="line.134"></a>
+<FONT color="green">135</FONT>         * &lt;p&gt;<a name="line.135"></a>
+<FONT color="green">136</FONT>         * Returns 0 for p=0 and &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt; for p=1.&lt;/p&gt;<a name="line.136"></a>
+<FONT color="green">137</FONT>         *<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @param p the desired probability<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @return x, such that P(X &amp;lt; x) = &lt;code&gt;p&lt;/code&gt;<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @throws MathException if the inverse cumulative probability can not be<a name="line.140"></a>
+<FONT color="green">141</FONT>         *         computed due to convergence or other numerical errors.<a name="line.141"></a>
+<FONT color="green">142</FONT>         * @throws IllegalArgumentException if &lt;code&gt;p&lt;/code&gt; is not a valid<a name="line.142"></a>
+<FONT color="green">143</FONT>         *         probability.<a name="line.143"></a>
+<FONT color="green">144</FONT>         */<a name="line.144"></a>
+<FONT color="green">145</FONT>        @Override<a name="line.145"></a>
+<FONT color="green">146</FONT>        public double inverseCumulativeProbability(final double p)<a name="line.146"></a>
+<FONT color="green">147</FONT>            throws MathException {<a name="line.147"></a>
+<FONT color="green">148</FONT>            if (p == 0) {<a name="line.148"></a>
+<FONT color="green">149</FONT>                return 0d;<a name="line.149"></a>
+<FONT color="green">150</FONT>            }<a name="line.150"></a>
+<FONT color="green">151</FONT>            if (p == 1) {<a name="line.151"></a>
+<FONT color="green">152</FONT>                return Double.POSITIVE_INFINITY;<a name="line.152"></a>
+<FONT color="green">153</FONT>            }<a name="line.153"></a>
+<FONT color="green">154</FONT>            return super.inverseCumulativeProbability(p);<a name="line.154"></a>
+<FONT color="green">155</FONT>        }<a name="line.155"></a>
+<FONT color="green">156</FONT>    <a name="line.156"></a>
+<FONT color="green">157</FONT>        /**<a name="line.157"></a>
+<FONT color="green">158</FONT>         * Access the domain value lower bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.158"></a>
+<FONT color="green">159</FONT>         * bracket a CDF root.  This method is used by<a name="line.159"></a>
+<FONT color="green">160</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.160"></a>
+<FONT color="green">161</FONT>         *<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @param p the desired probability for the critical value<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @return domain value lower bound, i.e.<a name="line.163"></a>
+<FONT color="green">164</FONT>         *         P(X &amp;lt; &lt;i&gt;lower bound&lt;/i&gt;) &amp;lt; &lt;code&gt;p&lt;/code&gt;<a name="line.164"></a>
+<FONT color="green">165</FONT>         */<a name="line.165"></a>
+<FONT color="green">166</FONT>        @Override<a name="line.166"></a>
+<FONT color="green">167</FONT>        protected double getDomainLowerBound(double p) {<a name="line.167"></a>
+<FONT color="green">168</FONT>            return 0.0;<a name="line.168"></a>
+<FONT color="green">169</FONT>        }<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>        /**<a name="line.171"></a>
+<FONT color="green">172</FONT>         * Access the domain value upper bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.172"></a>
+<FONT color="green">173</FONT>         * bracket a CDF root.  This method is used by<a name="line.173"></a>
+<FONT color="green">174</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.174"></a>
+<FONT color="green">175</FONT>         *<a name="line.175"></a>
+<FONT color="green">176</FONT>         * @param p the desired probability for the critical value<a name="line.176"></a>
+<FONT color="green">177</FONT>         * @return domain value upper bound, i.e.<a name="line.177"></a>
+<FONT color="green">178</FONT>         *         P(X &amp;lt; &lt;i&gt;upper bound&lt;/i&gt;) &amp;gt; &lt;code&gt;p&lt;/code&gt;<a name="line.178"></a>
+<FONT color="green">179</FONT>         */<a name="line.179"></a>
+<FONT color="green">180</FONT>        @Override<a name="line.180"></a>
+<FONT color="green">181</FONT>        protected double getDomainUpperBound(double p) {<a name="line.181"></a>
+<FONT color="green">182</FONT>            return Double.MAX_VALUE;<a name="line.182"></a>
+<FONT color="green">183</FONT>        }<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>        /**<a name="line.185"></a>
+<FONT color="green">186</FONT>         * Access the initial domain value, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.186"></a>
+<FONT color="green">187</FONT>         * bracket a CDF root.  This method is used by<a name="line.187"></a>
+<FONT color="green">188</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.188"></a>
+<FONT color="green">189</FONT>         *<a name="line.189"></a>
+<FONT color="green">190</FONT>         * @param p the desired probability for the critical value<a name="line.190"></a>
+<FONT color="green">191</FONT>         * @return initial domain value<a name="line.191"></a>
+<FONT color="green">192</FONT>         */<a name="line.192"></a>
+<FONT color="green">193</FONT>        @Override<a name="line.193"></a>
+<FONT color="green">194</FONT>        protected double getInitialDomain(double p) {<a name="line.194"></a>
+<FONT color="green">195</FONT>            double ret = 1.0;<a name="line.195"></a>
+<FONT color="green">196</FONT>            double d = denominatorDegreesOfFreedom;<a name="line.196"></a>
+<FONT color="green">197</FONT>            if (d &gt; 2.0) {<a name="line.197"></a>
+<FONT color="green">198</FONT>                // use mean<a name="line.198"></a>
+<FONT color="green">199</FONT>                ret = d / (d - 2.0);<a name="line.199"></a>
+<FONT color="green">200</FONT>            }<a name="line.200"></a>
+<FONT color="green">201</FONT>            return ret;<a name="line.201"></a>
+<FONT color="green">202</FONT>        }<a name="line.202"></a>
+<FONT color="green">203</FONT>    <a name="line.203"></a>
+<FONT color="green">204</FONT>        /**<a name="line.204"></a>
+<FONT color="green">205</FONT>         * Modify the numerator degrees of freedom.<a name="line.205"></a>
+<FONT color="green">206</FONT>         * @param degreesOfFreedom the new numerator degrees of freedom.<a name="line.206"></a>
+<FONT color="green">207</FONT>         * @throws IllegalArgumentException if &lt;code&gt;degreesOfFreedom&lt;/code&gt; is not<a name="line.207"></a>
+<FONT color="green">208</FONT>         *         positive.<a name="line.208"></a>
+<FONT color="green">209</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.209"></a>
+<FONT color="green">210</FONT>         */<a name="line.210"></a>
+<FONT color="green">211</FONT>        @Deprecated<a name="line.211"></a>
+<FONT color="green">212</FONT>        public void setNumeratorDegreesOfFreedom(double degreesOfFreedom) {<a name="line.212"></a>
+<FONT color="green">213</FONT>            setNumeratorDegreesOfFreedomInternal(degreesOfFreedom);<a name="line.213"></a>
+<FONT color="green">214</FONT>        }<a name="line.214"></a>
+<FONT color="green">215</FONT>    <a name="line.215"></a>
+<FONT color="green">216</FONT>        /**<a name="line.216"></a>
+<FONT color="green">217</FONT>         * Modify the numerator degrees of freedom.<a name="line.217"></a>
+<FONT color="green">218</FONT>         * @param degreesOfFreedom the new numerator degrees of freedom.<a name="line.218"></a>
+<FONT color="green">219</FONT>         * @throws IllegalArgumentException if &lt;code&gt;degreesOfFreedom&lt;/code&gt; is not<a name="line.219"></a>
+<FONT color="green">220</FONT>         *         positive.<a name="line.220"></a>
+<FONT color="green">221</FONT>         */<a name="line.221"></a>
+<FONT color="green">222</FONT>        private void setNumeratorDegreesOfFreedomInternal(double degreesOfFreedom) {<a name="line.222"></a>
+<FONT color="green">223</FONT>            if (degreesOfFreedom &lt;= 0.0) {<a name="line.223"></a>
+<FONT color="green">224</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.224"></a>
+<FONT color="green">225</FONT>                      NON_POSITIVE_DEGREES_OF_FREEDOM_MESSAGE, degreesOfFreedom);<a name="line.225"></a>
+<FONT color="green">226</FONT>            }<a name="line.226"></a>
+<FONT color="green">227</FONT>            this.numeratorDegreesOfFreedom = degreesOfFreedom;<a name="line.227"></a>
+<FONT color="green">228</FONT>        }<a name="line.228"></a>
+<FONT color="green">229</FONT>    <a name="line.229"></a>
+<FONT color="green">230</FONT>        /**<a name="line.230"></a>
+<FONT color="green">231</FONT>         * Access the numerator degrees of freedom.<a name="line.231"></a>
+<FONT color="green">232</FONT>         * @return the numerator degrees of freedom.<a name="line.232"></a>
+<FONT color="green">233</FONT>         */<a name="line.233"></a>
+<FONT color="green">234</FONT>        public double getNumeratorDegreesOfFreedom() {<a name="line.234"></a>
+<FONT color="green">235</FONT>            return numeratorDegreesOfFreedom;<a name="line.235"></a>
+<FONT color="green">236</FONT>        }<a name="line.236"></a>
+<FONT color="green">237</FONT>    <a name="line.237"></a>
+<FONT color="green">238</FONT>        /**<a name="line.238"></a>
+<FONT color="green">239</FONT>         * Modify the denominator degrees of freedom.<a name="line.239"></a>
+<FONT color="green">240</FONT>         * @param degreesOfFreedom the new denominator degrees of freedom.<a name="line.240"></a>
+<FONT color="green">241</FONT>         * @throws IllegalArgumentException if &lt;code&gt;degreesOfFreedom&lt;/code&gt; is not<a name="line.241"></a>
+<FONT color="green">242</FONT>         *         positive.<a name="line.242"></a>
+<FONT color="green">243</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.243"></a>
+<FONT color="green">244</FONT>         */<a name="line.244"></a>
+<FONT color="green">245</FONT>        @Deprecated<a name="line.245"></a>
+<FONT color="green">246</FONT>        public void setDenominatorDegreesOfFreedom(double degreesOfFreedom) {<a name="line.246"></a>
+<FONT color="green">247</FONT>            setDenominatorDegreesOfFreedomInternal(degreesOfFreedom);<a name="line.247"></a>
+<FONT color="green">248</FONT>        }<a name="line.248"></a>
+<FONT color="green">249</FONT>    <a name="line.249"></a>
+<FONT color="green">250</FONT>        /**<a name="line.250"></a>
+<FONT color="green">251</FONT>         * Modify the denominator degrees of freedom.<a name="line.251"></a>
+<FONT color="green">252</FONT>         * @param degreesOfFreedom the new denominator degrees of freedom.<a name="line.252"></a>
+<FONT color="green">253</FONT>         * @throws IllegalArgumentException if &lt;code&gt;degreesOfFreedom&lt;/code&gt; is not<a name="line.253"></a>
+<FONT color="green">254</FONT>         *         positive.<a name="line.254"></a>
+<FONT color="green">255</FONT>         */<a name="line.255"></a>
+<FONT color="green">256</FONT>        private void setDenominatorDegreesOfFreedomInternal(double degreesOfFreedom) {<a name="line.256"></a>
+<FONT color="green">257</FONT>            if (degreesOfFreedom &lt;= 0.0) {<a name="line.257"></a>
+<FONT color="green">258</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.258"></a>
+<FONT color="green">259</FONT>                      NON_POSITIVE_DEGREES_OF_FREEDOM_MESSAGE, degreesOfFreedom);<a name="line.259"></a>
+<FONT color="green">260</FONT>            }<a name="line.260"></a>
+<FONT color="green">261</FONT>            this.denominatorDegreesOfFreedom = degreesOfFreedom;<a name="line.261"></a>
+<FONT color="green">262</FONT>        }<a name="line.262"></a>
+<FONT color="green">263</FONT>    <a name="line.263"></a>
+<FONT color="green">264</FONT>        /**<a name="line.264"></a>
+<FONT color="green">265</FONT>         * Access the denominator degrees of freedom.<a name="line.265"></a>
+<FONT color="green">266</FONT>         * @return the denominator degrees of freedom.<a name="line.266"></a>
+<FONT color="green">267</FONT>         */<a name="line.267"></a>
+<FONT color="green">268</FONT>        public double getDenominatorDegreesOfFreedom() {<a name="line.268"></a>
+<FONT color="green">269</FONT>            return denominatorDegreesOfFreedom;<a name="line.269"></a>
+<FONT color="green">270</FONT>        }<a name="line.270"></a>
+<FONT color="green">271</FONT>    <a name="line.271"></a>
+<FONT color="green">272</FONT>        /**<a name="line.272"></a>
+<FONT color="green">273</FONT>         * Return the absolute accuracy setting of the solver used to estimate<a name="line.273"></a>
+<FONT color="green">274</FONT>         * inverse cumulative probabilities.<a name="line.274"></a>
+<FONT color="green">275</FONT>         *<a name="line.275"></a>
+<FONT color="green">276</FONT>         * @return the solver absolute accuracy<a name="line.276"></a>
+<FONT color="green">277</FONT>         * @since 2.1<a name="line.277"></a>
+<FONT color="green">278</FONT>         */<a name="line.278"></a>
+<FONT color="green">279</FONT>        @Override<a name="line.279"></a>
+<FONT color="green">280</FONT>        protected double getSolverAbsoluteAccuracy() {<a name="line.280"></a>
+<FONT color="green">281</FONT>            return solverAbsoluteAccuracy;<a name="line.281"></a>
+<FONT color="green">282</FONT>        }<a name="line.282"></a>
+<FONT color="green">283</FONT>    }<a name="line.283"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/GammaDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,133 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * The Gamma Distribution.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>     * &lt;p&gt;<a name="line.22"></a>
+<FONT color="green">023</FONT>     * References:<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;ul&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/GammaDistribution.html"&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Gamma Distribution&lt;/a&gt;&lt;/li&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;/ul&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     *<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 920852 $ $Date: 2010-03-09 07:53:44 -0500 (Tue, 09 Mar 2010) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    public interface GammaDistribution extends ContinuousDistribution, HasDensity&lt;Double&gt; {<a name="line.32"></a>
+<FONT color="green">033</FONT>        /**<a name="line.33"></a>
+<FONT color="green">034</FONT>         * Modify the shape parameter, alpha.<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @param alpha the new shape parameter.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @deprecated as of v2.1<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        @Deprecated<a name="line.38"></a>
+<FONT color="green">039</FONT>        void setAlpha(double alpha);<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * Access the shape parameter, alpha<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @return alpha.<a name="line.43"></a>
+<FONT color="green">044</FONT>         */<a name="line.44"></a>
+<FONT color="green">045</FONT>        double getAlpha();<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Modify the scale parameter, beta.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @param beta the new scale parameter.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @deprecated as of v2.1<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        @Deprecated<a name="line.52"></a>
+<FONT color="green">053</FONT>        void setBeta(double beta);<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * Access the scale parameter, beta<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @return beta.<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        double getBeta();<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Return the probability density for a particular point.<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @param x  The point at which the density should be computed.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @return  The pdf at point x.<a name="line.64"></a>
+<FONT color="green">065</FONT>         */<a name="line.65"></a>
+<FONT color="green">066</FONT>        double density(Double x);<a name="line.66"></a>
+<FONT color="green">067</FONT>    }<a name="line.67"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/GammaDistributionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,364 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.special.Gamma;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * The default implementation of {@link GammaDistribution}.<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @version $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public class GammaDistributionImpl extends AbstractContinuousDistribution<a name="line.30"></a>
+<FONT color="green">031</FONT>        implements GammaDistribution, Serializable  {<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /**<a name="line.33"></a>
+<FONT color="green">034</FONT>         * Default inverse cumulative probability accuracy<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @since 2.1<a name="line.35"></a>
+<FONT color="green">036</FONT>         */<a name="line.36"></a>
+<FONT color="green">037</FONT>        public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Serializable version identifier */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private static final long serialVersionUID = -3239549463135430361L;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** The shape parameter. */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private double alpha;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** The scale parameter. */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private double beta;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** Inverse cumulative probability accuracy */<a name="line.48"></a>
+<FONT color="green">049</FONT>        private final double solverAbsoluteAccuracy;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /**<a name="line.51"></a>
+<FONT color="green">052</FONT>         * Create a new gamma distribution with the given alpha and beta values.<a name="line.52"></a>
+<FONT color="green">053</FONT>         * @param alpha the shape parameter.<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @param beta the scale parameter.<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public GammaDistributionImpl(double alpha, double beta) {<a name="line.56"></a>
+<FONT color="green">057</FONT>            this(alpha, beta, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /**<a name="line.60"></a>
+<FONT color="green">061</FONT>         * Create a new gamma distribution with the given alpha and beta values.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param alpha the shape parameter.<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @param beta the scale parameter.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @param inverseCumAccuracy the maximum absolute error in inverse cumulative probability estimates<a name="line.64"></a>
+<FONT color="green">065</FONT>         * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY})<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @since 2.1<a name="line.66"></a>
+<FONT color="green">067</FONT>         */<a name="line.67"></a>
+<FONT color="green">068</FONT>        public GammaDistributionImpl(double alpha, double beta, double inverseCumAccuracy) {<a name="line.68"></a>
+<FONT color="green">069</FONT>            super();<a name="line.69"></a>
+<FONT color="green">070</FONT>            setAlphaInternal(alpha);<a name="line.70"></a>
+<FONT color="green">071</FONT>            setBetaInternal(beta);<a name="line.71"></a>
+<FONT color="green">072</FONT>            solverAbsoluteAccuracy = inverseCumAccuracy;<a name="line.72"></a>
+<FONT color="green">073</FONT>        }<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /**<a name="line.75"></a>
+<FONT color="green">076</FONT>         * For this distribution, X, this method returns P(X &amp;lt; x).<a name="line.76"></a>
+<FONT color="green">077</FONT>         *<a name="line.77"></a>
+<FONT color="green">078</FONT>         * The implementation of this method is based on:<a name="line.78"></a>
+<FONT color="green">079</FONT>         * &lt;ul&gt;<a name="line.79"></a>
+<FONT color="green">080</FONT>         * &lt;li&gt;<a name="line.80"></a>
+<FONT color="green">081</FONT>         * &lt;a href="http://mathworld.wolfram.com/Chi-SquaredDistribution.html"&gt;<a name="line.81"></a>
+<FONT color="green">082</FONT>         * Chi-Squared Distribution&lt;/a&gt;, equation (9).&lt;/li&gt;<a name="line.82"></a>
+<FONT color="green">083</FONT>         * &lt;li&gt;Casella, G., &amp; Berger, R. (1990). &lt;i&gt;Statistical Inference&lt;/i&gt;.<a name="line.83"></a>
+<FONT color="green">084</FONT>         * Belmont, CA: Duxbury Press.&lt;/li&gt;<a name="line.84"></a>
+<FONT color="green">085</FONT>         * &lt;/ul&gt;<a name="line.85"></a>
+<FONT color="green">086</FONT>         *<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @param x the value at which the CDF is evaluated.<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @return CDF for this distribution.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @throws MathException if the cumulative probability can not be<a name="line.89"></a>
+<FONT color="green">090</FONT>         *            computed due to convergence or other numerical errors.<a name="line.90"></a>
+<FONT color="green">091</FONT>         */<a name="line.91"></a>
+<FONT color="green">092</FONT>        public double cumulativeProbability(double x) throws MathException{<a name="line.92"></a>
+<FONT color="green">093</FONT>            double ret;<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>            if (x &lt;= 0.0) {<a name="line.95"></a>
+<FONT color="green">096</FONT>                ret = 0.0;<a name="line.96"></a>
+<FONT color="green">097</FONT>            } else {<a name="line.97"></a>
+<FONT color="green">098</FONT>                ret = Gamma.regularizedGammaP(alpha, x / beta);<a name="line.98"></a>
+<FONT color="green">099</FONT>            }<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>            return ret;<a name="line.101"></a>
+<FONT color="green">102</FONT>        }<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /**<a name="line.104"></a>
+<FONT color="green">105</FONT>         * For this distribution, X, this method returns the critical point x, such<a name="line.105"></a>
+<FONT color="green">106</FONT>         * that P(X &amp;lt; x) = &lt;code&gt;p&lt;/code&gt;.<a name="line.106"></a>
+<FONT color="green">107</FONT>         * &lt;p&gt;<a name="line.107"></a>
+<FONT color="green">108</FONT>         * Returns 0 for p=0 and &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt; for p=1.&lt;/p&gt;<a name="line.108"></a>
+<FONT color="green">109</FONT>         *<a name="line.109"></a>
+<FONT color="green">110</FONT>         * @param p the desired probability<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @return x, such that P(X &amp;lt; x) = &lt;code&gt;p&lt;/code&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @throws MathException if the inverse cumulative probability can not be<a name="line.112"></a>
+<FONT color="green">113</FONT>         *         computed due to convergence or other numerical errors.<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @throws IllegalArgumentException if &lt;code&gt;p&lt;/code&gt; is not a valid<a name="line.114"></a>
+<FONT color="green">115</FONT>         *         probability.<a name="line.115"></a>
+<FONT color="green">116</FONT>         */<a name="line.116"></a>
+<FONT color="green">117</FONT>        @Override<a name="line.117"></a>
+<FONT color="green">118</FONT>        public double inverseCumulativeProbability(final double p)<a name="line.118"></a>
+<FONT color="green">119</FONT>        throws MathException {<a name="line.119"></a>
+<FONT color="green">120</FONT>            if (p == 0) {<a name="line.120"></a>
+<FONT color="green">121</FONT>                return 0d;<a name="line.121"></a>
+<FONT color="green">122</FONT>            }<a name="line.122"></a>
+<FONT color="green">123</FONT>            if (p == 1) {<a name="line.123"></a>
+<FONT color="green">124</FONT>                return Double.POSITIVE_INFINITY;<a name="line.124"></a>
+<FONT color="green">125</FONT>            }<a name="line.125"></a>
+<FONT color="green">126</FONT>            return super.inverseCumulativeProbability(p);<a name="line.126"></a>
+<FONT color="green">127</FONT>        }<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>        /**<a name="line.129"></a>
+<FONT color="green">130</FONT>         * Modify the shape parameter, alpha.<a name="line.130"></a>
+<FONT color="green">131</FONT>         * @param alpha the new shape parameter.<a name="line.131"></a>
+<FONT color="green">132</FONT>         * @throws IllegalArgumentException if &lt;code&gt;alpha&lt;/code&gt; is not positive.<a name="line.132"></a>
+<FONT color="green">133</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.133"></a>
+<FONT color="green">134</FONT>         */<a name="line.134"></a>
+<FONT color="green">135</FONT>        @Deprecated<a name="line.135"></a>
+<FONT color="green">136</FONT>        public void setAlpha(double alpha) {<a name="line.136"></a>
+<FONT color="green">137</FONT>            setAlphaInternal(alpha);<a name="line.137"></a>
+<FONT color="green">138</FONT>        }<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>        /**<a name="line.140"></a>
+<FONT color="green">141</FONT>         * Modify the shape parameter, alpha.<a name="line.141"></a>
+<FONT color="green">142</FONT>         * @param newAlpha the new shape parameter.<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @throws IllegalArgumentException if &lt;code&gt;newAlpha&lt;/code&gt; is not positive.<a name="line.143"></a>
+<FONT color="green">144</FONT>         */<a name="line.144"></a>
+<FONT color="green">145</FONT>        private void setAlphaInternal(double newAlpha) {<a name="line.145"></a>
+<FONT color="green">146</FONT>            if (newAlpha &lt;= 0.0) {<a name="line.146"></a>
+<FONT color="green">147</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.147"></a>
+<FONT color="green">148</FONT>                      "alpha must be positive ({0})",<a name="line.148"></a>
+<FONT color="green">149</FONT>                      newAlpha);<a name="line.149"></a>
+<FONT color="green">150</FONT>            }<a name="line.150"></a>
+<FONT color="green">151</FONT>            this.alpha = newAlpha;<a name="line.151"></a>
+<FONT color="green">152</FONT>        }<a name="line.152"></a>
+<FONT color="green">153</FONT>    <a name="line.153"></a>
+<FONT color="green">154</FONT>        /**<a name="line.154"></a>
+<FONT color="green">155</FONT>         * Access the shape parameter, alpha<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @return alpha.<a name="line.156"></a>
+<FONT color="green">157</FONT>         */<a name="line.157"></a>
+<FONT color="green">158</FONT>        public double getAlpha() {<a name="line.158"></a>
+<FONT color="green">159</FONT>            return alpha;<a name="line.159"></a>
+<FONT color="green">160</FONT>        }<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>        /**<a name="line.162"></a>
+<FONT color="green">163</FONT>         * Modify the scale parameter, beta.<a name="line.163"></a>
+<FONT color="green">164</FONT>         * @param newBeta the new scale parameter.<a name="line.164"></a>
+<FONT color="green">165</FONT>         * @throws IllegalArgumentException if &lt;code&gt;newBeta&lt;/code&gt; is not positive.<a name="line.165"></a>
+<FONT color="green">166</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.166"></a>
+<FONT color="green">167</FONT>         */<a name="line.167"></a>
+<FONT color="green">168</FONT>        @Deprecated<a name="line.168"></a>
+<FONT color="green">169</FONT>        public void setBeta(double newBeta) {<a name="line.169"></a>
+<FONT color="green">170</FONT>            setBetaInternal(newBeta);<a name="line.170"></a>
+<FONT color="green">171</FONT>        }<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>        /**<a name="line.173"></a>
+<FONT color="green">174</FONT>         * Modify the scale parameter, beta.<a name="line.174"></a>
+<FONT color="green">175</FONT>         * @param newBeta the new scale parameter.<a name="line.175"></a>
+<FONT color="green">176</FONT>         * @throws IllegalArgumentException if &lt;code&gt;newBeta&lt;/code&gt; is not positive.<a name="line.176"></a>
+<FONT color="green">177</FONT>         */<a name="line.177"></a>
+<FONT color="green">178</FONT>        private void setBetaInternal(double newBeta) {<a name="line.178"></a>
+<FONT color="green">179</FONT>            if (newBeta &lt;= 0.0) {<a name="line.179"></a>
+<FONT color="green">180</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.180"></a>
+<FONT color="green">181</FONT>                      "beta must be positive ({0})",<a name="line.181"></a>
+<FONT color="green">182</FONT>                      newBeta);<a name="line.182"></a>
+<FONT color="green">183</FONT>            }<a name="line.183"></a>
+<FONT color="green">184</FONT>            this.beta = newBeta;<a name="line.184"></a>
+<FONT color="green">185</FONT>        }<a name="line.185"></a>
+<FONT color="green">186</FONT>    <a name="line.186"></a>
+<FONT color="green">187</FONT>        /**<a name="line.187"></a>
+<FONT color="green">188</FONT>         * Access the scale parameter, beta<a name="line.188"></a>
+<FONT color="green">189</FONT>         * @return beta.<a name="line.189"></a>
+<FONT color="green">190</FONT>         */<a name="line.190"></a>
+<FONT color="green">191</FONT>        public double getBeta() {<a name="line.191"></a>
+<FONT color="green">192</FONT>            return beta;<a name="line.192"></a>
+<FONT color="green">193</FONT>        }<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>        /**<a name="line.195"></a>
+<FONT color="green">196</FONT>         * Returns the probability density for a particular point.<a name="line.196"></a>
+<FONT color="green">197</FONT>         *<a name="line.197"></a>
+<FONT color="green">198</FONT>         * @param x The point at which the density should be computed.<a name="line.198"></a>
+<FONT color="green">199</FONT>         * @return The pdf at point x.<a name="line.199"></a>
+<FONT color="green">200</FONT>         */<a name="line.200"></a>
+<FONT color="green">201</FONT>        @Override<a name="line.201"></a>
+<FONT color="green">202</FONT>        public double density(double x) {<a name="line.202"></a>
+<FONT color="green">203</FONT>            if (x &lt; 0) return 0;<a name="line.203"></a>
+<FONT color="green">204</FONT>            return Math.pow(x / beta, alpha - 1) / beta * Math.exp(-x / beta) / Math.exp(Gamma.logGamma(alpha));<a name="line.204"></a>
+<FONT color="green">205</FONT>        }<a name="line.205"></a>
+<FONT color="green">206</FONT>    <a name="line.206"></a>
+<FONT color="green">207</FONT>        /**<a name="line.207"></a>
+<FONT color="green">208</FONT>         * Return the probability density for a particular point.<a name="line.208"></a>
+<FONT color="green">209</FONT>         *<a name="line.209"></a>
+<FONT color="green">210</FONT>         * @param x The point at which the density should be computed.<a name="line.210"></a>
+<FONT color="green">211</FONT>         * @return The pdf at point x.<a name="line.211"></a>
+<FONT color="green">212</FONT>         * @deprecated<a name="line.212"></a>
+<FONT color="green">213</FONT>         */<a name="line.213"></a>
+<FONT color="green">214</FONT>        public double density(Double x) {<a name="line.214"></a>
+<FONT color="green">215</FONT>            return density(x.doubleValue());<a name="line.215"></a>
+<FONT color="green">216</FONT>        }<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>        /**<a name="line.218"></a>
+<FONT color="green">219</FONT>         * Access the domain value lower bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.219"></a>
+<FONT color="green">220</FONT>         * bracket a CDF root.  This method is used by<a name="line.220"></a>
+<FONT color="green">221</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.221"></a>
+<FONT color="green">222</FONT>         *<a name="line.222"></a>
+<FONT color="green">223</FONT>         * @param p the desired probability for the critical value<a name="line.223"></a>
+<FONT color="green">224</FONT>         * @return domain value lower bound, i.e.<a name="line.224"></a>
+<FONT color="green">225</FONT>         *         P(X &amp;lt; &lt;i&gt;lower bound&lt;/i&gt;) &amp;lt; &lt;code&gt;p&lt;/code&gt;<a name="line.225"></a>
+<FONT color="green">226</FONT>         */<a name="line.226"></a>
+<FONT color="green">227</FONT>        @Override<a name="line.227"></a>
+<FONT color="green">228</FONT>        protected double getDomainLowerBound(double p) {<a name="line.228"></a>
+<FONT color="green">229</FONT>            // TODO: try to improve on this estimate<a name="line.229"></a>
+<FONT color="green">230</FONT>            return Double.MIN_VALUE;<a name="line.230"></a>
+<FONT color="green">231</FONT>        }<a name="line.231"></a>
+<FONT color="green">232</FONT>    <a name="line.232"></a>
+<FONT color="green">233</FONT>        /**<a name="line.233"></a>
+<FONT color="green">234</FONT>         * Access the domain value upper bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.234"></a>
+<FONT color="green">235</FONT>         * bracket a CDF root.  This method is used by<a name="line.235"></a>
+<FONT color="green">236</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.236"></a>
+<FONT color="green">237</FONT>         *<a name="line.237"></a>
+<FONT color="green">238</FONT>         * @param p the desired probability for the critical value<a name="line.238"></a>
+<FONT color="green">239</FONT>         * @return domain value upper bound, i.e.<a name="line.239"></a>
+<FONT color="green">240</FONT>         *         P(X &amp;lt; &lt;i&gt;upper bound&lt;/i&gt;) &amp;gt; &lt;code&gt;p&lt;/code&gt;<a name="line.240"></a>
+<FONT color="green">241</FONT>         */<a name="line.241"></a>
+<FONT color="green">242</FONT>        @Override<a name="line.242"></a>
+<FONT color="green">243</FONT>        protected double getDomainUpperBound(double p) {<a name="line.243"></a>
+<FONT color="green">244</FONT>            // TODO: try to improve on this estimate<a name="line.244"></a>
+<FONT color="green">245</FONT>            // NOTE: gamma is skewed to the left<a name="line.245"></a>
+<FONT color="green">246</FONT>            // NOTE: therefore, P(X &lt; &amp;mu;) &gt; .5<a name="line.246"></a>
+<FONT color="green">247</FONT>    <a name="line.247"></a>
+<FONT color="green">248</FONT>            double ret;<a name="line.248"></a>
+<FONT color="green">249</FONT>    <a name="line.249"></a>
+<FONT color="green">250</FONT>            if (p &lt; .5) {<a name="line.250"></a>
+<FONT color="green">251</FONT>                // use mean<a name="line.251"></a>
+<FONT color="green">252</FONT>                ret = alpha * beta;<a name="line.252"></a>
+<FONT color="green">253</FONT>            } else {<a name="line.253"></a>
+<FONT color="green">254</FONT>                // use max value<a name="line.254"></a>
+<FONT color="green">255</FONT>                ret = Double.MAX_VALUE;<a name="line.255"></a>
+<FONT color="green">256</FONT>            }<a name="line.256"></a>
+<FONT color="green">257</FONT>    <a name="line.257"></a>
+<FONT color="green">258</FONT>            return ret;<a name="line.258"></a>
+<FONT color="green">259</FONT>        }<a name="line.259"></a>
+<FONT color="green">260</FONT>    <a name="line.260"></a>
+<FONT color="green">261</FONT>        /**<a name="line.261"></a>
+<FONT color="green">262</FONT>         * Access the initial domain value, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.262"></a>
+<FONT color="green">263</FONT>         * bracket a CDF root.  This method is used by<a name="line.263"></a>
+<FONT color="green">264</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.264"></a>
+<FONT color="green">265</FONT>         *<a name="line.265"></a>
+<FONT color="green">266</FONT>         * @param p the desired probability for the critical value<a name="line.266"></a>
+<FONT color="green">267</FONT>         * @return initial domain value<a name="line.267"></a>
+<FONT color="green">268</FONT>         */<a name="line.268"></a>
+<FONT color="green">269</FONT>        @Override<a name="line.269"></a>
+<FONT color="green">270</FONT>        protected double getInitialDomain(double p) {<a name="line.270"></a>
+<FONT color="green">271</FONT>            // TODO: try to improve on this estimate<a name="line.271"></a>
+<FONT color="green">272</FONT>            // Gamma is skewed to the left, therefore, P(X &lt; &amp;mu;) &gt; .5<a name="line.272"></a>
+<FONT color="green">273</FONT>    <a name="line.273"></a>
+<FONT color="green">274</FONT>            double ret;<a name="line.274"></a>
+<FONT color="green">275</FONT>    <a name="line.275"></a>
+<FONT color="green">276</FONT>            if (p &lt; .5) {<a name="line.276"></a>
+<FONT color="green">277</FONT>                // use 1/2 mean<a name="line.277"></a>
+<FONT color="green">278</FONT>                ret = alpha * beta * .5;<a name="line.278"></a>
+<FONT color="green">279</FONT>            } else {<a name="line.279"></a>
+<FONT color="green">280</FONT>                // use mean<a name="line.280"></a>
+<FONT color="green">281</FONT>                ret = alpha * beta;<a name="line.281"></a>
+<FONT color="green">282</FONT>            }<a name="line.282"></a>
+<FONT color="green">283</FONT>    <a name="line.283"></a>
+<FONT color="green">284</FONT>            return ret;<a name="line.284"></a>
+<FONT color="green">285</FONT>        }<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>        /**<a name="line.287"></a>
+<FONT color="green">288</FONT>         * Return the absolute accuracy setting of the solver used to estimate<a name="line.288"></a>
+<FONT color="green">289</FONT>         * inverse cumulative probabilities.<a name="line.289"></a>
+<FONT color="green">290</FONT>         *<a name="line.290"></a>
+<FONT color="green">291</FONT>         * @return the solver absolute accuracy<a name="line.291"></a>
+<FONT color="green">292</FONT>         * @since 2.1<a name="line.292"></a>
+<FONT color="green">293</FONT>         */<a name="line.293"></a>
+<FONT color="green">294</FONT>        @Override<a name="line.294"></a>
+<FONT color="green">295</FONT>        protected double getSolverAbsoluteAccuracy() {<a name="line.295"></a>
+<FONT color="green">296</FONT>            return solverAbsoluteAccuracy;<a name="line.296"></a>
+<FONT color="green">297</FONT>        }<a name="line.297"></a>
+<FONT color="green">298</FONT>    }<a name="line.298"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/HasDensity.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,110 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.distribution;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;p&gt;Interface that signals that a distribution can compute the probability density function<a name="line.23"></a>
+<FONT color="green">024</FONT>     * for a particular point.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @param &lt;P&gt; the type of the point at which density is to be computed, this<a name="line.25"></a>
+<FONT color="green">026</FONT>     * may be for example &lt;code&gt;Double.&lt;/code&gt;&lt;/p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;This interface is deprecated.  As of version 2.0, the {@link ContinuousDistribution}<a name="line.28"></a>
+<FONT color="green">029</FONT>     * interface will be extended to include a &lt;code&gt;density(double)&lt;code&gt; method.&lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @deprecated to be removed in math 3.0<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @version $Revision: 924362 $ $Date: 2010-03-17 12:45:31 -0400 (Wed, 17 Mar 2010) $<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public interface HasDensity&lt;P&gt; {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /**<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Compute the probability density function.<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @param x point for which the probability density is requested<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @return probability density at point x<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @throws MathException if probability density cannot be computed at specifed point<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        double density(P x) throws MathException;<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>    }<a name="line.44"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/HypergeometricDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,142 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.distribution;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * The Hypergeometric Distribution.<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;p&gt;<a name="line.23"></a>
+<FONT color="green">024</FONT>     * References:<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;ul&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/HypergeometricDistribution.html"&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Hypergeometric Distribution&lt;/a&gt;&lt;/li&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;/ul&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 920852 $ $Date: 2010-03-09 07:53:44 -0500 (Tue, 09 Mar 2010) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public interface HypergeometricDistribution extends IntegerDistribution {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /**<a name="line.35"></a>
+<FONT color="green">036</FONT>         * Access the number of successes.<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @return the number of successes.<a name="line.37"></a>
+<FONT color="green">038</FONT>         */<a name="line.38"></a>
+<FONT color="green">039</FONT>        int getNumberOfSuccesses();<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * Access the population size.<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @return the population size.<a name="line.43"></a>
+<FONT color="green">044</FONT>         */<a name="line.44"></a>
+<FONT color="green">045</FONT>        int getPopulationSize();<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Access the sample size.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @return the sample size.<a name="line.49"></a>
+<FONT color="green">050</FONT>         */<a name="line.50"></a>
+<FONT color="green">051</FONT>        int getSampleSize();<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Modify the number of successes.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param num the new number of successes.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @deprecated as of v2.1<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        @Deprecated<a name="line.58"></a>
+<FONT color="green">059</FONT>        void setNumberOfSuccesses(int num);<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Modify the population size.<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @param size the new population size.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @deprecated as of v2.1<a name="line.64"></a>
+<FONT color="green">065</FONT>         */<a name="line.65"></a>
+<FONT color="green">066</FONT>        @Deprecated<a name="line.66"></a>
+<FONT color="green">067</FONT>        void setPopulationSize(int size);<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * Modify the sample size.<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param size the new sample size.<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @deprecated as of v2.1<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        @Deprecated<a name="line.74"></a>
+<FONT color="green">075</FONT>        void setSampleSize(int size);<a name="line.75"></a>
+<FONT color="green">076</FONT>    }<a name="line.76"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/HypergeometricDistributionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,418 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.distribution;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * The default implementation of {@link HypergeometricDistribution}.<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @version $Revision: 920852 $ $Date: 2010-03-09 07:53:44 -0500 (Tue, 09 Mar 2010) $<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public class HypergeometricDistributionImpl extends AbstractIntegerDistribution<a name="line.30"></a>
+<FONT color="green">031</FONT>            implements HypergeometricDistribution, Serializable {<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** Serializable version identifier */<a name="line.33"></a>
+<FONT color="green">034</FONT>        private static final long serialVersionUID = -436928820673516179L;<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** The number of successes in the population. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private int numberOfSuccesses;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** The population size. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private int populationSize;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** The sample size. */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private int sampleSize;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**<a name="line.45"></a>
+<FONT color="green">046</FONT>         * Construct a new hypergeometric distribution with the given the population<a name="line.46"></a>
+<FONT color="green">047</FONT>         * size, the number of successes in the population, and the sample size.<a name="line.47"></a>
+<FONT color="green">048</FONT>         *<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @param populationSize the population size.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @param numberOfSuccesses number of successes in the population.<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @param sampleSize the sample size.<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        public HypergeometricDistributionImpl(int populationSize,<a name="line.53"></a>
+<FONT color="green">054</FONT>                int numberOfSuccesses, int sampleSize) {<a name="line.54"></a>
+<FONT color="green">055</FONT>            super();<a name="line.55"></a>
+<FONT color="green">056</FONT>            if (numberOfSuccesses &gt; populationSize) {<a name="line.56"></a>
+<FONT color="green">057</FONT>                throw MathRuntimeException<a name="line.57"></a>
+<FONT color="green">058</FONT>                        .createIllegalArgumentException(<a name="line.58"></a>
+<FONT color="green">059</FONT>                                "number of successes ({0}) must be less than or equal to population size ({1})",<a name="line.59"></a>
+<FONT color="green">060</FONT>                                numberOfSuccesses, populationSize);<a name="line.60"></a>
+<FONT color="green">061</FONT>            }<a name="line.61"></a>
+<FONT color="green">062</FONT>            if (sampleSize &gt; populationSize) {<a name="line.62"></a>
+<FONT color="green">063</FONT>                throw MathRuntimeException<a name="line.63"></a>
+<FONT color="green">064</FONT>                        .createIllegalArgumentException(<a name="line.64"></a>
+<FONT color="green">065</FONT>                                "sample size ({0}) must be less than or equal to population size ({1})",<a name="line.65"></a>
+<FONT color="green">066</FONT>                                sampleSize, populationSize);<a name="line.66"></a>
+<FONT color="green">067</FONT>            }<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>            setPopulationSizeInternal(populationSize);<a name="line.69"></a>
+<FONT color="green">070</FONT>            setSampleSizeInternal(sampleSize);<a name="line.70"></a>
+<FONT color="green">071</FONT>            setNumberOfSuccessesInternal(numberOfSuccesses);<a name="line.71"></a>
+<FONT color="green">072</FONT>        }<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /**<a name="line.74"></a>
+<FONT color="green">075</FONT>         * For this distribution, X, this method returns P(X &amp;le; x).<a name="line.75"></a>
+<FONT color="green">076</FONT>         *<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @param x the value at which the PDF is evaluated.<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @return PDF for this distribution.<a name="line.78"></a>
+<FONT color="green">079</FONT>         */<a name="line.79"></a>
+<FONT color="green">080</FONT>        @Override<a name="line.80"></a>
+<FONT color="green">081</FONT>        public double cumulativeProbability(int x) {<a name="line.81"></a>
+<FONT color="green">082</FONT>            double ret;<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>            int[] domain = getDomain(populationSize, numberOfSuccesses, sampleSize);<a name="line.84"></a>
+<FONT color="green">085</FONT>            if (x &lt; domain[0]) {<a name="line.85"></a>
+<FONT color="green">086</FONT>                ret = 0.0;<a name="line.86"></a>
+<FONT color="green">087</FONT>            } else if (x &gt;= domain[1]) {<a name="line.87"></a>
+<FONT color="green">088</FONT>                ret = 1.0;<a name="line.88"></a>
+<FONT color="green">089</FONT>            } else {<a name="line.89"></a>
+<FONT color="green">090</FONT>                ret = innerCumulativeProbability(domain[0], x, 1, populationSize,<a name="line.90"></a>
+<FONT color="green">091</FONT>                                                 numberOfSuccesses, sampleSize);<a name="line.91"></a>
+<FONT color="green">092</FONT>            }<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>            return ret;<a name="line.94"></a>
+<FONT color="green">095</FONT>        }<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /**<a name="line.97"></a>
+<FONT color="green">098</FONT>         * Return the domain for the given hypergeometric distribution parameters.<a name="line.98"></a>
+<FONT color="green">099</FONT>         *<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @param n the population size.<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @param m number of successes in the population.<a name="line.101"></a>
+<FONT color="green">102</FONT>         * @param k the sample size.<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @return a two element array containing the lower and upper bounds of the<a name="line.103"></a>
+<FONT color="green">104</FONT>         *         hypergeometric distribution.<a name="line.104"></a>
+<FONT color="green">105</FONT>         */<a name="line.105"></a>
+<FONT color="green">106</FONT>        private int[] getDomain(int n, int m, int k) {<a name="line.106"></a>
+<FONT color="green">107</FONT>            return new int[] { getLowerDomain(n, m, k), getUpperDomain(m, k) };<a name="line.107"></a>
+<FONT color="green">108</FONT>        }<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>        /**<a name="line.110"></a>
+<FONT color="green">111</FONT>         * Access the domain value lower bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.111"></a>
+<FONT color="green">112</FONT>         * bracket a PDF root.<a name="line.112"></a>
+<FONT color="green">113</FONT>         *<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param p the desired probability for the critical value<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @return domain value lower bound, i.e. P(X &amp;lt; &lt;i&gt;lower bound&lt;/i&gt;) &amp;lt;<a name="line.115"></a>
+<FONT color="green">116</FONT>         *         &lt;code&gt;p&lt;/code&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         */<a name="line.117"></a>
+<FONT color="green">118</FONT>        @Override<a name="line.118"></a>
+<FONT color="green">119</FONT>        protected int getDomainLowerBound(double p) {<a name="line.119"></a>
+<FONT color="green">120</FONT>            return getLowerDomain(populationSize, numberOfSuccesses, sampleSize);<a name="line.120"></a>
+<FONT color="green">121</FONT>        }<a name="line.121"></a>
+<FONT color="green">122</FONT>    <a name="line.122"></a>
+<FONT color="green">123</FONT>        /**<a name="line.123"></a>
+<FONT color="green">124</FONT>         * Access the domain value upper bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.124"></a>
+<FONT color="green">125</FONT>         * bracket a PDF root.<a name="line.125"></a>
+<FONT color="green">126</FONT>         *<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @param p the desired probability for the critical value<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @return domain value upper bound, i.e. P(X &amp;lt; &lt;i&gt;upper bound&lt;/i&gt;) &amp;gt;<a name="line.128"></a>
+<FONT color="green">129</FONT>         *         &lt;code&gt;p&lt;/code&gt;<a name="line.129"></a>
+<FONT color="green">130</FONT>         */<a name="line.130"></a>
+<FONT color="green">131</FONT>        @Override<a name="line.131"></a>
+<FONT color="green">132</FONT>        protected int getDomainUpperBound(double p) {<a name="line.132"></a>
+<FONT color="green">133</FONT>            return getUpperDomain(sampleSize, numberOfSuccesses);<a name="line.133"></a>
+<FONT color="green">134</FONT>        }<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>        /**<a name="line.136"></a>
+<FONT color="green">137</FONT>         * Return the lowest domain value for the given hypergeometric distribution<a name="line.137"></a>
+<FONT color="green">138</FONT>         * parameters.<a name="line.138"></a>
+<FONT color="green">139</FONT>         *<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @param n the population size.<a name="line.140"></a>
+<FONT color="green">141</FONT>         * @param m number of successes in the population.<a name="line.141"></a>
+<FONT color="green">142</FONT>         * @param k the sample size.<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @return the lowest domain value of the hypergeometric distribution.<a name="line.143"></a>
+<FONT color="green">144</FONT>         */<a name="line.144"></a>
+<FONT color="green">145</FONT>        private int getLowerDomain(int n, int m, int k) {<a name="line.145"></a>
+<FONT color="green">146</FONT>            return Math.max(0, m - (n - k));<a name="line.146"></a>
+<FONT color="green">147</FONT>        }<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>        /**<a name="line.149"></a>
+<FONT color="green">150</FONT>         * Access the number of successes.<a name="line.150"></a>
+<FONT color="green">151</FONT>         *<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @return the number of successes.<a name="line.152"></a>
+<FONT color="green">153</FONT>         */<a name="line.153"></a>
+<FONT color="green">154</FONT>        public int getNumberOfSuccesses() {<a name="line.154"></a>
+<FONT color="green">155</FONT>            return numberOfSuccesses;<a name="line.155"></a>
+<FONT color="green">156</FONT>        }<a name="line.156"></a>
+<FONT color="green">157</FONT>    <a name="line.157"></a>
+<FONT color="green">158</FONT>        /**<a name="line.158"></a>
+<FONT color="green">159</FONT>         * Access the population size.<a name="line.159"></a>
+<FONT color="green">160</FONT>         *<a name="line.160"></a>
+<FONT color="green">161</FONT>         * @return the population size.<a name="line.161"></a>
+<FONT color="green">162</FONT>         */<a name="line.162"></a>
+<FONT color="green">163</FONT>        public int getPopulationSize() {<a name="line.163"></a>
+<FONT color="green">164</FONT>            return populationSize;<a name="line.164"></a>
+<FONT color="green">165</FONT>        }<a name="line.165"></a>
+<FONT color="green">166</FONT>    <a name="line.166"></a>
+<FONT color="green">167</FONT>        /**<a name="line.167"></a>
+<FONT color="green">168</FONT>         * Access the sample size.<a name="line.168"></a>
+<FONT color="green">169</FONT>         *<a name="line.169"></a>
+<FONT color="green">170</FONT>         * @return the sample size.<a name="line.170"></a>
+<FONT color="green">171</FONT>         */<a name="line.171"></a>
+<FONT color="green">172</FONT>        public int getSampleSize() {<a name="line.172"></a>
+<FONT color="green">173</FONT>            return sampleSize;<a name="line.173"></a>
+<FONT color="green">174</FONT>        }<a name="line.174"></a>
+<FONT color="green">175</FONT>    <a name="line.175"></a>
+<FONT color="green">176</FONT>        /**<a name="line.176"></a>
+<FONT color="green">177</FONT>         * Return the highest domain value for the given hypergeometric distribution<a name="line.177"></a>
+<FONT color="green">178</FONT>         * parameters.<a name="line.178"></a>
+<FONT color="green">179</FONT>         *<a name="line.179"></a>
+<FONT color="green">180</FONT>         * @param m number of successes in the population.<a name="line.180"></a>
+<FONT color="green">181</FONT>         * @param k the sample size.<a name="line.181"></a>
+<FONT color="green">182</FONT>         * @return the highest domain value of the hypergeometric distribution.<a name="line.182"></a>
+<FONT color="green">183</FONT>         */<a name="line.183"></a>
+<FONT color="green">184</FONT>        private int getUpperDomain(int m, int k) {<a name="line.184"></a>
+<FONT color="green">185</FONT>            return Math.min(k, m);<a name="line.185"></a>
+<FONT color="green">186</FONT>        }<a name="line.186"></a>
+<FONT color="green">187</FONT>    <a name="line.187"></a>
+<FONT color="green">188</FONT>        /**<a name="line.188"></a>
+<FONT color="green">189</FONT>         * For this distribution, X, this method returns P(X = x).<a name="line.189"></a>
+<FONT color="green">190</FONT>         *<a name="line.190"></a>
+<FONT color="green">191</FONT>         * @param x the value at which the PMF is evaluated.<a name="line.191"></a>
+<FONT color="green">192</FONT>         * @return PMF for this distribution.<a name="line.192"></a>
+<FONT color="green">193</FONT>         */<a name="line.193"></a>
+<FONT color="green">194</FONT>        public double probability(int x) {<a name="line.194"></a>
+<FONT color="green">195</FONT>            double ret;<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>            int[] domain = getDomain(populationSize, numberOfSuccesses, sampleSize);<a name="line.197"></a>
+<FONT color="green">198</FONT>            if (x &lt; domain[0] || x &gt; domain[1]) {<a name="line.198"></a>
+<FONT color="green">199</FONT>                ret = 0.0;<a name="line.199"></a>
+<FONT color="green">200</FONT>            } else {<a name="line.200"></a>
+<FONT color="green">201</FONT>                double p = (double) sampleSize / (double) populationSize;<a name="line.201"></a>
+<FONT color="green">202</FONT>                double q = (double) (populationSize - sampleSize) / (double) populationSize;<a name="line.202"></a>
+<FONT color="green">203</FONT>                double p1 = SaddlePointExpansion.logBinomialProbability(x,<a name="line.203"></a>
+<FONT color="green">204</FONT>                        numberOfSuccesses, p, q);<a name="line.204"></a>
+<FONT color="green">205</FONT>                double p2 =<a name="line.205"></a>
+<FONT color="green">206</FONT>                    SaddlePointExpansion.logBinomialProbability(sampleSize - x,<a name="line.206"></a>
+<FONT color="green">207</FONT>                        populationSize - numberOfSuccesses, p, q);<a name="line.207"></a>
+<FONT color="green">208</FONT>                double p3 =<a name="line.208"></a>
+<FONT color="green">209</FONT>                    SaddlePointExpansion.logBinomialProbability(sampleSize, populationSize, p, q);<a name="line.209"></a>
+<FONT color="green">210</FONT>                ret = Math.exp(p1 + p2 - p3);<a name="line.210"></a>
+<FONT color="green">211</FONT>            }<a name="line.211"></a>
+<FONT color="green">212</FONT>    <a name="line.212"></a>
+<FONT color="green">213</FONT>            return ret;<a name="line.213"></a>
+<FONT color="green">214</FONT>        }<a name="line.214"></a>
+<FONT color="green">215</FONT>    <a name="line.215"></a>
+<FONT color="green">216</FONT>        /**<a name="line.216"></a>
+<FONT color="green">217</FONT>         * For the distribution, X, defined by the given hypergeometric distribution<a name="line.217"></a>
+<FONT color="green">218</FONT>         * parameters, this method returns P(X = x).<a name="line.218"></a>
+<FONT color="green">219</FONT>         *<a name="line.219"></a>
+<FONT color="green">220</FONT>         * @param n the population size.<a name="line.220"></a>
+<FONT color="green">221</FONT>         * @param m number of successes in the population.<a name="line.221"></a>
+<FONT color="green">222</FONT>         * @param k the sample size.<a name="line.222"></a>
+<FONT color="green">223</FONT>         * @param x the value at which the PMF is evaluated.<a name="line.223"></a>
+<FONT color="green">224</FONT>         * @return PMF for the distribution.<a name="line.224"></a>
+<FONT color="green">225</FONT>         */<a name="line.225"></a>
+<FONT color="green">226</FONT>        private double probability(int n, int m, int k, int x) {<a name="line.226"></a>
+<FONT color="green">227</FONT>            return Math.exp(MathUtils.binomialCoefficientLog(m, x) +<a name="line.227"></a>
+<FONT color="green">228</FONT>                   MathUtils.binomialCoefficientLog(n - m, k - x) -<a name="line.228"></a>
+<FONT color="green">229</FONT>                   MathUtils.binomialCoefficientLog(n, k));<a name="line.229"></a>
+<FONT color="green">230</FONT>        }<a name="line.230"></a>
+<FONT color="green">231</FONT>    <a name="line.231"></a>
+<FONT color="green">232</FONT>        /**<a name="line.232"></a>
+<FONT color="green">233</FONT>         * Modify the number of successes.<a name="line.233"></a>
+<FONT color="green">234</FONT>         *<a name="line.234"></a>
+<FONT color="green">235</FONT>         * @param num the new number of successes.<a name="line.235"></a>
+<FONT color="green">236</FONT>         * @throws IllegalArgumentException if &lt;code&gt;num&lt;/code&gt; is negative.<a name="line.236"></a>
+<FONT color="green">237</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.237"></a>
+<FONT color="green">238</FONT>         */<a name="line.238"></a>
+<FONT color="green">239</FONT>        @Deprecated<a name="line.239"></a>
+<FONT color="green">240</FONT>        public void setNumberOfSuccesses(int num) {<a name="line.240"></a>
+<FONT color="green">241</FONT>            setNumberOfSuccessesInternal(num);<a name="line.241"></a>
+<FONT color="green">242</FONT>        }<a name="line.242"></a>
+<FONT color="green">243</FONT>        /**<a name="line.243"></a>
+<FONT color="green">244</FONT>         * Modify the number of successes.<a name="line.244"></a>
+<FONT color="green">245</FONT>         *<a name="line.245"></a>
+<FONT color="green">246</FONT>         * @param num the new number of successes.<a name="line.246"></a>
+<FONT color="green">247</FONT>         * @throws IllegalArgumentException if &lt;code&gt;num&lt;/code&gt; is negative.<a name="line.247"></a>
+<FONT color="green">248</FONT>         */<a name="line.248"></a>
+<FONT color="green">249</FONT>        private void setNumberOfSuccessesInternal(int num) {<a name="line.249"></a>
+<FONT color="green">250</FONT>            if (num &lt; 0) {<a name="line.250"></a>
+<FONT color="green">251</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.251"></a>
+<FONT color="green">252</FONT>                        "number of successes must be non-negative ({0})", num);<a name="line.252"></a>
+<FONT color="green">253</FONT>            }<a name="line.253"></a>
+<FONT color="green">254</FONT>            numberOfSuccesses = num;<a name="line.254"></a>
+<FONT color="green">255</FONT>        }<a name="line.255"></a>
+<FONT color="green">256</FONT>    <a name="line.256"></a>
+<FONT color="green">257</FONT>        /**<a name="line.257"></a>
+<FONT color="green">258</FONT>         * Modify the population size.<a name="line.258"></a>
+<FONT color="green">259</FONT>         *<a name="line.259"></a>
+<FONT color="green">260</FONT>         * @param size the new population size.<a name="line.260"></a>
+<FONT color="green">261</FONT>         * @throws IllegalArgumentException if &lt;code&gt;size&lt;/code&gt; is not positive.<a name="line.261"></a>
+<FONT color="green">262</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.262"></a>
+<FONT color="green">263</FONT>         */<a name="line.263"></a>
+<FONT color="green">264</FONT>        @Deprecated<a name="line.264"></a>
+<FONT color="green">265</FONT>        public void setPopulationSize(int size) {<a name="line.265"></a>
+<FONT color="green">266</FONT>            setPopulationSizeInternal(size);<a name="line.266"></a>
+<FONT color="green">267</FONT>        }<a name="line.267"></a>
+<FONT color="green">268</FONT>        /**<a name="line.268"></a>
+<FONT color="green">269</FONT>         * Modify the population size.<a name="line.269"></a>
+<FONT color="green">270</FONT>         *<a name="line.270"></a>
+<FONT color="green">271</FONT>         * @param size the new population size.<a name="line.271"></a>
+<FONT color="green">272</FONT>         * @throws IllegalArgumentException if &lt;code&gt;size&lt;/code&gt; is not positive.<a name="line.272"></a>
+<FONT color="green">273</FONT>         */<a name="line.273"></a>
+<FONT color="green">274</FONT>        private void setPopulationSizeInternal(int size) {<a name="line.274"></a>
+<FONT color="green">275</FONT>            if (size &lt;= 0) {<a name="line.275"></a>
+<FONT color="green">276</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.276"></a>
+<FONT color="green">277</FONT>                        "population size must be positive ({0})", size);<a name="line.277"></a>
+<FONT color="green">278</FONT>            }<a name="line.278"></a>
+<FONT color="green">279</FONT>            populationSize = size;<a name="line.279"></a>
+<FONT color="green">280</FONT>        }<a name="line.280"></a>
+<FONT color="green">281</FONT>    <a name="line.281"></a>
+<FONT color="green">282</FONT>        /**<a name="line.282"></a>
+<FONT color="green">283</FONT>         * Modify the sample size.<a name="line.283"></a>
+<FONT color="green">284</FONT>         *<a name="line.284"></a>
+<FONT color="green">285</FONT>         * @param size the new sample size.<a name="line.285"></a>
+<FONT color="green">286</FONT>         * @throws IllegalArgumentException if &lt;code&gt;size&lt;/code&gt; is negative.<a name="line.286"></a>
+<FONT color="green">287</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.287"></a>
+<FONT color="green">288</FONT>         */<a name="line.288"></a>
+<FONT color="green">289</FONT>        @Deprecated<a name="line.289"></a>
+<FONT color="green">290</FONT>        public void setSampleSize(int size) {<a name="line.290"></a>
+<FONT color="green">291</FONT>            setSampleSizeInternal(size);<a name="line.291"></a>
+<FONT color="green">292</FONT>        }<a name="line.292"></a>
+<FONT color="green">293</FONT>        /**<a name="line.293"></a>
+<FONT color="green">294</FONT>         * Modify the sample size.<a name="line.294"></a>
+<FONT color="green">295</FONT>         *<a name="line.295"></a>
+<FONT color="green">296</FONT>         * @param size the new sample size.<a name="line.296"></a>
+<FONT color="green">297</FONT>         * @throws IllegalArgumentException if &lt;code&gt;size&lt;/code&gt; is negative.<a name="line.297"></a>
+<FONT color="green">298</FONT>         */<a name="line.298"></a>
+<FONT color="green">299</FONT>        private void setSampleSizeInternal(int size) {<a name="line.299"></a>
+<FONT color="green">300</FONT>            if (size &lt; 0) {<a name="line.300"></a>
+<FONT color="green">301</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.301"></a>
+<FONT color="green">302</FONT>                        "sample size must be positive ({0})", size);<a name="line.302"></a>
+<FONT color="green">303</FONT>            }<a name="line.303"></a>
+<FONT color="green">304</FONT>            sampleSize = size;<a name="line.304"></a>
+<FONT color="green">305</FONT>        }<a name="line.305"></a>
+<FONT color="green">306</FONT>    <a name="line.306"></a>
+<FONT color="green">307</FONT>        /**<a name="line.307"></a>
+<FONT color="green">308</FONT>         * For this distribution, X, this method returns P(X &amp;ge; x).<a name="line.308"></a>
+<FONT color="green">309</FONT>         *<a name="line.309"></a>
+<FONT color="green">310</FONT>         * @param x the value at which the CDF is evaluated.<a name="line.310"></a>
+<FONT color="green">311</FONT>         * @return upper tail CDF for this distribution.<a name="line.311"></a>
+<FONT color="green">312</FONT>         * @since 1.1<a name="line.312"></a>
+<FONT color="green">313</FONT>         */<a name="line.313"></a>
+<FONT color="green">314</FONT>        public double upperCumulativeProbability(int x) {<a name="line.314"></a>
+<FONT color="green">315</FONT>            double ret;<a name="line.315"></a>
+<FONT color="green">316</FONT>    <a name="line.316"></a>
+<FONT color="green">317</FONT>            final int[] domain = getDomain(populationSize, numberOfSuccesses, sampleSize);<a name="line.317"></a>
+<FONT color="green">318</FONT>            if (x &lt; domain[0]) {<a name="line.318"></a>
+<FONT color="green">319</FONT>                ret = 1.0;<a name="line.319"></a>
+<FONT color="green">320</FONT>            } else if (x &gt; domain[1]) {<a name="line.320"></a>
+<FONT color="green">321</FONT>                ret = 0.0;<a name="line.321"></a>
+<FONT color="green">322</FONT>            } else {<a name="line.322"></a>
+<FONT color="green">323</FONT>                ret = innerCumulativeProbability(domain[1], x, -1, populationSize, numberOfSuccesses, sampleSize);<a name="line.323"></a>
+<FONT color="green">324</FONT>            }<a name="line.324"></a>
+<FONT color="green">325</FONT>    <a name="line.325"></a>
+<FONT color="green">326</FONT>            return ret;<a name="line.326"></a>
+<FONT color="green">327</FONT>        }<a name="line.327"></a>
+<FONT color="green">328</FONT>    <a name="line.328"></a>
+<FONT color="green">329</FONT>        /**<a name="line.329"></a>
+<FONT color="green">330</FONT>         * For this distribution, X, this method returns P(x0 &amp;le; X &amp;le; x1). This<a name="line.330"></a>
+<FONT color="green">331</FONT>         * probability is computed by summing the point probabilities for the values<a name="line.331"></a>
+<FONT color="green">332</FONT>         * x0, x0 + 1, x0 + 2, ..., x1, in the order directed by dx.<a name="line.332"></a>
+<FONT color="green">333</FONT>         *<a name="line.333"></a>
+<FONT color="green">334</FONT>         * @param x0 the inclusive, lower bound<a name="line.334"></a>
+<FONT color="green">335</FONT>         * @param x1 the inclusive, upper bound<a name="line.335"></a>
+<FONT color="green">336</FONT>         * @param dx the direction of summation. 1 indicates summing from x0 to x1.<a name="line.336"></a>
+<FONT color="green">337</FONT>         *            0 indicates summing from x1 to x0.<a name="line.337"></a>
+<FONT color="green">338</FONT>         * @param n the population size.<a name="line.338"></a>
+<FONT color="green">339</FONT>         * @param m number of successes in the population.<a name="line.339"></a>
+<FONT color="green">340</FONT>         * @param k the sample size.<a name="line.340"></a>
+<FONT color="green">341</FONT>         * @return P(x0 &amp;le; X &amp;le; x1).<a name="line.341"></a>
+<FONT color="green">342</FONT>         */<a name="line.342"></a>
+<FONT color="green">343</FONT>        private double innerCumulativeProbability(int x0, int x1, int dx, int n,<a name="line.343"></a>
+<FONT color="green">344</FONT>                int m, int k) {<a name="line.344"></a>
+<FONT color="green">345</FONT>            double ret = probability(n, m, k, x0);<a name="line.345"></a>
+<FONT color="green">346</FONT>            while (x0 != x1) {<a name="line.346"></a>
+<FONT color="green">347</FONT>                x0 += dx;<a name="line.347"></a>
+<FONT color="green">348</FONT>                ret += probability(n, m, k, x0);<a name="line.348"></a>
+<FONT color="green">349</FONT>            }<a name="line.349"></a>
+<FONT color="green">350</FONT>            return ret;<a name="line.350"></a>
+<FONT color="green">351</FONT>        }<a name="line.351"></a>
+<FONT color="green">352</FONT>    }<a name="line.352"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/IntegerDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,150 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Interface for discrete distributions of integer-valued random variables.<a name="line.22"></a>
+<FONT color="green">023</FONT>     *<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     */<a name="line.25"></a>
+<FONT color="green">026</FONT>    public interface IntegerDistribution extends DiscreteDistribution {<a name="line.26"></a>
+<FONT color="green">027</FONT>        /**<a name="line.27"></a>
+<FONT color="green">028</FONT>         * For a random variable X whose values are distributed according<a name="line.28"></a>
+<FONT color="green">029</FONT>         * to this distribution, this method returns P(X = x). In other words, this<a name="line.29"></a>
+<FONT color="green">030</FONT>         * method represents the probability mass function for the distribution.<a name="line.30"></a>
+<FONT color="green">031</FONT>         *<a name="line.31"></a>
+<FONT color="green">032</FONT>         * @param x the value at which the probability density function is evaluated.<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @return the value of the probability density function at x<a name="line.33"></a>
+<FONT color="green">034</FONT>         */<a name="line.34"></a>
+<FONT color="green">035</FONT>        double probability(int x);<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /**<a name="line.37"></a>
+<FONT color="green">038</FONT>         * For a random variable X whose values are distributed according<a name="line.38"></a>
+<FONT color="green">039</FONT>         * to this distribution, this method returns P(X &amp;le; x).  In other words,<a name="line.39"></a>
+<FONT color="green">040</FONT>         * this method represents the probability distribution function, or PDF<a name="line.40"></a>
+<FONT color="green">041</FONT>         * for the distribution.<a name="line.41"></a>
+<FONT color="green">042</FONT>         *<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @param x the value at which the PDF is evaluated.<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @return PDF for this distribution.<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @throws MathException if the cumulative probability can not be<a name="line.45"></a>
+<FONT color="green">046</FONT>         *            computed due to convergence or other numerical errors.<a name="line.46"></a>
+<FONT color="green">047</FONT>         */<a name="line.47"></a>
+<FONT color="green">048</FONT>        double cumulativeProbability(int x) throws MathException;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * For this distribution, X, this method returns P(x0 &amp;le; X &amp;le; x1).<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @param x0 the inclusive, lower bound<a name="line.52"></a>
+<FONT color="green">053</FONT>         * @param x1 the inclusive, upper bound<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @return the cumulative probability.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @throws MathException if the cumulative probability can not be<a name="line.55"></a>
+<FONT color="green">056</FONT>         *            computed due to convergence or other numerical errors.<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @throws IllegalArgumentException if x0 &gt; x1<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        double cumulativeProbability(int x0, int x1) throws MathException;<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * For this distribution, X, this method returns the largest x such that<a name="line.62"></a>
+<FONT color="green">063</FONT>         * P(X &amp;le; x) &lt;= p.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * &lt;p&gt;<a name="line.64"></a>
+<FONT color="green">065</FONT>         * Note that this definition implies: &lt;ul&gt;<a name="line.65"></a>
+<FONT color="green">066</FONT>         * &lt;li&gt; If there is a minimum value, &lt;code&gt;m&lt;/code&gt;, with postive<a name="line.66"></a>
+<FONT color="green">067</FONT>         * probablility under (the density of) X, then &lt;code&gt;m - 1&lt;/code&gt; is<a name="line.67"></a>
+<FONT color="green">068</FONT>         * returned by &lt;code&gt;inverseCumulativeProbability(0).&lt;/code&gt;  If there is<a name="line.68"></a>
+<FONT color="green">069</FONT>         * no such value &lt;code&gt;m,  Integer.MIN_VALUE&lt;/code&gt; is<a name="line.69"></a>
+<FONT color="green">070</FONT>         * returned.&lt;/li&gt;<a name="line.70"></a>
+<FONT color="green">071</FONT>         * &lt;li&gt; If there is a maximum value, &lt;code&gt;M&lt;/code&gt;, such that<a name="line.71"></a>
+<FONT color="green">072</FONT>         * P(X &amp;le; M) =1, then &lt;code&gt;M&lt;/code&gt; is returned by<a name="line.72"></a>
+<FONT color="green">073</FONT>         * &lt;code&gt;inverseCumulativeProbability(1).&lt;/code&gt;<a name="line.73"></a>
+<FONT color="green">074</FONT>         * If there is no such value, &lt;code&gt;M, Integer.MAX_VALUE&lt;/code&gt; is<a name="line.74"></a>
+<FONT color="green">075</FONT>         * returned.&lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.75"></a>
+<FONT color="green">076</FONT>         *<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @param p the cumulative probability.<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @return the largest x such that P(X &amp;le; x) &lt;= p<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @throws MathException if the inverse cumulative probability can not be<a name="line.79"></a>
+<FONT color="green">080</FONT>         *            computed due to convergence or other numerical errors.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @throws IllegalArgumentException if p is not between 0 and 1 (inclusive)<a name="line.81"></a>
+<FONT color="green">082</FONT>         */<a name="line.82"></a>
+<FONT color="green">083</FONT>        int inverseCumulativeProbability(double p) throws MathException;<a name="line.83"></a>
+<FONT color="green">084</FONT>    }<a name="line.84"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/NormalDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,131 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.distribution;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Normal (Gauss) Distribution.<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;p&gt;<a name="line.23"></a>
+<FONT color="green">024</FONT>     * References:&lt;/p&gt;&lt;p&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;ul&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/NormalDistribution.html"&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Normal Distribution&lt;/a&gt;&lt;/li&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;/ul&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 920852 $ $Date: 2010-03-09 07:53:44 -0500 (Tue, 09 Mar 2010) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public interface NormalDistribution extends ContinuousDistribution, HasDensity&lt;Double&gt; {<a name="line.33"></a>
+<FONT color="green">034</FONT>        /**<a name="line.34"></a>
+<FONT color="green">035</FONT>         * Access the mean.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @return mean for this distribution<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        double getMean();<a name="line.38"></a>
+<FONT color="green">039</FONT>        /**<a name="line.39"></a>
+<FONT color="green">040</FONT>         * Modify the mean.<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @param mean for this distribution<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @deprecated as of v2.1<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        @Deprecated<a name="line.44"></a>
+<FONT color="green">045</FONT>        void setMean(double mean);<a name="line.45"></a>
+<FONT color="green">046</FONT>        /**<a name="line.46"></a>
+<FONT color="green">047</FONT>         * Access the standard deviation.<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @return standard deviation for this distribution<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        double getStandardDeviation();<a name="line.50"></a>
+<FONT color="green">051</FONT>        /**<a name="line.51"></a>
+<FONT color="green">052</FONT>         * Modify the standard deviation.<a name="line.52"></a>
+<FONT color="green">053</FONT>         * @param sd standard deviation for this distribution<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @deprecated as of v2.1<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        @Deprecated<a name="line.56"></a>
+<FONT color="green">057</FONT>        void setStandardDeviation(double sd);<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /**<a name="line.59"></a>
+<FONT color="green">060</FONT>         * Return the probability density for a particular point.<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param x  The point at which the density should be computed.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @return  The pdf at point x.<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        double density(Double x);<a name="line.64"></a>
+<FONT color="green">065</FONT>    }<a name="line.65"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/NormalDistributionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,363 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.distribution;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.special.Erf;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    /**<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Default implementation of<a name="line.28"></a>
+<FONT color="green">029</FONT>     * {@link org.apache.commons.math.distribution.NormalDistribution}.<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public class NormalDistributionImpl extends AbstractContinuousDistribution<a name="line.33"></a>
+<FONT color="green">034</FONT>            implements NormalDistribution, Serializable {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /**<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Default inverse cumulative probability accuracy<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @since 2.1<a name="line.38"></a>
+<FONT color="green">039</FONT>         */<a name="line.39"></a>
+<FONT color="green">040</FONT>        public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Serializable version identifier */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private static final long serialVersionUID = 8589540077390120676L;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** &amp;sqrt;(2 &amp;pi;) */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private static final double SQRT2PI = Math.sqrt(2 * Math.PI);<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** The mean of this distribution. */<a name="line.48"></a>
+<FONT color="green">049</FONT>        private double mean = 0;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /** The standard deviation of this distribution. */<a name="line.51"></a>
+<FONT color="green">052</FONT>        private double standardDeviation = 1;<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /** Inverse cumulative probability accuracy */<a name="line.54"></a>
+<FONT color="green">055</FONT>        private final double solverAbsoluteAccuracy;<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /**<a name="line.57"></a>
+<FONT color="green">058</FONT>         * Create a normal distribution using the given mean and standard deviation.<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @param mean mean for this distribution<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @param sd standard deviation for this distribution<a name="line.60"></a>
+<FONT color="green">061</FONT>         */<a name="line.61"></a>
+<FONT color="green">062</FONT>        public NormalDistributionImpl(double mean, double sd){<a name="line.62"></a>
+<FONT color="green">063</FONT>            this(mean, sd, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);<a name="line.63"></a>
+<FONT color="green">064</FONT>        }<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /**<a name="line.66"></a>
+<FONT color="green">067</FONT>         * Create a normal distribution using the given mean, standard deviation and<a name="line.67"></a>
+<FONT color="green">068</FONT>         * inverse cumulative distribution accuracy.<a name="line.68"></a>
+<FONT color="green">069</FONT>         *<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @param mean mean for this distribution<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param sd standard deviation for this distribution<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param inverseCumAccuracy inverse cumulative probability accuracy<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @since 2.1<a name="line.73"></a>
+<FONT color="green">074</FONT>         */<a name="line.74"></a>
+<FONT color="green">075</FONT>        public NormalDistributionImpl(double mean, double sd, double inverseCumAccuracy) {<a name="line.75"></a>
+<FONT color="green">076</FONT>            super();<a name="line.76"></a>
+<FONT color="green">077</FONT>            setMeanInternal(mean);<a name="line.77"></a>
+<FONT color="green">078</FONT>            setStandardDeviationInternal(sd);<a name="line.78"></a>
+<FONT color="green">079</FONT>            solverAbsoluteAccuracy = inverseCumAccuracy;<a name="line.79"></a>
+<FONT color="green">080</FONT>        }<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>        /**<a name="line.82"></a>
+<FONT color="green">083</FONT>         * Creates normal distribution with the mean equal to zero and standard<a name="line.83"></a>
+<FONT color="green">084</FONT>         * deviation equal to one.<a name="line.84"></a>
+<FONT color="green">085</FONT>         */<a name="line.85"></a>
+<FONT color="green">086</FONT>        public NormalDistributionImpl(){<a name="line.86"></a>
+<FONT color="green">087</FONT>            this(0.0, 1.0);<a name="line.87"></a>
+<FONT color="green">088</FONT>        }<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>        /**<a name="line.90"></a>
+<FONT color="green">091</FONT>         * Access the mean.<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @return mean for this distribution<a name="line.92"></a>
+<FONT color="green">093</FONT>         */<a name="line.93"></a>
+<FONT color="green">094</FONT>        public double getMean() {<a name="line.94"></a>
+<FONT color="green">095</FONT>            return mean;<a name="line.95"></a>
+<FONT color="green">096</FONT>        }<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /**<a name="line.98"></a>
+<FONT color="green">099</FONT>         * Modify the mean.<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @param mean for this distribution<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.101"></a>
+<FONT color="green">102</FONT>         */<a name="line.102"></a>
+<FONT color="green">103</FONT>        @Deprecated<a name="line.103"></a>
+<FONT color="green">104</FONT>        public void setMean(double mean) {<a name="line.104"></a>
+<FONT color="green">105</FONT>            setMeanInternal(mean);<a name="line.105"></a>
+<FONT color="green">106</FONT>        }<a name="line.106"></a>
+<FONT color="green">107</FONT>        /**<a name="line.107"></a>
+<FONT color="green">108</FONT>         * Modify the mean.<a name="line.108"></a>
+<FONT color="green">109</FONT>         * @param newMean for this distribution<a name="line.109"></a>
+<FONT color="green">110</FONT>         */<a name="line.110"></a>
+<FONT color="green">111</FONT>        private void setMeanInternal(double newMean) {<a name="line.111"></a>
+<FONT color="green">112</FONT>            this.mean = newMean;<a name="line.112"></a>
+<FONT color="green">113</FONT>        }<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>        /**<a name="line.115"></a>
+<FONT color="green">116</FONT>         * Access the standard deviation.<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @return standard deviation for this distribution<a name="line.117"></a>
+<FONT color="green">118</FONT>         */<a name="line.118"></a>
+<FONT color="green">119</FONT>        public double getStandardDeviation() {<a name="line.119"></a>
+<FONT color="green">120</FONT>            return standardDeviation;<a name="line.120"></a>
+<FONT color="green">121</FONT>        }<a name="line.121"></a>
+<FONT color="green">122</FONT>    <a name="line.122"></a>
+<FONT color="green">123</FONT>        /**<a name="line.123"></a>
+<FONT color="green">124</FONT>         * Modify the standard deviation.<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @param sd standard deviation for this distribution<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @throws IllegalArgumentException if &lt;code&gt;sd&lt;/code&gt; is not positive.<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.127"></a>
+<FONT color="green">128</FONT>         */<a name="line.128"></a>
+<FONT color="green">129</FONT>        @Deprecated<a name="line.129"></a>
+<FONT color="green">130</FONT>        public void setStandardDeviation(double sd) {<a name="line.130"></a>
+<FONT color="green">131</FONT>            setStandardDeviationInternal(sd);<a name="line.131"></a>
+<FONT color="green">132</FONT>        }<a name="line.132"></a>
+<FONT color="green">133</FONT>        /**<a name="line.133"></a>
+<FONT color="green">134</FONT>         * Modify the standard deviation.<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @param sd standard deviation for this distribution<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @throws IllegalArgumentException if &lt;code&gt;sd&lt;/code&gt; is not positive.<a name="line.136"></a>
+<FONT color="green">137</FONT>         */<a name="line.137"></a>
+<FONT color="green">138</FONT>        private void setStandardDeviationInternal(double sd) {<a name="line.138"></a>
+<FONT color="green">139</FONT>            if (sd &lt;= 0.0) {<a name="line.139"></a>
+<FONT color="green">140</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.140"></a>
+<FONT color="green">141</FONT>                      "standard deviation must be positive ({0})",<a name="line.141"></a>
+<FONT color="green">142</FONT>                      sd);<a name="line.142"></a>
+<FONT color="green">143</FONT>            }<a name="line.143"></a>
+<FONT color="green">144</FONT>            standardDeviation = sd;<a name="line.144"></a>
+<FONT color="green">145</FONT>        }<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>        /**<a name="line.147"></a>
+<FONT color="green">148</FONT>         * Return the probability density for a particular point.<a name="line.148"></a>
+<FONT color="green">149</FONT>         *<a name="line.149"></a>
+<FONT color="green">150</FONT>         * @param x The point at which the density should be computed.<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @return The pdf at point x.<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @deprecated<a name="line.152"></a>
+<FONT color="green">153</FONT>         */<a name="line.153"></a>
+<FONT color="green">154</FONT>        public double density(Double x) {<a name="line.154"></a>
+<FONT color="green">155</FONT>            return density(x.doubleValue());<a name="line.155"></a>
+<FONT color="green">156</FONT>        }<a name="line.156"></a>
+<FONT color="green">157</FONT>    <a name="line.157"></a>
+<FONT color="green">158</FONT>        /**<a name="line.158"></a>
+<FONT color="green">159</FONT>         * Returns the probability density for a particular point.<a name="line.159"></a>
+<FONT color="green">160</FONT>         *<a name="line.160"></a>
+<FONT color="green">161</FONT>         * @param x The point at which the density should be computed.<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @return The pdf at point x.<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @since 2.1<a name="line.163"></a>
+<FONT color="green">164</FONT>         */<a name="line.164"></a>
+<FONT color="green">165</FONT>        public double density(double x) {<a name="line.165"></a>
+<FONT color="green">166</FONT>            double x0 = x - mean;<a name="line.166"></a>
+<FONT color="green">167</FONT>            return Math.exp(-x0 * x0 / (2 * standardDeviation * standardDeviation)) / (standardDeviation * SQRT2PI);<a name="line.167"></a>
+<FONT color="green">168</FONT>        }<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>        /**<a name="line.170"></a>
+<FONT color="green">171</FONT>         * For this distribution, X, this method returns P(X &amp;lt; &lt;code&gt;x&lt;/code&gt;).<a name="line.171"></a>
+<FONT color="green">172</FONT>         * @param x the value at which the CDF is evaluated.<a name="line.172"></a>
+<FONT color="green">173</FONT>         * @return CDF evaluted at &lt;code&gt;x&lt;/code&gt;.<a name="line.173"></a>
+<FONT color="green">174</FONT>         * @throws MathException if the algorithm fails to converge; unless<a name="line.174"></a>
+<FONT color="green">175</FONT>         * x is more than 20 standard deviations from the mean, in which case the<a name="line.175"></a>
+<FONT color="green">176</FONT>         * convergence exception is caught and 0 or 1 is returned.<a name="line.176"></a>
+<FONT color="green">177</FONT>         */<a name="line.177"></a>
+<FONT color="green">178</FONT>        public double cumulativeProbability(double x) throws MathException {<a name="line.178"></a>
+<FONT color="green">179</FONT>            try {<a name="line.179"></a>
+<FONT color="green">180</FONT>                return 0.5 * (1.0 + Erf.erf((x - mean) /<a name="line.180"></a>
+<FONT color="green">181</FONT>                        (standardDeviation * Math.sqrt(2.0))));<a name="line.181"></a>
+<FONT color="green">182</FONT>            } catch (MaxIterationsExceededException ex) {<a name="line.182"></a>
+<FONT color="green">183</FONT>                if (x &lt; (mean - 20 * standardDeviation)) { // JDK 1.5 blows at 38<a name="line.183"></a>
+<FONT color="green">184</FONT>                    return 0.0d;<a name="line.184"></a>
+<FONT color="green">185</FONT>                } else if (x &gt; (mean + 20 * standardDeviation)) {<a name="line.185"></a>
+<FONT color="green">186</FONT>                    return 1.0d;<a name="line.186"></a>
+<FONT color="green">187</FONT>                } else {<a name="line.187"></a>
+<FONT color="green">188</FONT>                    throw ex;<a name="line.188"></a>
+<FONT color="green">189</FONT>                }<a name="line.189"></a>
+<FONT color="green">190</FONT>            }<a name="line.190"></a>
+<FONT color="green">191</FONT>        }<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>        /**<a name="line.193"></a>
+<FONT color="green">194</FONT>         * Return the absolute accuracy setting of the solver used to estimate<a name="line.194"></a>
+<FONT color="green">195</FONT>         * inverse cumulative probabilities.<a name="line.195"></a>
+<FONT color="green">196</FONT>         *<a name="line.196"></a>
+<FONT color="green">197</FONT>         * @return the solver absolute accuracy<a name="line.197"></a>
+<FONT color="green">198</FONT>         * @since 2.1<a name="line.198"></a>
+<FONT color="green">199</FONT>         */<a name="line.199"></a>
+<FONT color="green">200</FONT>        @Override<a name="line.200"></a>
+<FONT color="green">201</FONT>        protected double getSolverAbsoluteAccuracy() {<a name="line.201"></a>
+<FONT color="green">202</FONT>            return solverAbsoluteAccuracy;<a name="line.202"></a>
+<FONT color="green">203</FONT>        }<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>        /**<a name="line.205"></a>
+<FONT color="green">206</FONT>         * For this distribution, X, this method returns the critical point x, such<a name="line.206"></a>
+<FONT color="green">207</FONT>         * that P(X &amp;lt; x) = &lt;code&gt;p&lt;/code&gt;.<a name="line.207"></a>
+<FONT color="green">208</FONT>         * &lt;p&gt;<a name="line.208"></a>
+<FONT color="green">209</FONT>         * Returns &lt;code&gt;Double.NEGATIVE_INFINITY&lt;/code&gt; for p=0 and<a name="line.209"></a>
+<FONT color="green">210</FONT>         * &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt; for p=1.&lt;/p&gt;<a name="line.210"></a>
+<FONT color="green">211</FONT>         *<a name="line.211"></a>
+<FONT color="green">212</FONT>         * @param p the desired probability<a name="line.212"></a>
+<FONT color="green">213</FONT>         * @return x, such that P(X &amp;lt; x) = &lt;code&gt;p&lt;/code&gt;<a name="line.213"></a>
+<FONT color="green">214</FONT>         * @throws MathException if the inverse cumulative probability can not be<a name="line.214"></a>
+<FONT color="green">215</FONT>         *         computed due to convergence or other numerical errors.<a name="line.215"></a>
+<FONT color="green">216</FONT>         * @throws IllegalArgumentException if &lt;code&gt;p&lt;/code&gt; is not a valid<a name="line.216"></a>
+<FONT color="green">217</FONT>         *         probability.<a name="line.217"></a>
+<FONT color="green">218</FONT>         */<a name="line.218"></a>
+<FONT color="green">219</FONT>        @Override<a name="line.219"></a>
+<FONT color="green">220</FONT>        public double inverseCumulativeProbability(final double p)<a name="line.220"></a>
+<FONT color="green">221</FONT>        throws MathException {<a name="line.221"></a>
+<FONT color="green">222</FONT>            if (p == 0) {<a name="line.222"></a>
+<FONT color="green">223</FONT>                return Double.NEGATIVE_INFINITY;<a name="line.223"></a>
+<FONT color="green">224</FONT>            }<a name="line.224"></a>
+<FONT color="green">225</FONT>            if (p == 1) {<a name="line.225"></a>
+<FONT color="green">226</FONT>                return Double.POSITIVE_INFINITY;<a name="line.226"></a>
+<FONT color="green">227</FONT>            }<a name="line.227"></a>
+<FONT color="green">228</FONT>            return super.inverseCumulativeProbability(p);<a name="line.228"></a>
+<FONT color="green">229</FONT>        }<a name="line.229"></a>
+<FONT color="green">230</FONT>    <a name="line.230"></a>
+<FONT color="green">231</FONT>        /**<a name="line.231"></a>
+<FONT color="green">232</FONT>         * Access the domain value lower bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.232"></a>
+<FONT color="green">233</FONT>         * bracket a CDF root.  This method is used by<a name="line.233"></a>
+<FONT color="green">234</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.234"></a>
+<FONT color="green">235</FONT>         *<a name="line.235"></a>
+<FONT color="green">236</FONT>         * @param p the desired probability for the critical value<a name="line.236"></a>
+<FONT color="green">237</FONT>         * @return domain value lower bound, i.e.<a name="line.237"></a>
+<FONT color="green">238</FONT>         *         P(X &amp;lt; &lt;i&gt;lower bound&lt;/i&gt;) &amp;lt; &lt;code&gt;p&lt;/code&gt;<a name="line.238"></a>
+<FONT color="green">239</FONT>         */<a name="line.239"></a>
+<FONT color="green">240</FONT>        @Override<a name="line.240"></a>
+<FONT color="green">241</FONT>        protected double getDomainLowerBound(double p) {<a name="line.241"></a>
+<FONT color="green">242</FONT>            double ret;<a name="line.242"></a>
+<FONT color="green">243</FONT>    <a name="line.243"></a>
+<FONT color="green">244</FONT>            if (p &lt; .5) {<a name="line.244"></a>
+<FONT color="green">245</FONT>                ret = -Double.MAX_VALUE;<a name="line.245"></a>
+<FONT color="green">246</FONT>            } else {<a name="line.246"></a>
+<FONT color="green">247</FONT>                ret = mean;<a name="line.247"></a>
+<FONT color="green">248</FONT>            }<a name="line.248"></a>
+<FONT color="green">249</FONT>    <a name="line.249"></a>
+<FONT color="green">250</FONT>            return ret;<a name="line.250"></a>
+<FONT color="green">251</FONT>        }<a name="line.251"></a>
+<FONT color="green">252</FONT>    <a name="line.252"></a>
+<FONT color="green">253</FONT>        /**<a name="line.253"></a>
+<FONT color="green">254</FONT>         * Access the domain value upper bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.254"></a>
+<FONT color="green">255</FONT>         * bracket a CDF root.  This method is used by<a name="line.255"></a>
+<FONT color="green">256</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.256"></a>
+<FONT color="green">257</FONT>         *<a name="line.257"></a>
+<FONT color="green">258</FONT>         * @param p the desired probability for the critical value<a name="line.258"></a>
+<FONT color="green">259</FONT>         * @return domain value upper bound, i.e.<a name="line.259"></a>
+<FONT color="green">260</FONT>         *         P(X &amp;lt; &lt;i&gt;upper bound&lt;/i&gt;) &amp;gt; &lt;code&gt;p&lt;/code&gt;<a name="line.260"></a>
+<FONT color="green">261</FONT>         */<a name="line.261"></a>
+<FONT color="green">262</FONT>        @Override<a name="line.262"></a>
+<FONT color="green">263</FONT>        protected double getDomainUpperBound(double p) {<a name="line.263"></a>
+<FONT color="green">264</FONT>            double ret;<a name="line.264"></a>
+<FONT color="green">265</FONT>    <a name="line.265"></a>
+<FONT color="green">266</FONT>            if (p &lt; .5) {<a name="line.266"></a>
+<FONT color="green">267</FONT>                ret = mean;<a name="line.267"></a>
+<FONT color="green">268</FONT>            } else {<a name="line.268"></a>
+<FONT color="green">269</FONT>                ret = Double.MAX_VALUE;<a name="line.269"></a>
+<FONT color="green">270</FONT>            }<a name="line.270"></a>
+<FONT color="green">271</FONT>    <a name="line.271"></a>
+<FONT color="green">272</FONT>            return ret;<a name="line.272"></a>
+<FONT color="green">273</FONT>        }<a name="line.273"></a>
+<FONT color="green">274</FONT>    <a name="line.274"></a>
+<FONT color="green">275</FONT>        /**<a name="line.275"></a>
+<FONT color="green">276</FONT>         * Access the initial domain value, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.276"></a>
+<FONT color="green">277</FONT>         * bracket a CDF root.  This method is used by<a name="line.277"></a>
+<FONT color="green">278</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.278"></a>
+<FONT color="green">279</FONT>         *<a name="line.279"></a>
+<FONT color="green">280</FONT>         * @param p the desired probability for the critical value<a name="line.280"></a>
+<FONT color="green">281</FONT>         * @return initial domain value<a name="line.281"></a>
+<FONT color="green">282</FONT>         */<a name="line.282"></a>
+<FONT color="green">283</FONT>        @Override<a name="line.283"></a>
+<FONT color="green">284</FONT>        protected double getInitialDomain(double p) {<a name="line.284"></a>
+<FONT color="green">285</FONT>            double ret;<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>            if (p &lt; .5) {<a name="line.287"></a>
+<FONT color="green">288</FONT>                ret = mean - standardDeviation;<a name="line.288"></a>
+<FONT color="green">289</FONT>            } else if (p &gt; .5) {<a name="line.289"></a>
+<FONT color="green">290</FONT>                ret = mean + standardDeviation;<a name="line.290"></a>
+<FONT color="green">291</FONT>            } else {<a name="line.291"></a>
+<FONT color="green">292</FONT>                ret = mean;<a name="line.292"></a>
+<FONT color="green">293</FONT>            }<a name="line.293"></a>
+<FONT color="green">294</FONT>    <a name="line.294"></a>
+<FONT color="green">295</FONT>            return ret;<a name="line.295"></a>
+<FONT color="green">296</FONT>        }<a name="line.296"></a>
+<FONT color="green">297</FONT>    }<a name="line.297"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/PascalDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,139 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * The Pascal distribution.  The Pascal distribution is a special case of the<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Negative Binomial distribution where the number of successes parameter is an<a name="line.21"></a>
+<FONT color="green">022</FONT>     * integer.<a name="line.22"></a>
+<FONT color="green">023</FONT>     *<a name="line.23"></a>
+<FONT color="green">024</FONT>     * There are various ways to express the probability mass and distribution<a name="line.24"></a>
+<FONT color="green">025</FONT>     * functions for the Pascal distribution.  The convention employed by the<a name="line.25"></a>
+<FONT color="green">026</FONT>     * library is to express these functions in terms of the number of failures in<a name="line.26"></a>
+<FONT color="green">027</FONT>     * a Bernoulli experiment [2].<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * References:<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;ol&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/NegativeBinomialDistribution.html"&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * Negative Binomial Distribution&lt;/a&gt;&lt;/li&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;oi&gt;&lt;a href="http://en.wikipedia.org/wiki/Negative_binomial_distribution#Waiting_time_in_a_Bernoulli_process"&gt;Waiting Time in a Bernoulli Process&lt;/a&gt;&lt;/li&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;/ul&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @version $Revision: 920852 $ $Date: 2010-03-09 07:53:44 -0500 (Tue, 09 Mar 2010) $<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @since 1.2<a name="line.39"></a>
+<FONT color="green">040</FONT>     */<a name="line.40"></a>
+<FONT color="green">041</FONT>    public interface PascalDistribution extends IntegerDistribution {<a name="line.41"></a>
+<FONT color="green">042</FONT>        /**<a name="line.42"></a>
+<FONT color="green">043</FONT>         * Access the number of successes for this distribution.<a name="line.43"></a>
+<FONT color="green">044</FONT>         *<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @return the number of successes<a name="line.45"></a>
+<FONT color="green">046</FONT>         */<a name="line.46"></a>
+<FONT color="green">047</FONT>        int getNumberOfSuccesses();<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /**<a name="line.49"></a>
+<FONT color="green">050</FONT>         * Access the probability of success for this distribution.<a name="line.50"></a>
+<FONT color="green">051</FONT>         *<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @return the probability of success<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        double getProbabilityOfSuccess();<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /**<a name="line.56"></a>
+<FONT color="green">057</FONT>         * Change the number of successes for this distribution.<a name="line.57"></a>
+<FONT color="green">058</FONT>         *<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @param successes the new number of successes<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @deprecated as of v2.1<a name="line.60"></a>
+<FONT color="green">061</FONT>         */<a name="line.61"></a>
+<FONT color="green">062</FONT>        @Deprecated<a name="line.62"></a>
+<FONT color="green">063</FONT>        void setNumberOfSuccesses(int successes);<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /**<a name="line.65"></a>
+<FONT color="green">066</FONT>         * Change the probability of success for this distribution.<a name="line.66"></a>
+<FONT color="green">067</FONT>         *<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param p the new probability of success<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @deprecated as of v2.1<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        @Deprecated<a name="line.71"></a>
+<FONT color="green">072</FONT>        void setProbabilityOfSuccess(double p);<a name="line.72"></a>
+<FONT color="green">073</FONT>    }<a name="line.73"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/PascalDistributionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,278 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.special.Beta;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * The default implementation of {@link PascalDistribution}.<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @version $Revision: 920852 $ $Date: 2010-03-09 07:53:44 -0500 (Tue, 09 Mar 2010) $<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @since 1.2<a name="line.29"></a>
+<FONT color="green">030</FONT>     */<a name="line.30"></a>
+<FONT color="green">031</FONT>    public class PascalDistributionImpl extends AbstractIntegerDistribution<a name="line.31"></a>
+<FONT color="green">032</FONT>        implements PascalDistribution, Serializable {<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /** Serializable version identifier */<a name="line.34"></a>
+<FONT color="green">035</FONT>        private static final long serialVersionUID = 6751309484392813623L;<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /** The number of successes */<a name="line.37"></a>
+<FONT color="green">038</FONT>        private int numberOfSuccesses;<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** The probability of success */<a name="line.40"></a>
+<FONT color="green">041</FONT>        private double probabilityOfSuccess;<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /**<a name="line.43"></a>
+<FONT color="green">044</FONT>         * Create a binomial distribution with the given number of trials and<a name="line.44"></a>
+<FONT color="green">045</FONT>         * probability of success.<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param r the number of successes<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @param p the probability of success<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        public PascalDistributionImpl(int r, double p) {<a name="line.49"></a>
+<FONT color="green">050</FONT>            super();<a name="line.50"></a>
+<FONT color="green">051</FONT>            setNumberOfSuccessesInternal(r);<a name="line.51"></a>
+<FONT color="green">052</FONT>            setProbabilityOfSuccessInternal(p);<a name="line.52"></a>
+<FONT color="green">053</FONT>        }<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * Access the number of successes for this distribution.<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @return the number of successes<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public int getNumberOfSuccesses() {<a name="line.59"></a>
+<FONT color="green">060</FONT>            return numberOfSuccesses;<a name="line.60"></a>
+<FONT color="green">061</FONT>        }<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /**<a name="line.63"></a>
+<FONT color="green">064</FONT>         * Access the probability of success for this distribution.<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @return the probability of success<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        public double getProbabilityOfSuccess() {<a name="line.67"></a>
+<FONT color="green">068</FONT>            return probabilityOfSuccess;<a name="line.68"></a>
+<FONT color="green">069</FONT>        }<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /**<a name="line.71"></a>
+<FONT color="green">072</FONT>         * Change the number of successes for this distribution.<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @param successes the new number of successes<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @throws IllegalArgumentException if &lt;code&gt;successes&lt;/code&gt; is not<a name="line.74"></a>
+<FONT color="green">075</FONT>         *         positive.<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.76"></a>
+<FONT color="green">077</FONT>         */<a name="line.77"></a>
+<FONT color="green">078</FONT>        @Deprecated<a name="line.78"></a>
+<FONT color="green">079</FONT>        public void setNumberOfSuccesses(int successes) {<a name="line.79"></a>
+<FONT color="green">080</FONT>            setNumberOfSuccessesInternal(successes);<a name="line.80"></a>
+<FONT color="green">081</FONT>        }<a name="line.81"></a>
+<FONT color="green">082</FONT>        /**<a name="line.82"></a>
+<FONT color="green">083</FONT>         * Change the number of successes for this distribution.<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @param successes the new number of successes<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @throws IllegalArgumentException if &lt;code&gt;successes&lt;/code&gt; is not<a name="line.85"></a>
+<FONT color="green">086</FONT>         *         positive.<a name="line.86"></a>
+<FONT color="green">087</FONT>         */<a name="line.87"></a>
+<FONT color="green">088</FONT>        private void setNumberOfSuccessesInternal(int successes) {<a name="line.88"></a>
+<FONT color="green">089</FONT>            if (successes &lt; 0) {<a name="line.89"></a>
+<FONT color="green">090</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.90"></a>
+<FONT color="green">091</FONT>                      "number of successes must be non-negative ({0})",<a name="line.91"></a>
+<FONT color="green">092</FONT>                      successes);<a name="line.92"></a>
+<FONT color="green">093</FONT>            }<a name="line.93"></a>
+<FONT color="green">094</FONT>            numberOfSuccesses = successes;<a name="line.94"></a>
+<FONT color="green">095</FONT>        }<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /**<a name="line.97"></a>
+<FONT color="green">098</FONT>         * Change the probability of success for this distribution.<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @param p the new probability of success<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @throws IllegalArgumentException if &lt;code&gt;p&lt;/code&gt; is not a valid<a name="line.100"></a>
+<FONT color="green">101</FONT>         *         probability.<a name="line.101"></a>
+<FONT color="green">102</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.102"></a>
+<FONT color="green">103</FONT>         */<a name="line.103"></a>
+<FONT color="green">104</FONT>        @Deprecated<a name="line.104"></a>
+<FONT color="green">105</FONT>        public void setProbabilityOfSuccess(double p) {<a name="line.105"></a>
+<FONT color="green">106</FONT>            setProbabilityOfSuccessInternal(p);<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>        /**<a name="line.108"></a>
+<FONT color="green">109</FONT>         * Change the probability of success for this distribution.<a name="line.109"></a>
+<FONT color="green">110</FONT>         * @param p the new probability of success<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @throws IllegalArgumentException if &lt;code&gt;p&lt;/code&gt; is not a valid<a name="line.111"></a>
+<FONT color="green">112</FONT>         *         probability.<a name="line.112"></a>
+<FONT color="green">113</FONT>         */<a name="line.113"></a>
+<FONT color="green">114</FONT>        private void setProbabilityOfSuccessInternal(double p) {<a name="line.114"></a>
+<FONT color="green">115</FONT>            if (p &lt; 0.0 || p &gt; 1.0) {<a name="line.115"></a>
+<FONT color="green">116</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.116"></a>
+<FONT color="green">117</FONT>                      "{0} out of [{1}, {2}] range", p, 0.0, 1.0);<a name="line.117"></a>
+<FONT color="green">118</FONT>            }<a name="line.118"></a>
+<FONT color="green">119</FONT>            probabilityOfSuccess = p;<a name="line.119"></a>
+<FONT color="green">120</FONT>        }<a name="line.120"></a>
+<FONT color="green">121</FONT>    <a name="line.121"></a>
+<FONT color="green">122</FONT>        /**<a name="line.122"></a>
+<FONT color="green">123</FONT>         * Access the domain value lower bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.123"></a>
+<FONT color="green">124</FONT>         * bracket a PDF root.<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @param p the desired probability for the critical value<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @return domain value lower bound, i.e. P(X &amp;lt; &lt;i&gt;lower bound&lt;/i&gt;) &amp;lt;<a name="line.126"></a>
+<FONT color="green">127</FONT>         *         &lt;code&gt;p&lt;/code&gt;<a name="line.127"></a>
+<FONT color="green">128</FONT>         */<a name="line.128"></a>
+<FONT color="green">129</FONT>        @Override<a name="line.129"></a>
+<FONT color="green">130</FONT>        protected int getDomainLowerBound(double p) {<a name="line.130"></a>
+<FONT color="green">131</FONT>            return -1;<a name="line.131"></a>
+<FONT color="green">132</FONT>        }<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>        /**<a name="line.134"></a>
+<FONT color="green">135</FONT>         * Access the domain value upper bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.135"></a>
+<FONT color="green">136</FONT>         * bracket a PDF root.<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @param p the desired probability for the critical value<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @return domain value upper bound, i.e. P(X &amp;lt; &lt;i&gt;upper bound&lt;/i&gt;) &amp;gt;<a name="line.138"></a>
+<FONT color="green">139</FONT>         *         &lt;code&gt;p&lt;/code&gt;<a name="line.139"></a>
+<FONT color="green">140</FONT>         */<a name="line.140"></a>
+<FONT color="green">141</FONT>        @Override<a name="line.141"></a>
+<FONT color="green">142</FONT>        protected int getDomainUpperBound(double p) {<a name="line.142"></a>
+<FONT color="green">143</FONT>            // use MAX - 1 because MAX causes loop<a name="line.143"></a>
+<FONT color="green">144</FONT>            return Integer.MAX_VALUE - 1;<a name="line.144"></a>
+<FONT color="green">145</FONT>        }<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>        /**<a name="line.147"></a>
+<FONT color="green">148</FONT>         * For this distribution, X, this method returns P(X &amp;le; x).<a name="line.148"></a>
+<FONT color="green">149</FONT>         * @param x the value at which the PDF is evaluated<a name="line.149"></a>
+<FONT color="green">150</FONT>         * @return PDF for this distribution<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @throws MathException if the cumulative probability can not be computed<a name="line.151"></a>
+<FONT color="green">152</FONT>         *         due to convergence or other numerical errors<a name="line.152"></a>
+<FONT color="green">153</FONT>         */<a name="line.153"></a>
+<FONT color="green">154</FONT>        @Override<a name="line.154"></a>
+<FONT color="green">155</FONT>        public double cumulativeProbability(int x) throws MathException {<a name="line.155"></a>
+<FONT color="green">156</FONT>            double ret;<a name="line.156"></a>
+<FONT color="green">157</FONT>            if (x &lt; 0) {<a name="line.157"></a>
+<FONT color="green">158</FONT>                ret = 0.0;<a name="line.158"></a>
+<FONT color="green">159</FONT>            } else {<a name="line.159"></a>
+<FONT color="green">160</FONT>                ret = Beta.regularizedBeta(probabilityOfSuccess,<a name="line.160"></a>
+<FONT color="green">161</FONT>                    numberOfSuccesses, x + 1);<a name="line.161"></a>
+<FONT color="green">162</FONT>            }<a name="line.162"></a>
+<FONT color="green">163</FONT>            return ret;<a name="line.163"></a>
+<FONT color="green">164</FONT>        }<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>        /**<a name="line.166"></a>
+<FONT color="green">167</FONT>         * For this distribution, X, this method returns P(X = x).<a name="line.167"></a>
+<FONT color="green">168</FONT>         * @param x the value at which the PMF is evaluated<a name="line.168"></a>
+<FONT color="green">169</FONT>         * @return PMF for this distribution<a name="line.169"></a>
+<FONT color="green">170</FONT>         */<a name="line.170"></a>
+<FONT color="green">171</FONT>        public double probability(int x) {<a name="line.171"></a>
+<FONT color="green">172</FONT>            double ret;<a name="line.172"></a>
+<FONT color="green">173</FONT>            if (x &lt; 0) {<a name="line.173"></a>
+<FONT color="green">174</FONT>                ret = 0.0;<a name="line.174"></a>
+<FONT color="green">175</FONT>            } else {<a name="line.175"></a>
+<FONT color="green">176</FONT>                ret = MathUtils.binomialCoefficientDouble(x +<a name="line.176"></a>
+<FONT color="green">177</FONT>                      numberOfSuccesses - 1, numberOfSuccesses - 1) *<a name="line.177"></a>
+<FONT color="green">178</FONT>                      Math.pow(probabilityOfSuccess, numberOfSuccesses) *<a name="line.178"></a>
+<FONT color="green">179</FONT>                      Math.pow(1.0 - probabilityOfSuccess, x);<a name="line.179"></a>
+<FONT color="green">180</FONT>            }<a name="line.180"></a>
+<FONT color="green">181</FONT>            return ret;<a name="line.181"></a>
+<FONT color="green">182</FONT>        }<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>        /**<a name="line.184"></a>
+<FONT color="green">185</FONT>         * For this distribution, X, this method returns the largest x, such that<a name="line.185"></a>
+<FONT color="green">186</FONT>         * P(X &amp;le; x) &amp;le; &lt;code&gt;p&lt;/code&gt;.<a name="line.186"></a>
+<FONT color="green">187</FONT>         * &lt;p&gt;<a name="line.187"></a>
+<FONT color="green">188</FONT>         * Returns &lt;code&gt;-1&lt;/code&gt; for p=0 and &lt;code&gt;Integer.MAX_VALUE&lt;/code&gt;<a name="line.188"></a>
+<FONT color="green">189</FONT>         * for p=1.&lt;/p&gt;<a name="line.189"></a>
+<FONT color="green">190</FONT>         * @param p the desired probability<a name="line.190"></a>
+<FONT color="green">191</FONT>         * @return the largest x such that P(X &amp;le; x) &lt;= p<a name="line.191"></a>
+<FONT color="green">192</FONT>         * @throws MathException if the inverse cumulative probability can not be<a name="line.192"></a>
+<FONT color="green">193</FONT>         *         computed due to convergence or other numerical errors.<a name="line.193"></a>
+<FONT color="green">194</FONT>         * @throws IllegalArgumentException if p &lt; 0 or p &gt; 1<a name="line.194"></a>
+<FONT color="green">195</FONT>         */<a name="line.195"></a>
+<FONT color="green">196</FONT>        @Override<a name="line.196"></a>
+<FONT color="green">197</FONT>        public int inverseCumulativeProbability(final double p)<a name="line.197"></a>
+<FONT color="green">198</FONT>            throws MathException {<a name="line.198"></a>
+<FONT color="green">199</FONT>            int ret;<a name="line.199"></a>
+<FONT color="green">200</FONT>    <a name="line.200"></a>
+<FONT color="green">201</FONT>            // handle extreme values explicitly<a name="line.201"></a>
+<FONT color="green">202</FONT>            if (p == 0) {<a name="line.202"></a>
+<FONT color="green">203</FONT>                ret = -1;<a name="line.203"></a>
+<FONT color="green">204</FONT>            } else if (p == 1) {<a name="line.204"></a>
+<FONT color="green">205</FONT>                ret = Integer.MAX_VALUE;<a name="line.205"></a>
+<FONT color="green">206</FONT>            } else {<a name="line.206"></a>
+<FONT color="green">207</FONT>                ret = super.inverseCumulativeProbability(p);<a name="line.207"></a>
+<FONT color="green">208</FONT>            }<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>            return ret;<a name="line.210"></a>
+<FONT color="green">211</FONT>        }<a name="line.211"></a>
+<FONT color="green">212</FONT>    }<a name="line.212"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/PoissonDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,130 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Interface representing the Poisson Distribution.<a name="line.22"></a>
+<FONT color="green">023</FONT>     *<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * References:<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;ul&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/PoissonDistribution.html"&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Poisson distribution&lt;/a&gt;&lt;/li&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;/ul&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     *<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @version $Revision: 920852 $ $Date: 2010-03-09 07:53:44 -0500 (Tue, 09 Mar 2010) $<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public interface PoissonDistribution extends IntegerDistribution {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /**<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Get the mean for the distribution.<a name="line.37"></a>
+<FONT color="green">038</FONT>         *<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @return the mean for the distribution.<a name="line.39"></a>
+<FONT color="green">040</FONT>         */<a name="line.40"></a>
+<FONT color="green">041</FONT>        double getMean();<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /**<a name="line.43"></a>
+<FONT color="green">044</FONT>         * Set the mean for the distribution.<a name="line.44"></a>
+<FONT color="green">045</FONT>         * The parameter value must be positive; otherwise an<a name="line.45"></a>
+<FONT color="green">046</FONT>         * &lt;code&gt;IllegalArgument&lt;/code&gt; is thrown.<a name="line.46"></a>
+<FONT color="green">047</FONT>         *<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @param p the mean<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @throws IllegalArgumentException if p &amp;le; 0<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @deprecated as of v2.1<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        @Deprecated<a name="line.52"></a>
+<FONT color="green">053</FONT>        void setMean(double p);<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * Calculates the Poisson distribution function using a normal approximation.<a name="line.56"></a>
+<FONT color="green">057</FONT>         *<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @param x the upper bound, inclusive<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @return the distribution function value calculated using a normal approximation<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @throws MathException if an error occurs computing the normal approximation<a name="line.60"></a>
+<FONT color="green">061</FONT>         */<a name="line.61"></a>
+<FONT color="green">062</FONT>        double normalApproximateProbability(int x) throws MathException;<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>    }<a name="line.64"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/PoissonDistributionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,345 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.special.Gamma;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Implementation for the {@link PoissonDistribution}.<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @version $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $<a name="line.29"></a>
+<FONT color="green">030</FONT>     */<a name="line.30"></a>
+<FONT color="green">031</FONT>    public class PoissonDistributionImpl extends AbstractIntegerDistribution<a name="line.31"></a>
+<FONT color="green">032</FONT>            implements PoissonDistribution, Serializable {<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /**<a name="line.34"></a>
+<FONT color="green">035</FONT>         * Default maximum number of iterations for cumulative probability calculations.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @since 2.1<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        public static final int DEFAULT_MAX_ITERATIONS = 10000000;<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /**<a name="line.40"></a>
+<FONT color="green">041</FONT>         * Default convergence criterion.<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @since 2.1<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        public static final double DEFAULT_EPSILON = 1E-12;<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** Serializable version identifier */<a name="line.46"></a>
+<FONT color="green">047</FONT>        private static final long serialVersionUID = -3349935121172596109L;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** Distribution used to compute normal approximation. */<a name="line.49"></a>
+<FONT color="green">050</FONT>        private NormalDistribution normal;<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * Holds the Poisson mean for the distribution.<a name="line.53"></a>
+<FONT color="green">054</FONT>         */<a name="line.54"></a>
+<FONT color="green">055</FONT>        private double mean;<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /**<a name="line.57"></a>
+<FONT color="green">058</FONT>         * Maximum number of iterations for cumulative probability.<a name="line.58"></a>
+<FONT color="green">059</FONT>         *<a name="line.59"></a>
+<FONT color="green">060</FONT>         * Cumulative probabilities are estimated using either Lanczos series approximation of<a name="line.60"></a>
+<FONT color="green">061</FONT>         * Gamma#regularizedGammaP or continued fraction approximation of Gamma#regularizedGammaQ.<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        private int maxIterations = DEFAULT_MAX_ITERATIONS;<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /**<a name="line.65"></a>
+<FONT color="green">066</FONT>         * Convergence criterion for cumulative probability.<a name="line.66"></a>
+<FONT color="green">067</FONT>         */<a name="line.67"></a>
+<FONT color="green">068</FONT>        private double epsilon = DEFAULT_EPSILON;<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /**<a name="line.70"></a>
+<FONT color="green">071</FONT>         * Create a new Poisson distribution with the given the mean. The mean value<a name="line.71"></a>
+<FONT color="green">072</FONT>         * must be positive; otherwise an &lt;code&gt;IllegalArgument&lt;/code&gt; is thrown.<a name="line.72"></a>
+<FONT color="green">073</FONT>         *<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @param p the Poisson mean<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @throws IllegalArgumentException if p &amp;le; 0<a name="line.75"></a>
+<FONT color="green">076</FONT>         */<a name="line.76"></a>
+<FONT color="green">077</FONT>        public PoissonDistributionImpl(double p) {<a name="line.77"></a>
+<FONT color="green">078</FONT>            this(p, new NormalDistributionImpl());<a name="line.78"></a>
+<FONT color="green">079</FONT>        }<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /**<a name="line.81"></a>
+<FONT color="green">082</FONT>         * Create a new Poisson distribution with the given mean, convergence criterion<a name="line.82"></a>
+<FONT color="green">083</FONT>         * and maximum number of iterations.<a name="line.83"></a>
+<FONT color="green">084</FONT>         *<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @param p the Poisson mean<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @param epsilon the convergence criteria for cumulative probabilites<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @param maxIterations the maximum number of iterations for cumulative probabilites<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @since 2.1<a name="line.88"></a>
+<FONT color="green">089</FONT>         */<a name="line.89"></a>
+<FONT color="green">090</FONT>        public PoissonDistributionImpl(double p, double epsilon, int maxIterations) {<a name="line.90"></a>
+<FONT color="green">091</FONT>            setMean(p);<a name="line.91"></a>
+<FONT color="green">092</FONT>            this.epsilon = epsilon;<a name="line.92"></a>
+<FONT color="green">093</FONT>            this.maxIterations = maxIterations;<a name="line.93"></a>
+<FONT color="green">094</FONT>        }<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /**<a name="line.96"></a>
+<FONT color="green">097</FONT>         * Create a new Poisson distribution with the given mean and convergence criterion.<a name="line.97"></a>
+<FONT color="green">098</FONT>         *<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @param p the Poisson mean<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @param epsilon the convergence criteria for cumulative probabilites<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @since 2.1<a name="line.101"></a>
+<FONT color="green">102</FONT>         */<a name="line.102"></a>
+<FONT color="green">103</FONT>        public PoissonDistributionImpl(double p, double epsilon) {<a name="line.103"></a>
+<FONT color="green">104</FONT>            setMean(p);<a name="line.104"></a>
+<FONT color="green">105</FONT>            this.epsilon = epsilon;<a name="line.105"></a>
+<FONT color="green">106</FONT>        }<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>        /**<a name="line.108"></a>
+<FONT color="green">109</FONT>         * Create a new Poisson distribution with the given mean and maximum number of iterations.<a name="line.109"></a>
+<FONT color="green">110</FONT>         *<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @param p the Poisson mean<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @param maxIterations the maximum number of iterations for cumulative probabilites<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @since 2.1<a name="line.113"></a>
+<FONT color="green">114</FONT>         */<a name="line.114"></a>
+<FONT color="green">115</FONT>        public PoissonDistributionImpl(double p, int maxIterations) {<a name="line.115"></a>
+<FONT color="green">116</FONT>            setMean(p);<a name="line.116"></a>
+<FONT color="green">117</FONT>            this.maxIterations = maxIterations;<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /**<a name="line.121"></a>
+<FONT color="green">122</FONT>         * Create a new Poisson distribution with the given the mean. The mean value<a name="line.122"></a>
+<FONT color="green">123</FONT>         * must be positive; otherwise an &lt;code&gt;IllegalArgument&lt;/code&gt; is thrown.<a name="line.123"></a>
+<FONT color="green">124</FONT>         *<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @param p the Poisson mean<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @param z a normal distribution used to compute normal approximations.<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @throws IllegalArgumentException if p &amp;le; 0<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @since 1.2<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @deprecated as of 2.1 (to avoid possibly inconsistent state, the<a name="line.129"></a>
+<FONT color="green">130</FONT>         * "NormalDistribution" will be instantiated internally)<a name="line.130"></a>
+<FONT color="green">131</FONT>         */<a name="line.131"></a>
+<FONT color="green">132</FONT>        @Deprecated<a name="line.132"></a>
+<FONT color="green">133</FONT>        public PoissonDistributionImpl(double p, NormalDistribution z) {<a name="line.133"></a>
+<FONT color="green">134</FONT>            super();<a name="line.134"></a>
+<FONT color="green">135</FONT>            setNormalAndMeanInternal(z, p);<a name="line.135"></a>
+<FONT color="green">136</FONT>        }<a name="line.136"></a>
+<FONT color="green">137</FONT>    <a name="line.137"></a>
+<FONT color="green">138</FONT>        /**<a name="line.138"></a>
+<FONT color="green">139</FONT>         * Get the Poisson mean for the distribution.<a name="line.139"></a>
+<FONT color="green">140</FONT>         *<a name="line.140"></a>
+<FONT color="green">141</FONT>         * @return the Poisson mean for the distribution.<a name="line.141"></a>
+<FONT color="green">142</FONT>         */<a name="line.142"></a>
+<FONT color="green">143</FONT>        public double getMean() {<a name="line.143"></a>
+<FONT color="green">144</FONT>            return mean;<a name="line.144"></a>
+<FONT color="green">145</FONT>        }<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>        /**<a name="line.147"></a>
+<FONT color="green">148</FONT>         * Set the Poisson mean for the distribution. The mean value must be<a name="line.148"></a>
+<FONT color="green">149</FONT>         * positive; otherwise an &lt;code&gt;IllegalArgument&lt;/code&gt; is thrown.<a name="line.149"></a>
+<FONT color="green">150</FONT>         *<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @param p the Poisson mean value<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @throws IllegalArgumentException if p &amp;le; 0<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.153"></a>
+<FONT color="green">154</FONT>         */<a name="line.154"></a>
+<FONT color="green">155</FONT>        @Deprecated<a name="line.155"></a>
+<FONT color="green">156</FONT>        public void setMean(double p) {<a name="line.156"></a>
+<FONT color="green">157</FONT>            setNormalAndMeanInternal(normal, p);<a name="line.157"></a>
+<FONT color="green">158</FONT>        }<a name="line.158"></a>
+<FONT color="green">159</FONT>        /**<a name="line.159"></a>
+<FONT color="green">160</FONT>         * Set the Poisson mean for the distribution. The mean value must be<a name="line.160"></a>
+<FONT color="green">161</FONT>         * positive; otherwise an &lt;code&gt;IllegalArgument&lt;/code&gt; is thrown.<a name="line.161"></a>
+<FONT color="green">162</FONT>         *<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @param z the new distribution<a name="line.163"></a>
+<FONT color="green">164</FONT>         * @param p the Poisson mean value<a name="line.164"></a>
+<FONT color="green">165</FONT>         * @throws IllegalArgumentException if p &amp;le; 0<a name="line.165"></a>
+<FONT color="green">166</FONT>         */<a name="line.166"></a>
+<FONT color="green">167</FONT>        private void setNormalAndMeanInternal(NormalDistribution z,<a name="line.167"></a>
+<FONT color="green">168</FONT>                                              double p) {<a name="line.168"></a>
+<FONT color="green">169</FONT>            if (p &lt;= 0) {<a name="line.169"></a>
+<FONT color="green">170</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.170"></a>
+<FONT color="green">171</FONT>                        "the Poisson mean must be positive ({0})", p);<a name="line.171"></a>
+<FONT color="green">172</FONT>            }<a name="line.172"></a>
+<FONT color="green">173</FONT>            mean = p;<a name="line.173"></a>
+<FONT color="green">174</FONT>            normal = z;<a name="line.174"></a>
+<FONT color="green">175</FONT>            normal.setMean(p);<a name="line.175"></a>
+<FONT color="green">176</FONT>            normal.setStandardDeviation(Math.sqrt(p));<a name="line.176"></a>
+<FONT color="green">177</FONT>        }<a name="line.177"></a>
+<FONT color="green">178</FONT>    <a name="line.178"></a>
+<FONT color="green">179</FONT>        /**<a name="line.179"></a>
+<FONT color="green">180</FONT>         * The probability mass function P(X = x) for a Poisson distribution.<a name="line.180"></a>
+<FONT color="green">181</FONT>         *<a name="line.181"></a>
+<FONT color="green">182</FONT>         * @param x the value at which the probability density function is<a name="line.182"></a>
+<FONT color="green">183</FONT>         *            evaluated.<a name="line.183"></a>
+<FONT color="green">184</FONT>         * @return the value of the probability mass function at x<a name="line.184"></a>
+<FONT color="green">185</FONT>         */<a name="line.185"></a>
+<FONT color="green">186</FONT>        public double probability(int x) {<a name="line.186"></a>
+<FONT color="green">187</FONT>            double ret;<a name="line.187"></a>
+<FONT color="green">188</FONT>            if (x &lt; 0 || x == Integer.MAX_VALUE) {<a name="line.188"></a>
+<FONT color="green">189</FONT>                ret = 0.0;<a name="line.189"></a>
+<FONT color="green">190</FONT>            } else if (x == 0) {<a name="line.190"></a>
+<FONT color="green">191</FONT>                ret = Math.exp(-mean);<a name="line.191"></a>
+<FONT color="green">192</FONT>            } else {<a name="line.192"></a>
+<FONT color="green">193</FONT>                ret = Math.exp(-SaddlePointExpansion.getStirlingError(x) -<a name="line.193"></a>
+<FONT color="green">194</FONT>                      SaddlePointExpansion.getDeviancePart(x, mean)) /<a name="line.194"></a>
+<FONT color="green">195</FONT>                      Math.sqrt(MathUtils.TWO_PI * x);<a name="line.195"></a>
+<FONT color="green">196</FONT>            }<a name="line.196"></a>
+<FONT color="green">197</FONT>            return ret;<a name="line.197"></a>
+<FONT color="green">198</FONT>        }<a name="line.198"></a>
+<FONT color="green">199</FONT>    <a name="line.199"></a>
+<FONT color="green">200</FONT>        /**<a name="line.200"></a>
+<FONT color="green">201</FONT>         * The probability distribution function P(X &lt;= x) for a Poisson<a name="line.201"></a>
+<FONT color="green">202</FONT>         * distribution.<a name="line.202"></a>
+<FONT color="green">203</FONT>         *<a name="line.203"></a>
+<FONT color="green">204</FONT>         * @param x the value at which the PDF is evaluated.<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @return Poisson distribution function evaluated at x<a name="line.205"></a>
+<FONT color="green">206</FONT>         * @throws MathException if the cumulative probability can not be computed<a name="line.206"></a>
+<FONT color="green">207</FONT>         *             due to convergence or other numerical errors.<a name="line.207"></a>
+<FONT color="green">208</FONT>         */<a name="line.208"></a>
+<FONT color="green">209</FONT>        @Override<a name="line.209"></a>
+<FONT color="green">210</FONT>        public double cumulativeProbability(int x) throws MathException {<a name="line.210"></a>
+<FONT color="green">211</FONT>            if (x &lt; 0) {<a name="line.211"></a>
+<FONT color="green">212</FONT>                return 0;<a name="line.212"></a>
+<FONT color="green">213</FONT>            }<a name="line.213"></a>
+<FONT color="green">214</FONT>            if (x == Integer.MAX_VALUE) {<a name="line.214"></a>
+<FONT color="green">215</FONT>                return 1;<a name="line.215"></a>
+<FONT color="green">216</FONT>            }<a name="line.216"></a>
+<FONT color="green">217</FONT>            return Gamma.regularizedGammaQ((double) x + 1, mean, epsilon, maxIterations);<a name="line.217"></a>
+<FONT color="green">218</FONT>        }<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>        /**<a name="line.220"></a>
+<FONT color="green">221</FONT>         * Calculates the Poisson distribution function using a normal<a name="line.221"></a>
+<FONT color="green">222</FONT>         * approximation. The &lt;code&gt;N(mean, sqrt(mean))&lt;/code&gt; distribution is used<a name="line.222"></a>
+<FONT color="green">223</FONT>         * to approximate the Poisson distribution.<a name="line.223"></a>
+<FONT color="green">224</FONT>         * &lt;p&gt;<a name="line.224"></a>
+<FONT color="green">225</FONT>         * The computation uses "half-correction" -- evaluating the normal<a name="line.225"></a>
+<FONT color="green">226</FONT>         * distribution function at &lt;code&gt;x + 0.5&lt;/code&gt;<a name="line.226"></a>
+<FONT color="green">227</FONT>         * &lt;/p&gt;<a name="line.227"></a>
+<FONT color="green">228</FONT>         *<a name="line.228"></a>
+<FONT color="green">229</FONT>         * @param x the upper bound, inclusive<a name="line.229"></a>
+<FONT color="green">230</FONT>         * @return the distribution function value calculated using a normal<a name="line.230"></a>
+<FONT color="green">231</FONT>         *         approximation<a name="line.231"></a>
+<FONT color="green">232</FONT>         * @throws MathException if an error occurs computing the normal<a name="line.232"></a>
+<FONT color="green">233</FONT>         *             approximation<a name="line.233"></a>
+<FONT color="green">234</FONT>         */<a name="line.234"></a>
+<FONT color="green">235</FONT>        public double normalApproximateProbability(int x) throws MathException {<a name="line.235"></a>
+<FONT color="green">236</FONT>            // calculate the probability using half-correction<a name="line.236"></a>
+<FONT color="green">237</FONT>            return normal.cumulativeProbability(x + 0.5);<a name="line.237"></a>
+<FONT color="green">238</FONT>        }<a name="line.238"></a>
+<FONT color="green">239</FONT>    <a name="line.239"></a>
+<FONT color="green">240</FONT>        /**<a name="line.240"></a>
+<FONT color="green">241</FONT>         * Access the domain value lower bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.241"></a>
+<FONT color="green">242</FONT>         * bracket a CDF root. This method is used by<a name="line.242"></a>
+<FONT color="green">243</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.243"></a>
+<FONT color="green">244</FONT>         *<a name="line.244"></a>
+<FONT color="green">245</FONT>         * @param p the desired probability for the critical value<a name="line.245"></a>
+<FONT color="green">246</FONT>         * @return domain lower bound<a name="line.246"></a>
+<FONT color="green">247</FONT>         */<a name="line.247"></a>
+<FONT color="green">248</FONT>        @Override<a name="line.248"></a>
+<FONT color="green">249</FONT>        protected int getDomainLowerBound(double p) {<a name="line.249"></a>
+<FONT color="green">250</FONT>            return 0;<a name="line.250"></a>
+<FONT color="green">251</FONT>        }<a name="line.251"></a>
+<FONT color="green">252</FONT>    <a name="line.252"></a>
+<FONT color="green">253</FONT>        /**<a name="line.253"></a>
+<FONT color="green">254</FONT>         * Access the domain value upper bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.254"></a>
+<FONT color="green">255</FONT>         * bracket a CDF root. This method is used by<a name="line.255"></a>
+<FONT color="green">256</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.256"></a>
+<FONT color="green">257</FONT>         *<a name="line.257"></a>
+<FONT color="green">258</FONT>         * @param p the desired probability for the critical value<a name="line.258"></a>
+<FONT color="green">259</FONT>         * @return domain upper bound<a name="line.259"></a>
+<FONT color="green">260</FONT>         */<a name="line.260"></a>
+<FONT color="green">261</FONT>        @Override<a name="line.261"></a>
+<FONT color="green">262</FONT>        protected int getDomainUpperBound(double p) {<a name="line.262"></a>
+<FONT color="green">263</FONT>            return Integer.MAX_VALUE;<a name="line.263"></a>
+<FONT color="green">264</FONT>        }<a name="line.264"></a>
+<FONT color="green">265</FONT>    <a name="line.265"></a>
+<FONT color="green">266</FONT>        /**<a name="line.266"></a>
+<FONT color="green">267</FONT>         * Modify the normal distribution used to compute normal approximations. The<a name="line.267"></a>
+<FONT color="green">268</FONT>         * caller is responsible for insuring the normal distribution has the proper<a name="line.268"></a>
+<FONT color="green">269</FONT>         * parameter settings.<a name="line.269"></a>
+<FONT color="green">270</FONT>         *<a name="line.270"></a>
+<FONT color="green">271</FONT>         * @param value the new distribution<a name="line.271"></a>
+<FONT color="green">272</FONT>         * @since 1.2<a name="line.272"></a>
+<FONT color="green">273</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.273"></a>
+<FONT color="green">274</FONT>         */<a name="line.274"></a>
+<FONT color="green">275</FONT>        @Deprecated<a name="line.275"></a>
+<FONT color="green">276</FONT>        public void setNormal(NormalDistribution value) {<a name="line.276"></a>
+<FONT color="green">277</FONT>            setNormalAndMeanInternal(value, mean);<a name="line.277"></a>
+<FONT color="green">278</FONT>        }<a name="line.278"></a>
+<FONT color="green">279</FONT>    }<a name="line.279"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/TDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,112 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Student's t-Distribution.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>     * &lt;p&gt;<a name="line.22"></a>
+<FONT color="green">023</FONT>     * References:<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;ul&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/Studentst-Distribution.html"&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Student's t-Distribution&lt;/a&gt;&lt;/li&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;/ul&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     *<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 920852 $ $Date: 2010-03-09 07:53:44 -0500 (Tue, 09 Mar 2010) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    public interface TDistribution extends ContinuousDistribution {<a name="line.32"></a>
+<FONT color="green">033</FONT>        /**<a name="line.33"></a>
+<FONT color="green">034</FONT>         * Modify the degrees of freedom.<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @param degreesOfFreedom the new degrees of freedom.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @deprecated as of v2.1<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        @Deprecated<a name="line.38"></a>
+<FONT color="green">039</FONT>        void setDegreesOfFreedom(double degreesOfFreedom);<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * Access the degrees of freedom.<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @return the degrees of freedom.<a name="line.43"></a>
+<FONT color="green">044</FONT>         */<a name="line.44"></a>
+<FONT color="green">045</FONT>        double getDegreesOfFreedom();<a name="line.45"></a>
+<FONT color="green">046</FONT>    }<a name="line.46"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/TDistributionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,290 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.distribution;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.special.Beta;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.special.Gamma;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Default implementation of<a name="line.27"></a>
+<FONT color="green">028</FONT>     * {@link org.apache.commons.math.distribution.TDistribution}.<a name="line.28"></a>
+<FONT color="green">029</FONT>     *<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    public class TDistributionImpl<a name="line.32"></a>
+<FONT color="green">033</FONT>        extends AbstractContinuousDistribution<a name="line.33"></a>
+<FONT color="green">034</FONT>        implements TDistribution, Serializable  {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /**<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Default inverse cumulative probability accuracy<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @since 2.1<a name="line.38"></a>
+<FONT color="green">039</FONT>        */<a name="line.39"></a>
+<FONT color="green">040</FONT>        public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Serializable version identifier */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private static final long serialVersionUID = -5852615386664158222L;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** The degrees of freedom*/<a name="line.45"></a>
+<FONT color="green">046</FONT>        private double degreesOfFreedom;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** Inverse cumulative probability accuracy */<a name="line.48"></a>
+<FONT color="green">049</FONT>        private final double solverAbsoluteAccuracy;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /**<a name="line.51"></a>
+<FONT color="green">052</FONT>         * Create a t distribution using the given degrees of freedom and the<a name="line.52"></a>
+<FONT color="green">053</FONT>         * specified inverse cumulative probability absolute accuracy.<a name="line.53"></a>
+<FONT color="green">054</FONT>         *<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param degreesOfFreedom the degrees of freedom.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param inverseCumAccuracy the maximum absolute error in inverse cumulative probability estimates<a name="line.56"></a>
+<FONT color="green">057</FONT>         * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY})<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @since 2.1<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        public TDistributionImpl(double degreesOfFreedom, double inverseCumAccuracy) {<a name="line.60"></a>
+<FONT color="green">061</FONT>            super();<a name="line.61"></a>
+<FONT color="green">062</FONT>            setDegreesOfFreedomInternal(degreesOfFreedom);<a name="line.62"></a>
+<FONT color="green">063</FONT>            solverAbsoluteAccuracy = inverseCumAccuracy;<a name="line.63"></a>
+<FONT color="green">064</FONT>        }<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /**<a name="line.66"></a>
+<FONT color="green">067</FONT>         * Create a t distribution using the given degrees of freedom.<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param degreesOfFreedom the degrees of freedom.<a name="line.68"></a>
+<FONT color="green">069</FONT>         */<a name="line.69"></a>
+<FONT color="green">070</FONT>        public TDistributionImpl(double degreesOfFreedom) {<a name="line.70"></a>
+<FONT color="green">071</FONT>            this(degreesOfFreedom, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);<a name="line.71"></a>
+<FONT color="green">072</FONT>        }<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /**<a name="line.74"></a>
+<FONT color="green">075</FONT>         * Modify the degrees of freedom.<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @param degreesOfFreedom the new degrees of freedom.<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.77"></a>
+<FONT color="green">078</FONT>         */<a name="line.78"></a>
+<FONT color="green">079</FONT>        @Deprecated<a name="line.79"></a>
+<FONT color="green">080</FONT>        public void setDegreesOfFreedom(double degreesOfFreedom) {<a name="line.80"></a>
+<FONT color="green">081</FONT>            setDegreesOfFreedomInternal(degreesOfFreedom);<a name="line.81"></a>
+<FONT color="green">082</FONT>        }<a name="line.82"></a>
+<FONT color="green">083</FONT>        /**<a name="line.83"></a>
+<FONT color="green">084</FONT>         * Modify the degrees of freedom.<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @param newDegreesOfFreedom the new degrees of freedom.<a name="line.85"></a>
+<FONT color="green">086</FONT>         */<a name="line.86"></a>
+<FONT color="green">087</FONT>        private void setDegreesOfFreedomInternal(double newDegreesOfFreedom) {<a name="line.87"></a>
+<FONT color="green">088</FONT>            if (newDegreesOfFreedom &lt;= 0.0) {<a name="line.88"></a>
+<FONT color="green">089</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.89"></a>
+<FONT color="green">090</FONT>                      "degrees of freedom must be positive ({0})",<a name="line.90"></a>
+<FONT color="green">091</FONT>                      newDegreesOfFreedom);<a name="line.91"></a>
+<FONT color="green">092</FONT>            }<a name="line.92"></a>
+<FONT color="green">093</FONT>            this.degreesOfFreedom = newDegreesOfFreedom;<a name="line.93"></a>
+<FONT color="green">094</FONT>        }<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /**<a name="line.96"></a>
+<FONT color="green">097</FONT>         * Access the degrees of freedom.<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @return the degrees of freedom.<a name="line.98"></a>
+<FONT color="green">099</FONT>         */<a name="line.99"></a>
+<FONT color="green">100</FONT>        public double getDegreesOfFreedom() {<a name="line.100"></a>
+<FONT color="green">101</FONT>            return degreesOfFreedom;<a name="line.101"></a>
+<FONT color="green">102</FONT>        }<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /**<a name="line.104"></a>
+<FONT color="green">105</FONT>         * Returns the probability density for a particular point.<a name="line.105"></a>
+<FONT color="green">106</FONT>         *<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @param x The point at which the density should be computed.<a name="line.107"></a>
+<FONT color="green">108</FONT>         * @return The pdf at point x.<a name="line.108"></a>
+<FONT color="green">109</FONT>         * @since 2.1<a name="line.109"></a>
+<FONT color="green">110</FONT>         */<a name="line.110"></a>
+<FONT color="green">111</FONT>        @Override<a name="line.111"></a>
+<FONT color="green">112</FONT>        public double density(double x) {<a name="line.112"></a>
+<FONT color="green">113</FONT>            final double n = degreesOfFreedom;<a name="line.113"></a>
+<FONT color="green">114</FONT>            final double nPlus1Over2 = (n + 1) / 2;<a name="line.114"></a>
+<FONT color="green">115</FONT>            return Math.exp(Gamma.logGamma(nPlus1Over2) - 0.5 * (Math.log(Math.PI) + Math.log(n)) -<a name="line.115"></a>
+<FONT color="green">116</FONT>                    Gamma.logGamma(n/2) - nPlus1Over2 * Math.log(1 + x * x /n));<a name="line.116"></a>
+<FONT color="green">117</FONT>        }<a name="line.117"></a>
+<FONT color="green">118</FONT>    <a name="line.118"></a>
+<FONT color="green">119</FONT>        /**<a name="line.119"></a>
+<FONT color="green">120</FONT>         * For this distribution, X, this method returns P(X &amp;lt; &lt;code&gt;x&lt;/code&gt;).<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @param x the value at which the CDF is evaluated.<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @return CDF evaluted at &lt;code&gt;x&lt;/code&gt;.<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @throws MathException if the cumulative probability can not be<a name="line.123"></a>
+<FONT color="green">124</FONT>         *            computed due to convergence or other numerical errors.<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        public double cumulativeProbability(double x) throws MathException{<a name="line.126"></a>
+<FONT color="green">127</FONT>            double ret;<a name="line.127"></a>
+<FONT color="green">128</FONT>            if (x == 0.0) {<a name="line.128"></a>
+<FONT color="green">129</FONT>                ret = 0.5;<a name="line.129"></a>
+<FONT color="green">130</FONT>            } else {<a name="line.130"></a>
+<FONT color="green">131</FONT>                double t =<a name="line.131"></a>
+<FONT color="green">132</FONT>                    Beta.regularizedBeta(<a name="line.132"></a>
+<FONT color="green">133</FONT>                        degreesOfFreedom / (degreesOfFreedom + (x * x)),<a name="line.133"></a>
+<FONT color="green">134</FONT>                        0.5 * degreesOfFreedom,<a name="line.134"></a>
+<FONT color="green">135</FONT>                        0.5);<a name="line.135"></a>
+<FONT color="green">136</FONT>                if (x &lt; 0.0) {<a name="line.136"></a>
+<FONT color="green">137</FONT>                    ret = 0.5 * t;<a name="line.137"></a>
+<FONT color="green">138</FONT>                } else {<a name="line.138"></a>
+<FONT color="green">139</FONT>                    ret = 1.0 - 0.5 * t;<a name="line.139"></a>
+<FONT color="green">140</FONT>                }<a name="line.140"></a>
+<FONT color="green">141</FONT>            }<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>            return ret;<a name="line.143"></a>
+<FONT color="green">144</FONT>        }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>        /**<a name="line.146"></a>
+<FONT color="green">147</FONT>         * For this distribution, X, this method returns the critical point x, such<a name="line.147"></a>
+<FONT color="green">148</FONT>         * that P(X &amp;lt; x) = &lt;code&gt;p&lt;/code&gt;.<a name="line.148"></a>
+<FONT color="green">149</FONT>         * &lt;p&gt;<a name="line.149"></a>
+<FONT color="green">150</FONT>         * Returns &lt;code&gt;Double.NEGATIVE_INFINITY&lt;/code&gt; for p=0 and<a name="line.150"></a>
+<FONT color="green">151</FONT>         * &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt; for p=1.&lt;/p&gt;<a name="line.151"></a>
+<FONT color="green">152</FONT>         *<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @param p the desired probability<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @return x, such that P(X &amp;lt; x) = &lt;code&gt;p&lt;/code&gt;<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @throws MathException if the inverse cumulative probability can not be<a name="line.155"></a>
+<FONT color="green">156</FONT>         *         computed due to convergence or other numerical errors.<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @throws IllegalArgumentException if &lt;code&gt;p&lt;/code&gt; is not a valid<a name="line.157"></a>
+<FONT color="green">158</FONT>         *         probability.<a name="line.158"></a>
+<FONT color="green">159</FONT>         */<a name="line.159"></a>
+<FONT color="green">160</FONT>        @Override<a name="line.160"></a>
+<FONT color="green">161</FONT>        public double inverseCumulativeProbability(final double p)<a name="line.161"></a>
+<FONT color="green">162</FONT>        throws MathException {<a name="line.162"></a>
+<FONT color="green">163</FONT>            if (p == 0) {<a name="line.163"></a>
+<FONT color="green">164</FONT>                return Double.NEGATIVE_INFINITY;<a name="line.164"></a>
+<FONT color="green">165</FONT>            }<a name="line.165"></a>
+<FONT color="green">166</FONT>            if (p == 1) {<a name="line.166"></a>
+<FONT color="green">167</FONT>                return Double.POSITIVE_INFINITY;<a name="line.167"></a>
+<FONT color="green">168</FONT>            }<a name="line.168"></a>
+<FONT color="green">169</FONT>            return super.inverseCumulativeProbability(p);<a name="line.169"></a>
+<FONT color="green">170</FONT>        }<a name="line.170"></a>
+<FONT color="green">171</FONT>    <a name="line.171"></a>
+<FONT color="green">172</FONT>        /**<a name="line.172"></a>
+<FONT color="green">173</FONT>         * Access the domain value lower bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.173"></a>
+<FONT color="green">174</FONT>         * bracket a CDF root.  This method is used by<a name="line.174"></a>
+<FONT color="green">175</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.175"></a>
+<FONT color="green">176</FONT>         *<a name="line.176"></a>
+<FONT color="green">177</FONT>         * @param p the desired probability for the critical value<a name="line.177"></a>
+<FONT color="green">178</FONT>         * @return domain value lower bound, i.e.<a name="line.178"></a>
+<FONT color="green">179</FONT>         *         P(X &amp;lt; &lt;i&gt;lower bound&lt;/i&gt;) &amp;lt; &lt;code&gt;p&lt;/code&gt;<a name="line.179"></a>
+<FONT color="green">180</FONT>         */<a name="line.180"></a>
+<FONT color="green">181</FONT>        @Override<a name="line.181"></a>
+<FONT color="green">182</FONT>        protected double getDomainLowerBound(double p) {<a name="line.182"></a>
+<FONT color="green">183</FONT>            return -Double.MAX_VALUE;<a name="line.183"></a>
+<FONT color="green">184</FONT>        }<a name="line.184"></a>
+<FONT color="green">185</FONT>    <a name="line.185"></a>
+<FONT color="green">186</FONT>        /**<a name="line.186"></a>
+<FONT color="green">187</FONT>         * Access the domain value upper bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.187"></a>
+<FONT color="green">188</FONT>         * bracket a CDF root.  This method is used by<a name="line.188"></a>
+<FONT color="green">189</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.189"></a>
+<FONT color="green">190</FONT>         *<a name="line.190"></a>
+<FONT color="green">191</FONT>         * @param p the desired probability for the critical value<a name="line.191"></a>
+<FONT color="green">192</FONT>         * @return domain value upper bound, i.e.<a name="line.192"></a>
+<FONT color="green">193</FONT>         *         P(X &amp;lt; &lt;i&gt;upper bound&lt;/i&gt;) &amp;gt; &lt;code&gt;p&lt;/code&gt;<a name="line.193"></a>
+<FONT color="green">194</FONT>         */<a name="line.194"></a>
+<FONT color="green">195</FONT>        @Override<a name="line.195"></a>
+<FONT color="green">196</FONT>        protected double getDomainUpperBound(double p) {<a name="line.196"></a>
+<FONT color="green">197</FONT>            return Double.MAX_VALUE;<a name="line.197"></a>
+<FONT color="green">198</FONT>        }<a name="line.198"></a>
+<FONT color="green">199</FONT>    <a name="line.199"></a>
+<FONT color="green">200</FONT>        /**<a name="line.200"></a>
+<FONT color="green">201</FONT>         * Access the initial domain value, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.201"></a>
+<FONT color="green">202</FONT>         * bracket a CDF root.  This method is used by<a name="line.202"></a>
+<FONT color="green">203</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.203"></a>
+<FONT color="green">204</FONT>         *<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @param p the desired probability for the critical value<a name="line.205"></a>
+<FONT color="green">206</FONT>         * @return initial domain value<a name="line.206"></a>
+<FONT color="green">207</FONT>         */<a name="line.207"></a>
+<FONT color="green">208</FONT>        @Override<a name="line.208"></a>
+<FONT color="green">209</FONT>        protected double getInitialDomain(double p) {<a name="line.209"></a>
+<FONT color="green">210</FONT>            return 0.0;<a name="line.210"></a>
+<FONT color="green">211</FONT>        }<a name="line.211"></a>
+<FONT color="green">212</FONT>    <a name="line.212"></a>
+<FONT color="green">213</FONT>        /**<a name="line.213"></a>
+<FONT color="green">214</FONT>         * Return the absolute accuracy setting of the solver used to estimate<a name="line.214"></a>
+<FONT color="green">215</FONT>         * inverse cumulative probabilities.<a name="line.215"></a>
+<FONT color="green">216</FONT>         *<a name="line.216"></a>
+<FONT color="green">217</FONT>         * @return the solver absolute accuracy<a name="line.217"></a>
+<FONT color="green">218</FONT>         * @since 2.1<a name="line.218"></a>
+<FONT color="green">219</FONT>         */<a name="line.219"></a>
+<FONT color="green">220</FONT>        @Override<a name="line.220"></a>
+<FONT color="green">221</FONT>        protected double getSolverAbsoluteAccuracy() {<a name="line.221"></a>
+<FONT color="green">222</FONT>            return solverAbsoluteAccuracy;<a name="line.222"></a>
+<FONT color="green">223</FONT>        }<a name="line.223"></a>
+<FONT color="green">224</FONT>    }<a name="line.224"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/WeibullDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,132 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.distribution;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Weibull Distribution.  This interface defines the two parameter form of the<a name="line.21"></a>
+<FONT color="green">022</FONT>     * distribution as defined by<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;a href="http://mathworld.wolfram.com/WeibullDistribution.html"&gt;<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Weibull Distribution&lt;/a&gt;, equations (1) and (2).<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * References:<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;ul&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/WeibullDistribution.html"&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * Weibull Distribution&lt;/a&gt;&lt;/li&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;/ul&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @since 1.1<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @version $Revision: 920852 $ $Date: 2010-03-09 07:53:44 -0500 (Tue, 09 Mar 2010) $<a name="line.35"></a>
+<FONT color="green">036</FONT>     */<a name="line.36"></a>
+<FONT color="green">037</FONT>    public interface WeibullDistribution extends ContinuousDistribution {<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /**<a name="line.39"></a>
+<FONT color="green">040</FONT>         * Access the shape parameter.<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @return the shape parameter.<a name="line.41"></a>
+<FONT color="green">042</FONT>         */<a name="line.42"></a>
+<FONT color="green">043</FONT>        double getShape();<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**<a name="line.45"></a>
+<FONT color="green">046</FONT>         * Access the scale parameter.<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @return the scale parameter.<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        double getScale();<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /**<a name="line.51"></a>
+<FONT color="green">052</FONT>         * Modify the shape parameter.<a name="line.52"></a>
+<FONT color="green">053</FONT>         * @param alpha The new shape parameter value.<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @deprecated as of v2.1<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        @Deprecated<a name="line.56"></a>
+<FONT color="green">057</FONT>        void setShape(double alpha);<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /**<a name="line.59"></a>
+<FONT color="green">060</FONT>         * Modify the scale parameter.<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param beta The new scale parameter value.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @deprecated as of v2.1<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        @Deprecated<a name="line.64"></a>
+<FONT color="green">065</FONT>        void setScale(double beta);<a name="line.65"></a>
+<FONT color="green">066</FONT>    }<a name="line.66"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/WeibullDistributionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,326 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.distribution;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Default implementation of<a name="line.25"></a>
+<FONT color="green">026</FONT>     * {@link org.apache.commons.math.distribution.WeibullDistribution}.<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @since 1.1<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @version $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $<a name="line.29"></a>
+<FONT color="green">030</FONT>     */<a name="line.30"></a>
+<FONT color="green">031</FONT>    public class WeibullDistributionImpl extends AbstractContinuousDistribution<a name="line.31"></a>
+<FONT color="green">032</FONT>            implements WeibullDistribution, Serializable {<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /**<a name="line.34"></a>
+<FONT color="green">035</FONT>         * Default inverse cumulative probability accuracy<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @since 2.1<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Serializable version identifier */<a name="line.40"></a>
+<FONT color="green">041</FONT>        private static final long serialVersionUID = 8589540077390120676L;<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** The shape parameter. */<a name="line.43"></a>
+<FONT color="green">044</FONT>        private double shape;<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** The scale parameter. */<a name="line.46"></a>
+<FONT color="green">047</FONT>        private double scale;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** Inverse cumulative probability accuracy */<a name="line.49"></a>
+<FONT color="green">050</FONT>        private final double solverAbsoluteAccuracy;<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * Creates weibull distribution with the given shape and scale and a<a name="line.53"></a>
+<FONT color="green">054</FONT>         * location equal to zero.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param alpha the shape parameter.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param beta the scale parameter.<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        public WeibullDistributionImpl(double alpha, double beta){<a name="line.58"></a>
+<FONT color="green">059</FONT>            this(alpha, beta, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);<a name="line.59"></a>
+<FONT color="green">060</FONT>        }<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /**<a name="line.62"></a>
+<FONT color="green">063</FONT>         * Creates weibull distribution with the given shape, scale and inverse<a name="line.63"></a>
+<FONT color="green">064</FONT>         * cumulative probability accuracy and a location equal to zero.<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param alpha the shape parameter.<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @param beta the scale parameter.<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @param inverseCumAccuracy the maximum absolute error in inverse cumulative probability estimates<a name="line.67"></a>
+<FONT color="green">068</FONT>         * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY})<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @since 2.1<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        public WeibullDistributionImpl(double alpha, double beta, double inverseCumAccuracy){<a name="line.71"></a>
+<FONT color="green">072</FONT>            super();<a name="line.72"></a>
+<FONT color="green">073</FONT>            setShapeInternal(alpha);<a name="line.73"></a>
+<FONT color="green">074</FONT>            setScaleInternal(beta);<a name="line.74"></a>
+<FONT color="green">075</FONT>            solverAbsoluteAccuracy = inverseCumAccuracy;<a name="line.75"></a>
+<FONT color="green">076</FONT>        }<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /**<a name="line.78"></a>
+<FONT color="green">079</FONT>         * For this distribution, X, this method returns P(X &amp;lt; &lt;code&gt;x&lt;/code&gt;).<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @param x the value at which the CDF is evaluated.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @return CDF evaluted at &lt;code&gt;x&lt;/code&gt;.<a name="line.81"></a>
+<FONT color="green">082</FONT>         */<a name="line.82"></a>
+<FONT color="green">083</FONT>        public double cumulativeProbability(double x) {<a name="line.83"></a>
+<FONT color="green">084</FONT>            double ret;<a name="line.84"></a>
+<FONT color="green">085</FONT>            if (x &lt;= 0.0) {<a name="line.85"></a>
+<FONT color="green">086</FONT>                ret = 0.0;<a name="line.86"></a>
+<FONT color="green">087</FONT>            } else {<a name="line.87"></a>
+<FONT color="green">088</FONT>                ret = 1.0 - Math.exp(-Math.pow(x / scale, shape));<a name="line.88"></a>
+<FONT color="green">089</FONT>            }<a name="line.89"></a>
+<FONT color="green">090</FONT>            return ret;<a name="line.90"></a>
+<FONT color="green">091</FONT>        }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /**<a name="line.93"></a>
+<FONT color="green">094</FONT>         * Access the shape parameter.<a name="line.94"></a>
+<FONT color="green">095</FONT>         * @return the shape parameter.<a name="line.95"></a>
+<FONT color="green">096</FONT>         */<a name="line.96"></a>
+<FONT color="green">097</FONT>        public double getShape() {<a name="line.97"></a>
+<FONT color="green">098</FONT>            return shape;<a name="line.98"></a>
+<FONT color="green">099</FONT>        }<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /**<a name="line.101"></a>
+<FONT color="green">102</FONT>         * Access the scale parameter.<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @return the scale parameter.<a name="line.103"></a>
+<FONT color="green">104</FONT>         */<a name="line.104"></a>
+<FONT color="green">105</FONT>        public double getScale() {<a name="line.105"></a>
+<FONT color="green">106</FONT>            return scale;<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /**<a name="line.109"></a>
+<FONT color="green">110</FONT>         * Returns the probability density for a particular point.<a name="line.110"></a>
+<FONT color="green">111</FONT>         *<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @param x The point at which the density should be computed.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @return The pdf at point x.<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @since 2.1<a name="line.114"></a>
+<FONT color="green">115</FONT>         */<a name="line.115"></a>
+<FONT color="green">116</FONT>        @Override<a name="line.116"></a>
+<FONT color="green">117</FONT>        public double density(double x) {<a name="line.117"></a>
+<FONT color="green">118</FONT>            if (x &lt; 0) {<a name="line.118"></a>
+<FONT color="green">119</FONT>                return 0;<a name="line.119"></a>
+<FONT color="green">120</FONT>            }<a name="line.120"></a>
+<FONT color="green">121</FONT>    <a name="line.121"></a>
+<FONT color="green">122</FONT>            final double xscale = x / scale;<a name="line.122"></a>
+<FONT color="green">123</FONT>            final double xscalepow = Math.pow(xscale, shape - 1);<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>            /*<a name="line.125"></a>
+<FONT color="green">126</FONT>             * Math.pow(x / scale, shape) =<a name="line.126"></a>
+<FONT color="green">127</FONT>             * Math.pow(xscale, shape) =<a name="line.127"></a>
+<FONT color="green">128</FONT>             * Math.pow(xscale, shape - 1) * xscale<a name="line.128"></a>
+<FONT color="green">129</FONT>             */<a name="line.129"></a>
+<FONT color="green">130</FONT>            final double xscalepowshape = xscalepow * xscale;<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>            return (shape / scale) * xscalepow * Math.exp(-xscalepowshape);<a name="line.132"></a>
+<FONT color="green">133</FONT>        }<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>        /**<a name="line.135"></a>
+<FONT color="green">136</FONT>         * For this distribution, X, this method returns the critical point x, such<a name="line.136"></a>
+<FONT color="green">137</FONT>         * that P(X &amp;lt; x) = &lt;code&gt;p&lt;/code&gt;.<a name="line.137"></a>
+<FONT color="green">138</FONT>         * &lt;p&gt;<a name="line.138"></a>
+<FONT color="green">139</FONT>         * Returns &lt;code&gt;Double.NEGATIVE_INFINITY&lt;/code&gt; for p=0 and<a name="line.139"></a>
+<FONT color="green">140</FONT>         * &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt; for p=1.&lt;/p&gt;<a name="line.140"></a>
+<FONT color="green">141</FONT>         *<a name="line.141"></a>
+<FONT color="green">142</FONT>         * @param p the desired probability<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @return x, such that P(X &amp;lt; x) = &lt;code&gt;p&lt;/code&gt;<a name="line.143"></a>
+<FONT color="green">144</FONT>         * @throws IllegalArgumentException if &lt;code&gt;p&lt;/code&gt; is not a valid<a name="line.144"></a>
+<FONT color="green">145</FONT>         *         probability.<a name="line.145"></a>
+<FONT color="green">146</FONT>         */<a name="line.146"></a>
+<FONT color="green">147</FONT>        @Override<a name="line.147"></a>
+<FONT color="green">148</FONT>        public double inverseCumulativeProbability(double p) {<a name="line.148"></a>
+<FONT color="green">149</FONT>            double ret;<a name="line.149"></a>
+<FONT color="green">150</FONT>            if (p &lt; 0.0 || p &gt; 1.0) {<a name="line.150"></a>
+<FONT color="green">151</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.151"></a>
+<FONT color="green">152</FONT>                      "{0} out of [{1}, {2}] range", p, 0.0, 1.0);<a name="line.152"></a>
+<FONT color="green">153</FONT>            } else if (p == 0) {<a name="line.153"></a>
+<FONT color="green">154</FONT>                ret = 0.0;<a name="line.154"></a>
+<FONT color="green">155</FONT>            } else  if (p == 1) {<a name="line.155"></a>
+<FONT color="green">156</FONT>                ret = Double.POSITIVE_INFINITY;<a name="line.156"></a>
+<FONT color="green">157</FONT>            } else {<a name="line.157"></a>
+<FONT color="green">158</FONT>                ret = scale * Math.pow(-Math.log(1.0 - p), 1.0 / shape);<a name="line.158"></a>
+<FONT color="green">159</FONT>            }<a name="line.159"></a>
+<FONT color="green">160</FONT>            return ret;<a name="line.160"></a>
+<FONT color="green">161</FONT>        }<a name="line.161"></a>
+<FONT color="green">162</FONT>    <a name="line.162"></a>
+<FONT color="green">163</FONT>        /**<a name="line.163"></a>
+<FONT color="green">164</FONT>         * Modify the shape parameter.<a name="line.164"></a>
+<FONT color="green">165</FONT>         * @param alpha the new shape parameter value.<a name="line.165"></a>
+<FONT color="green">166</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.166"></a>
+<FONT color="green">167</FONT>         */<a name="line.167"></a>
+<FONT color="green">168</FONT>        @Deprecated<a name="line.168"></a>
+<FONT color="green">169</FONT>        public void setShape(double alpha) {<a name="line.169"></a>
+<FONT color="green">170</FONT>            setShapeInternal(alpha);<a name="line.170"></a>
+<FONT color="green">171</FONT>        }<a name="line.171"></a>
+<FONT color="green">172</FONT>        /**<a name="line.172"></a>
+<FONT color="green">173</FONT>         * Modify the shape parameter.<a name="line.173"></a>
+<FONT color="green">174</FONT>         * @param alpha the new shape parameter value.<a name="line.174"></a>
+<FONT color="green">175</FONT>         */<a name="line.175"></a>
+<FONT color="green">176</FONT>        private void setShapeInternal(double alpha) {<a name="line.176"></a>
+<FONT color="green">177</FONT>            if (alpha &lt;= 0.0) {<a name="line.177"></a>
+<FONT color="green">178</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.178"></a>
+<FONT color="green">179</FONT>                      "shape must be positive ({0})",<a name="line.179"></a>
+<FONT color="green">180</FONT>                      alpha);<a name="line.180"></a>
+<FONT color="green">181</FONT>            }<a name="line.181"></a>
+<FONT color="green">182</FONT>            this.shape = alpha;<a name="line.182"></a>
+<FONT color="green">183</FONT>        }<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>        /**<a name="line.185"></a>
+<FONT color="green">186</FONT>         * Modify the scale parameter.<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @param beta the new scale parameter value.<a name="line.187"></a>
+<FONT color="green">188</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.188"></a>
+<FONT color="green">189</FONT>         */<a name="line.189"></a>
+<FONT color="green">190</FONT>        @Deprecated<a name="line.190"></a>
+<FONT color="green">191</FONT>        public void setScale(double beta) {<a name="line.191"></a>
+<FONT color="green">192</FONT>            setScaleInternal(beta);<a name="line.192"></a>
+<FONT color="green">193</FONT>        }<a name="line.193"></a>
+<FONT color="green">194</FONT>        /**<a name="line.194"></a>
+<FONT color="green">195</FONT>         * Modify the scale parameter.<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @param beta the new scale parameter value.<a name="line.196"></a>
+<FONT color="green">197</FONT>         */<a name="line.197"></a>
+<FONT color="green">198</FONT>        private void setScaleInternal(double beta) {<a name="line.198"></a>
+<FONT color="green">199</FONT>            if (beta &lt;= 0.0) {<a name="line.199"></a>
+<FONT color="green">200</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.200"></a>
+<FONT color="green">201</FONT>                      "scale must be positive ({0})",<a name="line.201"></a>
+<FONT color="green">202</FONT>                      beta);<a name="line.202"></a>
+<FONT color="green">203</FONT>            }<a name="line.203"></a>
+<FONT color="green">204</FONT>            this.scale = beta;<a name="line.204"></a>
+<FONT color="green">205</FONT>        }<a name="line.205"></a>
+<FONT color="green">206</FONT>    <a name="line.206"></a>
+<FONT color="green">207</FONT>        /**<a name="line.207"></a>
+<FONT color="green">208</FONT>         * Access the domain value lower bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.208"></a>
+<FONT color="green">209</FONT>         * bracket a CDF root.  This method is used by<a name="line.209"></a>
+<FONT color="green">210</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.210"></a>
+<FONT color="green">211</FONT>         *<a name="line.211"></a>
+<FONT color="green">212</FONT>         * @param p the desired probability for the critical value<a name="line.212"></a>
+<FONT color="green">213</FONT>         * @return domain value lower bound, i.e.<a name="line.213"></a>
+<FONT color="green">214</FONT>         *         P(X &amp;lt; &lt;i&gt;lower bound&lt;/i&gt;) &amp;lt; &lt;code&gt;p&lt;/code&gt;<a name="line.214"></a>
+<FONT color="green">215</FONT>         */<a name="line.215"></a>
+<FONT color="green">216</FONT>        @Override<a name="line.216"></a>
+<FONT color="green">217</FONT>        protected double getDomainLowerBound(double p) {<a name="line.217"></a>
+<FONT color="green">218</FONT>            return 0.0;<a name="line.218"></a>
+<FONT color="green">219</FONT>        }<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>        /**<a name="line.221"></a>
+<FONT color="green">222</FONT>         * Access the domain value upper bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.222"></a>
+<FONT color="green">223</FONT>         * bracket a CDF root.  This method is used by<a name="line.223"></a>
+<FONT color="green">224</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.224"></a>
+<FONT color="green">225</FONT>         *<a name="line.225"></a>
+<FONT color="green">226</FONT>         * @param p the desired probability for the critical value<a name="line.226"></a>
+<FONT color="green">227</FONT>         * @return domain value upper bound, i.e.<a name="line.227"></a>
+<FONT color="green">228</FONT>         *         P(X &amp;lt; &lt;i&gt;upper bound&lt;/i&gt;) &amp;gt; &lt;code&gt;p&lt;/code&gt;<a name="line.228"></a>
+<FONT color="green">229</FONT>         */<a name="line.229"></a>
+<FONT color="green">230</FONT>        @Override<a name="line.230"></a>
+<FONT color="green">231</FONT>        protected double getDomainUpperBound(double p) {<a name="line.231"></a>
+<FONT color="green">232</FONT>            return Double.MAX_VALUE;<a name="line.232"></a>
+<FONT color="green">233</FONT>        }<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>        /**<a name="line.235"></a>
+<FONT color="green">236</FONT>         * Access the initial domain value, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.236"></a>
+<FONT color="green">237</FONT>         * bracket a CDF root.  This method is used by<a name="line.237"></a>
+<FONT color="green">238</FONT>         * {@link #inverseCumulativeProbability(double)} to find critical values.<a name="line.238"></a>
+<FONT color="green">239</FONT>         *<a name="line.239"></a>
+<FONT color="green">240</FONT>         * @param p the desired probability for the critical value<a name="line.240"></a>
+<FONT color="green">241</FONT>         * @return initial domain value<a name="line.241"></a>
+<FONT color="green">242</FONT>         */<a name="line.242"></a>
+<FONT color="green">243</FONT>        @Override<a name="line.243"></a>
+<FONT color="green">244</FONT>        protected double getInitialDomain(double p) {<a name="line.244"></a>
+<FONT color="green">245</FONT>            // use median<a name="line.245"></a>
+<FONT color="green">246</FONT>            return Math.pow(scale * Math.log(2.0), 1.0 / shape);<a name="line.246"></a>
+<FONT color="green">247</FONT>        }<a name="line.247"></a>
+<FONT color="green">248</FONT>    <a name="line.248"></a>
+<FONT color="green">249</FONT>        /**<a name="line.249"></a>
+<FONT color="green">250</FONT>         * Return the absolute accuracy setting of the solver used to estimate<a name="line.250"></a>
+<FONT color="green">251</FONT>         * inverse cumulative probabilities.<a name="line.251"></a>
+<FONT color="green">252</FONT>         *<a name="line.252"></a>
+<FONT color="green">253</FONT>         * @return the solver absolute accuracy<a name="line.253"></a>
+<FONT color="green">254</FONT>         * @since 2.1<a name="line.254"></a>
+<FONT color="green">255</FONT>         */<a name="line.255"></a>
+<FONT color="green">256</FONT>        @Override<a name="line.256"></a>
+<FONT color="green">257</FONT>        protected double getSolverAbsoluteAccuracy() {<a name="line.257"></a>
+<FONT color="green">258</FONT>            return solverAbsoluteAccuracy;<a name="line.258"></a>
+<FONT color="green">259</FONT>        }<a name="line.259"></a>
+<FONT color="green">260</FONT>    }<a name="line.260"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/ZipfDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,137 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.distribution;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * The Zipf (or zeta) Distribution.<a name="line.21"></a>
+<FONT color="green">022</FONT>     * &lt;p&gt;<a name="line.22"></a>
+<FONT color="green">023</FONT>     * References:<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;ul&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/ZipfDistribution.html"&gt;Zipf<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Distribution&lt;/a&gt;&lt;/li&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;/ul&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     *<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 920852 $ $Date: 2010-03-09 07:53:44 -0500 (Tue, 09 Mar 2010) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    public interface ZipfDistribution extends IntegerDistribution {<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /**<a name="line.34"></a>
+<FONT color="green">035</FONT>         * Get the number of elements (e.g. corpus size) for the distribution.<a name="line.35"></a>
+<FONT color="green">036</FONT>         *<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @return the number of elements<a name="line.37"></a>
+<FONT color="green">038</FONT>         */<a name="line.38"></a>
+<FONT color="green">039</FONT>        int getNumberOfElements();<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * Set the number of elements (e.g. corpus size) for the distribution.<a name="line.42"></a>
+<FONT color="green">043</FONT>         * The parameter value must be positive; otherwise an<a name="line.43"></a>
+<FONT color="green">044</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown.<a name="line.44"></a>
+<FONT color="green">045</FONT>         *<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param n the number of elements<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @throws IllegalArgumentException if n &amp;le; 0<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @deprecated as of v2.1<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        @Deprecated<a name="line.50"></a>
+<FONT color="green">051</FONT>        void setNumberOfElements(int n);<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Get the exponent characterising the distribution.<a name="line.54"></a>
+<FONT color="green">055</FONT>         *<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @return the exponent<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        double getExponent();<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /**<a name="line.60"></a>
+<FONT color="green">061</FONT>         * Set the exponent characterising the distribution.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * The parameter value must be positive; otherwise an<a name="line.62"></a>
+<FONT color="green">063</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown.<a name="line.63"></a>
+<FONT color="green">064</FONT>         *<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param s the exponent<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @throws IllegalArgumentException if s &amp;le; 0.0<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @deprecated as of v2.1<a name="line.67"></a>
+<FONT color="green">068</FONT>         */<a name="line.68"></a>
+<FONT color="green">069</FONT>        @Deprecated<a name="line.69"></a>
+<FONT color="green">070</FONT>        void setExponent(double s);<a name="line.70"></a>
+<FONT color="green">071</FONT>    }<a name="line.71"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/distribution/ZipfDistributionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,279 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.distribution;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Implementation for the {@link ZipfDistribution}.<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 920852 $ $Date: 2010-03-09 07:53:44 -0500 (Tue, 09 Mar 2010) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public class ZipfDistributionImpl extends AbstractIntegerDistribution<a name="line.29"></a>
+<FONT color="green">030</FONT>        implements ZipfDistribution, Serializable {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** Serializable version identifier. */<a name="line.32"></a>
+<FONT color="green">033</FONT>        private static final long serialVersionUID = -140627372283420404L;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Number of elements. */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private int numberOfElements;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Exponent parameter of the distribution. */<a name="line.38"></a>
+<FONT color="green">039</FONT>        private double exponent;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * Create a new Zipf distribution with the given number of elements and<a name="line.42"></a>
+<FONT color="green">043</FONT>         * exponent. Both values must be positive; otherwise an<a name="line.43"></a>
+<FONT color="green">044</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown.<a name="line.44"></a>
+<FONT color="green">045</FONT>         *<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param numberOfElements the number of elements<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @param exponent the exponent<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @exception IllegalArgumentException if n &amp;le; 0 or s &amp;le; 0.0<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        public ZipfDistributionImpl(final int numberOfElements, final double exponent)<a name="line.50"></a>
+<FONT color="green">051</FONT>            throws IllegalArgumentException {<a name="line.51"></a>
+<FONT color="green">052</FONT>            setNumberOfElementsInternal(numberOfElements);<a name="line.52"></a>
+<FONT color="green">053</FONT>            setExponentInternal(exponent);<a name="line.53"></a>
+<FONT color="green">054</FONT>        }<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /**<a name="line.56"></a>
+<FONT color="green">057</FONT>         * Get the number of elements (e.g. corpus size) for the distribution.<a name="line.57"></a>
+<FONT color="green">058</FONT>         *<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @return the number of elements<a name="line.59"></a>
+<FONT color="green">060</FONT>         */<a name="line.60"></a>
+<FONT color="green">061</FONT>        public int getNumberOfElements() {<a name="line.61"></a>
+<FONT color="green">062</FONT>            return numberOfElements;<a name="line.62"></a>
+<FONT color="green">063</FONT>        }<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /**<a name="line.65"></a>
+<FONT color="green">066</FONT>         * Set the number of elements (e.g. corpus size) for the distribution.<a name="line.66"></a>
+<FONT color="green">067</FONT>         * The parameter value must be positive; otherwise an<a name="line.67"></a>
+<FONT color="green">068</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown.<a name="line.68"></a>
+<FONT color="green">069</FONT>         *<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @param n the number of elements<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @exception IllegalArgumentException if n &amp;le; 0<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        @Deprecated<a name="line.74"></a>
+<FONT color="green">075</FONT>        public void setNumberOfElements(final int n) {<a name="line.75"></a>
+<FONT color="green">076</FONT>            setNumberOfElementsInternal(n);<a name="line.76"></a>
+<FONT color="green">077</FONT>        }<a name="line.77"></a>
+<FONT color="green">078</FONT>        /**<a name="line.78"></a>
+<FONT color="green">079</FONT>         * Set the number of elements (e.g. corpus size) for the distribution.<a name="line.79"></a>
+<FONT color="green">080</FONT>         * The parameter value must be positive; otherwise an<a name="line.80"></a>
+<FONT color="green">081</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown.<a name="line.81"></a>
+<FONT color="green">082</FONT>         *<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param n the number of elements<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @exception IllegalArgumentException if n &amp;le; 0<a name="line.84"></a>
+<FONT color="green">085</FONT>         */<a name="line.85"></a>
+<FONT color="green">086</FONT>        private void setNumberOfElementsInternal(final int n)<a name="line.86"></a>
+<FONT color="green">087</FONT>            throws IllegalArgumentException {<a name="line.87"></a>
+<FONT color="green">088</FONT>            if (n &lt;= 0) {<a name="line.88"></a>
+<FONT color="green">089</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.89"></a>
+<FONT color="green">090</FONT>                        "invalid number of elements {0} (must be positive)",<a name="line.90"></a>
+<FONT color="green">091</FONT>                        n);<a name="line.91"></a>
+<FONT color="green">092</FONT>            }<a name="line.92"></a>
+<FONT color="green">093</FONT>            this.numberOfElements = n;<a name="line.93"></a>
+<FONT color="green">094</FONT>        }<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /**<a name="line.96"></a>
+<FONT color="green">097</FONT>         * Get the exponent characterising the distribution.<a name="line.97"></a>
+<FONT color="green">098</FONT>         *<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @return the exponent<a name="line.99"></a>
+<FONT color="green">100</FONT>         */<a name="line.100"></a>
+<FONT color="green">101</FONT>        public double getExponent() {<a name="line.101"></a>
+<FONT color="green">102</FONT>            return exponent;<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /**<a name="line.105"></a>
+<FONT color="green">106</FONT>         * Set the exponent characterising the distribution.<a name="line.106"></a>
+<FONT color="green">107</FONT>         * The parameter value must be positive; otherwise an<a name="line.107"></a>
+<FONT color="green">108</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown.<a name="line.108"></a>
+<FONT color="green">109</FONT>         *<a name="line.109"></a>
+<FONT color="green">110</FONT>         * @param s the exponent<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @exception IllegalArgumentException if s &amp;le; 0.0<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @deprecated as of 2.1 (class will become immutable in 3.0)<a name="line.112"></a>
+<FONT color="green">113</FONT>         */<a name="line.113"></a>
+<FONT color="green">114</FONT>        @Deprecated<a name="line.114"></a>
+<FONT color="green">115</FONT>        public void setExponent(final double s) {<a name="line.115"></a>
+<FONT color="green">116</FONT>            setExponentInternal(s);<a name="line.116"></a>
+<FONT color="green">117</FONT>        }<a name="line.117"></a>
+<FONT color="green">118</FONT>        /**<a name="line.118"></a>
+<FONT color="green">119</FONT>         * Set the exponent characterising the distribution.<a name="line.119"></a>
+<FONT color="green">120</FONT>         * The parameter value must be positive; otherwise an<a name="line.120"></a>
+<FONT color="green">121</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown.<a name="line.121"></a>
+<FONT color="green">122</FONT>         *<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @param s the exponent<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @exception IllegalArgumentException if s &amp;le; 0.0<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        private void setExponentInternal(final double s)<a name="line.126"></a>
+<FONT color="green">127</FONT>            throws IllegalArgumentException {<a name="line.127"></a>
+<FONT color="green">128</FONT>            if (s &lt;= 0.0) {<a name="line.128"></a>
+<FONT color="green">129</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.129"></a>
+<FONT color="green">130</FONT>                        "invalid exponent {0} (must be positive)",<a name="line.130"></a>
+<FONT color="green">131</FONT>                        s);<a name="line.131"></a>
+<FONT color="green">132</FONT>            }<a name="line.132"></a>
+<FONT color="green">133</FONT>            this.exponent = s;<a name="line.133"></a>
+<FONT color="green">134</FONT>        }<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>        /**<a name="line.136"></a>
+<FONT color="green">137</FONT>         * The probability mass function P(X = x) for a Zipf distribution.<a name="line.137"></a>
+<FONT color="green">138</FONT>         *<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @param x the value at which the probability density function is evaluated.<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @return the value of the probability mass function at x<a name="line.140"></a>
+<FONT color="green">141</FONT>         */<a name="line.141"></a>
+<FONT color="green">142</FONT>        public double probability(final int x) {<a name="line.142"></a>
+<FONT color="green">143</FONT>            if (x &lt;= 0 || x &gt; numberOfElements) {<a name="line.143"></a>
+<FONT color="green">144</FONT>                return 0.0;<a name="line.144"></a>
+<FONT color="green">145</FONT>            }<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>            return (1.0 / Math.pow(x, exponent)) / generalizedHarmonic(numberOfElements, exponent);<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>        }<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>        /**<a name="line.151"></a>
+<FONT color="green">152</FONT>         * The probability distribution function P(X &lt;= x) for a Zipf distribution.<a name="line.152"></a>
+<FONT color="green">153</FONT>         *<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @param x the value at which the PDF is evaluated.<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @return Zipf distribution function evaluated at x<a name="line.155"></a>
+<FONT color="green">156</FONT>         */<a name="line.156"></a>
+<FONT color="green">157</FONT>        @Override<a name="line.157"></a>
+<FONT color="green">158</FONT>        public double cumulativeProbability(final int x) {<a name="line.158"></a>
+<FONT color="green">159</FONT>            if (x &lt;= 0) {<a name="line.159"></a>
+<FONT color="green">160</FONT>                return 0.0;<a name="line.160"></a>
+<FONT color="green">161</FONT>            } else if (x &gt;= numberOfElements) {<a name="line.161"></a>
+<FONT color="green">162</FONT>                return 1.0;<a name="line.162"></a>
+<FONT color="green">163</FONT>            }<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>            return generalizedHarmonic(x, exponent) / generalizedHarmonic(numberOfElements, exponent);<a name="line.165"></a>
+<FONT color="green">166</FONT>    <a name="line.166"></a>
+<FONT color="green">167</FONT>        }<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>        /**<a name="line.169"></a>
+<FONT color="green">170</FONT>         * Access the domain value lower bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.170"></a>
+<FONT color="green">171</FONT>         * bracket a PDF root.<a name="line.171"></a>
+<FONT color="green">172</FONT>         *<a name="line.172"></a>
+<FONT color="green">173</FONT>         * @param p the desired probability for the critical value<a name="line.173"></a>
+<FONT color="green">174</FONT>         * @return domain value lower bound, i.e.<a name="line.174"></a>
+<FONT color="green">175</FONT>         *         P(X &amp;lt; &lt;i&gt;lower bound&lt;/i&gt;) &amp;lt; &lt;code&gt;p&lt;/code&gt;<a name="line.175"></a>
+<FONT color="green">176</FONT>         */<a name="line.176"></a>
+<FONT color="green">177</FONT>        @Override<a name="line.177"></a>
+<FONT color="green">178</FONT>        protected int getDomainLowerBound(final double p) {<a name="line.178"></a>
+<FONT color="green">179</FONT>            return 0;<a name="line.179"></a>
+<FONT color="green">180</FONT>        }<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>        /**<a name="line.182"></a>
+<FONT color="green">183</FONT>         * Access the domain value upper bound, based on &lt;code&gt;p&lt;/code&gt;, used to<a name="line.183"></a>
+<FONT color="green">184</FONT>         * bracket a PDF root.<a name="line.184"></a>
+<FONT color="green">185</FONT>         *<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @param p the desired probability for the critical value<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @return domain value upper bound, i.e.<a name="line.187"></a>
+<FONT color="green">188</FONT>         *         P(X &amp;lt; &lt;i&gt;upper bound&lt;/i&gt;) &amp;gt; &lt;code&gt;p&lt;/code&gt;<a name="line.188"></a>
+<FONT color="green">189</FONT>         */<a name="line.189"></a>
+<FONT color="green">190</FONT>        @Override<a name="line.190"></a>
+<FONT color="green">191</FONT>        protected int getDomainUpperBound(final double p) {<a name="line.191"></a>
+<FONT color="green">192</FONT>            return numberOfElements;<a name="line.192"></a>
+<FONT color="green">193</FONT>        }<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>    <a name="line.195"></a>
+<FONT color="green">196</FONT>        /**<a name="line.196"></a>
+<FONT color="green">197</FONT>         * Calculates the Nth generalized harmonic number. See<a name="line.197"></a>
+<FONT color="green">198</FONT>         * &lt;a href="http://mathworld.wolfram.com/HarmonicSeries.html"&gt;Harmonic<a name="line.198"></a>
+<FONT color="green">199</FONT>         * Series&lt;/a&gt;.<a name="line.199"></a>
+<FONT color="green">200</FONT>         *<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @param n the term in the series to calculate (must be &amp;ge; 1)<a name="line.201"></a>
+<FONT color="green">202</FONT>         * @param m the exponent; special case m == 1.0 is the harmonic series<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @return the nth generalized harmonic number<a name="line.203"></a>
+<FONT color="green">204</FONT>         */<a name="line.204"></a>
+<FONT color="green">205</FONT>        private double generalizedHarmonic(final int n, final double m) {<a name="line.205"></a>
+<FONT color="green">206</FONT>            double value = 0;<a name="line.206"></a>
+<FONT color="green">207</FONT>            for (int k = n; k &gt; 0; --k) {<a name="line.207"></a>
+<FONT color="green">208</FONT>                value += 1.0 / Math.pow(k, m);<a name="line.208"></a>
+<FONT color="green">209</FONT>            }<a name="line.209"></a>
+<FONT color="green">210</FONT>            return value;<a name="line.210"></a>
+<FONT color="green">211</FONT>        }<a name="line.211"></a>
+<FONT color="green">212</FONT>    <a name="line.212"></a>
+<FONT color="green">213</FONT>    }<a name="line.213"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/estimation/AbstractEstimator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,382 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.estimation;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.linear.InvalidMatrixException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.linear.LUDecompositionImpl;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.linear.MatrixUtils;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.linear.RealMatrix;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    /**<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Base class for implementing estimators.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;This base class handles the boilerplates methods associated to thresholds<a name="line.29"></a>
+<FONT color="green">030</FONT>     * settings, jacobian and error estimation.&lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 825919 $ $Date: 2009-10-16 10:51:55 -0400 (Fri, 16 Oct 2009) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 1.2<a name="line.32"></a>
+<FONT color="green">033</FONT>     * @deprecated as of 2.0, everything in package org.apache.commons.math.estimation has<a name="line.33"></a>
+<FONT color="green">034</FONT>     * been deprecated and replaced by package org.apache.commons.math.optimization.general<a name="line.34"></a>
+<FONT color="green">035</FONT>     *<a name="line.35"></a>
+<FONT color="green">036</FONT>     */<a name="line.36"></a>
+<FONT color="green">037</FONT>    @Deprecated<a name="line.37"></a>
+<FONT color="green">038</FONT>    public abstract class AbstractEstimator implements Estimator {<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Default maximal number of cost evaluations allowed. */<a name="line.40"></a>
+<FONT color="green">041</FONT>        public static final int DEFAULT_MAX_COST_EVALUATIONS = 100;<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** Array of measurements. */<a name="line.43"></a>
+<FONT color="green">044</FONT>        protected WeightedMeasurement[] measurements;<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** Array of parameters. */<a name="line.46"></a>
+<FONT color="green">047</FONT>        protected EstimatedParameter[] parameters;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /**<a name="line.49"></a>
+<FONT color="green">050</FONT>         * Jacobian matrix.<a name="line.50"></a>
+<FONT color="green">051</FONT>         * &lt;p&gt;This matrix is in canonical form just after the calls to<a name="line.51"></a>
+<FONT color="green">052</FONT>         * {@link #updateJacobian()}, but may be modified by the solver<a name="line.52"></a>
+<FONT color="green">053</FONT>         * in the derived class (the {@link LevenbergMarquardtEstimator<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Levenberg-Marquardt estimator} does this).&lt;/p&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        protected double[] jacobian;<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /** Number of columns of the jacobian matrix. */<a name="line.58"></a>
+<FONT color="green">059</FONT>        protected int cols;<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /** Number of rows of the jacobian matrix. */<a name="line.61"></a>
+<FONT color="green">062</FONT>        protected int rows;<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /** Residuals array.<a name="line.64"></a>
+<FONT color="green">065</FONT>         * &lt;p&gt;This array is in canonical form just after the calls to<a name="line.65"></a>
+<FONT color="green">066</FONT>         * {@link #updateJacobian()}, but may be modified by the solver<a name="line.66"></a>
+<FONT color="green">067</FONT>         * in the derived class (the {@link LevenbergMarquardtEstimator<a name="line.67"></a>
+<FONT color="green">068</FONT>         * Levenberg-Marquardt estimator} does this).&lt;/p&gt;<a name="line.68"></a>
+<FONT color="green">069</FONT>         */<a name="line.69"></a>
+<FONT color="green">070</FONT>        protected double[] residuals;<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /** Cost value (square root of the sum of the residuals). */<a name="line.72"></a>
+<FONT color="green">073</FONT>        protected double cost;<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /** Maximal allowed number of cost evaluations. */<a name="line.75"></a>
+<FONT color="green">076</FONT>        private int maxCostEval;<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /** Number of cost evaluations. */<a name="line.78"></a>
+<FONT color="green">079</FONT>        private int costEvaluations;<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /** Number of jacobian evaluations. */<a name="line.81"></a>
+<FONT color="green">082</FONT>        private int jacobianEvaluations;<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /**<a name="line.84"></a>
+<FONT color="green">085</FONT>         * Build an abstract estimator for least squares problems.<a name="line.85"></a>
+<FONT color="green">086</FONT>         * &lt;p&gt;The maximal number of cost evaluations allowed is set<a name="line.86"></a>
+<FONT color="green">087</FONT>         * to its default value {@link #DEFAULT_MAX_COST_EVALUATIONS}.&lt;/p&gt;<a name="line.87"></a>
+<FONT color="green">088</FONT>         */<a name="line.88"></a>
+<FONT color="green">089</FONT>        protected AbstractEstimator() {<a name="line.89"></a>
+<FONT color="green">090</FONT>            setMaxCostEval(DEFAULT_MAX_COST_EVALUATIONS);<a name="line.90"></a>
+<FONT color="green">091</FONT>        }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /**<a name="line.93"></a>
+<FONT color="green">094</FONT>         * Set the maximal number of cost evaluations allowed.<a name="line.94"></a>
+<FONT color="green">095</FONT>         *<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @param maxCostEval maximal number of cost evaluations allowed<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @see #estimate<a name="line.97"></a>
+<FONT color="green">098</FONT>         */<a name="line.98"></a>
+<FONT color="green">099</FONT>        public final void setMaxCostEval(int maxCostEval) {<a name="line.99"></a>
+<FONT color="green">100</FONT>            this.maxCostEval = maxCostEval;<a name="line.100"></a>
+<FONT color="green">101</FONT>        }<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        /**<a name="line.103"></a>
+<FONT color="green">104</FONT>         * Get the number of cost evaluations.<a name="line.104"></a>
+<FONT color="green">105</FONT>         *<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @return number of cost evaluations<a name="line.106"></a>
+<FONT color="green">107</FONT>         * */<a name="line.107"></a>
+<FONT color="green">108</FONT>        public final int getCostEvaluations() {<a name="line.108"></a>
+<FONT color="green">109</FONT>            return costEvaluations;<a name="line.109"></a>
+<FONT color="green">110</FONT>        }<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>        /**<a name="line.112"></a>
+<FONT color="green">113</FONT>         * Get the number of jacobian evaluations.<a name="line.113"></a>
+<FONT color="green">114</FONT>         *<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @return number of jacobian evaluations<a name="line.115"></a>
+<FONT color="green">116</FONT>         * */<a name="line.116"></a>
+<FONT color="green">117</FONT>        public final int getJacobianEvaluations() {<a name="line.117"></a>
+<FONT color="green">118</FONT>            return jacobianEvaluations;<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /**<a name="line.121"></a>
+<FONT color="green">122</FONT>         * Update the jacobian matrix.<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        protected void updateJacobian() {<a name="line.124"></a>
+<FONT color="green">125</FONT>            incrementJacobianEvaluationsCounter();<a name="line.125"></a>
+<FONT color="green">126</FONT>            Arrays.fill(jacobian, 0);<a name="line.126"></a>
+<FONT color="green">127</FONT>            int index = 0;<a name="line.127"></a>
+<FONT color="green">128</FONT>            for (int i = 0; i &lt; rows; i++) {<a name="line.128"></a>
+<FONT color="green">129</FONT>                WeightedMeasurement wm = measurements[i];<a name="line.129"></a>
+<FONT color="green">130</FONT>                double factor = -Math.sqrt(wm.getWeight());<a name="line.130"></a>
+<FONT color="green">131</FONT>                for (int j = 0; j &lt; cols; ++j) {<a name="line.131"></a>
+<FONT color="green">132</FONT>                    jacobian[index++] = factor * wm.getPartial(parameters[j]);<a name="line.132"></a>
+<FONT color="green">133</FONT>                }<a name="line.133"></a>
+<FONT color="green">134</FONT>            }<a name="line.134"></a>
+<FONT color="green">135</FONT>        }<a name="line.135"></a>
+<FONT color="green">136</FONT>    <a name="line.136"></a>
+<FONT color="green">137</FONT>        /**<a name="line.137"></a>
+<FONT color="green">138</FONT>         * Increment the jacobian evaluations counter.<a name="line.138"></a>
+<FONT color="green">139</FONT>         */<a name="line.139"></a>
+<FONT color="green">140</FONT>        protected final void incrementJacobianEvaluationsCounter() {<a name="line.140"></a>
+<FONT color="green">141</FONT>          ++jacobianEvaluations;<a name="line.141"></a>
+<FONT color="green">142</FONT>        }<a name="line.142"></a>
+<FONT color="green">143</FONT>    <a name="line.143"></a>
+<FONT color="green">144</FONT>        /**<a name="line.144"></a>
+<FONT color="green">145</FONT>         * Update the residuals array and cost function value.<a name="line.145"></a>
+<FONT color="green">146</FONT>         * @exception EstimationException if the number of cost evaluations<a name="line.146"></a>
+<FONT color="green">147</FONT>         * exceeds the maximum allowed<a name="line.147"></a>
+<FONT color="green">148</FONT>         */<a name="line.148"></a>
+<FONT color="green">149</FONT>        protected void updateResidualsAndCost()<a name="line.149"></a>
+<FONT color="green">150</FONT>        throws EstimationException {<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>            if (++costEvaluations &gt; maxCostEval) {<a name="line.152"></a>
+<FONT color="green">153</FONT>                throw new EstimationException("maximal number of evaluations exceeded ({0})",<a name="line.153"></a>
+<FONT color="green">154</FONT>                                              maxCostEval);<a name="line.154"></a>
+<FONT color="green">155</FONT>            }<a name="line.155"></a>
+<FONT color="green">156</FONT>    <a name="line.156"></a>
+<FONT color="green">157</FONT>            cost = 0;<a name="line.157"></a>
+<FONT color="green">158</FONT>            int index = 0;<a name="line.158"></a>
+<FONT color="green">159</FONT>            for (int i = 0; i &lt; rows; i++, index += cols) {<a name="line.159"></a>
+<FONT color="green">160</FONT>                WeightedMeasurement wm = measurements[i];<a name="line.160"></a>
+<FONT color="green">161</FONT>                double residual = wm.getResidual();<a name="line.161"></a>
+<FONT color="green">162</FONT>                residuals[i] = Math.sqrt(wm.getWeight()) * residual;<a name="line.162"></a>
+<FONT color="green">163</FONT>                cost += wm.getWeight() * residual * residual;<a name="line.163"></a>
+<FONT color="green">164</FONT>            }<a name="line.164"></a>
+<FONT color="green">165</FONT>            cost = Math.sqrt(cost);<a name="line.165"></a>
+<FONT color="green">166</FONT>    <a name="line.166"></a>
+<FONT color="green">167</FONT>        }<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>        /**<a name="line.169"></a>
+<FONT color="green">170</FONT>         * Get the Root Mean Square value.<a name="line.170"></a>
+<FONT color="green">171</FONT>         * Get the Root Mean Square value, i.e. the root of the arithmetic<a name="line.171"></a>
+<FONT color="green">172</FONT>         * mean of the square of all weighted residuals. This is related to the<a name="line.172"></a>
+<FONT color="green">173</FONT>         * criterion that is minimized by the estimator as follows: if<a name="line.173"></a>
+<FONT color="green">174</FONT>         * &lt;em&gt;c&lt;/em&gt; if the criterion, and &lt;em&gt;n&lt;/em&gt; is the number of<a name="line.174"></a>
+<FONT color="green">175</FONT>         * measurements, then the RMS is &lt;em&gt;sqrt (c/n)&lt;/em&gt;.<a name="line.175"></a>
+<FONT color="green">176</FONT>         *<a name="line.176"></a>
+<FONT color="green">177</FONT>         * @param problem estimation problem<a name="line.177"></a>
+<FONT color="green">178</FONT>         * @return RMS value<a name="line.178"></a>
+<FONT color="green">179</FONT>         */<a name="line.179"></a>
+<FONT color="green">180</FONT>        public double getRMS(EstimationProblem problem) {<a name="line.180"></a>
+<FONT color="green">181</FONT>            WeightedMeasurement[] wm = problem.getMeasurements();<a name="line.181"></a>
+<FONT color="green">182</FONT>            double criterion = 0;<a name="line.182"></a>
+<FONT color="green">183</FONT>            for (int i = 0; i &lt; wm.length; ++i) {<a name="line.183"></a>
+<FONT color="green">184</FONT>                double residual = wm[i].getResidual();<a name="line.184"></a>
+<FONT color="green">185</FONT>                criterion += wm[i].getWeight() * residual * residual;<a name="line.185"></a>
+<FONT color="green">186</FONT>            }<a name="line.186"></a>
+<FONT color="green">187</FONT>            return Math.sqrt(criterion / wm.length);<a name="line.187"></a>
+<FONT color="green">188</FONT>        }<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>        /**<a name="line.190"></a>
+<FONT color="green">191</FONT>         * Get the Chi-Square value.<a name="line.191"></a>
+<FONT color="green">192</FONT>         * @param problem estimation problem<a name="line.192"></a>
+<FONT color="green">193</FONT>         * @return chi-square value<a name="line.193"></a>
+<FONT color="green">194</FONT>         */<a name="line.194"></a>
+<FONT color="green">195</FONT>        public double getChiSquare(EstimationProblem problem) {<a name="line.195"></a>
+<FONT color="green">196</FONT>            WeightedMeasurement[] wm = problem.getMeasurements();<a name="line.196"></a>
+<FONT color="green">197</FONT>            double chiSquare = 0;<a name="line.197"></a>
+<FONT color="green">198</FONT>            for (int i = 0; i &lt; wm.length; ++i) {<a name="line.198"></a>
+<FONT color="green">199</FONT>                double residual = wm[i].getResidual();<a name="line.199"></a>
+<FONT color="green">200</FONT>                chiSquare += residual * residual / wm[i].getWeight();<a name="line.200"></a>
+<FONT color="green">201</FONT>            }<a name="line.201"></a>
+<FONT color="green">202</FONT>            return chiSquare;<a name="line.202"></a>
+<FONT color="green">203</FONT>        }<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>        /**<a name="line.205"></a>
+<FONT color="green">206</FONT>         * Get the covariance matrix of unbound estimated parameters.<a name="line.206"></a>
+<FONT color="green">207</FONT>         * @param problem estimation problem<a name="line.207"></a>
+<FONT color="green">208</FONT>         * @return covariance matrix<a name="line.208"></a>
+<FONT color="green">209</FONT>         * @exception EstimationException if the covariance matrix<a name="line.209"></a>
+<FONT color="green">210</FONT>         * cannot be computed (singular problem)<a name="line.210"></a>
+<FONT color="green">211</FONT>         */<a name="line.211"></a>
+<FONT color="green">212</FONT>        public double[][] getCovariances(EstimationProblem problem)<a name="line.212"></a>
+<FONT color="green">213</FONT>          throws EstimationException {<a name="line.213"></a>
+<FONT color="green">214</FONT>    <a name="line.214"></a>
+<FONT color="green">215</FONT>            // set up the jacobian<a name="line.215"></a>
+<FONT color="green">216</FONT>            updateJacobian();<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>            // compute transpose(J).J, avoiding building big intermediate matrices<a name="line.218"></a>
+<FONT color="green">219</FONT>            final int n = problem.getMeasurements().length;<a name="line.219"></a>
+<FONT color="green">220</FONT>            final int m = problem.getUnboundParameters().length;<a name="line.220"></a>
+<FONT color="green">221</FONT>            final int max  = m * n;<a name="line.221"></a>
+<FONT color="green">222</FONT>            double[][] jTj = new double[m][m];<a name="line.222"></a>
+<FONT color="green">223</FONT>            for (int i = 0; i &lt; m; ++i) {<a name="line.223"></a>
+<FONT color="green">224</FONT>                for (int j = i; j &lt; m; ++j) {<a name="line.224"></a>
+<FONT color="green">225</FONT>                    double sum = 0;<a name="line.225"></a>
+<FONT color="green">226</FONT>                    for (int k = 0; k &lt; max; k += m) {<a name="line.226"></a>
+<FONT color="green">227</FONT>                        sum += jacobian[k + i] * jacobian[k + j];<a name="line.227"></a>
+<FONT color="green">228</FONT>                    }<a name="line.228"></a>
+<FONT color="green">229</FONT>                    jTj[i][j] = sum;<a name="line.229"></a>
+<FONT color="green">230</FONT>                    jTj[j][i] = sum;<a name="line.230"></a>
+<FONT color="green">231</FONT>                }<a name="line.231"></a>
+<FONT color="green">232</FONT>            }<a name="line.232"></a>
+<FONT color="green">233</FONT>    <a name="line.233"></a>
+<FONT color="green">234</FONT>            try {<a name="line.234"></a>
+<FONT color="green">235</FONT>                // compute the covariances matrix<a name="line.235"></a>
+<FONT color="green">236</FONT>                RealMatrix inverse =<a name="line.236"></a>
+<FONT color="green">237</FONT>                    new LUDecompositionImpl(MatrixUtils.createRealMatrix(jTj)).getSolver().getInverse();<a name="line.237"></a>
+<FONT color="green">238</FONT>                return inverse.getData();<a name="line.238"></a>
+<FONT color="green">239</FONT>            } catch (InvalidMatrixException ime) {<a name="line.239"></a>
+<FONT color="green">240</FONT>                throw new EstimationException("unable to compute covariances: singular problem");<a name="line.240"></a>
+<FONT color="green">241</FONT>            }<a name="line.241"></a>
+<FONT color="green">242</FONT>    <a name="line.242"></a>
+<FONT color="green">243</FONT>        }<a name="line.243"></a>
+<FONT color="green">244</FONT>    <a name="line.244"></a>
+<FONT color="green">245</FONT>        /**<a name="line.245"></a>
+<FONT color="green">246</FONT>         * Guess the errors in unbound estimated parameters.<a name="line.246"></a>
+<FONT color="green">247</FONT>         * &lt;p&gt;Guessing is covariance-based, it only gives rough order of magnitude.&lt;/p&gt;<a name="line.247"></a>
+<FONT color="green">248</FONT>         * @param problem estimation problem<a name="line.248"></a>
+<FONT color="green">249</FONT>         * @return errors in estimated parameters<a name="line.249"></a>
+<FONT color="green">250</FONT>         * @exception EstimationException if the covariances matrix cannot be computed<a name="line.250"></a>
+<FONT color="green">251</FONT>         * or the number of degrees of freedom is not positive (number of measurements<a name="line.251"></a>
+<FONT color="green">252</FONT>         * lesser or equal to number of parameters)<a name="line.252"></a>
+<FONT color="green">253</FONT>         */<a name="line.253"></a>
+<FONT color="green">254</FONT>        public double[] guessParametersErrors(EstimationProblem problem)<a name="line.254"></a>
+<FONT color="green">255</FONT>          throws EstimationException {<a name="line.255"></a>
+<FONT color="green">256</FONT>            int m = problem.getMeasurements().length;<a name="line.256"></a>
+<FONT color="green">257</FONT>            int p = problem.getUnboundParameters().length;<a name="line.257"></a>
+<FONT color="green">258</FONT>            if (m &lt;= p) {<a name="line.258"></a>
+<FONT color="green">259</FONT>                throw new EstimationException(<a name="line.259"></a>
+<FONT color="green">260</FONT>                        "no degrees of freedom ({0} measurements, {1} parameters)",<a name="line.260"></a>
+<FONT color="green">261</FONT>                        m, p);<a name="line.261"></a>
+<FONT color="green">262</FONT>            }<a name="line.262"></a>
+<FONT color="green">263</FONT>            double[] errors = new double[problem.getUnboundParameters().length];<a name="line.263"></a>
+<FONT color="green">264</FONT>            final double c = Math.sqrt(getChiSquare(problem) / (m - p));<a name="line.264"></a>
+<FONT color="green">265</FONT>            double[][] covar = getCovariances(problem);<a name="line.265"></a>
+<FONT color="green">266</FONT>            for (int i = 0; i &lt; errors.length; ++i) {<a name="line.266"></a>
+<FONT color="green">267</FONT>                errors[i] = Math.sqrt(covar[i][i]) * c;<a name="line.267"></a>
+<FONT color="green">268</FONT>            }<a name="line.268"></a>
+<FONT color="green">269</FONT>            return errors;<a name="line.269"></a>
+<FONT color="green">270</FONT>        }<a name="line.270"></a>
+<FONT color="green">271</FONT>    <a name="line.271"></a>
+<FONT color="green">272</FONT>        /**<a name="line.272"></a>
+<FONT color="green">273</FONT>         * Initialization of the common parts of the estimation.<a name="line.273"></a>
+<FONT color="green">274</FONT>         * &lt;p&gt;This method &lt;em&gt;must&lt;/em&gt; be called at the start<a name="line.274"></a>
+<FONT color="green">275</FONT>         * of the {@link #estimate(EstimationProblem) estimate}<a name="line.275"></a>
+<FONT color="green">276</FONT>         * method.&lt;/p&gt;<a name="line.276"></a>
+<FONT color="green">277</FONT>         * @param problem estimation problem to solve<a name="line.277"></a>
+<FONT color="green">278</FONT>         */<a name="line.278"></a>
+<FONT color="green">279</FONT>        protected void initializeEstimate(EstimationProblem problem) {<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>            // reset counters<a name="line.281"></a>
+<FONT color="green">282</FONT>            costEvaluations     = 0;<a name="line.282"></a>
+<FONT color="green">283</FONT>            jacobianEvaluations = 0;<a name="line.283"></a>
+<FONT color="green">284</FONT>    <a name="line.284"></a>
+<FONT color="green">285</FONT>            // retrieve the equations and the parameters<a name="line.285"></a>
+<FONT color="green">286</FONT>            measurements = problem.getMeasurements();<a name="line.286"></a>
+<FONT color="green">287</FONT>            parameters   = problem.getUnboundParameters();<a name="line.287"></a>
+<FONT color="green">288</FONT>    <a name="line.288"></a>
+<FONT color="green">289</FONT>            // arrays shared with the other private methods<a name="line.289"></a>
+<FONT color="green">290</FONT>            rows      = measurements.length;<a name="line.290"></a>
+<FONT color="green">291</FONT>            cols      = parameters.length;<a name="line.291"></a>
+<FONT color="green">292</FONT>            jacobian  = new double[rows * cols];<a name="line.292"></a>
+<FONT color="green">293</FONT>            residuals = new double[rows];<a name="line.293"></a>
+<FONT color="green">294</FONT>    <a name="line.294"></a>
+<FONT color="green">295</FONT>            cost = Double.POSITIVE_INFINITY;<a name="line.295"></a>
+<FONT color="green">296</FONT>    <a name="line.296"></a>
+<FONT color="green">297</FONT>        }<a name="line.297"></a>
+<FONT color="green">298</FONT>    <a name="line.298"></a>
+<FONT color="green">299</FONT>        /**<a name="line.299"></a>
+<FONT color="green">300</FONT>         * Solve an estimation problem.<a name="line.300"></a>
+<FONT color="green">301</FONT>         *<a name="line.301"></a>
+<FONT color="green">302</FONT>         * &lt;p&gt;The method should set the parameters of the problem to several<a name="line.302"></a>
+<FONT color="green">303</FONT>         * trial values until it reaches convergence. If this method returns<a name="line.303"></a>
+<FONT color="green">304</FONT>         * normally (i.e. without throwing an exception), then the best<a name="line.304"></a>
+<FONT color="green">305</FONT>         * estimate of the parameters can be retrieved from the problem<a name="line.305"></a>
+<FONT color="green">306</FONT>         * itself, through the {@link EstimationProblem#getAllParameters<a name="line.306"></a>
+<FONT color="green">307</FONT>         * EstimationProblem.getAllParameters} method.&lt;/p&gt;<a name="line.307"></a>
+<FONT color="green">308</FONT>         *<a name="line.308"></a>
+<FONT color="green">309</FONT>         * @param problem estimation problem to solve<a name="line.309"></a>
+<FONT color="green">310</FONT>         * @exception EstimationException if the problem cannot be solved<a name="line.310"></a>
+<FONT color="green">311</FONT>         *<a name="line.311"></a>
+<FONT color="green">312</FONT>         */<a name="line.312"></a>
+<FONT color="green">313</FONT>        public abstract void estimate(EstimationProblem problem)<a name="line.313"></a>
+<FONT color="green">314</FONT>        throws EstimationException;<a name="line.314"></a>
+<FONT color="green">315</FONT>    <a name="line.315"></a>
+<FONT color="green">316</FONT>    }<a name="line.316"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/estimation/EstimatedParameter.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,192 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.estimation;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /** This class represents the estimated parameters of an estimation problem.<a name="line.22"></a>
+<FONT color="green">023</FONT>     *<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;The parameters of an estimation problem have a name, a value and<a name="line.24"></a>
+<FONT color="green">025</FONT>     * a bound flag. The value of bound parameters is considered trusted<a name="line.25"></a>
+<FONT color="green">026</FONT>     * and the solvers should not adjust them. On the other hand, the<a name="line.26"></a>
+<FONT color="green">027</FONT>     * solvers should adjust the value of unbounds parameters until they<a name="line.27"></a>
+<FONT color="green">028</FONT>     * satisfy convergence criterions specific to each solver.&lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     *<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 922710 $ $Date: 2010-03-13 20:20:56 -0500 (Sat, 13 Mar 2010) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 1.2<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @deprecated as of 2.0, everything in package org.apache.commons.math.estimation has<a name="line.32"></a>
+<FONT color="green">033</FONT>     * been deprecated and replaced by package org.apache.commons.math.optimization.general<a name="line.33"></a>
+<FONT color="green">034</FONT>     *<a name="line.34"></a>
+<FONT color="green">035</FONT>     */<a name="line.35"></a>
+<FONT color="green">036</FONT>    @Deprecated<a name="line.36"></a>
+<FONT color="green">037</FONT>    public class EstimatedParameter<a name="line.37"></a>
+<FONT color="green">038</FONT>      implements Serializable {<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Serializable version identifier */<a name="line.40"></a>
+<FONT color="green">041</FONT>        private static final long serialVersionUID = -555440800213416949L;<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** Current value of the parameter */<a name="line.43"></a>
+<FONT color="green">044</FONT>        protected double  estimate;<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** Name of the parameter */<a name="line.46"></a>
+<FONT color="green">047</FONT>        private final String  name;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** Indicator for bound parameters<a name="line.49"></a>
+<FONT color="green">050</FONT>         * (ie parameters that should not be estimated)<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        private   boolean bound;<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /** Simple constructor.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * Build an instance from a first estimate of the parameter,<a name="line.55"></a>
+<FONT color="green">056</FONT>         * initially considered unbound.<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @param name name of the parameter<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @param firstEstimate first estimate of the parameter<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        public EstimatedParameter(String name, double firstEstimate) {<a name="line.60"></a>
+<FONT color="green">061</FONT>            this.name = name;<a name="line.61"></a>
+<FONT color="green">062</FONT>            estimate  = firstEstimate;<a name="line.62"></a>
+<FONT color="green">063</FONT>            bound     = false;<a name="line.63"></a>
+<FONT color="green">064</FONT>        }<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /** Simple constructor.<a name="line.66"></a>
+<FONT color="green">067</FONT>         * Build an instance from a first estimate of the parameter and a<a name="line.67"></a>
+<FONT color="green">068</FONT>         * bound flag<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @param name name of the parameter<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @param firstEstimate first estimate of the parameter<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param bound flag, should be true if the parameter is bound<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        public EstimatedParameter(String name,<a name="line.73"></a>
+<FONT color="green">074</FONT>                                  double firstEstimate,<a name="line.74"></a>
+<FONT color="green">075</FONT>                                  boolean bound) {<a name="line.75"></a>
+<FONT color="green">076</FONT>            this.name  = name;<a name="line.76"></a>
+<FONT color="green">077</FONT>            estimate   = firstEstimate;<a name="line.77"></a>
+<FONT color="green">078</FONT>            this.bound = bound;<a name="line.78"></a>
+<FONT color="green">079</FONT>        }<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /** Copy constructor.<a name="line.81"></a>
+<FONT color="green">082</FONT>         * Build a copy of a parameter<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param parameter instance to copy<a name="line.83"></a>
+<FONT color="green">084</FONT>         */<a name="line.84"></a>
+<FONT color="green">085</FONT>        public EstimatedParameter(EstimatedParameter parameter) {<a name="line.85"></a>
+<FONT color="green">086</FONT>            name     = parameter.name;<a name="line.86"></a>
+<FONT color="green">087</FONT>            estimate = parameter.estimate;<a name="line.87"></a>
+<FONT color="green">088</FONT>            bound    = parameter.bound;<a name="line.88"></a>
+<FONT color="green">089</FONT>        }<a name="line.89"></a>
+<FONT color="green">090</FONT>    <a name="line.90"></a>
+<FONT color="green">091</FONT>        /** Set a new estimated value for the parameter.<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @param estimate new estimate for the parameter<a name="line.92"></a>
+<FONT color="green">093</FONT>         */<a name="line.93"></a>
+<FONT color="green">094</FONT>        public void setEstimate(double estimate) {<a name="line.94"></a>
+<FONT color="green">095</FONT>            this.estimate = estimate;<a name="line.95"></a>
+<FONT color="green">096</FONT>        }<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /** Get the current estimate of the parameter<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @return current estimate<a name="line.99"></a>
+<FONT color="green">100</FONT>         */<a name="line.100"></a>
+<FONT color="green">101</FONT>        public double getEstimate() {<a name="line.101"></a>
+<FONT color="green">102</FONT>            return estimate;<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /** get the name of the parameter<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @return parameter name<a name="line.106"></a>
+<FONT color="green">107</FONT>         */<a name="line.107"></a>
+<FONT color="green">108</FONT>        public String getName() {<a name="line.108"></a>
+<FONT color="green">109</FONT>            return name;<a name="line.109"></a>
+<FONT color="green">110</FONT>        }<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>        /** Set the bound flag of the parameter<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param bound this flag should be set to true if the parameter is<a name="line.113"></a>
+<FONT color="green">114</FONT>         * bound (i.e. if it should not be adjusted by the solver).<a name="line.114"></a>
+<FONT color="green">115</FONT>         */<a name="line.115"></a>
+<FONT color="green">116</FONT>        public void setBound(boolean bound) {<a name="line.116"></a>
+<FONT color="green">117</FONT>            this.bound = bound;<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /** Check if the parameter is bound<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @return true if the parameter is bound */<a name="line.121"></a>
+<FONT color="green">122</FONT>        public boolean isBound() {<a name="line.122"></a>
+<FONT color="green">123</FONT>            return bound;<a name="line.123"></a>
+<FONT color="green">124</FONT>        }<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>    }<a name="line.126"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/estimation/EstimationException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,114 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.estimation;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This class represents exceptions thrown by the estimation solvers.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 1.2<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @deprecated as of 2.0, everything in package org.apache.commons.math.estimation has<a name="line.27"></a>
+<FONT color="green">028</FONT>     * been deprecated and replaced by package org.apache.commons.math.optimization.general<a name="line.28"></a>
+<FONT color="green">029</FONT>     *<a name="line.29"></a>
+<FONT color="green">030</FONT>     */<a name="line.30"></a>
+<FONT color="green">031</FONT>    @Deprecated<a name="line.31"></a>
+<FONT color="green">032</FONT>    public class EstimationException<a name="line.32"></a>
+<FONT color="green">033</FONT>    extends MathException {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Serializable version identifier. */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private static final long serialVersionUID = -573038581493881337L;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /**<a name="line.38"></a>
+<FONT color="green">039</FONT>         * Simple constructor.<a name="line.39"></a>
+<FONT color="green">040</FONT>         * Build an exception by translating and formating a message<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @param specifier format specifier (to be translated)<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @param parts to insert in the format (no translation)<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        public EstimationException(String specifier, Object ... parts) {<a name="line.44"></a>
+<FONT color="green">045</FONT>            super(specifier, parts);<a name="line.45"></a>
+<FONT color="green">046</FONT>        }<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>    }<a name="line.48"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/estimation/EstimationProblem.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,134 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.estimation;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * This interface represents an estimation problem.<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;p&gt;This interface should be implemented by all real estimation<a name="line.23"></a>
+<FONT color="green">024</FONT>     * problems before they can be handled by the estimators through the<a name="line.24"></a>
+<FONT color="green">025</FONT>     * {@link Estimator#estimate Estimator.estimate} method.&lt;/p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;An estimation problem, as seen by a solver is a set of<a name="line.27"></a>
+<FONT color="green">028</FONT>     * parameters and a set of measurements. The parameters are adjusted<a name="line.28"></a>
+<FONT color="green">029</FONT>     * during the estimation through the {@link #getUnboundParameters<a name="line.29"></a>
+<FONT color="green">030</FONT>     * getUnboundParameters} and {@link EstimatedParameter#setEstimate<a name="line.30"></a>
+<FONT color="green">031</FONT>     * EstimatedParameter.setEstimate} methods. The measurements both have<a name="line.31"></a>
+<FONT color="green">032</FONT>     * a measured value which is generally fixed at construction and a<a name="line.32"></a>
+<FONT color="green">033</FONT>     * theoretical value which depends on the model and hence varies as<a name="line.33"></a>
+<FONT color="green">034</FONT>     * the parameters are adjusted. The purpose of the solver is to reduce<a name="line.34"></a>
+<FONT color="green">035</FONT>     * the residual between these values, it can retrieve the measurements<a name="line.35"></a>
+<FONT color="green">036</FONT>     * through the {@link #getMeasurements getMeasurements} method.&lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @see Estimator<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @see WeightedMeasurement<a name="line.39"></a>
+<FONT color="green">040</FONT>     *<a name="line.40"></a>
+<FONT color="green">041</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.41"></a>
+<FONT color="green">042</FONT>     * @since 1.2<a name="line.42"></a>
+<FONT color="green">043</FONT>     * @deprecated as of 2.0, everything in package org.apache.commons.math.estimation has<a name="line.43"></a>
+<FONT color="green">044</FONT>     * been deprecated and replaced by package org.apache.commons.math.optimization.general<a name="line.44"></a>
+<FONT color="green">045</FONT>     *<a name="line.45"></a>
+<FONT color="green">046</FONT>     */<a name="line.46"></a>
+<FONT color="green">047</FONT>    @Deprecated<a name="line.47"></a>
+<FONT color="green">048</FONT>    public interface EstimationProblem {<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Get the measurements of an estimation problem.<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @return measurements<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        WeightedMeasurement[] getMeasurements();<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /**<a name="line.56"></a>
+<FONT color="green">057</FONT>         * Get the unbound parameters of the problem.<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @return unbound parameters<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        EstimatedParameter[] getUnboundParameters();<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /**<a name="line.62"></a>
+<FONT color="green">063</FONT>         * Get all the parameters of the problem.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @return parameters<a name="line.64"></a>
+<FONT color="green">065</FONT>         */<a name="line.65"></a>
+<FONT color="green">066</FONT>        EstimatedParameter[] getAllParameters();<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>    }<a name="line.68"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/estimation/Estimator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,156 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.estimation;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * This interface represents solvers for estimation problems.<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;p&gt;The classes which are devoted to solve estimation problems<a name="line.23"></a>
+<FONT color="green">024</FONT>     * should implement this interface. The problems which can be handled<a name="line.24"></a>
+<FONT color="green">025</FONT>     * should implement the {@link EstimationProblem} interface which<a name="line.25"></a>
+<FONT color="green">026</FONT>     * gather all the information needed by the solver.&lt;/p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;The interface is composed only of the {@link #estimate estimate}<a name="line.28"></a>
+<FONT color="green">029</FONT>     * method.&lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @see EstimationProblem<a name="line.31"></a>
+<FONT color="green">032</FONT>     *<a name="line.32"></a>
+<FONT color="green">033</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @since 1.2<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @deprecated as of 2.0, everything in package org.apache.commons.math.estimation has<a name="line.35"></a>
+<FONT color="green">036</FONT>     * been deprecated and replaced by package org.apache.commons.math.optimization.general<a name="line.36"></a>
+<FONT color="green">037</FONT>     *<a name="line.37"></a>
+<FONT color="green">038</FONT>     */<a name="line.38"></a>
+<FONT color="green">039</FONT>    @Deprecated<a name="line.39"></a>
+<FONT color="green">040</FONT>    public interface Estimator {<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>      /**<a name="line.42"></a>
+<FONT color="green">043</FONT>       * Solve an estimation problem.<a name="line.43"></a>
+<FONT color="green">044</FONT>       *<a name="line.44"></a>
+<FONT color="green">045</FONT>       * &lt;p&gt;The method should set the parameters of the problem to several<a name="line.45"></a>
+<FONT color="green">046</FONT>       * trial values until it reaches convergence. If this method returns<a name="line.46"></a>
+<FONT color="green">047</FONT>       * normally (i.e. without throwing an exception), then the best<a name="line.47"></a>
+<FONT color="green">048</FONT>       * estimate of the parameters can be retrieved from the problem<a name="line.48"></a>
+<FONT color="green">049</FONT>       * itself, through the {@link EstimationProblem#getAllParameters<a name="line.49"></a>
+<FONT color="green">050</FONT>       * EstimationProblem.getAllParameters} method.&lt;/p&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>       *<a name="line.51"></a>
+<FONT color="green">052</FONT>       * @param problem estimation problem to solve<a name="line.52"></a>
+<FONT color="green">053</FONT>       * @exception EstimationException if the problem cannot be solved<a name="line.53"></a>
+<FONT color="green">054</FONT>       *<a name="line.54"></a>
+<FONT color="green">055</FONT>       */<a name="line.55"></a>
+<FONT color="green">056</FONT>      void estimate(EstimationProblem problem) throws EstimationException;<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>      /**<a name="line.58"></a>
+<FONT color="green">059</FONT>       * Get the Root Mean Square value.<a name="line.59"></a>
+<FONT color="green">060</FONT>       * Get the Root Mean Square value, i.e. the root of the arithmetic<a name="line.60"></a>
+<FONT color="green">061</FONT>       * mean of the square of all weighted residuals. This is related to the<a name="line.61"></a>
+<FONT color="green">062</FONT>       * criterion that is minimized by the estimator as follows: if<a name="line.62"></a>
+<FONT color="green">063</FONT>       * &lt;em&gt;c&lt;/em&gt; is the criterion, and &lt;em&gt;n&lt;/em&gt; is the number of<a name="line.63"></a>
+<FONT color="green">064</FONT>       * measurements, then the RMS is &lt;em&gt;sqrt (c/n)&lt;/em&gt;.<a name="line.64"></a>
+<FONT color="green">065</FONT>       * @see #guessParametersErrors(EstimationProblem)<a name="line.65"></a>
+<FONT color="green">066</FONT>       *<a name="line.66"></a>
+<FONT color="green">067</FONT>       * @param problem estimation problem<a name="line.67"></a>
+<FONT color="green">068</FONT>       * @return RMS value<a name="line.68"></a>
+<FONT color="green">069</FONT>       */<a name="line.69"></a>
+<FONT color="green">070</FONT>      double getRMS(EstimationProblem problem);<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>      /**<a name="line.72"></a>
+<FONT color="green">073</FONT>       * Get the covariance matrix of estimated parameters.<a name="line.73"></a>
+<FONT color="green">074</FONT>       * @param problem estimation problem<a name="line.74"></a>
+<FONT color="green">075</FONT>       * @return covariance matrix<a name="line.75"></a>
+<FONT color="green">076</FONT>       * @exception EstimationException if the covariance matrix<a name="line.76"></a>
+<FONT color="green">077</FONT>       * cannot be computed (singular problem)<a name="line.77"></a>
+<FONT color="green">078</FONT>       */<a name="line.78"></a>
+<FONT color="green">079</FONT>      double[][] getCovariances(EstimationProblem problem) throws EstimationException;<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>      /**<a name="line.81"></a>
+<FONT color="green">082</FONT>       * Guess the errors in estimated parameters.<a name="line.82"></a>
+<FONT color="green">083</FONT>       * @see #getRMS(EstimationProblem)<a name="line.83"></a>
+<FONT color="green">084</FONT>       * @param problem estimation problem<a name="line.84"></a>
+<FONT color="green">085</FONT>       * @return errors in estimated parameters<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @exception EstimationException if the error cannot be guessed<a name="line.86"></a>
+<FONT color="green">087</FONT>       */<a name="line.87"></a>
+<FONT color="green">088</FONT>      double[] guessParametersErrors(EstimationProblem problem) throws EstimationException;<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>    }<a name="line.90"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/estimation/GaussNewtonEstimator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,295 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.estimation;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.linear.InvalidMatrixException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.linear.LUDecompositionImpl;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.linear.MatrixUtils;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.linear.RealMatrix;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.linear.RealVector;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.linear.ArrayRealVector;<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>    /**<a name="line.29"></a>
+<FONT color="green">030</FONT>     * This class implements a solver for estimation problems.<a name="line.30"></a>
+<FONT color="green">031</FONT>     *<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;This class solves estimation problems using a weighted least<a name="line.32"></a>
+<FONT color="green">033</FONT>     * squares criterion on the measurement residuals. It uses a<a name="line.33"></a>
+<FONT color="green">034</FONT>     * Gauss-Newton algorithm.&lt;/p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     *<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @since 1.2<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @deprecated as of 2.0, everything in package org.apache.commons.math.estimation has<a name="line.38"></a>
+<FONT color="green">039</FONT>     * been deprecated and replaced by package org.apache.commons.math.optimization.general<a name="line.39"></a>
+<FONT color="green">040</FONT>     *<a name="line.40"></a>
+<FONT color="green">041</FONT>     */<a name="line.41"></a>
+<FONT color="green">042</FONT>    @Deprecated<a name="line.42"></a>
+<FONT color="green">043</FONT>    public class GaussNewtonEstimator extends AbstractEstimator implements Serializable {<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Serializable version identifier */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private static final long serialVersionUID = 5485001826076289109L;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** Default threshold for cost steady state detection. */<a name="line.48"></a>
+<FONT color="green">049</FONT>        private static final double DEFAULT_STEADY_STATE_THRESHOLD = 1.0e-6;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /** Default threshold for cost convergence. */<a name="line.51"></a>
+<FONT color="green">052</FONT>        private static final double DEFAULT_CONVERGENCE = 1.0e-6;<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /** Threshold for cost steady state detection. */<a name="line.54"></a>
+<FONT color="green">055</FONT>        private double steadyStateThreshold;<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /** Threshold for cost convergence. */<a name="line.57"></a>
+<FONT color="green">058</FONT>        private double convergence;<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Simple constructor with default settings.<a name="line.60"></a>
+<FONT color="green">061</FONT>         * &lt;p&gt;<a name="line.61"></a>
+<FONT color="green">062</FONT>         * The estimator is built with default values for all settings.<a name="line.62"></a>
+<FONT color="green">063</FONT>         * &lt;/p&gt;<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @see #DEFAULT_STEADY_STATE_THRESHOLD<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @see #DEFAULT_CONVERGENCE<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @see AbstractEstimator#DEFAULT_MAX_COST_EVALUATIONS<a name="line.66"></a>
+<FONT color="green">067</FONT>         */<a name="line.67"></a>
+<FONT color="green">068</FONT>        public GaussNewtonEstimator() {<a name="line.68"></a>
+<FONT color="green">069</FONT>            this.steadyStateThreshold = DEFAULT_STEADY_STATE_THRESHOLD;<a name="line.69"></a>
+<FONT color="green">070</FONT>            this.convergence          = DEFAULT_CONVERGENCE;<a name="line.70"></a>
+<FONT color="green">071</FONT>        }<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /**<a name="line.73"></a>
+<FONT color="green">074</FONT>         * Simple constructor.<a name="line.74"></a>
+<FONT color="green">075</FONT>         *<a name="line.75"></a>
+<FONT color="green">076</FONT>         * &lt;p&gt;This constructor builds an estimator and stores its convergence<a name="line.76"></a>
+<FONT color="green">077</FONT>         * characteristics.&lt;/p&gt;<a name="line.77"></a>
+<FONT color="green">078</FONT>         *<a name="line.78"></a>
+<FONT color="green">079</FONT>         * &lt;p&gt;An estimator is considered to have converged whenever either<a name="line.79"></a>
+<FONT color="green">080</FONT>         * the criterion goes below a physical threshold under which<a name="line.80"></a>
+<FONT color="green">081</FONT>         * improvements are considered useless or when the algorithm is<a name="line.81"></a>
+<FONT color="green">082</FONT>         * unable to improve it (even if it is still high). The first<a name="line.82"></a>
+<FONT color="green">083</FONT>         * condition that is met stops the iterations.&lt;/p&gt;<a name="line.83"></a>
+<FONT color="green">084</FONT>         *<a name="line.84"></a>
+<FONT color="green">085</FONT>         * &lt;p&gt;The fact an estimator has converged does not mean that the<a name="line.85"></a>
+<FONT color="green">086</FONT>         * model accurately fits the measurements. It only means no better<a name="line.86"></a>
+<FONT color="green">087</FONT>         * solution can be found, it does not mean this one is good. Such an<a name="line.87"></a>
+<FONT color="green">088</FONT>         * analysis is left to the caller.&lt;/p&gt;<a name="line.88"></a>
+<FONT color="green">089</FONT>         *<a name="line.89"></a>
+<FONT color="green">090</FONT>         * &lt;p&gt;If neither conditions are fulfilled before a given number of<a name="line.90"></a>
+<FONT color="green">091</FONT>         * iterations, the algorithm is considered to have failed and an<a name="line.91"></a>
+<FONT color="green">092</FONT>         * {@link EstimationException} is thrown.&lt;/p&gt;<a name="line.92"></a>
+<FONT color="green">093</FONT>         *<a name="line.93"></a>
+<FONT color="green">094</FONT>         * @param maxCostEval maximal number of cost evaluations allowed<a name="line.94"></a>
+<FONT color="green">095</FONT>         * @param convergence criterion threshold below which we do not need<a name="line.95"></a>
+<FONT color="green">096</FONT>         * to improve the criterion anymore<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @param steadyStateThreshold steady state detection threshold, the<a name="line.97"></a>
+<FONT color="green">098</FONT>         * problem has converged has reached a steady state if<a name="line.98"></a>
+<FONT color="green">099</FONT>         * &lt;code&gt;Math.abs(J&lt;sub&gt;n&lt;/sub&gt; - J&lt;sub&gt;n-1&lt;/sub&gt;) &amp;lt;<a name="line.99"></a>
+<FONT color="green">100</FONT>         * J&lt;sub&gt;n&lt;/sub&gt; &amp;times convergence&lt;/code&gt;, where &lt;code&gt;J&lt;sub&gt;n&lt;/sub&gt;&lt;/code&gt;<a name="line.100"></a>
+<FONT color="green">101</FONT>         * and &lt;code&gt;J&lt;sub&gt;n-1&lt;/sub&gt;&lt;/code&gt; are the current and preceding criterion<a name="line.101"></a>
+<FONT color="green">102</FONT>         * values (square sum of the weighted residuals of considered measurements).<a name="line.102"></a>
+<FONT color="green">103</FONT>         */<a name="line.103"></a>
+<FONT color="green">104</FONT>        public GaussNewtonEstimator(final int maxCostEval, final double convergence,<a name="line.104"></a>
+<FONT color="green">105</FONT>                                    final double steadyStateThreshold) {<a name="line.105"></a>
+<FONT color="green">106</FONT>            setMaxCostEval(maxCostEval);<a name="line.106"></a>
+<FONT color="green">107</FONT>            this.steadyStateThreshold = steadyStateThreshold;<a name="line.107"></a>
+<FONT color="green">108</FONT>            this.convergence          = convergence;<a name="line.108"></a>
+<FONT color="green">109</FONT>        }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /**<a name="line.111"></a>
+<FONT color="green">112</FONT>         * Set the convergence criterion threshold.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param convergence criterion threshold below which we do not need<a name="line.113"></a>
+<FONT color="green">114</FONT>         * to improve the criterion anymore<a name="line.114"></a>
+<FONT color="green">115</FONT>         */<a name="line.115"></a>
+<FONT color="green">116</FONT>        public void setConvergence(final double convergence) {<a name="line.116"></a>
+<FONT color="green">117</FONT>            this.convergence = convergence;<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /**<a name="line.120"></a>
+<FONT color="green">121</FONT>         * Set the steady state detection threshold.<a name="line.121"></a>
+<FONT color="green">122</FONT>         * &lt;p&gt;<a name="line.122"></a>
+<FONT color="green">123</FONT>         * The problem has converged has reached a steady state if<a name="line.123"></a>
+<FONT color="green">124</FONT>         * &lt;code&gt;Math.abs(J&lt;sub&gt;n&lt;/sub&gt; - J&lt;sub&gt;n-1&lt;/sub&gt;) &amp;lt;<a name="line.124"></a>
+<FONT color="green">125</FONT>         * J&lt;sub&gt;n&lt;/sub&gt; &amp;times convergence&lt;/code&gt;, where &lt;code&gt;J&lt;sub&gt;n&lt;/sub&gt;&lt;/code&gt;<a name="line.125"></a>
+<FONT color="green">126</FONT>         * and &lt;code&gt;J&lt;sub&gt;n-1&lt;/sub&gt;&lt;/code&gt; are the current and preceding criterion<a name="line.126"></a>
+<FONT color="green">127</FONT>         * values (square sum of the weighted residuals of considered measurements).<a name="line.127"></a>
+<FONT color="green">128</FONT>         * &lt;/p&gt;<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @param steadyStateThreshold steady state detection threshold<a name="line.129"></a>
+<FONT color="green">130</FONT>         */<a name="line.130"></a>
+<FONT color="green">131</FONT>        public void setSteadyStateThreshold(final double steadyStateThreshold) {<a name="line.131"></a>
+<FONT color="green">132</FONT>            this.steadyStateThreshold = steadyStateThreshold;<a name="line.132"></a>
+<FONT color="green">133</FONT>        }<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>        /**<a name="line.135"></a>
+<FONT color="green">136</FONT>         * Solve an estimation problem using a least squares criterion.<a name="line.136"></a>
+<FONT color="green">137</FONT>         *<a name="line.137"></a>
+<FONT color="green">138</FONT>         * &lt;p&gt;This method set the unbound parameters of the given problem<a name="line.138"></a>
+<FONT color="green">139</FONT>         * starting from their current values through several iterations. At<a name="line.139"></a>
+<FONT color="green">140</FONT>         * each step, the unbound parameters are changed in order to<a name="line.140"></a>
+<FONT color="green">141</FONT>         * minimize a weighted least square criterion based on the<a name="line.141"></a>
+<FONT color="green">142</FONT>         * measurements of the problem.&lt;/p&gt;<a name="line.142"></a>
+<FONT color="green">143</FONT>         *<a name="line.143"></a>
+<FONT color="green">144</FONT>         * &lt;p&gt;The iterations are stopped either when the criterion goes<a name="line.144"></a>
+<FONT color="green">145</FONT>         * below a physical threshold under which improvement are considered<a name="line.145"></a>
+<FONT color="green">146</FONT>         * useless or when the algorithm is unable to improve it (even if it<a name="line.146"></a>
+<FONT color="green">147</FONT>         * is still high). The first condition that is met stops the<a name="line.147"></a>
+<FONT color="green">148</FONT>         * iterations. If the convergence it not reached before the maximum<a name="line.148"></a>
+<FONT color="green">149</FONT>         * number of iterations, an {@link EstimationException} is<a name="line.149"></a>
+<FONT color="green">150</FONT>         * thrown.&lt;/p&gt;<a name="line.150"></a>
+<FONT color="green">151</FONT>         *<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @param problem estimation problem to solve<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @exception EstimationException if the problem cannot be solved<a name="line.153"></a>
+<FONT color="green">154</FONT>         *<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @see EstimationProblem<a name="line.155"></a>
+<FONT color="green">156</FONT>         *<a name="line.156"></a>
+<FONT color="green">157</FONT>         */<a name="line.157"></a>
+<FONT color="green">158</FONT>        @Override<a name="line.158"></a>
+<FONT color="green">159</FONT>        public void estimate(EstimationProblem problem)<a name="line.159"></a>
+<FONT color="green">160</FONT>        throws EstimationException {<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>            initializeEstimate(problem);<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>            // work matrices<a name="line.164"></a>
+<FONT color="green">165</FONT>            double[] grad             = new double[parameters.length];<a name="line.165"></a>
+<FONT color="green">166</FONT>            ArrayRealVector bDecrement = new ArrayRealVector(parameters.length);<a name="line.166"></a>
+<FONT color="green">167</FONT>            double[] bDecrementData   = bDecrement.getDataRef();<a name="line.167"></a>
+<FONT color="green">168</FONT>            RealMatrix wGradGradT     = MatrixUtils.createRealMatrix(parameters.length, parameters.length);<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>            // iterate until convergence is reached<a name="line.170"></a>
+<FONT color="green">171</FONT>            double previous = Double.POSITIVE_INFINITY;<a name="line.171"></a>
+<FONT color="green">172</FONT>            do {<a name="line.172"></a>
+<FONT color="green">173</FONT>    <a name="line.173"></a>
+<FONT color="green">174</FONT>                // build the linear problem<a name="line.174"></a>
+<FONT color="green">175</FONT>                incrementJacobianEvaluationsCounter();<a name="line.175"></a>
+<FONT color="green">176</FONT>                RealVector b = new ArrayRealVector(parameters.length);<a name="line.176"></a>
+<FONT color="green">177</FONT>                RealMatrix a = MatrixUtils.createRealMatrix(parameters.length, parameters.length);<a name="line.177"></a>
+<FONT color="green">178</FONT>                for (int i = 0; i &lt; measurements.length; ++i) {<a name="line.178"></a>
+<FONT color="green">179</FONT>                    if (! measurements [i].isIgnored()) {<a name="line.179"></a>
+<FONT color="green">180</FONT>    <a name="line.180"></a>
+<FONT color="green">181</FONT>                        double weight   = measurements[i].getWeight();<a name="line.181"></a>
+<FONT color="green">182</FONT>                        double residual = measurements[i].getResidual();<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>                        // compute the normal equation<a name="line.184"></a>
+<FONT color="green">185</FONT>                        for (int j = 0; j &lt; parameters.length; ++j) {<a name="line.185"></a>
+<FONT color="green">186</FONT>                            grad[j] = measurements[i].getPartial(parameters[j]);<a name="line.186"></a>
+<FONT color="green">187</FONT>                            bDecrementData[j] = weight * residual * grad[j];<a name="line.187"></a>
+<FONT color="green">188</FONT>                        }<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>                        // build the contribution matrix for measurement i<a name="line.190"></a>
+<FONT color="green">191</FONT>                        for (int k = 0; k &lt; parameters.length; ++k) {<a name="line.191"></a>
+<FONT color="green">192</FONT>                            double gk = grad[k];<a name="line.192"></a>
+<FONT color="green">193</FONT>                            for (int l = 0; l &lt; parameters.length; ++l) {<a name="line.193"></a>
+<FONT color="green">194</FONT>                                wGradGradT.setEntry(k, l, weight * gk * grad[l]);<a name="line.194"></a>
+<FONT color="green">195</FONT>                            }<a name="line.195"></a>
+<FONT color="green">196</FONT>                        }<a name="line.196"></a>
+<FONT color="green">197</FONT>    <a name="line.197"></a>
+<FONT color="green">198</FONT>                        // update the matrices<a name="line.198"></a>
+<FONT color="green">199</FONT>                        a = a.add(wGradGradT);<a name="line.199"></a>
+<FONT color="green">200</FONT>                        b = b.add(bDecrement);<a name="line.200"></a>
+<FONT color="green">201</FONT>    <a name="line.201"></a>
+<FONT color="green">202</FONT>                    }<a name="line.202"></a>
+<FONT color="green">203</FONT>                }<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>                try {<a name="line.205"></a>
+<FONT color="green">206</FONT>    <a name="line.206"></a>
+<FONT color="green">207</FONT>                    // solve the linearized least squares problem<a name="line.207"></a>
+<FONT color="green">208</FONT>                    RealVector dX = new LUDecompositionImpl(a).getSolver().solve(b);<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>                    // update the estimated parameters<a name="line.210"></a>
+<FONT color="green">211</FONT>                    for (int i = 0; i &lt; parameters.length; ++i) {<a name="line.211"></a>
+<FONT color="green">212</FONT>                        parameters[i].setEstimate(parameters[i].getEstimate() + dX.getEntry(i));<a name="line.212"></a>
+<FONT color="green">213</FONT>                    }<a name="line.213"></a>
+<FONT color="green">214</FONT>    <a name="line.214"></a>
+<FONT color="green">215</FONT>                } catch(InvalidMatrixException e) {<a name="line.215"></a>
+<FONT color="green">216</FONT>                    throw new EstimationException("unable to solve: singular problem");<a name="line.216"></a>
+<FONT color="green">217</FONT>                }<a name="line.217"></a>
+<FONT color="green">218</FONT>    <a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>                previous = cost;<a name="line.220"></a>
+<FONT color="green">221</FONT>                updateResidualsAndCost();<a name="line.221"></a>
+<FONT color="green">222</FONT>    <a name="line.222"></a>
+<FONT color="green">223</FONT>            } while ((getCostEvaluations() &lt; 2) ||<a name="line.223"></a>
+<FONT color="green">224</FONT>                     (Math.abs(previous - cost) &gt; (cost * steadyStateThreshold) &amp;&amp;<a name="line.224"></a>
+<FONT color="green">225</FONT>                      (Math.abs(cost) &gt; convergence)));<a name="line.225"></a>
+<FONT color="green">226</FONT>    <a name="line.226"></a>
+<FONT color="green">227</FONT>        }<a name="line.227"></a>
+<FONT color="green">228</FONT>    <a name="line.228"></a>
+<FONT color="green">229</FONT>    }<a name="line.229"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/estimation/LevenbergMarquardtEstimator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,960 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.estimation;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * This class solves a least squares problem.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;This implementation &lt;em&gt;should&lt;/em&gt; work even for over-determined systems<a name="line.26"></a>
+<FONT color="green">027</FONT>     * (i.e. systems having more variables than equations). Over-determined systems<a name="line.27"></a>
+<FONT color="green">028</FONT>     * are solved by ignoring the variables which have the smallest impact according<a name="line.28"></a>
+<FONT color="green">029</FONT>     * to their jacobian column norm. Only the rank of the matrix and some loop bounds<a name="line.29"></a>
+<FONT color="green">030</FONT>     * are changed to implement this.&lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     *<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;The resolution engine is a simple translation of the MINPACK &lt;a<a name="line.32"></a>
+<FONT color="green">033</FONT>     * href="http://www.netlib.org/minpack/lmder.f"&gt;lmder&lt;/a&gt; routine with minor<a name="line.33"></a>
+<FONT color="green">034</FONT>     * changes. The changes include the over-determined resolution and the Q.R.<a name="line.34"></a>
+<FONT color="green">035</FONT>     * decomposition which has been rewritten following the algorithm described in the<a name="line.35"></a>
+<FONT color="green">036</FONT>     * P. Lascaux and R. Theodor book &lt;i&gt;Analyse num&amp;eacute;rique matricielle<a name="line.36"></a>
+<FONT color="green">037</FONT>     * appliqu&amp;eacute;e &amp;agrave; l'art de l'ing&amp;eacute;nieur&lt;/i&gt;, Masson 1986.&lt;/p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * &lt;p&gt;The authors of the original fortran version are:<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;ul&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;li&gt;Argonne National Laboratory. MINPACK project. March 1980&lt;/li&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;li&gt;Burton S. Garbow&lt;/li&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;li&gt;Kenneth E. Hillstrom&lt;/li&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     * &lt;li&gt;Jorge J. More&lt;/li&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;/ul&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     * The redistribution policy for MINPACK is available &lt;a<a name="line.45"></a>
+<FONT color="green">046</FONT>     * href="http://www.netlib.org/minpack/disclaimer"&gt;here&lt;/a&gt;, for convenience, it<a name="line.46"></a>
+<FONT color="green">047</FONT>     * is reproduced below.&lt;/p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     *<a name="line.48"></a>
+<FONT color="green">049</FONT>     * &lt;table border="0" width="80%" cellpadding="10" align="center" bgcolor="#E0E0E0"&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     * &lt;tr&gt;&lt;td&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>     *    Minpack Copyright Notice (1999) University of Chicago.<a name="line.51"></a>
+<FONT color="green">052</FONT>     *    All rights reserved<a name="line.52"></a>
+<FONT color="green">053</FONT>     * &lt;/td&gt;&lt;/tr&gt;<a name="line.53"></a>
+<FONT color="green">054</FONT>     * &lt;tr&gt;&lt;td&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>     * Redistribution and use in source and binary forms, with or without<a name="line.55"></a>
+<FONT color="green">056</FONT>     * modification, are permitted provided that the following conditions<a name="line.56"></a>
+<FONT color="green">057</FONT>     * are met:<a name="line.57"></a>
+<FONT color="green">058</FONT>     * &lt;ol&gt;<a name="line.58"></a>
+<FONT color="green">059</FONT>     *  &lt;li&gt;Redistributions of source code must retain the above copyright<a name="line.59"></a>
+<FONT color="green">060</FONT>     *      notice, this list of conditions and the following disclaimer.&lt;/li&gt;<a name="line.60"></a>
+<FONT color="green">061</FONT>     * &lt;li&gt;Redistributions in binary form must reproduce the above<a name="line.61"></a>
+<FONT color="green">062</FONT>     *     copyright notice, this list of conditions and the following<a name="line.62"></a>
+<FONT color="green">063</FONT>     *     disclaimer in the documentation and/or other materials provided<a name="line.63"></a>
+<FONT color="green">064</FONT>     *     with the distribution.&lt;/li&gt;<a name="line.64"></a>
+<FONT color="green">065</FONT>     * &lt;li&gt;The end-user documentation included with the redistribution, if any,<a name="line.65"></a>
+<FONT color="green">066</FONT>     *     must include the following acknowledgment:<a name="line.66"></a>
+<FONT color="green">067</FONT>     *     &lt;code&gt;This product includes software developed by the University of<a name="line.67"></a>
+<FONT color="green">068</FONT>     *           Chicago, as Operator of Argonne National Laboratory.&lt;/code&gt;<a name="line.68"></a>
+<FONT color="green">069</FONT>     *     Alternately, this acknowledgment may appear in the software itself,<a name="line.69"></a>
+<FONT color="green">070</FONT>     *     if and wherever such third-party acknowledgments normally appear.&lt;/li&gt;<a name="line.70"></a>
+<FONT color="green">071</FONT>     * &lt;li&gt;&lt;strong&gt;WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"<a name="line.71"></a>
+<FONT color="green">072</FONT>     *     WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE<a name="line.72"></a>
+<FONT color="green">073</FONT>     *     UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND<a name="line.73"></a>
+<FONT color="green">074</FONT>     *     THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR<a name="line.74"></a>
+<FONT color="green">075</FONT>     *     IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES<a name="line.75"></a>
+<FONT color="green">076</FONT>     *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE<a name="line.76"></a>
+<FONT color="green">077</FONT>     *     OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY<a name="line.77"></a>
+<FONT color="green">078</FONT>     *     OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR<a name="line.78"></a>
+<FONT color="green">079</FONT>     *     USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF<a name="line.79"></a>
+<FONT color="green">080</FONT>     *     THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)<a name="line.80"></a>
+<FONT color="green">081</FONT>     *     DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION<a name="line.81"></a>
+<FONT color="green">082</FONT>     *     UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL<a name="line.82"></a>
+<FONT color="green">083</FONT>     *     BE CORRECTED.&lt;/strong&gt;&lt;/li&gt;<a name="line.83"></a>
+<FONT color="green">084</FONT>     * &lt;li&gt;&lt;strong&gt;LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT<a name="line.84"></a>
+<FONT color="green">085</FONT>     *     HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF<a name="line.85"></a>
+<FONT color="green">086</FONT>     *     ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,<a name="line.86"></a>
+<FONT color="green">087</FONT>     *     INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF<a name="line.87"></a>
+<FONT color="green">088</FONT>     *     ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF<a name="line.88"></a>
+<FONT color="green">089</FONT>     *     PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER<a name="line.89"></a>
+<FONT color="green">090</FONT>     *     SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT<a name="line.90"></a>
+<FONT color="green">091</FONT>     *     (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,<a name="line.91"></a>
+<FONT color="green">092</FONT>     *     EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE<a name="line.92"></a>
+<FONT color="green">093</FONT>     *     POSSIBILITY OF SUCH LOSS OR DAMAGES.&lt;/strong&gt;&lt;/li&gt;<a name="line.93"></a>
+<FONT color="green">094</FONT>     * &lt;ol&gt;&lt;/td&gt;&lt;/tr&gt;<a name="line.94"></a>
+<FONT color="green">095</FONT>     * &lt;/table&gt;<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>     * @version $Revision: 825919 $ $Date: 2009-10-16 10:51:55 -0400 (Fri, 16 Oct 2009) $<a name="line.97"></a>
+<FONT color="green">098</FONT>     * @since 1.2<a name="line.98"></a>
+<FONT color="green">099</FONT>     * @deprecated as of 2.0, everything in package org.apache.commons.math.estimation has<a name="line.99"></a>
+<FONT color="green">100</FONT>     * been deprecated and replaced by package org.apache.commons.math.optimization.general<a name="line.100"></a>
+<FONT color="green">101</FONT>     *<a name="line.101"></a>
+<FONT color="green">102</FONT>     */<a name="line.102"></a>
+<FONT color="green">103</FONT>    @Deprecated<a name="line.103"></a>
+<FONT color="green">104</FONT>    public class LevenbergMarquardtEstimator extends AbstractEstimator implements Serializable {<a name="line.104"></a>
+<FONT color="green">105</FONT>    <a name="line.105"></a>
+<FONT color="green">106</FONT>        /** Serializable version identifier */<a name="line.106"></a>
+<FONT color="green">107</FONT>        private static final long serialVersionUID = -5705952631533171019L;<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /** Number of solved variables. */<a name="line.109"></a>
+<FONT color="green">110</FONT>        private int solvedCols;<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>        /** Diagonal elements of the R matrix in the Q.R. decomposition. */<a name="line.112"></a>
+<FONT color="green">113</FONT>        private double[] diagR;<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>        /** Norms of the columns of the jacobian matrix. */<a name="line.115"></a>
+<FONT color="green">116</FONT>        private double[] jacNorm;<a name="line.116"></a>
+<FONT color="green">117</FONT>    <a name="line.117"></a>
+<FONT color="green">118</FONT>        /** Coefficients of the Householder transforms vectors. */<a name="line.118"></a>
+<FONT color="green">119</FONT>        private double[] beta;<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /** Columns permutation array. */<a name="line.121"></a>
+<FONT color="green">122</FONT>        private int[] permutation;<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>        /** Rank of the jacobian matrix. */<a name="line.124"></a>
+<FONT color="green">125</FONT>        private int rank;<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>        /** Levenberg-Marquardt parameter. */<a name="line.127"></a>
+<FONT color="green">128</FONT>        private double lmPar;<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /** Parameters evolution direction associated with lmPar. */<a name="line.130"></a>
+<FONT color="green">131</FONT>        private double[] lmDir;<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>        /** Positive input variable used in determining the initial step bound. */<a name="line.133"></a>
+<FONT color="green">134</FONT>        private double initialStepBoundFactor;<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>        /** Desired relative error in the sum of squares. */<a name="line.136"></a>
+<FONT color="green">137</FONT>        private double costRelativeTolerance;<a name="line.137"></a>
+<FONT color="green">138</FONT>    <a name="line.138"></a>
+<FONT color="green">139</FONT>        /**  Desired relative error in the approximate solution parameters. */<a name="line.139"></a>
+<FONT color="green">140</FONT>        private double parRelativeTolerance;<a name="line.140"></a>
+<FONT color="green">141</FONT>    <a name="line.141"></a>
+<FONT color="green">142</FONT>        /** Desired max cosine on the orthogonality between the function vector<a name="line.142"></a>
+<FONT color="green">143</FONT>         * and the columns of the jacobian. */<a name="line.143"></a>
+<FONT color="green">144</FONT>        private double orthoTolerance;<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>      /**<a name="line.146"></a>
+<FONT color="green">147</FONT>       * Build an estimator for least squares problems.<a name="line.147"></a>
+<FONT color="green">148</FONT>       * &lt;p&gt;The default values for the algorithm settings are:<a name="line.148"></a>
+<FONT color="green">149</FONT>       *   &lt;ul&gt;<a name="line.149"></a>
+<FONT color="green">150</FONT>       *    &lt;li&gt;{@link #setInitialStepBoundFactor initial step bound factor}: 100.0&lt;/li&gt;<a name="line.150"></a>
+<FONT color="green">151</FONT>       *    &lt;li&gt;{@link #setMaxCostEval maximal cost evaluations}: 1000&lt;/li&gt;<a name="line.151"></a>
+<FONT color="green">152</FONT>       *    &lt;li&gt;{@link #setCostRelativeTolerance cost relative tolerance}: 1.0e-10&lt;/li&gt;<a name="line.152"></a>
+<FONT color="green">153</FONT>       *    &lt;li&gt;{@link #setParRelativeTolerance parameters relative tolerance}: 1.0e-10&lt;/li&gt;<a name="line.153"></a>
+<FONT color="green">154</FONT>       *    &lt;li&gt;{@link #setOrthoTolerance orthogonality tolerance}: 1.0e-10&lt;/li&gt;<a name="line.154"></a>
+<FONT color="green">155</FONT>       *   &lt;/ul&gt;<a name="line.155"></a>
+<FONT color="green">156</FONT>       * &lt;/p&gt;<a name="line.156"></a>
+<FONT color="green">157</FONT>       */<a name="line.157"></a>
+<FONT color="green">158</FONT>      public LevenbergMarquardtEstimator() {<a name="line.158"></a>
+<FONT color="green">159</FONT>    <a name="line.159"></a>
+<FONT color="green">160</FONT>        // set up the superclass with a default  max cost evaluations setting<a name="line.160"></a>
+<FONT color="green">161</FONT>        setMaxCostEval(1000);<a name="line.161"></a>
+<FONT color="green">162</FONT>    <a name="line.162"></a>
+<FONT color="green">163</FONT>        // default values for the tuning parameters<a name="line.163"></a>
+<FONT color="green">164</FONT>        setInitialStepBoundFactor(100.0);<a name="line.164"></a>
+<FONT color="green">165</FONT>        setCostRelativeTolerance(1.0e-10);<a name="line.165"></a>
+<FONT color="green">166</FONT>        setParRelativeTolerance(1.0e-10);<a name="line.166"></a>
+<FONT color="green">167</FONT>        setOrthoTolerance(1.0e-10);<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>      }<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>      /**<a name="line.171"></a>
+<FONT color="green">172</FONT>       * Set the positive input variable used in determining the initial step bound.<a name="line.172"></a>
+<FONT color="green">173</FONT>       * This bound is set to the product of initialStepBoundFactor and the euclidean norm of diag*x if nonzero,<a name="line.173"></a>
+<FONT color="green">174</FONT>       * or else to initialStepBoundFactor itself. In most cases factor should lie<a name="line.174"></a>
+<FONT color="green">175</FONT>       * in the interval (0.1, 100.0). 100.0 is a generally recommended value<a name="line.175"></a>
+<FONT color="green">176</FONT>       *<a name="line.176"></a>
+<FONT color="green">177</FONT>       * @param initialStepBoundFactor initial step bound factor<a name="line.177"></a>
+<FONT color="green">178</FONT>       * @see #estimate<a name="line.178"></a>
+<FONT color="green">179</FONT>       */<a name="line.179"></a>
+<FONT color="green">180</FONT>      public void setInitialStepBoundFactor(double initialStepBoundFactor) {<a name="line.180"></a>
+<FONT color="green">181</FONT>        this.initialStepBoundFactor = initialStepBoundFactor;<a name="line.181"></a>
+<FONT color="green">182</FONT>      }<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>      /**<a name="line.184"></a>
+<FONT color="green">185</FONT>       * Set the desired relative error in the sum of squares.<a name="line.185"></a>
+<FONT color="green">186</FONT>       *<a name="line.186"></a>
+<FONT color="green">187</FONT>       * @param costRelativeTolerance desired relative error in the sum of squares<a name="line.187"></a>
+<FONT color="green">188</FONT>       * @see #estimate<a name="line.188"></a>
+<FONT color="green">189</FONT>       */<a name="line.189"></a>
+<FONT color="green">190</FONT>      public void setCostRelativeTolerance(double costRelativeTolerance) {<a name="line.190"></a>
+<FONT color="green">191</FONT>        this.costRelativeTolerance = costRelativeTolerance;<a name="line.191"></a>
+<FONT color="green">192</FONT>      }<a name="line.192"></a>
+<FONT color="green">193</FONT>    <a name="line.193"></a>
+<FONT color="green">194</FONT>      /**<a name="line.194"></a>
+<FONT color="green">195</FONT>       * Set the desired relative error in the approximate solution parameters.<a name="line.195"></a>
+<FONT color="green">196</FONT>       *<a name="line.196"></a>
+<FONT color="green">197</FONT>       * @param parRelativeTolerance desired relative error<a name="line.197"></a>
+<FONT color="green">198</FONT>       * in the approximate solution parameters<a name="line.198"></a>
+<FONT color="green">199</FONT>       * @see #estimate<a name="line.199"></a>
+<FONT color="green">200</FONT>       */<a name="line.200"></a>
+<FONT color="green">201</FONT>      public void setParRelativeTolerance(double parRelativeTolerance) {<a name="line.201"></a>
+<FONT color="green">202</FONT>        this.parRelativeTolerance = parRelativeTolerance;<a name="line.202"></a>
+<FONT color="green">203</FONT>      }<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>      /**<a name="line.205"></a>
+<FONT color="green">206</FONT>       * Set the desired max cosine on the orthogonality.<a name="line.206"></a>
+<FONT color="green">207</FONT>       *<a name="line.207"></a>
+<FONT color="green">208</FONT>       * @param orthoTolerance desired max cosine on the orthogonality<a name="line.208"></a>
+<FONT color="green">209</FONT>       * between the function vector and the columns of the jacobian<a name="line.209"></a>
+<FONT color="green">210</FONT>       * @see #estimate<a name="line.210"></a>
+<FONT color="green">211</FONT>       */<a name="line.211"></a>
+<FONT color="green">212</FONT>      public void setOrthoTolerance(double orthoTolerance) {<a name="line.212"></a>
+<FONT color="green">213</FONT>        this.orthoTolerance = orthoTolerance;<a name="line.213"></a>
+<FONT color="green">214</FONT>      }<a name="line.214"></a>
+<FONT color="green">215</FONT>    <a name="line.215"></a>
+<FONT color="green">216</FONT>      /**<a name="line.216"></a>
+<FONT color="green">217</FONT>       * Solve an estimation problem using the Levenberg-Marquardt algorithm.<a name="line.217"></a>
+<FONT color="green">218</FONT>       * &lt;p&gt;The algorithm used is a modified Levenberg-Marquardt one, based<a name="line.218"></a>
+<FONT color="green">219</FONT>       * on the MINPACK &lt;a href="http://www.netlib.org/minpack/lmder.f"&gt;lmder&lt;/a&gt;<a name="line.219"></a>
+<FONT color="green">220</FONT>       * routine. The algorithm settings must have been set up before this method<a name="line.220"></a>
+<FONT color="green">221</FONT>       * is called with the {@link #setInitialStepBoundFactor},<a name="line.221"></a>
+<FONT color="green">222</FONT>       * {@link #setMaxCostEval}, {@link #setCostRelativeTolerance},<a name="line.222"></a>
+<FONT color="green">223</FONT>       * {@link #setParRelativeTolerance} and {@link #setOrthoTolerance} methods.<a name="line.223"></a>
+<FONT color="green">224</FONT>       * If these methods have not been called, the default values set up by the<a name="line.224"></a>
+<FONT color="green">225</FONT>       * {@link #LevenbergMarquardtEstimator() constructor} will be used.&lt;/p&gt;<a name="line.225"></a>
+<FONT color="green">226</FONT>       * &lt;p&gt;The authors of the original fortran function are:&lt;/p&gt;<a name="line.226"></a>
+<FONT color="green">227</FONT>       * &lt;ul&gt;<a name="line.227"></a>
+<FONT color="green">228</FONT>       *   &lt;li&gt;Argonne National Laboratory. MINPACK project. March 1980&lt;/li&gt;<a name="line.228"></a>
+<FONT color="green">229</FONT>       *   &lt;li&gt;Burton  S. Garbow&lt;/li&gt;<a name="line.229"></a>
+<FONT color="green">230</FONT>       *   &lt;li&gt;Kenneth E. Hillstrom&lt;/li&gt;<a name="line.230"></a>
+<FONT color="green">231</FONT>       *   &lt;li&gt;Jorge   J. More&lt;/li&gt;<a name="line.231"></a>
+<FONT color="green">232</FONT>       *   &lt;/ul&gt;<a name="line.232"></a>
+<FONT color="green">233</FONT>       * &lt;p&gt;Luc Maisonobe did the Java translation.&lt;/p&gt;<a name="line.233"></a>
+<FONT color="green">234</FONT>       *<a name="line.234"></a>
+<FONT color="green">235</FONT>       * @param problem estimation problem to solve<a name="line.235"></a>
+<FONT color="green">236</FONT>       * @exception EstimationException if convergence cannot be<a name="line.236"></a>
+<FONT color="green">237</FONT>       * reached with the specified algorithm settings or if there are more variables<a name="line.237"></a>
+<FONT color="green">238</FONT>       * than equations<a name="line.238"></a>
+<FONT color="green">239</FONT>       * @see #setInitialStepBoundFactor<a name="line.239"></a>
+<FONT color="green">240</FONT>       * @see #setCostRelativeTolerance<a name="line.240"></a>
+<FONT color="green">241</FONT>       * @see #setParRelativeTolerance<a name="line.241"></a>
+<FONT color="green">242</FONT>       * @see #setOrthoTolerance<a name="line.242"></a>
+<FONT color="green">243</FONT>       */<a name="line.243"></a>
+<FONT color="green">244</FONT>      @Override<a name="line.244"></a>
+<FONT color="green">245</FONT>      public void estimate(EstimationProblem problem)<a name="line.245"></a>
+<FONT color="green">246</FONT>        throws EstimationException {<a name="line.246"></a>
+<FONT color="green">247</FONT>    <a name="line.247"></a>
+<FONT color="green">248</FONT>        initializeEstimate(problem);<a name="line.248"></a>
+<FONT color="green">249</FONT>    <a name="line.249"></a>
+<FONT color="green">250</FONT>        // arrays shared with the other private methods<a name="line.250"></a>
+<FONT color="green">251</FONT>        solvedCols  = Math.min(rows, cols);<a name="line.251"></a>
+<FONT color="green">252</FONT>        diagR       = new double[cols];<a name="line.252"></a>
+<FONT color="green">253</FONT>        jacNorm     = new double[cols];<a name="line.253"></a>
+<FONT color="green">254</FONT>        beta        = new double[cols];<a name="line.254"></a>
+<FONT color="green">255</FONT>        permutation = new int[cols];<a name="line.255"></a>
+<FONT color="green">256</FONT>        lmDir       = new double[cols];<a name="line.256"></a>
+<FONT color="green">257</FONT>    <a name="line.257"></a>
+<FONT color="green">258</FONT>        // local variables<a name="line.258"></a>
+<FONT color="green">259</FONT>        double   delta   = 0;<a name="line.259"></a>
+<FONT color="green">260</FONT>        double   xNorm = 0;<a name="line.260"></a>
+<FONT color="green">261</FONT>        double[] diag    = new double[cols];<a name="line.261"></a>
+<FONT color="green">262</FONT>        double[] oldX    = new double[cols];<a name="line.262"></a>
+<FONT color="green">263</FONT>        double[] oldRes  = new double[rows];<a name="line.263"></a>
+<FONT color="green">264</FONT>        double[] work1   = new double[cols];<a name="line.264"></a>
+<FONT color="green">265</FONT>        double[] work2   = new double[cols];<a name="line.265"></a>
+<FONT color="green">266</FONT>        double[] work3   = new double[cols];<a name="line.266"></a>
+<FONT color="green">267</FONT>    <a name="line.267"></a>
+<FONT color="green">268</FONT>        // evaluate the function at the starting point and calculate its norm<a name="line.268"></a>
+<FONT color="green">269</FONT>        updateResidualsAndCost();<a name="line.269"></a>
+<FONT color="green">270</FONT>    <a name="line.270"></a>
+<FONT color="green">271</FONT>        // outer loop<a name="line.271"></a>
+<FONT color="green">272</FONT>        lmPar = 0;<a name="line.272"></a>
+<FONT color="green">273</FONT>        boolean firstIteration = true;<a name="line.273"></a>
+<FONT color="green">274</FONT>        while (true) {<a name="line.274"></a>
+<FONT color="green">275</FONT>    <a name="line.275"></a>
+<FONT color="green">276</FONT>          // compute the Q.R. decomposition of the jacobian matrix<a name="line.276"></a>
+<FONT color="green">277</FONT>          updateJacobian();<a name="line.277"></a>
+<FONT color="green">278</FONT>          qrDecomposition();<a name="line.278"></a>
+<FONT color="green">279</FONT>    <a name="line.279"></a>
+<FONT color="green">280</FONT>          // compute Qt.res<a name="line.280"></a>
+<FONT color="green">281</FONT>          qTy(residuals);<a name="line.281"></a>
+<FONT color="green">282</FONT>    <a name="line.282"></a>
+<FONT color="green">283</FONT>          // now we don't need Q anymore,<a name="line.283"></a>
+<FONT color="green">284</FONT>          // so let jacobian contain the R matrix with its diagonal elements<a name="line.284"></a>
+<FONT color="green">285</FONT>          for (int k = 0; k &lt; solvedCols; ++k) {<a name="line.285"></a>
+<FONT color="green">286</FONT>            int pk = permutation[k];<a name="line.286"></a>
+<FONT color="green">287</FONT>            jacobian[k * cols + pk] = diagR[pk];<a name="line.287"></a>
+<FONT color="green">288</FONT>          }<a name="line.288"></a>
+<FONT color="green">289</FONT>    <a name="line.289"></a>
+<FONT color="green">290</FONT>          if (firstIteration) {<a name="line.290"></a>
+<FONT color="green">291</FONT>    <a name="line.291"></a>
+<FONT color="green">292</FONT>            // scale the variables according to the norms of the columns<a name="line.292"></a>
+<FONT color="green">293</FONT>            // of the initial jacobian<a name="line.293"></a>
+<FONT color="green">294</FONT>            xNorm = 0;<a name="line.294"></a>
+<FONT color="green">295</FONT>            for (int k = 0; k &lt; cols; ++k) {<a name="line.295"></a>
+<FONT color="green">296</FONT>              double dk = jacNorm[k];<a name="line.296"></a>
+<FONT color="green">297</FONT>              if (dk == 0) {<a name="line.297"></a>
+<FONT color="green">298</FONT>                dk = 1.0;<a name="line.298"></a>
+<FONT color="green">299</FONT>              }<a name="line.299"></a>
+<FONT color="green">300</FONT>              double xk = dk * parameters[k].getEstimate();<a name="line.300"></a>
+<FONT color="green">301</FONT>              xNorm  += xk * xk;<a name="line.301"></a>
+<FONT color="green">302</FONT>              diag[k] = dk;<a name="line.302"></a>
+<FONT color="green">303</FONT>            }<a name="line.303"></a>
+<FONT color="green">304</FONT>            xNorm = Math.sqrt(xNorm);<a name="line.304"></a>
+<FONT color="green">305</FONT>    <a name="line.305"></a>
+<FONT color="green">306</FONT>            // initialize the step bound delta<a name="line.306"></a>
+<FONT color="green">307</FONT>            delta = (xNorm == 0) ? initialStepBoundFactor : (initialStepBoundFactor * xNorm);<a name="line.307"></a>
+<FONT color="green">308</FONT>    <a name="line.308"></a>
+<FONT color="green">309</FONT>          }<a name="line.309"></a>
+<FONT color="green">310</FONT>    <a name="line.310"></a>
+<FONT color="green">311</FONT>          // check orthogonality between function vector and jacobian columns<a name="line.311"></a>
+<FONT color="green">312</FONT>          double maxCosine = 0;<a name="line.312"></a>
+<FONT color="green">313</FONT>          if (cost != 0) {<a name="line.313"></a>
+<FONT color="green">314</FONT>            for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.314"></a>
+<FONT color="green">315</FONT>              int    pj = permutation[j];<a name="line.315"></a>
+<FONT color="green">316</FONT>              double s  = jacNorm[pj];<a name="line.316"></a>
+<FONT color="green">317</FONT>              if (s != 0) {<a name="line.317"></a>
+<FONT color="green">318</FONT>                double sum = 0;<a name="line.318"></a>
+<FONT color="green">319</FONT>                int index = pj;<a name="line.319"></a>
+<FONT color="green">320</FONT>                for (int i = 0; i &lt;= j; ++i) {<a name="line.320"></a>
+<FONT color="green">321</FONT>                  sum += jacobian[index] * residuals[i];<a name="line.321"></a>
+<FONT color="green">322</FONT>                  index += cols;<a name="line.322"></a>
+<FONT color="green">323</FONT>                }<a name="line.323"></a>
+<FONT color="green">324</FONT>                maxCosine = Math.max(maxCosine, Math.abs(sum) / (s * cost));<a name="line.324"></a>
+<FONT color="green">325</FONT>              }<a name="line.325"></a>
+<FONT color="green">326</FONT>            }<a name="line.326"></a>
+<FONT color="green">327</FONT>          }<a name="line.327"></a>
+<FONT color="green">328</FONT>          if (maxCosine &lt;= orthoTolerance) {<a name="line.328"></a>
+<FONT color="green">329</FONT>            return;<a name="line.329"></a>
+<FONT color="green">330</FONT>          }<a name="line.330"></a>
+<FONT color="green">331</FONT>    <a name="line.331"></a>
+<FONT color="green">332</FONT>          // rescale if necessary<a name="line.332"></a>
+<FONT color="green">333</FONT>          for (int j = 0; j &lt; cols; ++j) {<a name="line.333"></a>
+<FONT color="green">334</FONT>            diag[j] = Math.max(diag[j], jacNorm[j]);<a name="line.334"></a>
+<FONT color="green">335</FONT>          }<a name="line.335"></a>
+<FONT color="green">336</FONT>    <a name="line.336"></a>
+<FONT color="green">337</FONT>          // inner loop<a name="line.337"></a>
+<FONT color="green">338</FONT>          for (double ratio = 0; ratio &lt; 1.0e-4;) {<a name="line.338"></a>
+<FONT color="green">339</FONT>    <a name="line.339"></a>
+<FONT color="green">340</FONT>            // save the state<a name="line.340"></a>
+<FONT color="green">341</FONT>            for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.341"></a>
+<FONT color="green">342</FONT>              int pj = permutation[j];<a name="line.342"></a>
+<FONT color="green">343</FONT>              oldX[pj] = parameters[pj].getEstimate();<a name="line.343"></a>
+<FONT color="green">344</FONT>            }<a name="line.344"></a>
+<FONT color="green">345</FONT>            double previousCost = cost;<a name="line.345"></a>
+<FONT color="green">346</FONT>            double[] tmpVec = residuals;<a name="line.346"></a>
+<FONT color="green">347</FONT>            residuals = oldRes;<a name="line.347"></a>
+<FONT color="green">348</FONT>            oldRes    = tmpVec;<a name="line.348"></a>
+<FONT color="green">349</FONT>    <a name="line.349"></a>
+<FONT color="green">350</FONT>            // determine the Levenberg-Marquardt parameter<a name="line.350"></a>
+<FONT color="green">351</FONT>            determineLMParameter(oldRes, delta, diag, work1, work2, work3);<a name="line.351"></a>
+<FONT color="green">352</FONT>    <a name="line.352"></a>
+<FONT color="green">353</FONT>            // compute the new point and the norm of the evolution direction<a name="line.353"></a>
+<FONT color="green">354</FONT>            double lmNorm = 0;<a name="line.354"></a>
+<FONT color="green">355</FONT>            for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.355"></a>
+<FONT color="green">356</FONT>              int pj = permutation[j];<a name="line.356"></a>
+<FONT color="green">357</FONT>              lmDir[pj] = -lmDir[pj];<a name="line.357"></a>
+<FONT color="green">358</FONT>              parameters[pj].setEstimate(oldX[pj] + lmDir[pj]);<a name="line.358"></a>
+<FONT color="green">359</FONT>              double s = diag[pj] * lmDir[pj];<a name="line.359"></a>
+<FONT color="green">360</FONT>              lmNorm  += s * s;<a name="line.360"></a>
+<FONT color="green">361</FONT>            }<a name="line.361"></a>
+<FONT color="green">362</FONT>            lmNorm = Math.sqrt(lmNorm);<a name="line.362"></a>
+<FONT color="green">363</FONT>    <a name="line.363"></a>
+<FONT color="green">364</FONT>            // on the first iteration, adjust the initial step bound.<a name="line.364"></a>
+<FONT color="green">365</FONT>            if (firstIteration) {<a name="line.365"></a>
+<FONT color="green">366</FONT>              delta = Math.min(delta, lmNorm);<a name="line.366"></a>
+<FONT color="green">367</FONT>            }<a name="line.367"></a>
+<FONT color="green">368</FONT>    <a name="line.368"></a>
+<FONT color="green">369</FONT>            // evaluate the function at x + p and calculate its norm<a name="line.369"></a>
+<FONT color="green">370</FONT>            updateResidualsAndCost();<a name="line.370"></a>
+<FONT color="green">371</FONT>    <a name="line.371"></a>
+<FONT color="green">372</FONT>            // compute the scaled actual reduction<a name="line.372"></a>
+<FONT color="green">373</FONT>            double actRed = -1.0;<a name="line.373"></a>
+<FONT color="green">374</FONT>            if (0.1 * cost &lt; previousCost) {<a name="line.374"></a>
+<FONT color="green">375</FONT>              double r = cost / previousCost;<a name="line.375"></a>
+<FONT color="green">376</FONT>              actRed = 1.0 - r * r;<a name="line.376"></a>
+<FONT color="green">377</FONT>            }<a name="line.377"></a>
+<FONT color="green">378</FONT>    <a name="line.378"></a>
+<FONT color="green">379</FONT>            // compute the scaled predicted reduction<a name="line.379"></a>
+<FONT color="green">380</FONT>            // and the scaled directional derivative<a name="line.380"></a>
+<FONT color="green">381</FONT>            for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.381"></a>
+<FONT color="green">382</FONT>              int pj = permutation[j];<a name="line.382"></a>
+<FONT color="green">383</FONT>              double dirJ = lmDir[pj];<a name="line.383"></a>
+<FONT color="green">384</FONT>              work1[j] = 0;<a name="line.384"></a>
+<FONT color="green">385</FONT>              int index = pj;<a name="line.385"></a>
+<FONT color="green">386</FONT>              for (int i = 0; i &lt;= j; ++i) {<a name="line.386"></a>
+<FONT color="green">387</FONT>                work1[i] += jacobian[index] * dirJ;<a name="line.387"></a>
+<FONT color="green">388</FONT>                index += cols;<a name="line.388"></a>
+<FONT color="green">389</FONT>              }<a name="line.389"></a>
+<FONT color="green">390</FONT>            }<a name="line.390"></a>
+<FONT color="green">391</FONT>            double coeff1 = 0;<a name="line.391"></a>
+<FONT color="green">392</FONT>            for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.392"></a>
+<FONT color="green">393</FONT>             coeff1 += work1[j] * work1[j];<a name="line.393"></a>
+<FONT color="green">394</FONT>            }<a name="line.394"></a>
+<FONT color="green">395</FONT>            double pc2 = previousCost * previousCost;<a name="line.395"></a>
+<FONT color="green">396</FONT>            coeff1 = coeff1 / pc2;<a name="line.396"></a>
+<FONT color="green">397</FONT>            double coeff2 = lmPar * lmNorm * lmNorm / pc2;<a name="line.397"></a>
+<FONT color="green">398</FONT>            double preRed = coeff1 + 2 * coeff2;<a name="line.398"></a>
+<FONT color="green">399</FONT>            double dirDer = -(coeff1 + coeff2);<a name="line.399"></a>
+<FONT color="green">400</FONT>    <a name="line.400"></a>
+<FONT color="green">401</FONT>            // ratio of the actual to the predicted reduction<a name="line.401"></a>
+<FONT color="green">402</FONT>            ratio = (preRed == 0) ? 0 : (actRed / preRed);<a name="line.402"></a>
+<FONT color="green">403</FONT>    <a name="line.403"></a>
+<FONT color="green">404</FONT>            // update the step bound<a name="line.404"></a>
+<FONT color="green">405</FONT>            if (ratio &lt;= 0.25) {<a name="line.405"></a>
+<FONT color="green">406</FONT>              double tmp =<a name="line.406"></a>
+<FONT color="green">407</FONT>                (actRed &lt; 0) ? (0.5 * dirDer / (dirDer + 0.5 * actRed)) : 0.5;<a name="line.407"></a>
+<FONT color="green">408</FONT>              if ((0.1 * cost &gt;= previousCost) || (tmp &lt; 0.1)) {<a name="line.408"></a>
+<FONT color="green">409</FONT>                tmp = 0.1;<a name="line.409"></a>
+<FONT color="green">410</FONT>              }<a name="line.410"></a>
+<FONT color="green">411</FONT>              delta = tmp * Math.min(delta, 10.0 * lmNorm);<a name="line.411"></a>
+<FONT color="green">412</FONT>              lmPar /= tmp;<a name="line.412"></a>
+<FONT color="green">413</FONT>            } else if ((lmPar == 0) || (ratio &gt;= 0.75)) {<a name="line.413"></a>
+<FONT color="green">414</FONT>              delta = 2 * lmNorm;<a name="line.414"></a>
+<FONT color="green">415</FONT>              lmPar *= 0.5;<a name="line.415"></a>
+<FONT color="green">416</FONT>            }<a name="line.416"></a>
+<FONT color="green">417</FONT>    <a name="line.417"></a>
+<FONT color="green">418</FONT>            // test for successful iteration.<a name="line.418"></a>
+<FONT color="green">419</FONT>            if (ratio &gt;= 1.0e-4) {<a name="line.419"></a>
+<FONT color="green">420</FONT>              // successful iteration, update the norm<a name="line.420"></a>
+<FONT color="green">421</FONT>              firstIteration = false;<a name="line.421"></a>
+<FONT color="green">422</FONT>              xNorm = 0;<a name="line.422"></a>
+<FONT color="green">423</FONT>              for (int k = 0; k &lt; cols; ++k) {<a name="line.423"></a>
+<FONT color="green">424</FONT>                double xK = diag[k] * parameters[k].getEstimate();<a name="line.424"></a>
+<FONT color="green">425</FONT>                xNorm    += xK * xK;<a name="line.425"></a>
+<FONT color="green">426</FONT>              }<a name="line.426"></a>
+<FONT color="green">427</FONT>              xNorm = Math.sqrt(xNorm);<a name="line.427"></a>
+<FONT color="green">428</FONT>            } else {<a name="line.428"></a>
+<FONT color="green">429</FONT>              // failed iteration, reset the previous values<a name="line.429"></a>
+<FONT color="green">430</FONT>              cost = previousCost;<a name="line.430"></a>
+<FONT color="green">431</FONT>              for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.431"></a>
+<FONT color="green">432</FONT>                int pj = permutation[j];<a name="line.432"></a>
+<FONT color="green">433</FONT>                parameters[pj].setEstimate(oldX[pj]);<a name="line.433"></a>
+<FONT color="green">434</FONT>              }<a name="line.434"></a>
+<FONT color="green">435</FONT>              tmpVec    = residuals;<a name="line.435"></a>
+<FONT color="green">436</FONT>              residuals = oldRes;<a name="line.436"></a>
+<FONT color="green">437</FONT>              oldRes    = tmpVec;<a name="line.437"></a>
+<FONT color="green">438</FONT>            }<a name="line.438"></a>
+<FONT color="green">439</FONT>    <a name="line.439"></a>
+<FONT color="green">440</FONT>            // tests for convergence.<a name="line.440"></a>
+<FONT color="green">441</FONT>            if (((Math.abs(actRed) &lt;= costRelativeTolerance) &amp;&amp;<a name="line.441"></a>
+<FONT color="green">442</FONT>                 (preRed &lt;= costRelativeTolerance) &amp;&amp;<a name="line.442"></a>
+<FONT color="green">443</FONT>                 (ratio &lt;= 2.0)) ||<a name="line.443"></a>
+<FONT color="green">444</FONT>                 (delta &lt;= parRelativeTolerance * xNorm)) {<a name="line.444"></a>
+<FONT color="green">445</FONT>              return;<a name="line.445"></a>
+<FONT color="green">446</FONT>            }<a name="line.446"></a>
+<FONT color="green">447</FONT>    <a name="line.447"></a>
+<FONT color="green">448</FONT>            // tests for termination and stringent tolerances<a name="line.448"></a>
+<FONT color="green">449</FONT>            // (2.2204e-16 is the machine epsilon for IEEE754)<a name="line.449"></a>
+<FONT color="green">450</FONT>            if ((Math.abs(actRed) &lt;= 2.2204e-16) &amp;&amp; (preRed &lt;= 2.2204e-16) &amp;&amp; (ratio &lt;= 2.0)) {<a name="line.450"></a>
+<FONT color="green">451</FONT>              throw new EstimationException("cost relative tolerance is too small ({0})," +<a name="line.451"></a>
+<FONT color="green">452</FONT>                                            " no further reduction in the" +<a name="line.452"></a>
+<FONT color="green">453</FONT>                                            " sum of squares is possible",<a name="line.453"></a>
+<FONT color="green">454</FONT>                                            costRelativeTolerance);<a name="line.454"></a>
+<FONT color="green">455</FONT>            } else if (delta &lt;= 2.2204e-16 * xNorm) {<a name="line.455"></a>
+<FONT color="green">456</FONT>              throw new EstimationException("parameters relative tolerance is too small" +<a name="line.456"></a>
+<FONT color="green">457</FONT>                                            " ({0}), no further improvement in" +<a name="line.457"></a>
+<FONT color="green">458</FONT>                                            " the approximate solution is possible",<a name="line.458"></a>
+<FONT color="green">459</FONT>                                            parRelativeTolerance);<a name="line.459"></a>
+<FONT color="green">460</FONT>            } else if (maxCosine &lt;= 2.2204e-16)  {<a name="line.460"></a>
+<FONT color="green">461</FONT>              throw new EstimationException("orthogonality tolerance is too small ({0})," +<a name="line.461"></a>
+<FONT color="green">462</FONT>                                            " solution is orthogonal to the jacobian",<a name="line.462"></a>
+<FONT color="green">463</FONT>                                            orthoTolerance);<a name="line.463"></a>
+<FONT color="green">464</FONT>            }<a name="line.464"></a>
+<FONT color="green">465</FONT>    <a name="line.465"></a>
+<FONT color="green">466</FONT>          }<a name="line.466"></a>
+<FONT color="green">467</FONT>    <a name="line.467"></a>
+<FONT color="green">468</FONT>        }<a name="line.468"></a>
+<FONT color="green">469</FONT>    <a name="line.469"></a>
+<FONT color="green">470</FONT>      }<a name="line.470"></a>
+<FONT color="green">471</FONT>    <a name="line.471"></a>
+<FONT color="green">472</FONT>      /**<a name="line.472"></a>
+<FONT color="green">473</FONT>       * Determine the Levenberg-Marquardt parameter.<a name="line.473"></a>
+<FONT color="green">474</FONT>       * &lt;p&gt;This implementation is a translation in Java of the MINPACK<a name="line.474"></a>
+<FONT color="green">475</FONT>       * &lt;a href="http://www.netlib.org/minpack/lmpar.f"&gt;lmpar&lt;/a&gt;<a name="line.475"></a>
+<FONT color="green">476</FONT>       * routine.&lt;/p&gt;<a name="line.476"></a>
+<FONT color="green">477</FONT>       * &lt;p&gt;This method sets the lmPar and lmDir attributes.&lt;/p&gt;<a name="line.477"></a>
+<FONT color="green">478</FONT>       * &lt;p&gt;The authors of the original fortran function are:&lt;/p&gt;<a name="line.478"></a>
+<FONT color="green">479</FONT>       * &lt;ul&gt;<a name="line.479"></a>
+<FONT color="green">480</FONT>       *   &lt;li&gt;Argonne National Laboratory. MINPACK project. March 1980&lt;/li&gt;<a name="line.480"></a>
+<FONT color="green">481</FONT>       *   &lt;li&gt;Burton  S. Garbow&lt;/li&gt;<a name="line.481"></a>
+<FONT color="green">482</FONT>       *   &lt;li&gt;Kenneth E. Hillstrom&lt;/li&gt;<a name="line.482"></a>
+<FONT color="green">483</FONT>       *   &lt;li&gt;Jorge   J. More&lt;/li&gt;<a name="line.483"></a>
+<FONT color="green">484</FONT>       * &lt;/ul&gt;<a name="line.484"></a>
+<FONT color="green">485</FONT>       * &lt;p&gt;Luc Maisonobe did the Java translation.&lt;/p&gt;<a name="line.485"></a>
+<FONT color="green">486</FONT>       *<a name="line.486"></a>
+<FONT color="green">487</FONT>       * @param qy array containing qTy<a name="line.487"></a>
+<FONT color="green">488</FONT>       * @param delta upper bound on the euclidean norm of diagR * lmDir<a name="line.488"></a>
+<FONT color="green">489</FONT>       * @param diag diagonal matrix<a name="line.489"></a>
+<FONT color="green">490</FONT>       * @param work1 work array<a name="line.490"></a>
+<FONT color="green">491</FONT>       * @param work2 work array<a name="line.491"></a>
+<FONT color="green">492</FONT>       * @param work3 work array<a name="line.492"></a>
+<FONT color="green">493</FONT>       */<a name="line.493"></a>
+<FONT color="green">494</FONT>      private void determineLMParameter(double[] qy, double delta, double[] diag,<a name="line.494"></a>
+<FONT color="green">495</FONT>                                        double[] work1, double[] work2, double[] work3) {<a name="line.495"></a>
+<FONT color="green">496</FONT>    <a name="line.496"></a>
+<FONT color="green">497</FONT>        // compute and store in x the gauss-newton direction, if the<a name="line.497"></a>
+<FONT color="green">498</FONT>        // jacobian is rank-deficient, obtain a least squares solution<a name="line.498"></a>
+<FONT color="green">499</FONT>        for (int j = 0; j &lt; rank; ++j) {<a name="line.499"></a>
+<FONT color="green">500</FONT>          lmDir[permutation[j]] = qy[j];<a name="line.500"></a>
+<FONT color="green">501</FONT>        }<a name="line.501"></a>
+<FONT color="green">502</FONT>        for (int j = rank; j &lt; cols; ++j) {<a name="line.502"></a>
+<FONT color="green">503</FONT>          lmDir[permutation[j]] = 0;<a name="line.503"></a>
+<FONT color="green">504</FONT>        }<a name="line.504"></a>
+<FONT color="green">505</FONT>        for (int k = rank - 1; k &gt;= 0; --k) {<a name="line.505"></a>
+<FONT color="green">506</FONT>          int pk = permutation[k];<a name="line.506"></a>
+<FONT color="green">507</FONT>          double ypk = lmDir[pk] / diagR[pk];<a name="line.507"></a>
+<FONT color="green">508</FONT>          int index = pk;<a name="line.508"></a>
+<FONT color="green">509</FONT>          for (int i = 0; i &lt; k; ++i) {<a name="line.509"></a>
+<FONT color="green">510</FONT>            lmDir[permutation[i]] -= ypk * jacobian[index];<a name="line.510"></a>
+<FONT color="green">511</FONT>            index += cols;<a name="line.511"></a>
+<FONT color="green">512</FONT>          }<a name="line.512"></a>
+<FONT color="green">513</FONT>          lmDir[pk] = ypk;<a name="line.513"></a>
+<FONT color="green">514</FONT>        }<a name="line.514"></a>
+<FONT color="green">515</FONT>    <a name="line.515"></a>
+<FONT color="green">516</FONT>        // evaluate the function at the origin, and test<a name="line.516"></a>
+<FONT color="green">517</FONT>        // for acceptance of the Gauss-Newton direction<a name="line.517"></a>
+<FONT color="green">518</FONT>        double dxNorm = 0;<a name="line.518"></a>
+<FONT color="green">519</FONT>        for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.519"></a>
+<FONT color="green">520</FONT>          int pj = permutation[j];<a name="line.520"></a>
+<FONT color="green">521</FONT>          double s = diag[pj] * lmDir[pj];<a name="line.521"></a>
+<FONT color="green">522</FONT>          work1[pj] = s;<a name="line.522"></a>
+<FONT color="green">523</FONT>          dxNorm += s * s;<a name="line.523"></a>
+<FONT color="green">524</FONT>        }<a name="line.524"></a>
+<FONT color="green">525</FONT>        dxNorm = Math.sqrt(dxNorm);<a name="line.525"></a>
+<FONT color="green">526</FONT>        double fp = dxNorm - delta;<a name="line.526"></a>
+<FONT color="green">527</FONT>        if (fp &lt;= 0.1 * delta) {<a name="line.527"></a>
+<FONT color="green">528</FONT>          lmPar = 0;<a name="line.528"></a>
+<FONT color="green">529</FONT>          return;<a name="line.529"></a>
+<FONT color="green">530</FONT>        }<a name="line.530"></a>
+<FONT color="green">531</FONT>    <a name="line.531"></a>
+<FONT color="green">532</FONT>        // if the jacobian is not rank deficient, the Newton step provides<a name="line.532"></a>
+<FONT color="green">533</FONT>        // a lower bound, parl, for the zero of the function,<a name="line.533"></a>
+<FONT color="green">534</FONT>        // otherwise set this bound to zero<a name="line.534"></a>
+<FONT color="green">535</FONT>        double sum2;<a name="line.535"></a>
+<FONT color="green">536</FONT>        double parl = 0;<a name="line.536"></a>
+<FONT color="green">537</FONT>        if (rank == solvedCols) {<a name="line.537"></a>
+<FONT color="green">538</FONT>          for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.538"></a>
+<FONT color="green">539</FONT>            int pj = permutation[j];<a name="line.539"></a>
+<FONT color="green">540</FONT>            work1[pj] *= diag[pj] / dxNorm;<a name="line.540"></a>
+<FONT color="green">541</FONT>          }<a name="line.541"></a>
+<FONT color="green">542</FONT>          sum2 = 0;<a name="line.542"></a>
+<FONT color="green">543</FONT>          for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.543"></a>
+<FONT color="green">544</FONT>            int pj = permutation[j];<a name="line.544"></a>
+<FONT color="green">545</FONT>            double sum = 0;<a name="line.545"></a>
+<FONT color="green">546</FONT>            int index = pj;<a name="line.546"></a>
+<FONT color="green">547</FONT>            for (int i = 0; i &lt; j; ++i) {<a name="line.547"></a>
+<FONT color="green">548</FONT>              sum += jacobian[index] * work1[permutation[i]];<a name="line.548"></a>
+<FONT color="green">549</FONT>              index += cols;<a name="line.549"></a>
+<FONT color="green">550</FONT>            }<a name="line.550"></a>
+<FONT color="green">551</FONT>            double s = (work1[pj] - sum) / diagR[pj];<a name="line.551"></a>
+<FONT color="green">552</FONT>            work1[pj] = s;<a name="line.552"></a>
+<FONT color="green">553</FONT>            sum2 += s * s;<a name="line.553"></a>
+<FONT color="green">554</FONT>          }<a name="line.554"></a>
+<FONT color="green">555</FONT>          parl = fp / (delta * sum2);<a name="line.555"></a>
+<FONT color="green">556</FONT>        }<a name="line.556"></a>
+<FONT color="green">557</FONT>    <a name="line.557"></a>
+<FONT color="green">558</FONT>        // calculate an upper bound, paru, for the zero of the function<a name="line.558"></a>
+<FONT color="green">559</FONT>        sum2 = 0;<a name="line.559"></a>
+<FONT color="green">560</FONT>        for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.560"></a>
+<FONT color="green">561</FONT>          int pj = permutation[j];<a name="line.561"></a>
+<FONT color="green">562</FONT>          double sum = 0;<a name="line.562"></a>
+<FONT color="green">563</FONT>          int index = pj;<a name="line.563"></a>
+<FONT color="green">564</FONT>          for (int i = 0; i &lt;= j; ++i) {<a name="line.564"></a>
+<FONT color="green">565</FONT>            sum += jacobian[index] * qy[i];<a name="line.565"></a>
+<FONT color="green">566</FONT>            index += cols;<a name="line.566"></a>
+<FONT color="green">567</FONT>          }<a name="line.567"></a>
+<FONT color="green">568</FONT>          sum /= diag[pj];<a name="line.568"></a>
+<FONT color="green">569</FONT>          sum2 += sum * sum;<a name="line.569"></a>
+<FONT color="green">570</FONT>        }<a name="line.570"></a>
+<FONT color="green">571</FONT>        double gNorm = Math.sqrt(sum2);<a name="line.571"></a>
+<FONT color="green">572</FONT>        double paru = gNorm / delta;<a name="line.572"></a>
+<FONT color="green">573</FONT>        if (paru == 0) {<a name="line.573"></a>
+<FONT color="green">574</FONT>          // 2.2251e-308 is the smallest positive real for IEE754<a name="line.574"></a>
+<FONT color="green">575</FONT>          paru = 2.2251e-308 / Math.min(delta, 0.1);<a name="line.575"></a>
+<FONT color="green">576</FONT>        }<a name="line.576"></a>
+<FONT color="green">577</FONT>    <a name="line.577"></a>
+<FONT color="green">578</FONT>        // if the input par lies outside of the interval (parl,paru),<a name="line.578"></a>
+<FONT color="green">579</FONT>        // set par to the closer endpoint<a name="line.579"></a>
+<FONT color="green">580</FONT>        lmPar = Math.min(paru, Math.max(lmPar, parl));<a name="line.580"></a>
+<FONT color="green">581</FONT>        if (lmPar == 0) {<a name="line.581"></a>
+<FONT color="green">582</FONT>          lmPar = gNorm / dxNorm;<a name="line.582"></a>
+<FONT color="green">583</FONT>        }<a name="line.583"></a>
+<FONT color="green">584</FONT>    <a name="line.584"></a>
+<FONT color="green">585</FONT>        for (int countdown = 10; countdown &gt;= 0; --countdown) {<a name="line.585"></a>
+<FONT color="green">586</FONT>    <a name="line.586"></a>
+<FONT color="green">587</FONT>          // evaluate the function at the current value of lmPar<a name="line.587"></a>
+<FONT color="green">588</FONT>          if (lmPar == 0) {<a name="line.588"></a>
+<FONT color="green">589</FONT>            lmPar = Math.max(2.2251e-308, 0.001 * paru);<a name="line.589"></a>
+<FONT color="green">590</FONT>          }<a name="line.590"></a>
+<FONT color="green">591</FONT>          double sPar = Math.sqrt(lmPar);<a name="line.591"></a>
+<FONT color="green">592</FONT>          for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.592"></a>
+<FONT color="green">593</FONT>            int pj = permutation[j];<a name="line.593"></a>
+<FONT color="green">594</FONT>            work1[pj] = sPar * diag[pj];<a name="line.594"></a>
+<FONT color="green">595</FONT>          }<a name="line.595"></a>
+<FONT color="green">596</FONT>          determineLMDirection(qy, work1, work2, work3);<a name="line.596"></a>
+<FONT color="green">597</FONT>    <a name="line.597"></a>
+<FONT color="green">598</FONT>          dxNorm = 0;<a name="line.598"></a>
+<FONT color="green">599</FONT>          for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.599"></a>
+<FONT color="green">600</FONT>            int pj = permutation[j];<a name="line.600"></a>
+<FONT color="green">601</FONT>            double s = diag[pj] * lmDir[pj];<a name="line.601"></a>
+<FONT color="green">602</FONT>            work3[pj] = s;<a name="line.602"></a>
+<FONT color="green">603</FONT>            dxNorm += s * s;<a name="line.603"></a>
+<FONT color="green">604</FONT>          }<a name="line.604"></a>
+<FONT color="green">605</FONT>          dxNorm = Math.sqrt(dxNorm);<a name="line.605"></a>
+<FONT color="green">606</FONT>          double previousFP = fp;<a name="line.606"></a>
+<FONT color="green">607</FONT>          fp = dxNorm - delta;<a name="line.607"></a>
+<FONT color="green">608</FONT>    <a name="line.608"></a>
+<FONT color="green">609</FONT>          // if the function is small enough, accept the current value<a name="line.609"></a>
+<FONT color="green">610</FONT>          // of lmPar, also test for the exceptional cases where parl is zero<a name="line.610"></a>
+<FONT color="green">611</FONT>          if ((Math.abs(fp) &lt;= 0.1 * delta) ||<a name="line.611"></a>
+<FONT color="green">612</FONT>              ((parl == 0) &amp;&amp; (fp &lt;= previousFP) &amp;&amp; (previousFP &lt; 0))) {<a name="line.612"></a>
+<FONT color="green">613</FONT>            return;<a name="line.613"></a>
+<FONT color="green">614</FONT>          }<a name="line.614"></a>
+<FONT color="green">615</FONT>    <a name="line.615"></a>
+<FONT color="green">616</FONT>          // compute the Newton correction<a name="line.616"></a>
+<FONT color="green">617</FONT>          for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.617"></a>
+<FONT color="green">618</FONT>           int pj = permutation[j];<a name="line.618"></a>
+<FONT color="green">619</FONT>            work1[pj] = work3[pj] * diag[pj] / dxNorm;<a name="line.619"></a>
+<FONT color="green">620</FONT>          }<a name="line.620"></a>
+<FONT color="green">621</FONT>          for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.621"></a>
+<FONT color="green">622</FONT>            int pj = permutation[j];<a name="line.622"></a>
+<FONT color="green">623</FONT>            work1[pj] /= work2[j];<a name="line.623"></a>
+<FONT color="green">624</FONT>            double tmp = work1[pj];<a name="line.624"></a>
+<FONT color="green">625</FONT>            for (int i = j + 1; i &lt; solvedCols; ++i) {<a name="line.625"></a>
+<FONT color="green">626</FONT>              work1[permutation[i]] -= jacobian[i * cols + pj] * tmp;<a name="line.626"></a>
+<FONT color="green">627</FONT>            }<a name="line.627"></a>
+<FONT color="green">628</FONT>          }<a name="line.628"></a>
+<FONT color="green">629</FONT>          sum2 = 0;<a name="line.629"></a>
+<FONT color="green">630</FONT>          for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.630"></a>
+<FONT color="green">631</FONT>            double s = work1[permutation[j]];<a name="line.631"></a>
+<FONT color="green">632</FONT>            sum2 += s * s;<a name="line.632"></a>
+<FONT color="green">633</FONT>          }<a name="line.633"></a>
+<FONT color="green">634</FONT>          double correction = fp / (delta * sum2);<a name="line.634"></a>
+<FONT color="green">635</FONT>    <a name="line.635"></a>
+<FONT color="green">636</FONT>          // depending on the sign of the function, update parl or paru.<a name="line.636"></a>
+<FONT color="green">637</FONT>          if (fp &gt; 0) {<a name="line.637"></a>
+<FONT color="green">638</FONT>            parl = Math.max(parl, lmPar);<a name="line.638"></a>
+<FONT color="green">639</FONT>          } else if (fp &lt; 0) {<a name="line.639"></a>
+<FONT color="green">640</FONT>            paru = Math.min(paru, lmPar);<a name="line.640"></a>
+<FONT color="green">641</FONT>          }<a name="line.641"></a>
+<FONT color="green">642</FONT>    <a name="line.642"></a>
+<FONT color="green">643</FONT>          // compute an improved estimate for lmPar<a name="line.643"></a>
+<FONT color="green">644</FONT>          lmPar = Math.max(parl, lmPar + correction);<a name="line.644"></a>
+<FONT color="green">645</FONT>    <a name="line.645"></a>
+<FONT color="green">646</FONT>        }<a name="line.646"></a>
+<FONT color="green">647</FONT>      }<a name="line.647"></a>
+<FONT color="green">648</FONT>    <a name="line.648"></a>
+<FONT color="green">649</FONT>      /**<a name="line.649"></a>
+<FONT color="green">650</FONT>       * Solve a*x = b and d*x = 0 in the least squares sense.<a name="line.650"></a>
+<FONT color="green">651</FONT>       * &lt;p&gt;This implementation is a translation in Java of the MINPACK<a name="line.651"></a>
+<FONT color="green">652</FONT>       * &lt;a href="http://www.netlib.org/minpack/qrsolv.f"&gt;qrsolv&lt;/a&gt;<a name="line.652"></a>
+<FONT color="green">653</FONT>       * routine.&lt;/p&gt;<a name="line.653"></a>
+<FONT color="green">654</FONT>       * &lt;p&gt;This method sets the lmDir and lmDiag attributes.&lt;/p&gt;<a name="line.654"></a>
+<FONT color="green">655</FONT>       * &lt;p&gt;The authors of the original fortran function are:&lt;/p&gt;<a name="line.655"></a>
+<FONT color="green">656</FONT>       * &lt;ul&gt;<a name="line.656"></a>
+<FONT color="green">657</FONT>       *   &lt;li&gt;Argonne National Laboratory. MINPACK project. March 1980&lt;/li&gt;<a name="line.657"></a>
+<FONT color="green">658</FONT>       *   &lt;li&gt;Burton  S. Garbow&lt;/li&gt;<a name="line.658"></a>
+<FONT color="green">659</FONT>       *   &lt;li&gt;Kenneth E. Hillstrom&lt;/li&gt;<a name="line.659"></a>
+<FONT color="green">660</FONT>       *   &lt;li&gt;Jorge   J. More&lt;/li&gt;<a name="line.660"></a>
+<FONT color="green">661</FONT>       * &lt;/ul&gt;<a name="line.661"></a>
+<FONT color="green">662</FONT>       * &lt;p&gt;Luc Maisonobe did the Java translation.&lt;/p&gt;<a name="line.662"></a>
+<FONT color="green">663</FONT>       *<a name="line.663"></a>
+<FONT color="green">664</FONT>       * @param qy array containing qTy<a name="line.664"></a>
+<FONT color="green">665</FONT>       * @param diag diagonal matrix<a name="line.665"></a>
+<FONT color="green">666</FONT>       * @param lmDiag diagonal elements associated with lmDir<a name="line.666"></a>
+<FONT color="green">667</FONT>       * @param work work array<a name="line.667"></a>
+<FONT color="green">668</FONT>       */<a name="line.668"></a>
+<FONT color="green">669</FONT>      private void determineLMDirection(double[] qy, double[] diag,<a name="line.669"></a>
+<FONT color="green">670</FONT>                                        double[] lmDiag, double[] work) {<a name="line.670"></a>
+<FONT color="green">671</FONT>    <a name="line.671"></a>
+<FONT color="green">672</FONT>        // copy R and Qty to preserve input and initialize s<a name="line.672"></a>
+<FONT color="green">673</FONT>        //  in particular, save the diagonal elements of R in lmDir<a name="line.673"></a>
+<FONT color="green">674</FONT>        for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.674"></a>
+<FONT color="green">675</FONT>          int pj = permutation[j];<a name="line.675"></a>
+<FONT color="green">676</FONT>          for (int i = j + 1; i &lt; solvedCols; ++i) {<a name="line.676"></a>
+<FONT color="green">677</FONT>            jacobian[i * cols + pj] = jacobian[j * cols + permutation[i]];<a name="line.677"></a>
+<FONT color="green">678</FONT>          }<a name="line.678"></a>
+<FONT color="green">679</FONT>          lmDir[j] = diagR[pj];<a name="line.679"></a>
+<FONT color="green">680</FONT>          work[j]  = qy[j];<a name="line.680"></a>
+<FONT color="green">681</FONT>        }<a name="line.681"></a>
+<FONT color="green">682</FONT>    <a name="line.682"></a>
+<FONT color="green">683</FONT>        // eliminate the diagonal matrix d using a Givens rotation<a name="line.683"></a>
+<FONT color="green">684</FONT>        for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.684"></a>
+<FONT color="green">685</FONT>    <a name="line.685"></a>
+<FONT color="green">686</FONT>          // prepare the row of d to be eliminated, locating the<a name="line.686"></a>
+<FONT color="green">687</FONT>          // diagonal element using p from the Q.R. factorization<a name="line.687"></a>
+<FONT color="green">688</FONT>          int pj = permutation[j];<a name="line.688"></a>
+<FONT color="green">689</FONT>          double dpj = diag[pj];<a name="line.689"></a>
+<FONT color="green">690</FONT>          if (dpj != 0) {<a name="line.690"></a>
+<FONT color="green">691</FONT>            Arrays.fill(lmDiag, j + 1, lmDiag.length, 0);<a name="line.691"></a>
+<FONT color="green">692</FONT>          }<a name="line.692"></a>
+<FONT color="green">693</FONT>          lmDiag[j] = dpj;<a name="line.693"></a>
+<FONT color="green">694</FONT>    <a name="line.694"></a>
+<FONT color="green">695</FONT>          //  the transformations to eliminate the row of d<a name="line.695"></a>
+<FONT color="green">696</FONT>          // modify only a single element of Qty<a name="line.696"></a>
+<FONT color="green">697</FONT>          // beyond the first n, which is initially zero.<a name="line.697"></a>
+<FONT color="green">698</FONT>          double qtbpj = 0;<a name="line.698"></a>
+<FONT color="green">699</FONT>          for (int k = j; k &lt; solvedCols; ++k) {<a name="line.699"></a>
+<FONT color="green">700</FONT>            int pk = permutation[k];<a name="line.700"></a>
+<FONT color="green">701</FONT>    <a name="line.701"></a>
+<FONT color="green">702</FONT>            // determine a Givens rotation which eliminates the<a name="line.702"></a>
+<FONT color="green">703</FONT>            // appropriate element in the current row of d<a name="line.703"></a>
+<FONT color="green">704</FONT>            if (lmDiag[k] != 0) {<a name="line.704"></a>
+<FONT color="green">705</FONT>    <a name="line.705"></a>
+<FONT color="green">706</FONT>              final double sin;<a name="line.706"></a>
+<FONT color="green">707</FONT>              final double cos;<a name="line.707"></a>
+<FONT color="green">708</FONT>              double rkk = jacobian[k * cols + pk];<a name="line.708"></a>
+<FONT color="green">709</FONT>              if (Math.abs(rkk) &lt; Math.abs(lmDiag[k])) {<a name="line.709"></a>
+<FONT color="green">710</FONT>                final double cotan = rkk / lmDiag[k];<a name="line.710"></a>
+<FONT color="green">711</FONT>                sin   = 1.0 / Math.sqrt(1.0 + cotan * cotan);<a name="line.711"></a>
+<FONT color="green">712</FONT>                cos   = sin * cotan;<a name="line.712"></a>
+<FONT color="green">713</FONT>              } else {<a name="line.713"></a>
+<FONT color="green">714</FONT>                final double tan = lmDiag[k] / rkk;<a name="line.714"></a>
+<FONT color="green">715</FONT>                cos = 1.0 / Math.sqrt(1.0 + tan * tan);<a name="line.715"></a>
+<FONT color="green">716</FONT>                sin = cos * tan;<a name="line.716"></a>
+<FONT color="green">717</FONT>              }<a name="line.717"></a>
+<FONT color="green">718</FONT>    <a name="line.718"></a>
+<FONT color="green">719</FONT>              // compute the modified diagonal element of R and<a name="line.719"></a>
+<FONT color="green">720</FONT>              // the modified element of (Qty,0)<a name="line.720"></a>
+<FONT color="green">721</FONT>              jacobian[k * cols + pk] = cos * rkk + sin * lmDiag[k];<a name="line.721"></a>
+<FONT color="green">722</FONT>              final double temp = cos * work[k] + sin * qtbpj;<a name="line.722"></a>
+<FONT color="green">723</FONT>              qtbpj = -sin * work[k] + cos * qtbpj;<a name="line.723"></a>
+<FONT color="green">724</FONT>              work[k] = temp;<a name="line.724"></a>
+<FONT color="green">725</FONT>    <a name="line.725"></a>
+<FONT color="green">726</FONT>              // accumulate the tranformation in the row of s<a name="line.726"></a>
+<FONT color="green">727</FONT>              for (int i = k + 1; i &lt; solvedCols; ++i) {<a name="line.727"></a>
+<FONT color="green">728</FONT>                double rik = jacobian[i * cols + pk];<a name="line.728"></a>
+<FONT color="green">729</FONT>                final double temp2 = cos * rik + sin * lmDiag[i];<a name="line.729"></a>
+<FONT color="green">730</FONT>                lmDiag[i] = -sin * rik + cos * lmDiag[i];<a name="line.730"></a>
+<FONT color="green">731</FONT>                jacobian[i * cols + pk] = temp2;<a name="line.731"></a>
+<FONT color="green">732</FONT>              }<a name="line.732"></a>
+<FONT color="green">733</FONT>    <a name="line.733"></a>
+<FONT color="green">734</FONT>            }<a name="line.734"></a>
+<FONT color="green">735</FONT>          }<a name="line.735"></a>
+<FONT color="green">736</FONT>    <a name="line.736"></a>
+<FONT color="green">737</FONT>          // store the diagonal element of s and restore<a name="line.737"></a>
+<FONT color="green">738</FONT>          // the corresponding diagonal element of R<a name="line.738"></a>
+<FONT color="green">739</FONT>          int index = j * cols + permutation[j];<a name="line.739"></a>
+<FONT color="green">740</FONT>          lmDiag[j]       = jacobian[index];<a name="line.740"></a>
+<FONT color="green">741</FONT>          jacobian[index] = lmDir[j];<a name="line.741"></a>
+<FONT color="green">742</FONT>    <a name="line.742"></a>
+<FONT color="green">743</FONT>        }<a name="line.743"></a>
+<FONT color="green">744</FONT>    <a name="line.744"></a>
+<FONT color="green">745</FONT>        // solve the triangular system for z, if the system is<a name="line.745"></a>
+<FONT color="green">746</FONT>        // singular, then obtain a least squares solution<a name="line.746"></a>
+<FONT color="green">747</FONT>        int nSing = solvedCols;<a name="line.747"></a>
+<FONT color="green">748</FONT>        for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.748"></a>
+<FONT color="green">749</FONT>          if ((lmDiag[j] == 0) &amp;&amp; (nSing == solvedCols)) {<a name="line.749"></a>
+<FONT color="green">750</FONT>            nSing = j;<a name="line.750"></a>
+<FONT color="green">751</FONT>          }<a name="line.751"></a>
+<FONT color="green">752</FONT>          if (nSing &lt; solvedCols) {<a name="line.752"></a>
+<FONT color="green">753</FONT>            work[j] = 0;<a name="line.753"></a>
+<FONT color="green">754</FONT>          }<a name="line.754"></a>
+<FONT color="green">755</FONT>        }<a name="line.755"></a>
+<FONT color="green">756</FONT>        if (nSing &gt; 0) {<a name="line.756"></a>
+<FONT color="green">757</FONT>          for (int j = nSing - 1; j &gt;= 0; --j) {<a name="line.757"></a>
+<FONT color="green">758</FONT>            int pj = permutation[j];<a name="line.758"></a>
+<FONT color="green">759</FONT>            double sum = 0;<a name="line.759"></a>
+<FONT color="green">760</FONT>            for (int i = j + 1; i &lt; nSing; ++i) {<a name="line.760"></a>
+<FONT color="green">761</FONT>              sum += jacobian[i * cols + pj] * work[i];<a name="line.761"></a>
+<FONT color="green">762</FONT>            }<a name="line.762"></a>
+<FONT color="green">763</FONT>            work[j] = (work[j] - sum) / lmDiag[j];<a name="line.763"></a>
+<FONT color="green">764</FONT>          }<a name="line.764"></a>
+<FONT color="green">765</FONT>        }<a name="line.765"></a>
+<FONT color="green">766</FONT>    <a name="line.766"></a>
+<FONT color="green">767</FONT>        // permute the components of z back to components of lmDir<a name="line.767"></a>
+<FONT color="green">768</FONT>        for (int j = 0; j &lt; lmDir.length; ++j) {<a name="line.768"></a>
+<FONT color="green">769</FONT>          lmDir[permutation[j]] = work[j];<a name="line.769"></a>
+<FONT color="green">770</FONT>        }<a name="line.770"></a>
+<FONT color="green">771</FONT>    <a name="line.771"></a>
+<FONT color="green">772</FONT>      }<a name="line.772"></a>
+<FONT color="green">773</FONT>    <a name="line.773"></a>
+<FONT color="green">774</FONT>      /**<a name="line.774"></a>
+<FONT color="green">775</FONT>       * Decompose a matrix A as A.P = Q.R using Householder transforms.<a name="line.775"></a>
+<FONT color="green">776</FONT>       * &lt;p&gt;As suggested in the P. Lascaux and R. Theodor book<a name="line.776"></a>
+<FONT color="green">777</FONT>       * &lt;i&gt;Analyse num&amp;eacute;rique matricielle appliqu&amp;eacute;e &amp;agrave;<a name="line.777"></a>
+<FONT color="green">778</FONT>       * l'art de l'ing&amp;eacute;nieur&lt;/i&gt; (Masson, 1986), instead of representing<a name="line.778"></a>
+<FONT color="green">779</FONT>       * the Householder transforms with u&lt;sub&gt;k&lt;/sub&gt; unit vectors such that:<a name="line.779"></a>
+<FONT color="green">780</FONT>       * &lt;pre&gt;<a name="line.780"></a>
+<FONT color="green">781</FONT>       * H&lt;sub&gt;k&lt;/sub&gt; = I - 2u&lt;sub&gt;k&lt;/sub&gt;.u&lt;sub&gt;k&lt;/sub&gt;&lt;sup&gt;t&lt;/sup&gt;<a name="line.781"></a>
+<FONT color="green">782</FONT>       * &lt;/pre&gt;<a name="line.782"></a>
+<FONT color="green">783</FONT>       * we use &lt;sub&gt;k&lt;/sub&gt; non-unit vectors such that:<a name="line.783"></a>
+<FONT color="green">784</FONT>       * &lt;pre&gt;<a name="line.784"></a>
+<FONT color="green">785</FONT>       * H&lt;sub&gt;k&lt;/sub&gt; = I - beta&lt;sub&gt;k&lt;/sub&gt;v&lt;sub&gt;k&lt;/sub&gt;.v&lt;sub&gt;k&lt;/sub&gt;&lt;sup&gt;t&lt;/sup&gt;<a name="line.785"></a>
+<FONT color="green">786</FONT>       * &lt;/pre&gt;<a name="line.786"></a>
+<FONT color="green">787</FONT>       * where v&lt;sub&gt;k&lt;/sub&gt; = a&lt;sub&gt;k&lt;/sub&gt; - alpha&lt;sub&gt;k&lt;/sub&gt; e&lt;sub&gt;k&lt;/sub&gt;.<a name="line.787"></a>
+<FONT color="green">788</FONT>       * The beta&lt;sub&gt;k&lt;/sub&gt; coefficients are provided upon exit as recomputing<a name="line.788"></a>
+<FONT color="green">789</FONT>       * them from the v&lt;sub&gt;k&lt;/sub&gt; vectors would be costly.&lt;/p&gt;<a name="line.789"></a>
+<FONT color="green">790</FONT>       * &lt;p&gt;This decomposition handles rank deficient cases since the tranformations<a name="line.790"></a>
+<FONT color="green">791</FONT>       * are performed in non-increasing columns norms order thanks to columns<a name="line.791"></a>
+<FONT color="green">792</FONT>       * pivoting. The diagonal elements of the R matrix are therefore also in<a name="line.792"></a>
+<FONT color="green">793</FONT>       * non-increasing absolute values order.&lt;/p&gt;<a name="line.793"></a>
+<FONT color="green">794</FONT>       * @exception EstimationException if the decomposition cannot be performed<a name="line.794"></a>
+<FONT color="green">795</FONT>       */<a name="line.795"></a>
+<FONT color="green">796</FONT>      private void qrDecomposition() throws EstimationException {<a name="line.796"></a>
+<FONT color="green">797</FONT>    <a name="line.797"></a>
+<FONT color="green">798</FONT>        // initializations<a name="line.798"></a>
+<FONT color="green">799</FONT>        for (int k = 0; k &lt; cols; ++k) {<a name="line.799"></a>
+<FONT color="green">800</FONT>          permutation[k] = k;<a name="line.800"></a>
+<FONT color="green">801</FONT>          double norm2 = 0;<a name="line.801"></a>
+<FONT color="green">802</FONT>          for (int index = k; index &lt; jacobian.length; index += cols) {<a name="line.802"></a>
+<FONT color="green">803</FONT>            double akk = jacobian[index];<a name="line.803"></a>
+<FONT color="green">804</FONT>            norm2 += akk * akk;<a name="line.804"></a>
+<FONT color="green">805</FONT>          }<a name="line.805"></a>
+<FONT color="green">806</FONT>          jacNorm[k] = Math.sqrt(norm2);<a name="line.806"></a>
+<FONT color="green">807</FONT>        }<a name="line.807"></a>
+<FONT color="green">808</FONT>    <a name="line.808"></a>
+<FONT color="green">809</FONT>        // transform the matrix column after column<a name="line.809"></a>
+<FONT color="green">810</FONT>        for (int k = 0; k &lt; cols; ++k) {<a name="line.810"></a>
+<FONT color="green">811</FONT>    <a name="line.811"></a>
+<FONT color="green">812</FONT>          // select the column with the greatest norm on active components<a name="line.812"></a>
+<FONT color="green">813</FONT>          int nextColumn = -1;<a name="line.813"></a>
+<FONT color="green">814</FONT>          double ak2 = Double.NEGATIVE_INFINITY;<a name="line.814"></a>
+<FONT color="green">815</FONT>          for (int i = k; i &lt; cols; ++i) {<a name="line.815"></a>
+<FONT color="green">816</FONT>            double norm2 = 0;<a name="line.816"></a>
+<FONT color="green">817</FONT>            int iDiag = k * cols + permutation[i];<a name="line.817"></a>
+<FONT color="green">818</FONT>            for (int index = iDiag; index &lt; jacobian.length; index += cols) {<a name="line.818"></a>
+<FONT color="green">819</FONT>              double aki = jacobian[index];<a name="line.819"></a>
+<FONT color="green">820</FONT>              norm2 += aki * aki;<a name="line.820"></a>
+<FONT color="green">821</FONT>            }<a name="line.821"></a>
+<FONT color="green">822</FONT>            if (Double.isInfinite(norm2) || Double.isNaN(norm2)) {<a name="line.822"></a>
+<FONT color="green">823</FONT>                throw new EstimationException(<a name="line.823"></a>
+<FONT color="green">824</FONT>                        "unable to perform Q.R decomposition on the {0}x{1} jacobian matrix",<a name="line.824"></a>
+<FONT color="green">825</FONT>                        rows, cols);<a name="line.825"></a>
+<FONT color="green">826</FONT>            }<a name="line.826"></a>
+<FONT color="green">827</FONT>            if (norm2 &gt; ak2) {<a name="line.827"></a>
+<FONT color="green">828</FONT>              nextColumn = i;<a name="line.828"></a>
+<FONT color="green">829</FONT>              ak2        = norm2;<a name="line.829"></a>
+<FONT color="green">830</FONT>            }<a name="line.830"></a>
+<FONT color="green">831</FONT>          }<a name="line.831"></a>
+<FONT color="green">832</FONT>          if (ak2 == 0) {<a name="line.832"></a>
+<FONT color="green">833</FONT>            rank = k;<a name="line.833"></a>
+<FONT color="green">834</FONT>            return;<a name="line.834"></a>
+<FONT color="green">835</FONT>          }<a name="line.835"></a>
+<FONT color="green">836</FONT>          int pk                  = permutation[nextColumn];<a name="line.836"></a>
+<FONT color="green">837</FONT>          permutation[nextColumn] = permutation[k];<a name="line.837"></a>
+<FONT color="green">838</FONT>          permutation[k]          = pk;<a name="line.838"></a>
+<FONT color="green">839</FONT>    <a name="line.839"></a>
+<FONT color="green">840</FONT>          // choose alpha such that Hk.u = alpha ek<a name="line.840"></a>
+<FONT color="green">841</FONT>          int    kDiag = k * cols + pk;<a name="line.841"></a>
+<FONT color="green">842</FONT>          double akk   = jacobian[kDiag];<a name="line.842"></a>
+<FONT color="green">843</FONT>          double alpha = (akk &gt; 0) ? -Math.sqrt(ak2) : Math.sqrt(ak2);<a name="line.843"></a>
+<FONT color="green">844</FONT>          double betak = 1.0 / (ak2 - akk * alpha);<a name="line.844"></a>
+<FONT color="green">845</FONT>          beta[pk]     = betak;<a name="line.845"></a>
+<FONT color="green">846</FONT>    <a name="line.846"></a>
+<FONT color="green">847</FONT>          // transform the current column<a name="line.847"></a>
+<FONT color="green">848</FONT>          diagR[pk]        = alpha;<a name="line.848"></a>
+<FONT color="green">849</FONT>          jacobian[kDiag] -= alpha;<a name="line.849"></a>
+<FONT color="green">850</FONT>    <a name="line.850"></a>
+<FONT color="green">851</FONT>          // transform the remaining columns<a name="line.851"></a>
+<FONT color="green">852</FONT>          for (int dk = cols - 1 - k; dk &gt; 0; --dk) {<a name="line.852"></a>
+<FONT color="green">853</FONT>            int dkp = permutation[k + dk] - pk;<a name="line.853"></a>
+<FONT color="green">854</FONT>            double gamma = 0;<a name="line.854"></a>
+<FONT color="green">855</FONT>            for (int index = kDiag; index &lt; jacobian.length; index += cols) {<a name="line.855"></a>
+<FONT color="green">856</FONT>              gamma += jacobian[index] * jacobian[index + dkp];<a name="line.856"></a>
+<FONT color="green">857</FONT>            }<a name="line.857"></a>
+<FONT color="green">858</FONT>            gamma *= betak;<a name="line.858"></a>
+<FONT color="green">859</FONT>            for (int index = kDiag; index &lt; jacobian.length; index += cols) {<a name="line.859"></a>
+<FONT color="green">860</FONT>              jacobian[index + dkp] -= gamma * jacobian[index];<a name="line.860"></a>
+<FONT color="green">861</FONT>            }<a name="line.861"></a>
+<FONT color="green">862</FONT>          }<a name="line.862"></a>
+<FONT color="green">863</FONT>    <a name="line.863"></a>
+<FONT color="green">864</FONT>        }<a name="line.864"></a>
+<FONT color="green">865</FONT>    <a name="line.865"></a>
+<FONT color="green">866</FONT>        rank = solvedCols;<a name="line.866"></a>
+<FONT color="green">867</FONT>    <a name="line.867"></a>
+<FONT color="green">868</FONT>      }<a name="line.868"></a>
+<FONT color="green">869</FONT>    <a name="line.869"></a>
+<FONT color="green">870</FONT>      /**<a name="line.870"></a>
+<FONT color="green">871</FONT>       * Compute the product Qt.y for some Q.R. decomposition.<a name="line.871"></a>
+<FONT color="green">872</FONT>       *<a name="line.872"></a>
+<FONT color="green">873</FONT>       * @param y vector to multiply (will be overwritten with the result)<a name="line.873"></a>
+<FONT color="green">874</FONT>       */<a name="line.874"></a>
+<FONT color="green">875</FONT>      private void qTy(double[] y) {<a name="line.875"></a>
+<FONT color="green">876</FONT>        for (int k = 0; k &lt; cols; ++k) {<a name="line.876"></a>
+<FONT color="green">877</FONT>          int pk = permutation[k];<a name="line.877"></a>
+<FONT color="green">878</FONT>          int kDiag = k * cols + pk;<a name="line.878"></a>
+<FONT color="green">879</FONT>          double gamma = 0;<a name="line.879"></a>
+<FONT color="green">880</FONT>          int index = kDiag;<a name="line.880"></a>
+<FONT color="green">881</FONT>          for (int i = k; i &lt; rows; ++i) {<a name="line.881"></a>
+<FONT color="green">882</FONT>            gamma += jacobian[index] * y[i];<a name="line.882"></a>
+<FONT color="green">883</FONT>            index += cols;<a name="line.883"></a>
+<FONT color="green">884</FONT>          }<a name="line.884"></a>
+<FONT color="green">885</FONT>          gamma *= beta[pk];<a name="line.885"></a>
+<FONT color="green">886</FONT>          index = kDiag;<a name="line.886"></a>
+<FONT color="green">887</FONT>          for (int i = k; i &lt; rows; ++i) {<a name="line.887"></a>
+<FONT color="green">888</FONT>            y[i] -= gamma * jacobian[index];<a name="line.888"></a>
+<FONT color="green">889</FONT>            index += cols;<a name="line.889"></a>
+<FONT color="green">890</FONT>          }<a name="line.890"></a>
+<FONT color="green">891</FONT>        }<a name="line.891"></a>
+<FONT color="green">892</FONT>      }<a name="line.892"></a>
+<FONT color="green">893</FONT>    <a name="line.893"></a>
+<FONT color="green">894</FONT>    }<a name="line.894"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/estimation/SimpleEstimationProblem.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,177 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.estimation;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.ArrayList;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.List;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Simple implementation of the {@link EstimationProblem<a name="line.24"></a>
+<FONT color="green">025</FONT>     * EstimationProblem} interface for boilerplate data handling.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;This class &lt;em&gt;only&lt;/em&gt; handles parameters and measurements<a name="line.26"></a>
+<FONT color="green">027</FONT>     * storage and unbound parameters filtering. It does not compute<a name="line.27"></a>
+<FONT color="green">028</FONT>     * anything by itself. It should either be used with measurements<a name="line.28"></a>
+<FONT color="green">029</FONT>     * implementation that are smart enough to know about the<a name="line.29"></a>
+<FONT color="green">030</FONT>     * various parameters in order to compute the partial derivatives<a name="line.30"></a>
+<FONT color="green">031</FONT>     * appropriately. Since the problem-specific logic is mainly related to<a name="line.31"></a>
+<FONT color="green">032</FONT>     * the various measurements models, the simplest way to use this class<a name="line.32"></a>
+<FONT color="green">033</FONT>     * is by extending it and using one internal class extending<a name="line.33"></a>
+<FONT color="green">034</FONT>     * {@link WeightedMeasurement WeightedMeasurement} for each measurement<a name="line.34"></a>
+<FONT color="green">035</FONT>     * type. The instances of the internal classes would have access to the<a name="line.35"></a>
+<FONT color="green">036</FONT>     * various parameters and their current estimate.&lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @since 1.2<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @deprecated as of 2.0, everything in package org.apache.commons.math.estimation has<a name="line.40"></a>
+<FONT color="green">041</FONT>     * been deprecated and replaced by package org.apache.commons.math.optimization.general<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>     */<a name="line.43"></a>
+<FONT color="green">044</FONT>    @Deprecated<a name="line.44"></a>
+<FONT color="green">045</FONT>    public class SimpleEstimationProblem implements EstimationProblem {<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** Estimated parameters. */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private final List&lt;EstimatedParameter&gt; parameters;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Measurements. */<a name="line.50"></a>
+<FONT color="green">051</FONT>        private final List&lt;WeightedMeasurement&gt; measurements;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Build an empty instance without parameters nor measurements.<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public SimpleEstimationProblem() {<a name="line.56"></a>
+<FONT color="green">057</FONT>            parameters   = new ArrayList&lt;EstimatedParameter&gt;();<a name="line.57"></a>
+<FONT color="green">058</FONT>            measurements = new ArrayList&lt;WeightedMeasurement&gt;();<a name="line.58"></a>
+<FONT color="green">059</FONT>        }<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Get all the parameters of the problem.<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @return parameters<a name="line.63"></a>
+<FONT color="green">064</FONT>         */<a name="line.64"></a>
+<FONT color="green">065</FONT>        public EstimatedParameter[] getAllParameters() {<a name="line.65"></a>
+<FONT color="green">066</FONT>            return parameters.toArray(new EstimatedParameter[parameters.size()]);<a name="line.66"></a>
+<FONT color="green">067</FONT>        }<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * Get the unbound parameters of the problem.<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @return unbound parameters<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        public EstimatedParameter[] getUnboundParameters() {<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>            // filter the unbound parameters<a name="line.75"></a>
+<FONT color="green">076</FONT>            List&lt;EstimatedParameter&gt; unbound = new ArrayList&lt;EstimatedParameter&gt;(parameters.size());<a name="line.76"></a>
+<FONT color="green">077</FONT>            for (EstimatedParameter p : parameters) {<a name="line.77"></a>
+<FONT color="green">078</FONT>                if (! p.isBound()) {<a name="line.78"></a>
+<FONT color="green">079</FONT>                    unbound.add(p);<a name="line.79"></a>
+<FONT color="green">080</FONT>                }<a name="line.80"></a>
+<FONT color="green">081</FONT>            }<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>            // convert to an array<a name="line.83"></a>
+<FONT color="green">084</FONT>            return unbound.toArray(new EstimatedParameter[unbound.size()]);<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        }<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>        /**<a name="line.88"></a>
+<FONT color="green">089</FONT>         * Get the measurements of an estimation problem.<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @return measurements<a name="line.90"></a>
+<FONT color="green">091</FONT>         */<a name="line.91"></a>
+<FONT color="green">092</FONT>        public WeightedMeasurement[] getMeasurements() {<a name="line.92"></a>
+<FONT color="green">093</FONT>            return measurements.toArray(new WeightedMeasurement[measurements.size()]);<a name="line.93"></a>
+<FONT color="green">094</FONT>        }<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /** Add a parameter to the problem.<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @param p parameter to add<a name="line.97"></a>
+<FONT color="green">098</FONT>         */<a name="line.98"></a>
+<FONT color="green">099</FONT>        protected void addParameter(EstimatedParameter p) {<a name="line.99"></a>
+<FONT color="green">100</FONT>            parameters.add(p);<a name="line.100"></a>
+<FONT color="green">101</FONT>        }<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        /**<a name="line.103"></a>
+<FONT color="green">104</FONT>         * Add a new measurement to the set.<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @param m measurement to add<a name="line.105"></a>
+<FONT color="green">106</FONT>         */<a name="line.106"></a>
+<FONT color="green">107</FONT>        protected void addMeasurement(WeightedMeasurement m) {<a name="line.107"></a>
+<FONT color="green">108</FONT>            measurements.add(m);<a name="line.108"></a>
+<FONT color="green">109</FONT>        }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>    }<a name="line.111"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/estimation/WeightedMeasurement.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,238 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.estimation;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This class represents measurements in estimation problems.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;This abstract class implements all the methods needed to handle<a name="line.25"></a>
+<FONT color="green">026</FONT>     * measurements in a general way. It defines neither the {@link<a name="line.26"></a>
+<FONT color="green">027</FONT>     * #getTheoreticalValue getTheoreticalValue} nor the {@link<a name="line.27"></a>
+<FONT color="green">028</FONT>     * #getPartial getPartial} methods, which should be defined by<a name="line.28"></a>
+<FONT color="green">029</FONT>     * sub-classes according to the specific problem.&lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;The {@link #getTheoreticalValue getTheoreticalValue} and {@link<a name="line.31"></a>
+<FONT color="green">032</FONT>     * #getPartial getPartial} methods must always use the current<a name="line.32"></a>
+<FONT color="green">033</FONT>     * estimate of the parameters set by the solver in the problem. These<a name="line.33"></a>
+<FONT color="green">034</FONT>     * parameters can be retrieved through the {@link<a name="line.34"></a>
+<FONT color="green">035</FONT>     * EstimationProblem#getAllParameters<a name="line.35"></a>
+<FONT color="green">036</FONT>     * EstimationProblem.getAllParameters} method if the measurements are<a name="line.36"></a>
+<FONT color="green">037</FONT>     * independent of the problem, or directly if they are implemented as<a name="line.37"></a>
+<FONT color="green">038</FONT>     * inner classes of the problem.&lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     *<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;p&gt;The instances for which the &lt;code&gt;ignored&lt;/code&gt; flag is set<a name="line.40"></a>
+<FONT color="green">041</FONT>     * through the {@link #setIgnored setIgnored} method are ignored by the<a name="line.41"></a>
+<FONT color="green">042</FONT>     * solvers. This can be used to reject wrong measurements at some<a name="line.42"></a>
+<FONT color="green">043</FONT>     * steps of the estimation.&lt;/p&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     *<a name="line.44"></a>
+<FONT color="green">045</FONT>     * @see EstimationProblem<a name="line.45"></a>
+<FONT color="green">046</FONT>     *<a name="line.46"></a>
+<FONT color="green">047</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.47"></a>
+<FONT color="green">048</FONT>     * @since 1.2<a name="line.48"></a>
+<FONT color="green">049</FONT>     * @deprecated as of 2.0, everything in package org.apache.commons.math.estimation has<a name="line.49"></a>
+<FONT color="green">050</FONT>     * been deprecated and replaced by package org.apache.commons.math.optimization.general<a name="line.50"></a>
+<FONT color="green">051</FONT>     */<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>    @Deprecated<a name="line.53"></a>
+<FONT color="green">054</FONT>    public abstract class WeightedMeasurement implements Serializable {<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** Serializable version identifier. */<a name="line.56"></a>
+<FONT color="green">057</FONT>        private static final long serialVersionUID = 4360046376796901941L;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** Measurement weight. */<a name="line.59"></a>
+<FONT color="green">060</FONT>        private final double  weight;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** Value of the measurements. */<a name="line.62"></a>
+<FONT color="green">063</FONT>        private final double  measuredValue;<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Ignore measurement indicator. */<a name="line.65"></a>
+<FONT color="green">066</FONT>        private boolean ignored;<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>      /**<a name="line.68"></a>
+<FONT color="green">069</FONT>       * Simple constructor.<a name="line.69"></a>
+<FONT color="green">070</FONT>       * Build a measurement with the given parameters, and set its ignore<a name="line.70"></a>
+<FONT color="green">071</FONT>       * flag to false.<a name="line.71"></a>
+<FONT color="green">072</FONT>       * @param weight weight of the measurement in the least squares problem<a name="line.72"></a>
+<FONT color="green">073</FONT>       * (two common choices are either to use 1.0 for all measurements, or to<a name="line.73"></a>
+<FONT color="green">074</FONT>       * use a value proportional to the inverse of the variance of the measurement<a name="line.74"></a>
+<FONT color="green">075</FONT>       * type)<a name="line.75"></a>
+<FONT color="green">076</FONT>       *<a name="line.76"></a>
+<FONT color="green">077</FONT>       * @param measuredValue measured value<a name="line.77"></a>
+<FONT color="green">078</FONT>       */<a name="line.78"></a>
+<FONT color="green">079</FONT>      public WeightedMeasurement(double weight, double measuredValue) {<a name="line.79"></a>
+<FONT color="green">080</FONT>        this.weight        = weight;<a name="line.80"></a>
+<FONT color="green">081</FONT>        this.measuredValue = measuredValue;<a name="line.81"></a>
+<FONT color="green">082</FONT>        ignored            = false;<a name="line.82"></a>
+<FONT color="green">083</FONT>      }<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>      /** Simple constructor.<a name="line.85"></a>
+<FONT color="green">086</FONT>       *<a name="line.86"></a>
+<FONT color="green">087</FONT>       * Build a measurement with the given parameters<a name="line.87"></a>
+<FONT color="green">088</FONT>       *<a name="line.88"></a>
+<FONT color="green">089</FONT>       * @param weight weight of the measurement in the least squares problem<a name="line.89"></a>
+<FONT color="green">090</FONT>       * @param measuredValue measured value<a name="line.90"></a>
+<FONT color="green">091</FONT>       * @param ignored true if the measurement should be ignored<a name="line.91"></a>
+<FONT color="green">092</FONT>       */<a name="line.92"></a>
+<FONT color="green">093</FONT>      public WeightedMeasurement(double weight, double measuredValue,<a name="line.93"></a>
+<FONT color="green">094</FONT>                                 boolean ignored) {<a name="line.94"></a>
+<FONT color="green">095</FONT>        this.weight        = weight;<a name="line.95"></a>
+<FONT color="green">096</FONT>        this.measuredValue = measuredValue;<a name="line.96"></a>
+<FONT color="green">097</FONT>        this.ignored       = ignored;<a name="line.97"></a>
+<FONT color="green">098</FONT>      }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>      /**<a name="line.100"></a>
+<FONT color="green">101</FONT>       * Get the weight of the measurement in the least squares problem<a name="line.101"></a>
+<FONT color="green">102</FONT>       *<a name="line.102"></a>
+<FONT color="green">103</FONT>       * @return weight<a name="line.103"></a>
+<FONT color="green">104</FONT>       */<a name="line.104"></a>
+<FONT color="green">105</FONT>      public double getWeight() {<a name="line.105"></a>
+<FONT color="green">106</FONT>        return weight;<a name="line.106"></a>
+<FONT color="green">107</FONT>      }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>      /**<a name="line.109"></a>
+<FONT color="green">110</FONT>       * Get the measured value<a name="line.110"></a>
+<FONT color="green">111</FONT>       *<a name="line.111"></a>
+<FONT color="green">112</FONT>       * @return measured value<a name="line.112"></a>
+<FONT color="green">113</FONT>       */<a name="line.113"></a>
+<FONT color="green">114</FONT>      public double getMeasuredValue() {<a name="line.114"></a>
+<FONT color="green">115</FONT>        return measuredValue;<a name="line.115"></a>
+<FONT color="green">116</FONT>      }<a name="line.116"></a>
+<FONT color="green">117</FONT>    <a name="line.117"></a>
+<FONT color="green">118</FONT>      /**<a name="line.118"></a>
+<FONT color="green">119</FONT>       * Get the residual for this measurement<a name="line.119"></a>
+<FONT color="green">120</FONT>       * The residual is the measured value minus the theoretical value.<a name="line.120"></a>
+<FONT color="green">121</FONT>       *<a name="line.121"></a>
+<FONT color="green">122</FONT>       * @return residual<a name="line.122"></a>
+<FONT color="green">123</FONT>       */<a name="line.123"></a>
+<FONT color="green">124</FONT>      public double getResidual() {<a name="line.124"></a>
+<FONT color="green">125</FONT>        return measuredValue - getTheoreticalValue();<a name="line.125"></a>
+<FONT color="green">126</FONT>      }<a name="line.126"></a>
+<FONT color="green">127</FONT>    <a name="line.127"></a>
+<FONT color="green">128</FONT>      /**<a name="line.128"></a>
+<FONT color="green">129</FONT>       * Get the theoretical value expected for this measurement<a name="line.129"></a>
+<FONT color="green">130</FONT>       * &lt;p&gt;The theoretical value is the value expected for this measurement<a name="line.130"></a>
+<FONT color="green">131</FONT>       * if the model and its parameter were all perfectly known.&lt;/p&gt;<a name="line.131"></a>
+<FONT color="green">132</FONT>       * &lt;p&gt;The value must be computed using the current estimate of the parameters<a name="line.132"></a>
+<FONT color="green">133</FONT>       * set by the solver in the problem.&lt;/p&gt;<a name="line.133"></a>
+<FONT color="green">134</FONT>       *<a name="line.134"></a>
+<FONT color="green">135</FONT>       * @return theoretical value<a name="line.135"></a>
+<FONT color="green">136</FONT>       */<a name="line.136"></a>
+<FONT color="green">137</FONT>      public abstract double getTheoreticalValue();<a name="line.137"></a>
+<FONT color="green">138</FONT>    <a name="line.138"></a>
+<FONT color="green">139</FONT>      /**<a name="line.139"></a>
+<FONT color="green">140</FONT>       * Get the partial derivative of the {@link #getTheoreticalValue<a name="line.140"></a>
+<FONT color="green">141</FONT>       * theoretical value} according to the parameter.<a name="line.141"></a>
+<FONT color="green">142</FONT>       * &lt;p&gt;The value must be computed using the current estimate of the parameters<a name="line.142"></a>
+<FONT color="green">143</FONT>       * set by the solver in the problem.&lt;/p&gt;<a name="line.143"></a>
+<FONT color="green">144</FONT>       *<a name="line.144"></a>
+<FONT color="green">145</FONT>       * @param parameter parameter against which the partial derivative<a name="line.145"></a>
+<FONT color="green">146</FONT>       * should be computed<a name="line.146"></a>
+<FONT color="green">147</FONT>       * @return partial derivative of the {@link #getTheoreticalValue<a name="line.147"></a>
+<FONT color="green">148</FONT>       * theoretical value}<a name="line.148"></a>
+<FONT color="green">149</FONT>       */<a name="line.149"></a>
+<FONT color="green">150</FONT>      public abstract double getPartial(EstimatedParameter parameter);<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>      /**<a name="line.152"></a>
+<FONT color="green">153</FONT>       * Set the ignore flag to the specified value<a name="line.153"></a>
+<FONT color="green">154</FONT>       * Setting the ignore flag to true allow to reject wrong<a name="line.154"></a>
+<FONT color="green">155</FONT>       * measurements, which sometimes can be detected only rather late.<a name="line.155"></a>
+<FONT color="green">156</FONT>       *<a name="line.156"></a>
+<FONT color="green">157</FONT>       * @param ignored value for the ignore flag<a name="line.157"></a>
+<FONT color="green">158</FONT>       */<a name="line.158"></a>
+<FONT color="green">159</FONT>      public void setIgnored(boolean ignored) {<a name="line.159"></a>
+<FONT color="green">160</FONT>        this.ignored = ignored;<a name="line.160"></a>
+<FONT color="green">161</FONT>      }<a name="line.161"></a>
+<FONT color="green">162</FONT>    <a name="line.162"></a>
+<FONT color="green">163</FONT>      /**<a name="line.163"></a>
+<FONT color="green">164</FONT>       * Check if this measurement should be ignored<a name="line.164"></a>
+<FONT color="green">165</FONT>       *<a name="line.165"></a>
+<FONT color="green">166</FONT>       * @return true if the measurement should be ignored<a name="line.166"></a>
+<FONT color="green">167</FONT>       */<a name="line.167"></a>
+<FONT color="green">168</FONT>      public boolean isIgnored() {<a name="line.168"></a>
+<FONT color="green">169</FONT>        return ignored;<a name="line.169"></a>
+<FONT color="green">170</FONT>      }<a name="line.170"></a>
+<FONT color="green">171</FONT>    <a name="line.171"></a>
+<FONT color="green">172</FONT>    }<a name="line.172"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/AbstractFormat.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,279 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.fraction;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.text.FieldPosition;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.text.NumberFormat;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.text.ParsePosition;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import java.util.Locale;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    /**<a name="line.28"></a>
+<FONT color="green">029</FONT>     * Common part shared by both {@link FractionFormat} and {@link BigFractionFormat}.<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 2.0<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public abstract class AbstractFormat extends NumberFormat implements Serializable {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Serializable version identifier. */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private static final long serialVersionUID = -6981118387974191891L;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** The format used for the denominator. */<a name="line.38"></a>
+<FONT color="green">039</FONT>        protected NumberFormat denominatorFormat;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** The format used for the numerator. */<a name="line.41"></a>
+<FONT color="green">042</FONT>        protected NumberFormat numeratorFormat;<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /**<a name="line.44"></a>
+<FONT color="green">045</FONT>         * Create an improper formatting instance with the default number format<a name="line.45"></a>
+<FONT color="green">046</FONT>         * for the numerator and denominator.<a name="line.46"></a>
+<FONT color="green">047</FONT>         */<a name="line.47"></a>
+<FONT color="green">048</FONT>        protected AbstractFormat() {<a name="line.48"></a>
+<FONT color="green">049</FONT>            this(getDefaultNumberFormat());<a name="line.49"></a>
+<FONT color="green">050</FONT>        }<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * Create an improper formatting instance with a custom number format for<a name="line.53"></a>
+<FONT color="green">054</FONT>         * both the numerator and denominator.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param format the custom format for both the numerator and denominator.<a name="line.55"></a>
+<FONT color="green">056</FONT>         */<a name="line.56"></a>
+<FONT color="green">057</FONT>        protected AbstractFormat(final NumberFormat format) {<a name="line.57"></a>
+<FONT color="green">058</FONT>            this(format, (NumberFormat) format.clone());<a name="line.58"></a>
+<FONT color="green">059</FONT>        }<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Create an improper formatting instance with a custom number format for<a name="line.62"></a>
+<FONT color="green">063</FONT>         * the numerator and a custom number format for the denominator.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @param numeratorFormat the custom format for the numerator.<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param denominatorFormat the custom format for the denominator.<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        protected AbstractFormat(final NumberFormat numeratorFormat,<a name="line.67"></a>
+<FONT color="green">068</FONT>                                 final NumberFormat denominatorFormat) {<a name="line.68"></a>
+<FONT color="green">069</FONT>            this.numeratorFormat   = numeratorFormat;<a name="line.69"></a>
+<FONT color="green">070</FONT>            this.denominatorFormat = denominatorFormat;<a name="line.70"></a>
+<FONT color="green">071</FONT>        }<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /**<a name="line.73"></a>
+<FONT color="green">074</FONT>         * Create a default number format.  The default number format is based on<a name="line.74"></a>
+<FONT color="green">075</FONT>         * {@link NumberFormat#getNumberInstance(java.util.Locale)} with the only<a name="line.75"></a>
+<FONT color="green">076</FONT>         * customizing is the maximum number of BigFraction digits, which is set to 0.<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @return the default number format.<a name="line.77"></a>
+<FONT color="green">078</FONT>         */<a name="line.78"></a>
+<FONT color="green">079</FONT>        protected static NumberFormat getDefaultNumberFormat() {<a name="line.79"></a>
+<FONT color="green">080</FONT>            return getDefaultNumberFormat(Locale.getDefault());<a name="line.80"></a>
+<FONT color="green">081</FONT>        }<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /**<a name="line.83"></a>
+<FONT color="green">084</FONT>         * Create a default number format.  The default number format is based on<a name="line.84"></a>
+<FONT color="green">085</FONT>         * {@link NumberFormat#getNumberInstance(java.util.Locale)} with the only<a name="line.85"></a>
+<FONT color="green">086</FONT>         * customizing is the maximum number of BigFraction digits, which is set to 0.<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @param locale the specific locale used by the format.<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @return the default number format specific to the given locale.<a name="line.88"></a>
+<FONT color="green">089</FONT>         */<a name="line.89"></a>
+<FONT color="green">090</FONT>        protected static NumberFormat getDefaultNumberFormat(final Locale locale) {<a name="line.90"></a>
+<FONT color="green">091</FONT>            final NumberFormat nf = NumberFormat.getNumberInstance(locale);<a name="line.91"></a>
+<FONT color="green">092</FONT>            nf.setMaximumFractionDigits(0);<a name="line.92"></a>
+<FONT color="green">093</FONT>            nf.setParseIntegerOnly(true);<a name="line.93"></a>
+<FONT color="green">094</FONT>            return nf;<a name="line.94"></a>
+<FONT color="green">095</FONT>        }<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /**<a name="line.97"></a>
+<FONT color="green">098</FONT>         * Access the denominator format.<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @return the denominator format.<a name="line.99"></a>
+<FONT color="green">100</FONT>         */<a name="line.100"></a>
+<FONT color="green">101</FONT>        public NumberFormat getDenominatorFormat() {<a name="line.101"></a>
+<FONT color="green">102</FONT>            return denominatorFormat;<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /**<a name="line.105"></a>
+<FONT color="green">106</FONT>         * Access the numerator format.<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @return the numerator format.<a name="line.107"></a>
+<FONT color="green">108</FONT>         */<a name="line.108"></a>
+<FONT color="green">109</FONT>        public NumberFormat getNumeratorFormat() {<a name="line.109"></a>
+<FONT color="green">110</FONT>            return numeratorFormat;<a name="line.110"></a>
+<FONT color="green">111</FONT>        }<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>        /**<a name="line.113"></a>
+<FONT color="green">114</FONT>         * Modify the denominator format.<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @param format the new denominator format value.<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @throws IllegalArgumentException if &lt;code&gt;format&lt;/code&gt; is<a name="line.116"></a>
+<FONT color="green">117</FONT>         *         &lt;code&gt;null&lt;/code&gt;.<a name="line.117"></a>
+<FONT color="green">118</FONT>         */<a name="line.118"></a>
+<FONT color="green">119</FONT>        public void setDenominatorFormat(final NumberFormat format) {<a name="line.119"></a>
+<FONT color="green">120</FONT>            if (format == null) {<a name="line.120"></a>
+<FONT color="green">121</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.121"></a>
+<FONT color="green">122</FONT>                    "denominator format can not be null");<a name="line.122"></a>
+<FONT color="green">123</FONT>            }<a name="line.123"></a>
+<FONT color="green">124</FONT>            this.denominatorFormat = format;<a name="line.124"></a>
+<FONT color="green">125</FONT>        }<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>        /**<a name="line.127"></a>
+<FONT color="green">128</FONT>         * Modify the numerator format.<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @param format the new numerator format value.<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @throws IllegalArgumentException if &lt;code&gt;format&lt;/code&gt; is<a name="line.130"></a>
+<FONT color="green">131</FONT>         *         &lt;code&gt;null&lt;/code&gt;.<a name="line.131"></a>
+<FONT color="green">132</FONT>         */<a name="line.132"></a>
+<FONT color="green">133</FONT>        public void setNumeratorFormat(final NumberFormat format) {<a name="line.133"></a>
+<FONT color="green">134</FONT>            if (format == null) {<a name="line.134"></a>
+<FONT color="green">135</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.135"></a>
+<FONT color="green">136</FONT>                    "numerator format can not be null");<a name="line.136"></a>
+<FONT color="green">137</FONT>            }<a name="line.137"></a>
+<FONT color="green">138</FONT>            this.numeratorFormat = format;<a name="line.138"></a>
+<FONT color="green">139</FONT>        }<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>        /**<a name="line.141"></a>
+<FONT color="green">142</FONT>         * Parses &lt;code&gt;source&lt;/code&gt; until a non-whitespace character is found.<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @param source the string to parse<a name="line.143"></a>
+<FONT color="green">144</FONT>         * @param pos input/ouput parsing parameter.  On output, &lt;code&gt;pos&lt;/code&gt;<a name="line.144"></a>
+<FONT color="green">145</FONT>         *        holds the index of the next non-whitespace character.<a name="line.145"></a>
+<FONT color="green">146</FONT>         */<a name="line.146"></a>
+<FONT color="green">147</FONT>        protected static void parseAndIgnoreWhitespace(final String source,<a name="line.147"></a>
+<FONT color="green">148</FONT>                                                       final ParsePosition pos) {<a name="line.148"></a>
+<FONT color="green">149</FONT>            parseNextCharacter(source, pos);<a name="line.149"></a>
+<FONT color="green">150</FONT>            pos.setIndex(pos.getIndex() - 1);<a name="line.150"></a>
+<FONT color="green">151</FONT>        }<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>        /**<a name="line.153"></a>
+<FONT color="green">154</FONT>         * Parses &lt;code&gt;source&lt;/code&gt; until a non-whitespace character is found.<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @param source the string to parse<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @param pos input/ouput parsing parameter.<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @return the first non-whitespace character.<a name="line.157"></a>
+<FONT color="green">158</FONT>         */<a name="line.158"></a>
+<FONT color="green">159</FONT>        protected static char parseNextCharacter(final String source,<a name="line.159"></a>
+<FONT color="green">160</FONT>                                                 final ParsePosition pos) {<a name="line.160"></a>
+<FONT color="green">161</FONT>             int index = pos.getIndex();<a name="line.161"></a>
+<FONT color="green">162</FONT>             final int n = source.length();<a name="line.162"></a>
+<FONT color="green">163</FONT>             char ret = 0;<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>             if (index &lt; n) {<a name="line.165"></a>
+<FONT color="green">166</FONT>                 char c;<a name="line.166"></a>
+<FONT color="green">167</FONT>                 do {<a name="line.167"></a>
+<FONT color="green">168</FONT>                     c = source.charAt(index++);<a name="line.168"></a>
+<FONT color="green">169</FONT>                 } while (Character.isWhitespace(c) &amp;&amp; index &lt; n);<a name="line.169"></a>
+<FONT color="green">170</FONT>                 pos.setIndex(index);<a name="line.170"></a>
+<FONT color="green">171</FONT>    <a name="line.171"></a>
+<FONT color="green">172</FONT>                 if (index &lt; n) {<a name="line.172"></a>
+<FONT color="green">173</FONT>                     ret = c;<a name="line.173"></a>
+<FONT color="green">174</FONT>                 }<a name="line.174"></a>
+<FONT color="green">175</FONT>             }<a name="line.175"></a>
+<FONT color="green">176</FONT>    <a name="line.176"></a>
+<FONT color="green">177</FONT>             return ret;<a name="line.177"></a>
+<FONT color="green">178</FONT>        }<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>        /**<a name="line.180"></a>
+<FONT color="green">181</FONT>         * Formats a double value as a fraction and appends the result to a StringBuffer.<a name="line.181"></a>
+<FONT color="green">182</FONT>         *<a name="line.182"></a>
+<FONT color="green">183</FONT>         * @param value the double value to format<a name="line.183"></a>
+<FONT color="green">184</FONT>         * @param buffer StringBuffer to append to<a name="line.184"></a>
+<FONT color="green">185</FONT>         * @param position On input: an alignment field, if desired. On output: the<a name="line.185"></a>
+<FONT color="green">186</FONT>         *            offsets of the alignment field<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @return a reference to the appended buffer<a name="line.187"></a>
+<FONT color="green">188</FONT>         * @see #format(Object, StringBuffer, FieldPosition)<a name="line.188"></a>
+<FONT color="green">189</FONT>         */<a name="line.189"></a>
+<FONT color="green">190</FONT>        @Override<a name="line.190"></a>
+<FONT color="green">191</FONT>        public StringBuffer format(final double value,<a name="line.191"></a>
+<FONT color="green">192</FONT>                                   final StringBuffer buffer, final FieldPosition position) {<a name="line.192"></a>
+<FONT color="green">193</FONT>            return format(Double.valueOf(value), buffer, position);<a name="line.193"></a>
+<FONT color="green">194</FONT>        }<a name="line.194"></a>
+<FONT color="green">195</FONT>    <a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>        /**<a name="line.197"></a>
+<FONT color="green">198</FONT>         * Formats a long value as a fraction and appends the result to a StringBuffer.<a name="line.198"></a>
+<FONT color="green">199</FONT>         *<a name="line.199"></a>
+<FONT color="green">200</FONT>         * @param value the long value to format<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @param buffer StringBuffer to append to<a name="line.201"></a>
+<FONT color="green">202</FONT>         * @param position On input: an alignment field, if desired. On output: the<a name="line.202"></a>
+<FONT color="green">203</FONT>         *            offsets of the alignment field<a name="line.203"></a>
+<FONT color="green">204</FONT>         * @return a reference to the appended buffer<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @see #format(Object, StringBuffer, FieldPosition)<a name="line.205"></a>
+<FONT color="green">206</FONT>         */<a name="line.206"></a>
+<FONT color="green">207</FONT>        @Override<a name="line.207"></a>
+<FONT color="green">208</FONT>        public StringBuffer format(final long value,<a name="line.208"></a>
+<FONT color="green">209</FONT>                                   final StringBuffer buffer, final FieldPosition position) {<a name="line.209"></a>
+<FONT color="green">210</FONT>            return format(Long.valueOf(value), buffer, position);<a name="line.210"></a>
+<FONT color="green">211</FONT>        }<a name="line.211"></a>
+<FONT color="green">212</FONT>    <a name="line.212"></a>
+<FONT color="green">213</FONT>    }<a name="line.213"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/BigFraction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,1201 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.fraction;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.math.BigDecimal;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.math.BigInteger;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.FieldElement;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    /**<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Representation of a rational number without any overflow. This class is<a name="line.28"></a>
+<FONT color="green">029</FONT>     * immutable.<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 906251 $ $Date: 2010-02-03 16:19:54 -0500 (Wed, 03 Feb 2010) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 2.0<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public class BigFraction<a name="line.34"></a>
+<FONT color="green">035</FONT>        extends Number<a name="line.35"></a>
+<FONT color="green">036</FONT>        implements FieldElement&lt;BigFraction&gt;, Comparable&lt;BigFraction&gt;, Serializable {<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** A fraction representing "2 / 1". */<a name="line.38"></a>
+<FONT color="green">039</FONT>        public static final BigFraction TWO = new BigFraction(2);<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** A fraction representing "1". */<a name="line.41"></a>
+<FONT color="green">042</FONT>        public static final BigFraction ONE = new BigFraction(1);<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** A fraction representing "0". */<a name="line.44"></a>
+<FONT color="green">045</FONT>        public static final BigFraction ZERO = new BigFraction(0);<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** A fraction representing "-1 / 1". */<a name="line.47"></a>
+<FONT color="green">048</FONT>        public static final BigFraction MINUS_ONE = new BigFraction(-1);<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** A fraction representing "4/5". */<a name="line.50"></a>
+<FONT color="green">051</FONT>        public static final BigFraction FOUR_FIFTHS = new BigFraction(4, 5);<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** A fraction representing "1/5". */<a name="line.53"></a>
+<FONT color="green">054</FONT>        public static final BigFraction ONE_FIFTH = new BigFraction(1, 5);<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** A fraction representing "1/2". */<a name="line.56"></a>
+<FONT color="green">057</FONT>        public static final BigFraction ONE_HALF = new BigFraction(1, 2);<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** A fraction representing "1/4". */<a name="line.59"></a>
+<FONT color="green">060</FONT>        public static final BigFraction ONE_QUARTER = new BigFraction(1, 4);<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** A fraction representing "1/3". */<a name="line.62"></a>
+<FONT color="green">063</FONT>        public static final BigFraction ONE_THIRD = new BigFraction(1, 3);<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** A fraction representing "3/5". */<a name="line.65"></a>
+<FONT color="green">066</FONT>        public static final BigFraction THREE_FIFTHS = new BigFraction(3, 5);<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /** A fraction representing "3/4". */<a name="line.68"></a>
+<FONT color="green">069</FONT>        public static final BigFraction THREE_QUARTERS = new BigFraction(3, 4);<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** A fraction representing "2/5". */<a name="line.71"></a>
+<FONT color="green">072</FONT>        public static final BigFraction TWO_FIFTHS = new BigFraction(2, 5);<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /** A fraction representing "2/4". */<a name="line.74"></a>
+<FONT color="green">075</FONT>        public static final BigFraction TWO_QUARTERS = new BigFraction(2, 4);<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** A fraction representing "2/3". */<a name="line.77"></a>
+<FONT color="green">078</FONT>        public static final BigFraction TWO_THIRDS = new BigFraction(2, 3);<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /** Serializable version identifier. */<a name="line.80"></a>
+<FONT color="green">081</FONT>        private static final long serialVersionUID = -5630213147331578515L;<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /** Message for zero denominator. */<a name="line.83"></a>
+<FONT color="green">084</FONT>        private static final String FORBIDDEN_ZERO_DENOMINATOR =<a name="line.84"></a>
+<FONT color="green">085</FONT>            "denominator must be different from 0";<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>        /** &lt;code&gt;BigInteger&lt;/code&gt; representation of 100. */<a name="line.87"></a>
+<FONT color="green">088</FONT>        private static final BigInteger ONE_HUNDRED_DOUBLE = BigInteger.valueOf(100);<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>        /** The numerator. */<a name="line.90"></a>
+<FONT color="green">091</FONT>        private final BigInteger numerator;<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /** The denominator. */<a name="line.93"></a>
+<FONT color="green">094</FONT>        private final BigInteger denominator;<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /**<a name="line.96"></a>
+<FONT color="green">097</FONT>         * &lt;p&gt;<a name="line.97"></a>
+<FONT color="green">098</FONT>         * Create a {@link BigFraction} equivalent to the passed &lt;tt&gt;BigInteger&lt;/tt&gt;, ie<a name="line.98"></a>
+<FONT color="green">099</FONT>         * "num / 1".<a name="line.99"></a>
+<FONT color="green">100</FONT>         * &lt;/p&gt;<a name="line.100"></a>
+<FONT color="green">101</FONT>         *<a name="line.101"></a>
+<FONT color="green">102</FONT>         * @param num<a name="line.102"></a>
+<FONT color="green">103</FONT>         *            the numerator.<a name="line.103"></a>
+<FONT color="green">104</FONT>         */<a name="line.104"></a>
+<FONT color="green">105</FONT>        public BigFraction(final BigInteger num) {<a name="line.105"></a>
+<FONT color="green">106</FONT>            this(num, BigInteger.ONE);<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /**<a name="line.109"></a>
+<FONT color="green">110</FONT>         * &lt;p&gt;<a name="line.110"></a>
+<FONT color="green">111</FONT>         * Create a {@link BigFraction} given the numerator and denominator as<a name="line.111"></a>
+<FONT color="green">112</FONT>         * &lt;code&gt;BigInteger&lt;/code&gt;. The {@link BigFraction} is reduced to lowest terms.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * &lt;/p&gt;<a name="line.113"></a>
+<FONT color="green">114</FONT>         *<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @param num<a name="line.115"></a>
+<FONT color="green">116</FONT>         *            the numerator, must not be &lt;code&gt;null&lt;/code&gt;.<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @param den<a name="line.117"></a>
+<FONT color="green">118</FONT>         *            the denominator, must not be &lt;code&gt;null&lt;/code&gt;.<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @throws ArithmeticException<a name="line.119"></a>
+<FONT color="green">120</FONT>         *             if the denominator is &lt;code&gt;zero&lt;/code&gt;.<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @throws NullPointerException<a name="line.121"></a>
+<FONT color="green">122</FONT>         *             if the numerator or the denominator is &lt;code&gt;zero&lt;/code&gt;.<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        public BigFraction(BigInteger num, BigInteger den) {<a name="line.124"></a>
+<FONT color="green">125</FONT>            if (num == null) {<a name="line.125"></a>
+<FONT color="green">126</FONT>                throw MathRuntimeException.createNullPointerException("numerator is null");<a name="line.126"></a>
+<FONT color="green">127</FONT>            }<a name="line.127"></a>
+<FONT color="green">128</FONT>            if (den == null) {<a name="line.128"></a>
+<FONT color="green">129</FONT>                throw MathRuntimeException.createNullPointerException("denominator is null");<a name="line.129"></a>
+<FONT color="green">130</FONT>            }<a name="line.130"></a>
+<FONT color="green">131</FONT>            if (BigInteger.ZERO.equals(den)) {<a name="line.131"></a>
+<FONT color="green">132</FONT>                throw MathRuntimeException.createArithmeticException(FORBIDDEN_ZERO_DENOMINATOR);<a name="line.132"></a>
+<FONT color="green">133</FONT>            }<a name="line.133"></a>
+<FONT color="green">134</FONT>            if (BigInteger.ZERO.equals(num)) {<a name="line.134"></a>
+<FONT color="green">135</FONT>                numerator   = BigInteger.ZERO;<a name="line.135"></a>
+<FONT color="green">136</FONT>                denominator = BigInteger.ONE;<a name="line.136"></a>
+<FONT color="green">137</FONT>            } else {<a name="line.137"></a>
+<FONT color="green">138</FONT>    <a name="line.138"></a>
+<FONT color="green">139</FONT>                // reduce numerator and denominator by greatest common denominator<a name="line.139"></a>
+<FONT color="green">140</FONT>                final BigInteger gcd = num.gcd(den);<a name="line.140"></a>
+<FONT color="green">141</FONT>                if (BigInteger.ONE.compareTo(gcd) &lt; 0) {<a name="line.141"></a>
+<FONT color="green">142</FONT>                    num = num.divide(gcd);<a name="line.142"></a>
+<FONT color="green">143</FONT>                    den = den.divide(gcd);<a name="line.143"></a>
+<FONT color="green">144</FONT>                }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>                // move sign to numerator<a name="line.146"></a>
+<FONT color="green">147</FONT>                if (BigInteger.ZERO.compareTo(den) &gt; 0) {<a name="line.147"></a>
+<FONT color="green">148</FONT>                    num = num.negate();<a name="line.148"></a>
+<FONT color="green">149</FONT>                    den = den.negate();<a name="line.149"></a>
+<FONT color="green">150</FONT>                }<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>                // store the values in the final fields<a name="line.152"></a>
+<FONT color="green">153</FONT>                numerator   = num;<a name="line.153"></a>
+<FONT color="green">154</FONT>                denominator = den;<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>            }<a name="line.156"></a>
+<FONT color="green">157</FONT>        }<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>        /**<a name="line.159"></a>
+<FONT color="green">160</FONT>         * Create a fraction given the double value.<a name="line.160"></a>
+<FONT color="green">161</FONT>         * &lt;p&gt;<a name="line.161"></a>
+<FONT color="green">162</FONT>         * This constructor behaves &lt;em&gt;differently&lt;/em&gt; from<a name="line.162"></a>
+<FONT color="green">163</FONT>         * {@link #BigFraction(double, double, int)}. It converts the<a name="line.163"></a>
+<FONT color="green">164</FONT>         * double value exactly, considering its internal bits representation.<a name="line.164"></a>
+<FONT color="green">165</FONT>         * This does work for all values except NaN and infinities and does<a name="line.165"></a>
+<FONT color="green">166</FONT>         * not requires any loop or convergence threshold.<a name="line.166"></a>
+<FONT color="green">167</FONT>         * &lt;/p&gt;<a name="line.167"></a>
+<FONT color="green">168</FONT>         * &lt;p&gt;<a name="line.168"></a>
+<FONT color="green">169</FONT>         * Since this conversion is exact and since double numbers are sometimes<a name="line.169"></a>
+<FONT color="green">170</FONT>         * approximated, the fraction created may seem strange in some cases. For example<a name="line.170"></a>
+<FONT color="green">171</FONT>         * calling &lt;code&gt;new BigFraction(1.0 / 3.0)&lt;/code&gt; does &lt;em&gt;not&lt;/em&gt; create<a name="line.171"></a>
+<FONT color="green">172</FONT>         * the fraction 1/3 but the fraction 6004799503160661 / 18014398509481984<a name="line.172"></a>
+<FONT color="green">173</FONT>         * because the double number passed to the constructor is not exactly 1/3<a name="line.173"></a>
+<FONT color="green">174</FONT>         * (this number cannot be stored exactly in IEEE754).<a name="line.174"></a>
+<FONT color="green">175</FONT>         * &lt;/p&gt;<a name="line.175"></a>
+<FONT color="green">176</FONT>         * @see #BigFraction(double, double, int)<a name="line.176"></a>
+<FONT color="green">177</FONT>         * @param value the double value to convert to a fraction.<a name="line.177"></a>
+<FONT color="green">178</FONT>         * @exception IllegalArgumentException if value is NaN or infinite<a name="line.178"></a>
+<FONT color="green">179</FONT>         */<a name="line.179"></a>
+<FONT color="green">180</FONT>        public BigFraction(final double value) throws IllegalArgumentException {<a name="line.180"></a>
+<FONT color="green">181</FONT>            if (Double.isNaN(value)) {<a name="line.181"></a>
+<FONT color="green">182</FONT>                throw MathRuntimeException.createIllegalArgumentException("cannot convert NaN value");<a name="line.182"></a>
+<FONT color="green">183</FONT>            }<a name="line.183"></a>
+<FONT color="green">184</FONT>            if (Double.isInfinite(value)) {<a name="line.184"></a>
+<FONT color="green">185</FONT>                throw MathRuntimeException.createIllegalArgumentException("cannot convert infinite value");<a name="line.185"></a>
+<FONT color="green">186</FONT>            }<a name="line.186"></a>
+<FONT color="green">187</FONT>    <a name="line.187"></a>
+<FONT color="green">188</FONT>            // compute m and k such that value = m * 2^k<a name="line.188"></a>
+<FONT color="green">189</FONT>            final long bits     = Double.doubleToLongBits(value);<a name="line.189"></a>
+<FONT color="green">190</FONT>            final long sign     = bits &amp; 0x8000000000000000L;<a name="line.190"></a>
+<FONT color="green">191</FONT>            final long exponent = bits &amp; 0x7ff0000000000000L;<a name="line.191"></a>
+<FONT color="green">192</FONT>            long m              = bits &amp; 0x000fffffffffffffL;<a name="line.192"></a>
+<FONT color="green">193</FONT>            if (exponent != 0) {<a name="line.193"></a>
+<FONT color="green">194</FONT>                // this was a normalized number, add the implicit most significant bit<a name="line.194"></a>
+<FONT color="green">195</FONT>                m |= 0x0010000000000000L;<a name="line.195"></a>
+<FONT color="green">196</FONT>            }<a name="line.196"></a>
+<FONT color="green">197</FONT>            if (sign != 0) {<a name="line.197"></a>
+<FONT color="green">198</FONT>                m = -m;<a name="line.198"></a>
+<FONT color="green">199</FONT>            }<a name="line.199"></a>
+<FONT color="green">200</FONT>            int k = ((int) (exponent &gt;&gt; 52)) - 1075;<a name="line.200"></a>
+<FONT color="green">201</FONT>            while (((m &amp; 0x001ffffffffffffeL) != 0) &amp;&amp; ((m &amp; 0x1) == 0)) {<a name="line.201"></a>
+<FONT color="green">202</FONT>                m = m &gt;&gt; 1;<a name="line.202"></a>
+<FONT color="green">203</FONT>                ++k;<a name="line.203"></a>
+<FONT color="green">204</FONT>            }<a name="line.204"></a>
+<FONT color="green">205</FONT>    <a name="line.205"></a>
+<FONT color="green">206</FONT>            if (k &lt; 0) {<a name="line.206"></a>
+<FONT color="green">207</FONT>                numerator   = BigInteger.valueOf(m);<a name="line.207"></a>
+<FONT color="green">208</FONT>                denominator = BigInteger.ZERO.flipBit(-k);<a name="line.208"></a>
+<FONT color="green">209</FONT>            } else {<a name="line.209"></a>
+<FONT color="green">210</FONT>                numerator   = BigInteger.valueOf(m).multiply(BigInteger.ZERO.flipBit(k));<a name="line.210"></a>
+<FONT color="green">211</FONT>                denominator = BigInteger.ONE;<a name="line.211"></a>
+<FONT color="green">212</FONT>            }<a name="line.212"></a>
+<FONT color="green">213</FONT>    <a name="line.213"></a>
+<FONT color="green">214</FONT>        }<a name="line.214"></a>
+<FONT color="green">215</FONT>    <a name="line.215"></a>
+<FONT color="green">216</FONT>        /**<a name="line.216"></a>
+<FONT color="green">217</FONT>         * Create a fraction given the double value and maximum error allowed.<a name="line.217"></a>
+<FONT color="green">218</FONT>         * &lt;p&gt;<a name="line.218"></a>
+<FONT color="green">219</FONT>         * References:<a name="line.219"></a>
+<FONT color="green">220</FONT>         * &lt;ul&gt;<a name="line.220"></a>
+<FONT color="green">221</FONT>         * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/ContinuedFraction.html"&gt;<a name="line.221"></a>
+<FONT color="green">222</FONT>         * Continued Fraction&lt;/a&gt; equations (11) and (22)-(26)&lt;/li&gt;<a name="line.222"></a>
+<FONT color="green">223</FONT>         * &lt;/ul&gt;<a name="line.223"></a>
+<FONT color="green">224</FONT>         * &lt;/p&gt;<a name="line.224"></a>
+<FONT color="green">225</FONT>         *<a name="line.225"></a>
+<FONT color="green">226</FONT>         * @param value<a name="line.226"></a>
+<FONT color="green">227</FONT>         *            the double value to convert to a fraction.<a name="line.227"></a>
+<FONT color="green">228</FONT>         * @param epsilon<a name="line.228"></a>
+<FONT color="green">229</FONT>         *            maximum error allowed. The resulting fraction is within<a name="line.229"></a>
+<FONT color="green">230</FONT>         *            &lt;code&gt;epsilon&lt;/code&gt; of &lt;code&gt;value&lt;/code&gt;, in absolute terms.<a name="line.230"></a>
+<FONT color="green">231</FONT>         * @param maxIterations<a name="line.231"></a>
+<FONT color="green">232</FONT>         *            maximum number of convergents.<a name="line.232"></a>
+<FONT color="green">233</FONT>         * @throws FractionConversionException<a name="line.233"></a>
+<FONT color="green">234</FONT>         *             if the continued fraction failed to converge.<a name="line.234"></a>
+<FONT color="green">235</FONT>         * @see #BigFraction(double)<a name="line.235"></a>
+<FONT color="green">236</FONT>         */<a name="line.236"></a>
+<FONT color="green">237</FONT>        public BigFraction(final double value, final double epsilon,<a name="line.237"></a>
+<FONT color="green">238</FONT>                           final int maxIterations)<a name="line.238"></a>
+<FONT color="green">239</FONT>            throws FractionConversionException {<a name="line.239"></a>
+<FONT color="green">240</FONT>            this(value, epsilon, Integer.MAX_VALUE, maxIterations);<a name="line.240"></a>
+<FONT color="green">241</FONT>        }<a name="line.241"></a>
+<FONT color="green">242</FONT>    <a name="line.242"></a>
+<FONT color="green">243</FONT>        /**<a name="line.243"></a>
+<FONT color="green">244</FONT>         * Create a fraction given the double value and either the maximum error<a name="line.244"></a>
+<FONT color="green">245</FONT>         * allowed or the maximum number of denominator digits.<a name="line.245"></a>
+<FONT color="green">246</FONT>         * &lt;p&gt;<a name="line.246"></a>
+<FONT color="green">247</FONT>         *<a name="line.247"></a>
+<FONT color="green">248</FONT>         * NOTE: This constructor is called with EITHER - a valid epsilon value and<a name="line.248"></a>
+<FONT color="green">249</FONT>         * the maxDenominator set to Integer.MAX_VALUE (that way the maxDenominator<a name="line.249"></a>
+<FONT color="green">250</FONT>         * has no effect). OR - a valid maxDenominator value and the epsilon value<a name="line.250"></a>
+<FONT color="green">251</FONT>         * set to zero (that way epsilon only has effect if there is an exact match<a name="line.251"></a>
+<FONT color="green">252</FONT>         * before the maxDenominator value is reached).<a name="line.252"></a>
+<FONT color="green">253</FONT>         * &lt;/p&gt;<a name="line.253"></a>
+<FONT color="green">254</FONT>         * &lt;p&gt;<a name="line.254"></a>
+<FONT color="green">255</FONT>         *<a name="line.255"></a>
+<FONT color="green">256</FONT>         * It has been done this way so that the same code can be (re)used for both<a name="line.256"></a>
+<FONT color="green">257</FONT>         * scenarios. However this could be confusing to users if it were part of<a name="line.257"></a>
+<FONT color="green">258</FONT>         * the public API and this constructor should therefore remain PRIVATE.<a name="line.258"></a>
+<FONT color="green">259</FONT>         * &lt;/p&gt;<a name="line.259"></a>
+<FONT color="green">260</FONT>         *<a name="line.260"></a>
+<FONT color="green">261</FONT>         * See JIRA issue ticket MATH-181 for more details:<a name="line.261"></a>
+<FONT color="green">262</FONT>         *<a name="line.262"></a>
+<FONT color="green">263</FONT>         * https://issues.apache.org/jira/browse/MATH-181<a name="line.263"></a>
+<FONT color="green">264</FONT>         *<a name="line.264"></a>
+<FONT color="green">265</FONT>         * @param value<a name="line.265"></a>
+<FONT color="green">266</FONT>         *            the double value to convert to a fraction.<a name="line.266"></a>
+<FONT color="green">267</FONT>         * @param epsilon<a name="line.267"></a>
+<FONT color="green">268</FONT>         *            maximum error allowed. The resulting fraction is within<a name="line.268"></a>
+<FONT color="green">269</FONT>         *            &lt;code&gt;epsilon&lt;/code&gt; of &lt;code&gt;value&lt;/code&gt;, in absolute terms.<a name="line.269"></a>
+<FONT color="green">270</FONT>         * @param maxDenominator<a name="line.270"></a>
+<FONT color="green">271</FONT>         *            maximum denominator value allowed.<a name="line.271"></a>
+<FONT color="green">272</FONT>         * @param maxIterations<a name="line.272"></a>
+<FONT color="green">273</FONT>         *            maximum number of convergents.<a name="line.273"></a>
+<FONT color="green">274</FONT>         * @throws FractionConversionException<a name="line.274"></a>
+<FONT color="green">275</FONT>         *             if the continued fraction failed to converge.<a name="line.275"></a>
+<FONT color="green">276</FONT>         */<a name="line.276"></a>
+<FONT color="green">277</FONT>        private BigFraction(final double value, final double epsilon,<a name="line.277"></a>
+<FONT color="green">278</FONT>                            final int maxDenominator, int maxIterations)<a name="line.278"></a>
+<FONT color="green">279</FONT>            throws FractionConversionException {<a name="line.279"></a>
+<FONT color="green">280</FONT>            long overflow = Integer.MAX_VALUE;<a name="line.280"></a>
+<FONT color="green">281</FONT>            double r0 = value;<a name="line.281"></a>
+<FONT color="green">282</FONT>            long a0 = (long) Math.floor(r0);<a name="line.282"></a>
+<FONT color="green">283</FONT>            if (a0 &gt; overflow) {<a name="line.283"></a>
+<FONT color="green">284</FONT>                throw new FractionConversionException(value, a0, 1l);<a name="line.284"></a>
+<FONT color="green">285</FONT>            }<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>            // check for (almost) integer arguments, which should not go<a name="line.287"></a>
+<FONT color="green">288</FONT>            // to iterations.<a name="line.288"></a>
+<FONT color="green">289</FONT>            if (Math.abs(a0 - value) &lt; epsilon) {<a name="line.289"></a>
+<FONT color="green">290</FONT>                numerator = BigInteger.valueOf(a0);<a name="line.290"></a>
+<FONT color="green">291</FONT>                denominator = BigInteger.ONE;<a name="line.291"></a>
+<FONT color="green">292</FONT>                return;<a name="line.292"></a>
+<FONT color="green">293</FONT>            }<a name="line.293"></a>
+<FONT color="green">294</FONT>    <a name="line.294"></a>
+<FONT color="green">295</FONT>            long p0 = 1;<a name="line.295"></a>
+<FONT color="green">296</FONT>            long q0 = 0;<a name="line.296"></a>
+<FONT color="green">297</FONT>            long p1 = a0;<a name="line.297"></a>
+<FONT color="green">298</FONT>            long q1 = 1;<a name="line.298"></a>
+<FONT color="green">299</FONT>    <a name="line.299"></a>
+<FONT color="green">300</FONT>            long p2 = 0;<a name="line.300"></a>
+<FONT color="green">301</FONT>            long q2 = 1;<a name="line.301"></a>
+<FONT color="green">302</FONT>    <a name="line.302"></a>
+<FONT color="green">303</FONT>            int n = 0;<a name="line.303"></a>
+<FONT color="green">304</FONT>            boolean stop = false;<a name="line.304"></a>
+<FONT color="green">305</FONT>            do {<a name="line.305"></a>
+<FONT color="green">306</FONT>                ++n;<a name="line.306"></a>
+<FONT color="green">307</FONT>                final double r1 = 1.0 / (r0 - a0);<a name="line.307"></a>
+<FONT color="green">308</FONT>                final long a1 = (long) Math.floor(r1);<a name="line.308"></a>
+<FONT color="green">309</FONT>                p2 = (a1 * p1) + p0;<a name="line.309"></a>
+<FONT color="green">310</FONT>                q2 = (a1 * q1) + q0;<a name="line.310"></a>
+<FONT color="green">311</FONT>                if ((p2 &gt; overflow) || (q2 &gt; overflow)) {<a name="line.311"></a>
+<FONT color="green">312</FONT>                    throw new FractionConversionException(value, p2, q2);<a name="line.312"></a>
+<FONT color="green">313</FONT>                }<a name="line.313"></a>
+<FONT color="green">314</FONT>    <a name="line.314"></a>
+<FONT color="green">315</FONT>                final double convergent = (double) p2 / (double) q2;<a name="line.315"></a>
+<FONT color="green">316</FONT>                if ((n &lt; maxIterations) &amp;&amp;<a name="line.316"></a>
+<FONT color="green">317</FONT>                    (Math.abs(convergent - value) &gt; epsilon) &amp;&amp;<a name="line.317"></a>
+<FONT color="green">318</FONT>                    (q2 &lt; maxDenominator)) {<a name="line.318"></a>
+<FONT color="green">319</FONT>                    p0 = p1;<a name="line.319"></a>
+<FONT color="green">320</FONT>                    p1 = p2;<a name="line.320"></a>
+<FONT color="green">321</FONT>                    q0 = q1;<a name="line.321"></a>
+<FONT color="green">322</FONT>                    q1 = q2;<a name="line.322"></a>
+<FONT color="green">323</FONT>                    a0 = a1;<a name="line.323"></a>
+<FONT color="green">324</FONT>                    r0 = r1;<a name="line.324"></a>
+<FONT color="green">325</FONT>                } else {<a name="line.325"></a>
+<FONT color="green">326</FONT>                    stop = true;<a name="line.326"></a>
+<FONT color="green">327</FONT>                }<a name="line.327"></a>
+<FONT color="green">328</FONT>            } while (!stop);<a name="line.328"></a>
+<FONT color="green">329</FONT>    <a name="line.329"></a>
+<FONT color="green">330</FONT>            if (n &gt;= maxIterations) {<a name="line.330"></a>
+<FONT color="green">331</FONT>                throw new FractionConversionException(value, maxIterations);<a name="line.331"></a>
+<FONT color="green">332</FONT>            }<a name="line.332"></a>
+<FONT color="green">333</FONT>    <a name="line.333"></a>
+<FONT color="green">334</FONT>            if (q2 &lt; maxDenominator) {<a name="line.334"></a>
+<FONT color="green">335</FONT>                numerator   = BigInteger.valueOf(p2);<a name="line.335"></a>
+<FONT color="green">336</FONT>                denominator = BigInteger.valueOf(q2);<a name="line.336"></a>
+<FONT color="green">337</FONT>            } else {<a name="line.337"></a>
+<FONT color="green">338</FONT>                numerator   = BigInteger.valueOf(p1);<a name="line.338"></a>
+<FONT color="green">339</FONT>                denominator = BigInteger.valueOf(q1);<a name="line.339"></a>
+<FONT color="green">340</FONT>            }<a name="line.340"></a>
+<FONT color="green">341</FONT>        }<a name="line.341"></a>
+<FONT color="green">342</FONT>    <a name="line.342"></a>
+<FONT color="green">343</FONT>        /**<a name="line.343"></a>
+<FONT color="green">344</FONT>         * Create a fraction given the double value and maximum denominator.<a name="line.344"></a>
+<FONT color="green">345</FONT>         * &lt;p&gt;<a name="line.345"></a>
+<FONT color="green">346</FONT>         * References:<a name="line.346"></a>
+<FONT color="green">347</FONT>         * &lt;ul&gt;<a name="line.347"></a>
+<FONT color="green">348</FONT>         * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/ContinuedFraction.html"&gt;<a name="line.348"></a>
+<FONT color="green">349</FONT>         * Continued Fraction&lt;/a&gt; equations (11) and (22)-(26)&lt;/li&gt;<a name="line.349"></a>
+<FONT color="green">350</FONT>         * &lt;/ul&gt;<a name="line.350"></a>
+<FONT color="green">351</FONT>         * &lt;/p&gt;<a name="line.351"></a>
+<FONT color="green">352</FONT>         *<a name="line.352"></a>
+<FONT color="green">353</FONT>         * @param value<a name="line.353"></a>
+<FONT color="green">354</FONT>         *            the double value to convert to a fraction.<a name="line.354"></a>
+<FONT color="green">355</FONT>         * @param maxDenominator<a name="line.355"></a>
+<FONT color="green">356</FONT>         *            The maximum allowed value for denominator.<a name="line.356"></a>
+<FONT color="green">357</FONT>         * @throws FractionConversionException<a name="line.357"></a>
+<FONT color="green">358</FONT>         *             if the continued fraction failed to converge.<a name="line.358"></a>
+<FONT color="green">359</FONT>         */<a name="line.359"></a>
+<FONT color="green">360</FONT>        public BigFraction(final double value, final int maxDenominator)<a name="line.360"></a>
+<FONT color="green">361</FONT>            throws FractionConversionException {<a name="line.361"></a>
+<FONT color="green">362</FONT>            this(value, 0, maxDenominator, 100);<a name="line.362"></a>
+<FONT color="green">363</FONT>        }<a name="line.363"></a>
+<FONT color="green">364</FONT>    <a name="line.364"></a>
+<FONT color="green">365</FONT>        /**<a name="line.365"></a>
+<FONT color="green">366</FONT>         * &lt;p&gt;<a name="line.366"></a>
+<FONT color="green">367</FONT>         * Create a {@link BigFraction} equivalent to the passed &lt;tt&gt;int&lt;/tt&gt;, ie<a name="line.367"></a>
+<FONT color="green">368</FONT>         * "num / 1".<a name="line.368"></a>
+<FONT color="green">369</FONT>         * &lt;/p&gt;<a name="line.369"></a>
+<FONT color="green">370</FONT>         *<a name="line.370"></a>
+<FONT color="green">371</FONT>         * @param num<a name="line.371"></a>
+<FONT color="green">372</FONT>         *            the numerator.<a name="line.372"></a>
+<FONT color="green">373</FONT>         */<a name="line.373"></a>
+<FONT color="green">374</FONT>        public BigFraction(final int num) {<a name="line.374"></a>
+<FONT color="green">375</FONT>            this(BigInteger.valueOf(num), BigInteger.ONE);<a name="line.375"></a>
+<FONT color="green">376</FONT>        }<a name="line.376"></a>
+<FONT color="green">377</FONT>    <a name="line.377"></a>
+<FONT color="green">378</FONT>        /**<a name="line.378"></a>
+<FONT color="green">379</FONT>         * &lt;p&gt;<a name="line.379"></a>
+<FONT color="green">380</FONT>         * Create a {@link BigFraction} given the numerator and denominator as simple<a name="line.380"></a>
+<FONT color="green">381</FONT>         * &lt;tt&gt;int&lt;/tt&gt;. The {@link BigFraction} is reduced to lowest terms.<a name="line.381"></a>
+<FONT color="green">382</FONT>         * &lt;/p&gt;<a name="line.382"></a>
+<FONT color="green">383</FONT>         *<a name="line.383"></a>
+<FONT color="green">384</FONT>         * @param num<a name="line.384"></a>
+<FONT color="green">385</FONT>         *            the numerator.<a name="line.385"></a>
+<FONT color="green">386</FONT>         * @param den<a name="line.386"></a>
+<FONT color="green">387</FONT>         *            the denominator.<a name="line.387"></a>
+<FONT color="green">388</FONT>         */<a name="line.388"></a>
+<FONT color="green">389</FONT>        public BigFraction(final int num, final int den) {<a name="line.389"></a>
+<FONT color="green">390</FONT>            this(BigInteger.valueOf(num), BigInteger.valueOf(den));<a name="line.390"></a>
+<FONT color="green">391</FONT>        }<a name="line.391"></a>
+<FONT color="green">392</FONT>    <a name="line.392"></a>
+<FONT color="green">393</FONT>        /**<a name="line.393"></a>
+<FONT color="green">394</FONT>         * &lt;p&gt;<a name="line.394"></a>
+<FONT color="green">395</FONT>         * Create a {@link BigFraction} equivalent to the passed long, ie "num / 1".<a name="line.395"></a>
+<FONT color="green">396</FONT>         * &lt;/p&gt;<a name="line.396"></a>
+<FONT color="green">397</FONT>         *<a name="line.397"></a>
+<FONT color="green">398</FONT>         * @param num<a name="line.398"></a>
+<FONT color="green">399</FONT>         *            the numerator.<a name="line.399"></a>
+<FONT color="green">400</FONT>         */<a name="line.400"></a>
+<FONT color="green">401</FONT>        public BigFraction(final long num) {<a name="line.401"></a>
+<FONT color="green">402</FONT>            this(BigInteger.valueOf(num), BigInteger.ONE);<a name="line.402"></a>
+<FONT color="green">403</FONT>        }<a name="line.403"></a>
+<FONT color="green">404</FONT>    <a name="line.404"></a>
+<FONT color="green">405</FONT>        /**<a name="line.405"></a>
+<FONT color="green">406</FONT>         * &lt;p&gt;<a name="line.406"></a>
+<FONT color="green">407</FONT>         * Create a {@link BigFraction} given the numerator and denominator as simple<a name="line.407"></a>
+<FONT color="green">408</FONT>         * &lt;tt&gt;long&lt;/tt&gt;. The {@link BigFraction} is reduced to lowest terms.<a name="line.408"></a>
+<FONT color="green">409</FONT>         * &lt;/p&gt;<a name="line.409"></a>
+<FONT color="green">410</FONT>         *<a name="line.410"></a>
+<FONT color="green">411</FONT>         * @param num<a name="line.411"></a>
+<FONT color="green">412</FONT>         *            the numerator.<a name="line.412"></a>
+<FONT color="green">413</FONT>         * @param den<a name="line.413"></a>
+<FONT color="green">414</FONT>         *            the denominator.<a name="line.414"></a>
+<FONT color="green">415</FONT>         */<a name="line.415"></a>
+<FONT color="green">416</FONT>        public BigFraction(final long num, final long den) {<a name="line.416"></a>
+<FONT color="green">417</FONT>            this(BigInteger.valueOf(num), BigInteger.valueOf(den));<a name="line.417"></a>
+<FONT color="green">418</FONT>        }<a name="line.418"></a>
+<FONT color="green">419</FONT>    <a name="line.419"></a>
+<FONT color="green">420</FONT>        /**<a name="line.420"></a>
+<FONT color="green">421</FONT>         * &lt;p&gt;<a name="line.421"></a>
+<FONT color="green">422</FONT>         * Creates a &lt;code&gt;BigFraction&lt;/code&gt; instance with the 2 parts of a fraction<a name="line.422"></a>
+<FONT color="green">423</FONT>         * Y/Z.<a name="line.423"></a>
+<FONT color="green">424</FONT>         * &lt;/p&gt;<a name="line.424"></a>
+<FONT color="green">425</FONT>         *<a name="line.425"></a>
+<FONT color="green">426</FONT>         * &lt;p&gt;<a name="line.426"></a>
+<FONT color="green">427</FONT>         * Any negative signs are resolved to be on the numerator.<a name="line.427"></a>
+<FONT color="green">428</FONT>         * &lt;/p&gt;<a name="line.428"></a>
+<FONT color="green">429</FONT>         *<a name="line.429"></a>
+<FONT color="green">430</FONT>         * @param numerator<a name="line.430"></a>
+<FONT color="green">431</FONT>         *            the numerator, for example the three in 'three sevenths'.<a name="line.431"></a>
+<FONT color="green">432</FONT>         * @param denominator<a name="line.432"></a>
+<FONT color="green">433</FONT>         *            the denominator, for example the seven in 'three sevenths'.<a name="line.433"></a>
+<FONT color="green">434</FONT>         * @return a new fraction instance, with the numerator and denominator<a name="line.434"></a>
+<FONT color="green">435</FONT>         *         reduced.<a name="line.435"></a>
+<FONT color="green">436</FONT>         * @throws ArithmeticException<a name="line.436"></a>
+<FONT color="green">437</FONT>         *             if the denominator is &lt;code&gt;zero&lt;/code&gt;.<a name="line.437"></a>
+<FONT color="green">438</FONT>         */<a name="line.438"></a>
+<FONT color="green">439</FONT>        public static BigFraction getReducedFraction(final int numerator,<a name="line.439"></a>
+<FONT color="green">440</FONT>                                                     final int denominator) {<a name="line.440"></a>
+<FONT color="green">441</FONT>            if (numerator == 0) {<a name="line.441"></a>
+<FONT color="green">442</FONT>                return ZERO; // normalize zero.<a name="line.442"></a>
+<FONT color="green">443</FONT>            }<a name="line.443"></a>
+<FONT color="green">444</FONT>    <a name="line.444"></a>
+<FONT color="green">445</FONT>            return new BigFraction(numerator, denominator);<a name="line.445"></a>
+<FONT color="green">446</FONT>        }<a name="line.446"></a>
+<FONT color="green">447</FONT>    <a name="line.447"></a>
+<FONT color="green">448</FONT>        /**<a name="line.448"></a>
+<FONT color="green">449</FONT>         * &lt;p&gt;<a name="line.449"></a>
+<FONT color="green">450</FONT>         * Returns the absolute value of this {@link BigFraction}.<a name="line.450"></a>
+<FONT color="green">451</FONT>         * &lt;/p&gt;<a name="line.451"></a>
+<FONT color="green">452</FONT>         *<a name="line.452"></a>
+<FONT color="green">453</FONT>         * @return the absolute value as a {@link BigFraction}.<a name="line.453"></a>
+<FONT color="green">454</FONT>         */<a name="line.454"></a>
+<FONT color="green">455</FONT>        public BigFraction abs() {<a name="line.455"></a>
+<FONT color="green">456</FONT>            return (BigInteger.ZERO.compareTo(numerator) &lt;= 0) ? this : negate();<a name="line.456"></a>
+<FONT color="green">457</FONT>        }<a name="line.457"></a>
+<FONT color="green">458</FONT>    <a name="line.458"></a>
+<FONT color="green">459</FONT>        /**<a name="line.459"></a>
+<FONT color="green">460</FONT>         * &lt;p&gt;<a name="line.460"></a>
+<FONT color="green">461</FONT>         * Adds the value of this fraction to the passed {@link BigInteger},<a name="line.461"></a>
+<FONT color="green">462</FONT>         * returning the result in reduced form.<a name="line.462"></a>
+<FONT color="green">463</FONT>         * &lt;/p&gt;<a name="line.463"></a>
+<FONT color="green">464</FONT>         *<a name="line.464"></a>
+<FONT color="green">465</FONT>         * @param bg<a name="line.465"></a>
+<FONT color="green">466</FONT>         *            the {@link BigInteger} to add, must'nt be &lt;code&gt;null&lt;/code&gt;.<a name="line.466"></a>
+<FONT color="green">467</FONT>         * @return a &lt;code&gt;BigFraction&lt;/code&gt; instance with the resulting values.<a name="line.467"></a>
+<FONT color="green">468</FONT>         * @throws NullPointerException<a name="line.468"></a>
+<FONT color="green">469</FONT>         *             if the {@link BigInteger} is &lt;code&gt;null&lt;/code&gt;.<a name="line.469"></a>
+<FONT color="green">470</FONT>         */<a name="line.470"></a>
+<FONT color="green">471</FONT>        public BigFraction add(final BigInteger bg) {<a name="line.471"></a>
+<FONT color="green">472</FONT>            return new BigFraction(numerator.add(denominator.multiply(bg)), denominator);<a name="line.472"></a>
+<FONT color="green">473</FONT>        }<a name="line.473"></a>
+<FONT color="green">474</FONT>    <a name="line.474"></a>
+<FONT color="green">475</FONT>        /**<a name="line.475"></a>
+<FONT color="green">476</FONT>         * &lt;p&gt;<a name="line.476"></a>
+<FONT color="green">477</FONT>         * Adds the value of this fraction to the passed &lt;tt&gt;integer&lt;/tt&gt;, returning<a name="line.477"></a>
+<FONT color="green">478</FONT>         * the result in reduced form.<a name="line.478"></a>
+<FONT color="green">479</FONT>         * &lt;/p&gt;<a name="line.479"></a>
+<FONT color="green">480</FONT>         *<a name="line.480"></a>
+<FONT color="green">481</FONT>         * @param i<a name="line.481"></a>
+<FONT color="green">482</FONT>         *            the &lt;tt&gt;integer&lt;/tt&gt; to add.<a name="line.482"></a>
+<FONT color="green">483</FONT>         * @return a &lt;code&gt;BigFraction&lt;/code&gt; instance with the resulting values.<a name="line.483"></a>
+<FONT color="green">484</FONT>         */<a name="line.484"></a>
+<FONT color="green">485</FONT>        public BigFraction add(final int i) {<a name="line.485"></a>
+<FONT color="green">486</FONT>            return add(BigInteger.valueOf(i));<a name="line.486"></a>
+<FONT color="green">487</FONT>        }<a name="line.487"></a>
+<FONT color="green">488</FONT>    <a name="line.488"></a>
+<FONT color="green">489</FONT>        /**<a name="line.489"></a>
+<FONT color="green">490</FONT>         * &lt;p&gt;<a name="line.490"></a>
+<FONT color="green">491</FONT>         * Adds the value of this fraction to the passed &lt;tt&gt;long&lt;/tt&gt;, returning<a name="line.491"></a>
+<FONT color="green">492</FONT>         * the result in reduced form.<a name="line.492"></a>
+<FONT color="green">493</FONT>         * &lt;/p&gt;<a name="line.493"></a>
+<FONT color="green">494</FONT>         *<a name="line.494"></a>
+<FONT color="green">495</FONT>         * @param l<a name="line.495"></a>
+<FONT color="green">496</FONT>         *            the &lt;tt&gt;long&lt;/tt&gt; to add.<a name="line.496"></a>
+<FONT color="green">497</FONT>         * @return a &lt;code&gt;BigFraction&lt;/code&gt; instance with the resulting values.<a name="line.497"></a>
+<FONT color="green">498</FONT>         */<a name="line.498"></a>
+<FONT color="green">499</FONT>        public BigFraction add(final long l) {<a name="line.499"></a>
+<FONT color="green">500</FONT>            return add(BigInteger.valueOf(l));<a name="line.500"></a>
+<FONT color="green">501</FONT>        }<a name="line.501"></a>
+<FONT color="green">502</FONT>    <a name="line.502"></a>
+<FONT color="green">503</FONT>        /**<a name="line.503"></a>
+<FONT color="green">504</FONT>         * &lt;p&gt;<a name="line.504"></a>
+<FONT color="green">505</FONT>         * Adds the value of this fraction to another, returning the result in<a name="line.505"></a>
+<FONT color="green">506</FONT>         * reduced form.<a name="line.506"></a>
+<FONT color="green">507</FONT>         * &lt;/p&gt;<a name="line.507"></a>
+<FONT color="green">508</FONT>         *<a name="line.508"></a>
+<FONT color="green">509</FONT>         * @param fraction<a name="line.509"></a>
+<FONT color="green">510</FONT>         *            the {@link BigFraction} to add, must not be &lt;code&gt;null&lt;/code&gt;.<a name="line.510"></a>
+<FONT color="green">511</FONT>         * @return a {@link BigFraction} instance with the resulting values.<a name="line.511"></a>
+<FONT color="green">512</FONT>         * @throws NullPointerException<a name="line.512"></a>
+<FONT color="green">513</FONT>         *             if the {@link BigFraction} is &lt;code&gt;null&lt;/code&gt;.<a name="line.513"></a>
+<FONT color="green">514</FONT>         */<a name="line.514"></a>
+<FONT color="green">515</FONT>        public BigFraction add(final BigFraction fraction) {<a name="line.515"></a>
+<FONT color="green">516</FONT>            if (ZERO.equals(fraction)) {<a name="line.516"></a>
+<FONT color="green">517</FONT>                return this;<a name="line.517"></a>
+<FONT color="green">518</FONT>            }<a name="line.518"></a>
+<FONT color="green">519</FONT>    <a name="line.519"></a>
+<FONT color="green">520</FONT>            BigInteger num = null;<a name="line.520"></a>
+<FONT color="green">521</FONT>            BigInteger den = null;<a name="line.521"></a>
+<FONT color="green">522</FONT>    <a name="line.522"></a>
+<FONT color="green">523</FONT>            if (denominator.equals(fraction.denominator)) {<a name="line.523"></a>
+<FONT color="green">524</FONT>                num = numerator.add(fraction.numerator);<a name="line.524"></a>
+<FONT color="green">525</FONT>                den = denominator;<a name="line.525"></a>
+<FONT color="green">526</FONT>            } else {<a name="line.526"></a>
+<FONT color="green">527</FONT>                num = (numerator.multiply(fraction.denominator)).add((fraction.numerator).multiply(denominator));<a name="line.527"></a>
+<FONT color="green">528</FONT>                den = denominator.multiply(fraction.denominator);<a name="line.528"></a>
+<FONT color="green">529</FONT>            }<a name="line.529"></a>
+<FONT color="green">530</FONT>            return new BigFraction(num, den);<a name="line.530"></a>
+<FONT color="green">531</FONT>    <a name="line.531"></a>
+<FONT color="green">532</FONT>        }<a name="line.532"></a>
+<FONT color="green">533</FONT>    <a name="line.533"></a>
+<FONT color="green">534</FONT>        /**<a name="line.534"></a>
+<FONT color="green">535</FONT>         * &lt;p&gt;<a name="line.535"></a>
+<FONT color="green">536</FONT>         * Gets the fraction as a &lt;code&gt;BigDecimal&lt;/code&gt;. This calculates the<a name="line.536"></a>
+<FONT color="green">537</FONT>         * fraction as the numerator divided by denominator.<a name="line.537"></a>
+<FONT color="green">538</FONT>         * &lt;/p&gt;<a name="line.538"></a>
+<FONT color="green">539</FONT>         *<a name="line.539"></a>
+<FONT color="green">540</FONT>         * @return the fraction as a &lt;code&gt;BigDecimal&lt;/code&gt;.<a name="line.540"></a>
+<FONT color="green">541</FONT>         * @throws ArithmeticException<a name="line.541"></a>
+<FONT color="green">542</FONT>         *             if the exact quotient does not have a terminating decimal<a name="line.542"></a>
+<FONT color="green">543</FONT>         *             expansion.<a name="line.543"></a>
+<FONT color="green">544</FONT>         * @see BigDecimal<a name="line.544"></a>
+<FONT color="green">545</FONT>         */<a name="line.545"></a>
+<FONT color="green">546</FONT>        public BigDecimal bigDecimalValue() {<a name="line.546"></a>
+<FONT color="green">547</FONT>            return new BigDecimal(numerator).divide(new BigDecimal(denominator));<a name="line.547"></a>
+<FONT color="green">548</FONT>        }<a name="line.548"></a>
+<FONT color="green">549</FONT>    <a name="line.549"></a>
+<FONT color="green">550</FONT>        /**<a name="line.550"></a>
+<FONT color="green">551</FONT>         * &lt;p&gt;<a name="line.551"></a>
+<FONT color="green">552</FONT>         * Gets the fraction as a &lt;code&gt;BigDecimal&lt;/code&gt; following the passed<a name="line.552"></a>
+<FONT color="green">553</FONT>         * rounding mode. This calculates the fraction as the numerator divided by<a name="line.553"></a>
+<FONT color="green">554</FONT>         * denominator.<a name="line.554"></a>
+<FONT color="green">555</FONT>         * &lt;/p&gt;<a name="line.555"></a>
+<FONT color="green">556</FONT>         *<a name="line.556"></a>
+<FONT color="green">557</FONT>         * @param roundingMode<a name="line.557"></a>
+<FONT color="green">558</FONT>         *            rounding mode to apply. see {@link BigDecimal} constants.<a name="line.558"></a>
+<FONT color="green">559</FONT>         * @return the fraction as a &lt;code&gt;BigDecimal&lt;/code&gt;.<a name="line.559"></a>
+<FONT color="green">560</FONT>         * @throws IllegalArgumentException<a name="line.560"></a>
+<FONT color="green">561</FONT>         *             if &lt;tt&gt;roundingMode&lt;/tt&gt; does not represent a valid rounding<a name="line.561"></a>
+<FONT color="green">562</FONT>         *             mode.<a name="line.562"></a>
+<FONT color="green">563</FONT>         * @see BigDecimal<a name="line.563"></a>
+<FONT color="green">564</FONT>         */<a name="line.564"></a>
+<FONT color="green">565</FONT>        public BigDecimal bigDecimalValue(final int roundingMode) {<a name="line.565"></a>
+<FONT color="green">566</FONT>            return new BigDecimal(numerator).divide(new BigDecimal(denominator), roundingMode);<a name="line.566"></a>
+<FONT color="green">567</FONT>        }<a name="line.567"></a>
+<FONT color="green">568</FONT>    <a name="line.568"></a>
+<FONT color="green">569</FONT>        /**<a name="line.569"></a>
+<FONT color="green">570</FONT>         * &lt;p&gt;<a name="line.570"></a>
+<FONT color="green">571</FONT>         * Gets the fraction as a &lt;code&gt;BigDecimal&lt;/code&gt; following the passed scale<a name="line.571"></a>
+<FONT color="green">572</FONT>         * and rounding mode. This calculates the fraction as the numerator divided<a name="line.572"></a>
+<FONT color="green">573</FONT>         * by denominator.<a name="line.573"></a>
+<FONT color="green">574</FONT>         * &lt;/p&gt;<a name="line.574"></a>
+<FONT color="green">575</FONT>         *<a name="line.575"></a>
+<FONT color="green">576</FONT>         * @param scale<a name="line.576"></a>
+<FONT color="green">577</FONT>         *            scale of the &lt;code&gt;BigDecimal&lt;/code&gt; quotient to be returned.<a name="line.577"></a>
+<FONT color="green">578</FONT>         *            see {@link BigDecimal} for more information.<a name="line.578"></a>
+<FONT color="green">579</FONT>         * @param roundingMode<a name="line.579"></a>
+<FONT color="green">580</FONT>         *            rounding mode to apply. see {@link BigDecimal} constants.<a name="line.580"></a>
+<FONT color="green">581</FONT>         * @return the fraction as a &lt;code&gt;BigDecimal&lt;/code&gt;.<a name="line.581"></a>
+<FONT color="green">582</FONT>         * @see BigDecimal<a name="line.582"></a>
+<FONT color="green">583</FONT>         */<a name="line.583"></a>
+<FONT color="green">584</FONT>        public BigDecimal bigDecimalValue(final int scale, final int roundingMode) {<a name="line.584"></a>
+<FONT color="green">585</FONT>            return new BigDecimal(numerator).divide(new BigDecimal(denominator), scale, roundingMode);<a name="line.585"></a>
+<FONT color="green">586</FONT>        }<a name="line.586"></a>
+<FONT color="green">587</FONT>    <a name="line.587"></a>
+<FONT color="green">588</FONT>        /**<a name="line.588"></a>
+<FONT color="green">589</FONT>         * &lt;p&gt;<a name="line.589"></a>
+<FONT color="green">590</FONT>         * Compares this object to another based on size.<a name="line.590"></a>
+<FONT color="green">591</FONT>         * &lt;/p&gt;<a name="line.591"></a>
+<FONT color="green">592</FONT>         *<a name="line.592"></a>
+<FONT color="green">593</FONT>         * @param object<a name="line.593"></a>
+<FONT color="green">594</FONT>         *            the object to compare to, must not be &lt;code&gt;null&lt;/code&gt;.<a name="line.594"></a>
+<FONT color="green">595</FONT>         * @return -1 if this is less than &lt;tt&gt;object&lt;/tt&gt;, +1 if this is greater<a name="line.595"></a>
+<FONT color="green">596</FONT>         *         than &lt;tt&gt;object&lt;/tt&gt;, 0 if they are equal.<a name="line.596"></a>
+<FONT color="green">597</FONT>         * @see java.lang.Comparable#compareTo(java.lang.Object)<a name="line.597"></a>
+<FONT color="green">598</FONT>         */<a name="line.598"></a>
+<FONT color="green">599</FONT>        public int compareTo(final BigFraction object) {<a name="line.599"></a>
+<FONT color="green">600</FONT>            BigInteger nOd = numerator.multiply(object.denominator);<a name="line.600"></a>
+<FONT color="green">601</FONT>            BigInteger dOn = denominator.multiply(object.numerator);<a name="line.601"></a>
+<FONT color="green">602</FONT>            return nOd.compareTo(dOn);<a name="line.602"></a>
+<FONT color="green">603</FONT>        }<a name="line.603"></a>
+<FONT color="green">604</FONT>    <a name="line.604"></a>
+<FONT color="green">605</FONT>        /**<a name="line.605"></a>
+<FONT color="green">606</FONT>         * &lt;p&gt;<a name="line.606"></a>
+<FONT color="green">607</FONT>         * Divide the value of this fraction by the passed &lt;code&gt;BigInteger&lt;/code&gt;,<a name="line.607"></a>
+<FONT color="green">608</FONT>         * ie "this * 1 / bg", returning the result in reduced form.<a name="line.608"></a>
+<FONT color="green">609</FONT>         * &lt;/p&gt;<a name="line.609"></a>
+<FONT color="green">610</FONT>         *<a name="line.610"></a>
+<FONT color="green">611</FONT>         * @param bg<a name="line.611"></a>
+<FONT color="green">612</FONT>         *            the &lt;code&gt;BigInteger&lt;/code&gt; to divide by, must not be<a name="line.612"></a>
+<FONT color="green">613</FONT>         *            &lt;code&gt;null&lt;/code&gt;.<a name="line.613"></a>
+<FONT color="green">614</FONT>         * @return a {@link BigFraction} instance with the resulting values.<a name="line.614"></a>
+<FONT color="green">615</FONT>         * @throws NullPointerException<a name="line.615"></a>
+<FONT color="green">616</FONT>         *             if the &lt;code&gt;BigInteger&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt;.<a name="line.616"></a>
+<FONT color="green">617</FONT>         * @throws ArithmeticException<a name="line.617"></a>
+<FONT color="green">618</FONT>         *             if the fraction to divide by is zero.<a name="line.618"></a>
+<FONT color="green">619</FONT>         */<a name="line.619"></a>
+<FONT color="green">620</FONT>        public BigFraction divide(final BigInteger bg) {<a name="line.620"></a>
+<FONT color="green">621</FONT>            if (BigInteger.ZERO.equals(bg)) {<a name="line.621"></a>
+<FONT color="green">622</FONT>                throw MathRuntimeException.createArithmeticException(FORBIDDEN_ZERO_DENOMINATOR);<a name="line.622"></a>
+<FONT color="green">623</FONT>            }<a name="line.623"></a>
+<FONT color="green">624</FONT>            return new BigFraction(numerator, denominator.multiply(bg));<a name="line.624"></a>
+<FONT color="green">625</FONT>        }<a name="line.625"></a>
+<FONT color="green">626</FONT>    <a name="line.626"></a>
+<FONT color="green">627</FONT>        /**<a name="line.627"></a>
+<FONT color="green">628</FONT>         * &lt;p&gt;<a name="line.628"></a>
+<FONT color="green">629</FONT>         * Divide the value of this fraction by the passed &lt;tt&gt;int&lt;/tt&gt;, ie<a name="line.629"></a>
+<FONT color="green">630</FONT>         * "this * 1 / i", returning the result in reduced form.<a name="line.630"></a>
+<FONT color="green">631</FONT>         * &lt;/p&gt;<a name="line.631"></a>
+<FONT color="green">632</FONT>         *<a name="line.632"></a>
+<FONT color="green">633</FONT>         * @param i<a name="line.633"></a>
+<FONT color="green">634</FONT>         *            the &lt;tt&gt;int&lt;/tt&gt; to divide by.<a name="line.634"></a>
+<FONT color="green">635</FONT>         * @return a {@link BigFraction} instance with the resulting values.<a name="line.635"></a>
+<FONT color="green">636</FONT>         * @throws ArithmeticException<a name="line.636"></a>
+<FONT color="green">637</FONT>         *             if the fraction to divide by is zero.<a name="line.637"></a>
+<FONT color="green">638</FONT>         */<a name="line.638"></a>
+<FONT color="green">639</FONT>        public BigFraction divide(final int i) {<a name="line.639"></a>
+<FONT color="green">640</FONT>            return divide(BigInteger.valueOf(i));<a name="line.640"></a>
+<FONT color="green">641</FONT>        }<a name="line.641"></a>
+<FONT color="green">642</FONT>    <a name="line.642"></a>
+<FONT color="green">643</FONT>        /**<a name="line.643"></a>
+<FONT color="green">644</FONT>         * &lt;p&gt;<a name="line.644"></a>
+<FONT color="green">645</FONT>         * Divide the value of this fraction by the passed &lt;tt&gt;long&lt;/tt&gt;, ie<a name="line.645"></a>
+<FONT color="green">646</FONT>         * "this * 1 / l", returning the result in reduced form.<a name="line.646"></a>
+<FONT color="green">647</FONT>         * &lt;/p&gt;<a name="line.647"></a>
+<FONT color="green">648</FONT>         *<a name="line.648"></a>
+<FONT color="green">649</FONT>         * @param l<a name="line.649"></a>
+<FONT color="green">650</FONT>         *            the &lt;tt&gt;long&lt;/tt&gt; to divide by.<a name="line.650"></a>
+<FONT color="green">651</FONT>         * @return a {@link BigFraction} instance with the resulting values.<a name="line.651"></a>
+<FONT color="green">652</FONT>         * @throws ArithmeticException<a name="line.652"></a>
+<FONT color="green">653</FONT>         *             if the fraction to divide by is zero.<a name="line.653"></a>
+<FONT color="green">654</FONT>         */<a name="line.654"></a>
+<FONT color="green">655</FONT>        public BigFraction divide(final long l) {<a name="line.655"></a>
+<FONT color="green">656</FONT>            return divide(BigInteger.valueOf(l));<a name="line.656"></a>
+<FONT color="green">657</FONT>        }<a name="line.657"></a>
+<FONT color="green">658</FONT>    <a name="line.658"></a>
+<FONT color="green">659</FONT>        /**<a name="line.659"></a>
+<FONT color="green">660</FONT>         * &lt;p&gt;<a name="line.660"></a>
+<FONT color="green">661</FONT>         * Divide the value of this fraction by another, returning the result in<a name="line.661"></a>
+<FONT color="green">662</FONT>         * reduced form.<a name="line.662"></a>
+<FONT color="green">663</FONT>         * &lt;/p&gt;<a name="line.663"></a>
+<FONT color="green">664</FONT>         *<a name="line.664"></a>
+<FONT color="green">665</FONT>         * @param fraction<a name="line.665"></a>
+<FONT color="green">666</FONT>         *            the fraction to divide by, must not be &lt;code&gt;null&lt;/code&gt;.<a name="line.666"></a>
+<FONT color="green">667</FONT>         * @return a {@link BigFraction} instance with the resulting values.<a name="line.667"></a>
+<FONT color="green">668</FONT>         * @throws NullPointerException<a name="line.668"></a>
+<FONT color="green">669</FONT>         *             if the fraction is &lt;code&gt;null&lt;/code&gt;.<a name="line.669"></a>
+<FONT color="green">670</FONT>         * @throws ArithmeticException<a name="line.670"></a>
+<FONT color="green">671</FONT>         *             if the fraction to divide by is zero.<a name="line.671"></a>
+<FONT color="green">672</FONT>         */<a name="line.672"></a>
+<FONT color="green">673</FONT>        public BigFraction divide(final BigFraction fraction) {<a name="line.673"></a>
+<FONT color="green">674</FONT>            if (BigInteger.ZERO.equals(fraction.numerator)) {<a name="line.674"></a>
+<FONT color="green">675</FONT>                throw MathRuntimeException.createArithmeticException(FORBIDDEN_ZERO_DENOMINATOR);<a name="line.675"></a>
+<FONT color="green">676</FONT>            }<a name="line.676"></a>
+<FONT color="green">677</FONT>    <a name="line.677"></a>
+<FONT color="green">678</FONT>            return multiply(fraction.reciprocal());<a name="line.678"></a>
+<FONT color="green">679</FONT>        }<a name="line.679"></a>
+<FONT color="green">680</FONT>    <a name="line.680"></a>
+<FONT color="green">681</FONT>        /**<a name="line.681"></a>
+<FONT color="green">682</FONT>         * &lt;p&gt;<a name="line.682"></a>
+<FONT color="green">683</FONT>         * Gets the fraction as a &lt;tt&gt;double&lt;/tt&gt;. This calculates the fraction as<a name="line.683"></a>
+<FONT color="green">684</FONT>         * the numerator divided by denominator.<a name="line.684"></a>
+<FONT color="green">685</FONT>         * &lt;/p&gt;<a name="line.685"></a>
+<FONT color="green">686</FONT>         *<a name="line.686"></a>
+<FONT color="green">687</FONT>         * @return the fraction as a &lt;tt&gt;double&lt;/tt&gt;<a name="line.687"></a>
+<FONT color="green">688</FONT>         * @see java.lang.Number#doubleValue()<a name="line.688"></a>
+<FONT color="green">689</FONT>         */<a name="line.689"></a>
+<FONT color="green">690</FONT>        @Override<a name="line.690"></a>
+<FONT color="green">691</FONT>        public double doubleValue() {<a name="line.691"></a>
+<FONT color="green">692</FONT>            return numerator.doubleValue() / denominator.doubleValue();<a name="line.692"></a>
+<FONT color="green">693</FONT>        }<a name="line.693"></a>
+<FONT color="green">694</FONT>    <a name="line.694"></a>
+<FONT color="green">695</FONT>        /**<a name="line.695"></a>
+<FONT color="green">696</FONT>         * &lt;p&gt;<a name="line.696"></a>
+<FONT color="green">697</FONT>         * Test for the equality of two fractions. If the lowest term numerator and<a name="line.697"></a>
+<FONT color="green">698</FONT>         * denominators are the same for both fractions, the two fractions are<a name="line.698"></a>
+<FONT color="green">699</FONT>         * considered to be equal.<a name="line.699"></a>
+<FONT color="green">700</FONT>         * &lt;/p&gt;<a name="line.700"></a>
+<FONT color="green">701</FONT>         *<a name="line.701"></a>
+<FONT color="green">702</FONT>         * @param other<a name="line.702"></a>
+<FONT color="green">703</FONT>         *            fraction to test for equality to this fraction, can be<a name="line.703"></a>
+<FONT color="green">704</FONT>         *            &lt;code&gt;null&lt;/code&gt;.<a name="line.704"></a>
+<FONT color="green">705</FONT>         * @return true if two fractions are equal, false if object is<a name="line.705"></a>
+<FONT color="green">706</FONT>         *         &lt;code&gt;null&lt;/code&gt;, not an instance of {@link BigFraction}, or not<a name="line.706"></a>
+<FONT color="green">707</FONT>         *         equal to this fraction instance.<a name="line.707"></a>
+<FONT color="green">708</FONT>         * @see java.lang.Object#equals(java.lang.Object)<a name="line.708"></a>
+<FONT color="green">709</FONT>         */<a name="line.709"></a>
+<FONT color="green">710</FONT>        @Override<a name="line.710"></a>
+<FONT color="green">711</FONT>        public boolean equals(final Object other) {<a name="line.711"></a>
+<FONT color="green">712</FONT>            boolean ret = false;<a name="line.712"></a>
+<FONT color="green">713</FONT>    <a name="line.713"></a>
+<FONT color="green">714</FONT>            if (this == other) {<a name="line.714"></a>
+<FONT color="green">715</FONT>                ret = true;<a name="line.715"></a>
+<FONT color="green">716</FONT>            } else if (other instanceof BigFraction) {<a name="line.716"></a>
+<FONT color="green">717</FONT>                BigFraction rhs = ((BigFraction) other).reduce();<a name="line.717"></a>
+<FONT color="green">718</FONT>                BigFraction thisOne = this.reduce();<a name="line.718"></a>
+<FONT color="green">719</FONT>                ret = thisOne.numerator.equals(rhs.numerator) &amp;&amp; thisOne.denominator.equals(rhs.denominator);<a name="line.719"></a>
+<FONT color="green">720</FONT>            }<a name="line.720"></a>
+<FONT color="green">721</FONT>    <a name="line.721"></a>
+<FONT color="green">722</FONT>            return ret;<a name="line.722"></a>
+<FONT color="green">723</FONT>        }<a name="line.723"></a>
+<FONT color="green">724</FONT>    <a name="line.724"></a>
+<FONT color="green">725</FONT>        /**<a name="line.725"></a>
+<FONT color="green">726</FONT>         * &lt;p&gt;<a name="line.726"></a>
+<FONT color="green">727</FONT>         * Gets the fraction as a &lt;tt&gt;float&lt;/tt&gt;. This calculates the fraction as<a name="line.727"></a>
+<FONT color="green">728</FONT>         * the numerator divided by denominator.<a name="line.728"></a>
+<FONT color="green">729</FONT>         * &lt;/p&gt;<a name="line.729"></a>
+<FONT color="green">730</FONT>         *<a name="line.730"></a>
+<FONT color="green">731</FONT>         * @return the fraction as a &lt;tt&gt;float&lt;/tt&gt;.<a name="line.731"></a>
+<FONT color="green">732</FONT>         * @see java.lang.Number#floatValue()<a name="line.732"></a>
+<FONT color="green">733</FONT>         */<a name="line.733"></a>
+<FONT color="green">734</FONT>        @Override<a name="line.734"></a>
+<FONT color="green">735</FONT>        public float floatValue() {<a name="line.735"></a>
+<FONT color="green">736</FONT>            return numerator.floatValue() / denominator.floatValue();<a name="line.736"></a>
+<FONT color="green">737</FONT>        }<a name="line.737"></a>
+<FONT color="green">738</FONT>    <a name="line.738"></a>
+<FONT color="green">739</FONT>        /**<a name="line.739"></a>
+<FONT color="green">740</FONT>         * &lt;p&gt;<a name="line.740"></a>
+<FONT color="green">741</FONT>         * Access the denominator as a &lt;code&gt;BigInteger&lt;/code&gt;.<a name="line.741"></a>
+<FONT color="green">742</FONT>         * &lt;/p&gt;<a name="line.742"></a>
+<FONT color="green">743</FONT>         *<a name="line.743"></a>
+<FONT color="green">744</FONT>         * @return the denominator as a &lt;code&gt;BigInteger&lt;/code&gt;.<a name="line.744"></a>
+<FONT color="green">745</FONT>         */<a name="line.745"></a>
+<FONT color="green">746</FONT>        public BigInteger getDenominator() {<a name="line.746"></a>
+<FONT color="green">747</FONT>            return denominator;<a name="line.747"></a>
+<FONT color="green">748</FONT>        }<a name="line.748"></a>
+<FONT color="green">749</FONT>    <a name="line.749"></a>
+<FONT color="green">750</FONT>        /**<a name="line.750"></a>
+<FONT color="green">751</FONT>         * &lt;p&gt;<a name="line.751"></a>
+<FONT color="green">752</FONT>         * Access the denominator as a &lt;tt&gt;int&lt;/tt&gt;.<a name="line.752"></a>
+<FONT color="green">753</FONT>         * &lt;/p&gt;<a name="line.753"></a>
+<FONT color="green">754</FONT>         *<a name="line.754"></a>
+<FONT color="green">755</FONT>         * @return the denominator as a &lt;tt&gt;int&lt;/tt&gt;.<a name="line.755"></a>
+<FONT color="green">756</FONT>         */<a name="line.756"></a>
+<FONT color="green">757</FONT>        public int getDenominatorAsInt() {<a name="line.757"></a>
+<FONT color="green">758</FONT>            return denominator.intValue();<a name="line.758"></a>
+<FONT color="green">759</FONT>        }<a name="line.759"></a>
+<FONT color="green">760</FONT>    <a name="line.760"></a>
+<FONT color="green">761</FONT>        /**<a name="line.761"></a>
+<FONT color="green">762</FONT>         * &lt;p&gt;<a name="line.762"></a>
+<FONT color="green">763</FONT>         * Access the denominator as a &lt;tt&gt;long&lt;/tt&gt;.<a name="line.763"></a>
+<FONT color="green">764</FONT>         * &lt;/p&gt;<a name="line.764"></a>
+<FONT color="green">765</FONT>         *<a name="line.765"></a>
+<FONT color="green">766</FONT>         * @return the denominator as a &lt;tt&gt;long&lt;/tt&gt;.<a name="line.766"></a>
+<FONT color="green">767</FONT>         */<a name="line.767"></a>
+<FONT color="green">768</FONT>        public long getDenominatorAsLong() {<a name="line.768"></a>
+<FONT color="green">769</FONT>            return denominator.longValue();<a name="line.769"></a>
+<FONT color="green">770</FONT>        }<a name="line.770"></a>
+<FONT color="green">771</FONT>    <a name="line.771"></a>
+<FONT color="green">772</FONT>        /**<a name="line.772"></a>
+<FONT color="green">773</FONT>         * &lt;p&gt;<a name="line.773"></a>
+<FONT color="green">774</FONT>         * Access the numerator as a &lt;code&gt;BigInteger&lt;/code&gt;.<a name="line.774"></a>
+<FONT color="green">775</FONT>         * &lt;/p&gt;<a name="line.775"></a>
+<FONT color="green">776</FONT>         *<a name="line.776"></a>
+<FONT color="green">777</FONT>         * @return the numerator as a &lt;code&gt;BigInteger&lt;/code&gt;.<a name="line.777"></a>
+<FONT color="green">778</FONT>         */<a name="line.778"></a>
+<FONT color="green">779</FONT>        public BigInteger getNumerator() {<a name="line.779"></a>
+<FONT color="green">780</FONT>            return numerator;<a name="line.780"></a>
+<FONT color="green">781</FONT>        }<a name="line.781"></a>
+<FONT color="green">782</FONT>    <a name="line.782"></a>
+<FONT color="green">783</FONT>        /**<a name="line.783"></a>
+<FONT color="green">784</FONT>         * &lt;p&gt;<a name="line.784"></a>
+<FONT color="green">785</FONT>         * Access the numerator as a &lt;tt&gt;int&lt;/tt&gt;.<a name="line.785"></a>
+<FONT color="green">786</FONT>         * &lt;/p&gt;<a name="line.786"></a>
+<FONT color="green">787</FONT>         *<a name="line.787"></a>
+<FONT color="green">788</FONT>         * @return the numerator as a &lt;tt&gt;int&lt;/tt&gt;.<a name="line.788"></a>
+<FONT color="green">789</FONT>         */<a name="line.789"></a>
+<FONT color="green">790</FONT>        public int getNumeratorAsInt() {<a name="line.790"></a>
+<FONT color="green">791</FONT>            return numerator.intValue();<a name="line.791"></a>
+<FONT color="green">792</FONT>        }<a name="line.792"></a>
+<FONT color="green">793</FONT>    <a name="line.793"></a>
+<FONT color="green">794</FONT>        /**<a name="line.794"></a>
+<FONT color="green">795</FONT>         * &lt;p&gt;<a name="line.795"></a>
+<FONT color="green">796</FONT>         * Access the numerator as a &lt;tt&gt;long&lt;/tt&gt;.<a name="line.796"></a>
+<FONT color="green">797</FONT>         * &lt;/p&gt;<a name="line.797"></a>
+<FONT color="green">798</FONT>         *<a name="line.798"></a>
+<FONT color="green">799</FONT>         * @return the numerator as a &lt;tt&gt;long&lt;/tt&gt;.<a name="line.799"></a>
+<FONT color="green">800</FONT>         */<a name="line.800"></a>
+<FONT color="green">801</FONT>        public long getNumeratorAsLong() {<a name="line.801"></a>
+<FONT color="green">802</FONT>            return numerator.longValue();<a name="line.802"></a>
+<FONT color="green">803</FONT>        }<a name="line.803"></a>
+<FONT color="green">804</FONT>    <a name="line.804"></a>
+<FONT color="green">805</FONT>        /**<a name="line.805"></a>
+<FONT color="green">806</FONT>         * &lt;p&gt;<a name="line.806"></a>
+<FONT color="green">807</FONT>         * Gets a hashCode for the fraction.<a name="line.807"></a>
+<FONT color="green">808</FONT>         * &lt;/p&gt;<a name="line.808"></a>
+<FONT color="green">809</FONT>         *<a name="line.809"></a>
+<FONT color="green">810</FONT>         * @return a hash code value for this object.<a name="line.810"></a>
+<FONT color="green">811</FONT>         * @see java.lang.Object#hashCode()<a name="line.811"></a>
+<FONT color="green">812</FONT>         */<a name="line.812"></a>
+<FONT color="green">813</FONT>        @Override<a name="line.813"></a>
+<FONT color="green">814</FONT>        public int hashCode() {<a name="line.814"></a>
+<FONT color="green">815</FONT>            return 37 * (37 * 17 + numerator.hashCode()) + denominator.hashCode();<a name="line.815"></a>
+<FONT color="green">816</FONT>        }<a name="line.816"></a>
+<FONT color="green">817</FONT>    <a name="line.817"></a>
+<FONT color="green">818</FONT>        /**<a name="line.818"></a>
+<FONT color="green">819</FONT>         * &lt;p&gt;<a name="line.819"></a>
+<FONT color="green">820</FONT>         * Gets the fraction as an &lt;tt&gt;int&lt;/tt&gt;. This returns the whole number part<a name="line.820"></a>
+<FONT color="green">821</FONT>         * of the fraction.<a name="line.821"></a>
+<FONT color="green">822</FONT>         * &lt;/p&gt;<a name="line.822"></a>
+<FONT color="green">823</FONT>         *<a name="line.823"></a>
+<FONT color="green">824</FONT>         * @return the whole number fraction part.<a name="line.824"></a>
+<FONT color="green">825</FONT>         * @see java.lang.Number#intValue()<a name="line.825"></a>
+<FONT color="green">826</FONT>         */<a name="line.826"></a>
+<FONT color="green">827</FONT>        @Override<a name="line.827"></a>
+<FONT color="green">828</FONT>        public int intValue() {<a name="line.828"></a>
+<FONT color="green">829</FONT>            return numerator.divide(denominator).intValue();<a name="line.829"></a>
+<FONT color="green">830</FONT>        }<a name="line.830"></a>
+<FONT color="green">831</FONT>    <a name="line.831"></a>
+<FONT color="green">832</FONT>        /**<a name="line.832"></a>
+<FONT color="green">833</FONT>         * &lt;p&gt;<a name="line.833"></a>
+<FONT color="green">834</FONT>         * Gets the fraction as a &lt;tt&gt;long&lt;/tt&gt;. This returns the whole number part<a name="line.834"></a>
+<FONT color="green">835</FONT>         * of the fraction.<a name="line.835"></a>
+<FONT color="green">836</FONT>         * &lt;/p&gt;<a name="line.836"></a>
+<FONT color="green">837</FONT>         *<a name="line.837"></a>
+<FONT color="green">838</FONT>         * @return the whole number fraction part.<a name="line.838"></a>
+<FONT color="green">839</FONT>         * @see java.lang.Number#longValue()<a name="line.839"></a>
+<FONT color="green">840</FONT>         */<a name="line.840"></a>
+<FONT color="green">841</FONT>        @Override<a name="line.841"></a>
+<FONT color="green">842</FONT>        public long longValue() {<a name="line.842"></a>
+<FONT color="green">843</FONT>            return numerator.divide(denominator).longValue();<a name="line.843"></a>
+<FONT color="green">844</FONT>        }<a name="line.844"></a>
+<FONT color="green">845</FONT>    <a name="line.845"></a>
+<FONT color="green">846</FONT>        /**<a name="line.846"></a>
+<FONT color="green">847</FONT>         * &lt;p&gt;<a name="line.847"></a>
+<FONT color="green">848</FONT>         * Multiplies the value of this fraction by the passed<a name="line.848"></a>
+<FONT color="green">849</FONT>         * &lt;code&gt;BigInteger&lt;/code&gt;, returning the result in reduced form.<a name="line.849"></a>
+<FONT color="green">850</FONT>         * &lt;/p&gt;<a name="line.850"></a>
+<FONT color="green">851</FONT>         *<a name="line.851"></a>
+<FONT color="green">852</FONT>         * @param bg<a name="line.852"></a>
+<FONT color="green">853</FONT>         *            the &lt;code&gt;BigInteger&lt;/code&gt; to multiply by.<a name="line.853"></a>
+<FONT color="green">854</FONT>         * @return a &lt;code&gt;BigFraction&lt;/code&gt; instance with the resulting values.<a name="line.854"></a>
+<FONT color="green">855</FONT>         * @throws NullPointerException<a name="line.855"></a>
+<FONT color="green">856</FONT>         *             if the bg is &lt;code&gt;null&lt;/code&gt;.<a name="line.856"></a>
+<FONT color="green">857</FONT>         */<a name="line.857"></a>
+<FONT color="green">858</FONT>        public BigFraction multiply(final BigInteger bg) {<a name="line.858"></a>
+<FONT color="green">859</FONT>            return new BigFraction(bg.multiply(numerator), denominator);<a name="line.859"></a>
+<FONT color="green">860</FONT>        }<a name="line.860"></a>
+<FONT color="green">861</FONT>    <a name="line.861"></a>
+<FONT color="green">862</FONT>        /**<a name="line.862"></a>
+<FONT color="green">863</FONT>         * &lt;p&gt;<a name="line.863"></a>
+<FONT color="green">864</FONT>         * Multiply the value of this fraction by the passed &lt;tt&gt;int&lt;/tt&gt;, returning<a name="line.864"></a>
+<FONT color="green">865</FONT>         * the result in reduced form.<a name="line.865"></a>
+<FONT color="green">866</FONT>         * &lt;/p&gt;<a name="line.866"></a>
+<FONT color="green">867</FONT>         *<a name="line.867"></a>
+<FONT color="green">868</FONT>         * @param i<a name="line.868"></a>
+<FONT color="green">869</FONT>         *            the &lt;tt&gt;int&lt;/tt&gt; to multiply by.<a name="line.869"></a>
+<FONT color="green">870</FONT>         * @return a {@link BigFraction} instance with the resulting values.<a name="line.870"></a>
+<FONT color="green">871</FONT>         */<a name="line.871"></a>
+<FONT color="green">872</FONT>        public BigFraction multiply(final int i) {<a name="line.872"></a>
+<FONT color="green">873</FONT>            return multiply(BigInteger.valueOf(i));<a name="line.873"></a>
+<FONT color="green">874</FONT>        }<a name="line.874"></a>
+<FONT color="green">875</FONT>    <a name="line.875"></a>
+<FONT color="green">876</FONT>        /**<a name="line.876"></a>
+<FONT color="green">877</FONT>         * &lt;p&gt;<a name="line.877"></a>
+<FONT color="green">878</FONT>         * Multiply the value of this fraction by the passed &lt;tt&gt;long&lt;/tt&gt;,<a name="line.878"></a>
+<FONT color="green">879</FONT>         * returning the result in reduced form.<a name="line.879"></a>
+<FONT color="green">880</FONT>         * &lt;/p&gt;<a name="line.880"></a>
+<FONT color="green">881</FONT>         *<a name="line.881"></a>
+<FONT color="green">882</FONT>         * @param l<a name="line.882"></a>
+<FONT color="green">883</FONT>         *            the &lt;tt&gt;long&lt;/tt&gt; to multiply by.<a name="line.883"></a>
+<FONT color="green">884</FONT>         * @return a {@link BigFraction} instance with the resulting values.<a name="line.884"></a>
+<FONT color="green">885</FONT>         */<a name="line.885"></a>
+<FONT color="green">886</FONT>        public BigFraction multiply(final long l) {<a name="line.886"></a>
+<FONT color="green">887</FONT>            return multiply(BigInteger.valueOf(l));<a name="line.887"></a>
+<FONT color="green">888</FONT>        }<a name="line.888"></a>
+<FONT color="green">889</FONT>    <a name="line.889"></a>
+<FONT color="green">890</FONT>        /**<a name="line.890"></a>
+<FONT color="green">891</FONT>         * &lt;p&gt;<a name="line.891"></a>
+<FONT color="green">892</FONT>         * Multiplies the value of this fraction by another, returning the result in<a name="line.892"></a>
+<FONT color="green">893</FONT>         * reduced form.<a name="line.893"></a>
+<FONT color="green">894</FONT>         * &lt;/p&gt;<a name="line.894"></a>
+<FONT color="green">895</FONT>         *<a name="line.895"></a>
+<FONT color="green">896</FONT>         * @param fraction<a name="line.896"></a>
+<FONT color="green">897</FONT>         *            the fraction to multiply by, must not be &lt;code&gt;null&lt;/code&gt;.<a name="line.897"></a>
+<FONT color="green">898</FONT>         * @return a {@link BigFraction} instance with the resulting values.<a name="line.898"></a>
+<FONT color="green">899</FONT>         * @throws NullPointerException<a name="line.899"></a>
+<FONT color="green">900</FONT>         *             if the fraction is &lt;code&gt;null&lt;/code&gt;.<a name="line.900"></a>
+<FONT color="green">901</FONT>         */<a name="line.901"></a>
+<FONT color="green">902</FONT>        public BigFraction multiply(final BigFraction fraction) {<a name="line.902"></a>
+<FONT color="green">903</FONT>            if (numerator.equals(BigInteger.ZERO) ||<a name="line.903"></a>
+<FONT color="green">904</FONT>                fraction.numerator.equals(BigInteger.ZERO)) {<a name="line.904"></a>
+<FONT color="green">905</FONT>                return ZERO;<a name="line.905"></a>
+<FONT color="green">906</FONT>            }<a name="line.906"></a>
+<FONT color="green">907</FONT>            return new BigFraction(numerator.multiply(fraction.numerator),<a name="line.907"></a>
+<FONT color="green">908</FONT>                                   denominator.multiply(fraction.denominator));<a name="line.908"></a>
+<FONT color="green">909</FONT>        }<a name="line.909"></a>
+<FONT color="green">910</FONT>    <a name="line.910"></a>
+<FONT color="green">911</FONT>        /**<a name="line.911"></a>
+<FONT color="green">912</FONT>         * &lt;p&gt;<a name="line.912"></a>
+<FONT color="green">913</FONT>         * Return the additive inverse of this fraction, returning the result in<a name="line.913"></a>
+<FONT color="green">914</FONT>         * reduced form.<a name="line.914"></a>
+<FONT color="green">915</FONT>         * &lt;/p&gt;<a name="line.915"></a>
+<FONT color="green">916</FONT>         *<a name="line.916"></a>
+<FONT color="green">917</FONT>         * @return the negation of this fraction.<a name="line.917"></a>
+<FONT color="green">918</FONT>         */<a name="line.918"></a>
+<FONT color="green">919</FONT>        public BigFraction negate() {<a name="line.919"></a>
+<FONT color="green">920</FONT>            return new BigFraction(numerator.negate(), denominator);<a name="line.920"></a>
+<FONT color="green">921</FONT>        }<a name="line.921"></a>
+<FONT color="green">922</FONT>    <a name="line.922"></a>
+<FONT color="green">923</FONT>        /**<a name="line.923"></a>
+<FONT color="green">924</FONT>         * &lt;p&gt;<a name="line.924"></a>
+<FONT color="green">925</FONT>         * Gets the fraction percentage as a &lt;tt&gt;double&lt;/tt&gt;. This calculates the<a name="line.925"></a>
+<FONT color="green">926</FONT>         * fraction as the numerator divided by denominator multiplied by 100.<a name="line.926"></a>
+<FONT color="green">927</FONT>         * &lt;/p&gt;<a name="line.927"></a>
+<FONT color="green">928</FONT>         *<a name="line.928"></a>
+<FONT color="green">929</FONT>         * @return the fraction percentage as a &lt;tt&gt;double&lt;/tt&gt;.<a name="line.929"></a>
+<FONT color="green">930</FONT>         */<a name="line.930"></a>
+<FONT color="green">931</FONT>        public double percentageValue() {<a name="line.931"></a>
+<FONT color="green">932</FONT>            return (numerator.divide(denominator)).multiply(ONE_HUNDRED_DOUBLE).doubleValue();<a name="line.932"></a>
+<FONT color="green">933</FONT>        }<a name="line.933"></a>
+<FONT color="green">934</FONT>    <a name="line.934"></a>
+<FONT color="green">935</FONT>        /**<a name="line.935"></a>
+<FONT color="green">936</FONT>         * &lt;p&gt;<a name="line.936"></a>
+<FONT color="green">937</FONT>         * Returns a &lt;tt&gt;integer&lt;/tt&gt; whose value is<a name="line.937"></a>
+<FONT color="green">938</FONT>         * &lt;tt&gt;(this&lt;sup&gt;exponent&lt;/sup&gt;)&lt;/tt&gt;, returning the result in reduced form.<a name="line.938"></a>
+<FONT color="green">939</FONT>         * &lt;/p&gt;<a name="line.939"></a>
+<FONT color="green">940</FONT>         *<a name="line.940"></a>
+<FONT color="green">941</FONT>         * @param exponent<a name="line.941"></a>
+<FONT color="green">942</FONT>         *            exponent to which this &lt;code&gt;BigInteger&lt;/code&gt; is to be<a name="line.942"></a>
+<FONT color="green">943</FONT>         *            raised.<a name="line.943"></a>
+<FONT color="green">944</FONT>         * @return &lt;tt&gt;this&lt;sup&gt;exponent&lt;/sup&gt;&lt;/tt&gt;.<a name="line.944"></a>
+<FONT color="green">945</FONT>         */<a name="line.945"></a>
+<FONT color="green">946</FONT>        public BigFraction pow(final int exponent) {<a name="line.946"></a>
+<FONT color="green">947</FONT>            if (exponent &lt; 0) {<a name="line.947"></a>
+<FONT color="green">948</FONT>                return new BigFraction(denominator.pow(-exponent), numerator.pow(-exponent));<a name="line.948"></a>
+<FONT color="green">949</FONT>            }<a name="line.949"></a>
+<FONT color="green">950</FONT>            return new BigFraction(numerator.pow(exponent), denominator.pow(exponent));<a name="line.950"></a>
+<FONT color="green">951</FONT>        }<a name="line.951"></a>
+<FONT color="green">952</FONT>    <a name="line.952"></a>
+<FONT color="green">953</FONT>        /**<a name="line.953"></a>
+<FONT color="green">954</FONT>         * &lt;p&gt;<a name="line.954"></a>
+<FONT color="green">955</FONT>         * Returns a &lt;code&gt;BigFraction&lt;/code&gt; whose value is<a name="line.955"></a>
+<FONT color="green">956</FONT>         * &lt;tt&gt;(this&lt;sup&gt;exponent&lt;/sup&gt;)&lt;/tt&gt;, returning the result in reduced form.<a name="line.956"></a>
+<FONT color="green">957</FONT>         * &lt;/p&gt;<a name="line.957"></a>
+<FONT color="green">958</FONT>         *<a name="line.958"></a>
+<FONT color="green">959</FONT>         * @param exponent<a name="line.959"></a>
+<FONT color="green">960</FONT>         *            exponent to which this &lt;code&gt;BigFraction&lt;/code&gt; is to be raised.<a name="line.960"></a>
+<FONT color="green">961</FONT>         * @return &lt;tt&gt;this&lt;sup&gt;exponent&lt;/sup&gt;&lt;/tt&gt; as a &lt;code&gt;BigFraction&lt;/code&gt;.<a name="line.961"></a>
+<FONT color="green">962</FONT>         */<a name="line.962"></a>
+<FONT color="green">963</FONT>        public BigFraction pow(final long exponent) {<a name="line.963"></a>
+<FONT color="green">964</FONT>            if (exponent &lt; 0) {<a name="line.964"></a>
+<FONT color="green">965</FONT>                return new BigFraction(MathUtils.pow(denominator, -exponent),<a name="line.965"></a>
+<FONT color="green">966</FONT>                                       MathUtils.pow(numerator,   -exponent));<a name="line.966"></a>
+<FONT color="green">967</FONT>            }<a name="line.967"></a>
+<FONT color="green">968</FONT>            return new BigFraction(MathUtils.pow(numerator,   exponent),<a name="line.968"></a>
+<FONT color="green">969</FONT>                                   MathUtils.pow(denominator, exponent));<a name="line.969"></a>
+<FONT color="green">970</FONT>        }<a name="line.970"></a>
+<FONT color="green">971</FONT>    <a name="line.971"></a>
+<FONT color="green">972</FONT>        /**<a name="line.972"></a>
+<FONT color="green">973</FONT>         * &lt;p&gt;<a name="line.973"></a>
+<FONT color="green">974</FONT>         * Returns a &lt;code&gt;BigFraction&lt;/code&gt; whose value is<a name="line.974"></a>
+<FONT color="green">975</FONT>         * &lt;tt&gt;(this&lt;sup&gt;exponent&lt;/sup&gt;)&lt;/tt&gt;, returning the result in reduced form.<a name="line.975"></a>
+<FONT color="green">976</FONT>         * &lt;/p&gt;<a name="line.976"></a>
+<FONT color="green">977</FONT>         *<a name="line.977"></a>
+<FONT color="green">978</FONT>         * @param exponent<a name="line.978"></a>
+<FONT color="green">979</FONT>         *            exponent to which this &lt;code&gt;BigFraction&lt;/code&gt; is to be raised.<a name="line.979"></a>
+<FONT color="green">980</FONT>         * @return &lt;tt&gt;this&lt;sup&gt;exponent&lt;/sup&gt;&lt;/tt&gt; as a &lt;code&gt;BigFraction&lt;/code&gt;.<a name="line.980"></a>
+<FONT color="green">981</FONT>         */<a name="line.981"></a>
+<FONT color="green">982</FONT>        public BigFraction pow(final BigInteger exponent) {<a name="line.982"></a>
+<FONT color="green">983</FONT>            if (exponent.compareTo(BigInteger.ZERO) &lt; 0) {<a name="line.983"></a>
+<FONT color="green">984</FONT>                final BigInteger eNeg = exponent.negate();<a name="line.984"></a>
+<FONT color="green">985</FONT>                return new BigFraction(MathUtils.pow(denominator, eNeg),<a name="line.985"></a>
+<FONT color="green">986</FONT>                                       MathUtils.pow(numerator,   eNeg));<a name="line.986"></a>
+<FONT color="green">987</FONT>            }<a name="line.987"></a>
+<FONT color="green">988</FONT>            return new BigFraction(MathUtils.pow(numerator,   exponent),<a name="line.988"></a>
+<FONT color="green">989</FONT>                                   MathUtils.pow(denominator, exponent));<a name="line.989"></a>
+<FONT color="green">990</FONT>        }<a name="line.990"></a>
+<FONT color="green">991</FONT>    <a name="line.991"></a>
+<FONT color="green">992</FONT>        /**<a name="line.992"></a>
+<FONT color="green">993</FONT>         * &lt;p&gt;<a name="line.993"></a>
+<FONT color="green">994</FONT>         * Returns a &lt;code&gt;double&lt;/code&gt; whose value is<a name="line.994"></a>
+<FONT color="green">995</FONT>         * &lt;tt&gt;(this&lt;sup&gt;exponent&lt;/sup&gt;)&lt;/tt&gt;, returning the result in reduced form.<a name="line.995"></a>
+<FONT color="green">996</FONT>         * &lt;/p&gt;<a name="line.996"></a>
+<FONT color="green">997</FONT>         *<a name="line.997"></a>
+<FONT color="green">998</FONT>         * @param exponent<a name="line.998"></a>
+<FONT color="green">999</FONT>         *            exponent to which this &lt;code&gt;BigFraction&lt;/code&gt; is to be raised.<a name="line.999"></a>
+<FONT color="green">1000</FONT>         * @return &lt;tt&gt;this&lt;sup&gt;exponent&lt;/sup&gt;&lt;/tt&gt;.<a name="line.1000"></a>
+<FONT color="green">1001</FONT>         */<a name="line.1001"></a>
+<FONT color="green">1002</FONT>        public double pow(final double exponent) {<a name="line.1002"></a>
+<FONT color="green">1003</FONT>            return Math.pow(numerator.doubleValue(),   exponent) /<a name="line.1003"></a>
+<FONT color="green">1004</FONT>                   Math.pow(denominator.doubleValue(), exponent);<a name="line.1004"></a>
+<FONT color="green">1005</FONT>        }<a name="line.1005"></a>
+<FONT color="green">1006</FONT>    <a name="line.1006"></a>
+<FONT color="green">1007</FONT>        /**<a name="line.1007"></a>
+<FONT color="green">1008</FONT>         * &lt;p&gt;<a name="line.1008"></a>
+<FONT color="green">1009</FONT>         * Return the multiplicative inverse of this fraction.<a name="line.1009"></a>
+<FONT color="green">1010</FONT>         * &lt;/p&gt;<a name="line.1010"></a>
+<FONT color="green">1011</FONT>         *<a name="line.1011"></a>
+<FONT color="green">1012</FONT>         * @return the reciprocal fraction.<a name="line.1012"></a>
+<FONT color="green">1013</FONT>         */<a name="line.1013"></a>
+<FONT color="green">1014</FONT>        public BigFraction reciprocal() {<a name="line.1014"></a>
+<FONT color="green">1015</FONT>            return new BigFraction(denominator, numerator);<a name="line.1015"></a>
+<FONT color="green">1016</FONT>        }<a name="line.1016"></a>
+<FONT color="green">1017</FONT>    <a name="line.1017"></a>
+<FONT color="green">1018</FONT>        /**<a name="line.1018"></a>
+<FONT color="green">1019</FONT>         * &lt;p&gt;<a name="line.1019"></a>
+<FONT color="green">1020</FONT>         * Reduce this &lt;code&gt;BigFraction&lt;/code&gt; to its lowest terms.<a name="line.1020"></a>
+<FONT color="green">1021</FONT>         * &lt;/p&gt;<a name="line.1021"></a>
+<FONT color="green">1022</FONT>         *<a name="line.1022"></a>
+<FONT color="green">1023</FONT>         * @return the reduced &lt;code&gt;BigFraction&lt;/code&gt;. It doesn't change anything if<a name="line.1023"></a>
+<FONT color="green">1024</FONT>         *         the fraction can be reduced.<a name="line.1024"></a>
+<FONT color="green">1025</FONT>         */<a name="line.1025"></a>
+<FONT color="green">1026</FONT>        public BigFraction reduce() {<a name="line.1026"></a>
+<FONT color="green">1027</FONT>            final BigInteger gcd = numerator.gcd(denominator);<a name="line.1027"></a>
+<FONT color="green">1028</FONT>            return new BigFraction(numerator.divide(gcd), denominator.divide(gcd));<a name="line.1028"></a>
+<FONT color="green">1029</FONT>        }<a name="line.1029"></a>
+<FONT color="green">1030</FONT>    <a name="line.1030"></a>
+<FONT color="green">1031</FONT>        /**<a name="line.1031"></a>
+<FONT color="green">1032</FONT>         * &lt;p&gt;<a name="line.1032"></a>
+<FONT color="green">1033</FONT>         * Subtracts the value of an {@link BigInteger} from the value of this one,<a name="line.1033"></a>
+<FONT color="green">1034</FONT>         * returning the result in reduced form.<a name="line.1034"></a>
+<FONT color="green">1035</FONT>         * &lt;/p&gt;<a name="line.1035"></a>
+<FONT color="green">1036</FONT>         *<a name="line.1036"></a>
+<FONT color="green">1037</FONT>         * @param bg<a name="line.1037"></a>
+<FONT color="green">1038</FONT>         *            the {@link BigInteger} to subtract, must'nt be<a name="line.1038"></a>
+<FONT color="green">1039</FONT>         *            &lt;code&gt;null&lt;/code&gt;.<a name="line.1039"></a>
+<FONT color="green">1040</FONT>         * @return a &lt;code&gt;BigFraction&lt;/code&gt; instance with the resulting values.<a name="line.1040"></a>
+<FONT color="green">1041</FONT>         * @throws NullPointerException<a name="line.1041"></a>
+<FONT color="green">1042</FONT>         *             if the {@link BigInteger} is &lt;code&gt;null&lt;/code&gt;.<a name="line.1042"></a>
+<FONT color="green">1043</FONT>         */<a name="line.1043"></a>
+<FONT color="green">1044</FONT>        public BigFraction subtract(final BigInteger bg) {<a name="line.1044"></a>
+<FONT color="green">1045</FONT>            return new BigFraction(numerator.subtract(denominator.multiply(bg)), denominator);<a name="line.1045"></a>
+<FONT color="green">1046</FONT>        }<a name="line.1046"></a>
+<FONT color="green">1047</FONT>    <a name="line.1047"></a>
+<FONT color="green">1048</FONT>        /**<a name="line.1048"></a>
+<FONT color="green">1049</FONT>         * &lt;p&gt;<a name="line.1049"></a>
+<FONT color="green">1050</FONT>         * Subtracts the value of an &lt;tt&gt;integer&lt;/tt&gt; from the value of this one,<a name="line.1050"></a>
+<FONT color="green">1051</FONT>         * returning the result in reduced form.<a name="line.1051"></a>
+<FONT color="green">1052</FONT>         * &lt;/p&gt;<a name="line.1052"></a>
+<FONT color="green">1053</FONT>         *<a name="line.1053"></a>
+<FONT color="green">1054</FONT>         * @param i<a name="line.1054"></a>
+<FONT color="green">1055</FONT>         *            the &lt;tt&gt;integer&lt;/tt&gt; to subtract.<a name="line.1055"></a>
+<FONT color="green">1056</FONT>         * @return a &lt;code&gt;BigFraction&lt;/code&gt; instance with the resulting values.<a name="line.1056"></a>
+<FONT color="green">1057</FONT>         */<a name="line.1057"></a>
+<FONT color="green">1058</FONT>        public BigFraction subtract(final int i) {<a name="line.1058"></a>
+<FONT color="green">1059</FONT>            return subtract(BigInteger.valueOf(i));<a name="line.1059"></a>
+<FONT color="green">1060</FONT>        }<a name="line.1060"></a>
+<FONT color="green">1061</FONT>    <a name="line.1061"></a>
+<FONT color="green">1062</FONT>        /**<a name="line.1062"></a>
+<FONT color="green">1063</FONT>         * &lt;p&gt;<a name="line.1063"></a>
+<FONT color="green">1064</FONT>         * Subtracts the value of an &lt;tt&gt;integer&lt;/tt&gt; from the value of this one,<a name="line.1064"></a>
+<FONT color="green">1065</FONT>         * returning the result in reduced form.<a name="line.1065"></a>
+<FONT color="green">1066</FONT>         * &lt;/p&gt;<a name="line.1066"></a>
+<FONT color="green">1067</FONT>         *<a name="line.1067"></a>
+<FONT color="green">1068</FONT>         * @param l<a name="line.1068"></a>
+<FONT color="green">1069</FONT>         *            the &lt;tt&gt;long&lt;/tt&gt; to subtract.<a name="line.1069"></a>
+<FONT color="green">1070</FONT>         * @return a &lt;code&gt;BigFraction&lt;/code&gt; instance with the resulting values, or<a name="line.1070"></a>
+<FONT color="green">1071</FONT>         *         this object if the &lt;tt&gt;long&lt;/tt&gt; is zero.<a name="line.1071"></a>
+<FONT color="green">1072</FONT>         */<a name="line.1072"></a>
+<FONT color="green">1073</FONT>        public BigFraction subtract(final long l) {<a name="line.1073"></a>
+<FONT color="green">1074</FONT>            return subtract(BigInteger.valueOf(l));<a name="line.1074"></a>
+<FONT color="green">1075</FONT>        }<a name="line.1075"></a>
+<FONT color="green">1076</FONT>    <a name="line.1076"></a>
+<FONT color="green">1077</FONT>        /**<a name="line.1077"></a>
+<FONT color="green">1078</FONT>         * &lt;p&gt;<a name="line.1078"></a>
+<FONT color="green">1079</FONT>         * Subtracts the value of another fraction from the value of this one,<a name="line.1079"></a>
+<FONT color="green">1080</FONT>         * returning the result in reduced form.<a name="line.1080"></a>
+<FONT color="green">1081</FONT>         * &lt;/p&gt;<a name="line.1081"></a>
+<FONT color="green">1082</FONT>         *<a name="line.1082"></a>
+<FONT color="green">1083</FONT>         * @param fraction<a name="line.1083"></a>
+<FONT color="green">1084</FONT>         *            the {@link BigFraction} to subtract, must not be<a name="line.1084"></a>
+<FONT color="green">1085</FONT>         *            &lt;code&gt;null&lt;/code&gt;.<a name="line.1085"></a>
+<FONT color="green">1086</FONT>         * @return a {@link BigFraction} instance with the resulting values<a name="line.1086"></a>
+<FONT color="green">1087</FONT>         * @throws NullPointerException<a name="line.1087"></a>
+<FONT color="green">1088</FONT>         *             if the fraction is &lt;code&gt;null&lt;/code&gt;.<a name="line.1088"></a>
+<FONT color="green">1089</FONT>         */<a name="line.1089"></a>
+<FONT color="green">1090</FONT>        public BigFraction subtract(final BigFraction fraction) {<a name="line.1090"></a>
+<FONT color="green">1091</FONT>            if (ZERO.equals(fraction)) {<a name="line.1091"></a>
+<FONT color="green">1092</FONT>                return this;<a name="line.1092"></a>
+<FONT color="green">1093</FONT>            }<a name="line.1093"></a>
+<FONT color="green">1094</FONT>    <a name="line.1094"></a>
+<FONT color="green">1095</FONT>            BigInteger num = null;<a name="line.1095"></a>
+<FONT color="green">1096</FONT>            BigInteger den = null;<a name="line.1096"></a>
+<FONT color="green">1097</FONT>            if (denominator.equals(fraction.denominator)) {<a name="line.1097"></a>
+<FONT color="green">1098</FONT>                num = numerator.subtract(fraction.numerator);<a name="line.1098"></a>
+<FONT color="green">1099</FONT>                den = denominator;<a name="line.1099"></a>
+<FONT color="green">1100</FONT>            } else {<a name="line.1100"></a>
+<FONT color="green">1101</FONT>                num = (numerator.multiply(fraction.denominator)).subtract((fraction.numerator).multiply(denominator));<a name="line.1101"></a>
+<FONT color="green">1102</FONT>                den = denominator.multiply(fraction.denominator);<a name="line.1102"></a>
+<FONT color="green">1103</FONT>            }<a name="line.1103"></a>
+<FONT color="green">1104</FONT>            return new BigFraction(num, den);<a name="line.1104"></a>
+<FONT color="green">1105</FONT>    <a name="line.1105"></a>
+<FONT color="green">1106</FONT>        }<a name="line.1106"></a>
+<FONT color="green">1107</FONT>    <a name="line.1107"></a>
+<FONT color="green">1108</FONT>        /**<a name="line.1108"></a>
+<FONT color="green">1109</FONT>         * &lt;p&gt;<a name="line.1109"></a>
+<FONT color="green">1110</FONT>         * Returns the &lt;code&gt;String&lt;/code&gt; representing this fraction, ie<a name="line.1110"></a>
+<FONT color="green">1111</FONT>         * "num / dem" or just "num" if the denominator is one.<a name="line.1111"></a>
+<FONT color="green">1112</FONT>         * &lt;/p&gt;<a name="line.1112"></a>
+<FONT color="green">1113</FONT>         *<a name="line.1113"></a>
+<FONT color="green">1114</FONT>         * @return a string representation of the fraction.<a name="line.1114"></a>
+<FONT color="green">1115</FONT>         * @see java.lang.Object#toString()<a name="line.1115"></a>
+<FONT color="green">1116</FONT>         */<a name="line.1116"></a>
+<FONT color="green">1117</FONT>        @Override<a name="line.1117"></a>
+<FONT color="green">1118</FONT>        public String toString() {<a name="line.1118"></a>
+<FONT color="green">1119</FONT>            String str = null;<a name="line.1119"></a>
+<FONT color="green">1120</FONT>            if (BigInteger.ONE.equals(denominator)) {<a name="line.1120"></a>
+<FONT color="green">1121</FONT>                str = numerator.toString();<a name="line.1121"></a>
+<FONT color="green">1122</FONT>            } else if (BigInteger.ZERO.equals(numerator)) {<a name="line.1122"></a>
+<FONT color="green">1123</FONT>                str = "0";<a name="line.1123"></a>
+<FONT color="green">1124</FONT>            } else {<a name="line.1124"></a>
+<FONT color="green">1125</FONT>                str = numerator + " / " + denominator;<a name="line.1125"></a>
+<FONT color="green">1126</FONT>            }<a name="line.1126"></a>
+<FONT color="green">1127</FONT>            return str;<a name="line.1127"></a>
+<FONT color="green">1128</FONT>        }<a name="line.1128"></a>
+<FONT color="green">1129</FONT>    <a name="line.1129"></a>
+<FONT color="green">1130</FONT>        /** {@inheritDoc} */<a name="line.1130"></a>
+<FONT color="green">1131</FONT>        public BigFractionField getField() {<a name="line.1131"></a>
+<FONT color="green">1132</FONT>            return BigFractionField.getInstance();<a name="line.1132"></a>
+<FONT color="green">1133</FONT>        }<a name="line.1133"></a>
+<FONT color="green">1134</FONT>    <a name="line.1134"></a>
+<FONT color="green">1135</FONT>    }<a name="line.1135"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/BigFractionField.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,144 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.fraction;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.Field;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Representation of the fractional numbers  without any overflow field.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * This class is a singleton.<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @see Fraction<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 2.0<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public class BigFractionField implements Field&lt;BigFraction&gt;, Serializable  {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Serializable version identifier */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private static final long serialVersionUID = -1699294557189741703L;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Private constructor for the singleton.<a name="line.38"></a>
+<FONT color="green">039</FONT>         */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private BigFractionField() {<a name="line.40"></a>
+<FONT color="green">041</FONT>        }<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** Get the unique instance.<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @return the unique instance<a name="line.44"></a>
+<FONT color="green">045</FONT>         */<a name="line.45"></a>
+<FONT color="green">046</FONT>        public static BigFractionField getInstance() {<a name="line.46"></a>
+<FONT color="green">047</FONT>            return LazyHolder.INSTANCE;<a name="line.47"></a>
+<FONT color="green">048</FONT>        }<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** {@inheritDoc} */<a name="line.50"></a>
+<FONT color="green">051</FONT>        public BigFraction getOne() {<a name="line.51"></a>
+<FONT color="green">052</FONT>            return BigFraction.ONE;<a name="line.52"></a>
+<FONT color="green">053</FONT>        }<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** {@inheritDoc} */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public BigFraction getZero() {<a name="line.56"></a>
+<FONT color="green">057</FONT>            return BigFraction.ZERO;<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        // CHECKSTYLE: stop HideUtilityClassConstructor<a name="line.60"></a>
+<FONT color="green">061</FONT>        /** Holder for the instance.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * &lt;p&gt;We use here the Initialization On Demand Holder Idiom.&lt;/p&gt;<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        private static class LazyHolder {<a name="line.64"></a>
+<FONT color="green">065</FONT>            /** Cached field instance. */<a name="line.65"></a>
+<FONT color="green">066</FONT>            private static final BigFractionField INSTANCE = new BigFractionField();<a name="line.66"></a>
+<FONT color="green">067</FONT>        }<a name="line.67"></a>
+<FONT color="green">068</FONT>        // CHECKSTYLE: resume HideUtilityClassConstructor<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /** Handle deserialization of the singleton.<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @return the singleton instance<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        private Object readResolve() {<a name="line.73"></a>
+<FONT color="green">074</FONT>            // return the singleton instance<a name="line.74"></a>
+<FONT color="green">075</FONT>            return LazyHolder.INSTANCE;<a name="line.75"></a>
+<FONT color="green">076</FONT>        }<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>    }<a name="line.78"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/BigFractionFormat.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,356 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.fraction;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.math.BigInteger;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.text.FieldPosition;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.text.NumberFormat;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import java.text.ParseException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import java.text.ParsePosition;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import java.util.Locale;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>    /**<a name="line.30"></a>
+<FONT color="green">031</FONT>     * Formats a BigFraction number in proper format or improper format.<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * The number format for each of the whole number, numerator and,<a name="line.33"></a>
+<FONT color="green">034</FONT>     * denominator can be configured.<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     *<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @since 2.0<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.38"></a>
+<FONT color="green">039</FONT>     */<a name="line.39"></a>
+<FONT color="green">040</FONT>    public class BigFractionFormat extends AbstractFormat implements Serializable {<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Serializable version identifier */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private static final long serialVersionUID = -2932167925527338976L;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**<a name="line.45"></a>
+<FONT color="green">046</FONT>         * Create an improper formatting instance with the default number format<a name="line.46"></a>
+<FONT color="green">047</FONT>         * for the numerator and denominator.<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        public BigFractionFormat() {<a name="line.49"></a>
+<FONT color="green">050</FONT>        }<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * Create an improper formatting instance with a custom number format for<a name="line.53"></a>
+<FONT color="green">054</FONT>         * both the numerator and denominator.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param format the custom format for both the numerator and denominator.<a name="line.55"></a>
+<FONT color="green">056</FONT>         */<a name="line.56"></a>
+<FONT color="green">057</FONT>        public BigFractionFormat(final NumberFormat format) {<a name="line.57"></a>
+<FONT color="green">058</FONT>            super(format);<a name="line.58"></a>
+<FONT color="green">059</FONT>        }<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Create an improper formatting instance with a custom number format for<a name="line.62"></a>
+<FONT color="green">063</FONT>         * the numerator and a custom number format for the denominator.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @param numeratorFormat the custom format for the numerator.<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param denominatorFormat the custom format for the denominator.<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        public BigFractionFormat(final NumberFormat numeratorFormat,<a name="line.67"></a>
+<FONT color="green">068</FONT>                                 final NumberFormat denominatorFormat) {<a name="line.68"></a>
+<FONT color="green">069</FONT>            super(numeratorFormat, denominatorFormat);<a name="line.69"></a>
+<FONT color="green">070</FONT>        }<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /**<a name="line.72"></a>
+<FONT color="green">073</FONT>         * Get the set of locales for which complex formats are available.  This<a name="line.73"></a>
+<FONT color="green">074</FONT>         * is the same set as the {@link NumberFormat} set.<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @return available complex format locales.<a name="line.75"></a>
+<FONT color="green">076</FONT>         */<a name="line.76"></a>
+<FONT color="green">077</FONT>        public static Locale[] getAvailableLocales() {<a name="line.77"></a>
+<FONT color="green">078</FONT>            return NumberFormat.getAvailableLocales();<a name="line.78"></a>
+<FONT color="green">079</FONT>        }<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /**<a name="line.81"></a>
+<FONT color="green">082</FONT>         * This static method calls formatBigFraction() on a default instance of<a name="line.82"></a>
+<FONT color="green">083</FONT>         * BigFractionFormat.<a name="line.83"></a>
+<FONT color="green">084</FONT>         *<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @param f BigFraction object to format<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @return A formatted BigFraction in proper form.<a name="line.86"></a>
+<FONT color="green">087</FONT>         */<a name="line.87"></a>
+<FONT color="green">088</FONT>        public static String formatBigFraction(final BigFraction f) {<a name="line.88"></a>
+<FONT color="green">089</FONT>            return getImproperInstance().format(f);<a name="line.89"></a>
+<FONT color="green">090</FONT>        }<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /**<a name="line.92"></a>
+<FONT color="green">093</FONT>         * Returns the default complex format for the current locale.<a name="line.93"></a>
+<FONT color="green">094</FONT>         * @return the default complex format.<a name="line.94"></a>
+<FONT color="green">095</FONT>         */<a name="line.95"></a>
+<FONT color="green">096</FONT>        public static BigFractionFormat getImproperInstance() {<a name="line.96"></a>
+<FONT color="green">097</FONT>            return getImproperInstance(Locale.getDefault());<a name="line.97"></a>
+<FONT color="green">098</FONT>        }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>        /**<a name="line.100"></a>
+<FONT color="green">101</FONT>         * Returns the default complex format for the given locale.<a name="line.101"></a>
+<FONT color="green">102</FONT>         * @param locale the specific locale used by the format.<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @return the complex format specific to the given locale.<a name="line.103"></a>
+<FONT color="green">104</FONT>         */<a name="line.104"></a>
+<FONT color="green">105</FONT>        public static BigFractionFormat getImproperInstance(final Locale locale) {<a name="line.105"></a>
+<FONT color="green">106</FONT>            return new BigFractionFormat(getDefaultNumberFormat(locale));<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /**<a name="line.109"></a>
+<FONT color="green">110</FONT>         * Returns the default complex format for the current locale.<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @return the default complex format.<a name="line.111"></a>
+<FONT color="green">112</FONT>         */<a name="line.112"></a>
+<FONT color="green">113</FONT>        public static BigFractionFormat getProperInstance() {<a name="line.113"></a>
+<FONT color="green">114</FONT>            return getProperInstance(Locale.getDefault());<a name="line.114"></a>
+<FONT color="green">115</FONT>        }<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>        /**<a name="line.117"></a>
+<FONT color="green">118</FONT>         * Returns the default complex format for the given locale.<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @param locale the specific locale used by the format.<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @return the complex format specific to the given locale.<a name="line.120"></a>
+<FONT color="green">121</FONT>         */<a name="line.121"></a>
+<FONT color="green">122</FONT>        public static BigFractionFormat getProperInstance(final Locale locale) {<a name="line.122"></a>
+<FONT color="green">123</FONT>            return new ProperBigFractionFormat(getDefaultNumberFormat(locale));<a name="line.123"></a>
+<FONT color="green">124</FONT>        }<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>        /**<a name="line.126"></a>
+<FONT color="green">127</FONT>         * Formats a {@link BigFraction} object to produce a string.  The BigFraction is<a name="line.127"></a>
+<FONT color="green">128</FONT>         * output in improper format.<a name="line.128"></a>
+<FONT color="green">129</FONT>         *<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @param BigFraction the object to format.<a name="line.130"></a>
+<FONT color="green">131</FONT>         * @param toAppendTo where the text is to be appended<a name="line.131"></a>
+<FONT color="green">132</FONT>         * @param pos On input: an alignment field, if desired. On output: the<a name="line.132"></a>
+<FONT color="green">133</FONT>         *            offsets of the alignment field<a name="line.133"></a>
+<FONT color="green">134</FONT>         * @return the value passed in as toAppendTo.<a name="line.134"></a>
+<FONT color="green">135</FONT>         */<a name="line.135"></a>
+<FONT color="green">136</FONT>        public StringBuffer format(final BigFraction BigFraction,<a name="line.136"></a>
+<FONT color="green">137</FONT>                                   final StringBuffer toAppendTo, final FieldPosition pos) {<a name="line.137"></a>
+<FONT color="green">138</FONT>    <a name="line.138"></a>
+<FONT color="green">139</FONT>            pos.setBeginIndex(0);<a name="line.139"></a>
+<FONT color="green">140</FONT>            pos.setEndIndex(0);<a name="line.140"></a>
+<FONT color="green">141</FONT>    <a name="line.141"></a>
+<FONT color="green">142</FONT>            getNumeratorFormat().format(BigFraction.getNumerator(), toAppendTo, pos);<a name="line.142"></a>
+<FONT color="green">143</FONT>            toAppendTo.append(" / ");<a name="line.143"></a>
+<FONT color="green">144</FONT>            getDenominatorFormat().format(BigFraction.getDenominator(), toAppendTo, pos);<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>            return toAppendTo;<a name="line.146"></a>
+<FONT color="green">147</FONT>        }<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>        /**<a name="line.149"></a>
+<FONT color="green">150</FONT>         * Formats an object and appends the result to a StringBuffer.<a name="line.150"></a>
+<FONT color="green">151</FONT>         * &lt;code&gt;obj&lt;/code&gt; must be either a  {@link BigFraction} object or a<a name="line.151"></a>
+<FONT color="green">152</FONT>         * {@link BigInteger} object or a {@link Number} object. Any other type of<a name="line.152"></a>
+<FONT color="green">153</FONT>         * object will result in an {@link IllegalArgumentException} being thrown.<a name="line.153"></a>
+<FONT color="green">154</FONT>         *<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @param obj the object to format.<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @param toAppendTo where the text is to be appended<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @param pos On input: an alignment field, if desired. On output: the<a name="line.157"></a>
+<FONT color="green">158</FONT>         *            offsets of the alignment field<a name="line.158"></a>
+<FONT color="green">159</FONT>         * @return the value passed in as toAppendTo.<a name="line.159"></a>
+<FONT color="green">160</FONT>         * @see java.text.Format#format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)<a name="line.160"></a>
+<FONT color="green">161</FONT>         * @throws IllegalArgumentException is &lt;code&gt;obj&lt;/code&gt; is not a valid type.<a name="line.161"></a>
+<FONT color="green">162</FONT>         */<a name="line.162"></a>
+<FONT color="green">163</FONT>        @Override<a name="line.163"></a>
+<FONT color="green">164</FONT>        public StringBuffer format(final Object obj,<a name="line.164"></a>
+<FONT color="green">165</FONT>                                   final StringBuffer toAppendTo, final FieldPosition pos) {<a name="line.165"></a>
+<FONT color="green">166</FONT>    <a name="line.166"></a>
+<FONT color="green">167</FONT>            final StringBuffer ret;<a name="line.167"></a>
+<FONT color="green">168</FONT>            if (obj instanceof BigFraction) {<a name="line.168"></a>
+<FONT color="green">169</FONT>                ret = format((BigFraction) obj, toAppendTo, pos);<a name="line.169"></a>
+<FONT color="green">170</FONT>            } else if (obj instanceof BigInteger) {<a name="line.170"></a>
+<FONT color="green">171</FONT>                ret = format(new BigFraction((BigInteger) obj), toAppendTo, pos);<a name="line.171"></a>
+<FONT color="green">172</FONT>            } else if (obj instanceof Number) {<a name="line.172"></a>
+<FONT color="green">173</FONT>                ret = format(new BigFraction(((Number) obj).doubleValue()),<a name="line.173"></a>
+<FONT color="green">174</FONT>                             toAppendTo, pos);<a name="line.174"></a>
+<FONT color="green">175</FONT>            } else {<a name="line.175"></a>
+<FONT color="green">176</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.176"></a>
+<FONT color="green">177</FONT>                    "cannot format given object as a fraction number");<a name="line.177"></a>
+<FONT color="green">178</FONT>            }<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>            return ret;<a name="line.180"></a>
+<FONT color="green">181</FONT>        }<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>        /**<a name="line.183"></a>
+<FONT color="green">184</FONT>         * Parses a string to produce a {@link BigFraction} object.<a name="line.184"></a>
+<FONT color="green">185</FONT>         * @param source the string to parse<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @return the parsed {@link BigFraction} object.<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @exception ParseException if the beginning of the specified string<a name="line.187"></a>
+<FONT color="green">188</FONT>         *            cannot be parsed.<a name="line.188"></a>
+<FONT color="green">189</FONT>         */<a name="line.189"></a>
+<FONT color="green">190</FONT>        @Override<a name="line.190"></a>
+<FONT color="green">191</FONT>        public BigFraction parse(final String source) throws ParseException {<a name="line.191"></a>
+<FONT color="green">192</FONT>            final ParsePosition parsePosition = new ParsePosition(0);<a name="line.192"></a>
+<FONT color="green">193</FONT>            final BigFraction result = parse(source, parsePosition);<a name="line.193"></a>
+<FONT color="green">194</FONT>            if (parsePosition.getIndex() == 0) {<a name="line.194"></a>
+<FONT color="green">195</FONT>                throw MathRuntimeException.createParseException(<a name="line.195"></a>
+<FONT color="green">196</FONT>                        parsePosition.getErrorIndex(),<a name="line.196"></a>
+<FONT color="green">197</FONT>                        "unparseable fraction number: \"{0}\"", source);<a name="line.197"></a>
+<FONT color="green">198</FONT>            }<a name="line.198"></a>
+<FONT color="green">199</FONT>            return result;<a name="line.199"></a>
+<FONT color="green">200</FONT>        }<a name="line.200"></a>
+<FONT color="green">201</FONT>    <a name="line.201"></a>
+<FONT color="green">202</FONT>        /**<a name="line.202"></a>
+<FONT color="green">203</FONT>         * Parses a string to produce a {@link BigFraction} object.<a name="line.203"></a>
+<FONT color="green">204</FONT>         * This method expects the string to be formatted as an improper BigFraction.<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @param source the string to parse<a name="line.205"></a>
+<FONT color="green">206</FONT>         * @param pos input/ouput parsing parameter.<a name="line.206"></a>
+<FONT color="green">207</FONT>         * @return the parsed {@link BigFraction} object.<a name="line.207"></a>
+<FONT color="green">208</FONT>         */<a name="line.208"></a>
+<FONT color="green">209</FONT>        @Override<a name="line.209"></a>
+<FONT color="green">210</FONT>        public BigFraction parse(final String source, final ParsePosition pos) {<a name="line.210"></a>
+<FONT color="green">211</FONT>            final int initialIndex = pos.getIndex();<a name="line.211"></a>
+<FONT color="green">212</FONT>    <a name="line.212"></a>
+<FONT color="green">213</FONT>            // parse whitespace<a name="line.213"></a>
+<FONT color="green">214</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.214"></a>
+<FONT color="green">215</FONT>    <a name="line.215"></a>
+<FONT color="green">216</FONT>            // parse numerator<a name="line.216"></a>
+<FONT color="green">217</FONT>            final BigInteger num = parseNextBigInteger(source, pos);<a name="line.217"></a>
+<FONT color="green">218</FONT>            if (num == null) {<a name="line.218"></a>
+<FONT color="green">219</FONT>                // invalid integer number<a name="line.219"></a>
+<FONT color="green">220</FONT>                // set index back to initial, error index should already be set<a name="line.220"></a>
+<FONT color="green">221</FONT>                // character examined.<a name="line.221"></a>
+<FONT color="green">222</FONT>                pos.setIndex(initialIndex);<a name="line.222"></a>
+<FONT color="green">223</FONT>                return null;<a name="line.223"></a>
+<FONT color="green">224</FONT>            }<a name="line.224"></a>
+<FONT color="green">225</FONT>    <a name="line.225"></a>
+<FONT color="green">226</FONT>            // parse '/'<a name="line.226"></a>
+<FONT color="green">227</FONT>            final int startIndex = pos.getIndex();<a name="line.227"></a>
+<FONT color="green">228</FONT>            final char c = parseNextCharacter(source, pos);<a name="line.228"></a>
+<FONT color="green">229</FONT>            switch (c) {<a name="line.229"></a>
+<FONT color="green">230</FONT>            case 0 :<a name="line.230"></a>
+<FONT color="green">231</FONT>                // no '/'<a name="line.231"></a>
+<FONT color="green">232</FONT>                // return num as a BigFraction<a name="line.232"></a>
+<FONT color="green">233</FONT>                return new BigFraction(num);<a name="line.233"></a>
+<FONT color="green">234</FONT>            case '/' :<a name="line.234"></a>
+<FONT color="green">235</FONT>                // found '/', continue parsing denominator<a name="line.235"></a>
+<FONT color="green">236</FONT>                break;<a name="line.236"></a>
+<FONT color="green">237</FONT>            default :<a name="line.237"></a>
+<FONT color="green">238</FONT>                // invalid '/'<a name="line.238"></a>
+<FONT color="green">239</FONT>                // set index back to initial, error index should be the last<a name="line.239"></a>
+<FONT color="green">240</FONT>                // character examined.<a name="line.240"></a>
+<FONT color="green">241</FONT>                pos.setIndex(initialIndex);<a name="line.241"></a>
+<FONT color="green">242</FONT>                pos.setErrorIndex(startIndex);<a name="line.242"></a>
+<FONT color="green">243</FONT>                return null;<a name="line.243"></a>
+<FONT color="green">244</FONT>            }<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>            // parse whitespace<a name="line.246"></a>
+<FONT color="green">247</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.247"></a>
+<FONT color="green">248</FONT>    <a name="line.248"></a>
+<FONT color="green">249</FONT>            // parse denominator<a name="line.249"></a>
+<FONT color="green">250</FONT>            final BigInteger den = parseNextBigInteger(source, pos);<a name="line.250"></a>
+<FONT color="green">251</FONT>            if (den == null) {<a name="line.251"></a>
+<FONT color="green">252</FONT>                // invalid integer number<a name="line.252"></a>
+<FONT color="green">253</FONT>                // set index back to initial, error index should already be set<a name="line.253"></a>
+<FONT color="green">254</FONT>                // character examined.<a name="line.254"></a>
+<FONT color="green">255</FONT>                pos.setIndex(initialIndex);<a name="line.255"></a>
+<FONT color="green">256</FONT>                return null;<a name="line.256"></a>
+<FONT color="green">257</FONT>            }<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>            return new BigFraction(num, den);<a name="line.259"></a>
+<FONT color="green">260</FONT>        }<a name="line.260"></a>
+<FONT color="green">261</FONT>    <a name="line.261"></a>
+<FONT color="green">262</FONT>        /**<a name="line.262"></a>
+<FONT color="green">263</FONT>         * Parses a string to produce a &lt;code&gt;BigInteger&lt;/code&gt;.<a name="line.263"></a>
+<FONT color="green">264</FONT>         * @param source the string to parse<a name="line.264"></a>
+<FONT color="green">265</FONT>         * @param pos input/ouput parsing parameter.<a name="line.265"></a>
+<FONT color="green">266</FONT>         * @return a parsed &lt;code&gt;BigInteger&lt;/code&gt; or null if string does not<a name="line.266"></a>
+<FONT color="green">267</FONT>         * contain a BigInteger at the specified position<a name="line.267"></a>
+<FONT color="green">268</FONT>         */<a name="line.268"></a>
+<FONT color="green">269</FONT>        protected BigInteger parseNextBigInteger(final String source,<a name="line.269"></a>
+<FONT color="green">270</FONT>                                                 final ParsePosition pos) {<a name="line.270"></a>
+<FONT color="green">271</FONT>    <a name="line.271"></a>
+<FONT color="green">272</FONT>            final int start = pos.getIndex();<a name="line.272"></a>
+<FONT color="green">273</FONT>             int end = (source.charAt(start) == '-') ? (start + 1) : start;<a name="line.273"></a>
+<FONT color="green">274</FONT>             while((end &lt; source.length()) &amp;&amp;<a name="line.274"></a>
+<FONT color="green">275</FONT>                   Character.isDigit(source.charAt(end))) {<a name="line.275"></a>
+<FONT color="green">276</FONT>                 ++end;<a name="line.276"></a>
+<FONT color="green">277</FONT>             }<a name="line.277"></a>
+<FONT color="green">278</FONT>    <a name="line.278"></a>
+<FONT color="green">279</FONT>             try {<a name="line.279"></a>
+<FONT color="green">280</FONT>                 BigInteger n = new BigInteger(source.substring(start, end));<a name="line.280"></a>
+<FONT color="green">281</FONT>                 pos.setIndex(end);<a name="line.281"></a>
+<FONT color="green">282</FONT>                 return n;<a name="line.282"></a>
+<FONT color="green">283</FONT>             } catch (NumberFormatException nfe) {<a name="line.283"></a>
+<FONT color="green">284</FONT>                 pos.setErrorIndex(start);<a name="line.284"></a>
+<FONT color="green">285</FONT>                 return null;<a name="line.285"></a>
+<FONT color="green">286</FONT>             }<a name="line.286"></a>
+<FONT color="green">287</FONT>    <a name="line.287"></a>
+<FONT color="green">288</FONT>        }<a name="line.288"></a>
+<FONT color="green">289</FONT>    <a name="line.289"></a>
+<FONT color="green">290</FONT>    }<a name="line.290"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/Fraction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,730 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.fraction;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.math.BigInteger;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.FieldElement;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Representation of a rational number.<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * implements Serializable since 2.0<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 1.1<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @version $Revision: 922715 $ $Date: 2010-03-13 20:38:14 -0500 (Sat, 13 Mar 2010) $<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public class Fraction<a name="line.34"></a>
+<FONT color="green">035</FONT>        extends Number<a name="line.35"></a>
+<FONT color="green">036</FONT>        implements FieldElement&lt;Fraction&gt;, Comparable&lt;Fraction&gt;, Serializable {<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** A fraction representing "2 / 1". */<a name="line.38"></a>
+<FONT color="green">039</FONT>        public static final Fraction TWO = new Fraction(2, 1);<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** A fraction representing "1". */<a name="line.41"></a>
+<FONT color="green">042</FONT>        public static final Fraction ONE = new Fraction(1, 1);<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** A fraction representing "0". */<a name="line.44"></a>
+<FONT color="green">045</FONT>        public static final Fraction ZERO = new Fraction(0, 1);<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** A fraction representing "4/5". */<a name="line.47"></a>
+<FONT color="green">048</FONT>        public static final Fraction FOUR_FIFTHS = new Fraction(4, 5);<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** A fraction representing "1/5". */<a name="line.50"></a>
+<FONT color="green">051</FONT>        public static final Fraction ONE_FIFTH = new Fraction(1, 5);<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** A fraction representing "1/2". */<a name="line.53"></a>
+<FONT color="green">054</FONT>        public static final Fraction ONE_HALF = new Fraction(1, 2);<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** A fraction representing "1/4". */<a name="line.56"></a>
+<FONT color="green">057</FONT>        public static final Fraction ONE_QUARTER = new Fraction(1, 4);<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** A fraction representing "1/3". */<a name="line.59"></a>
+<FONT color="green">060</FONT>        public static final Fraction ONE_THIRD = new Fraction(1, 3);<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** A fraction representing "3/5". */<a name="line.62"></a>
+<FONT color="green">063</FONT>        public static final Fraction THREE_FIFTHS = new Fraction(3, 5);<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** A fraction representing "3/4". */<a name="line.65"></a>
+<FONT color="green">066</FONT>        public static final Fraction THREE_QUARTERS = new Fraction(3, 4);<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /** A fraction representing "2/5". */<a name="line.68"></a>
+<FONT color="green">069</FONT>        public static final Fraction TWO_FIFTHS = new Fraction(2, 5);<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** A fraction representing "2/4". */<a name="line.71"></a>
+<FONT color="green">072</FONT>        public static final Fraction TWO_QUARTERS = new Fraction(2, 4);<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /** A fraction representing "2/3". */<a name="line.74"></a>
+<FONT color="green">075</FONT>        public static final Fraction TWO_THIRDS = new Fraction(2, 3);<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** A fraction representing "-1 / 1". */<a name="line.77"></a>
+<FONT color="green">078</FONT>        public static final Fraction MINUS_ONE = new Fraction(-1, 1);<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /** Message for zero denominator. */<a name="line.80"></a>
+<FONT color="green">081</FONT>        private static final String ZERO_DENOMINATOR_MESSAGE =<a name="line.81"></a>
+<FONT color="green">082</FONT>            "zero denominator in fraction {0}/{1}";<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /** Message for overflow. */<a name="line.84"></a>
+<FONT color="green">085</FONT>        private static final String OVERFLOW_MESSAGE =<a name="line.85"></a>
+<FONT color="green">086</FONT>            "overflow in fraction {0}/{1}, cannot negate";<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>        /** Message for null fraction. */<a name="line.88"></a>
+<FONT color="green">089</FONT>        private static final String NULL_FRACTION =<a name="line.89"></a>
+<FONT color="green">090</FONT>            "null fraction";<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /** Serializable version identifier */<a name="line.92"></a>
+<FONT color="green">093</FONT>        private static final long serialVersionUID = 3698073679419233275L;<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /** The denominator. */<a name="line.95"></a>
+<FONT color="green">096</FONT>        private final int denominator;<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /** The numerator. */<a name="line.98"></a>
+<FONT color="green">099</FONT>        private final int numerator;<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /**<a name="line.101"></a>
+<FONT color="green">102</FONT>         * Create a fraction given the double value.<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @param value the double value to convert to a fraction.<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @throws FractionConversionException if the continued fraction failed to<a name="line.104"></a>
+<FONT color="green">105</FONT>         *         converge.<a name="line.105"></a>
+<FONT color="green">106</FONT>         */<a name="line.106"></a>
+<FONT color="green">107</FONT>        public Fraction(double value) throws FractionConversionException {<a name="line.107"></a>
+<FONT color="green">108</FONT>            this(value, 1.0e-5, 100);<a name="line.108"></a>
+<FONT color="green">109</FONT>        }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /**<a name="line.111"></a>
+<FONT color="green">112</FONT>         * Create a fraction given the double value and maximum error allowed.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * &lt;p&gt;<a name="line.113"></a>
+<FONT color="green">114</FONT>         * References:<a name="line.114"></a>
+<FONT color="green">115</FONT>         * &lt;ul&gt;<a name="line.115"></a>
+<FONT color="green">116</FONT>         * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/ContinuedFraction.html"&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * Continued Fraction&lt;/a&gt; equations (11) and (22)-(26)&lt;/li&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>         * &lt;/ul&gt;<a name="line.118"></a>
+<FONT color="green">119</FONT>         * &lt;/p&gt;<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @param value the double value to convert to a fraction.<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @param epsilon maximum error allowed.  The resulting fraction is within<a name="line.121"></a>
+<FONT color="green">122</FONT>         *        &lt;code&gt;epsilon&lt;/code&gt; of &lt;code&gt;value&lt;/code&gt;, in absolute terms.<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @param maxIterations maximum number of convergents<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @throws FractionConversionException if the continued fraction failed to<a name="line.124"></a>
+<FONT color="green">125</FONT>         *         converge.<a name="line.125"></a>
+<FONT color="green">126</FONT>         */<a name="line.126"></a>
+<FONT color="green">127</FONT>        public Fraction(double value, double epsilon, int maxIterations)<a name="line.127"></a>
+<FONT color="green">128</FONT>            throws FractionConversionException<a name="line.128"></a>
+<FONT color="green">129</FONT>        {<a name="line.129"></a>
+<FONT color="green">130</FONT>            this(value, epsilon, Integer.MAX_VALUE, maxIterations);<a name="line.130"></a>
+<FONT color="green">131</FONT>        }<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>        /**<a name="line.133"></a>
+<FONT color="green">134</FONT>         * Create a fraction given the double value and maximum denominator.<a name="line.134"></a>
+<FONT color="green">135</FONT>         * &lt;p&gt;<a name="line.135"></a>
+<FONT color="green">136</FONT>         * References:<a name="line.136"></a>
+<FONT color="green">137</FONT>         * &lt;ul&gt;<a name="line.137"></a>
+<FONT color="green">138</FONT>         * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/ContinuedFraction.html"&gt;<a name="line.138"></a>
+<FONT color="green">139</FONT>         * Continued Fraction&lt;/a&gt; equations (11) and (22)-(26)&lt;/li&gt;<a name="line.139"></a>
+<FONT color="green">140</FONT>         * &lt;/ul&gt;<a name="line.140"></a>
+<FONT color="green">141</FONT>         * &lt;/p&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>         * @param value the double value to convert to a fraction.<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @param maxDenominator The maximum allowed value for denominator<a name="line.143"></a>
+<FONT color="green">144</FONT>         * @throws FractionConversionException if the continued fraction failed to<a name="line.144"></a>
+<FONT color="green">145</FONT>         *         converge<a name="line.145"></a>
+<FONT color="green">146</FONT>         */<a name="line.146"></a>
+<FONT color="green">147</FONT>        public Fraction(double value, int maxDenominator)<a name="line.147"></a>
+<FONT color="green">148</FONT>            throws FractionConversionException<a name="line.148"></a>
+<FONT color="green">149</FONT>        {<a name="line.149"></a>
+<FONT color="green">150</FONT>           this(value, 0, maxDenominator, 100);<a name="line.150"></a>
+<FONT color="green">151</FONT>        }<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>        /**<a name="line.153"></a>
+<FONT color="green">154</FONT>         * Create a fraction given the double value and either the maximum error<a name="line.154"></a>
+<FONT color="green">155</FONT>         * allowed or the maximum number of denominator digits.<a name="line.155"></a>
+<FONT color="green">156</FONT>         * &lt;p&gt;<a name="line.156"></a>
+<FONT color="green">157</FONT>         *<a name="line.157"></a>
+<FONT color="green">158</FONT>         * NOTE: This constructor is called with EITHER<a name="line.158"></a>
+<FONT color="green">159</FONT>         *   - a valid epsilon value and the maxDenominator set to Integer.MAX_VALUE<a name="line.159"></a>
+<FONT color="green">160</FONT>         *     (that way the maxDenominator has no effect).<a name="line.160"></a>
+<FONT color="green">161</FONT>         * OR<a name="line.161"></a>
+<FONT color="green">162</FONT>         *   - a valid maxDenominator value and the epsilon value set to zero<a name="line.162"></a>
+<FONT color="green">163</FONT>         *     (that way epsilon only has effect if there is an exact match before<a name="line.163"></a>
+<FONT color="green">164</FONT>         *     the maxDenominator value is reached).<a name="line.164"></a>
+<FONT color="green">165</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.165"></a>
+<FONT color="green">166</FONT>         *<a name="line.166"></a>
+<FONT color="green">167</FONT>         * It has been done this way so that the same code can be (re)used for both<a name="line.167"></a>
+<FONT color="green">168</FONT>         * scenarios. However this could be confusing to users if it were part of<a name="line.168"></a>
+<FONT color="green">169</FONT>         * the public API and this constructor should therefore remain PRIVATE.<a name="line.169"></a>
+<FONT color="green">170</FONT>         * &lt;/p&gt;<a name="line.170"></a>
+<FONT color="green">171</FONT>         *<a name="line.171"></a>
+<FONT color="green">172</FONT>         * See JIRA issue ticket MATH-181 for more details:<a name="line.172"></a>
+<FONT color="green">173</FONT>         *<a name="line.173"></a>
+<FONT color="green">174</FONT>         *     https://issues.apache.org/jira/browse/MATH-181<a name="line.174"></a>
+<FONT color="green">175</FONT>         *<a name="line.175"></a>
+<FONT color="green">176</FONT>         * @param value the double value to convert to a fraction.<a name="line.176"></a>
+<FONT color="green">177</FONT>         * @param epsilon maximum error allowed.  The resulting fraction is within<a name="line.177"></a>
+<FONT color="green">178</FONT>         *        &lt;code&gt;epsilon&lt;/code&gt; of &lt;code&gt;value&lt;/code&gt;, in absolute terms.<a name="line.178"></a>
+<FONT color="green">179</FONT>         * @param maxDenominator maximum denominator value allowed.<a name="line.179"></a>
+<FONT color="green">180</FONT>         * @param maxIterations maximum number of convergents<a name="line.180"></a>
+<FONT color="green">181</FONT>         * @throws FractionConversionException if the continued fraction failed to<a name="line.181"></a>
+<FONT color="green">182</FONT>         *         converge.<a name="line.182"></a>
+<FONT color="green">183</FONT>         */<a name="line.183"></a>
+<FONT color="green">184</FONT>        private Fraction(double value, double epsilon, int maxDenominator, int maxIterations)<a name="line.184"></a>
+<FONT color="green">185</FONT>            throws FractionConversionException<a name="line.185"></a>
+<FONT color="green">186</FONT>        {<a name="line.186"></a>
+<FONT color="green">187</FONT>            long overflow = Integer.MAX_VALUE;<a name="line.187"></a>
+<FONT color="green">188</FONT>            double r0 = value;<a name="line.188"></a>
+<FONT color="green">189</FONT>            long a0 = (long)Math.floor(r0);<a name="line.189"></a>
+<FONT color="green">190</FONT>            if (a0 &gt; overflow) {<a name="line.190"></a>
+<FONT color="green">191</FONT>                throw new FractionConversionException(value, a0, 1l);<a name="line.191"></a>
+<FONT color="green">192</FONT>            }<a name="line.192"></a>
+<FONT color="green">193</FONT>    <a name="line.193"></a>
+<FONT color="green">194</FONT>            // check for (almost) integer arguments, which should not go<a name="line.194"></a>
+<FONT color="green">195</FONT>            // to iterations.<a name="line.195"></a>
+<FONT color="green">196</FONT>            if (Math.abs(a0 - value) &lt; epsilon) {<a name="line.196"></a>
+<FONT color="green">197</FONT>                this.numerator = (int) a0;<a name="line.197"></a>
+<FONT color="green">198</FONT>                this.denominator = 1;<a name="line.198"></a>
+<FONT color="green">199</FONT>                return;<a name="line.199"></a>
+<FONT color="green">200</FONT>            }<a name="line.200"></a>
+<FONT color="green">201</FONT>    <a name="line.201"></a>
+<FONT color="green">202</FONT>            long p0 = 1;<a name="line.202"></a>
+<FONT color="green">203</FONT>            long q0 = 0;<a name="line.203"></a>
+<FONT color="green">204</FONT>            long p1 = a0;<a name="line.204"></a>
+<FONT color="green">205</FONT>            long q1 = 1;<a name="line.205"></a>
+<FONT color="green">206</FONT>    <a name="line.206"></a>
+<FONT color="green">207</FONT>            long p2 = 0;<a name="line.207"></a>
+<FONT color="green">208</FONT>            long q2 = 1;<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>            int n = 0;<a name="line.210"></a>
+<FONT color="green">211</FONT>            boolean stop = false;<a name="line.211"></a>
+<FONT color="green">212</FONT>            do {<a name="line.212"></a>
+<FONT color="green">213</FONT>                ++n;<a name="line.213"></a>
+<FONT color="green">214</FONT>                double r1 = 1.0 / (r0 - a0);<a name="line.214"></a>
+<FONT color="green">215</FONT>                long a1 = (long)Math.floor(r1);<a name="line.215"></a>
+<FONT color="green">216</FONT>                p2 = (a1 * p1) + p0;<a name="line.216"></a>
+<FONT color="green">217</FONT>                q2 = (a1 * q1) + q0;<a name="line.217"></a>
+<FONT color="green">218</FONT>                if ((p2 &gt; overflow) || (q2 &gt; overflow)) {<a name="line.218"></a>
+<FONT color="green">219</FONT>                    throw new FractionConversionException(value, p2, q2);<a name="line.219"></a>
+<FONT color="green">220</FONT>                }<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>                double convergent = (double)p2 / (double)q2;<a name="line.222"></a>
+<FONT color="green">223</FONT>                if (n &lt; maxIterations &amp;&amp; Math.abs(convergent - value) &gt; epsilon &amp;&amp; q2 &lt; maxDenominator) {<a name="line.223"></a>
+<FONT color="green">224</FONT>                    p0 = p1;<a name="line.224"></a>
+<FONT color="green">225</FONT>                    p1 = p2;<a name="line.225"></a>
+<FONT color="green">226</FONT>                    q0 = q1;<a name="line.226"></a>
+<FONT color="green">227</FONT>                    q1 = q2;<a name="line.227"></a>
+<FONT color="green">228</FONT>                    a0 = a1;<a name="line.228"></a>
+<FONT color="green">229</FONT>                    r0 = r1;<a name="line.229"></a>
+<FONT color="green">230</FONT>                } else {<a name="line.230"></a>
+<FONT color="green">231</FONT>                    stop = true;<a name="line.231"></a>
+<FONT color="green">232</FONT>                }<a name="line.232"></a>
+<FONT color="green">233</FONT>            } while (!stop);<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>            if (n &gt;= maxIterations) {<a name="line.235"></a>
+<FONT color="green">236</FONT>                throw new FractionConversionException(value, maxIterations);<a name="line.236"></a>
+<FONT color="green">237</FONT>            }<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>            if (q2 &lt; maxDenominator) {<a name="line.239"></a>
+<FONT color="green">240</FONT>                this.numerator = (int) p2;<a name="line.240"></a>
+<FONT color="green">241</FONT>                this.denominator = (int) q2;<a name="line.241"></a>
+<FONT color="green">242</FONT>            } else {<a name="line.242"></a>
+<FONT color="green">243</FONT>                this.numerator = (int) p1;<a name="line.243"></a>
+<FONT color="green">244</FONT>                this.denominator = (int) q1;<a name="line.244"></a>
+<FONT color="green">245</FONT>            }<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>        }<a name="line.247"></a>
+<FONT color="green">248</FONT>    <a name="line.248"></a>
+<FONT color="green">249</FONT>        /**<a name="line.249"></a>
+<FONT color="green">250</FONT>         * Create a fraction from an int.<a name="line.250"></a>
+<FONT color="green">251</FONT>         * The fraction is num / 1.<a name="line.251"></a>
+<FONT color="green">252</FONT>         * @param num the numerator.<a name="line.252"></a>
+<FONT color="green">253</FONT>         */<a name="line.253"></a>
+<FONT color="green">254</FONT>        public Fraction(int num) {<a name="line.254"></a>
+<FONT color="green">255</FONT>            this(num, 1);<a name="line.255"></a>
+<FONT color="green">256</FONT>        }<a name="line.256"></a>
+<FONT color="green">257</FONT>    <a name="line.257"></a>
+<FONT color="green">258</FONT>        /**<a name="line.258"></a>
+<FONT color="green">259</FONT>         * Create a fraction given the numerator and denominator.  The fraction is<a name="line.259"></a>
+<FONT color="green">260</FONT>         * reduced to lowest terms.<a name="line.260"></a>
+<FONT color="green">261</FONT>         * @param num the numerator.<a name="line.261"></a>
+<FONT color="green">262</FONT>         * @param den the denominator.<a name="line.262"></a>
+<FONT color="green">263</FONT>         * @throws ArithmeticException if the denominator is &lt;code&gt;zero&lt;/code&gt;<a name="line.263"></a>
+<FONT color="green">264</FONT>         */<a name="line.264"></a>
+<FONT color="green">265</FONT>        public Fraction(int num, int den) {<a name="line.265"></a>
+<FONT color="green">266</FONT>            if (den == 0) {<a name="line.266"></a>
+<FONT color="green">267</FONT>                throw MathRuntimeException.createArithmeticException(<a name="line.267"></a>
+<FONT color="green">268</FONT>                      ZERO_DENOMINATOR_MESSAGE, num, den);<a name="line.268"></a>
+<FONT color="green">269</FONT>            }<a name="line.269"></a>
+<FONT color="green">270</FONT>            if (den &lt; 0) {<a name="line.270"></a>
+<FONT color="green">271</FONT>                if (num == Integer.MIN_VALUE || den == Integer.MIN_VALUE) {<a name="line.271"></a>
+<FONT color="green">272</FONT>                    throw MathRuntimeException.createArithmeticException(<a name="line.272"></a>
+<FONT color="green">273</FONT>                          OVERFLOW_MESSAGE, num, den);<a name="line.273"></a>
+<FONT color="green">274</FONT>                }<a name="line.274"></a>
+<FONT color="green">275</FONT>                num = -num;<a name="line.275"></a>
+<FONT color="green">276</FONT>                den = -den;<a name="line.276"></a>
+<FONT color="green">277</FONT>            }<a name="line.277"></a>
+<FONT color="green">278</FONT>            // reduce numerator and denominator by greatest common denominator.<a name="line.278"></a>
+<FONT color="green">279</FONT>            final int d = MathUtils.gcd(num, den);<a name="line.279"></a>
+<FONT color="green">280</FONT>            if (d &gt; 1) {<a name="line.280"></a>
+<FONT color="green">281</FONT>                num /= d;<a name="line.281"></a>
+<FONT color="green">282</FONT>                den /= d;<a name="line.282"></a>
+<FONT color="green">283</FONT>            }<a name="line.283"></a>
+<FONT color="green">284</FONT>    <a name="line.284"></a>
+<FONT color="green">285</FONT>            // move sign to numerator.<a name="line.285"></a>
+<FONT color="green">286</FONT>            if (den &lt; 0) {<a name="line.286"></a>
+<FONT color="green">287</FONT>                num = -num;<a name="line.287"></a>
+<FONT color="green">288</FONT>                den = -den;<a name="line.288"></a>
+<FONT color="green">289</FONT>            }<a name="line.289"></a>
+<FONT color="green">290</FONT>            this.numerator   = num;<a name="line.290"></a>
+<FONT color="green">291</FONT>            this.denominator = den;<a name="line.291"></a>
+<FONT color="green">292</FONT>        }<a name="line.292"></a>
+<FONT color="green">293</FONT>    <a name="line.293"></a>
+<FONT color="green">294</FONT>        /**<a name="line.294"></a>
+<FONT color="green">295</FONT>         * Returns the absolute value of this fraction.<a name="line.295"></a>
+<FONT color="green">296</FONT>         * @return the absolute value.<a name="line.296"></a>
+<FONT color="green">297</FONT>         */<a name="line.297"></a>
+<FONT color="green">298</FONT>        public Fraction abs() {<a name="line.298"></a>
+<FONT color="green">299</FONT>            Fraction ret;<a name="line.299"></a>
+<FONT color="green">300</FONT>            if (numerator &gt;= 0) {<a name="line.300"></a>
+<FONT color="green">301</FONT>                ret = this;<a name="line.301"></a>
+<FONT color="green">302</FONT>            } else {<a name="line.302"></a>
+<FONT color="green">303</FONT>                ret = negate();<a name="line.303"></a>
+<FONT color="green">304</FONT>            }<a name="line.304"></a>
+<FONT color="green">305</FONT>            return ret;<a name="line.305"></a>
+<FONT color="green">306</FONT>        }<a name="line.306"></a>
+<FONT color="green">307</FONT>    <a name="line.307"></a>
+<FONT color="green">308</FONT>        /**<a name="line.308"></a>
+<FONT color="green">309</FONT>         * Compares this object to another based on size.<a name="line.309"></a>
+<FONT color="green">310</FONT>         * @param object the object to compare to<a name="line.310"></a>
+<FONT color="green">311</FONT>         * @return -1 if this is less than &lt;tt&gt;object&lt;/tt&gt;, +1 if this is greater<a name="line.311"></a>
+<FONT color="green">312</FONT>         *         than &lt;tt&gt;object&lt;/tt&gt;, 0 if they are equal.<a name="line.312"></a>
+<FONT color="green">313</FONT>         */<a name="line.313"></a>
+<FONT color="green">314</FONT>        public int compareTo(Fraction object) {<a name="line.314"></a>
+<FONT color="green">315</FONT>            long nOd = ((long) numerator) * object.denominator;<a name="line.315"></a>
+<FONT color="green">316</FONT>            long dOn = ((long) denominator) * object.numerator;<a name="line.316"></a>
+<FONT color="green">317</FONT>            return (nOd &lt; dOn) ? -1 : ((nOd &gt; dOn) ? +1 : 0);<a name="line.317"></a>
+<FONT color="green">318</FONT>        }<a name="line.318"></a>
+<FONT color="green">319</FONT>    <a name="line.319"></a>
+<FONT color="green">320</FONT>        /**<a name="line.320"></a>
+<FONT color="green">321</FONT>         * Gets the fraction as a &lt;tt&gt;double&lt;/tt&gt;. This calculates the fraction as<a name="line.321"></a>
+<FONT color="green">322</FONT>         * the numerator divided by denominator.<a name="line.322"></a>
+<FONT color="green">323</FONT>         * @return the fraction as a &lt;tt&gt;double&lt;/tt&gt;<a name="line.323"></a>
+<FONT color="green">324</FONT>         */<a name="line.324"></a>
+<FONT color="green">325</FONT>        @Override<a name="line.325"></a>
+<FONT color="green">326</FONT>        public double doubleValue() {<a name="line.326"></a>
+<FONT color="green">327</FONT>            return (double)numerator / (double)denominator;<a name="line.327"></a>
+<FONT color="green">328</FONT>        }<a name="line.328"></a>
+<FONT color="green">329</FONT>    <a name="line.329"></a>
+<FONT color="green">330</FONT>        /**<a name="line.330"></a>
+<FONT color="green">331</FONT>         * Test for the equality of two fractions.  If the lowest term<a name="line.331"></a>
+<FONT color="green">332</FONT>         * numerator and denominators are the same for both fractions, the two<a name="line.332"></a>
+<FONT color="green">333</FONT>         * fractions are considered to be equal.<a name="line.333"></a>
+<FONT color="green">334</FONT>         * @param other fraction to test for equality to this fraction<a name="line.334"></a>
+<FONT color="green">335</FONT>         * @return true if two fractions are equal, false if object is<a name="line.335"></a>
+<FONT color="green">336</FONT>         *         &lt;tt&gt;null&lt;/tt&gt;, not an instance of {@link Fraction}, or not equal<a name="line.336"></a>
+<FONT color="green">337</FONT>         *         to this fraction instance.<a name="line.337"></a>
+<FONT color="green">338</FONT>         */<a name="line.338"></a>
+<FONT color="green">339</FONT>        @Override<a name="line.339"></a>
+<FONT color="green">340</FONT>        public boolean equals(Object other) {<a name="line.340"></a>
+<FONT color="green">341</FONT>            if (this == other) {<a name="line.341"></a>
+<FONT color="green">342</FONT>                return true;<a name="line.342"></a>
+<FONT color="green">343</FONT>            }<a name="line.343"></a>
+<FONT color="green">344</FONT>            if (other instanceof Fraction) {<a name="line.344"></a>
+<FONT color="green">345</FONT>                // since fractions are always in lowest terms, numerators and<a name="line.345"></a>
+<FONT color="green">346</FONT>                // denominators can be compared directly for equality.<a name="line.346"></a>
+<FONT color="green">347</FONT>                Fraction rhs = (Fraction)other;<a name="line.347"></a>
+<FONT color="green">348</FONT>                return (numerator == rhs.numerator) &amp;&amp;<a name="line.348"></a>
+<FONT color="green">349</FONT>                    (denominator == rhs.denominator);<a name="line.349"></a>
+<FONT color="green">350</FONT>            }<a name="line.350"></a>
+<FONT color="green">351</FONT>            return false;<a name="line.351"></a>
+<FONT color="green">352</FONT>        }<a name="line.352"></a>
+<FONT color="green">353</FONT>    <a name="line.353"></a>
+<FONT color="green">354</FONT>        /**<a name="line.354"></a>
+<FONT color="green">355</FONT>         * Gets the fraction as a &lt;tt&gt;float&lt;/tt&gt;. This calculates the fraction as<a name="line.355"></a>
+<FONT color="green">356</FONT>         * the numerator divided by denominator.<a name="line.356"></a>
+<FONT color="green">357</FONT>         * @return the fraction as a &lt;tt&gt;float&lt;/tt&gt;<a name="line.357"></a>
+<FONT color="green">358</FONT>         */<a name="line.358"></a>
+<FONT color="green">359</FONT>        @Override<a name="line.359"></a>
+<FONT color="green">360</FONT>        public float floatValue() {<a name="line.360"></a>
+<FONT color="green">361</FONT>            return (float)doubleValue();<a name="line.361"></a>
+<FONT color="green">362</FONT>        }<a name="line.362"></a>
+<FONT color="green">363</FONT>    <a name="line.363"></a>
+<FONT color="green">364</FONT>        /**<a name="line.364"></a>
+<FONT color="green">365</FONT>         * Access the denominator.<a name="line.365"></a>
+<FONT color="green">366</FONT>         * @return the denominator.<a name="line.366"></a>
+<FONT color="green">367</FONT>         */<a name="line.367"></a>
+<FONT color="green">368</FONT>        public int getDenominator() {<a name="line.368"></a>
+<FONT color="green">369</FONT>            return denominator;<a name="line.369"></a>
+<FONT color="green">370</FONT>        }<a name="line.370"></a>
+<FONT color="green">371</FONT>    <a name="line.371"></a>
+<FONT color="green">372</FONT>        /**<a name="line.372"></a>
+<FONT color="green">373</FONT>         * Access the numerator.<a name="line.373"></a>
+<FONT color="green">374</FONT>         * @return the numerator.<a name="line.374"></a>
+<FONT color="green">375</FONT>         */<a name="line.375"></a>
+<FONT color="green">376</FONT>        public int getNumerator() {<a name="line.376"></a>
+<FONT color="green">377</FONT>            return numerator;<a name="line.377"></a>
+<FONT color="green">378</FONT>        }<a name="line.378"></a>
+<FONT color="green">379</FONT>    <a name="line.379"></a>
+<FONT color="green">380</FONT>        /**<a name="line.380"></a>
+<FONT color="green">381</FONT>         * Gets a hashCode for the fraction.<a name="line.381"></a>
+<FONT color="green">382</FONT>         * @return a hash code value for this object<a name="line.382"></a>
+<FONT color="green">383</FONT>         */<a name="line.383"></a>
+<FONT color="green">384</FONT>        @Override<a name="line.384"></a>
+<FONT color="green">385</FONT>        public int hashCode() {<a name="line.385"></a>
+<FONT color="green">386</FONT>            return 37 * (37 * 17 + numerator) + denominator;<a name="line.386"></a>
+<FONT color="green">387</FONT>        }<a name="line.387"></a>
+<FONT color="green">388</FONT>    <a name="line.388"></a>
+<FONT color="green">389</FONT>        /**<a name="line.389"></a>
+<FONT color="green">390</FONT>         * Gets the fraction as an &lt;tt&gt;int&lt;/tt&gt;. This returns the whole number part<a name="line.390"></a>
+<FONT color="green">391</FONT>         * of the fraction.<a name="line.391"></a>
+<FONT color="green">392</FONT>         * @return the whole number fraction part<a name="line.392"></a>
+<FONT color="green">393</FONT>         */<a name="line.393"></a>
+<FONT color="green">394</FONT>        @Override<a name="line.394"></a>
+<FONT color="green">395</FONT>        public int intValue() {<a name="line.395"></a>
+<FONT color="green">396</FONT>            return (int)doubleValue();<a name="line.396"></a>
+<FONT color="green">397</FONT>        }<a name="line.397"></a>
+<FONT color="green">398</FONT>    <a name="line.398"></a>
+<FONT color="green">399</FONT>        /**<a name="line.399"></a>
+<FONT color="green">400</FONT>         * Gets the fraction as a &lt;tt&gt;long&lt;/tt&gt;. This returns the whole number part<a name="line.400"></a>
+<FONT color="green">401</FONT>         * of the fraction.<a name="line.401"></a>
+<FONT color="green">402</FONT>         * @return the whole number fraction part<a name="line.402"></a>
+<FONT color="green">403</FONT>         */<a name="line.403"></a>
+<FONT color="green">404</FONT>        @Override<a name="line.404"></a>
+<FONT color="green">405</FONT>        public long longValue() {<a name="line.405"></a>
+<FONT color="green">406</FONT>            return (long)doubleValue();<a name="line.406"></a>
+<FONT color="green">407</FONT>        }<a name="line.407"></a>
+<FONT color="green">408</FONT>    <a name="line.408"></a>
+<FONT color="green">409</FONT>        /**<a name="line.409"></a>
+<FONT color="green">410</FONT>         * Return the additive inverse of this fraction.<a name="line.410"></a>
+<FONT color="green">411</FONT>         * @return the negation of this fraction.<a name="line.411"></a>
+<FONT color="green">412</FONT>         */<a name="line.412"></a>
+<FONT color="green">413</FONT>        public Fraction negate() {<a name="line.413"></a>
+<FONT color="green">414</FONT>            if (numerator==Integer.MIN_VALUE) {<a name="line.414"></a>
+<FONT color="green">415</FONT>                throw MathRuntimeException.createArithmeticException(<a name="line.415"></a>
+<FONT color="green">416</FONT>                      OVERFLOW_MESSAGE, numerator, denominator);<a name="line.416"></a>
+<FONT color="green">417</FONT>            }<a name="line.417"></a>
+<FONT color="green">418</FONT>            return new Fraction(-numerator, denominator);<a name="line.418"></a>
+<FONT color="green">419</FONT>        }<a name="line.419"></a>
+<FONT color="green">420</FONT>    <a name="line.420"></a>
+<FONT color="green">421</FONT>        /**<a name="line.421"></a>
+<FONT color="green">422</FONT>         * Return the multiplicative inverse of this fraction.<a name="line.422"></a>
+<FONT color="green">423</FONT>         * @return the reciprocal fraction<a name="line.423"></a>
+<FONT color="green">424</FONT>         */<a name="line.424"></a>
+<FONT color="green">425</FONT>        public Fraction reciprocal() {<a name="line.425"></a>
+<FONT color="green">426</FONT>            return new Fraction(denominator, numerator);<a name="line.426"></a>
+<FONT color="green">427</FONT>        }<a name="line.427"></a>
+<FONT color="green">428</FONT>    <a name="line.428"></a>
+<FONT color="green">429</FONT>        /**<a name="line.429"></a>
+<FONT color="green">430</FONT>         * &lt;p&gt;Adds the value of this fraction to another, returning the result in reduced form.<a name="line.430"></a>
+<FONT color="green">431</FONT>         * The algorithm follows Knuth, 4.5.1.&lt;/p&gt;<a name="line.431"></a>
+<FONT color="green">432</FONT>         *<a name="line.432"></a>
+<FONT color="green">433</FONT>         * @param fraction  the fraction to add, must not be &lt;code&gt;null&lt;/code&gt;<a name="line.433"></a>
+<FONT color="green">434</FONT>         * @return a &lt;code&gt;Fraction&lt;/code&gt; instance with the resulting values<a name="line.434"></a>
+<FONT color="green">435</FONT>         * @throws IllegalArgumentException if the fraction is &lt;code&gt;null&lt;/code&gt;<a name="line.435"></a>
+<FONT color="green">436</FONT>         * @throws ArithmeticException if the resulting numerator or denominator exceeds<a name="line.436"></a>
+<FONT color="green">437</FONT>         *  &lt;code&gt;Integer.MAX_VALUE&lt;/code&gt;<a name="line.437"></a>
+<FONT color="green">438</FONT>         */<a name="line.438"></a>
+<FONT color="green">439</FONT>        public Fraction add(Fraction fraction) {<a name="line.439"></a>
+<FONT color="green">440</FONT>            return addSub(fraction, true /* add */);<a name="line.440"></a>
+<FONT color="green">441</FONT>        }<a name="line.441"></a>
+<FONT color="green">442</FONT>    <a name="line.442"></a>
+<FONT color="green">443</FONT>        /**<a name="line.443"></a>
+<FONT color="green">444</FONT>         * Add an integer to the fraction.<a name="line.444"></a>
+<FONT color="green">445</FONT>         * @param i the &lt;tt&gt;integer&lt;/tt&gt; to add.<a name="line.445"></a>
+<FONT color="green">446</FONT>         * @return this + i<a name="line.446"></a>
+<FONT color="green">447</FONT>         */<a name="line.447"></a>
+<FONT color="green">448</FONT>        public Fraction add(final int i) {<a name="line.448"></a>
+<FONT color="green">449</FONT>            return new Fraction(numerator + i * denominator, denominator);<a name="line.449"></a>
+<FONT color="green">450</FONT>        }<a name="line.450"></a>
+<FONT color="green">451</FONT>    <a name="line.451"></a>
+<FONT color="green">452</FONT>        /**<a name="line.452"></a>
+<FONT color="green">453</FONT>         * &lt;p&gt;Subtracts the value of another fraction from the value of this one,<a name="line.453"></a>
+<FONT color="green">454</FONT>         * returning the result in reduced form.&lt;/p&gt;<a name="line.454"></a>
+<FONT color="green">455</FONT>         *<a name="line.455"></a>
+<FONT color="green">456</FONT>         * @param fraction  the fraction to subtract, must not be &lt;code&gt;null&lt;/code&gt;<a name="line.456"></a>
+<FONT color="green">457</FONT>         * @return a &lt;code&gt;Fraction&lt;/code&gt; instance with the resulting values<a name="line.457"></a>
+<FONT color="green">458</FONT>         * @throws IllegalArgumentException if the fraction is &lt;code&gt;null&lt;/code&gt;<a name="line.458"></a>
+<FONT color="green">459</FONT>         * @throws ArithmeticException if the resulting numerator or denominator<a name="line.459"></a>
+<FONT color="green">460</FONT>         *   cannot be represented in an &lt;code&gt;int&lt;/code&gt;.<a name="line.460"></a>
+<FONT color="green">461</FONT>         */<a name="line.461"></a>
+<FONT color="green">462</FONT>        public Fraction subtract(Fraction fraction) {<a name="line.462"></a>
+<FONT color="green">463</FONT>            return addSub(fraction, false /* subtract */);<a name="line.463"></a>
+<FONT color="green">464</FONT>        }<a name="line.464"></a>
+<FONT color="green">465</FONT>    <a name="line.465"></a>
+<FONT color="green">466</FONT>        /**<a name="line.466"></a>
+<FONT color="green">467</FONT>         * Subtract an integer from the fraction.<a name="line.467"></a>
+<FONT color="green">468</FONT>         * @param i the &lt;tt&gt;integer&lt;/tt&gt; to subtract.<a name="line.468"></a>
+<FONT color="green">469</FONT>         * @return this - i<a name="line.469"></a>
+<FONT color="green">470</FONT>         */<a name="line.470"></a>
+<FONT color="green">471</FONT>        public Fraction subtract(final int i) {<a name="line.471"></a>
+<FONT color="green">472</FONT>            return new Fraction(numerator - i * denominator, denominator);<a name="line.472"></a>
+<FONT color="green">473</FONT>        }<a name="line.473"></a>
+<FONT color="green">474</FONT>    <a name="line.474"></a>
+<FONT color="green">475</FONT>        /**<a name="line.475"></a>
+<FONT color="green">476</FONT>         * Implement add and subtract using algorithm described in Knuth 4.5.1.<a name="line.476"></a>
+<FONT color="green">477</FONT>         *<a name="line.477"></a>
+<FONT color="green">478</FONT>         * @param fraction the fraction to subtract, must not be &lt;code&gt;null&lt;/code&gt;<a name="line.478"></a>
+<FONT color="green">479</FONT>         * @param isAdd true to add, false to subtract<a name="line.479"></a>
+<FONT color="green">480</FONT>         * @return a &lt;code&gt;Fraction&lt;/code&gt; instance with the resulting values<a name="line.480"></a>
+<FONT color="green">481</FONT>         * @throws IllegalArgumentException if the fraction is &lt;code&gt;null&lt;/code&gt;<a name="line.481"></a>
+<FONT color="green">482</FONT>         * @throws ArithmeticException if the resulting numerator or denominator<a name="line.482"></a>
+<FONT color="green">483</FONT>         *   cannot be represented in an &lt;code&gt;int&lt;/code&gt;.<a name="line.483"></a>
+<FONT color="green">484</FONT>         */<a name="line.484"></a>
+<FONT color="green">485</FONT>        private Fraction addSub(Fraction fraction, boolean isAdd) {<a name="line.485"></a>
+<FONT color="green">486</FONT>            if (fraction == null) {<a name="line.486"></a>
+<FONT color="green">487</FONT>                throw MathRuntimeException.createIllegalArgumentException(NULL_FRACTION);<a name="line.487"></a>
+<FONT color="green">488</FONT>            }<a name="line.488"></a>
+<FONT color="green">489</FONT>            // zero is identity for addition.<a name="line.489"></a>
+<FONT color="green">490</FONT>            if (numerator == 0) {<a name="line.490"></a>
+<FONT color="green">491</FONT>                return isAdd ? fraction : fraction.negate();<a name="line.491"></a>
+<FONT color="green">492</FONT>            }<a name="line.492"></a>
+<FONT color="green">493</FONT>            if (fraction.numerator == 0) {<a name="line.493"></a>
+<FONT color="green">494</FONT>                return this;<a name="line.494"></a>
+<FONT color="green">495</FONT>            }<a name="line.495"></a>
+<FONT color="green">496</FONT>            // if denominators are randomly distributed, d1 will be 1 about 61%<a name="line.496"></a>
+<FONT color="green">497</FONT>            // of the time.<a name="line.497"></a>
+<FONT color="green">498</FONT>            int d1 = MathUtils.gcd(denominator, fraction.denominator);<a name="line.498"></a>
+<FONT color="green">499</FONT>            if (d1==1) {<a name="line.499"></a>
+<FONT color="green">500</FONT>                // result is ( (u*v' +/- u'v) / u'v')<a name="line.500"></a>
+<FONT color="green">501</FONT>                int uvp = MathUtils.mulAndCheck(numerator, fraction.denominator);<a name="line.501"></a>
+<FONT color="green">502</FONT>                int upv = MathUtils.mulAndCheck(fraction.numerator, denominator);<a name="line.502"></a>
+<FONT color="green">503</FONT>                return new Fraction<a name="line.503"></a>
+<FONT color="green">504</FONT>                    (isAdd ? MathUtils.addAndCheck(uvp, upv) :<a name="line.504"></a>
+<FONT color="green">505</FONT>                     MathUtils.subAndCheck(uvp, upv),<a name="line.505"></a>
+<FONT color="green">506</FONT>                     MathUtils.mulAndCheck(denominator, fraction.denominator));<a name="line.506"></a>
+<FONT color="green">507</FONT>            }<a name="line.507"></a>
+<FONT color="green">508</FONT>            // the quantity 't' requires 65 bits of precision; see knuth 4.5.1<a name="line.508"></a>
+<FONT color="green">509</FONT>            // exercise 7.  we're going to use a BigInteger.<a name="line.509"></a>
+<FONT color="green">510</FONT>            // t = u(v'/d1) +/- v(u'/d1)<a name="line.510"></a>
+<FONT color="green">511</FONT>            BigInteger uvp = BigInteger.valueOf(numerator)<a name="line.511"></a>
+<FONT color="green">512</FONT>            .multiply(BigInteger.valueOf(fraction.denominator/d1));<a name="line.512"></a>
+<FONT color="green">513</FONT>            BigInteger upv = BigInteger.valueOf(fraction.numerator)<a name="line.513"></a>
+<FONT color="green">514</FONT>            .multiply(BigInteger.valueOf(denominator/d1));<a name="line.514"></a>
+<FONT color="green">515</FONT>            BigInteger t = isAdd ? uvp.add(upv) : uvp.subtract(upv);<a name="line.515"></a>
+<FONT color="green">516</FONT>            // but d2 doesn't need extra precision because<a name="line.516"></a>
+<FONT color="green">517</FONT>            // d2 = gcd(t,d1) = gcd(t mod d1, d1)<a name="line.517"></a>
+<FONT color="green">518</FONT>            int tmodd1 = t.mod(BigInteger.valueOf(d1)).intValue();<a name="line.518"></a>
+<FONT color="green">519</FONT>            int d2 = (tmodd1==0)?d1:MathUtils.gcd(tmodd1, d1);<a name="line.519"></a>
+<FONT color="green">520</FONT>    <a name="line.520"></a>
+<FONT color="green">521</FONT>            // result is (t/d2) / (u'/d1)(v'/d2)<a name="line.521"></a>
+<FONT color="green">522</FONT>            BigInteger w = t.divide(BigInteger.valueOf(d2));<a name="line.522"></a>
+<FONT color="green">523</FONT>            if (w.bitLength() &gt; 31) {<a name="line.523"></a>
+<FONT color="green">524</FONT>                throw MathRuntimeException.createArithmeticException("overflow, numerator too large after multiply: {0}",<a name="line.524"></a>
+<FONT color="green">525</FONT>                                                                     w);<a name="line.525"></a>
+<FONT color="green">526</FONT>            }<a name="line.526"></a>
+<FONT color="green">527</FONT>            return new Fraction (w.intValue(),<a name="line.527"></a>
+<FONT color="green">528</FONT>                    MathUtils.mulAndCheck(denominator/d1,<a name="line.528"></a>
+<FONT color="green">529</FONT>                            fraction.denominator/d2));<a name="line.529"></a>
+<FONT color="green">530</FONT>        }<a name="line.530"></a>
+<FONT color="green">531</FONT>    <a name="line.531"></a>
+<FONT color="green">532</FONT>        /**<a name="line.532"></a>
+<FONT color="green">533</FONT>         * &lt;p&gt;Multiplies the value of this fraction by another, returning the<a name="line.533"></a>
+<FONT color="green">534</FONT>         * result in reduced form.&lt;/p&gt;<a name="line.534"></a>
+<FONT color="green">535</FONT>         *<a name="line.535"></a>
+<FONT color="green">536</FONT>         * @param fraction  the fraction to multiply by, must not be &lt;code&gt;null&lt;/code&gt;<a name="line.536"></a>
+<FONT color="green">537</FONT>         * @return a &lt;code&gt;Fraction&lt;/code&gt; instance with the resulting values<a name="line.537"></a>
+<FONT color="green">538</FONT>         * @throws IllegalArgumentException if the fraction is &lt;code&gt;null&lt;/code&gt;<a name="line.538"></a>
+<FONT color="green">539</FONT>         * @throws ArithmeticException if the resulting numerator or denominator exceeds<a name="line.539"></a>
+<FONT color="green">540</FONT>         *  &lt;code&gt;Integer.MAX_VALUE&lt;/code&gt;<a name="line.540"></a>
+<FONT color="green">541</FONT>         */<a name="line.541"></a>
+<FONT color="green">542</FONT>        public Fraction multiply(Fraction fraction) {<a name="line.542"></a>
+<FONT color="green">543</FONT>            if (fraction == null) {<a name="line.543"></a>
+<FONT color="green">544</FONT>                throw MathRuntimeException.createIllegalArgumentException(NULL_FRACTION);<a name="line.544"></a>
+<FONT color="green">545</FONT>            }<a name="line.545"></a>
+<FONT color="green">546</FONT>            if (numerator == 0 || fraction.numerator == 0) {<a name="line.546"></a>
+<FONT color="green">547</FONT>                return ZERO;<a name="line.547"></a>
+<FONT color="green">548</FONT>            }<a name="line.548"></a>
+<FONT color="green">549</FONT>            // knuth 4.5.1<a name="line.549"></a>
+<FONT color="green">550</FONT>            // make sure we don't overflow unless the result *must* overflow.<a name="line.550"></a>
+<FONT color="green">551</FONT>            int d1 = MathUtils.gcd(numerator, fraction.denominator);<a name="line.551"></a>
+<FONT color="green">552</FONT>            int d2 = MathUtils.gcd(fraction.numerator, denominator);<a name="line.552"></a>
+<FONT color="green">553</FONT>            return getReducedFraction<a name="line.553"></a>
+<FONT color="green">554</FONT>            (MathUtils.mulAndCheck(numerator/d1, fraction.numerator/d2),<a name="line.554"></a>
+<FONT color="green">555</FONT>                    MathUtils.mulAndCheck(denominator/d2, fraction.denominator/d1));<a name="line.555"></a>
+<FONT color="green">556</FONT>        }<a name="line.556"></a>
+<FONT color="green">557</FONT>    <a name="line.557"></a>
+<FONT color="green">558</FONT>        /**<a name="line.558"></a>
+<FONT color="green">559</FONT>         * Multiply the fraction by an integer.<a name="line.559"></a>
+<FONT color="green">560</FONT>         * @param i the &lt;tt&gt;integer&lt;/tt&gt; to multiply by.<a name="line.560"></a>
+<FONT color="green">561</FONT>         * @return this * i<a name="line.561"></a>
+<FONT color="green">562</FONT>         */<a name="line.562"></a>
+<FONT color="green">563</FONT>        public Fraction multiply(final int i) {<a name="line.563"></a>
+<FONT color="green">564</FONT>            return new Fraction(numerator * i, denominator);<a name="line.564"></a>
+<FONT color="green">565</FONT>        }<a name="line.565"></a>
+<FONT color="green">566</FONT>    <a name="line.566"></a>
+<FONT color="green">567</FONT>        /**<a name="line.567"></a>
+<FONT color="green">568</FONT>         * &lt;p&gt;Divide the value of this fraction by another.&lt;/p&gt;<a name="line.568"></a>
+<FONT color="green">569</FONT>         *<a name="line.569"></a>
+<FONT color="green">570</FONT>         * @param fraction  the fraction to divide by, must not be &lt;code&gt;null&lt;/code&gt;<a name="line.570"></a>
+<FONT color="green">571</FONT>         * @return a &lt;code&gt;Fraction&lt;/code&gt; instance with the resulting values<a name="line.571"></a>
+<FONT color="green">572</FONT>         * @throws IllegalArgumentException if the fraction is &lt;code&gt;null&lt;/code&gt;<a name="line.572"></a>
+<FONT color="green">573</FONT>         * @throws ArithmeticException if the fraction to divide by is zero<a name="line.573"></a>
+<FONT color="green">574</FONT>         * @throws ArithmeticException if the resulting numerator or denominator exceeds<a name="line.574"></a>
+<FONT color="green">575</FONT>         *  &lt;code&gt;Integer.MAX_VALUE&lt;/code&gt;<a name="line.575"></a>
+<FONT color="green">576</FONT>         */<a name="line.576"></a>
+<FONT color="green">577</FONT>        public Fraction divide(Fraction fraction) {<a name="line.577"></a>
+<FONT color="green">578</FONT>            if (fraction == null) {<a name="line.578"></a>
+<FONT color="green">579</FONT>                throw MathRuntimeException.createIllegalArgumentException(NULL_FRACTION);<a name="line.579"></a>
+<FONT color="green">580</FONT>            }<a name="line.580"></a>
+<FONT color="green">581</FONT>            if (fraction.numerator == 0) {<a name="line.581"></a>
+<FONT color="green">582</FONT>                throw MathRuntimeException.createArithmeticException(<a name="line.582"></a>
+<FONT color="green">583</FONT>                        "the fraction to divide by must not be zero: {0}/{1}",<a name="line.583"></a>
+<FONT color="green">584</FONT>                        fraction.numerator, fraction.denominator);<a name="line.584"></a>
+<FONT color="green">585</FONT>            }<a name="line.585"></a>
+<FONT color="green">586</FONT>            return multiply(fraction.reciprocal());<a name="line.586"></a>
+<FONT color="green">587</FONT>        }<a name="line.587"></a>
+<FONT color="green">588</FONT>    <a name="line.588"></a>
+<FONT color="green">589</FONT>        /**<a name="line.589"></a>
+<FONT color="green">590</FONT>         * Divide the fraction by an integer.<a name="line.590"></a>
+<FONT color="green">591</FONT>         * @param i the &lt;tt&gt;integer&lt;/tt&gt; to divide by.<a name="line.591"></a>
+<FONT color="green">592</FONT>         * @return this * i<a name="line.592"></a>
+<FONT color="green">593</FONT>         */<a name="line.593"></a>
+<FONT color="green">594</FONT>        public Fraction divide(final int i) {<a name="line.594"></a>
+<FONT color="green">595</FONT>            return new Fraction(numerator, denominator * i);<a name="line.595"></a>
+<FONT color="green">596</FONT>        }<a name="line.596"></a>
+<FONT color="green">597</FONT>    <a name="line.597"></a>
+<FONT color="green">598</FONT>        /**<a name="line.598"></a>
+<FONT color="green">599</FONT>         * &lt;p&gt;Creates a &lt;code&gt;Fraction&lt;/code&gt; instance with the 2 parts<a name="line.599"></a>
+<FONT color="green">600</FONT>         * of a fraction Y/Z.&lt;/p&gt;<a name="line.600"></a>
+<FONT color="green">601</FONT>         *<a name="line.601"></a>
+<FONT color="green">602</FONT>         * &lt;p&gt;Any negative signs are resolved to be on the numerator.&lt;/p&gt;<a name="line.602"></a>
+<FONT color="green">603</FONT>         *<a name="line.603"></a>
+<FONT color="green">604</FONT>         * @param numerator  the numerator, for example the three in 'three sevenths'<a name="line.604"></a>
+<FONT color="green">605</FONT>         * @param denominator  the denominator, for example the seven in 'three sevenths'<a name="line.605"></a>
+<FONT color="green">606</FONT>         * @return a new fraction instance, with the numerator and denominator reduced<a name="line.606"></a>
+<FONT color="green">607</FONT>         * @throws ArithmeticException if the denominator is &lt;code&gt;zero&lt;/code&gt;<a name="line.607"></a>
+<FONT color="green">608</FONT>         */<a name="line.608"></a>
+<FONT color="green">609</FONT>        public static Fraction getReducedFraction(int numerator, int denominator) {<a name="line.609"></a>
+<FONT color="green">610</FONT>            if (denominator == 0) {<a name="line.610"></a>
+<FONT color="green">611</FONT>                throw MathRuntimeException.createArithmeticException(<a name="line.611"></a>
+<FONT color="green">612</FONT>                      ZERO_DENOMINATOR_MESSAGE, numerator, denominator);<a name="line.612"></a>
+<FONT color="green">613</FONT>            }<a name="line.613"></a>
+<FONT color="green">614</FONT>            if (numerator==0) {<a name="line.614"></a>
+<FONT color="green">615</FONT>                return ZERO; // normalize zero.<a name="line.615"></a>
+<FONT color="green">616</FONT>            }<a name="line.616"></a>
+<FONT color="green">617</FONT>            // allow 2^k/-2^31 as a valid fraction (where k&gt;0)<a name="line.617"></a>
+<FONT color="green">618</FONT>            if (denominator==Integer.MIN_VALUE &amp;&amp; (numerator&amp;1)==0) {<a name="line.618"></a>
+<FONT color="green">619</FONT>                numerator/=2; denominator/=2;<a name="line.619"></a>
+<FONT color="green">620</FONT>            }<a name="line.620"></a>
+<FONT color="green">621</FONT>            if (denominator &lt; 0) {<a name="line.621"></a>
+<FONT color="green">622</FONT>                if (numerator==Integer.MIN_VALUE ||<a name="line.622"></a>
+<FONT color="green">623</FONT>                        denominator==Integer.MIN_VALUE) {<a name="line.623"></a>
+<FONT color="green">624</FONT>                    throw MathRuntimeException.createArithmeticException(<a name="line.624"></a>
+<FONT color="green">625</FONT>                          OVERFLOW_MESSAGE, numerator, denominator);<a name="line.625"></a>
+<FONT color="green">626</FONT>                }<a name="line.626"></a>
+<FONT color="green">627</FONT>                numerator = -numerator;<a name="line.627"></a>
+<FONT color="green">628</FONT>                denominator = -denominator;<a name="line.628"></a>
+<FONT color="green">629</FONT>            }<a name="line.629"></a>
+<FONT color="green">630</FONT>            // simplify fraction.<a name="line.630"></a>
+<FONT color="green">631</FONT>            int gcd = MathUtils.gcd(numerator, denominator);<a name="line.631"></a>
+<FONT color="green">632</FONT>            numerator /= gcd;<a name="line.632"></a>
+<FONT color="green">633</FONT>            denominator /= gcd;<a name="line.633"></a>
+<FONT color="green">634</FONT>            return new Fraction(numerator, denominator);<a name="line.634"></a>
+<FONT color="green">635</FONT>        }<a name="line.635"></a>
+<FONT color="green">636</FONT>    <a name="line.636"></a>
+<FONT color="green">637</FONT>        /**<a name="line.637"></a>
+<FONT color="green">638</FONT>         * &lt;p&gt;<a name="line.638"></a>
+<FONT color="green">639</FONT>         * Returns the &lt;code&gt;String&lt;/code&gt; representing this fraction, ie<a name="line.639"></a>
+<FONT color="green">640</FONT>         * "num / dem" or just "num" if the denominator is one.<a name="line.640"></a>
+<FONT color="green">641</FONT>         * &lt;/p&gt;<a name="line.641"></a>
+<FONT color="green">642</FONT>         *<a name="line.642"></a>
+<FONT color="green">643</FONT>         * @return a string representation of the fraction.<a name="line.643"></a>
+<FONT color="green">644</FONT>         * @see java.lang.Object#toString()<a name="line.644"></a>
+<FONT color="green">645</FONT>         */<a name="line.645"></a>
+<FONT color="green">646</FONT>        @Override<a name="line.646"></a>
+<FONT color="green">647</FONT>        public String toString() {<a name="line.647"></a>
+<FONT color="green">648</FONT>            String str = null;<a name="line.648"></a>
+<FONT color="green">649</FONT>            if (denominator == 1) {<a name="line.649"></a>
+<FONT color="green">650</FONT>                str = Integer.toString(numerator);<a name="line.650"></a>
+<FONT color="green">651</FONT>            } else if (numerator == 0) {<a name="line.651"></a>
+<FONT color="green">652</FONT>                str = "0";<a name="line.652"></a>
+<FONT color="green">653</FONT>            } else {<a name="line.653"></a>
+<FONT color="green">654</FONT>                str = numerator + " / " + denominator;<a name="line.654"></a>
+<FONT color="green">655</FONT>            }<a name="line.655"></a>
+<FONT color="green">656</FONT>            return str;<a name="line.656"></a>
+<FONT color="green">657</FONT>        }<a name="line.657"></a>
+<FONT color="green">658</FONT>    <a name="line.658"></a>
+<FONT color="green">659</FONT>        /** {@inheritDoc} */<a name="line.659"></a>
+<FONT color="green">660</FONT>        public FractionField getField() {<a name="line.660"></a>
+<FONT color="green">661</FONT>            return FractionField.getInstance();<a name="line.661"></a>
+<FONT color="green">662</FONT>        }<a name="line.662"></a>
+<FONT color="green">663</FONT>    <a name="line.663"></a>
+<FONT color="green">664</FONT>    }<a name="line.664"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/FractionConversionException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,121 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.fraction;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Error thrown when a double value cannot be converted to a fraction<a name="line.23"></a>
+<FONT color="green">024</FONT>     * in the allowed number of iterations.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @since 1.2<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public class FractionConversionException extends ConvergenceException {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /** Serializable version identifier. */<a name="line.31"></a>
+<FONT color="green">032</FONT>        private static final long serialVersionUID = -4661812640132576263L;<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /**<a name="line.34"></a>
+<FONT color="green">035</FONT>         * Constructs an exception with specified formatted detail message.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @param value double value to convert<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @param maxIterations maximal number of iterations allowed<a name="line.38"></a>
+<FONT color="green">039</FONT>         */<a name="line.39"></a>
+<FONT color="green">040</FONT>        public FractionConversionException(double value, int maxIterations) {<a name="line.40"></a>
+<FONT color="green">041</FONT>            super("Unable to convert {0} to fraction after {1} iterations", value, maxIterations);<a name="line.41"></a>
+<FONT color="green">042</FONT>        }<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /**<a name="line.44"></a>
+<FONT color="green">045</FONT>         * Constructs an exception with specified formatted detail message.<a name="line.45"></a>
+<FONT color="green">046</FONT>         * Message formatting is delegated to {@link java.text.MessageFormat}.<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @param value double value to convert<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @param p current numerator<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @param q current denominator<a name="line.49"></a>
+<FONT color="green">050</FONT>         */<a name="line.50"></a>
+<FONT color="green">051</FONT>        public FractionConversionException(double value, long p, long q) {<a name="line.51"></a>
+<FONT color="green">052</FONT>            super("Overflow trying to convert {0} to fraction ({1}/{2})", value, p, q);<a name="line.52"></a>
+<FONT color="green">053</FONT>        }<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>    }<a name="line.55"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/FractionField.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,144 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.fraction;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.Field;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Representation of the fractional numbers field.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * This class is a singleton.<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @see Fraction<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 2.0<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public class FractionField implements Field&lt;Fraction&gt;, Serializable  {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Serializable version identifier */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private static final long serialVersionUID = -1257768487499119313L;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Private constructor for the singleton.<a name="line.38"></a>
+<FONT color="green">039</FONT>         */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private FractionField() {<a name="line.40"></a>
+<FONT color="green">041</FONT>        }<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** Get the unique instance.<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @return the unique instance<a name="line.44"></a>
+<FONT color="green">045</FONT>         */<a name="line.45"></a>
+<FONT color="green">046</FONT>        public static FractionField getInstance() {<a name="line.46"></a>
+<FONT color="green">047</FONT>            return LazyHolder.INSTANCE;<a name="line.47"></a>
+<FONT color="green">048</FONT>        }<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** {@inheritDoc} */<a name="line.50"></a>
+<FONT color="green">051</FONT>        public Fraction getOne() {<a name="line.51"></a>
+<FONT color="green">052</FONT>            return Fraction.ONE;<a name="line.52"></a>
+<FONT color="green">053</FONT>        }<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** {@inheritDoc} */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public Fraction getZero() {<a name="line.56"></a>
+<FONT color="green">057</FONT>            return Fraction.ZERO;<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        // CHECKSTYLE: stop HideUtilityClassConstructor<a name="line.60"></a>
+<FONT color="green">061</FONT>        /** Holder for the instance.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * &lt;p&gt;We use here the Initialization On Demand Holder Idiom.&lt;/p&gt;<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        private static class LazyHolder {<a name="line.64"></a>
+<FONT color="green">065</FONT>            /** Cached field instance. */<a name="line.65"></a>
+<FONT color="green">066</FONT>            private static final FractionField INSTANCE = new FractionField();<a name="line.66"></a>
+<FONT color="green">067</FONT>        }<a name="line.67"></a>
+<FONT color="green">068</FONT>        // CHECKSTYLE: resume HideUtilityClassConstructor<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /** Handle deserialization of the singleton.<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @return the singleton instance<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        private Object readResolve() {<a name="line.73"></a>
+<FONT color="green">074</FONT>            // return the singleton instance<a name="line.74"></a>
+<FONT color="green">075</FONT>            return LazyHolder.INSTANCE;<a name="line.75"></a>
+<FONT color="green">076</FONT>        }<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>    }<a name="line.78"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/FractionFormat.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,339 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.fraction;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.text.FieldPosition;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.text.NumberFormat;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.text.ParseException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.text.ParsePosition;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import java.util.Locale;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>    /**<a name="line.29"></a>
+<FONT color="green">030</FONT>     * Formats a Fraction number in proper format or improper format.  The number<a name="line.30"></a>
+<FONT color="green">031</FONT>     * format for each of the whole number, numerator and, denominator can be<a name="line.31"></a>
+<FONT color="green">032</FONT>     * configured.<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @since 1.1<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.35"></a>
+<FONT color="green">036</FONT>     */<a name="line.36"></a>
+<FONT color="green">037</FONT>    public class FractionFormat extends AbstractFormat {<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Serializable version identifier */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private static final long serialVersionUID = 3008655719530972611L;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /**<a name="line.42"></a>
+<FONT color="green">043</FONT>         * Create an improper formatting instance with the default number format<a name="line.43"></a>
+<FONT color="green">044</FONT>         * for the numerator and denominator.<a name="line.44"></a>
+<FONT color="green">045</FONT>         */<a name="line.45"></a>
+<FONT color="green">046</FONT>        public FractionFormat() {<a name="line.46"></a>
+<FONT color="green">047</FONT>        }<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /**<a name="line.49"></a>
+<FONT color="green">050</FONT>         * Create an improper formatting instance with a custom number format for<a name="line.50"></a>
+<FONT color="green">051</FONT>         * both the numerator and denominator.<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @param format the custom format for both the numerator and denominator.<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        public FractionFormat(final NumberFormat format) {<a name="line.54"></a>
+<FONT color="green">055</FONT>            super(format);<a name="line.55"></a>
+<FONT color="green">056</FONT>        }<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /**<a name="line.58"></a>
+<FONT color="green">059</FONT>         * Create an improper formatting instance with a custom number format for<a name="line.59"></a>
+<FONT color="green">060</FONT>         * the numerator and a custom number format for the denominator.<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param numeratorFormat the custom format for the numerator.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param denominatorFormat the custom format for the denominator.<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public FractionFormat(final NumberFormat numeratorFormat,<a name="line.64"></a>
+<FONT color="green">065</FONT>                              final NumberFormat denominatorFormat) {<a name="line.65"></a>
+<FONT color="green">066</FONT>            super(numeratorFormat, denominatorFormat);<a name="line.66"></a>
+<FONT color="green">067</FONT>        }<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * Get the set of locales for which complex formats are available.  This<a name="line.70"></a>
+<FONT color="green">071</FONT>         * is the same set as the {@link NumberFormat} set.<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @return available complex format locales.<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        public static Locale[] getAvailableLocales() {<a name="line.74"></a>
+<FONT color="green">075</FONT>            return NumberFormat.getAvailableLocales();<a name="line.75"></a>
+<FONT color="green">076</FONT>        }<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /**<a name="line.78"></a>
+<FONT color="green">079</FONT>         * This static method calls formatFraction() on a default instance of<a name="line.79"></a>
+<FONT color="green">080</FONT>         * FractionFormat.<a name="line.80"></a>
+<FONT color="green">081</FONT>         *<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @param f Fraction object to format<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @return A formatted fraction in proper form.<a name="line.83"></a>
+<FONT color="green">084</FONT>         */<a name="line.84"></a>
+<FONT color="green">085</FONT>        public static String formatFraction(Fraction f) {<a name="line.85"></a>
+<FONT color="green">086</FONT>            return getImproperInstance().format(f);<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /**<a name="line.89"></a>
+<FONT color="green">090</FONT>         * Returns the default complex format for the current locale.<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @return the default complex format.<a name="line.91"></a>
+<FONT color="green">092</FONT>         */<a name="line.92"></a>
+<FONT color="green">093</FONT>        public static FractionFormat getImproperInstance() {<a name="line.93"></a>
+<FONT color="green">094</FONT>            return getImproperInstance(Locale.getDefault());<a name="line.94"></a>
+<FONT color="green">095</FONT>        }<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /**<a name="line.97"></a>
+<FONT color="green">098</FONT>         * Returns the default complex format for the given locale.<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @param locale the specific locale used by the format.<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @return the complex format specific to the given locale.<a name="line.100"></a>
+<FONT color="green">101</FONT>         */<a name="line.101"></a>
+<FONT color="green">102</FONT>        public static FractionFormat getImproperInstance(final Locale locale) {<a name="line.102"></a>
+<FONT color="green">103</FONT>            return new FractionFormat(getDefaultNumberFormat(locale));<a name="line.103"></a>
+<FONT color="green">104</FONT>        }<a name="line.104"></a>
+<FONT color="green">105</FONT>    <a name="line.105"></a>
+<FONT color="green">106</FONT>        /**<a name="line.106"></a>
+<FONT color="green">107</FONT>         * Returns the default complex format for the current locale.<a name="line.107"></a>
+<FONT color="green">108</FONT>         * @return the default complex format.<a name="line.108"></a>
+<FONT color="green">109</FONT>         */<a name="line.109"></a>
+<FONT color="green">110</FONT>        public static FractionFormat getProperInstance() {<a name="line.110"></a>
+<FONT color="green">111</FONT>            return getProperInstance(Locale.getDefault());<a name="line.111"></a>
+<FONT color="green">112</FONT>        }<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /**<a name="line.114"></a>
+<FONT color="green">115</FONT>         * Returns the default complex format for the given locale.<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @param locale the specific locale used by the format.<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @return the complex format specific to the given locale.<a name="line.117"></a>
+<FONT color="green">118</FONT>         */<a name="line.118"></a>
+<FONT color="green">119</FONT>        public static FractionFormat getProperInstance(final Locale locale) {<a name="line.119"></a>
+<FONT color="green">120</FONT>            return new ProperFractionFormat(getDefaultNumberFormat(locale));<a name="line.120"></a>
+<FONT color="green">121</FONT>        }<a name="line.121"></a>
+<FONT color="green">122</FONT>    <a name="line.122"></a>
+<FONT color="green">123</FONT>        /**<a name="line.123"></a>
+<FONT color="green">124</FONT>         * Create a default number format.  The default number format is based on<a name="line.124"></a>
+<FONT color="green">125</FONT>         * {@link NumberFormat#getNumberInstance(java.util.Locale)} with the only<a name="line.125"></a>
+<FONT color="green">126</FONT>         * customizing is the maximum number of fraction digits, which is set to 0.<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @return the default number format.<a name="line.127"></a>
+<FONT color="green">128</FONT>         */<a name="line.128"></a>
+<FONT color="green">129</FONT>        protected static NumberFormat getDefaultNumberFormat() {<a name="line.129"></a>
+<FONT color="green">130</FONT>            return getDefaultNumberFormat(Locale.getDefault());<a name="line.130"></a>
+<FONT color="green">131</FONT>        }<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>        /**<a name="line.133"></a>
+<FONT color="green">134</FONT>         * Formats a {@link Fraction} object to produce a string.  The fraction is<a name="line.134"></a>
+<FONT color="green">135</FONT>         * output in improper format.<a name="line.135"></a>
+<FONT color="green">136</FONT>         *<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @param fraction the object to format.<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @param toAppendTo where the text is to be appended<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @param pos On input: an alignment field, if desired. On output: the<a name="line.139"></a>
+<FONT color="green">140</FONT>         *            offsets of the alignment field<a name="line.140"></a>
+<FONT color="green">141</FONT>         * @return the value passed in as toAppendTo.<a name="line.141"></a>
+<FONT color="green">142</FONT>         */<a name="line.142"></a>
+<FONT color="green">143</FONT>        public StringBuffer format(final Fraction fraction,<a name="line.143"></a>
+<FONT color="green">144</FONT>                                   final StringBuffer toAppendTo, final FieldPosition pos) {<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>            pos.setBeginIndex(0);<a name="line.146"></a>
+<FONT color="green">147</FONT>            pos.setEndIndex(0);<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>            getNumeratorFormat().format(fraction.getNumerator(), toAppendTo, pos);<a name="line.149"></a>
+<FONT color="green">150</FONT>            toAppendTo.append(" / ");<a name="line.150"></a>
+<FONT color="green">151</FONT>            getDenominatorFormat().format(fraction.getDenominator(), toAppendTo,<a name="line.151"></a>
+<FONT color="green">152</FONT>                pos);<a name="line.152"></a>
+<FONT color="green">153</FONT>    <a name="line.153"></a>
+<FONT color="green">154</FONT>            return toAppendTo;<a name="line.154"></a>
+<FONT color="green">155</FONT>        }<a name="line.155"></a>
+<FONT color="green">156</FONT>    <a name="line.156"></a>
+<FONT color="green">157</FONT>        /**<a name="line.157"></a>
+<FONT color="green">158</FONT>         * Formats an object and appends the result to a StringBuffer. &lt;code&gt;obj&lt;/code&gt; must be either a<a name="line.158"></a>
+<FONT color="green">159</FONT>         * {@link Fraction} object or a {@link Number} object.  Any other type of<a name="line.159"></a>
+<FONT color="green">160</FONT>         * object will result in an {@link IllegalArgumentException} being thrown.<a name="line.160"></a>
+<FONT color="green">161</FONT>         *<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @param obj the object to format.<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @param toAppendTo where the text is to be appended<a name="line.163"></a>
+<FONT color="green">164</FONT>         * @param pos On input: an alignment field, if desired. On output: the<a name="line.164"></a>
+<FONT color="green">165</FONT>         *            offsets of the alignment field<a name="line.165"></a>
+<FONT color="green">166</FONT>         * @return the value passed in as toAppendTo.<a name="line.166"></a>
+<FONT color="green">167</FONT>         * @see java.text.Format#format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)<a name="line.167"></a>
+<FONT color="green">168</FONT>         * @throws IllegalArgumentException is &lt;code&gt;obj&lt;/code&gt; is not a valid type.<a name="line.168"></a>
+<FONT color="green">169</FONT>         */<a name="line.169"></a>
+<FONT color="green">170</FONT>        @Override<a name="line.170"></a>
+<FONT color="green">171</FONT>        public StringBuffer format(final Object obj,<a name="line.171"></a>
+<FONT color="green">172</FONT>                                   final StringBuffer toAppendTo, final FieldPosition pos) {<a name="line.172"></a>
+<FONT color="green">173</FONT>            StringBuffer ret = null;<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>            if (obj instanceof Fraction) {<a name="line.175"></a>
+<FONT color="green">176</FONT>                ret = format((Fraction) obj, toAppendTo, pos);<a name="line.176"></a>
+<FONT color="green">177</FONT>            } else if (obj instanceof Number) {<a name="line.177"></a>
+<FONT color="green">178</FONT>                try {<a name="line.178"></a>
+<FONT color="green">179</FONT>                    ret = format(new Fraction(((Number) obj).doubleValue()),<a name="line.179"></a>
+<FONT color="green">180</FONT>                                 toAppendTo, pos);<a name="line.180"></a>
+<FONT color="green">181</FONT>                } catch (ConvergenceException ex) {<a name="line.181"></a>
+<FONT color="green">182</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.182"></a>
+<FONT color="green">183</FONT>                        "cannot convert given object to a fraction number: {0}",<a name="line.183"></a>
+<FONT color="green">184</FONT>                        ex.getLocalizedMessage());<a name="line.184"></a>
+<FONT color="green">185</FONT>                }<a name="line.185"></a>
+<FONT color="green">186</FONT>            } else {<a name="line.186"></a>
+<FONT color="green">187</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.187"></a>
+<FONT color="green">188</FONT>                    "cannot format given object as a fraction number");<a name="line.188"></a>
+<FONT color="green">189</FONT>            }<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>            return ret;<a name="line.191"></a>
+<FONT color="green">192</FONT>        }<a name="line.192"></a>
+<FONT color="green">193</FONT>    <a name="line.193"></a>
+<FONT color="green">194</FONT>        /**<a name="line.194"></a>
+<FONT color="green">195</FONT>         * Parses a string to produce a {@link Fraction} object.<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @param source the string to parse<a name="line.196"></a>
+<FONT color="green">197</FONT>         * @return the parsed {@link Fraction} object.<a name="line.197"></a>
+<FONT color="green">198</FONT>         * @exception ParseException if the beginning of the specified string<a name="line.198"></a>
+<FONT color="green">199</FONT>         *            cannot be parsed.<a name="line.199"></a>
+<FONT color="green">200</FONT>         */<a name="line.200"></a>
+<FONT color="green">201</FONT>        @Override<a name="line.201"></a>
+<FONT color="green">202</FONT>        public Fraction parse(final String source) throws ParseException {<a name="line.202"></a>
+<FONT color="green">203</FONT>            final ParsePosition parsePosition = new ParsePosition(0);<a name="line.203"></a>
+<FONT color="green">204</FONT>            final Fraction result = parse(source, parsePosition);<a name="line.204"></a>
+<FONT color="green">205</FONT>            if (parsePosition.getIndex() == 0) {<a name="line.205"></a>
+<FONT color="green">206</FONT>                throw MathRuntimeException.createParseException(<a name="line.206"></a>
+<FONT color="green">207</FONT>                        parsePosition.getErrorIndex(),<a name="line.207"></a>
+<FONT color="green">208</FONT>                        "unparseable fraction number: \"{0}\"", source);<a name="line.208"></a>
+<FONT color="green">209</FONT>            }<a name="line.209"></a>
+<FONT color="green">210</FONT>            return result;<a name="line.210"></a>
+<FONT color="green">211</FONT>        }<a name="line.211"></a>
+<FONT color="green">212</FONT>    <a name="line.212"></a>
+<FONT color="green">213</FONT>        /**<a name="line.213"></a>
+<FONT color="green">214</FONT>         * Parses a string to produce a {@link Fraction} object.  This method<a name="line.214"></a>
+<FONT color="green">215</FONT>         * expects the string to be formatted as an improper fraction.<a name="line.215"></a>
+<FONT color="green">216</FONT>         * @param source the string to parse<a name="line.216"></a>
+<FONT color="green">217</FONT>         * @param pos input/ouput parsing parameter.<a name="line.217"></a>
+<FONT color="green">218</FONT>         * @return the parsed {@link Fraction} object.<a name="line.218"></a>
+<FONT color="green">219</FONT>         */<a name="line.219"></a>
+<FONT color="green">220</FONT>        @Override<a name="line.220"></a>
+<FONT color="green">221</FONT>        public Fraction parse(final String source, final ParsePosition pos) {<a name="line.221"></a>
+<FONT color="green">222</FONT>            final int initialIndex = pos.getIndex();<a name="line.222"></a>
+<FONT color="green">223</FONT>    <a name="line.223"></a>
+<FONT color="green">224</FONT>            // parse whitespace<a name="line.224"></a>
+<FONT color="green">225</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.225"></a>
+<FONT color="green">226</FONT>    <a name="line.226"></a>
+<FONT color="green">227</FONT>            // parse numerator<a name="line.227"></a>
+<FONT color="green">228</FONT>            final Number num = getNumeratorFormat().parse(source, pos);<a name="line.228"></a>
+<FONT color="green">229</FONT>            if (num == null) {<a name="line.229"></a>
+<FONT color="green">230</FONT>                // invalid integer number<a name="line.230"></a>
+<FONT color="green">231</FONT>                // set index back to initial, error index should already be set<a name="line.231"></a>
+<FONT color="green">232</FONT>                // character examined.<a name="line.232"></a>
+<FONT color="green">233</FONT>                pos.setIndex(initialIndex);<a name="line.233"></a>
+<FONT color="green">234</FONT>                return null;<a name="line.234"></a>
+<FONT color="green">235</FONT>            }<a name="line.235"></a>
+<FONT color="green">236</FONT>    <a name="line.236"></a>
+<FONT color="green">237</FONT>            // parse '/'<a name="line.237"></a>
+<FONT color="green">238</FONT>            final int startIndex = pos.getIndex();<a name="line.238"></a>
+<FONT color="green">239</FONT>            final char c = parseNextCharacter(source, pos);<a name="line.239"></a>
+<FONT color="green">240</FONT>            switch (c) {<a name="line.240"></a>
+<FONT color="green">241</FONT>            case 0 :<a name="line.241"></a>
+<FONT color="green">242</FONT>                // no '/'<a name="line.242"></a>
+<FONT color="green">243</FONT>                // return num as a fraction<a name="line.243"></a>
+<FONT color="green">244</FONT>                return new Fraction(num.intValue(), 1);<a name="line.244"></a>
+<FONT color="green">245</FONT>            case '/' :<a name="line.245"></a>
+<FONT color="green">246</FONT>                // found '/', continue parsing denominator<a name="line.246"></a>
+<FONT color="green">247</FONT>                break;<a name="line.247"></a>
+<FONT color="green">248</FONT>            default :<a name="line.248"></a>
+<FONT color="green">249</FONT>                // invalid '/'<a name="line.249"></a>
+<FONT color="green">250</FONT>                // set index back to initial, error index should be the last<a name="line.250"></a>
+<FONT color="green">251</FONT>                // character examined.<a name="line.251"></a>
+<FONT color="green">252</FONT>                pos.setIndex(initialIndex);<a name="line.252"></a>
+<FONT color="green">253</FONT>                pos.setErrorIndex(startIndex);<a name="line.253"></a>
+<FONT color="green">254</FONT>                return null;<a name="line.254"></a>
+<FONT color="green">255</FONT>            }<a name="line.255"></a>
+<FONT color="green">256</FONT>    <a name="line.256"></a>
+<FONT color="green">257</FONT>            // parse whitespace<a name="line.257"></a>
+<FONT color="green">258</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>            // parse denominator<a name="line.260"></a>
+<FONT color="green">261</FONT>            final Number den = getDenominatorFormat().parse(source, pos);<a name="line.261"></a>
+<FONT color="green">262</FONT>            if (den == null) {<a name="line.262"></a>
+<FONT color="green">263</FONT>                // invalid integer number<a name="line.263"></a>
+<FONT color="green">264</FONT>                // set index back to initial, error index should already be set<a name="line.264"></a>
+<FONT color="green">265</FONT>                // character examined.<a name="line.265"></a>
+<FONT color="green">266</FONT>                pos.setIndex(initialIndex);<a name="line.266"></a>
+<FONT color="green">267</FONT>                return null;<a name="line.267"></a>
+<FONT color="green">268</FONT>            }<a name="line.268"></a>
+<FONT color="green">269</FONT>    <a name="line.269"></a>
+<FONT color="green">270</FONT>            return new Fraction(num.intValue(), den.intValue());<a name="line.270"></a>
+<FONT color="green">271</FONT>        }<a name="line.271"></a>
+<FONT color="green">272</FONT>    <a name="line.272"></a>
+<FONT color="green">273</FONT>    }<a name="line.273"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/ProperBigFractionFormat.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,307 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.fraction;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.math.BigInteger;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.text.FieldPosition;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.text.NumberFormat;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.text.ParsePosition;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Formats a BigFraction number in proper format.  The number format for each of<a name="line.27"></a>
+<FONT color="green">028</FONT>     * the whole number, numerator and, denominator can be configured.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * Minus signs are only allowed in the whole number part - i.e.,<a name="line.30"></a>
+<FONT color="green">031</FONT>     * "-3 1/2" is legitimate and denotes -7/2, but "-3 -1/2" is invalid and<a name="line.31"></a>
+<FONT color="green">032</FONT>     * will result in a &lt;code&gt;ParseException&lt;/code&gt;.&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @since 1.1<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.35"></a>
+<FONT color="green">036</FONT>     */<a name="line.36"></a>
+<FONT color="green">037</FONT>    public class ProperBigFractionFormat extends BigFractionFormat {<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Serializable version identifier */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private static final long serialVersionUID = -6337346779577272307L;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** The format used for the whole number. */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private NumberFormat wholeFormat;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**<a name="line.45"></a>
+<FONT color="green">046</FONT>         * Create a proper formatting instance with the default number format for<a name="line.46"></a>
+<FONT color="green">047</FONT>         * the whole, numerator, and denominator.<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        public ProperBigFractionFormat() {<a name="line.49"></a>
+<FONT color="green">050</FONT>            this(getDefaultNumberFormat());<a name="line.50"></a>
+<FONT color="green">051</FONT>        }<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Create a proper formatting instance with a custom number format for the<a name="line.54"></a>
+<FONT color="green">055</FONT>         * whole, numerator, and denominator.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param format the custom format for the whole, numerator, and<a name="line.56"></a>
+<FONT color="green">057</FONT>         *        denominator.<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public ProperBigFractionFormat(final NumberFormat format) {<a name="line.59"></a>
+<FONT color="green">060</FONT>            this(format, (NumberFormat)format.clone(), (NumberFormat)format.clone());<a name="line.60"></a>
+<FONT color="green">061</FONT>        }<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /**<a name="line.63"></a>
+<FONT color="green">064</FONT>         * Create a proper formatting instance with a custom number format for each<a name="line.64"></a>
+<FONT color="green">065</FONT>         * of the whole, numerator, and denominator.<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @param wholeFormat the custom format for the whole.<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @param numeratorFormat the custom format for the numerator.<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param denominatorFormat the custom format for the denominator.<a name="line.68"></a>
+<FONT color="green">069</FONT>         */<a name="line.69"></a>
+<FONT color="green">070</FONT>        public ProperBigFractionFormat(final NumberFormat wholeFormat,<a name="line.70"></a>
+<FONT color="green">071</FONT>                                       final NumberFormat numeratorFormat,<a name="line.71"></a>
+<FONT color="green">072</FONT>                                       final NumberFormat denominatorFormat) {<a name="line.72"></a>
+<FONT color="green">073</FONT>            super(numeratorFormat, denominatorFormat);<a name="line.73"></a>
+<FONT color="green">074</FONT>            setWholeFormat(wholeFormat);<a name="line.74"></a>
+<FONT color="green">075</FONT>        }<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /**<a name="line.77"></a>
+<FONT color="green">078</FONT>         * Formats a {@link BigFraction} object to produce a string.  The BigFraction<a name="line.78"></a>
+<FONT color="green">079</FONT>         * is output in proper format.<a name="line.79"></a>
+<FONT color="green">080</FONT>         *<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @param fraction the object to format.<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @param toAppendTo where the text is to be appended<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param pos On input: an alignment field, if desired. On output: the<a name="line.83"></a>
+<FONT color="green">084</FONT>         *            offsets of the alignment field<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @return the value passed in as toAppendTo.<a name="line.85"></a>
+<FONT color="green">086</FONT>         */<a name="line.86"></a>
+<FONT color="green">087</FONT>        @Override<a name="line.87"></a>
+<FONT color="green">088</FONT>        public StringBuffer format(final BigFraction fraction,<a name="line.88"></a>
+<FONT color="green">089</FONT>                                   final StringBuffer toAppendTo, final FieldPosition pos) {<a name="line.89"></a>
+<FONT color="green">090</FONT>    <a name="line.90"></a>
+<FONT color="green">091</FONT>            pos.setBeginIndex(0);<a name="line.91"></a>
+<FONT color="green">092</FONT>            pos.setEndIndex(0);<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>            BigInteger num = fraction.getNumerator();<a name="line.94"></a>
+<FONT color="green">095</FONT>            BigInteger den = fraction.getDenominator();<a name="line.95"></a>
+<FONT color="green">096</FONT>            BigInteger whole = num.divide(den);<a name="line.96"></a>
+<FONT color="green">097</FONT>            num = num.remainder(den);<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>            if (!BigInteger.ZERO.equals(whole)) {<a name="line.99"></a>
+<FONT color="green">100</FONT>                getWholeFormat().format(whole, toAppendTo, pos);<a name="line.100"></a>
+<FONT color="green">101</FONT>                toAppendTo.append(' ');<a name="line.101"></a>
+<FONT color="green">102</FONT>                if (num.compareTo(BigInteger.ZERO) &lt; 0) {<a name="line.102"></a>
+<FONT color="green">103</FONT>                    num = num.negate();<a name="line.103"></a>
+<FONT color="green">104</FONT>                }<a name="line.104"></a>
+<FONT color="green">105</FONT>            }<a name="line.105"></a>
+<FONT color="green">106</FONT>            getNumeratorFormat().format(num, toAppendTo, pos);<a name="line.106"></a>
+<FONT color="green">107</FONT>            toAppendTo.append(" / ");<a name="line.107"></a>
+<FONT color="green">108</FONT>            getDenominatorFormat().format(den, toAppendTo, pos);<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>            return toAppendTo;<a name="line.110"></a>
+<FONT color="green">111</FONT>        }<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>        /**<a name="line.113"></a>
+<FONT color="green">114</FONT>         * Access the whole format.<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @return the whole format.<a name="line.115"></a>
+<FONT color="green">116</FONT>         */<a name="line.116"></a>
+<FONT color="green">117</FONT>        public NumberFormat getWholeFormat() {<a name="line.117"></a>
+<FONT color="green">118</FONT>            return wholeFormat;<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /**<a name="line.121"></a>
+<FONT color="green">122</FONT>         * Parses a string to produce a {@link BigFraction} object.  This method<a name="line.122"></a>
+<FONT color="green">123</FONT>         * expects the string to be formatted as a proper BigFraction.<a name="line.123"></a>
+<FONT color="green">124</FONT>         * &lt;p&gt;<a name="line.124"></a>
+<FONT color="green">125</FONT>         * Minus signs are only allowed in the whole number part - i.e.,<a name="line.125"></a>
+<FONT color="green">126</FONT>         * "-3 1/2" is legitimate and denotes -7/2, but "-3 -1/2" is invalid and<a name="line.126"></a>
+<FONT color="green">127</FONT>         * will result in a &lt;code&gt;ParseException&lt;/code&gt;.&lt;/p&gt;<a name="line.127"></a>
+<FONT color="green">128</FONT>         *<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @param source the string to parse<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @param pos input/ouput parsing parameter.<a name="line.130"></a>
+<FONT color="green">131</FONT>         * @return the parsed {@link BigFraction} object.<a name="line.131"></a>
+<FONT color="green">132</FONT>         */<a name="line.132"></a>
+<FONT color="green">133</FONT>        @Override<a name="line.133"></a>
+<FONT color="green">134</FONT>        public BigFraction parse(final String source, final ParsePosition pos) {<a name="line.134"></a>
+<FONT color="green">135</FONT>            // try to parse improper BigFraction<a name="line.135"></a>
+<FONT color="green">136</FONT>            BigFraction ret = super.parse(source, pos);<a name="line.136"></a>
+<FONT color="green">137</FONT>            if (ret != null) {<a name="line.137"></a>
+<FONT color="green">138</FONT>                return ret;<a name="line.138"></a>
+<FONT color="green">139</FONT>            }<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>            final int initialIndex = pos.getIndex();<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>            // parse whitespace<a name="line.143"></a>
+<FONT color="green">144</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>            // parse whole<a name="line.146"></a>
+<FONT color="green">147</FONT>            BigInteger whole = parseNextBigInteger(source, pos);<a name="line.147"></a>
+<FONT color="green">148</FONT>            if (whole == null) {<a name="line.148"></a>
+<FONT color="green">149</FONT>                // invalid integer number<a name="line.149"></a>
+<FONT color="green">150</FONT>                // set index back to initial, error index should already be set<a name="line.150"></a>
+<FONT color="green">151</FONT>                // character examined.<a name="line.151"></a>
+<FONT color="green">152</FONT>                pos.setIndex(initialIndex);<a name="line.152"></a>
+<FONT color="green">153</FONT>                return null;<a name="line.153"></a>
+<FONT color="green">154</FONT>            }<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>            // parse whitespace<a name="line.156"></a>
+<FONT color="green">157</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>            // parse numerator<a name="line.159"></a>
+<FONT color="green">160</FONT>            BigInteger num = parseNextBigInteger(source, pos);<a name="line.160"></a>
+<FONT color="green">161</FONT>            if (num == null) {<a name="line.161"></a>
+<FONT color="green">162</FONT>                // invalid integer number<a name="line.162"></a>
+<FONT color="green">163</FONT>                // set index back to initial, error index should already be set<a name="line.163"></a>
+<FONT color="green">164</FONT>                // character examined.<a name="line.164"></a>
+<FONT color="green">165</FONT>                pos.setIndex(initialIndex);<a name="line.165"></a>
+<FONT color="green">166</FONT>                return null;<a name="line.166"></a>
+<FONT color="green">167</FONT>            }<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>            if (num.compareTo(BigInteger.ZERO) &lt; 0) {<a name="line.169"></a>
+<FONT color="green">170</FONT>                // minus signs should be leading, invalid expression<a name="line.170"></a>
+<FONT color="green">171</FONT>                pos.setIndex(initialIndex);<a name="line.171"></a>
+<FONT color="green">172</FONT>                return null;<a name="line.172"></a>
+<FONT color="green">173</FONT>            }<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>            // parse '/'<a name="line.175"></a>
+<FONT color="green">176</FONT>            final int startIndex = pos.getIndex();<a name="line.176"></a>
+<FONT color="green">177</FONT>            final char c = parseNextCharacter(source, pos);<a name="line.177"></a>
+<FONT color="green">178</FONT>            switch (c) {<a name="line.178"></a>
+<FONT color="green">179</FONT>            case 0 :<a name="line.179"></a>
+<FONT color="green">180</FONT>                // no '/'<a name="line.180"></a>
+<FONT color="green">181</FONT>                // return num as a BigFraction<a name="line.181"></a>
+<FONT color="green">182</FONT>                return new BigFraction(num);<a name="line.182"></a>
+<FONT color="green">183</FONT>            case '/' :<a name="line.183"></a>
+<FONT color="green">184</FONT>                // found '/', continue parsing denominator<a name="line.184"></a>
+<FONT color="green">185</FONT>                break;<a name="line.185"></a>
+<FONT color="green">186</FONT>            default :<a name="line.186"></a>
+<FONT color="green">187</FONT>                // invalid '/'<a name="line.187"></a>
+<FONT color="green">188</FONT>                // set index back to initial, error index should be the last<a name="line.188"></a>
+<FONT color="green">189</FONT>                // character examined.<a name="line.189"></a>
+<FONT color="green">190</FONT>                pos.setIndex(initialIndex);<a name="line.190"></a>
+<FONT color="green">191</FONT>                pos.setErrorIndex(startIndex);<a name="line.191"></a>
+<FONT color="green">192</FONT>                return null;<a name="line.192"></a>
+<FONT color="green">193</FONT>            }<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>            // parse whitespace<a name="line.195"></a>
+<FONT color="green">196</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.196"></a>
+<FONT color="green">197</FONT>    <a name="line.197"></a>
+<FONT color="green">198</FONT>            // parse denominator<a name="line.198"></a>
+<FONT color="green">199</FONT>            final BigInteger den = parseNextBigInteger(source, pos);<a name="line.199"></a>
+<FONT color="green">200</FONT>            if (den == null) {<a name="line.200"></a>
+<FONT color="green">201</FONT>                // invalid integer number<a name="line.201"></a>
+<FONT color="green">202</FONT>                // set index back to initial, error index should already be set<a name="line.202"></a>
+<FONT color="green">203</FONT>                // character examined.<a name="line.203"></a>
+<FONT color="green">204</FONT>                pos.setIndex(initialIndex);<a name="line.204"></a>
+<FONT color="green">205</FONT>                return null;<a name="line.205"></a>
+<FONT color="green">206</FONT>            }<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>            if (den.compareTo(BigInteger.ZERO) &lt; 0) {<a name="line.208"></a>
+<FONT color="green">209</FONT>                // minus signs must be leading, invalid<a name="line.209"></a>
+<FONT color="green">210</FONT>                pos.setIndex(initialIndex);<a name="line.210"></a>
+<FONT color="green">211</FONT>                return null;<a name="line.211"></a>
+<FONT color="green">212</FONT>            }<a name="line.212"></a>
+<FONT color="green">213</FONT>    <a name="line.213"></a>
+<FONT color="green">214</FONT>            boolean wholeIsNeg = whole.compareTo(BigInteger.ZERO) &lt; 0;<a name="line.214"></a>
+<FONT color="green">215</FONT>            if (wholeIsNeg) {<a name="line.215"></a>
+<FONT color="green">216</FONT>                whole = whole.negate();<a name="line.216"></a>
+<FONT color="green">217</FONT>            }<a name="line.217"></a>
+<FONT color="green">218</FONT>            num = whole.multiply(den).add(num);<a name="line.218"></a>
+<FONT color="green">219</FONT>            if (wholeIsNeg) {<a name="line.219"></a>
+<FONT color="green">220</FONT>                num = num.negate();<a name="line.220"></a>
+<FONT color="green">221</FONT>            }<a name="line.221"></a>
+<FONT color="green">222</FONT>    <a name="line.222"></a>
+<FONT color="green">223</FONT>            return new BigFraction(num, den);<a name="line.223"></a>
+<FONT color="green">224</FONT>    <a name="line.224"></a>
+<FONT color="green">225</FONT>        }<a name="line.225"></a>
+<FONT color="green">226</FONT>    <a name="line.226"></a>
+<FONT color="green">227</FONT>        /**<a name="line.227"></a>
+<FONT color="green">228</FONT>         * Modify the whole format.<a name="line.228"></a>
+<FONT color="green">229</FONT>         * @param format The new whole format value.<a name="line.229"></a>
+<FONT color="green">230</FONT>         * @throws IllegalArgumentException if &lt;code&gt;format&lt;/code&gt; is<a name="line.230"></a>
+<FONT color="green">231</FONT>         *         &lt;code&gt;null&lt;/code&gt;.<a name="line.231"></a>
+<FONT color="green">232</FONT>         */<a name="line.232"></a>
+<FONT color="green">233</FONT>        public void setWholeFormat(final NumberFormat format) {<a name="line.233"></a>
+<FONT color="green">234</FONT>            if (format == null) {<a name="line.234"></a>
+<FONT color="green">235</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.235"></a>
+<FONT color="green">236</FONT>                    "whole format can not be null");<a name="line.236"></a>
+<FONT color="green">237</FONT>            }<a name="line.237"></a>
+<FONT color="green">238</FONT>            this.wholeFormat = format;<a name="line.238"></a>
+<FONT color="green">239</FONT>        }<a name="line.239"></a>
+<FONT color="green">240</FONT>    <a name="line.240"></a>
+<FONT color="green">241</FONT>    }<a name="line.241"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/fraction/ProperFractionFormat.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,299 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.fraction;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.text.FieldPosition;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.text.NumberFormat;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.text.ParsePosition;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Formats a Fraction number in proper format.  The number format for each of<a name="line.27"></a>
+<FONT color="green">028</FONT>     * the whole number, numerator and, denominator can be configured.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * Minus signs are only allowed in the whole number part - i.e.,<a name="line.30"></a>
+<FONT color="green">031</FONT>     * "-3 1/2" is legitimate and denotes -7/2, but "-3 -1/2" is invalid and<a name="line.31"></a>
+<FONT color="green">032</FONT>     * will result in a &lt;code&gt;ParseException&lt;/code&gt;.&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @since 1.1<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.35"></a>
+<FONT color="green">036</FONT>     */<a name="line.36"></a>
+<FONT color="green">037</FONT>    public class ProperFractionFormat extends FractionFormat {<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Serializable version identifier */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private static final long serialVersionUID = 760934726031766749L;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** The format used for the whole number. */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private NumberFormat wholeFormat;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**<a name="line.45"></a>
+<FONT color="green">046</FONT>         * Create a proper formatting instance with the default number format for<a name="line.46"></a>
+<FONT color="green">047</FONT>         * the whole, numerator, and denominator.<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        public ProperFractionFormat() {<a name="line.49"></a>
+<FONT color="green">050</FONT>            this(getDefaultNumberFormat());<a name="line.50"></a>
+<FONT color="green">051</FONT>        }<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Create a proper formatting instance with a custom number format for the<a name="line.54"></a>
+<FONT color="green">055</FONT>         * whole, numerator, and denominator.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param format the custom format for the whole, numerator, and<a name="line.56"></a>
+<FONT color="green">057</FONT>         *        denominator.<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public ProperFractionFormat(NumberFormat format) {<a name="line.59"></a>
+<FONT color="green">060</FONT>            this(format, (NumberFormat)format.clone(), (NumberFormat)format.clone());<a name="line.60"></a>
+<FONT color="green">061</FONT>        }<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /**<a name="line.63"></a>
+<FONT color="green">064</FONT>         * Create a proper formatting instance with a custom number format for each<a name="line.64"></a>
+<FONT color="green">065</FONT>         * of the whole, numerator, and denominator.<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @param wholeFormat the custom format for the whole.<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @param numeratorFormat the custom format for the numerator.<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param denominatorFormat the custom format for the denominator.<a name="line.68"></a>
+<FONT color="green">069</FONT>         */<a name="line.69"></a>
+<FONT color="green">070</FONT>        public ProperFractionFormat(NumberFormat wholeFormat,<a name="line.70"></a>
+<FONT color="green">071</FONT>                NumberFormat numeratorFormat,<a name="line.71"></a>
+<FONT color="green">072</FONT>                NumberFormat denominatorFormat)<a name="line.72"></a>
+<FONT color="green">073</FONT>        {<a name="line.73"></a>
+<FONT color="green">074</FONT>            super(numeratorFormat, denominatorFormat);<a name="line.74"></a>
+<FONT color="green">075</FONT>            setWholeFormat(wholeFormat);<a name="line.75"></a>
+<FONT color="green">076</FONT>        }<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /**<a name="line.78"></a>
+<FONT color="green">079</FONT>         * Formats a {@link Fraction} object to produce a string.  The fraction<a name="line.79"></a>
+<FONT color="green">080</FONT>         * is output in proper format.<a name="line.80"></a>
+<FONT color="green">081</FONT>         *<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @param fraction the object to format.<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param toAppendTo where the text is to be appended<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @param pos On input: an alignment field, if desired. On output: the<a name="line.84"></a>
+<FONT color="green">085</FONT>         *            offsets of the alignment field<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @return the value passed in as toAppendTo.<a name="line.86"></a>
+<FONT color="green">087</FONT>         */<a name="line.87"></a>
+<FONT color="green">088</FONT>        @Override<a name="line.88"></a>
+<FONT color="green">089</FONT>        public StringBuffer format(Fraction fraction, StringBuffer toAppendTo,<a name="line.89"></a>
+<FONT color="green">090</FONT>                FieldPosition pos) {<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>            pos.setBeginIndex(0);<a name="line.92"></a>
+<FONT color="green">093</FONT>            pos.setEndIndex(0);<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>            int num = fraction.getNumerator();<a name="line.95"></a>
+<FONT color="green">096</FONT>            int den = fraction.getDenominator();<a name="line.96"></a>
+<FONT color="green">097</FONT>            int whole = num / den;<a name="line.97"></a>
+<FONT color="green">098</FONT>            num = num % den;<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>            if (whole != 0) {<a name="line.100"></a>
+<FONT color="green">101</FONT>                getWholeFormat().format(whole, toAppendTo, pos);<a name="line.101"></a>
+<FONT color="green">102</FONT>                toAppendTo.append(' ');<a name="line.102"></a>
+<FONT color="green">103</FONT>                num = Math.abs(num);<a name="line.103"></a>
+<FONT color="green">104</FONT>            }<a name="line.104"></a>
+<FONT color="green">105</FONT>            getNumeratorFormat().format(num, toAppendTo, pos);<a name="line.105"></a>
+<FONT color="green">106</FONT>            toAppendTo.append(" / ");<a name="line.106"></a>
+<FONT color="green">107</FONT>            getDenominatorFormat().format(den, toAppendTo,<a name="line.107"></a>
+<FONT color="green">108</FONT>                pos);<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>            return toAppendTo;<a name="line.110"></a>
+<FONT color="green">111</FONT>        }<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>        /**<a name="line.113"></a>
+<FONT color="green">114</FONT>         * Access the whole format.<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @return the whole format.<a name="line.115"></a>
+<FONT color="green">116</FONT>         */<a name="line.116"></a>
+<FONT color="green">117</FONT>        public NumberFormat getWholeFormat() {<a name="line.117"></a>
+<FONT color="green">118</FONT>            return wholeFormat;<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /**<a name="line.121"></a>
+<FONT color="green">122</FONT>         * Parses a string to produce a {@link Fraction} object.  This method<a name="line.122"></a>
+<FONT color="green">123</FONT>         * expects the string to be formatted as a proper fraction.<a name="line.123"></a>
+<FONT color="green">124</FONT>         * &lt;p&gt;<a name="line.124"></a>
+<FONT color="green">125</FONT>         * Minus signs are only allowed in the whole number part - i.e.,<a name="line.125"></a>
+<FONT color="green">126</FONT>         * "-3 1/2" is legitimate and denotes -7/2, but "-3 -1/2" is invalid and<a name="line.126"></a>
+<FONT color="green">127</FONT>         * will result in a &lt;code&gt;ParseException&lt;/code&gt;.&lt;/p&gt;<a name="line.127"></a>
+<FONT color="green">128</FONT>         *<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @param source the string to parse<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @param pos input/ouput parsing parameter.<a name="line.130"></a>
+<FONT color="green">131</FONT>         * @return the parsed {@link Fraction} object.<a name="line.131"></a>
+<FONT color="green">132</FONT>         */<a name="line.132"></a>
+<FONT color="green">133</FONT>        @Override<a name="line.133"></a>
+<FONT color="green">134</FONT>        public Fraction parse(String source, ParsePosition pos) {<a name="line.134"></a>
+<FONT color="green">135</FONT>            // try to parse improper fraction<a name="line.135"></a>
+<FONT color="green">136</FONT>            Fraction ret = super.parse(source, pos);<a name="line.136"></a>
+<FONT color="green">137</FONT>            if (ret != null) {<a name="line.137"></a>
+<FONT color="green">138</FONT>                return ret;<a name="line.138"></a>
+<FONT color="green">139</FONT>            }<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>            int initialIndex = pos.getIndex();<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>            // parse whitespace<a name="line.143"></a>
+<FONT color="green">144</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>            // parse whole<a name="line.146"></a>
+<FONT color="green">147</FONT>            Number whole = getWholeFormat().parse(source, pos);<a name="line.147"></a>
+<FONT color="green">148</FONT>            if (whole == null) {<a name="line.148"></a>
+<FONT color="green">149</FONT>                // invalid integer number<a name="line.149"></a>
+<FONT color="green">150</FONT>                // set index back to initial, error index should already be set<a name="line.150"></a>
+<FONT color="green">151</FONT>                // character examined.<a name="line.151"></a>
+<FONT color="green">152</FONT>                pos.setIndex(initialIndex);<a name="line.152"></a>
+<FONT color="green">153</FONT>                return null;<a name="line.153"></a>
+<FONT color="green">154</FONT>            }<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>            // parse whitespace<a name="line.156"></a>
+<FONT color="green">157</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>            // parse numerator<a name="line.159"></a>
+<FONT color="green">160</FONT>            Number num = getNumeratorFormat().parse(source, pos);<a name="line.160"></a>
+<FONT color="green">161</FONT>            if (num == null) {<a name="line.161"></a>
+<FONT color="green">162</FONT>                // invalid integer number<a name="line.162"></a>
+<FONT color="green">163</FONT>                // set index back to initial, error index should already be set<a name="line.163"></a>
+<FONT color="green">164</FONT>                // character examined.<a name="line.164"></a>
+<FONT color="green">165</FONT>                pos.setIndex(initialIndex);<a name="line.165"></a>
+<FONT color="green">166</FONT>                return null;<a name="line.166"></a>
+<FONT color="green">167</FONT>            }<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>            if (num.intValue() &lt; 0) {<a name="line.169"></a>
+<FONT color="green">170</FONT>                // minus signs should be leading, invalid expression<a name="line.170"></a>
+<FONT color="green">171</FONT>                pos.setIndex(initialIndex);<a name="line.171"></a>
+<FONT color="green">172</FONT>                return null;<a name="line.172"></a>
+<FONT color="green">173</FONT>            }<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>            // parse '/'<a name="line.175"></a>
+<FONT color="green">176</FONT>            int startIndex = pos.getIndex();<a name="line.176"></a>
+<FONT color="green">177</FONT>            char c = parseNextCharacter(source, pos);<a name="line.177"></a>
+<FONT color="green">178</FONT>            switch (c) {<a name="line.178"></a>
+<FONT color="green">179</FONT>            case 0 :<a name="line.179"></a>
+<FONT color="green">180</FONT>                // no '/'<a name="line.180"></a>
+<FONT color="green">181</FONT>                // return num as a fraction<a name="line.181"></a>
+<FONT color="green">182</FONT>                return new Fraction(num.intValue(), 1);<a name="line.182"></a>
+<FONT color="green">183</FONT>            case '/' :<a name="line.183"></a>
+<FONT color="green">184</FONT>                // found '/', continue parsing denominator<a name="line.184"></a>
+<FONT color="green">185</FONT>                break;<a name="line.185"></a>
+<FONT color="green">186</FONT>            default :<a name="line.186"></a>
+<FONT color="green">187</FONT>                // invalid '/'<a name="line.187"></a>
+<FONT color="green">188</FONT>                // set index back to initial, error index should be the last<a name="line.188"></a>
+<FONT color="green">189</FONT>                // character examined.<a name="line.189"></a>
+<FONT color="green">190</FONT>                pos.setIndex(initialIndex);<a name="line.190"></a>
+<FONT color="green">191</FONT>                pos.setErrorIndex(startIndex);<a name="line.191"></a>
+<FONT color="green">192</FONT>                return null;<a name="line.192"></a>
+<FONT color="green">193</FONT>            }<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>            // parse whitespace<a name="line.195"></a>
+<FONT color="green">196</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.196"></a>
+<FONT color="green">197</FONT>    <a name="line.197"></a>
+<FONT color="green">198</FONT>            // parse denominator<a name="line.198"></a>
+<FONT color="green">199</FONT>            Number den = getDenominatorFormat().parse(source, pos);<a name="line.199"></a>
+<FONT color="green">200</FONT>            if (den == null) {<a name="line.200"></a>
+<FONT color="green">201</FONT>                // invalid integer number<a name="line.201"></a>
+<FONT color="green">202</FONT>                // set index back to initial, error index should already be set<a name="line.202"></a>
+<FONT color="green">203</FONT>                // character examined.<a name="line.203"></a>
+<FONT color="green">204</FONT>                pos.setIndex(initialIndex);<a name="line.204"></a>
+<FONT color="green">205</FONT>                return null;<a name="line.205"></a>
+<FONT color="green">206</FONT>            }<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>            if (den.intValue() &lt; 0) {<a name="line.208"></a>
+<FONT color="green">209</FONT>                // minus signs must be leading, invalid<a name="line.209"></a>
+<FONT color="green">210</FONT>                pos.setIndex(initialIndex);<a name="line.210"></a>
+<FONT color="green">211</FONT>                return null;<a name="line.211"></a>
+<FONT color="green">212</FONT>            }<a name="line.212"></a>
+<FONT color="green">213</FONT>    <a name="line.213"></a>
+<FONT color="green">214</FONT>            int w = whole.intValue();<a name="line.214"></a>
+<FONT color="green">215</FONT>            int n = num.intValue();<a name="line.215"></a>
+<FONT color="green">216</FONT>            int d = den.intValue();<a name="line.216"></a>
+<FONT color="green">217</FONT>            return new Fraction(((Math.abs(w) * d) + n) * MathUtils.sign(w), d);<a name="line.217"></a>
+<FONT color="green">218</FONT>        }<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>        /**<a name="line.220"></a>
+<FONT color="green">221</FONT>         * Modify the whole format.<a name="line.221"></a>
+<FONT color="green">222</FONT>         * @param format The new whole format value.<a name="line.222"></a>
+<FONT color="green">223</FONT>         * @throws IllegalArgumentException if &lt;code&gt;format&lt;/code&gt; is<a name="line.223"></a>
+<FONT color="green">224</FONT>         *         &lt;code&gt;null&lt;/code&gt;.<a name="line.224"></a>
+<FONT color="green">225</FONT>         */<a name="line.225"></a>
+<FONT color="green">226</FONT>        public void setWholeFormat(NumberFormat format) {<a name="line.226"></a>
+<FONT color="green">227</FONT>            if (format == null) {<a name="line.227"></a>
+<FONT color="green">228</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.228"></a>
+<FONT color="green">229</FONT>                    "whole format can not be null");<a name="line.229"></a>
+<FONT color="green">230</FONT>            }<a name="line.230"></a>
+<FONT color="green">231</FONT>            this.wholeFormat = format;<a name="line.231"></a>
+<FONT color="green">232</FONT>        }<a name="line.232"></a>
+<FONT color="green">233</FONT>    }<a name="line.233"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/AbstractListChromosome.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,170 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.ArrayList;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.Collections;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.util.List;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Chromosome represented by an immutable list of a fixed length.<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @param &lt;T&gt; type of the representation list<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @since 2.0<a name="line.29"></a>
+<FONT color="green">030</FONT>     */<a name="line.30"></a>
+<FONT color="green">031</FONT>    public abstract class AbstractListChromosome&lt;T&gt; extends Chromosome {<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** List representing the chromosome */<a name="line.33"></a>
+<FONT color="green">034</FONT>        private final List&lt;T&gt; representation;<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /**<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Constructor.<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @param representation inner representation of the chromosome<a name="line.38"></a>
+<FONT color="green">039</FONT>         */<a name="line.39"></a>
+<FONT color="green">040</FONT>        public AbstractListChromosome(final List&lt;T&gt; representation) {<a name="line.40"></a>
+<FONT color="green">041</FONT>            try {<a name="line.41"></a>
+<FONT color="green">042</FONT>                checkValidity(representation);<a name="line.42"></a>
+<FONT color="green">043</FONT>            } catch (InvalidRepresentationException e) {<a name="line.43"></a>
+<FONT color="green">044</FONT>                throw new IllegalArgumentException(String.format("Invalid representation for %s", getClass().getSimpleName()), e);<a name="line.44"></a>
+<FONT color="green">045</FONT>            }<a name="line.45"></a>
+<FONT color="green">046</FONT>            this.representation = Collections.unmodifiableList(new ArrayList&lt;T&gt; (representation));<a name="line.46"></a>
+<FONT color="green">047</FONT>        }<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /**<a name="line.49"></a>
+<FONT color="green">050</FONT>         * Constructor.<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @param representation inner representation of the chromosome<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        public AbstractListChromosome(final T[] representation) {<a name="line.53"></a>
+<FONT color="green">054</FONT>            this(Arrays.asList(representation));<a name="line.54"></a>
+<FONT color="green">055</FONT>        }<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /**<a name="line.57"></a>
+<FONT color="green">058</FONT>         *<a name="line.58"></a>
+<FONT color="green">059</FONT>         * Asserts that &lt;code&gt;representation&lt;/code&gt; can represent a valid chromosome.<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @param chromosomeRepresentation representation of the chromosome<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @throws InvalidRepresentationException iff the &lt;code&gt;representation&lt;/code&gt; can not represent<a name="line.61"></a>
+<FONT color="green">062</FONT>         *         a valid chromosome<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        protected abstract void checkValidity(List&lt;T&gt; chromosomeRepresentation) throws InvalidRepresentationException;<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /**<a name="line.66"></a>
+<FONT color="green">067</FONT>         * Returns the (immutable) inner representation of the chromosome.<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @return the representation of the chromosome<a name="line.68"></a>
+<FONT color="green">069</FONT>         */<a name="line.69"></a>
+<FONT color="green">070</FONT>        protected List&lt;T&gt; getRepresentation() {<a name="line.70"></a>
+<FONT color="green">071</FONT>            return representation;<a name="line.71"></a>
+<FONT color="green">072</FONT>        }<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /**<a name="line.74"></a>
+<FONT color="green">075</FONT>         * Returns the length of the chromosome.<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @return the length of the chromosome<a name="line.76"></a>
+<FONT color="green">077</FONT>         */<a name="line.77"></a>
+<FONT color="green">078</FONT>        public int getLength() {<a name="line.78"></a>
+<FONT color="green">079</FONT>            return getRepresentation().size();<a name="line.79"></a>
+<FONT color="green">080</FONT>        }<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>        /**<a name="line.82"></a>
+<FONT color="green">083</FONT>         * Creates a new instance of the same class as &lt;code&gt;this&lt;/code&gt; is, with a<a name="line.83"></a>
+<FONT color="green">084</FONT>         * given &lt;code&gt;arrayRepresentation&lt;/code&gt;. This is needed in crossover and<a name="line.84"></a>
+<FONT color="green">085</FONT>         * mutation operators, where we need a new instance of the same class, but<a name="line.85"></a>
+<FONT color="green">086</FONT>         * with different array representation.<a name="line.86"></a>
+<FONT color="green">087</FONT>         *<a name="line.87"></a>
+<FONT color="green">088</FONT>         * Usually, this method just calls a constructor of the class.<a name="line.88"></a>
+<FONT color="green">089</FONT>         *<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @param chromosomeRepresentation<a name="line.90"></a>
+<FONT color="green">091</FONT>         *            the inner array representation of the new chromosome.<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @return new instance extended from FixedLengthChromosome with the given<a name="line.92"></a>
+<FONT color="green">093</FONT>         *         arrayRepresentation<a name="line.93"></a>
+<FONT color="green">094</FONT>         */<a name="line.94"></a>
+<FONT color="green">095</FONT>        public abstract AbstractListChromosome&lt;T&gt; newFixedLengthChromosome(final List&lt;T&gt; chromosomeRepresentation);<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /**<a name="line.97"></a>
+<FONT color="green">098</FONT>         * {@inheritDoc}<a name="line.98"></a>
+<FONT color="green">099</FONT>         */<a name="line.99"></a>
+<FONT color="green">100</FONT>        @Override<a name="line.100"></a>
+<FONT color="green">101</FONT>        public String toString() {<a name="line.101"></a>
+<FONT color="green">102</FONT>            return String.format("(f=%s %s)", getFitness(), getRepresentation());<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    }<a name="line.104"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/BinaryChromosome.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,158 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.ArrayList;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.List;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Chromosome represented by a vector of 0s and 1s.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @since 2.0<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public abstract class BinaryChromosome extends AbstractListChromosome&lt;Integer&gt; {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /**<a name="line.31"></a>
+<FONT color="green">032</FONT>         * Constructor.<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @param representation list of {0,1} values representing the chromosome<a name="line.33"></a>
+<FONT color="green">034</FONT>         */<a name="line.34"></a>
+<FONT color="green">035</FONT>        public BinaryChromosome(List&lt;Integer&gt; representation) {<a name="line.35"></a>
+<FONT color="green">036</FONT>            super(representation);<a name="line.36"></a>
+<FONT color="green">037</FONT>        }<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /**<a name="line.39"></a>
+<FONT color="green">040</FONT>         * Constructor.<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @param representation array of {0,1} values representing the chromosome<a name="line.41"></a>
+<FONT color="green">042</FONT>         */<a name="line.42"></a>
+<FONT color="green">043</FONT>        public BinaryChromosome(Integer[] representation) {<a name="line.43"></a>
+<FONT color="green">044</FONT>            super(representation);<a name="line.44"></a>
+<FONT color="green">045</FONT>        }<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * {@inheritDoc}<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        @Override<a name="line.50"></a>
+<FONT color="green">051</FONT>        protected void checkValidity(List&lt;Integer&gt; chromosomeRepresentation) throws InvalidRepresentationException {<a name="line.51"></a>
+<FONT color="green">052</FONT>            for (int i : chromosomeRepresentation) {<a name="line.52"></a>
+<FONT color="green">053</FONT>                if (i &lt; 0 || i &gt;1)<a name="line.53"></a>
+<FONT color="green">054</FONT>                    throw new InvalidRepresentationException("Elements can be only 0 or 1.");<a name="line.54"></a>
+<FONT color="green">055</FONT>            }<a name="line.55"></a>
+<FONT color="green">056</FONT>        }<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /**<a name="line.58"></a>
+<FONT color="green">059</FONT>         * Returns a representation of a random binary array of length &lt;code&gt;length&lt;/code&gt;.<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @param length length of the array<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @return a random binary array of length &lt;code&gt;length&lt;/code&gt;<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        public static List&lt;Integer&gt; randomBinaryRepresentation(int length) {<a name="line.63"></a>
+<FONT color="green">064</FONT>            // random binary list<a name="line.64"></a>
+<FONT color="green">065</FONT>            List&lt;Integer&gt; rList= new ArrayList&lt;Integer&gt; (length);<a name="line.65"></a>
+<FONT color="green">066</FONT>            for (int j=0; j&lt;length; j++) {<a name="line.66"></a>
+<FONT color="green">067</FONT>                rList.add(GeneticAlgorithm.getRandomGenerator().nextInt(2));<a name="line.67"></a>
+<FONT color="green">068</FONT>            }<a name="line.68"></a>
+<FONT color="green">069</FONT>            return rList;<a name="line.69"></a>
+<FONT color="green">070</FONT>        }<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /**<a name="line.72"></a>
+<FONT color="green">073</FONT>         * {@inheritDoc}<a name="line.73"></a>
+<FONT color="green">074</FONT>         */<a name="line.74"></a>
+<FONT color="green">075</FONT>        @Override<a name="line.75"></a>
+<FONT color="green">076</FONT>        protected boolean isSame(Chromosome another) {<a name="line.76"></a>
+<FONT color="green">077</FONT>            // type check<a name="line.77"></a>
+<FONT color="green">078</FONT>            if (! (another instanceof BinaryChromosome))<a name="line.78"></a>
+<FONT color="green">079</FONT>                return false;<a name="line.79"></a>
+<FONT color="green">080</FONT>            BinaryChromosome anotherBc = (BinaryChromosome) another;<a name="line.80"></a>
+<FONT color="green">081</FONT>            // size check<a name="line.81"></a>
+<FONT color="green">082</FONT>            if (getLength() != anotherBc.getLength())<a name="line.82"></a>
+<FONT color="green">083</FONT>                return false;<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>            for (int i=0; i&lt; getRepresentation().size(); i++) {<a name="line.85"></a>
+<FONT color="green">086</FONT>                if (!(getRepresentation().get(i).equals(anotherBc.getRepresentation().get(i))))<a name="line.86"></a>
+<FONT color="green">087</FONT>                    return false;<a name="line.87"></a>
+<FONT color="green">088</FONT>            }<a name="line.88"></a>
+<FONT color="green">089</FONT>            // all is ok<a name="line.89"></a>
+<FONT color="green">090</FONT>            return true;<a name="line.90"></a>
+<FONT color="green">091</FONT>        }<a name="line.91"></a>
+<FONT color="green">092</FONT>    }<a name="line.92"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/BinaryMutation.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,118 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.ArrayList;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.List;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Mutation for {@link BinaryChromosome}s. Randomly changes one gene.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 2.0<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public class BinaryMutation implements MutationPolicy {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /**<a name="line.30"></a>
+<FONT color="green">031</FONT>         * Mutate the given chromosome. Randomly changes one gene.<a name="line.31"></a>
+<FONT color="green">032</FONT>         * @param original the original chromosome.<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @return the mutated chromomsome.<a name="line.33"></a>
+<FONT color="green">034</FONT>         */<a name="line.34"></a>
+<FONT color="green">035</FONT>        public Chromosome mutate(Chromosome original) {<a name="line.35"></a>
+<FONT color="green">036</FONT>            if (!(original instanceof BinaryChromosome)) {<a name="line.36"></a>
+<FONT color="green">037</FONT>                throw new IllegalArgumentException("Binary mutation works on BinaryChromosome only.");<a name="line.37"></a>
+<FONT color="green">038</FONT>            }<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>            BinaryChromosome origChrom = (BinaryChromosome) original;<a name="line.40"></a>
+<FONT color="green">041</FONT>            List&lt;Integer&gt; newRepr = new ArrayList&lt;Integer&gt;(origChrom.getRepresentation());<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>            // randomly select a gene<a name="line.43"></a>
+<FONT color="green">044</FONT>            int geneIndex = GeneticAlgorithm.getRandomGenerator().nextInt(origChrom.getLength());<a name="line.44"></a>
+<FONT color="green">045</FONT>            // and change it<a name="line.45"></a>
+<FONT color="green">046</FONT>            newRepr.set(geneIndex, origChrom.getRepresentation().get(geneIndex) == 0 ? 1 : 0);<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>            Chromosome newChrom = origChrom.newFixedLengthChromosome(newRepr);<a name="line.48"></a>
+<FONT color="green">049</FONT>            return newChrom;<a name="line.49"></a>
+<FONT color="green">050</FONT>        }<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>    }<a name="line.52"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/Chromosome.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,177 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Individual in a population. Chromosomes are compared based on their fitness.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>     * The chromosomes are IMMUTABLE, and so their fitness is also immutable and<a name="line.22"></a>
+<FONT color="green">023</FONT>     * therefore it can be cached.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @since 2.0<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public abstract class Chromosome implements Comparable&lt;Chromosome&gt;,Fitness {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /**<a name="line.30"></a>
+<FONT color="green">031</FONT>         * Cached value of the fitness of this chromosome.<a name="line.31"></a>
+<FONT color="green">032</FONT>         */<a name="line.32"></a>
+<FONT color="green">033</FONT>        private double fitness = Double.MIN_VALUE;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /**<a name="line.35"></a>
+<FONT color="green">036</FONT>         * Access the fitness of this chromosome. The bigger the fitness, the better<a name="line.36"></a>
+<FONT color="green">037</FONT>         * the chromosome.<a name="line.37"></a>
+<FONT color="green">038</FONT>         *<a name="line.38"></a>
+<FONT color="green">039</FONT>         * Computation of fitness is usually very time-consuming task, therefore the<a name="line.39"></a>
+<FONT color="green">040</FONT>         * fitness is cached.<a name="line.40"></a>
+<FONT color="green">041</FONT>         *<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @return the fitness.<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        public double getFitness() {<a name="line.44"></a>
+<FONT color="green">045</FONT>            if (this.fitness == Double.MIN_VALUE) {<a name="line.45"></a>
+<FONT color="green">046</FONT>                // no cache - compute the fitness<a name="line.46"></a>
+<FONT color="green">047</FONT>                this.fitness = fitness();<a name="line.47"></a>
+<FONT color="green">048</FONT>            }<a name="line.48"></a>
+<FONT color="green">049</FONT>            return this.fitness;<a name="line.49"></a>
+<FONT color="green">050</FONT>        }<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * Compares two chromosomes based on their fitness. The bigger the fitness,<a name="line.53"></a>
+<FONT color="green">054</FONT>         * the better the chromosome.<a name="line.54"></a>
+<FONT color="green">055</FONT>         *<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param another another chromosome to compare<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @return<a name="line.57"></a>
+<FONT color="green">058</FONT>         * &lt;ul&gt;<a name="line.58"></a>
+<FONT color="green">059</FONT>         *     &lt;li&gt;-1 if &lt;code&gt;another&lt;/code&gt; is better than &lt;code&gt;this&lt;/code&gt;&lt;/li&gt;<a name="line.59"></a>
+<FONT color="green">060</FONT>         *     &lt;li&gt;1 if &lt;code&gt;another&lt;/code&gt; is worse than &lt;code&gt;this&lt;/code&gt;&lt;/li&gt;<a name="line.60"></a>
+<FONT color="green">061</FONT>         *     &lt;li&gt;0 if the two chromosomes have the same fitness&lt;/li&gt;<a name="line.61"></a>
+<FONT color="green">062</FONT>         * &lt;/ul&gt;<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public int compareTo(Chromosome another) {<a name="line.64"></a>
+<FONT color="green">065</FONT>            return ((Double)this.getFitness()).compareTo(another.getFitness());<a name="line.65"></a>
+<FONT color="green">066</FONT>        }<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /**<a name="line.68"></a>
+<FONT color="green">069</FONT>         * Returns &lt;code&gt;true&lt;code&gt; iff &lt;code&gt;another&lt;/code&gt; has the same<a name="line.69"></a>
+<FONT color="green">070</FONT>         * representation and therefore the same fitness. By default, it returns<a name="line.70"></a>
+<FONT color="green">071</FONT>         * false -- override it in your implementation if you need it.<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param another chromosome to compare<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @return true if &lt;code&gt;another&lt;/code&gt; is equivalent to this chromosome<a name="line.73"></a>
+<FONT color="green">074</FONT>         */<a name="line.74"></a>
+<FONT color="green">075</FONT>        protected boolean isSame(Chromosome another) {<a name="line.75"></a>
+<FONT color="green">076</FONT>            return false;<a name="line.76"></a>
+<FONT color="green">077</FONT>        }<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        /**<a name="line.79"></a>
+<FONT color="green">080</FONT>         * Searches the &lt;code&gt;population&lt;/code&gt; for another chromosome with the same<a name="line.80"></a>
+<FONT color="green">081</FONT>         * representation. If such chromosome is found, it is returned, if no such<a name="line.81"></a>
+<FONT color="green">082</FONT>         * chromosome exists, returns &lt;code&gt;null&lt;/code&gt;.<a name="line.82"></a>
+<FONT color="green">083</FONT>         *<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @param population<a name="line.84"></a>
+<FONT color="green">085</FONT>         *            Population to search<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @return Chromosome with the same representation, or &lt;code&gt;null&lt;/code&gt; if<a name="line.86"></a>
+<FONT color="green">087</FONT>         *         no such chromosome exists.<a name="line.87"></a>
+<FONT color="green">088</FONT>         */<a name="line.88"></a>
+<FONT color="green">089</FONT>        protected Chromosome findSameChromosome(Population population) {<a name="line.89"></a>
+<FONT color="green">090</FONT>            for (Chromosome anotherChr : population) {<a name="line.90"></a>
+<FONT color="green">091</FONT>                if (this.isSame(anotherChr))<a name="line.91"></a>
+<FONT color="green">092</FONT>                    return anotherChr;<a name="line.92"></a>
+<FONT color="green">093</FONT>            }<a name="line.93"></a>
+<FONT color="green">094</FONT>            return null;<a name="line.94"></a>
+<FONT color="green">095</FONT>        }<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /**<a name="line.97"></a>
+<FONT color="green">098</FONT>         * Searches the population for a chromosome representing the same solution,<a name="line.98"></a>
+<FONT color="green">099</FONT>         * and if it finds one, updates the fitness to its value.<a name="line.99"></a>
+<FONT color="green">100</FONT>         *<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @param population<a name="line.101"></a>
+<FONT color="green">102</FONT>         *            Population to search<a name="line.102"></a>
+<FONT color="green">103</FONT>         */<a name="line.103"></a>
+<FONT color="green">104</FONT>        public void searchForFitnessUpdate(Population population) {<a name="line.104"></a>
+<FONT color="green">105</FONT>            Chromosome sameChromosome = findSameChromosome(population);<a name="line.105"></a>
+<FONT color="green">106</FONT>            if (sameChromosome != null) {<a name="line.106"></a>
+<FONT color="green">107</FONT>                fitness = sameChromosome.getFitness();<a name="line.107"></a>
+<FONT color="green">108</FONT>            }<a name="line.108"></a>
+<FONT color="green">109</FONT>        }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>    }<a name="line.111"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/ChromosomePair.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,135 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * A pair of {@link Chromosome} objects.<a name="line.20"></a>
+<FONT color="green">021</FONT>     * @since 2.0<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     */<a name="line.24"></a>
+<FONT color="green">025</FONT>    public class ChromosomePair {<a name="line.25"></a>
+<FONT color="green">026</FONT>        /** the first chromosome in the pair. */<a name="line.26"></a>
+<FONT color="green">027</FONT>        private final Chromosome first;<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>        /** the second chromosome in the pair. */<a name="line.29"></a>
+<FONT color="green">030</FONT>        private final Chromosome second;<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /**<a name="line.32"></a>
+<FONT color="green">033</FONT>         * Create a chromosome pair.<a name="line.33"></a>
+<FONT color="green">034</FONT>         *<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @param c1 the first chromosome.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @param c2 the second chromosome.<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        public ChromosomePair(final Chromosome c1, final Chromosome c2) {<a name="line.38"></a>
+<FONT color="green">039</FONT>            super();<a name="line.39"></a>
+<FONT color="green">040</FONT>            first = c1;<a name="line.40"></a>
+<FONT color="green">041</FONT>            second = c2;<a name="line.41"></a>
+<FONT color="green">042</FONT>        }<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /**<a name="line.44"></a>
+<FONT color="green">045</FONT>         * Access the first chromosome.<a name="line.45"></a>
+<FONT color="green">046</FONT>         *<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @return the first chromosome.<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        public Chromosome getFirst() {<a name="line.49"></a>
+<FONT color="green">050</FONT>            return first;<a name="line.50"></a>
+<FONT color="green">051</FONT>        }<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Access the second chromosome.<a name="line.54"></a>
+<FONT color="green">055</FONT>         *<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @return the second chromosome.<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        public Chromosome getSecond() {<a name="line.58"></a>
+<FONT color="green">059</FONT>            return second;<a name="line.59"></a>
+<FONT color="green">060</FONT>        }<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /**<a name="line.62"></a>
+<FONT color="green">063</FONT>         * {@inheritDoc}<a name="line.63"></a>
+<FONT color="green">064</FONT>         */<a name="line.64"></a>
+<FONT color="green">065</FONT>        @Override<a name="line.65"></a>
+<FONT color="green">066</FONT>        public String toString() {<a name="line.66"></a>
+<FONT color="green">067</FONT>            return String.format("(%s,%s)", getFirst(), getSecond());<a name="line.67"></a>
+<FONT color="green">068</FONT>        }<a name="line.68"></a>
+<FONT color="green">069</FONT>    }<a name="line.69"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/CrossoverPolicy.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,101 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Policy used to create a pair of new chromosomes by performing a crossover<a name="line.20"></a>
+<FONT color="green">021</FONT>     * operation on a source pair of chromosomes.<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @since 2.0<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     */<a name="line.25"></a>
+<FONT color="green">026</FONT>    public interface CrossoverPolicy {<a name="line.26"></a>
+<FONT color="green">027</FONT>        /**<a name="line.27"></a>
+<FONT color="green">028</FONT>         * Perform a crossover operation on the given chromosomes.<a name="line.28"></a>
+<FONT color="green">029</FONT>         *<a name="line.29"></a>
+<FONT color="green">030</FONT>         * @param first the first chromosome.<a name="line.30"></a>
+<FONT color="green">031</FONT>         * @param second the second chromosome.<a name="line.31"></a>
+<FONT color="green">032</FONT>         * @return the pair of new chromosomes that resulted from the crossover.<a name="line.32"></a>
+<FONT color="green">033</FONT>         */<a name="line.33"></a>
+<FONT color="green">034</FONT>        ChromosomePair crossover(Chromosome first, Chromosome second);<a name="line.34"></a>
+<FONT color="green">035</FONT>    }<a name="line.35"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/ElitisticListPopulation.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,174 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.Collections;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.List;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Population of chromosomes which uses elitism (certain percentace of the best<a name="line.23"></a>
+<FONT color="green">024</FONT>     * chromosomes is directly copied to the next generation).<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @since 2.0<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public class ElitisticListPopulation extends ListPopulation {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /** percentage of chromosomes copied to the next generation */<a name="line.31"></a>
+<FONT color="green">032</FONT>        private double elitismRate = 0.9;<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /**<a name="line.34"></a>
+<FONT color="green">035</FONT>         * Creates a new ElitisticListPopulation instance.<a name="line.35"></a>
+<FONT color="green">036</FONT>         *<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @param chromosomes<a name="line.37"></a>
+<FONT color="green">038</FONT>         *            list of chromosomes in the population<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @param populationLimit<a name="line.39"></a>
+<FONT color="green">040</FONT>         *            maximal size of the population<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @param elitismRate<a name="line.41"></a>
+<FONT color="green">042</FONT>         *            how many best chromosomes will be directly transferred to the<a name="line.42"></a>
+<FONT color="green">043</FONT>         *            next generation [in %]<a name="line.43"></a>
+<FONT color="green">044</FONT>         */<a name="line.44"></a>
+<FONT color="green">045</FONT>        public ElitisticListPopulation(List&lt;Chromosome&gt; chromosomes, int populationLimit, double elitismRate) {<a name="line.45"></a>
+<FONT color="green">046</FONT>            super(chromosomes, populationLimit);<a name="line.46"></a>
+<FONT color="green">047</FONT>            this.elitismRate = elitismRate;<a name="line.47"></a>
+<FONT color="green">048</FONT>        }<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Creates a new ListPopulation instance and initializes its inner<a name="line.51"></a>
+<FONT color="green">052</FONT>         * chromosome list.<a name="line.52"></a>
+<FONT color="green">053</FONT>         *<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @param populationLimit maximal size of the population<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param elitismRate<a name="line.55"></a>
+<FONT color="green">056</FONT>         *            how many best chromosomes will be directly transferred to the<a name="line.56"></a>
+<FONT color="green">057</FONT>         *            next generation [in %]<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public ElitisticListPopulation(int populationLimit, double elitismRate) {<a name="line.59"></a>
+<FONT color="green">060</FONT>            super(populationLimit);<a name="line.60"></a>
+<FONT color="green">061</FONT>            this.elitismRate = elitismRate;<a name="line.61"></a>
+<FONT color="green">062</FONT>        }<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /**<a name="line.64"></a>
+<FONT color="green">065</FONT>         * Start the population for the next generation. The<a name="line.65"></a>
+<FONT color="green">066</FONT>         * &lt;code&gt;{@link #elitismRate}&lt;code&gt; percents of the best<a name="line.66"></a>
+<FONT color="green">067</FONT>         * chromosomes are directly copied to the next generation.<a name="line.67"></a>
+<FONT color="green">068</FONT>         *<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @return the beginnings of the next generation.<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        public Population nextGeneration() {<a name="line.71"></a>
+<FONT color="green">072</FONT>            // initialize a new generation with the same parameters<a name="line.72"></a>
+<FONT color="green">073</FONT>            ElitisticListPopulation nextGeneration = new ElitisticListPopulation(this.getPopulationLimit(), this.getElitismRate());<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>            List&lt;Chromosome&gt; oldChromosomes = this.getChromosomes();<a name="line.75"></a>
+<FONT color="green">076</FONT>            Collections.sort(oldChromosomes);<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>            // index of the last "not good enough" chromosome<a name="line.78"></a>
+<FONT color="green">079</FONT>            int boundIndex = (int) Math.ceil((1.0 - this.getElitismRate()) * oldChromosomes.size());<a name="line.79"></a>
+<FONT color="green">080</FONT>            for (int i=boundIndex; i&lt;oldChromosomes.size(); i++) {<a name="line.80"></a>
+<FONT color="green">081</FONT>                nextGeneration.addChromosome(oldChromosomes.get(i));<a name="line.81"></a>
+<FONT color="green">082</FONT>            }<a name="line.82"></a>
+<FONT color="green">083</FONT>            return nextGeneration;<a name="line.83"></a>
+<FONT color="green">084</FONT>        }<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /**<a name="line.86"></a>
+<FONT color="green">087</FONT>         * Sets the elitism rate, i.e. how many best chromosomes will be directly<a name="line.87"></a>
+<FONT color="green">088</FONT>         * transferred to the next generation [in %].<a name="line.88"></a>
+<FONT color="green">089</FONT>         *<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @param elitismRate<a name="line.90"></a>
+<FONT color="green">091</FONT>         *            how many best chromosomes will be directly transferred to the<a name="line.91"></a>
+<FONT color="green">092</FONT>         *            next generation [in %]<a name="line.92"></a>
+<FONT color="green">093</FONT>         */<a name="line.93"></a>
+<FONT color="green">094</FONT>        public void setElitismRate(double elitismRate) {<a name="line.94"></a>
+<FONT color="green">095</FONT>            if (elitismRate &lt; 0 || elitismRate &gt; 1)<a name="line.95"></a>
+<FONT color="green">096</FONT>                throw new IllegalArgumentException("Elitism rate has to be in [0,1]");<a name="line.96"></a>
+<FONT color="green">097</FONT>            this.elitismRate = elitismRate;<a name="line.97"></a>
+<FONT color="green">098</FONT>        }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>        /**<a name="line.100"></a>
+<FONT color="green">101</FONT>         * Access the elitism rate.<a name="line.101"></a>
+<FONT color="green">102</FONT>         * @return the elitism rate<a name="line.102"></a>
+<FONT color="green">103</FONT>         */<a name="line.103"></a>
+<FONT color="green">104</FONT>        public double getElitismRate() {<a name="line.104"></a>
+<FONT color="green">105</FONT>            return this.elitismRate;<a name="line.105"></a>
+<FONT color="green">106</FONT>        }<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>    }<a name="line.108"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/Fitness.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,101 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Fitness of a chromosome.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @since 2.0<a name="line.23"></a>
+<FONT color="green">024</FONT>     */<a name="line.24"></a>
+<FONT color="green">025</FONT>    public interface Fitness {<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>        /**<a name="line.27"></a>
+<FONT color="green">028</FONT>         * Compute the fitness. This is usually very time-consuming, so the value<a name="line.28"></a>
+<FONT color="green">029</FONT>         * should be cached.<a name="line.29"></a>
+<FONT color="green">030</FONT>         *<a name="line.30"></a>
+<FONT color="green">031</FONT>         * @return fitness<a name="line.31"></a>
+<FONT color="green">032</FONT>         */<a name="line.32"></a>
+<FONT color="green">033</FONT>        double fitness();<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>    }<a name="line.35"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/FixedGenerationCount.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,136 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Stops after a fixed number of generations.  Each time<a name="line.20"></a>
+<FONT color="green">021</FONT>     * {@link #isSatisfied(Population)} is invoked, a generation counter is<a name="line.21"></a>
+<FONT color="green">022</FONT>     * incremented.  Once the counter reaches the configured<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;code&gt;maxGenerations&lt;/code&gt; value, {@link #isSatisfied(Population)} returns<a name="line.23"></a>
+<FONT color="green">024</FONT>     * true.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @since 2.0<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public class FixedGenerationCount implements StoppingCondition {<a name="line.29"></a>
+<FONT color="green">030</FONT>        /** Number of generations that have passed */<a name="line.30"></a>
+<FONT color="green">031</FONT>        private int numGenerations = 0;<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** Maximum number of generations (stopping criteria) */<a name="line.33"></a>
+<FONT color="green">034</FONT>        private final int maxGenerations;<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /**<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Create a new FixedGenerationCount instance.<a name="line.37"></a>
+<FONT color="green">038</FONT>         *<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @param maxGenerations number of generations to evolve<a name="line.39"></a>
+<FONT color="green">040</FONT>         */<a name="line.40"></a>
+<FONT color="green">041</FONT>        public FixedGenerationCount(int maxGenerations) {<a name="line.41"></a>
+<FONT color="green">042</FONT>            if (maxGenerations &lt;= 0)<a name="line.42"></a>
+<FONT color="green">043</FONT>                throw new IllegalArgumentException("The number of generations has to be &gt;= 0");<a name="line.43"></a>
+<FONT color="green">044</FONT>            this.maxGenerations = maxGenerations;<a name="line.44"></a>
+<FONT color="green">045</FONT>        }<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Determine whether or not the given number of generations have passed.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * Increments the number of generations counter if the maximum has not<a name="line.49"></a>
+<FONT color="green">050</FONT>         * been reached.<a name="line.50"></a>
+<FONT color="green">051</FONT>         *<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @param population ignored (no impact on result)<a name="line.52"></a>
+<FONT color="green">053</FONT>         * @return &lt;code&gt;true&lt;/code&gt; IFF the maximum number of generations has been exceeded<a name="line.53"></a>
+<FONT color="green">054</FONT>         */<a name="line.54"></a>
+<FONT color="green">055</FONT>        public boolean isSatisfied(Population population) {<a name="line.55"></a>
+<FONT color="green">056</FONT>            if (this.numGenerations &lt; this.maxGenerations) {<a name="line.56"></a>
+<FONT color="green">057</FONT>                numGenerations++;<a name="line.57"></a>
+<FONT color="green">058</FONT>                return false;<a name="line.58"></a>
+<FONT color="green">059</FONT>            }<a name="line.59"></a>
+<FONT color="green">060</FONT>            return true;<a name="line.60"></a>
+<FONT color="green">061</FONT>        }<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /**<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @return the number of generations that have passed<a name="line.64"></a>
+<FONT color="green">065</FONT>         */<a name="line.65"></a>
+<FONT color="green">066</FONT>        public int getNumGenerations() {<a name="line.66"></a>
+<FONT color="green">067</FONT>            return numGenerations;<a name="line.67"></a>
+<FONT color="green">068</FONT>        }<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>    }<a name="line.70"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/GeneticAlgorithm.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,294 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.random.RandomGenerator;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.random.JDKRandomGenerator;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Implementation of a genetic algorithm. All factors that govern the operation<a name="line.23"></a>
+<FONT color="green">024</FONT>     * of the algorithm can be configured for a specific problem.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 2.0<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public class GeneticAlgorithm {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /**<a name="line.31"></a>
+<FONT color="green">032</FONT>         * Static random number generator shared by GA implementation classes.<a name="line.32"></a>
+<FONT color="green">033</FONT>         * Set the randomGenerator seed to get reproducible results.<a name="line.33"></a>
+<FONT color="green">034</FONT>         * Use {@link #setRandomGenerator(RandomGenerator)} to supply an alternative<a name="line.34"></a>
+<FONT color="green">035</FONT>         * to the default JDK-provided PRNG.<a name="line.35"></a>
+<FONT color="green">036</FONT>         */<a name="line.36"></a>
+<FONT color="green">037</FONT>        //@GuardedBy("this")<a name="line.37"></a>
+<FONT color="green">038</FONT>        private static RandomGenerator randomGenerator = new JDKRandomGenerator();<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** the crossover policy used by the algorithm. */<a name="line.40"></a>
+<FONT color="green">041</FONT>        private final CrossoverPolicy crossoverPolicy;<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** the rate of crossover for the algorithm. */<a name="line.43"></a>
+<FONT color="green">044</FONT>        private final double crossoverRate;<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** the mutation policy used by the algorithm. */<a name="line.46"></a>
+<FONT color="green">047</FONT>        private final MutationPolicy mutationPolicy;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** the rate of mutation for the algorithm. */<a name="line.49"></a>
+<FONT color="green">050</FONT>        private final double mutationRate;<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /** the selection policy used by the algorithm. */<a name="line.52"></a>
+<FONT color="green">053</FONT>        private final SelectionPolicy selectionPolicy;<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** the number of generations evolved to reach {@link StoppingCondition} in the last run. */<a name="line.55"></a>
+<FONT color="green">056</FONT>        private int generationsEvolved = 0;<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /**<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @param crossoverPolicy The {@link CrossoverPolicy}<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @param crossoverRate The crossover rate as a percentage (0-1 inclusive)<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param mutationPolicy The {@link MutationPolicy}<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param mutationRate The mutation rate as a percentage (0-1 inclusive)<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @param selectionPolicy The {@link SelectionPolicy}<a name="line.63"></a>
+<FONT color="green">064</FONT>         */<a name="line.64"></a>
+<FONT color="green">065</FONT>        public GeneticAlgorithm(<a name="line.65"></a>
+<FONT color="green">066</FONT>                CrossoverPolicy crossoverPolicy, double crossoverRate,<a name="line.66"></a>
+<FONT color="green">067</FONT>                MutationPolicy mutationPolicy, double mutationRate,<a name="line.67"></a>
+<FONT color="green">068</FONT>                SelectionPolicy selectionPolicy) {<a name="line.68"></a>
+<FONT color="green">069</FONT>            if (crossoverRate &lt; 0 || crossoverRate &gt; 1) {<a name="line.69"></a>
+<FONT color="green">070</FONT>                throw new IllegalArgumentException("crossoverRate must be between 0 and 1");<a name="line.70"></a>
+<FONT color="green">071</FONT>            }<a name="line.71"></a>
+<FONT color="green">072</FONT>            if (mutationRate &lt; 0 || mutationRate &gt; 1) {<a name="line.72"></a>
+<FONT color="green">073</FONT>                throw new IllegalArgumentException("mutationRate must be between 0 and 1");<a name="line.73"></a>
+<FONT color="green">074</FONT>            }<a name="line.74"></a>
+<FONT color="green">075</FONT>            this.crossoverPolicy = crossoverPolicy;<a name="line.75"></a>
+<FONT color="green">076</FONT>            this.crossoverRate = crossoverRate;<a name="line.76"></a>
+<FONT color="green">077</FONT>            this.mutationPolicy = mutationPolicy;<a name="line.77"></a>
+<FONT color="green">078</FONT>            this.mutationRate = mutationRate;<a name="line.78"></a>
+<FONT color="green">079</FONT>            this.selectionPolicy = selectionPolicy;<a name="line.79"></a>
+<FONT color="green">080</FONT>        }<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>        /**<a name="line.82"></a>
+<FONT color="green">083</FONT>         * Set the (static) random generator.<a name="line.83"></a>
+<FONT color="green">084</FONT>         *<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @param random random generator<a name="line.85"></a>
+<FONT color="green">086</FONT>         */<a name="line.86"></a>
+<FONT color="green">087</FONT>        public static synchronized void setRandomGenerator(RandomGenerator random) {<a name="line.87"></a>
+<FONT color="green">088</FONT>            randomGenerator = random;<a name="line.88"></a>
+<FONT color="green">089</FONT>        }<a name="line.89"></a>
+<FONT color="green">090</FONT>    <a name="line.90"></a>
+<FONT color="green">091</FONT>        /**<a name="line.91"></a>
+<FONT color="green">092</FONT>         * Returns the (static) random generator.<a name="line.92"></a>
+<FONT color="green">093</FONT>         *<a name="line.93"></a>
+<FONT color="green">094</FONT>         * @return the static random generator shared by GA implementation classes<a name="line.94"></a>
+<FONT color="green">095</FONT>         */<a name="line.95"></a>
+<FONT color="green">096</FONT>        public static synchronized RandomGenerator getRandomGenerator() {<a name="line.96"></a>
+<FONT color="green">097</FONT>            return randomGenerator;<a name="line.97"></a>
+<FONT color="green">098</FONT>        }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>        /**<a name="line.100"></a>
+<FONT color="green">101</FONT>         * Evolve the given population. Evolution stops when the stopping condition<a name="line.101"></a>
+<FONT color="green">102</FONT>         * is satisfied. Updates the {@link #getGenerationsEvolved() generationsEvolved}<a name="line.102"></a>
+<FONT color="green">103</FONT>         * property with the number of generations evolved before the StoppingCondition<a name="line.103"></a>
+<FONT color="green">104</FONT>         * is satisfied.<a name="line.104"></a>
+<FONT color="green">105</FONT>         *<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @param initial the initial, seed population.<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @param condition the stopping condition used to stop evolution.<a name="line.107"></a>
+<FONT color="green">108</FONT>         * @return the population that satisfies the stopping condition.<a name="line.108"></a>
+<FONT color="green">109</FONT>         */<a name="line.109"></a>
+<FONT color="green">110</FONT>        public Population evolve(Population initial, StoppingCondition condition) {<a name="line.110"></a>
+<FONT color="green">111</FONT>            Population current = initial;<a name="line.111"></a>
+<FONT color="green">112</FONT>            generationsEvolved = 0;<a name="line.112"></a>
+<FONT color="green">113</FONT>            while (!condition.isSatisfied(current)) {<a name="line.113"></a>
+<FONT color="green">114</FONT>                current = nextGeneration(current);<a name="line.114"></a>
+<FONT color="green">115</FONT>                generationsEvolved++;<a name="line.115"></a>
+<FONT color="green">116</FONT>            }<a name="line.116"></a>
+<FONT color="green">117</FONT>            return current;<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /**<a name="line.120"></a>
+<FONT color="green">121</FONT>         * &lt;p&gt;Evolve the given population into the next generation.&lt;/p&gt;<a name="line.121"></a>
+<FONT color="green">122</FONT>         * &lt;p&gt;&lt;ol&gt;<a name="line.122"></a>
+<FONT color="green">123</FONT>         *    &lt;li&gt;Get nextGeneration population to fill from &lt;code&gt;current&lt;/code&gt;<a name="line.123"></a>
+<FONT color="green">124</FONT>         *        generation, using its nextGeneration method&lt;/li&gt;<a name="line.124"></a>
+<FONT color="green">125</FONT>         *    &lt;li&gt;Loop until new generation is filled:&lt;/li&gt;<a name="line.125"></a>
+<FONT color="green">126</FONT>         *    &lt;ul&gt;&lt;li&gt;Apply configured SelectionPolicy to select a pair of parents<a name="line.126"></a>
+<FONT color="green">127</FONT>         *            from &lt;code&gt;current&lt;/code&gt;&lt;/li&gt;<a name="line.127"></a>
+<FONT color="green">128</FONT>         *        &lt;li&gt;With probability = {@link #getCrossoverRate()}, apply<a name="line.128"></a>
+<FONT color="green">129</FONT>         *            configured {@link CrossoverPolicy} to parents&lt;/li&gt;<a name="line.129"></a>
+<FONT color="green">130</FONT>         *        &lt;li&gt;With probability = {@link #getMutationRate()}, apply<a name="line.130"></a>
+<FONT color="green">131</FONT>         *            configured {@link MutationPolicy} to each of the offspring&lt;/li&gt;<a name="line.131"></a>
+<FONT color="green">132</FONT>         *        &lt;li&gt;Add offspring individually to nextGeneration,<a name="line.132"></a>
+<FONT color="green">133</FONT>         *            space permitting&lt;/li&gt;<a name="line.133"></a>
+<FONT color="green">134</FONT>         *    &lt;/ul&gt;<a name="line.134"></a>
+<FONT color="green">135</FONT>         *    &lt;li&gt;Return nextGeneration&lt;/li&gt;<a name="line.135"></a>
+<FONT color="green">136</FONT>         *    &lt;/ol&gt;<a name="line.136"></a>
+<FONT color="green">137</FONT>         * &lt;/p&gt;<a name="line.137"></a>
+<FONT color="green">138</FONT>         *<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @param current the current population.<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @return the population for the next generation.<a name="line.140"></a>
+<FONT color="green">141</FONT>         */<a name="line.141"></a>
+<FONT color="green">142</FONT>        public Population nextGeneration(Population current) {<a name="line.142"></a>
+<FONT color="green">143</FONT>            Population nextGeneration = current.nextGeneration();<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>            RandomGenerator randGen = getRandomGenerator();<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>            while (nextGeneration.getPopulationSize() &lt; nextGeneration.getPopulationLimit()) {<a name="line.147"></a>
+<FONT color="green">148</FONT>                // select parent chromosomes<a name="line.148"></a>
+<FONT color="green">149</FONT>                ChromosomePair pair = getSelectionPolicy().select(current);<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>                // crossover?<a name="line.151"></a>
+<FONT color="green">152</FONT>                if (randGen.nextDouble() &lt; getCrossoverRate()) {<a name="line.152"></a>
+<FONT color="green">153</FONT>                    // apply crossover policy to create two offspring<a name="line.153"></a>
+<FONT color="green">154</FONT>                    pair = getCrossoverPolicy().crossover(pair.getFirst(), pair.getSecond());<a name="line.154"></a>
+<FONT color="green">155</FONT>                }<a name="line.155"></a>
+<FONT color="green">156</FONT>    <a name="line.156"></a>
+<FONT color="green">157</FONT>                // mutation?<a name="line.157"></a>
+<FONT color="green">158</FONT>                if (randGen.nextDouble() &lt; getMutationRate()) {<a name="line.158"></a>
+<FONT color="green">159</FONT>                    // apply mutation policy to the chromosomes<a name="line.159"></a>
+<FONT color="green">160</FONT>                    pair = new ChromosomePair(<a name="line.160"></a>
+<FONT color="green">161</FONT>                        getMutationPolicy().mutate(pair.getFirst()),<a name="line.161"></a>
+<FONT color="green">162</FONT>                        getMutationPolicy().mutate(pair.getSecond()));<a name="line.162"></a>
+<FONT color="green">163</FONT>                }<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>                // add the first chromosome to the population<a name="line.165"></a>
+<FONT color="green">166</FONT>                nextGeneration.addChromosome(pair.getFirst());<a name="line.166"></a>
+<FONT color="green">167</FONT>                // is there still a place for the second chromosome?<a name="line.167"></a>
+<FONT color="green">168</FONT>                if (nextGeneration.getPopulationSize() &lt; nextGeneration.getPopulationLimit()) {<a name="line.168"></a>
+<FONT color="green">169</FONT>                    // add the second chromosome to the population<a name="line.169"></a>
+<FONT color="green">170</FONT>                    nextGeneration.addChromosome(pair.getSecond());<a name="line.170"></a>
+<FONT color="green">171</FONT>                }<a name="line.171"></a>
+<FONT color="green">172</FONT>            }<a name="line.172"></a>
+<FONT color="green">173</FONT>    <a name="line.173"></a>
+<FONT color="green">174</FONT>            return nextGeneration;<a name="line.174"></a>
+<FONT color="green">175</FONT>        }<a name="line.175"></a>
+<FONT color="green">176</FONT>    <a name="line.176"></a>
+<FONT color="green">177</FONT>        /**<a name="line.177"></a>
+<FONT color="green">178</FONT>         * Returns the crossover policy.<a name="line.178"></a>
+<FONT color="green">179</FONT>         * @return crossover policy<a name="line.179"></a>
+<FONT color="green">180</FONT>         */<a name="line.180"></a>
+<FONT color="green">181</FONT>        public CrossoverPolicy getCrossoverPolicy() {<a name="line.181"></a>
+<FONT color="green">182</FONT>            return crossoverPolicy;<a name="line.182"></a>
+<FONT color="green">183</FONT>        }<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>        /**<a name="line.185"></a>
+<FONT color="green">186</FONT>         * Returns the crossover rate.<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @return crossover rate<a name="line.187"></a>
+<FONT color="green">188</FONT>         */<a name="line.188"></a>
+<FONT color="green">189</FONT>        public double getCrossoverRate() {<a name="line.189"></a>
+<FONT color="green">190</FONT>            return crossoverRate;<a name="line.190"></a>
+<FONT color="green">191</FONT>        }<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>        /**<a name="line.193"></a>
+<FONT color="green">194</FONT>         * Returns the mutation policy.<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @return mutation policy<a name="line.195"></a>
+<FONT color="green">196</FONT>         */<a name="line.196"></a>
+<FONT color="green">197</FONT>        public MutationPolicy getMutationPolicy() {<a name="line.197"></a>
+<FONT color="green">198</FONT>            return mutationPolicy;<a name="line.198"></a>
+<FONT color="green">199</FONT>        }<a name="line.199"></a>
+<FONT color="green">200</FONT>    <a name="line.200"></a>
+<FONT color="green">201</FONT>        /**<a name="line.201"></a>
+<FONT color="green">202</FONT>         * Returns the mutation rate.<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @return mutation rate<a name="line.203"></a>
+<FONT color="green">204</FONT>         */<a name="line.204"></a>
+<FONT color="green">205</FONT>        public double getMutationRate() {<a name="line.205"></a>
+<FONT color="green">206</FONT>            return mutationRate;<a name="line.206"></a>
+<FONT color="green">207</FONT>        }<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>        /**<a name="line.209"></a>
+<FONT color="green">210</FONT>         * Returns the selection policy.<a name="line.210"></a>
+<FONT color="green">211</FONT>         * @return selection policy<a name="line.211"></a>
+<FONT color="green">212</FONT>         */<a name="line.212"></a>
+<FONT color="green">213</FONT>        public SelectionPolicy getSelectionPolicy() {<a name="line.213"></a>
+<FONT color="green">214</FONT>            return selectionPolicy;<a name="line.214"></a>
+<FONT color="green">215</FONT>        }<a name="line.215"></a>
+<FONT color="green">216</FONT>    <a name="line.216"></a>
+<FONT color="green">217</FONT>        /**<a name="line.217"></a>
+<FONT color="green">218</FONT>         * Returns the number of generations evolved to<a name="line.218"></a>
+<FONT color="green">219</FONT>         * reach {@link StoppingCondition} in the last run.<a name="line.219"></a>
+<FONT color="green">220</FONT>         *<a name="line.220"></a>
+<FONT color="green">221</FONT>         * @return number of generations evolved<a name="line.221"></a>
+<FONT color="green">222</FONT>         * @since 2.1<a name="line.222"></a>
+<FONT color="green">223</FONT>         */<a name="line.223"></a>
+<FONT color="green">224</FONT>        public int getGenerationsEvolved() {<a name="line.224"></a>
+<FONT color="green">225</FONT>            return generationsEvolved;<a name="line.225"></a>
+<FONT color="green">226</FONT>        }<a name="line.226"></a>
+<FONT color="green">227</FONT>    <a name="line.227"></a>
+<FONT color="green">228</FONT>    }<a name="line.228"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/InvalidRepresentationException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,129 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Exception indicating that the representation of a chromosome is not valid.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @since 2.0<a name="line.23"></a>
+<FONT color="green">024</FONT>     */<a name="line.24"></a>
+<FONT color="green">025</FONT>    public class InvalidRepresentationException extends Exception {<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>        /** Serialization version id */<a name="line.27"></a>
+<FONT color="green">028</FONT>        private static final long serialVersionUID = 1L;<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /**<a name="line.30"></a>
+<FONT color="green">031</FONT>         * Constructor<a name="line.31"></a>
+<FONT color="green">032</FONT>         */<a name="line.32"></a>
+<FONT color="green">033</FONT>        public InvalidRepresentationException() {<a name="line.33"></a>
+<FONT color="green">034</FONT>            super();<a name="line.34"></a>
+<FONT color="green">035</FONT>        }<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /**<a name="line.37"></a>
+<FONT color="green">038</FONT>         * Construct an InvalidRepresentationException<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @param arg0 exception message<a name="line.39"></a>
+<FONT color="green">040</FONT>         */<a name="line.40"></a>
+<FONT color="green">041</FONT>        public InvalidRepresentationException(String arg0) {<a name="line.41"></a>
+<FONT color="green">042</FONT>            super(arg0);<a name="line.42"></a>
+<FONT color="green">043</FONT>        }<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**<a name="line.45"></a>
+<FONT color="green">046</FONT>         * Construct an InvalidRepresentationException<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @param arg0 cause<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        public InvalidRepresentationException(Throwable arg0) {<a name="line.49"></a>
+<FONT color="green">050</FONT>            super(arg0);<a name="line.50"></a>
+<FONT color="green">051</FONT>        }<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Construct an InvalidRepresentationException<a name="line.54"></a>
+<FONT color="green">055</FONT>         *<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param arg0 exception message<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @param arg1 cause<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public InvalidRepresentationException(String arg0, Throwable arg1) {<a name="line.59"></a>
+<FONT color="green">060</FONT>            super(arg0, arg1);<a name="line.60"></a>
+<FONT color="green">061</FONT>        }<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>    }<a name="line.63"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/ListPopulation.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,216 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.ArrayList;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Iterator;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.List;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Population of chromosomes represented by a {@link List}.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 2.0<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public abstract class ListPopulation implements Population {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /** List of chromosomes */<a name="line.31"></a>
+<FONT color="green">032</FONT>        private List&lt;Chromosome&gt; chromosomes;<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /** maximial size of the population */<a name="line.34"></a>
+<FONT color="green">035</FONT>        private int populationLimit;<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /**<a name="line.38"></a>
+<FONT color="green">039</FONT>         * Creates a new ListPopulation instance.<a name="line.39"></a>
+<FONT color="green">040</FONT>         *<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @param chromosomes list of chromosomes in the population<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @param populationLimit maximal size of the population<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        public ListPopulation (List&lt;Chromosome&gt; chromosomes, int populationLimit) {<a name="line.44"></a>
+<FONT color="green">045</FONT>            if (chromosomes.size() &gt; populationLimit) {<a name="line.45"></a>
+<FONT color="green">046</FONT>                throw new IllegalArgumentException("List of chromosomes bigger than maxPopulationSize.");<a name="line.46"></a>
+<FONT color="green">047</FONT>            }<a name="line.47"></a>
+<FONT color="green">048</FONT>            if (populationLimit &lt; 0) {<a name="line.48"></a>
+<FONT color="green">049</FONT>                throw new IllegalArgumentException("Population limit has to be &gt;= 0");<a name="line.49"></a>
+<FONT color="green">050</FONT>            }<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>            this.chromosomes = chromosomes;<a name="line.52"></a>
+<FONT color="green">053</FONT>            this.populationLimit = populationLimit;<a name="line.53"></a>
+<FONT color="green">054</FONT>        }<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /**<a name="line.56"></a>
+<FONT color="green">057</FONT>         * Creates a new ListPopulation instance and initializes its inner<a name="line.57"></a>
+<FONT color="green">058</FONT>         * chromosome list.<a name="line.58"></a>
+<FONT color="green">059</FONT>         *<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @param populationLimit maximal size of the population<a name="line.60"></a>
+<FONT color="green">061</FONT>         */<a name="line.61"></a>
+<FONT color="green">062</FONT>        public ListPopulation (int populationLimit) {<a name="line.62"></a>
+<FONT color="green">063</FONT>            if (populationLimit &lt; 0) {<a name="line.63"></a>
+<FONT color="green">064</FONT>                throw new IllegalArgumentException("Population limit has to be &gt;= 0");<a name="line.64"></a>
+<FONT color="green">065</FONT>            }<a name="line.65"></a>
+<FONT color="green">066</FONT>            this.populationLimit = populationLimit;<a name="line.66"></a>
+<FONT color="green">067</FONT>            this.chromosomes = new ArrayList&lt;Chromosome&gt;(populationLimit);<a name="line.67"></a>
+<FONT color="green">068</FONT>        }<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /**<a name="line.70"></a>
+<FONT color="green">071</FONT>         * Sets the list of chromosomes.<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param chromosomes the list of chromosomes<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        public void setChromosomes(List&lt;Chromosome&gt; chromosomes) {<a name="line.74"></a>
+<FONT color="green">075</FONT>            this.chromosomes = chromosomes;<a name="line.75"></a>
+<FONT color="green">076</FONT>        }<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /**<a name="line.78"></a>
+<FONT color="green">079</FONT>         * Access the list of chromosomes.<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @return the list of chromosomes<a name="line.80"></a>
+<FONT color="green">081</FONT>         */<a name="line.81"></a>
+<FONT color="green">082</FONT>        public List&lt;Chromosome&gt; getChromosomes() {<a name="line.82"></a>
+<FONT color="green">083</FONT>            return chromosomes;<a name="line.83"></a>
+<FONT color="green">084</FONT>        }<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /**<a name="line.86"></a>
+<FONT color="green">087</FONT>         * Add the given chromosome to the population.<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @param chromosome the chromosome to add.<a name="line.88"></a>
+<FONT color="green">089</FONT>         */<a name="line.89"></a>
+<FONT color="green">090</FONT>        public void addChromosome(Chromosome chromosome) {<a name="line.90"></a>
+<FONT color="green">091</FONT>            this.chromosomes.add(chromosome);<a name="line.91"></a>
+<FONT color="green">092</FONT>        }<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>        /**<a name="line.94"></a>
+<FONT color="green">095</FONT>         * Access the fittest chromosome in this population.<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @return the fittest chromosome.<a name="line.96"></a>
+<FONT color="green">097</FONT>         */<a name="line.97"></a>
+<FONT color="green">098</FONT>        public Chromosome getFittestChromosome() {<a name="line.98"></a>
+<FONT color="green">099</FONT>            // best so far<a name="line.99"></a>
+<FONT color="green">100</FONT>            Chromosome bestChromosome = this.chromosomes.get(0);<a name="line.100"></a>
+<FONT color="green">101</FONT>            for (Chromosome chromosome : this.chromosomes) {<a name="line.101"></a>
+<FONT color="green">102</FONT>                if (chromosome.compareTo(bestChromosome) &gt; 0) {<a name="line.102"></a>
+<FONT color="green">103</FONT>                    // better chromosome found<a name="line.103"></a>
+<FONT color="green">104</FONT>                    bestChromosome = chromosome;<a name="line.104"></a>
+<FONT color="green">105</FONT>                }<a name="line.105"></a>
+<FONT color="green">106</FONT>            }<a name="line.106"></a>
+<FONT color="green">107</FONT>            return bestChromosome;<a name="line.107"></a>
+<FONT color="green">108</FONT>        }<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>        /**<a name="line.110"></a>
+<FONT color="green">111</FONT>         * Access the maximum population size.<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @return the maximum population size.<a name="line.112"></a>
+<FONT color="green">113</FONT>         */<a name="line.113"></a>
+<FONT color="green">114</FONT>        public int getPopulationLimit() {<a name="line.114"></a>
+<FONT color="green">115</FONT>            return this.populationLimit;<a name="line.115"></a>
+<FONT color="green">116</FONT>        }<a name="line.116"></a>
+<FONT color="green">117</FONT>    <a name="line.117"></a>
+<FONT color="green">118</FONT>        /**<a name="line.118"></a>
+<FONT color="green">119</FONT>         * Sets the maximal population size.<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @param populationLimit maximal population size.<a name="line.120"></a>
+<FONT color="green">121</FONT>         */<a name="line.121"></a>
+<FONT color="green">122</FONT>        public void setPopulationLimit(int populationLimit) {<a name="line.122"></a>
+<FONT color="green">123</FONT>            this.populationLimit = populationLimit;<a name="line.123"></a>
+<FONT color="green">124</FONT>        }<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>        /**<a name="line.126"></a>
+<FONT color="green">127</FONT>         * Access the current population size.<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @return the current population size.<a name="line.128"></a>
+<FONT color="green">129</FONT>         */<a name="line.129"></a>
+<FONT color="green">130</FONT>        public int getPopulationSize() {<a name="line.130"></a>
+<FONT color="green">131</FONT>            return this.chromosomes.size();<a name="line.131"></a>
+<FONT color="green">132</FONT>        }<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>        /**<a name="line.134"></a>
+<FONT color="green">135</FONT>         * {@inheritDoc}<a name="line.135"></a>
+<FONT color="green">136</FONT>         */<a name="line.136"></a>
+<FONT color="green">137</FONT>        @Override<a name="line.137"></a>
+<FONT color="green">138</FONT>        public String toString() {<a name="line.138"></a>
+<FONT color="green">139</FONT>            return this.chromosomes.toString();<a name="line.139"></a>
+<FONT color="green">140</FONT>        }<a name="line.140"></a>
+<FONT color="green">141</FONT>    <a name="line.141"></a>
+<FONT color="green">142</FONT>        /**<a name="line.142"></a>
+<FONT color="green">143</FONT>         * Chromosome list iterator<a name="line.143"></a>
+<FONT color="green">144</FONT>         *<a name="line.144"></a>
+<FONT color="green">145</FONT>         * @return chromosome iterator<a name="line.145"></a>
+<FONT color="green">146</FONT>         */<a name="line.146"></a>
+<FONT color="green">147</FONT>        public Iterator&lt;Chromosome&gt; iterator() {<a name="line.147"></a>
+<FONT color="green">148</FONT>            return chromosomes.iterator();<a name="line.148"></a>
+<FONT color="green">149</FONT>        }<a name="line.149"></a>
+<FONT color="green">150</FONT>    }<a name="line.150"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/MutationPolicy.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,99 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Algorithm used to mutate a chrommosome.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>     * @since 2.0<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     */<a name="line.24"></a>
+<FONT color="green">025</FONT>    public interface MutationPolicy {<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>        /**<a name="line.27"></a>
+<FONT color="green">028</FONT>         * Mutate the given chromosome.<a name="line.28"></a>
+<FONT color="green">029</FONT>         * @param original the original chromosome.<a name="line.29"></a>
+<FONT color="green">030</FONT>         * @return the mutated chromomsome.<a name="line.30"></a>
+<FONT color="green">031</FONT>         */<a name="line.31"></a>
+<FONT color="green">032</FONT>        Chromosome mutate(Chromosome original);<a name="line.32"></a>
+<FONT color="green">033</FONT>    }<a name="line.33"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/OnePointCrossover.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,183 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.ArrayList;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.List;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * One point crossover policy. A random crossover point is selected and the<a name="line.24"></a>
+<FONT color="green">025</FONT>     * first part from each parent is copied to the corresponding child, and the<a name="line.25"></a>
+<FONT color="green">026</FONT>     * second parts are copied crosswise.<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Example:<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;pre&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * -C- denotes a crossover point<a name="line.30"></a>
+<FONT color="green">031</FONT>     *                   -C-                                -C-<a name="line.31"></a>
+<FONT color="green">032</FONT>     * p1 = (1 0 1 0 0 1  | 0 1 1)    X    p2 = (0 1 1 0 1 0  | 1 1 1)<a name="line.32"></a>
+<FONT color="green">033</FONT>     *         \------------/ \-----/              \------------/ \-----/<a name="line.33"></a>
+<FONT color="green">034</FONT>     *            ||         (*)                       ||        (**)<a name="line.34"></a>
+<FONT color="green">035</FONT>     *            VV         (**)                      VV        (*)<a name="line.35"></a>
+<FONT color="green">036</FONT>     *      /------------\ /-----\              /------------\ /-----\<a name="line.36"></a>
+<FONT color="green">037</FONT>     * c1 = (1 0 1 0 0 1  | 1 1 1)    X    p2 = (0 1 1 0 1 0  | 0 1 1)<a name="line.37"></a>
+<FONT color="green">038</FONT>     * &lt;/pre&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     *<a name="line.39"></a>
+<FONT color="green">040</FONT>     * This policy works only on {@link AbstractListChromosome}, and therefore it<a name="line.40"></a>
+<FONT color="green">041</FONT>     * is parametrized by T. Moreover, the chromosomes must have same lengths.<a name="line.41"></a>
+<FONT color="green">042</FONT>     *<a name="line.42"></a>
+<FONT color="green">043</FONT>     * @param &lt;T&gt; generic type of the {@link AbstractListChromosome}s for crossover<a name="line.43"></a>
+<FONT color="green">044</FONT>     * @since 2.0<a name="line.44"></a>
+<FONT color="green">045</FONT>     * @version $Revision: 903046 $ $Date: 2010-01-25 21:07:26 -0500 (Mon, 25 Jan 2010) $<a name="line.45"></a>
+<FONT color="green">046</FONT>     *<a name="line.46"></a>
+<FONT color="green">047</FONT>     */<a name="line.47"></a>
+<FONT color="green">048</FONT>    public class OnePointCrossover&lt;T&gt; implements CrossoverPolicy {<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Performs one point crossover. A random crossover point is selected and the<a name="line.51"></a>
+<FONT color="green">052</FONT>         * first part from each parent is copied to the corresponding child, and the<a name="line.52"></a>
+<FONT color="green">053</FONT>         * second parts are copied crosswise.<a name="line.53"></a>
+<FONT color="green">054</FONT>         *<a name="line.54"></a>
+<FONT color="green">055</FONT>         * Example:<a name="line.55"></a>
+<FONT color="green">056</FONT>         * -C- denotes a crossover point<a name="line.56"></a>
+<FONT color="green">057</FONT>         *                   -C-                                -C-<a name="line.57"></a>
+<FONT color="green">058</FONT>         * p1 = (1 0 1 0 0 1  | 0 1 1)    X    p2 = (0 1 1 0 1 0  | 1 1 1)<a name="line.58"></a>
+<FONT color="green">059</FONT>         *         \------------/ \-----/              \------------/ \-----/<a name="line.59"></a>
+<FONT color="green">060</FONT>         *            ||         (*)                       ||        (**)<a name="line.60"></a>
+<FONT color="green">061</FONT>         *            VV         (**)                      VV        (*)<a name="line.61"></a>
+<FONT color="green">062</FONT>         *      /------------\ /-----\              /------------\ /-----\<a name="line.62"></a>
+<FONT color="green">063</FONT>         * c1 = (1 0 1 0 0 1  | 1 1 1)    X    p2 = (0 1 1 0 1 0  | 0 1 1)<a name="line.63"></a>
+<FONT color="green">064</FONT>         *<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param first first parent (p1)<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @param second second parent (p2)<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @return pair of two children (c1,c2)<a name="line.67"></a>
+<FONT color="green">068</FONT>         */<a name="line.68"></a>
+<FONT color="green">069</FONT>        @SuppressWarnings("unchecked") // OK because of instanceof checks<a name="line.69"></a>
+<FONT color="green">070</FONT>        public ChromosomePair crossover(Chromosome first, Chromosome second) {<a name="line.70"></a>
+<FONT color="green">071</FONT>            if (! (first instanceof AbstractListChromosome&lt;?&gt; &amp;&amp; second instanceof AbstractListChromosome&lt;?&gt;)) {<a name="line.71"></a>
+<FONT color="green">072</FONT>                throw new IllegalArgumentException("One point crossover works on FixedLengthChromosomes only.");<a name="line.72"></a>
+<FONT color="green">073</FONT>            }<a name="line.73"></a>
+<FONT color="green">074</FONT>            return crossover((AbstractListChromosome&lt;T&gt;) first, (AbstractListChromosome&lt;T&gt;) second);<a name="line.74"></a>
+<FONT color="green">075</FONT>        }<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /**<a name="line.78"></a>
+<FONT color="green">079</FONT>         * Helper for {@link #crossover(Chromosome, Chromosome)}. Performs the actual crossover.<a name="line.79"></a>
+<FONT color="green">080</FONT>         *<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @param first the first chromosome.<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @param second the second chromosome.<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @return the pair of new chromosomes that resulted from the crossover.<a name="line.83"></a>
+<FONT color="green">084</FONT>         */<a name="line.84"></a>
+<FONT color="green">085</FONT>        private ChromosomePair crossover(AbstractListChromosome&lt;T&gt; first, AbstractListChromosome&lt;T&gt; second) {<a name="line.85"></a>
+<FONT color="green">086</FONT>            int length = first.getLength();<a name="line.86"></a>
+<FONT color="green">087</FONT>            if (length != second.getLength())<a name="line.87"></a>
+<FONT color="green">088</FONT>                throw new IllegalArgumentException("Both chromosomes must have same lengths.");<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>            // array representations of the parents<a name="line.90"></a>
+<FONT color="green">091</FONT>            List&lt;T&gt; parent1Rep = first.getRepresentation();<a name="line.91"></a>
+<FONT color="green">092</FONT>            List&lt;T&gt; parent2Rep = second.getRepresentation();<a name="line.92"></a>
+<FONT color="green">093</FONT>            // and of the children<a name="line.93"></a>
+<FONT color="green">094</FONT>            ArrayList&lt;T&gt; child1Rep = new ArrayList&lt;T&gt; (first.getLength());<a name="line.94"></a>
+<FONT color="green">095</FONT>            ArrayList&lt;T&gt; child2Rep = new ArrayList&lt;T&gt; (second.getLength());<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>            // select a crossover point at random (0 and length makes no sense)<a name="line.97"></a>
+<FONT color="green">098</FONT>            int crossoverIndex = 1 + (GeneticAlgorithm.getRandomGenerator().nextInt(length-2));<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>            // copy the first part<a name="line.100"></a>
+<FONT color="green">101</FONT>            for (int i = 0; i &lt; crossoverIndex; i++) {<a name="line.101"></a>
+<FONT color="green">102</FONT>                child1Rep.add(parent1Rep.get(i));<a name="line.102"></a>
+<FONT color="green">103</FONT>                child2Rep.add(parent2Rep.get(i));<a name="line.103"></a>
+<FONT color="green">104</FONT>            }<a name="line.104"></a>
+<FONT color="green">105</FONT>            // and switch the second part<a name="line.105"></a>
+<FONT color="green">106</FONT>            for (int i = crossoverIndex; i &lt; length; i++) {<a name="line.106"></a>
+<FONT color="green">107</FONT>                child1Rep.add(parent2Rep.get(i));<a name="line.107"></a>
+<FONT color="green">108</FONT>                child2Rep.add(parent1Rep.get(i));<a name="line.108"></a>
+<FONT color="green">109</FONT>            }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>            return new ChromosomePair(<a name="line.111"></a>
+<FONT color="green">112</FONT>                    first.newFixedLengthChromosome(child1Rep),<a name="line.112"></a>
+<FONT color="green">113</FONT>                    second.newFixedLengthChromosome(child2Rep)<a name="line.113"></a>
+<FONT color="green">114</FONT>                    );<a name="line.114"></a>
+<FONT color="green">115</FONT>        }<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>    }<a name="line.117"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/PermutationChromosome.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,110 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.List;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Interface indicating that the chromosome represents a permutation of objects.<a name="line.22"></a>
+<FONT color="green">023</FONT>     *<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @param &lt;T&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     *            type of the permuted objects<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 2.0<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public interface PermutationChromosome&lt;T&gt; {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /**<a name="line.31"></a>
+<FONT color="green">032</FONT>         * Permutes the &lt;code&gt;sequence&lt;/code&gt; of objects of type T according to the<a name="line.32"></a>
+<FONT color="green">033</FONT>         * permutation this chromosome represents. For example, if this chromosome<a name="line.33"></a>
+<FONT color="green">034</FONT>         * represents a permutation (3,0,1,2), and the unpermuted sequence is<a name="line.34"></a>
+<FONT color="green">035</FONT>         * (a,b,c,d), this yields (d,a,b,c).<a name="line.35"></a>
+<FONT color="green">036</FONT>         *<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @param sequence<a name="line.37"></a>
+<FONT color="green">038</FONT>         *            the unpermuted (original) sequence of objects<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @return permutation of &lt;code&gt;sequence&lt;/code&gt; represented by this<a name="line.39"></a>
+<FONT color="green">040</FONT>         *         permutation<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        List&lt;T&gt; decode(List&lt;T&gt; sequence);<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>    }<a name="line.44"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/Population.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,121 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * A collection of chromosomes that facilitates generational evolution.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>     * @since 2.0<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     */<a name="line.24"></a>
+<FONT color="green">025</FONT>    public interface Population extends Iterable&lt;Chromosome&gt; {<a name="line.25"></a>
+<FONT color="green">026</FONT>        /**<a name="line.26"></a>
+<FONT color="green">027</FONT>         * Access the current population size.<a name="line.27"></a>
+<FONT color="green">028</FONT>         * @return the current population size.<a name="line.28"></a>
+<FONT color="green">029</FONT>         */<a name="line.29"></a>
+<FONT color="green">030</FONT>        int getPopulationSize();<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /**<a name="line.32"></a>
+<FONT color="green">033</FONT>         * Access the maximum population size.<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @return the maximum population size.<a name="line.34"></a>
+<FONT color="green">035</FONT>         */<a name="line.35"></a>
+<FONT color="green">036</FONT>        int getPopulationLimit();<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /**<a name="line.38"></a>
+<FONT color="green">039</FONT>         * Start the population for the next generation.<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @return the beginnings of the next generation.<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        Population nextGeneration();<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /**<a name="line.44"></a>
+<FONT color="green">045</FONT>         * Add the given chromosome to the population.<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param chromosome the chromosome to add.<a name="line.46"></a>
+<FONT color="green">047</FONT>         */<a name="line.47"></a>
+<FONT color="green">048</FONT>        void addChromosome(Chromosome chromosome);<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Access the fittest chromosome in this population.<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @return the fittest chromosome.<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        Chromosome getFittestChromosome();<a name="line.54"></a>
+<FONT color="green">055</FONT>    }<a name="line.55"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/RandomKey.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,356 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.ArrayList;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.Collections;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.util.Comparator;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.util.List;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Random Key chromosome is used for permutation representation. It is a vector<a name="line.27"></a>
+<FONT color="green">028</FONT>     * of a fixed length of real numbers in [0,1] interval. The index of the i-th<a name="line.28"></a>
+<FONT color="green">029</FONT>     * smallest value in the vector represents an i-th member of the permutation.<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     *<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * For example, the random key [0.2, 0.3, 0.8, 0.1] corresponds to the<a name="line.33"></a>
+<FONT color="green">034</FONT>     * permutation of indices (3,0,1,2). If the original (unpermuted) sequence would<a name="line.34"></a>
+<FONT color="green">035</FONT>     * be (a,b,c,d), this would mean the sequence (d,a,b,c).<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *<a name="line.37"></a>
+<FONT color="green">038</FONT>     * &lt;p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * With this representation, common operators like n-point crossover can be<a name="line.39"></a>
+<FONT color="green">040</FONT>     * used, because any such chromosome represents a valid permutation.<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;/p&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     *<a name="line.42"></a>
+<FONT color="green">043</FONT>     * &lt;p&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     * Since the chromosome (and thus its arrayRepresentation) is immutable, the<a name="line.44"></a>
+<FONT color="green">045</FONT>     * array representation is sorted only once in the constructor.<a name="line.45"></a>
+<FONT color="green">046</FONT>     * &lt;/p&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     *<a name="line.47"></a>
+<FONT color="green">048</FONT>     * &lt;p&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>     * For details, see:<a name="line.49"></a>
+<FONT color="green">050</FONT>     * &lt;ul&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>     * &lt;li&gt;Bean, J.C.: Genetic algorithms and random keys for sequencing and<a name="line.51"></a>
+<FONT color="green">052</FONT>     * optimization. ORSA Journal on Computing 6 (1994) 154–160&lt;/li&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>     * &lt;li&gt;Rothlauf, F.: Representations for Genetic and Evolutionary Algorithms.<a name="line.53"></a>
+<FONT color="green">054</FONT>     * Volume 104 of Studies in Fuzziness and Soft Computing. Physica-Verlag,<a name="line.54"></a>
+<FONT color="green">055</FONT>     * Heidelberg (2002)&lt;/li&gt;<a name="line.55"></a>
+<FONT color="green">056</FONT>     * &lt;/ul&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>     * &lt;/p&gt;<a name="line.57"></a>
+<FONT color="green">058</FONT>     *<a name="line.58"></a>
+<FONT color="green">059</FONT>     * @param &lt;T&gt;<a name="line.59"></a>
+<FONT color="green">060</FONT>     *            type of the permuted objects<a name="line.60"></a>
+<FONT color="green">061</FONT>     * @since 2.0<a name="line.61"></a>
+<FONT color="green">062</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.62"></a>
+<FONT color="green">063</FONT>     */<a name="line.63"></a>
+<FONT color="green">064</FONT>    public abstract class RandomKey&lt;T&gt; extends AbstractListChromosome&lt;Double&gt; implements PermutationChromosome&lt;T&gt; {<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /**<a name="line.66"></a>
+<FONT color="green">067</FONT>         * Cache of sorted representation (unmodifiable).<a name="line.67"></a>
+<FONT color="green">068</FONT>         */<a name="line.68"></a>
+<FONT color="green">069</FONT>        private final List&lt;Double&gt; sortedRepresentation;<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /**<a name="line.71"></a>
+<FONT color="green">072</FONT>         * Base sequence [0,1,...,n-1], permuted accorting to the representation (unmodifiable).<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        private final List&lt;Integer&gt; baseSeqPermutation;<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        /**<a name="line.76"></a>
+<FONT color="green">077</FONT>         * Constructor.<a name="line.77"></a>
+<FONT color="green">078</FONT>         *<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @param representation list of [0,1] values representing the permutation<a name="line.79"></a>
+<FONT color="green">080</FONT>         */<a name="line.80"></a>
+<FONT color="green">081</FONT>        public RandomKey(List&lt;Double&gt; representation) {<a name="line.81"></a>
+<FONT color="green">082</FONT>            super(representation);<a name="line.82"></a>
+<FONT color="green">083</FONT>            // store the sorted representation<a name="line.83"></a>
+<FONT color="green">084</FONT>            List&lt;Double&gt; sortedRepr = new ArrayList&lt;Double&gt; (getRepresentation());<a name="line.84"></a>
+<FONT color="green">085</FONT>            Collections.sort(sortedRepr);<a name="line.85"></a>
+<FONT color="green">086</FONT>            sortedRepresentation = Collections.unmodifiableList(sortedRepr);<a name="line.86"></a>
+<FONT color="green">087</FONT>            // store the permutation of [0,1,...,n-1] list for toString() and isSame() methods<a name="line.87"></a>
+<FONT color="green">088</FONT>            baseSeqPermutation = Collections.unmodifiableList(<a name="line.88"></a>
+<FONT color="green">089</FONT>                decodeGeneric(baseSequence(getLength()), getRepresentation(), sortedRepresentation)<a name="line.89"></a>
+<FONT color="green">090</FONT>            );<a name="line.90"></a>
+<FONT color="green">091</FONT>        }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /**<a name="line.93"></a>
+<FONT color="green">094</FONT>         * Constructor.<a name="line.94"></a>
+<FONT color="green">095</FONT>         *<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @param representation array of [0,1] values representing the permutation<a name="line.96"></a>
+<FONT color="green">097</FONT>         */<a name="line.97"></a>
+<FONT color="green">098</FONT>        public RandomKey(Double[] representation) {<a name="line.98"></a>
+<FONT color="green">099</FONT>            this(Arrays.asList(representation));<a name="line.99"></a>
+<FONT color="green">100</FONT>        }<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>        /**<a name="line.102"></a>
+<FONT color="green">103</FONT>         * {@inheritDoc}<a name="line.103"></a>
+<FONT color="green">104</FONT>         */<a name="line.104"></a>
+<FONT color="green">105</FONT>        public List&lt;T&gt; decode(List&lt;T&gt; sequence) {<a name="line.105"></a>
+<FONT color="green">106</FONT>            return decodeGeneric(sequence, getRepresentation(), sortedRepresentation);<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /**<a name="line.109"></a>
+<FONT color="green">110</FONT>         * Decodes a permutation represented by &lt;code&gt;representation&lt;/code&gt; and<a name="line.110"></a>
+<FONT color="green">111</FONT>         * returns a (generic) list with the permuted values.<a name="line.111"></a>
+<FONT color="green">112</FONT>         *<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param &lt;S&gt; generic type of the sequence values<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param sequence the unpermuted sequence<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @param representation representation of the permutation ([0,1] vector)<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @param sortedRepr sorted &lt;code&gt;representation&lt;/code&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @return list with the sequence values permuted according to the representation<a name="line.117"></a>
+<FONT color="green">118</FONT>         */<a name="line.118"></a>
+<FONT color="green">119</FONT>        private static &lt;S&gt; List&lt;S&gt; decodeGeneric(List&lt;S&gt; sequence, List&lt;Double&gt; representation, List&lt;Double&gt; sortedRepr) {<a name="line.119"></a>
+<FONT color="green">120</FONT>            int l = sequence.size();<a name="line.120"></a>
+<FONT color="green">121</FONT>    <a name="line.121"></a>
+<FONT color="green">122</FONT>            if (representation.size() != l) {<a name="line.122"></a>
+<FONT color="green">123</FONT>                throw new IllegalArgumentException(String.format("Length of sequence for decoding (%s) has to be equal to the length of the RandomKey (%s)", l, representation.size()));<a name="line.123"></a>
+<FONT color="green">124</FONT>            }<a name="line.124"></a>
+<FONT color="green">125</FONT>            if (representation.size() != sortedRepr.size()) {<a name="line.125"></a>
+<FONT color="green">126</FONT>                throw new IllegalArgumentException(String.format("Representation and sortedRepr must have same sizes, %d != %d", representation.size(), sortedRepr.size()));<a name="line.126"></a>
+<FONT color="green">127</FONT>            }<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>            List&lt;Double&gt; reprCopy = new ArrayList&lt;Double&gt; (representation);// do not modify the orig. representation<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>            // now find the indices in the original repr and use them for permuting<a name="line.131"></a>
+<FONT color="green">132</FONT>            List&lt;S&gt; res = new ArrayList&lt;S&gt; (l);<a name="line.132"></a>
+<FONT color="green">133</FONT>            for (int i=0; i&lt;l; i++) {<a name="line.133"></a>
+<FONT color="green">134</FONT>                int index = reprCopy.indexOf(sortedRepr.get(i));<a name="line.134"></a>
+<FONT color="green">135</FONT>                res.add(sequence.get(index));<a name="line.135"></a>
+<FONT color="green">136</FONT>                reprCopy.set(index, null);<a name="line.136"></a>
+<FONT color="green">137</FONT>            }<a name="line.137"></a>
+<FONT color="green">138</FONT>            return res;<a name="line.138"></a>
+<FONT color="green">139</FONT>        }<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>        /**<a name="line.141"></a>
+<FONT color="green">142</FONT>         * Returns &lt;code&gt;true&lt;/code&gt; iff &lt;code&gt;another&lt;/code&gt; is a RandomKey and<a name="line.142"></a>
+<FONT color="green">143</FONT>         * encodes the same permutation.<a name="line.143"></a>
+<FONT color="green">144</FONT>         *<a name="line.144"></a>
+<FONT color="green">145</FONT>         * @param another chromosome to compare<a name="line.145"></a>
+<FONT color="green">146</FONT>         * @return true iff chromosomes encode the same permutation<a name="line.146"></a>
+<FONT color="green">147</FONT>         */<a name="line.147"></a>
+<FONT color="green">148</FONT>        @Override<a name="line.148"></a>
+<FONT color="green">149</FONT>        protected boolean isSame(Chromosome another) {<a name="line.149"></a>
+<FONT color="green">150</FONT>            // type check<a name="line.150"></a>
+<FONT color="green">151</FONT>            if (! (another instanceof RandomKey&lt;?&gt;))<a name="line.151"></a>
+<FONT color="green">152</FONT>                return false;<a name="line.152"></a>
+<FONT color="green">153</FONT>            RandomKey&lt;?&gt; anotherRk = (RandomKey&lt;?&gt;) another;<a name="line.153"></a>
+<FONT color="green">154</FONT>            // size check<a name="line.154"></a>
+<FONT color="green">155</FONT>            if (getLength() != anotherRk.getLength())<a name="line.155"></a>
+<FONT color="green">156</FONT>                return false;<a name="line.156"></a>
+<FONT color="green">157</FONT>    <a name="line.157"></a>
+<FONT color="green">158</FONT>            // two different representations can still encode the same permutation<a name="line.158"></a>
+<FONT color="green">159</FONT>            // the ordering is what counts<a name="line.159"></a>
+<FONT color="green">160</FONT>            List&lt;Integer&gt; thisPerm = this.baseSeqPermutation;<a name="line.160"></a>
+<FONT color="green">161</FONT>            List&lt;Integer&gt; anotherPerm = anotherRk.baseSeqPermutation;<a name="line.161"></a>
+<FONT color="green">162</FONT>    <a name="line.162"></a>
+<FONT color="green">163</FONT>            for (int i=0; i&lt;getLength(); i++) {<a name="line.163"></a>
+<FONT color="green">164</FONT>                if (thisPerm.get(i) != anotherPerm.get(i))<a name="line.164"></a>
+<FONT color="green">165</FONT>                    return false;<a name="line.165"></a>
+<FONT color="green">166</FONT>            }<a name="line.166"></a>
+<FONT color="green">167</FONT>            // the permutations are the same<a name="line.167"></a>
+<FONT color="green">168</FONT>            return true;<a name="line.168"></a>
+<FONT color="green">169</FONT>        }<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>        /**<a name="line.171"></a>
+<FONT color="green">172</FONT>         * {@inheritDoc}<a name="line.172"></a>
+<FONT color="green">173</FONT>         */<a name="line.173"></a>
+<FONT color="green">174</FONT>        @Override<a name="line.174"></a>
+<FONT color="green">175</FONT>        protected void checkValidity(java.util.List&lt;Double&gt; chromosomeRepresentation) throws InvalidRepresentationException {<a name="line.175"></a>
+<FONT color="green">176</FONT>            for (double val : chromosomeRepresentation) {<a name="line.176"></a>
+<FONT color="green">177</FONT>                if (val &lt; 0 || val &gt; 1) {<a name="line.177"></a>
+<FONT color="green">178</FONT>                    throw new InvalidRepresentationException("Values of representation must be in [0,1] interval");<a name="line.178"></a>
+<FONT color="green">179</FONT>                }<a name="line.179"></a>
+<FONT color="green">180</FONT>            }<a name="line.180"></a>
+<FONT color="green">181</FONT>        }<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>        /**<a name="line.184"></a>
+<FONT color="green">185</FONT>         * Generates a representation corresponding to a random permutation of<a name="line.185"></a>
+<FONT color="green">186</FONT>         * length l which can be passed to the RandomKey constructor.<a name="line.186"></a>
+<FONT color="green">187</FONT>         *<a name="line.187"></a>
+<FONT color="green">188</FONT>         * @param l<a name="line.188"></a>
+<FONT color="green">189</FONT>         *            length of the permutation<a name="line.189"></a>
+<FONT color="green">190</FONT>         * @return representation of a random permutation<a name="line.190"></a>
+<FONT color="green">191</FONT>         */<a name="line.191"></a>
+<FONT color="green">192</FONT>        public static final List&lt;Double&gt; randomPermutation(int l) {<a name="line.192"></a>
+<FONT color="green">193</FONT>            List&lt;Double&gt; repr = new ArrayList&lt;Double&gt;(l);<a name="line.193"></a>
+<FONT color="green">194</FONT>            for (int i=0; i&lt;l; i++) {<a name="line.194"></a>
+<FONT color="green">195</FONT>                repr.add(GeneticAlgorithm.getRandomGenerator().nextDouble());<a name="line.195"></a>
+<FONT color="green">196</FONT>            }<a name="line.196"></a>
+<FONT color="green">197</FONT>            return repr;<a name="line.197"></a>
+<FONT color="green">198</FONT>        }<a name="line.198"></a>
+<FONT color="green">199</FONT>    <a name="line.199"></a>
+<FONT color="green">200</FONT>        /**<a name="line.200"></a>
+<FONT color="green">201</FONT>         * Generates a representation corresponding to an identity permutation of<a name="line.201"></a>
+<FONT color="green">202</FONT>         * length l which can be passed to the RandomKey constructor.<a name="line.202"></a>
+<FONT color="green">203</FONT>         *<a name="line.203"></a>
+<FONT color="green">204</FONT>         * @param l<a name="line.204"></a>
+<FONT color="green">205</FONT>         *            length of the permutation<a name="line.205"></a>
+<FONT color="green">206</FONT>         * @return representation of an identity permutation<a name="line.206"></a>
+<FONT color="green">207</FONT>         */<a name="line.207"></a>
+<FONT color="green">208</FONT>        public static final List&lt;Double&gt; identityPermutation(int l) {<a name="line.208"></a>
+<FONT color="green">209</FONT>            List&lt;Double&gt; repr = new ArrayList&lt;Double&gt;(l);<a name="line.209"></a>
+<FONT color="green">210</FONT>            for (int i=0; i&lt;l; i++) {<a name="line.210"></a>
+<FONT color="green">211</FONT>                repr.add((double)i/l);<a name="line.211"></a>
+<FONT color="green">212</FONT>            }<a name="line.212"></a>
+<FONT color="green">213</FONT>            return repr;<a name="line.213"></a>
+<FONT color="green">214</FONT>        }<a name="line.214"></a>
+<FONT color="green">215</FONT>    <a name="line.215"></a>
+<FONT color="green">216</FONT>        /**<a name="line.216"></a>
+<FONT color="green">217</FONT>         * Generates a representation of a permutation corresponding to the<a name="line.217"></a>
+<FONT color="green">218</FONT>         * &lt;code&gt;data&lt;/code&gt; sorted by &lt;code&gt;comparator&lt;/code&gt;. The<a name="line.218"></a>
+<FONT color="green">219</FONT>         * &lt;code&gt;data&lt;/code&gt; is not modified during the process.<a name="line.219"></a>
+<FONT color="green">220</FONT>         *<a name="line.220"></a>
+<FONT color="green">221</FONT>         * This is useful if you want to inject some permutations to the initial<a name="line.221"></a>
+<FONT color="green">222</FONT>         * population.<a name="line.222"></a>
+<FONT color="green">223</FONT>         *<a name="line.223"></a>
+<FONT color="green">224</FONT>         * @param &lt;S&gt; type of the data<a name="line.224"></a>
+<FONT color="green">225</FONT>         * @param data list of data determining the order<a name="line.225"></a>
+<FONT color="green">226</FONT>         * @param comparator how the data will be compared<a name="line.226"></a>
+<FONT color="green">227</FONT>         * @return list representation of the permutation corresponding to the parameters<a name="line.227"></a>
+<FONT color="green">228</FONT>         */<a name="line.228"></a>
+<FONT color="green">229</FONT>        public static &lt;S&gt; List&lt;Double&gt; comparatorPermutation(List&lt;S&gt; data, Comparator&lt;S&gt; comparator) {<a name="line.229"></a>
+<FONT color="green">230</FONT>            List&lt;S&gt; sortedData = new ArrayList&lt;S&gt; (data);<a name="line.230"></a>
+<FONT color="green">231</FONT>            Collections.sort(sortedData, comparator);<a name="line.231"></a>
+<FONT color="green">232</FONT>    <a name="line.232"></a>
+<FONT color="green">233</FONT>            return inducedPermutation(data, sortedData);<a name="line.233"></a>
+<FONT color="green">234</FONT>        }<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>        /**<a name="line.236"></a>
+<FONT color="green">237</FONT>         * Generates a representation of a permutation corresponding to a<a name="line.237"></a>
+<FONT color="green">238</FONT>         * permutation which yields &lt;code&gt;permutedData&lt;/code&gt; when applied to<a name="line.238"></a>
+<FONT color="green">239</FONT>         * &lt;code&gt;originalData&lt;/code&gt;.<a name="line.239"></a>
+<FONT color="green">240</FONT>         *<a name="line.240"></a>
+<FONT color="green">241</FONT>         * This method can be viewed as an inverse to {@link #decode(List)}.<a name="line.241"></a>
+<FONT color="green">242</FONT>         *<a name="line.242"></a>
+<FONT color="green">243</FONT>         * @param &lt;S&gt; type of the data<a name="line.243"></a>
+<FONT color="green">244</FONT>         * @param originalData the original, unpermuted data<a name="line.244"></a>
+<FONT color="green">245</FONT>         * @param permutedData the data, somehow permuted<a name="line.245"></a>
+<FONT color="green">246</FONT>         * @return representation of a permutation corresponding to the permutation &lt;code&gt;originalData -&gt; permutedData&lt;/code&gt;<a name="line.246"></a>
+<FONT color="green">247</FONT>         * @throws IllegalArgumentException iff the &lt;code&gt;permutedData&lt;/code&gt; and &lt;code&gt;originalData&lt;/code&gt; contains different data<a name="line.247"></a>
+<FONT color="green">248</FONT>         */<a name="line.248"></a>
+<FONT color="green">249</FONT>        public static &lt;S&gt; List&lt;Double&gt; inducedPermutation(List&lt;S&gt; originalData, List&lt;S&gt; permutedData) throws IllegalArgumentException {<a name="line.249"></a>
+<FONT color="green">250</FONT>            if (originalData.size() != permutedData.size()) {<a name="line.250"></a>
+<FONT color="green">251</FONT>                throw new IllegalArgumentException("originalData and permutedData must have same length");<a name="line.251"></a>
+<FONT color="green">252</FONT>            }<a name="line.252"></a>
+<FONT color="green">253</FONT>            int l = originalData.size();<a name="line.253"></a>
+<FONT color="green">254</FONT>    <a name="line.254"></a>
+<FONT color="green">255</FONT>            List&lt;S&gt; origDataCopy = new ArrayList&lt;S&gt; (originalData);<a name="line.255"></a>
+<FONT color="green">256</FONT>    <a name="line.256"></a>
+<FONT color="green">257</FONT>            Double[] res = new Double[l];<a name="line.257"></a>
+<FONT color="green">258</FONT>            for (int i=0; i&lt;l; i++) {<a name="line.258"></a>
+<FONT color="green">259</FONT>                int index = origDataCopy.indexOf(permutedData.get(i));<a name="line.259"></a>
+<FONT color="green">260</FONT>                if (index == -1) {<a name="line.260"></a>
+<FONT color="green">261</FONT>                    throw new IllegalArgumentException("originalData and permutedData must contain the same objects.");<a name="line.261"></a>
+<FONT color="green">262</FONT>                }<a name="line.262"></a>
+<FONT color="green">263</FONT>                res[index] = (double) i / l;<a name="line.263"></a>
+<FONT color="green">264</FONT>                origDataCopy.set(index, null);<a name="line.264"></a>
+<FONT color="green">265</FONT>            }<a name="line.265"></a>
+<FONT color="green">266</FONT>            return Arrays.asList(res);<a name="line.266"></a>
+<FONT color="green">267</FONT>        }<a name="line.267"></a>
+<FONT color="green">268</FONT>    <a name="line.268"></a>
+<FONT color="green">269</FONT>        /**<a name="line.269"></a>
+<FONT color="green">270</FONT>         * {@inheritDoc}<a name="line.270"></a>
+<FONT color="green">271</FONT>         */<a name="line.271"></a>
+<FONT color="green">272</FONT>        @Override<a name="line.272"></a>
+<FONT color="green">273</FONT>        public String toString() {<a name="line.273"></a>
+<FONT color="green">274</FONT>            return String.format("(f=%s pi=(%s))", getFitness(), baseSeqPermutation);<a name="line.274"></a>
+<FONT color="green">275</FONT>        }<a name="line.275"></a>
+<FONT color="green">276</FONT>    <a name="line.276"></a>
+<FONT color="green">277</FONT>        /**<a name="line.277"></a>
+<FONT color="green">278</FONT>         * Helper for constructor. Generates a list of natural numbers (0,1,...,l-1).<a name="line.278"></a>
+<FONT color="green">279</FONT>         *<a name="line.279"></a>
+<FONT color="green">280</FONT>         * @param l length of list to generate<a name="line.280"></a>
+<FONT color="green">281</FONT>         * @return list of integers from 0 to l-1<a name="line.281"></a>
+<FONT color="green">282</FONT>         */<a name="line.282"></a>
+<FONT color="green">283</FONT>        private static List&lt;Integer&gt; baseSequence(int l) {<a name="line.283"></a>
+<FONT color="green">284</FONT>            List&lt;Integer&gt; baseSequence = new ArrayList&lt;Integer&gt; (l);<a name="line.284"></a>
+<FONT color="green">285</FONT>            for (int i=0; i&lt;l; i++) {<a name="line.285"></a>
+<FONT color="green">286</FONT>                baseSequence.add(i);<a name="line.286"></a>
+<FONT color="green">287</FONT>            }<a name="line.287"></a>
+<FONT color="green">288</FONT>            return baseSequence;<a name="line.288"></a>
+<FONT color="green">289</FONT>        }<a name="line.289"></a>
+<FONT color="green">290</FONT>    }<a name="line.290"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/RandomKeyMutation.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,122 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.ArrayList;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.List;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Mutation operator for {@link RandomKey}s. Changes a randomly chosen element<a name="line.25"></a>
+<FONT color="green">026</FONT>     * of the array representation to a random value uniformly distributed in [0,1].<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @since 2.0<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.29"></a>
+<FONT color="green">030</FONT>     */<a name="line.30"></a>
+<FONT color="green">031</FONT>    public class RandomKeyMutation implements MutationPolicy {<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /**<a name="line.33"></a>
+<FONT color="green">034</FONT>         * {@inheritDoc}<a name="line.34"></a>
+<FONT color="green">035</FONT>         *<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @throws IllegalArgumentException if &lt;code&gt;original&lt;/code&gt; is not a<a name="line.36"></a>
+<FONT color="green">037</FONT>         * {@link RandomKey} instance<a name="line.37"></a>
+<FONT color="green">038</FONT>         */<a name="line.38"></a>
+<FONT color="green">039</FONT>        public Chromosome mutate(Chromosome original) {<a name="line.39"></a>
+<FONT color="green">040</FONT>            if (!(original instanceof RandomKey&lt;?&gt;)) {<a name="line.40"></a>
+<FONT color="green">041</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.41"></a>
+<FONT color="green">042</FONT>                        "RandomKeyMutation works only with RandomKeys, got " +<a name="line.42"></a>
+<FONT color="green">043</FONT>                        original.getClass().getSimpleName());<a name="line.43"></a>
+<FONT color="green">044</FONT>            }<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>            RandomKey&lt;?&gt; originalRk = (RandomKey&lt;?&gt;) original;<a name="line.46"></a>
+<FONT color="green">047</FONT>            List&lt;Double&gt; repr = originalRk.getRepresentation();<a name="line.47"></a>
+<FONT color="green">048</FONT>            int rInd = GeneticAlgorithm.getRandomGenerator().nextInt(repr.size());<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>            List&lt;Double&gt; newRepr = new ArrayList&lt;Double&gt; (repr);<a name="line.50"></a>
+<FONT color="green">051</FONT>            newRepr.set(rInd, GeneticAlgorithm.getRandomGenerator().nextDouble());<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>            return originalRk.newFixedLengthChromosome(newRepr);<a name="line.53"></a>
+<FONT color="green">054</FONT>        }<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>    }<a name="line.56"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/SelectionPolicy.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,98 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Algorithm used to select a chromosome pair from a population.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>     * @since 2.0<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     */<a name="line.24"></a>
+<FONT color="green">025</FONT>    public interface SelectionPolicy {<a name="line.25"></a>
+<FONT color="green">026</FONT>        /**<a name="line.26"></a>
+<FONT color="green">027</FONT>         * Select two chromosomes from the population.<a name="line.27"></a>
+<FONT color="green">028</FONT>         * @param population the population from which the chromosomes are choosen.<a name="line.28"></a>
+<FONT color="green">029</FONT>         * @return the selected chromosomes.<a name="line.29"></a>
+<FONT color="green">030</FONT>         */<a name="line.30"></a>
+<FONT color="green">031</FONT>        ChromosomePair select(Population population);<a name="line.31"></a>
+<FONT color="green">032</FONT>    }<a name="line.32"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/StoppingCondition.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,101 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Algorithm used to determine when to stop evolution.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>     * @since 2.0<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     */<a name="line.24"></a>
+<FONT color="green">025</FONT>    public interface StoppingCondition {<a name="line.25"></a>
+<FONT color="green">026</FONT>        /**<a name="line.26"></a>
+<FONT color="green">027</FONT>         * Determine whether or not the given population satisfies the stopping<a name="line.27"></a>
+<FONT color="green">028</FONT>         * condition.<a name="line.28"></a>
+<FONT color="green">029</FONT>         *<a name="line.29"></a>
+<FONT color="green">030</FONT>         * @param population the population to test.<a name="line.30"></a>
+<FONT color="green">031</FONT>         * @return &lt;code&gt;true&lt;/code&gt; if this stopping condition is met by the<a name="line.31"></a>
+<FONT color="green">032</FONT>         *         given population. &lt;code&gt;false&lt;/code&gt; otherwise.<a name="line.32"></a>
+<FONT color="green">033</FONT>         */<a name="line.33"></a>
+<FONT color="green">034</FONT>        boolean isSatisfied(Population population);<a name="line.34"></a>
+<FONT color="green">035</FONT>    }<a name="line.35"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/genetics/TournamentSelection.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,180 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.genetics;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.ArrayList;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.List;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Tournament selection scheme. Each of the two selected chromosomes is selected<a name="line.23"></a>
+<FONT color="green">024</FONT>     * based on n-ary tournament -- this is done by drawing {@link #arity} random<a name="line.24"></a>
+<FONT color="green">025</FONT>     * chromosomes without replacement from the population, and then selecting the<a name="line.25"></a>
+<FONT color="green">026</FONT>     * fittest chromosome among them.<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @since 2.0<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.29"></a>
+<FONT color="green">030</FONT>     */<a name="line.30"></a>
+<FONT color="green">031</FONT>    public class TournamentSelection implements SelectionPolicy {<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** number of chromosomes included in the tournament selections */<a name="line.33"></a>
+<FONT color="green">034</FONT>        private int arity;<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /**<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Creates a new TournamentSelection instance.<a name="line.37"></a>
+<FONT color="green">038</FONT>         *<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @param arity<a name="line.39"></a>
+<FONT color="green">040</FONT>         *            how many chromosomes will be drawn to the tournament<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        public TournamentSelection(int arity) {<a name="line.42"></a>
+<FONT color="green">043</FONT>            this.arity = arity;<a name="line.43"></a>
+<FONT color="green">044</FONT>        }<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /**<a name="line.46"></a>
+<FONT color="green">047</FONT>         * Select two chromosomes from the population. Each of the two selected<a name="line.47"></a>
+<FONT color="green">048</FONT>         * chromosomes is selected based on n-ary tournament -- this is done by<a name="line.48"></a>
+<FONT color="green">049</FONT>         * drawing {@link #arity} random chromosomes without replacement from the<a name="line.49"></a>
+<FONT color="green">050</FONT>         * population, and then selecting the fittest chromosome among them.<a name="line.50"></a>
+<FONT color="green">051</FONT>         *<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @param population<a name="line.52"></a>
+<FONT color="green">053</FONT>         *            the population from which the chromosomes are choosen.<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @return the selected chromosomes.<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public ChromosomePair select(Population population) {<a name="line.56"></a>
+<FONT color="green">057</FONT>            return new ChromosomePair(<a name="line.57"></a>
+<FONT color="green">058</FONT>                    tournament((ListPopulation) population),<a name="line.58"></a>
+<FONT color="green">059</FONT>                    tournament((ListPopulation)population)<a name="line.59"></a>
+<FONT color="green">060</FONT>                    );<a name="line.60"></a>
+<FONT color="green">061</FONT>        }<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /**<a name="line.63"></a>
+<FONT color="green">064</FONT>         * Helper for {@link #select(Population)}. Draw {@link #arity} random<a name="line.64"></a>
+<FONT color="green">065</FONT>         * chromosomes without replacement from the population, and then select the<a name="line.65"></a>
+<FONT color="green">066</FONT>         * fittest chromosome among them.<a name="line.66"></a>
+<FONT color="green">067</FONT>         *<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param population<a name="line.68"></a>
+<FONT color="green">069</FONT>         *            the population from which the chromosomes are choosen.<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @return the selected chromosome.<a name="line.70"></a>
+<FONT color="green">071</FONT>         */<a name="line.71"></a>
+<FONT color="green">072</FONT>        private Chromosome tournament(ListPopulation population) {<a name="line.72"></a>
+<FONT color="green">073</FONT>            if (population.getPopulationSize() &lt; this.arity)<a name="line.73"></a>
+<FONT color="green">074</FONT>                throw new IllegalArgumentException("Tournament arity cannot be bigger than population size.");<a name="line.74"></a>
+<FONT color="green">075</FONT>            // auxiliary population<a name="line.75"></a>
+<FONT color="green">076</FONT>            ListPopulation tournamentPopulation = new ListPopulation(this.arity) {<a name="line.76"></a>
+<FONT color="green">077</FONT>                public Population nextGeneration() {<a name="line.77"></a>
+<FONT color="green">078</FONT>                    // not useful here<a name="line.78"></a>
+<FONT color="green">079</FONT>                    return null;<a name="line.79"></a>
+<FONT color="green">080</FONT>                }<a name="line.80"></a>
+<FONT color="green">081</FONT>            };<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>            // create a copy of the chromosome list<a name="line.83"></a>
+<FONT color="green">084</FONT>            List&lt;Chromosome&gt; chromosomes = new ArrayList&lt;Chromosome&gt; (population.getChromosomes());<a name="line.84"></a>
+<FONT color="green">085</FONT>            for (int i=0; i&lt;this.arity; i++) {<a name="line.85"></a>
+<FONT color="green">086</FONT>                // select a random individual and add it to the tournament<a name="line.86"></a>
+<FONT color="green">087</FONT>                int rind = GeneticAlgorithm.getRandomGenerator().nextInt(chromosomes.size());<a name="line.87"></a>
+<FONT color="green">088</FONT>                tournamentPopulation.addChromosome(chromosomes.get(rind));<a name="line.88"></a>
+<FONT color="green">089</FONT>                // do not select it again<a name="line.89"></a>
+<FONT color="green">090</FONT>                chromosomes.remove(rind);<a name="line.90"></a>
+<FONT color="green">091</FONT>            }<a name="line.91"></a>
+<FONT color="green">092</FONT>            // the winner takes it all<a name="line.92"></a>
+<FONT color="green">093</FONT>            return tournamentPopulation.getFittestChromosome();<a name="line.93"></a>
+<FONT color="green">094</FONT>        }<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /**<a name="line.96"></a>
+<FONT color="green">097</FONT>         * Gets the arity (number of chromosomes drawn to the tournament).<a name="line.97"></a>
+<FONT color="green">098</FONT>         *<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @return arity of the tournament<a name="line.99"></a>
+<FONT color="green">100</FONT>         */<a name="line.100"></a>
+<FONT color="green">101</FONT>        public int getArity() {<a name="line.101"></a>
+<FONT color="green">102</FONT>            return arity;<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /**<a name="line.105"></a>
+<FONT color="green">106</FONT>         * Sets the arity (number of chromosomes drawn to the tournament).<a name="line.106"></a>
+<FONT color="green">107</FONT>         *<a name="line.107"></a>
+<FONT color="green">108</FONT>         * @param arity arity of the tournament<a name="line.108"></a>
+<FONT color="green">109</FONT>         */<a name="line.109"></a>
+<FONT color="green">110</FONT>        public void setArity(int arity) {<a name="line.110"></a>
+<FONT color="green">111</FONT>            this.arity = arity;<a name="line.111"></a>
+<FONT color="green">112</FONT>        }<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>    }<a name="line.114"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/geometry/CardanEulerSingularityException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,110 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.geometry;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /** This class represents exceptions thrown while extractiong Cardan<a name="line.22"></a>
+<FONT color="green">023</FONT>     * or Euler angles from a rotation.<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 1.2<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public class CardanEulerSingularityException<a name="line.28"></a>
+<FONT color="green">029</FONT>      extends MathException {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /** Serializable version identifier */<a name="line.31"></a>
+<FONT color="green">032</FONT>        private static final long serialVersionUID = -1360952845582206770L;<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /**<a name="line.34"></a>
+<FONT color="green">035</FONT>         * Simple constructor.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * build an exception with a default message.<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @param isCardan if true, the rotation is related to Cardan angles,<a name="line.37"></a>
+<FONT color="green">038</FONT>         * if false it is related to EulerAngles<a name="line.38"></a>
+<FONT color="green">039</FONT>         */<a name="line.39"></a>
+<FONT color="green">040</FONT>        public CardanEulerSingularityException(boolean isCardan) {<a name="line.40"></a>
+<FONT color="green">041</FONT>            super(isCardan ? "Cardan angles singularity" : "Euler angles singularity");<a name="line.41"></a>
+<FONT color="green">042</FONT>        }<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>    }<a name="line.44"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/geometry/NotARotationMatrixException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,112 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.geometry;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This class represents exceptions thrown while building rotations<a name="line.23"></a>
+<FONT color="green">024</FONT>     * from matrices.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @since 1.2<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>    public class NotARotationMatrixException<a name="line.30"></a>
+<FONT color="green">031</FONT>      extends MathException {<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** Serializable version identifier */<a name="line.33"></a>
+<FONT color="green">034</FONT>        private static final long serialVersionUID = 5647178478658937642L;<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /**<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Simple constructor.<a name="line.37"></a>
+<FONT color="green">038</FONT>         * Build an exception by translating and formating a message<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @param specifier format specifier (to be translated)<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @param parts to insert in the format (no translation)<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        public NotARotationMatrixException(String specifier, Object ... parts) {<a name="line.42"></a>
+<FONT color="green">043</FONT>            super(specifier, parts);<a name="line.43"></a>
+<FONT color="green">044</FONT>        }<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>    }<a name="line.46"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/geometry/Rotation.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,1118 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.geometry;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * This class implements rotations in a three-dimensional space.<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;Rotations can be represented by several different mathematical<a name="line.27"></a>
+<FONT color="green">028</FONT>     * entities (matrices, axe and angle, Cardan or Euler angles,<a name="line.28"></a>
+<FONT color="green">029</FONT>     * quaternions). This class presents an higher level abstraction, more<a name="line.29"></a>
+<FONT color="green">030</FONT>     * user-oriented and hiding this implementation details. Well, for the<a name="line.30"></a>
+<FONT color="green">031</FONT>     * curious, we use quaternions for the internal representation. The<a name="line.31"></a>
+<FONT color="green">032</FONT>     * user can build a rotation from any of these representations, and<a name="line.32"></a>
+<FONT color="green">033</FONT>     * any of these representations can be retrieved from a<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;code&gt;Rotation&lt;/code&gt; instance (see the various constructors and<a name="line.34"></a>
+<FONT color="green">035</FONT>     * getters). In addition, a rotation can also be built implicitely<a name="line.35"></a>
+<FONT color="green">036</FONT>     * from a set of vectors and their image.&lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;p&gt;This implies that this class can be used to convert from one<a name="line.37"></a>
+<FONT color="green">038</FONT>     * representation to another one. For example, converting a rotation<a name="line.38"></a>
+<FONT color="green">039</FONT>     * matrix into a set of Cardan angles from can be done using the<a name="line.39"></a>
+<FONT color="green">040</FONT>     * followong single line of code:&lt;/p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;pre&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * double[] angles = new Rotation(matrix, 1.0e-10).getAngles(RotationOrder.XYZ);<a name="line.42"></a>
+<FONT color="green">043</FONT>     * &lt;/pre&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;p&gt;Focus is oriented on what a rotation &lt;em&gt;do&lt;/em&gt; rather than on its<a name="line.44"></a>
+<FONT color="green">045</FONT>     * underlying representation. Once it has been built, and regardless of its<a name="line.45"></a>
+<FONT color="green">046</FONT>     * internal representation, a rotation is an &lt;em&gt;operator&lt;/em&gt; which basically<a name="line.46"></a>
+<FONT color="green">047</FONT>     * transforms three dimensional {@link Vector3D vectors} into other three<a name="line.47"></a>
+<FONT color="green">048</FONT>     * dimensional {@link Vector3D vectors}. Depending on the application, the<a name="line.48"></a>
+<FONT color="green">049</FONT>     * meaning of these vectors may vary and the semantics of the rotation also.&lt;/p&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     * &lt;p&gt;For example in an spacecraft attitude simulation tool, users will often<a name="line.50"></a>
+<FONT color="green">051</FONT>     * consider the vectors are fixed (say the Earth direction for example) and the<a name="line.51"></a>
+<FONT color="green">052</FONT>     * rotation transforms the coordinates coordinates of this vector in inertial<a name="line.52"></a>
+<FONT color="green">053</FONT>     * frame into the coordinates of the same vector in satellite frame. In this<a name="line.53"></a>
+<FONT color="green">054</FONT>     * case, the rotation implicitely defines the relation between the two frames.<a name="line.54"></a>
+<FONT color="green">055</FONT>     * Another example could be a telescope control application, where the rotation<a name="line.55"></a>
+<FONT color="green">056</FONT>     * would transform the sighting direction at rest into the desired observing<a name="line.56"></a>
+<FONT color="green">057</FONT>     * direction when the telescope is pointed towards an object of interest. In this<a name="line.57"></a>
+<FONT color="green">058</FONT>     * case the rotation transforms the directionf at rest in a topocentric frame<a name="line.58"></a>
+<FONT color="green">059</FONT>     * into the sighting direction in the same topocentric frame. In many case, both<a name="line.59"></a>
+<FONT color="green">060</FONT>     * approaches will be combined, in our telescope example, we will probably also<a name="line.60"></a>
+<FONT color="green">061</FONT>     * need to transform the observing direction in the topocentric frame into the<a name="line.61"></a>
+<FONT color="green">062</FONT>     * observing direction in inertial frame taking into account the observatory<a name="line.62"></a>
+<FONT color="green">063</FONT>     * location and the Earth rotation.&lt;/p&gt;<a name="line.63"></a>
+<FONT color="green">064</FONT>     *<a name="line.64"></a>
+<FONT color="green">065</FONT>     * &lt;p&gt;These examples show that a rotation is what the user wants it to be, so this<a name="line.65"></a>
+<FONT color="green">066</FONT>     * class does not push the user towards one specific definition and hence does not<a name="line.66"></a>
+<FONT color="green">067</FONT>     * provide methods like &lt;code&gt;projectVectorIntoDestinationFrame&lt;/code&gt; or<a name="line.67"></a>
+<FONT color="green">068</FONT>     * &lt;code&gt;computeTransformedDirection&lt;/code&gt;. It provides simpler and more generic<a name="line.68"></a>
+<FONT color="green">069</FONT>     * methods: {@link #applyTo(Vector3D) applyTo(Vector3D)} and {@link<a name="line.69"></a>
+<FONT color="green">070</FONT>     * #applyInverseTo(Vector3D) applyInverseTo(Vector3D)}.&lt;/p&gt;<a name="line.70"></a>
+<FONT color="green">071</FONT>     *<a name="line.71"></a>
+<FONT color="green">072</FONT>     * &lt;p&gt;Since a rotation is basically a vectorial operator, several rotations can be<a name="line.72"></a>
+<FONT color="green">073</FONT>     * composed together and the composite operation &lt;code&gt;r = r&lt;sub&gt;1&lt;/sub&gt; o<a name="line.73"></a>
+<FONT color="green">074</FONT>     * r&lt;sub&gt;2&lt;/sub&gt;&lt;/code&gt; (which means that for each vector &lt;code&gt;u&lt;/code&gt;,<a name="line.74"></a>
+<FONT color="green">075</FONT>     * &lt;code&gt;r(u) = r&lt;sub&gt;1&lt;/sub&gt;(r&lt;sub&gt;2&lt;/sub&gt;(u))&lt;/code&gt;) is also a rotation. Hence<a name="line.75"></a>
+<FONT color="green">076</FONT>     * we can consider that in addition to vectors, a rotation can be applied to other<a name="line.76"></a>
+<FONT color="green">077</FONT>     * rotations as well (or to itself). With our previous notations, we would say we<a name="line.77"></a>
+<FONT color="green">078</FONT>     * can apply &lt;code&gt;r&lt;sub&gt;1&lt;/sub&gt;&lt;/code&gt; to &lt;code&gt;r&lt;sub&gt;2&lt;/sub&gt;&lt;/code&gt; and the result<a name="line.78"></a>
+<FONT color="green">079</FONT>     * we get is &lt;code&gt;r = r&lt;sub&gt;1&lt;/sub&gt; o r&lt;sub&gt;2&lt;/sub&gt;&lt;/code&gt;. For this purpose, the<a name="line.79"></a>
+<FONT color="green">080</FONT>     * class provides the methods: {@link #applyTo(Rotation) applyTo(Rotation)} and<a name="line.80"></a>
+<FONT color="green">081</FONT>     * {@link #applyInverseTo(Rotation) applyInverseTo(Rotation)}.&lt;/p&gt;<a name="line.81"></a>
+<FONT color="green">082</FONT>     *<a name="line.82"></a>
+<FONT color="green">083</FONT>     * &lt;p&gt;Rotations are guaranteed to be immutable objects.&lt;/p&gt;<a name="line.83"></a>
+<FONT color="green">084</FONT>     *<a name="line.84"></a>
+<FONT color="green">085</FONT>     * @version $Revision: 772119 $ $Date: 2009-05-06 05:43:28 -0400 (Wed, 06 May 2009) $<a name="line.85"></a>
+<FONT color="green">086</FONT>     * @see Vector3D<a name="line.86"></a>
+<FONT color="green">087</FONT>     * @see RotationOrder<a name="line.87"></a>
+<FONT color="green">088</FONT>     * @since 1.2<a name="line.88"></a>
+<FONT color="green">089</FONT>     */<a name="line.89"></a>
+<FONT color="green">090</FONT>    <a name="line.90"></a>
+<FONT color="green">091</FONT>    public class Rotation implements Serializable {<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>      /** Identity rotation. */<a name="line.93"></a>
+<FONT color="green">094</FONT>      public static final Rotation IDENTITY = new Rotation(1.0, 0.0, 0.0, 0.0, false);<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>      /** Serializable version identifier */<a name="line.96"></a>
+<FONT color="green">097</FONT>      private static final long serialVersionUID = -2153622329907944313L;<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>      /** Scalar coordinate of the quaternion. */<a name="line.99"></a>
+<FONT color="green">100</FONT>      private final double q0;<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>      /** First coordinate of the vectorial part of the quaternion. */<a name="line.102"></a>
+<FONT color="green">103</FONT>      private final double q1;<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>      /** Second coordinate of the vectorial part of the quaternion. */<a name="line.105"></a>
+<FONT color="green">106</FONT>      private final double q2;<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>      /** Third coordinate of the vectorial part of the quaternion. */<a name="line.108"></a>
+<FONT color="green">109</FONT>      private final double q3;<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>      /** Build a rotation from the quaternion coordinates.<a name="line.111"></a>
+<FONT color="green">112</FONT>       * &lt;p&gt;A rotation can be built from a &lt;em&gt;normalized&lt;/em&gt; quaternion,<a name="line.112"></a>
+<FONT color="green">113</FONT>       * i.e. a quaternion for which q&lt;sub&gt;0&lt;/sub&gt;&lt;sup&gt;2&lt;/sup&gt; +<a name="line.113"></a>
+<FONT color="green">114</FONT>       * q&lt;sub&gt;1&lt;/sub&gt;&lt;sup&gt;2&lt;/sup&gt; + q&lt;sub&gt;2&lt;/sub&gt;&lt;sup&gt;2&lt;/sup&gt; +<a name="line.114"></a>
+<FONT color="green">115</FONT>       * q&lt;sub&gt;3&lt;/sub&gt;&lt;sup&gt;2&lt;/sup&gt; = 1. If the quaternion is not normalized,<a name="line.115"></a>
+<FONT color="green">116</FONT>       * the constructor can normalize it in a preprocessing step.&lt;/p&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>       * @param q0 scalar part of the quaternion<a name="line.117"></a>
+<FONT color="green">118</FONT>       * @param q1 first coordinate of the vectorial part of the quaternion<a name="line.118"></a>
+<FONT color="green">119</FONT>       * @param q2 second coordinate of the vectorial part of the quaternion<a name="line.119"></a>
+<FONT color="green">120</FONT>       * @param q3 third coordinate of the vectorial part of the quaternion<a name="line.120"></a>
+<FONT color="green">121</FONT>       * @param needsNormalization if true, the coordinates are considered<a name="line.121"></a>
+<FONT color="green">122</FONT>       * not to be normalized, a normalization preprocessing step is performed<a name="line.122"></a>
+<FONT color="green">123</FONT>       * before using them<a name="line.123"></a>
+<FONT color="green">124</FONT>       */<a name="line.124"></a>
+<FONT color="green">125</FONT>      public Rotation(double q0, double q1, double q2, double q3,<a name="line.125"></a>
+<FONT color="green">126</FONT>                      boolean needsNormalization) {<a name="line.126"></a>
+<FONT color="green">127</FONT>    <a name="line.127"></a>
+<FONT color="green">128</FONT>        if (needsNormalization) {<a name="line.128"></a>
+<FONT color="green">129</FONT>          // normalization preprocessing<a name="line.129"></a>
+<FONT color="green">130</FONT>          double inv = 1.0 / Math.sqrt(q0 * q0 + q1 * q1 + q2 * q2 + q3 * q3);<a name="line.130"></a>
+<FONT color="green">131</FONT>          q0 *= inv;<a name="line.131"></a>
+<FONT color="green">132</FONT>          q1 *= inv;<a name="line.132"></a>
+<FONT color="green">133</FONT>          q2 *= inv;<a name="line.133"></a>
+<FONT color="green">134</FONT>          q3 *= inv;<a name="line.134"></a>
+<FONT color="green">135</FONT>        }<a name="line.135"></a>
+<FONT color="green">136</FONT>    <a name="line.136"></a>
+<FONT color="green">137</FONT>        this.q0 = q0;<a name="line.137"></a>
+<FONT color="green">138</FONT>        this.q1 = q1;<a name="line.138"></a>
+<FONT color="green">139</FONT>        this.q2 = q2;<a name="line.139"></a>
+<FONT color="green">140</FONT>        this.q3 = q3;<a name="line.140"></a>
+<FONT color="green">141</FONT>    <a name="line.141"></a>
+<FONT color="green">142</FONT>      }<a name="line.142"></a>
+<FONT color="green">143</FONT>    <a name="line.143"></a>
+<FONT color="green">144</FONT>      /** Build a rotation from an axis and an angle.<a name="line.144"></a>
+<FONT color="green">145</FONT>       * &lt;p&gt;We use the convention that angles are oriented according to<a name="line.145"></a>
+<FONT color="green">146</FONT>       * the effect of the rotation on vectors around the axis. That means<a name="line.146"></a>
+<FONT color="green">147</FONT>       * that if (i, j, k) is a direct frame and if we first provide +k as<a name="line.147"></a>
+<FONT color="green">148</FONT>       * the axis and PI/2 as the angle to this constructor, and then<a name="line.148"></a>
+<FONT color="green">149</FONT>       * {@link #applyTo(Vector3D) apply} the instance to +i, we will get<a name="line.149"></a>
+<FONT color="green">150</FONT>       * +j.&lt;/p&gt;<a name="line.150"></a>
+<FONT color="green">151</FONT>       * @param axis axis around which to rotate<a name="line.151"></a>
+<FONT color="green">152</FONT>       * @param angle rotation angle.<a name="line.152"></a>
+<FONT color="green">153</FONT>       * @exception ArithmeticException if the axis norm is zero<a name="line.153"></a>
+<FONT color="green">154</FONT>       */<a name="line.154"></a>
+<FONT color="green">155</FONT>      public Rotation(Vector3D axis, double angle) {<a name="line.155"></a>
+<FONT color="green">156</FONT>    <a name="line.156"></a>
+<FONT color="green">157</FONT>        double norm = axis.getNorm();<a name="line.157"></a>
+<FONT color="green">158</FONT>        if (norm == 0) {<a name="line.158"></a>
+<FONT color="green">159</FONT>          throw MathRuntimeException.createArithmeticException("zero norm for rotation axis");<a name="line.159"></a>
+<FONT color="green">160</FONT>        }<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>        double halfAngle = -0.5 * angle;<a name="line.162"></a>
+<FONT color="green">163</FONT>        double coeff = Math.sin(halfAngle) / norm;<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>        q0 = Math.cos (halfAngle);<a name="line.165"></a>
+<FONT color="green">166</FONT>        q1 = coeff * axis.getX();<a name="line.166"></a>
+<FONT color="green">167</FONT>        q2 = coeff * axis.getY();<a name="line.167"></a>
+<FONT color="green">168</FONT>        q3 = coeff * axis.getZ();<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>      }<a name="line.170"></a>
+<FONT color="green">171</FONT>    <a name="line.171"></a>
+<FONT color="green">172</FONT>      /** Build a rotation from a 3X3 matrix.<a name="line.172"></a>
+<FONT color="green">173</FONT>    <a name="line.173"></a>
+<FONT color="green">174</FONT>       * &lt;p&gt;Rotation matrices are orthogonal matrices, i.e. unit matrices<a name="line.174"></a>
+<FONT color="green">175</FONT>       * (which are matrices for which m.m&lt;sup&gt;T&lt;/sup&gt; = I) with real<a name="line.175"></a>
+<FONT color="green">176</FONT>       * coefficients. The module of the determinant of unit matrices is<a name="line.176"></a>
+<FONT color="green">177</FONT>       * 1, among the orthogonal 3X3 matrices, only the ones having a<a name="line.177"></a>
+<FONT color="green">178</FONT>       * positive determinant (+1) are rotation matrices.&lt;/p&gt;<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>       * &lt;p&gt;When a rotation is defined by a matrix with truncated values<a name="line.180"></a>
+<FONT color="green">181</FONT>       * (typically when it is extracted from a technical sheet where only<a name="line.181"></a>
+<FONT color="green">182</FONT>       * four to five significant digits are available), the matrix is not<a name="line.182"></a>
+<FONT color="green">183</FONT>       * orthogonal anymore. This constructor handles this case<a name="line.183"></a>
+<FONT color="green">184</FONT>       * transparently by using a copy of the given matrix and applying a<a name="line.184"></a>
+<FONT color="green">185</FONT>       * correction to the copy in order to perfect its orthogonality. If<a name="line.185"></a>
+<FONT color="green">186</FONT>       * the Frobenius norm of the correction needed is above the given<a name="line.186"></a>
+<FONT color="green">187</FONT>       * threshold, then the matrix is considered to be too far from a<a name="line.187"></a>
+<FONT color="green">188</FONT>       * true rotation matrix and an exception is thrown.&lt;p&gt;<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>       * @param m rotation matrix<a name="line.190"></a>
+<FONT color="green">191</FONT>       * @param threshold convergence threshold for the iterative<a name="line.191"></a>
+<FONT color="green">192</FONT>       * orthogonality correction (convergence is reached when the<a name="line.192"></a>
+<FONT color="green">193</FONT>       * difference between two steps of the Frobenius norm of the<a name="line.193"></a>
+<FONT color="green">194</FONT>       * correction is below this threshold)<a name="line.194"></a>
+<FONT color="green">195</FONT>    <a name="line.195"></a>
+<FONT color="green">196</FONT>       * @exception NotARotationMatrixException if the matrix is not a 3X3<a name="line.196"></a>
+<FONT color="green">197</FONT>       * matrix, or if it cannot be transformed into an orthogonal matrix<a name="line.197"></a>
+<FONT color="green">198</FONT>       * with the given threshold, or if the determinant of the resulting<a name="line.198"></a>
+<FONT color="green">199</FONT>       * orthogonal matrix is negative<a name="line.199"></a>
+<FONT color="green">200</FONT>    <a name="line.200"></a>
+<FONT color="green">201</FONT>       */<a name="line.201"></a>
+<FONT color="green">202</FONT>      public Rotation(double[][] m, double threshold)<a name="line.202"></a>
+<FONT color="green">203</FONT>        throws NotARotationMatrixException {<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>        // dimension check<a name="line.205"></a>
+<FONT color="green">206</FONT>        if ((m.length != 3) || (m[0].length != 3) ||<a name="line.206"></a>
+<FONT color="green">207</FONT>            (m[1].length != 3) || (m[2].length != 3)) {<a name="line.207"></a>
+<FONT color="green">208</FONT>          throw new NotARotationMatrixException(<a name="line.208"></a>
+<FONT color="green">209</FONT>                  "a {0}x{1} matrix cannot be a rotation matrix",<a name="line.209"></a>
+<FONT color="green">210</FONT>                  m.length, m[0].length);<a name="line.210"></a>
+<FONT color="green">211</FONT>        }<a name="line.211"></a>
+<FONT color="green">212</FONT>    <a name="line.212"></a>
+<FONT color="green">213</FONT>        // compute a "close" orthogonal matrix<a name="line.213"></a>
+<FONT color="green">214</FONT>        double[][] ort = orthogonalizeMatrix(m, threshold);<a name="line.214"></a>
+<FONT color="green">215</FONT>    <a name="line.215"></a>
+<FONT color="green">216</FONT>        // check the sign of the determinant<a name="line.216"></a>
+<FONT color="green">217</FONT>        double det = ort[0][0] * (ort[1][1] * ort[2][2] - ort[2][1] * ort[1][2]) -<a name="line.217"></a>
+<FONT color="green">218</FONT>                     ort[1][0] * (ort[0][1] * ort[2][2] - ort[2][1] * ort[0][2]) +<a name="line.218"></a>
+<FONT color="green">219</FONT>                     ort[2][0] * (ort[0][1] * ort[1][2] - ort[1][1] * ort[0][2]);<a name="line.219"></a>
+<FONT color="green">220</FONT>        if (det &lt; 0.0) {<a name="line.220"></a>
+<FONT color="green">221</FONT>          throw new NotARotationMatrixException(<a name="line.221"></a>
+<FONT color="green">222</FONT>                  "the closest orthogonal matrix has a negative determinant {0}",<a name="line.222"></a>
+<FONT color="green">223</FONT>                  det);<a name="line.223"></a>
+<FONT color="green">224</FONT>        }<a name="line.224"></a>
+<FONT color="green">225</FONT>    <a name="line.225"></a>
+<FONT color="green">226</FONT>        // There are different ways to compute the quaternions elements<a name="line.226"></a>
+<FONT color="green">227</FONT>        // from the matrix. They all involve computing one element from<a name="line.227"></a>
+<FONT color="green">228</FONT>        // the diagonal of the matrix, and computing the three other ones<a name="line.228"></a>
+<FONT color="green">229</FONT>        // using a formula involving a division by the first element,<a name="line.229"></a>
+<FONT color="green">230</FONT>        // which unfortunately can be zero. Since the norm of the<a name="line.230"></a>
+<FONT color="green">231</FONT>        // quaternion is 1, we know at least one element has an absolute<a name="line.231"></a>
+<FONT color="green">232</FONT>        // value greater or equal to 0.5, so it is always possible to<a name="line.232"></a>
+<FONT color="green">233</FONT>        // select the right formula and avoid division by zero and even<a name="line.233"></a>
+<FONT color="green">234</FONT>        // numerical inaccuracy. Checking the elements in turn and using<a name="line.234"></a>
+<FONT color="green">235</FONT>        // the first one greater than 0.45 is safe (this leads to a simple<a name="line.235"></a>
+<FONT color="green">236</FONT>        // test since qi = 0.45 implies 4 qi^2 - 1 = -0.19)<a name="line.236"></a>
+<FONT color="green">237</FONT>        double s = ort[0][0] + ort[1][1] + ort[2][2];<a name="line.237"></a>
+<FONT color="green">238</FONT>        if (s &gt; -0.19) {<a name="line.238"></a>
+<FONT color="green">239</FONT>          // compute q0 and deduce q1, q2 and q3<a name="line.239"></a>
+<FONT color="green">240</FONT>          q0 = 0.5 * Math.sqrt(s + 1.0);<a name="line.240"></a>
+<FONT color="green">241</FONT>          double inv = 0.25 / q0;<a name="line.241"></a>
+<FONT color="green">242</FONT>          q1 = inv * (ort[1][2] - ort[2][1]);<a name="line.242"></a>
+<FONT color="green">243</FONT>          q2 = inv * (ort[2][0] - ort[0][2]);<a name="line.243"></a>
+<FONT color="green">244</FONT>          q3 = inv * (ort[0][1] - ort[1][0]);<a name="line.244"></a>
+<FONT color="green">245</FONT>        } else {<a name="line.245"></a>
+<FONT color="green">246</FONT>          s = ort[0][0] - ort[1][1] - ort[2][2];<a name="line.246"></a>
+<FONT color="green">247</FONT>          if (s &gt; -0.19) {<a name="line.247"></a>
+<FONT color="green">248</FONT>            // compute q1 and deduce q0, q2 and q3<a name="line.248"></a>
+<FONT color="green">249</FONT>            q1 = 0.5 * Math.sqrt(s + 1.0);<a name="line.249"></a>
+<FONT color="green">250</FONT>            double inv = 0.25 / q1;<a name="line.250"></a>
+<FONT color="green">251</FONT>            q0 = inv * (ort[1][2] - ort[2][1]);<a name="line.251"></a>
+<FONT color="green">252</FONT>            q2 = inv * (ort[0][1] + ort[1][0]);<a name="line.252"></a>
+<FONT color="green">253</FONT>            q3 = inv * (ort[0][2] + ort[2][0]);<a name="line.253"></a>
+<FONT color="green">254</FONT>          } else {<a name="line.254"></a>
+<FONT color="green">255</FONT>            s = ort[1][1] - ort[0][0] - ort[2][2];<a name="line.255"></a>
+<FONT color="green">256</FONT>            if (s &gt; -0.19) {<a name="line.256"></a>
+<FONT color="green">257</FONT>              // compute q2 and deduce q0, q1 and q3<a name="line.257"></a>
+<FONT color="green">258</FONT>              q2 = 0.5 * Math.sqrt(s + 1.0);<a name="line.258"></a>
+<FONT color="green">259</FONT>              double inv = 0.25 / q2;<a name="line.259"></a>
+<FONT color="green">260</FONT>              q0 = inv * (ort[2][0] - ort[0][2]);<a name="line.260"></a>
+<FONT color="green">261</FONT>              q1 = inv * (ort[0][1] + ort[1][0]);<a name="line.261"></a>
+<FONT color="green">262</FONT>              q3 = inv * (ort[2][1] + ort[1][2]);<a name="line.262"></a>
+<FONT color="green">263</FONT>            } else {<a name="line.263"></a>
+<FONT color="green">264</FONT>              // compute q3 and deduce q0, q1 and q2<a name="line.264"></a>
+<FONT color="green">265</FONT>              s = ort[2][2] - ort[0][0] - ort[1][1];<a name="line.265"></a>
+<FONT color="green">266</FONT>              q3 = 0.5 * Math.sqrt(s + 1.0);<a name="line.266"></a>
+<FONT color="green">267</FONT>              double inv = 0.25 / q3;<a name="line.267"></a>
+<FONT color="green">268</FONT>              q0 = inv * (ort[0][1] - ort[1][0]);<a name="line.268"></a>
+<FONT color="green">269</FONT>              q1 = inv * (ort[0][2] + ort[2][0]);<a name="line.269"></a>
+<FONT color="green">270</FONT>              q2 = inv * (ort[2][1] + ort[1][2]);<a name="line.270"></a>
+<FONT color="green">271</FONT>            }<a name="line.271"></a>
+<FONT color="green">272</FONT>          }<a name="line.272"></a>
+<FONT color="green">273</FONT>        }<a name="line.273"></a>
+<FONT color="green">274</FONT>    <a name="line.274"></a>
+<FONT color="green">275</FONT>      }<a name="line.275"></a>
+<FONT color="green">276</FONT>    <a name="line.276"></a>
+<FONT color="green">277</FONT>      /** Build the rotation that transforms a pair of vector into another pair.<a name="line.277"></a>
+<FONT color="green">278</FONT>    <a name="line.278"></a>
+<FONT color="green">279</FONT>       * &lt;p&gt;Except for possible scale factors, if the instance were applied to<a name="line.279"></a>
+<FONT color="green">280</FONT>       * the pair (u&lt;sub&gt;1&lt;/sub&gt;, u&lt;sub&gt;2&lt;/sub&gt;) it will produce the pair<a name="line.280"></a>
+<FONT color="green">281</FONT>       * (v&lt;sub&gt;1&lt;/sub&gt;, v&lt;sub&gt;2&lt;/sub&gt;).&lt;/p&gt;<a name="line.281"></a>
+<FONT color="green">282</FONT>    <a name="line.282"></a>
+<FONT color="green">283</FONT>       * &lt;p&gt;If the angular separation between u&lt;sub&gt;1&lt;/sub&gt; and u&lt;sub&gt;2&lt;/sub&gt; is<a name="line.283"></a>
+<FONT color="green">284</FONT>       * not the same as the angular separation between v&lt;sub&gt;1&lt;/sub&gt; and<a name="line.284"></a>
+<FONT color="green">285</FONT>       * v&lt;sub&gt;2&lt;/sub&gt;, then a corrected v'&lt;sub&gt;2&lt;/sub&gt; will be used rather than<a name="line.285"></a>
+<FONT color="green">286</FONT>       * v&lt;sub&gt;2&lt;/sub&gt;, the corrected vector will be in the (v&lt;sub&gt;1&lt;/sub&gt;,<a name="line.286"></a>
+<FONT color="green">287</FONT>       * v&lt;sub&gt;2&lt;/sub&gt;) plane.&lt;/p&gt;<a name="line.287"></a>
+<FONT color="green">288</FONT>    <a name="line.288"></a>
+<FONT color="green">289</FONT>       * @param u1 first vector of the origin pair<a name="line.289"></a>
+<FONT color="green">290</FONT>       * @param u2 second vector of the origin pair<a name="line.290"></a>
+<FONT color="green">291</FONT>       * @param v1 desired image of u1 by the rotation<a name="line.291"></a>
+<FONT color="green">292</FONT>       * @param v2 desired image of u2 by the rotation<a name="line.292"></a>
+<FONT color="green">293</FONT>       * @exception IllegalArgumentException if the norm of one of the vectors is zero<a name="line.293"></a>
+<FONT color="green">294</FONT>       */<a name="line.294"></a>
+<FONT color="green">295</FONT>      public Rotation(Vector3D u1, Vector3D u2, Vector3D v1, Vector3D v2) {<a name="line.295"></a>
+<FONT color="green">296</FONT>    <a name="line.296"></a>
+<FONT color="green">297</FONT>      // norms computation<a name="line.297"></a>
+<FONT color="green">298</FONT>      double u1u1 = Vector3D.dotProduct(u1, u1);<a name="line.298"></a>
+<FONT color="green">299</FONT>      double u2u2 = Vector3D.dotProduct(u2, u2);<a name="line.299"></a>
+<FONT color="green">300</FONT>      double v1v1 = Vector3D.dotProduct(v1, v1);<a name="line.300"></a>
+<FONT color="green">301</FONT>      double v2v2 = Vector3D.dotProduct(v2, v2);<a name="line.301"></a>
+<FONT color="green">302</FONT>      if ((u1u1 == 0) || (u2u2 == 0) || (v1v1 == 0) || (v2v2 == 0)) {<a name="line.302"></a>
+<FONT color="green">303</FONT>        throw MathRuntimeException.createIllegalArgumentException("zero norm for rotation defining vector");<a name="line.303"></a>
+<FONT color="green">304</FONT>      }<a name="line.304"></a>
+<FONT color="green">305</FONT>    <a name="line.305"></a>
+<FONT color="green">306</FONT>      double u1x = u1.getX();<a name="line.306"></a>
+<FONT color="green">307</FONT>      double u1y = u1.getY();<a name="line.307"></a>
+<FONT color="green">308</FONT>      double u1z = u1.getZ();<a name="line.308"></a>
+<FONT color="green">309</FONT>    <a name="line.309"></a>
+<FONT color="green">310</FONT>      double u2x = u2.getX();<a name="line.310"></a>
+<FONT color="green">311</FONT>      double u2y = u2.getY();<a name="line.311"></a>
+<FONT color="green">312</FONT>      double u2z = u2.getZ();<a name="line.312"></a>
+<FONT color="green">313</FONT>    <a name="line.313"></a>
+<FONT color="green">314</FONT>      // normalize v1 in order to have (v1'|v1') = (u1|u1)<a name="line.314"></a>
+<FONT color="green">315</FONT>      double coeff = Math.sqrt (u1u1 / v1v1);<a name="line.315"></a>
+<FONT color="green">316</FONT>      double v1x   = coeff * v1.getX();<a name="line.316"></a>
+<FONT color="green">317</FONT>      double v1y   = coeff * v1.getY();<a name="line.317"></a>
+<FONT color="green">318</FONT>      double v1z   = coeff * v1.getZ();<a name="line.318"></a>
+<FONT color="green">319</FONT>      v1 = new Vector3D(v1x, v1y, v1z);<a name="line.319"></a>
+<FONT color="green">320</FONT>    <a name="line.320"></a>
+<FONT color="green">321</FONT>      // adjust v2 in order to have (u1|u2) = (v1|v2) and (v2'|v2') = (u2|u2)<a name="line.321"></a>
+<FONT color="green">322</FONT>      double u1u2   = Vector3D.dotProduct(u1, u2);<a name="line.322"></a>
+<FONT color="green">323</FONT>      double v1v2   = Vector3D.dotProduct(v1, v2);<a name="line.323"></a>
+<FONT color="green">324</FONT>      double coeffU = u1u2 / u1u1;<a name="line.324"></a>
+<FONT color="green">325</FONT>      double coeffV = v1v2 / u1u1;<a name="line.325"></a>
+<FONT color="green">326</FONT>      double beta   = Math.sqrt((u2u2 - u1u2 * coeffU) / (v2v2 - v1v2 * coeffV));<a name="line.326"></a>
+<FONT color="green">327</FONT>      double alpha  = coeffU - beta * coeffV;<a name="line.327"></a>
+<FONT color="green">328</FONT>      double v2x    = alpha * v1x + beta * v2.getX();<a name="line.328"></a>
+<FONT color="green">329</FONT>      double v2y    = alpha * v1y + beta * v2.getY();<a name="line.329"></a>
+<FONT color="green">330</FONT>      double v2z    = alpha * v1z + beta * v2.getZ();<a name="line.330"></a>
+<FONT color="green">331</FONT>      v2 = new Vector3D(v2x, v2y, v2z);<a name="line.331"></a>
+<FONT color="green">332</FONT>    <a name="line.332"></a>
+<FONT color="green">333</FONT>      // preliminary computation (we use explicit formulation instead<a name="line.333"></a>
+<FONT color="green">334</FONT>      // of relying on the Vector3D class in order to avoid building lots<a name="line.334"></a>
+<FONT color="green">335</FONT>      // of temporary objects)<a name="line.335"></a>
+<FONT color="green">336</FONT>      Vector3D uRef = u1;<a name="line.336"></a>
+<FONT color="green">337</FONT>      Vector3D vRef = v1;<a name="line.337"></a>
+<FONT color="green">338</FONT>      double dx1 = v1x - u1.getX();<a name="line.338"></a>
+<FONT color="green">339</FONT>      double dy1 = v1y - u1.getY();<a name="line.339"></a>
+<FONT color="green">340</FONT>      double dz1 = v1z - u1.getZ();<a name="line.340"></a>
+<FONT color="green">341</FONT>      double dx2 = v2x - u2.getX();<a name="line.341"></a>
+<FONT color="green">342</FONT>      double dy2 = v2y - u2.getY();<a name="line.342"></a>
+<FONT color="green">343</FONT>      double dz2 = v2z - u2.getZ();<a name="line.343"></a>
+<FONT color="green">344</FONT>      Vector3D k = new Vector3D(dy1 * dz2 - dz1 * dy2,<a name="line.344"></a>
+<FONT color="green">345</FONT>                                dz1 * dx2 - dx1 * dz2,<a name="line.345"></a>
+<FONT color="green">346</FONT>                                dx1 * dy2 - dy1 * dx2);<a name="line.346"></a>
+<FONT color="green">347</FONT>      double c = k.getX() * (u1y * u2z - u1z * u2y) +<a name="line.347"></a>
+<FONT color="green">348</FONT>                 k.getY() * (u1z * u2x - u1x * u2z) +<a name="line.348"></a>
+<FONT color="green">349</FONT>                 k.getZ() * (u1x * u2y - u1y * u2x);<a name="line.349"></a>
+<FONT color="green">350</FONT>    <a name="line.350"></a>
+<FONT color="green">351</FONT>      if (c == 0) {<a name="line.351"></a>
+<FONT color="green">352</FONT>        // the (q1, q2, q3) vector is in the (u1, u2) plane<a name="line.352"></a>
+<FONT color="green">353</FONT>        // we try other vectors<a name="line.353"></a>
+<FONT color="green">354</FONT>        Vector3D u3 = Vector3D.crossProduct(u1, u2);<a name="line.354"></a>
+<FONT color="green">355</FONT>        Vector3D v3 = Vector3D.crossProduct(v1, v2);<a name="line.355"></a>
+<FONT color="green">356</FONT>        double u3x  = u3.getX();<a name="line.356"></a>
+<FONT color="green">357</FONT>        double u3y  = u3.getY();<a name="line.357"></a>
+<FONT color="green">358</FONT>        double u3z  = u3.getZ();<a name="line.358"></a>
+<FONT color="green">359</FONT>        double v3x  = v3.getX();<a name="line.359"></a>
+<FONT color="green">360</FONT>        double v3y  = v3.getY();<a name="line.360"></a>
+<FONT color="green">361</FONT>        double v3z  = v3.getZ();<a name="line.361"></a>
+<FONT color="green">362</FONT>    <a name="line.362"></a>
+<FONT color="green">363</FONT>        double dx3 = v3x - u3x;<a name="line.363"></a>
+<FONT color="green">364</FONT>        double dy3 = v3y - u3y;<a name="line.364"></a>
+<FONT color="green">365</FONT>        double dz3 = v3z - u3z;<a name="line.365"></a>
+<FONT color="green">366</FONT>        k = new Vector3D(dy1 * dz3 - dz1 * dy3,<a name="line.366"></a>
+<FONT color="green">367</FONT>                         dz1 * dx3 - dx1 * dz3,<a name="line.367"></a>
+<FONT color="green">368</FONT>                         dx1 * dy3 - dy1 * dx3);<a name="line.368"></a>
+<FONT color="green">369</FONT>        c = k.getX() * (u1y * u3z - u1z * u3y) +<a name="line.369"></a>
+<FONT color="green">370</FONT>            k.getY() * (u1z * u3x - u1x * u3z) +<a name="line.370"></a>
+<FONT color="green">371</FONT>            k.getZ() * (u1x * u3y - u1y * u3x);<a name="line.371"></a>
+<FONT color="green">372</FONT>    <a name="line.372"></a>
+<FONT color="green">373</FONT>        if (c == 0) {<a name="line.373"></a>
+<FONT color="green">374</FONT>          // the (q1, q2, q3) vector is aligned with u1:<a name="line.374"></a>
+<FONT color="green">375</FONT>          // we try (u2, u3) and (v2, v3)<a name="line.375"></a>
+<FONT color="green">376</FONT>          k = new Vector3D(dy2 * dz3 - dz2 * dy3,<a name="line.376"></a>
+<FONT color="green">377</FONT>                           dz2 * dx3 - dx2 * dz3,<a name="line.377"></a>
+<FONT color="green">378</FONT>                           dx2 * dy3 - dy2 * dx3);<a name="line.378"></a>
+<FONT color="green">379</FONT>          c = k.getX() * (u2y * u3z - u2z * u3y) +<a name="line.379"></a>
+<FONT color="green">380</FONT>              k.getY() * (u2z * u3x - u2x * u3z) +<a name="line.380"></a>
+<FONT color="green">381</FONT>              k.getZ() * (u2x * u3y - u2y * u3x);<a name="line.381"></a>
+<FONT color="green">382</FONT>    <a name="line.382"></a>
+<FONT color="green">383</FONT>          if (c == 0) {<a name="line.383"></a>
+<FONT color="green">384</FONT>            // the (q1, q2, q3) vector is aligned with everything<a name="line.384"></a>
+<FONT color="green">385</FONT>            // this is really the identity rotation<a name="line.385"></a>
+<FONT color="green">386</FONT>            q0 = 1.0;<a name="line.386"></a>
+<FONT color="green">387</FONT>            q1 = 0.0;<a name="line.387"></a>
+<FONT color="green">388</FONT>            q2 = 0.0;<a name="line.388"></a>
+<FONT color="green">389</FONT>            q3 = 0.0;<a name="line.389"></a>
+<FONT color="green">390</FONT>            return;<a name="line.390"></a>
+<FONT color="green">391</FONT>          }<a name="line.391"></a>
+<FONT color="green">392</FONT>    <a name="line.392"></a>
+<FONT color="green">393</FONT>          // we will have to use u2 and v2 to compute the scalar part<a name="line.393"></a>
+<FONT color="green">394</FONT>          uRef = u2;<a name="line.394"></a>
+<FONT color="green">395</FONT>          vRef = v2;<a name="line.395"></a>
+<FONT color="green">396</FONT>    <a name="line.396"></a>
+<FONT color="green">397</FONT>        }<a name="line.397"></a>
+<FONT color="green">398</FONT>    <a name="line.398"></a>
+<FONT color="green">399</FONT>      }<a name="line.399"></a>
+<FONT color="green">400</FONT>    <a name="line.400"></a>
+<FONT color="green">401</FONT>      // compute the vectorial part<a name="line.401"></a>
+<FONT color="green">402</FONT>      c = Math.sqrt(c);<a name="line.402"></a>
+<FONT color="green">403</FONT>      double inv = 1.0 / (c + c);<a name="line.403"></a>
+<FONT color="green">404</FONT>      q1 = inv * k.getX();<a name="line.404"></a>
+<FONT color="green">405</FONT>      q2 = inv * k.getY();<a name="line.405"></a>
+<FONT color="green">406</FONT>      q3 = inv * k.getZ();<a name="line.406"></a>
+<FONT color="green">407</FONT>    <a name="line.407"></a>
+<FONT color="green">408</FONT>      // compute the scalar part<a name="line.408"></a>
+<FONT color="green">409</FONT>       k = new Vector3D(uRef.getY() * q3 - uRef.getZ() * q2,<a name="line.409"></a>
+<FONT color="green">410</FONT>                        uRef.getZ() * q1 - uRef.getX() * q3,<a name="line.410"></a>
+<FONT color="green">411</FONT>                        uRef.getX() * q2 - uRef.getY() * q1);<a name="line.411"></a>
+<FONT color="green">412</FONT>       c = Vector3D.dotProduct(k, k);<a name="line.412"></a>
+<FONT color="green">413</FONT>      q0 = Vector3D.dotProduct(vRef, k) / (c + c);<a name="line.413"></a>
+<FONT color="green">414</FONT>    <a name="line.414"></a>
+<FONT color="green">415</FONT>      }<a name="line.415"></a>
+<FONT color="green">416</FONT>    <a name="line.416"></a>
+<FONT color="green">417</FONT>      /** Build one of the rotations that transform one vector into another one.<a name="line.417"></a>
+<FONT color="green">418</FONT>    <a name="line.418"></a>
+<FONT color="green">419</FONT>       * &lt;p&gt;Except for a possible scale factor, if the instance were<a name="line.419"></a>
+<FONT color="green">420</FONT>       * applied to the vector u it will produce the vector v. There is an<a name="line.420"></a>
+<FONT color="green">421</FONT>       * infinite number of such rotations, this constructor choose the<a name="line.421"></a>
+<FONT color="green">422</FONT>       * one with the smallest associated angle (i.e. the one whose axis<a name="line.422"></a>
+<FONT color="green">423</FONT>       * is orthogonal to the (u, v) plane). If u and v are colinear, an<a name="line.423"></a>
+<FONT color="green">424</FONT>       * arbitrary rotation axis is chosen.&lt;/p&gt;<a name="line.424"></a>
+<FONT color="green">425</FONT>    <a name="line.425"></a>
+<FONT color="green">426</FONT>       * @param u origin vector<a name="line.426"></a>
+<FONT color="green">427</FONT>       * @param v desired image of u by the rotation<a name="line.427"></a>
+<FONT color="green">428</FONT>       * @exception IllegalArgumentException if the norm of one of the vectors is zero<a name="line.428"></a>
+<FONT color="green">429</FONT>       */<a name="line.429"></a>
+<FONT color="green">430</FONT>      public Rotation(Vector3D u, Vector3D v) {<a name="line.430"></a>
+<FONT color="green">431</FONT>    <a name="line.431"></a>
+<FONT color="green">432</FONT>        double normProduct = u.getNorm() * v.getNorm();<a name="line.432"></a>
+<FONT color="green">433</FONT>        if (normProduct == 0) {<a name="line.433"></a>
+<FONT color="green">434</FONT>            throw MathRuntimeException.createIllegalArgumentException("zero norm for rotation defining vector");<a name="line.434"></a>
+<FONT color="green">435</FONT>        }<a name="line.435"></a>
+<FONT color="green">436</FONT>    <a name="line.436"></a>
+<FONT color="green">437</FONT>        double dot = Vector3D.dotProduct(u, v);<a name="line.437"></a>
+<FONT color="green">438</FONT>    <a name="line.438"></a>
+<FONT color="green">439</FONT>        if (dot &lt; ((2.0e-15 - 1.0) * normProduct)) {<a name="line.439"></a>
+<FONT color="green">440</FONT>          // special case u = -v: we select a PI angle rotation around<a name="line.440"></a>
+<FONT color="green">441</FONT>          // an arbitrary vector orthogonal to u<a name="line.441"></a>
+<FONT color="green">442</FONT>          Vector3D w = u.orthogonal();<a name="line.442"></a>
+<FONT color="green">443</FONT>          q0 = 0.0;<a name="line.443"></a>
+<FONT color="green">444</FONT>          q1 = -w.getX();<a name="line.444"></a>
+<FONT color="green">445</FONT>          q2 = -w.getY();<a name="line.445"></a>
+<FONT color="green">446</FONT>          q3 = -w.getZ();<a name="line.446"></a>
+<FONT color="green">447</FONT>        } else {<a name="line.447"></a>
+<FONT color="green">448</FONT>          // general case: (u, v) defines a plane, we select<a name="line.448"></a>
+<FONT color="green">449</FONT>          // the shortest possible rotation: axis orthogonal to this plane<a name="line.449"></a>
+<FONT color="green">450</FONT>          q0 = Math.sqrt(0.5 * (1.0 + dot / normProduct));<a name="line.450"></a>
+<FONT color="green">451</FONT>          double coeff = 1.0 / (2.0 * q0 * normProduct);<a name="line.451"></a>
+<FONT color="green">452</FONT>          q1 = coeff * (v.getY() * u.getZ() - v.getZ() * u.getY());<a name="line.452"></a>
+<FONT color="green">453</FONT>          q2 = coeff * (v.getZ() * u.getX() - v.getX() * u.getZ());<a name="line.453"></a>
+<FONT color="green">454</FONT>          q3 = coeff * (v.getX() * u.getY() - v.getY() * u.getX());<a name="line.454"></a>
+<FONT color="green">455</FONT>        }<a name="line.455"></a>
+<FONT color="green">456</FONT>    <a name="line.456"></a>
+<FONT color="green">457</FONT>      }<a name="line.457"></a>
+<FONT color="green">458</FONT>    <a name="line.458"></a>
+<FONT color="green">459</FONT>      /** Build a rotation from three Cardan or Euler elementary rotations.<a name="line.459"></a>
+<FONT color="green">460</FONT>    <a name="line.460"></a>
+<FONT color="green">461</FONT>       * &lt;p&gt;Cardan rotations are three successive rotations around the<a name="line.461"></a>
+<FONT color="green">462</FONT>       * canonical axes X, Y and Z, each axis being used once. There are<a name="line.462"></a>
+<FONT color="green">463</FONT>       * 6 such sets of rotations (XYZ, XZY, YXZ, YZX, ZXY and ZYX). Euler<a name="line.463"></a>
+<FONT color="green">464</FONT>       * rotations are three successive rotations around the canonical<a name="line.464"></a>
+<FONT color="green">465</FONT>       * axes X, Y and Z, the first and last rotations being around the<a name="line.465"></a>
+<FONT color="green">466</FONT>       * same axis. There are 6 such sets of rotations (XYX, XZX, YXY,<a name="line.466"></a>
+<FONT color="green">467</FONT>       * YZY, ZXZ and ZYZ), the most popular one being ZXZ.&lt;/p&gt;<a name="line.467"></a>
+<FONT color="green">468</FONT>       * &lt;p&gt;Beware that many people routinely use the term Euler angles even<a name="line.468"></a>
+<FONT color="green">469</FONT>       * for what really are Cardan angles (this confusion is especially<a name="line.469"></a>
+<FONT color="green">470</FONT>       * widespread in the aerospace business where Roll, Pitch and Yaw angles<a name="line.470"></a>
+<FONT color="green">471</FONT>       * are often wrongly tagged as Euler angles).&lt;/p&gt;<a name="line.471"></a>
+<FONT color="green">472</FONT>    <a name="line.472"></a>
+<FONT color="green">473</FONT>       * @param order order of rotations to use<a name="line.473"></a>
+<FONT color="green">474</FONT>       * @param alpha1 angle of the first elementary rotation<a name="line.474"></a>
+<FONT color="green">475</FONT>       * @param alpha2 angle of the second elementary rotation<a name="line.475"></a>
+<FONT color="green">476</FONT>       * @param alpha3 angle of the third elementary rotation<a name="line.476"></a>
+<FONT color="green">477</FONT>       */<a name="line.477"></a>
+<FONT color="green">478</FONT>      public Rotation(RotationOrder order,<a name="line.478"></a>
+<FONT color="green">479</FONT>                      double alpha1, double alpha2, double alpha3) {<a name="line.479"></a>
+<FONT color="green">480</FONT>        Rotation r1 = new Rotation(order.getA1(), alpha1);<a name="line.480"></a>
+<FONT color="green">481</FONT>        Rotation r2 = new Rotation(order.getA2(), alpha2);<a name="line.481"></a>
+<FONT color="green">482</FONT>        Rotation r3 = new Rotation(order.getA3(), alpha3);<a name="line.482"></a>
+<FONT color="green">483</FONT>        Rotation composed = r1.applyTo(r2.applyTo(r3));<a name="line.483"></a>
+<FONT color="green">484</FONT>        q0 = composed.q0;<a name="line.484"></a>
+<FONT color="green">485</FONT>        q1 = composed.q1;<a name="line.485"></a>
+<FONT color="green">486</FONT>        q2 = composed.q2;<a name="line.486"></a>
+<FONT color="green">487</FONT>        q3 = composed.q3;<a name="line.487"></a>
+<FONT color="green">488</FONT>      }<a name="line.488"></a>
+<FONT color="green">489</FONT>    <a name="line.489"></a>
+<FONT color="green">490</FONT>      /** Revert a rotation.<a name="line.490"></a>
+<FONT color="green">491</FONT>       * Build a rotation which reverse the effect of another<a name="line.491"></a>
+<FONT color="green">492</FONT>       * rotation. This means that if r(u) = v, then r.revert(v) = u. The<a name="line.492"></a>
+<FONT color="green">493</FONT>       * instance is not changed.<a name="line.493"></a>
+<FONT color="green">494</FONT>       * @return a new rotation whose effect is the reverse of the effect<a name="line.494"></a>
+<FONT color="green">495</FONT>       * of the instance<a name="line.495"></a>
+<FONT color="green">496</FONT>       */<a name="line.496"></a>
+<FONT color="green">497</FONT>      public Rotation revert() {<a name="line.497"></a>
+<FONT color="green">498</FONT>        return new Rotation(-q0, q1, q2, q3, false);<a name="line.498"></a>
+<FONT color="green">499</FONT>      }<a name="line.499"></a>
+<FONT color="green">500</FONT>    <a name="line.500"></a>
+<FONT color="green">501</FONT>      /** Get the scalar coordinate of the quaternion.<a name="line.501"></a>
+<FONT color="green">502</FONT>       * @return scalar coordinate of the quaternion<a name="line.502"></a>
+<FONT color="green">503</FONT>       */<a name="line.503"></a>
+<FONT color="green">504</FONT>      public double getQ0() {<a name="line.504"></a>
+<FONT color="green">505</FONT>        return q0;<a name="line.505"></a>
+<FONT color="green">506</FONT>      }<a name="line.506"></a>
+<FONT color="green">507</FONT>    <a name="line.507"></a>
+<FONT color="green">508</FONT>      /** Get the first coordinate of the vectorial part of the quaternion.<a name="line.508"></a>
+<FONT color="green">509</FONT>       * @return first coordinate of the vectorial part of the quaternion<a name="line.509"></a>
+<FONT color="green">510</FONT>       */<a name="line.510"></a>
+<FONT color="green">511</FONT>      public double getQ1() {<a name="line.511"></a>
+<FONT color="green">512</FONT>        return q1;<a name="line.512"></a>
+<FONT color="green">513</FONT>      }<a name="line.513"></a>
+<FONT color="green">514</FONT>    <a name="line.514"></a>
+<FONT color="green">515</FONT>      /** Get the second coordinate of the vectorial part of the quaternion.<a name="line.515"></a>
+<FONT color="green">516</FONT>       * @return second coordinate of the vectorial part of the quaternion<a name="line.516"></a>
+<FONT color="green">517</FONT>       */<a name="line.517"></a>
+<FONT color="green">518</FONT>      public double getQ2() {<a name="line.518"></a>
+<FONT color="green">519</FONT>        return q2;<a name="line.519"></a>
+<FONT color="green">520</FONT>      }<a name="line.520"></a>
+<FONT color="green">521</FONT>    <a name="line.521"></a>
+<FONT color="green">522</FONT>      /** Get the third coordinate of the vectorial part of the quaternion.<a name="line.522"></a>
+<FONT color="green">523</FONT>       * @return third coordinate of the vectorial part of the quaternion<a name="line.523"></a>
+<FONT color="green">524</FONT>       */<a name="line.524"></a>
+<FONT color="green">525</FONT>      public double getQ3() {<a name="line.525"></a>
+<FONT color="green">526</FONT>        return q3;<a name="line.526"></a>
+<FONT color="green">527</FONT>      }<a name="line.527"></a>
+<FONT color="green">528</FONT>    <a name="line.528"></a>
+<FONT color="green">529</FONT>      /** Get the normalized axis of the rotation.<a name="line.529"></a>
+<FONT color="green">530</FONT>       * @return normalized axis of the rotation<a name="line.530"></a>
+<FONT color="green">531</FONT>       */<a name="line.531"></a>
+<FONT color="green">532</FONT>      public Vector3D getAxis() {<a name="line.532"></a>
+<FONT color="green">533</FONT>        double squaredSine = q1 * q1 + q2 * q2 + q3 * q3;<a name="line.533"></a>
+<FONT color="green">534</FONT>        if (squaredSine == 0) {<a name="line.534"></a>
+<FONT color="green">535</FONT>          return new Vector3D(1, 0, 0);<a name="line.535"></a>
+<FONT color="green">536</FONT>        } else if (q0 &lt; 0) {<a name="line.536"></a>
+<FONT color="green">537</FONT>          double inverse = 1 / Math.sqrt(squaredSine);<a name="line.537"></a>
+<FONT color="green">538</FONT>          return new Vector3D(q1 * inverse, q2 * inverse, q3 * inverse);<a name="line.538"></a>
+<FONT color="green">539</FONT>        }<a name="line.539"></a>
+<FONT color="green">540</FONT>        double inverse = -1 / Math.sqrt(squaredSine);<a name="line.540"></a>
+<FONT color="green">541</FONT>        return new Vector3D(q1 * inverse, q2 * inverse, q3 * inverse);<a name="line.541"></a>
+<FONT color="green">542</FONT>      }<a name="line.542"></a>
+<FONT color="green">543</FONT>    <a name="line.543"></a>
+<FONT color="green">544</FONT>      /** Get the angle of the rotation.<a name="line.544"></a>
+<FONT color="green">545</FONT>       * @return angle of the rotation (between 0 and &amp;pi;)<a name="line.545"></a>
+<FONT color="green">546</FONT>       */<a name="line.546"></a>
+<FONT color="green">547</FONT>      public double getAngle() {<a name="line.547"></a>
+<FONT color="green">548</FONT>        if ((q0 &lt; -0.1) || (q0 &gt; 0.1)) {<a name="line.548"></a>
+<FONT color="green">549</FONT>          return 2 * Math.asin(Math.sqrt(q1 * q1 + q2 * q2 + q3 * q3));<a name="line.549"></a>
+<FONT color="green">550</FONT>        } else if (q0 &lt; 0) {<a name="line.550"></a>
+<FONT color="green">551</FONT>          return 2 * Math.acos(-q0);<a name="line.551"></a>
+<FONT color="green">552</FONT>        }<a name="line.552"></a>
+<FONT color="green">553</FONT>        return 2 * Math.acos(q0);<a name="line.553"></a>
+<FONT color="green">554</FONT>      }<a name="line.554"></a>
+<FONT color="green">555</FONT>    <a name="line.555"></a>
+<FONT color="green">556</FONT>      /** Get the Cardan or Euler angles corresponding to the instance.<a name="line.556"></a>
+<FONT color="green">557</FONT>    <a name="line.557"></a>
+<FONT color="green">558</FONT>       * &lt;p&gt;The equations show that each rotation can be defined by two<a name="line.558"></a>
+<FONT color="green">559</FONT>       * different values of the Cardan or Euler angles set. For example<a name="line.559"></a>
+<FONT color="green">560</FONT>       * if Cardan angles are used, the rotation defined by the angles<a name="line.560"></a>
+<FONT color="green">561</FONT>       * a&lt;sub&gt;1&lt;/sub&gt;, a&lt;sub&gt;2&lt;/sub&gt; and a&lt;sub&gt;3&lt;/sub&gt; is the same as<a name="line.561"></a>
+<FONT color="green">562</FONT>       * the rotation defined by the angles &amp;pi; + a&lt;sub&gt;1&lt;/sub&gt;, &amp;pi;<a name="line.562"></a>
+<FONT color="green">563</FONT>       * - a&lt;sub&gt;2&lt;/sub&gt; and &amp;pi; + a&lt;sub&gt;3&lt;/sub&gt;. This method implements<a name="line.563"></a>
+<FONT color="green">564</FONT>       * the following arbitrary choices:&lt;/p&gt;<a name="line.564"></a>
+<FONT color="green">565</FONT>       * &lt;ul&gt;<a name="line.565"></a>
+<FONT color="green">566</FONT>       *   &lt;li&gt;for Cardan angles, the chosen set is the one for which the<a name="line.566"></a>
+<FONT color="green">567</FONT>       *   second angle is between -&amp;pi;/2 and &amp;pi;/2 (i.e its cosine is<a name="line.567"></a>
+<FONT color="green">568</FONT>       *   positive),&lt;/li&gt;<a name="line.568"></a>
+<FONT color="green">569</FONT>       *   &lt;li&gt;for Euler angles, the chosen set is the one for which the<a name="line.569"></a>
+<FONT color="green">570</FONT>       *   second angle is between 0 and &amp;pi; (i.e its sine is positive).&lt;/li&gt;<a name="line.570"></a>
+<FONT color="green">571</FONT>       * &lt;/ul&gt;<a name="line.571"></a>
+<FONT color="green">572</FONT>    <a name="line.572"></a>
+<FONT color="green">573</FONT>       * &lt;p&gt;Cardan and Euler angle have a very disappointing drawback: all<a name="line.573"></a>
+<FONT color="green">574</FONT>       * of them have singularities. This means that if the instance is<a name="line.574"></a>
+<FONT color="green">575</FONT>       * too close to the singularities corresponding to the given<a name="line.575"></a>
+<FONT color="green">576</FONT>       * rotation order, it will be impossible to retrieve the angles. For<a name="line.576"></a>
+<FONT color="green">577</FONT>       * Cardan angles, this is often called gimbal lock. There is<a name="line.577"></a>
+<FONT color="green">578</FONT>       * &lt;em&gt;nothing&lt;/em&gt; to do to prevent this, it is an intrinsic problem<a name="line.578"></a>
+<FONT color="green">579</FONT>       * with Cardan and Euler representation (but not a problem with the<a name="line.579"></a>
+<FONT color="green">580</FONT>       * rotation itself, which is perfectly well defined). For Cardan<a name="line.580"></a>
+<FONT color="green">581</FONT>       * angles, singularities occur when the second angle is close to<a name="line.581"></a>
+<FONT color="green">582</FONT>       * -&amp;pi;/2 or +&amp;pi;/2, for Euler angle singularities occur when the<a name="line.582"></a>
+<FONT color="green">583</FONT>       * second angle is close to 0 or &amp;pi;, this implies that the identity<a name="line.583"></a>
+<FONT color="green">584</FONT>       * rotation is always singular for Euler angles!&lt;/p&gt;<a name="line.584"></a>
+<FONT color="green">585</FONT>    <a name="line.585"></a>
+<FONT color="green">586</FONT>       * @param order rotation order to use<a name="line.586"></a>
+<FONT color="green">587</FONT>       * @return an array of three angles, in the order specified by the set<a name="line.587"></a>
+<FONT color="green">588</FONT>       * @exception CardanEulerSingularityException if the rotation is<a name="line.588"></a>
+<FONT color="green">589</FONT>       * singular with respect to the angles set specified<a name="line.589"></a>
+<FONT color="green">590</FONT>       */<a name="line.590"></a>
+<FONT color="green">591</FONT>      public double[] getAngles(RotationOrder order)<a name="line.591"></a>
+<FONT color="green">592</FONT>        throws CardanEulerSingularityException {<a name="line.592"></a>
+<FONT color="green">593</FONT>    <a name="line.593"></a>
+<FONT color="green">594</FONT>        if (order == RotationOrder.XYZ) {<a name="line.594"></a>
+<FONT color="green">595</FONT>    <a name="line.595"></a>
+<FONT color="green">596</FONT>          // r (Vector3D.plusK) coordinates are :<a name="line.596"></a>
+<FONT color="green">597</FONT>          //  sin (theta), -cos (theta) sin (phi), cos (theta) cos (phi)<a name="line.597"></a>
+<FONT color="green">598</FONT>          // (-r) (Vector3D.plusI) coordinates are :<a name="line.598"></a>
+<FONT color="green">599</FONT>          // cos (psi) cos (theta), -sin (psi) cos (theta), sin (theta)<a name="line.599"></a>
+<FONT color="green">600</FONT>          // and we can choose to have theta in the interval [-PI/2 ; +PI/2]<a name="line.600"></a>
+<FONT color="green">601</FONT>          Vector3D v1 = applyTo(Vector3D.PLUS_K);<a name="line.601"></a>
+<FONT color="green">602</FONT>          Vector3D v2 = applyInverseTo(Vector3D.PLUS_I);<a name="line.602"></a>
+<FONT color="green">603</FONT>          if  ((v2.getZ() &lt; -0.9999999999) || (v2.getZ() &gt; 0.9999999999)) {<a name="line.603"></a>
+<FONT color="green">604</FONT>            throw new CardanEulerSingularityException(true);<a name="line.604"></a>
+<FONT color="green">605</FONT>          }<a name="line.605"></a>
+<FONT color="green">606</FONT>          return new double[] {<a name="line.606"></a>
+<FONT color="green">607</FONT>            Math.atan2(-(v1.getY()), v1.getZ()),<a name="line.607"></a>
+<FONT color="green">608</FONT>            Math.asin(v2.getZ()),<a name="line.608"></a>
+<FONT color="green">609</FONT>            Math.atan2(-(v2.getY()), v2.getX())<a name="line.609"></a>
+<FONT color="green">610</FONT>          };<a name="line.610"></a>
+<FONT color="green">611</FONT>    <a name="line.611"></a>
+<FONT color="green">612</FONT>        } else if (order == RotationOrder.XZY) {<a name="line.612"></a>
+<FONT color="green">613</FONT>    <a name="line.613"></a>
+<FONT color="green">614</FONT>          // r (Vector3D.plusJ) coordinates are :<a name="line.614"></a>
+<FONT color="green">615</FONT>          // -sin (psi), cos (psi) cos (phi), cos (psi) sin (phi)<a name="line.615"></a>
+<FONT color="green">616</FONT>          // (-r) (Vector3D.plusI) coordinates are :<a name="line.616"></a>
+<FONT color="green">617</FONT>          // cos (theta) cos (psi), -sin (psi), sin (theta) cos (psi)<a name="line.617"></a>
+<FONT color="green">618</FONT>          // and we can choose to have psi in the interval [-PI/2 ; +PI/2]<a name="line.618"></a>
+<FONT color="green">619</FONT>          Vector3D v1 = applyTo(Vector3D.PLUS_J);<a name="line.619"></a>
+<FONT color="green">620</FONT>          Vector3D v2 = applyInverseTo(Vector3D.PLUS_I);<a name="line.620"></a>
+<FONT color="green">621</FONT>          if ((v2.getY() &lt; -0.9999999999) || (v2.getY() &gt; 0.9999999999)) {<a name="line.621"></a>
+<FONT color="green">622</FONT>            throw new CardanEulerSingularityException(true);<a name="line.622"></a>
+<FONT color="green">623</FONT>          }<a name="line.623"></a>
+<FONT color="green">624</FONT>          return new double[] {<a name="line.624"></a>
+<FONT color="green">625</FONT>            Math.atan2(v1.getZ(), v1.getY()),<a name="line.625"></a>
+<FONT color="green">626</FONT>           -Math.asin(v2.getY()),<a name="line.626"></a>
+<FONT color="green">627</FONT>            Math.atan2(v2.getZ(), v2.getX())<a name="line.627"></a>
+<FONT color="green">628</FONT>          };<a name="line.628"></a>
+<FONT color="green">629</FONT>    <a name="line.629"></a>
+<FONT color="green">630</FONT>        } else if (order == RotationOrder.YXZ) {<a name="line.630"></a>
+<FONT color="green">631</FONT>    <a name="line.631"></a>
+<FONT color="green">632</FONT>          // r (Vector3D.plusK) coordinates are :<a name="line.632"></a>
+<FONT color="green">633</FONT>          //  cos (phi) sin (theta), -sin (phi), cos (phi) cos (theta)<a name="line.633"></a>
+<FONT color="green">634</FONT>          // (-r) (Vector3D.plusJ) coordinates are :<a name="line.634"></a>
+<FONT color="green">635</FONT>          // sin (psi) cos (phi), cos (psi) cos (phi), -sin (phi)<a name="line.635"></a>
+<FONT color="green">636</FONT>          // and we can choose to have phi in the interval [-PI/2 ; +PI/2]<a name="line.636"></a>
+<FONT color="green">637</FONT>          Vector3D v1 = applyTo(Vector3D.PLUS_K);<a name="line.637"></a>
+<FONT color="green">638</FONT>          Vector3D v2 = applyInverseTo(Vector3D.PLUS_J);<a name="line.638"></a>
+<FONT color="green">639</FONT>          if ((v2.getZ() &lt; -0.9999999999) || (v2.getZ() &gt; 0.9999999999)) {<a name="line.639"></a>
+<FONT color="green">640</FONT>            throw new CardanEulerSingularityException(true);<a name="line.640"></a>
+<FONT color="green">641</FONT>          }<a name="line.641"></a>
+<FONT color="green">642</FONT>          return new double[] {<a name="line.642"></a>
+<FONT color="green">643</FONT>            Math.atan2(v1.getX(), v1.getZ()),<a name="line.643"></a>
+<FONT color="green">644</FONT>           -Math.asin(v2.getZ()),<a name="line.644"></a>
+<FONT color="green">645</FONT>            Math.atan2(v2.getX(), v2.getY())<a name="line.645"></a>
+<FONT color="green">646</FONT>          };<a name="line.646"></a>
+<FONT color="green">647</FONT>    <a name="line.647"></a>
+<FONT color="green">648</FONT>        } else if (order == RotationOrder.YZX) {<a name="line.648"></a>
+<FONT color="green">649</FONT>    <a name="line.649"></a>
+<FONT color="green">650</FONT>          // r (Vector3D.plusI) coordinates are :<a name="line.650"></a>
+<FONT color="green">651</FONT>          // cos (psi) cos (theta), sin (psi), -cos (psi) sin (theta)<a name="line.651"></a>
+<FONT color="green">652</FONT>          // (-r) (Vector3D.plusJ) coordinates are :<a name="line.652"></a>
+<FONT color="green">653</FONT>          // sin (psi), cos (phi) cos (psi), -sin (phi) cos (psi)<a name="line.653"></a>
+<FONT color="green">654</FONT>          // and we can choose to have psi in the interval [-PI/2 ; +PI/2]<a name="line.654"></a>
+<FONT color="green">655</FONT>          Vector3D v1 = applyTo(Vector3D.PLUS_I);<a name="line.655"></a>
+<FONT color="green">656</FONT>          Vector3D v2 = applyInverseTo(Vector3D.PLUS_J);<a name="line.656"></a>
+<FONT color="green">657</FONT>          if ((v2.getX() &lt; -0.9999999999) || (v2.getX() &gt; 0.9999999999)) {<a name="line.657"></a>
+<FONT color="green">658</FONT>            throw new CardanEulerSingularityException(true);<a name="line.658"></a>
+<FONT color="green">659</FONT>          }<a name="line.659"></a>
+<FONT color="green">660</FONT>          return new double[] {<a name="line.660"></a>
+<FONT color="green">661</FONT>            Math.atan2(-(v1.getZ()), v1.getX()),<a name="line.661"></a>
+<FONT color="green">662</FONT>            Math.asin(v2.getX()),<a name="line.662"></a>
+<FONT color="green">663</FONT>            Math.atan2(-(v2.getZ()), v2.getY())<a name="line.663"></a>
+<FONT color="green">664</FONT>          };<a name="line.664"></a>
+<FONT color="green">665</FONT>    <a name="line.665"></a>
+<FONT color="green">666</FONT>        } else if (order == RotationOrder.ZXY) {<a name="line.666"></a>
+<FONT color="green">667</FONT>    <a name="line.667"></a>
+<FONT color="green">668</FONT>          // r (Vector3D.plusJ) coordinates are :<a name="line.668"></a>
+<FONT color="green">669</FONT>          // -cos (phi) sin (psi), cos (phi) cos (psi), sin (phi)<a name="line.669"></a>
+<FONT color="green">670</FONT>          // (-r) (Vector3D.plusK) coordinates are :<a name="line.670"></a>
+<FONT color="green">671</FONT>          // -sin (theta) cos (phi), sin (phi), cos (theta) cos (phi)<a name="line.671"></a>
+<FONT color="green">672</FONT>          // and we can choose to have phi in the interval [-PI/2 ; +PI/2]<a name="line.672"></a>
+<FONT color="green">673</FONT>          Vector3D v1 = applyTo(Vector3D.PLUS_J);<a name="line.673"></a>
+<FONT color="green">674</FONT>          Vector3D v2 = applyInverseTo(Vector3D.PLUS_K);<a name="line.674"></a>
+<FONT color="green">675</FONT>          if ((v2.getY() &lt; -0.9999999999) || (v2.getY() &gt; 0.9999999999)) {<a name="line.675"></a>
+<FONT color="green">676</FONT>            throw new CardanEulerSingularityException(true);<a name="line.676"></a>
+<FONT color="green">677</FONT>          }<a name="line.677"></a>
+<FONT color="green">678</FONT>          return new double[] {<a name="line.678"></a>
+<FONT color="green">679</FONT>            Math.atan2(-(v1.getX()), v1.getY()),<a name="line.679"></a>
+<FONT color="green">680</FONT>            Math.asin(v2.getY()),<a name="line.680"></a>
+<FONT color="green">681</FONT>            Math.atan2(-(v2.getX()), v2.getZ())<a name="line.681"></a>
+<FONT color="green">682</FONT>          };<a name="line.682"></a>
+<FONT color="green">683</FONT>    <a name="line.683"></a>
+<FONT color="green">684</FONT>        } else if (order == RotationOrder.ZYX) {<a name="line.684"></a>
+<FONT color="green">685</FONT>    <a name="line.685"></a>
+<FONT color="green">686</FONT>          // r (Vector3D.plusI) coordinates are :<a name="line.686"></a>
+<FONT color="green">687</FONT>          //  cos (theta) cos (psi), cos (theta) sin (psi), -sin (theta)<a name="line.687"></a>
+<FONT color="green">688</FONT>          // (-r) (Vector3D.plusK) coordinates are :<a name="line.688"></a>
+<FONT color="green">689</FONT>          // -sin (theta), sin (phi) cos (theta), cos (phi) cos (theta)<a name="line.689"></a>
+<FONT color="green">690</FONT>          // and we can choose to have theta in the interval [-PI/2 ; +PI/2]<a name="line.690"></a>
+<FONT color="green">691</FONT>          Vector3D v1 = applyTo(Vector3D.PLUS_I);<a name="line.691"></a>
+<FONT color="green">692</FONT>          Vector3D v2 = applyInverseTo(Vector3D.PLUS_K);<a name="line.692"></a>
+<FONT color="green">693</FONT>          if ((v2.getX() &lt; -0.9999999999) || (v2.getX() &gt; 0.9999999999)) {<a name="line.693"></a>
+<FONT color="green">694</FONT>            throw new CardanEulerSingularityException(true);<a name="line.694"></a>
+<FONT color="green">695</FONT>          }<a name="line.695"></a>
+<FONT color="green">696</FONT>          return new double[] {<a name="line.696"></a>
+<FONT color="green">697</FONT>            Math.atan2(v1.getY(), v1.getX()),<a name="line.697"></a>
+<FONT color="green">698</FONT>           -Math.asin(v2.getX()),<a name="line.698"></a>
+<FONT color="green">699</FONT>            Math.atan2(v2.getY(), v2.getZ())<a name="line.699"></a>
+<FONT color="green">700</FONT>          };<a name="line.700"></a>
+<FONT color="green">701</FONT>    <a name="line.701"></a>
+<FONT color="green">702</FONT>        } else if (order == RotationOrder.XYX) {<a name="line.702"></a>
+<FONT color="green">703</FONT>    <a name="line.703"></a>
+<FONT color="green">704</FONT>          // r (Vector3D.plusI) coordinates are :<a name="line.704"></a>
+<FONT color="green">705</FONT>          //  cos (theta), sin (phi1) sin (theta), -cos (phi1) sin (theta)<a name="line.705"></a>
+<FONT color="green">706</FONT>          // (-r) (Vector3D.plusI) coordinates are :<a name="line.706"></a>
+<FONT color="green">707</FONT>          // cos (theta), sin (theta) sin (phi2), sin (theta) cos (phi2)<a name="line.707"></a>
+<FONT color="green">708</FONT>          // and we can choose to have theta in the interval [0 ; PI]<a name="line.708"></a>
+<FONT color="green">709</FONT>          Vector3D v1 = applyTo(Vector3D.PLUS_I);<a name="line.709"></a>
+<FONT color="green">710</FONT>          Vector3D v2 = applyInverseTo(Vector3D.PLUS_I);<a name="line.710"></a>
+<FONT color="green">711</FONT>          if ((v2.getX() &lt; -0.9999999999) || (v2.getX() &gt; 0.9999999999)) {<a name="line.711"></a>
+<FONT color="green">712</FONT>            throw new CardanEulerSingularityException(false);<a name="line.712"></a>
+<FONT color="green">713</FONT>          }<a name="line.713"></a>
+<FONT color="green">714</FONT>          return new double[] {<a name="line.714"></a>
+<FONT color="green">715</FONT>            Math.atan2(v1.getY(), -v1.getZ()),<a name="line.715"></a>
+<FONT color="green">716</FONT>            Math.acos(v2.getX()),<a name="line.716"></a>
+<FONT color="green">717</FONT>            Math.atan2(v2.getY(), v2.getZ())<a name="line.717"></a>
+<FONT color="green">718</FONT>          };<a name="line.718"></a>
+<FONT color="green">719</FONT>    <a name="line.719"></a>
+<FONT color="green">720</FONT>        } else if (order == RotationOrder.XZX) {<a name="line.720"></a>
+<FONT color="green">721</FONT>    <a name="line.721"></a>
+<FONT color="green">722</FONT>          // r (Vector3D.plusI) coordinates are :<a name="line.722"></a>
+<FONT color="green">723</FONT>          //  cos (psi), cos (phi1) sin (psi), sin (phi1) sin (psi)<a name="line.723"></a>
+<FONT color="green">724</FONT>          // (-r) (Vector3D.plusI) coordinates are :<a name="line.724"></a>
+<FONT color="green">725</FONT>          // cos (psi), -sin (psi) cos (phi2), sin (psi) sin (phi2)<a name="line.725"></a>
+<FONT color="green">726</FONT>          // and we can choose to have psi in the interval [0 ; PI]<a name="line.726"></a>
+<FONT color="green">727</FONT>          Vector3D v1 = applyTo(Vector3D.PLUS_I);<a name="line.727"></a>
+<FONT color="green">728</FONT>          Vector3D v2 = applyInverseTo(Vector3D.PLUS_I);<a name="line.728"></a>
+<FONT color="green">729</FONT>          if ((v2.getX() &lt; -0.9999999999) || (v2.getX() &gt; 0.9999999999)) {<a name="line.729"></a>
+<FONT color="green">730</FONT>            throw new CardanEulerSingularityException(false);<a name="line.730"></a>
+<FONT color="green">731</FONT>          }<a name="line.731"></a>
+<FONT color="green">732</FONT>          return new double[] {<a name="line.732"></a>
+<FONT color="green">733</FONT>            Math.atan2(v1.getZ(), v1.getY()),<a name="line.733"></a>
+<FONT color="green">734</FONT>            Math.acos(v2.getX()),<a name="line.734"></a>
+<FONT color="green">735</FONT>            Math.atan2(v2.getZ(), -v2.getY())<a name="line.735"></a>
+<FONT color="green">736</FONT>          };<a name="line.736"></a>
+<FONT color="green">737</FONT>    <a name="line.737"></a>
+<FONT color="green">738</FONT>        } else if (order == RotationOrder.YXY) {<a name="line.738"></a>
+<FONT color="green">739</FONT>    <a name="line.739"></a>
+<FONT color="green">740</FONT>          // r (Vector3D.plusJ) coordinates are :<a name="line.740"></a>
+<FONT color="green">741</FONT>          //  sin (theta1) sin (phi), cos (phi), cos (theta1) sin (phi)<a name="line.741"></a>
+<FONT color="green">742</FONT>          // (-r) (Vector3D.plusJ) coordinates are :<a name="line.742"></a>
+<FONT color="green">743</FONT>          // sin (phi) sin (theta2), cos (phi), -sin (phi) cos (theta2)<a name="line.743"></a>
+<FONT color="green">744</FONT>          // and we can choose to have phi in the interval [0 ; PI]<a name="line.744"></a>
+<FONT color="green">745</FONT>          Vector3D v1 = applyTo(Vector3D.PLUS_J);<a name="line.745"></a>
+<FONT color="green">746</FONT>          Vector3D v2 = applyInverseTo(Vector3D.PLUS_J);<a name="line.746"></a>
+<FONT color="green">747</FONT>          if ((v2.getY() &lt; -0.9999999999) || (v2.getY() &gt; 0.9999999999)) {<a name="line.747"></a>
+<FONT color="green">748</FONT>            throw new CardanEulerSingularityException(false);<a name="line.748"></a>
+<FONT color="green">749</FONT>          }<a name="line.749"></a>
+<FONT color="green">750</FONT>          return new double[] {<a name="line.750"></a>
+<FONT color="green">751</FONT>            Math.atan2(v1.getX(), v1.getZ()),<a name="line.751"></a>
+<FONT color="green">752</FONT>            Math.acos(v2.getY()),<a name="line.752"></a>
+<FONT color="green">753</FONT>            Math.atan2(v2.getX(), -v2.getZ())<a name="line.753"></a>
+<FONT color="green">754</FONT>          };<a name="line.754"></a>
+<FONT color="green">755</FONT>    <a name="line.755"></a>
+<FONT color="green">756</FONT>        } else if (order == RotationOrder.YZY) {<a name="line.756"></a>
+<FONT color="green">757</FONT>    <a name="line.757"></a>
+<FONT color="green">758</FONT>          // r (Vector3D.plusJ) coordinates are :<a name="line.758"></a>
+<FONT color="green">759</FONT>          //  -cos (theta1) sin (psi), cos (psi), sin (theta1) sin (psi)<a name="line.759"></a>
+<FONT color="green">760</FONT>          // (-r) (Vector3D.plusJ) coordinates are :<a name="line.760"></a>
+<FONT color="green">761</FONT>          // sin (psi) cos (theta2), cos (psi), sin (psi) sin (theta2)<a name="line.761"></a>
+<FONT color="green">762</FONT>          // and we can choose to have psi in the interval [0 ; PI]<a name="line.762"></a>
+<FONT color="green">763</FONT>          Vector3D v1 = applyTo(Vector3D.PLUS_J);<a name="line.763"></a>
+<FONT color="green">764</FONT>          Vector3D v2 = applyInverseTo(Vector3D.PLUS_J);<a name="line.764"></a>
+<FONT color="green">765</FONT>          if ((v2.getY() &lt; -0.9999999999) || (v2.getY() &gt; 0.9999999999)) {<a name="line.765"></a>
+<FONT color="green">766</FONT>            throw new CardanEulerSingularityException(false);<a name="line.766"></a>
+<FONT color="green">767</FONT>          }<a name="line.767"></a>
+<FONT color="green">768</FONT>          return new double[] {<a name="line.768"></a>
+<FONT color="green">769</FONT>            Math.atan2(v1.getZ(), -v1.getX()),<a name="line.769"></a>
+<FONT color="green">770</FONT>            Math.acos(v2.getY()),<a name="line.770"></a>
+<FONT color="green">771</FONT>            Math.atan2(v2.getZ(), v2.getX())<a name="line.771"></a>
+<FONT color="green">772</FONT>          };<a name="line.772"></a>
+<FONT color="green">773</FONT>    <a name="line.773"></a>
+<FONT color="green">774</FONT>        } else if (order == RotationOrder.ZXZ) {<a name="line.774"></a>
+<FONT color="green">775</FONT>    <a name="line.775"></a>
+<FONT color="green">776</FONT>          // r (Vector3D.plusK) coordinates are :<a name="line.776"></a>
+<FONT color="green">777</FONT>          //  sin (psi1) sin (phi), -cos (psi1) sin (phi), cos (phi)<a name="line.777"></a>
+<FONT color="green">778</FONT>          // (-r) (Vector3D.plusK) coordinates are :<a name="line.778"></a>
+<FONT color="green">779</FONT>          // sin (phi) sin (psi2), sin (phi) cos (psi2), cos (phi)<a name="line.779"></a>
+<FONT color="green">780</FONT>          // and we can choose to have phi in the interval [0 ; PI]<a name="line.780"></a>
+<FONT color="green">781</FONT>          Vector3D v1 = applyTo(Vector3D.PLUS_K);<a name="line.781"></a>
+<FONT color="green">782</FONT>          Vector3D v2 = applyInverseTo(Vector3D.PLUS_K);<a name="line.782"></a>
+<FONT color="green">783</FONT>          if ((v2.getZ() &lt; -0.9999999999) || (v2.getZ() &gt; 0.9999999999)) {<a name="line.783"></a>
+<FONT color="green">784</FONT>            throw new CardanEulerSingularityException(false);<a name="line.784"></a>
+<FONT color="green">785</FONT>          }<a name="line.785"></a>
+<FONT color="green">786</FONT>          return new double[] {<a name="line.786"></a>
+<FONT color="green">787</FONT>            Math.atan2(v1.getX(), -v1.getY()),<a name="line.787"></a>
+<FONT color="green">788</FONT>            Math.acos(v2.getZ()),<a name="line.788"></a>
+<FONT color="green">789</FONT>            Math.atan2(v2.getX(), v2.getY())<a name="line.789"></a>
+<FONT color="green">790</FONT>          };<a name="line.790"></a>
+<FONT color="green">791</FONT>    <a name="line.791"></a>
+<FONT color="green">792</FONT>        } else { // last possibility is ZYZ<a name="line.792"></a>
+<FONT color="green">793</FONT>    <a name="line.793"></a>
+<FONT color="green">794</FONT>          // r (Vector3D.plusK) coordinates are :<a name="line.794"></a>
+<FONT color="green">795</FONT>          //  cos (psi1) sin (theta), sin (psi1) sin (theta), cos (theta)<a name="line.795"></a>
+<FONT color="green">796</FONT>          // (-r) (Vector3D.plusK) coordinates are :<a name="line.796"></a>
+<FONT color="green">797</FONT>          // -sin (theta) cos (psi2), sin (theta) sin (psi2), cos (theta)<a name="line.797"></a>
+<FONT color="green">798</FONT>          // and we can choose to have theta in the interval [0 ; PI]<a name="line.798"></a>
+<FONT color="green">799</FONT>          Vector3D v1 = applyTo(Vector3D.PLUS_K);<a name="line.799"></a>
+<FONT color="green">800</FONT>          Vector3D v2 = applyInverseTo(Vector3D.PLUS_K);<a name="line.800"></a>
+<FONT color="green">801</FONT>          if ((v2.getZ() &lt; -0.9999999999) || (v2.getZ() &gt; 0.9999999999)) {<a name="line.801"></a>
+<FONT color="green">802</FONT>            throw new CardanEulerSingularityException(false);<a name="line.802"></a>
+<FONT color="green">803</FONT>          }<a name="line.803"></a>
+<FONT color="green">804</FONT>          return new double[] {<a name="line.804"></a>
+<FONT color="green">805</FONT>            Math.atan2(v1.getY(), v1.getX()),<a name="line.805"></a>
+<FONT color="green">806</FONT>            Math.acos(v2.getZ()),<a name="line.806"></a>
+<FONT color="green">807</FONT>            Math.atan2(v2.getY(), -v2.getX())<a name="line.807"></a>
+<FONT color="green">808</FONT>          };<a name="line.808"></a>
+<FONT color="green">809</FONT>    <a name="line.809"></a>
+<FONT color="green">810</FONT>        }<a name="line.810"></a>
+<FONT color="green">811</FONT>    <a name="line.811"></a>
+<FONT color="green">812</FONT>      }<a name="line.812"></a>
+<FONT color="green">813</FONT>    <a name="line.813"></a>
+<FONT color="green">814</FONT>      /** Get the 3X3 matrix corresponding to the instance<a name="line.814"></a>
+<FONT color="green">815</FONT>       * @return the matrix corresponding to the instance<a name="line.815"></a>
+<FONT color="green">816</FONT>       */<a name="line.816"></a>
+<FONT color="green">817</FONT>      public double[][] getMatrix() {<a name="line.817"></a>
+<FONT color="green">818</FONT>    <a name="line.818"></a>
+<FONT color="green">819</FONT>        // products<a name="line.819"></a>
+<FONT color="green">820</FONT>        double q0q0  = q0 * q0;<a name="line.820"></a>
+<FONT color="green">821</FONT>        double q0q1  = q0 * q1;<a name="line.821"></a>
+<FONT color="green">822</FONT>        double q0q2  = q0 * q2;<a name="line.822"></a>
+<FONT color="green">823</FONT>        double q0q3  = q0 * q3;<a name="line.823"></a>
+<FONT color="green">824</FONT>        double q1q1  = q1 * q1;<a name="line.824"></a>
+<FONT color="green">825</FONT>        double q1q2  = q1 * q2;<a name="line.825"></a>
+<FONT color="green">826</FONT>        double q1q3  = q1 * q3;<a name="line.826"></a>
+<FONT color="green">827</FONT>        double q2q2  = q2 * q2;<a name="line.827"></a>
+<FONT color="green">828</FONT>        double q2q3  = q2 * q3;<a name="line.828"></a>
+<FONT color="green">829</FONT>        double q3q3  = q3 * q3;<a name="line.829"></a>
+<FONT color="green">830</FONT>    <a name="line.830"></a>
+<FONT color="green">831</FONT>        // create the matrix<a name="line.831"></a>
+<FONT color="green">832</FONT>        double[][] m = new double[3][];<a name="line.832"></a>
+<FONT color="green">833</FONT>        m[0] = new double[3];<a name="line.833"></a>
+<FONT color="green">834</FONT>        m[1] = new double[3];<a name="line.834"></a>
+<FONT color="green">835</FONT>        m[2] = new double[3];<a name="line.835"></a>
+<FONT color="green">836</FONT>    <a name="line.836"></a>
+<FONT color="green">837</FONT>        m [0][0] = 2.0 * (q0q0 + q1q1) - 1.0;<a name="line.837"></a>
+<FONT color="green">838</FONT>        m [1][0] = 2.0 * (q1q2 - q0q3);<a name="line.838"></a>
+<FONT color="green">839</FONT>        m [2][0] = 2.0 * (q1q3 + q0q2);<a name="line.839"></a>
+<FONT color="green">840</FONT>    <a name="line.840"></a>
+<FONT color="green">841</FONT>        m [0][1] = 2.0 * (q1q2 + q0q3);<a name="line.841"></a>
+<FONT color="green">842</FONT>        m [1][1] = 2.0 * (q0q0 + q2q2) - 1.0;<a name="line.842"></a>
+<FONT color="green">843</FONT>        m [2][1] = 2.0 * (q2q3 - q0q1);<a name="line.843"></a>
+<FONT color="green">844</FONT>    <a name="line.844"></a>
+<FONT color="green">845</FONT>        m [0][2] = 2.0 * (q1q3 - q0q2);<a name="line.845"></a>
+<FONT color="green">846</FONT>        m [1][2] = 2.0 * (q2q3 + q0q1);<a name="line.846"></a>
+<FONT color="green">847</FONT>        m [2][2] = 2.0 * (q0q0 + q3q3) - 1.0;<a name="line.847"></a>
+<FONT color="green">848</FONT>    <a name="line.848"></a>
+<FONT color="green">849</FONT>        return m;<a name="line.849"></a>
+<FONT color="green">850</FONT>    <a name="line.850"></a>
+<FONT color="green">851</FONT>      }<a name="line.851"></a>
+<FONT color="green">852</FONT>    <a name="line.852"></a>
+<FONT color="green">853</FONT>      /** Apply the rotation to a vector.<a name="line.853"></a>
+<FONT color="green">854</FONT>       * @param u vector to apply the rotation to<a name="line.854"></a>
+<FONT color="green">855</FONT>       * @return a new vector which is the image of u by the rotation<a name="line.855"></a>
+<FONT color="green">856</FONT>       */<a name="line.856"></a>
+<FONT color="green">857</FONT>      public Vector3D applyTo(Vector3D u) {<a name="line.857"></a>
+<FONT color="green">858</FONT>    <a name="line.858"></a>
+<FONT color="green">859</FONT>        double x = u.getX();<a name="line.859"></a>
+<FONT color="green">860</FONT>        double y = u.getY();<a name="line.860"></a>
+<FONT color="green">861</FONT>        double z = u.getZ();<a name="line.861"></a>
+<FONT color="green">862</FONT>    <a name="line.862"></a>
+<FONT color="green">863</FONT>        double s = q1 * x + q2 * y + q3 * z;<a name="line.863"></a>
+<FONT color="green">864</FONT>    <a name="line.864"></a>
+<FONT color="green">865</FONT>        return new Vector3D(2 * (q0 * (x * q0 - (q2 * z - q3 * y)) + s * q1) - x,<a name="line.865"></a>
+<FONT color="green">866</FONT>                            2 * (q0 * (y * q0 - (q3 * x - q1 * z)) + s * q2) - y,<a name="line.866"></a>
+<FONT color="green">867</FONT>                            2 * (q0 * (z * q0 - (q1 * y - q2 * x)) + s * q3) - z);<a name="line.867"></a>
+<FONT color="green">868</FONT>    <a name="line.868"></a>
+<FONT color="green">869</FONT>      }<a name="line.869"></a>
+<FONT color="green">870</FONT>    <a name="line.870"></a>
+<FONT color="green">871</FONT>      /** Apply the inverse of the rotation to a vector.<a name="line.871"></a>
+<FONT color="green">872</FONT>       * @param u vector to apply the inverse of the rotation to<a name="line.872"></a>
+<FONT color="green">873</FONT>       * @return a new vector which such that u is its image by the rotation<a name="line.873"></a>
+<FONT color="green">874</FONT>       */<a name="line.874"></a>
+<FONT color="green">875</FONT>      public Vector3D applyInverseTo(Vector3D u) {<a name="line.875"></a>
+<FONT color="green">876</FONT>    <a name="line.876"></a>
+<FONT color="green">877</FONT>        double x = u.getX();<a name="line.877"></a>
+<FONT color="green">878</FONT>        double y = u.getY();<a name="line.878"></a>
+<FONT color="green">879</FONT>        double z = u.getZ();<a name="line.879"></a>
+<FONT color="green">880</FONT>    <a name="line.880"></a>
+<FONT color="green">881</FONT>        double s = q1 * x + q2 * y + q3 * z;<a name="line.881"></a>
+<FONT color="green">882</FONT>        double m0 = -q0;<a name="line.882"></a>
+<FONT color="green">883</FONT>    <a name="line.883"></a>
+<FONT color="green">884</FONT>        return new Vector3D(2 * (m0 * (x * m0 - (q2 * z - q3 * y)) + s * q1) - x,<a name="line.884"></a>
+<FONT color="green">885</FONT>                            2 * (m0 * (y * m0 - (q3 * x - q1 * z)) + s * q2) - y,<a name="line.885"></a>
+<FONT color="green">886</FONT>                            2 * (m0 * (z * m0 - (q1 * y - q2 * x)) + s * q3) - z);<a name="line.886"></a>
+<FONT color="green">887</FONT>    <a name="line.887"></a>
+<FONT color="green">888</FONT>      }<a name="line.888"></a>
+<FONT color="green">889</FONT>    <a name="line.889"></a>
+<FONT color="green">890</FONT>      /** Apply the instance to another rotation.<a name="line.890"></a>
+<FONT color="green">891</FONT>       * Applying the instance to a rotation is computing the composition<a name="line.891"></a>
+<FONT color="green">892</FONT>       * in an order compliant with the following rule : let u be any<a name="line.892"></a>
+<FONT color="green">893</FONT>       * vector and v its image by r (i.e. r.applyTo(u) = v), let w be the image<a name="line.893"></a>
+<FONT color="green">894</FONT>       * of v by the instance (i.e. applyTo(v) = w), then w = comp.applyTo(u),<a name="line.894"></a>
+<FONT color="green">895</FONT>       * where comp = applyTo(r).<a name="line.895"></a>
+<FONT color="green">896</FONT>       * @param r rotation to apply the rotation to<a name="line.896"></a>
+<FONT color="green">897</FONT>       * @return a new rotation which is the composition of r by the instance<a name="line.897"></a>
+<FONT color="green">898</FONT>       */<a name="line.898"></a>
+<FONT color="green">899</FONT>      public Rotation applyTo(Rotation r) {<a name="line.899"></a>
+<FONT color="green">900</FONT>        return new Rotation(r.q0 * q0 - (r.q1 * q1 + r.q2 * q2 + r.q3 * q3),<a name="line.900"></a>
+<FONT color="green">901</FONT>                            r.q1 * q0 + r.q0 * q1 + (r.q2 * q3 - r.q3 * q2),<a name="line.901"></a>
+<FONT color="green">902</FONT>                            r.q2 * q0 + r.q0 * q2 + (r.q3 * q1 - r.q1 * q3),<a name="line.902"></a>
+<FONT color="green">903</FONT>                            r.q3 * q0 + r.q0 * q3 + (r.q1 * q2 - r.q2 * q1),<a name="line.903"></a>
+<FONT color="green">904</FONT>                            false);<a name="line.904"></a>
+<FONT color="green">905</FONT>      }<a name="line.905"></a>
+<FONT color="green">906</FONT>    <a name="line.906"></a>
+<FONT color="green">907</FONT>      /** Apply the inverse of the instance to another rotation.<a name="line.907"></a>
+<FONT color="green">908</FONT>       * Applying the inverse of the instance to a rotation is computing<a name="line.908"></a>
+<FONT color="green">909</FONT>       * the composition in an order compliant with the following rule :<a name="line.909"></a>
+<FONT color="green">910</FONT>       * let u be any vector and v its image by r (i.e. r.applyTo(u) = v),<a name="line.910"></a>
+<FONT color="green">911</FONT>       * let w be the inverse image of v by the instance<a name="line.911"></a>
+<FONT color="green">912</FONT>       * (i.e. applyInverseTo(v) = w), then w = comp.applyTo(u), where<a name="line.912"></a>
+<FONT color="green">913</FONT>       * comp = applyInverseTo(r).<a name="line.913"></a>
+<FONT color="green">914</FONT>       * @param r rotation to apply the rotation to<a name="line.914"></a>
+<FONT color="green">915</FONT>       * @return a new rotation which is the composition of r by the inverse<a name="line.915"></a>
+<FONT color="green">916</FONT>       * of the instance<a name="line.916"></a>
+<FONT color="green">917</FONT>       */<a name="line.917"></a>
+<FONT color="green">918</FONT>      public Rotation applyInverseTo(Rotation r) {<a name="line.918"></a>
+<FONT color="green">919</FONT>        return new Rotation(-r.q0 * q0 - (r.q1 * q1 + r.q2 * q2 + r.q3 * q3),<a name="line.919"></a>
+<FONT color="green">920</FONT>                            -r.q1 * q0 + r.q0 * q1 + (r.q2 * q3 - r.q3 * q2),<a name="line.920"></a>
+<FONT color="green">921</FONT>                            -r.q2 * q0 + r.q0 * q2 + (r.q3 * q1 - r.q1 * q3),<a name="line.921"></a>
+<FONT color="green">922</FONT>                            -r.q3 * q0 + r.q0 * q3 + (r.q1 * q2 - r.q2 * q1),<a name="line.922"></a>
+<FONT color="green">923</FONT>                            false);<a name="line.923"></a>
+<FONT color="green">924</FONT>      }<a name="line.924"></a>
+<FONT color="green">925</FONT>    <a name="line.925"></a>
+<FONT color="green">926</FONT>      /** Perfect orthogonality on a 3X3 matrix.<a name="line.926"></a>
+<FONT color="green">927</FONT>       * @param m initial matrix (not exactly orthogonal)<a name="line.927"></a>
+<FONT color="green">928</FONT>       * @param threshold convergence threshold for the iterative<a name="line.928"></a>
+<FONT color="green">929</FONT>       * orthogonality correction (convergence is reached when the<a name="line.929"></a>
+<FONT color="green">930</FONT>       * difference between two steps of the Frobenius norm of the<a name="line.930"></a>
+<FONT color="green">931</FONT>       * correction is below this threshold)<a name="line.931"></a>
+<FONT color="green">932</FONT>       * @return an orthogonal matrix close to m<a name="line.932"></a>
+<FONT color="green">933</FONT>       * @exception NotARotationMatrixException if the matrix cannot be<a name="line.933"></a>
+<FONT color="green">934</FONT>       * orthogonalized with the given threshold after 10 iterations<a name="line.934"></a>
+<FONT color="green">935</FONT>       */<a name="line.935"></a>
+<FONT color="green">936</FONT>      private double[][] orthogonalizeMatrix(double[][] m, double threshold)<a name="line.936"></a>
+<FONT color="green">937</FONT>        throws NotARotationMatrixException {<a name="line.937"></a>
+<FONT color="green">938</FONT>        double[] m0 = m[0];<a name="line.938"></a>
+<FONT color="green">939</FONT>        double[] m1 = m[1];<a name="line.939"></a>
+<FONT color="green">940</FONT>        double[] m2 = m[2];<a name="line.940"></a>
+<FONT color="green">941</FONT>        double x00 = m0[0];<a name="line.941"></a>
+<FONT color="green">942</FONT>        double x01 = m0[1];<a name="line.942"></a>
+<FONT color="green">943</FONT>        double x02 = m0[2];<a name="line.943"></a>
+<FONT color="green">944</FONT>        double x10 = m1[0];<a name="line.944"></a>
+<FONT color="green">945</FONT>        double x11 = m1[1];<a name="line.945"></a>
+<FONT color="green">946</FONT>        double x12 = m1[2];<a name="line.946"></a>
+<FONT color="green">947</FONT>        double x20 = m2[0];<a name="line.947"></a>
+<FONT color="green">948</FONT>        double x21 = m2[1];<a name="line.948"></a>
+<FONT color="green">949</FONT>        double x22 = m2[2];<a name="line.949"></a>
+<FONT color="green">950</FONT>        double fn = 0;<a name="line.950"></a>
+<FONT color="green">951</FONT>        double fn1;<a name="line.951"></a>
+<FONT color="green">952</FONT>    <a name="line.952"></a>
+<FONT color="green">953</FONT>        double[][] o = new double[3][3];<a name="line.953"></a>
+<FONT color="green">954</FONT>        double[] o0 = o[0];<a name="line.954"></a>
+<FONT color="green">955</FONT>        double[] o1 = o[1];<a name="line.955"></a>
+<FONT color="green">956</FONT>        double[] o2 = o[2];<a name="line.956"></a>
+<FONT color="green">957</FONT>    <a name="line.957"></a>
+<FONT color="green">958</FONT>        // iterative correction: Xn+1 = Xn - 0.5 * (Xn.Mt.Xn - M)<a name="line.958"></a>
+<FONT color="green">959</FONT>        int i = 0;<a name="line.959"></a>
+<FONT color="green">960</FONT>        while (++i &lt; 11) {<a name="line.960"></a>
+<FONT color="green">961</FONT>    <a name="line.961"></a>
+<FONT color="green">962</FONT>          // Mt.Xn<a name="line.962"></a>
+<FONT color="green">963</FONT>          double mx00 = m0[0] * x00 + m1[0] * x10 + m2[0] * x20;<a name="line.963"></a>
+<FONT color="green">964</FONT>          double mx10 = m0[1] * x00 + m1[1] * x10 + m2[1] * x20;<a name="line.964"></a>
+<FONT color="green">965</FONT>          double mx20 = m0[2] * x00 + m1[2] * x10 + m2[2] * x20;<a name="line.965"></a>
+<FONT color="green">966</FONT>          double mx01 = m0[0] * x01 + m1[0] * x11 + m2[0] * x21;<a name="line.966"></a>
+<FONT color="green">967</FONT>          double mx11 = m0[1] * x01 + m1[1] * x11 + m2[1] * x21;<a name="line.967"></a>
+<FONT color="green">968</FONT>          double mx21 = m0[2] * x01 + m1[2] * x11 + m2[2] * x21;<a name="line.968"></a>
+<FONT color="green">969</FONT>          double mx02 = m0[0] * x02 + m1[0] * x12 + m2[0] * x22;<a name="line.969"></a>
+<FONT color="green">970</FONT>          double mx12 = m0[1] * x02 + m1[1] * x12 + m2[1] * x22;<a name="line.970"></a>
+<FONT color="green">971</FONT>          double mx22 = m0[2] * x02 + m1[2] * x12 + m2[2] * x22;<a name="line.971"></a>
+<FONT color="green">972</FONT>    <a name="line.972"></a>
+<FONT color="green">973</FONT>          // Xn+1<a name="line.973"></a>
+<FONT color="green">974</FONT>          o0[0] = x00 - 0.5 * (x00 * mx00 + x01 * mx10 + x02 * mx20 - m0[0]);<a name="line.974"></a>
+<FONT color="green">975</FONT>          o0[1] = x01 - 0.5 * (x00 * mx01 + x01 * mx11 + x02 * mx21 - m0[1]);<a name="line.975"></a>
+<FONT color="green">976</FONT>          o0[2] = x02 - 0.5 * (x00 * mx02 + x01 * mx12 + x02 * mx22 - m0[2]);<a name="line.976"></a>
+<FONT color="green">977</FONT>          o1[0] = x10 - 0.5 * (x10 * mx00 + x11 * mx10 + x12 * mx20 - m1[0]);<a name="line.977"></a>
+<FONT color="green">978</FONT>          o1[1] = x11 - 0.5 * (x10 * mx01 + x11 * mx11 + x12 * mx21 - m1[1]);<a name="line.978"></a>
+<FONT color="green">979</FONT>          o1[2] = x12 - 0.5 * (x10 * mx02 + x11 * mx12 + x12 * mx22 - m1[2]);<a name="line.979"></a>
+<FONT color="green">980</FONT>          o2[0] = x20 - 0.5 * (x20 * mx00 + x21 * mx10 + x22 * mx20 - m2[0]);<a name="line.980"></a>
+<FONT color="green">981</FONT>          o2[1] = x21 - 0.5 * (x20 * mx01 + x21 * mx11 + x22 * mx21 - m2[1]);<a name="line.981"></a>
+<FONT color="green">982</FONT>          o2[2] = x22 - 0.5 * (x20 * mx02 + x21 * mx12 + x22 * mx22 - m2[2]);<a name="line.982"></a>
+<FONT color="green">983</FONT>    <a name="line.983"></a>
+<FONT color="green">984</FONT>          // correction on each elements<a name="line.984"></a>
+<FONT color="green">985</FONT>          double corr00 = o0[0] - m0[0];<a name="line.985"></a>
+<FONT color="green">986</FONT>          double corr01 = o0[1] - m0[1];<a name="line.986"></a>
+<FONT color="green">987</FONT>          double corr02 = o0[2] - m0[2];<a name="line.987"></a>
+<FONT color="green">988</FONT>          double corr10 = o1[0] - m1[0];<a name="line.988"></a>
+<FONT color="green">989</FONT>          double corr11 = o1[1] - m1[1];<a name="line.989"></a>
+<FONT color="green">990</FONT>          double corr12 = o1[2] - m1[2];<a name="line.990"></a>
+<FONT color="green">991</FONT>          double corr20 = o2[0] - m2[0];<a name="line.991"></a>
+<FONT color="green">992</FONT>          double corr21 = o2[1] - m2[1];<a name="line.992"></a>
+<FONT color="green">993</FONT>          double corr22 = o2[2] - m2[2];<a name="line.993"></a>
+<FONT color="green">994</FONT>    <a name="line.994"></a>
+<FONT color="green">995</FONT>          // Frobenius norm of the correction<a name="line.995"></a>
+<FONT color="green">996</FONT>          fn1 = corr00 * corr00 + corr01 * corr01 + corr02 * corr02 +<a name="line.996"></a>
+<FONT color="green">997</FONT>                corr10 * corr10 + corr11 * corr11 + corr12 * corr12 +<a name="line.997"></a>
+<FONT color="green">998</FONT>                corr20 * corr20 + corr21 * corr21 + corr22 * corr22;<a name="line.998"></a>
+<FONT color="green">999</FONT>    <a name="line.999"></a>
+<FONT color="green">1000</FONT>          // convergence test<a name="line.1000"></a>
+<FONT color="green">1001</FONT>          if (Math.abs(fn1 - fn) &lt;= threshold)<a name="line.1001"></a>
+<FONT color="green">1002</FONT>            return o;<a name="line.1002"></a>
+<FONT color="green">1003</FONT>    <a name="line.1003"></a>
+<FONT color="green">1004</FONT>          // prepare next iteration<a name="line.1004"></a>
+<FONT color="green">1005</FONT>          x00 = o0[0];<a name="line.1005"></a>
+<FONT color="green">1006</FONT>          x01 = o0[1];<a name="line.1006"></a>
+<FONT color="green">1007</FONT>          x02 = o0[2];<a name="line.1007"></a>
+<FONT color="green">1008</FONT>          x10 = o1[0];<a name="line.1008"></a>
+<FONT color="green">1009</FONT>          x11 = o1[1];<a name="line.1009"></a>
+<FONT color="green">1010</FONT>          x12 = o1[2];<a name="line.1010"></a>
+<FONT color="green">1011</FONT>          x20 = o2[0];<a name="line.1011"></a>
+<FONT color="green">1012</FONT>          x21 = o2[1];<a name="line.1012"></a>
+<FONT color="green">1013</FONT>          x22 = o2[2];<a name="line.1013"></a>
+<FONT color="green">1014</FONT>          fn  = fn1;<a name="line.1014"></a>
+<FONT color="green">1015</FONT>    <a name="line.1015"></a>
+<FONT color="green">1016</FONT>        }<a name="line.1016"></a>
+<FONT color="green">1017</FONT>    <a name="line.1017"></a>
+<FONT color="green">1018</FONT>        // the algorithm did not converge after 10 iterations<a name="line.1018"></a>
+<FONT color="green">1019</FONT>        throw new NotARotationMatrixException(<a name="line.1019"></a>
+<FONT color="green">1020</FONT>                "unable to orthogonalize matrix in {0} iterations",<a name="line.1020"></a>
+<FONT color="green">1021</FONT>                i - 1);<a name="line.1021"></a>
+<FONT color="green">1022</FONT>      }<a name="line.1022"></a>
+<FONT color="green">1023</FONT>    <a name="line.1023"></a>
+<FONT color="green">1024</FONT>      /** Compute the &lt;i&gt;distance&lt;/i&gt; between two rotations.<a name="line.1024"></a>
+<FONT color="green">1025</FONT>       * &lt;p&gt;The &lt;i&gt;distance&lt;/i&gt; is intended here as a way to check if two<a name="line.1025"></a>
+<FONT color="green">1026</FONT>       * rotations are almost similar (i.e. they transform vectors the same way)<a name="line.1026"></a>
+<FONT color="green">1027</FONT>       * or very different. It is mathematically defined as the angle of<a name="line.1027"></a>
+<FONT color="green">1028</FONT>       * the rotation r that prepended to one of the rotations gives the other<a name="line.1028"></a>
+<FONT color="green">1029</FONT>       * one:&lt;/p&gt;<a name="line.1029"></a>
+<FONT color="green">1030</FONT>       * &lt;pre&gt;<a name="line.1030"></a>
+<FONT color="green">1031</FONT>       *        r&lt;sub&gt;1&lt;/sub&gt;(r) = r&lt;sub&gt;2&lt;/sub&gt;<a name="line.1031"></a>
+<FONT color="green">1032</FONT>       * &lt;/pre&gt;<a name="line.1032"></a>
+<FONT color="green">1033</FONT>       * &lt;p&gt;This distance is an angle between 0 and &amp;pi;. Its value is the smallest<a name="line.1033"></a>
+<FONT color="green">1034</FONT>       * possible upper bound of the angle in radians between r&lt;sub&gt;1&lt;/sub&gt;(v)<a name="line.1034"></a>
+<FONT color="green">1035</FONT>       * and r&lt;sub&gt;2&lt;/sub&gt;(v) for all possible vectors v. This upper bound is<a name="line.1035"></a>
+<FONT color="green">1036</FONT>       * reached for some v. The distance is equal to 0 if and only if the two<a name="line.1036"></a>
+<FONT color="green">1037</FONT>       * rotations are identical.&lt;/p&gt;<a name="line.1037"></a>
+<FONT color="green">1038</FONT>       * &lt;p&gt;Comparing two rotations should always be done using this value rather<a name="line.1038"></a>
+<FONT color="green">1039</FONT>       * than for example comparing the components of the quaternions. It is much<a name="line.1039"></a>
+<FONT color="green">1040</FONT>       * more stable, and has a geometric meaning. Also comparing quaternions<a name="line.1040"></a>
+<FONT color="green">1041</FONT>       * components is error prone since for example quaternions (0.36, 0.48, -0.48, -0.64)<a name="line.1041"></a>
+<FONT color="green">1042</FONT>       * and (-0.36, -0.48, 0.48, 0.64) represent exactly the same rotation despite<a name="line.1042"></a>
+<FONT color="green">1043</FONT>       * their components are different (they are exact opposites).&lt;/p&gt;<a name="line.1043"></a>
+<FONT color="green">1044</FONT>       * @param r1 first rotation<a name="line.1044"></a>
+<FONT color="green">1045</FONT>       * @param r2 second rotation<a name="line.1045"></a>
+<FONT color="green">1046</FONT>       * @return &lt;i&gt;distance&lt;/i&gt; between r1 and r2<a name="line.1046"></a>
+<FONT color="green">1047</FONT>       */<a name="line.1047"></a>
+<FONT color="green">1048</FONT>      public static double distance(Rotation r1, Rotation r2) {<a name="line.1048"></a>
+<FONT color="green">1049</FONT>          return r1.applyInverseTo(r2).getAngle();<a name="line.1049"></a>
+<FONT color="green">1050</FONT>      }<a name="line.1050"></a>
+<FONT color="green">1051</FONT>    <a name="line.1051"></a>
+<FONT color="green">1052</FONT>    }<a name="line.1052"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/geometry/RotationOrder.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,241 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.geometry;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * This class is a utility representing a rotation order specification<a name="line.21"></a>
+<FONT color="green">022</FONT>     * for Cardan or Euler angles specification.<a name="line.22"></a>
+<FONT color="green">023</FONT>     *<a name="line.23"></a>
+<FONT color="green">024</FONT>     * This class cannot be instanciated by the user. He can only use one<a name="line.24"></a>
+<FONT color="green">025</FONT>     * of the twelve predefined supported orders as an argument to either<a name="line.25"></a>
+<FONT color="green">026</FONT>     * the {@link Rotation#Rotation(RotationOrder,double,double,double)}<a name="line.26"></a>
+<FONT color="green">027</FONT>     * constructor or the {@link Rotation#getAngles} method.<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @since 1.2<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    public final class RotationOrder {<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /** Set of Cardan angles.<a name="line.34"></a>
+<FONT color="green">035</FONT>         * this ordered set of rotations is around X, then around Y, then<a name="line.35"></a>
+<FONT color="green">036</FONT>         * around Z<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        public static final RotationOrder XYZ =<a name="line.38"></a>
+<FONT color="green">039</FONT>          new RotationOrder("XYZ", Vector3D.PLUS_I, Vector3D.PLUS_J, Vector3D.PLUS_K);<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Set of Cardan angles.<a name="line.41"></a>
+<FONT color="green">042</FONT>         * this ordered set of rotations is around X, then around Z, then<a name="line.42"></a>
+<FONT color="green">043</FONT>         * around Y<a name="line.43"></a>
+<FONT color="green">044</FONT>         */<a name="line.44"></a>
+<FONT color="green">045</FONT>        public static final RotationOrder XZY =<a name="line.45"></a>
+<FONT color="green">046</FONT>          new RotationOrder("XZY", Vector3D.PLUS_I, Vector3D.PLUS_K, Vector3D.PLUS_J);<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** Set of Cardan angles.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * this ordered set of rotations is around Y, then around X, then<a name="line.49"></a>
+<FONT color="green">050</FONT>         * around Z<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        public static final RotationOrder YXZ =<a name="line.52"></a>
+<FONT color="green">053</FONT>          new RotationOrder("YXZ", Vector3D.PLUS_J, Vector3D.PLUS_I, Vector3D.PLUS_K);<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** Set of Cardan angles.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * this ordered set of rotations is around Y, then around Z, then<a name="line.56"></a>
+<FONT color="green">057</FONT>         * around X<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public static final RotationOrder YZX =<a name="line.59"></a>
+<FONT color="green">060</FONT>          new RotationOrder("YZX", Vector3D.PLUS_J, Vector3D.PLUS_K, Vector3D.PLUS_I);<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** Set of Cardan angles.<a name="line.62"></a>
+<FONT color="green">063</FONT>         * this ordered set of rotations is around Z, then around X, then<a name="line.63"></a>
+<FONT color="green">064</FONT>         * around Y<a name="line.64"></a>
+<FONT color="green">065</FONT>         */<a name="line.65"></a>
+<FONT color="green">066</FONT>        public static final RotationOrder ZXY =<a name="line.66"></a>
+<FONT color="green">067</FONT>          new RotationOrder("ZXY", Vector3D.PLUS_K, Vector3D.PLUS_I, Vector3D.PLUS_J);<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /** Set of Cardan angles.<a name="line.69"></a>
+<FONT color="green">070</FONT>         * this ordered set of rotations is around Z, then around Y, then<a name="line.70"></a>
+<FONT color="green">071</FONT>         * around X<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        public static final RotationOrder ZYX =<a name="line.73"></a>
+<FONT color="green">074</FONT>          new RotationOrder("ZYX", Vector3D.PLUS_K, Vector3D.PLUS_J, Vector3D.PLUS_I);<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        /** Set of Euler angles.<a name="line.76"></a>
+<FONT color="green">077</FONT>         * this ordered set of rotations is around X, then around Y, then<a name="line.77"></a>
+<FONT color="green">078</FONT>         * around X<a name="line.78"></a>
+<FONT color="green">079</FONT>         */<a name="line.79"></a>
+<FONT color="green">080</FONT>        public static final RotationOrder XYX =<a name="line.80"></a>
+<FONT color="green">081</FONT>          new RotationOrder("XYX", Vector3D.PLUS_I, Vector3D.PLUS_J, Vector3D.PLUS_I);<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /** Set of Euler angles.<a name="line.83"></a>
+<FONT color="green">084</FONT>         * this ordered set of rotations is around X, then around Z, then<a name="line.84"></a>
+<FONT color="green">085</FONT>         * around X<a name="line.85"></a>
+<FONT color="green">086</FONT>         */<a name="line.86"></a>
+<FONT color="green">087</FONT>        public static final RotationOrder XZX =<a name="line.87"></a>
+<FONT color="green">088</FONT>          new RotationOrder("XZX", Vector3D.PLUS_I, Vector3D.PLUS_K, Vector3D.PLUS_I);<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>        /** Set of Euler angles.<a name="line.90"></a>
+<FONT color="green">091</FONT>         * this ordered set of rotations is around Y, then around X, then<a name="line.91"></a>
+<FONT color="green">092</FONT>         * around Y<a name="line.92"></a>
+<FONT color="green">093</FONT>         */<a name="line.93"></a>
+<FONT color="green">094</FONT>        public static final RotationOrder YXY =<a name="line.94"></a>
+<FONT color="green">095</FONT>          new RotationOrder("YXY", Vector3D.PLUS_J, Vector3D.PLUS_I, Vector3D.PLUS_J);<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /** Set of Euler angles.<a name="line.97"></a>
+<FONT color="green">098</FONT>         * this ordered set of rotations is around Y, then around Z, then<a name="line.98"></a>
+<FONT color="green">099</FONT>         * around Y<a name="line.99"></a>
+<FONT color="green">100</FONT>         */<a name="line.100"></a>
+<FONT color="green">101</FONT>        public static final RotationOrder YZY =<a name="line.101"></a>
+<FONT color="green">102</FONT>          new RotationOrder("YZY", Vector3D.PLUS_J, Vector3D.PLUS_K, Vector3D.PLUS_J);<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /** Set of Euler angles.<a name="line.104"></a>
+<FONT color="green">105</FONT>         * this ordered set of rotations is around Z, then around X, then<a name="line.105"></a>
+<FONT color="green">106</FONT>         * around Z<a name="line.106"></a>
+<FONT color="green">107</FONT>         */<a name="line.107"></a>
+<FONT color="green">108</FONT>        public static final RotationOrder ZXZ =<a name="line.108"></a>
+<FONT color="green">109</FONT>          new RotationOrder("ZXZ", Vector3D.PLUS_K, Vector3D.PLUS_I, Vector3D.PLUS_K);<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /** Set of Euler angles.<a name="line.111"></a>
+<FONT color="green">112</FONT>         * this ordered set of rotations is around Z, then around Y, then<a name="line.112"></a>
+<FONT color="green">113</FONT>         * around Z<a name="line.113"></a>
+<FONT color="green">114</FONT>         */<a name="line.114"></a>
+<FONT color="green">115</FONT>        public static final RotationOrder ZYZ =<a name="line.115"></a>
+<FONT color="green">116</FONT>          new RotationOrder("ZYZ", Vector3D.PLUS_K, Vector3D.PLUS_J, Vector3D.PLUS_K);<a name="line.116"></a>
+<FONT color="green">117</FONT>    <a name="line.117"></a>
+<FONT color="green">118</FONT>        /** Name of the rotations order. */<a name="line.118"></a>
+<FONT color="green">119</FONT>        private final String name;<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /** Axis of the first rotation. */<a name="line.121"></a>
+<FONT color="green">122</FONT>        private final Vector3D a1;<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>        /** Axis of the second rotation. */<a name="line.124"></a>
+<FONT color="green">125</FONT>        private final Vector3D a2;<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>        /** Axis of the third rotation. */<a name="line.127"></a>
+<FONT color="green">128</FONT>        private final Vector3D a3;<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /** Private constructor.<a name="line.130"></a>
+<FONT color="green">131</FONT>         * This is a utility class that cannot be instantiated by the user,<a name="line.131"></a>
+<FONT color="green">132</FONT>         * so its only constructor is private.<a name="line.132"></a>
+<FONT color="green">133</FONT>         * @param name name of the rotation order<a name="line.133"></a>
+<FONT color="green">134</FONT>         * @param a1 axis of the first rotation<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @param a2 axis of the second rotation<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @param a3 axis of the third rotation<a name="line.136"></a>
+<FONT color="green">137</FONT>         */<a name="line.137"></a>
+<FONT color="green">138</FONT>        private RotationOrder(final String name,<a name="line.138"></a>
+<FONT color="green">139</FONT>                              final Vector3D a1, final Vector3D a2, final Vector3D a3) {<a name="line.139"></a>
+<FONT color="green">140</FONT>            this.name = name;<a name="line.140"></a>
+<FONT color="green">141</FONT>            this.a1   = a1;<a name="line.141"></a>
+<FONT color="green">142</FONT>            this.a2   = a2;<a name="line.142"></a>
+<FONT color="green">143</FONT>            this.a3   = a3;<a name="line.143"></a>
+<FONT color="green">144</FONT>        }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>        /** Get a string representation of the instance.<a name="line.146"></a>
+<FONT color="green">147</FONT>         * @return a string representation of the instance (in fact, its name)<a name="line.147"></a>
+<FONT color="green">148</FONT>         */<a name="line.148"></a>
+<FONT color="green">149</FONT>        @Override<a name="line.149"></a>
+<FONT color="green">150</FONT>        public String toString() {<a name="line.150"></a>
+<FONT color="green">151</FONT>            return name;<a name="line.151"></a>
+<FONT color="green">152</FONT>        }<a name="line.152"></a>
+<FONT color="green">153</FONT>    <a name="line.153"></a>
+<FONT color="green">154</FONT>        /** Get the axis of the first rotation.<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @return axis of the first rotation<a name="line.155"></a>
+<FONT color="green">156</FONT>         */<a name="line.156"></a>
+<FONT color="green">157</FONT>        public Vector3D getA1() {<a name="line.157"></a>
+<FONT color="green">158</FONT>            return a1;<a name="line.158"></a>
+<FONT color="green">159</FONT>        }<a name="line.159"></a>
+<FONT color="green">160</FONT>    <a name="line.160"></a>
+<FONT color="green">161</FONT>        /** Get the axis of the second rotation.<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @return axis of the second rotation<a name="line.162"></a>
+<FONT color="green">163</FONT>         */<a name="line.163"></a>
+<FONT color="green">164</FONT>        public Vector3D getA2() {<a name="line.164"></a>
+<FONT color="green">165</FONT>            return a2;<a name="line.165"></a>
+<FONT color="green">166</FONT>        }<a name="line.166"></a>
+<FONT color="green">167</FONT>    <a name="line.167"></a>
+<FONT color="green">168</FONT>        /** Get the axis of the second rotation.<a name="line.168"></a>
+<FONT color="green">169</FONT>         * @return axis of the second rotation<a name="line.169"></a>
+<FONT color="green">170</FONT>         */<a name="line.170"></a>
+<FONT color="green">171</FONT>        public Vector3D getA3() {<a name="line.171"></a>
+<FONT color="green">172</FONT>            return a3;<a name="line.172"></a>
+<FONT color="green">173</FONT>        }<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>    }<a name="line.175"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/geometry/Vector3D.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,598 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.geometry;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * This class implements vectors in a three-dimensional space.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;Instance of this class are guaranteed to be immutable.&lt;/p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @version $Revision: 922713 $ $Date: 2010-03-13 20:26:13 -0500 (Sat, 13 Mar 2010) $<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @since 1.2<a name="line.29"></a>
+<FONT color="green">030</FONT>     */<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>    public class Vector3D<a name="line.32"></a>
+<FONT color="green">033</FONT>      implements Serializable {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>      /** Null vector (coordinates: 0, 0, 0). */<a name="line.35"></a>
+<FONT color="green">036</FONT>      public static final Vector3D ZERO   = new Vector3D(0, 0, 0);<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>      /** First canonical vector (coordinates: 1, 0, 0). */<a name="line.38"></a>
+<FONT color="green">039</FONT>      public static final Vector3D PLUS_I = new Vector3D(1, 0, 0);<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>      /** Opposite of the first canonical vector (coordinates: -1, 0, 0). */<a name="line.41"></a>
+<FONT color="green">042</FONT>      public static final Vector3D MINUS_I = new Vector3D(-1, 0, 0);<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>      /** Second canonical vector (coordinates: 0, 1, 0). */<a name="line.44"></a>
+<FONT color="green">045</FONT>      public static final Vector3D PLUS_J = new Vector3D(0, 1, 0);<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>      /** Opposite of the second canonical vector (coordinates: 0, -1, 0). */<a name="line.47"></a>
+<FONT color="green">048</FONT>      public static final Vector3D MINUS_J = new Vector3D(0, -1, 0);<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>      /** Third canonical vector (coordinates: 0, 0, 1). */<a name="line.50"></a>
+<FONT color="green">051</FONT>      public static final Vector3D PLUS_K = new Vector3D(0, 0, 1);<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>      /** Opposite of the third canonical vector (coordinates: 0, 0, -1).  */<a name="line.53"></a>
+<FONT color="green">054</FONT>      public static final Vector3D MINUS_K = new Vector3D(0, 0, -1);<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>      // CHECKSTYLE: stop ConstantName<a name="line.56"></a>
+<FONT color="green">057</FONT>      /** A vector with all coordinates set to NaN. */<a name="line.57"></a>
+<FONT color="green">058</FONT>      public static final Vector3D NaN = new Vector3D(Double.NaN, Double.NaN, Double.NaN);<a name="line.58"></a>
+<FONT color="green">059</FONT>      // CHECKSTYLE: resume ConstantName<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>      /** A vector with all coordinates set to positive infinity. */<a name="line.61"></a>
+<FONT color="green">062</FONT>      public static final Vector3D POSITIVE_INFINITY =<a name="line.62"></a>
+<FONT color="green">063</FONT>          new Vector3D(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>      /** A vector with all coordinates set to negative infinity. */<a name="line.65"></a>
+<FONT color="green">066</FONT>      public static final Vector3D NEGATIVE_INFINITY =<a name="line.66"></a>
+<FONT color="green">067</FONT>          new Vector3D(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>      /** Default format. */<a name="line.69"></a>
+<FONT color="green">070</FONT>      private static final Vector3DFormat DEFAULT_FORMAT =<a name="line.70"></a>
+<FONT color="green">071</FONT>          Vector3DFormat.getInstance();<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>      /** Serializable version identifier. */<a name="line.73"></a>
+<FONT color="green">074</FONT>      private static final long serialVersionUID = 5133268763396045979L;<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>      /** Abscissa. */<a name="line.76"></a>
+<FONT color="green">077</FONT>      private final double x;<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>      /** Ordinate. */<a name="line.79"></a>
+<FONT color="green">080</FONT>      private final double y;<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>      /** Height. */<a name="line.82"></a>
+<FONT color="green">083</FONT>      private final double z;<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>      /** Simple constructor.<a name="line.85"></a>
+<FONT color="green">086</FONT>       * Build a vector from its coordinates<a name="line.86"></a>
+<FONT color="green">087</FONT>       * @param x abscissa<a name="line.87"></a>
+<FONT color="green">088</FONT>       * @param y ordinate<a name="line.88"></a>
+<FONT color="green">089</FONT>       * @param z height<a name="line.89"></a>
+<FONT color="green">090</FONT>       * @see #getX()<a name="line.90"></a>
+<FONT color="green">091</FONT>       * @see #getY()<a name="line.91"></a>
+<FONT color="green">092</FONT>       * @see #getZ()<a name="line.92"></a>
+<FONT color="green">093</FONT>       */<a name="line.93"></a>
+<FONT color="green">094</FONT>      public Vector3D(double x, double y, double z) {<a name="line.94"></a>
+<FONT color="green">095</FONT>        this.x = x;<a name="line.95"></a>
+<FONT color="green">096</FONT>        this.y = y;<a name="line.96"></a>
+<FONT color="green">097</FONT>        this.z = z;<a name="line.97"></a>
+<FONT color="green">098</FONT>      }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>      /** Simple constructor.<a name="line.100"></a>
+<FONT color="green">101</FONT>       * Build a vector from its azimuthal coordinates<a name="line.101"></a>
+<FONT color="green">102</FONT>       * @param alpha azimuth (&amp;alpha;) around Z<a name="line.102"></a>
+<FONT color="green">103</FONT>       *              (0 is +X, &amp;pi;/2 is +Y, &amp;pi; is -X and 3&amp;pi;/2 is -Y)<a name="line.103"></a>
+<FONT color="green">104</FONT>       * @param delta elevation (&amp;delta;) above (XY) plane, from -&amp;pi;/2 to +&amp;pi;/2<a name="line.104"></a>
+<FONT color="green">105</FONT>       * @see #getAlpha()<a name="line.105"></a>
+<FONT color="green">106</FONT>       * @see #getDelta()<a name="line.106"></a>
+<FONT color="green">107</FONT>       */<a name="line.107"></a>
+<FONT color="green">108</FONT>      public Vector3D(double alpha, double delta) {<a name="line.108"></a>
+<FONT color="green">109</FONT>        double cosDelta = Math.cos(delta);<a name="line.109"></a>
+<FONT color="green">110</FONT>        this.x = Math.cos(alpha) * cosDelta;<a name="line.110"></a>
+<FONT color="green">111</FONT>        this.y = Math.sin(alpha) * cosDelta;<a name="line.111"></a>
+<FONT color="green">112</FONT>        this.z = Math.sin(delta);<a name="line.112"></a>
+<FONT color="green">113</FONT>      }<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>      /** Multiplicative constructor<a name="line.115"></a>
+<FONT color="green">116</FONT>       * Build a vector from another one and a scale factor.<a name="line.116"></a>
+<FONT color="green">117</FONT>       * The vector built will be a * u<a name="line.117"></a>
+<FONT color="green">118</FONT>       * @param a scale factor<a name="line.118"></a>
+<FONT color="green">119</FONT>       * @param u base (unscaled) vector<a name="line.119"></a>
+<FONT color="green">120</FONT>       */<a name="line.120"></a>
+<FONT color="green">121</FONT>      public Vector3D(double a, Vector3D u) {<a name="line.121"></a>
+<FONT color="green">122</FONT>        this.x = a * u.x;<a name="line.122"></a>
+<FONT color="green">123</FONT>        this.y = a * u.y;<a name="line.123"></a>
+<FONT color="green">124</FONT>        this.z = a * u.z;<a name="line.124"></a>
+<FONT color="green">125</FONT>      }<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>      /** Linear constructor<a name="line.127"></a>
+<FONT color="green">128</FONT>       * Build a vector from two other ones and corresponding scale factors.<a name="line.128"></a>
+<FONT color="green">129</FONT>       * The vector built will be a1 * u1 + a2 * u2<a name="line.129"></a>
+<FONT color="green">130</FONT>       * @param a1 first scale factor<a name="line.130"></a>
+<FONT color="green">131</FONT>       * @param u1 first base (unscaled) vector<a name="line.131"></a>
+<FONT color="green">132</FONT>       * @param a2 second scale factor<a name="line.132"></a>
+<FONT color="green">133</FONT>       * @param u2 second base (unscaled) vector<a name="line.133"></a>
+<FONT color="green">134</FONT>       */<a name="line.134"></a>
+<FONT color="green">135</FONT>      public Vector3D(double a1, Vector3D u1, double a2, Vector3D u2) {<a name="line.135"></a>
+<FONT color="green">136</FONT>        this.x = a1 * u1.x + a2 * u2.x;<a name="line.136"></a>
+<FONT color="green">137</FONT>        this.y = a1 * u1.y + a2 * u2.y;<a name="line.137"></a>
+<FONT color="green">138</FONT>        this.z = a1 * u1.z + a2 * u2.z;<a name="line.138"></a>
+<FONT color="green">139</FONT>      }<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>      /** Linear constructor<a name="line.141"></a>
+<FONT color="green">142</FONT>       * Build a vector from three other ones and corresponding scale factors.<a name="line.142"></a>
+<FONT color="green">143</FONT>       * The vector built will be a1 * u1 + a2 * u2 + a3 * u3<a name="line.143"></a>
+<FONT color="green">144</FONT>       * @param a1 first scale factor<a name="line.144"></a>
+<FONT color="green">145</FONT>       * @param u1 first base (unscaled) vector<a name="line.145"></a>
+<FONT color="green">146</FONT>       * @param a2 second scale factor<a name="line.146"></a>
+<FONT color="green">147</FONT>       * @param u2 second base (unscaled) vector<a name="line.147"></a>
+<FONT color="green">148</FONT>       * @param a3 third scale factor<a name="line.148"></a>
+<FONT color="green">149</FONT>       * @param u3 third base (unscaled) vector<a name="line.149"></a>
+<FONT color="green">150</FONT>       */<a name="line.150"></a>
+<FONT color="green">151</FONT>      public Vector3D(double a1, Vector3D u1, double a2, Vector3D u2,<a name="line.151"></a>
+<FONT color="green">152</FONT>                      double a3, Vector3D u3) {<a name="line.152"></a>
+<FONT color="green">153</FONT>        this.x = a1 * u1.x + a2 * u2.x + a3 * u3.x;<a name="line.153"></a>
+<FONT color="green">154</FONT>        this.y = a1 * u1.y + a2 * u2.y + a3 * u3.y;<a name="line.154"></a>
+<FONT color="green">155</FONT>        this.z = a1 * u1.z + a2 * u2.z + a3 * u3.z;<a name="line.155"></a>
+<FONT color="green">156</FONT>      }<a name="line.156"></a>
+<FONT color="green">157</FONT>    <a name="line.157"></a>
+<FONT color="green">158</FONT>      /** Linear constructor<a name="line.158"></a>
+<FONT color="green">159</FONT>       * Build a vector from four other ones and corresponding scale factors.<a name="line.159"></a>
+<FONT color="green">160</FONT>       * The vector built will be a1 * u1 + a2 * u2 + a3 * u3 + a4 * u4<a name="line.160"></a>
+<FONT color="green">161</FONT>       * @param a1 first scale factor<a name="line.161"></a>
+<FONT color="green">162</FONT>       * @param u1 first base (unscaled) vector<a name="line.162"></a>
+<FONT color="green">163</FONT>       * @param a2 second scale factor<a name="line.163"></a>
+<FONT color="green">164</FONT>       * @param u2 second base (unscaled) vector<a name="line.164"></a>
+<FONT color="green">165</FONT>       * @param a3 third scale factor<a name="line.165"></a>
+<FONT color="green">166</FONT>       * @param u3 third base (unscaled) vector<a name="line.166"></a>
+<FONT color="green">167</FONT>       * @param a4 fourth scale factor<a name="line.167"></a>
+<FONT color="green">168</FONT>       * @param u4 fourth base (unscaled) vector<a name="line.168"></a>
+<FONT color="green">169</FONT>       */<a name="line.169"></a>
+<FONT color="green">170</FONT>      public Vector3D(double a1, Vector3D u1, double a2, Vector3D u2,<a name="line.170"></a>
+<FONT color="green">171</FONT>                      double a3, Vector3D u3, double a4, Vector3D u4) {<a name="line.171"></a>
+<FONT color="green">172</FONT>        this.x = a1 * u1.x + a2 * u2.x + a3 * u3.x + a4 * u4.x;<a name="line.172"></a>
+<FONT color="green">173</FONT>        this.y = a1 * u1.y + a2 * u2.y + a3 * u3.y + a4 * u4.y;<a name="line.173"></a>
+<FONT color="green">174</FONT>        this.z = a1 * u1.z + a2 * u2.z + a3 * u3.z + a4 * u4.z;<a name="line.174"></a>
+<FONT color="green">175</FONT>      }<a name="line.175"></a>
+<FONT color="green">176</FONT>    <a name="line.176"></a>
+<FONT color="green">177</FONT>      /** Get the abscissa of the vector.<a name="line.177"></a>
+<FONT color="green">178</FONT>       * @return abscissa of the vector<a name="line.178"></a>
+<FONT color="green">179</FONT>       * @see #Vector3D(double, double, double)<a name="line.179"></a>
+<FONT color="green">180</FONT>       */<a name="line.180"></a>
+<FONT color="green">181</FONT>      public double getX() {<a name="line.181"></a>
+<FONT color="green">182</FONT>        return x;<a name="line.182"></a>
+<FONT color="green">183</FONT>      }<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>      /** Get the ordinate of the vector.<a name="line.185"></a>
+<FONT color="green">186</FONT>       * @return ordinate of the vector<a name="line.186"></a>
+<FONT color="green">187</FONT>       * @see #Vector3D(double, double, double)<a name="line.187"></a>
+<FONT color="green">188</FONT>       */<a name="line.188"></a>
+<FONT color="green">189</FONT>      public double getY() {<a name="line.189"></a>
+<FONT color="green">190</FONT>        return y;<a name="line.190"></a>
+<FONT color="green">191</FONT>      }<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>      /** Get the height of the vector.<a name="line.193"></a>
+<FONT color="green">194</FONT>       * @return height of the vector<a name="line.194"></a>
+<FONT color="green">195</FONT>       * @see #Vector3D(double, double, double)<a name="line.195"></a>
+<FONT color="green">196</FONT>       */<a name="line.196"></a>
+<FONT color="green">197</FONT>      public double getZ() {<a name="line.197"></a>
+<FONT color="green">198</FONT>        return z;<a name="line.198"></a>
+<FONT color="green">199</FONT>      }<a name="line.199"></a>
+<FONT color="green">200</FONT>    <a name="line.200"></a>
+<FONT color="green">201</FONT>      /** Get the L&lt;sub&gt;1&lt;/sub&gt; norm for the vector.<a name="line.201"></a>
+<FONT color="green">202</FONT>       * @return L&lt;sub&gt;1&lt;/sub&gt; norm for the vector<a name="line.202"></a>
+<FONT color="green">203</FONT>       */<a name="line.203"></a>
+<FONT color="green">204</FONT>      public double getNorm1() {<a name="line.204"></a>
+<FONT color="green">205</FONT>        return Math.abs(x) + Math.abs(y) + Math.abs(z);<a name="line.205"></a>
+<FONT color="green">206</FONT>      }<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>      /** Get the L&lt;sub&gt;2&lt;/sub&gt; norm for the vector.<a name="line.208"></a>
+<FONT color="green">209</FONT>       * @return euclidian norm for the vector<a name="line.209"></a>
+<FONT color="green">210</FONT>       */<a name="line.210"></a>
+<FONT color="green">211</FONT>      public double getNorm() {<a name="line.211"></a>
+<FONT color="green">212</FONT>        return Math.sqrt (x * x + y * y + z * z);<a name="line.212"></a>
+<FONT color="green">213</FONT>      }<a name="line.213"></a>
+<FONT color="green">214</FONT>    <a name="line.214"></a>
+<FONT color="green">215</FONT>      /** Get the square of the norm for the vector.<a name="line.215"></a>
+<FONT color="green">216</FONT>       * @return square of the euclidian norm for the vector<a name="line.216"></a>
+<FONT color="green">217</FONT>       */<a name="line.217"></a>
+<FONT color="green">218</FONT>      public double getNormSq() {<a name="line.218"></a>
+<FONT color="green">219</FONT>        return x * x + y * y + z * z;<a name="line.219"></a>
+<FONT color="green">220</FONT>      }<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>      /** Get the L&lt;sub&gt;&amp;infin;&lt;/sub&gt; norm for the vector.<a name="line.222"></a>
+<FONT color="green">223</FONT>       * @return L&lt;sub&gt;&amp;infin;&lt;/sub&gt; norm for the vector<a name="line.223"></a>
+<FONT color="green">224</FONT>       */<a name="line.224"></a>
+<FONT color="green">225</FONT>      public double getNormInf() {<a name="line.225"></a>
+<FONT color="green">226</FONT>        return Math.max(Math.max(Math.abs(x), Math.abs(y)), Math.abs(z));<a name="line.226"></a>
+<FONT color="green">227</FONT>      }<a name="line.227"></a>
+<FONT color="green">228</FONT>    <a name="line.228"></a>
+<FONT color="green">229</FONT>      /** Get the azimuth of the vector.<a name="line.229"></a>
+<FONT color="green">230</FONT>       * @return azimuth (&amp;alpha;) of the vector, between -&amp;pi; and +&amp;pi;<a name="line.230"></a>
+<FONT color="green">231</FONT>       * @see #Vector3D(double, double)<a name="line.231"></a>
+<FONT color="green">232</FONT>       */<a name="line.232"></a>
+<FONT color="green">233</FONT>      public double getAlpha() {<a name="line.233"></a>
+<FONT color="green">234</FONT>        return Math.atan2(y, x);<a name="line.234"></a>
+<FONT color="green">235</FONT>      }<a name="line.235"></a>
+<FONT color="green">236</FONT>    <a name="line.236"></a>
+<FONT color="green">237</FONT>      /** Get the elevation of the vector.<a name="line.237"></a>
+<FONT color="green">238</FONT>       * @return elevation (&amp;delta;) of the vector, between -&amp;pi;/2 and +&amp;pi;/2<a name="line.238"></a>
+<FONT color="green">239</FONT>       * @see #Vector3D(double, double)<a name="line.239"></a>
+<FONT color="green">240</FONT>       */<a name="line.240"></a>
+<FONT color="green">241</FONT>      public double getDelta() {<a name="line.241"></a>
+<FONT color="green">242</FONT>        return Math.asin(z / getNorm());<a name="line.242"></a>
+<FONT color="green">243</FONT>      }<a name="line.243"></a>
+<FONT color="green">244</FONT>    <a name="line.244"></a>
+<FONT color="green">245</FONT>      /** Add a vector to the instance.<a name="line.245"></a>
+<FONT color="green">246</FONT>       * @param v vector to add<a name="line.246"></a>
+<FONT color="green">247</FONT>       * @return a new vector<a name="line.247"></a>
+<FONT color="green">248</FONT>       */<a name="line.248"></a>
+<FONT color="green">249</FONT>      public Vector3D add(Vector3D v) {<a name="line.249"></a>
+<FONT color="green">250</FONT>        return new Vector3D(x + v.x, y + v.y, z + v.z);<a name="line.250"></a>
+<FONT color="green">251</FONT>      }<a name="line.251"></a>
+<FONT color="green">252</FONT>    <a name="line.252"></a>
+<FONT color="green">253</FONT>      /** Add a scaled vector to the instance.<a name="line.253"></a>
+<FONT color="green">254</FONT>       * @param factor scale factor to apply to v before adding it<a name="line.254"></a>
+<FONT color="green">255</FONT>       * @param v vector to add<a name="line.255"></a>
+<FONT color="green">256</FONT>       * @return a new vector<a name="line.256"></a>
+<FONT color="green">257</FONT>       */<a name="line.257"></a>
+<FONT color="green">258</FONT>      public Vector3D add(double factor, Vector3D v) {<a name="line.258"></a>
+<FONT color="green">259</FONT>        return new Vector3D(x + factor * v.x, y + factor * v.y, z + factor * v.z);<a name="line.259"></a>
+<FONT color="green">260</FONT>      }<a name="line.260"></a>
+<FONT color="green">261</FONT>    <a name="line.261"></a>
+<FONT color="green">262</FONT>      /** Subtract a vector from the instance.<a name="line.262"></a>
+<FONT color="green">263</FONT>       * @param v vector to subtract<a name="line.263"></a>
+<FONT color="green">264</FONT>       * @return a new vector<a name="line.264"></a>
+<FONT color="green">265</FONT>       */<a name="line.265"></a>
+<FONT color="green">266</FONT>      public Vector3D subtract(Vector3D v) {<a name="line.266"></a>
+<FONT color="green">267</FONT>        return new Vector3D(x - v.x, y - v.y, z - v.z);<a name="line.267"></a>
+<FONT color="green">268</FONT>      }<a name="line.268"></a>
+<FONT color="green">269</FONT>    <a name="line.269"></a>
+<FONT color="green">270</FONT>      /** Subtract a scaled vector from the instance.<a name="line.270"></a>
+<FONT color="green">271</FONT>       * @param factor scale factor to apply to v before subtracting it<a name="line.271"></a>
+<FONT color="green">272</FONT>       * @param v vector to subtract<a name="line.272"></a>
+<FONT color="green">273</FONT>       * @return a new vector<a name="line.273"></a>
+<FONT color="green">274</FONT>       */<a name="line.274"></a>
+<FONT color="green">275</FONT>      public Vector3D subtract(double factor, Vector3D v) {<a name="line.275"></a>
+<FONT color="green">276</FONT>        return new Vector3D(x - factor * v.x, y - factor * v.y, z - factor * v.z);<a name="line.276"></a>
+<FONT color="green">277</FONT>      }<a name="line.277"></a>
+<FONT color="green">278</FONT>    <a name="line.278"></a>
+<FONT color="green">279</FONT>      /** Get a normalized vector aligned with the instance.<a name="line.279"></a>
+<FONT color="green">280</FONT>       * @return a new normalized vector<a name="line.280"></a>
+<FONT color="green">281</FONT>       * @exception ArithmeticException if the norm is zero<a name="line.281"></a>
+<FONT color="green">282</FONT>       */<a name="line.282"></a>
+<FONT color="green">283</FONT>      public Vector3D normalize() {<a name="line.283"></a>
+<FONT color="green">284</FONT>        double s = getNorm();<a name="line.284"></a>
+<FONT color="green">285</FONT>        if (s == 0) {<a name="line.285"></a>
+<FONT color="green">286</FONT>          throw MathRuntimeException.createArithmeticException("cannot normalize a zero norm vector");<a name="line.286"></a>
+<FONT color="green">287</FONT>        }<a name="line.287"></a>
+<FONT color="green">288</FONT>        return scalarMultiply(1 / s);<a name="line.288"></a>
+<FONT color="green">289</FONT>      }<a name="line.289"></a>
+<FONT color="green">290</FONT>    <a name="line.290"></a>
+<FONT color="green">291</FONT>      /** Get a vector orthogonal to the instance.<a name="line.291"></a>
+<FONT color="green">292</FONT>       * &lt;p&gt;There are an infinite number of normalized vectors orthogonal<a name="line.292"></a>
+<FONT color="green">293</FONT>       * to the instance. This method picks up one of them almost<a name="line.293"></a>
+<FONT color="green">294</FONT>       * arbitrarily. It is useful when one needs to compute a reference<a name="line.294"></a>
+<FONT color="green">295</FONT>       * frame with one of the axes in a predefined direction. The<a name="line.295"></a>
+<FONT color="green">296</FONT>       * following example shows how to build a frame having the k axis<a name="line.296"></a>
+<FONT color="green">297</FONT>       * aligned with the known vector u :<a name="line.297"></a>
+<FONT color="green">298</FONT>       * &lt;pre&gt;&lt;code&gt;<a name="line.298"></a>
+<FONT color="green">299</FONT>       *   Vector3D k = u.normalize();<a name="line.299"></a>
+<FONT color="green">300</FONT>       *   Vector3D i = k.orthogonal();<a name="line.300"></a>
+<FONT color="green">301</FONT>       *   Vector3D j = Vector3D.crossProduct(k, i);<a name="line.301"></a>
+<FONT color="green">302</FONT>       * &lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;<a name="line.302"></a>
+<FONT color="green">303</FONT>       * @return a new normalized vector orthogonal to the instance<a name="line.303"></a>
+<FONT color="green">304</FONT>       * @exception ArithmeticException if the norm of the instance is null<a name="line.304"></a>
+<FONT color="green">305</FONT>       */<a name="line.305"></a>
+<FONT color="green">306</FONT>      public Vector3D orthogonal() {<a name="line.306"></a>
+<FONT color="green">307</FONT>    <a name="line.307"></a>
+<FONT color="green">308</FONT>        double threshold = 0.6 * getNorm();<a name="line.308"></a>
+<FONT color="green">309</FONT>        if (threshold == 0) {<a name="line.309"></a>
+<FONT color="green">310</FONT>          throw MathRuntimeException.createArithmeticException("zero norm");<a name="line.310"></a>
+<FONT color="green">311</FONT>        }<a name="line.311"></a>
+<FONT color="green">312</FONT>    <a name="line.312"></a>
+<FONT color="green">313</FONT>        if ((x &gt;= -threshold) &amp;&amp; (x &lt;= threshold)) {<a name="line.313"></a>
+<FONT color="green">314</FONT>          double inverse  = 1 / Math.sqrt(y * y + z * z);<a name="line.314"></a>
+<FONT color="green">315</FONT>          return new Vector3D(0, inverse * z, -inverse * y);<a name="line.315"></a>
+<FONT color="green">316</FONT>        } else if ((y &gt;= -threshold) &amp;&amp; (y &lt;= threshold)) {<a name="line.316"></a>
+<FONT color="green">317</FONT>          double inverse  = 1 / Math.sqrt(x * x + z * z);<a name="line.317"></a>
+<FONT color="green">318</FONT>          return new Vector3D(-inverse * z, 0, inverse * x);<a name="line.318"></a>
+<FONT color="green">319</FONT>        }<a name="line.319"></a>
+<FONT color="green">320</FONT>        double inverse  = 1 / Math.sqrt(x * x + y * y);<a name="line.320"></a>
+<FONT color="green">321</FONT>        return new Vector3D(inverse * y, -inverse * x, 0);<a name="line.321"></a>
+<FONT color="green">322</FONT>    <a name="line.322"></a>
+<FONT color="green">323</FONT>      }<a name="line.323"></a>
+<FONT color="green">324</FONT>    <a name="line.324"></a>
+<FONT color="green">325</FONT>      /** Compute the angular separation between two vectors.<a name="line.325"></a>
+<FONT color="green">326</FONT>       * &lt;p&gt;This method computes the angular separation between two<a name="line.326"></a>
+<FONT color="green">327</FONT>       * vectors using the dot product for well separated vectors and the<a name="line.327"></a>
+<FONT color="green">328</FONT>       * cross product for almost aligned vectors. This allows to have a<a name="line.328"></a>
+<FONT color="green">329</FONT>       * good accuracy in all cases, even for vectors very close to each<a name="line.329"></a>
+<FONT color="green">330</FONT>       * other.&lt;/p&gt;<a name="line.330"></a>
+<FONT color="green">331</FONT>       * @param v1 first vector<a name="line.331"></a>
+<FONT color="green">332</FONT>       * @param v2 second vector<a name="line.332"></a>
+<FONT color="green">333</FONT>       * @return angular separation between v1 and v2<a name="line.333"></a>
+<FONT color="green">334</FONT>       * @exception ArithmeticException if either vector has a null norm<a name="line.334"></a>
+<FONT color="green">335</FONT>       */<a name="line.335"></a>
+<FONT color="green">336</FONT>      public static double angle(Vector3D v1, Vector3D v2) {<a name="line.336"></a>
+<FONT color="green">337</FONT>    <a name="line.337"></a>
+<FONT color="green">338</FONT>        double normProduct = v1.getNorm() * v2.getNorm();<a name="line.338"></a>
+<FONT color="green">339</FONT>        if (normProduct == 0) {<a name="line.339"></a>
+<FONT color="green">340</FONT>          throw MathRuntimeException.createArithmeticException("zero norm");<a name="line.340"></a>
+<FONT color="green">341</FONT>        }<a name="line.341"></a>
+<FONT color="green">342</FONT>    <a name="line.342"></a>
+<FONT color="green">343</FONT>        double dot = dotProduct(v1, v2);<a name="line.343"></a>
+<FONT color="green">344</FONT>        double threshold = normProduct * 0.9999;<a name="line.344"></a>
+<FONT color="green">345</FONT>        if ((dot &lt; -threshold) || (dot &gt; threshold)) {<a name="line.345"></a>
+<FONT color="green">346</FONT>          // the vectors are almost aligned, compute using the sine<a name="line.346"></a>
+<FONT color="green">347</FONT>          Vector3D v3 = crossProduct(v1, v2);<a name="line.347"></a>
+<FONT color="green">348</FONT>          if (dot &gt;= 0) {<a name="line.348"></a>
+<FONT color="green">349</FONT>            return Math.asin(v3.getNorm() / normProduct);<a name="line.349"></a>
+<FONT color="green">350</FONT>          }<a name="line.350"></a>
+<FONT color="green">351</FONT>          return Math.PI - Math.asin(v3.getNorm() / normProduct);<a name="line.351"></a>
+<FONT color="green">352</FONT>        }<a name="line.352"></a>
+<FONT color="green">353</FONT>    <a name="line.353"></a>
+<FONT color="green">354</FONT>        // the vectors are sufficiently separated to use the cosine<a name="line.354"></a>
+<FONT color="green">355</FONT>        return Math.acos(dot / normProduct);<a name="line.355"></a>
+<FONT color="green">356</FONT>    <a name="line.356"></a>
+<FONT color="green">357</FONT>      }<a name="line.357"></a>
+<FONT color="green">358</FONT>    <a name="line.358"></a>
+<FONT color="green">359</FONT>      /** Get the opposite of the instance.<a name="line.359"></a>
+<FONT color="green">360</FONT>       * @return a new vector which is opposite to the instance<a name="line.360"></a>
+<FONT color="green">361</FONT>       */<a name="line.361"></a>
+<FONT color="green">362</FONT>      public Vector3D negate() {<a name="line.362"></a>
+<FONT color="green">363</FONT>        return new Vector3D(-x, -y, -z);<a name="line.363"></a>
+<FONT color="green">364</FONT>      }<a name="line.364"></a>
+<FONT color="green">365</FONT>    <a name="line.365"></a>
+<FONT color="green">366</FONT>      /** Multiply the instance by a scalar<a name="line.366"></a>
+<FONT color="green">367</FONT>       * @param a scalar<a name="line.367"></a>
+<FONT color="green">368</FONT>       * @return a new vector<a name="line.368"></a>
+<FONT color="green">369</FONT>       */<a name="line.369"></a>
+<FONT color="green">370</FONT>      public Vector3D scalarMultiply(double a) {<a name="line.370"></a>
+<FONT color="green">371</FONT>        return new Vector3D(a * x, a * y, a * z);<a name="line.371"></a>
+<FONT color="green">372</FONT>      }<a name="line.372"></a>
+<FONT color="green">373</FONT>    <a name="line.373"></a>
+<FONT color="green">374</FONT>      /**<a name="line.374"></a>
+<FONT color="green">375</FONT>       * Returns true if any coordinate of this vector is NaN; false otherwise<a name="line.375"></a>
+<FONT color="green">376</FONT>       * @return  true if any coordinate of this vector is NaN; false otherwise<a name="line.376"></a>
+<FONT color="green">377</FONT>       */<a name="line.377"></a>
+<FONT color="green">378</FONT>      public boolean isNaN() {<a name="line.378"></a>
+<FONT color="green">379</FONT>          return Double.isNaN(x) || Double.isNaN(y) || Double.isNaN(z);<a name="line.379"></a>
+<FONT color="green">380</FONT>      }<a name="line.380"></a>
+<FONT color="green">381</FONT>    <a name="line.381"></a>
+<FONT color="green">382</FONT>      /**<a name="line.382"></a>
+<FONT color="green">383</FONT>       * Returns true if any coordinate of this vector is infinite and none are NaN;<a name="line.383"></a>
+<FONT color="green">384</FONT>       * false otherwise<a name="line.384"></a>
+<FONT color="green">385</FONT>       * @return  true if any coordinate of this vector is infinite and none are NaN;<a name="line.385"></a>
+<FONT color="green">386</FONT>       * false otherwise<a name="line.386"></a>
+<FONT color="green">387</FONT>       */<a name="line.387"></a>
+<FONT color="green">388</FONT>      public boolean isInfinite() {<a name="line.388"></a>
+<FONT color="green">389</FONT>          return !isNaN() &amp;&amp; (Double.isInfinite(x) || Double.isInfinite(y) || Double.isInfinite(z));<a name="line.389"></a>
+<FONT color="green">390</FONT>      }<a name="line.390"></a>
+<FONT color="green">391</FONT>    <a name="line.391"></a>
+<FONT color="green">392</FONT>      /**<a name="line.392"></a>
+<FONT color="green">393</FONT>       * Test for the equality of two 3D vectors.<a name="line.393"></a>
+<FONT color="green">394</FONT>       * &lt;p&gt;<a name="line.394"></a>
+<FONT color="green">395</FONT>       * If all coordinates of two 3D vectors are exactly the same, and none are<a name="line.395"></a>
+<FONT color="green">396</FONT>       * &lt;code&gt;Double.NaN&lt;/code&gt;, the two 3D vectors are considered to be equal.<a name="line.396"></a>
+<FONT color="green">397</FONT>       * &lt;/p&gt;<a name="line.397"></a>
+<FONT color="green">398</FONT>       * &lt;p&gt;<a name="line.398"></a>
+<FONT color="green">399</FONT>       * &lt;code&gt;NaN&lt;/code&gt; coordinates are considered to affect globally the vector<a name="line.399"></a>
+<FONT color="green">400</FONT>       * and be equals to each other - i.e, if either (or all) coordinates of the<a name="line.400"></a>
+<FONT color="green">401</FONT>       * 3D vector are equal to &lt;code&gt;Double.NaN&lt;/code&gt;, the 3D vector is equal to<a name="line.401"></a>
+<FONT color="green">402</FONT>       * {@link #NaN}.<a name="line.402"></a>
+<FONT color="green">403</FONT>       * &lt;/p&gt;<a name="line.403"></a>
+<FONT color="green">404</FONT>       *<a name="line.404"></a>
+<FONT color="green">405</FONT>       * @param other Object to test for equality to this<a name="line.405"></a>
+<FONT color="green">406</FONT>       * @return true if two 3D vector objects are equal, false if<a name="line.406"></a>
+<FONT color="green">407</FONT>       *         object is null, not an instance of Vector3D, or<a name="line.407"></a>
+<FONT color="green">408</FONT>       *         not equal to this Vector3D instance<a name="line.408"></a>
+<FONT color="green">409</FONT>       *<a name="line.409"></a>
+<FONT color="green">410</FONT>       */<a name="line.410"></a>
+<FONT color="green">411</FONT>      @Override<a name="line.411"></a>
+<FONT color="green">412</FONT>      public boolean equals(Object other) {<a name="line.412"></a>
+<FONT color="green">413</FONT>    <a name="line.413"></a>
+<FONT color="green">414</FONT>        if (this == other) {<a name="line.414"></a>
+<FONT color="green">415</FONT>          return true;<a name="line.415"></a>
+<FONT color="green">416</FONT>        }<a name="line.416"></a>
+<FONT color="green">417</FONT>    <a name="line.417"></a>
+<FONT color="green">418</FONT>        if (other instanceof Vector3D) {<a name="line.418"></a>
+<FONT color="green">419</FONT>          final Vector3D rhs = (Vector3D)other;<a name="line.419"></a>
+<FONT color="green">420</FONT>          if (rhs.isNaN()) {<a name="line.420"></a>
+<FONT color="green">421</FONT>              return this.isNaN();<a name="line.421"></a>
+<FONT color="green">422</FONT>          }<a name="line.422"></a>
+<FONT color="green">423</FONT>    <a name="line.423"></a>
+<FONT color="green">424</FONT>          return (x == rhs.x) &amp;&amp; (y == rhs.y) &amp;&amp; (z == rhs.z);<a name="line.424"></a>
+<FONT color="green">425</FONT>        }<a name="line.425"></a>
+<FONT color="green">426</FONT>        return false;<a name="line.426"></a>
+<FONT color="green">427</FONT>      }<a name="line.427"></a>
+<FONT color="green">428</FONT>    <a name="line.428"></a>
+<FONT color="green">429</FONT>      /**<a name="line.429"></a>
+<FONT color="green">430</FONT>       * Get a hashCode for the 3D vector.<a name="line.430"></a>
+<FONT color="green">431</FONT>       * &lt;p&gt;<a name="line.431"></a>
+<FONT color="green">432</FONT>       * All NaN values have the same hash code.&lt;/p&gt;<a name="line.432"></a>
+<FONT color="green">433</FONT>       *<a name="line.433"></a>
+<FONT color="green">434</FONT>       * @return a hash code value for this object<a name="line.434"></a>
+<FONT color="green">435</FONT>       */<a name="line.435"></a>
+<FONT color="green">436</FONT>      @Override<a name="line.436"></a>
+<FONT color="green">437</FONT>      public int hashCode() {<a name="line.437"></a>
+<FONT color="green">438</FONT>          if (isNaN()) {<a name="line.438"></a>
+<FONT color="green">439</FONT>              return 8;<a name="line.439"></a>
+<FONT color="green">440</FONT>          }<a name="line.440"></a>
+<FONT color="green">441</FONT>          return 31 * (23 * MathUtils.hash(x) +  19 * MathUtils.hash(y) +  MathUtils.hash(z));<a name="line.441"></a>
+<FONT color="green">442</FONT>      }<a name="line.442"></a>
+<FONT color="green">443</FONT>    <a name="line.443"></a>
+<FONT color="green">444</FONT>      /** Compute the dot-product of two vectors.<a name="line.444"></a>
+<FONT color="green">445</FONT>       * @param v1 first vector<a name="line.445"></a>
+<FONT color="green">446</FONT>       * @param v2 second vector<a name="line.446"></a>
+<FONT color="green">447</FONT>       * @return the dot product v1.v2<a name="line.447"></a>
+<FONT color="green">448</FONT>       */<a name="line.448"></a>
+<FONT color="green">449</FONT>      public static double dotProduct(Vector3D v1, Vector3D v2) {<a name="line.449"></a>
+<FONT color="green">450</FONT>        return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z;<a name="line.450"></a>
+<FONT color="green">451</FONT>      }<a name="line.451"></a>
+<FONT color="green">452</FONT>    <a name="line.452"></a>
+<FONT color="green">453</FONT>      /** Compute the cross-product of two vectors.<a name="line.453"></a>
+<FONT color="green">454</FONT>       * @param v1 first vector<a name="line.454"></a>
+<FONT color="green">455</FONT>       * @param v2 second vector<a name="line.455"></a>
+<FONT color="green">456</FONT>       * @return the cross product v1 ^ v2 as a new Vector<a name="line.456"></a>
+<FONT color="green">457</FONT>       */<a name="line.457"></a>
+<FONT color="green">458</FONT>      public static Vector3D crossProduct(Vector3D v1, Vector3D v2) {<a name="line.458"></a>
+<FONT color="green">459</FONT>        return new Vector3D(v1.y * v2.z - v1.z * v2.y,<a name="line.459"></a>
+<FONT color="green">460</FONT>                            v1.z * v2.x - v1.x * v2.z,<a name="line.460"></a>
+<FONT color="green">461</FONT>                            v1.x * v2.y - v1.y * v2.x);<a name="line.461"></a>
+<FONT color="green">462</FONT>      }<a name="line.462"></a>
+<FONT color="green">463</FONT>    <a name="line.463"></a>
+<FONT color="green">464</FONT>      /** Compute the distance between two vectors according to the L&lt;sub&gt;1&lt;/sub&gt; norm.<a name="line.464"></a>
+<FONT color="green">465</FONT>       * &lt;p&gt;Calling this method is equivalent to calling:<a name="line.465"></a>
+<FONT color="green">466</FONT>       * &lt;code&gt;v1.subtract(v2).getNorm1()&lt;/code&gt; except that no intermediate<a name="line.466"></a>
+<FONT color="green">467</FONT>       * vector is built&lt;/p&gt;<a name="line.467"></a>
+<FONT color="green">468</FONT>       * @param v1 first vector<a name="line.468"></a>
+<FONT color="green">469</FONT>       * @param v2 second vector<a name="line.469"></a>
+<FONT color="green">470</FONT>       * @return the distance between v1 and v2 according to the L&lt;sub&gt;1&lt;/sub&gt; norm<a name="line.470"></a>
+<FONT color="green">471</FONT>       */<a name="line.471"></a>
+<FONT color="green">472</FONT>      public static double distance1(Vector3D v1, Vector3D v2) {<a name="line.472"></a>
+<FONT color="green">473</FONT>        final double dx = Math.abs(v2.x - v1.x);<a name="line.473"></a>
+<FONT color="green">474</FONT>        final double dy = Math.abs(v2.y - v1.y);<a name="line.474"></a>
+<FONT color="green">475</FONT>        final double dz = Math.abs(v2.z - v1.z);<a name="line.475"></a>
+<FONT color="green">476</FONT>        return dx + dy + dz;<a name="line.476"></a>
+<FONT color="green">477</FONT>      }<a name="line.477"></a>
+<FONT color="green">478</FONT>    <a name="line.478"></a>
+<FONT color="green">479</FONT>      /** Compute the distance between two vectors according to the L&lt;sub&gt;2&lt;/sub&gt; norm.<a name="line.479"></a>
+<FONT color="green">480</FONT>       * &lt;p&gt;Calling this method is equivalent to calling:<a name="line.480"></a>
+<FONT color="green">481</FONT>       * &lt;code&gt;v1.subtract(v2).getNorm()&lt;/code&gt; except that no intermediate<a name="line.481"></a>
+<FONT color="green">482</FONT>       * vector is built&lt;/p&gt;<a name="line.482"></a>
+<FONT color="green">483</FONT>       * @param v1 first vector<a name="line.483"></a>
+<FONT color="green">484</FONT>       * @param v2 second vector<a name="line.484"></a>
+<FONT color="green">485</FONT>       * @return the distance between v1 and v2 according to the L&lt;sub&gt;2&lt;/sub&gt; norm<a name="line.485"></a>
+<FONT color="green">486</FONT>       */<a name="line.486"></a>
+<FONT color="green">487</FONT>      public static double distance(Vector3D v1, Vector3D v2) {<a name="line.487"></a>
+<FONT color="green">488</FONT>        final double dx = v2.x - v1.x;<a name="line.488"></a>
+<FONT color="green">489</FONT>        final double dy = v2.y - v1.y;<a name="line.489"></a>
+<FONT color="green">490</FONT>        final double dz = v2.z - v1.z;<a name="line.490"></a>
+<FONT color="green">491</FONT>        return Math.sqrt(dx * dx + dy * dy + dz * dz);<a name="line.491"></a>
+<FONT color="green">492</FONT>      }<a name="line.492"></a>
+<FONT color="green">493</FONT>    <a name="line.493"></a>
+<FONT color="green">494</FONT>      /** Compute the distance between two vectors according to the L&lt;sub&gt;&amp;infin;&lt;/sub&gt; norm.<a name="line.494"></a>
+<FONT color="green">495</FONT>       * &lt;p&gt;Calling this method is equivalent to calling:<a name="line.495"></a>
+<FONT color="green">496</FONT>       * &lt;code&gt;v1.subtract(v2).getNormInf()&lt;/code&gt; except that no intermediate<a name="line.496"></a>
+<FONT color="green">497</FONT>       * vector is built&lt;/p&gt;<a name="line.497"></a>
+<FONT color="green">498</FONT>       * @param v1 first vector<a name="line.498"></a>
+<FONT color="green">499</FONT>       * @param v2 second vector<a name="line.499"></a>
+<FONT color="green">500</FONT>       * @return the distance between v1 and v2 according to the L&lt;sub&gt;&amp;infin;&lt;/sub&gt; norm<a name="line.500"></a>
+<FONT color="green">501</FONT>       */<a name="line.501"></a>
+<FONT color="green">502</FONT>      public static double distanceInf(Vector3D v1, Vector3D v2) {<a name="line.502"></a>
+<FONT color="green">503</FONT>        final double dx = Math.abs(v2.x - v1.x);<a name="line.503"></a>
+<FONT color="green">504</FONT>        final double dy = Math.abs(v2.y - v1.y);<a name="line.504"></a>
+<FONT color="green">505</FONT>        final double dz = Math.abs(v2.z - v1.z);<a name="line.505"></a>
+<FONT color="green">506</FONT>        return Math.max(Math.max(dx, dy), dz);<a name="line.506"></a>
+<FONT color="green">507</FONT>      }<a name="line.507"></a>
+<FONT color="green">508</FONT>    <a name="line.508"></a>
+<FONT color="green">509</FONT>      /** Compute the square of the distance between two vectors.<a name="line.509"></a>
+<FONT color="green">510</FONT>       * &lt;p&gt;Calling this method is equivalent to calling:<a name="line.510"></a>
+<FONT color="green">511</FONT>       * &lt;code&gt;v1.subtract(v2).getNormSq()&lt;/code&gt; except that no intermediate<a name="line.511"></a>
+<FONT color="green">512</FONT>       * vector is built&lt;/p&gt;<a name="line.512"></a>
+<FONT color="green">513</FONT>       * @param v1 first vector<a name="line.513"></a>
+<FONT color="green">514</FONT>       * @param v2 second vector<a name="line.514"></a>
+<FONT color="green">515</FONT>       * @return the square of the distance between v1 and v2<a name="line.515"></a>
+<FONT color="green">516</FONT>       */<a name="line.516"></a>
+<FONT color="green">517</FONT>      public static double distanceSq(Vector3D v1, Vector3D v2) {<a name="line.517"></a>
+<FONT color="green">518</FONT>        final double dx = v2.x - v1.x;<a name="line.518"></a>
+<FONT color="green">519</FONT>        final double dy = v2.y - v1.y;<a name="line.519"></a>
+<FONT color="green">520</FONT>        final double dz = v2.z - v1.z;<a name="line.520"></a>
+<FONT color="green">521</FONT>        return dx * dx + dy * dy + dz * dz;<a name="line.521"></a>
+<FONT color="green">522</FONT>      }<a name="line.522"></a>
+<FONT color="green">523</FONT>    <a name="line.523"></a>
+<FONT color="green">524</FONT>      /** Get a string representation of this vector.<a name="line.524"></a>
+<FONT color="green">525</FONT>       * @return a string representation of this vector<a name="line.525"></a>
+<FONT color="green">526</FONT>       */<a name="line.526"></a>
+<FONT color="green">527</FONT>      @Override<a name="line.527"></a>
+<FONT color="green">528</FONT>      public String toString() {<a name="line.528"></a>
+<FONT color="green">529</FONT>          return DEFAULT_FORMAT.format(this);<a name="line.529"></a>
+<FONT color="green">530</FONT>      }<a name="line.530"></a>
+<FONT color="green">531</FONT>    <a name="line.531"></a>
+<FONT color="green">532</FONT>    }<a name="line.532"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/geometry/Vector3DFormat.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,408 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.geometry;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.text.FieldPosition;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.text.NumberFormat;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.text.ParseException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.text.ParsePosition;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import java.util.Locale;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.util.CompositeFormat;<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>    /**<a name="line.29"></a>
+<FONT color="green">030</FONT>     * Formats a 3D vector in components list format "{x; y; z}".<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;The prefix and suffix "{" and "}" and the separator "; " can be replaced by<a name="line.31"></a>
+<FONT color="green">032</FONT>     * any user-defined strings. The number format for components can be configured.&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;p&gt;White space is ignored at parse time, even if it is in the prefix, suffix<a name="line.33"></a>
+<FONT color="green">034</FONT>     * or separator specifications. So even if the default separator does include a space<a name="line.34"></a>
+<FONT color="green">035</FONT>     * character that is used at format time, both input string "{1;1;1}" and<a name="line.35"></a>
+<FONT color="green">036</FONT>     * " { 1 ; 1 ; 1 } " will be parsed without error and the same vector will be<a name="line.36"></a>
+<FONT color="green">037</FONT>     * returned. In the second case, however, the parse position after parsing will be<a name="line.37"></a>
+<FONT color="green">038</FONT>     * just after the closing curly brace, i.e. just before the trailing space.&lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     *<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @version $Revision: 772119 $ $Date: 2009-05-06 05:43:28 -0400 (Wed, 06 May 2009) $<a name="line.40"></a>
+<FONT color="green">041</FONT>     */<a name="line.41"></a>
+<FONT color="green">042</FONT>    public class Vector3DFormat extends CompositeFormat {<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Serializable version identifier */<a name="line.44"></a>
+<FONT color="green">045</FONT>        private static final long serialVersionUID = -5447606608652576301L;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** The default prefix: "{". */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private static final String DEFAULT_PREFIX = "{";<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** The default suffix: "}". */<a name="line.50"></a>
+<FONT color="green">051</FONT>        private static final String DEFAULT_SUFFIX = "}";<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** The default separator: ", ". */<a name="line.53"></a>
+<FONT color="green">054</FONT>        private static final String DEFAULT_SEPARATOR = "; ";<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** Prefix. */<a name="line.56"></a>
+<FONT color="green">057</FONT>        private final String prefix;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** Suffix. */<a name="line.59"></a>
+<FONT color="green">060</FONT>        private final String suffix;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** Separator. */<a name="line.62"></a>
+<FONT color="green">063</FONT>        private final String separator;<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Trimmed prefix. */<a name="line.65"></a>
+<FONT color="green">066</FONT>        private final String trimmedPrefix;<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /** Trimmed suffix. */<a name="line.68"></a>
+<FONT color="green">069</FONT>        private final String trimmedSuffix;<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** Trimmed separator. */<a name="line.71"></a>
+<FONT color="green">072</FONT>        private final String trimmedSeparator;<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /** The format used for components. */<a name="line.74"></a>
+<FONT color="green">075</FONT>        private NumberFormat format;<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /**<a name="line.77"></a>
+<FONT color="green">078</FONT>         * Create an instance with default settings.<a name="line.78"></a>
+<FONT color="green">079</FONT>         * &lt;p&gt;The instance uses the default prefix, suffix and separator:<a name="line.79"></a>
+<FONT color="green">080</FONT>         * "{", "}", and "; " and the default number format for components.&lt;/p&gt;<a name="line.80"></a>
+<FONT color="green">081</FONT>         */<a name="line.81"></a>
+<FONT color="green">082</FONT>        public Vector3DFormat() {<a name="line.82"></a>
+<FONT color="green">083</FONT>            this(DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_SEPARATOR, getDefaultNumberFormat());<a name="line.83"></a>
+<FONT color="green">084</FONT>        }<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /**<a name="line.86"></a>
+<FONT color="green">087</FONT>         * Create an instance with a custom number format for components.<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @param format the custom format for components.<a name="line.88"></a>
+<FONT color="green">089</FONT>         */<a name="line.89"></a>
+<FONT color="green">090</FONT>        public Vector3DFormat(final NumberFormat format) {<a name="line.90"></a>
+<FONT color="green">091</FONT>            this(DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_SEPARATOR, format);<a name="line.91"></a>
+<FONT color="green">092</FONT>        }<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>        /**<a name="line.94"></a>
+<FONT color="green">095</FONT>         * Create an instance with custom prefix, suffix and separator.<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @param prefix prefix to use instead of the default "{"<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @param suffix suffix to use instead of the default "}"<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @param separator separator to use instead of the default "; "<a name="line.98"></a>
+<FONT color="green">099</FONT>         */<a name="line.99"></a>
+<FONT color="green">100</FONT>        public Vector3DFormat(final String prefix, final String suffix,<a name="line.100"></a>
+<FONT color="green">101</FONT>                              final String separator) {<a name="line.101"></a>
+<FONT color="green">102</FONT>            this(prefix, suffix, separator, getDefaultNumberFormat());<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /**<a name="line.105"></a>
+<FONT color="green">106</FONT>         * Create an instance with custom prefix, suffix, separator and format<a name="line.106"></a>
+<FONT color="green">107</FONT>         * for components.<a name="line.107"></a>
+<FONT color="green">108</FONT>         * @param prefix prefix to use instead of the default "{"<a name="line.108"></a>
+<FONT color="green">109</FONT>         * @param suffix suffix to use instead of the default "}"<a name="line.109"></a>
+<FONT color="green">110</FONT>         * @param separator separator to use instead of the default "; "<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @param format the custom format for components.<a name="line.111"></a>
+<FONT color="green">112</FONT>         */<a name="line.112"></a>
+<FONT color="green">113</FONT>        public Vector3DFormat(final String prefix, final String suffix,<a name="line.113"></a>
+<FONT color="green">114</FONT>                              final String separator, final NumberFormat format) {<a name="line.114"></a>
+<FONT color="green">115</FONT>            this.prefix      = prefix;<a name="line.115"></a>
+<FONT color="green">116</FONT>            this.suffix      = suffix;<a name="line.116"></a>
+<FONT color="green">117</FONT>            this.separator   = separator;<a name="line.117"></a>
+<FONT color="green">118</FONT>            trimmedPrefix    = prefix.trim();<a name="line.118"></a>
+<FONT color="green">119</FONT>            trimmedSuffix    = suffix.trim();<a name="line.119"></a>
+<FONT color="green">120</FONT>            trimmedSeparator = separator.trim();<a name="line.120"></a>
+<FONT color="green">121</FONT>            this.format      = format;<a name="line.121"></a>
+<FONT color="green">122</FONT>        }<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>        /**<a name="line.124"></a>
+<FONT color="green">125</FONT>         * Get the set of locales for which 3D vectors formats are available.<a name="line.125"></a>
+<FONT color="green">126</FONT>         * &lt;p&gt;This is the same set as the {@link NumberFormat} set.&lt;/p&gt;<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @return available 3D vector format locales.<a name="line.127"></a>
+<FONT color="green">128</FONT>         */<a name="line.128"></a>
+<FONT color="green">129</FONT>        public static Locale[] getAvailableLocales() {<a name="line.129"></a>
+<FONT color="green">130</FONT>            return NumberFormat.getAvailableLocales();<a name="line.130"></a>
+<FONT color="green">131</FONT>        }<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>        /**<a name="line.133"></a>
+<FONT color="green">134</FONT>         * Get the format prefix.<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @return format prefix.<a name="line.135"></a>
+<FONT color="green">136</FONT>         */<a name="line.136"></a>
+<FONT color="green">137</FONT>        public String getPrefix() {<a name="line.137"></a>
+<FONT color="green">138</FONT>            return prefix;<a name="line.138"></a>
+<FONT color="green">139</FONT>        }<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>        /**<a name="line.141"></a>
+<FONT color="green">142</FONT>         * Get the format suffix.<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @return format suffix.<a name="line.143"></a>
+<FONT color="green">144</FONT>         */<a name="line.144"></a>
+<FONT color="green">145</FONT>        public String getSuffix() {<a name="line.145"></a>
+<FONT color="green">146</FONT>            return suffix;<a name="line.146"></a>
+<FONT color="green">147</FONT>        }<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>        /**<a name="line.149"></a>
+<FONT color="green">150</FONT>         * Get the format separator between components.<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @return format separator.<a name="line.151"></a>
+<FONT color="green">152</FONT>         */<a name="line.152"></a>
+<FONT color="green">153</FONT>        public String getSeparator() {<a name="line.153"></a>
+<FONT color="green">154</FONT>            return separator;<a name="line.154"></a>
+<FONT color="green">155</FONT>        }<a name="line.155"></a>
+<FONT color="green">156</FONT>    <a name="line.156"></a>
+<FONT color="green">157</FONT>        /**<a name="line.157"></a>
+<FONT color="green">158</FONT>         * Get the components format.<a name="line.158"></a>
+<FONT color="green">159</FONT>         * @return components format.<a name="line.159"></a>
+<FONT color="green">160</FONT>         */<a name="line.160"></a>
+<FONT color="green">161</FONT>        public NumberFormat getFormat() {<a name="line.161"></a>
+<FONT color="green">162</FONT>            return format;<a name="line.162"></a>
+<FONT color="green">163</FONT>        }<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>        /**<a name="line.165"></a>
+<FONT color="green">166</FONT>         * Returns the default 3D vector format for the current locale.<a name="line.166"></a>
+<FONT color="green">167</FONT>         * @return the default 3D vector format.<a name="line.167"></a>
+<FONT color="green">168</FONT>         */<a name="line.168"></a>
+<FONT color="green">169</FONT>        public static Vector3DFormat getInstance() {<a name="line.169"></a>
+<FONT color="green">170</FONT>            return getInstance(Locale.getDefault());<a name="line.170"></a>
+<FONT color="green">171</FONT>        }<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>        /**<a name="line.173"></a>
+<FONT color="green">174</FONT>         * Returns the default 3D vector format for the given locale.<a name="line.174"></a>
+<FONT color="green">175</FONT>         * @param locale the specific locale used by the format.<a name="line.175"></a>
+<FONT color="green">176</FONT>         * @return the 3D vector format specific to the given locale.<a name="line.176"></a>
+<FONT color="green">177</FONT>         */<a name="line.177"></a>
+<FONT color="green">178</FONT>        public static Vector3DFormat getInstance(final Locale locale) {<a name="line.178"></a>
+<FONT color="green">179</FONT>            return new Vector3DFormat(getDefaultNumberFormat(locale));<a name="line.179"></a>
+<FONT color="green">180</FONT>        }<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>        /**<a name="line.182"></a>
+<FONT color="green">183</FONT>         * This static method calls {@link #format(Object)} on a default instance of<a name="line.183"></a>
+<FONT color="green">184</FONT>         * Vector3DFormat.<a name="line.184"></a>
+<FONT color="green">185</FONT>         *<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @param v Vector3D object to format<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @return A formatted vector<a name="line.187"></a>
+<FONT color="green">188</FONT>         */<a name="line.188"></a>
+<FONT color="green">189</FONT>        public static String formatVector3D(Vector3D v) {<a name="line.189"></a>
+<FONT color="green">190</FONT>            return getInstance().format(v);<a name="line.190"></a>
+<FONT color="green">191</FONT>        }<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>        /**<a name="line.193"></a>
+<FONT color="green">194</FONT>         * Formats a {@link Vector3D} object to produce a string.<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @param vector the object to format.<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @param toAppendTo where the text is to be appended<a name="line.196"></a>
+<FONT color="green">197</FONT>         * @param pos On input: an alignment field, if desired. On output: the<a name="line.197"></a>
+<FONT color="green">198</FONT>         *            offsets of the alignment field<a name="line.198"></a>
+<FONT color="green">199</FONT>         * @return the value passed in as toAppendTo.<a name="line.199"></a>
+<FONT color="green">200</FONT>         */<a name="line.200"></a>
+<FONT color="green">201</FONT>        public StringBuffer format(Vector3D vector, StringBuffer toAppendTo,<a name="line.201"></a>
+<FONT color="green">202</FONT>                                   FieldPosition pos) {<a name="line.202"></a>
+<FONT color="green">203</FONT>    <a name="line.203"></a>
+<FONT color="green">204</FONT>            pos.setBeginIndex(0);<a name="line.204"></a>
+<FONT color="green">205</FONT>            pos.setEndIndex(0);<a name="line.205"></a>
+<FONT color="green">206</FONT>    <a name="line.206"></a>
+<FONT color="green">207</FONT>            // format prefix<a name="line.207"></a>
+<FONT color="green">208</FONT>            toAppendTo.append(prefix);<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>            // format components<a name="line.210"></a>
+<FONT color="green">211</FONT>            formatDouble(vector.getX(), format, toAppendTo, pos);<a name="line.211"></a>
+<FONT color="green">212</FONT>            toAppendTo.append(separator);<a name="line.212"></a>
+<FONT color="green">213</FONT>            formatDouble(vector.getY(), format, toAppendTo, pos);<a name="line.213"></a>
+<FONT color="green">214</FONT>            toAppendTo.append(separator);<a name="line.214"></a>
+<FONT color="green">215</FONT>            formatDouble(vector.getZ(), format, toAppendTo, pos);<a name="line.215"></a>
+<FONT color="green">216</FONT>    <a name="line.216"></a>
+<FONT color="green">217</FONT>            // format suffix<a name="line.217"></a>
+<FONT color="green">218</FONT>            toAppendTo.append(suffix);<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>            return toAppendTo;<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>        }<a name="line.222"></a>
+<FONT color="green">223</FONT>    <a name="line.223"></a>
+<FONT color="green">224</FONT>        /**<a name="line.224"></a>
+<FONT color="green">225</FONT>         * Formats a object to produce a string.<a name="line.225"></a>
+<FONT color="green">226</FONT>         * &lt;p&gt;&lt;code&gt;obj&lt;/code&gt; must be a  {@link Vector3D} object. Any other type of<a name="line.226"></a>
+<FONT color="green">227</FONT>         * object will result in an {@link IllegalArgumentException} being thrown.&lt;/p&gt;<a name="line.227"></a>
+<FONT color="green">228</FONT>         * @param obj the object to format.<a name="line.228"></a>
+<FONT color="green">229</FONT>         * @param toAppendTo where the text is to be appended<a name="line.229"></a>
+<FONT color="green">230</FONT>         * @param pos On input: an alignment field, if desired. On output: the<a name="line.230"></a>
+<FONT color="green">231</FONT>         *            offsets of the alignment field<a name="line.231"></a>
+<FONT color="green">232</FONT>         * @return the value passed in as toAppendTo.<a name="line.232"></a>
+<FONT color="green">233</FONT>         * @see java.text.Format#format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)<a name="line.233"></a>
+<FONT color="green">234</FONT>         * @throws IllegalArgumentException is &lt;code&gt;obj&lt;/code&gt; is not a valid type.<a name="line.234"></a>
+<FONT color="green">235</FONT>         */<a name="line.235"></a>
+<FONT color="green">236</FONT>        @Override<a name="line.236"></a>
+<FONT color="green">237</FONT>        public StringBuffer format(Object obj, StringBuffer toAppendTo,<a name="line.237"></a>
+<FONT color="green">238</FONT>                                   FieldPosition pos) {<a name="line.238"></a>
+<FONT color="green">239</FONT>    <a name="line.239"></a>
+<FONT color="green">240</FONT>            if (obj instanceof Vector3D) {<a name="line.240"></a>
+<FONT color="green">241</FONT>                return format( (Vector3D)obj, toAppendTo, pos);<a name="line.241"></a>
+<FONT color="green">242</FONT>            }<a name="line.242"></a>
+<FONT color="green">243</FONT>    <a name="line.243"></a>
+<FONT color="green">244</FONT>            throw MathRuntimeException.createIllegalArgumentException("cannot format a {0} instance as a 3D vector",<a name="line.244"></a>
+<FONT color="green">245</FONT>                                                                      obj.getClass().getName());<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>        }<a name="line.247"></a>
+<FONT color="green">248</FONT>    <a name="line.248"></a>
+<FONT color="green">249</FONT>        /**<a name="line.249"></a>
+<FONT color="green">250</FONT>         * Parses a string to produce a {@link Vector3D} object.<a name="line.250"></a>
+<FONT color="green">251</FONT>         * @param source the string to parse<a name="line.251"></a>
+<FONT color="green">252</FONT>         * @return the parsed {@link Vector3D} object.<a name="line.252"></a>
+<FONT color="green">253</FONT>         * @exception ParseException if the beginning of the specified string<a name="line.253"></a>
+<FONT color="green">254</FONT>         *            cannot be parsed.<a name="line.254"></a>
+<FONT color="green">255</FONT>         */<a name="line.255"></a>
+<FONT color="green">256</FONT>        public Vector3D parse(String source) throws ParseException {<a name="line.256"></a>
+<FONT color="green">257</FONT>            ParsePosition parsePosition = new ParsePosition(0);<a name="line.257"></a>
+<FONT color="green">258</FONT>            Vector3D result = parse(source, parsePosition);<a name="line.258"></a>
+<FONT color="green">259</FONT>            if (parsePosition.getIndex() == 0) {<a name="line.259"></a>
+<FONT color="green">260</FONT>                throw MathRuntimeException.createParseException(<a name="line.260"></a>
+<FONT color="green">261</FONT>                        parsePosition.getErrorIndex(),<a name="line.261"></a>
+<FONT color="green">262</FONT>                        "unparseable 3D vector: \"{0}\"", source);<a name="line.262"></a>
+<FONT color="green">263</FONT>            }<a name="line.263"></a>
+<FONT color="green">264</FONT>            return result;<a name="line.264"></a>
+<FONT color="green">265</FONT>        }<a name="line.265"></a>
+<FONT color="green">266</FONT>    <a name="line.266"></a>
+<FONT color="green">267</FONT>        /**<a name="line.267"></a>
+<FONT color="green">268</FONT>         * Parses a string to produce a {@link Vector3D} object.<a name="line.268"></a>
+<FONT color="green">269</FONT>         * @param source the string to parse<a name="line.269"></a>
+<FONT color="green">270</FONT>         * @param pos input/ouput parsing parameter.<a name="line.270"></a>
+<FONT color="green">271</FONT>         * @return the parsed {@link Vector3D} object.<a name="line.271"></a>
+<FONT color="green">272</FONT>         */<a name="line.272"></a>
+<FONT color="green">273</FONT>        public Vector3D parse(String source, ParsePosition pos) {<a name="line.273"></a>
+<FONT color="green">274</FONT>            int initialIndex = pos.getIndex();<a name="line.274"></a>
+<FONT color="green">275</FONT>    <a name="line.275"></a>
+<FONT color="green">276</FONT>            // parse prefix<a name="line.276"></a>
+<FONT color="green">277</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.277"></a>
+<FONT color="green">278</FONT>            if (!parseFixedstring(source, trimmedPrefix, pos)) {<a name="line.278"></a>
+<FONT color="green">279</FONT>                return null;<a name="line.279"></a>
+<FONT color="green">280</FONT>            }<a name="line.280"></a>
+<FONT color="green">281</FONT>    <a name="line.281"></a>
+<FONT color="green">282</FONT>            // parse X component<a name="line.282"></a>
+<FONT color="green">283</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.283"></a>
+<FONT color="green">284</FONT>            Number x = parseNumber(source, format, pos);<a name="line.284"></a>
+<FONT color="green">285</FONT>            if (x == null) {<a name="line.285"></a>
+<FONT color="green">286</FONT>                // invalid abscissa<a name="line.286"></a>
+<FONT color="green">287</FONT>                // set index back to initial, error index should already be set<a name="line.287"></a>
+<FONT color="green">288</FONT>                pos.setIndex(initialIndex);<a name="line.288"></a>
+<FONT color="green">289</FONT>                return null;<a name="line.289"></a>
+<FONT color="green">290</FONT>            }<a name="line.290"></a>
+<FONT color="green">291</FONT>    <a name="line.291"></a>
+<FONT color="green">292</FONT>            // parse Y component<a name="line.292"></a>
+<FONT color="green">293</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.293"></a>
+<FONT color="green">294</FONT>            if (!parseFixedstring(source, trimmedSeparator, pos)) {<a name="line.294"></a>
+<FONT color="green">295</FONT>                return null;<a name="line.295"></a>
+<FONT color="green">296</FONT>            }<a name="line.296"></a>
+<FONT color="green">297</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.297"></a>
+<FONT color="green">298</FONT>            Number y = parseNumber(source, format, pos);<a name="line.298"></a>
+<FONT color="green">299</FONT>            if (y == null) {<a name="line.299"></a>
+<FONT color="green">300</FONT>                // invalid ordinate<a name="line.300"></a>
+<FONT color="green">301</FONT>                // set index back to initial, error index should already be set<a name="line.301"></a>
+<FONT color="green">302</FONT>                pos.setIndex(initialIndex);<a name="line.302"></a>
+<FONT color="green">303</FONT>                return null;<a name="line.303"></a>
+<FONT color="green">304</FONT>            }<a name="line.304"></a>
+<FONT color="green">305</FONT>    <a name="line.305"></a>
+<FONT color="green">306</FONT>            // parse Z component<a name="line.306"></a>
+<FONT color="green">307</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.307"></a>
+<FONT color="green">308</FONT>            if (!parseFixedstring(source, trimmedSeparator, pos)) {<a name="line.308"></a>
+<FONT color="green">309</FONT>                return null;<a name="line.309"></a>
+<FONT color="green">310</FONT>            }<a name="line.310"></a>
+<FONT color="green">311</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.311"></a>
+<FONT color="green">312</FONT>            Number z = parseNumber(source, format, pos);<a name="line.312"></a>
+<FONT color="green">313</FONT>            if (z == null) {<a name="line.313"></a>
+<FONT color="green">314</FONT>                // invalid height<a name="line.314"></a>
+<FONT color="green">315</FONT>                // set index back to initial, error index should already be set<a name="line.315"></a>
+<FONT color="green">316</FONT>                pos.setIndex(initialIndex);<a name="line.316"></a>
+<FONT color="green">317</FONT>                return null;<a name="line.317"></a>
+<FONT color="green">318</FONT>            }<a name="line.318"></a>
+<FONT color="green">319</FONT>    <a name="line.319"></a>
+<FONT color="green">320</FONT>            // parse suffix<a name="line.320"></a>
+<FONT color="green">321</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.321"></a>
+<FONT color="green">322</FONT>            if (!parseFixedstring(source, trimmedSuffix, pos)) {<a name="line.322"></a>
+<FONT color="green">323</FONT>                return null;<a name="line.323"></a>
+<FONT color="green">324</FONT>            }<a name="line.324"></a>
+<FONT color="green">325</FONT>    <a name="line.325"></a>
+<FONT color="green">326</FONT>            return new Vector3D(x.doubleValue(), y.doubleValue(), z.doubleValue());<a name="line.326"></a>
+<FONT color="green">327</FONT>    <a name="line.327"></a>
+<FONT color="green">328</FONT>        }<a name="line.328"></a>
+<FONT color="green">329</FONT>    <a name="line.329"></a>
+<FONT color="green">330</FONT>        /**<a name="line.330"></a>
+<FONT color="green">331</FONT>         * Parses a string to produce a object.<a name="line.331"></a>
+<FONT color="green">332</FONT>         * @param source the string to parse<a name="line.332"></a>
+<FONT color="green">333</FONT>         * @param pos input/ouput parsing parameter.<a name="line.333"></a>
+<FONT color="green">334</FONT>         * @return the parsed object.<a name="line.334"></a>
+<FONT color="green">335</FONT>         * @see java.text.Format#parseObject(java.lang.String, java.text.ParsePosition)<a name="line.335"></a>
+<FONT color="green">336</FONT>         */<a name="line.336"></a>
+<FONT color="green">337</FONT>        @Override<a name="line.337"></a>
+<FONT color="green">338</FONT>        public Object parseObject(String source, ParsePosition pos) {<a name="line.338"></a>
+<FONT color="green">339</FONT>            return parse(source, pos);<a name="line.339"></a>
+<FONT color="green">340</FONT>        }<a name="line.340"></a>
+<FONT color="green">341</FONT>    <a name="line.341"></a>
+<FONT color="green">342</FONT>    }<a name="line.342"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/AbstractFieldMatrix.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,1205 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.lang.reflect.Array;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.Arrays;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.Field;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.FieldElement;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    /**<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Basic implementation of {@link FieldMatrix} methods regardless of the underlying storage.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;All the methods implemented here use {@link #getEntry(int, int)} to access<a name="line.29"></a>
+<FONT color="green">030</FONT>     * matrix elements. Derived class can provide faster implementations. &lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     *<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @param &lt;T&gt; the type of the field elements<a name="line.32"></a>
+<FONT color="green">033</FONT>     * @version $Revision: 903046 $ $Date: 2010-01-25 21:07:26 -0500 (Mon, 25 Jan 2010) $<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @since 2.0<a name="line.34"></a>
+<FONT color="green">035</FONT>     */<a name="line.35"></a>
+<FONT color="green">036</FONT>    public abstract class AbstractFieldMatrix&lt;T extends FieldElement&lt;T&gt;&gt; implements FieldMatrix&lt;T&gt; {<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Field to which the elements belong. */<a name="line.38"></a>
+<FONT color="green">039</FONT>        private final Field&lt;T&gt; field;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * Constructor for use with Serializable<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        protected AbstractFieldMatrix() {<a name="line.44"></a>
+<FONT color="green">045</FONT>            field = null;<a name="line.45"></a>
+<FONT color="green">046</FONT>        }<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /**<a name="line.48"></a>
+<FONT color="green">049</FONT>         * Creates a matrix with no data<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @param field field to which the elements belong<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        protected AbstractFieldMatrix(final Field&lt;T&gt; field) {<a name="line.52"></a>
+<FONT color="green">053</FONT>            this.field = field;<a name="line.53"></a>
+<FONT color="green">054</FONT>        }<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /**<a name="line.56"></a>
+<FONT color="green">057</FONT>         * Create a new FieldMatrix&lt;T&gt; with the supplied row and column dimensions.<a name="line.57"></a>
+<FONT color="green">058</FONT>         *<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @param field field to which the elements belong<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @param rowDimension  the number of rows in the new matrix<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param columnDimension  the number of columns in the new matrix<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @throws IllegalArgumentException if row or column dimension is not positive<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        protected AbstractFieldMatrix(final Field&lt;T&gt; field,<a name="line.64"></a>
+<FONT color="green">065</FONT>                                      final int rowDimension, final int columnDimension)<a name="line.65"></a>
+<FONT color="green">066</FONT>            throws IllegalArgumentException {<a name="line.66"></a>
+<FONT color="green">067</FONT>            if (rowDimension &lt;= 0 ) {<a name="line.67"></a>
+<FONT color="green">068</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.68"></a>
+<FONT color="green">069</FONT>                        "invalid row dimension {0} (must be positive)",<a name="line.69"></a>
+<FONT color="green">070</FONT>                        rowDimension);<a name="line.70"></a>
+<FONT color="green">071</FONT>            }<a name="line.71"></a>
+<FONT color="green">072</FONT>            if (columnDimension &lt;= 0) {<a name="line.72"></a>
+<FONT color="green">073</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.73"></a>
+<FONT color="green">074</FONT>                        "invalid column dimension {0} (must be positive)",<a name="line.74"></a>
+<FONT color="green">075</FONT>                        columnDimension);<a name="line.75"></a>
+<FONT color="green">076</FONT>            }<a name="line.76"></a>
+<FONT color="green">077</FONT>            this.field = field;<a name="line.77"></a>
+<FONT color="green">078</FONT>        }<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /**<a name="line.80"></a>
+<FONT color="green">081</FONT>         * Get the elements type from an array.<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @param &lt;T&gt; the type of the field elements<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param d data array<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @return field to which array elements belong<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @exception IllegalArgumentException if array is empty<a name="line.85"></a>
+<FONT color="green">086</FONT>         */<a name="line.86"></a>
+<FONT color="green">087</FONT>        protected static &lt;T extends FieldElement&lt;T&gt;&gt; Field&lt;T&gt; extractField(final T[][] d)<a name="line.87"></a>
+<FONT color="green">088</FONT>            throws IllegalArgumentException {<a name="line.88"></a>
+<FONT color="green">089</FONT>            if (d.length == 0) {<a name="line.89"></a>
+<FONT color="green">090</FONT>                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");<a name="line.90"></a>
+<FONT color="green">091</FONT>            }<a name="line.91"></a>
+<FONT color="green">092</FONT>            if (d[0].length == 0) {<a name="line.92"></a>
+<FONT color="green">093</FONT>                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");<a name="line.93"></a>
+<FONT color="green">094</FONT>            }<a name="line.94"></a>
+<FONT color="green">095</FONT>            return d[0][0].getField();<a name="line.95"></a>
+<FONT color="green">096</FONT>        }<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /**<a name="line.98"></a>
+<FONT color="green">099</FONT>         * Get the elements type from an array.<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @param &lt;T&gt; the type of the field elements<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @param d data array<a name="line.101"></a>
+<FONT color="green">102</FONT>         * @return field to which array elements belong<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @exception IllegalArgumentException if array is empty<a name="line.103"></a>
+<FONT color="green">104</FONT>         */<a name="line.104"></a>
+<FONT color="green">105</FONT>        protected static &lt;T extends FieldElement&lt;T&gt;&gt; Field&lt;T&gt; extractField(final T[] d)<a name="line.105"></a>
+<FONT color="green">106</FONT>            throws IllegalArgumentException {<a name="line.106"></a>
+<FONT color="green">107</FONT>            if (d.length == 0) {<a name="line.107"></a>
+<FONT color="green">108</FONT>                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");<a name="line.108"></a>
+<FONT color="green">109</FONT>            }<a name="line.109"></a>
+<FONT color="green">110</FONT>            return d[0].getField();<a name="line.110"></a>
+<FONT color="green">111</FONT>        }<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>        /** Build an array of elements.<a name="line.113"></a>
+<FONT color="green">114</FONT>         * &lt;p&gt;<a name="line.114"></a>
+<FONT color="green">115</FONT>         * Complete arrays are filled with field.getZero()<a name="line.115"></a>
+<FONT color="green">116</FONT>         * &lt;/p&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @param &lt;T&gt; the type of the field elements<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @param field field to which array elements belong<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @param rows number of rows<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @param columns number of columns (may be negative to build partial<a name="line.120"></a>
+<FONT color="green">121</FONT>         * arrays in the same way &lt;code&gt;new Field[rows][]&lt;/code&gt; works)<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @return a new array<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        @SuppressWarnings("unchecked")<a name="line.124"></a>
+<FONT color="green">125</FONT>        protected static &lt;T extends FieldElement&lt;T&gt;&gt; T[][] buildArray(final Field&lt;T&gt; field,<a name="line.125"></a>
+<FONT color="green">126</FONT>                                                                      final int rows,<a name="line.126"></a>
+<FONT color="green">127</FONT>                                                                      final int columns) {<a name="line.127"></a>
+<FONT color="green">128</FONT>            if (columns &lt; 0) {<a name="line.128"></a>
+<FONT color="green">129</FONT>                T[] dummyRow = (T[]) Array.newInstance(field.getZero().getClass(), 0);<a name="line.129"></a>
+<FONT color="green">130</FONT>                return (T[][]) Array.newInstance(dummyRow.getClass(), rows);<a name="line.130"></a>
+<FONT color="green">131</FONT>            }<a name="line.131"></a>
+<FONT color="green">132</FONT>            T[][] array =<a name="line.132"></a>
+<FONT color="green">133</FONT>                (T[][]) Array.newInstance(field.getZero().getClass(), new int[] { rows, columns });<a name="line.133"></a>
+<FONT color="green">134</FONT>            for (int i = 0; i &lt; array.length; ++i) {<a name="line.134"></a>
+<FONT color="green">135</FONT>                Arrays.fill(array[i], field.getZero());<a name="line.135"></a>
+<FONT color="green">136</FONT>            }<a name="line.136"></a>
+<FONT color="green">137</FONT>            return array;<a name="line.137"></a>
+<FONT color="green">138</FONT>        }<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>        /** Build an array of elements.<a name="line.140"></a>
+<FONT color="green">141</FONT>         * &lt;p&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>         * Arrays are filled with field.getZero()<a name="line.142"></a>
+<FONT color="green">143</FONT>         * &lt;/p&gt;<a name="line.143"></a>
+<FONT color="green">144</FONT>         * @param &lt;T&gt; the type of the field elements<a name="line.144"></a>
+<FONT color="green">145</FONT>         * @param field field to which array elements belong<a name="line.145"></a>
+<FONT color="green">146</FONT>         * @param length of the array<a name="line.146"></a>
+<FONT color="green">147</FONT>         * @return a new array<a name="line.147"></a>
+<FONT color="green">148</FONT>         */<a name="line.148"></a>
+<FONT color="green">149</FONT>        protected static &lt;T extends FieldElement&lt;T&gt;&gt; T[] buildArray(final Field&lt;T&gt; field,<a name="line.149"></a>
+<FONT color="green">150</FONT>                                                                    final int length) {<a name="line.150"></a>
+<FONT color="green">151</FONT>            @SuppressWarnings("unchecked") // OK because field must be correct class<a name="line.151"></a>
+<FONT color="green">152</FONT>            T[] array = (T[]) Array.newInstance(field.getZero().getClass(), length);<a name="line.152"></a>
+<FONT color="green">153</FONT>            Arrays.fill(array, field.getZero());<a name="line.153"></a>
+<FONT color="green">154</FONT>            return array;<a name="line.154"></a>
+<FONT color="green">155</FONT>        }<a name="line.155"></a>
+<FONT color="green">156</FONT>    <a name="line.156"></a>
+<FONT color="green">157</FONT>        /** {@inheritDoc} */<a name="line.157"></a>
+<FONT color="green">158</FONT>        public Field&lt;T&gt; getField() {<a name="line.158"></a>
+<FONT color="green">159</FONT>            return field;<a name="line.159"></a>
+<FONT color="green">160</FONT>        }<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>        /** {@inheritDoc} */<a name="line.162"></a>
+<FONT color="green">163</FONT>        public abstract FieldMatrix&lt;T&gt; createMatrix(final int rowDimension, final int columnDimension)<a name="line.163"></a>
+<FONT color="green">164</FONT>            throws IllegalArgumentException;<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>        /** {@inheritDoc} */<a name="line.166"></a>
+<FONT color="green">167</FONT>        public abstract FieldMatrix&lt;T&gt; copy();<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>        /** {@inheritDoc} */<a name="line.169"></a>
+<FONT color="green">170</FONT>        public FieldMatrix&lt;T&gt; add(FieldMatrix&lt;T&gt; m) throws IllegalArgumentException {<a name="line.170"></a>
+<FONT color="green">171</FONT>    <a name="line.171"></a>
+<FONT color="green">172</FONT>            // safety check<a name="line.172"></a>
+<FONT color="green">173</FONT>            checkAdditionCompatible(m);<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>            final int rowCount    = getRowDimension();<a name="line.175"></a>
+<FONT color="green">176</FONT>            final int columnCount = getColumnDimension();<a name="line.176"></a>
+<FONT color="green">177</FONT>            final FieldMatrix&lt;T&gt; out = createMatrix(rowCount, columnCount);<a name="line.177"></a>
+<FONT color="green">178</FONT>            for (int row = 0; row &lt; rowCount; ++row) {<a name="line.178"></a>
+<FONT color="green">179</FONT>                for (int col = 0; col &lt; columnCount; ++col) {<a name="line.179"></a>
+<FONT color="green">180</FONT>                    out.setEntry(row, col, getEntry(row, col).add(m.getEntry(row, col)));<a name="line.180"></a>
+<FONT color="green">181</FONT>                }<a name="line.181"></a>
+<FONT color="green">182</FONT>            }<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>            return out;<a name="line.184"></a>
+<FONT color="green">185</FONT>    <a name="line.185"></a>
+<FONT color="green">186</FONT>        }<a name="line.186"></a>
+<FONT color="green">187</FONT>    <a name="line.187"></a>
+<FONT color="green">188</FONT>        /** {@inheritDoc} */<a name="line.188"></a>
+<FONT color="green">189</FONT>        public FieldMatrix&lt;T&gt; subtract(final FieldMatrix&lt;T&gt; m) throws IllegalArgumentException {<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>            // safety check<a name="line.191"></a>
+<FONT color="green">192</FONT>            checkSubtractionCompatible(m);<a name="line.192"></a>
+<FONT color="green">193</FONT>    <a name="line.193"></a>
+<FONT color="green">194</FONT>            final int rowCount    = getRowDimension();<a name="line.194"></a>
+<FONT color="green">195</FONT>            final int columnCount = getColumnDimension();<a name="line.195"></a>
+<FONT color="green">196</FONT>            final FieldMatrix&lt;T&gt; out = createMatrix(rowCount, columnCount);<a name="line.196"></a>
+<FONT color="green">197</FONT>            for (int row = 0; row &lt; rowCount; ++row) {<a name="line.197"></a>
+<FONT color="green">198</FONT>                for (int col = 0; col &lt; columnCount; ++col) {<a name="line.198"></a>
+<FONT color="green">199</FONT>                    out.setEntry(row, col, getEntry(row, col).subtract(m.getEntry(row, col)));<a name="line.199"></a>
+<FONT color="green">200</FONT>                }<a name="line.200"></a>
+<FONT color="green">201</FONT>            }<a name="line.201"></a>
+<FONT color="green">202</FONT>    <a name="line.202"></a>
+<FONT color="green">203</FONT>            return out;<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>        }<a name="line.205"></a>
+<FONT color="green">206</FONT>    <a name="line.206"></a>
+<FONT color="green">207</FONT>        /** {@inheritDoc} */<a name="line.207"></a>
+<FONT color="green">208</FONT>        public FieldMatrix&lt;T&gt; scalarAdd(final T d) {<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>            final int rowCount    = getRowDimension();<a name="line.210"></a>
+<FONT color="green">211</FONT>            final int columnCount = getColumnDimension();<a name="line.211"></a>
+<FONT color="green">212</FONT>            final FieldMatrix&lt;T&gt; out = createMatrix(rowCount, columnCount);<a name="line.212"></a>
+<FONT color="green">213</FONT>            for (int row = 0; row &lt; rowCount; ++row) {<a name="line.213"></a>
+<FONT color="green">214</FONT>                for (int col = 0; col &lt; columnCount; ++col) {<a name="line.214"></a>
+<FONT color="green">215</FONT>                    out.setEntry(row, col, getEntry(row, col).add(d));<a name="line.215"></a>
+<FONT color="green">216</FONT>                }<a name="line.216"></a>
+<FONT color="green">217</FONT>            }<a name="line.217"></a>
+<FONT color="green">218</FONT>    <a name="line.218"></a>
+<FONT color="green">219</FONT>            return out;<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>        }<a name="line.221"></a>
+<FONT color="green">222</FONT>    <a name="line.222"></a>
+<FONT color="green">223</FONT>        /** {@inheritDoc} */<a name="line.223"></a>
+<FONT color="green">224</FONT>        public FieldMatrix&lt;T&gt; scalarMultiply(final T d) {<a name="line.224"></a>
+<FONT color="green">225</FONT>    <a name="line.225"></a>
+<FONT color="green">226</FONT>            final int rowCount    = getRowDimension();<a name="line.226"></a>
+<FONT color="green">227</FONT>            final int columnCount = getColumnDimension();<a name="line.227"></a>
+<FONT color="green">228</FONT>            final FieldMatrix&lt;T&gt; out = createMatrix(rowCount, columnCount);<a name="line.228"></a>
+<FONT color="green">229</FONT>            for (int row = 0; row &lt; rowCount; ++row) {<a name="line.229"></a>
+<FONT color="green">230</FONT>                for (int col = 0; col &lt; columnCount; ++col) {<a name="line.230"></a>
+<FONT color="green">231</FONT>                    out.setEntry(row, col, getEntry(row, col).multiply(d));<a name="line.231"></a>
+<FONT color="green">232</FONT>                }<a name="line.232"></a>
+<FONT color="green">233</FONT>            }<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>            return out;<a name="line.235"></a>
+<FONT color="green">236</FONT>    <a name="line.236"></a>
+<FONT color="green">237</FONT>        }<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>        /** {@inheritDoc} */<a name="line.239"></a>
+<FONT color="green">240</FONT>        public FieldMatrix&lt;T&gt; multiply(final FieldMatrix&lt;T&gt; m)<a name="line.240"></a>
+<FONT color="green">241</FONT>            throws IllegalArgumentException {<a name="line.241"></a>
+<FONT color="green">242</FONT>    <a name="line.242"></a>
+<FONT color="green">243</FONT>            // safety check<a name="line.243"></a>
+<FONT color="green">244</FONT>            checkMultiplicationCompatible(m);<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>            final int nRows = getRowDimension();<a name="line.246"></a>
+<FONT color="green">247</FONT>            final int nCols = m.getColumnDimension();<a name="line.247"></a>
+<FONT color="green">248</FONT>            final int nSum  = getColumnDimension();<a name="line.248"></a>
+<FONT color="green">249</FONT>            final FieldMatrix&lt;T&gt; out = createMatrix(nRows, nCols);<a name="line.249"></a>
+<FONT color="green">250</FONT>            for (int row = 0; row &lt; nRows; ++row) {<a name="line.250"></a>
+<FONT color="green">251</FONT>                for (int col = 0; col &lt; nCols; ++col) {<a name="line.251"></a>
+<FONT color="green">252</FONT>                    T sum = field.getZero();<a name="line.252"></a>
+<FONT color="green">253</FONT>                    for (int i = 0; i &lt; nSum; ++i) {<a name="line.253"></a>
+<FONT color="green">254</FONT>                        sum = sum.add(getEntry(row, i).multiply(m.getEntry(i, col)));<a name="line.254"></a>
+<FONT color="green">255</FONT>                    }<a name="line.255"></a>
+<FONT color="green">256</FONT>                    out.setEntry(row, col, sum);<a name="line.256"></a>
+<FONT color="green">257</FONT>                }<a name="line.257"></a>
+<FONT color="green">258</FONT>            }<a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>            return out;<a name="line.260"></a>
+<FONT color="green">261</FONT>    <a name="line.261"></a>
+<FONT color="green">262</FONT>        }<a name="line.262"></a>
+<FONT color="green">263</FONT>    <a name="line.263"></a>
+<FONT color="green">264</FONT>        /** {@inheritDoc} */<a name="line.264"></a>
+<FONT color="green">265</FONT>        public FieldMatrix&lt;T&gt; preMultiply(final FieldMatrix&lt;T&gt; m)<a name="line.265"></a>
+<FONT color="green">266</FONT>            throws IllegalArgumentException {<a name="line.266"></a>
+<FONT color="green">267</FONT>            return m.multiply(this);<a name="line.267"></a>
+<FONT color="green">268</FONT>        }<a name="line.268"></a>
+<FONT color="green">269</FONT>    <a name="line.269"></a>
+<FONT color="green">270</FONT>        /** {@inheritDoc} */<a name="line.270"></a>
+<FONT color="green">271</FONT>        public T[][] getData() {<a name="line.271"></a>
+<FONT color="green">272</FONT>    <a name="line.272"></a>
+<FONT color="green">273</FONT>            final T[][] data = buildArray(field, getRowDimension(), getColumnDimension());<a name="line.273"></a>
+<FONT color="green">274</FONT>    <a name="line.274"></a>
+<FONT color="green">275</FONT>            for (int i = 0; i &lt; data.length; ++i) {<a name="line.275"></a>
+<FONT color="green">276</FONT>                final T[] dataI = data[i];<a name="line.276"></a>
+<FONT color="green">277</FONT>                for (int j = 0; j &lt; dataI.length; ++j) {<a name="line.277"></a>
+<FONT color="green">278</FONT>                    dataI[j] = getEntry(i, j);<a name="line.278"></a>
+<FONT color="green">279</FONT>                }<a name="line.279"></a>
+<FONT color="green">280</FONT>            }<a name="line.280"></a>
+<FONT color="green">281</FONT>    <a name="line.281"></a>
+<FONT color="green">282</FONT>            return data;<a name="line.282"></a>
+<FONT color="green">283</FONT>    <a name="line.283"></a>
+<FONT color="green">284</FONT>        }<a name="line.284"></a>
+<FONT color="green">285</FONT>    <a name="line.285"></a>
+<FONT color="green">286</FONT>        /** {@inheritDoc} */<a name="line.286"></a>
+<FONT color="green">287</FONT>        public FieldMatrix&lt;T&gt; getSubMatrix(final int startRow, final int endRow,<a name="line.287"></a>
+<FONT color="green">288</FONT>                                       final int startColumn, final int endColumn)<a name="line.288"></a>
+<FONT color="green">289</FONT>            throws MatrixIndexException {<a name="line.289"></a>
+<FONT color="green">290</FONT>    <a name="line.290"></a>
+<FONT color="green">291</FONT>            checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);<a name="line.291"></a>
+<FONT color="green">292</FONT>    <a name="line.292"></a>
+<FONT color="green">293</FONT>            final FieldMatrix&lt;T&gt; subMatrix =<a name="line.293"></a>
+<FONT color="green">294</FONT>                createMatrix(endRow - startRow + 1, endColumn - startColumn + 1);<a name="line.294"></a>
+<FONT color="green">295</FONT>            for (int i = startRow; i &lt;= endRow; ++i) {<a name="line.295"></a>
+<FONT color="green">296</FONT>                for (int j = startColumn; j &lt;= endColumn; ++j) {<a name="line.296"></a>
+<FONT color="green">297</FONT>                    subMatrix.setEntry(i - startRow, j - startColumn, getEntry(i, j));<a name="line.297"></a>
+<FONT color="green">298</FONT>                }<a name="line.298"></a>
+<FONT color="green">299</FONT>            }<a name="line.299"></a>
+<FONT color="green">300</FONT>    <a name="line.300"></a>
+<FONT color="green">301</FONT>            return subMatrix;<a name="line.301"></a>
+<FONT color="green">302</FONT>    <a name="line.302"></a>
+<FONT color="green">303</FONT>        }<a name="line.303"></a>
+<FONT color="green">304</FONT>    <a name="line.304"></a>
+<FONT color="green">305</FONT>        /** {@inheritDoc} */<a name="line.305"></a>
+<FONT color="green">306</FONT>        public FieldMatrix&lt;T&gt; getSubMatrix(final int[] selectedRows, final int[] selectedColumns)<a name="line.306"></a>
+<FONT color="green">307</FONT>            throws MatrixIndexException {<a name="line.307"></a>
+<FONT color="green">308</FONT>    <a name="line.308"></a>
+<FONT color="green">309</FONT>            // safety checks<a name="line.309"></a>
+<FONT color="green">310</FONT>            checkSubMatrixIndex(selectedRows, selectedColumns);<a name="line.310"></a>
+<FONT color="green">311</FONT>    <a name="line.311"></a>
+<FONT color="green">312</FONT>            // copy entries<a name="line.312"></a>
+<FONT color="green">313</FONT>            final FieldMatrix&lt;T&gt; subMatrix =<a name="line.313"></a>
+<FONT color="green">314</FONT>                createMatrix(selectedRows.length, selectedColumns.length);<a name="line.314"></a>
+<FONT color="green">315</FONT>            subMatrix.walkInOptimizedOrder(new DefaultFieldMatrixChangingVisitor&lt;T&gt;(field.getZero()) {<a name="line.315"></a>
+<FONT color="green">316</FONT>    <a name="line.316"></a>
+<FONT color="green">317</FONT>                /** {@inheritDoc} */<a name="line.317"></a>
+<FONT color="green">318</FONT>                @Override<a name="line.318"></a>
+<FONT color="green">319</FONT>                public T visit(final int row, final int column, final T value) {<a name="line.319"></a>
+<FONT color="green">320</FONT>                    return getEntry(selectedRows[row], selectedColumns[column]);<a name="line.320"></a>
+<FONT color="green">321</FONT>                }<a name="line.321"></a>
+<FONT color="green">322</FONT>    <a name="line.322"></a>
+<FONT color="green">323</FONT>            });<a name="line.323"></a>
+<FONT color="green">324</FONT>    <a name="line.324"></a>
+<FONT color="green">325</FONT>            return subMatrix;<a name="line.325"></a>
+<FONT color="green">326</FONT>    <a name="line.326"></a>
+<FONT color="green">327</FONT>        }<a name="line.327"></a>
+<FONT color="green">328</FONT>    <a name="line.328"></a>
+<FONT color="green">329</FONT>        /** {@inheritDoc} */<a name="line.329"></a>
+<FONT color="green">330</FONT>        public void copySubMatrix(final int startRow, final int endRow,<a name="line.330"></a>
+<FONT color="green">331</FONT>                                  final int startColumn, final int endColumn,<a name="line.331"></a>
+<FONT color="green">332</FONT>                                  final T[][] destination)<a name="line.332"></a>
+<FONT color="green">333</FONT>            throws MatrixIndexException, IllegalArgumentException {<a name="line.333"></a>
+<FONT color="green">334</FONT>    <a name="line.334"></a>
+<FONT color="green">335</FONT>            // safety checks<a name="line.335"></a>
+<FONT color="green">336</FONT>            checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);<a name="line.336"></a>
+<FONT color="green">337</FONT>            final int rowsCount    = endRow + 1 - startRow;<a name="line.337"></a>
+<FONT color="green">338</FONT>            final int columnsCount = endColumn + 1 - startColumn;<a name="line.338"></a>
+<FONT color="green">339</FONT>            if ((destination.length &lt; rowsCount) || (destination[0].length &lt; columnsCount)) {<a name="line.339"></a>
+<FONT color="green">340</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.340"></a>
+<FONT color="green">341</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.341"></a>
+<FONT color="green">342</FONT>                        destination.length, destination[0].length,<a name="line.342"></a>
+<FONT color="green">343</FONT>                        rowsCount, columnsCount);<a name="line.343"></a>
+<FONT color="green">344</FONT>            }<a name="line.344"></a>
+<FONT color="green">345</FONT>    <a name="line.345"></a>
+<FONT color="green">346</FONT>            // copy entries<a name="line.346"></a>
+<FONT color="green">347</FONT>            walkInOptimizedOrder(new DefaultFieldMatrixPreservingVisitor&lt;T&gt;(field.getZero()) {<a name="line.347"></a>
+<FONT color="green">348</FONT>    <a name="line.348"></a>
+<FONT color="green">349</FONT>                /** Initial row index. */<a name="line.349"></a>
+<FONT color="green">350</FONT>                private int startRow;<a name="line.350"></a>
+<FONT color="green">351</FONT>    <a name="line.351"></a>
+<FONT color="green">352</FONT>                /** Initial column index. */<a name="line.352"></a>
+<FONT color="green">353</FONT>                private int startColumn;<a name="line.353"></a>
+<FONT color="green">354</FONT>    <a name="line.354"></a>
+<FONT color="green">355</FONT>                /** {@inheritDoc} */<a name="line.355"></a>
+<FONT color="green">356</FONT>                @Override<a name="line.356"></a>
+<FONT color="green">357</FONT>                public void start(final int rows, final int columns,<a name="line.357"></a>
+<FONT color="green">358</FONT>                                  final int startRow, final int endRow,<a name="line.358"></a>
+<FONT color="green">359</FONT>                                  final int startColumn, final int endColumn) {<a name="line.359"></a>
+<FONT color="green">360</FONT>                    this.startRow    = startRow;<a name="line.360"></a>
+<FONT color="green">361</FONT>                    this.startColumn = startColumn;<a name="line.361"></a>
+<FONT color="green">362</FONT>                }<a name="line.362"></a>
+<FONT color="green">363</FONT>    <a name="line.363"></a>
+<FONT color="green">364</FONT>                /** {@inheritDoc} */<a name="line.364"></a>
+<FONT color="green">365</FONT>                @Override<a name="line.365"></a>
+<FONT color="green">366</FONT>                public void visit(final int row, final int column, final T value) {<a name="line.366"></a>
+<FONT color="green">367</FONT>                    destination[row - startRow][column - startColumn] = value;<a name="line.367"></a>
+<FONT color="green">368</FONT>                }<a name="line.368"></a>
+<FONT color="green">369</FONT>    <a name="line.369"></a>
+<FONT color="green">370</FONT>            }, startRow, endRow, startColumn, endColumn);<a name="line.370"></a>
+<FONT color="green">371</FONT>    <a name="line.371"></a>
+<FONT color="green">372</FONT>        }<a name="line.372"></a>
+<FONT color="green">373</FONT>    <a name="line.373"></a>
+<FONT color="green">374</FONT>        /** {@inheritDoc} */<a name="line.374"></a>
+<FONT color="green">375</FONT>        public void copySubMatrix(int[] selectedRows, int[] selectedColumns, T[][] destination)<a name="line.375"></a>
+<FONT color="green">376</FONT>            throws MatrixIndexException, IllegalArgumentException {<a name="line.376"></a>
+<FONT color="green">377</FONT>    <a name="line.377"></a>
+<FONT color="green">378</FONT>            // safety checks<a name="line.378"></a>
+<FONT color="green">379</FONT>            checkSubMatrixIndex(selectedRows, selectedColumns);<a name="line.379"></a>
+<FONT color="green">380</FONT>            if ((destination.length &lt; selectedRows.length) ||<a name="line.380"></a>
+<FONT color="green">381</FONT>                (destination[0].length &lt; selectedColumns.length)) {<a name="line.381"></a>
+<FONT color="green">382</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.382"></a>
+<FONT color="green">383</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.383"></a>
+<FONT color="green">384</FONT>                        destination.length, destination[0].length,<a name="line.384"></a>
+<FONT color="green">385</FONT>                        selectedRows.length, selectedColumns.length);<a name="line.385"></a>
+<FONT color="green">386</FONT>            }<a name="line.386"></a>
+<FONT color="green">387</FONT>    <a name="line.387"></a>
+<FONT color="green">388</FONT>            // copy entries<a name="line.388"></a>
+<FONT color="green">389</FONT>            for (int i = 0; i &lt; selectedRows.length; i++) {<a name="line.389"></a>
+<FONT color="green">390</FONT>                final T[] destinationI = destination[i];<a name="line.390"></a>
+<FONT color="green">391</FONT>                for (int j = 0; j &lt; selectedColumns.length; j++) {<a name="line.391"></a>
+<FONT color="green">392</FONT>                    destinationI[j] = getEntry(selectedRows[i], selectedColumns[j]);<a name="line.392"></a>
+<FONT color="green">393</FONT>                }<a name="line.393"></a>
+<FONT color="green">394</FONT>            }<a name="line.394"></a>
+<FONT color="green">395</FONT>    <a name="line.395"></a>
+<FONT color="green">396</FONT>        }<a name="line.396"></a>
+<FONT color="green">397</FONT>    <a name="line.397"></a>
+<FONT color="green">398</FONT>        /** {@inheritDoc} */<a name="line.398"></a>
+<FONT color="green">399</FONT>        public void setSubMatrix(final T[][] subMatrix, final int row, final int column)<a name="line.399"></a>
+<FONT color="green">400</FONT>            throws MatrixIndexException {<a name="line.400"></a>
+<FONT color="green">401</FONT>    <a name="line.401"></a>
+<FONT color="green">402</FONT>            final int nRows = subMatrix.length;<a name="line.402"></a>
+<FONT color="green">403</FONT>            if (nRows == 0) {<a name="line.403"></a>
+<FONT color="green">404</FONT>                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");<a name="line.404"></a>
+<FONT color="green">405</FONT>            }<a name="line.405"></a>
+<FONT color="green">406</FONT>    <a name="line.406"></a>
+<FONT color="green">407</FONT>            final int nCols = subMatrix[0].length;<a name="line.407"></a>
+<FONT color="green">408</FONT>            if (nCols == 0) {<a name="line.408"></a>
+<FONT color="green">409</FONT>                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");<a name="line.409"></a>
+<FONT color="green">410</FONT>            }<a name="line.410"></a>
+<FONT color="green">411</FONT>    <a name="line.411"></a>
+<FONT color="green">412</FONT>            for (int r = 1; r &lt; nRows; ++r) {<a name="line.412"></a>
+<FONT color="green">413</FONT>                if (subMatrix[r].length != nCols) {<a name="line.413"></a>
+<FONT color="green">414</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.414"></a>
+<FONT color="green">415</FONT>                            "some rows have length {0} while others have length {1}",<a name="line.415"></a>
+<FONT color="green">416</FONT>                            nCols, subMatrix[r].length);<a name="line.416"></a>
+<FONT color="green">417</FONT>                }<a name="line.417"></a>
+<FONT color="green">418</FONT>            }<a name="line.418"></a>
+<FONT color="green">419</FONT>    <a name="line.419"></a>
+<FONT color="green">420</FONT>            checkRowIndex(row);<a name="line.420"></a>
+<FONT color="green">421</FONT>            checkColumnIndex(column);<a name="line.421"></a>
+<FONT color="green">422</FONT>            checkRowIndex(nRows + row - 1);<a name="line.422"></a>
+<FONT color="green">423</FONT>            checkColumnIndex(nCols + column - 1);<a name="line.423"></a>
+<FONT color="green">424</FONT>    <a name="line.424"></a>
+<FONT color="green">425</FONT>            for (int i = 0; i &lt; nRows; ++i) {<a name="line.425"></a>
+<FONT color="green">426</FONT>                for (int j = 0; j &lt; nCols; ++j) {<a name="line.426"></a>
+<FONT color="green">427</FONT>                    setEntry(row + i, column + j, subMatrix[i][j]);<a name="line.427"></a>
+<FONT color="green">428</FONT>                }<a name="line.428"></a>
+<FONT color="green">429</FONT>            }<a name="line.429"></a>
+<FONT color="green">430</FONT>    <a name="line.430"></a>
+<FONT color="green">431</FONT>        }<a name="line.431"></a>
+<FONT color="green">432</FONT>    <a name="line.432"></a>
+<FONT color="green">433</FONT>        /** {@inheritDoc} */<a name="line.433"></a>
+<FONT color="green">434</FONT>        public FieldMatrix&lt;T&gt; getRowMatrix(final int row)<a name="line.434"></a>
+<FONT color="green">435</FONT>            throws MatrixIndexException {<a name="line.435"></a>
+<FONT color="green">436</FONT>    <a name="line.436"></a>
+<FONT color="green">437</FONT>            checkRowIndex(row);<a name="line.437"></a>
+<FONT color="green">438</FONT>            final int nCols = getColumnDimension();<a name="line.438"></a>
+<FONT color="green">439</FONT>            final FieldMatrix&lt;T&gt; out = createMatrix(1, nCols);<a name="line.439"></a>
+<FONT color="green">440</FONT>            for (int i = 0; i &lt; nCols; ++i) {<a name="line.440"></a>
+<FONT color="green">441</FONT>                out.setEntry(0, i, getEntry(row, i));<a name="line.441"></a>
+<FONT color="green">442</FONT>            }<a name="line.442"></a>
+<FONT color="green">443</FONT>    <a name="line.443"></a>
+<FONT color="green">444</FONT>            return out;<a name="line.444"></a>
+<FONT color="green">445</FONT>    <a name="line.445"></a>
+<FONT color="green">446</FONT>        }<a name="line.446"></a>
+<FONT color="green">447</FONT>    <a name="line.447"></a>
+<FONT color="green">448</FONT>        /** {@inheritDoc} */<a name="line.448"></a>
+<FONT color="green">449</FONT>        public void setRowMatrix(final int row, final FieldMatrix&lt;T&gt; matrix)<a name="line.449"></a>
+<FONT color="green">450</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.450"></a>
+<FONT color="green">451</FONT>    <a name="line.451"></a>
+<FONT color="green">452</FONT>            checkRowIndex(row);<a name="line.452"></a>
+<FONT color="green">453</FONT>            final int nCols = getColumnDimension();<a name="line.453"></a>
+<FONT color="green">454</FONT>            if ((matrix.getRowDimension() != 1) ||<a name="line.454"></a>
+<FONT color="green">455</FONT>                (matrix.getColumnDimension() != nCols)) {<a name="line.455"></a>
+<FONT color="green">456</FONT>                throw new InvalidMatrixException(<a name="line.456"></a>
+<FONT color="green">457</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.457"></a>
+<FONT color="green">458</FONT>                        matrix.getRowDimension(), matrix.getColumnDimension(), 1, nCols);<a name="line.458"></a>
+<FONT color="green">459</FONT>            }<a name="line.459"></a>
+<FONT color="green">460</FONT>            for (int i = 0; i &lt; nCols; ++i) {<a name="line.460"></a>
+<FONT color="green">461</FONT>                setEntry(row, i, matrix.getEntry(0, i));<a name="line.461"></a>
+<FONT color="green">462</FONT>            }<a name="line.462"></a>
+<FONT color="green">463</FONT>    <a name="line.463"></a>
+<FONT color="green">464</FONT>        }<a name="line.464"></a>
+<FONT color="green">465</FONT>    <a name="line.465"></a>
+<FONT color="green">466</FONT>        /** {@inheritDoc} */<a name="line.466"></a>
+<FONT color="green">467</FONT>        public FieldMatrix&lt;T&gt; getColumnMatrix(final int column)<a name="line.467"></a>
+<FONT color="green">468</FONT>            throws MatrixIndexException {<a name="line.468"></a>
+<FONT color="green">469</FONT>    <a name="line.469"></a>
+<FONT color="green">470</FONT>            checkColumnIndex(column);<a name="line.470"></a>
+<FONT color="green">471</FONT>            final int nRows = getRowDimension();<a name="line.471"></a>
+<FONT color="green">472</FONT>            final FieldMatrix&lt;T&gt; out = createMatrix(nRows, 1);<a name="line.472"></a>
+<FONT color="green">473</FONT>            for (int i = 0; i &lt; nRows; ++i) {<a name="line.473"></a>
+<FONT color="green">474</FONT>                out.setEntry(i, 0, getEntry(i, column));<a name="line.474"></a>
+<FONT color="green">475</FONT>            }<a name="line.475"></a>
+<FONT color="green">476</FONT>    <a name="line.476"></a>
+<FONT color="green">477</FONT>            return out;<a name="line.477"></a>
+<FONT color="green">478</FONT>    <a name="line.478"></a>
+<FONT color="green">479</FONT>        }<a name="line.479"></a>
+<FONT color="green">480</FONT>    <a name="line.480"></a>
+<FONT color="green">481</FONT>        /** {@inheritDoc} */<a name="line.481"></a>
+<FONT color="green">482</FONT>        public void setColumnMatrix(final int column, final FieldMatrix&lt;T&gt; matrix)<a name="line.482"></a>
+<FONT color="green">483</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.483"></a>
+<FONT color="green">484</FONT>    <a name="line.484"></a>
+<FONT color="green">485</FONT>            checkColumnIndex(column);<a name="line.485"></a>
+<FONT color="green">486</FONT>            final int nRows = getRowDimension();<a name="line.486"></a>
+<FONT color="green">487</FONT>            if ((matrix.getRowDimension() != nRows) ||<a name="line.487"></a>
+<FONT color="green">488</FONT>                (matrix.getColumnDimension() != 1)) {<a name="line.488"></a>
+<FONT color="green">489</FONT>                throw new InvalidMatrixException(<a name="line.489"></a>
+<FONT color="green">490</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.490"></a>
+<FONT color="green">491</FONT>                        matrix.getRowDimension(), matrix.getColumnDimension(), nRows, 1);<a name="line.491"></a>
+<FONT color="green">492</FONT>            }<a name="line.492"></a>
+<FONT color="green">493</FONT>            for (int i = 0; i &lt; nRows; ++i) {<a name="line.493"></a>
+<FONT color="green">494</FONT>                setEntry(i, column, matrix.getEntry(i, 0));<a name="line.494"></a>
+<FONT color="green">495</FONT>            }<a name="line.495"></a>
+<FONT color="green">496</FONT>    <a name="line.496"></a>
+<FONT color="green">497</FONT>        }<a name="line.497"></a>
+<FONT color="green">498</FONT>    <a name="line.498"></a>
+<FONT color="green">499</FONT>        /** {@inheritDoc} */<a name="line.499"></a>
+<FONT color="green">500</FONT>        public FieldVector&lt;T&gt; getRowVector(final int row)<a name="line.500"></a>
+<FONT color="green">501</FONT>            throws MatrixIndexException {<a name="line.501"></a>
+<FONT color="green">502</FONT>            return new ArrayFieldVector&lt;T&gt;(getRow(row), false);<a name="line.502"></a>
+<FONT color="green">503</FONT>        }<a name="line.503"></a>
+<FONT color="green">504</FONT>    <a name="line.504"></a>
+<FONT color="green">505</FONT>        /** {@inheritDoc} */<a name="line.505"></a>
+<FONT color="green">506</FONT>        public void setRowVector(final int row, final FieldVector&lt;T&gt; vector)<a name="line.506"></a>
+<FONT color="green">507</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.507"></a>
+<FONT color="green">508</FONT>    <a name="line.508"></a>
+<FONT color="green">509</FONT>            checkRowIndex(row);<a name="line.509"></a>
+<FONT color="green">510</FONT>            final int nCols = getColumnDimension();<a name="line.510"></a>
+<FONT color="green">511</FONT>            if (vector.getDimension() != nCols) {<a name="line.511"></a>
+<FONT color="green">512</FONT>                throw new InvalidMatrixException(<a name="line.512"></a>
+<FONT color="green">513</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.513"></a>
+<FONT color="green">514</FONT>                        1, vector.getDimension(), 1, nCols);<a name="line.514"></a>
+<FONT color="green">515</FONT>            }<a name="line.515"></a>
+<FONT color="green">516</FONT>            for (int i = 0; i &lt; nCols; ++i) {<a name="line.516"></a>
+<FONT color="green">517</FONT>                setEntry(row, i, vector.getEntry(i));<a name="line.517"></a>
+<FONT color="green">518</FONT>            }<a name="line.518"></a>
+<FONT color="green">519</FONT>    <a name="line.519"></a>
+<FONT color="green">520</FONT>        }<a name="line.520"></a>
+<FONT color="green">521</FONT>    <a name="line.521"></a>
+<FONT color="green">522</FONT>        /** {@inheritDoc} */<a name="line.522"></a>
+<FONT color="green">523</FONT>        public FieldVector&lt;T&gt; getColumnVector(final int column)<a name="line.523"></a>
+<FONT color="green">524</FONT>            throws MatrixIndexException {<a name="line.524"></a>
+<FONT color="green">525</FONT>            return new ArrayFieldVector&lt;T&gt;(getColumn(column), false);<a name="line.525"></a>
+<FONT color="green">526</FONT>        }<a name="line.526"></a>
+<FONT color="green">527</FONT>    <a name="line.527"></a>
+<FONT color="green">528</FONT>        /** {@inheritDoc} */<a name="line.528"></a>
+<FONT color="green">529</FONT>        public void setColumnVector(final int column, final FieldVector&lt;T&gt; vector)<a name="line.529"></a>
+<FONT color="green">530</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.530"></a>
+<FONT color="green">531</FONT>    <a name="line.531"></a>
+<FONT color="green">532</FONT>            checkColumnIndex(column);<a name="line.532"></a>
+<FONT color="green">533</FONT>            final int nRows = getRowDimension();<a name="line.533"></a>
+<FONT color="green">534</FONT>            if (vector.getDimension() != nRows) {<a name="line.534"></a>
+<FONT color="green">535</FONT>                throw new InvalidMatrixException(<a name="line.535"></a>
+<FONT color="green">536</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.536"></a>
+<FONT color="green">537</FONT>                        vector.getDimension(), 1, nRows, 1);<a name="line.537"></a>
+<FONT color="green">538</FONT>            }<a name="line.538"></a>
+<FONT color="green">539</FONT>            for (int i = 0; i &lt; nRows; ++i) {<a name="line.539"></a>
+<FONT color="green">540</FONT>                setEntry(i, column, vector.getEntry(i));<a name="line.540"></a>
+<FONT color="green">541</FONT>            }<a name="line.541"></a>
+<FONT color="green">542</FONT>    <a name="line.542"></a>
+<FONT color="green">543</FONT>        }<a name="line.543"></a>
+<FONT color="green">544</FONT>    <a name="line.544"></a>
+<FONT color="green">545</FONT>        /** {@inheritDoc} */<a name="line.545"></a>
+<FONT color="green">546</FONT>        public T[] getRow(final int row)<a name="line.546"></a>
+<FONT color="green">547</FONT>            throws MatrixIndexException {<a name="line.547"></a>
+<FONT color="green">548</FONT>    <a name="line.548"></a>
+<FONT color="green">549</FONT>            checkRowIndex(row);<a name="line.549"></a>
+<FONT color="green">550</FONT>            final int nCols = getColumnDimension();<a name="line.550"></a>
+<FONT color="green">551</FONT>            final T[] out = buildArray(field, nCols);<a name="line.551"></a>
+<FONT color="green">552</FONT>            for (int i = 0; i &lt; nCols; ++i) {<a name="line.552"></a>
+<FONT color="green">553</FONT>                out[i] = getEntry(row, i);<a name="line.553"></a>
+<FONT color="green">554</FONT>            }<a name="line.554"></a>
+<FONT color="green">555</FONT>    <a name="line.555"></a>
+<FONT color="green">556</FONT>            return out;<a name="line.556"></a>
+<FONT color="green">557</FONT>    <a name="line.557"></a>
+<FONT color="green">558</FONT>        }<a name="line.558"></a>
+<FONT color="green">559</FONT>    <a name="line.559"></a>
+<FONT color="green">560</FONT>        /** {@inheritDoc} */<a name="line.560"></a>
+<FONT color="green">561</FONT>        public void setRow(final int row, final T[] array)<a name="line.561"></a>
+<FONT color="green">562</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.562"></a>
+<FONT color="green">563</FONT>    <a name="line.563"></a>
+<FONT color="green">564</FONT>            checkRowIndex(row);<a name="line.564"></a>
+<FONT color="green">565</FONT>            final int nCols = getColumnDimension();<a name="line.565"></a>
+<FONT color="green">566</FONT>            if (array.length != nCols) {<a name="line.566"></a>
+<FONT color="green">567</FONT>                throw new InvalidMatrixException(<a name="line.567"></a>
+<FONT color="green">568</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.568"></a>
+<FONT color="green">569</FONT>                        1, array.length, 1, nCols);<a name="line.569"></a>
+<FONT color="green">570</FONT>            }<a name="line.570"></a>
+<FONT color="green">571</FONT>            for (int i = 0; i &lt; nCols; ++i) {<a name="line.571"></a>
+<FONT color="green">572</FONT>                setEntry(row, i, array[i]);<a name="line.572"></a>
+<FONT color="green">573</FONT>            }<a name="line.573"></a>
+<FONT color="green">574</FONT>    <a name="line.574"></a>
+<FONT color="green">575</FONT>        }<a name="line.575"></a>
+<FONT color="green">576</FONT>    <a name="line.576"></a>
+<FONT color="green">577</FONT>        /** {@inheritDoc} */<a name="line.577"></a>
+<FONT color="green">578</FONT>        public T[] getColumn(final int column)<a name="line.578"></a>
+<FONT color="green">579</FONT>            throws MatrixIndexException {<a name="line.579"></a>
+<FONT color="green">580</FONT>    <a name="line.580"></a>
+<FONT color="green">581</FONT>            checkColumnIndex(column);<a name="line.581"></a>
+<FONT color="green">582</FONT>            final int nRows = getRowDimension();<a name="line.582"></a>
+<FONT color="green">583</FONT>            final T[] out = buildArray(field, nRows);<a name="line.583"></a>
+<FONT color="green">584</FONT>            for (int i = 0; i &lt; nRows; ++i) {<a name="line.584"></a>
+<FONT color="green">585</FONT>                out[i] = getEntry(i, column);<a name="line.585"></a>
+<FONT color="green">586</FONT>            }<a name="line.586"></a>
+<FONT color="green">587</FONT>    <a name="line.587"></a>
+<FONT color="green">588</FONT>            return out;<a name="line.588"></a>
+<FONT color="green">589</FONT>    <a name="line.589"></a>
+<FONT color="green">590</FONT>        }<a name="line.590"></a>
+<FONT color="green">591</FONT>    <a name="line.591"></a>
+<FONT color="green">592</FONT>        /** {@inheritDoc} */<a name="line.592"></a>
+<FONT color="green">593</FONT>        public void setColumn(final int column, final T[] array)<a name="line.593"></a>
+<FONT color="green">594</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.594"></a>
+<FONT color="green">595</FONT>    <a name="line.595"></a>
+<FONT color="green">596</FONT>            checkColumnIndex(column);<a name="line.596"></a>
+<FONT color="green">597</FONT>            final int nRows = getRowDimension();<a name="line.597"></a>
+<FONT color="green">598</FONT>            if (array.length != nRows) {<a name="line.598"></a>
+<FONT color="green">599</FONT>                throw new InvalidMatrixException(<a name="line.599"></a>
+<FONT color="green">600</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.600"></a>
+<FONT color="green">601</FONT>                        array.length, 1, nRows, 1);<a name="line.601"></a>
+<FONT color="green">602</FONT>            }<a name="line.602"></a>
+<FONT color="green">603</FONT>            for (int i = 0; i &lt; nRows; ++i) {<a name="line.603"></a>
+<FONT color="green">604</FONT>                setEntry(i, column, array[i]);<a name="line.604"></a>
+<FONT color="green">605</FONT>            }<a name="line.605"></a>
+<FONT color="green">606</FONT>    <a name="line.606"></a>
+<FONT color="green">607</FONT>        }<a name="line.607"></a>
+<FONT color="green">608</FONT>    <a name="line.608"></a>
+<FONT color="green">609</FONT>        /** {@inheritDoc} */<a name="line.609"></a>
+<FONT color="green">610</FONT>        public abstract T getEntry(int row, int column)<a name="line.610"></a>
+<FONT color="green">611</FONT>            throws MatrixIndexException;<a name="line.611"></a>
+<FONT color="green">612</FONT>    <a name="line.612"></a>
+<FONT color="green">613</FONT>        /** {@inheritDoc} */<a name="line.613"></a>
+<FONT color="green">614</FONT>        public abstract void setEntry(int row, int column, T value)<a name="line.614"></a>
+<FONT color="green">615</FONT>            throws MatrixIndexException;<a name="line.615"></a>
+<FONT color="green">616</FONT>    <a name="line.616"></a>
+<FONT color="green">617</FONT>        /** {@inheritDoc} */<a name="line.617"></a>
+<FONT color="green">618</FONT>        public abstract void addToEntry(int row, int column, T increment)<a name="line.618"></a>
+<FONT color="green">619</FONT>            throws MatrixIndexException;<a name="line.619"></a>
+<FONT color="green">620</FONT>    <a name="line.620"></a>
+<FONT color="green">621</FONT>        /** {@inheritDoc} */<a name="line.621"></a>
+<FONT color="green">622</FONT>        public abstract void multiplyEntry(int row, int column, T factor)<a name="line.622"></a>
+<FONT color="green">623</FONT>            throws MatrixIndexException;<a name="line.623"></a>
+<FONT color="green">624</FONT>    <a name="line.624"></a>
+<FONT color="green">625</FONT>        /** {@inheritDoc} */<a name="line.625"></a>
+<FONT color="green">626</FONT>        public FieldMatrix&lt;T&gt; transpose() {<a name="line.626"></a>
+<FONT color="green">627</FONT>    <a name="line.627"></a>
+<FONT color="green">628</FONT>            final int nRows = getRowDimension();<a name="line.628"></a>
+<FONT color="green">629</FONT>            final int nCols = getColumnDimension();<a name="line.629"></a>
+<FONT color="green">630</FONT>            final FieldMatrix&lt;T&gt; out = createMatrix(nCols, nRows);<a name="line.630"></a>
+<FONT color="green">631</FONT>            walkInOptimizedOrder(new DefaultFieldMatrixPreservingVisitor&lt;T&gt;(field.getZero()) {<a name="line.631"></a>
+<FONT color="green">632</FONT>    <a name="line.632"></a>
+<FONT color="green">633</FONT>                /** {@inheritDoc} */<a name="line.633"></a>
+<FONT color="green">634</FONT>                @Override<a name="line.634"></a>
+<FONT color="green">635</FONT>                public void visit(final int row, final int column, final T value) {<a name="line.635"></a>
+<FONT color="green">636</FONT>                    out.setEntry(column, row, value);<a name="line.636"></a>
+<FONT color="green">637</FONT>                }<a name="line.637"></a>
+<FONT color="green">638</FONT>    <a name="line.638"></a>
+<FONT color="green">639</FONT>            });<a name="line.639"></a>
+<FONT color="green">640</FONT>    <a name="line.640"></a>
+<FONT color="green">641</FONT>            return out;<a name="line.641"></a>
+<FONT color="green">642</FONT>    <a name="line.642"></a>
+<FONT color="green">643</FONT>        }<a name="line.643"></a>
+<FONT color="green">644</FONT>    <a name="line.644"></a>
+<FONT color="green">645</FONT>        /** {@inheritDoc} */<a name="line.645"></a>
+<FONT color="green">646</FONT>        public boolean isSquare() {<a name="line.646"></a>
+<FONT color="green">647</FONT>            return getColumnDimension() == getRowDimension();<a name="line.647"></a>
+<FONT color="green">648</FONT>        }<a name="line.648"></a>
+<FONT color="green">649</FONT>    <a name="line.649"></a>
+<FONT color="green">650</FONT>        /** {@inheritDoc} */<a name="line.650"></a>
+<FONT color="green">651</FONT>        public abstract int getRowDimension();<a name="line.651"></a>
+<FONT color="green">652</FONT>    <a name="line.652"></a>
+<FONT color="green">653</FONT>        /** {@inheritDoc} */<a name="line.653"></a>
+<FONT color="green">654</FONT>        public abstract int getColumnDimension();<a name="line.654"></a>
+<FONT color="green">655</FONT>    <a name="line.655"></a>
+<FONT color="green">656</FONT>        /** {@inheritDoc} */<a name="line.656"></a>
+<FONT color="green">657</FONT>        public T getTrace()<a name="line.657"></a>
+<FONT color="green">658</FONT>            throws NonSquareMatrixException {<a name="line.658"></a>
+<FONT color="green">659</FONT>            final int nRows = getRowDimension();<a name="line.659"></a>
+<FONT color="green">660</FONT>            final int nCols = getColumnDimension();<a name="line.660"></a>
+<FONT color="green">661</FONT>            if (nRows != nCols) {<a name="line.661"></a>
+<FONT color="green">662</FONT>                throw new NonSquareMatrixException(nRows, nCols);<a name="line.662"></a>
+<FONT color="green">663</FONT>           }<a name="line.663"></a>
+<FONT color="green">664</FONT>            T trace = field.getZero();<a name="line.664"></a>
+<FONT color="green">665</FONT>            for (int i = 0; i &lt; nRows; ++i) {<a name="line.665"></a>
+<FONT color="green">666</FONT>                trace = trace.add(getEntry(i, i));<a name="line.666"></a>
+<FONT color="green">667</FONT>            }<a name="line.667"></a>
+<FONT color="green">668</FONT>            return trace;<a name="line.668"></a>
+<FONT color="green">669</FONT>        }<a name="line.669"></a>
+<FONT color="green">670</FONT>    <a name="line.670"></a>
+<FONT color="green">671</FONT>        /** {@inheritDoc} */<a name="line.671"></a>
+<FONT color="green">672</FONT>        public T[] operate(final T[] v)<a name="line.672"></a>
+<FONT color="green">673</FONT>            throws IllegalArgumentException {<a name="line.673"></a>
+<FONT color="green">674</FONT>    <a name="line.674"></a>
+<FONT color="green">675</FONT>            final int nRows = getRowDimension();<a name="line.675"></a>
+<FONT color="green">676</FONT>            final int nCols = getColumnDimension();<a name="line.676"></a>
+<FONT color="green">677</FONT>            if (v.length != nCols) {<a name="line.677"></a>
+<FONT color="green">678</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.678"></a>
+<FONT color="green">679</FONT>                        "vector length mismatch: got {0} but expected {1}",<a name="line.679"></a>
+<FONT color="green">680</FONT>                        v.length, nCols);<a name="line.680"></a>
+<FONT color="green">681</FONT>            }<a name="line.681"></a>
+<FONT color="green">682</FONT>    <a name="line.682"></a>
+<FONT color="green">683</FONT>            final T[] out = buildArray(field, nRows);<a name="line.683"></a>
+<FONT color="green">684</FONT>            for (int row = 0; row &lt; nRows; ++row) {<a name="line.684"></a>
+<FONT color="green">685</FONT>                T sum = field.getZero();<a name="line.685"></a>
+<FONT color="green">686</FONT>                for (int i = 0; i &lt; nCols; ++i) {<a name="line.686"></a>
+<FONT color="green">687</FONT>                    sum = sum.add(getEntry(row, i).multiply(v[i]));<a name="line.687"></a>
+<FONT color="green">688</FONT>                }<a name="line.688"></a>
+<FONT color="green">689</FONT>                out[row] = sum;<a name="line.689"></a>
+<FONT color="green">690</FONT>            }<a name="line.690"></a>
+<FONT color="green">691</FONT>    <a name="line.691"></a>
+<FONT color="green">692</FONT>            return out;<a name="line.692"></a>
+<FONT color="green">693</FONT>    <a name="line.693"></a>
+<FONT color="green">694</FONT>        }<a name="line.694"></a>
+<FONT color="green">695</FONT>    <a name="line.695"></a>
+<FONT color="green">696</FONT>        /** {@inheritDoc} */<a name="line.696"></a>
+<FONT color="green">697</FONT>        public FieldVector&lt;T&gt; operate(final FieldVector&lt;T&gt; v)<a name="line.697"></a>
+<FONT color="green">698</FONT>            throws IllegalArgumentException {<a name="line.698"></a>
+<FONT color="green">699</FONT>            try {<a name="line.699"></a>
+<FONT color="green">700</FONT>                return new ArrayFieldVector&lt;T&gt;(operate(((ArrayFieldVector&lt;T&gt;) v).getDataRef()), false);<a name="line.700"></a>
+<FONT color="green">701</FONT>            } catch (ClassCastException cce) {<a name="line.701"></a>
+<FONT color="green">702</FONT>                final int nRows = getRowDimension();<a name="line.702"></a>
+<FONT color="green">703</FONT>                final int nCols = getColumnDimension();<a name="line.703"></a>
+<FONT color="green">704</FONT>                if (v.getDimension() != nCols) {<a name="line.704"></a>
+<FONT color="green">705</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.705"></a>
+<FONT color="green">706</FONT>                            "vector length mismatch: got {0} but expected {1}",<a name="line.706"></a>
+<FONT color="green">707</FONT>                            v.getDimension(), nCols);<a name="line.707"></a>
+<FONT color="green">708</FONT>                }<a name="line.708"></a>
+<FONT color="green">709</FONT>    <a name="line.709"></a>
+<FONT color="green">710</FONT>                final T[] out = buildArray(field, nRows);<a name="line.710"></a>
+<FONT color="green">711</FONT>                for (int row = 0; row &lt; nRows; ++row) {<a name="line.711"></a>
+<FONT color="green">712</FONT>                    T sum = field.getZero();<a name="line.712"></a>
+<FONT color="green">713</FONT>                    for (int i = 0; i &lt; nCols; ++i) {<a name="line.713"></a>
+<FONT color="green">714</FONT>                        sum = sum.add(getEntry(row, i).multiply(v.getEntry(i)));<a name="line.714"></a>
+<FONT color="green">715</FONT>                    }<a name="line.715"></a>
+<FONT color="green">716</FONT>                    out[row] = sum;<a name="line.716"></a>
+<FONT color="green">717</FONT>                }<a name="line.717"></a>
+<FONT color="green">718</FONT>    <a name="line.718"></a>
+<FONT color="green">719</FONT>                return new ArrayFieldVector&lt;T&gt;(out, false);<a name="line.719"></a>
+<FONT color="green">720</FONT>            }<a name="line.720"></a>
+<FONT color="green">721</FONT>        }<a name="line.721"></a>
+<FONT color="green">722</FONT>    <a name="line.722"></a>
+<FONT color="green">723</FONT>        /** {@inheritDoc} */<a name="line.723"></a>
+<FONT color="green">724</FONT>        public T[] preMultiply(final T[] v)<a name="line.724"></a>
+<FONT color="green">725</FONT>            throws IllegalArgumentException {<a name="line.725"></a>
+<FONT color="green">726</FONT>    <a name="line.726"></a>
+<FONT color="green">727</FONT>            final int nRows = getRowDimension();<a name="line.727"></a>
+<FONT color="green">728</FONT>            final int nCols = getColumnDimension();<a name="line.728"></a>
+<FONT color="green">729</FONT>            if (v.length != nRows) {<a name="line.729"></a>
+<FONT color="green">730</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.730"></a>
+<FONT color="green">731</FONT>                        "vector length mismatch: got {0} but expected {1}",<a name="line.731"></a>
+<FONT color="green">732</FONT>                        v.length, nRows);<a name="line.732"></a>
+<FONT color="green">733</FONT>            }<a name="line.733"></a>
+<FONT color="green">734</FONT>    <a name="line.734"></a>
+<FONT color="green">735</FONT>            final T[] out = buildArray(field, nCols);<a name="line.735"></a>
+<FONT color="green">736</FONT>            for (int col = 0; col &lt; nCols; ++col) {<a name="line.736"></a>
+<FONT color="green">737</FONT>                T sum = field.getZero();<a name="line.737"></a>
+<FONT color="green">738</FONT>                for (int i = 0; i &lt; nRows; ++i) {<a name="line.738"></a>
+<FONT color="green">739</FONT>                    sum = sum.add(getEntry(i, col).multiply(v[i]));<a name="line.739"></a>
+<FONT color="green">740</FONT>                }<a name="line.740"></a>
+<FONT color="green">741</FONT>                out[col] = sum;<a name="line.741"></a>
+<FONT color="green">742</FONT>            }<a name="line.742"></a>
+<FONT color="green">743</FONT>    <a name="line.743"></a>
+<FONT color="green">744</FONT>            return out;<a name="line.744"></a>
+<FONT color="green">745</FONT>    <a name="line.745"></a>
+<FONT color="green">746</FONT>        }<a name="line.746"></a>
+<FONT color="green">747</FONT>    <a name="line.747"></a>
+<FONT color="green">748</FONT>        /** {@inheritDoc} */<a name="line.748"></a>
+<FONT color="green">749</FONT>        public FieldVector&lt;T&gt; preMultiply(final FieldVector&lt;T&gt; v)<a name="line.749"></a>
+<FONT color="green">750</FONT>            throws IllegalArgumentException {<a name="line.750"></a>
+<FONT color="green">751</FONT>            try {<a name="line.751"></a>
+<FONT color="green">752</FONT>                return new ArrayFieldVector&lt;T&gt;(preMultiply(((ArrayFieldVector&lt;T&gt;) v).getDataRef()), false);<a name="line.752"></a>
+<FONT color="green">753</FONT>            } catch (ClassCastException cce) {<a name="line.753"></a>
+<FONT color="green">754</FONT>    <a name="line.754"></a>
+<FONT color="green">755</FONT>                final int nRows = getRowDimension();<a name="line.755"></a>
+<FONT color="green">756</FONT>                final int nCols = getColumnDimension();<a name="line.756"></a>
+<FONT color="green">757</FONT>                if (v.getDimension() != nRows) {<a name="line.757"></a>
+<FONT color="green">758</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.758"></a>
+<FONT color="green">759</FONT>                            "vector length mismatch: got {0} but expected {1}",<a name="line.759"></a>
+<FONT color="green">760</FONT>                            v.getDimension(), nRows);<a name="line.760"></a>
+<FONT color="green">761</FONT>                }<a name="line.761"></a>
+<FONT color="green">762</FONT>    <a name="line.762"></a>
+<FONT color="green">763</FONT>                final T[] out = buildArray(field, nCols);<a name="line.763"></a>
+<FONT color="green">764</FONT>                for (int col = 0; col &lt; nCols; ++col) {<a name="line.764"></a>
+<FONT color="green">765</FONT>                    T sum = field.getZero();<a name="line.765"></a>
+<FONT color="green">766</FONT>                    for (int i = 0; i &lt; nRows; ++i) {<a name="line.766"></a>
+<FONT color="green">767</FONT>                        sum = sum.add(getEntry(i, col).multiply(v.getEntry(i)));<a name="line.767"></a>
+<FONT color="green">768</FONT>                    }<a name="line.768"></a>
+<FONT color="green">769</FONT>                    out[col] = sum;<a name="line.769"></a>
+<FONT color="green">770</FONT>                }<a name="line.770"></a>
+<FONT color="green">771</FONT>    <a name="line.771"></a>
+<FONT color="green">772</FONT>                return new ArrayFieldVector&lt;T&gt;(out);<a name="line.772"></a>
+<FONT color="green">773</FONT>    <a name="line.773"></a>
+<FONT color="green">774</FONT>            }<a name="line.774"></a>
+<FONT color="green">775</FONT>        }<a name="line.775"></a>
+<FONT color="green">776</FONT>    <a name="line.776"></a>
+<FONT color="green">777</FONT>        /** {@inheritDoc} */<a name="line.777"></a>
+<FONT color="green">778</FONT>        public T walkInRowOrder(final FieldMatrixChangingVisitor&lt;T&gt; visitor)<a name="line.778"></a>
+<FONT color="green">779</FONT>            throws MatrixVisitorException {<a name="line.779"></a>
+<FONT color="green">780</FONT>            final int rows    = getRowDimension();<a name="line.780"></a>
+<FONT color="green">781</FONT>            final int columns = getColumnDimension();<a name="line.781"></a>
+<FONT color="green">782</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.782"></a>
+<FONT color="green">783</FONT>            for (int row = 0; row &lt; rows; ++row) {<a name="line.783"></a>
+<FONT color="green">784</FONT>                for (int column = 0; column &lt; columns; ++column) {<a name="line.784"></a>
+<FONT color="green">785</FONT>                    final T oldValue = getEntry(row, column);<a name="line.785"></a>
+<FONT color="green">786</FONT>                    final T newValue = visitor.visit(row, column, oldValue);<a name="line.786"></a>
+<FONT color="green">787</FONT>                    setEntry(row, column, newValue);<a name="line.787"></a>
+<FONT color="green">788</FONT>                }<a name="line.788"></a>
+<FONT color="green">789</FONT>            }<a name="line.789"></a>
+<FONT color="green">790</FONT>            return visitor.end();<a name="line.790"></a>
+<FONT color="green">791</FONT>        }<a name="line.791"></a>
+<FONT color="green">792</FONT>    <a name="line.792"></a>
+<FONT color="green">793</FONT>        /** {@inheritDoc} */<a name="line.793"></a>
+<FONT color="green">794</FONT>        public T walkInRowOrder(final FieldMatrixPreservingVisitor&lt;T&gt; visitor)<a name="line.794"></a>
+<FONT color="green">795</FONT>            throws MatrixVisitorException {<a name="line.795"></a>
+<FONT color="green">796</FONT>            final int rows    = getRowDimension();<a name="line.796"></a>
+<FONT color="green">797</FONT>            final int columns = getColumnDimension();<a name="line.797"></a>
+<FONT color="green">798</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.798"></a>
+<FONT color="green">799</FONT>            for (int row = 0; row &lt; rows; ++row) {<a name="line.799"></a>
+<FONT color="green">800</FONT>                for (int column = 0; column &lt; columns; ++column) {<a name="line.800"></a>
+<FONT color="green">801</FONT>                    visitor.visit(row, column, getEntry(row, column));<a name="line.801"></a>
+<FONT color="green">802</FONT>                }<a name="line.802"></a>
+<FONT color="green">803</FONT>            }<a name="line.803"></a>
+<FONT color="green">804</FONT>            return visitor.end();<a name="line.804"></a>
+<FONT color="green">805</FONT>        }<a name="line.805"></a>
+<FONT color="green">806</FONT>    <a name="line.806"></a>
+<FONT color="green">807</FONT>        /** {@inheritDoc} */<a name="line.807"></a>
+<FONT color="green">808</FONT>        public T walkInRowOrder(final FieldMatrixChangingVisitor&lt;T&gt; visitor,<a name="line.808"></a>
+<FONT color="green">809</FONT>                                final int startRow, final int endRow,<a name="line.809"></a>
+<FONT color="green">810</FONT>                                final int startColumn, final int endColumn)<a name="line.810"></a>
+<FONT color="green">811</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.811"></a>
+<FONT color="green">812</FONT>            checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);<a name="line.812"></a>
+<FONT color="green">813</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.813"></a>
+<FONT color="green">814</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.814"></a>
+<FONT color="green">815</FONT>            for (int row = startRow; row &lt;= endRow; ++row) {<a name="line.815"></a>
+<FONT color="green">816</FONT>                for (int column = startColumn; column &lt;= endColumn; ++column) {<a name="line.816"></a>
+<FONT color="green">817</FONT>                    final T oldValue = getEntry(row, column);<a name="line.817"></a>
+<FONT color="green">818</FONT>                    final T newValue = visitor.visit(row, column, oldValue);<a name="line.818"></a>
+<FONT color="green">819</FONT>                    setEntry(row, column, newValue);<a name="line.819"></a>
+<FONT color="green">820</FONT>                }<a name="line.820"></a>
+<FONT color="green">821</FONT>            }<a name="line.821"></a>
+<FONT color="green">822</FONT>            return visitor.end();<a name="line.822"></a>
+<FONT color="green">823</FONT>        }<a name="line.823"></a>
+<FONT color="green">824</FONT>    <a name="line.824"></a>
+<FONT color="green">825</FONT>        /** {@inheritDoc} */<a name="line.825"></a>
+<FONT color="green">826</FONT>        public T walkInRowOrder(final FieldMatrixPreservingVisitor&lt;T&gt; visitor,<a name="line.826"></a>
+<FONT color="green">827</FONT>                                     final int startRow, final int endRow,<a name="line.827"></a>
+<FONT color="green">828</FONT>                                     final int startColumn, final int endColumn)<a name="line.828"></a>
+<FONT color="green">829</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.829"></a>
+<FONT color="green">830</FONT>            checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);<a name="line.830"></a>
+<FONT color="green">831</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.831"></a>
+<FONT color="green">832</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.832"></a>
+<FONT color="green">833</FONT>            for (int row = startRow; row &lt;= endRow; ++row) {<a name="line.833"></a>
+<FONT color="green">834</FONT>                for (int column = startColumn; column &lt;= endColumn; ++column) {<a name="line.834"></a>
+<FONT color="green">835</FONT>                    visitor.visit(row, column, getEntry(row, column));<a name="line.835"></a>
+<FONT color="green">836</FONT>                }<a name="line.836"></a>
+<FONT color="green">837</FONT>            }<a name="line.837"></a>
+<FONT color="green">838</FONT>            return visitor.end();<a name="line.838"></a>
+<FONT color="green">839</FONT>        }<a name="line.839"></a>
+<FONT color="green">840</FONT>    <a name="line.840"></a>
+<FONT color="green">841</FONT>        /** {@inheritDoc} */<a name="line.841"></a>
+<FONT color="green">842</FONT>        public T walkInColumnOrder(final FieldMatrixChangingVisitor&lt;T&gt; visitor)<a name="line.842"></a>
+<FONT color="green">843</FONT>            throws MatrixVisitorException {<a name="line.843"></a>
+<FONT color="green">844</FONT>            final int rows    = getRowDimension();<a name="line.844"></a>
+<FONT color="green">845</FONT>            final int columns = getColumnDimension();<a name="line.845"></a>
+<FONT color="green">846</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.846"></a>
+<FONT color="green">847</FONT>            for (int column = 0; column &lt; columns; ++column) {<a name="line.847"></a>
+<FONT color="green">848</FONT>                for (int row = 0; row &lt; rows; ++row) {<a name="line.848"></a>
+<FONT color="green">849</FONT>                    final T oldValue = getEntry(row, column);<a name="line.849"></a>
+<FONT color="green">850</FONT>                    final T newValue = visitor.visit(row, column, oldValue);<a name="line.850"></a>
+<FONT color="green">851</FONT>                    setEntry(row, column, newValue);<a name="line.851"></a>
+<FONT color="green">852</FONT>                }<a name="line.852"></a>
+<FONT color="green">853</FONT>            }<a name="line.853"></a>
+<FONT color="green">854</FONT>            return visitor.end();<a name="line.854"></a>
+<FONT color="green">855</FONT>        }<a name="line.855"></a>
+<FONT color="green">856</FONT>    <a name="line.856"></a>
+<FONT color="green">857</FONT>        /** {@inheritDoc} */<a name="line.857"></a>
+<FONT color="green">858</FONT>        public T walkInColumnOrder(final FieldMatrixPreservingVisitor&lt;T&gt; visitor)<a name="line.858"></a>
+<FONT color="green">859</FONT>            throws MatrixVisitorException {<a name="line.859"></a>
+<FONT color="green">860</FONT>            final int rows    = getRowDimension();<a name="line.860"></a>
+<FONT color="green">861</FONT>            final int columns = getColumnDimension();<a name="line.861"></a>
+<FONT color="green">862</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.862"></a>
+<FONT color="green">863</FONT>            for (int column = 0; column &lt; columns; ++column) {<a name="line.863"></a>
+<FONT color="green">864</FONT>                for (int row = 0; row &lt; rows; ++row) {<a name="line.864"></a>
+<FONT color="green">865</FONT>                    visitor.visit(row, column, getEntry(row, column));<a name="line.865"></a>
+<FONT color="green">866</FONT>                }<a name="line.866"></a>
+<FONT color="green">867</FONT>            }<a name="line.867"></a>
+<FONT color="green">868</FONT>            return visitor.end();<a name="line.868"></a>
+<FONT color="green">869</FONT>        }<a name="line.869"></a>
+<FONT color="green">870</FONT>    <a name="line.870"></a>
+<FONT color="green">871</FONT>        /** {@inheritDoc} */<a name="line.871"></a>
+<FONT color="green">872</FONT>        public T walkInColumnOrder(final FieldMatrixChangingVisitor&lt;T&gt; visitor,<a name="line.872"></a>
+<FONT color="green">873</FONT>                                   final int startRow, final int endRow,<a name="line.873"></a>
+<FONT color="green">874</FONT>                                   final int startColumn, final int endColumn)<a name="line.874"></a>
+<FONT color="green">875</FONT>        throws MatrixIndexException, MatrixVisitorException {<a name="line.875"></a>
+<FONT color="green">876</FONT>            checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);<a name="line.876"></a>
+<FONT color="green">877</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.877"></a>
+<FONT color="green">878</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.878"></a>
+<FONT color="green">879</FONT>            for (int column = startColumn; column &lt;= endColumn; ++column) {<a name="line.879"></a>
+<FONT color="green">880</FONT>                for (int row = startRow; row &lt;= endRow; ++row) {<a name="line.880"></a>
+<FONT color="green">881</FONT>                    final T oldValue = getEntry(row, column);<a name="line.881"></a>
+<FONT color="green">882</FONT>                    final T newValue = visitor.visit(row, column, oldValue);<a name="line.882"></a>
+<FONT color="green">883</FONT>                    setEntry(row, column, newValue);<a name="line.883"></a>
+<FONT color="green">884</FONT>                }<a name="line.884"></a>
+<FONT color="green">885</FONT>            }<a name="line.885"></a>
+<FONT color="green">886</FONT>            return visitor.end();<a name="line.886"></a>
+<FONT color="green">887</FONT>        }<a name="line.887"></a>
+<FONT color="green">888</FONT>    <a name="line.888"></a>
+<FONT color="green">889</FONT>        /** {@inheritDoc} */<a name="line.889"></a>
+<FONT color="green">890</FONT>        public T walkInColumnOrder(final FieldMatrixPreservingVisitor&lt;T&gt; visitor,<a name="line.890"></a>
+<FONT color="green">891</FONT>                                   final int startRow, final int endRow,<a name="line.891"></a>
+<FONT color="green">892</FONT>                                   final int startColumn, final int endColumn)<a name="line.892"></a>
+<FONT color="green">893</FONT>        throws MatrixIndexException, MatrixVisitorException {<a name="line.893"></a>
+<FONT color="green">894</FONT>            checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);<a name="line.894"></a>
+<FONT color="green">895</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.895"></a>
+<FONT color="green">896</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.896"></a>
+<FONT color="green">897</FONT>            for (int column = startColumn; column &lt;= endColumn; ++column) {<a name="line.897"></a>
+<FONT color="green">898</FONT>                for (int row = startRow; row &lt;= endRow; ++row) {<a name="line.898"></a>
+<FONT color="green">899</FONT>                    visitor.visit(row, column, getEntry(row, column));<a name="line.899"></a>
+<FONT color="green">900</FONT>                }<a name="line.900"></a>
+<FONT color="green">901</FONT>            }<a name="line.901"></a>
+<FONT color="green">902</FONT>            return visitor.end();<a name="line.902"></a>
+<FONT color="green">903</FONT>        }<a name="line.903"></a>
+<FONT color="green">904</FONT>    <a name="line.904"></a>
+<FONT color="green">905</FONT>        /** {@inheritDoc} */<a name="line.905"></a>
+<FONT color="green">906</FONT>        public T walkInOptimizedOrder(final FieldMatrixChangingVisitor&lt;T&gt; visitor)<a name="line.906"></a>
+<FONT color="green">907</FONT>            throws MatrixVisitorException {<a name="line.907"></a>
+<FONT color="green">908</FONT>            return walkInRowOrder(visitor);<a name="line.908"></a>
+<FONT color="green">909</FONT>        }<a name="line.909"></a>
+<FONT color="green">910</FONT>    <a name="line.910"></a>
+<FONT color="green">911</FONT>        /** {@inheritDoc} */<a name="line.911"></a>
+<FONT color="green">912</FONT>        public T walkInOptimizedOrder(final FieldMatrixPreservingVisitor&lt;T&gt; visitor)<a name="line.912"></a>
+<FONT color="green">913</FONT>            throws MatrixVisitorException {<a name="line.913"></a>
+<FONT color="green">914</FONT>            return walkInRowOrder(visitor);<a name="line.914"></a>
+<FONT color="green">915</FONT>        }<a name="line.915"></a>
+<FONT color="green">916</FONT>    <a name="line.916"></a>
+<FONT color="green">917</FONT>        /** {@inheritDoc} */<a name="line.917"></a>
+<FONT color="green">918</FONT>        public T walkInOptimizedOrder(final FieldMatrixChangingVisitor&lt;T&gt; visitor,<a name="line.918"></a>
+<FONT color="green">919</FONT>                                           final int startRow, final int endRow,<a name="line.919"></a>
+<FONT color="green">920</FONT>                                           final int startColumn, final int endColumn)<a name="line.920"></a>
+<FONT color="green">921</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.921"></a>
+<FONT color="green">922</FONT>            return walkInRowOrder(visitor, startRow, endRow, startColumn, endColumn);<a name="line.922"></a>
+<FONT color="green">923</FONT>        }<a name="line.923"></a>
+<FONT color="green">924</FONT>    <a name="line.924"></a>
+<FONT color="green">925</FONT>        /** {@inheritDoc} */<a name="line.925"></a>
+<FONT color="green">926</FONT>        public T walkInOptimizedOrder(final FieldMatrixPreservingVisitor&lt;T&gt; visitor,<a name="line.926"></a>
+<FONT color="green">927</FONT>                                           final int startRow, final int endRow,<a name="line.927"></a>
+<FONT color="green">928</FONT>                                           final int startColumn, final int endColumn)<a name="line.928"></a>
+<FONT color="green">929</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.929"></a>
+<FONT color="green">930</FONT>            return walkInRowOrder(visitor, startRow, endRow, startColumn, endColumn);<a name="line.930"></a>
+<FONT color="green">931</FONT>        }<a name="line.931"></a>
+<FONT color="green">932</FONT>    <a name="line.932"></a>
+<FONT color="green">933</FONT>        /**<a name="line.933"></a>
+<FONT color="green">934</FONT>         * Get a string representation for this matrix.<a name="line.934"></a>
+<FONT color="green">935</FONT>         * @return a string representation for this matrix<a name="line.935"></a>
+<FONT color="green">936</FONT>         */<a name="line.936"></a>
+<FONT color="green">937</FONT>        @Override<a name="line.937"></a>
+<FONT color="green">938</FONT>        public String toString() {<a name="line.938"></a>
+<FONT color="green">939</FONT>            final int nRows = getRowDimension();<a name="line.939"></a>
+<FONT color="green">940</FONT>            final int nCols = getColumnDimension();<a name="line.940"></a>
+<FONT color="green">941</FONT>            final StringBuffer res = new StringBuffer();<a name="line.941"></a>
+<FONT color="green">942</FONT>            String fullClassName = getClass().getName();<a name="line.942"></a>
+<FONT color="green">943</FONT>            String shortClassName = fullClassName.substring(fullClassName.lastIndexOf('.') + 1);<a name="line.943"></a>
+<FONT color="green">944</FONT>            res.append(shortClassName).append("{");<a name="line.944"></a>
+<FONT color="green">945</FONT>    <a name="line.945"></a>
+<FONT color="green">946</FONT>            for (int i = 0; i &lt; nRows; ++i) {<a name="line.946"></a>
+<FONT color="green">947</FONT>                if (i &gt; 0) {<a name="line.947"></a>
+<FONT color="green">948</FONT>                    res.append(",");<a name="line.948"></a>
+<FONT color="green">949</FONT>                }<a name="line.949"></a>
+<FONT color="green">950</FONT>                res.append("{");<a name="line.950"></a>
+<FONT color="green">951</FONT>                for (int j = 0; j &lt; nCols; ++j) {<a name="line.951"></a>
+<FONT color="green">952</FONT>                    if (j &gt; 0) {<a name="line.952"></a>
+<FONT color="green">953</FONT>                        res.append(",");<a name="line.953"></a>
+<FONT color="green">954</FONT>                    }<a name="line.954"></a>
+<FONT color="green">955</FONT>                    res.append(getEntry(i, j));<a name="line.955"></a>
+<FONT color="green">956</FONT>                }<a name="line.956"></a>
+<FONT color="green">957</FONT>                res.append("}");<a name="line.957"></a>
+<FONT color="green">958</FONT>            }<a name="line.958"></a>
+<FONT color="green">959</FONT>    <a name="line.959"></a>
+<FONT color="green">960</FONT>            res.append("}");<a name="line.960"></a>
+<FONT color="green">961</FONT>            return res.toString();<a name="line.961"></a>
+<FONT color="green">962</FONT>    <a name="line.962"></a>
+<FONT color="green">963</FONT>        }<a name="line.963"></a>
+<FONT color="green">964</FONT>    <a name="line.964"></a>
+<FONT color="green">965</FONT>        /**<a name="line.965"></a>
+<FONT color="green">966</FONT>         * Returns true iff &lt;code&gt;object&lt;/code&gt; is a<a name="line.966"></a>
+<FONT color="green">967</FONT>         * &lt;code&gt;FieldMatrix&lt;/code&gt; instance with the same dimensions as this<a name="line.967"></a>
+<FONT color="green">968</FONT>         * and all corresponding matrix entries are equal.<a name="line.968"></a>
+<FONT color="green">969</FONT>         *<a name="line.969"></a>
+<FONT color="green">970</FONT>         * @param object the object to test equality against.<a name="line.970"></a>
+<FONT color="green">971</FONT>         * @return true if object equals this<a name="line.971"></a>
+<FONT color="green">972</FONT>         */<a name="line.972"></a>
+<FONT color="green">973</FONT>        @Override<a name="line.973"></a>
+<FONT color="green">974</FONT>        public boolean equals(final Object object) {<a name="line.974"></a>
+<FONT color="green">975</FONT>            if (object == this ) {<a name="line.975"></a>
+<FONT color="green">976</FONT>                return true;<a name="line.976"></a>
+<FONT color="green">977</FONT>            }<a name="line.977"></a>
+<FONT color="green">978</FONT>            if (object instanceof FieldMatrix&lt;?&gt; == false) {<a name="line.978"></a>
+<FONT color="green">979</FONT>                return false;<a name="line.979"></a>
+<FONT color="green">980</FONT>            }<a name="line.980"></a>
+<FONT color="green">981</FONT>            FieldMatrix&lt;?&gt; m = (FieldMatrix&lt;?&gt;) object;<a name="line.981"></a>
+<FONT color="green">982</FONT>            final int nRows = getRowDimension();<a name="line.982"></a>
+<FONT color="green">983</FONT>            final int nCols = getColumnDimension();<a name="line.983"></a>
+<FONT color="green">984</FONT>            if (m.getColumnDimension() != nCols || m.getRowDimension() != nRows) {<a name="line.984"></a>
+<FONT color="green">985</FONT>                return false;<a name="line.985"></a>
+<FONT color="green">986</FONT>            }<a name="line.986"></a>
+<FONT color="green">987</FONT>            for (int row = 0; row &lt; nRows; ++row) {<a name="line.987"></a>
+<FONT color="green">988</FONT>                for (int col = 0; col &lt; nCols; ++col) {<a name="line.988"></a>
+<FONT color="green">989</FONT>                    if (!getEntry(row, col).equals(m.getEntry(row, col))) {<a name="line.989"></a>
+<FONT color="green">990</FONT>                        return false;<a name="line.990"></a>
+<FONT color="green">991</FONT>                    }<a name="line.991"></a>
+<FONT color="green">992</FONT>                }<a name="line.992"></a>
+<FONT color="green">993</FONT>            }<a name="line.993"></a>
+<FONT color="green">994</FONT>            return true;<a name="line.994"></a>
+<FONT color="green">995</FONT>        }<a name="line.995"></a>
+<FONT color="green">996</FONT>    <a name="line.996"></a>
+<FONT color="green">997</FONT>        /**<a name="line.997"></a>
+<FONT color="green">998</FONT>         * Computes a hashcode for the matrix.<a name="line.998"></a>
+<FONT color="green">999</FONT>         *<a name="line.999"></a>
+<FONT color="green">1000</FONT>         * @return hashcode for matrix<a name="line.1000"></a>
+<FONT color="green">1001</FONT>         */<a name="line.1001"></a>
+<FONT color="green">1002</FONT>        @Override<a name="line.1002"></a>
+<FONT color="green">1003</FONT>        public int hashCode() {<a name="line.1003"></a>
+<FONT color="green">1004</FONT>            int ret = 322562;<a name="line.1004"></a>
+<FONT color="green">1005</FONT>            final int nRows = getRowDimension();<a name="line.1005"></a>
+<FONT color="green">1006</FONT>            final int nCols = getColumnDimension();<a name="line.1006"></a>
+<FONT color="green">1007</FONT>            ret = ret * 31 + nRows;<a name="line.1007"></a>
+<FONT color="green">1008</FONT>            ret = ret * 31 + nCols;<a name="line.1008"></a>
+<FONT color="green">1009</FONT>            for (int row = 0; row &lt; nRows; ++row) {<a name="line.1009"></a>
+<FONT color="green">1010</FONT>                for (int col = 0; col &lt; nCols; ++col) {<a name="line.1010"></a>
+<FONT color="green">1011</FONT>                   ret = ret * 31 + (11 * (row+1) + 17 * (col+1)) * getEntry(row, col).hashCode();<a name="line.1011"></a>
+<FONT color="green">1012</FONT>               }<a name="line.1012"></a>
+<FONT color="green">1013</FONT>            }<a name="line.1013"></a>
+<FONT color="green">1014</FONT>            return ret;<a name="line.1014"></a>
+<FONT color="green">1015</FONT>        }<a name="line.1015"></a>
+<FONT color="green">1016</FONT>    <a name="line.1016"></a>
+<FONT color="green">1017</FONT>        /**<a name="line.1017"></a>
+<FONT color="green">1018</FONT>         * Check if a row index is valid.<a name="line.1018"></a>
+<FONT color="green">1019</FONT>         * @param row row index to check<a name="line.1019"></a>
+<FONT color="green">1020</FONT>         * @exception MatrixIndexException if index is not valid<a name="line.1020"></a>
+<FONT color="green">1021</FONT>         */<a name="line.1021"></a>
+<FONT color="green">1022</FONT>        protected void checkRowIndex(final int row) {<a name="line.1022"></a>
+<FONT color="green">1023</FONT>            if (row &lt; 0 || row &gt;= getRowDimension()) {<a name="line.1023"></a>
+<FONT color="green">1024</FONT>                throw new MatrixIndexException("row index {0} out of allowed range [{1}, {2}]",<a name="line.1024"></a>
+<FONT color="green">1025</FONT>                                               row, 0, getRowDimension() - 1);<a name="line.1025"></a>
+<FONT color="green">1026</FONT>            }<a name="line.1026"></a>
+<FONT color="green">1027</FONT>        }<a name="line.1027"></a>
+<FONT color="green">1028</FONT>    <a name="line.1028"></a>
+<FONT color="green">1029</FONT>        /**<a name="line.1029"></a>
+<FONT color="green">1030</FONT>         * Check if a column index is valid.<a name="line.1030"></a>
+<FONT color="green">1031</FONT>         * @param column column index to check<a name="line.1031"></a>
+<FONT color="green">1032</FONT>         * @exception MatrixIndexException if index is not valid<a name="line.1032"></a>
+<FONT color="green">1033</FONT>         */<a name="line.1033"></a>
+<FONT color="green">1034</FONT>        protected void checkColumnIndex(final int column)<a name="line.1034"></a>
+<FONT color="green">1035</FONT>            throws MatrixIndexException {<a name="line.1035"></a>
+<FONT color="green">1036</FONT>            if (column &lt; 0 || column &gt;= getColumnDimension()) {<a name="line.1036"></a>
+<FONT color="green">1037</FONT>                throw new MatrixIndexException("column index {0} out of allowed range [{1}, {2}]",<a name="line.1037"></a>
+<FONT color="green">1038</FONT>                                               column, 0, getColumnDimension() - 1);<a name="line.1038"></a>
+<FONT color="green">1039</FONT>            }<a name="line.1039"></a>
+<FONT color="green">1040</FONT>        }<a name="line.1040"></a>
+<FONT color="green">1041</FONT>    <a name="line.1041"></a>
+<FONT color="green">1042</FONT>        /**<a name="line.1042"></a>
+<FONT color="green">1043</FONT>         * Check if submatrix ranges indices are valid.<a name="line.1043"></a>
+<FONT color="green">1044</FONT>         * Rows and columns are indicated counting from 0 to n-1.<a name="line.1044"></a>
+<FONT color="green">1045</FONT>         *<a name="line.1045"></a>
+<FONT color="green">1046</FONT>         * @param startRow Initial row index<a name="line.1046"></a>
+<FONT color="green">1047</FONT>         * @param endRow Final row index<a name="line.1047"></a>
+<FONT color="green">1048</FONT>         * @param startColumn Initial column index<a name="line.1048"></a>
+<FONT color="green">1049</FONT>         * @param endColumn Final column index<a name="line.1049"></a>
+<FONT color="green">1050</FONT>         * @exception MatrixIndexException  if the indices are not valid<a name="line.1050"></a>
+<FONT color="green">1051</FONT>         */<a name="line.1051"></a>
+<FONT color="green">1052</FONT>        protected void checkSubMatrixIndex(final int startRow, final int endRow,<a name="line.1052"></a>
+<FONT color="green">1053</FONT>                                           final int startColumn, final int endColumn) {<a name="line.1053"></a>
+<FONT color="green">1054</FONT>            checkRowIndex(startRow);<a name="line.1054"></a>
+<FONT color="green">1055</FONT>            checkRowIndex(endRow);<a name="line.1055"></a>
+<FONT color="green">1056</FONT>            if (startRow &gt; endRow) {<a name="line.1056"></a>
+<FONT color="green">1057</FONT>                throw new MatrixIndexException("initial row {0} after final row {1}",<a name="line.1057"></a>
+<FONT color="green">1058</FONT>                                               startRow, endRow);<a name="line.1058"></a>
+<FONT color="green">1059</FONT>            }<a name="line.1059"></a>
+<FONT color="green">1060</FONT>    <a name="line.1060"></a>
+<FONT color="green">1061</FONT>            checkColumnIndex(startColumn);<a name="line.1061"></a>
+<FONT color="green">1062</FONT>            checkColumnIndex(endColumn);<a name="line.1062"></a>
+<FONT color="green">1063</FONT>            if (startColumn &gt; endColumn) {<a name="line.1063"></a>
+<FONT color="green">1064</FONT>                throw new MatrixIndexException("initial column {0} after final column {1}",<a name="line.1064"></a>
+<FONT color="green">1065</FONT>                                               startColumn, endColumn);<a name="line.1065"></a>
+<FONT color="green">1066</FONT>            }<a name="line.1066"></a>
+<FONT color="green">1067</FONT>    <a name="line.1067"></a>
+<FONT color="green">1068</FONT>    <a name="line.1068"></a>
+<FONT color="green">1069</FONT>        }<a name="line.1069"></a>
+<FONT color="green">1070</FONT>    <a name="line.1070"></a>
+<FONT color="green">1071</FONT>        /**<a name="line.1071"></a>
+<FONT color="green">1072</FONT>         * Check if submatrix ranges indices are valid.<a name="line.1072"></a>
+<FONT color="green">1073</FONT>         * Rows and columns are indicated counting from 0 to n-1.<a name="line.1073"></a>
+<FONT color="green">1074</FONT>         *<a name="line.1074"></a>
+<FONT color="green">1075</FONT>         * @param selectedRows Array of row indices.<a name="line.1075"></a>
+<FONT color="green">1076</FONT>         * @param selectedColumns Array of column indices.<a name="line.1076"></a>
+<FONT color="green">1077</FONT>         * @exception MatrixIndexException if row or column selections are not valid<a name="line.1077"></a>
+<FONT color="green">1078</FONT>         */<a name="line.1078"></a>
+<FONT color="green">1079</FONT>        protected void checkSubMatrixIndex(final int[] selectedRows, final int[] selectedColumns) {<a name="line.1079"></a>
+<FONT color="green">1080</FONT>            if (selectedRows.length * selectedColumns.length == 0) {<a name="line.1080"></a>
+<FONT color="green">1081</FONT>                if (selectedRows.length == 0) {<a name="line.1081"></a>
+<FONT color="green">1082</FONT>                    throw new MatrixIndexException("empty selected row index array");<a name="line.1082"></a>
+<FONT color="green">1083</FONT>                }<a name="line.1083"></a>
+<FONT color="green">1084</FONT>                throw new MatrixIndexException("empty selected column index array");<a name="line.1084"></a>
+<FONT color="green">1085</FONT>            }<a name="line.1085"></a>
+<FONT color="green">1086</FONT>    <a name="line.1086"></a>
+<FONT color="green">1087</FONT>            for (final int row : selectedRows) {<a name="line.1087"></a>
+<FONT color="green">1088</FONT>                checkRowIndex(row);<a name="line.1088"></a>
+<FONT color="green">1089</FONT>            }<a name="line.1089"></a>
+<FONT color="green">1090</FONT>            for (final int column : selectedColumns) {<a name="line.1090"></a>
+<FONT color="green">1091</FONT>                checkColumnIndex(column);<a name="line.1091"></a>
+<FONT color="green">1092</FONT>            }<a name="line.1092"></a>
+<FONT color="green">1093</FONT>        }<a name="line.1093"></a>
+<FONT color="green">1094</FONT>    <a name="line.1094"></a>
+<FONT color="green">1095</FONT>        /**<a name="line.1095"></a>
+<FONT color="green">1096</FONT>         * Check if a matrix is addition compatible with the instance<a name="line.1096"></a>
+<FONT color="green">1097</FONT>         * @param m matrix to check<a name="line.1097"></a>
+<FONT color="green">1098</FONT>         * @exception IllegalArgumentException if matrix is not addition compatible with instance<a name="line.1098"></a>
+<FONT color="green">1099</FONT>         */<a name="line.1099"></a>
+<FONT color="green">1100</FONT>        protected void checkAdditionCompatible(final FieldMatrix&lt;T&gt; m) {<a name="line.1100"></a>
+<FONT color="green">1101</FONT>            if ((getRowDimension()    != m.getRowDimension()) ||<a name="line.1101"></a>
+<FONT color="green">1102</FONT>                (getColumnDimension() != m.getColumnDimension())) {<a name="line.1102"></a>
+<FONT color="green">1103</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1103"></a>
+<FONT color="green">1104</FONT>                        "{0}x{1} and {2}x{3} matrices are not addition compatible",<a name="line.1104"></a>
+<FONT color="green">1105</FONT>                        getRowDimension(), getColumnDimension(),<a name="line.1105"></a>
+<FONT color="green">1106</FONT>                        m.getRowDimension(), m.getColumnDimension());<a name="line.1106"></a>
+<FONT color="green">1107</FONT>            }<a name="line.1107"></a>
+<FONT color="green">1108</FONT>        }<a name="line.1108"></a>
+<FONT color="green">1109</FONT>    <a name="line.1109"></a>
+<FONT color="green">1110</FONT>        /**<a name="line.1110"></a>
+<FONT color="green">1111</FONT>         * Check if a matrix is subtraction compatible with the instance<a name="line.1111"></a>
+<FONT color="green">1112</FONT>         * @param m matrix to check<a name="line.1112"></a>
+<FONT color="green">1113</FONT>         * @exception IllegalArgumentException if matrix is not subtraction compatible with instance<a name="line.1113"></a>
+<FONT color="green">1114</FONT>         */<a name="line.1114"></a>
+<FONT color="green">1115</FONT>        protected void checkSubtractionCompatible(final FieldMatrix&lt;T&gt; m) {<a name="line.1115"></a>
+<FONT color="green">1116</FONT>            if ((getRowDimension()    != m.getRowDimension()) ||<a name="line.1116"></a>
+<FONT color="green">1117</FONT>                (getColumnDimension() != m.getColumnDimension())) {<a name="line.1117"></a>
+<FONT color="green">1118</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1118"></a>
+<FONT color="green">1119</FONT>                        "{0}x{1} and {2}x{3} matrices are not subtraction compatible",<a name="line.1119"></a>
+<FONT color="green">1120</FONT>                        getRowDimension(), getColumnDimension(),<a name="line.1120"></a>
+<FONT color="green">1121</FONT>                        m.getRowDimension(), m.getColumnDimension());<a name="line.1121"></a>
+<FONT color="green">1122</FONT>            }<a name="line.1122"></a>
+<FONT color="green">1123</FONT>        }<a name="line.1123"></a>
+<FONT color="green">1124</FONT>    <a name="line.1124"></a>
+<FONT color="green">1125</FONT>        /**<a name="line.1125"></a>
+<FONT color="green">1126</FONT>         * Check if a matrix is multiplication compatible with the instance<a name="line.1126"></a>
+<FONT color="green">1127</FONT>         * @param m matrix to check<a name="line.1127"></a>
+<FONT color="green">1128</FONT>         * @exception IllegalArgumentException if matrix is not multiplication compatible with instance<a name="line.1128"></a>
+<FONT color="green">1129</FONT>         */<a name="line.1129"></a>
+<FONT color="green">1130</FONT>        protected void checkMultiplicationCompatible(final FieldMatrix&lt;T&gt; m) {<a name="line.1130"></a>
+<FONT color="green">1131</FONT>            if (getColumnDimension() != m.getRowDimension()) {<a name="line.1131"></a>
+<FONT color="green">1132</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1132"></a>
+<FONT color="green">1133</FONT>                        "{0}x{1} and {2}x{3} matrices are not multiplication compatible",<a name="line.1133"></a>
+<FONT color="green">1134</FONT>                        getRowDimension(), getColumnDimension(),<a name="line.1134"></a>
+<FONT color="green">1135</FONT>                        m.getRowDimension(), m.getColumnDimension());<a name="line.1135"></a>
+<FONT color="green">1136</FONT>            }<a name="line.1136"></a>
+<FONT color="green">1137</FONT>        }<a name="line.1137"></a>
+<FONT color="green">1138</FONT>    <a name="line.1138"></a>
+<FONT color="green">1139</FONT>    }<a name="line.1139"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/AbstractRealMatrix.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,1136 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Basic implementation of RealMatrix methods regardless of the underlying storage.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;All the methods implemented here use {@link #getEntry(int, int)} to access<a name="line.25"></a>
+<FONT color="green">026</FONT>     * matrix elements. Derived class can provide faster implementations. &lt;/p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @version $Revision: 811833 $ $Date: 2009-09-06 12:27:50 -0400 (Sun, 06 Sep 2009) $<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @since 2.0<a name="line.29"></a>
+<FONT color="green">030</FONT>     */<a name="line.30"></a>
+<FONT color="green">031</FONT>    public abstract class AbstractRealMatrix implements RealMatrix {<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /** Cached LU solver.<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @deprecated as of release 2.0, since all methods using this are deprecated<a name="line.35"></a>
+<FONT color="green">036</FONT>         */<a name="line.36"></a>
+<FONT color="green">037</FONT>        @Deprecated<a name="line.37"></a>
+<FONT color="green">038</FONT>        private DecompositionSolver lu;<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /**<a name="line.40"></a>
+<FONT color="green">041</FONT>         * Creates a matrix with no data<a name="line.41"></a>
+<FONT color="green">042</FONT>         */<a name="line.42"></a>
+<FONT color="green">043</FONT>        protected AbstractRealMatrix() {<a name="line.43"></a>
+<FONT color="green">044</FONT>            lu = null;<a name="line.44"></a>
+<FONT color="green">045</FONT>        }<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Create a new RealMatrix with the supplied row and column dimensions.<a name="line.48"></a>
+<FONT color="green">049</FONT>         *<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @param rowDimension  the number of rows in the new matrix<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @param columnDimension  the number of columns in the new matrix<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @throws IllegalArgumentException if row or column dimension is not positive<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        protected AbstractRealMatrix(final int rowDimension, final int columnDimension)<a name="line.54"></a>
+<FONT color="green">055</FONT>            throws IllegalArgumentException {<a name="line.55"></a>
+<FONT color="green">056</FONT>            if (rowDimension &lt;= 0 ) {<a name="line.56"></a>
+<FONT color="green">057</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.57"></a>
+<FONT color="green">058</FONT>                        "invalid row dimension {0} (must be positive)",<a name="line.58"></a>
+<FONT color="green">059</FONT>                        rowDimension);<a name="line.59"></a>
+<FONT color="green">060</FONT>            }<a name="line.60"></a>
+<FONT color="green">061</FONT>            if (columnDimension &lt;= 0) {<a name="line.61"></a>
+<FONT color="green">062</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.62"></a>
+<FONT color="green">063</FONT>                        "invalid column dimension {0} (must be positive)",<a name="line.63"></a>
+<FONT color="green">064</FONT>                        columnDimension);<a name="line.64"></a>
+<FONT color="green">065</FONT>            }<a name="line.65"></a>
+<FONT color="green">066</FONT>            lu = null;<a name="line.66"></a>
+<FONT color="green">067</FONT>        }<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /** {@inheritDoc} */<a name="line.69"></a>
+<FONT color="green">070</FONT>        public abstract RealMatrix createMatrix(final int rowDimension, final int columnDimension)<a name="line.70"></a>
+<FONT color="green">071</FONT>            throws IllegalArgumentException;<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /** {@inheritDoc} */<a name="line.73"></a>
+<FONT color="green">074</FONT>        public abstract RealMatrix copy();<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        /** {@inheritDoc} */<a name="line.76"></a>
+<FONT color="green">077</FONT>        public RealMatrix add(RealMatrix m) throws IllegalArgumentException {<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>            // safety check<a name="line.79"></a>
+<FONT color="green">080</FONT>            MatrixUtils.checkAdditionCompatible(this, m);<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>            final int rowCount    = getRowDimension();<a name="line.82"></a>
+<FONT color="green">083</FONT>            final int columnCount = getColumnDimension();<a name="line.83"></a>
+<FONT color="green">084</FONT>            final RealMatrix out = createMatrix(rowCount, columnCount);<a name="line.84"></a>
+<FONT color="green">085</FONT>            for (int row = 0; row &lt; rowCount; ++row) {<a name="line.85"></a>
+<FONT color="green">086</FONT>                for (int col = 0; col &lt; columnCount; ++col) {<a name="line.86"></a>
+<FONT color="green">087</FONT>                    out.setEntry(row, col, getEntry(row, col) + m.getEntry(row, col));<a name="line.87"></a>
+<FONT color="green">088</FONT>                }<a name="line.88"></a>
+<FONT color="green">089</FONT>            }<a name="line.89"></a>
+<FONT color="green">090</FONT>    <a name="line.90"></a>
+<FONT color="green">091</FONT>            return out;<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        }<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /** {@inheritDoc} */<a name="line.95"></a>
+<FONT color="green">096</FONT>        public RealMatrix subtract(final RealMatrix m) throws IllegalArgumentException {<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>            // safety check<a name="line.98"></a>
+<FONT color="green">099</FONT>            MatrixUtils.checkSubtractionCompatible(this, m);<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>            final int rowCount    = getRowDimension();<a name="line.101"></a>
+<FONT color="green">102</FONT>            final int columnCount = getColumnDimension();<a name="line.102"></a>
+<FONT color="green">103</FONT>            final RealMatrix out = createMatrix(rowCount, columnCount);<a name="line.103"></a>
+<FONT color="green">104</FONT>            for (int row = 0; row &lt; rowCount; ++row) {<a name="line.104"></a>
+<FONT color="green">105</FONT>                for (int col = 0; col &lt; columnCount; ++col) {<a name="line.105"></a>
+<FONT color="green">106</FONT>                    out.setEntry(row, col, getEntry(row, col) - m.getEntry(row, col));<a name="line.106"></a>
+<FONT color="green">107</FONT>                }<a name="line.107"></a>
+<FONT color="green">108</FONT>            }<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>            return out;<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>        }<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /** {@inheritDoc} */<a name="line.114"></a>
+<FONT color="green">115</FONT>        public RealMatrix scalarAdd(final double d) {<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>            final int rowCount    = getRowDimension();<a name="line.117"></a>
+<FONT color="green">118</FONT>            final int columnCount = getColumnDimension();<a name="line.118"></a>
+<FONT color="green">119</FONT>            final RealMatrix out = createMatrix(rowCount, columnCount);<a name="line.119"></a>
+<FONT color="green">120</FONT>            for (int row = 0; row &lt; rowCount; ++row) {<a name="line.120"></a>
+<FONT color="green">121</FONT>                for (int col = 0; col &lt; columnCount; ++col) {<a name="line.121"></a>
+<FONT color="green">122</FONT>                    out.setEntry(row, col, getEntry(row, col) + d);<a name="line.122"></a>
+<FONT color="green">123</FONT>                }<a name="line.123"></a>
+<FONT color="green">124</FONT>            }<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>            return out;<a name="line.126"></a>
+<FONT color="green">127</FONT>    <a name="line.127"></a>
+<FONT color="green">128</FONT>        }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /** {@inheritDoc} */<a name="line.130"></a>
+<FONT color="green">131</FONT>        public RealMatrix scalarMultiply(final double d) {<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>            final int rowCount    = getRowDimension();<a name="line.133"></a>
+<FONT color="green">134</FONT>            final int columnCount = getColumnDimension();<a name="line.134"></a>
+<FONT color="green">135</FONT>            final RealMatrix out = createMatrix(rowCount, columnCount);<a name="line.135"></a>
+<FONT color="green">136</FONT>            for (int row = 0; row &lt; rowCount; ++row) {<a name="line.136"></a>
+<FONT color="green">137</FONT>                for (int col = 0; col &lt; columnCount; ++col) {<a name="line.137"></a>
+<FONT color="green">138</FONT>                    out.setEntry(row, col, getEntry(row, col) * d);<a name="line.138"></a>
+<FONT color="green">139</FONT>                }<a name="line.139"></a>
+<FONT color="green">140</FONT>            }<a name="line.140"></a>
+<FONT color="green">141</FONT>    <a name="line.141"></a>
+<FONT color="green">142</FONT>            return out;<a name="line.142"></a>
+<FONT color="green">143</FONT>    <a name="line.143"></a>
+<FONT color="green">144</FONT>        }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>        /** {@inheritDoc} */<a name="line.146"></a>
+<FONT color="green">147</FONT>        public RealMatrix multiply(final RealMatrix m)<a name="line.147"></a>
+<FONT color="green">148</FONT>            throws IllegalArgumentException {<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>            // safety check<a name="line.150"></a>
+<FONT color="green">151</FONT>            MatrixUtils.checkMultiplicationCompatible(this, m);<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>            final int nRows = getRowDimension();<a name="line.153"></a>
+<FONT color="green">154</FONT>            final int nCols = m.getColumnDimension();<a name="line.154"></a>
+<FONT color="green">155</FONT>            final int nSum  = getColumnDimension();<a name="line.155"></a>
+<FONT color="green">156</FONT>            final RealMatrix out = createMatrix(nRows, nCols);<a name="line.156"></a>
+<FONT color="green">157</FONT>            for (int row = 0; row &lt; nRows; ++row) {<a name="line.157"></a>
+<FONT color="green">158</FONT>                for (int col = 0; col &lt; nCols; ++col) {<a name="line.158"></a>
+<FONT color="green">159</FONT>                    double sum = 0;<a name="line.159"></a>
+<FONT color="green">160</FONT>                    for (int i = 0; i &lt; nSum; ++i) {<a name="line.160"></a>
+<FONT color="green">161</FONT>                        sum += getEntry(row, i) * m.getEntry(i, col);<a name="line.161"></a>
+<FONT color="green">162</FONT>                    }<a name="line.162"></a>
+<FONT color="green">163</FONT>                    out.setEntry(row, col, sum);<a name="line.163"></a>
+<FONT color="green">164</FONT>                }<a name="line.164"></a>
+<FONT color="green">165</FONT>            }<a name="line.165"></a>
+<FONT color="green">166</FONT>    <a name="line.166"></a>
+<FONT color="green">167</FONT>            return out;<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>        }<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>        /** {@inheritDoc} */<a name="line.171"></a>
+<FONT color="green">172</FONT>        public RealMatrix preMultiply(final RealMatrix m)<a name="line.172"></a>
+<FONT color="green">173</FONT>            throws IllegalArgumentException {<a name="line.173"></a>
+<FONT color="green">174</FONT>            return m.multiply(this);<a name="line.174"></a>
+<FONT color="green">175</FONT>        }<a name="line.175"></a>
+<FONT color="green">176</FONT>    <a name="line.176"></a>
+<FONT color="green">177</FONT>        /** {@inheritDoc} */<a name="line.177"></a>
+<FONT color="green">178</FONT>        public double[][] getData() {<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>            final double[][] data = new double[getRowDimension()][getColumnDimension()];<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>            for (int i = 0; i &lt; data.length; ++i) {<a name="line.182"></a>
+<FONT color="green">183</FONT>                final double[] dataI = data[i];<a name="line.183"></a>
+<FONT color="green">184</FONT>                for (int j = 0; j &lt; dataI.length; ++j) {<a name="line.184"></a>
+<FONT color="green">185</FONT>                    dataI[j] = getEntry(i, j);<a name="line.185"></a>
+<FONT color="green">186</FONT>                }<a name="line.186"></a>
+<FONT color="green">187</FONT>            }<a name="line.187"></a>
+<FONT color="green">188</FONT>    <a name="line.188"></a>
+<FONT color="green">189</FONT>            return data;<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>        }<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>        /** {@inheritDoc} */<a name="line.193"></a>
+<FONT color="green">194</FONT>        public double getNorm() {<a name="line.194"></a>
+<FONT color="green">195</FONT>            return walkInColumnOrder(new RealMatrixPreservingVisitor() {<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>                /** Last row index. */<a name="line.197"></a>
+<FONT color="green">198</FONT>                private double endRow;<a name="line.198"></a>
+<FONT color="green">199</FONT>    <a name="line.199"></a>
+<FONT color="green">200</FONT>                /** Sum of absolute values on one column. */<a name="line.200"></a>
+<FONT color="green">201</FONT>                private double columnSum;<a name="line.201"></a>
+<FONT color="green">202</FONT>    <a name="line.202"></a>
+<FONT color="green">203</FONT>                /** Maximal sum across all columns. */<a name="line.203"></a>
+<FONT color="green">204</FONT>                private double maxColSum;<a name="line.204"></a>
+<FONT color="green">205</FONT>    <a name="line.205"></a>
+<FONT color="green">206</FONT>                /** {@inheritDoc} */<a name="line.206"></a>
+<FONT color="green">207</FONT>                public void start(final int rows, final int columns,<a name="line.207"></a>
+<FONT color="green">208</FONT>                                  final int startRow, final int endRow,<a name="line.208"></a>
+<FONT color="green">209</FONT>                                  final int startColumn, final int endColumn) {<a name="line.209"></a>
+<FONT color="green">210</FONT>                    this.endRow = endRow;<a name="line.210"></a>
+<FONT color="green">211</FONT>                    columnSum   = 0;<a name="line.211"></a>
+<FONT color="green">212</FONT>                    maxColSum   = 0;<a name="line.212"></a>
+<FONT color="green">213</FONT>                }<a name="line.213"></a>
+<FONT color="green">214</FONT>    <a name="line.214"></a>
+<FONT color="green">215</FONT>                /** {@inheritDoc} */<a name="line.215"></a>
+<FONT color="green">216</FONT>                public void visit(final int row, final int column, final double value) {<a name="line.216"></a>
+<FONT color="green">217</FONT>                    columnSum += Math.abs(value);<a name="line.217"></a>
+<FONT color="green">218</FONT>                    if (row == endRow) {<a name="line.218"></a>
+<FONT color="green">219</FONT>                        maxColSum = Math.max(maxColSum, columnSum);<a name="line.219"></a>
+<FONT color="green">220</FONT>                        columnSum = 0;<a name="line.220"></a>
+<FONT color="green">221</FONT>                    }<a name="line.221"></a>
+<FONT color="green">222</FONT>                }<a name="line.222"></a>
+<FONT color="green">223</FONT>    <a name="line.223"></a>
+<FONT color="green">224</FONT>                /** {@inheritDoc} */<a name="line.224"></a>
+<FONT color="green">225</FONT>                public double end() {<a name="line.225"></a>
+<FONT color="green">226</FONT>                    return maxColSum;<a name="line.226"></a>
+<FONT color="green">227</FONT>                }<a name="line.227"></a>
+<FONT color="green">228</FONT>    <a name="line.228"></a>
+<FONT color="green">229</FONT>            });<a name="line.229"></a>
+<FONT color="green">230</FONT>        }<a name="line.230"></a>
+<FONT color="green">231</FONT>    <a name="line.231"></a>
+<FONT color="green">232</FONT>        /** {@inheritDoc} */<a name="line.232"></a>
+<FONT color="green">233</FONT>        public double getFrobeniusNorm() {<a name="line.233"></a>
+<FONT color="green">234</FONT>            return walkInOptimizedOrder(new RealMatrixPreservingVisitor() {<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>                /** Sum of squared entries. */<a name="line.236"></a>
+<FONT color="green">237</FONT>                private double sum;<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>                /** {@inheritDoc} */<a name="line.239"></a>
+<FONT color="green">240</FONT>                public void start(final int rows, final int columns,<a name="line.240"></a>
+<FONT color="green">241</FONT>                                  final int startRow, final int endRow,<a name="line.241"></a>
+<FONT color="green">242</FONT>                                  final int startColumn, final int endColumn) {<a name="line.242"></a>
+<FONT color="green">243</FONT>                    sum = 0;<a name="line.243"></a>
+<FONT color="green">244</FONT>                }<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>                /** {@inheritDoc} */<a name="line.246"></a>
+<FONT color="green">247</FONT>                public void visit(final int row, final int column, final double value) {<a name="line.247"></a>
+<FONT color="green">248</FONT>                    sum += value * value;<a name="line.248"></a>
+<FONT color="green">249</FONT>                }<a name="line.249"></a>
+<FONT color="green">250</FONT>    <a name="line.250"></a>
+<FONT color="green">251</FONT>                /** {@inheritDoc} */<a name="line.251"></a>
+<FONT color="green">252</FONT>                public double end() {<a name="line.252"></a>
+<FONT color="green">253</FONT>                    return Math.sqrt(sum);<a name="line.253"></a>
+<FONT color="green">254</FONT>                }<a name="line.254"></a>
+<FONT color="green">255</FONT>    <a name="line.255"></a>
+<FONT color="green">256</FONT>            });<a name="line.256"></a>
+<FONT color="green">257</FONT>        }<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>        /** {@inheritDoc} */<a name="line.259"></a>
+<FONT color="green">260</FONT>        public RealMatrix getSubMatrix(final int startRow, final int endRow,<a name="line.260"></a>
+<FONT color="green">261</FONT>                                       final int startColumn, final int endColumn)<a name="line.261"></a>
+<FONT color="green">262</FONT>            throws MatrixIndexException {<a name="line.262"></a>
+<FONT color="green">263</FONT>    <a name="line.263"></a>
+<FONT color="green">264</FONT>            MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);<a name="line.264"></a>
+<FONT color="green">265</FONT>    <a name="line.265"></a>
+<FONT color="green">266</FONT>            final RealMatrix subMatrix =<a name="line.266"></a>
+<FONT color="green">267</FONT>                createMatrix(endRow - startRow + 1, endColumn - startColumn + 1);<a name="line.267"></a>
+<FONT color="green">268</FONT>            for (int i = startRow; i &lt;= endRow; ++i) {<a name="line.268"></a>
+<FONT color="green">269</FONT>                for (int j = startColumn; j &lt;= endColumn; ++j) {<a name="line.269"></a>
+<FONT color="green">270</FONT>                    subMatrix.setEntry(i - startRow, j - startColumn, getEntry(i, j));<a name="line.270"></a>
+<FONT color="green">271</FONT>                }<a name="line.271"></a>
+<FONT color="green">272</FONT>            }<a name="line.272"></a>
+<FONT color="green">273</FONT>    <a name="line.273"></a>
+<FONT color="green">274</FONT>            return subMatrix;<a name="line.274"></a>
+<FONT color="green">275</FONT>    <a name="line.275"></a>
+<FONT color="green">276</FONT>        }<a name="line.276"></a>
+<FONT color="green">277</FONT>    <a name="line.277"></a>
+<FONT color="green">278</FONT>        /** {@inheritDoc} */<a name="line.278"></a>
+<FONT color="green">279</FONT>        public RealMatrix getSubMatrix(final int[] selectedRows, final int[] selectedColumns)<a name="line.279"></a>
+<FONT color="green">280</FONT>            throws MatrixIndexException {<a name="line.280"></a>
+<FONT color="green">281</FONT>    <a name="line.281"></a>
+<FONT color="green">282</FONT>            // safety checks<a name="line.282"></a>
+<FONT color="green">283</FONT>            MatrixUtils.checkSubMatrixIndex(this, selectedRows, selectedColumns);<a name="line.283"></a>
+<FONT color="green">284</FONT>    <a name="line.284"></a>
+<FONT color="green">285</FONT>            // copy entries<a name="line.285"></a>
+<FONT color="green">286</FONT>            final RealMatrix subMatrix =<a name="line.286"></a>
+<FONT color="green">287</FONT>                createMatrix(selectedRows.length, selectedColumns.length);<a name="line.287"></a>
+<FONT color="green">288</FONT>            subMatrix.walkInOptimizedOrder(new DefaultRealMatrixChangingVisitor() {<a name="line.288"></a>
+<FONT color="green">289</FONT>    <a name="line.289"></a>
+<FONT color="green">290</FONT>                /** {@inheritDoc} */<a name="line.290"></a>
+<FONT color="green">291</FONT>                @Override<a name="line.291"></a>
+<FONT color="green">292</FONT>                public double visit(final int row, final int column, final double value) {<a name="line.292"></a>
+<FONT color="green">293</FONT>                    return getEntry(selectedRows[row], selectedColumns[column]);<a name="line.293"></a>
+<FONT color="green">294</FONT>                }<a name="line.294"></a>
+<FONT color="green">295</FONT>    <a name="line.295"></a>
+<FONT color="green">296</FONT>            });<a name="line.296"></a>
+<FONT color="green">297</FONT>    <a name="line.297"></a>
+<FONT color="green">298</FONT>            return subMatrix;<a name="line.298"></a>
+<FONT color="green">299</FONT>    <a name="line.299"></a>
+<FONT color="green">300</FONT>        }<a name="line.300"></a>
+<FONT color="green">301</FONT>    <a name="line.301"></a>
+<FONT color="green">302</FONT>        /** {@inheritDoc} */<a name="line.302"></a>
+<FONT color="green">303</FONT>        public void copySubMatrix(final int startRow, final int endRow,<a name="line.303"></a>
+<FONT color="green">304</FONT>                                  final int startColumn, final int endColumn,<a name="line.304"></a>
+<FONT color="green">305</FONT>                                  final double[][] destination)<a name="line.305"></a>
+<FONT color="green">306</FONT>            throws MatrixIndexException, IllegalArgumentException {<a name="line.306"></a>
+<FONT color="green">307</FONT>    <a name="line.307"></a>
+<FONT color="green">308</FONT>            // safety checks<a name="line.308"></a>
+<FONT color="green">309</FONT>            MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);<a name="line.309"></a>
+<FONT color="green">310</FONT>            final int rowsCount    = endRow + 1 - startRow;<a name="line.310"></a>
+<FONT color="green">311</FONT>            final int columnsCount = endColumn + 1 - startColumn;<a name="line.311"></a>
+<FONT color="green">312</FONT>            if ((destination.length &lt; rowsCount) || (destination[0].length &lt; columnsCount)) {<a name="line.312"></a>
+<FONT color="green">313</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.313"></a>
+<FONT color="green">314</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.314"></a>
+<FONT color="green">315</FONT>                        destination.length, destination[0].length,<a name="line.315"></a>
+<FONT color="green">316</FONT>                        rowsCount, columnsCount);<a name="line.316"></a>
+<FONT color="green">317</FONT>            }<a name="line.317"></a>
+<FONT color="green">318</FONT>    <a name="line.318"></a>
+<FONT color="green">319</FONT>            // copy entries<a name="line.319"></a>
+<FONT color="green">320</FONT>            walkInOptimizedOrder(new DefaultRealMatrixPreservingVisitor() {<a name="line.320"></a>
+<FONT color="green">321</FONT>    <a name="line.321"></a>
+<FONT color="green">322</FONT>                /** Initial row index. */<a name="line.322"></a>
+<FONT color="green">323</FONT>                private int startRow;<a name="line.323"></a>
+<FONT color="green">324</FONT>    <a name="line.324"></a>
+<FONT color="green">325</FONT>                /** Initial column index. */<a name="line.325"></a>
+<FONT color="green">326</FONT>                private int startColumn;<a name="line.326"></a>
+<FONT color="green">327</FONT>    <a name="line.327"></a>
+<FONT color="green">328</FONT>                /** {@inheritDoc} */<a name="line.328"></a>
+<FONT color="green">329</FONT>                @Override<a name="line.329"></a>
+<FONT color="green">330</FONT>                public void start(final int rows, final int columns,<a name="line.330"></a>
+<FONT color="green">331</FONT>                                  final int startRow, final int endRow,<a name="line.331"></a>
+<FONT color="green">332</FONT>                                  final int startColumn, final int endColumn) {<a name="line.332"></a>
+<FONT color="green">333</FONT>                    this.startRow    = startRow;<a name="line.333"></a>
+<FONT color="green">334</FONT>                    this.startColumn = startColumn;<a name="line.334"></a>
+<FONT color="green">335</FONT>                }<a name="line.335"></a>
+<FONT color="green">336</FONT>    <a name="line.336"></a>
+<FONT color="green">337</FONT>                /** {@inheritDoc} */<a name="line.337"></a>
+<FONT color="green">338</FONT>                @Override<a name="line.338"></a>
+<FONT color="green">339</FONT>                public void visit(final int row, final int column, final double value) {<a name="line.339"></a>
+<FONT color="green">340</FONT>                    destination[row - startRow][column - startColumn] = value;<a name="line.340"></a>
+<FONT color="green">341</FONT>                }<a name="line.341"></a>
+<FONT color="green">342</FONT>    <a name="line.342"></a>
+<FONT color="green">343</FONT>            }, startRow, endRow, startColumn, endColumn);<a name="line.343"></a>
+<FONT color="green">344</FONT>    <a name="line.344"></a>
+<FONT color="green">345</FONT>        }<a name="line.345"></a>
+<FONT color="green">346</FONT>    <a name="line.346"></a>
+<FONT color="green">347</FONT>        /** {@inheritDoc} */<a name="line.347"></a>
+<FONT color="green">348</FONT>        public void copySubMatrix(int[] selectedRows, int[] selectedColumns, double[][] destination)<a name="line.348"></a>
+<FONT color="green">349</FONT>            throws MatrixIndexException, IllegalArgumentException {<a name="line.349"></a>
+<FONT color="green">350</FONT>    <a name="line.350"></a>
+<FONT color="green">351</FONT>            // safety checks<a name="line.351"></a>
+<FONT color="green">352</FONT>            MatrixUtils.checkSubMatrixIndex(this, selectedRows, selectedColumns);<a name="line.352"></a>
+<FONT color="green">353</FONT>            if ((destination.length &lt; selectedRows.length) ||<a name="line.353"></a>
+<FONT color="green">354</FONT>                (destination[0].length &lt; selectedColumns.length)) {<a name="line.354"></a>
+<FONT color="green">355</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.355"></a>
+<FONT color="green">356</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.356"></a>
+<FONT color="green">357</FONT>                        destination.length, destination[0].length,<a name="line.357"></a>
+<FONT color="green">358</FONT>                        selectedRows.length, selectedColumns.length);<a name="line.358"></a>
+<FONT color="green">359</FONT>            }<a name="line.359"></a>
+<FONT color="green">360</FONT>    <a name="line.360"></a>
+<FONT color="green">361</FONT>            // copy entries<a name="line.361"></a>
+<FONT color="green">362</FONT>            for (int i = 0; i &lt; selectedRows.length; i++) {<a name="line.362"></a>
+<FONT color="green">363</FONT>                final double[] destinationI = destination[i];<a name="line.363"></a>
+<FONT color="green">364</FONT>                for (int j = 0; j &lt; selectedColumns.length; j++) {<a name="line.364"></a>
+<FONT color="green">365</FONT>                    destinationI[j] = getEntry(selectedRows[i], selectedColumns[j]);<a name="line.365"></a>
+<FONT color="green">366</FONT>                }<a name="line.366"></a>
+<FONT color="green">367</FONT>            }<a name="line.367"></a>
+<FONT color="green">368</FONT>    <a name="line.368"></a>
+<FONT color="green">369</FONT>        }<a name="line.369"></a>
+<FONT color="green">370</FONT>    <a name="line.370"></a>
+<FONT color="green">371</FONT>        /** {@inheritDoc} */<a name="line.371"></a>
+<FONT color="green">372</FONT>        public void setSubMatrix(final double[][] subMatrix, final int row, final int column)<a name="line.372"></a>
+<FONT color="green">373</FONT>            throws MatrixIndexException {<a name="line.373"></a>
+<FONT color="green">374</FONT>    <a name="line.374"></a>
+<FONT color="green">375</FONT>            final int nRows = subMatrix.length;<a name="line.375"></a>
+<FONT color="green">376</FONT>            if (nRows == 0) {<a name="line.376"></a>
+<FONT color="green">377</FONT>                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");<a name="line.377"></a>
+<FONT color="green">378</FONT>            }<a name="line.378"></a>
+<FONT color="green">379</FONT>    <a name="line.379"></a>
+<FONT color="green">380</FONT>            final int nCols = subMatrix[0].length;<a name="line.380"></a>
+<FONT color="green">381</FONT>            if (nCols == 0) {<a name="line.381"></a>
+<FONT color="green">382</FONT>                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");<a name="line.382"></a>
+<FONT color="green">383</FONT>            }<a name="line.383"></a>
+<FONT color="green">384</FONT>    <a name="line.384"></a>
+<FONT color="green">385</FONT>            for (int r = 1; r &lt; nRows; ++r) {<a name="line.385"></a>
+<FONT color="green">386</FONT>                if (subMatrix[r].length != nCols) {<a name="line.386"></a>
+<FONT color="green">387</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.387"></a>
+<FONT color="green">388</FONT>                            "some rows have length {0} while others have length {1}",<a name="line.388"></a>
+<FONT color="green">389</FONT>                            nCols, subMatrix[r].length);<a name="line.389"></a>
+<FONT color="green">390</FONT>                }<a name="line.390"></a>
+<FONT color="green">391</FONT>            }<a name="line.391"></a>
+<FONT color="green">392</FONT>    <a name="line.392"></a>
+<FONT color="green">393</FONT>            MatrixUtils.checkRowIndex(this, row);<a name="line.393"></a>
+<FONT color="green">394</FONT>            MatrixUtils.checkColumnIndex(this, column);<a name="line.394"></a>
+<FONT color="green">395</FONT>            MatrixUtils.checkRowIndex(this, nRows + row - 1);<a name="line.395"></a>
+<FONT color="green">396</FONT>            MatrixUtils.checkColumnIndex(this, nCols + column - 1);<a name="line.396"></a>
+<FONT color="green">397</FONT>    <a name="line.397"></a>
+<FONT color="green">398</FONT>            for (int i = 0; i &lt; nRows; ++i) {<a name="line.398"></a>
+<FONT color="green">399</FONT>                for (int j = 0; j &lt; nCols; ++j) {<a name="line.399"></a>
+<FONT color="green">400</FONT>                    setEntry(row + i, column + j, subMatrix[i][j]);<a name="line.400"></a>
+<FONT color="green">401</FONT>                }<a name="line.401"></a>
+<FONT color="green">402</FONT>            }<a name="line.402"></a>
+<FONT color="green">403</FONT>    <a name="line.403"></a>
+<FONT color="green">404</FONT>            lu = null;<a name="line.404"></a>
+<FONT color="green">405</FONT>    <a name="line.405"></a>
+<FONT color="green">406</FONT>        }<a name="line.406"></a>
+<FONT color="green">407</FONT>    <a name="line.407"></a>
+<FONT color="green">408</FONT>        /** {@inheritDoc} */<a name="line.408"></a>
+<FONT color="green">409</FONT>        public RealMatrix getRowMatrix(final int row)<a name="line.409"></a>
+<FONT color="green">410</FONT>            throws MatrixIndexException {<a name="line.410"></a>
+<FONT color="green">411</FONT>    <a name="line.411"></a>
+<FONT color="green">412</FONT>            MatrixUtils.checkRowIndex(this, row);<a name="line.412"></a>
+<FONT color="green">413</FONT>            final int nCols = getColumnDimension();<a name="line.413"></a>
+<FONT color="green">414</FONT>            final RealMatrix out = createMatrix(1, nCols);<a name="line.414"></a>
+<FONT color="green">415</FONT>            for (int i = 0; i &lt; nCols; ++i) {<a name="line.415"></a>
+<FONT color="green">416</FONT>                out.setEntry(0, i, getEntry(row, i));<a name="line.416"></a>
+<FONT color="green">417</FONT>            }<a name="line.417"></a>
+<FONT color="green">418</FONT>    <a name="line.418"></a>
+<FONT color="green">419</FONT>            return out;<a name="line.419"></a>
+<FONT color="green">420</FONT>    <a name="line.420"></a>
+<FONT color="green">421</FONT>        }<a name="line.421"></a>
+<FONT color="green">422</FONT>    <a name="line.422"></a>
+<FONT color="green">423</FONT>        /** {@inheritDoc} */<a name="line.423"></a>
+<FONT color="green">424</FONT>        public void setRowMatrix(final int row, final RealMatrix matrix)<a name="line.424"></a>
+<FONT color="green">425</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.425"></a>
+<FONT color="green">426</FONT>    <a name="line.426"></a>
+<FONT color="green">427</FONT>            MatrixUtils.checkRowIndex(this, row);<a name="line.427"></a>
+<FONT color="green">428</FONT>            final int nCols = getColumnDimension();<a name="line.428"></a>
+<FONT color="green">429</FONT>            if ((matrix.getRowDimension() != 1) ||<a name="line.429"></a>
+<FONT color="green">430</FONT>                (matrix.getColumnDimension() != nCols)) {<a name="line.430"></a>
+<FONT color="green">431</FONT>                throw new InvalidMatrixException(<a name="line.431"></a>
+<FONT color="green">432</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.432"></a>
+<FONT color="green">433</FONT>                        matrix.getRowDimension(), matrix.getColumnDimension(), 1, nCols);<a name="line.433"></a>
+<FONT color="green">434</FONT>            }<a name="line.434"></a>
+<FONT color="green">435</FONT>            for (int i = 0; i &lt; nCols; ++i) {<a name="line.435"></a>
+<FONT color="green">436</FONT>                setEntry(row, i, matrix.getEntry(0, i));<a name="line.436"></a>
+<FONT color="green">437</FONT>            }<a name="line.437"></a>
+<FONT color="green">438</FONT>    <a name="line.438"></a>
+<FONT color="green">439</FONT>        }<a name="line.439"></a>
+<FONT color="green">440</FONT>    <a name="line.440"></a>
+<FONT color="green">441</FONT>        /** {@inheritDoc} */<a name="line.441"></a>
+<FONT color="green">442</FONT>        public RealMatrix getColumnMatrix(final int column)<a name="line.442"></a>
+<FONT color="green">443</FONT>            throws MatrixIndexException {<a name="line.443"></a>
+<FONT color="green">444</FONT>    <a name="line.444"></a>
+<FONT color="green">445</FONT>            MatrixUtils.checkColumnIndex(this, column);<a name="line.445"></a>
+<FONT color="green">446</FONT>            final int nRows = getRowDimension();<a name="line.446"></a>
+<FONT color="green">447</FONT>            final RealMatrix out = createMatrix(nRows, 1);<a name="line.447"></a>
+<FONT color="green">448</FONT>            for (int i = 0; i &lt; nRows; ++i) {<a name="line.448"></a>
+<FONT color="green">449</FONT>                out.setEntry(i, 0, getEntry(i, column));<a name="line.449"></a>
+<FONT color="green">450</FONT>            }<a name="line.450"></a>
+<FONT color="green">451</FONT>    <a name="line.451"></a>
+<FONT color="green">452</FONT>            return out;<a name="line.452"></a>
+<FONT color="green">453</FONT>    <a name="line.453"></a>
+<FONT color="green">454</FONT>        }<a name="line.454"></a>
+<FONT color="green">455</FONT>    <a name="line.455"></a>
+<FONT color="green">456</FONT>        /** {@inheritDoc} */<a name="line.456"></a>
+<FONT color="green">457</FONT>        public void setColumnMatrix(final int column, final RealMatrix matrix)<a name="line.457"></a>
+<FONT color="green">458</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.458"></a>
+<FONT color="green">459</FONT>    <a name="line.459"></a>
+<FONT color="green">460</FONT>            MatrixUtils.checkColumnIndex(this, column);<a name="line.460"></a>
+<FONT color="green">461</FONT>            final int nRows = getRowDimension();<a name="line.461"></a>
+<FONT color="green">462</FONT>            if ((matrix.getRowDimension() != nRows) ||<a name="line.462"></a>
+<FONT color="green">463</FONT>                (matrix.getColumnDimension() != 1)) {<a name="line.463"></a>
+<FONT color="green">464</FONT>                throw new InvalidMatrixException(<a name="line.464"></a>
+<FONT color="green">465</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.465"></a>
+<FONT color="green">466</FONT>                        matrix.getRowDimension(), matrix.getColumnDimension(), nRows, 1);<a name="line.466"></a>
+<FONT color="green">467</FONT>            }<a name="line.467"></a>
+<FONT color="green">468</FONT>            for (int i = 0; i &lt; nRows; ++i) {<a name="line.468"></a>
+<FONT color="green">469</FONT>                setEntry(i, column, matrix.getEntry(i, 0));<a name="line.469"></a>
+<FONT color="green">470</FONT>            }<a name="line.470"></a>
+<FONT color="green">471</FONT>    <a name="line.471"></a>
+<FONT color="green">472</FONT>        }<a name="line.472"></a>
+<FONT color="green">473</FONT>    <a name="line.473"></a>
+<FONT color="green">474</FONT>        /** {@inheritDoc} */<a name="line.474"></a>
+<FONT color="green">475</FONT>        public RealVector getRowVector(final int row)<a name="line.475"></a>
+<FONT color="green">476</FONT>            throws MatrixIndexException {<a name="line.476"></a>
+<FONT color="green">477</FONT>            return new ArrayRealVector(getRow(row), false);<a name="line.477"></a>
+<FONT color="green">478</FONT>        }<a name="line.478"></a>
+<FONT color="green">479</FONT>    <a name="line.479"></a>
+<FONT color="green">480</FONT>        /** {@inheritDoc} */<a name="line.480"></a>
+<FONT color="green">481</FONT>        public void setRowVector(final int row, final RealVector vector)<a name="line.481"></a>
+<FONT color="green">482</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.482"></a>
+<FONT color="green">483</FONT>    <a name="line.483"></a>
+<FONT color="green">484</FONT>            MatrixUtils.checkRowIndex(this, row);<a name="line.484"></a>
+<FONT color="green">485</FONT>            final int nCols = getColumnDimension();<a name="line.485"></a>
+<FONT color="green">486</FONT>            if (vector.getDimension() != nCols) {<a name="line.486"></a>
+<FONT color="green">487</FONT>                throw new InvalidMatrixException(<a name="line.487"></a>
+<FONT color="green">488</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.488"></a>
+<FONT color="green">489</FONT>                        1, vector.getDimension(), 1, nCols);<a name="line.489"></a>
+<FONT color="green">490</FONT>            }<a name="line.490"></a>
+<FONT color="green">491</FONT>            for (int i = 0; i &lt; nCols; ++i) {<a name="line.491"></a>
+<FONT color="green">492</FONT>                setEntry(row, i, vector.getEntry(i));<a name="line.492"></a>
+<FONT color="green">493</FONT>            }<a name="line.493"></a>
+<FONT color="green">494</FONT>    <a name="line.494"></a>
+<FONT color="green">495</FONT>        }<a name="line.495"></a>
+<FONT color="green">496</FONT>    <a name="line.496"></a>
+<FONT color="green">497</FONT>        /** {@inheritDoc} */<a name="line.497"></a>
+<FONT color="green">498</FONT>        public RealVector getColumnVector(final int column)<a name="line.498"></a>
+<FONT color="green">499</FONT>            throws MatrixIndexException {<a name="line.499"></a>
+<FONT color="green">500</FONT>            return new ArrayRealVector(getColumn(column), false);<a name="line.500"></a>
+<FONT color="green">501</FONT>        }<a name="line.501"></a>
+<FONT color="green">502</FONT>    <a name="line.502"></a>
+<FONT color="green">503</FONT>        /** {@inheritDoc} */<a name="line.503"></a>
+<FONT color="green">504</FONT>        public void setColumnVector(final int column, final RealVector vector)<a name="line.504"></a>
+<FONT color="green">505</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.505"></a>
+<FONT color="green">506</FONT>    <a name="line.506"></a>
+<FONT color="green">507</FONT>            MatrixUtils.checkColumnIndex(this, column);<a name="line.507"></a>
+<FONT color="green">508</FONT>            final int nRows = getRowDimension();<a name="line.508"></a>
+<FONT color="green">509</FONT>            if (vector.getDimension() != nRows) {<a name="line.509"></a>
+<FONT color="green">510</FONT>                throw new InvalidMatrixException(<a name="line.510"></a>
+<FONT color="green">511</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.511"></a>
+<FONT color="green">512</FONT>                        vector.getDimension(), 1, nRows, 1);<a name="line.512"></a>
+<FONT color="green">513</FONT>            }<a name="line.513"></a>
+<FONT color="green">514</FONT>            for (int i = 0; i &lt; nRows; ++i) {<a name="line.514"></a>
+<FONT color="green">515</FONT>                setEntry(i, column, vector.getEntry(i));<a name="line.515"></a>
+<FONT color="green">516</FONT>            }<a name="line.516"></a>
+<FONT color="green">517</FONT>    <a name="line.517"></a>
+<FONT color="green">518</FONT>        }<a name="line.518"></a>
+<FONT color="green">519</FONT>    <a name="line.519"></a>
+<FONT color="green">520</FONT>        /** {@inheritDoc} */<a name="line.520"></a>
+<FONT color="green">521</FONT>        public double[] getRow(final int row)<a name="line.521"></a>
+<FONT color="green">522</FONT>            throws MatrixIndexException {<a name="line.522"></a>
+<FONT color="green">523</FONT>    <a name="line.523"></a>
+<FONT color="green">524</FONT>            MatrixUtils.checkRowIndex(this, row);<a name="line.524"></a>
+<FONT color="green">525</FONT>            final int nCols = getColumnDimension();<a name="line.525"></a>
+<FONT color="green">526</FONT>            final double[] out = new double[nCols];<a name="line.526"></a>
+<FONT color="green">527</FONT>            for (int i = 0; i &lt; nCols; ++i) {<a name="line.527"></a>
+<FONT color="green">528</FONT>                out[i] = getEntry(row, i);<a name="line.528"></a>
+<FONT color="green">529</FONT>            }<a name="line.529"></a>
+<FONT color="green">530</FONT>    <a name="line.530"></a>
+<FONT color="green">531</FONT>            return out;<a name="line.531"></a>
+<FONT color="green">532</FONT>    <a name="line.532"></a>
+<FONT color="green">533</FONT>        }<a name="line.533"></a>
+<FONT color="green">534</FONT>    <a name="line.534"></a>
+<FONT color="green">535</FONT>        /** {@inheritDoc} */<a name="line.535"></a>
+<FONT color="green">536</FONT>        public void setRow(final int row, final double[] array)<a name="line.536"></a>
+<FONT color="green">537</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.537"></a>
+<FONT color="green">538</FONT>    <a name="line.538"></a>
+<FONT color="green">539</FONT>            MatrixUtils.checkRowIndex(this, row);<a name="line.539"></a>
+<FONT color="green">540</FONT>            final int nCols = getColumnDimension();<a name="line.540"></a>
+<FONT color="green">541</FONT>            if (array.length != nCols) {<a name="line.541"></a>
+<FONT color="green">542</FONT>                throw new InvalidMatrixException(<a name="line.542"></a>
+<FONT color="green">543</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.543"></a>
+<FONT color="green">544</FONT>                        1, array.length, 1, nCols);<a name="line.544"></a>
+<FONT color="green">545</FONT>            }<a name="line.545"></a>
+<FONT color="green">546</FONT>            for (int i = 0; i &lt; nCols; ++i) {<a name="line.546"></a>
+<FONT color="green">547</FONT>                setEntry(row, i, array[i]);<a name="line.547"></a>
+<FONT color="green">548</FONT>            }<a name="line.548"></a>
+<FONT color="green">549</FONT>    <a name="line.549"></a>
+<FONT color="green">550</FONT>        }<a name="line.550"></a>
+<FONT color="green">551</FONT>    <a name="line.551"></a>
+<FONT color="green">552</FONT>        /** {@inheritDoc} */<a name="line.552"></a>
+<FONT color="green">553</FONT>        public double[] getColumn(final int column)<a name="line.553"></a>
+<FONT color="green">554</FONT>            throws MatrixIndexException {<a name="line.554"></a>
+<FONT color="green">555</FONT>    <a name="line.555"></a>
+<FONT color="green">556</FONT>            MatrixUtils.checkColumnIndex(this, column);<a name="line.556"></a>
+<FONT color="green">557</FONT>            final int nRows = getRowDimension();<a name="line.557"></a>
+<FONT color="green">558</FONT>            final double[] out = new double[nRows];<a name="line.558"></a>
+<FONT color="green">559</FONT>            for (int i = 0; i &lt; nRows; ++i) {<a name="line.559"></a>
+<FONT color="green">560</FONT>                out[i] = getEntry(i, column);<a name="line.560"></a>
+<FONT color="green">561</FONT>            }<a name="line.561"></a>
+<FONT color="green">562</FONT>    <a name="line.562"></a>
+<FONT color="green">563</FONT>            return out;<a name="line.563"></a>
+<FONT color="green">564</FONT>    <a name="line.564"></a>
+<FONT color="green">565</FONT>        }<a name="line.565"></a>
+<FONT color="green">566</FONT>    <a name="line.566"></a>
+<FONT color="green">567</FONT>        /** {@inheritDoc} */<a name="line.567"></a>
+<FONT color="green">568</FONT>        public void setColumn(final int column, final double[] array)<a name="line.568"></a>
+<FONT color="green">569</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.569"></a>
+<FONT color="green">570</FONT>    <a name="line.570"></a>
+<FONT color="green">571</FONT>            MatrixUtils.checkColumnIndex(this, column);<a name="line.571"></a>
+<FONT color="green">572</FONT>            final int nRows = getRowDimension();<a name="line.572"></a>
+<FONT color="green">573</FONT>            if (array.length != nRows) {<a name="line.573"></a>
+<FONT color="green">574</FONT>                throw new InvalidMatrixException(<a name="line.574"></a>
+<FONT color="green">575</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.575"></a>
+<FONT color="green">576</FONT>                        array.length, 1, nRows, 1);<a name="line.576"></a>
+<FONT color="green">577</FONT>            }<a name="line.577"></a>
+<FONT color="green">578</FONT>            for (int i = 0; i &lt; nRows; ++i) {<a name="line.578"></a>
+<FONT color="green">579</FONT>                setEntry(i, column, array[i]);<a name="line.579"></a>
+<FONT color="green">580</FONT>            }<a name="line.580"></a>
+<FONT color="green">581</FONT>    <a name="line.581"></a>
+<FONT color="green">582</FONT>        }<a name="line.582"></a>
+<FONT color="green">583</FONT>    <a name="line.583"></a>
+<FONT color="green">584</FONT>        /** {@inheritDoc} */<a name="line.584"></a>
+<FONT color="green">585</FONT>        public abstract double getEntry(int row, int column)<a name="line.585"></a>
+<FONT color="green">586</FONT>            throws MatrixIndexException;<a name="line.586"></a>
+<FONT color="green">587</FONT>    <a name="line.587"></a>
+<FONT color="green">588</FONT>        /** {@inheritDoc} */<a name="line.588"></a>
+<FONT color="green">589</FONT>        public abstract void setEntry(int row, int column, double value)<a name="line.589"></a>
+<FONT color="green">590</FONT>            throws MatrixIndexException;<a name="line.590"></a>
+<FONT color="green">591</FONT>    <a name="line.591"></a>
+<FONT color="green">592</FONT>        /** {@inheritDoc} */<a name="line.592"></a>
+<FONT color="green">593</FONT>        public abstract void addToEntry(int row, int column, double increment)<a name="line.593"></a>
+<FONT color="green">594</FONT>            throws MatrixIndexException;<a name="line.594"></a>
+<FONT color="green">595</FONT>    <a name="line.595"></a>
+<FONT color="green">596</FONT>        /** {@inheritDoc} */<a name="line.596"></a>
+<FONT color="green">597</FONT>        public abstract void multiplyEntry(int row, int column, double factor)<a name="line.597"></a>
+<FONT color="green">598</FONT>            throws MatrixIndexException;<a name="line.598"></a>
+<FONT color="green">599</FONT>    <a name="line.599"></a>
+<FONT color="green">600</FONT>        /** {@inheritDoc} */<a name="line.600"></a>
+<FONT color="green">601</FONT>        public RealMatrix transpose() {<a name="line.601"></a>
+<FONT color="green">602</FONT>    <a name="line.602"></a>
+<FONT color="green">603</FONT>            final int nRows = getRowDimension();<a name="line.603"></a>
+<FONT color="green">604</FONT>            final int nCols = getColumnDimension();<a name="line.604"></a>
+<FONT color="green">605</FONT>            final RealMatrix out = createMatrix(nCols, nRows);<a name="line.605"></a>
+<FONT color="green">606</FONT>            walkInOptimizedOrder(new DefaultRealMatrixPreservingVisitor() {<a name="line.606"></a>
+<FONT color="green">607</FONT>    <a name="line.607"></a>
+<FONT color="green">608</FONT>                /** {@inheritDoc} */<a name="line.608"></a>
+<FONT color="green">609</FONT>                @Override<a name="line.609"></a>
+<FONT color="green">610</FONT>                public void visit(final int row, final int column, final double value) {<a name="line.610"></a>
+<FONT color="green">611</FONT>                    out.setEntry(column, row, value);<a name="line.611"></a>
+<FONT color="green">612</FONT>                }<a name="line.612"></a>
+<FONT color="green">613</FONT>    <a name="line.613"></a>
+<FONT color="green">614</FONT>            });<a name="line.614"></a>
+<FONT color="green">615</FONT>    <a name="line.615"></a>
+<FONT color="green">616</FONT>            return out;<a name="line.616"></a>
+<FONT color="green">617</FONT>    <a name="line.617"></a>
+<FONT color="green">618</FONT>        }<a name="line.618"></a>
+<FONT color="green">619</FONT>    <a name="line.619"></a>
+<FONT color="green">620</FONT>        /** {@inheritDoc} */<a name="line.620"></a>
+<FONT color="green">621</FONT>        @Deprecated<a name="line.621"></a>
+<FONT color="green">622</FONT>        public RealMatrix inverse()<a name="line.622"></a>
+<FONT color="green">623</FONT>            throws InvalidMatrixException {<a name="line.623"></a>
+<FONT color="green">624</FONT>            if (lu == null) {<a name="line.624"></a>
+<FONT color="green">625</FONT>                lu = new LUDecompositionImpl(this, MathUtils.SAFE_MIN).getSolver();<a name="line.625"></a>
+<FONT color="green">626</FONT>            }<a name="line.626"></a>
+<FONT color="green">627</FONT>            return lu.getInverse();<a name="line.627"></a>
+<FONT color="green">628</FONT>        }<a name="line.628"></a>
+<FONT color="green">629</FONT>    <a name="line.629"></a>
+<FONT color="green">630</FONT>        /** {@inheritDoc} */<a name="line.630"></a>
+<FONT color="green">631</FONT>        @Deprecated<a name="line.631"></a>
+<FONT color="green">632</FONT>        public double getDeterminant()<a name="line.632"></a>
+<FONT color="green">633</FONT>            throws InvalidMatrixException {<a name="line.633"></a>
+<FONT color="green">634</FONT>            return new LUDecompositionImpl(this, MathUtils.SAFE_MIN).getDeterminant();<a name="line.634"></a>
+<FONT color="green">635</FONT>        }<a name="line.635"></a>
+<FONT color="green">636</FONT>    <a name="line.636"></a>
+<FONT color="green">637</FONT>        /** {@inheritDoc} */<a name="line.637"></a>
+<FONT color="green">638</FONT>        public boolean isSquare() {<a name="line.638"></a>
+<FONT color="green">639</FONT>            return getColumnDimension() == getRowDimension();<a name="line.639"></a>
+<FONT color="green">640</FONT>        }<a name="line.640"></a>
+<FONT color="green">641</FONT>    <a name="line.641"></a>
+<FONT color="green">642</FONT>        /** {@inheritDoc} */<a name="line.642"></a>
+<FONT color="green">643</FONT>        @Deprecated<a name="line.643"></a>
+<FONT color="green">644</FONT>        public boolean isSingular() {<a name="line.644"></a>
+<FONT color="green">645</FONT>            if (lu == null) {<a name="line.645"></a>
+<FONT color="green">646</FONT>                lu = new LUDecompositionImpl(this, MathUtils.SAFE_MIN).getSolver();<a name="line.646"></a>
+<FONT color="green">647</FONT>           }<a name="line.647"></a>
+<FONT color="green">648</FONT>            return !lu.isNonSingular();<a name="line.648"></a>
+<FONT color="green">649</FONT>        }<a name="line.649"></a>
+<FONT color="green">650</FONT>    <a name="line.650"></a>
+<FONT color="green">651</FONT>        /** {@inheritDoc} */<a name="line.651"></a>
+<FONT color="green">652</FONT>        public abstract int getRowDimension();<a name="line.652"></a>
+<FONT color="green">653</FONT>    <a name="line.653"></a>
+<FONT color="green">654</FONT>        /** {@inheritDoc} */<a name="line.654"></a>
+<FONT color="green">655</FONT>        public abstract int getColumnDimension();<a name="line.655"></a>
+<FONT color="green">656</FONT>    <a name="line.656"></a>
+<FONT color="green">657</FONT>        /** {@inheritDoc} */<a name="line.657"></a>
+<FONT color="green">658</FONT>        public double getTrace()<a name="line.658"></a>
+<FONT color="green">659</FONT>            throws NonSquareMatrixException {<a name="line.659"></a>
+<FONT color="green">660</FONT>            final int nRows = getRowDimension();<a name="line.660"></a>
+<FONT color="green">661</FONT>            final int nCols = getColumnDimension();<a name="line.661"></a>
+<FONT color="green">662</FONT>            if (nRows != nCols) {<a name="line.662"></a>
+<FONT color="green">663</FONT>                throw new NonSquareMatrixException(nRows, nCols);<a name="line.663"></a>
+<FONT color="green">664</FONT>           }<a name="line.664"></a>
+<FONT color="green">665</FONT>            double trace = 0;<a name="line.665"></a>
+<FONT color="green">666</FONT>            for (int i = 0; i &lt; nRows; ++i) {<a name="line.666"></a>
+<FONT color="green">667</FONT>                trace += getEntry(i, i);<a name="line.667"></a>
+<FONT color="green">668</FONT>            }<a name="line.668"></a>
+<FONT color="green">669</FONT>            return trace;<a name="line.669"></a>
+<FONT color="green">670</FONT>        }<a name="line.670"></a>
+<FONT color="green">671</FONT>    <a name="line.671"></a>
+<FONT color="green">672</FONT>        /** {@inheritDoc} */<a name="line.672"></a>
+<FONT color="green">673</FONT>        public double[] operate(final double[] v)<a name="line.673"></a>
+<FONT color="green">674</FONT>            throws IllegalArgumentException {<a name="line.674"></a>
+<FONT color="green">675</FONT>    <a name="line.675"></a>
+<FONT color="green">676</FONT>            final int nRows = getRowDimension();<a name="line.676"></a>
+<FONT color="green">677</FONT>            final int nCols = getColumnDimension();<a name="line.677"></a>
+<FONT color="green">678</FONT>            if (v.length != nCols) {<a name="line.678"></a>
+<FONT color="green">679</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.679"></a>
+<FONT color="green">680</FONT>                        "vector length mismatch: got {0} but expected {1}",<a name="line.680"></a>
+<FONT color="green">681</FONT>                        v.length, nCols);<a name="line.681"></a>
+<FONT color="green">682</FONT>            }<a name="line.682"></a>
+<FONT color="green">683</FONT>    <a name="line.683"></a>
+<FONT color="green">684</FONT>            final double[] out = new double[nRows];<a name="line.684"></a>
+<FONT color="green">685</FONT>            for (int row = 0; row &lt; nRows; ++row) {<a name="line.685"></a>
+<FONT color="green">686</FONT>                double sum = 0;<a name="line.686"></a>
+<FONT color="green">687</FONT>                for (int i = 0; i &lt; nCols; ++i) {<a name="line.687"></a>
+<FONT color="green">688</FONT>                    sum += getEntry(row, i) * v[i];<a name="line.688"></a>
+<FONT color="green">689</FONT>                }<a name="line.689"></a>
+<FONT color="green">690</FONT>                out[row] = sum;<a name="line.690"></a>
+<FONT color="green">691</FONT>            }<a name="line.691"></a>
+<FONT color="green">692</FONT>    <a name="line.692"></a>
+<FONT color="green">693</FONT>            return out;<a name="line.693"></a>
+<FONT color="green">694</FONT>    <a name="line.694"></a>
+<FONT color="green">695</FONT>        }<a name="line.695"></a>
+<FONT color="green">696</FONT>    <a name="line.696"></a>
+<FONT color="green">697</FONT>        /** {@inheritDoc} */<a name="line.697"></a>
+<FONT color="green">698</FONT>        public RealVector operate(final RealVector v)<a name="line.698"></a>
+<FONT color="green">699</FONT>            throws IllegalArgumentException {<a name="line.699"></a>
+<FONT color="green">700</FONT>            try {<a name="line.700"></a>
+<FONT color="green">701</FONT>                return new ArrayRealVector(operate(((ArrayRealVector) v).getDataRef()), false);<a name="line.701"></a>
+<FONT color="green">702</FONT>            } catch (ClassCastException cce) {<a name="line.702"></a>
+<FONT color="green">703</FONT>                final int nRows = getRowDimension();<a name="line.703"></a>
+<FONT color="green">704</FONT>                final int nCols = getColumnDimension();<a name="line.704"></a>
+<FONT color="green">705</FONT>                if (v.getDimension() != nCols) {<a name="line.705"></a>
+<FONT color="green">706</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.706"></a>
+<FONT color="green">707</FONT>                            "vector length mismatch: got {0} but expected {1}",<a name="line.707"></a>
+<FONT color="green">708</FONT>                            v.getDimension(), nCols);<a name="line.708"></a>
+<FONT color="green">709</FONT>                }<a name="line.709"></a>
+<FONT color="green">710</FONT>    <a name="line.710"></a>
+<FONT color="green">711</FONT>                final double[] out = new double[nRows];<a name="line.711"></a>
+<FONT color="green">712</FONT>                for (int row = 0; row &lt; nRows; ++row) {<a name="line.712"></a>
+<FONT color="green">713</FONT>                    double sum = 0;<a name="line.713"></a>
+<FONT color="green">714</FONT>                    for (int i = 0; i &lt; nCols; ++i) {<a name="line.714"></a>
+<FONT color="green">715</FONT>                        sum += getEntry(row, i) * v.getEntry(i);<a name="line.715"></a>
+<FONT color="green">716</FONT>                    }<a name="line.716"></a>
+<FONT color="green">717</FONT>                    out[row] = sum;<a name="line.717"></a>
+<FONT color="green">718</FONT>                }<a name="line.718"></a>
+<FONT color="green">719</FONT>    <a name="line.719"></a>
+<FONT color="green">720</FONT>                return new ArrayRealVector(out, false);<a name="line.720"></a>
+<FONT color="green">721</FONT>            }<a name="line.721"></a>
+<FONT color="green">722</FONT>        }<a name="line.722"></a>
+<FONT color="green">723</FONT>    <a name="line.723"></a>
+<FONT color="green">724</FONT>        /** {@inheritDoc} */<a name="line.724"></a>
+<FONT color="green">725</FONT>        public double[] preMultiply(final double[] v)<a name="line.725"></a>
+<FONT color="green">726</FONT>            throws IllegalArgumentException {<a name="line.726"></a>
+<FONT color="green">727</FONT>    <a name="line.727"></a>
+<FONT color="green">728</FONT>            final int nRows = getRowDimension();<a name="line.728"></a>
+<FONT color="green">729</FONT>            final int nCols = getColumnDimension();<a name="line.729"></a>
+<FONT color="green">730</FONT>            if (v.length != nRows) {<a name="line.730"></a>
+<FONT color="green">731</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.731"></a>
+<FONT color="green">732</FONT>                        "vector length mismatch: got {0} but expected {1}",<a name="line.732"></a>
+<FONT color="green">733</FONT>                        v.length, nRows);<a name="line.733"></a>
+<FONT color="green">734</FONT>            }<a name="line.734"></a>
+<FONT color="green">735</FONT>    <a name="line.735"></a>
+<FONT color="green">736</FONT>            final double[] out = new double[nCols];<a name="line.736"></a>
+<FONT color="green">737</FONT>            for (int col = 0; col &lt; nCols; ++col) {<a name="line.737"></a>
+<FONT color="green">738</FONT>                double sum = 0;<a name="line.738"></a>
+<FONT color="green">739</FONT>                for (int i = 0; i &lt; nRows; ++i) {<a name="line.739"></a>
+<FONT color="green">740</FONT>                    sum += getEntry(i, col) * v[i];<a name="line.740"></a>
+<FONT color="green">741</FONT>                }<a name="line.741"></a>
+<FONT color="green">742</FONT>                out[col] = sum;<a name="line.742"></a>
+<FONT color="green">743</FONT>            }<a name="line.743"></a>
+<FONT color="green">744</FONT>    <a name="line.744"></a>
+<FONT color="green">745</FONT>            return out;<a name="line.745"></a>
+<FONT color="green">746</FONT>    <a name="line.746"></a>
+<FONT color="green">747</FONT>        }<a name="line.747"></a>
+<FONT color="green">748</FONT>    <a name="line.748"></a>
+<FONT color="green">749</FONT>        /** {@inheritDoc} */<a name="line.749"></a>
+<FONT color="green">750</FONT>        public RealVector preMultiply(final RealVector v)<a name="line.750"></a>
+<FONT color="green">751</FONT>            throws IllegalArgumentException {<a name="line.751"></a>
+<FONT color="green">752</FONT>            try {<a name="line.752"></a>
+<FONT color="green">753</FONT>                return new ArrayRealVector(preMultiply(((ArrayRealVector) v).getDataRef()), false);<a name="line.753"></a>
+<FONT color="green">754</FONT>            } catch (ClassCastException cce) {<a name="line.754"></a>
+<FONT color="green">755</FONT>    <a name="line.755"></a>
+<FONT color="green">756</FONT>                final int nRows = getRowDimension();<a name="line.756"></a>
+<FONT color="green">757</FONT>                final int nCols = getColumnDimension();<a name="line.757"></a>
+<FONT color="green">758</FONT>                if (v.getDimension() != nRows) {<a name="line.758"></a>
+<FONT color="green">759</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.759"></a>
+<FONT color="green">760</FONT>                            "vector length mismatch: got {0} but expected {1}",<a name="line.760"></a>
+<FONT color="green">761</FONT>                            v.getDimension(), nRows);<a name="line.761"></a>
+<FONT color="green">762</FONT>                }<a name="line.762"></a>
+<FONT color="green">763</FONT>    <a name="line.763"></a>
+<FONT color="green">764</FONT>                final double[] out = new double[nCols];<a name="line.764"></a>
+<FONT color="green">765</FONT>                for (int col = 0; col &lt; nCols; ++col) {<a name="line.765"></a>
+<FONT color="green">766</FONT>                    double sum = 0;<a name="line.766"></a>
+<FONT color="green">767</FONT>                    for (int i = 0; i &lt; nRows; ++i) {<a name="line.767"></a>
+<FONT color="green">768</FONT>                        sum += getEntry(i, col) * v.getEntry(i);<a name="line.768"></a>
+<FONT color="green">769</FONT>                    }<a name="line.769"></a>
+<FONT color="green">770</FONT>                    out[col] = sum;<a name="line.770"></a>
+<FONT color="green">771</FONT>                }<a name="line.771"></a>
+<FONT color="green">772</FONT>    <a name="line.772"></a>
+<FONT color="green">773</FONT>                return new ArrayRealVector(out);<a name="line.773"></a>
+<FONT color="green">774</FONT>    <a name="line.774"></a>
+<FONT color="green">775</FONT>            }<a name="line.775"></a>
+<FONT color="green">776</FONT>        }<a name="line.776"></a>
+<FONT color="green">777</FONT>    <a name="line.777"></a>
+<FONT color="green">778</FONT>        /** {@inheritDoc} */<a name="line.778"></a>
+<FONT color="green">779</FONT>        public double walkInRowOrder(final RealMatrixChangingVisitor visitor)<a name="line.779"></a>
+<FONT color="green">780</FONT>            throws MatrixVisitorException {<a name="line.780"></a>
+<FONT color="green">781</FONT>            final int rows    = getRowDimension();<a name="line.781"></a>
+<FONT color="green">782</FONT>            final int columns = getColumnDimension();<a name="line.782"></a>
+<FONT color="green">783</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.783"></a>
+<FONT color="green">784</FONT>            for (int row = 0; row &lt; rows; ++row) {<a name="line.784"></a>
+<FONT color="green">785</FONT>                for (int column = 0; column &lt; columns; ++column) {<a name="line.785"></a>
+<FONT color="green">786</FONT>                    final double oldValue = getEntry(row, column);<a name="line.786"></a>
+<FONT color="green">787</FONT>                    final double newValue = visitor.visit(row, column, oldValue);<a name="line.787"></a>
+<FONT color="green">788</FONT>                    setEntry(row, column, newValue);<a name="line.788"></a>
+<FONT color="green">789</FONT>                }<a name="line.789"></a>
+<FONT color="green">790</FONT>            }<a name="line.790"></a>
+<FONT color="green">791</FONT>            lu = null;<a name="line.791"></a>
+<FONT color="green">792</FONT>            return visitor.end();<a name="line.792"></a>
+<FONT color="green">793</FONT>        }<a name="line.793"></a>
+<FONT color="green">794</FONT>    <a name="line.794"></a>
+<FONT color="green">795</FONT>        /** {@inheritDoc} */<a name="line.795"></a>
+<FONT color="green">796</FONT>        public double walkInRowOrder(final RealMatrixPreservingVisitor visitor)<a name="line.796"></a>
+<FONT color="green">797</FONT>            throws MatrixVisitorException {<a name="line.797"></a>
+<FONT color="green">798</FONT>            final int rows    = getRowDimension();<a name="line.798"></a>
+<FONT color="green">799</FONT>            final int columns = getColumnDimension();<a name="line.799"></a>
+<FONT color="green">800</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.800"></a>
+<FONT color="green">801</FONT>            for (int row = 0; row &lt; rows; ++row) {<a name="line.801"></a>
+<FONT color="green">802</FONT>                for (int column = 0; column &lt; columns; ++column) {<a name="line.802"></a>
+<FONT color="green">803</FONT>                    visitor.visit(row, column, getEntry(row, column));<a name="line.803"></a>
+<FONT color="green">804</FONT>                }<a name="line.804"></a>
+<FONT color="green">805</FONT>            }<a name="line.805"></a>
+<FONT color="green">806</FONT>            return visitor.end();<a name="line.806"></a>
+<FONT color="green">807</FONT>        }<a name="line.807"></a>
+<FONT color="green">808</FONT>    <a name="line.808"></a>
+<FONT color="green">809</FONT>        /** {@inheritDoc} */<a name="line.809"></a>
+<FONT color="green">810</FONT>        public double walkInRowOrder(final RealMatrixChangingVisitor visitor,<a name="line.810"></a>
+<FONT color="green">811</FONT>                                     final int startRow, final int endRow,<a name="line.811"></a>
+<FONT color="green">812</FONT>                                     final int startColumn, final int endColumn)<a name="line.812"></a>
+<FONT color="green">813</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.813"></a>
+<FONT color="green">814</FONT>            MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);<a name="line.814"></a>
+<FONT color="green">815</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.815"></a>
+<FONT color="green">816</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.816"></a>
+<FONT color="green">817</FONT>            for (int row = startRow; row &lt;= endRow; ++row) {<a name="line.817"></a>
+<FONT color="green">818</FONT>                for (int column = startColumn; column &lt;= endColumn; ++column) {<a name="line.818"></a>
+<FONT color="green">819</FONT>                    final double oldValue = getEntry(row, column);<a name="line.819"></a>
+<FONT color="green">820</FONT>                    final double newValue = visitor.visit(row, column, oldValue);<a name="line.820"></a>
+<FONT color="green">821</FONT>                    setEntry(row, column, newValue);<a name="line.821"></a>
+<FONT color="green">822</FONT>                }<a name="line.822"></a>
+<FONT color="green">823</FONT>            }<a name="line.823"></a>
+<FONT color="green">824</FONT>            lu = null;<a name="line.824"></a>
+<FONT color="green">825</FONT>            return visitor.end();<a name="line.825"></a>
+<FONT color="green">826</FONT>        }<a name="line.826"></a>
+<FONT color="green">827</FONT>    <a name="line.827"></a>
+<FONT color="green">828</FONT>        /** {@inheritDoc} */<a name="line.828"></a>
+<FONT color="green">829</FONT>        public double walkInRowOrder(final RealMatrixPreservingVisitor visitor,<a name="line.829"></a>
+<FONT color="green">830</FONT>                                     final int startRow, final int endRow,<a name="line.830"></a>
+<FONT color="green">831</FONT>                                     final int startColumn, final int endColumn)<a name="line.831"></a>
+<FONT color="green">832</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.832"></a>
+<FONT color="green">833</FONT>            MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);<a name="line.833"></a>
+<FONT color="green">834</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.834"></a>
+<FONT color="green">835</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.835"></a>
+<FONT color="green">836</FONT>            for (int row = startRow; row &lt;= endRow; ++row) {<a name="line.836"></a>
+<FONT color="green">837</FONT>                for (int column = startColumn; column &lt;= endColumn; ++column) {<a name="line.837"></a>
+<FONT color="green">838</FONT>                    visitor.visit(row, column, getEntry(row, column));<a name="line.838"></a>
+<FONT color="green">839</FONT>                }<a name="line.839"></a>
+<FONT color="green">840</FONT>            }<a name="line.840"></a>
+<FONT color="green">841</FONT>            return visitor.end();<a name="line.841"></a>
+<FONT color="green">842</FONT>        }<a name="line.842"></a>
+<FONT color="green">843</FONT>    <a name="line.843"></a>
+<FONT color="green">844</FONT>        /** {@inheritDoc} */<a name="line.844"></a>
+<FONT color="green">845</FONT>        public double walkInColumnOrder(final RealMatrixChangingVisitor visitor)<a name="line.845"></a>
+<FONT color="green">846</FONT>            throws MatrixVisitorException {<a name="line.846"></a>
+<FONT color="green">847</FONT>            final int rows    = getRowDimension();<a name="line.847"></a>
+<FONT color="green">848</FONT>            final int columns = getColumnDimension();<a name="line.848"></a>
+<FONT color="green">849</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.849"></a>
+<FONT color="green">850</FONT>            for (int column = 0; column &lt; columns; ++column) {<a name="line.850"></a>
+<FONT color="green">851</FONT>                for (int row = 0; row &lt; rows; ++row) {<a name="line.851"></a>
+<FONT color="green">852</FONT>                    final double oldValue = getEntry(row, column);<a name="line.852"></a>
+<FONT color="green">853</FONT>                    final double newValue = visitor.visit(row, column, oldValue);<a name="line.853"></a>
+<FONT color="green">854</FONT>                    setEntry(row, column, newValue);<a name="line.854"></a>
+<FONT color="green">855</FONT>                }<a name="line.855"></a>
+<FONT color="green">856</FONT>            }<a name="line.856"></a>
+<FONT color="green">857</FONT>            lu = null;<a name="line.857"></a>
+<FONT color="green">858</FONT>            return visitor.end();<a name="line.858"></a>
+<FONT color="green">859</FONT>        }<a name="line.859"></a>
+<FONT color="green">860</FONT>    <a name="line.860"></a>
+<FONT color="green">861</FONT>        /** {@inheritDoc} */<a name="line.861"></a>
+<FONT color="green">862</FONT>        public double walkInColumnOrder(final RealMatrixPreservingVisitor visitor)<a name="line.862"></a>
+<FONT color="green">863</FONT>            throws MatrixVisitorException {<a name="line.863"></a>
+<FONT color="green">864</FONT>            final int rows    = getRowDimension();<a name="line.864"></a>
+<FONT color="green">865</FONT>            final int columns = getColumnDimension();<a name="line.865"></a>
+<FONT color="green">866</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.866"></a>
+<FONT color="green">867</FONT>            for (int column = 0; column &lt; columns; ++column) {<a name="line.867"></a>
+<FONT color="green">868</FONT>                for (int row = 0; row &lt; rows; ++row) {<a name="line.868"></a>
+<FONT color="green">869</FONT>                    visitor.visit(row, column, getEntry(row, column));<a name="line.869"></a>
+<FONT color="green">870</FONT>                }<a name="line.870"></a>
+<FONT color="green">871</FONT>            }<a name="line.871"></a>
+<FONT color="green">872</FONT>            return visitor.end();<a name="line.872"></a>
+<FONT color="green">873</FONT>        }<a name="line.873"></a>
+<FONT color="green">874</FONT>    <a name="line.874"></a>
+<FONT color="green">875</FONT>        /** {@inheritDoc} */<a name="line.875"></a>
+<FONT color="green">876</FONT>        public double walkInColumnOrder(final RealMatrixChangingVisitor visitor,<a name="line.876"></a>
+<FONT color="green">877</FONT>                                        final int startRow, final int endRow,<a name="line.877"></a>
+<FONT color="green">878</FONT>                                        final int startColumn, final int endColumn)<a name="line.878"></a>
+<FONT color="green">879</FONT>        throws MatrixIndexException, MatrixVisitorException {<a name="line.879"></a>
+<FONT color="green">880</FONT>            MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);<a name="line.880"></a>
+<FONT color="green">881</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.881"></a>
+<FONT color="green">882</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.882"></a>
+<FONT color="green">883</FONT>            for (int column = startColumn; column &lt;= endColumn; ++column) {<a name="line.883"></a>
+<FONT color="green">884</FONT>                for (int row = startRow; row &lt;= endRow; ++row) {<a name="line.884"></a>
+<FONT color="green">885</FONT>                    final double oldValue = getEntry(row, column);<a name="line.885"></a>
+<FONT color="green">886</FONT>                    final double newValue = visitor.visit(row, column, oldValue);<a name="line.886"></a>
+<FONT color="green">887</FONT>                    setEntry(row, column, newValue);<a name="line.887"></a>
+<FONT color="green">888</FONT>                }<a name="line.888"></a>
+<FONT color="green">889</FONT>            }<a name="line.889"></a>
+<FONT color="green">890</FONT>            lu = null;<a name="line.890"></a>
+<FONT color="green">891</FONT>            return visitor.end();<a name="line.891"></a>
+<FONT color="green">892</FONT>        }<a name="line.892"></a>
+<FONT color="green">893</FONT>    <a name="line.893"></a>
+<FONT color="green">894</FONT>        /** {@inheritDoc} */<a name="line.894"></a>
+<FONT color="green">895</FONT>        public double walkInColumnOrder(final RealMatrixPreservingVisitor visitor,<a name="line.895"></a>
+<FONT color="green">896</FONT>                                        final int startRow, final int endRow,<a name="line.896"></a>
+<FONT color="green">897</FONT>                                        final int startColumn, final int endColumn)<a name="line.897"></a>
+<FONT color="green">898</FONT>        throws MatrixIndexException, MatrixVisitorException {<a name="line.898"></a>
+<FONT color="green">899</FONT>            MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);<a name="line.899"></a>
+<FONT color="green">900</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.900"></a>
+<FONT color="green">901</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.901"></a>
+<FONT color="green">902</FONT>            for (int column = startColumn; column &lt;= endColumn; ++column) {<a name="line.902"></a>
+<FONT color="green">903</FONT>                for (int row = startRow; row &lt;= endRow; ++row) {<a name="line.903"></a>
+<FONT color="green">904</FONT>                    visitor.visit(row, column, getEntry(row, column));<a name="line.904"></a>
+<FONT color="green">905</FONT>                }<a name="line.905"></a>
+<FONT color="green">906</FONT>            }<a name="line.906"></a>
+<FONT color="green">907</FONT>            return visitor.end();<a name="line.907"></a>
+<FONT color="green">908</FONT>        }<a name="line.908"></a>
+<FONT color="green">909</FONT>    <a name="line.909"></a>
+<FONT color="green">910</FONT>        /** {@inheritDoc} */<a name="line.910"></a>
+<FONT color="green">911</FONT>        public double walkInOptimizedOrder(final RealMatrixChangingVisitor visitor)<a name="line.911"></a>
+<FONT color="green">912</FONT>            throws MatrixVisitorException {<a name="line.912"></a>
+<FONT color="green">913</FONT>            return walkInRowOrder(visitor);<a name="line.913"></a>
+<FONT color="green">914</FONT>        }<a name="line.914"></a>
+<FONT color="green">915</FONT>    <a name="line.915"></a>
+<FONT color="green">916</FONT>        /** {@inheritDoc} */<a name="line.916"></a>
+<FONT color="green">917</FONT>        public double walkInOptimizedOrder(final RealMatrixPreservingVisitor visitor)<a name="line.917"></a>
+<FONT color="green">918</FONT>            throws MatrixVisitorException {<a name="line.918"></a>
+<FONT color="green">919</FONT>            return walkInRowOrder(visitor);<a name="line.919"></a>
+<FONT color="green">920</FONT>        }<a name="line.920"></a>
+<FONT color="green">921</FONT>    <a name="line.921"></a>
+<FONT color="green">922</FONT>        /** {@inheritDoc} */<a name="line.922"></a>
+<FONT color="green">923</FONT>        public double walkInOptimizedOrder(final RealMatrixChangingVisitor visitor,<a name="line.923"></a>
+<FONT color="green">924</FONT>                                           final int startRow, final int endRow,<a name="line.924"></a>
+<FONT color="green">925</FONT>                                           final int startColumn, final int endColumn)<a name="line.925"></a>
+<FONT color="green">926</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.926"></a>
+<FONT color="green">927</FONT>            return walkInRowOrder(visitor, startRow, endRow, startColumn, endColumn);<a name="line.927"></a>
+<FONT color="green">928</FONT>        }<a name="line.928"></a>
+<FONT color="green">929</FONT>    <a name="line.929"></a>
+<FONT color="green">930</FONT>        /** {@inheritDoc} */<a name="line.930"></a>
+<FONT color="green">931</FONT>        public double walkInOptimizedOrder(final RealMatrixPreservingVisitor visitor,<a name="line.931"></a>
+<FONT color="green">932</FONT>                                           final int startRow, final int endRow,<a name="line.932"></a>
+<FONT color="green">933</FONT>                                           final int startColumn, final int endColumn)<a name="line.933"></a>
+<FONT color="green">934</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.934"></a>
+<FONT color="green">935</FONT>            return walkInRowOrder(visitor, startRow, endRow, startColumn, endColumn);<a name="line.935"></a>
+<FONT color="green">936</FONT>        }<a name="line.936"></a>
+<FONT color="green">937</FONT>    <a name="line.937"></a>
+<FONT color="green">938</FONT>        /** {@inheritDoc} */<a name="line.938"></a>
+<FONT color="green">939</FONT>        @Deprecated<a name="line.939"></a>
+<FONT color="green">940</FONT>        public double[] solve(final double[] b)<a name="line.940"></a>
+<FONT color="green">941</FONT>            throws IllegalArgumentException, InvalidMatrixException {<a name="line.941"></a>
+<FONT color="green">942</FONT>            if (lu == null) {<a name="line.942"></a>
+<FONT color="green">943</FONT>                lu = new LUDecompositionImpl(this, MathUtils.SAFE_MIN).getSolver();<a name="line.943"></a>
+<FONT color="green">944</FONT>            }<a name="line.944"></a>
+<FONT color="green">945</FONT>            return lu.solve(b);<a name="line.945"></a>
+<FONT color="green">946</FONT>        }<a name="line.946"></a>
+<FONT color="green">947</FONT>    <a name="line.947"></a>
+<FONT color="green">948</FONT>        /** {@inheritDoc} */<a name="line.948"></a>
+<FONT color="green">949</FONT>        @Deprecated<a name="line.949"></a>
+<FONT color="green">950</FONT>        public RealMatrix solve(final RealMatrix b)<a name="line.950"></a>
+<FONT color="green">951</FONT>            throws IllegalArgumentException, InvalidMatrixException  {<a name="line.951"></a>
+<FONT color="green">952</FONT>            if (lu == null) {<a name="line.952"></a>
+<FONT color="green">953</FONT>                lu = new LUDecompositionImpl(this, MathUtils.SAFE_MIN).getSolver();<a name="line.953"></a>
+<FONT color="green">954</FONT>            }<a name="line.954"></a>
+<FONT color="green">955</FONT>            return lu.solve(b);<a name="line.955"></a>
+<FONT color="green">956</FONT>        }<a name="line.956"></a>
+<FONT color="green">957</FONT>    <a name="line.957"></a>
+<FONT color="green">958</FONT>        /**<a name="line.958"></a>
+<FONT color="green">959</FONT>         * Computes a new<a name="line.959"></a>
+<FONT color="green">960</FONT>         * &lt;a href="http://www.math.gatech.edu/~bourbaki/math2601/Web-notes/2num.pdf"&gt;<a name="line.960"></a>
+<FONT color="green">961</FONT>         * LU decomposition&lt;/a&gt; for this matrix, storing the result for use by other methods.<a name="line.961"></a>
+<FONT color="green">962</FONT>         * &lt;p&gt;<a name="line.962"></a>
+<FONT color="green">963</FONT>         * &lt;strong&gt;Implementation Note&lt;/strong&gt;:&lt;br&gt;<a name="line.963"></a>
+<FONT color="green">964</FONT>         * Uses &lt;a href="http://www.damtp.cam.ac.uk/user/fdl/people/sd/lectures/nummeth98/linear.htm"&gt;<a name="line.964"></a>
+<FONT color="green">965</FONT>         * Crout's algorithm&lt;/a&gt;, with partial pivoting.&lt;/p&gt;<a name="line.965"></a>
+<FONT color="green">966</FONT>         * &lt;p&gt;<a name="line.966"></a>
+<FONT color="green">967</FONT>         * &lt;strong&gt;Usage Note&lt;/strong&gt;:&lt;br&gt;<a name="line.967"></a>
+<FONT color="green">968</FONT>         * This method should rarely be invoked directly. Its only use is<a name="line.968"></a>
+<FONT color="green">969</FONT>         * to force recomputation of the LU decomposition when changes have been<a name="line.969"></a>
+<FONT color="green">970</FONT>         * made to the underlying data using direct array references. Changes<a name="line.970"></a>
+<FONT color="green">971</FONT>         * made using setXxx methods will trigger recomputation when needed<a name="line.971"></a>
+<FONT color="green">972</FONT>         * automatically.&lt;/p&gt;<a name="line.972"></a>
+<FONT color="green">973</FONT>         *<a name="line.973"></a>
+<FONT color="green">974</FONT>         * @throws InvalidMatrixException if the matrix is non-square or singular.<a name="line.974"></a>
+<FONT color="green">975</FONT>         * @deprecated as of release 2.0, replaced by {@link LUDecomposition}<a name="line.975"></a>
+<FONT color="green">976</FONT>         */<a name="line.976"></a>
+<FONT color="green">977</FONT>        @Deprecated<a name="line.977"></a>
+<FONT color="green">978</FONT>        public void luDecompose()<a name="line.978"></a>
+<FONT color="green">979</FONT>            throws InvalidMatrixException {<a name="line.979"></a>
+<FONT color="green">980</FONT>            if (lu == null) {<a name="line.980"></a>
+<FONT color="green">981</FONT>                lu = new LUDecompositionImpl(this, MathUtils.SAFE_MIN).getSolver();<a name="line.981"></a>
+<FONT color="green">982</FONT>            }<a name="line.982"></a>
+<FONT color="green">983</FONT>        }<a name="line.983"></a>
+<FONT color="green">984</FONT>    <a name="line.984"></a>
+<FONT color="green">985</FONT>        /**<a name="line.985"></a>
+<FONT color="green">986</FONT>         * Get a string representation for this matrix.<a name="line.986"></a>
+<FONT color="green">987</FONT>         * @return a string representation for this matrix<a name="line.987"></a>
+<FONT color="green">988</FONT>         */<a name="line.988"></a>
+<FONT color="green">989</FONT>        @Override<a name="line.989"></a>
+<FONT color="green">990</FONT>        public String toString() {<a name="line.990"></a>
+<FONT color="green">991</FONT>            final int nRows = getRowDimension();<a name="line.991"></a>
+<FONT color="green">992</FONT>            final int nCols = getColumnDimension();<a name="line.992"></a>
+<FONT color="green">993</FONT>            final StringBuffer res = new StringBuffer();<a name="line.993"></a>
+<FONT color="green">994</FONT>            String fullClassName = getClass().getName();<a name="line.994"></a>
+<FONT color="green">995</FONT>            String shortClassName = fullClassName.substring(fullClassName.lastIndexOf('.') + 1);<a name="line.995"></a>
+<FONT color="green">996</FONT>            res.append(shortClassName).append("{");<a name="line.996"></a>
+<FONT color="green">997</FONT>    <a name="line.997"></a>
+<FONT color="green">998</FONT>            for (int i = 0; i &lt; nRows; ++i) {<a name="line.998"></a>
+<FONT color="green">999</FONT>                if (i &gt; 0) {<a name="line.999"></a>
+<FONT color="green">1000</FONT>                    res.append(",");<a name="line.1000"></a>
+<FONT color="green">1001</FONT>                }<a name="line.1001"></a>
+<FONT color="green">1002</FONT>                res.append("{");<a name="line.1002"></a>
+<FONT color="green">1003</FONT>                for (int j = 0; j &lt; nCols; ++j) {<a name="line.1003"></a>
+<FONT color="green">1004</FONT>                    if (j &gt; 0) {<a name="line.1004"></a>
+<FONT color="green">1005</FONT>                        res.append(",");<a name="line.1005"></a>
+<FONT color="green">1006</FONT>                    }<a name="line.1006"></a>
+<FONT color="green">1007</FONT>                    res.append(getEntry(i, j));<a name="line.1007"></a>
+<FONT color="green">1008</FONT>                }<a name="line.1008"></a>
+<FONT color="green">1009</FONT>                res.append("}");<a name="line.1009"></a>
+<FONT color="green">1010</FONT>            }<a name="line.1010"></a>
+<FONT color="green">1011</FONT>    <a name="line.1011"></a>
+<FONT color="green">1012</FONT>            res.append("}");<a name="line.1012"></a>
+<FONT color="green">1013</FONT>            return res.toString();<a name="line.1013"></a>
+<FONT color="green">1014</FONT>    <a name="line.1014"></a>
+<FONT color="green">1015</FONT>        }<a name="line.1015"></a>
+<FONT color="green">1016</FONT>    <a name="line.1016"></a>
+<FONT color="green">1017</FONT>        /**<a name="line.1017"></a>
+<FONT color="green">1018</FONT>         * Returns true iff &lt;code&gt;object&lt;/code&gt; is a<a name="line.1018"></a>
+<FONT color="green">1019</FONT>         * &lt;code&gt;RealMatrix&lt;/code&gt; instance with the same dimensions as this<a name="line.1019"></a>
+<FONT color="green">1020</FONT>         * and all corresponding matrix entries are equal.<a name="line.1020"></a>
+<FONT color="green">1021</FONT>         *<a name="line.1021"></a>
+<FONT color="green">1022</FONT>         * @param object the object to test equality against.<a name="line.1022"></a>
+<FONT color="green">1023</FONT>         * @return true if object equals this<a name="line.1023"></a>
+<FONT color="green">1024</FONT>         */<a name="line.1024"></a>
+<FONT color="green">1025</FONT>        @Override<a name="line.1025"></a>
+<FONT color="green">1026</FONT>        public boolean equals(final Object object) {<a name="line.1026"></a>
+<FONT color="green">1027</FONT>            if (object == this ) {<a name="line.1027"></a>
+<FONT color="green">1028</FONT>                return true;<a name="line.1028"></a>
+<FONT color="green">1029</FONT>            }<a name="line.1029"></a>
+<FONT color="green">1030</FONT>            if (object instanceof RealMatrix == false) {<a name="line.1030"></a>
+<FONT color="green">1031</FONT>                return false;<a name="line.1031"></a>
+<FONT color="green">1032</FONT>            }<a name="line.1032"></a>
+<FONT color="green">1033</FONT>            RealMatrix m = (RealMatrix) object;<a name="line.1033"></a>
+<FONT color="green">1034</FONT>            final int nRows = getRowDimension();<a name="line.1034"></a>
+<FONT color="green">1035</FONT>            final int nCols = getColumnDimension();<a name="line.1035"></a>
+<FONT color="green">1036</FONT>            if (m.getColumnDimension() != nCols || m.getRowDimension() != nRows) {<a name="line.1036"></a>
+<FONT color="green">1037</FONT>                return false;<a name="line.1037"></a>
+<FONT color="green">1038</FONT>            }<a name="line.1038"></a>
+<FONT color="green">1039</FONT>            for (int row = 0; row &lt; nRows; ++row) {<a name="line.1039"></a>
+<FONT color="green">1040</FONT>                for (int col = 0; col &lt; nCols; ++col) {<a name="line.1040"></a>
+<FONT color="green">1041</FONT>                    if (getEntry(row, col) != m.getEntry(row, col)) {<a name="line.1041"></a>
+<FONT color="green">1042</FONT>                        return false;<a name="line.1042"></a>
+<FONT color="green">1043</FONT>                    }<a name="line.1043"></a>
+<FONT color="green">1044</FONT>                }<a name="line.1044"></a>
+<FONT color="green">1045</FONT>            }<a name="line.1045"></a>
+<FONT color="green">1046</FONT>            return true;<a name="line.1046"></a>
+<FONT color="green">1047</FONT>        }<a name="line.1047"></a>
+<FONT color="green">1048</FONT>    <a name="line.1048"></a>
+<FONT color="green">1049</FONT>        /**<a name="line.1049"></a>
+<FONT color="green">1050</FONT>         * Computes a hashcode for the matrix.<a name="line.1050"></a>
+<FONT color="green">1051</FONT>         *<a name="line.1051"></a>
+<FONT color="green">1052</FONT>         * @return hashcode for matrix<a name="line.1052"></a>
+<FONT color="green">1053</FONT>         */<a name="line.1053"></a>
+<FONT color="green">1054</FONT>        @Override<a name="line.1054"></a>
+<FONT color="green">1055</FONT>        public int hashCode() {<a name="line.1055"></a>
+<FONT color="green">1056</FONT>            int ret = 7;<a name="line.1056"></a>
+<FONT color="green">1057</FONT>            final int nRows = getRowDimension();<a name="line.1057"></a>
+<FONT color="green">1058</FONT>            final int nCols = getColumnDimension();<a name="line.1058"></a>
+<FONT color="green">1059</FONT>            ret = ret * 31 + nRows;<a name="line.1059"></a>
+<FONT color="green">1060</FONT>            ret = ret * 31 + nCols;<a name="line.1060"></a>
+<FONT color="green">1061</FONT>            for (int row = 0; row &lt; nRows; ++row) {<a name="line.1061"></a>
+<FONT color="green">1062</FONT>                for (int col = 0; col &lt; nCols; ++col) {<a name="line.1062"></a>
+<FONT color="green">1063</FONT>                   ret = ret * 31 + (11 * (row+1) + 17 * (col+1)) *<a name="line.1063"></a>
+<FONT color="green">1064</FONT>                       MathUtils.hash(getEntry(row, col));<a name="line.1064"></a>
+<FONT color="green">1065</FONT>               }<a name="line.1065"></a>
+<FONT color="green">1066</FONT>            }<a name="line.1066"></a>
+<FONT color="green">1067</FONT>            return ret;<a name="line.1067"></a>
+<FONT color="green">1068</FONT>        }<a name="line.1068"></a>
+<FONT color="green">1069</FONT>    <a name="line.1069"></a>
+<FONT color="green">1070</FONT>    }<a name="line.1070"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/AbstractRealVector.EntryImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,1012 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Iterator;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.analysis.BinaryFunction;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.analysis.ComposableFunction;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    /**<a name="line.28"></a>
+<FONT color="green">029</FONT>     * This class provides default basic implementations for many methods in the<a name="line.29"></a>
+<FONT color="green">030</FONT>     * {@link RealVector} interface with.<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 904231 $ $Date: 2010-01-28 14:42:31 -0500 (Thu, 28 Jan 2010) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 2.1<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public abstract class AbstractRealVector implements RealVector {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /**<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Check if instance and specified vectors have the same dimension.<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @param v vector to compare instance with<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @exception IllegalArgumentException if the vectors do not<a name="line.39"></a>
+<FONT color="green">040</FONT>         * have the same dimension<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        protected void checkVectorDimensions(RealVector v) {<a name="line.42"></a>
+<FONT color="green">043</FONT>            checkVectorDimensions(v.getDimension());<a name="line.43"></a>
+<FONT color="green">044</FONT>        }<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /**<a name="line.46"></a>
+<FONT color="green">047</FONT>         * Check if instance dimension is equal to some expected value.<a name="line.47"></a>
+<FONT color="green">048</FONT>         *<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @param n expected dimension.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @exception IllegalArgumentException if the dimension is<a name="line.50"></a>
+<FONT color="green">051</FONT>         * inconsistent with vector size<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        protected void checkVectorDimensions(int n)<a name="line.53"></a>
+<FONT color="green">054</FONT>            throws IllegalArgumentException {<a name="line.54"></a>
+<FONT color="green">055</FONT>            double d = getDimension();<a name="line.55"></a>
+<FONT color="green">056</FONT>            if (d != n) {<a name="line.56"></a>
+<FONT color="green">057</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.57"></a>
+<FONT color="green">058</FONT>                      "vector length mismatch: got {0} but expected {1}",<a name="line.58"></a>
+<FONT color="green">059</FONT>                      d, n);<a name="line.59"></a>
+<FONT color="green">060</FONT>            }<a name="line.60"></a>
+<FONT color="green">061</FONT>        }<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /**<a name="line.63"></a>
+<FONT color="green">064</FONT>         * Check if an index is valid.<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param index index to check<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @exception MatrixIndexException if index is not valid<a name="line.66"></a>
+<FONT color="green">067</FONT>         */<a name="line.67"></a>
+<FONT color="green">068</FONT>        protected void checkIndex(final int index)<a name="line.68"></a>
+<FONT color="green">069</FONT>            throws MatrixIndexException {<a name="line.69"></a>
+<FONT color="green">070</FONT>            if (index &lt; 0 || index &gt;= getDimension()) {<a name="line.70"></a>
+<FONT color="green">071</FONT>                throw new MatrixIndexException(<a name="line.71"></a>
+<FONT color="green">072</FONT>                      "index {0} out of allowed range [{1}, {2}]",<a name="line.72"></a>
+<FONT color="green">073</FONT>                      index, 0, getDimension() - 1);<a name="line.73"></a>
+<FONT color="green">074</FONT>            }<a name="line.74"></a>
+<FONT color="green">075</FONT>        }<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** {@inheritDoc} */<a name="line.77"></a>
+<FONT color="green">078</FONT>        public void setSubVector(int index, RealVector v) throws MatrixIndexException {<a name="line.78"></a>
+<FONT color="green">079</FONT>            checkIndex(index);<a name="line.79"></a>
+<FONT color="green">080</FONT>            checkIndex(index + v.getDimension() - 1);<a name="line.80"></a>
+<FONT color="green">081</FONT>            setSubVector(index, v.getData());<a name="line.81"></a>
+<FONT color="green">082</FONT>        }<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /** {@inheritDoc} */<a name="line.84"></a>
+<FONT color="green">085</FONT>        public void setSubVector(int index, double[] v) throws MatrixIndexException {<a name="line.85"></a>
+<FONT color="green">086</FONT>            checkIndex(index);<a name="line.86"></a>
+<FONT color="green">087</FONT>            checkIndex(index + v.length - 1);<a name="line.87"></a>
+<FONT color="green">088</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.88"></a>
+<FONT color="green">089</FONT>                setEntry(i + index, v[i]);<a name="line.89"></a>
+<FONT color="green">090</FONT>            }<a name="line.90"></a>
+<FONT color="green">091</FONT>        }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /** {@inheritDoc} */<a name="line.93"></a>
+<FONT color="green">094</FONT>        public RealVector add(double[] v) throws IllegalArgumentException {<a name="line.94"></a>
+<FONT color="green">095</FONT>            double[] result = v.clone();<a name="line.95"></a>
+<FONT color="green">096</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.96"></a>
+<FONT color="green">097</FONT>            Entry e;<a name="line.97"></a>
+<FONT color="green">098</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.98"></a>
+<FONT color="green">099</FONT>                result[e.getIndex()] += e.getValue();<a name="line.99"></a>
+<FONT color="green">100</FONT>            }<a name="line.100"></a>
+<FONT color="green">101</FONT>            return new ArrayRealVector(result, false);<a name="line.101"></a>
+<FONT color="green">102</FONT>        }<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /** {@inheritDoc} */<a name="line.104"></a>
+<FONT color="green">105</FONT>        public RealVector add(RealVector v) throws IllegalArgumentException {<a name="line.105"></a>
+<FONT color="green">106</FONT>            if (v instanceof ArrayRealVector) {<a name="line.106"></a>
+<FONT color="green">107</FONT>                double[] values = ((ArrayRealVector)v).getDataRef();<a name="line.107"></a>
+<FONT color="green">108</FONT>                return add(values);<a name="line.108"></a>
+<FONT color="green">109</FONT>            }<a name="line.109"></a>
+<FONT color="green">110</FONT>            RealVector result = v.copy();<a name="line.110"></a>
+<FONT color="green">111</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.111"></a>
+<FONT color="green">112</FONT>            Entry e;<a name="line.112"></a>
+<FONT color="green">113</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.113"></a>
+<FONT color="green">114</FONT>                final int index = e.getIndex();<a name="line.114"></a>
+<FONT color="green">115</FONT>                result.setEntry(index, e.getValue() + result.getEntry(index));<a name="line.115"></a>
+<FONT color="green">116</FONT>            }<a name="line.116"></a>
+<FONT color="green">117</FONT>            return result;<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /** {@inheritDoc} */<a name="line.120"></a>
+<FONT color="green">121</FONT>        public RealVector subtract(double[] v) throws IllegalArgumentException {<a name="line.121"></a>
+<FONT color="green">122</FONT>            double[] result = v.clone();<a name="line.122"></a>
+<FONT color="green">123</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.123"></a>
+<FONT color="green">124</FONT>            Entry e;<a name="line.124"></a>
+<FONT color="green">125</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.125"></a>
+<FONT color="green">126</FONT>                final int index = e.getIndex();<a name="line.126"></a>
+<FONT color="green">127</FONT>                result[index] = e.getValue() - result[index];<a name="line.127"></a>
+<FONT color="green">128</FONT>            }<a name="line.128"></a>
+<FONT color="green">129</FONT>            return new ArrayRealVector(result, false);<a name="line.129"></a>
+<FONT color="green">130</FONT>        }<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>        /** {@inheritDoc} */<a name="line.132"></a>
+<FONT color="green">133</FONT>        public RealVector subtract(RealVector v) throws IllegalArgumentException {<a name="line.133"></a>
+<FONT color="green">134</FONT>            if (v instanceof ArrayRealVector) {<a name="line.134"></a>
+<FONT color="green">135</FONT>                double[] values = ((ArrayRealVector)v).getDataRef();<a name="line.135"></a>
+<FONT color="green">136</FONT>                return add(values);<a name="line.136"></a>
+<FONT color="green">137</FONT>            }<a name="line.137"></a>
+<FONT color="green">138</FONT>            RealVector result = v.copy();<a name="line.138"></a>
+<FONT color="green">139</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.139"></a>
+<FONT color="green">140</FONT>            Entry e;<a name="line.140"></a>
+<FONT color="green">141</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.141"></a>
+<FONT color="green">142</FONT>                final int index = e.getIndex();<a name="line.142"></a>
+<FONT color="green">143</FONT>                v.setEntry(index, e.getValue() - result.getEntry(index));<a name="line.143"></a>
+<FONT color="green">144</FONT>            }<a name="line.144"></a>
+<FONT color="green">145</FONT>            return result;<a name="line.145"></a>
+<FONT color="green">146</FONT>        }<a name="line.146"></a>
+<FONT color="green">147</FONT>    <a name="line.147"></a>
+<FONT color="green">148</FONT>        /** {@inheritDoc} */<a name="line.148"></a>
+<FONT color="green">149</FONT>        public RealVector mapAdd(double d) {<a name="line.149"></a>
+<FONT color="green">150</FONT>            return copy().mapAddToSelf(d);<a name="line.150"></a>
+<FONT color="green">151</FONT>        }<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>        /** {@inheritDoc} */<a name="line.153"></a>
+<FONT color="green">154</FONT>        public RealVector mapAddToSelf(double d) {<a name="line.154"></a>
+<FONT color="green">155</FONT>            if (d != 0) {<a name="line.155"></a>
+<FONT color="green">156</FONT>                try {<a name="line.156"></a>
+<FONT color="green">157</FONT>                    return mapToSelf(BinaryFunction.ADD.fix1stArgument(d));<a name="line.157"></a>
+<FONT color="green">158</FONT>                } catch (FunctionEvaluationException e) {<a name="line.158"></a>
+<FONT color="green">159</FONT>                    throw new IllegalArgumentException(e);<a name="line.159"></a>
+<FONT color="green">160</FONT>                }<a name="line.160"></a>
+<FONT color="green">161</FONT>            }<a name="line.161"></a>
+<FONT color="green">162</FONT>            return this;<a name="line.162"></a>
+<FONT color="green">163</FONT>        }<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>        /** {@inheritDoc} */<a name="line.165"></a>
+<FONT color="green">166</FONT>        public abstract AbstractRealVector copy();<a name="line.166"></a>
+<FONT color="green">167</FONT>    <a name="line.167"></a>
+<FONT color="green">168</FONT>        /** {@inheritDoc} */<a name="line.168"></a>
+<FONT color="green">169</FONT>        public double dotProduct(double[] v) throws IllegalArgumentException {<a name="line.169"></a>
+<FONT color="green">170</FONT>            return dotProduct(new ArrayRealVector(v, false));<a name="line.170"></a>
+<FONT color="green">171</FONT>        }<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>        /** {@inheritDoc} */<a name="line.173"></a>
+<FONT color="green">174</FONT>        public double dotProduct(RealVector v) throws IllegalArgumentException {<a name="line.174"></a>
+<FONT color="green">175</FONT>            checkVectorDimensions(v);<a name="line.175"></a>
+<FONT color="green">176</FONT>            double d = 0;<a name="line.176"></a>
+<FONT color="green">177</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.177"></a>
+<FONT color="green">178</FONT>            Entry e;<a name="line.178"></a>
+<FONT color="green">179</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.179"></a>
+<FONT color="green">180</FONT>                d += e.getValue() * v.getEntry(e.getIndex());<a name="line.180"></a>
+<FONT color="green">181</FONT>            }<a name="line.181"></a>
+<FONT color="green">182</FONT>            return d;<a name="line.182"></a>
+<FONT color="green">183</FONT>        }<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>        /** {@inheritDoc} */<a name="line.185"></a>
+<FONT color="green">186</FONT>        public RealVector ebeDivide(double[] v) throws IllegalArgumentException {<a name="line.186"></a>
+<FONT color="green">187</FONT>            return ebeDivide(new ArrayRealVector(v, false));<a name="line.187"></a>
+<FONT color="green">188</FONT>        }<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>        /** {@inheritDoc} */<a name="line.190"></a>
+<FONT color="green">191</FONT>        public RealVector ebeMultiply(double[] v) throws IllegalArgumentException {<a name="line.191"></a>
+<FONT color="green">192</FONT>            return ebeMultiply(new ArrayRealVector(v, false));<a name="line.192"></a>
+<FONT color="green">193</FONT>        }<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>        /** {@inheritDoc} */<a name="line.195"></a>
+<FONT color="green">196</FONT>        public double getDistance(RealVector v) throws IllegalArgumentException {<a name="line.196"></a>
+<FONT color="green">197</FONT>            checkVectorDimensions(v);<a name="line.197"></a>
+<FONT color="green">198</FONT>            double d = 0;<a name="line.198"></a>
+<FONT color="green">199</FONT>            Iterator&lt;Entry&gt; it = iterator();<a name="line.199"></a>
+<FONT color="green">200</FONT>            Entry e;<a name="line.200"></a>
+<FONT color="green">201</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.201"></a>
+<FONT color="green">202</FONT>                final double diff = e.getValue() - v.getEntry(e.getIndex());<a name="line.202"></a>
+<FONT color="green">203</FONT>                d += diff * diff;<a name="line.203"></a>
+<FONT color="green">204</FONT>            }<a name="line.204"></a>
+<FONT color="green">205</FONT>            return Math.sqrt(d);<a name="line.205"></a>
+<FONT color="green">206</FONT>        }<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>        /** {@inheritDoc} */<a name="line.208"></a>
+<FONT color="green">209</FONT>        public double getNorm() {<a name="line.209"></a>
+<FONT color="green">210</FONT>            double sum = 0;<a name="line.210"></a>
+<FONT color="green">211</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.211"></a>
+<FONT color="green">212</FONT>            Entry e;<a name="line.212"></a>
+<FONT color="green">213</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.213"></a>
+<FONT color="green">214</FONT>                final double value = e.getValue();<a name="line.214"></a>
+<FONT color="green">215</FONT>                sum += value * value;<a name="line.215"></a>
+<FONT color="green">216</FONT>            }<a name="line.216"></a>
+<FONT color="green">217</FONT>            return Math.sqrt(sum);<a name="line.217"></a>
+<FONT color="green">218</FONT>        }<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>        /** {@inheritDoc} */<a name="line.220"></a>
+<FONT color="green">221</FONT>        public double getL1Norm() {<a name="line.221"></a>
+<FONT color="green">222</FONT>            double norm = 0;<a name="line.222"></a>
+<FONT color="green">223</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.223"></a>
+<FONT color="green">224</FONT>            Entry e;<a name="line.224"></a>
+<FONT color="green">225</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.225"></a>
+<FONT color="green">226</FONT>                norm += Math.abs(e.getValue());<a name="line.226"></a>
+<FONT color="green">227</FONT>            }<a name="line.227"></a>
+<FONT color="green">228</FONT>            return norm;<a name="line.228"></a>
+<FONT color="green">229</FONT>        }<a name="line.229"></a>
+<FONT color="green">230</FONT>    <a name="line.230"></a>
+<FONT color="green">231</FONT>        /** {@inheritDoc} */<a name="line.231"></a>
+<FONT color="green">232</FONT>        public double getLInfNorm() {<a name="line.232"></a>
+<FONT color="green">233</FONT>            double norm = 0;<a name="line.233"></a>
+<FONT color="green">234</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.234"></a>
+<FONT color="green">235</FONT>            Entry e;<a name="line.235"></a>
+<FONT color="green">236</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.236"></a>
+<FONT color="green">237</FONT>                norm = Math.max(norm, Math.abs(e.getValue()));<a name="line.237"></a>
+<FONT color="green">238</FONT>            }<a name="line.238"></a>
+<FONT color="green">239</FONT>            return norm;<a name="line.239"></a>
+<FONT color="green">240</FONT>        }<a name="line.240"></a>
+<FONT color="green">241</FONT>    <a name="line.241"></a>
+<FONT color="green">242</FONT>        /** {@inheritDoc} */<a name="line.242"></a>
+<FONT color="green">243</FONT>        public double getDistance(double[] v) throws IllegalArgumentException {<a name="line.243"></a>
+<FONT color="green">244</FONT>            return getDistance(new ArrayRealVector(v,false));<a name="line.244"></a>
+<FONT color="green">245</FONT>        }<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>        /** {@inheritDoc} */<a name="line.247"></a>
+<FONT color="green">248</FONT>        public double getL1Distance(RealVector v) throws IllegalArgumentException {<a name="line.248"></a>
+<FONT color="green">249</FONT>            checkVectorDimensions(v);<a name="line.249"></a>
+<FONT color="green">250</FONT>            double d = 0;<a name="line.250"></a>
+<FONT color="green">251</FONT>            Iterator&lt;Entry&gt; it = iterator();<a name="line.251"></a>
+<FONT color="green">252</FONT>            Entry e;<a name="line.252"></a>
+<FONT color="green">253</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.253"></a>
+<FONT color="green">254</FONT>                d += Math.abs(e.getValue() - v.getEntry(e.getIndex()));<a name="line.254"></a>
+<FONT color="green">255</FONT>            }<a name="line.255"></a>
+<FONT color="green">256</FONT>            return d;<a name="line.256"></a>
+<FONT color="green">257</FONT>        }<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>        /** {@inheritDoc} */<a name="line.259"></a>
+<FONT color="green">260</FONT>        public double getL1Distance(double[] v) throws IllegalArgumentException {<a name="line.260"></a>
+<FONT color="green">261</FONT>            checkVectorDimensions(v.length);<a name="line.261"></a>
+<FONT color="green">262</FONT>            double d = 0;<a name="line.262"></a>
+<FONT color="green">263</FONT>            Iterator&lt;Entry&gt; it = iterator();<a name="line.263"></a>
+<FONT color="green">264</FONT>            Entry e;<a name="line.264"></a>
+<FONT color="green">265</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.265"></a>
+<FONT color="green">266</FONT>                d += Math.abs(e.getValue() - v[e.getIndex()]);<a name="line.266"></a>
+<FONT color="green">267</FONT>            }<a name="line.267"></a>
+<FONT color="green">268</FONT>            return d;<a name="line.268"></a>
+<FONT color="green">269</FONT>        }<a name="line.269"></a>
+<FONT color="green">270</FONT>    <a name="line.270"></a>
+<FONT color="green">271</FONT>        /** {@inheritDoc} */<a name="line.271"></a>
+<FONT color="green">272</FONT>        public double getLInfDistance(RealVector v) throws IllegalArgumentException {<a name="line.272"></a>
+<FONT color="green">273</FONT>            checkVectorDimensions(v);<a name="line.273"></a>
+<FONT color="green">274</FONT>            double d = 0;<a name="line.274"></a>
+<FONT color="green">275</FONT>            Iterator&lt;Entry&gt; it = iterator();<a name="line.275"></a>
+<FONT color="green">276</FONT>            Entry e;<a name="line.276"></a>
+<FONT color="green">277</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.277"></a>
+<FONT color="green">278</FONT>                d = Math.max(Math.abs(e.getValue() - v.getEntry(e.getIndex())), d);<a name="line.278"></a>
+<FONT color="green">279</FONT>            }<a name="line.279"></a>
+<FONT color="green">280</FONT>            return d;<a name="line.280"></a>
+<FONT color="green">281</FONT>        }<a name="line.281"></a>
+<FONT color="green">282</FONT>    <a name="line.282"></a>
+<FONT color="green">283</FONT>        /** {@inheritDoc} */<a name="line.283"></a>
+<FONT color="green">284</FONT>        public double getLInfDistance(double[] v) throws IllegalArgumentException {<a name="line.284"></a>
+<FONT color="green">285</FONT>            checkVectorDimensions(v.length);<a name="line.285"></a>
+<FONT color="green">286</FONT>            double d = 0;<a name="line.286"></a>
+<FONT color="green">287</FONT>            Iterator&lt;Entry&gt; it = iterator();<a name="line.287"></a>
+<FONT color="green">288</FONT>            Entry e;<a name="line.288"></a>
+<FONT color="green">289</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.289"></a>
+<FONT color="green">290</FONT>                d = Math.max(Math.abs(e.getValue() - v[e.getIndex()]), d);<a name="line.290"></a>
+<FONT color="green">291</FONT>            }<a name="line.291"></a>
+<FONT color="green">292</FONT>            return d;<a name="line.292"></a>
+<FONT color="green">293</FONT>        }<a name="line.293"></a>
+<FONT color="green">294</FONT>    <a name="line.294"></a>
+<FONT color="green">295</FONT>        /** Get the index of the minimum entry.<a name="line.295"></a>
+<FONT color="green">296</FONT>         * @return index of the minimum entry or -1 if vector length is 0<a name="line.296"></a>
+<FONT color="green">297</FONT>         * or all entries are NaN<a name="line.297"></a>
+<FONT color="green">298</FONT>         */<a name="line.298"></a>
+<FONT color="green">299</FONT>        public int getMinIndex() {<a name="line.299"></a>
+<FONT color="green">300</FONT>            int minIndex    = -1;<a name="line.300"></a>
+<FONT color="green">301</FONT>            double minValue = Double.POSITIVE_INFINITY;<a name="line.301"></a>
+<FONT color="green">302</FONT>            Iterator&lt;Entry&gt; iterator = iterator();<a name="line.302"></a>
+<FONT color="green">303</FONT>            while (iterator.hasNext()) {<a name="line.303"></a>
+<FONT color="green">304</FONT>                final Entry entry = iterator.next();<a name="line.304"></a>
+<FONT color="green">305</FONT>                if (entry.getValue() &lt;= minValue) {<a name="line.305"></a>
+<FONT color="green">306</FONT>                    minIndex = entry.getIndex();<a name="line.306"></a>
+<FONT color="green">307</FONT>                    minValue = entry.getValue();<a name="line.307"></a>
+<FONT color="green">308</FONT>                }<a name="line.308"></a>
+<FONT color="green">309</FONT>            }<a name="line.309"></a>
+<FONT color="green">310</FONT>            return minIndex;<a name="line.310"></a>
+<FONT color="green">311</FONT>        }<a name="line.311"></a>
+<FONT color="green">312</FONT>    <a name="line.312"></a>
+<FONT color="green">313</FONT>        /** Get the value of the minimum entry.<a name="line.313"></a>
+<FONT color="green">314</FONT>         * @return value of the minimum entry or NaN if all entries are NaN<a name="line.314"></a>
+<FONT color="green">315</FONT>         */<a name="line.315"></a>
+<FONT color="green">316</FONT>        public double getMinValue() {<a name="line.316"></a>
+<FONT color="green">317</FONT>            final int minIndex = getMinIndex();<a name="line.317"></a>
+<FONT color="green">318</FONT>            return minIndex &lt; 0 ? Double.NaN : getEntry(minIndex);<a name="line.318"></a>
+<FONT color="green">319</FONT>        }<a name="line.319"></a>
+<FONT color="green">320</FONT>    <a name="line.320"></a>
+<FONT color="green">321</FONT>        /** Get the index of the maximum entry.<a name="line.321"></a>
+<FONT color="green">322</FONT>         * @return index of the maximum entry or -1 if vector length is 0<a name="line.322"></a>
+<FONT color="green">323</FONT>         * or all entries are NaN<a name="line.323"></a>
+<FONT color="green">324</FONT>         */<a name="line.324"></a>
+<FONT color="green">325</FONT>        public int getMaxIndex() {<a name="line.325"></a>
+<FONT color="green">326</FONT>            int maxIndex    = -1;<a name="line.326"></a>
+<FONT color="green">327</FONT>            double maxValue = Double.NEGATIVE_INFINITY;<a name="line.327"></a>
+<FONT color="green">328</FONT>            Iterator&lt;Entry&gt; iterator = iterator();<a name="line.328"></a>
+<FONT color="green">329</FONT>            while (iterator.hasNext()) {<a name="line.329"></a>
+<FONT color="green">330</FONT>                final Entry entry = iterator.next();<a name="line.330"></a>
+<FONT color="green">331</FONT>                if (entry.getValue() &gt;= maxValue) {<a name="line.331"></a>
+<FONT color="green">332</FONT>                    maxIndex = entry.getIndex();<a name="line.332"></a>
+<FONT color="green">333</FONT>                    maxValue = entry.getValue();<a name="line.333"></a>
+<FONT color="green">334</FONT>                }<a name="line.334"></a>
+<FONT color="green">335</FONT>            }<a name="line.335"></a>
+<FONT color="green">336</FONT>            return maxIndex;<a name="line.336"></a>
+<FONT color="green">337</FONT>        }<a name="line.337"></a>
+<FONT color="green">338</FONT>    <a name="line.338"></a>
+<FONT color="green">339</FONT>        /** Get the value of the maximum entry.<a name="line.339"></a>
+<FONT color="green">340</FONT>         * @return value of the maximum entry or NaN if all entries are NaN<a name="line.340"></a>
+<FONT color="green">341</FONT>         */<a name="line.341"></a>
+<FONT color="green">342</FONT>        public double getMaxValue() {<a name="line.342"></a>
+<FONT color="green">343</FONT>            final int maxIndex = getMaxIndex();<a name="line.343"></a>
+<FONT color="green">344</FONT>            return maxIndex &lt; 0 ? Double.NaN : getEntry(maxIndex);<a name="line.344"></a>
+<FONT color="green">345</FONT>        }<a name="line.345"></a>
+<FONT color="green">346</FONT>    <a name="line.346"></a>
+<FONT color="green">347</FONT>        /** {@inheritDoc} */<a name="line.347"></a>
+<FONT color="green">348</FONT>        public RealVector mapAbs() {<a name="line.348"></a>
+<FONT color="green">349</FONT>            return copy().mapAbsToSelf();<a name="line.349"></a>
+<FONT color="green">350</FONT>        }<a name="line.350"></a>
+<FONT color="green">351</FONT>    <a name="line.351"></a>
+<FONT color="green">352</FONT>        /** {@inheritDoc} */<a name="line.352"></a>
+<FONT color="green">353</FONT>        public RealVector mapAbsToSelf() {<a name="line.353"></a>
+<FONT color="green">354</FONT>            try {<a name="line.354"></a>
+<FONT color="green">355</FONT>                return mapToSelf(ComposableFunction.ABS);<a name="line.355"></a>
+<FONT color="green">356</FONT>            } catch (FunctionEvaluationException e) {<a name="line.356"></a>
+<FONT color="green">357</FONT>                throw new IllegalArgumentException(e);<a name="line.357"></a>
+<FONT color="green">358</FONT>            }<a name="line.358"></a>
+<FONT color="green">359</FONT>        }<a name="line.359"></a>
+<FONT color="green">360</FONT>    <a name="line.360"></a>
+<FONT color="green">361</FONT>        /** {@inheritDoc} */<a name="line.361"></a>
+<FONT color="green">362</FONT>        public RealVector mapAcos() {<a name="line.362"></a>
+<FONT color="green">363</FONT>            return copy().mapAcosToSelf();<a name="line.363"></a>
+<FONT color="green">364</FONT>        }<a name="line.364"></a>
+<FONT color="green">365</FONT>    <a name="line.365"></a>
+<FONT color="green">366</FONT>        /** {@inheritDoc} */<a name="line.366"></a>
+<FONT color="green">367</FONT>        public RealVector mapAcosToSelf() {<a name="line.367"></a>
+<FONT color="green">368</FONT>            try {<a name="line.368"></a>
+<FONT color="green">369</FONT>                return mapToSelf(ComposableFunction.ACOS);<a name="line.369"></a>
+<FONT color="green">370</FONT>            } catch (FunctionEvaluationException e) {<a name="line.370"></a>
+<FONT color="green">371</FONT>                throw new IllegalArgumentException(e);<a name="line.371"></a>
+<FONT color="green">372</FONT>            }<a name="line.372"></a>
+<FONT color="green">373</FONT>        }<a name="line.373"></a>
+<FONT color="green">374</FONT>    <a name="line.374"></a>
+<FONT color="green">375</FONT>        /** {@inheritDoc} */<a name="line.375"></a>
+<FONT color="green">376</FONT>        public RealVector mapAsin() {<a name="line.376"></a>
+<FONT color="green">377</FONT>            return copy().mapAsinToSelf();<a name="line.377"></a>
+<FONT color="green">378</FONT>        }<a name="line.378"></a>
+<FONT color="green">379</FONT>    <a name="line.379"></a>
+<FONT color="green">380</FONT>        /** {@inheritDoc} */<a name="line.380"></a>
+<FONT color="green">381</FONT>        public RealVector mapAsinToSelf() {<a name="line.381"></a>
+<FONT color="green">382</FONT>            try {<a name="line.382"></a>
+<FONT color="green">383</FONT>                return mapToSelf(ComposableFunction.ASIN);<a name="line.383"></a>
+<FONT color="green">384</FONT>            } catch (FunctionEvaluationException e) {<a name="line.384"></a>
+<FONT color="green">385</FONT>                throw new IllegalArgumentException(e);<a name="line.385"></a>
+<FONT color="green">386</FONT>            }<a name="line.386"></a>
+<FONT color="green">387</FONT>        }<a name="line.387"></a>
+<FONT color="green">388</FONT>    <a name="line.388"></a>
+<FONT color="green">389</FONT>        /** {@inheritDoc} */<a name="line.389"></a>
+<FONT color="green">390</FONT>        public RealVector mapAtan() {<a name="line.390"></a>
+<FONT color="green">391</FONT>            return copy().mapAtanToSelf();<a name="line.391"></a>
+<FONT color="green">392</FONT>        }<a name="line.392"></a>
+<FONT color="green">393</FONT>    <a name="line.393"></a>
+<FONT color="green">394</FONT>        /** {@inheritDoc} */<a name="line.394"></a>
+<FONT color="green">395</FONT>        public RealVector mapAtanToSelf() {<a name="line.395"></a>
+<FONT color="green">396</FONT>            try {<a name="line.396"></a>
+<FONT color="green">397</FONT>                return mapToSelf(ComposableFunction.ATAN);<a name="line.397"></a>
+<FONT color="green">398</FONT>            } catch (FunctionEvaluationException e) {<a name="line.398"></a>
+<FONT color="green">399</FONT>                throw new IllegalArgumentException(e);<a name="line.399"></a>
+<FONT color="green">400</FONT>            }<a name="line.400"></a>
+<FONT color="green">401</FONT>        }<a name="line.401"></a>
+<FONT color="green">402</FONT>    <a name="line.402"></a>
+<FONT color="green">403</FONT>        /** {@inheritDoc} */<a name="line.403"></a>
+<FONT color="green">404</FONT>        public RealVector mapCbrt() {<a name="line.404"></a>
+<FONT color="green">405</FONT>            return copy().mapCbrtToSelf();<a name="line.405"></a>
+<FONT color="green">406</FONT>        }<a name="line.406"></a>
+<FONT color="green">407</FONT>    <a name="line.407"></a>
+<FONT color="green">408</FONT>        /** {@inheritDoc} */<a name="line.408"></a>
+<FONT color="green">409</FONT>        public RealVector mapCbrtToSelf() {<a name="line.409"></a>
+<FONT color="green">410</FONT>            try {<a name="line.410"></a>
+<FONT color="green">411</FONT>                return mapToSelf(ComposableFunction.CBRT);<a name="line.411"></a>
+<FONT color="green">412</FONT>            } catch (FunctionEvaluationException e) {<a name="line.412"></a>
+<FONT color="green">413</FONT>                throw new IllegalArgumentException(e);<a name="line.413"></a>
+<FONT color="green">414</FONT>            }<a name="line.414"></a>
+<FONT color="green">415</FONT>        }<a name="line.415"></a>
+<FONT color="green">416</FONT>    <a name="line.416"></a>
+<FONT color="green">417</FONT>        /** {@inheritDoc} */<a name="line.417"></a>
+<FONT color="green">418</FONT>        public RealVector mapCeil() {<a name="line.418"></a>
+<FONT color="green">419</FONT>            return copy().mapCeilToSelf();<a name="line.419"></a>
+<FONT color="green">420</FONT>        }<a name="line.420"></a>
+<FONT color="green">421</FONT>    <a name="line.421"></a>
+<FONT color="green">422</FONT>        /** {@inheritDoc} */<a name="line.422"></a>
+<FONT color="green">423</FONT>        public RealVector mapCeilToSelf() {<a name="line.423"></a>
+<FONT color="green">424</FONT>            try {<a name="line.424"></a>
+<FONT color="green">425</FONT>                return mapToSelf(ComposableFunction.CEIL);<a name="line.425"></a>
+<FONT color="green">426</FONT>            } catch (FunctionEvaluationException e) {<a name="line.426"></a>
+<FONT color="green">427</FONT>                throw new IllegalArgumentException(e);<a name="line.427"></a>
+<FONT color="green">428</FONT>            }<a name="line.428"></a>
+<FONT color="green">429</FONT>        }<a name="line.429"></a>
+<FONT color="green">430</FONT>    <a name="line.430"></a>
+<FONT color="green">431</FONT>        /** {@inheritDoc} */<a name="line.431"></a>
+<FONT color="green">432</FONT>        public RealVector mapCos() {<a name="line.432"></a>
+<FONT color="green">433</FONT>            return copy().mapCosToSelf();<a name="line.433"></a>
+<FONT color="green">434</FONT>        }<a name="line.434"></a>
+<FONT color="green">435</FONT>    <a name="line.435"></a>
+<FONT color="green">436</FONT>        /** {@inheritDoc} */<a name="line.436"></a>
+<FONT color="green">437</FONT>        public RealVector mapCosToSelf() {<a name="line.437"></a>
+<FONT color="green">438</FONT>            try {<a name="line.438"></a>
+<FONT color="green">439</FONT>                return mapToSelf(ComposableFunction.COS);<a name="line.439"></a>
+<FONT color="green">440</FONT>            } catch (FunctionEvaluationException e) {<a name="line.440"></a>
+<FONT color="green">441</FONT>                throw new IllegalArgumentException(e);<a name="line.441"></a>
+<FONT color="green">442</FONT>            }<a name="line.442"></a>
+<FONT color="green">443</FONT>        }<a name="line.443"></a>
+<FONT color="green">444</FONT>    <a name="line.444"></a>
+<FONT color="green">445</FONT>        /** {@inheritDoc} */<a name="line.445"></a>
+<FONT color="green">446</FONT>        public RealVector mapCosh() {<a name="line.446"></a>
+<FONT color="green">447</FONT>            return copy().mapCoshToSelf();<a name="line.447"></a>
+<FONT color="green">448</FONT>        }<a name="line.448"></a>
+<FONT color="green">449</FONT>    <a name="line.449"></a>
+<FONT color="green">450</FONT>        /** {@inheritDoc} */<a name="line.450"></a>
+<FONT color="green">451</FONT>        public RealVector mapCoshToSelf() {<a name="line.451"></a>
+<FONT color="green">452</FONT>            try {<a name="line.452"></a>
+<FONT color="green">453</FONT>                return mapToSelf(ComposableFunction.COSH);<a name="line.453"></a>
+<FONT color="green">454</FONT>            } catch (FunctionEvaluationException e) {<a name="line.454"></a>
+<FONT color="green">455</FONT>                throw new IllegalArgumentException(e);<a name="line.455"></a>
+<FONT color="green">456</FONT>            }<a name="line.456"></a>
+<FONT color="green">457</FONT>        }<a name="line.457"></a>
+<FONT color="green">458</FONT>    <a name="line.458"></a>
+<FONT color="green">459</FONT>        /** {@inheritDoc} */<a name="line.459"></a>
+<FONT color="green">460</FONT>        public RealVector mapDivide(double d) {<a name="line.460"></a>
+<FONT color="green">461</FONT>            return copy().mapDivideToSelf(d);<a name="line.461"></a>
+<FONT color="green">462</FONT>        }<a name="line.462"></a>
+<FONT color="green">463</FONT>    <a name="line.463"></a>
+<FONT color="green">464</FONT>        /** {@inheritDoc} */<a name="line.464"></a>
+<FONT color="green">465</FONT>        public RealVector mapDivideToSelf(double d){<a name="line.465"></a>
+<FONT color="green">466</FONT>            try {<a name="line.466"></a>
+<FONT color="green">467</FONT>                return mapToSelf(BinaryFunction.DIVIDE.fix2ndArgument(d));<a name="line.467"></a>
+<FONT color="green">468</FONT>            } catch (FunctionEvaluationException e) {<a name="line.468"></a>
+<FONT color="green">469</FONT>                throw new IllegalArgumentException(e);<a name="line.469"></a>
+<FONT color="green">470</FONT>            }<a name="line.470"></a>
+<FONT color="green">471</FONT>        }<a name="line.471"></a>
+<FONT color="green">472</FONT>    <a name="line.472"></a>
+<FONT color="green">473</FONT>        /** {@inheritDoc} */<a name="line.473"></a>
+<FONT color="green">474</FONT>        public RealVector mapExp() {<a name="line.474"></a>
+<FONT color="green">475</FONT>            return copy().mapExpToSelf();<a name="line.475"></a>
+<FONT color="green">476</FONT>        }<a name="line.476"></a>
+<FONT color="green">477</FONT>    <a name="line.477"></a>
+<FONT color="green">478</FONT>        /** {@inheritDoc} */<a name="line.478"></a>
+<FONT color="green">479</FONT>        public RealVector mapExpToSelf() {<a name="line.479"></a>
+<FONT color="green">480</FONT>            try {<a name="line.480"></a>
+<FONT color="green">481</FONT>                return mapToSelf(ComposableFunction.EXP);<a name="line.481"></a>
+<FONT color="green">482</FONT>            } catch (FunctionEvaluationException e) {<a name="line.482"></a>
+<FONT color="green">483</FONT>                throw new IllegalArgumentException(e);<a name="line.483"></a>
+<FONT color="green">484</FONT>            }<a name="line.484"></a>
+<FONT color="green">485</FONT>        }<a name="line.485"></a>
+<FONT color="green">486</FONT>    <a name="line.486"></a>
+<FONT color="green">487</FONT>        /** {@inheritDoc} */<a name="line.487"></a>
+<FONT color="green">488</FONT>        public RealVector mapExpm1() {<a name="line.488"></a>
+<FONT color="green">489</FONT>            return copy().mapExpm1ToSelf();<a name="line.489"></a>
+<FONT color="green">490</FONT>        }<a name="line.490"></a>
+<FONT color="green">491</FONT>    <a name="line.491"></a>
+<FONT color="green">492</FONT>        /** {@inheritDoc} */<a name="line.492"></a>
+<FONT color="green">493</FONT>        public RealVector mapExpm1ToSelf() {<a name="line.493"></a>
+<FONT color="green">494</FONT>            try {<a name="line.494"></a>
+<FONT color="green">495</FONT>                return mapToSelf(ComposableFunction.EXPM1);<a name="line.495"></a>
+<FONT color="green">496</FONT>            } catch (FunctionEvaluationException e) {<a name="line.496"></a>
+<FONT color="green">497</FONT>                throw new IllegalArgumentException(e);<a name="line.497"></a>
+<FONT color="green">498</FONT>            }<a name="line.498"></a>
+<FONT color="green">499</FONT>        }<a name="line.499"></a>
+<FONT color="green">500</FONT>    <a name="line.500"></a>
+<FONT color="green">501</FONT>        /** {@inheritDoc} */<a name="line.501"></a>
+<FONT color="green">502</FONT>        public RealVector mapFloor() {<a name="line.502"></a>
+<FONT color="green">503</FONT>            return copy().mapFloorToSelf();<a name="line.503"></a>
+<FONT color="green">504</FONT>        }<a name="line.504"></a>
+<FONT color="green">505</FONT>    <a name="line.505"></a>
+<FONT color="green">506</FONT>        /** {@inheritDoc} */<a name="line.506"></a>
+<FONT color="green">507</FONT>        public RealVector mapFloorToSelf() {<a name="line.507"></a>
+<FONT color="green">508</FONT>            try {<a name="line.508"></a>
+<FONT color="green">509</FONT>                return mapToSelf(ComposableFunction.FLOOR);<a name="line.509"></a>
+<FONT color="green">510</FONT>            } catch (FunctionEvaluationException e) {<a name="line.510"></a>
+<FONT color="green">511</FONT>                throw new IllegalArgumentException(e);<a name="line.511"></a>
+<FONT color="green">512</FONT>            }<a name="line.512"></a>
+<FONT color="green">513</FONT>        }<a name="line.513"></a>
+<FONT color="green">514</FONT>    <a name="line.514"></a>
+<FONT color="green">515</FONT>        /** {@inheritDoc} */<a name="line.515"></a>
+<FONT color="green">516</FONT>        public RealVector mapInv() {<a name="line.516"></a>
+<FONT color="green">517</FONT>            return copy().mapInvToSelf();<a name="line.517"></a>
+<FONT color="green">518</FONT>        }<a name="line.518"></a>
+<FONT color="green">519</FONT>    <a name="line.519"></a>
+<FONT color="green">520</FONT>        /** {@inheritDoc} */<a name="line.520"></a>
+<FONT color="green">521</FONT>        public RealVector mapInvToSelf() {<a name="line.521"></a>
+<FONT color="green">522</FONT>            try {<a name="line.522"></a>
+<FONT color="green">523</FONT>                return mapToSelf(ComposableFunction.INVERT);<a name="line.523"></a>
+<FONT color="green">524</FONT>            } catch (FunctionEvaluationException e) {<a name="line.524"></a>
+<FONT color="green">525</FONT>                throw new IllegalArgumentException(e);<a name="line.525"></a>
+<FONT color="green">526</FONT>            }<a name="line.526"></a>
+<FONT color="green">527</FONT>        }<a name="line.527"></a>
+<FONT color="green">528</FONT>    <a name="line.528"></a>
+<FONT color="green">529</FONT>        /** {@inheritDoc} */<a name="line.529"></a>
+<FONT color="green">530</FONT>        public RealVector mapLog() {<a name="line.530"></a>
+<FONT color="green">531</FONT>            return copy().mapLogToSelf();<a name="line.531"></a>
+<FONT color="green">532</FONT>        }<a name="line.532"></a>
+<FONT color="green">533</FONT>    <a name="line.533"></a>
+<FONT color="green">534</FONT>        /** {@inheritDoc} */<a name="line.534"></a>
+<FONT color="green">535</FONT>        public RealVector mapLogToSelf() {<a name="line.535"></a>
+<FONT color="green">536</FONT>            try {<a name="line.536"></a>
+<FONT color="green">537</FONT>                return mapToSelf(ComposableFunction.LOG);<a name="line.537"></a>
+<FONT color="green">538</FONT>            } catch (FunctionEvaluationException e) {<a name="line.538"></a>
+<FONT color="green">539</FONT>                throw new IllegalArgumentException(e);<a name="line.539"></a>
+<FONT color="green">540</FONT>            }<a name="line.540"></a>
+<FONT color="green">541</FONT>        }<a name="line.541"></a>
+<FONT color="green">542</FONT>    <a name="line.542"></a>
+<FONT color="green">543</FONT>        /** {@inheritDoc} */<a name="line.543"></a>
+<FONT color="green">544</FONT>        public RealVector mapLog10() {<a name="line.544"></a>
+<FONT color="green">545</FONT>            return copy().mapLog10ToSelf();<a name="line.545"></a>
+<FONT color="green">546</FONT>        }<a name="line.546"></a>
+<FONT color="green">547</FONT>    <a name="line.547"></a>
+<FONT color="green">548</FONT>        /** {@inheritDoc} */<a name="line.548"></a>
+<FONT color="green">549</FONT>        public RealVector mapLog10ToSelf() {<a name="line.549"></a>
+<FONT color="green">550</FONT>            try {<a name="line.550"></a>
+<FONT color="green">551</FONT>                return mapToSelf(ComposableFunction.LOG10);<a name="line.551"></a>
+<FONT color="green">552</FONT>            } catch (FunctionEvaluationException e) {<a name="line.552"></a>
+<FONT color="green">553</FONT>                throw new IllegalArgumentException(e);<a name="line.553"></a>
+<FONT color="green">554</FONT>            }<a name="line.554"></a>
+<FONT color="green">555</FONT>        }<a name="line.555"></a>
+<FONT color="green">556</FONT>    <a name="line.556"></a>
+<FONT color="green">557</FONT>        /** {@inheritDoc} */<a name="line.557"></a>
+<FONT color="green">558</FONT>        public RealVector mapLog1p() {<a name="line.558"></a>
+<FONT color="green">559</FONT>            return copy().mapLog1pToSelf();<a name="line.559"></a>
+<FONT color="green">560</FONT>        }<a name="line.560"></a>
+<FONT color="green">561</FONT>    <a name="line.561"></a>
+<FONT color="green">562</FONT>        /** {@inheritDoc} */<a name="line.562"></a>
+<FONT color="green">563</FONT>        public RealVector mapLog1pToSelf() {<a name="line.563"></a>
+<FONT color="green">564</FONT>            try {<a name="line.564"></a>
+<FONT color="green">565</FONT>                return mapToSelf(ComposableFunction.LOG1P);<a name="line.565"></a>
+<FONT color="green">566</FONT>            } catch (FunctionEvaluationException e) {<a name="line.566"></a>
+<FONT color="green">567</FONT>                throw new IllegalArgumentException(e);<a name="line.567"></a>
+<FONT color="green">568</FONT>            }<a name="line.568"></a>
+<FONT color="green">569</FONT>        }<a name="line.569"></a>
+<FONT color="green">570</FONT>    <a name="line.570"></a>
+<FONT color="green">571</FONT>        /** {@inheritDoc} */<a name="line.571"></a>
+<FONT color="green">572</FONT>        public RealVector mapMultiply(double d) {<a name="line.572"></a>
+<FONT color="green">573</FONT>            return copy().mapMultiplyToSelf(d);<a name="line.573"></a>
+<FONT color="green">574</FONT>        }<a name="line.574"></a>
+<FONT color="green">575</FONT>    <a name="line.575"></a>
+<FONT color="green">576</FONT>        /** {@inheritDoc} */<a name="line.576"></a>
+<FONT color="green">577</FONT>        public RealVector mapMultiplyToSelf(double d){<a name="line.577"></a>
+<FONT color="green">578</FONT>            try {<a name="line.578"></a>
+<FONT color="green">579</FONT>                return mapToSelf(BinaryFunction.MULTIPLY.fix1stArgument(d));<a name="line.579"></a>
+<FONT color="green">580</FONT>            } catch (FunctionEvaluationException e) {<a name="line.580"></a>
+<FONT color="green">581</FONT>                throw new IllegalArgumentException(e);<a name="line.581"></a>
+<FONT color="green">582</FONT>            }<a name="line.582"></a>
+<FONT color="green">583</FONT>        }<a name="line.583"></a>
+<FONT color="green">584</FONT>    <a name="line.584"></a>
+<FONT color="green">585</FONT>        /** {@inheritDoc} */<a name="line.585"></a>
+<FONT color="green">586</FONT>        public RealVector mapPow(double d) {<a name="line.586"></a>
+<FONT color="green">587</FONT>            return copy().mapPowToSelf(d);<a name="line.587"></a>
+<FONT color="green">588</FONT>        }<a name="line.588"></a>
+<FONT color="green">589</FONT>    <a name="line.589"></a>
+<FONT color="green">590</FONT>        /** {@inheritDoc} */<a name="line.590"></a>
+<FONT color="green">591</FONT>        public RealVector mapPowToSelf(double d){<a name="line.591"></a>
+<FONT color="green">592</FONT>            try {<a name="line.592"></a>
+<FONT color="green">593</FONT>                return mapToSelf(BinaryFunction.POW.fix2ndArgument(d));<a name="line.593"></a>
+<FONT color="green">594</FONT>            } catch (FunctionEvaluationException e) {<a name="line.594"></a>
+<FONT color="green">595</FONT>                throw new IllegalArgumentException(e);<a name="line.595"></a>
+<FONT color="green">596</FONT>            }<a name="line.596"></a>
+<FONT color="green">597</FONT>        }<a name="line.597"></a>
+<FONT color="green">598</FONT>    <a name="line.598"></a>
+<FONT color="green">599</FONT>        /** {@inheritDoc} */<a name="line.599"></a>
+<FONT color="green">600</FONT>        public RealVector mapRint() {<a name="line.600"></a>
+<FONT color="green">601</FONT>            return copy().mapRintToSelf();<a name="line.601"></a>
+<FONT color="green">602</FONT>        }<a name="line.602"></a>
+<FONT color="green">603</FONT>    <a name="line.603"></a>
+<FONT color="green">604</FONT>        /** {@inheritDoc} */<a name="line.604"></a>
+<FONT color="green">605</FONT>        public RealVector mapRintToSelf() {<a name="line.605"></a>
+<FONT color="green">606</FONT>            try {<a name="line.606"></a>
+<FONT color="green">607</FONT>                return mapToSelf(ComposableFunction.RINT);<a name="line.607"></a>
+<FONT color="green">608</FONT>            } catch (FunctionEvaluationException e) {<a name="line.608"></a>
+<FONT color="green">609</FONT>                throw new IllegalArgumentException(e);<a name="line.609"></a>
+<FONT color="green">610</FONT>            }<a name="line.610"></a>
+<FONT color="green">611</FONT>        }<a name="line.611"></a>
+<FONT color="green">612</FONT>    <a name="line.612"></a>
+<FONT color="green">613</FONT>        /** {@inheritDoc} */<a name="line.613"></a>
+<FONT color="green">614</FONT>        public RealVector mapSignum() {<a name="line.614"></a>
+<FONT color="green">615</FONT>            return copy().mapSignumToSelf();<a name="line.615"></a>
+<FONT color="green">616</FONT>        }<a name="line.616"></a>
+<FONT color="green">617</FONT>    <a name="line.617"></a>
+<FONT color="green">618</FONT>        /** {@inheritDoc} */<a name="line.618"></a>
+<FONT color="green">619</FONT>        public RealVector mapSignumToSelf() {<a name="line.619"></a>
+<FONT color="green">620</FONT>            try {<a name="line.620"></a>
+<FONT color="green">621</FONT>                return mapToSelf(ComposableFunction.SIGNUM);<a name="line.621"></a>
+<FONT color="green">622</FONT>            } catch (FunctionEvaluationException e) {<a name="line.622"></a>
+<FONT color="green">623</FONT>                throw new IllegalArgumentException(e);<a name="line.623"></a>
+<FONT color="green">624</FONT>            }<a name="line.624"></a>
+<FONT color="green">625</FONT>        }<a name="line.625"></a>
+<FONT color="green">626</FONT>    <a name="line.626"></a>
+<FONT color="green">627</FONT>        /** {@inheritDoc} */<a name="line.627"></a>
+<FONT color="green">628</FONT>        public RealVector mapSin() {<a name="line.628"></a>
+<FONT color="green">629</FONT>            return copy().mapSinToSelf();<a name="line.629"></a>
+<FONT color="green">630</FONT>        }<a name="line.630"></a>
+<FONT color="green">631</FONT>    <a name="line.631"></a>
+<FONT color="green">632</FONT>        /** {@inheritDoc} */<a name="line.632"></a>
+<FONT color="green">633</FONT>        public RealVector mapSinToSelf() {<a name="line.633"></a>
+<FONT color="green">634</FONT>            try {<a name="line.634"></a>
+<FONT color="green">635</FONT>                return mapToSelf(ComposableFunction.SIN);<a name="line.635"></a>
+<FONT color="green">636</FONT>            } catch (FunctionEvaluationException e) {<a name="line.636"></a>
+<FONT color="green">637</FONT>                throw new IllegalArgumentException(e);<a name="line.637"></a>
+<FONT color="green">638</FONT>            }<a name="line.638"></a>
+<FONT color="green">639</FONT>        }<a name="line.639"></a>
+<FONT color="green">640</FONT>    <a name="line.640"></a>
+<FONT color="green">641</FONT>        /** {@inheritDoc} */<a name="line.641"></a>
+<FONT color="green">642</FONT>        public RealVector mapSinh() {<a name="line.642"></a>
+<FONT color="green">643</FONT>            return copy().mapSinhToSelf();<a name="line.643"></a>
+<FONT color="green">644</FONT>        }<a name="line.644"></a>
+<FONT color="green">645</FONT>    <a name="line.645"></a>
+<FONT color="green">646</FONT>        /** {@inheritDoc} */<a name="line.646"></a>
+<FONT color="green">647</FONT>        public RealVector mapSinhToSelf() {<a name="line.647"></a>
+<FONT color="green">648</FONT>            try {<a name="line.648"></a>
+<FONT color="green">649</FONT>                return mapToSelf(ComposableFunction.SINH);<a name="line.649"></a>
+<FONT color="green">650</FONT>            } catch (FunctionEvaluationException e) {<a name="line.650"></a>
+<FONT color="green">651</FONT>                throw new IllegalArgumentException(e);<a name="line.651"></a>
+<FONT color="green">652</FONT>            }<a name="line.652"></a>
+<FONT color="green">653</FONT>        }<a name="line.653"></a>
+<FONT color="green">654</FONT>    <a name="line.654"></a>
+<FONT color="green">655</FONT>        /** {@inheritDoc} */<a name="line.655"></a>
+<FONT color="green">656</FONT>        public RealVector mapSqrt() {<a name="line.656"></a>
+<FONT color="green">657</FONT>            return copy().mapSqrtToSelf();<a name="line.657"></a>
+<FONT color="green">658</FONT>        }<a name="line.658"></a>
+<FONT color="green">659</FONT>    <a name="line.659"></a>
+<FONT color="green">660</FONT>        /** {@inheritDoc} */<a name="line.660"></a>
+<FONT color="green">661</FONT>        public RealVector mapSqrtToSelf() {<a name="line.661"></a>
+<FONT color="green">662</FONT>            try {<a name="line.662"></a>
+<FONT color="green">663</FONT>                return mapToSelf(ComposableFunction.SQRT);<a name="line.663"></a>
+<FONT color="green">664</FONT>            } catch (FunctionEvaluationException e) {<a name="line.664"></a>
+<FONT color="green">665</FONT>                throw new IllegalArgumentException(e);<a name="line.665"></a>
+<FONT color="green">666</FONT>            }<a name="line.666"></a>
+<FONT color="green">667</FONT>        }<a name="line.667"></a>
+<FONT color="green">668</FONT>    <a name="line.668"></a>
+<FONT color="green">669</FONT>        /** {@inheritDoc} */<a name="line.669"></a>
+<FONT color="green">670</FONT>        public RealVector mapSubtract(double d) {<a name="line.670"></a>
+<FONT color="green">671</FONT>            return copy().mapSubtractToSelf(d);<a name="line.671"></a>
+<FONT color="green">672</FONT>        }<a name="line.672"></a>
+<FONT color="green">673</FONT>    <a name="line.673"></a>
+<FONT color="green">674</FONT>        /** {@inheritDoc} */<a name="line.674"></a>
+<FONT color="green">675</FONT>        public RealVector mapSubtractToSelf(double d){<a name="line.675"></a>
+<FONT color="green">676</FONT>            return mapAddToSelf(-d);<a name="line.676"></a>
+<FONT color="green">677</FONT>        }<a name="line.677"></a>
+<FONT color="green">678</FONT>    <a name="line.678"></a>
+<FONT color="green">679</FONT>        /** {@inheritDoc} */<a name="line.679"></a>
+<FONT color="green">680</FONT>        public RealVector mapTan() {<a name="line.680"></a>
+<FONT color="green">681</FONT>            return copy().mapTanToSelf();<a name="line.681"></a>
+<FONT color="green">682</FONT>        }<a name="line.682"></a>
+<FONT color="green">683</FONT>    <a name="line.683"></a>
+<FONT color="green">684</FONT>        /** {@inheritDoc} */<a name="line.684"></a>
+<FONT color="green">685</FONT>        public RealVector mapTanToSelf() {<a name="line.685"></a>
+<FONT color="green">686</FONT>            try {<a name="line.686"></a>
+<FONT color="green">687</FONT>                return mapToSelf(ComposableFunction.TAN);<a name="line.687"></a>
+<FONT color="green">688</FONT>            } catch (FunctionEvaluationException e) {<a name="line.688"></a>
+<FONT color="green">689</FONT>                throw new IllegalArgumentException(e);<a name="line.689"></a>
+<FONT color="green">690</FONT>            }<a name="line.690"></a>
+<FONT color="green">691</FONT>        }<a name="line.691"></a>
+<FONT color="green">692</FONT>    <a name="line.692"></a>
+<FONT color="green">693</FONT>        /** {@inheritDoc} */<a name="line.693"></a>
+<FONT color="green">694</FONT>        public RealVector mapTanh() {<a name="line.694"></a>
+<FONT color="green">695</FONT>            return copy().mapTanhToSelf();<a name="line.695"></a>
+<FONT color="green">696</FONT>        }<a name="line.696"></a>
+<FONT color="green">697</FONT>    <a name="line.697"></a>
+<FONT color="green">698</FONT>        /** {@inheritDoc} */<a name="line.698"></a>
+<FONT color="green">699</FONT>        public RealVector mapTanhToSelf() {<a name="line.699"></a>
+<FONT color="green">700</FONT>            try {<a name="line.700"></a>
+<FONT color="green">701</FONT>                return mapToSelf(ComposableFunction.TANH);<a name="line.701"></a>
+<FONT color="green">702</FONT>            } catch (FunctionEvaluationException e) {<a name="line.702"></a>
+<FONT color="green">703</FONT>                throw new IllegalArgumentException(e);<a name="line.703"></a>
+<FONT color="green">704</FONT>            }<a name="line.704"></a>
+<FONT color="green">705</FONT>        }<a name="line.705"></a>
+<FONT color="green">706</FONT>    <a name="line.706"></a>
+<FONT color="green">707</FONT>        /** {@inheritDoc} */<a name="line.707"></a>
+<FONT color="green">708</FONT>        public RealVector mapUlp() {<a name="line.708"></a>
+<FONT color="green">709</FONT>            return copy().mapUlpToSelf();<a name="line.709"></a>
+<FONT color="green">710</FONT>        }<a name="line.710"></a>
+<FONT color="green">711</FONT>    <a name="line.711"></a>
+<FONT color="green">712</FONT>        /** {@inheritDoc} */<a name="line.712"></a>
+<FONT color="green">713</FONT>        public RealVector mapUlpToSelf() {<a name="line.713"></a>
+<FONT color="green">714</FONT>            try {<a name="line.714"></a>
+<FONT color="green">715</FONT>                return mapToSelf(ComposableFunction.ULP);<a name="line.715"></a>
+<FONT color="green">716</FONT>            } catch (FunctionEvaluationException e) {<a name="line.716"></a>
+<FONT color="green">717</FONT>                throw new IllegalArgumentException(e);<a name="line.717"></a>
+<FONT color="green">718</FONT>            }<a name="line.718"></a>
+<FONT color="green">719</FONT>        }<a name="line.719"></a>
+<FONT color="green">720</FONT>    <a name="line.720"></a>
+<FONT color="green">721</FONT>        /** {@inheritDoc} */<a name="line.721"></a>
+<FONT color="green">722</FONT>        public RealMatrix outerProduct(RealVector v) throws IllegalArgumentException {<a name="line.722"></a>
+<FONT color="green">723</FONT>            RealMatrix product;<a name="line.723"></a>
+<FONT color="green">724</FONT>            if (v instanceof SparseRealVector || this instanceof SparseRealVector) {<a name="line.724"></a>
+<FONT color="green">725</FONT>                product = new OpenMapRealMatrix(this.getDimension(), v.getDimension());<a name="line.725"></a>
+<FONT color="green">726</FONT>            } else {<a name="line.726"></a>
+<FONT color="green">727</FONT>                product = new Array2DRowRealMatrix(this.getDimension(), v.getDimension());<a name="line.727"></a>
+<FONT color="green">728</FONT>            }<a name="line.728"></a>
+<FONT color="green">729</FONT>            Iterator&lt;Entry&gt; thisIt = sparseIterator();<a name="line.729"></a>
+<FONT color="green">730</FONT>            Entry thisE = null;<a name="line.730"></a>
+<FONT color="green">731</FONT>            while (thisIt.hasNext() &amp;&amp; (thisE = thisIt.next()) != null) {<a name="line.731"></a>
+<FONT color="green">732</FONT>                Iterator&lt;Entry&gt; otherIt = v.sparseIterator();<a name="line.732"></a>
+<FONT color="green">733</FONT>                Entry otherE = null;<a name="line.733"></a>
+<FONT color="green">734</FONT>                while (otherIt.hasNext() &amp;&amp; (otherE = otherIt.next()) != null) {<a name="line.734"></a>
+<FONT color="green">735</FONT>                    product.setEntry(thisE.getIndex(), otherE.getIndex(),<a name="line.735"></a>
+<FONT color="green">736</FONT>                                     thisE.getValue() * otherE.getValue());<a name="line.736"></a>
+<FONT color="green">737</FONT>                }<a name="line.737"></a>
+<FONT color="green">738</FONT>            }<a name="line.738"></a>
+<FONT color="green">739</FONT>    <a name="line.739"></a>
+<FONT color="green">740</FONT>            return product;<a name="line.740"></a>
+<FONT color="green">741</FONT>    <a name="line.741"></a>
+<FONT color="green">742</FONT>        }<a name="line.742"></a>
+<FONT color="green">743</FONT>    <a name="line.743"></a>
+<FONT color="green">744</FONT>        /** {@inheritDoc} */<a name="line.744"></a>
+<FONT color="green">745</FONT>        public RealMatrix outerProduct(double[] v) throws IllegalArgumentException {<a name="line.745"></a>
+<FONT color="green">746</FONT>            return outerProduct(new ArrayRealVector(v, false));<a name="line.746"></a>
+<FONT color="green">747</FONT>        }<a name="line.747"></a>
+<FONT color="green">748</FONT>    <a name="line.748"></a>
+<FONT color="green">749</FONT>        /** {@inheritDoc} */<a name="line.749"></a>
+<FONT color="green">750</FONT>        public RealVector projection(double[] v) throws IllegalArgumentException {<a name="line.750"></a>
+<FONT color="green">751</FONT>            return projection(new ArrayRealVector(v, false));<a name="line.751"></a>
+<FONT color="green">752</FONT>        }<a name="line.752"></a>
+<FONT color="green">753</FONT>    <a name="line.753"></a>
+<FONT color="green">754</FONT>        /** {@inheritDoc} */<a name="line.754"></a>
+<FONT color="green">755</FONT>        public void set(double value) {<a name="line.755"></a>
+<FONT color="green">756</FONT>            Iterator&lt;Entry&gt; it = iterator();<a name="line.756"></a>
+<FONT color="green">757</FONT>            Entry e = null;<a name="line.757"></a>
+<FONT color="green">758</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.758"></a>
+<FONT color="green">759</FONT>                e.setValue(value);<a name="line.759"></a>
+<FONT color="green">760</FONT>            }<a name="line.760"></a>
+<FONT color="green">761</FONT>        }<a name="line.761"></a>
+<FONT color="green">762</FONT>    <a name="line.762"></a>
+<FONT color="green">763</FONT>        /** {@inheritDoc} */<a name="line.763"></a>
+<FONT color="green">764</FONT>        public double[] toArray() {<a name="line.764"></a>
+<FONT color="green">765</FONT>            int dim = getDimension();<a name="line.765"></a>
+<FONT color="green">766</FONT>            double[] values = new double[dim];<a name="line.766"></a>
+<FONT color="green">767</FONT>            for (int i = 0; i &lt; dim; i++) {<a name="line.767"></a>
+<FONT color="green">768</FONT>                values[i] = getEntry(i);<a name="line.768"></a>
+<FONT color="green">769</FONT>            }<a name="line.769"></a>
+<FONT color="green">770</FONT>            return values;<a name="line.770"></a>
+<FONT color="green">771</FONT>        }<a name="line.771"></a>
+<FONT color="green">772</FONT>    <a name="line.772"></a>
+<FONT color="green">773</FONT>        /** {@inheritDoc} */<a name="line.773"></a>
+<FONT color="green">774</FONT>        public double[] getData() {<a name="line.774"></a>
+<FONT color="green">775</FONT>            return toArray();<a name="line.775"></a>
+<FONT color="green">776</FONT>        }<a name="line.776"></a>
+<FONT color="green">777</FONT>    <a name="line.777"></a>
+<FONT color="green">778</FONT>        /** {@inheritDoc} */<a name="line.778"></a>
+<FONT color="green">779</FONT>        public RealVector unitVector() {<a name="line.779"></a>
+<FONT color="green">780</FONT>            RealVector copy = copy();<a name="line.780"></a>
+<FONT color="green">781</FONT>            copy.unitize();<a name="line.781"></a>
+<FONT color="green">782</FONT>            return copy;<a name="line.782"></a>
+<FONT color="green">783</FONT>        }<a name="line.783"></a>
+<FONT color="green">784</FONT>    <a name="line.784"></a>
+<FONT color="green">785</FONT>        /** {@inheritDoc} */<a name="line.785"></a>
+<FONT color="green">786</FONT>        public void unitize() {<a name="line.786"></a>
+<FONT color="green">787</FONT>            mapDivideToSelf(getNorm());<a name="line.787"></a>
+<FONT color="green">788</FONT>        }<a name="line.788"></a>
+<FONT color="green">789</FONT>    <a name="line.789"></a>
+<FONT color="green">790</FONT>        /** {@inheritDoc} */<a name="line.790"></a>
+<FONT color="green">791</FONT>        public Iterator&lt;Entry&gt; sparseIterator() {<a name="line.791"></a>
+<FONT color="green">792</FONT>            return new SparseEntryIterator();<a name="line.792"></a>
+<FONT color="green">793</FONT>        }<a name="line.793"></a>
+<FONT color="green">794</FONT>    <a name="line.794"></a>
+<FONT color="green">795</FONT>        /** {@inheritDoc} */<a name="line.795"></a>
+<FONT color="green">796</FONT>        public Iterator&lt;Entry&gt; iterator() {<a name="line.796"></a>
+<FONT color="green">797</FONT>            final int dim = getDimension();<a name="line.797"></a>
+<FONT color="green">798</FONT>            return new Iterator&lt;Entry&gt;() {<a name="line.798"></a>
+<FONT color="green">799</FONT>    <a name="line.799"></a>
+<FONT color="green">800</FONT>                /** Current index. */<a name="line.800"></a>
+<FONT color="green">801</FONT>                private int i = 0;<a name="line.801"></a>
+<FONT color="green">802</FONT>    <a name="line.802"></a>
+<FONT color="green">803</FONT>                /** Current entry. */<a name="line.803"></a>
+<FONT color="green">804</FONT>                private EntryImpl e = new EntryImpl();<a name="line.804"></a>
+<FONT color="green">805</FONT>    <a name="line.805"></a>
+<FONT color="green">806</FONT>                /** {@inheritDoc} */<a name="line.806"></a>
+<FONT color="green">807</FONT>                public boolean hasNext() {<a name="line.807"></a>
+<FONT color="green">808</FONT>                    return i &lt; dim;<a name="line.808"></a>
+<FONT color="green">809</FONT>                }<a name="line.809"></a>
+<FONT color="green">810</FONT>    <a name="line.810"></a>
+<FONT color="green">811</FONT>                /** {@inheritDoc} */<a name="line.811"></a>
+<FONT color="green">812</FONT>                public Entry next() {<a name="line.812"></a>
+<FONT color="green">813</FONT>                    e.setIndex(i++);<a name="line.813"></a>
+<FONT color="green">814</FONT>                    return e;<a name="line.814"></a>
+<FONT color="green">815</FONT>                }<a name="line.815"></a>
+<FONT color="green">816</FONT>    <a name="line.816"></a>
+<FONT color="green">817</FONT>                /** {@inheritDoc} */<a name="line.817"></a>
+<FONT color="green">818</FONT>                public void remove() {<a name="line.818"></a>
+<FONT color="green">819</FONT>                    throw new UnsupportedOperationException("Not supported");<a name="line.819"></a>
+<FONT color="green">820</FONT>                }<a name="line.820"></a>
+<FONT color="green">821</FONT>            };<a name="line.821"></a>
+<FONT color="green">822</FONT>        }<a name="line.822"></a>
+<FONT color="green">823</FONT>    <a name="line.823"></a>
+<FONT color="green">824</FONT>        /** {@inheritDoc} */<a name="line.824"></a>
+<FONT color="green">825</FONT>        public RealVector map(UnivariateRealFunction function) throws FunctionEvaluationException {<a name="line.825"></a>
+<FONT color="green">826</FONT>            return copy().mapToSelf(function);<a name="line.826"></a>
+<FONT color="green">827</FONT>        }<a name="line.827"></a>
+<FONT color="green">828</FONT>    <a name="line.828"></a>
+<FONT color="green">829</FONT>        /** {@inheritDoc} */<a name="line.829"></a>
+<FONT color="green">830</FONT>        public RealVector mapToSelf(UnivariateRealFunction function) throws FunctionEvaluationException {<a name="line.830"></a>
+<FONT color="green">831</FONT>            Iterator&lt;Entry&gt; it = (function.value(0) == 0) ? sparseIterator() : iterator();<a name="line.831"></a>
+<FONT color="green">832</FONT>            Entry e;<a name="line.832"></a>
+<FONT color="green">833</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.833"></a>
+<FONT color="green">834</FONT>                e.setValue(function.value(e.getValue()));<a name="line.834"></a>
+<FONT color="green">835</FONT>            }<a name="line.835"></a>
+<FONT color="green">836</FONT>            return this;<a name="line.836"></a>
+<FONT color="green">837</FONT>        }<a name="line.837"></a>
+<FONT color="green">838</FONT>    <a name="line.838"></a>
+<FONT color="green">839</FONT>        /** An entry in the vector. */<a name="line.839"></a>
+<FONT color="green">840</FONT>        protected class EntryImpl extends Entry {<a name="line.840"></a>
+<FONT color="green">841</FONT>    <a name="line.841"></a>
+<FONT color="green">842</FONT>            /** Simple constructor. */<a name="line.842"></a>
+<FONT color="green">843</FONT>            public EntryImpl() {<a name="line.843"></a>
+<FONT color="green">844</FONT>                setIndex(0);<a name="line.844"></a>
+<FONT color="green">845</FONT>            }<a name="line.845"></a>
+<FONT color="green">846</FONT>    <a name="line.846"></a>
+<FONT color="green">847</FONT>            /** {@inheritDoc} */<a name="line.847"></a>
+<FONT color="green">848</FONT>            @Override<a name="line.848"></a>
+<FONT color="green">849</FONT>            public double getValue() {<a name="line.849"></a>
+<FONT color="green">850</FONT>                return getEntry(getIndex());<a name="line.850"></a>
+<FONT color="green">851</FONT>            }<a name="line.851"></a>
+<FONT color="green">852</FONT>    <a name="line.852"></a>
+<FONT color="green">853</FONT>            /** {@inheritDoc} */<a name="line.853"></a>
+<FONT color="green">854</FONT>            @Override<a name="line.854"></a>
+<FONT color="green">855</FONT>            public void setValue(double newValue) {<a name="line.855"></a>
+<FONT color="green">856</FONT>                setEntry(getIndex(), newValue);<a name="line.856"></a>
+<FONT color="green">857</FONT>            }<a name="line.857"></a>
+<FONT color="green">858</FONT>        }<a name="line.858"></a>
+<FONT color="green">859</FONT>    <a name="line.859"></a>
+<FONT color="green">860</FONT>        /**<a name="line.860"></a>
+<FONT color="green">861</FONT>         * This class should rare be used, but is here to provide<a name="line.861"></a>
+<FONT color="green">862</FONT>         * a default implementation of sparseIterator(), which is implemented<a name="line.862"></a>
+<FONT color="green">863</FONT>         * by walking over the entries, skipping those whose values are the default one.<a name="line.863"></a>
+<FONT color="green">864</FONT>         *<a name="line.864"></a>
+<FONT color="green">865</FONT>         * Concrete subclasses which are SparseVector implementations should<a name="line.865"></a>
+<FONT color="green">866</FONT>         * make their own sparse iterator, not use this one.<a name="line.866"></a>
+<FONT color="green">867</FONT>         *<a name="line.867"></a>
+<FONT color="green">868</FONT>         * This implementation might be useful for ArrayRealVector, when expensive<a name="line.868"></a>
+<FONT color="green">869</FONT>         * operations which preserve the default value are to be done on the entries,<a name="line.869"></a>
+<FONT color="green">870</FONT>         * and the fraction of non-default values is small (i.e. someone took a<a name="line.870"></a>
+<FONT color="green">871</FONT>         * SparseVector, and passed it into the copy-constructor of ArrayRealVector)<a name="line.871"></a>
+<FONT color="green">872</FONT>         */<a name="line.872"></a>
+<FONT color="green">873</FONT>        protected class SparseEntryIterator implements Iterator&lt;Entry&gt; {<a name="line.873"></a>
+<FONT color="green">874</FONT>    <a name="line.874"></a>
+<FONT color="green">875</FONT>            /** Dimension of the vector. */<a name="line.875"></a>
+<FONT color="green">876</FONT>            private final int dim;<a name="line.876"></a>
+<FONT color="green">877</FONT>    <a name="line.877"></a>
+<FONT color="green">878</FONT>            /** Temporary entry (reused on each call to {@link #next()}. */<a name="line.878"></a>
+<FONT color="green">879</FONT>            private EntryImpl tmp = new EntryImpl();<a name="line.879"></a>
+<FONT color="green">880</FONT>    <a name="line.880"></a>
+<FONT color="green">881</FONT>            /** Current entry. */<a name="line.881"></a>
+<FONT color="green">882</FONT>            private EntryImpl current;<a name="line.882"></a>
+<FONT color="green">883</FONT>    <a name="line.883"></a>
+<FONT color="green">884</FONT>            /** Next entry. */<a name="line.884"></a>
+<FONT color="green">885</FONT>            private EntryImpl next;<a name="line.885"></a>
+<FONT color="green">886</FONT>    <a name="line.886"></a>
+<FONT color="green">887</FONT>            /** Simple constructor. */<a name="line.887"></a>
+<FONT color="green">888</FONT>            protected SparseEntryIterator() {<a name="line.888"></a>
+<FONT color="green">889</FONT>                dim = getDimension();<a name="line.889"></a>
+<FONT color="green">890</FONT>                current = new EntryImpl();<a name="line.890"></a>
+<FONT color="green">891</FONT>                if (current.getValue() == 0) {<a name="line.891"></a>
+<FONT color="green">892</FONT>                    advance(current);<a name="line.892"></a>
+<FONT color="green">893</FONT>                }<a name="line.893"></a>
+<FONT color="green">894</FONT>                if(current.getIndex() &gt;= 0){<a name="line.894"></a>
+<FONT color="green">895</FONT>                    // There is at least one non-zero entry<a name="line.895"></a>
+<FONT color="green">896</FONT>                    next = new EntryImpl();<a name="line.896"></a>
+<FONT color="green">897</FONT>                    next.setIndex(current.getIndex());<a name="line.897"></a>
+<FONT color="green">898</FONT>                    advance(next);<a name="line.898"></a>
+<FONT color="green">899</FONT>                } else {<a name="line.899"></a>
+<FONT color="green">900</FONT>                    // The vector consists of only zero entries, so deny having a next<a name="line.900"></a>
+<FONT color="green">901</FONT>                    current = null;<a name="line.901"></a>
+<FONT color="green">902</FONT>                }<a name="line.902"></a>
+<FONT color="green">903</FONT>            }<a name="line.903"></a>
+<FONT color="green">904</FONT>    <a name="line.904"></a>
+<FONT color="green">905</FONT>            /** Advance an entry up to the next non null one.<a name="line.905"></a>
+<FONT color="green">906</FONT>             * @param e entry to advance<a name="line.906"></a>
+<FONT color="green">907</FONT>             */<a name="line.907"></a>
+<FONT color="green">908</FONT>            protected void advance(EntryImpl e) {<a name="line.908"></a>
+<FONT color="green">909</FONT>                if (e == null) {<a name="line.909"></a>
+<FONT color="green">910</FONT>                    return;<a name="line.910"></a>
+<FONT color="green">911</FONT>                }<a name="line.911"></a>
+<FONT color="green">912</FONT>                do {<a name="line.912"></a>
+<FONT color="green">913</FONT>                    e.setIndex(e.getIndex() + 1);<a name="line.913"></a>
+<FONT color="green">914</FONT>                } while (e.getIndex() &lt; dim &amp;&amp; e.getValue() == 0);<a name="line.914"></a>
+<FONT color="green">915</FONT>                if (e.getIndex() &gt;= dim) {<a name="line.915"></a>
+<FONT color="green">916</FONT>                    e.setIndex(-1);<a name="line.916"></a>
+<FONT color="green">917</FONT>                }<a name="line.917"></a>
+<FONT color="green">918</FONT>            }<a name="line.918"></a>
+<FONT color="green">919</FONT>    <a name="line.919"></a>
+<FONT color="green">920</FONT>            /** {@inheritDoc} */<a name="line.920"></a>
+<FONT color="green">921</FONT>            public boolean hasNext() {<a name="line.921"></a>
+<FONT color="green">922</FONT>                return current != null;<a name="line.922"></a>
+<FONT color="green">923</FONT>            }<a name="line.923"></a>
+<FONT color="green">924</FONT>    <a name="line.924"></a>
+<FONT color="green">925</FONT>            /** {@inheritDoc} */<a name="line.925"></a>
+<FONT color="green">926</FONT>            public Entry next() {<a name="line.926"></a>
+<FONT color="green">927</FONT>                tmp.setIndex(current.getIndex());<a name="line.927"></a>
+<FONT color="green">928</FONT>                if (next != null) {<a name="line.928"></a>
+<FONT color="green">929</FONT>                    current.setIndex(next.getIndex());<a name="line.929"></a>
+<FONT color="green">930</FONT>                    advance(next);<a name="line.930"></a>
+<FONT color="green">931</FONT>                    if (next.getIndex() &lt; 0) {<a name="line.931"></a>
+<FONT color="green">932</FONT>                        next = null;<a name="line.932"></a>
+<FONT color="green">933</FONT>                    }<a name="line.933"></a>
+<FONT color="green">934</FONT>                } else {<a name="line.934"></a>
+<FONT color="green">935</FONT>                    current = null;<a name="line.935"></a>
+<FONT color="green">936</FONT>                }<a name="line.936"></a>
+<FONT color="green">937</FONT>                return tmp;<a name="line.937"></a>
+<FONT color="green">938</FONT>            }<a name="line.938"></a>
+<FONT color="green">939</FONT>    <a name="line.939"></a>
+<FONT color="green">940</FONT>            /** {@inheritDoc} */<a name="line.940"></a>
+<FONT color="green">941</FONT>            public void remove() {<a name="line.941"></a>
+<FONT color="green">942</FONT>                throw new UnsupportedOperationException("Not supported");<a name="line.942"></a>
+<FONT color="green">943</FONT>            }<a name="line.943"></a>
+<FONT color="green">944</FONT>        }<a name="line.944"></a>
+<FONT color="green">945</FONT>    <a name="line.945"></a>
+<FONT color="green">946</FONT>    }<a name="line.946"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/AbstractRealVector.SparseEntryIterator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,1012 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Iterator;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.analysis.BinaryFunction;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.analysis.ComposableFunction;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    /**<a name="line.28"></a>
+<FONT color="green">029</FONT>     * This class provides default basic implementations for many methods in the<a name="line.29"></a>
+<FONT color="green">030</FONT>     * {@link RealVector} interface with.<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 904231 $ $Date: 2010-01-28 14:42:31 -0500 (Thu, 28 Jan 2010) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 2.1<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public abstract class AbstractRealVector implements RealVector {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /**<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Check if instance and specified vectors have the same dimension.<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @param v vector to compare instance with<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @exception IllegalArgumentException if the vectors do not<a name="line.39"></a>
+<FONT color="green">040</FONT>         * have the same dimension<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        protected void checkVectorDimensions(RealVector v) {<a name="line.42"></a>
+<FONT color="green">043</FONT>            checkVectorDimensions(v.getDimension());<a name="line.43"></a>
+<FONT color="green">044</FONT>        }<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /**<a name="line.46"></a>
+<FONT color="green">047</FONT>         * Check if instance dimension is equal to some expected value.<a name="line.47"></a>
+<FONT color="green">048</FONT>         *<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @param n expected dimension.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @exception IllegalArgumentException if the dimension is<a name="line.50"></a>
+<FONT color="green">051</FONT>         * inconsistent with vector size<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        protected void checkVectorDimensions(int n)<a name="line.53"></a>
+<FONT color="green">054</FONT>            throws IllegalArgumentException {<a name="line.54"></a>
+<FONT color="green">055</FONT>            double d = getDimension();<a name="line.55"></a>
+<FONT color="green">056</FONT>            if (d != n) {<a name="line.56"></a>
+<FONT color="green">057</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.57"></a>
+<FONT color="green">058</FONT>                      "vector length mismatch: got {0} but expected {1}",<a name="line.58"></a>
+<FONT color="green">059</FONT>                      d, n);<a name="line.59"></a>
+<FONT color="green">060</FONT>            }<a name="line.60"></a>
+<FONT color="green">061</FONT>        }<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /**<a name="line.63"></a>
+<FONT color="green">064</FONT>         * Check if an index is valid.<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param index index to check<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @exception MatrixIndexException if index is not valid<a name="line.66"></a>
+<FONT color="green">067</FONT>         */<a name="line.67"></a>
+<FONT color="green">068</FONT>        protected void checkIndex(final int index)<a name="line.68"></a>
+<FONT color="green">069</FONT>            throws MatrixIndexException {<a name="line.69"></a>
+<FONT color="green">070</FONT>            if (index &lt; 0 || index &gt;= getDimension()) {<a name="line.70"></a>
+<FONT color="green">071</FONT>                throw new MatrixIndexException(<a name="line.71"></a>
+<FONT color="green">072</FONT>                      "index {0} out of allowed range [{1}, {2}]",<a name="line.72"></a>
+<FONT color="green">073</FONT>                      index, 0, getDimension() - 1);<a name="line.73"></a>
+<FONT color="green">074</FONT>            }<a name="line.74"></a>
+<FONT color="green">075</FONT>        }<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** {@inheritDoc} */<a name="line.77"></a>
+<FONT color="green">078</FONT>        public void setSubVector(int index, RealVector v) throws MatrixIndexException {<a name="line.78"></a>
+<FONT color="green">079</FONT>            checkIndex(index);<a name="line.79"></a>
+<FONT color="green">080</FONT>            checkIndex(index + v.getDimension() - 1);<a name="line.80"></a>
+<FONT color="green">081</FONT>            setSubVector(index, v.getData());<a name="line.81"></a>
+<FONT color="green">082</FONT>        }<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /** {@inheritDoc} */<a name="line.84"></a>
+<FONT color="green">085</FONT>        public void setSubVector(int index, double[] v) throws MatrixIndexException {<a name="line.85"></a>
+<FONT color="green">086</FONT>            checkIndex(index);<a name="line.86"></a>
+<FONT color="green">087</FONT>            checkIndex(index + v.length - 1);<a name="line.87"></a>
+<FONT color="green">088</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.88"></a>
+<FONT color="green">089</FONT>                setEntry(i + index, v[i]);<a name="line.89"></a>
+<FONT color="green">090</FONT>            }<a name="line.90"></a>
+<FONT color="green">091</FONT>        }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /** {@inheritDoc} */<a name="line.93"></a>
+<FONT color="green">094</FONT>        public RealVector add(double[] v) throws IllegalArgumentException {<a name="line.94"></a>
+<FONT color="green">095</FONT>            double[] result = v.clone();<a name="line.95"></a>
+<FONT color="green">096</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.96"></a>
+<FONT color="green">097</FONT>            Entry e;<a name="line.97"></a>
+<FONT color="green">098</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.98"></a>
+<FONT color="green">099</FONT>                result[e.getIndex()] += e.getValue();<a name="line.99"></a>
+<FONT color="green">100</FONT>            }<a name="line.100"></a>
+<FONT color="green">101</FONT>            return new ArrayRealVector(result, false);<a name="line.101"></a>
+<FONT color="green">102</FONT>        }<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /** {@inheritDoc} */<a name="line.104"></a>
+<FONT color="green">105</FONT>        public RealVector add(RealVector v) throws IllegalArgumentException {<a name="line.105"></a>
+<FONT color="green">106</FONT>            if (v instanceof ArrayRealVector) {<a name="line.106"></a>
+<FONT color="green">107</FONT>                double[] values = ((ArrayRealVector)v).getDataRef();<a name="line.107"></a>
+<FONT color="green">108</FONT>                return add(values);<a name="line.108"></a>
+<FONT color="green">109</FONT>            }<a name="line.109"></a>
+<FONT color="green">110</FONT>            RealVector result = v.copy();<a name="line.110"></a>
+<FONT color="green">111</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.111"></a>
+<FONT color="green">112</FONT>            Entry e;<a name="line.112"></a>
+<FONT color="green">113</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.113"></a>
+<FONT color="green">114</FONT>                final int index = e.getIndex();<a name="line.114"></a>
+<FONT color="green">115</FONT>                result.setEntry(index, e.getValue() + result.getEntry(index));<a name="line.115"></a>
+<FONT color="green">116</FONT>            }<a name="line.116"></a>
+<FONT color="green">117</FONT>            return result;<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /** {@inheritDoc} */<a name="line.120"></a>
+<FONT color="green">121</FONT>        public RealVector subtract(double[] v) throws IllegalArgumentException {<a name="line.121"></a>
+<FONT color="green">122</FONT>            double[] result = v.clone();<a name="line.122"></a>
+<FONT color="green">123</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.123"></a>
+<FONT color="green">124</FONT>            Entry e;<a name="line.124"></a>
+<FONT color="green">125</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.125"></a>
+<FONT color="green">126</FONT>                final int index = e.getIndex();<a name="line.126"></a>
+<FONT color="green">127</FONT>                result[index] = e.getValue() - result[index];<a name="line.127"></a>
+<FONT color="green">128</FONT>            }<a name="line.128"></a>
+<FONT color="green">129</FONT>            return new ArrayRealVector(result, false);<a name="line.129"></a>
+<FONT color="green">130</FONT>        }<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>        /** {@inheritDoc} */<a name="line.132"></a>
+<FONT color="green">133</FONT>        public RealVector subtract(RealVector v) throws IllegalArgumentException {<a name="line.133"></a>
+<FONT color="green">134</FONT>            if (v instanceof ArrayRealVector) {<a name="line.134"></a>
+<FONT color="green">135</FONT>                double[] values = ((ArrayRealVector)v).getDataRef();<a name="line.135"></a>
+<FONT color="green">136</FONT>                return add(values);<a name="line.136"></a>
+<FONT color="green">137</FONT>            }<a name="line.137"></a>
+<FONT color="green">138</FONT>            RealVector result = v.copy();<a name="line.138"></a>
+<FONT color="green">139</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.139"></a>
+<FONT color="green">140</FONT>            Entry e;<a name="line.140"></a>
+<FONT color="green">141</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.141"></a>
+<FONT color="green">142</FONT>                final int index = e.getIndex();<a name="line.142"></a>
+<FONT color="green">143</FONT>                v.setEntry(index, e.getValue() - result.getEntry(index));<a name="line.143"></a>
+<FONT color="green">144</FONT>            }<a name="line.144"></a>
+<FONT color="green">145</FONT>            return result;<a name="line.145"></a>
+<FONT color="green">146</FONT>        }<a name="line.146"></a>
+<FONT color="green">147</FONT>    <a name="line.147"></a>
+<FONT color="green">148</FONT>        /** {@inheritDoc} */<a name="line.148"></a>
+<FONT color="green">149</FONT>        public RealVector mapAdd(double d) {<a name="line.149"></a>
+<FONT color="green">150</FONT>            return copy().mapAddToSelf(d);<a name="line.150"></a>
+<FONT color="green">151</FONT>        }<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>        /** {@inheritDoc} */<a name="line.153"></a>
+<FONT color="green">154</FONT>        public RealVector mapAddToSelf(double d) {<a name="line.154"></a>
+<FONT color="green">155</FONT>            if (d != 0) {<a name="line.155"></a>
+<FONT color="green">156</FONT>                try {<a name="line.156"></a>
+<FONT color="green">157</FONT>                    return mapToSelf(BinaryFunction.ADD.fix1stArgument(d));<a name="line.157"></a>
+<FONT color="green">158</FONT>                } catch (FunctionEvaluationException e) {<a name="line.158"></a>
+<FONT color="green">159</FONT>                    throw new IllegalArgumentException(e);<a name="line.159"></a>
+<FONT color="green">160</FONT>                }<a name="line.160"></a>
+<FONT color="green">161</FONT>            }<a name="line.161"></a>
+<FONT color="green">162</FONT>            return this;<a name="line.162"></a>
+<FONT color="green">163</FONT>        }<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>        /** {@inheritDoc} */<a name="line.165"></a>
+<FONT color="green">166</FONT>        public abstract AbstractRealVector copy();<a name="line.166"></a>
+<FONT color="green">167</FONT>    <a name="line.167"></a>
+<FONT color="green">168</FONT>        /** {@inheritDoc} */<a name="line.168"></a>
+<FONT color="green">169</FONT>        public double dotProduct(double[] v) throws IllegalArgumentException {<a name="line.169"></a>
+<FONT color="green">170</FONT>            return dotProduct(new ArrayRealVector(v, false));<a name="line.170"></a>
+<FONT color="green">171</FONT>        }<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>        /** {@inheritDoc} */<a name="line.173"></a>
+<FONT color="green">174</FONT>        public double dotProduct(RealVector v) throws IllegalArgumentException {<a name="line.174"></a>
+<FONT color="green">175</FONT>            checkVectorDimensions(v);<a name="line.175"></a>
+<FONT color="green">176</FONT>            double d = 0;<a name="line.176"></a>
+<FONT color="green">177</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.177"></a>
+<FONT color="green">178</FONT>            Entry e;<a name="line.178"></a>
+<FONT color="green">179</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.179"></a>
+<FONT color="green">180</FONT>                d += e.getValue() * v.getEntry(e.getIndex());<a name="line.180"></a>
+<FONT color="green">181</FONT>            }<a name="line.181"></a>
+<FONT color="green">182</FONT>            return d;<a name="line.182"></a>
+<FONT color="green">183</FONT>        }<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>        /** {@inheritDoc} */<a name="line.185"></a>
+<FONT color="green">186</FONT>        public RealVector ebeDivide(double[] v) throws IllegalArgumentException {<a name="line.186"></a>
+<FONT color="green">187</FONT>            return ebeDivide(new ArrayRealVector(v, false));<a name="line.187"></a>
+<FONT color="green">188</FONT>        }<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>        /** {@inheritDoc} */<a name="line.190"></a>
+<FONT color="green">191</FONT>        public RealVector ebeMultiply(double[] v) throws IllegalArgumentException {<a name="line.191"></a>
+<FONT color="green">192</FONT>            return ebeMultiply(new ArrayRealVector(v, false));<a name="line.192"></a>
+<FONT color="green">193</FONT>        }<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>        /** {@inheritDoc} */<a name="line.195"></a>
+<FONT color="green">196</FONT>        public double getDistance(RealVector v) throws IllegalArgumentException {<a name="line.196"></a>
+<FONT color="green">197</FONT>            checkVectorDimensions(v);<a name="line.197"></a>
+<FONT color="green">198</FONT>            double d = 0;<a name="line.198"></a>
+<FONT color="green">199</FONT>            Iterator&lt;Entry&gt; it = iterator();<a name="line.199"></a>
+<FONT color="green">200</FONT>            Entry e;<a name="line.200"></a>
+<FONT color="green">201</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.201"></a>
+<FONT color="green">202</FONT>                final double diff = e.getValue() - v.getEntry(e.getIndex());<a name="line.202"></a>
+<FONT color="green">203</FONT>                d += diff * diff;<a name="line.203"></a>
+<FONT color="green">204</FONT>            }<a name="line.204"></a>
+<FONT color="green">205</FONT>            return Math.sqrt(d);<a name="line.205"></a>
+<FONT color="green">206</FONT>        }<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>        /** {@inheritDoc} */<a name="line.208"></a>
+<FONT color="green">209</FONT>        public double getNorm() {<a name="line.209"></a>
+<FONT color="green">210</FONT>            double sum = 0;<a name="line.210"></a>
+<FONT color="green">211</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.211"></a>
+<FONT color="green">212</FONT>            Entry e;<a name="line.212"></a>
+<FONT color="green">213</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.213"></a>
+<FONT color="green">214</FONT>                final double value = e.getValue();<a name="line.214"></a>
+<FONT color="green">215</FONT>                sum += value * value;<a name="line.215"></a>
+<FONT color="green">216</FONT>            }<a name="line.216"></a>
+<FONT color="green">217</FONT>            return Math.sqrt(sum);<a name="line.217"></a>
+<FONT color="green">218</FONT>        }<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>        /** {@inheritDoc} */<a name="line.220"></a>
+<FONT color="green">221</FONT>        public double getL1Norm() {<a name="line.221"></a>
+<FONT color="green">222</FONT>            double norm = 0;<a name="line.222"></a>
+<FONT color="green">223</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.223"></a>
+<FONT color="green">224</FONT>            Entry e;<a name="line.224"></a>
+<FONT color="green">225</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.225"></a>
+<FONT color="green">226</FONT>                norm += Math.abs(e.getValue());<a name="line.226"></a>
+<FONT color="green">227</FONT>            }<a name="line.227"></a>
+<FONT color="green">228</FONT>            return norm;<a name="line.228"></a>
+<FONT color="green">229</FONT>        }<a name="line.229"></a>
+<FONT color="green">230</FONT>    <a name="line.230"></a>
+<FONT color="green">231</FONT>        /** {@inheritDoc} */<a name="line.231"></a>
+<FONT color="green">232</FONT>        public double getLInfNorm() {<a name="line.232"></a>
+<FONT color="green">233</FONT>            double norm = 0;<a name="line.233"></a>
+<FONT color="green">234</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.234"></a>
+<FONT color="green">235</FONT>            Entry e;<a name="line.235"></a>
+<FONT color="green">236</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.236"></a>
+<FONT color="green">237</FONT>                norm = Math.max(norm, Math.abs(e.getValue()));<a name="line.237"></a>
+<FONT color="green">238</FONT>            }<a name="line.238"></a>
+<FONT color="green">239</FONT>            return norm;<a name="line.239"></a>
+<FONT color="green">240</FONT>        }<a name="line.240"></a>
+<FONT color="green">241</FONT>    <a name="line.241"></a>
+<FONT color="green">242</FONT>        /** {@inheritDoc} */<a name="line.242"></a>
+<FONT color="green">243</FONT>        public double getDistance(double[] v) throws IllegalArgumentException {<a name="line.243"></a>
+<FONT color="green">244</FONT>            return getDistance(new ArrayRealVector(v,false));<a name="line.244"></a>
+<FONT color="green">245</FONT>        }<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>        /** {@inheritDoc} */<a name="line.247"></a>
+<FONT color="green">248</FONT>        public double getL1Distance(RealVector v) throws IllegalArgumentException {<a name="line.248"></a>
+<FONT color="green">249</FONT>            checkVectorDimensions(v);<a name="line.249"></a>
+<FONT color="green">250</FONT>            double d = 0;<a name="line.250"></a>
+<FONT color="green">251</FONT>            Iterator&lt;Entry&gt; it = iterator();<a name="line.251"></a>
+<FONT color="green">252</FONT>            Entry e;<a name="line.252"></a>
+<FONT color="green">253</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.253"></a>
+<FONT color="green">254</FONT>                d += Math.abs(e.getValue() - v.getEntry(e.getIndex()));<a name="line.254"></a>
+<FONT color="green">255</FONT>            }<a name="line.255"></a>
+<FONT color="green">256</FONT>            return d;<a name="line.256"></a>
+<FONT color="green">257</FONT>        }<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>        /** {@inheritDoc} */<a name="line.259"></a>
+<FONT color="green">260</FONT>        public double getL1Distance(double[] v) throws IllegalArgumentException {<a name="line.260"></a>
+<FONT color="green">261</FONT>            checkVectorDimensions(v.length);<a name="line.261"></a>
+<FONT color="green">262</FONT>            double d = 0;<a name="line.262"></a>
+<FONT color="green">263</FONT>            Iterator&lt;Entry&gt; it = iterator();<a name="line.263"></a>
+<FONT color="green">264</FONT>            Entry e;<a name="line.264"></a>
+<FONT color="green">265</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.265"></a>
+<FONT color="green">266</FONT>                d += Math.abs(e.getValue() - v[e.getIndex()]);<a name="line.266"></a>
+<FONT color="green">267</FONT>            }<a name="line.267"></a>
+<FONT color="green">268</FONT>            return d;<a name="line.268"></a>
+<FONT color="green">269</FONT>        }<a name="line.269"></a>
+<FONT color="green">270</FONT>    <a name="line.270"></a>
+<FONT color="green">271</FONT>        /** {@inheritDoc} */<a name="line.271"></a>
+<FONT color="green">272</FONT>        public double getLInfDistance(RealVector v) throws IllegalArgumentException {<a name="line.272"></a>
+<FONT color="green">273</FONT>            checkVectorDimensions(v);<a name="line.273"></a>
+<FONT color="green">274</FONT>            double d = 0;<a name="line.274"></a>
+<FONT color="green">275</FONT>            Iterator&lt;Entry&gt; it = iterator();<a name="line.275"></a>
+<FONT color="green">276</FONT>            Entry e;<a name="line.276"></a>
+<FONT color="green">277</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.277"></a>
+<FONT color="green">278</FONT>                d = Math.max(Math.abs(e.getValue() - v.getEntry(e.getIndex())), d);<a name="line.278"></a>
+<FONT color="green">279</FONT>            }<a name="line.279"></a>
+<FONT color="green">280</FONT>            return d;<a name="line.280"></a>
+<FONT color="green">281</FONT>        }<a name="line.281"></a>
+<FONT color="green">282</FONT>    <a name="line.282"></a>
+<FONT color="green">283</FONT>        /** {@inheritDoc} */<a name="line.283"></a>
+<FONT color="green">284</FONT>        public double getLInfDistance(double[] v) throws IllegalArgumentException {<a name="line.284"></a>
+<FONT color="green">285</FONT>            checkVectorDimensions(v.length);<a name="line.285"></a>
+<FONT color="green">286</FONT>            double d = 0;<a name="line.286"></a>
+<FONT color="green">287</FONT>            Iterator&lt;Entry&gt; it = iterator();<a name="line.287"></a>
+<FONT color="green">288</FONT>            Entry e;<a name="line.288"></a>
+<FONT color="green">289</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.289"></a>
+<FONT color="green">290</FONT>                d = Math.max(Math.abs(e.getValue() - v[e.getIndex()]), d);<a name="line.290"></a>
+<FONT color="green">291</FONT>            }<a name="line.291"></a>
+<FONT color="green">292</FONT>            return d;<a name="line.292"></a>
+<FONT color="green">293</FONT>        }<a name="line.293"></a>
+<FONT color="green">294</FONT>    <a name="line.294"></a>
+<FONT color="green">295</FONT>        /** Get the index of the minimum entry.<a name="line.295"></a>
+<FONT color="green">296</FONT>         * @return index of the minimum entry or -1 if vector length is 0<a name="line.296"></a>
+<FONT color="green">297</FONT>         * or all entries are NaN<a name="line.297"></a>
+<FONT color="green">298</FONT>         */<a name="line.298"></a>
+<FONT color="green">299</FONT>        public int getMinIndex() {<a name="line.299"></a>
+<FONT color="green">300</FONT>            int minIndex    = -1;<a name="line.300"></a>
+<FONT color="green">301</FONT>            double minValue = Double.POSITIVE_INFINITY;<a name="line.301"></a>
+<FONT color="green">302</FONT>            Iterator&lt;Entry&gt; iterator = iterator();<a name="line.302"></a>
+<FONT color="green">303</FONT>            while (iterator.hasNext()) {<a name="line.303"></a>
+<FONT color="green">304</FONT>                final Entry entry = iterator.next();<a name="line.304"></a>
+<FONT color="green">305</FONT>                if (entry.getValue() &lt;= minValue) {<a name="line.305"></a>
+<FONT color="green">306</FONT>                    minIndex = entry.getIndex();<a name="line.306"></a>
+<FONT color="green">307</FONT>                    minValue = entry.getValue();<a name="line.307"></a>
+<FONT color="green">308</FONT>                }<a name="line.308"></a>
+<FONT color="green">309</FONT>            }<a name="line.309"></a>
+<FONT color="green">310</FONT>            return minIndex;<a name="line.310"></a>
+<FONT color="green">311</FONT>        }<a name="line.311"></a>
+<FONT color="green">312</FONT>    <a name="line.312"></a>
+<FONT color="green">313</FONT>        /** Get the value of the minimum entry.<a name="line.313"></a>
+<FONT color="green">314</FONT>         * @return value of the minimum entry or NaN if all entries are NaN<a name="line.314"></a>
+<FONT color="green">315</FONT>         */<a name="line.315"></a>
+<FONT color="green">316</FONT>        public double getMinValue() {<a name="line.316"></a>
+<FONT color="green">317</FONT>            final int minIndex = getMinIndex();<a name="line.317"></a>
+<FONT color="green">318</FONT>            return minIndex &lt; 0 ? Double.NaN : getEntry(minIndex);<a name="line.318"></a>
+<FONT color="green">319</FONT>        }<a name="line.319"></a>
+<FONT color="green">320</FONT>    <a name="line.320"></a>
+<FONT color="green">321</FONT>        /** Get the index of the maximum entry.<a name="line.321"></a>
+<FONT color="green">322</FONT>         * @return index of the maximum entry or -1 if vector length is 0<a name="line.322"></a>
+<FONT color="green">323</FONT>         * or all entries are NaN<a name="line.323"></a>
+<FONT color="green">324</FONT>         */<a name="line.324"></a>
+<FONT color="green">325</FONT>        public int getMaxIndex() {<a name="line.325"></a>
+<FONT color="green">326</FONT>            int maxIndex    = -1;<a name="line.326"></a>
+<FONT color="green">327</FONT>            double maxValue = Double.NEGATIVE_INFINITY;<a name="line.327"></a>
+<FONT color="green">328</FONT>            Iterator&lt;Entry&gt; iterator = iterator();<a name="line.328"></a>
+<FONT color="green">329</FONT>            while (iterator.hasNext()) {<a name="line.329"></a>
+<FONT color="green">330</FONT>                final Entry entry = iterator.next();<a name="line.330"></a>
+<FONT color="green">331</FONT>                if (entry.getValue() &gt;= maxValue) {<a name="line.331"></a>
+<FONT color="green">332</FONT>                    maxIndex = entry.getIndex();<a name="line.332"></a>
+<FONT color="green">333</FONT>                    maxValue = entry.getValue();<a name="line.333"></a>
+<FONT color="green">334</FONT>                }<a name="line.334"></a>
+<FONT color="green">335</FONT>            }<a name="line.335"></a>
+<FONT color="green">336</FONT>            return maxIndex;<a name="line.336"></a>
+<FONT color="green">337</FONT>        }<a name="line.337"></a>
+<FONT color="green">338</FONT>    <a name="line.338"></a>
+<FONT color="green">339</FONT>        /** Get the value of the maximum entry.<a name="line.339"></a>
+<FONT color="green">340</FONT>         * @return value of the maximum entry or NaN if all entries are NaN<a name="line.340"></a>
+<FONT color="green">341</FONT>         */<a name="line.341"></a>
+<FONT color="green">342</FONT>        public double getMaxValue() {<a name="line.342"></a>
+<FONT color="green">343</FONT>            final int maxIndex = getMaxIndex();<a name="line.343"></a>
+<FONT color="green">344</FONT>            return maxIndex &lt; 0 ? Double.NaN : getEntry(maxIndex);<a name="line.344"></a>
+<FONT color="green">345</FONT>        }<a name="line.345"></a>
+<FONT color="green">346</FONT>    <a name="line.346"></a>
+<FONT color="green">347</FONT>        /** {@inheritDoc} */<a name="line.347"></a>
+<FONT color="green">348</FONT>        public RealVector mapAbs() {<a name="line.348"></a>
+<FONT color="green">349</FONT>            return copy().mapAbsToSelf();<a name="line.349"></a>
+<FONT color="green">350</FONT>        }<a name="line.350"></a>
+<FONT color="green">351</FONT>    <a name="line.351"></a>
+<FONT color="green">352</FONT>        /** {@inheritDoc} */<a name="line.352"></a>
+<FONT color="green">353</FONT>        public RealVector mapAbsToSelf() {<a name="line.353"></a>
+<FONT color="green">354</FONT>            try {<a name="line.354"></a>
+<FONT color="green">355</FONT>                return mapToSelf(ComposableFunction.ABS);<a name="line.355"></a>
+<FONT color="green">356</FONT>            } catch (FunctionEvaluationException e) {<a name="line.356"></a>
+<FONT color="green">357</FONT>                throw new IllegalArgumentException(e);<a name="line.357"></a>
+<FONT color="green">358</FONT>            }<a name="line.358"></a>
+<FONT color="green">359</FONT>        }<a name="line.359"></a>
+<FONT color="green">360</FONT>    <a name="line.360"></a>
+<FONT color="green">361</FONT>        /** {@inheritDoc} */<a name="line.361"></a>
+<FONT color="green">362</FONT>        public RealVector mapAcos() {<a name="line.362"></a>
+<FONT color="green">363</FONT>            return copy().mapAcosToSelf();<a name="line.363"></a>
+<FONT color="green">364</FONT>        }<a name="line.364"></a>
+<FONT color="green">365</FONT>    <a name="line.365"></a>
+<FONT color="green">366</FONT>        /** {@inheritDoc} */<a name="line.366"></a>
+<FONT color="green">367</FONT>        public RealVector mapAcosToSelf() {<a name="line.367"></a>
+<FONT color="green">368</FONT>            try {<a name="line.368"></a>
+<FONT color="green">369</FONT>                return mapToSelf(ComposableFunction.ACOS);<a name="line.369"></a>
+<FONT color="green">370</FONT>            } catch (FunctionEvaluationException e) {<a name="line.370"></a>
+<FONT color="green">371</FONT>                throw new IllegalArgumentException(e);<a name="line.371"></a>
+<FONT color="green">372</FONT>            }<a name="line.372"></a>
+<FONT color="green">373</FONT>        }<a name="line.373"></a>
+<FONT color="green">374</FONT>    <a name="line.374"></a>
+<FONT color="green">375</FONT>        /** {@inheritDoc} */<a name="line.375"></a>
+<FONT color="green">376</FONT>        public RealVector mapAsin() {<a name="line.376"></a>
+<FONT color="green">377</FONT>            return copy().mapAsinToSelf();<a name="line.377"></a>
+<FONT color="green">378</FONT>        }<a name="line.378"></a>
+<FONT color="green">379</FONT>    <a name="line.379"></a>
+<FONT color="green">380</FONT>        /** {@inheritDoc} */<a name="line.380"></a>
+<FONT color="green">381</FONT>        public RealVector mapAsinToSelf() {<a name="line.381"></a>
+<FONT color="green">382</FONT>            try {<a name="line.382"></a>
+<FONT color="green">383</FONT>                return mapToSelf(ComposableFunction.ASIN);<a name="line.383"></a>
+<FONT color="green">384</FONT>            } catch (FunctionEvaluationException e) {<a name="line.384"></a>
+<FONT color="green">385</FONT>                throw new IllegalArgumentException(e);<a name="line.385"></a>
+<FONT color="green">386</FONT>            }<a name="line.386"></a>
+<FONT color="green">387</FONT>        }<a name="line.387"></a>
+<FONT color="green">388</FONT>    <a name="line.388"></a>
+<FONT color="green">389</FONT>        /** {@inheritDoc} */<a name="line.389"></a>
+<FONT color="green">390</FONT>        public RealVector mapAtan() {<a name="line.390"></a>
+<FONT color="green">391</FONT>            return copy().mapAtanToSelf();<a name="line.391"></a>
+<FONT color="green">392</FONT>        }<a name="line.392"></a>
+<FONT color="green">393</FONT>    <a name="line.393"></a>
+<FONT color="green">394</FONT>        /** {@inheritDoc} */<a name="line.394"></a>
+<FONT color="green">395</FONT>        public RealVector mapAtanToSelf() {<a name="line.395"></a>
+<FONT color="green">396</FONT>            try {<a name="line.396"></a>
+<FONT color="green">397</FONT>                return mapToSelf(ComposableFunction.ATAN);<a name="line.397"></a>
+<FONT color="green">398</FONT>            } catch (FunctionEvaluationException e) {<a name="line.398"></a>
+<FONT color="green">399</FONT>                throw new IllegalArgumentException(e);<a name="line.399"></a>
+<FONT color="green">400</FONT>            }<a name="line.400"></a>
+<FONT color="green">401</FONT>        }<a name="line.401"></a>
+<FONT color="green">402</FONT>    <a name="line.402"></a>
+<FONT color="green">403</FONT>        /** {@inheritDoc} */<a name="line.403"></a>
+<FONT color="green">404</FONT>        public RealVector mapCbrt() {<a name="line.404"></a>
+<FONT color="green">405</FONT>            return copy().mapCbrtToSelf();<a name="line.405"></a>
+<FONT color="green">406</FONT>        }<a name="line.406"></a>
+<FONT color="green">407</FONT>    <a name="line.407"></a>
+<FONT color="green">408</FONT>        /** {@inheritDoc} */<a name="line.408"></a>
+<FONT color="green">409</FONT>        public RealVector mapCbrtToSelf() {<a name="line.409"></a>
+<FONT color="green">410</FONT>            try {<a name="line.410"></a>
+<FONT color="green">411</FONT>                return mapToSelf(ComposableFunction.CBRT);<a name="line.411"></a>
+<FONT color="green">412</FONT>            } catch (FunctionEvaluationException e) {<a name="line.412"></a>
+<FONT color="green">413</FONT>                throw new IllegalArgumentException(e);<a name="line.413"></a>
+<FONT color="green">414</FONT>            }<a name="line.414"></a>
+<FONT color="green">415</FONT>        }<a name="line.415"></a>
+<FONT color="green">416</FONT>    <a name="line.416"></a>
+<FONT color="green">417</FONT>        /** {@inheritDoc} */<a name="line.417"></a>
+<FONT color="green">418</FONT>        public RealVector mapCeil() {<a name="line.418"></a>
+<FONT color="green">419</FONT>            return copy().mapCeilToSelf();<a name="line.419"></a>
+<FONT color="green">420</FONT>        }<a name="line.420"></a>
+<FONT color="green">421</FONT>    <a name="line.421"></a>
+<FONT color="green">422</FONT>        /** {@inheritDoc} */<a name="line.422"></a>
+<FONT color="green">423</FONT>        public RealVector mapCeilToSelf() {<a name="line.423"></a>
+<FONT color="green">424</FONT>            try {<a name="line.424"></a>
+<FONT color="green">425</FONT>                return mapToSelf(ComposableFunction.CEIL);<a name="line.425"></a>
+<FONT color="green">426</FONT>            } catch (FunctionEvaluationException e) {<a name="line.426"></a>
+<FONT color="green">427</FONT>                throw new IllegalArgumentException(e);<a name="line.427"></a>
+<FONT color="green">428</FONT>            }<a name="line.428"></a>
+<FONT color="green">429</FONT>        }<a name="line.429"></a>
+<FONT color="green">430</FONT>    <a name="line.430"></a>
+<FONT color="green">431</FONT>        /** {@inheritDoc} */<a name="line.431"></a>
+<FONT color="green">432</FONT>        public RealVector mapCos() {<a name="line.432"></a>
+<FONT color="green">433</FONT>            return copy().mapCosToSelf();<a name="line.433"></a>
+<FONT color="green">434</FONT>        }<a name="line.434"></a>
+<FONT color="green">435</FONT>    <a name="line.435"></a>
+<FONT color="green">436</FONT>        /** {@inheritDoc} */<a name="line.436"></a>
+<FONT color="green">437</FONT>        public RealVector mapCosToSelf() {<a name="line.437"></a>
+<FONT color="green">438</FONT>            try {<a name="line.438"></a>
+<FONT color="green">439</FONT>                return mapToSelf(ComposableFunction.COS);<a name="line.439"></a>
+<FONT color="green">440</FONT>            } catch (FunctionEvaluationException e) {<a name="line.440"></a>
+<FONT color="green">441</FONT>                throw new IllegalArgumentException(e);<a name="line.441"></a>
+<FONT color="green">442</FONT>            }<a name="line.442"></a>
+<FONT color="green">443</FONT>        }<a name="line.443"></a>
+<FONT color="green">444</FONT>    <a name="line.444"></a>
+<FONT color="green">445</FONT>        /** {@inheritDoc} */<a name="line.445"></a>
+<FONT color="green">446</FONT>        public RealVector mapCosh() {<a name="line.446"></a>
+<FONT color="green">447</FONT>            return copy().mapCoshToSelf();<a name="line.447"></a>
+<FONT color="green">448</FONT>        }<a name="line.448"></a>
+<FONT color="green">449</FONT>    <a name="line.449"></a>
+<FONT color="green">450</FONT>        /** {@inheritDoc} */<a name="line.450"></a>
+<FONT color="green">451</FONT>        public RealVector mapCoshToSelf() {<a name="line.451"></a>
+<FONT color="green">452</FONT>            try {<a name="line.452"></a>
+<FONT color="green">453</FONT>                return mapToSelf(ComposableFunction.COSH);<a name="line.453"></a>
+<FONT color="green">454</FONT>            } catch (FunctionEvaluationException e) {<a name="line.454"></a>
+<FONT color="green">455</FONT>                throw new IllegalArgumentException(e);<a name="line.455"></a>
+<FONT color="green">456</FONT>            }<a name="line.456"></a>
+<FONT color="green">457</FONT>        }<a name="line.457"></a>
+<FONT color="green">458</FONT>    <a name="line.458"></a>
+<FONT color="green">459</FONT>        /** {@inheritDoc} */<a name="line.459"></a>
+<FONT color="green">460</FONT>        public RealVector mapDivide(double d) {<a name="line.460"></a>
+<FONT color="green">461</FONT>            return copy().mapDivideToSelf(d);<a name="line.461"></a>
+<FONT color="green">462</FONT>        }<a name="line.462"></a>
+<FONT color="green">463</FONT>    <a name="line.463"></a>
+<FONT color="green">464</FONT>        /** {@inheritDoc} */<a name="line.464"></a>
+<FONT color="green">465</FONT>        public RealVector mapDivideToSelf(double d){<a name="line.465"></a>
+<FONT color="green">466</FONT>            try {<a name="line.466"></a>
+<FONT color="green">467</FONT>                return mapToSelf(BinaryFunction.DIVIDE.fix2ndArgument(d));<a name="line.467"></a>
+<FONT color="green">468</FONT>            } catch (FunctionEvaluationException e) {<a name="line.468"></a>
+<FONT color="green">469</FONT>                throw new IllegalArgumentException(e);<a name="line.469"></a>
+<FONT color="green">470</FONT>            }<a name="line.470"></a>
+<FONT color="green">471</FONT>        }<a name="line.471"></a>
+<FONT color="green">472</FONT>    <a name="line.472"></a>
+<FONT color="green">473</FONT>        /** {@inheritDoc} */<a name="line.473"></a>
+<FONT color="green">474</FONT>        public RealVector mapExp() {<a name="line.474"></a>
+<FONT color="green">475</FONT>            return copy().mapExpToSelf();<a name="line.475"></a>
+<FONT color="green">476</FONT>        }<a name="line.476"></a>
+<FONT color="green">477</FONT>    <a name="line.477"></a>
+<FONT color="green">478</FONT>        /** {@inheritDoc} */<a name="line.478"></a>
+<FONT color="green">479</FONT>        public RealVector mapExpToSelf() {<a name="line.479"></a>
+<FONT color="green">480</FONT>            try {<a name="line.480"></a>
+<FONT color="green">481</FONT>                return mapToSelf(ComposableFunction.EXP);<a name="line.481"></a>
+<FONT color="green">482</FONT>            } catch (FunctionEvaluationException e) {<a name="line.482"></a>
+<FONT color="green">483</FONT>                throw new IllegalArgumentException(e);<a name="line.483"></a>
+<FONT color="green">484</FONT>            }<a name="line.484"></a>
+<FONT color="green">485</FONT>        }<a name="line.485"></a>
+<FONT color="green">486</FONT>    <a name="line.486"></a>
+<FONT color="green">487</FONT>        /** {@inheritDoc} */<a name="line.487"></a>
+<FONT color="green">488</FONT>        public RealVector mapExpm1() {<a name="line.488"></a>
+<FONT color="green">489</FONT>            return copy().mapExpm1ToSelf();<a name="line.489"></a>
+<FONT color="green">490</FONT>        }<a name="line.490"></a>
+<FONT color="green">491</FONT>    <a name="line.491"></a>
+<FONT color="green">492</FONT>        /** {@inheritDoc} */<a name="line.492"></a>
+<FONT color="green">493</FONT>        public RealVector mapExpm1ToSelf() {<a name="line.493"></a>
+<FONT color="green">494</FONT>            try {<a name="line.494"></a>
+<FONT color="green">495</FONT>                return mapToSelf(ComposableFunction.EXPM1);<a name="line.495"></a>
+<FONT color="green">496</FONT>            } catch (FunctionEvaluationException e) {<a name="line.496"></a>
+<FONT color="green">497</FONT>                throw new IllegalArgumentException(e);<a name="line.497"></a>
+<FONT color="green">498</FONT>            }<a name="line.498"></a>
+<FONT color="green">499</FONT>        }<a name="line.499"></a>
+<FONT color="green">500</FONT>    <a name="line.500"></a>
+<FONT color="green">501</FONT>        /** {@inheritDoc} */<a name="line.501"></a>
+<FONT color="green">502</FONT>        public RealVector mapFloor() {<a name="line.502"></a>
+<FONT color="green">503</FONT>            return copy().mapFloorToSelf();<a name="line.503"></a>
+<FONT color="green">504</FONT>        }<a name="line.504"></a>
+<FONT color="green">505</FONT>    <a name="line.505"></a>
+<FONT color="green">506</FONT>        /** {@inheritDoc} */<a name="line.506"></a>
+<FONT color="green">507</FONT>        public RealVector mapFloorToSelf() {<a name="line.507"></a>
+<FONT color="green">508</FONT>            try {<a name="line.508"></a>
+<FONT color="green">509</FONT>                return mapToSelf(ComposableFunction.FLOOR);<a name="line.509"></a>
+<FONT color="green">510</FONT>            } catch (FunctionEvaluationException e) {<a name="line.510"></a>
+<FONT color="green">511</FONT>                throw new IllegalArgumentException(e);<a name="line.511"></a>
+<FONT color="green">512</FONT>            }<a name="line.512"></a>
+<FONT color="green">513</FONT>        }<a name="line.513"></a>
+<FONT color="green">514</FONT>    <a name="line.514"></a>
+<FONT color="green">515</FONT>        /** {@inheritDoc} */<a name="line.515"></a>
+<FONT color="green">516</FONT>        public RealVector mapInv() {<a name="line.516"></a>
+<FONT color="green">517</FONT>            return copy().mapInvToSelf();<a name="line.517"></a>
+<FONT color="green">518</FONT>        }<a name="line.518"></a>
+<FONT color="green">519</FONT>    <a name="line.519"></a>
+<FONT color="green">520</FONT>        /** {@inheritDoc} */<a name="line.520"></a>
+<FONT color="green">521</FONT>        public RealVector mapInvToSelf() {<a name="line.521"></a>
+<FONT color="green">522</FONT>            try {<a name="line.522"></a>
+<FONT color="green">523</FONT>                return mapToSelf(ComposableFunction.INVERT);<a name="line.523"></a>
+<FONT color="green">524</FONT>            } catch (FunctionEvaluationException e) {<a name="line.524"></a>
+<FONT color="green">525</FONT>                throw new IllegalArgumentException(e);<a name="line.525"></a>
+<FONT color="green">526</FONT>            }<a name="line.526"></a>
+<FONT color="green">527</FONT>        }<a name="line.527"></a>
+<FONT color="green">528</FONT>    <a name="line.528"></a>
+<FONT color="green">529</FONT>        /** {@inheritDoc} */<a name="line.529"></a>
+<FONT color="green">530</FONT>        public RealVector mapLog() {<a name="line.530"></a>
+<FONT color="green">531</FONT>            return copy().mapLogToSelf();<a name="line.531"></a>
+<FONT color="green">532</FONT>        }<a name="line.532"></a>
+<FONT color="green">533</FONT>    <a name="line.533"></a>
+<FONT color="green">534</FONT>        /** {@inheritDoc} */<a name="line.534"></a>
+<FONT color="green">535</FONT>        public RealVector mapLogToSelf() {<a name="line.535"></a>
+<FONT color="green">536</FONT>            try {<a name="line.536"></a>
+<FONT color="green">537</FONT>                return mapToSelf(ComposableFunction.LOG);<a name="line.537"></a>
+<FONT color="green">538</FONT>            } catch (FunctionEvaluationException e) {<a name="line.538"></a>
+<FONT color="green">539</FONT>                throw new IllegalArgumentException(e);<a name="line.539"></a>
+<FONT color="green">540</FONT>            }<a name="line.540"></a>
+<FONT color="green">541</FONT>        }<a name="line.541"></a>
+<FONT color="green">542</FONT>    <a name="line.542"></a>
+<FONT color="green">543</FONT>        /** {@inheritDoc} */<a name="line.543"></a>
+<FONT color="green">544</FONT>        public RealVector mapLog10() {<a name="line.544"></a>
+<FONT color="green">545</FONT>            return copy().mapLog10ToSelf();<a name="line.545"></a>
+<FONT color="green">546</FONT>        }<a name="line.546"></a>
+<FONT color="green">547</FONT>    <a name="line.547"></a>
+<FONT color="green">548</FONT>        /** {@inheritDoc} */<a name="line.548"></a>
+<FONT color="green">549</FONT>        public RealVector mapLog10ToSelf() {<a name="line.549"></a>
+<FONT color="green">550</FONT>            try {<a name="line.550"></a>
+<FONT color="green">551</FONT>                return mapToSelf(ComposableFunction.LOG10);<a name="line.551"></a>
+<FONT color="green">552</FONT>            } catch (FunctionEvaluationException e) {<a name="line.552"></a>
+<FONT color="green">553</FONT>                throw new IllegalArgumentException(e);<a name="line.553"></a>
+<FONT color="green">554</FONT>            }<a name="line.554"></a>
+<FONT color="green">555</FONT>        }<a name="line.555"></a>
+<FONT color="green">556</FONT>    <a name="line.556"></a>
+<FONT color="green">557</FONT>        /** {@inheritDoc} */<a name="line.557"></a>
+<FONT color="green">558</FONT>        public RealVector mapLog1p() {<a name="line.558"></a>
+<FONT color="green">559</FONT>            return copy().mapLog1pToSelf();<a name="line.559"></a>
+<FONT color="green">560</FONT>        }<a name="line.560"></a>
+<FONT color="green">561</FONT>    <a name="line.561"></a>
+<FONT color="green">562</FONT>        /** {@inheritDoc} */<a name="line.562"></a>
+<FONT color="green">563</FONT>        public RealVector mapLog1pToSelf() {<a name="line.563"></a>
+<FONT color="green">564</FONT>            try {<a name="line.564"></a>
+<FONT color="green">565</FONT>                return mapToSelf(ComposableFunction.LOG1P);<a name="line.565"></a>
+<FONT color="green">566</FONT>            } catch (FunctionEvaluationException e) {<a name="line.566"></a>
+<FONT color="green">567</FONT>                throw new IllegalArgumentException(e);<a name="line.567"></a>
+<FONT color="green">568</FONT>            }<a name="line.568"></a>
+<FONT color="green">569</FONT>        }<a name="line.569"></a>
+<FONT color="green">570</FONT>    <a name="line.570"></a>
+<FONT color="green">571</FONT>        /** {@inheritDoc} */<a name="line.571"></a>
+<FONT color="green">572</FONT>        public RealVector mapMultiply(double d) {<a name="line.572"></a>
+<FONT color="green">573</FONT>            return copy().mapMultiplyToSelf(d);<a name="line.573"></a>
+<FONT color="green">574</FONT>        }<a name="line.574"></a>
+<FONT color="green">575</FONT>    <a name="line.575"></a>
+<FONT color="green">576</FONT>        /** {@inheritDoc} */<a name="line.576"></a>
+<FONT color="green">577</FONT>        public RealVector mapMultiplyToSelf(double d){<a name="line.577"></a>
+<FONT color="green">578</FONT>            try {<a name="line.578"></a>
+<FONT color="green">579</FONT>                return mapToSelf(BinaryFunction.MULTIPLY.fix1stArgument(d));<a name="line.579"></a>
+<FONT color="green">580</FONT>            } catch (FunctionEvaluationException e) {<a name="line.580"></a>
+<FONT color="green">581</FONT>                throw new IllegalArgumentException(e);<a name="line.581"></a>
+<FONT color="green">582</FONT>            }<a name="line.582"></a>
+<FONT color="green">583</FONT>        }<a name="line.583"></a>
+<FONT color="green">584</FONT>    <a name="line.584"></a>
+<FONT color="green">585</FONT>        /** {@inheritDoc} */<a name="line.585"></a>
+<FONT color="green">586</FONT>        public RealVector mapPow(double d) {<a name="line.586"></a>
+<FONT color="green">587</FONT>            return copy().mapPowToSelf(d);<a name="line.587"></a>
+<FONT color="green">588</FONT>        }<a name="line.588"></a>
+<FONT color="green">589</FONT>    <a name="line.589"></a>
+<FONT color="green">590</FONT>        /** {@inheritDoc} */<a name="line.590"></a>
+<FONT color="green">591</FONT>        public RealVector mapPowToSelf(double d){<a name="line.591"></a>
+<FONT color="green">592</FONT>            try {<a name="line.592"></a>
+<FONT color="green">593</FONT>                return mapToSelf(BinaryFunction.POW.fix2ndArgument(d));<a name="line.593"></a>
+<FONT color="green">594</FONT>            } catch (FunctionEvaluationException e) {<a name="line.594"></a>
+<FONT color="green">595</FONT>                throw new IllegalArgumentException(e);<a name="line.595"></a>
+<FONT color="green">596</FONT>            }<a name="line.596"></a>
+<FONT color="green">597</FONT>        }<a name="line.597"></a>
+<FONT color="green">598</FONT>    <a name="line.598"></a>
+<FONT color="green">599</FONT>        /** {@inheritDoc} */<a name="line.599"></a>
+<FONT color="green">600</FONT>        public RealVector mapRint() {<a name="line.600"></a>
+<FONT color="green">601</FONT>            return copy().mapRintToSelf();<a name="line.601"></a>
+<FONT color="green">602</FONT>        }<a name="line.602"></a>
+<FONT color="green">603</FONT>    <a name="line.603"></a>
+<FONT color="green">604</FONT>        /** {@inheritDoc} */<a name="line.604"></a>
+<FONT color="green">605</FONT>        public RealVector mapRintToSelf() {<a name="line.605"></a>
+<FONT color="green">606</FONT>            try {<a name="line.606"></a>
+<FONT color="green">607</FONT>                return mapToSelf(ComposableFunction.RINT);<a name="line.607"></a>
+<FONT color="green">608</FONT>            } catch (FunctionEvaluationException e) {<a name="line.608"></a>
+<FONT color="green">609</FONT>                throw new IllegalArgumentException(e);<a name="line.609"></a>
+<FONT color="green">610</FONT>            }<a name="line.610"></a>
+<FONT color="green">611</FONT>        }<a name="line.611"></a>
+<FONT color="green">612</FONT>    <a name="line.612"></a>
+<FONT color="green">613</FONT>        /** {@inheritDoc} */<a name="line.613"></a>
+<FONT color="green">614</FONT>        public RealVector mapSignum() {<a name="line.614"></a>
+<FONT color="green">615</FONT>            return copy().mapSignumToSelf();<a name="line.615"></a>
+<FONT color="green">616</FONT>        }<a name="line.616"></a>
+<FONT color="green">617</FONT>    <a name="line.617"></a>
+<FONT color="green">618</FONT>        /** {@inheritDoc} */<a name="line.618"></a>
+<FONT color="green">619</FONT>        public RealVector mapSignumToSelf() {<a name="line.619"></a>
+<FONT color="green">620</FONT>            try {<a name="line.620"></a>
+<FONT color="green">621</FONT>                return mapToSelf(ComposableFunction.SIGNUM);<a name="line.621"></a>
+<FONT color="green">622</FONT>            } catch (FunctionEvaluationException e) {<a name="line.622"></a>
+<FONT color="green">623</FONT>                throw new IllegalArgumentException(e);<a name="line.623"></a>
+<FONT color="green">624</FONT>            }<a name="line.624"></a>
+<FONT color="green">625</FONT>        }<a name="line.625"></a>
+<FONT color="green">626</FONT>    <a name="line.626"></a>
+<FONT color="green">627</FONT>        /** {@inheritDoc} */<a name="line.627"></a>
+<FONT color="green">628</FONT>        public RealVector mapSin() {<a name="line.628"></a>
+<FONT color="green">629</FONT>            return copy().mapSinToSelf();<a name="line.629"></a>
+<FONT color="green">630</FONT>        }<a name="line.630"></a>
+<FONT color="green">631</FONT>    <a name="line.631"></a>
+<FONT color="green">632</FONT>        /** {@inheritDoc} */<a name="line.632"></a>
+<FONT color="green">633</FONT>        public RealVector mapSinToSelf() {<a name="line.633"></a>
+<FONT color="green">634</FONT>            try {<a name="line.634"></a>
+<FONT color="green">635</FONT>                return mapToSelf(ComposableFunction.SIN);<a name="line.635"></a>
+<FONT color="green">636</FONT>            } catch (FunctionEvaluationException e) {<a name="line.636"></a>
+<FONT color="green">637</FONT>                throw new IllegalArgumentException(e);<a name="line.637"></a>
+<FONT color="green">638</FONT>            }<a name="line.638"></a>
+<FONT color="green">639</FONT>        }<a name="line.639"></a>
+<FONT color="green">640</FONT>    <a name="line.640"></a>
+<FONT color="green">641</FONT>        /** {@inheritDoc} */<a name="line.641"></a>
+<FONT color="green">642</FONT>        public RealVector mapSinh() {<a name="line.642"></a>
+<FONT color="green">643</FONT>            return copy().mapSinhToSelf();<a name="line.643"></a>
+<FONT color="green">644</FONT>        }<a name="line.644"></a>
+<FONT color="green">645</FONT>    <a name="line.645"></a>
+<FONT color="green">646</FONT>        /** {@inheritDoc} */<a name="line.646"></a>
+<FONT color="green">647</FONT>        public RealVector mapSinhToSelf() {<a name="line.647"></a>
+<FONT color="green">648</FONT>            try {<a name="line.648"></a>
+<FONT color="green">649</FONT>                return mapToSelf(ComposableFunction.SINH);<a name="line.649"></a>
+<FONT color="green">650</FONT>            } catch (FunctionEvaluationException e) {<a name="line.650"></a>
+<FONT color="green">651</FONT>                throw new IllegalArgumentException(e);<a name="line.651"></a>
+<FONT color="green">652</FONT>            }<a name="line.652"></a>
+<FONT color="green">653</FONT>        }<a name="line.653"></a>
+<FONT color="green">654</FONT>    <a name="line.654"></a>
+<FONT color="green">655</FONT>        /** {@inheritDoc} */<a name="line.655"></a>
+<FONT color="green">656</FONT>        public RealVector mapSqrt() {<a name="line.656"></a>
+<FONT color="green">657</FONT>            return copy().mapSqrtToSelf();<a name="line.657"></a>
+<FONT color="green">658</FONT>        }<a name="line.658"></a>
+<FONT color="green">659</FONT>    <a name="line.659"></a>
+<FONT color="green">660</FONT>        /** {@inheritDoc} */<a name="line.660"></a>
+<FONT color="green">661</FONT>        public RealVector mapSqrtToSelf() {<a name="line.661"></a>
+<FONT color="green">662</FONT>            try {<a name="line.662"></a>
+<FONT color="green">663</FONT>                return mapToSelf(ComposableFunction.SQRT);<a name="line.663"></a>
+<FONT color="green">664</FONT>            } catch (FunctionEvaluationException e) {<a name="line.664"></a>
+<FONT color="green">665</FONT>                throw new IllegalArgumentException(e);<a name="line.665"></a>
+<FONT color="green">666</FONT>            }<a name="line.666"></a>
+<FONT color="green">667</FONT>        }<a name="line.667"></a>
+<FONT color="green">668</FONT>    <a name="line.668"></a>
+<FONT color="green">669</FONT>        /** {@inheritDoc} */<a name="line.669"></a>
+<FONT color="green">670</FONT>        public RealVector mapSubtract(double d) {<a name="line.670"></a>
+<FONT color="green">671</FONT>            return copy().mapSubtractToSelf(d);<a name="line.671"></a>
+<FONT color="green">672</FONT>        }<a name="line.672"></a>
+<FONT color="green">673</FONT>    <a name="line.673"></a>
+<FONT color="green">674</FONT>        /** {@inheritDoc} */<a name="line.674"></a>
+<FONT color="green">675</FONT>        public RealVector mapSubtractToSelf(double d){<a name="line.675"></a>
+<FONT color="green">676</FONT>            return mapAddToSelf(-d);<a name="line.676"></a>
+<FONT color="green">677</FONT>        }<a name="line.677"></a>
+<FONT color="green">678</FONT>    <a name="line.678"></a>
+<FONT color="green">679</FONT>        /** {@inheritDoc} */<a name="line.679"></a>
+<FONT color="green">680</FONT>        public RealVector mapTan() {<a name="line.680"></a>
+<FONT color="green">681</FONT>            return copy().mapTanToSelf();<a name="line.681"></a>
+<FONT color="green">682</FONT>        }<a name="line.682"></a>
+<FONT color="green">683</FONT>    <a name="line.683"></a>
+<FONT color="green">684</FONT>        /** {@inheritDoc} */<a name="line.684"></a>
+<FONT color="green">685</FONT>        public RealVector mapTanToSelf() {<a name="line.685"></a>
+<FONT color="green">686</FONT>            try {<a name="line.686"></a>
+<FONT color="green">687</FONT>                return mapToSelf(ComposableFunction.TAN);<a name="line.687"></a>
+<FONT color="green">688</FONT>            } catch (FunctionEvaluationException e) {<a name="line.688"></a>
+<FONT color="green">689</FONT>                throw new IllegalArgumentException(e);<a name="line.689"></a>
+<FONT color="green">690</FONT>            }<a name="line.690"></a>
+<FONT color="green">691</FONT>        }<a name="line.691"></a>
+<FONT color="green">692</FONT>    <a name="line.692"></a>
+<FONT color="green">693</FONT>        /** {@inheritDoc} */<a name="line.693"></a>
+<FONT color="green">694</FONT>        public RealVector mapTanh() {<a name="line.694"></a>
+<FONT color="green">695</FONT>            return copy().mapTanhToSelf();<a name="line.695"></a>
+<FONT color="green">696</FONT>        }<a name="line.696"></a>
+<FONT color="green">697</FONT>    <a name="line.697"></a>
+<FONT color="green">698</FONT>        /** {@inheritDoc} */<a name="line.698"></a>
+<FONT color="green">699</FONT>        public RealVector mapTanhToSelf() {<a name="line.699"></a>
+<FONT color="green">700</FONT>            try {<a name="line.700"></a>
+<FONT color="green">701</FONT>                return mapToSelf(ComposableFunction.TANH);<a name="line.701"></a>
+<FONT color="green">702</FONT>            } catch (FunctionEvaluationException e) {<a name="line.702"></a>
+<FONT color="green">703</FONT>                throw new IllegalArgumentException(e);<a name="line.703"></a>
+<FONT color="green">704</FONT>            }<a name="line.704"></a>
+<FONT color="green">705</FONT>        }<a name="line.705"></a>
+<FONT color="green">706</FONT>    <a name="line.706"></a>
+<FONT color="green">707</FONT>        /** {@inheritDoc} */<a name="line.707"></a>
+<FONT color="green">708</FONT>        public RealVector mapUlp() {<a name="line.708"></a>
+<FONT color="green">709</FONT>            return copy().mapUlpToSelf();<a name="line.709"></a>
+<FONT color="green">710</FONT>        }<a name="line.710"></a>
+<FONT color="green">711</FONT>    <a name="line.711"></a>
+<FONT color="green">712</FONT>        /** {@inheritDoc} */<a name="line.712"></a>
+<FONT color="green">713</FONT>        public RealVector mapUlpToSelf() {<a name="line.713"></a>
+<FONT color="green">714</FONT>            try {<a name="line.714"></a>
+<FONT color="green">715</FONT>                return mapToSelf(ComposableFunction.ULP);<a name="line.715"></a>
+<FONT color="green">716</FONT>            } catch (FunctionEvaluationException e) {<a name="line.716"></a>
+<FONT color="green">717</FONT>                throw new IllegalArgumentException(e);<a name="line.717"></a>
+<FONT color="green">718</FONT>            }<a name="line.718"></a>
+<FONT color="green">719</FONT>        }<a name="line.719"></a>
+<FONT color="green">720</FONT>    <a name="line.720"></a>
+<FONT color="green">721</FONT>        /** {@inheritDoc} */<a name="line.721"></a>
+<FONT color="green">722</FONT>        public RealMatrix outerProduct(RealVector v) throws IllegalArgumentException {<a name="line.722"></a>
+<FONT color="green">723</FONT>            RealMatrix product;<a name="line.723"></a>
+<FONT color="green">724</FONT>            if (v instanceof SparseRealVector || this instanceof SparseRealVector) {<a name="line.724"></a>
+<FONT color="green">725</FONT>                product = new OpenMapRealMatrix(this.getDimension(), v.getDimension());<a name="line.725"></a>
+<FONT color="green">726</FONT>            } else {<a name="line.726"></a>
+<FONT color="green">727</FONT>                product = new Array2DRowRealMatrix(this.getDimension(), v.getDimension());<a name="line.727"></a>
+<FONT color="green">728</FONT>            }<a name="line.728"></a>
+<FONT color="green">729</FONT>            Iterator&lt;Entry&gt; thisIt = sparseIterator();<a name="line.729"></a>
+<FONT color="green">730</FONT>            Entry thisE = null;<a name="line.730"></a>
+<FONT color="green">731</FONT>            while (thisIt.hasNext() &amp;&amp; (thisE = thisIt.next()) != null) {<a name="line.731"></a>
+<FONT color="green">732</FONT>                Iterator&lt;Entry&gt; otherIt = v.sparseIterator();<a name="line.732"></a>
+<FONT color="green">733</FONT>                Entry otherE = null;<a name="line.733"></a>
+<FONT color="green">734</FONT>                while (otherIt.hasNext() &amp;&amp; (otherE = otherIt.next()) != null) {<a name="line.734"></a>
+<FONT color="green">735</FONT>                    product.setEntry(thisE.getIndex(), otherE.getIndex(),<a name="line.735"></a>
+<FONT color="green">736</FONT>                                     thisE.getValue() * otherE.getValue());<a name="line.736"></a>
+<FONT color="green">737</FONT>                }<a name="line.737"></a>
+<FONT color="green">738</FONT>            }<a name="line.738"></a>
+<FONT color="green">739</FONT>    <a name="line.739"></a>
+<FONT color="green">740</FONT>            return product;<a name="line.740"></a>
+<FONT color="green">741</FONT>    <a name="line.741"></a>
+<FONT color="green">742</FONT>        }<a name="line.742"></a>
+<FONT color="green">743</FONT>    <a name="line.743"></a>
+<FONT color="green">744</FONT>        /** {@inheritDoc} */<a name="line.744"></a>
+<FONT color="green">745</FONT>        public RealMatrix outerProduct(double[] v) throws IllegalArgumentException {<a name="line.745"></a>
+<FONT color="green">746</FONT>            return outerProduct(new ArrayRealVector(v, false));<a name="line.746"></a>
+<FONT color="green">747</FONT>        }<a name="line.747"></a>
+<FONT color="green">748</FONT>    <a name="line.748"></a>
+<FONT color="green">749</FONT>        /** {@inheritDoc} */<a name="line.749"></a>
+<FONT color="green">750</FONT>        public RealVector projection(double[] v) throws IllegalArgumentException {<a name="line.750"></a>
+<FONT color="green">751</FONT>            return projection(new ArrayRealVector(v, false));<a name="line.751"></a>
+<FONT color="green">752</FONT>        }<a name="line.752"></a>
+<FONT color="green">753</FONT>    <a name="line.753"></a>
+<FONT color="green">754</FONT>        /** {@inheritDoc} */<a name="line.754"></a>
+<FONT color="green">755</FONT>        public void set(double value) {<a name="line.755"></a>
+<FONT color="green">756</FONT>            Iterator&lt;Entry&gt; it = iterator();<a name="line.756"></a>
+<FONT color="green">757</FONT>            Entry e = null;<a name="line.757"></a>
+<FONT color="green">758</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.758"></a>
+<FONT color="green">759</FONT>                e.setValue(value);<a name="line.759"></a>
+<FONT color="green">760</FONT>            }<a name="line.760"></a>
+<FONT color="green">761</FONT>        }<a name="line.761"></a>
+<FONT color="green">762</FONT>    <a name="line.762"></a>
+<FONT color="green">763</FONT>        /** {@inheritDoc} */<a name="line.763"></a>
+<FONT color="green">764</FONT>        public double[] toArray() {<a name="line.764"></a>
+<FONT color="green">765</FONT>            int dim = getDimension();<a name="line.765"></a>
+<FONT color="green">766</FONT>            double[] values = new double[dim];<a name="line.766"></a>
+<FONT color="green">767</FONT>            for (int i = 0; i &lt; dim; i++) {<a name="line.767"></a>
+<FONT color="green">768</FONT>                values[i] = getEntry(i);<a name="line.768"></a>
+<FONT color="green">769</FONT>            }<a name="line.769"></a>
+<FONT color="green">770</FONT>            return values;<a name="line.770"></a>
+<FONT color="green">771</FONT>        }<a name="line.771"></a>
+<FONT color="green">772</FONT>    <a name="line.772"></a>
+<FONT color="green">773</FONT>        /** {@inheritDoc} */<a name="line.773"></a>
+<FONT color="green">774</FONT>        public double[] getData() {<a name="line.774"></a>
+<FONT color="green">775</FONT>            return toArray();<a name="line.775"></a>
+<FONT color="green">776</FONT>        }<a name="line.776"></a>
+<FONT color="green">777</FONT>    <a name="line.777"></a>
+<FONT color="green">778</FONT>        /** {@inheritDoc} */<a name="line.778"></a>
+<FONT color="green">779</FONT>        public RealVector unitVector() {<a name="line.779"></a>
+<FONT color="green">780</FONT>            RealVector copy = copy();<a name="line.780"></a>
+<FONT color="green">781</FONT>            copy.unitize();<a name="line.781"></a>
+<FONT color="green">782</FONT>            return copy;<a name="line.782"></a>
+<FONT color="green">783</FONT>        }<a name="line.783"></a>
+<FONT color="green">784</FONT>    <a name="line.784"></a>
+<FONT color="green">785</FONT>        /** {@inheritDoc} */<a name="line.785"></a>
+<FONT color="green">786</FONT>        public void unitize() {<a name="line.786"></a>
+<FONT color="green">787</FONT>            mapDivideToSelf(getNorm());<a name="line.787"></a>
+<FONT color="green">788</FONT>        }<a name="line.788"></a>
+<FONT color="green">789</FONT>    <a name="line.789"></a>
+<FONT color="green">790</FONT>        /** {@inheritDoc} */<a name="line.790"></a>
+<FONT color="green">791</FONT>        public Iterator&lt;Entry&gt; sparseIterator() {<a name="line.791"></a>
+<FONT color="green">792</FONT>            return new SparseEntryIterator();<a name="line.792"></a>
+<FONT color="green">793</FONT>        }<a name="line.793"></a>
+<FONT color="green">794</FONT>    <a name="line.794"></a>
+<FONT color="green">795</FONT>        /** {@inheritDoc} */<a name="line.795"></a>
+<FONT color="green">796</FONT>        public Iterator&lt;Entry&gt; iterator() {<a name="line.796"></a>
+<FONT color="green">797</FONT>            final int dim = getDimension();<a name="line.797"></a>
+<FONT color="green">798</FONT>            return new Iterator&lt;Entry&gt;() {<a name="line.798"></a>
+<FONT color="green">799</FONT>    <a name="line.799"></a>
+<FONT color="green">800</FONT>                /** Current index. */<a name="line.800"></a>
+<FONT color="green">801</FONT>                private int i = 0;<a name="line.801"></a>
+<FONT color="green">802</FONT>    <a name="line.802"></a>
+<FONT color="green">803</FONT>                /** Current entry. */<a name="line.803"></a>
+<FONT color="green">804</FONT>                private EntryImpl e = new EntryImpl();<a name="line.804"></a>
+<FONT color="green">805</FONT>    <a name="line.805"></a>
+<FONT color="green">806</FONT>                /** {@inheritDoc} */<a name="line.806"></a>
+<FONT color="green">807</FONT>                public boolean hasNext() {<a name="line.807"></a>
+<FONT color="green">808</FONT>                    return i &lt; dim;<a name="line.808"></a>
+<FONT color="green">809</FONT>                }<a name="line.809"></a>
+<FONT color="green">810</FONT>    <a name="line.810"></a>
+<FONT color="green">811</FONT>                /** {@inheritDoc} */<a name="line.811"></a>
+<FONT color="green">812</FONT>                public Entry next() {<a name="line.812"></a>
+<FONT color="green">813</FONT>                    e.setIndex(i++);<a name="line.813"></a>
+<FONT color="green">814</FONT>                    return e;<a name="line.814"></a>
+<FONT color="green">815</FONT>                }<a name="line.815"></a>
+<FONT color="green">816</FONT>    <a name="line.816"></a>
+<FONT color="green">817</FONT>                /** {@inheritDoc} */<a name="line.817"></a>
+<FONT color="green">818</FONT>                public void remove() {<a name="line.818"></a>
+<FONT color="green">819</FONT>                    throw new UnsupportedOperationException("Not supported");<a name="line.819"></a>
+<FONT color="green">820</FONT>                }<a name="line.820"></a>
+<FONT color="green">821</FONT>            };<a name="line.821"></a>
+<FONT color="green">822</FONT>        }<a name="line.822"></a>
+<FONT color="green">823</FONT>    <a name="line.823"></a>
+<FONT color="green">824</FONT>        /** {@inheritDoc} */<a name="line.824"></a>
+<FONT color="green">825</FONT>        public RealVector map(UnivariateRealFunction function) throws FunctionEvaluationException {<a name="line.825"></a>
+<FONT color="green">826</FONT>            return copy().mapToSelf(function);<a name="line.826"></a>
+<FONT color="green">827</FONT>        }<a name="line.827"></a>
+<FONT color="green">828</FONT>    <a name="line.828"></a>
+<FONT color="green">829</FONT>        /** {@inheritDoc} */<a name="line.829"></a>
+<FONT color="green">830</FONT>        public RealVector mapToSelf(UnivariateRealFunction function) throws FunctionEvaluationException {<a name="line.830"></a>
+<FONT color="green">831</FONT>            Iterator&lt;Entry&gt; it = (function.value(0) == 0) ? sparseIterator() : iterator();<a name="line.831"></a>
+<FONT color="green">832</FONT>            Entry e;<a name="line.832"></a>
+<FONT color="green">833</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.833"></a>
+<FONT color="green">834</FONT>                e.setValue(function.value(e.getValue()));<a name="line.834"></a>
+<FONT color="green">835</FONT>            }<a name="line.835"></a>
+<FONT color="green">836</FONT>            return this;<a name="line.836"></a>
+<FONT color="green">837</FONT>        }<a name="line.837"></a>
+<FONT color="green">838</FONT>    <a name="line.838"></a>
+<FONT color="green">839</FONT>        /** An entry in the vector. */<a name="line.839"></a>
+<FONT color="green">840</FONT>        protected class EntryImpl extends Entry {<a name="line.840"></a>
+<FONT color="green">841</FONT>    <a name="line.841"></a>
+<FONT color="green">842</FONT>            /** Simple constructor. */<a name="line.842"></a>
+<FONT color="green">843</FONT>            public EntryImpl() {<a name="line.843"></a>
+<FONT color="green">844</FONT>                setIndex(0);<a name="line.844"></a>
+<FONT color="green">845</FONT>            }<a name="line.845"></a>
+<FONT color="green">846</FONT>    <a name="line.846"></a>
+<FONT color="green">847</FONT>            /** {@inheritDoc} */<a name="line.847"></a>
+<FONT color="green">848</FONT>            @Override<a name="line.848"></a>
+<FONT color="green">849</FONT>            public double getValue() {<a name="line.849"></a>
+<FONT color="green">850</FONT>                return getEntry(getIndex());<a name="line.850"></a>
+<FONT color="green">851</FONT>            }<a name="line.851"></a>
+<FONT color="green">852</FONT>    <a name="line.852"></a>
+<FONT color="green">853</FONT>            /** {@inheritDoc} */<a name="line.853"></a>
+<FONT color="green">854</FONT>            @Override<a name="line.854"></a>
+<FONT color="green">855</FONT>            public void setValue(double newValue) {<a name="line.855"></a>
+<FONT color="green">856</FONT>                setEntry(getIndex(), newValue);<a name="line.856"></a>
+<FONT color="green">857</FONT>            }<a name="line.857"></a>
+<FONT color="green">858</FONT>        }<a name="line.858"></a>
+<FONT color="green">859</FONT>    <a name="line.859"></a>
+<FONT color="green">860</FONT>        /**<a name="line.860"></a>
+<FONT color="green">861</FONT>         * This class should rare be used, but is here to provide<a name="line.861"></a>
+<FONT color="green">862</FONT>         * a default implementation of sparseIterator(), which is implemented<a name="line.862"></a>
+<FONT color="green">863</FONT>         * by walking over the entries, skipping those whose values are the default one.<a name="line.863"></a>
+<FONT color="green">864</FONT>         *<a name="line.864"></a>
+<FONT color="green">865</FONT>         * Concrete subclasses which are SparseVector implementations should<a name="line.865"></a>
+<FONT color="green">866</FONT>         * make their own sparse iterator, not use this one.<a name="line.866"></a>
+<FONT color="green">867</FONT>         *<a name="line.867"></a>
+<FONT color="green">868</FONT>         * This implementation might be useful for ArrayRealVector, when expensive<a name="line.868"></a>
+<FONT color="green">869</FONT>         * operations which preserve the default value are to be done on the entries,<a name="line.869"></a>
+<FONT color="green">870</FONT>         * and the fraction of non-default values is small (i.e. someone took a<a name="line.870"></a>
+<FONT color="green">871</FONT>         * SparseVector, and passed it into the copy-constructor of ArrayRealVector)<a name="line.871"></a>
+<FONT color="green">872</FONT>         */<a name="line.872"></a>
+<FONT color="green">873</FONT>        protected class SparseEntryIterator implements Iterator&lt;Entry&gt; {<a name="line.873"></a>
+<FONT color="green">874</FONT>    <a name="line.874"></a>
+<FONT color="green">875</FONT>            /** Dimension of the vector. */<a name="line.875"></a>
+<FONT color="green">876</FONT>            private final int dim;<a name="line.876"></a>
+<FONT color="green">877</FONT>    <a name="line.877"></a>
+<FONT color="green">878</FONT>            /** Temporary entry (reused on each call to {@link #next()}. */<a name="line.878"></a>
+<FONT color="green">879</FONT>            private EntryImpl tmp = new EntryImpl();<a name="line.879"></a>
+<FONT color="green">880</FONT>    <a name="line.880"></a>
+<FONT color="green">881</FONT>            /** Current entry. */<a name="line.881"></a>
+<FONT color="green">882</FONT>            private EntryImpl current;<a name="line.882"></a>
+<FONT color="green">883</FONT>    <a name="line.883"></a>
+<FONT color="green">884</FONT>            /** Next entry. */<a name="line.884"></a>
+<FONT color="green">885</FONT>            private EntryImpl next;<a name="line.885"></a>
+<FONT color="green">886</FONT>    <a name="line.886"></a>
+<FONT color="green">887</FONT>            /** Simple constructor. */<a name="line.887"></a>
+<FONT color="green">888</FONT>            protected SparseEntryIterator() {<a name="line.888"></a>
+<FONT color="green">889</FONT>                dim = getDimension();<a name="line.889"></a>
+<FONT color="green">890</FONT>                current = new EntryImpl();<a name="line.890"></a>
+<FONT color="green">891</FONT>                if (current.getValue() == 0) {<a name="line.891"></a>
+<FONT color="green">892</FONT>                    advance(current);<a name="line.892"></a>
+<FONT color="green">893</FONT>                }<a name="line.893"></a>
+<FONT color="green">894</FONT>                if(current.getIndex() &gt;= 0){<a name="line.894"></a>
+<FONT color="green">895</FONT>                    // There is at least one non-zero entry<a name="line.895"></a>
+<FONT color="green">896</FONT>                    next = new EntryImpl();<a name="line.896"></a>
+<FONT color="green">897</FONT>                    next.setIndex(current.getIndex());<a name="line.897"></a>
+<FONT color="green">898</FONT>                    advance(next);<a name="line.898"></a>
+<FONT color="green">899</FONT>                } else {<a name="line.899"></a>
+<FONT color="green">900</FONT>                    // The vector consists of only zero entries, so deny having a next<a name="line.900"></a>
+<FONT color="green">901</FONT>                    current = null;<a name="line.901"></a>
+<FONT color="green">902</FONT>                }<a name="line.902"></a>
+<FONT color="green">903</FONT>            }<a name="line.903"></a>
+<FONT color="green">904</FONT>    <a name="line.904"></a>
+<FONT color="green">905</FONT>            /** Advance an entry up to the next non null one.<a name="line.905"></a>
+<FONT color="green">906</FONT>             * @param e entry to advance<a name="line.906"></a>
+<FONT color="green">907</FONT>             */<a name="line.907"></a>
+<FONT color="green">908</FONT>            protected void advance(EntryImpl e) {<a name="line.908"></a>
+<FONT color="green">909</FONT>                if (e == null) {<a name="line.909"></a>
+<FONT color="green">910</FONT>                    return;<a name="line.910"></a>
+<FONT color="green">911</FONT>                }<a name="line.911"></a>
+<FONT color="green">912</FONT>                do {<a name="line.912"></a>
+<FONT color="green">913</FONT>                    e.setIndex(e.getIndex() + 1);<a name="line.913"></a>
+<FONT color="green">914</FONT>                } while (e.getIndex() &lt; dim &amp;&amp; e.getValue() == 0);<a name="line.914"></a>
+<FONT color="green">915</FONT>                if (e.getIndex() &gt;= dim) {<a name="line.915"></a>
+<FONT color="green">916</FONT>                    e.setIndex(-1);<a name="line.916"></a>
+<FONT color="green">917</FONT>                }<a name="line.917"></a>
+<FONT color="green">918</FONT>            }<a name="line.918"></a>
+<FONT color="green">919</FONT>    <a name="line.919"></a>
+<FONT color="green">920</FONT>            /** {@inheritDoc} */<a name="line.920"></a>
+<FONT color="green">921</FONT>            public boolean hasNext() {<a name="line.921"></a>
+<FONT color="green">922</FONT>                return current != null;<a name="line.922"></a>
+<FONT color="green">923</FONT>            }<a name="line.923"></a>
+<FONT color="green">924</FONT>    <a name="line.924"></a>
+<FONT color="green">925</FONT>            /** {@inheritDoc} */<a name="line.925"></a>
+<FONT color="green">926</FONT>            public Entry next() {<a name="line.926"></a>
+<FONT color="green">927</FONT>                tmp.setIndex(current.getIndex());<a name="line.927"></a>
+<FONT color="green">928</FONT>                if (next != null) {<a name="line.928"></a>
+<FONT color="green">929</FONT>                    current.setIndex(next.getIndex());<a name="line.929"></a>
+<FONT color="green">930</FONT>                    advance(next);<a name="line.930"></a>
+<FONT color="green">931</FONT>                    if (next.getIndex() &lt; 0) {<a name="line.931"></a>
+<FONT color="green">932</FONT>                        next = null;<a name="line.932"></a>
+<FONT color="green">933</FONT>                    }<a name="line.933"></a>
+<FONT color="green">934</FONT>                } else {<a name="line.934"></a>
+<FONT color="green">935</FONT>                    current = null;<a name="line.935"></a>
+<FONT color="green">936</FONT>                }<a name="line.936"></a>
+<FONT color="green">937</FONT>                return tmp;<a name="line.937"></a>
+<FONT color="green">938</FONT>            }<a name="line.938"></a>
+<FONT color="green">939</FONT>    <a name="line.939"></a>
+<FONT color="green">940</FONT>            /** {@inheritDoc} */<a name="line.940"></a>
+<FONT color="green">941</FONT>            public void remove() {<a name="line.941"></a>
+<FONT color="green">942</FONT>                throw new UnsupportedOperationException("Not supported");<a name="line.942"></a>
+<FONT color="green">943</FONT>            }<a name="line.943"></a>
+<FONT color="green">944</FONT>        }<a name="line.944"></a>
+<FONT color="green">945</FONT>    <a name="line.945"></a>
+<FONT color="green">946</FONT>    }<a name="line.946"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/AbstractRealVector.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,1012 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Iterator;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.analysis.BinaryFunction;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.analysis.ComposableFunction;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    /**<a name="line.28"></a>
+<FONT color="green">029</FONT>     * This class provides default basic implementations for many methods in the<a name="line.29"></a>
+<FONT color="green">030</FONT>     * {@link RealVector} interface with.<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 904231 $ $Date: 2010-01-28 14:42:31 -0500 (Thu, 28 Jan 2010) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 2.1<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public abstract class AbstractRealVector implements RealVector {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /**<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Check if instance and specified vectors have the same dimension.<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @param v vector to compare instance with<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @exception IllegalArgumentException if the vectors do not<a name="line.39"></a>
+<FONT color="green">040</FONT>         * have the same dimension<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        protected void checkVectorDimensions(RealVector v) {<a name="line.42"></a>
+<FONT color="green">043</FONT>            checkVectorDimensions(v.getDimension());<a name="line.43"></a>
+<FONT color="green">044</FONT>        }<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /**<a name="line.46"></a>
+<FONT color="green">047</FONT>         * Check if instance dimension is equal to some expected value.<a name="line.47"></a>
+<FONT color="green">048</FONT>         *<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @param n expected dimension.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @exception IllegalArgumentException if the dimension is<a name="line.50"></a>
+<FONT color="green">051</FONT>         * inconsistent with vector size<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        protected void checkVectorDimensions(int n)<a name="line.53"></a>
+<FONT color="green">054</FONT>            throws IllegalArgumentException {<a name="line.54"></a>
+<FONT color="green">055</FONT>            double d = getDimension();<a name="line.55"></a>
+<FONT color="green">056</FONT>            if (d != n) {<a name="line.56"></a>
+<FONT color="green">057</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.57"></a>
+<FONT color="green">058</FONT>                      "vector length mismatch: got {0} but expected {1}",<a name="line.58"></a>
+<FONT color="green">059</FONT>                      d, n);<a name="line.59"></a>
+<FONT color="green">060</FONT>            }<a name="line.60"></a>
+<FONT color="green">061</FONT>        }<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /**<a name="line.63"></a>
+<FONT color="green">064</FONT>         * Check if an index is valid.<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param index index to check<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @exception MatrixIndexException if index is not valid<a name="line.66"></a>
+<FONT color="green">067</FONT>         */<a name="line.67"></a>
+<FONT color="green">068</FONT>        protected void checkIndex(final int index)<a name="line.68"></a>
+<FONT color="green">069</FONT>            throws MatrixIndexException {<a name="line.69"></a>
+<FONT color="green">070</FONT>            if (index &lt; 0 || index &gt;= getDimension()) {<a name="line.70"></a>
+<FONT color="green">071</FONT>                throw new MatrixIndexException(<a name="line.71"></a>
+<FONT color="green">072</FONT>                      "index {0} out of allowed range [{1}, {2}]",<a name="line.72"></a>
+<FONT color="green">073</FONT>                      index, 0, getDimension() - 1);<a name="line.73"></a>
+<FONT color="green">074</FONT>            }<a name="line.74"></a>
+<FONT color="green">075</FONT>        }<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** {@inheritDoc} */<a name="line.77"></a>
+<FONT color="green">078</FONT>        public void setSubVector(int index, RealVector v) throws MatrixIndexException {<a name="line.78"></a>
+<FONT color="green">079</FONT>            checkIndex(index);<a name="line.79"></a>
+<FONT color="green">080</FONT>            checkIndex(index + v.getDimension() - 1);<a name="line.80"></a>
+<FONT color="green">081</FONT>            setSubVector(index, v.getData());<a name="line.81"></a>
+<FONT color="green">082</FONT>        }<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /** {@inheritDoc} */<a name="line.84"></a>
+<FONT color="green">085</FONT>        public void setSubVector(int index, double[] v) throws MatrixIndexException {<a name="line.85"></a>
+<FONT color="green">086</FONT>            checkIndex(index);<a name="line.86"></a>
+<FONT color="green">087</FONT>            checkIndex(index + v.length - 1);<a name="line.87"></a>
+<FONT color="green">088</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.88"></a>
+<FONT color="green">089</FONT>                setEntry(i + index, v[i]);<a name="line.89"></a>
+<FONT color="green">090</FONT>            }<a name="line.90"></a>
+<FONT color="green">091</FONT>        }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /** {@inheritDoc} */<a name="line.93"></a>
+<FONT color="green">094</FONT>        public RealVector add(double[] v) throws IllegalArgumentException {<a name="line.94"></a>
+<FONT color="green">095</FONT>            double[] result = v.clone();<a name="line.95"></a>
+<FONT color="green">096</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.96"></a>
+<FONT color="green">097</FONT>            Entry e;<a name="line.97"></a>
+<FONT color="green">098</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.98"></a>
+<FONT color="green">099</FONT>                result[e.getIndex()] += e.getValue();<a name="line.99"></a>
+<FONT color="green">100</FONT>            }<a name="line.100"></a>
+<FONT color="green">101</FONT>            return new ArrayRealVector(result, false);<a name="line.101"></a>
+<FONT color="green">102</FONT>        }<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /** {@inheritDoc} */<a name="line.104"></a>
+<FONT color="green">105</FONT>        public RealVector add(RealVector v) throws IllegalArgumentException {<a name="line.105"></a>
+<FONT color="green">106</FONT>            if (v instanceof ArrayRealVector) {<a name="line.106"></a>
+<FONT color="green">107</FONT>                double[] values = ((ArrayRealVector)v).getDataRef();<a name="line.107"></a>
+<FONT color="green">108</FONT>                return add(values);<a name="line.108"></a>
+<FONT color="green">109</FONT>            }<a name="line.109"></a>
+<FONT color="green">110</FONT>            RealVector result = v.copy();<a name="line.110"></a>
+<FONT color="green">111</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.111"></a>
+<FONT color="green">112</FONT>            Entry e;<a name="line.112"></a>
+<FONT color="green">113</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.113"></a>
+<FONT color="green">114</FONT>                final int index = e.getIndex();<a name="line.114"></a>
+<FONT color="green">115</FONT>                result.setEntry(index, e.getValue() + result.getEntry(index));<a name="line.115"></a>
+<FONT color="green">116</FONT>            }<a name="line.116"></a>
+<FONT color="green">117</FONT>            return result;<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /** {@inheritDoc} */<a name="line.120"></a>
+<FONT color="green">121</FONT>        public RealVector subtract(double[] v) throws IllegalArgumentException {<a name="line.121"></a>
+<FONT color="green">122</FONT>            double[] result = v.clone();<a name="line.122"></a>
+<FONT color="green">123</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.123"></a>
+<FONT color="green">124</FONT>            Entry e;<a name="line.124"></a>
+<FONT color="green">125</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.125"></a>
+<FONT color="green">126</FONT>                final int index = e.getIndex();<a name="line.126"></a>
+<FONT color="green">127</FONT>                result[index] = e.getValue() - result[index];<a name="line.127"></a>
+<FONT color="green">128</FONT>            }<a name="line.128"></a>
+<FONT color="green">129</FONT>            return new ArrayRealVector(result, false);<a name="line.129"></a>
+<FONT color="green">130</FONT>        }<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>        /** {@inheritDoc} */<a name="line.132"></a>
+<FONT color="green">133</FONT>        public RealVector subtract(RealVector v) throws IllegalArgumentException {<a name="line.133"></a>
+<FONT color="green">134</FONT>            if (v instanceof ArrayRealVector) {<a name="line.134"></a>
+<FONT color="green">135</FONT>                double[] values = ((ArrayRealVector)v).getDataRef();<a name="line.135"></a>
+<FONT color="green">136</FONT>                return add(values);<a name="line.136"></a>
+<FONT color="green">137</FONT>            }<a name="line.137"></a>
+<FONT color="green">138</FONT>            RealVector result = v.copy();<a name="line.138"></a>
+<FONT color="green">139</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.139"></a>
+<FONT color="green">140</FONT>            Entry e;<a name="line.140"></a>
+<FONT color="green">141</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.141"></a>
+<FONT color="green">142</FONT>                final int index = e.getIndex();<a name="line.142"></a>
+<FONT color="green">143</FONT>                v.setEntry(index, e.getValue() - result.getEntry(index));<a name="line.143"></a>
+<FONT color="green">144</FONT>            }<a name="line.144"></a>
+<FONT color="green">145</FONT>            return result;<a name="line.145"></a>
+<FONT color="green">146</FONT>        }<a name="line.146"></a>
+<FONT color="green">147</FONT>    <a name="line.147"></a>
+<FONT color="green">148</FONT>        /** {@inheritDoc} */<a name="line.148"></a>
+<FONT color="green">149</FONT>        public RealVector mapAdd(double d) {<a name="line.149"></a>
+<FONT color="green">150</FONT>            return copy().mapAddToSelf(d);<a name="line.150"></a>
+<FONT color="green">151</FONT>        }<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>        /** {@inheritDoc} */<a name="line.153"></a>
+<FONT color="green">154</FONT>        public RealVector mapAddToSelf(double d) {<a name="line.154"></a>
+<FONT color="green">155</FONT>            if (d != 0) {<a name="line.155"></a>
+<FONT color="green">156</FONT>                try {<a name="line.156"></a>
+<FONT color="green">157</FONT>                    return mapToSelf(BinaryFunction.ADD.fix1stArgument(d));<a name="line.157"></a>
+<FONT color="green">158</FONT>                } catch (FunctionEvaluationException e) {<a name="line.158"></a>
+<FONT color="green">159</FONT>                    throw new IllegalArgumentException(e);<a name="line.159"></a>
+<FONT color="green">160</FONT>                }<a name="line.160"></a>
+<FONT color="green">161</FONT>            }<a name="line.161"></a>
+<FONT color="green">162</FONT>            return this;<a name="line.162"></a>
+<FONT color="green">163</FONT>        }<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>        /** {@inheritDoc} */<a name="line.165"></a>
+<FONT color="green">166</FONT>        public abstract AbstractRealVector copy();<a name="line.166"></a>
+<FONT color="green">167</FONT>    <a name="line.167"></a>
+<FONT color="green">168</FONT>        /** {@inheritDoc} */<a name="line.168"></a>
+<FONT color="green">169</FONT>        public double dotProduct(double[] v) throws IllegalArgumentException {<a name="line.169"></a>
+<FONT color="green">170</FONT>            return dotProduct(new ArrayRealVector(v, false));<a name="line.170"></a>
+<FONT color="green">171</FONT>        }<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>        /** {@inheritDoc} */<a name="line.173"></a>
+<FONT color="green">174</FONT>        public double dotProduct(RealVector v) throws IllegalArgumentException {<a name="line.174"></a>
+<FONT color="green">175</FONT>            checkVectorDimensions(v);<a name="line.175"></a>
+<FONT color="green">176</FONT>            double d = 0;<a name="line.176"></a>
+<FONT color="green">177</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.177"></a>
+<FONT color="green">178</FONT>            Entry e;<a name="line.178"></a>
+<FONT color="green">179</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.179"></a>
+<FONT color="green">180</FONT>                d += e.getValue() * v.getEntry(e.getIndex());<a name="line.180"></a>
+<FONT color="green">181</FONT>            }<a name="line.181"></a>
+<FONT color="green">182</FONT>            return d;<a name="line.182"></a>
+<FONT color="green">183</FONT>        }<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>        /** {@inheritDoc} */<a name="line.185"></a>
+<FONT color="green">186</FONT>        public RealVector ebeDivide(double[] v) throws IllegalArgumentException {<a name="line.186"></a>
+<FONT color="green">187</FONT>            return ebeDivide(new ArrayRealVector(v, false));<a name="line.187"></a>
+<FONT color="green">188</FONT>        }<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>        /** {@inheritDoc} */<a name="line.190"></a>
+<FONT color="green">191</FONT>        public RealVector ebeMultiply(double[] v) throws IllegalArgumentException {<a name="line.191"></a>
+<FONT color="green">192</FONT>            return ebeMultiply(new ArrayRealVector(v, false));<a name="line.192"></a>
+<FONT color="green">193</FONT>        }<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>        /** {@inheritDoc} */<a name="line.195"></a>
+<FONT color="green">196</FONT>        public double getDistance(RealVector v) throws IllegalArgumentException {<a name="line.196"></a>
+<FONT color="green">197</FONT>            checkVectorDimensions(v);<a name="line.197"></a>
+<FONT color="green">198</FONT>            double d = 0;<a name="line.198"></a>
+<FONT color="green">199</FONT>            Iterator&lt;Entry&gt; it = iterator();<a name="line.199"></a>
+<FONT color="green">200</FONT>            Entry e;<a name="line.200"></a>
+<FONT color="green">201</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.201"></a>
+<FONT color="green">202</FONT>                final double diff = e.getValue() - v.getEntry(e.getIndex());<a name="line.202"></a>
+<FONT color="green">203</FONT>                d += diff * diff;<a name="line.203"></a>
+<FONT color="green">204</FONT>            }<a name="line.204"></a>
+<FONT color="green">205</FONT>            return Math.sqrt(d);<a name="line.205"></a>
+<FONT color="green">206</FONT>        }<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>        /** {@inheritDoc} */<a name="line.208"></a>
+<FONT color="green">209</FONT>        public double getNorm() {<a name="line.209"></a>
+<FONT color="green">210</FONT>            double sum = 0;<a name="line.210"></a>
+<FONT color="green">211</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.211"></a>
+<FONT color="green">212</FONT>            Entry e;<a name="line.212"></a>
+<FONT color="green">213</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.213"></a>
+<FONT color="green">214</FONT>                final double value = e.getValue();<a name="line.214"></a>
+<FONT color="green">215</FONT>                sum += value * value;<a name="line.215"></a>
+<FONT color="green">216</FONT>            }<a name="line.216"></a>
+<FONT color="green">217</FONT>            return Math.sqrt(sum);<a name="line.217"></a>
+<FONT color="green">218</FONT>        }<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>        /** {@inheritDoc} */<a name="line.220"></a>
+<FONT color="green">221</FONT>        public double getL1Norm() {<a name="line.221"></a>
+<FONT color="green">222</FONT>            double norm = 0;<a name="line.222"></a>
+<FONT color="green">223</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.223"></a>
+<FONT color="green">224</FONT>            Entry e;<a name="line.224"></a>
+<FONT color="green">225</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.225"></a>
+<FONT color="green">226</FONT>                norm += Math.abs(e.getValue());<a name="line.226"></a>
+<FONT color="green">227</FONT>            }<a name="line.227"></a>
+<FONT color="green">228</FONT>            return norm;<a name="line.228"></a>
+<FONT color="green">229</FONT>        }<a name="line.229"></a>
+<FONT color="green">230</FONT>    <a name="line.230"></a>
+<FONT color="green">231</FONT>        /** {@inheritDoc} */<a name="line.231"></a>
+<FONT color="green">232</FONT>        public double getLInfNorm() {<a name="line.232"></a>
+<FONT color="green">233</FONT>            double norm = 0;<a name="line.233"></a>
+<FONT color="green">234</FONT>            Iterator&lt;Entry&gt; it = sparseIterator();<a name="line.234"></a>
+<FONT color="green">235</FONT>            Entry e;<a name="line.235"></a>
+<FONT color="green">236</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.236"></a>
+<FONT color="green">237</FONT>                norm = Math.max(norm, Math.abs(e.getValue()));<a name="line.237"></a>
+<FONT color="green">238</FONT>            }<a name="line.238"></a>
+<FONT color="green">239</FONT>            return norm;<a name="line.239"></a>
+<FONT color="green">240</FONT>        }<a name="line.240"></a>
+<FONT color="green">241</FONT>    <a name="line.241"></a>
+<FONT color="green">242</FONT>        /** {@inheritDoc} */<a name="line.242"></a>
+<FONT color="green">243</FONT>        public double getDistance(double[] v) throws IllegalArgumentException {<a name="line.243"></a>
+<FONT color="green">244</FONT>            return getDistance(new ArrayRealVector(v,false));<a name="line.244"></a>
+<FONT color="green">245</FONT>        }<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>        /** {@inheritDoc} */<a name="line.247"></a>
+<FONT color="green">248</FONT>        public double getL1Distance(RealVector v) throws IllegalArgumentException {<a name="line.248"></a>
+<FONT color="green">249</FONT>            checkVectorDimensions(v);<a name="line.249"></a>
+<FONT color="green">250</FONT>            double d = 0;<a name="line.250"></a>
+<FONT color="green">251</FONT>            Iterator&lt;Entry&gt; it = iterator();<a name="line.251"></a>
+<FONT color="green">252</FONT>            Entry e;<a name="line.252"></a>
+<FONT color="green">253</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.253"></a>
+<FONT color="green">254</FONT>                d += Math.abs(e.getValue() - v.getEntry(e.getIndex()));<a name="line.254"></a>
+<FONT color="green">255</FONT>            }<a name="line.255"></a>
+<FONT color="green">256</FONT>            return d;<a name="line.256"></a>
+<FONT color="green">257</FONT>        }<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>        /** {@inheritDoc} */<a name="line.259"></a>
+<FONT color="green">260</FONT>        public double getL1Distance(double[] v) throws IllegalArgumentException {<a name="line.260"></a>
+<FONT color="green">261</FONT>            checkVectorDimensions(v.length);<a name="line.261"></a>
+<FONT color="green">262</FONT>            double d = 0;<a name="line.262"></a>
+<FONT color="green">263</FONT>            Iterator&lt;Entry&gt; it = iterator();<a name="line.263"></a>
+<FONT color="green">264</FONT>            Entry e;<a name="line.264"></a>
+<FONT color="green">265</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.265"></a>
+<FONT color="green">266</FONT>                d += Math.abs(e.getValue() - v[e.getIndex()]);<a name="line.266"></a>
+<FONT color="green">267</FONT>            }<a name="line.267"></a>
+<FONT color="green">268</FONT>            return d;<a name="line.268"></a>
+<FONT color="green">269</FONT>        }<a name="line.269"></a>
+<FONT color="green">270</FONT>    <a name="line.270"></a>
+<FONT color="green">271</FONT>        /** {@inheritDoc} */<a name="line.271"></a>
+<FONT color="green">272</FONT>        public double getLInfDistance(RealVector v) throws IllegalArgumentException {<a name="line.272"></a>
+<FONT color="green">273</FONT>            checkVectorDimensions(v);<a name="line.273"></a>
+<FONT color="green">274</FONT>            double d = 0;<a name="line.274"></a>
+<FONT color="green">275</FONT>            Iterator&lt;Entry&gt; it = iterator();<a name="line.275"></a>
+<FONT color="green">276</FONT>            Entry e;<a name="line.276"></a>
+<FONT color="green">277</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.277"></a>
+<FONT color="green">278</FONT>                d = Math.max(Math.abs(e.getValue() - v.getEntry(e.getIndex())), d);<a name="line.278"></a>
+<FONT color="green">279</FONT>            }<a name="line.279"></a>
+<FONT color="green">280</FONT>            return d;<a name="line.280"></a>
+<FONT color="green">281</FONT>        }<a name="line.281"></a>
+<FONT color="green">282</FONT>    <a name="line.282"></a>
+<FONT color="green">283</FONT>        /** {@inheritDoc} */<a name="line.283"></a>
+<FONT color="green">284</FONT>        public double getLInfDistance(double[] v) throws IllegalArgumentException {<a name="line.284"></a>
+<FONT color="green">285</FONT>            checkVectorDimensions(v.length);<a name="line.285"></a>
+<FONT color="green">286</FONT>            double d = 0;<a name="line.286"></a>
+<FONT color="green">287</FONT>            Iterator&lt;Entry&gt; it = iterator();<a name="line.287"></a>
+<FONT color="green">288</FONT>            Entry e;<a name="line.288"></a>
+<FONT color="green">289</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.289"></a>
+<FONT color="green">290</FONT>                d = Math.max(Math.abs(e.getValue() - v[e.getIndex()]), d);<a name="line.290"></a>
+<FONT color="green">291</FONT>            }<a name="line.291"></a>
+<FONT color="green">292</FONT>            return d;<a name="line.292"></a>
+<FONT color="green">293</FONT>        }<a name="line.293"></a>
+<FONT color="green">294</FONT>    <a name="line.294"></a>
+<FONT color="green">295</FONT>        /** Get the index of the minimum entry.<a name="line.295"></a>
+<FONT color="green">296</FONT>         * @return index of the minimum entry or -1 if vector length is 0<a name="line.296"></a>
+<FONT color="green">297</FONT>         * or all entries are NaN<a name="line.297"></a>
+<FONT color="green">298</FONT>         */<a name="line.298"></a>
+<FONT color="green">299</FONT>        public int getMinIndex() {<a name="line.299"></a>
+<FONT color="green">300</FONT>            int minIndex    = -1;<a name="line.300"></a>
+<FONT color="green">301</FONT>            double minValue = Double.POSITIVE_INFINITY;<a name="line.301"></a>
+<FONT color="green">302</FONT>            Iterator&lt;Entry&gt; iterator = iterator();<a name="line.302"></a>
+<FONT color="green">303</FONT>            while (iterator.hasNext()) {<a name="line.303"></a>
+<FONT color="green">304</FONT>                final Entry entry = iterator.next();<a name="line.304"></a>
+<FONT color="green">305</FONT>                if (entry.getValue() &lt;= minValue) {<a name="line.305"></a>
+<FONT color="green">306</FONT>                    minIndex = entry.getIndex();<a name="line.306"></a>
+<FONT color="green">307</FONT>                    minValue = entry.getValue();<a name="line.307"></a>
+<FONT color="green">308</FONT>                }<a name="line.308"></a>
+<FONT color="green">309</FONT>            }<a name="line.309"></a>
+<FONT color="green">310</FONT>            return minIndex;<a name="line.310"></a>
+<FONT color="green">311</FONT>        }<a name="line.311"></a>
+<FONT color="green">312</FONT>    <a name="line.312"></a>
+<FONT color="green">313</FONT>        /** Get the value of the minimum entry.<a name="line.313"></a>
+<FONT color="green">314</FONT>         * @return value of the minimum entry or NaN if all entries are NaN<a name="line.314"></a>
+<FONT color="green">315</FONT>         */<a name="line.315"></a>
+<FONT color="green">316</FONT>        public double getMinValue() {<a name="line.316"></a>
+<FONT color="green">317</FONT>            final int minIndex = getMinIndex();<a name="line.317"></a>
+<FONT color="green">318</FONT>            return minIndex &lt; 0 ? Double.NaN : getEntry(minIndex);<a name="line.318"></a>
+<FONT color="green">319</FONT>        }<a name="line.319"></a>
+<FONT color="green">320</FONT>    <a name="line.320"></a>
+<FONT color="green">321</FONT>        /** Get the index of the maximum entry.<a name="line.321"></a>
+<FONT color="green">322</FONT>         * @return index of the maximum entry or -1 if vector length is 0<a name="line.322"></a>
+<FONT color="green">323</FONT>         * or all entries are NaN<a name="line.323"></a>
+<FONT color="green">324</FONT>         */<a name="line.324"></a>
+<FONT color="green">325</FONT>        public int getMaxIndex() {<a name="line.325"></a>
+<FONT color="green">326</FONT>            int maxIndex    = -1;<a name="line.326"></a>
+<FONT color="green">327</FONT>            double maxValue = Double.NEGATIVE_INFINITY;<a name="line.327"></a>
+<FONT color="green">328</FONT>            Iterator&lt;Entry&gt; iterator = iterator();<a name="line.328"></a>
+<FONT color="green">329</FONT>            while (iterator.hasNext()) {<a name="line.329"></a>
+<FONT color="green">330</FONT>                final Entry entry = iterator.next();<a name="line.330"></a>
+<FONT color="green">331</FONT>                if (entry.getValue() &gt;= maxValue) {<a name="line.331"></a>
+<FONT color="green">332</FONT>                    maxIndex = entry.getIndex();<a name="line.332"></a>
+<FONT color="green">333</FONT>                    maxValue = entry.getValue();<a name="line.333"></a>
+<FONT color="green">334</FONT>                }<a name="line.334"></a>
+<FONT color="green">335</FONT>            }<a name="line.335"></a>
+<FONT color="green">336</FONT>            return maxIndex;<a name="line.336"></a>
+<FONT color="green">337</FONT>        }<a name="line.337"></a>
+<FONT color="green">338</FONT>    <a name="line.338"></a>
+<FONT color="green">339</FONT>        /** Get the value of the maximum entry.<a name="line.339"></a>
+<FONT color="green">340</FONT>         * @return value of the maximum entry or NaN if all entries are NaN<a name="line.340"></a>
+<FONT color="green">341</FONT>         */<a name="line.341"></a>
+<FONT color="green">342</FONT>        public double getMaxValue() {<a name="line.342"></a>
+<FONT color="green">343</FONT>            final int maxIndex = getMaxIndex();<a name="line.343"></a>
+<FONT color="green">344</FONT>            return maxIndex &lt; 0 ? Double.NaN : getEntry(maxIndex);<a name="line.344"></a>
+<FONT color="green">345</FONT>        }<a name="line.345"></a>
+<FONT color="green">346</FONT>    <a name="line.346"></a>
+<FONT color="green">347</FONT>        /** {@inheritDoc} */<a name="line.347"></a>
+<FONT color="green">348</FONT>        public RealVector mapAbs() {<a name="line.348"></a>
+<FONT color="green">349</FONT>            return copy().mapAbsToSelf();<a name="line.349"></a>
+<FONT color="green">350</FONT>        }<a name="line.350"></a>
+<FONT color="green">351</FONT>    <a name="line.351"></a>
+<FONT color="green">352</FONT>        /** {@inheritDoc} */<a name="line.352"></a>
+<FONT color="green">353</FONT>        public RealVector mapAbsToSelf() {<a name="line.353"></a>
+<FONT color="green">354</FONT>            try {<a name="line.354"></a>
+<FONT color="green">355</FONT>                return mapToSelf(ComposableFunction.ABS);<a name="line.355"></a>
+<FONT color="green">356</FONT>            } catch (FunctionEvaluationException e) {<a name="line.356"></a>
+<FONT color="green">357</FONT>                throw new IllegalArgumentException(e);<a name="line.357"></a>
+<FONT color="green">358</FONT>            }<a name="line.358"></a>
+<FONT color="green">359</FONT>        }<a name="line.359"></a>
+<FONT color="green">360</FONT>    <a name="line.360"></a>
+<FONT color="green">361</FONT>        /** {@inheritDoc} */<a name="line.361"></a>
+<FONT color="green">362</FONT>        public RealVector mapAcos() {<a name="line.362"></a>
+<FONT color="green">363</FONT>            return copy().mapAcosToSelf();<a name="line.363"></a>
+<FONT color="green">364</FONT>        }<a name="line.364"></a>
+<FONT color="green">365</FONT>    <a name="line.365"></a>
+<FONT color="green">366</FONT>        /** {@inheritDoc} */<a name="line.366"></a>
+<FONT color="green">367</FONT>        public RealVector mapAcosToSelf() {<a name="line.367"></a>
+<FONT color="green">368</FONT>            try {<a name="line.368"></a>
+<FONT color="green">369</FONT>                return mapToSelf(ComposableFunction.ACOS);<a name="line.369"></a>
+<FONT color="green">370</FONT>            } catch (FunctionEvaluationException e) {<a name="line.370"></a>
+<FONT color="green">371</FONT>                throw new IllegalArgumentException(e);<a name="line.371"></a>
+<FONT color="green">372</FONT>            }<a name="line.372"></a>
+<FONT color="green">373</FONT>        }<a name="line.373"></a>
+<FONT color="green">374</FONT>    <a name="line.374"></a>
+<FONT color="green">375</FONT>        /** {@inheritDoc} */<a name="line.375"></a>
+<FONT color="green">376</FONT>        public RealVector mapAsin() {<a name="line.376"></a>
+<FONT color="green">377</FONT>            return copy().mapAsinToSelf();<a name="line.377"></a>
+<FONT color="green">378</FONT>        }<a name="line.378"></a>
+<FONT color="green">379</FONT>    <a name="line.379"></a>
+<FONT color="green">380</FONT>        /** {@inheritDoc} */<a name="line.380"></a>
+<FONT color="green">381</FONT>        public RealVector mapAsinToSelf() {<a name="line.381"></a>
+<FONT color="green">382</FONT>            try {<a name="line.382"></a>
+<FONT color="green">383</FONT>                return mapToSelf(ComposableFunction.ASIN);<a name="line.383"></a>
+<FONT color="green">384</FONT>            } catch (FunctionEvaluationException e) {<a name="line.384"></a>
+<FONT color="green">385</FONT>                throw new IllegalArgumentException(e);<a name="line.385"></a>
+<FONT color="green">386</FONT>            }<a name="line.386"></a>
+<FONT color="green">387</FONT>        }<a name="line.387"></a>
+<FONT color="green">388</FONT>    <a name="line.388"></a>
+<FONT color="green">389</FONT>        /** {@inheritDoc} */<a name="line.389"></a>
+<FONT color="green">390</FONT>        public RealVector mapAtan() {<a name="line.390"></a>
+<FONT color="green">391</FONT>            return copy().mapAtanToSelf();<a name="line.391"></a>
+<FONT color="green">392</FONT>        }<a name="line.392"></a>
+<FONT color="green">393</FONT>    <a name="line.393"></a>
+<FONT color="green">394</FONT>        /** {@inheritDoc} */<a name="line.394"></a>
+<FONT color="green">395</FONT>        public RealVector mapAtanToSelf() {<a name="line.395"></a>
+<FONT color="green">396</FONT>            try {<a name="line.396"></a>
+<FONT color="green">397</FONT>                return mapToSelf(ComposableFunction.ATAN);<a name="line.397"></a>
+<FONT color="green">398</FONT>            } catch (FunctionEvaluationException e) {<a name="line.398"></a>
+<FONT color="green">399</FONT>                throw new IllegalArgumentException(e);<a name="line.399"></a>
+<FONT color="green">400</FONT>            }<a name="line.400"></a>
+<FONT color="green">401</FONT>        }<a name="line.401"></a>
+<FONT color="green">402</FONT>    <a name="line.402"></a>
+<FONT color="green">403</FONT>        /** {@inheritDoc} */<a name="line.403"></a>
+<FONT color="green">404</FONT>        public RealVector mapCbrt() {<a name="line.404"></a>
+<FONT color="green">405</FONT>            return copy().mapCbrtToSelf();<a name="line.405"></a>
+<FONT color="green">406</FONT>        }<a name="line.406"></a>
+<FONT color="green">407</FONT>    <a name="line.407"></a>
+<FONT color="green">408</FONT>        /** {@inheritDoc} */<a name="line.408"></a>
+<FONT color="green">409</FONT>        public RealVector mapCbrtToSelf() {<a name="line.409"></a>
+<FONT color="green">410</FONT>            try {<a name="line.410"></a>
+<FONT color="green">411</FONT>                return mapToSelf(ComposableFunction.CBRT);<a name="line.411"></a>
+<FONT color="green">412</FONT>            } catch (FunctionEvaluationException e) {<a name="line.412"></a>
+<FONT color="green">413</FONT>                throw new IllegalArgumentException(e);<a name="line.413"></a>
+<FONT color="green">414</FONT>            }<a name="line.414"></a>
+<FONT color="green">415</FONT>        }<a name="line.415"></a>
+<FONT color="green">416</FONT>    <a name="line.416"></a>
+<FONT color="green">417</FONT>        /** {@inheritDoc} */<a name="line.417"></a>
+<FONT color="green">418</FONT>        public RealVector mapCeil() {<a name="line.418"></a>
+<FONT color="green">419</FONT>            return copy().mapCeilToSelf();<a name="line.419"></a>
+<FONT color="green">420</FONT>        }<a name="line.420"></a>
+<FONT color="green">421</FONT>    <a name="line.421"></a>
+<FONT color="green">422</FONT>        /** {@inheritDoc} */<a name="line.422"></a>
+<FONT color="green">423</FONT>        public RealVector mapCeilToSelf() {<a name="line.423"></a>
+<FONT color="green">424</FONT>            try {<a name="line.424"></a>
+<FONT color="green">425</FONT>                return mapToSelf(ComposableFunction.CEIL);<a name="line.425"></a>
+<FONT color="green">426</FONT>            } catch (FunctionEvaluationException e) {<a name="line.426"></a>
+<FONT color="green">427</FONT>                throw new IllegalArgumentException(e);<a name="line.427"></a>
+<FONT color="green">428</FONT>            }<a name="line.428"></a>
+<FONT color="green">429</FONT>        }<a name="line.429"></a>
+<FONT color="green">430</FONT>    <a name="line.430"></a>
+<FONT color="green">431</FONT>        /** {@inheritDoc} */<a name="line.431"></a>
+<FONT color="green">432</FONT>        public RealVector mapCos() {<a name="line.432"></a>
+<FONT color="green">433</FONT>            return copy().mapCosToSelf();<a name="line.433"></a>
+<FONT color="green">434</FONT>        }<a name="line.434"></a>
+<FONT color="green">435</FONT>    <a name="line.435"></a>
+<FONT color="green">436</FONT>        /** {@inheritDoc} */<a name="line.436"></a>
+<FONT color="green">437</FONT>        public RealVector mapCosToSelf() {<a name="line.437"></a>
+<FONT color="green">438</FONT>            try {<a name="line.438"></a>
+<FONT color="green">439</FONT>                return mapToSelf(ComposableFunction.COS);<a name="line.439"></a>
+<FONT color="green">440</FONT>            } catch (FunctionEvaluationException e) {<a name="line.440"></a>
+<FONT color="green">441</FONT>                throw new IllegalArgumentException(e);<a name="line.441"></a>
+<FONT color="green">442</FONT>            }<a name="line.442"></a>
+<FONT color="green">443</FONT>        }<a name="line.443"></a>
+<FONT color="green">444</FONT>    <a name="line.444"></a>
+<FONT color="green">445</FONT>        /** {@inheritDoc} */<a name="line.445"></a>
+<FONT color="green">446</FONT>        public RealVector mapCosh() {<a name="line.446"></a>
+<FONT color="green">447</FONT>            return copy().mapCoshToSelf();<a name="line.447"></a>
+<FONT color="green">448</FONT>        }<a name="line.448"></a>
+<FONT color="green">449</FONT>    <a name="line.449"></a>
+<FONT color="green">450</FONT>        /** {@inheritDoc} */<a name="line.450"></a>
+<FONT color="green">451</FONT>        public RealVector mapCoshToSelf() {<a name="line.451"></a>
+<FONT color="green">452</FONT>            try {<a name="line.452"></a>
+<FONT color="green">453</FONT>                return mapToSelf(ComposableFunction.COSH);<a name="line.453"></a>
+<FONT color="green">454</FONT>            } catch (FunctionEvaluationException e) {<a name="line.454"></a>
+<FONT color="green">455</FONT>                throw new IllegalArgumentException(e);<a name="line.455"></a>
+<FONT color="green">456</FONT>            }<a name="line.456"></a>
+<FONT color="green">457</FONT>        }<a name="line.457"></a>
+<FONT color="green">458</FONT>    <a name="line.458"></a>
+<FONT color="green">459</FONT>        /** {@inheritDoc} */<a name="line.459"></a>
+<FONT color="green">460</FONT>        public RealVector mapDivide(double d) {<a name="line.460"></a>
+<FONT color="green">461</FONT>            return copy().mapDivideToSelf(d);<a name="line.461"></a>
+<FONT color="green">462</FONT>        }<a name="line.462"></a>
+<FONT color="green">463</FONT>    <a name="line.463"></a>
+<FONT color="green">464</FONT>        /** {@inheritDoc} */<a name="line.464"></a>
+<FONT color="green">465</FONT>        public RealVector mapDivideToSelf(double d){<a name="line.465"></a>
+<FONT color="green">466</FONT>            try {<a name="line.466"></a>
+<FONT color="green">467</FONT>                return mapToSelf(BinaryFunction.DIVIDE.fix2ndArgument(d));<a name="line.467"></a>
+<FONT color="green">468</FONT>            } catch (FunctionEvaluationException e) {<a name="line.468"></a>
+<FONT color="green">469</FONT>                throw new IllegalArgumentException(e);<a name="line.469"></a>
+<FONT color="green">470</FONT>            }<a name="line.470"></a>
+<FONT color="green">471</FONT>        }<a name="line.471"></a>
+<FONT color="green">472</FONT>    <a name="line.472"></a>
+<FONT color="green">473</FONT>        /** {@inheritDoc} */<a name="line.473"></a>
+<FONT color="green">474</FONT>        public RealVector mapExp() {<a name="line.474"></a>
+<FONT color="green">475</FONT>            return copy().mapExpToSelf();<a name="line.475"></a>
+<FONT color="green">476</FONT>        }<a name="line.476"></a>
+<FONT color="green">477</FONT>    <a name="line.477"></a>
+<FONT color="green">478</FONT>        /** {@inheritDoc} */<a name="line.478"></a>
+<FONT color="green">479</FONT>        public RealVector mapExpToSelf() {<a name="line.479"></a>
+<FONT color="green">480</FONT>            try {<a name="line.480"></a>
+<FONT color="green">481</FONT>                return mapToSelf(ComposableFunction.EXP);<a name="line.481"></a>
+<FONT color="green">482</FONT>            } catch (FunctionEvaluationException e) {<a name="line.482"></a>
+<FONT color="green">483</FONT>                throw new IllegalArgumentException(e);<a name="line.483"></a>
+<FONT color="green">484</FONT>            }<a name="line.484"></a>
+<FONT color="green">485</FONT>        }<a name="line.485"></a>
+<FONT color="green">486</FONT>    <a name="line.486"></a>
+<FONT color="green">487</FONT>        /** {@inheritDoc} */<a name="line.487"></a>
+<FONT color="green">488</FONT>        public RealVector mapExpm1() {<a name="line.488"></a>
+<FONT color="green">489</FONT>            return copy().mapExpm1ToSelf();<a name="line.489"></a>
+<FONT color="green">490</FONT>        }<a name="line.490"></a>
+<FONT color="green">491</FONT>    <a name="line.491"></a>
+<FONT color="green">492</FONT>        /** {@inheritDoc} */<a name="line.492"></a>
+<FONT color="green">493</FONT>        public RealVector mapExpm1ToSelf() {<a name="line.493"></a>
+<FONT color="green">494</FONT>            try {<a name="line.494"></a>
+<FONT color="green">495</FONT>                return mapToSelf(ComposableFunction.EXPM1);<a name="line.495"></a>
+<FONT color="green">496</FONT>            } catch (FunctionEvaluationException e) {<a name="line.496"></a>
+<FONT color="green">497</FONT>                throw new IllegalArgumentException(e);<a name="line.497"></a>
+<FONT color="green">498</FONT>            }<a name="line.498"></a>
+<FONT color="green">499</FONT>        }<a name="line.499"></a>
+<FONT color="green">500</FONT>    <a name="line.500"></a>
+<FONT color="green">501</FONT>        /** {@inheritDoc} */<a name="line.501"></a>
+<FONT color="green">502</FONT>        public RealVector mapFloor() {<a name="line.502"></a>
+<FONT color="green">503</FONT>            return copy().mapFloorToSelf();<a name="line.503"></a>
+<FONT color="green">504</FONT>        }<a name="line.504"></a>
+<FONT color="green">505</FONT>    <a name="line.505"></a>
+<FONT color="green">506</FONT>        /** {@inheritDoc} */<a name="line.506"></a>
+<FONT color="green">507</FONT>        public RealVector mapFloorToSelf() {<a name="line.507"></a>
+<FONT color="green">508</FONT>            try {<a name="line.508"></a>
+<FONT color="green">509</FONT>                return mapToSelf(ComposableFunction.FLOOR);<a name="line.509"></a>
+<FONT color="green">510</FONT>            } catch (FunctionEvaluationException e) {<a name="line.510"></a>
+<FONT color="green">511</FONT>                throw new IllegalArgumentException(e);<a name="line.511"></a>
+<FONT color="green">512</FONT>            }<a name="line.512"></a>
+<FONT color="green">513</FONT>        }<a name="line.513"></a>
+<FONT color="green">514</FONT>    <a name="line.514"></a>
+<FONT color="green">515</FONT>        /** {@inheritDoc} */<a name="line.515"></a>
+<FONT color="green">516</FONT>        public RealVector mapInv() {<a name="line.516"></a>
+<FONT color="green">517</FONT>            return copy().mapInvToSelf();<a name="line.517"></a>
+<FONT color="green">518</FONT>        }<a name="line.518"></a>
+<FONT color="green">519</FONT>    <a name="line.519"></a>
+<FONT color="green">520</FONT>        /** {@inheritDoc} */<a name="line.520"></a>
+<FONT color="green">521</FONT>        public RealVector mapInvToSelf() {<a name="line.521"></a>
+<FONT color="green">522</FONT>            try {<a name="line.522"></a>
+<FONT color="green">523</FONT>                return mapToSelf(ComposableFunction.INVERT);<a name="line.523"></a>
+<FONT color="green">524</FONT>            } catch (FunctionEvaluationException e) {<a name="line.524"></a>
+<FONT color="green">525</FONT>                throw new IllegalArgumentException(e);<a name="line.525"></a>
+<FONT color="green">526</FONT>            }<a name="line.526"></a>
+<FONT color="green">527</FONT>        }<a name="line.527"></a>
+<FONT color="green">528</FONT>    <a name="line.528"></a>
+<FONT color="green">529</FONT>        /** {@inheritDoc} */<a name="line.529"></a>
+<FONT color="green">530</FONT>        public RealVector mapLog() {<a name="line.530"></a>
+<FONT color="green">531</FONT>            return copy().mapLogToSelf();<a name="line.531"></a>
+<FONT color="green">532</FONT>        }<a name="line.532"></a>
+<FONT color="green">533</FONT>    <a name="line.533"></a>
+<FONT color="green">534</FONT>        /** {@inheritDoc} */<a name="line.534"></a>
+<FONT color="green">535</FONT>        public RealVector mapLogToSelf() {<a name="line.535"></a>
+<FONT color="green">536</FONT>            try {<a name="line.536"></a>
+<FONT color="green">537</FONT>                return mapToSelf(ComposableFunction.LOG);<a name="line.537"></a>
+<FONT color="green">538</FONT>            } catch (FunctionEvaluationException e) {<a name="line.538"></a>
+<FONT color="green">539</FONT>                throw new IllegalArgumentException(e);<a name="line.539"></a>
+<FONT color="green">540</FONT>            }<a name="line.540"></a>
+<FONT color="green">541</FONT>        }<a name="line.541"></a>
+<FONT color="green">542</FONT>    <a name="line.542"></a>
+<FONT color="green">543</FONT>        /** {@inheritDoc} */<a name="line.543"></a>
+<FONT color="green">544</FONT>        public RealVector mapLog10() {<a name="line.544"></a>
+<FONT color="green">545</FONT>            return copy().mapLog10ToSelf();<a name="line.545"></a>
+<FONT color="green">546</FONT>        }<a name="line.546"></a>
+<FONT color="green">547</FONT>    <a name="line.547"></a>
+<FONT color="green">548</FONT>        /** {@inheritDoc} */<a name="line.548"></a>
+<FONT color="green">549</FONT>        public RealVector mapLog10ToSelf() {<a name="line.549"></a>
+<FONT color="green">550</FONT>            try {<a name="line.550"></a>
+<FONT color="green">551</FONT>                return mapToSelf(ComposableFunction.LOG10);<a name="line.551"></a>
+<FONT color="green">552</FONT>            } catch (FunctionEvaluationException e) {<a name="line.552"></a>
+<FONT color="green">553</FONT>                throw new IllegalArgumentException(e);<a name="line.553"></a>
+<FONT color="green">554</FONT>            }<a name="line.554"></a>
+<FONT color="green">555</FONT>        }<a name="line.555"></a>
+<FONT color="green">556</FONT>    <a name="line.556"></a>
+<FONT color="green">557</FONT>        /** {@inheritDoc} */<a name="line.557"></a>
+<FONT color="green">558</FONT>        public RealVector mapLog1p() {<a name="line.558"></a>
+<FONT color="green">559</FONT>            return copy().mapLog1pToSelf();<a name="line.559"></a>
+<FONT color="green">560</FONT>        }<a name="line.560"></a>
+<FONT color="green">561</FONT>    <a name="line.561"></a>
+<FONT color="green">562</FONT>        /** {@inheritDoc} */<a name="line.562"></a>
+<FONT color="green">563</FONT>        public RealVector mapLog1pToSelf() {<a name="line.563"></a>
+<FONT color="green">564</FONT>            try {<a name="line.564"></a>
+<FONT color="green">565</FONT>                return mapToSelf(ComposableFunction.LOG1P);<a name="line.565"></a>
+<FONT color="green">566</FONT>            } catch (FunctionEvaluationException e) {<a name="line.566"></a>
+<FONT color="green">567</FONT>                throw new IllegalArgumentException(e);<a name="line.567"></a>
+<FONT color="green">568</FONT>            }<a name="line.568"></a>
+<FONT color="green">569</FONT>        }<a name="line.569"></a>
+<FONT color="green">570</FONT>    <a name="line.570"></a>
+<FONT color="green">571</FONT>        /** {@inheritDoc} */<a name="line.571"></a>
+<FONT color="green">572</FONT>        public RealVector mapMultiply(double d) {<a name="line.572"></a>
+<FONT color="green">573</FONT>            return copy().mapMultiplyToSelf(d);<a name="line.573"></a>
+<FONT color="green">574</FONT>        }<a name="line.574"></a>
+<FONT color="green">575</FONT>    <a name="line.575"></a>
+<FONT color="green">576</FONT>        /** {@inheritDoc} */<a name="line.576"></a>
+<FONT color="green">577</FONT>        public RealVector mapMultiplyToSelf(double d){<a name="line.577"></a>
+<FONT color="green">578</FONT>            try {<a name="line.578"></a>
+<FONT color="green">579</FONT>                return mapToSelf(BinaryFunction.MULTIPLY.fix1stArgument(d));<a name="line.579"></a>
+<FONT color="green">580</FONT>            } catch (FunctionEvaluationException e) {<a name="line.580"></a>
+<FONT color="green">581</FONT>                throw new IllegalArgumentException(e);<a name="line.581"></a>
+<FONT color="green">582</FONT>            }<a name="line.582"></a>
+<FONT color="green">583</FONT>        }<a name="line.583"></a>
+<FONT color="green">584</FONT>    <a name="line.584"></a>
+<FONT color="green">585</FONT>        /** {@inheritDoc} */<a name="line.585"></a>
+<FONT color="green">586</FONT>        public RealVector mapPow(double d) {<a name="line.586"></a>
+<FONT color="green">587</FONT>            return copy().mapPowToSelf(d);<a name="line.587"></a>
+<FONT color="green">588</FONT>        }<a name="line.588"></a>
+<FONT color="green">589</FONT>    <a name="line.589"></a>
+<FONT color="green">590</FONT>        /** {@inheritDoc} */<a name="line.590"></a>
+<FONT color="green">591</FONT>        public RealVector mapPowToSelf(double d){<a name="line.591"></a>
+<FONT color="green">592</FONT>            try {<a name="line.592"></a>
+<FONT color="green">593</FONT>                return mapToSelf(BinaryFunction.POW.fix2ndArgument(d));<a name="line.593"></a>
+<FONT color="green">594</FONT>            } catch (FunctionEvaluationException e) {<a name="line.594"></a>
+<FONT color="green">595</FONT>                throw new IllegalArgumentException(e);<a name="line.595"></a>
+<FONT color="green">596</FONT>            }<a name="line.596"></a>
+<FONT color="green">597</FONT>        }<a name="line.597"></a>
+<FONT color="green">598</FONT>    <a name="line.598"></a>
+<FONT color="green">599</FONT>        /** {@inheritDoc} */<a name="line.599"></a>
+<FONT color="green">600</FONT>        public RealVector mapRint() {<a name="line.600"></a>
+<FONT color="green">601</FONT>            return copy().mapRintToSelf();<a name="line.601"></a>
+<FONT color="green">602</FONT>        }<a name="line.602"></a>
+<FONT color="green">603</FONT>    <a name="line.603"></a>
+<FONT color="green">604</FONT>        /** {@inheritDoc} */<a name="line.604"></a>
+<FONT color="green">605</FONT>        public RealVector mapRintToSelf() {<a name="line.605"></a>
+<FONT color="green">606</FONT>            try {<a name="line.606"></a>
+<FONT color="green">607</FONT>                return mapToSelf(ComposableFunction.RINT);<a name="line.607"></a>
+<FONT color="green">608</FONT>            } catch (FunctionEvaluationException e) {<a name="line.608"></a>
+<FONT color="green">609</FONT>                throw new IllegalArgumentException(e);<a name="line.609"></a>
+<FONT color="green">610</FONT>            }<a name="line.610"></a>
+<FONT color="green">611</FONT>        }<a name="line.611"></a>
+<FONT color="green">612</FONT>    <a name="line.612"></a>
+<FONT color="green">613</FONT>        /** {@inheritDoc} */<a name="line.613"></a>
+<FONT color="green">614</FONT>        public RealVector mapSignum() {<a name="line.614"></a>
+<FONT color="green">615</FONT>            return copy().mapSignumToSelf();<a name="line.615"></a>
+<FONT color="green">616</FONT>        }<a name="line.616"></a>
+<FONT color="green">617</FONT>    <a name="line.617"></a>
+<FONT color="green">618</FONT>        /** {@inheritDoc} */<a name="line.618"></a>
+<FONT color="green">619</FONT>        public RealVector mapSignumToSelf() {<a name="line.619"></a>
+<FONT color="green">620</FONT>            try {<a name="line.620"></a>
+<FONT color="green">621</FONT>                return mapToSelf(ComposableFunction.SIGNUM);<a name="line.621"></a>
+<FONT color="green">622</FONT>            } catch (FunctionEvaluationException e) {<a name="line.622"></a>
+<FONT color="green">623</FONT>                throw new IllegalArgumentException(e);<a name="line.623"></a>
+<FONT color="green">624</FONT>            }<a name="line.624"></a>
+<FONT color="green">625</FONT>        }<a name="line.625"></a>
+<FONT color="green">626</FONT>    <a name="line.626"></a>
+<FONT color="green">627</FONT>        /** {@inheritDoc} */<a name="line.627"></a>
+<FONT color="green">628</FONT>        public RealVector mapSin() {<a name="line.628"></a>
+<FONT color="green">629</FONT>            return copy().mapSinToSelf();<a name="line.629"></a>
+<FONT color="green">630</FONT>        }<a name="line.630"></a>
+<FONT color="green">631</FONT>    <a name="line.631"></a>
+<FONT color="green">632</FONT>        /** {@inheritDoc} */<a name="line.632"></a>
+<FONT color="green">633</FONT>        public RealVector mapSinToSelf() {<a name="line.633"></a>
+<FONT color="green">634</FONT>            try {<a name="line.634"></a>
+<FONT color="green">635</FONT>                return mapToSelf(ComposableFunction.SIN);<a name="line.635"></a>
+<FONT color="green">636</FONT>            } catch (FunctionEvaluationException e) {<a name="line.636"></a>
+<FONT color="green">637</FONT>                throw new IllegalArgumentException(e);<a name="line.637"></a>
+<FONT color="green">638</FONT>            }<a name="line.638"></a>
+<FONT color="green">639</FONT>        }<a name="line.639"></a>
+<FONT color="green">640</FONT>    <a name="line.640"></a>
+<FONT color="green">641</FONT>        /** {@inheritDoc} */<a name="line.641"></a>
+<FONT color="green">642</FONT>        public RealVector mapSinh() {<a name="line.642"></a>
+<FONT color="green">643</FONT>            return copy().mapSinhToSelf();<a name="line.643"></a>
+<FONT color="green">644</FONT>        }<a name="line.644"></a>
+<FONT color="green">645</FONT>    <a name="line.645"></a>
+<FONT color="green">646</FONT>        /** {@inheritDoc} */<a name="line.646"></a>
+<FONT color="green">647</FONT>        public RealVector mapSinhToSelf() {<a name="line.647"></a>
+<FONT color="green">648</FONT>            try {<a name="line.648"></a>
+<FONT color="green">649</FONT>                return mapToSelf(ComposableFunction.SINH);<a name="line.649"></a>
+<FONT color="green">650</FONT>            } catch (FunctionEvaluationException e) {<a name="line.650"></a>
+<FONT color="green">651</FONT>                throw new IllegalArgumentException(e);<a name="line.651"></a>
+<FONT color="green">652</FONT>            }<a name="line.652"></a>
+<FONT color="green">653</FONT>        }<a name="line.653"></a>
+<FONT color="green">654</FONT>    <a name="line.654"></a>
+<FONT color="green">655</FONT>        /** {@inheritDoc} */<a name="line.655"></a>
+<FONT color="green">656</FONT>        public RealVector mapSqrt() {<a name="line.656"></a>
+<FONT color="green">657</FONT>            return copy().mapSqrtToSelf();<a name="line.657"></a>
+<FONT color="green">658</FONT>        }<a name="line.658"></a>
+<FONT color="green">659</FONT>    <a name="line.659"></a>
+<FONT color="green">660</FONT>        /** {@inheritDoc} */<a name="line.660"></a>
+<FONT color="green">661</FONT>        public RealVector mapSqrtToSelf() {<a name="line.661"></a>
+<FONT color="green">662</FONT>            try {<a name="line.662"></a>
+<FONT color="green">663</FONT>                return mapToSelf(ComposableFunction.SQRT);<a name="line.663"></a>
+<FONT color="green">664</FONT>            } catch (FunctionEvaluationException e) {<a name="line.664"></a>
+<FONT color="green">665</FONT>                throw new IllegalArgumentException(e);<a name="line.665"></a>
+<FONT color="green">666</FONT>            }<a name="line.666"></a>
+<FONT color="green">667</FONT>        }<a name="line.667"></a>
+<FONT color="green">668</FONT>    <a name="line.668"></a>
+<FONT color="green">669</FONT>        /** {@inheritDoc} */<a name="line.669"></a>
+<FONT color="green">670</FONT>        public RealVector mapSubtract(double d) {<a name="line.670"></a>
+<FONT color="green">671</FONT>            return copy().mapSubtractToSelf(d);<a name="line.671"></a>
+<FONT color="green">672</FONT>        }<a name="line.672"></a>
+<FONT color="green">673</FONT>    <a name="line.673"></a>
+<FONT color="green">674</FONT>        /** {@inheritDoc} */<a name="line.674"></a>
+<FONT color="green">675</FONT>        public RealVector mapSubtractToSelf(double d){<a name="line.675"></a>
+<FONT color="green">676</FONT>            return mapAddToSelf(-d);<a name="line.676"></a>
+<FONT color="green">677</FONT>        }<a name="line.677"></a>
+<FONT color="green">678</FONT>    <a name="line.678"></a>
+<FONT color="green">679</FONT>        /** {@inheritDoc} */<a name="line.679"></a>
+<FONT color="green">680</FONT>        public RealVector mapTan() {<a name="line.680"></a>
+<FONT color="green">681</FONT>            return copy().mapTanToSelf();<a name="line.681"></a>
+<FONT color="green">682</FONT>        }<a name="line.682"></a>
+<FONT color="green">683</FONT>    <a name="line.683"></a>
+<FONT color="green">684</FONT>        /** {@inheritDoc} */<a name="line.684"></a>
+<FONT color="green">685</FONT>        public RealVector mapTanToSelf() {<a name="line.685"></a>
+<FONT color="green">686</FONT>            try {<a name="line.686"></a>
+<FONT color="green">687</FONT>                return mapToSelf(ComposableFunction.TAN);<a name="line.687"></a>
+<FONT color="green">688</FONT>            } catch (FunctionEvaluationException e) {<a name="line.688"></a>
+<FONT color="green">689</FONT>                throw new IllegalArgumentException(e);<a name="line.689"></a>
+<FONT color="green">690</FONT>            }<a name="line.690"></a>
+<FONT color="green">691</FONT>        }<a name="line.691"></a>
+<FONT color="green">692</FONT>    <a name="line.692"></a>
+<FONT color="green">693</FONT>        /** {@inheritDoc} */<a name="line.693"></a>
+<FONT color="green">694</FONT>        public RealVector mapTanh() {<a name="line.694"></a>
+<FONT color="green">695</FONT>            return copy().mapTanhToSelf();<a name="line.695"></a>
+<FONT color="green">696</FONT>        }<a name="line.696"></a>
+<FONT color="green">697</FONT>    <a name="line.697"></a>
+<FONT color="green">698</FONT>        /** {@inheritDoc} */<a name="line.698"></a>
+<FONT color="green">699</FONT>        public RealVector mapTanhToSelf() {<a name="line.699"></a>
+<FONT color="green">700</FONT>            try {<a name="line.700"></a>
+<FONT color="green">701</FONT>                return mapToSelf(ComposableFunction.TANH);<a name="line.701"></a>
+<FONT color="green">702</FONT>            } catch (FunctionEvaluationException e) {<a name="line.702"></a>
+<FONT color="green">703</FONT>                throw new IllegalArgumentException(e);<a name="line.703"></a>
+<FONT color="green">704</FONT>            }<a name="line.704"></a>
+<FONT color="green">705</FONT>        }<a name="line.705"></a>
+<FONT color="green">706</FONT>    <a name="line.706"></a>
+<FONT color="green">707</FONT>        /** {@inheritDoc} */<a name="line.707"></a>
+<FONT color="green">708</FONT>        public RealVector mapUlp() {<a name="line.708"></a>
+<FONT color="green">709</FONT>            return copy().mapUlpToSelf();<a name="line.709"></a>
+<FONT color="green">710</FONT>        }<a name="line.710"></a>
+<FONT color="green">711</FONT>    <a name="line.711"></a>
+<FONT color="green">712</FONT>        /** {@inheritDoc} */<a name="line.712"></a>
+<FONT color="green">713</FONT>        public RealVector mapUlpToSelf() {<a name="line.713"></a>
+<FONT color="green">714</FONT>            try {<a name="line.714"></a>
+<FONT color="green">715</FONT>                return mapToSelf(ComposableFunction.ULP);<a name="line.715"></a>
+<FONT color="green">716</FONT>            } catch (FunctionEvaluationException e) {<a name="line.716"></a>
+<FONT color="green">717</FONT>                throw new IllegalArgumentException(e);<a name="line.717"></a>
+<FONT color="green">718</FONT>            }<a name="line.718"></a>
+<FONT color="green">719</FONT>        }<a name="line.719"></a>
+<FONT color="green">720</FONT>    <a name="line.720"></a>
+<FONT color="green">721</FONT>        /** {@inheritDoc} */<a name="line.721"></a>
+<FONT color="green">722</FONT>        public RealMatrix outerProduct(RealVector v) throws IllegalArgumentException {<a name="line.722"></a>
+<FONT color="green">723</FONT>            RealMatrix product;<a name="line.723"></a>
+<FONT color="green">724</FONT>            if (v instanceof SparseRealVector || this instanceof SparseRealVector) {<a name="line.724"></a>
+<FONT color="green">725</FONT>                product = new OpenMapRealMatrix(this.getDimension(), v.getDimension());<a name="line.725"></a>
+<FONT color="green">726</FONT>            } else {<a name="line.726"></a>
+<FONT color="green">727</FONT>                product = new Array2DRowRealMatrix(this.getDimension(), v.getDimension());<a name="line.727"></a>
+<FONT color="green">728</FONT>            }<a name="line.728"></a>
+<FONT color="green">729</FONT>            Iterator&lt;Entry&gt; thisIt = sparseIterator();<a name="line.729"></a>
+<FONT color="green">730</FONT>            Entry thisE = null;<a name="line.730"></a>
+<FONT color="green">731</FONT>            while (thisIt.hasNext() &amp;&amp; (thisE = thisIt.next()) != null) {<a name="line.731"></a>
+<FONT color="green">732</FONT>                Iterator&lt;Entry&gt; otherIt = v.sparseIterator();<a name="line.732"></a>
+<FONT color="green">733</FONT>                Entry otherE = null;<a name="line.733"></a>
+<FONT color="green">734</FONT>                while (otherIt.hasNext() &amp;&amp; (otherE = otherIt.next()) != null) {<a name="line.734"></a>
+<FONT color="green">735</FONT>                    product.setEntry(thisE.getIndex(), otherE.getIndex(),<a name="line.735"></a>
+<FONT color="green">736</FONT>                                     thisE.getValue() * otherE.getValue());<a name="line.736"></a>
+<FONT color="green">737</FONT>                }<a name="line.737"></a>
+<FONT color="green">738</FONT>            }<a name="line.738"></a>
+<FONT color="green">739</FONT>    <a name="line.739"></a>
+<FONT color="green">740</FONT>            return product;<a name="line.740"></a>
+<FONT color="green">741</FONT>    <a name="line.741"></a>
+<FONT color="green">742</FONT>        }<a name="line.742"></a>
+<FONT color="green">743</FONT>    <a name="line.743"></a>
+<FONT color="green">744</FONT>        /** {@inheritDoc} */<a name="line.744"></a>
+<FONT color="green">745</FONT>        public RealMatrix outerProduct(double[] v) throws IllegalArgumentException {<a name="line.745"></a>
+<FONT color="green">746</FONT>            return outerProduct(new ArrayRealVector(v, false));<a name="line.746"></a>
+<FONT color="green">747</FONT>        }<a name="line.747"></a>
+<FONT color="green">748</FONT>    <a name="line.748"></a>
+<FONT color="green">749</FONT>        /** {@inheritDoc} */<a name="line.749"></a>
+<FONT color="green">750</FONT>        public RealVector projection(double[] v) throws IllegalArgumentException {<a name="line.750"></a>
+<FONT color="green">751</FONT>            return projection(new ArrayRealVector(v, false));<a name="line.751"></a>
+<FONT color="green">752</FONT>        }<a name="line.752"></a>
+<FONT color="green">753</FONT>    <a name="line.753"></a>
+<FONT color="green">754</FONT>        /** {@inheritDoc} */<a name="line.754"></a>
+<FONT color="green">755</FONT>        public void set(double value) {<a name="line.755"></a>
+<FONT color="green">756</FONT>            Iterator&lt;Entry&gt; it = iterator();<a name="line.756"></a>
+<FONT color="green">757</FONT>            Entry e = null;<a name="line.757"></a>
+<FONT color="green">758</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.758"></a>
+<FONT color="green">759</FONT>                e.setValue(value);<a name="line.759"></a>
+<FONT color="green">760</FONT>            }<a name="line.760"></a>
+<FONT color="green">761</FONT>        }<a name="line.761"></a>
+<FONT color="green">762</FONT>    <a name="line.762"></a>
+<FONT color="green">763</FONT>        /** {@inheritDoc} */<a name="line.763"></a>
+<FONT color="green">764</FONT>        public double[] toArray() {<a name="line.764"></a>
+<FONT color="green">765</FONT>            int dim = getDimension();<a name="line.765"></a>
+<FONT color="green">766</FONT>            double[] values = new double[dim];<a name="line.766"></a>
+<FONT color="green">767</FONT>            for (int i = 0; i &lt; dim; i++) {<a name="line.767"></a>
+<FONT color="green">768</FONT>                values[i] = getEntry(i);<a name="line.768"></a>
+<FONT color="green">769</FONT>            }<a name="line.769"></a>
+<FONT color="green">770</FONT>            return values;<a name="line.770"></a>
+<FONT color="green">771</FONT>        }<a name="line.771"></a>
+<FONT color="green">772</FONT>    <a name="line.772"></a>
+<FONT color="green">773</FONT>        /** {@inheritDoc} */<a name="line.773"></a>
+<FONT color="green">774</FONT>        public double[] getData() {<a name="line.774"></a>
+<FONT color="green">775</FONT>            return toArray();<a name="line.775"></a>
+<FONT color="green">776</FONT>        }<a name="line.776"></a>
+<FONT color="green">777</FONT>    <a name="line.777"></a>
+<FONT color="green">778</FONT>        /** {@inheritDoc} */<a name="line.778"></a>
+<FONT color="green">779</FONT>        public RealVector unitVector() {<a name="line.779"></a>
+<FONT color="green">780</FONT>            RealVector copy = copy();<a name="line.780"></a>
+<FONT color="green">781</FONT>            copy.unitize();<a name="line.781"></a>
+<FONT color="green">782</FONT>            return copy;<a name="line.782"></a>
+<FONT color="green">783</FONT>        }<a name="line.783"></a>
+<FONT color="green">784</FONT>    <a name="line.784"></a>
+<FONT color="green">785</FONT>        /** {@inheritDoc} */<a name="line.785"></a>
+<FONT color="green">786</FONT>        public void unitize() {<a name="line.786"></a>
+<FONT color="green">787</FONT>            mapDivideToSelf(getNorm());<a name="line.787"></a>
+<FONT color="green">788</FONT>        }<a name="line.788"></a>
+<FONT color="green">789</FONT>    <a name="line.789"></a>
+<FONT color="green">790</FONT>        /** {@inheritDoc} */<a name="line.790"></a>
+<FONT color="green">791</FONT>        public Iterator&lt;Entry&gt; sparseIterator() {<a name="line.791"></a>
+<FONT color="green">792</FONT>            return new SparseEntryIterator();<a name="line.792"></a>
+<FONT color="green">793</FONT>        }<a name="line.793"></a>
+<FONT color="green">794</FONT>    <a name="line.794"></a>
+<FONT color="green">795</FONT>        /** {@inheritDoc} */<a name="line.795"></a>
+<FONT color="green">796</FONT>        public Iterator&lt;Entry&gt; iterator() {<a name="line.796"></a>
+<FONT color="green">797</FONT>            final int dim = getDimension();<a name="line.797"></a>
+<FONT color="green">798</FONT>            return new Iterator&lt;Entry&gt;() {<a name="line.798"></a>
+<FONT color="green">799</FONT>    <a name="line.799"></a>
+<FONT color="green">800</FONT>                /** Current index. */<a name="line.800"></a>
+<FONT color="green">801</FONT>                private int i = 0;<a name="line.801"></a>
+<FONT color="green">802</FONT>    <a name="line.802"></a>
+<FONT color="green">803</FONT>                /** Current entry. */<a name="line.803"></a>
+<FONT color="green">804</FONT>                private EntryImpl e = new EntryImpl();<a name="line.804"></a>
+<FONT color="green">805</FONT>    <a name="line.805"></a>
+<FONT color="green">806</FONT>                /** {@inheritDoc} */<a name="line.806"></a>
+<FONT color="green">807</FONT>                public boolean hasNext() {<a name="line.807"></a>
+<FONT color="green">808</FONT>                    return i &lt; dim;<a name="line.808"></a>
+<FONT color="green">809</FONT>                }<a name="line.809"></a>
+<FONT color="green">810</FONT>    <a name="line.810"></a>
+<FONT color="green">811</FONT>                /** {@inheritDoc} */<a name="line.811"></a>
+<FONT color="green">812</FONT>                public Entry next() {<a name="line.812"></a>
+<FONT color="green">813</FONT>                    e.setIndex(i++);<a name="line.813"></a>
+<FONT color="green">814</FONT>                    return e;<a name="line.814"></a>
+<FONT color="green">815</FONT>                }<a name="line.815"></a>
+<FONT color="green">816</FONT>    <a name="line.816"></a>
+<FONT color="green">817</FONT>                /** {@inheritDoc} */<a name="line.817"></a>
+<FONT color="green">818</FONT>                public void remove() {<a name="line.818"></a>
+<FONT color="green">819</FONT>                    throw new UnsupportedOperationException("Not supported");<a name="line.819"></a>
+<FONT color="green">820</FONT>                }<a name="line.820"></a>
+<FONT color="green">821</FONT>            };<a name="line.821"></a>
+<FONT color="green">822</FONT>        }<a name="line.822"></a>
+<FONT color="green">823</FONT>    <a name="line.823"></a>
+<FONT color="green">824</FONT>        /** {@inheritDoc} */<a name="line.824"></a>
+<FONT color="green">825</FONT>        public RealVector map(UnivariateRealFunction function) throws FunctionEvaluationException {<a name="line.825"></a>
+<FONT color="green">826</FONT>            return copy().mapToSelf(function);<a name="line.826"></a>
+<FONT color="green">827</FONT>        }<a name="line.827"></a>
+<FONT color="green">828</FONT>    <a name="line.828"></a>
+<FONT color="green">829</FONT>        /** {@inheritDoc} */<a name="line.829"></a>
+<FONT color="green">830</FONT>        public RealVector mapToSelf(UnivariateRealFunction function) throws FunctionEvaluationException {<a name="line.830"></a>
+<FONT color="green">831</FONT>            Iterator&lt;Entry&gt; it = (function.value(0) == 0) ? sparseIterator() : iterator();<a name="line.831"></a>
+<FONT color="green">832</FONT>            Entry e;<a name="line.832"></a>
+<FONT color="green">833</FONT>            while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.833"></a>
+<FONT color="green">834</FONT>                e.setValue(function.value(e.getValue()));<a name="line.834"></a>
+<FONT color="green">835</FONT>            }<a name="line.835"></a>
+<FONT color="green">836</FONT>            return this;<a name="line.836"></a>
+<FONT color="green">837</FONT>        }<a name="line.837"></a>
+<FONT color="green">838</FONT>    <a name="line.838"></a>
+<FONT color="green">839</FONT>        /** An entry in the vector. */<a name="line.839"></a>
+<FONT color="green">840</FONT>        protected class EntryImpl extends Entry {<a name="line.840"></a>
+<FONT color="green">841</FONT>    <a name="line.841"></a>
+<FONT color="green">842</FONT>            /** Simple constructor. */<a name="line.842"></a>
+<FONT color="green">843</FONT>            public EntryImpl() {<a name="line.843"></a>
+<FONT color="green">844</FONT>                setIndex(0);<a name="line.844"></a>
+<FONT color="green">845</FONT>            }<a name="line.845"></a>
+<FONT color="green">846</FONT>    <a name="line.846"></a>
+<FONT color="green">847</FONT>            /** {@inheritDoc} */<a name="line.847"></a>
+<FONT color="green">848</FONT>            @Override<a name="line.848"></a>
+<FONT color="green">849</FONT>            public double getValue() {<a name="line.849"></a>
+<FONT color="green">850</FONT>                return getEntry(getIndex());<a name="line.850"></a>
+<FONT color="green">851</FONT>            }<a name="line.851"></a>
+<FONT color="green">852</FONT>    <a name="line.852"></a>
+<FONT color="green">853</FONT>            /** {@inheritDoc} */<a name="line.853"></a>
+<FONT color="green">854</FONT>            @Override<a name="line.854"></a>
+<FONT color="green">855</FONT>            public void setValue(double newValue) {<a name="line.855"></a>
+<FONT color="green">856</FONT>                setEntry(getIndex(), newValue);<a name="line.856"></a>
+<FONT color="green">857</FONT>            }<a name="line.857"></a>
+<FONT color="green">858</FONT>        }<a name="line.858"></a>
+<FONT color="green">859</FONT>    <a name="line.859"></a>
+<FONT color="green">860</FONT>        /**<a name="line.860"></a>
+<FONT color="green">861</FONT>         * This class should rare be used, but is here to provide<a name="line.861"></a>
+<FONT color="green">862</FONT>         * a default implementation of sparseIterator(), which is implemented<a name="line.862"></a>
+<FONT color="green">863</FONT>         * by walking over the entries, skipping those whose values are the default one.<a name="line.863"></a>
+<FONT color="green">864</FONT>         *<a name="line.864"></a>
+<FONT color="green">865</FONT>         * Concrete subclasses which are SparseVector implementations should<a name="line.865"></a>
+<FONT color="green">866</FONT>         * make their own sparse iterator, not use this one.<a name="line.866"></a>
+<FONT color="green">867</FONT>         *<a name="line.867"></a>
+<FONT color="green">868</FONT>         * This implementation might be useful for ArrayRealVector, when expensive<a name="line.868"></a>
+<FONT color="green">869</FONT>         * operations which preserve the default value are to be done on the entries,<a name="line.869"></a>
+<FONT color="green">870</FONT>         * and the fraction of non-default values is small (i.e. someone took a<a name="line.870"></a>
+<FONT color="green">871</FONT>         * SparseVector, and passed it into the copy-constructor of ArrayRealVector)<a name="line.871"></a>
+<FONT color="green">872</FONT>         */<a name="line.872"></a>
+<FONT color="green">873</FONT>        protected class SparseEntryIterator implements Iterator&lt;Entry&gt; {<a name="line.873"></a>
+<FONT color="green">874</FONT>    <a name="line.874"></a>
+<FONT color="green">875</FONT>            /** Dimension of the vector. */<a name="line.875"></a>
+<FONT color="green">876</FONT>            private final int dim;<a name="line.876"></a>
+<FONT color="green">877</FONT>    <a name="line.877"></a>
+<FONT color="green">878</FONT>            /** Temporary entry (reused on each call to {@link #next()}. */<a name="line.878"></a>
+<FONT color="green">879</FONT>            private EntryImpl tmp = new EntryImpl();<a name="line.879"></a>
+<FONT color="green">880</FONT>    <a name="line.880"></a>
+<FONT color="green">881</FONT>            /** Current entry. */<a name="line.881"></a>
+<FONT color="green">882</FONT>            private EntryImpl current;<a name="line.882"></a>
+<FONT color="green">883</FONT>    <a name="line.883"></a>
+<FONT color="green">884</FONT>            /** Next entry. */<a name="line.884"></a>
+<FONT color="green">885</FONT>            private EntryImpl next;<a name="line.885"></a>
+<FONT color="green">886</FONT>    <a name="line.886"></a>
+<FONT color="green">887</FONT>            /** Simple constructor. */<a name="line.887"></a>
+<FONT color="green">888</FONT>            protected SparseEntryIterator() {<a name="line.888"></a>
+<FONT color="green">889</FONT>                dim = getDimension();<a name="line.889"></a>
+<FONT color="green">890</FONT>                current = new EntryImpl();<a name="line.890"></a>
+<FONT color="green">891</FONT>                if (current.getValue() == 0) {<a name="line.891"></a>
+<FONT color="green">892</FONT>                    advance(current);<a name="line.892"></a>
+<FONT color="green">893</FONT>                }<a name="line.893"></a>
+<FONT color="green">894</FONT>                if(current.getIndex() &gt;= 0){<a name="line.894"></a>
+<FONT color="green">895</FONT>                    // There is at least one non-zero entry<a name="line.895"></a>
+<FONT color="green">896</FONT>                    next = new EntryImpl();<a name="line.896"></a>
+<FONT color="green">897</FONT>                    next.setIndex(current.getIndex());<a name="line.897"></a>
+<FONT color="green">898</FONT>                    advance(next);<a name="line.898"></a>
+<FONT color="green">899</FONT>                } else {<a name="line.899"></a>
+<FONT color="green">900</FONT>                    // The vector consists of only zero entries, so deny having a next<a name="line.900"></a>
+<FONT color="green">901</FONT>                    current = null;<a name="line.901"></a>
+<FONT color="green">902</FONT>                }<a name="line.902"></a>
+<FONT color="green">903</FONT>            }<a name="line.903"></a>
+<FONT color="green">904</FONT>    <a name="line.904"></a>
+<FONT color="green">905</FONT>            /** Advance an entry up to the next non null one.<a name="line.905"></a>
+<FONT color="green">906</FONT>             * @param e entry to advance<a name="line.906"></a>
+<FONT color="green">907</FONT>             */<a name="line.907"></a>
+<FONT color="green">908</FONT>            protected void advance(EntryImpl e) {<a name="line.908"></a>
+<FONT color="green">909</FONT>                if (e == null) {<a name="line.909"></a>
+<FONT color="green">910</FONT>                    return;<a name="line.910"></a>
+<FONT color="green">911</FONT>                }<a name="line.911"></a>
+<FONT color="green">912</FONT>                do {<a name="line.912"></a>
+<FONT color="green">913</FONT>                    e.setIndex(e.getIndex() + 1);<a name="line.913"></a>
+<FONT color="green">914</FONT>                } while (e.getIndex() &lt; dim &amp;&amp; e.getValue() == 0);<a name="line.914"></a>
+<FONT color="green">915</FONT>                if (e.getIndex() &gt;= dim) {<a name="line.915"></a>
+<FONT color="green">916</FONT>                    e.setIndex(-1);<a name="line.916"></a>
+<FONT color="green">917</FONT>                }<a name="line.917"></a>
+<FONT color="green">918</FONT>            }<a name="line.918"></a>
+<FONT color="green">919</FONT>    <a name="line.919"></a>
+<FONT color="green">920</FONT>            /** {@inheritDoc} */<a name="line.920"></a>
+<FONT color="green">921</FONT>            public boolean hasNext() {<a name="line.921"></a>
+<FONT color="green">922</FONT>                return current != null;<a name="line.922"></a>
+<FONT color="green">923</FONT>            }<a name="line.923"></a>
+<FONT color="green">924</FONT>    <a name="line.924"></a>
+<FONT color="green">925</FONT>            /** {@inheritDoc} */<a name="line.925"></a>
+<FONT color="green">926</FONT>            public Entry next() {<a name="line.926"></a>
+<FONT color="green">927</FONT>                tmp.setIndex(current.getIndex());<a name="line.927"></a>
+<FONT color="green">928</FONT>                if (next != null) {<a name="line.928"></a>
+<FONT color="green">929</FONT>                    current.setIndex(next.getIndex());<a name="line.929"></a>
+<FONT color="green">930</FONT>                    advance(next);<a name="line.930"></a>
+<FONT color="green">931</FONT>                    if (next.getIndex() &lt; 0) {<a name="line.931"></a>
+<FONT color="green">932</FONT>                        next = null;<a name="line.932"></a>
+<FONT color="green">933</FONT>                    }<a name="line.933"></a>
+<FONT color="green">934</FONT>                } else {<a name="line.934"></a>
+<FONT color="green">935</FONT>                    current = null;<a name="line.935"></a>
+<FONT color="green">936</FONT>                }<a name="line.936"></a>
+<FONT color="green">937</FONT>                return tmp;<a name="line.937"></a>
+<FONT color="green">938</FONT>            }<a name="line.938"></a>
+<FONT color="green">939</FONT>    <a name="line.939"></a>
+<FONT color="green">940</FONT>            /** {@inheritDoc} */<a name="line.940"></a>
+<FONT color="green">941</FONT>            public void remove() {<a name="line.941"></a>
+<FONT color="green">942</FONT>                throw new UnsupportedOperationException("Not supported");<a name="line.942"></a>
+<FONT color="green">943</FONT>            }<a name="line.943"></a>
+<FONT color="green">944</FONT>        }<a name="line.944"></a>
+<FONT color="green">945</FONT>    <a name="line.945"></a>
+<FONT color="green">946</FONT>    }<a name="line.946"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/AnyMatrix.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,114 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Interface defining very basic matrix operations.<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 772119 $ $Date: 2009-05-06 05:43:28 -0400 (Wed, 06 May 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @since 2.0<a name="line.24"></a>
+<FONT color="green">025</FONT>     */<a name="line.25"></a>
+<FONT color="green">026</FONT>    public interface AnyMatrix {<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>        /**<a name="line.28"></a>
+<FONT color="green">029</FONT>         * Is this a square matrix?<a name="line.29"></a>
+<FONT color="green">030</FONT>         * @return true if the matrix is square (rowDimension = columnDimension)<a name="line.30"></a>
+<FONT color="green">031</FONT>         */<a name="line.31"></a>
+<FONT color="green">032</FONT>        boolean isSquare();<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /**<a name="line.34"></a>
+<FONT color="green">035</FONT>         * Returns the number of rows in the matrix.<a name="line.35"></a>
+<FONT color="green">036</FONT>         *<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @return rowDimension<a name="line.37"></a>
+<FONT color="green">038</FONT>         */<a name="line.38"></a>
+<FONT color="green">039</FONT>        int getRowDimension();<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * Returns the number of columns in the matrix.<a name="line.42"></a>
+<FONT color="green">043</FONT>         *<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @return columnDimension<a name="line.44"></a>
+<FONT color="green">045</FONT>         */<a name="line.45"></a>
+<FONT color="green">046</FONT>        int getColumnDimension();<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>    }<a name="line.48"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/Array2DRowFieldMatrix.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,697 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.Field;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.FieldElement;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Implementation of FieldMatrix&lt;T&gt; using a {@link FieldElement}[][] array to store entries.<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * As specified in the {@link FieldMatrix} interface, matrix element indexing<a name="line.29"></a>
+<FONT color="green">030</FONT>     * is 0-based -- e.g., &lt;code&gt;getEntry(0, 0)&lt;/code&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * returns the element in the first row, first column of the matrix.&lt;/li&gt;&lt;/ul&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @param &lt;T&gt; the type of the field elements<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @version $Revision: 885278 $ $Date: 2009-11-29 16:47:51 -0500 (Sun, 29 Nov 2009) $<a name="line.35"></a>
+<FONT color="green">036</FONT>     */<a name="line.36"></a>
+<FONT color="green">037</FONT>    public class Array2DRowFieldMatrix&lt;T extends FieldElement&lt;T&gt;&gt; extends AbstractFieldMatrix&lt;T&gt; implements Serializable {<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Serializable version identifier */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private static final long serialVersionUID = 7260756672015356458L;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Message for at least one row. */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private static final String AT_LEAST_ONE_ROW_MESSAGE =<a name="line.43"></a>
+<FONT color="green">044</FONT>            "matrix must have at least one row";<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** Message for at least one column. */<a name="line.46"></a>
+<FONT color="green">047</FONT>        private static final String AT_LEAST_ONE_COLUMN_MESSAGE =<a name="line.47"></a>
+<FONT color="green">048</FONT>            "matrix must have at least one column";<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Message for different rows lengths. */<a name="line.50"></a>
+<FONT color="green">051</FONT>        private static final String DIFFERENT_ROWS_LENGTHS_MESSAGE =<a name="line.51"></a>
+<FONT color="green">052</FONT>            "some rows have length {0} while others have length {1}";<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /** Message for no entry at selected indices. */<a name="line.54"></a>
+<FONT color="green">055</FONT>        private static final String NO_ENTRY_MESSAGE =<a name="line.55"></a>
+<FONT color="green">056</FONT>            "no entry at indices ({0}, {1}) in a {2}x{3} matrix";<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /** Message for vector lengths mismatch. */<a name="line.58"></a>
+<FONT color="green">059</FONT>        private static final String VECTOR_LENGTHS_MISMATCH =<a name="line.59"></a>
+<FONT color="green">060</FONT>            "vector length mismatch: got {0} but expected {1}";<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** Entries of the matrix */<a name="line.62"></a>
+<FONT color="green">063</FONT>        protected T[][] data;<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /**<a name="line.65"></a>
+<FONT color="green">066</FONT>         * Creates a matrix with no data<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @param field field to which the elements belong<a name="line.67"></a>
+<FONT color="green">068</FONT>         */<a name="line.68"></a>
+<FONT color="green">069</FONT>        public Array2DRowFieldMatrix(final Field&lt;T&gt; field) {<a name="line.69"></a>
+<FONT color="green">070</FONT>            super(field);<a name="line.70"></a>
+<FONT color="green">071</FONT>        }<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /**<a name="line.73"></a>
+<FONT color="green">074</FONT>         * Create a new FieldMatrix&lt;T&gt; with the supplied row and column dimensions.<a name="line.74"></a>
+<FONT color="green">075</FONT>         *<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @param field field to which the elements belong<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @param rowDimension  the number of rows in the new matrix<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @param columnDimension  the number of columns in the new matrix<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @throws IllegalArgumentException if row or column dimension is not<a name="line.79"></a>
+<FONT color="green">080</FONT>         *  positive<a name="line.80"></a>
+<FONT color="green">081</FONT>         */<a name="line.81"></a>
+<FONT color="green">082</FONT>        public Array2DRowFieldMatrix(final Field&lt;T&gt; field,<a name="line.82"></a>
+<FONT color="green">083</FONT>                               final int rowDimension, final int columnDimension)<a name="line.83"></a>
+<FONT color="green">084</FONT>            throws IllegalArgumentException {<a name="line.84"></a>
+<FONT color="green">085</FONT>            super(field, rowDimension, columnDimension);<a name="line.85"></a>
+<FONT color="green">086</FONT>            data = buildArray(field, rowDimension, columnDimension);<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /**<a name="line.89"></a>
+<FONT color="green">090</FONT>         * Create a new FieldMatrix&lt;T&gt; using the input array as the underlying<a name="line.90"></a>
+<FONT color="green">091</FONT>         * data array.<a name="line.91"></a>
+<FONT color="green">092</FONT>         * &lt;p&gt;The input array is copied, not referenced. This constructor has<a name="line.92"></a>
+<FONT color="green">093</FONT>         * the same effect as calling {@link #Array2DRowFieldMatrix(FieldElement[][], boolean)}<a name="line.93"></a>
+<FONT color="green">094</FONT>         * with the second argument set to &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;<a name="line.94"></a>
+<FONT color="green">095</FONT>         *<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @param d data for new matrix<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @throws IllegalArgumentException if &lt;code&gt;d&lt;/code&gt; is not rectangular<a name="line.97"></a>
+<FONT color="green">098</FONT>         *  (not all rows have the same length) or empty<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @throws NullPointerException if &lt;code&gt;d&lt;/code&gt; is null<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @see #Array2DRowFieldMatrix(FieldElement[][], boolean)<a name="line.100"></a>
+<FONT color="green">101</FONT>         */<a name="line.101"></a>
+<FONT color="green">102</FONT>        public Array2DRowFieldMatrix(final T[][] d)<a name="line.102"></a>
+<FONT color="green">103</FONT>            throws IllegalArgumentException, NullPointerException {<a name="line.103"></a>
+<FONT color="green">104</FONT>            super(extractField(d));<a name="line.104"></a>
+<FONT color="green">105</FONT>            copyIn(d);<a name="line.105"></a>
+<FONT color="green">106</FONT>        }<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>        /**<a name="line.108"></a>
+<FONT color="green">109</FONT>         * Create a new FieldMatrix&lt;T&gt; using the input array as the underlying<a name="line.109"></a>
+<FONT color="green">110</FONT>         * data array.<a name="line.110"></a>
+<FONT color="green">111</FONT>         * &lt;p&gt;If an array is built specially in order to be embedded in a<a name="line.111"></a>
+<FONT color="green">112</FONT>         * FieldMatrix&lt;T&gt; and not used directly, the &lt;code&gt;copyArray&lt;/code&gt; may be<a name="line.112"></a>
+<FONT color="green">113</FONT>         * set to &lt;code&gt;false&lt;/code. This will prevent the copying and improve<a name="line.113"></a>
+<FONT color="green">114</FONT>         * performance as no new array will be built and no data will be copied.&lt;/p&gt;<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @param d data for new matrix<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @param copyArray if true, the input array will be copied, otherwise<a name="line.116"></a>
+<FONT color="green">117</FONT>         * it will be referenced<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @throws IllegalArgumentException if &lt;code&gt;d&lt;/code&gt; is not rectangular<a name="line.118"></a>
+<FONT color="green">119</FONT>         *  (not all rows have the same length) or empty<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @throws NullPointerException if &lt;code&gt;d&lt;/code&gt; is null<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @see #Array2DRowFieldMatrix(FieldElement[][])<a name="line.121"></a>
+<FONT color="green">122</FONT>         */<a name="line.122"></a>
+<FONT color="green">123</FONT>        public Array2DRowFieldMatrix(final T[][] d, final boolean copyArray)<a name="line.123"></a>
+<FONT color="green">124</FONT>            throws IllegalArgumentException, NullPointerException {<a name="line.124"></a>
+<FONT color="green">125</FONT>            super(extractField(d));<a name="line.125"></a>
+<FONT color="green">126</FONT>            if (copyArray) {<a name="line.126"></a>
+<FONT color="green">127</FONT>                copyIn(d);<a name="line.127"></a>
+<FONT color="green">128</FONT>            } else {<a name="line.128"></a>
+<FONT color="green">129</FONT>                if (d == null) {<a name="line.129"></a>
+<FONT color="green">130</FONT>                    throw new NullPointerException();<a name="line.130"></a>
+<FONT color="green">131</FONT>                }<a name="line.131"></a>
+<FONT color="green">132</FONT>                final int nRows = d.length;<a name="line.132"></a>
+<FONT color="green">133</FONT>                if (nRows == 0) {<a name="line.133"></a>
+<FONT color="green">134</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.134"></a>
+<FONT color="green">135</FONT>                          AT_LEAST_ONE_ROW_MESSAGE);<a name="line.135"></a>
+<FONT color="green">136</FONT>                }<a name="line.136"></a>
+<FONT color="green">137</FONT>                final int nCols = d[0].length;<a name="line.137"></a>
+<FONT color="green">138</FONT>                if (nCols == 0) {<a name="line.138"></a>
+<FONT color="green">139</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.139"></a>
+<FONT color="green">140</FONT>                          AT_LEAST_ONE_COLUMN_MESSAGE);<a name="line.140"></a>
+<FONT color="green">141</FONT>                }<a name="line.141"></a>
+<FONT color="green">142</FONT>                for (int r = 1; r &lt; nRows; r++) {<a name="line.142"></a>
+<FONT color="green">143</FONT>                    if (d[r].length != nCols) {<a name="line.143"></a>
+<FONT color="green">144</FONT>                        throw MathRuntimeException.createIllegalArgumentException(<a name="line.144"></a>
+<FONT color="green">145</FONT>                              DIFFERENT_ROWS_LENGTHS_MESSAGE, nCols, d[r].length);<a name="line.145"></a>
+<FONT color="green">146</FONT>                    }<a name="line.146"></a>
+<FONT color="green">147</FONT>                }<a name="line.147"></a>
+<FONT color="green">148</FONT>                data = d;<a name="line.148"></a>
+<FONT color="green">149</FONT>            }<a name="line.149"></a>
+<FONT color="green">150</FONT>        }<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>        /**<a name="line.152"></a>
+<FONT color="green">153</FONT>         * Create a new (column) FieldMatrix&lt;T&gt; using &lt;code&gt;v&lt;/code&gt; as the<a name="line.153"></a>
+<FONT color="green">154</FONT>         * data for the unique column of the &lt;code&gt;v.length x 1&lt;/code&gt; matrix<a name="line.154"></a>
+<FONT color="green">155</FONT>         * created.<a name="line.155"></a>
+<FONT color="green">156</FONT>         * &lt;p&gt;The input array is copied, not referenced.&lt;/p&gt;<a name="line.156"></a>
+<FONT color="green">157</FONT>         *<a name="line.157"></a>
+<FONT color="green">158</FONT>         * @param v column vector holding data for new matrix<a name="line.158"></a>
+<FONT color="green">159</FONT>         */<a name="line.159"></a>
+<FONT color="green">160</FONT>        public Array2DRowFieldMatrix(final T[] v) {<a name="line.160"></a>
+<FONT color="green">161</FONT>            super(extractField(v));<a name="line.161"></a>
+<FONT color="green">162</FONT>            final int nRows = v.length;<a name="line.162"></a>
+<FONT color="green">163</FONT>            data = buildArray(getField(), nRows, 1);<a name="line.163"></a>
+<FONT color="green">164</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.164"></a>
+<FONT color="green">165</FONT>                data[row][0] = v[row];<a name="line.165"></a>
+<FONT color="green">166</FONT>            }<a name="line.166"></a>
+<FONT color="green">167</FONT>        }<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>        /** {@inheritDoc} */<a name="line.169"></a>
+<FONT color="green">170</FONT>        @Override<a name="line.170"></a>
+<FONT color="green">171</FONT>        public FieldMatrix&lt;T&gt; createMatrix(final int rowDimension, final int columnDimension)<a name="line.171"></a>
+<FONT color="green">172</FONT>            throws IllegalArgumentException {<a name="line.172"></a>
+<FONT color="green">173</FONT>            return new Array2DRowFieldMatrix&lt;T&gt;(getField(), rowDimension, columnDimension);<a name="line.173"></a>
+<FONT color="green">174</FONT>        }<a name="line.174"></a>
+<FONT color="green">175</FONT>    <a name="line.175"></a>
+<FONT color="green">176</FONT>        /** {@inheritDoc} */<a name="line.176"></a>
+<FONT color="green">177</FONT>        @Override<a name="line.177"></a>
+<FONT color="green">178</FONT>        public FieldMatrix&lt;T&gt; copy() {<a name="line.178"></a>
+<FONT color="green">179</FONT>            return new Array2DRowFieldMatrix&lt;T&gt;(copyOut(), false);<a name="line.179"></a>
+<FONT color="green">180</FONT>        }<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>        /** {@inheritDoc} */<a name="line.182"></a>
+<FONT color="green">183</FONT>        @Override<a name="line.183"></a>
+<FONT color="green">184</FONT>        public FieldMatrix&lt;T&gt; add(final FieldMatrix&lt;T&gt; m)<a name="line.184"></a>
+<FONT color="green">185</FONT>            throws IllegalArgumentException {<a name="line.185"></a>
+<FONT color="green">186</FONT>            try {<a name="line.186"></a>
+<FONT color="green">187</FONT>                return add((Array2DRowFieldMatrix&lt;T&gt;) m);<a name="line.187"></a>
+<FONT color="green">188</FONT>            } catch (ClassCastException cce) {<a name="line.188"></a>
+<FONT color="green">189</FONT>                return super.add(m);<a name="line.189"></a>
+<FONT color="green">190</FONT>            }<a name="line.190"></a>
+<FONT color="green">191</FONT>        }<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>        /**<a name="line.193"></a>
+<FONT color="green">194</FONT>         * Compute the sum of this and &lt;code&gt;m&lt;/code&gt;.<a name="line.194"></a>
+<FONT color="green">195</FONT>         *<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @param m    matrix to be added<a name="line.196"></a>
+<FONT color="green">197</FONT>         * @return     this + m<a name="line.197"></a>
+<FONT color="green">198</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.198"></a>
+<FONT color="green">199</FONT>         */<a name="line.199"></a>
+<FONT color="green">200</FONT>        public Array2DRowFieldMatrix&lt;T&gt; add(final Array2DRowFieldMatrix&lt;T&gt; m)<a name="line.200"></a>
+<FONT color="green">201</FONT>            throws IllegalArgumentException {<a name="line.201"></a>
+<FONT color="green">202</FONT>    <a name="line.202"></a>
+<FONT color="green">203</FONT>            // safety check<a name="line.203"></a>
+<FONT color="green">204</FONT>            checkAdditionCompatible(m);<a name="line.204"></a>
+<FONT color="green">205</FONT>    <a name="line.205"></a>
+<FONT color="green">206</FONT>            final int rowCount    = getRowDimension();<a name="line.206"></a>
+<FONT color="green">207</FONT>            final int columnCount = getColumnDimension();<a name="line.207"></a>
+<FONT color="green">208</FONT>            final T[][] outData = buildArray(getField(), rowCount, columnCount);<a name="line.208"></a>
+<FONT color="green">209</FONT>            for (int row = 0; row &lt; rowCount; row++) {<a name="line.209"></a>
+<FONT color="green">210</FONT>                final T[] dataRow    = data[row];<a name="line.210"></a>
+<FONT color="green">211</FONT>                final T[] mRow       = m.data[row];<a name="line.211"></a>
+<FONT color="green">212</FONT>                final T[] outDataRow = outData[row];<a name="line.212"></a>
+<FONT color="green">213</FONT>                for (int col = 0; col &lt; columnCount; col++) {<a name="line.213"></a>
+<FONT color="green">214</FONT>                    outDataRow[col] = dataRow[col].add(mRow[col]);<a name="line.214"></a>
+<FONT color="green">215</FONT>                }<a name="line.215"></a>
+<FONT color="green">216</FONT>            }<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>            return new Array2DRowFieldMatrix&lt;T&gt;(outData, false);<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>        }<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>        /** {@inheritDoc} */<a name="line.222"></a>
+<FONT color="green">223</FONT>        @Override<a name="line.223"></a>
+<FONT color="green">224</FONT>        public FieldMatrix&lt;T&gt; subtract(final FieldMatrix&lt;T&gt; m)<a name="line.224"></a>
+<FONT color="green">225</FONT>            throws IllegalArgumentException {<a name="line.225"></a>
+<FONT color="green">226</FONT>            try {<a name="line.226"></a>
+<FONT color="green">227</FONT>                return subtract((Array2DRowFieldMatrix&lt;T&gt;) m);<a name="line.227"></a>
+<FONT color="green">228</FONT>            } catch (ClassCastException cce) {<a name="line.228"></a>
+<FONT color="green">229</FONT>                return super.subtract(m);<a name="line.229"></a>
+<FONT color="green">230</FONT>            }<a name="line.230"></a>
+<FONT color="green">231</FONT>        }<a name="line.231"></a>
+<FONT color="green">232</FONT>    <a name="line.232"></a>
+<FONT color="green">233</FONT>        /**<a name="line.233"></a>
+<FONT color="green">234</FONT>         * Compute  this minus &lt;code&gt;m&lt;/code&gt;.<a name="line.234"></a>
+<FONT color="green">235</FONT>         *<a name="line.235"></a>
+<FONT color="green">236</FONT>         * @param m    matrix to be subtracted<a name="line.236"></a>
+<FONT color="green">237</FONT>         * @return     this + m<a name="line.237"></a>
+<FONT color="green">238</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.238"></a>
+<FONT color="green">239</FONT>         */<a name="line.239"></a>
+<FONT color="green">240</FONT>        public Array2DRowFieldMatrix&lt;T&gt; subtract(final Array2DRowFieldMatrix&lt;T&gt; m)<a name="line.240"></a>
+<FONT color="green">241</FONT>            throws IllegalArgumentException {<a name="line.241"></a>
+<FONT color="green">242</FONT>    <a name="line.242"></a>
+<FONT color="green">243</FONT>            // safety check<a name="line.243"></a>
+<FONT color="green">244</FONT>            checkSubtractionCompatible(m);<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>            final int rowCount    = getRowDimension();<a name="line.246"></a>
+<FONT color="green">247</FONT>            final int columnCount = getColumnDimension();<a name="line.247"></a>
+<FONT color="green">248</FONT>            final T[][] outData = buildArray(getField(), rowCount, columnCount);<a name="line.248"></a>
+<FONT color="green">249</FONT>            for (int row = 0; row &lt; rowCount; row++) {<a name="line.249"></a>
+<FONT color="green">250</FONT>                final T[] dataRow    = data[row];<a name="line.250"></a>
+<FONT color="green">251</FONT>                final T[] mRow       = m.data[row];<a name="line.251"></a>
+<FONT color="green">252</FONT>                final T[] outDataRow = outData[row];<a name="line.252"></a>
+<FONT color="green">253</FONT>                for (int col = 0; col &lt; columnCount; col++) {<a name="line.253"></a>
+<FONT color="green">254</FONT>                    outDataRow[col] = dataRow[col].subtract(mRow[col]);<a name="line.254"></a>
+<FONT color="green">255</FONT>                }<a name="line.255"></a>
+<FONT color="green">256</FONT>            }<a name="line.256"></a>
+<FONT color="green">257</FONT>    <a name="line.257"></a>
+<FONT color="green">258</FONT>            return new Array2DRowFieldMatrix&lt;T&gt;(outData, false);<a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>        }<a name="line.260"></a>
+<FONT color="green">261</FONT>    <a name="line.261"></a>
+<FONT color="green">262</FONT>        /** {@inheritDoc} */<a name="line.262"></a>
+<FONT color="green">263</FONT>        @Override<a name="line.263"></a>
+<FONT color="green">264</FONT>        public FieldMatrix&lt;T&gt; multiply(final FieldMatrix&lt;T&gt; m)<a name="line.264"></a>
+<FONT color="green">265</FONT>            throws IllegalArgumentException {<a name="line.265"></a>
+<FONT color="green">266</FONT>            try {<a name="line.266"></a>
+<FONT color="green">267</FONT>                return multiply((Array2DRowFieldMatrix&lt;T&gt;) m);<a name="line.267"></a>
+<FONT color="green">268</FONT>            } catch (ClassCastException cce) {<a name="line.268"></a>
+<FONT color="green">269</FONT>                return super.multiply(m);<a name="line.269"></a>
+<FONT color="green">270</FONT>            }<a name="line.270"></a>
+<FONT color="green">271</FONT>        }<a name="line.271"></a>
+<FONT color="green">272</FONT>    <a name="line.272"></a>
+<FONT color="green">273</FONT>        /**<a name="line.273"></a>
+<FONT color="green">274</FONT>         * Returns the result of postmultiplying this by &lt;code&gt;m&lt;/code&gt;.<a name="line.274"></a>
+<FONT color="green">275</FONT>         * @param m    matrix to postmultiply by<a name="line.275"></a>
+<FONT color="green">276</FONT>         * @return     this*m<a name="line.276"></a>
+<FONT color="green">277</FONT>         * @throws     IllegalArgumentException<a name="line.277"></a>
+<FONT color="green">278</FONT>         *             if columnDimension(this) != rowDimension(m)<a name="line.278"></a>
+<FONT color="green">279</FONT>         */<a name="line.279"></a>
+<FONT color="green">280</FONT>        public Array2DRowFieldMatrix&lt;T&gt; multiply(final Array2DRowFieldMatrix&lt;T&gt; m)<a name="line.280"></a>
+<FONT color="green">281</FONT>            throws IllegalArgumentException {<a name="line.281"></a>
+<FONT color="green">282</FONT>    <a name="line.282"></a>
+<FONT color="green">283</FONT>            // safety check<a name="line.283"></a>
+<FONT color="green">284</FONT>            checkMultiplicationCompatible(m);<a name="line.284"></a>
+<FONT color="green">285</FONT>    <a name="line.285"></a>
+<FONT color="green">286</FONT>            final int nRows = this.getRowDimension();<a name="line.286"></a>
+<FONT color="green">287</FONT>            final int nCols = m.getColumnDimension();<a name="line.287"></a>
+<FONT color="green">288</FONT>            final int nSum = this.getColumnDimension();<a name="line.288"></a>
+<FONT color="green">289</FONT>            final T[][] outData = buildArray(getField(), nRows, nCols);<a name="line.289"></a>
+<FONT color="green">290</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.290"></a>
+<FONT color="green">291</FONT>                final T[] dataRow    = data[row];<a name="line.291"></a>
+<FONT color="green">292</FONT>                final T[] outDataRow = outData[row];<a name="line.292"></a>
+<FONT color="green">293</FONT>                for (int col = 0; col &lt; nCols; col++) {<a name="line.293"></a>
+<FONT color="green">294</FONT>                    T sum = getField().getZero();<a name="line.294"></a>
+<FONT color="green">295</FONT>                    for (int i = 0; i &lt; nSum; i++) {<a name="line.295"></a>
+<FONT color="green">296</FONT>                        sum = sum.add(dataRow[i].multiply(m.data[i][col]));<a name="line.296"></a>
+<FONT color="green">297</FONT>                    }<a name="line.297"></a>
+<FONT color="green">298</FONT>                    outDataRow[col] = sum;<a name="line.298"></a>
+<FONT color="green">299</FONT>                }<a name="line.299"></a>
+<FONT color="green">300</FONT>            }<a name="line.300"></a>
+<FONT color="green">301</FONT>    <a name="line.301"></a>
+<FONT color="green">302</FONT>            return new Array2DRowFieldMatrix&lt;T&gt;(outData, false);<a name="line.302"></a>
+<FONT color="green">303</FONT>    <a name="line.303"></a>
+<FONT color="green">304</FONT>        }<a name="line.304"></a>
+<FONT color="green">305</FONT>    <a name="line.305"></a>
+<FONT color="green">306</FONT>        /** {@inheritDoc} */<a name="line.306"></a>
+<FONT color="green">307</FONT>        @Override<a name="line.307"></a>
+<FONT color="green">308</FONT>        public T[][] getData() {<a name="line.308"></a>
+<FONT color="green">309</FONT>            return copyOut();<a name="line.309"></a>
+<FONT color="green">310</FONT>        }<a name="line.310"></a>
+<FONT color="green">311</FONT>    <a name="line.311"></a>
+<FONT color="green">312</FONT>        /**<a name="line.312"></a>
+<FONT color="green">313</FONT>         * Returns a reference to the underlying data array.<a name="line.313"></a>
+<FONT color="green">314</FONT>         * &lt;p&gt;<a name="line.314"></a>
+<FONT color="green">315</FONT>         * Does &lt;strong&gt;not&lt;/strong&gt; make a fresh copy of the underlying data.&lt;/p&gt;<a name="line.315"></a>
+<FONT color="green">316</FONT>         *<a name="line.316"></a>
+<FONT color="green">317</FONT>         * @return 2-dimensional array of entries<a name="line.317"></a>
+<FONT color="green">318</FONT>         */<a name="line.318"></a>
+<FONT color="green">319</FONT>        public T[][] getDataRef() {<a name="line.319"></a>
+<FONT color="green">320</FONT>            return data;<a name="line.320"></a>
+<FONT color="green">321</FONT>        }<a name="line.321"></a>
+<FONT color="green">322</FONT>    <a name="line.322"></a>
+<FONT color="green">323</FONT>        /** {@inheritDoc} */<a name="line.323"></a>
+<FONT color="green">324</FONT>        @Override<a name="line.324"></a>
+<FONT color="green">325</FONT>        public void setSubMatrix(final T[][] subMatrix, final int row, final int column)<a name="line.325"></a>
+<FONT color="green">326</FONT>        throws MatrixIndexException {<a name="line.326"></a>
+<FONT color="green">327</FONT>            if (data == null) {<a name="line.327"></a>
+<FONT color="green">328</FONT>                if (row &gt; 0) {<a name="line.328"></a>
+<FONT color="green">329</FONT>                    throw MathRuntimeException.createIllegalStateException(<a name="line.329"></a>
+<FONT color="green">330</FONT>                          "first {0} rows are not initialized yet", row);<a name="line.330"></a>
+<FONT color="green">331</FONT>                }<a name="line.331"></a>
+<FONT color="green">332</FONT>                if (column &gt; 0) {<a name="line.332"></a>
+<FONT color="green">333</FONT>                    throw MathRuntimeException.createIllegalStateException(<a name="line.333"></a>
+<FONT color="green">334</FONT>                          "first {0} columns are not initialized yet", column);<a name="line.334"></a>
+<FONT color="green">335</FONT>                }<a name="line.335"></a>
+<FONT color="green">336</FONT>                final int nRows = subMatrix.length;<a name="line.336"></a>
+<FONT color="green">337</FONT>                if (nRows == 0) {<a name="line.337"></a>
+<FONT color="green">338</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.338"></a>
+<FONT color="green">339</FONT>                          AT_LEAST_ONE_ROW_MESSAGE);<a name="line.339"></a>
+<FONT color="green">340</FONT>                }<a name="line.340"></a>
+<FONT color="green">341</FONT>    <a name="line.341"></a>
+<FONT color="green">342</FONT>                final int nCols = subMatrix[0].length;<a name="line.342"></a>
+<FONT color="green">343</FONT>                if (nCols == 0) {<a name="line.343"></a>
+<FONT color="green">344</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.344"></a>
+<FONT color="green">345</FONT>                          AT_LEAST_ONE_COLUMN_MESSAGE);<a name="line.345"></a>
+<FONT color="green">346</FONT>                }<a name="line.346"></a>
+<FONT color="green">347</FONT>                data = buildArray(getField(), subMatrix.length, nCols);<a name="line.347"></a>
+<FONT color="green">348</FONT>                for (int i = 0; i &lt; data.length; ++i) {<a name="line.348"></a>
+<FONT color="green">349</FONT>                    if (subMatrix[i].length != nCols) {<a name="line.349"></a>
+<FONT color="green">350</FONT>                        throw MathRuntimeException.createIllegalArgumentException(<a name="line.350"></a>
+<FONT color="green">351</FONT>                              DIFFERENT_ROWS_LENGTHS_MESSAGE, nCols, subMatrix[i].length);<a name="line.351"></a>
+<FONT color="green">352</FONT>                    }<a name="line.352"></a>
+<FONT color="green">353</FONT>                    System.arraycopy(subMatrix[i], 0, data[i + row], column, nCols);<a name="line.353"></a>
+<FONT color="green">354</FONT>                }<a name="line.354"></a>
+<FONT color="green">355</FONT>            } else {<a name="line.355"></a>
+<FONT color="green">356</FONT>                super.setSubMatrix(subMatrix, row, column);<a name="line.356"></a>
+<FONT color="green">357</FONT>            }<a name="line.357"></a>
+<FONT color="green">358</FONT>    <a name="line.358"></a>
+<FONT color="green">359</FONT>        }<a name="line.359"></a>
+<FONT color="green">360</FONT>    <a name="line.360"></a>
+<FONT color="green">361</FONT>        /** {@inheritDoc} */<a name="line.361"></a>
+<FONT color="green">362</FONT>        @Override<a name="line.362"></a>
+<FONT color="green">363</FONT>        public T getEntry(final int row, final int column)<a name="line.363"></a>
+<FONT color="green">364</FONT>            throws MatrixIndexException {<a name="line.364"></a>
+<FONT color="green">365</FONT>            try {<a name="line.365"></a>
+<FONT color="green">366</FONT>                return data[row][column];<a name="line.366"></a>
+<FONT color="green">367</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.367"></a>
+<FONT color="green">368</FONT>                throw new MatrixIndexException(<a name="line.368"></a>
+<FONT color="green">369</FONT>                          NO_ENTRY_MESSAGE, row, column, getRowDimension(), getColumnDimension());<a name="line.369"></a>
+<FONT color="green">370</FONT>            }<a name="line.370"></a>
+<FONT color="green">371</FONT>        }<a name="line.371"></a>
+<FONT color="green">372</FONT>    <a name="line.372"></a>
+<FONT color="green">373</FONT>        /** {@inheritDoc} */<a name="line.373"></a>
+<FONT color="green">374</FONT>        @Override<a name="line.374"></a>
+<FONT color="green">375</FONT>        public void setEntry(final int row, final int column, final T value)<a name="line.375"></a>
+<FONT color="green">376</FONT>            throws MatrixIndexException {<a name="line.376"></a>
+<FONT color="green">377</FONT>            try {<a name="line.377"></a>
+<FONT color="green">378</FONT>                data[row][column] = value;<a name="line.378"></a>
+<FONT color="green">379</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.379"></a>
+<FONT color="green">380</FONT>                throw new MatrixIndexException(<a name="line.380"></a>
+<FONT color="green">381</FONT>                          NO_ENTRY_MESSAGE, row, column, getRowDimension(), getColumnDimension());<a name="line.381"></a>
+<FONT color="green">382</FONT>            }<a name="line.382"></a>
+<FONT color="green">383</FONT>        }<a name="line.383"></a>
+<FONT color="green">384</FONT>    <a name="line.384"></a>
+<FONT color="green">385</FONT>        /** {@inheritDoc} */<a name="line.385"></a>
+<FONT color="green">386</FONT>        @Override<a name="line.386"></a>
+<FONT color="green">387</FONT>        public void addToEntry(final int row, final int column, final T increment)<a name="line.387"></a>
+<FONT color="green">388</FONT>            throws MatrixIndexException {<a name="line.388"></a>
+<FONT color="green">389</FONT>            try {<a name="line.389"></a>
+<FONT color="green">390</FONT>                data[row][column] = data[row][column].add(increment);<a name="line.390"></a>
+<FONT color="green">391</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.391"></a>
+<FONT color="green">392</FONT>                throw new MatrixIndexException(<a name="line.392"></a>
+<FONT color="green">393</FONT>                          NO_ENTRY_MESSAGE, row, column, getRowDimension(), getColumnDimension());<a name="line.393"></a>
+<FONT color="green">394</FONT>            }<a name="line.394"></a>
+<FONT color="green">395</FONT>        }<a name="line.395"></a>
+<FONT color="green">396</FONT>    <a name="line.396"></a>
+<FONT color="green">397</FONT>        /** {@inheritDoc} */<a name="line.397"></a>
+<FONT color="green">398</FONT>        @Override<a name="line.398"></a>
+<FONT color="green">399</FONT>        public void multiplyEntry(final int row, final int column, final T factor)<a name="line.399"></a>
+<FONT color="green">400</FONT>            throws MatrixIndexException {<a name="line.400"></a>
+<FONT color="green">401</FONT>            try {<a name="line.401"></a>
+<FONT color="green">402</FONT>                data[row][column] = data[row][column].multiply(factor);<a name="line.402"></a>
+<FONT color="green">403</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.403"></a>
+<FONT color="green">404</FONT>                throw new MatrixIndexException(<a name="line.404"></a>
+<FONT color="green">405</FONT>                          NO_ENTRY_MESSAGE, row, column, getRowDimension(), getColumnDimension());<a name="line.405"></a>
+<FONT color="green">406</FONT>            }<a name="line.406"></a>
+<FONT color="green">407</FONT>        }<a name="line.407"></a>
+<FONT color="green">408</FONT>    <a name="line.408"></a>
+<FONT color="green">409</FONT>        /** {@inheritDoc} */<a name="line.409"></a>
+<FONT color="green">410</FONT>        @Override<a name="line.410"></a>
+<FONT color="green">411</FONT>        public int getRowDimension() {<a name="line.411"></a>
+<FONT color="green">412</FONT>            return (data == null) ? 0 : data.length;<a name="line.412"></a>
+<FONT color="green">413</FONT>        }<a name="line.413"></a>
+<FONT color="green">414</FONT>    <a name="line.414"></a>
+<FONT color="green">415</FONT>        /** {@inheritDoc} */<a name="line.415"></a>
+<FONT color="green">416</FONT>        @Override<a name="line.416"></a>
+<FONT color="green">417</FONT>        public int getColumnDimension() {<a name="line.417"></a>
+<FONT color="green">418</FONT>            return ((data == null) || (data[0] == null)) ? 0 : data[0].length;<a name="line.418"></a>
+<FONT color="green">419</FONT>        }<a name="line.419"></a>
+<FONT color="green">420</FONT>    <a name="line.420"></a>
+<FONT color="green">421</FONT>        /** {@inheritDoc} */<a name="line.421"></a>
+<FONT color="green">422</FONT>        @Override<a name="line.422"></a>
+<FONT color="green">423</FONT>        public T[] operate(final T[] v)<a name="line.423"></a>
+<FONT color="green">424</FONT>            throws IllegalArgumentException {<a name="line.424"></a>
+<FONT color="green">425</FONT>            final int nRows = this.getRowDimension();<a name="line.425"></a>
+<FONT color="green">426</FONT>            final int nCols = this.getColumnDimension();<a name="line.426"></a>
+<FONT color="green">427</FONT>            if (v.length != nCols) {<a name="line.427"></a>
+<FONT color="green">428</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.428"></a>
+<FONT color="green">429</FONT>                      VECTOR_LENGTHS_MISMATCH, v.length, nCols);<a name="line.429"></a>
+<FONT color="green">430</FONT>            }<a name="line.430"></a>
+<FONT color="green">431</FONT>            final T[] out = buildArray(getField(), nRows);<a name="line.431"></a>
+<FONT color="green">432</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.432"></a>
+<FONT color="green">433</FONT>                final T[] dataRow = data[row];<a name="line.433"></a>
+<FONT color="green">434</FONT>                T sum = getField().getZero();<a name="line.434"></a>
+<FONT color="green">435</FONT>                for (int i = 0; i &lt; nCols; i++) {<a name="line.435"></a>
+<FONT color="green">436</FONT>                    sum = sum.add(dataRow[i].multiply(v[i]));<a name="line.436"></a>
+<FONT color="green">437</FONT>                }<a name="line.437"></a>
+<FONT color="green">438</FONT>                out[row] = sum;<a name="line.438"></a>
+<FONT color="green">439</FONT>            }<a name="line.439"></a>
+<FONT color="green">440</FONT>            return out;<a name="line.440"></a>
+<FONT color="green">441</FONT>        }<a name="line.441"></a>
+<FONT color="green">442</FONT>    <a name="line.442"></a>
+<FONT color="green">443</FONT>        /** {@inheritDoc} */<a name="line.443"></a>
+<FONT color="green">444</FONT>        @Override<a name="line.444"></a>
+<FONT color="green">445</FONT>        public T[] preMultiply(final T[] v)<a name="line.445"></a>
+<FONT color="green">446</FONT>            throws IllegalArgumentException {<a name="line.446"></a>
+<FONT color="green">447</FONT>    <a name="line.447"></a>
+<FONT color="green">448</FONT>            final int nRows = getRowDimension();<a name="line.448"></a>
+<FONT color="green">449</FONT>            final int nCols = getColumnDimension();<a name="line.449"></a>
+<FONT color="green">450</FONT>            if (v.length != nRows) {<a name="line.450"></a>
+<FONT color="green">451</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.451"></a>
+<FONT color="green">452</FONT>                      VECTOR_LENGTHS_MISMATCH, v.length, nRows);<a name="line.452"></a>
+<FONT color="green">453</FONT>            }<a name="line.453"></a>
+<FONT color="green">454</FONT>    <a name="line.454"></a>
+<FONT color="green">455</FONT>            final T[] out = buildArray(getField(), nCols);<a name="line.455"></a>
+<FONT color="green">456</FONT>            for (int col = 0; col &lt; nCols; ++col) {<a name="line.456"></a>
+<FONT color="green">457</FONT>                T sum = getField().getZero();<a name="line.457"></a>
+<FONT color="green">458</FONT>                for (int i = 0; i &lt; nRows; ++i) {<a name="line.458"></a>
+<FONT color="green">459</FONT>                    sum = sum.add(data[i][col].multiply(v[i]));<a name="line.459"></a>
+<FONT color="green">460</FONT>                }<a name="line.460"></a>
+<FONT color="green">461</FONT>                out[col] = sum;<a name="line.461"></a>
+<FONT color="green">462</FONT>            }<a name="line.462"></a>
+<FONT color="green">463</FONT>    <a name="line.463"></a>
+<FONT color="green">464</FONT>            return out;<a name="line.464"></a>
+<FONT color="green">465</FONT>    <a name="line.465"></a>
+<FONT color="green">466</FONT>        }<a name="line.466"></a>
+<FONT color="green">467</FONT>    <a name="line.467"></a>
+<FONT color="green">468</FONT>        /** {@inheritDoc} */<a name="line.468"></a>
+<FONT color="green">469</FONT>        @Override<a name="line.469"></a>
+<FONT color="green">470</FONT>        public T walkInRowOrder(final FieldMatrixChangingVisitor&lt;T&gt; visitor)<a name="line.470"></a>
+<FONT color="green">471</FONT>            throws MatrixVisitorException {<a name="line.471"></a>
+<FONT color="green">472</FONT>            final int rows    = getRowDimension();<a name="line.472"></a>
+<FONT color="green">473</FONT>            final int columns = getColumnDimension();<a name="line.473"></a>
+<FONT color="green">474</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.474"></a>
+<FONT color="green">475</FONT>            for (int i = 0; i &lt; rows; ++i) {<a name="line.475"></a>
+<FONT color="green">476</FONT>                final T[] rowI = data[i];<a name="line.476"></a>
+<FONT color="green">477</FONT>                for (int j = 0; j &lt; columns; ++j) {<a name="line.477"></a>
+<FONT color="green">478</FONT>                    rowI[j] = visitor.visit(i, j, rowI[j]);<a name="line.478"></a>
+<FONT color="green">479</FONT>                }<a name="line.479"></a>
+<FONT color="green">480</FONT>            }<a name="line.480"></a>
+<FONT color="green">481</FONT>            return visitor.end();<a name="line.481"></a>
+<FONT color="green">482</FONT>        }<a name="line.482"></a>
+<FONT color="green">483</FONT>    <a name="line.483"></a>
+<FONT color="green">484</FONT>        /** {@inheritDoc} */<a name="line.484"></a>
+<FONT color="green">485</FONT>        @Override<a name="line.485"></a>
+<FONT color="green">486</FONT>        public T walkInRowOrder(final FieldMatrixPreservingVisitor&lt;T&gt; visitor)<a name="line.486"></a>
+<FONT color="green">487</FONT>            throws MatrixVisitorException {<a name="line.487"></a>
+<FONT color="green">488</FONT>            final int rows    = getRowDimension();<a name="line.488"></a>
+<FONT color="green">489</FONT>            final int columns = getColumnDimension();<a name="line.489"></a>
+<FONT color="green">490</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.490"></a>
+<FONT color="green">491</FONT>            for (int i = 0; i &lt; rows; ++i) {<a name="line.491"></a>
+<FONT color="green">492</FONT>                final T[] rowI = data[i];<a name="line.492"></a>
+<FONT color="green">493</FONT>                for (int j = 0; j &lt; columns; ++j) {<a name="line.493"></a>
+<FONT color="green">494</FONT>                    visitor.visit(i, j, rowI[j]);<a name="line.494"></a>
+<FONT color="green">495</FONT>                }<a name="line.495"></a>
+<FONT color="green">496</FONT>            }<a name="line.496"></a>
+<FONT color="green">497</FONT>            return visitor.end();<a name="line.497"></a>
+<FONT color="green">498</FONT>        }<a name="line.498"></a>
+<FONT color="green">499</FONT>    <a name="line.499"></a>
+<FONT color="green">500</FONT>        /** {@inheritDoc} */<a name="line.500"></a>
+<FONT color="green">501</FONT>        @Override<a name="line.501"></a>
+<FONT color="green">502</FONT>        public T walkInRowOrder(final FieldMatrixChangingVisitor&lt;T&gt; visitor,<a name="line.502"></a>
+<FONT color="green">503</FONT>                                final int startRow, final int endRow,<a name="line.503"></a>
+<FONT color="green">504</FONT>                                final int startColumn, final int endColumn)<a name="line.504"></a>
+<FONT color="green">505</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.505"></a>
+<FONT color="green">506</FONT>            checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);<a name="line.506"></a>
+<FONT color="green">507</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.507"></a>
+<FONT color="green">508</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.508"></a>
+<FONT color="green">509</FONT>            for (int i = startRow; i &lt;= endRow; ++i) {<a name="line.509"></a>
+<FONT color="green">510</FONT>                final T[] rowI = data[i];<a name="line.510"></a>
+<FONT color="green">511</FONT>                for (int j = startColumn; j &lt;= endColumn; ++j) {<a name="line.511"></a>
+<FONT color="green">512</FONT>                    rowI[j] = visitor.visit(i, j, rowI[j]);<a name="line.512"></a>
+<FONT color="green">513</FONT>                }<a name="line.513"></a>
+<FONT color="green">514</FONT>            }<a name="line.514"></a>
+<FONT color="green">515</FONT>            return visitor.end();<a name="line.515"></a>
+<FONT color="green">516</FONT>        }<a name="line.516"></a>
+<FONT color="green">517</FONT>    <a name="line.517"></a>
+<FONT color="green">518</FONT>        /** {@inheritDoc} */<a name="line.518"></a>
+<FONT color="green">519</FONT>        @Override<a name="line.519"></a>
+<FONT color="green">520</FONT>        public T walkInRowOrder(final FieldMatrixPreservingVisitor&lt;T&gt; visitor,<a name="line.520"></a>
+<FONT color="green">521</FONT>                                final int startRow, final int endRow,<a name="line.521"></a>
+<FONT color="green">522</FONT>                                final int startColumn, final int endColumn)<a name="line.522"></a>
+<FONT color="green">523</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.523"></a>
+<FONT color="green">524</FONT>            checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);<a name="line.524"></a>
+<FONT color="green">525</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.525"></a>
+<FONT color="green">526</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.526"></a>
+<FONT color="green">527</FONT>            for (int i = startRow; i &lt;= endRow; ++i) {<a name="line.527"></a>
+<FONT color="green">528</FONT>                final T[] rowI = data[i];<a name="line.528"></a>
+<FONT color="green">529</FONT>                for (int j = startColumn; j &lt;= endColumn; ++j) {<a name="line.529"></a>
+<FONT color="green">530</FONT>                    visitor.visit(i, j, rowI[j]);<a name="line.530"></a>
+<FONT color="green">531</FONT>                }<a name="line.531"></a>
+<FONT color="green">532</FONT>            }<a name="line.532"></a>
+<FONT color="green">533</FONT>            return visitor.end();<a name="line.533"></a>
+<FONT color="green">534</FONT>        }<a name="line.534"></a>
+<FONT color="green">535</FONT>    <a name="line.535"></a>
+<FONT color="green">536</FONT>        /** {@inheritDoc} */<a name="line.536"></a>
+<FONT color="green">537</FONT>        @Override<a name="line.537"></a>
+<FONT color="green">538</FONT>        public T walkInColumnOrder(final FieldMatrixChangingVisitor&lt;T&gt; visitor)<a name="line.538"></a>
+<FONT color="green">539</FONT>            throws MatrixVisitorException {<a name="line.539"></a>
+<FONT color="green">540</FONT>            final int rows    = getRowDimension();<a name="line.540"></a>
+<FONT color="green">541</FONT>            final int columns = getColumnDimension();<a name="line.541"></a>
+<FONT color="green">542</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.542"></a>
+<FONT color="green">543</FONT>            for (int j = 0; j &lt; columns; ++j) {<a name="line.543"></a>
+<FONT color="green">544</FONT>                for (int i = 0; i &lt; rows; ++i) {<a name="line.544"></a>
+<FONT color="green">545</FONT>                    final T[] rowI = data[i];<a name="line.545"></a>
+<FONT color="green">546</FONT>                    rowI[j] = visitor.visit(i, j, rowI[j]);<a name="line.546"></a>
+<FONT color="green">547</FONT>                }<a name="line.547"></a>
+<FONT color="green">548</FONT>            }<a name="line.548"></a>
+<FONT color="green">549</FONT>            return visitor.end();<a name="line.549"></a>
+<FONT color="green">550</FONT>        }<a name="line.550"></a>
+<FONT color="green">551</FONT>    <a name="line.551"></a>
+<FONT color="green">552</FONT>        /** {@inheritDoc} */<a name="line.552"></a>
+<FONT color="green">553</FONT>        @Override<a name="line.553"></a>
+<FONT color="green">554</FONT>        public T walkInColumnOrder(final FieldMatrixPreservingVisitor&lt;T&gt; visitor)<a name="line.554"></a>
+<FONT color="green">555</FONT>            throws MatrixVisitorException {<a name="line.555"></a>
+<FONT color="green">556</FONT>            final int rows    = getRowDimension();<a name="line.556"></a>
+<FONT color="green">557</FONT>            final int columns = getColumnDimension();<a name="line.557"></a>
+<FONT color="green">558</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.558"></a>
+<FONT color="green">559</FONT>            for (int j = 0; j &lt; columns; ++j) {<a name="line.559"></a>
+<FONT color="green">560</FONT>                for (int i = 0; i &lt; rows; ++i) {<a name="line.560"></a>
+<FONT color="green">561</FONT>                    visitor.visit(i, j, data[i][j]);<a name="line.561"></a>
+<FONT color="green">562</FONT>                }<a name="line.562"></a>
+<FONT color="green">563</FONT>            }<a name="line.563"></a>
+<FONT color="green">564</FONT>            return visitor.end();<a name="line.564"></a>
+<FONT color="green">565</FONT>        }<a name="line.565"></a>
+<FONT color="green">566</FONT>    <a name="line.566"></a>
+<FONT color="green">567</FONT>        /** {@inheritDoc} */<a name="line.567"></a>
+<FONT color="green">568</FONT>        @Override<a name="line.568"></a>
+<FONT color="green">569</FONT>        public T walkInColumnOrder(final FieldMatrixChangingVisitor&lt;T&gt; visitor,<a name="line.569"></a>
+<FONT color="green">570</FONT>                                   final int startRow, final int endRow,<a name="line.570"></a>
+<FONT color="green">571</FONT>                                   final int startColumn, final int endColumn)<a name="line.571"></a>
+<FONT color="green">572</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.572"></a>
+<FONT color="green">573</FONT>            checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);<a name="line.573"></a>
+<FONT color="green">574</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.574"></a>
+<FONT color="green">575</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.575"></a>
+<FONT color="green">576</FONT>            for (int j = startColumn; j &lt;= endColumn; ++j) {<a name="line.576"></a>
+<FONT color="green">577</FONT>                for (int i = startRow; i &lt;= endRow; ++i) {<a name="line.577"></a>
+<FONT color="green">578</FONT>                    final T[] rowI = data[i];<a name="line.578"></a>
+<FONT color="green">579</FONT>                    rowI[j] = visitor.visit(i, j, rowI[j]);<a name="line.579"></a>
+<FONT color="green">580</FONT>                }<a name="line.580"></a>
+<FONT color="green">581</FONT>            }<a name="line.581"></a>
+<FONT color="green">582</FONT>            return visitor.end();<a name="line.582"></a>
+<FONT color="green">583</FONT>        }<a name="line.583"></a>
+<FONT color="green">584</FONT>    <a name="line.584"></a>
+<FONT color="green">585</FONT>        /** {@inheritDoc} */<a name="line.585"></a>
+<FONT color="green">586</FONT>        @Override<a name="line.586"></a>
+<FONT color="green">587</FONT>        public T walkInColumnOrder(final FieldMatrixPreservingVisitor&lt;T&gt; visitor,<a name="line.587"></a>
+<FONT color="green">588</FONT>                                   final int startRow, final int endRow,<a name="line.588"></a>
+<FONT color="green">589</FONT>                                   final int startColumn, final int endColumn)<a name="line.589"></a>
+<FONT color="green">590</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.590"></a>
+<FONT color="green">591</FONT>            checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);<a name="line.591"></a>
+<FONT color="green">592</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.592"></a>
+<FONT color="green">593</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.593"></a>
+<FONT color="green">594</FONT>            for (int j = startColumn; j &lt;= endColumn; ++j) {<a name="line.594"></a>
+<FONT color="green">595</FONT>                for (int i = startRow; i &lt;= endRow; ++i) {<a name="line.595"></a>
+<FONT color="green">596</FONT>                    visitor.visit(i, j, data[i][j]);<a name="line.596"></a>
+<FONT color="green">597</FONT>                }<a name="line.597"></a>
+<FONT color="green">598</FONT>            }<a name="line.598"></a>
+<FONT color="green">599</FONT>            return visitor.end();<a name="line.599"></a>
+<FONT color="green">600</FONT>        }<a name="line.600"></a>
+<FONT color="green">601</FONT>    <a name="line.601"></a>
+<FONT color="green">602</FONT>        /**<a name="line.602"></a>
+<FONT color="green">603</FONT>         * Returns a fresh copy of the underlying data array.<a name="line.603"></a>
+<FONT color="green">604</FONT>         *<a name="line.604"></a>
+<FONT color="green">605</FONT>         * @return a copy of the underlying data array.<a name="line.605"></a>
+<FONT color="green">606</FONT>         */<a name="line.606"></a>
+<FONT color="green">607</FONT>        private T[][] copyOut() {<a name="line.607"></a>
+<FONT color="green">608</FONT>            final int nRows = this.getRowDimension();<a name="line.608"></a>
+<FONT color="green">609</FONT>            final T[][] out = buildArray(getField(), nRows, getColumnDimension());<a name="line.609"></a>
+<FONT color="green">610</FONT>            // can't copy 2-d array in one shot, otherwise get row references<a name="line.610"></a>
+<FONT color="green">611</FONT>            for (int i = 0; i &lt; nRows; i++) {<a name="line.611"></a>
+<FONT color="green">612</FONT>                System.arraycopy(data[i], 0, out[i], 0, data[i].length);<a name="line.612"></a>
+<FONT color="green">613</FONT>            }<a name="line.613"></a>
+<FONT color="green">614</FONT>            return out;<a name="line.614"></a>
+<FONT color="green">615</FONT>        }<a name="line.615"></a>
+<FONT color="green">616</FONT>    <a name="line.616"></a>
+<FONT color="green">617</FONT>        /**<a name="line.617"></a>
+<FONT color="green">618</FONT>         * Replaces data with a fresh copy of the input array.<a name="line.618"></a>
+<FONT color="green">619</FONT>         * &lt;p&gt;<a name="line.619"></a>
+<FONT color="green">620</FONT>         * Verifies that the input array is rectangular and non-empty.&lt;/p&gt;<a name="line.620"></a>
+<FONT color="green">621</FONT>         *<a name="line.621"></a>
+<FONT color="green">622</FONT>         * @param in data to copy in<a name="line.622"></a>
+<FONT color="green">623</FONT>         * @throws IllegalArgumentException if input array is empty or not<a name="line.623"></a>
+<FONT color="green">624</FONT>         *    rectangular<a name="line.624"></a>
+<FONT color="green">625</FONT>         * @throws NullPointerException if input array is null<a name="line.625"></a>
+<FONT color="green">626</FONT>         */<a name="line.626"></a>
+<FONT color="green">627</FONT>        private void copyIn(final T[][] in) {<a name="line.627"></a>
+<FONT color="green">628</FONT>            setSubMatrix(in, 0, 0);<a name="line.628"></a>
+<FONT color="green">629</FONT>        }<a name="line.629"></a>
+<FONT color="green">630</FONT>    <a name="line.630"></a>
+<FONT color="green">631</FONT>    }<a name="line.631"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/Array2DRowRealMatrix.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,705 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Implementation of RealMatrix using a double[][] array to store entries and<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;a href="http://www.math.gatech.edu/~bourbaki/math2601/Web-notes/2num.pdf"&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * LU decomposition&lt;/a&gt; to support linear system<a name="line.27"></a>
+<FONT color="green">028</FONT>     * solution and inverse.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * The LU decomposition is performed as needed, to support the following operations: &lt;ul&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;li&gt;solve&lt;/li&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;li&gt;isSingular&lt;/li&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;li&gt;getDeterminant&lt;/li&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;li&gt;inverse&lt;/li&gt; &lt;/ul&gt;&lt;/p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;strong&gt;Usage notes&lt;/strong&gt;:&lt;br&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;ul&gt;&lt;li&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * The LU decomposition is cached and reused on subsequent calls.<a name="line.38"></a>
+<FONT color="green">039</FONT>     * If data are modified via references to the underlying array obtained using<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;code&gt;getDataRef()&lt;/code&gt;, then the stored LU decomposition will not be<a name="line.40"></a>
+<FONT color="green">041</FONT>     * discarded.  In this case, you need to explicitly invoke<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;code&gt;LUDecompose()&lt;/code&gt; to recompute the decomposition<a name="line.42"></a>
+<FONT color="green">043</FONT>     * before using any of the methods above.&lt;/li&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;li&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     * As specified in the {@link RealMatrix} interface, matrix element indexing<a name="line.45"></a>
+<FONT color="green">046</FONT>     * is 0-based -- e.g., &lt;code&gt;getEntry(0, 0)&lt;/code&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     * returns the element in the first row, first column of the matrix.&lt;/li&gt;&lt;/ul&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     * &lt;/p&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>     *<a name="line.49"></a>
+<FONT color="green">050</FONT>     * @version $Revision: 885278 $ $Date: 2009-11-29 16:47:51 -0500 (Sun, 29 Nov 2009) $<a name="line.50"></a>
+<FONT color="green">051</FONT>     */<a name="line.51"></a>
+<FONT color="green">052</FONT>    public class Array2DRowRealMatrix extends AbstractRealMatrix implements Serializable {<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /** Serializable version identifier */<a name="line.54"></a>
+<FONT color="green">055</FONT>        private static final long serialVersionUID = -1067294169172445528L;<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /** Message for at least one row. */<a name="line.57"></a>
+<FONT color="green">058</FONT>        private static final String AT_LEAST_ONE_ROW_MESSAGE =<a name="line.58"></a>
+<FONT color="green">059</FONT>            "matrix must have at least one row";<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /** Message for at least one column. */<a name="line.61"></a>
+<FONT color="green">062</FONT>        private static final String AT_LEAST_ONE_COLUMN_MESSAGE =<a name="line.62"></a>
+<FONT color="green">063</FONT>            "matrix must have at least one column";<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Message for different rows lengths. */<a name="line.65"></a>
+<FONT color="green">066</FONT>        private static final String DIFFERENT_ROWS_LENGTHS_MESSAGE =<a name="line.66"></a>
+<FONT color="green">067</FONT>            "some rows have length {0} while others have length {1}";<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /** Message for no entry at selected indices. */<a name="line.69"></a>
+<FONT color="green">070</FONT>        private static final String NO_ENTRY_MESSAGE =<a name="line.70"></a>
+<FONT color="green">071</FONT>            "no entry at indices ({0}, {1}) in a {2}x{3} matrix";<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /** Message for vector lengths mismatch. */<a name="line.73"></a>
+<FONT color="green">074</FONT>        private static final String VECTOR_LENGTHS_MISMATCH =<a name="line.74"></a>
+<FONT color="green">075</FONT>            "vector length mismatch: got {0} but expected {1}";<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** Entries of the matrix */<a name="line.77"></a>
+<FONT color="green">078</FONT>        protected double data[][];<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /**<a name="line.80"></a>
+<FONT color="green">081</FONT>         * Creates a matrix with no data<a name="line.81"></a>
+<FONT color="green">082</FONT>         */<a name="line.82"></a>
+<FONT color="green">083</FONT>        public Array2DRowRealMatrix() {<a name="line.83"></a>
+<FONT color="green">084</FONT>        }<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /**<a name="line.86"></a>
+<FONT color="green">087</FONT>         * Create a new RealMatrix with the supplied row and column dimensions.<a name="line.87"></a>
+<FONT color="green">088</FONT>         *<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @param rowDimension  the number of rows in the new matrix<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @param columnDimension  the number of columns in the new matrix<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @throws IllegalArgumentException if row or column dimension is not<a name="line.91"></a>
+<FONT color="green">092</FONT>         *  positive<a name="line.92"></a>
+<FONT color="green">093</FONT>         */<a name="line.93"></a>
+<FONT color="green">094</FONT>        public Array2DRowRealMatrix(final int rowDimension, final int columnDimension)<a name="line.94"></a>
+<FONT color="green">095</FONT>            throws IllegalArgumentException {<a name="line.95"></a>
+<FONT color="green">096</FONT>            super(rowDimension, columnDimension);<a name="line.96"></a>
+<FONT color="green">097</FONT>            data = new double[rowDimension][columnDimension];<a name="line.97"></a>
+<FONT color="green">098</FONT>        }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>        /**<a name="line.100"></a>
+<FONT color="green">101</FONT>         * Create a new RealMatrix using the input array as the underlying<a name="line.101"></a>
+<FONT color="green">102</FONT>         * data array.<a name="line.102"></a>
+<FONT color="green">103</FONT>         * &lt;p&gt;The input array is copied, not referenced. This constructor has<a name="line.103"></a>
+<FONT color="green">104</FONT>         * the same effect as calling {@link #Array2DRowRealMatrix(double[][], boolean)}<a name="line.104"></a>
+<FONT color="green">105</FONT>         * with the second argument set to &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;<a name="line.105"></a>
+<FONT color="green">106</FONT>         *<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @param d data for new matrix<a name="line.107"></a>
+<FONT color="green">108</FONT>         * @throws IllegalArgumentException if &lt;code&gt;d&lt;/code&gt; is not rectangular<a name="line.108"></a>
+<FONT color="green">109</FONT>         *  (not all rows have the same length) or empty<a name="line.109"></a>
+<FONT color="green">110</FONT>         * @throws NullPointerException if &lt;code&gt;d&lt;/code&gt; is null<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @see #Array2DRowRealMatrix(double[][], boolean)<a name="line.111"></a>
+<FONT color="green">112</FONT>         */<a name="line.112"></a>
+<FONT color="green">113</FONT>        public Array2DRowRealMatrix(final double[][] d)<a name="line.113"></a>
+<FONT color="green">114</FONT>            throws IllegalArgumentException, NullPointerException {<a name="line.114"></a>
+<FONT color="green">115</FONT>            copyIn(d);<a name="line.115"></a>
+<FONT color="green">116</FONT>        }<a name="line.116"></a>
+<FONT color="green">117</FONT>    <a name="line.117"></a>
+<FONT color="green">118</FONT>        /**<a name="line.118"></a>
+<FONT color="green">119</FONT>         * Create a new RealMatrix using the input array as the underlying<a name="line.119"></a>
+<FONT color="green">120</FONT>         * data array.<a name="line.120"></a>
+<FONT color="green">121</FONT>         * &lt;p&gt;If an array is built specially in order to be embedded in a<a name="line.121"></a>
+<FONT color="green">122</FONT>         * RealMatrix and not used directly, the &lt;code&gt;copyArray&lt;/code&gt; may be<a name="line.122"></a>
+<FONT color="green">123</FONT>         * set to &lt;code&gt;false&lt;/code. This will prevent the copying and improve<a name="line.123"></a>
+<FONT color="green">124</FONT>         * performance as no new array will be built and no data will be copied.&lt;/p&gt;<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @param d data for new matrix<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @param copyArray if true, the input array will be copied, otherwise<a name="line.126"></a>
+<FONT color="green">127</FONT>         * it will be referenced<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @throws IllegalArgumentException if &lt;code&gt;d&lt;/code&gt; is not rectangular<a name="line.128"></a>
+<FONT color="green">129</FONT>         *  (not all rows have the same length) or empty<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @throws NullPointerException if &lt;code&gt;d&lt;/code&gt; is null<a name="line.130"></a>
+<FONT color="green">131</FONT>         * @see #Array2DRowRealMatrix(double[][])<a name="line.131"></a>
+<FONT color="green">132</FONT>         */<a name="line.132"></a>
+<FONT color="green">133</FONT>        public Array2DRowRealMatrix(final double[][] d, final boolean copyArray)<a name="line.133"></a>
+<FONT color="green">134</FONT>            throws IllegalArgumentException, NullPointerException {<a name="line.134"></a>
+<FONT color="green">135</FONT>            if (copyArray) {<a name="line.135"></a>
+<FONT color="green">136</FONT>                copyIn(d);<a name="line.136"></a>
+<FONT color="green">137</FONT>            } else {<a name="line.137"></a>
+<FONT color="green">138</FONT>                if (d == null) {<a name="line.138"></a>
+<FONT color="green">139</FONT>                    throw new NullPointerException();<a name="line.139"></a>
+<FONT color="green">140</FONT>                }<a name="line.140"></a>
+<FONT color="green">141</FONT>                final int nRows = d.length;<a name="line.141"></a>
+<FONT color="green">142</FONT>                if (nRows == 0) {<a name="line.142"></a>
+<FONT color="green">143</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.143"></a>
+<FONT color="green">144</FONT>                          AT_LEAST_ONE_ROW_MESSAGE);<a name="line.144"></a>
+<FONT color="green">145</FONT>                }<a name="line.145"></a>
+<FONT color="green">146</FONT>                final int nCols = d[0].length;<a name="line.146"></a>
+<FONT color="green">147</FONT>                if (nCols == 0) {<a name="line.147"></a>
+<FONT color="green">148</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.148"></a>
+<FONT color="green">149</FONT>                          AT_LEAST_ONE_COLUMN_MESSAGE);<a name="line.149"></a>
+<FONT color="green">150</FONT>                }<a name="line.150"></a>
+<FONT color="green">151</FONT>                for (int r = 1; r &lt; nRows; r++) {<a name="line.151"></a>
+<FONT color="green">152</FONT>                    if (d[r].length != nCols) {<a name="line.152"></a>
+<FONT color="green">153</FONT>                        throw MathRuntimeException.createIllegalArgumentException(<a name="line.153"></a>
+<FONT color="green">154</FONT>                              DIFFERENT_ROWS_LENGTHS_MESSAGE, nCols, d[r].length);<a name="line.154"></a>
+<FONT color="green">155</FONT>                    }<a name="line.155"></a>
+<FONT color="green">156</FONT>                }<a name="line.156"></a>
+<FONT color="green">157</FONT>                data = d;<a name="line.157"></a>
+<FONT color="green">158</FONT>            }<a name="line.158"></a>
+<FONT color="green">159</FONT>        }<a name="line.159"></a>
+<FONT color="green">160</FONT>    <a name="line.160"></a>
+<FONT color="green">161</FONT>        /**<a name="line.161"></a>
+<FONT color="green">162</FONT>         * Create a new (column) RealMatrix using &lt;code&gt;v&lt;/code&gt; as the<a name="line.162"></a>
+<FONT color="green">163</FONT>         * data for the unique column of the &lt;code&gt;v.length x 1&lt;/code&gt; matrix<a name="line.163"></a>
+<FONT color="green">164</FONT>         * created.<a name="line.164"></a>
+<FONT color="green">165</FONT>         * &lt;p&gt;The input array is copied, not referenced.&lt;/p&gt;<a name="line.165"></a>
+<FONT color="green">166</FONT>         *<a name="line.166"></a>
+<FONT color="green">167</FONT>         * @param v column vector holding data for new matrix<a name="line.167"></a>
+<FONT color="green">168</FONT>         */<a name="line.168"></a>
+<FONT color="green">169</FONT>        public Array2DRowRealMatrix(final double[] v) {<a name="line.169"></a>
+<FONT color="green">170</FONT>            final int nRows = v.length;<a name="line.170"></a>
+<FONT color="green">171</FONT>            data = new double[nRows][1];<a name="line.171"></a>
+<FONT color="green">172</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.172"></a>
+<FONT color="green">173</FONT>                data[row][0] = v[row];<a name="line.173"></a>
+<FONT color="green">174</FONT>            }<a name="line.174"></a>
+<FONT color="green">175</FONT>        }<a name="line.175"></a>
+<FONT color="green">176</FONT>    <a name="line.176"></a>
+<FONT color="green">177</FONT>        /** {@inheritDoc} */<a name="line.177"></a>
+<FONT color="green">178</FONT>        @Override<a name="line.178"></a>
+<FONT color="green">179</FONT>        public RealMatrix createMatrix(final int rowDimension, final int columnDimension)<a name="line.179"></a>
+<FONT color="green">180</FONT>            throws IllegalArgumentException {<a name="line.180"></a>
+<FONT color="green">181</FONT>            return new Array2DRowRealMatrix(rowDimension, columnDimension);<a name="line.181"></a>
+<FONT color="green">182</FONT>        }<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>        /** {@inheritDoc} */<a name="line.184"></a>
+<FONT color="green">185</FONT>        @Override<a name="line.185"></a>
+<FONT color="green">186</FONT>        public RealMatrix copy() {<a name="line.186"></a>
+<FONT color="green">187</FONT>            return new Array2DRowRealMatrix(copyOut(), false);<a name="line.187"></a>
+<FONT color="green">188</FONT>        }<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>        /** {@inheritDoc} */<a name="line.190"></a>
+<FONT color="green">191</FONT>        @Override<a name="line.191"></a>
+<FONT color="green">192</FONT>        public RealMatrix add(final RealMatrix m)<a name="line.192"></a>
+<FONT color="green">193</FONT>            throws IllegalArgumentException {<a name="line.193"></a>
+<FONT color="green">194</FONT>            try {<a name="line.194"></a>
+<FONT color="green">195</FONT>                return add((Array2DRowRealMatrix) m);<a name="line.195"></a>
+<FONT color="green">196</FONT>            } catch (ClassCastException cce) {<a name="line.196"></a>
+<FONT color="green">197</FONT>                return super.add(m);<a name="line.197"></a>
+<FONT color="green">198</FONT>            }<a name="line.198"></a>
+<FONT color="green">199</FONT>        }<a name="line.199"></a>
+<FONT color="green">200</FONT>    <a name="line.200"></a>
+<FONT color="green">201</FONT>        /**<a name="line.201"></a>
+<FONT color="green">202</FONT>         * Compute the sum of this and &lt;code&gt;m&lt;/code&gt;.<a name="line.202"></a>
+<FONT color="green">203</FONT>         *<a name="line.203"></a>
+<FONT color="green">204</FONT>         * @param m    matrix to be added<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @return     this + m<a name="line.205"></a>
+<FONT color="green">206</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.206"></a>
+<FONT color="green">207</FONT>         */<a name="line.207"></a>
+<FONT color="green">208</FONT>        public Array2DRowRealMatrix add(final Array2DRowRealMatrix m)<a name="line.208"></a>
+<FONT color="green">209</FONT>            throws IllegalArgumentException {<a name="line.209"></a>
+<FONT color="green">210</FONT>    <a name="line.210"></a>
+<FONT color="green">211</FONT>            // safety check<a name="line.211"></a>
+<FONT color="green">212</FONT>            MatrixUtils.checkAdditionCompatible(this, m);<a name="line.212"></a>
+<FONT color="green">213</FONT>    <a name="line.213"></a>
+<FONT color="green">214</FONT>            final int rowCount    = getRowDimension();<a name="line.214"></a>
+<FONT color="green">215</FONT>            final int columnCount = getColumnDimension();<a name="line.215"></a>
+<FONT color="green">216</FONT>            final double[][] outData = new double[rowCount][columnCount];<a name="line.216"></a>
+<FONT color="green">217</FONT>            for (int row = 0; row &lt; rowCount; row++) {<a name="line.217"></a>
+<FONT color="green">218</FONT>                final double[] dataRow    = data[row];<a name="line.218"></a>
+<FONT color="green">219</FONT>                final double[] mRow       = m.data[row];<a name="line.219"></a>
+<FONT color="green">220</FONT>                final double[] outDataRow = outData[row];<a name="line.220"></a>
+<FONT color="green">221</FONT>                for (int col = 0; col &lt; columnCount; col++) {<a name="line.221"></a>
+<FONT color="green">222</FONT>                    outDataRow[col] = dataRow[col] + mRow[col];<a name="line.222"></a>
+<FONT color="green">223</FONT>                }<a name="line.223"></a>
+<FONT color="green">224</FONT>            }<a name="line.224"></a>
+<FONT color="green">225</FONT>    <a name="line.225"></a>
+<FONT color="green">226</FONT>            return new Array2DRowRealMatrix(outData, false);<a name="line.226"></a>
+<FONT color="green">227</FONT>    <a name="line.227"></a>
+<FONT color="green">228</FONT>        }<a name="line.228"></a>
+<FONT color="green">229</FONT>    <a name="line.229"></a>
+<FONT color="green">230</FONT>        /** {@inheritDoc} */<a name="line.230"></a>
+<FONT color="green">231</FONT>        @Override<a name="line.231"></a>
+<FONT color="green">232</FONT>        public RealMatrix subtract(final RealMatrix m)<a name="line.232"></a>
+<FONT color="green">233</FONT>            throws IllegalArgumentException {<a name="line.233"></a>
+<FONT color="green">234</FONT>            try {<a name="line.234"></a>
+<FONT color="green">235</FONT>                return subtract((Array2DRowRealMatrix) m);<a name="line.235"></a>
+<FONT color="green">236</FONT>            } catch (ClassCastException cce) {<a name="line.236"></a>
+<FONT color="green">237</FONT>                return super.subtract(m);<a name="line.237"></a>
+<FONT color="green">238</FONT>            }<a name="line.238"></a>
+<FONT color="green">239</FONT>        }<a name="line.239"></a>
+<FONT color="green">240</FONT>    <a name="line.240"></a>
+<FONT color="green">241</FONT>        /**<a name="line.241"></a>
+<FONT color="green">242</FONT>         * Compute  this minus &lt;code&gt;m&lt;/code&gt;.<a name="line.242"></a>
+<FONT color="green">243</FONT>         *<a name="line.243"></a>
+<FONT color="green">244</FONT>         * @param m    matrix to be subtracted<a name="line.244"></a>
+<FONT color="green">245</FONT>         * @return     this + m<a name="line.245"></a>
+<FONT color="green">246</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.246"></a>
+<FONT color="green">247</FONT>         */<a name="line.247"></a>
+<FONT color="green">248</FONT>        public Array2DRowRealMatrix subtract(final Array2DRowRealMatrix m)<a name="line.248"></a>
+<FONT color="green">249</FONT>            throws IllegalArgumentException {<a name="line.249"></a>
+<FONT color="green">250</FONT>    <a name="line.250"></a>
+<FONT color="green">251</FONT>            // safety check<a name="line.251"></a>
+<FONT color="green">252</FONT>            MatrixUtils.checkSubtractionCompatible(this, m);<a name="line.252"></a>
+<FONT color="green">253</FONT>    <a name="line.253"></a>
+<FONT color="green">254</FONT>            final int rowCount    = getRowDimension();<a name="line.254"></a>
+<FONT color="green">255</FONT>            final int columnCount = getColumnDimension();<a name="line.255"></a>
+<FONT color="green">256</FONT>            final double[][] outData = new double[rowCount][columnCount];<a name="line.256"></a>
+<FONT color="green">257</FONT>            for (int row = 0; row &lt; rowCount; row++) {<a name="line.257"></a>
+<FONT color="green">258</FONT>                final double[] dataRow    = data[row];<a name="line.258"></a>
+<FONT color="green">259</FONT>                final double[] mRow       = m.data[row];<a name="line.259"></a>
+<FONT color="green">260</FONT>                final double[] outDataRow = outData[row];<a name="line.260"></a>
+<FONT color="green">261</FONT>                for (int col = 0; col &lt; columnCount; col++) {<a name="line.261"></a>
+<FONT color="green">262</FONT>                    outDataRow[col] = dataRow[col] - mRow[col];<a name="line.262"></a>
+<FONT color="green">263</FONT>                }<a name="line.263"></a>
+<FONT color="green">264</FONT>            }<a name="line.264"></a>
+<FONT color="green">265</FONT>    <a name="line.265"></a>
+<FONT color="green">266</FONT>            return new Array2DRowRealMatrix(outData, false);<a name="line.266"></a>
+<FONT color="green">267</FONT>    <a name="line.267"></a>
+<FONT color="green">268</FONT>        }<a name="line.268"></a>
+<FONT color="green">269</FONT>    <a name="line.269"></a>
+<FONT color="green">270</FONT>        /** {@inheritDoc} */<a name="line.270"></a>
+<FONT color="green">271</FONT>        @Override<a name="line.271"></a>
+<FONT color="green">272</FONT>        public RealMatrix multiply(final RealMatrix m)<a name="line.272"></a>
+<FONT color="green">273</FONT>            throws IllegalArgumentException {<a name="line.273"></a>
+<FONT color="green">274</FONT>            try {<a name="line.274"></a>
+<FONT color="green">275</FONT>                return multiply((Array2DRowRealMatrix) m);<a name="line.275"></a>
+<FONT color="green">276</FONT>            } catch (ClassCastException cce) {<a name="line.276"></a>
+<FONT color="green">277</FONT>                return super.multiply(m);<a name="line.277"></a>
+<FONT color="green">278</FONT>            }<a name="line.278"></a>
+<FONT color="green">279</FONT>        }<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>        /**<a name="line.281"></a>
+<FONT color="green">282</FONT>         * Returns the result of postmultiplying this by &lt;code&gt;m&lt;/code&gt;.<a name="line.282"></a>
+<FONT color="green">283</FONT>         * @param m    matrix to postmultiply by<a name="line.283"></a>
+<FONT color="green">284</FONT>         * @return     this*m<a name="line.284"></a>
+<FONT color="green">285</FONT>         * @throws     IllegalArgumentException<a name="line.285"></a>
+<FONT color="green">286</FONT>         *             if columnDimension(this) != rowDimension(m)<a name="line.286"></a>
+<FONT color="green">287</FONT>         */<a name="line.287"></a>
+<FONT color="green">288</FONT>        public Array2DRowRealMatrix multiply(final Array2DRowRealMatrix m)<a name="line.288"></a>
+<FONT color="green">289</FONT>            throws IllegalArgumentException {<a name="line.289"></a>
+<FONT color="green">290</FONT>    <a name="line.290"></a>
+<FONT color="green">291</FONT>            // safety check<a name="line.291"></a>
+<FONT color="green">292</FONT>            MatrixUtils.checkMultiplicationCompatible(this, m);<a name="line.292"></a>
+<FONT color="green">293</FONT>    <a name="line.293"></a>
+<FONT color="green">294</FONT>            final int nRows = this.getRowDimension();<a name="line.294"></a>
+<FONT color="green">295</FONT>            final int nCols = m.getColumnDimension();<a name="line.295"></a>
+<FONT color="green">296</FONT>            final int nSum = this.getColumnDimension();<a name="line.296"></a>
+<FONT color="green">297</FONT>            final double[][] outData = new double[nRows][nCols];<a name="line.297"></a>
+<FONT color="green">298</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.298"></a>
+<FONT color="green">299</FONT>                final double[] dataRow    = data[row];<a name="line.299"></a>
+<FONT color="green">300</FONT>                final double[] outDataRow = outData[row];<a name="line.300"></a>
+<FONT color="green">301</FONT>                for (int col = 0; col &lt; nCols; col++) {<a name="line.301"></a>
+<FONT color="green">302</FONT>                    double sum = 0;<a name="line.302"></a>
+<FONT color="green">303</FONT>                    for (int i = 0; i &lt; nSum; i++) {<a name="line.303"></a>
+<FONT color="green">304</FONT>                        sum += dataRow[i] * m.data[i][col];<a name="line.304"></a>
+<FONT color="green">305</FONT>                    }<a name="line.305"></a>
+<FONT color="green">306</FONT>                    outDataRow[col] = sum;<a name="line.306"></a>
+<FONT color="green">307</FONT>                }<a name="line.307"></a>
+<FONT color="green">308</FONT>            }<a name="line.308"></a>
+<FONT color="green">309</FONT>    <a name="line.309"></a>
+<FONT color="green">310</FONT>            return new Array2DRowRealMatrix(outData, false);<a name="line.310"></a>
+<FONT color="green">311</FONT>    <a name="line.311"></a>
+<FONT color="green">312</FONT>        }<a name="line.312"></a>
+<FONT color="green">313</FONT>    <a name="line.313"></a>
+<FONT color="green">314</FONT>        /** {@inheritDoc} */<a name="line.314"></a>
+<FONT color="green">315</FONT>        @Override<a name="line.315"></a>
+<FONT color="green">316</FONT>        public double[][] getData() {<a name="line.316"></a>
+<FONT color="green">317</FONT>            return copyOut();<a name="line.317"></a>
+<FONT color="green">318</FONT>        }<a name="line.318"></a>
+<FONT color="green">319</FONT>    <a name="line.319"></a>
+<FONT color="green">320</FONT>        /**<a name="line.320"></a>
+<FONT color="green">321</FONT>         * Returns a reference to the underlying data array.<a name="line.321"></a>
+<FONT color="green">322</FONT>         * &lt;p&gt;<a name="line.322"></a>
+<FONT color="green">323</FONT>         * Does &lt;strong&gt;not&lt;/strong&gt; make a fresh copy of the underlying data.&lt;/p&gt;<a name="line.323"></a>
+<FONT color="green">324</FONT>         *<a name="line.324"></a>
+<FONT color="green">325</FONT>         * @return 2-dimensional array of entries<a name="line.325"></a>
+<FONT color="green">326</FONT>         */<a name="line.326"></a>
+<FONT color="green">327</FONT>        public double[][] getDataRef() {<a name="line.327"></a>
+<FONT color="green">328</FONT>            return data;<a name="line.328"></a>
+<FONT color="green">329</FONT>        }<a name="line.329"></a>
+<FONT color="green">330</FONT>    <a name="line.330"></a>
+<FONT color="green">331</FONT>        /** {@inheritDoc} */<a name="line.331"></a>
+<FONT color="green">332</FONT>        @Override<a name="line.332"></a>
+<FONT color="green">333</FONT>        public void setSubMatrix(final double[][] subMatrix, final int row, final int column)<a name="line.333"></a>
+<FONT color="green">334</FONT>        throws MatrixIndexException {<a name="line.334"></a>
+<FONT color="green">335</FONT>            if (data == null) {<a name="line.335"></a>
+<FONT color="green">336</FONT>                if (row &gt; 0) {<a name="line.336"></a>
+<FONT color="green">337</FONT>                    throw MathRuntimeException.createIllegalStateException(<a name="line.337"></a>
+<FONT color="green">338</FONT>                          "first {0} rows are not initialized yet", row);<a name="line.338"></a>
+<FONT color="green">339</FONT>                }<a name="line.339"></a>
+<FONT color="green">340</FONT>                if (column &gt; 0) {<a name="line.340"></a>
+<FONT color="green">341</FONT>                    throw MathRuntimeException.createIllegalStateException(<a name="line.341"></a>
+<FONT color="green">342</FONT>                          "first {0} columns are not initialized yet", column);<a name="line.342"></a>
+<FONT color="green">343</FONT>                }<a name="line.343"></a>
+<FONT color="green">344</FONT>                final int nRows = subMatrix.length;<a name="line.344"></a>
+<FONT color="green">345</FONT>                if (nRows == 0) {<a name="line.345"></a>
+<FONT color="green">346</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.346"></a>
+<FONT color="green">347</FONT>                          AT_LEAST_ONE_ROW_MESSAGE);<a name="line.347"></a>
+<FONT color="green">348</FONT>                }<a name="line.348"></a>
+<FONT color="green">349</FONT>    <a name="line.349"></a>
+<FONT color="green">350</FONT>                final int nCols = subMatrix[0].length;<a name="line.350"></a>
+<FONT color="green">351</FONT>                if (nCols == 0) {<a name="line.351"></a>
+<FONT color="green">352</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.352"></a>
+<FONT color="green">353</FONT>                          AT_LEAST_ONE_COLUMN_MESSAGE);<a name="line.353"></a>
+<FONT color="green">354</FONT>                }<a name="line.354"></a>
+<FONT color="green">355</FONT>                data = new double[subMatrix.length][nCols];<a name="line.355"></a>
+<FONT color="green">356</FONT>                for (int i = 0; i &lt; data.length; ++i) {<a name="line.356"></a>
+<FONT color="green">357</FONT>                    if (subMatrix[i].length != nCols) {<a name="line.357"></a>
+<FONT color="green">358</FONT>                        throw MathRuntimeException.createIllegalArgumentException(<a name="line.358"></a>
+<FONT color="green">359</FONT>                              DIFFERENT_ROWS_LENGTHS_MESSAGE, nCols, subMatrix[i].length);<a name="line.359"></a>
+<FONT color="green">360</FONT>                    }<a name="line.360"></a>
+<FONT color="green">361</FONT>                    System.arraycopy(subMatrix[i], 0, data[i + row], column, nCols);<a name="line.361"></a>
+<FONT color="green">362</FONT>                }<a name="line.362"></a>
+<FONT color="green">363</FONT>            } else {<a name="line.363"></a>
+<FONT color="green">364</FONT>                super.setSubMatrix(subMatrix, row, column);<a name="line.364"></a>
+<FONT color="green">365</FONT>            }<a name="line.365"></a>
+<FONT color="green">366</FONT>    <a name="line.366"></a>
+<FONT color="green">367</FONT>        }<a name="line.367"></a>
+<FONT color="green">368</FONT>    <a name="line.368"></a>
+<FONT color="green">369</FONT>        /** {@inheritDoc} */<a name="line.369"></a>
+<FONT color="green">370</FONT>        @Override<a name="line.370"></a>
+<FONT color="green">371</FONT>        public double getEntry(final int row, final int column)<a name="line.371"></a>
+<FONT color="green">372</FONT>            throws MatrixIndexException {<a name="line.372"></a>
+<FONT color="green">373</FONT>            try {<a name="line.373"></a>
+<FONT color="green">374</FONT>                return data[row][column];<a name="line.374"></a>
+<FONT color="green">375</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.375"></a>
+<FONT color="green">376</FONT>                throw new MatrixIndexException(<a name="line.376"></a>
+<FONT color="green">377</FONT>                          NO_ENTRY_MESSAGE, row, column, getRowDimension(), getColumnDimension());<a name="line.377"></a>
+<FONT color="green">378</FONT>            }<a name="line.378"></a>
+<FONT color="green">379</FONT>        }<a name="line.379"></a>
+<FONT color="green">380</FONT>    <a name="line.380"></a>
+<FONT color="green">381</FONT>        /** {@inheritDoc} */<a name="line.381"></a>
+<FONT color="green">382</FONT>        @Override<a name="line.382"></a>
+<FONT color="green">383</FONT>        public void setEntry(final int row, final int column, final double value)<a name="line.383"></a>
+<FONT color="green">384</FONT>            throws MatrixIndexException {<a name="line.384"></a>
+<FONT color="green">385</FONT>            try {<a name="line.385"></a>
+<FONT color="green">386</FONT>                data[row][column] = value;<a name="line.386"></a>
+<FONT color="green">387</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.387"></a>
+<FONT color="green">388</FONT>                throw new MatrixIndexException(<a name="line.388"></a>
+<FONT color="green">389</FONT>                          NO_ENTRY_MESSAGE, row, column, getRowDimension(), getColumnDimension());<a name="line.389"></a>
+<FONT color="green">390</FONT>            }<a name="line.390"></a>
+<FONT color="green">391</FONT>        }<a name="line.391"></a>
+<FONT color="green">392</FONT>    <a name="line.392"></a>
+<FONT color="green">393</FONT>        /** {@inheritDoc} */<a name="line.393"></a>
+<FONT color="green">394</FONT>        @Override<a name="line.394"></a>
+<FONT color="green">395</FONT>        public void addToEntry(final int row, final int column, final double increment)<a name="line.395"></a>
+<FONT color="green">396</FONT>            throws MatrixIndexException {<a name="line.396"></a>
+<FONT color="green">397</FONT>            try {<a name="line.397"></a>
+<FONT color="green">398</FONT>                data[row][column] += increment;<a name="line.398"></a>
+<FONT color="green">399</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.399"></a>
+<FONT color="green">400</FONT>                throw new MatrixIndexException(<a name="line.400"></a>
+<FONT color="green">401</FONT>                          NO_ENTRY_MESSAGE, row, column, getRowDimension(), getColumnDimension());<a name="line.401"></a>
+<FONT color="green">402</FONT>            }<a name="line.402"></a>
+<FONT color="green">403</FONT>        }<a name="line.403"></a>
+<FONT color="green">404</FONT>    <a name="line.404"></a>
+<FONT color="green">405</FONT>        /** {@inheritDoc} */<a name="line.405"></a>
+<FONT color="green">406</FONT>        @Override<a name="line.406"></a>
+<FONT color="green">407</FONT>        public void multiplyEntry(final int row, final int column, final double factor)<a name="line.407"></a>
+<FONT color="green">408</FONT>            throws MatrixIndexException {<a name="line.408"></a>
+<FONT color="green">409</FONT>            try {<a name="line.409"></a>
+<FONT color="green">410</FONT>                data[row][column] *= factor;<a name="line.410"></a>
+<FONT color="green">411</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.411"></a>
+<FONT color="green">412</FONT>                throw new MatrixIndexException(<a name="line.412"></a>
+<FONT color="green">413</FONT>                          NO_ENTRY_MESSAGE, row, column, getRowDimension(), getColumnDimension());<a name="line.413"></a>
+<FONT color="green">414</FONT>            }<a name="line.414"></a>
+<FONT color="green">415</FONT>        }<a name="line.415"></a>
+<FONT color="green">416</FONT>    <a name="line.416"></a>
+<FONT color="green">417</FONT>        /** {@inheritDoc} */<a name="line.417"></a>
+<FONT color="green">418</FONT>        @Override<a name="line.418"></a>
+<FONT color="green">419</FONT>        public int getRowDimension() {<a name="line.419"></a>
+<FONT color="green">420</FONT>            return (data == null) ? 0 : data.length;<a name="line.420"></a>
+<FONT color="green">421</FONT>        }<a name="line.421"></a>
+<FONT color="green">422</FONT>    <a name="line.422"></a>
+<FONT color="green">423</FONT>        /** {@inheritDoc} */<a name="line.423"></a>
+<FONT color="green">424</FONT>        @Override<a name="line.424"></a>
+<FONT color="green">425</FONT>        public int getColumnDimension() {<a name="line.425"></a>
+<FONT color="green">426</FONT>            return ((data == null) || (data[0] == null)) ? 0 : data[0].length;<a name="line.426"></a>
+<FONT color="green">427</FONT>        }<a name="line.427"></a>
+<FONT color="green">428</FONT>    <a name="line.428"></a>
+<FONT color="green">429</FONT>        /** {@inheritDoc} */<a name="line.429"></a>
+<FONT color="green">430</FONT>        @Override<a name="line.430"></a>
+<FONT color="green">431</FONT>        public double[] operate(final double[] v)<a name="line.431"></a>
+<FONT color="green">432</FONT>            throws IllegalArgumentException {<a name="line.432"></a>
+<FONT color="green">433</FONT>            final int nRows = this.getRowDimension();<a name="line.433"></a>
+<FONT color="green">434</FONT>            final int nCols = this.getColumnDimension();<a name="line.434"></a>
+<FONT color="green">435</FONT>            if (v.length != nCols) {<a name="line.435"></a>
+<FONT color="green">436</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.436"></a>
+<FONT color="green">437</FONT>                      VECTOR_LENGTHS_MISMATCH, v.length, nCols);<a name="line.437"></a>
+<FONT color="green">438</FONT>            }<a name="line.438"></a>
+<FONT color="green">439</FONT>            final double[] out = new double[nRows];<a name="line.439"></a>
+<FONT color="green">440</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.440"></a>
+<FONT color="green">441</FONT>                final double[] dataRow = data[row];<a name="line.441"></a>
+<FONT color="green">442</FONT>                double sum = 0;<a name="line.442"></a>
+<FONT color="green">443</FONT>                for (int i = 0; i &lt; nCols; i++) {<a name="line.443"></a>
+<FONT color="green">444</FONT>                    sum += dataRow[i] * v[i];<a name="line.444"></a>
+<FONT color="green">445</FONT>                }<a name="line.445"></a>
+<FONT color="green">446</FONT>                out[row] = sum;<a name="line.446"></a>
+<FONT color="green">447</FONT>            }<a name="line.447"></a>
+<FONT color="green">448</FONT>            return out;<a name="line.448"></a>
+<FONT color="green">449</FONT>        }<a name="line.449"></a>
+<FONT color="green">450</FONT>    <a name="line.450"></a>
+<FONT color="green">451</FONT>        /** {@inheritDoc} */<a name="line.451"></a>
+<FONT color="green">452</FONT>        @Override<a name="line.452"></a>
+<FONT color="green">453</FONT>        public double[] preMultiply(final double[] v)<a name="line.453"></a>
+<FONT color="green">454</FONT>            throws IllegalArgumentException {<a name="line.454"></a>
+<FONT color="green">455</FONT>    <a name="line.455"></a>
+<FONT color="green">456</FONT>            final int nRows = getRowDimension();<a name="line.456"></a>
+<FONT color="green">457</FONT>            final int nCols = getColumnDimension();<a name="line.457"></a>
+<FONT color="green">458</FONT>            if (v.length != nRows) {<a name="line.458"></a>
+<FONT color="green">459</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.459"></a>
+<FONT color="green">460</FONT>                      VECTOR_LENGTHS_MISMATCH, v.length, nRows);<a name="line.460"></a>
+<FONT color="green">461</FONT>            }<a name="line.461"></a>
+<FONT color="green">462</FONT>    <a name="line.462"></a>
+<FONT color="green">463</FONT>            final double[] out = new double[nCols];<a name="line.463"></a>
+<FONT color="green">464</FONT>            for (int col = 0; col &lt; nCols; ++col) {<a name="line.464"></a>
+<FONT color="green">465</FONT>                double sum = 0;<a name="line.465"></a>
+<FONT color="green">466</FONT>                for (int i = 0; i &lt; nRows; ++i) {<a name="line.466"></a>
+<FONT color="green">467</FONT>                    sum += data[i][col] * v[i];<a name="line.467"></a>
+<FONT color="green">468</FONT>                }<a name="line.468"></a>
+<FONT color="green">469</FONT>                out[col] = sum;<a name="line.469"></a>
+<FONT color="green">470</FONT>            }<a name="line.470"></a>
+<FONT color="green">471</FONT>    <a name="line.471"></a>
+<FONT color="green">472</FONT>            return out;<a name="line.472"></a>
+<FONT color="green">473</FONT>    <a name="line.473"></a>
+<FONT color="green">474</FONT>        }<a name="line.474"></a>
+<FONT color="green">475</FONT>    <a name="line.475"></a>
+<FONT color="green">476</FONT>        /** {@inheritDoc} */<a name="line.476"></a>
+<FONT color="green">477</FONT>        @Override<a name="line.477"></a>
+<FONT color="green">478</FONT>        public double walkInRowOrder(final RealMatrixChangingVisitor visitor)<a name="line.478"></a>
+<FONT color="green">479</FONT>            throws MatrixVisitorException {<a name="line.479"></a>
+<FONT color="green">480</FONT>            final int rows    = getRowDimension();<a name="line.480"></a>
+<FONT color="green">481</FONT>            final int columns = getColumnDimension();<a name="line.481"></a>
+<FONT color="green">482</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.482"></a>
+<FONT color="green">483</FONT>            for (int i = 0; i &lt; rows; ++i) {<a name="line.483"></a>
+<FONT color="green">484</FONT>                final double[] rowI = data[i];<a name="line.484"></a>
+<FONT color="green">485</FONT>                for (int j = 0; j &lt; columns; ++j) {<a name="line.485"></a>
+<FONT color="green">486</FONT>                    rowI[j] = visitor.visit(i, j, rowI[j]);<a name="line.486"></a>
+<FONT color="green">487</FONT>                }<a name="line.487"></a>
+<FONT color="green">488</FONT>            }<a name="line.488"></a>
+<FONT color="green">489</FONT>            return visitor.end();<a name="line.489"></a>
+<FONT color="green">490</FONT>        }<a name="line.490"></a>
+<FONT color="green">491</FONT>    <a name="line.491"></a>
+<FONT color="green">492</FONT>        /** {@inheritDoc} */<a name="line.492"></a>
+<FONT color="green">493</FONT>        @Override<a name="line.493"></a>
+<FONT color="green">494</FONT>        public double walkInRowOrder(final RealMatrixPreservingVisitor visitor)<a name="line.494"></a>
+<FONT color="green">495</FONT>            throws MatrixVisitorException {<a name="line.495"></a>
+<FONT color="green">496</FONT>            final int rows    = getRowDimension();<a name="line.496"></a>
+<FONT color="green">497</FONT>            final int columns = getColumnDimension();<a name="line.497"></a>
+<FONT color="green">498</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.498"></a>
+<FONT color="green">499</FONT>            for (int i = 0; i &lt; rows; ++i) {<a name="line.499"></a>
+<FONT color="green">500</FONT>                final double[] rowI = data[i];<a name="line.500"></a>
+<FONT color="green">501</FONT>                for (int j = 0; j &lt; columns; ++j) {<a name="line.501"></a>
+<FONT color="green">502</FONT>                    visitor.visit(i, j, rowI[j]);<a name="line.502"></a>
+<FONT color="green">503</FONT>                }<a name="line.503"></a>
+<FONT color="green">504</FONT>            }<a name="line.504"></a>
+<FONT color="green">505</FONT>            return visitor.end();<a name="line.505"></a>
+<FONT color="green">506</FONT>        }<a name="line.506"></a>
+<FONT color="green">507</FONT>    <a name="line.507"></a>
+<FONT color="green">508</FONT>        /** {@inheritDoc} */<a name="line.508"></a>
+<FONT color="green">509</FONT>        @Override<a name="line.509"></a>
+<FONT color="green">510</FONT>        public double walkInRowOrder(final RealMatrixChangingVisitor visitor,<a name="line.510"></a>
+<FONT color="green">511</FONT>                                     final int startRow, final int endRow,<a name="line.511"></a>
+<FONT color="green">512</FONT>                                     final int startColumn, final int endColumn)<a name="line.512"></a>
+<FONT color="green">513</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.513"></a>
+<FONT color="green">514</FONT>            MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);<a name="line.514"></a>
+<FONT color="green">515</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.515"></a>
+<FONT color="green">516</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.516"></a>
+<FONT color="green">517</FONT>            for (int i = startRow; i &lt;= endRow; ++i) {<a name="line.517"></a>
+<FONT color="green">518</FONT>                final double[] rowI = data[i];<a name="line.518"></a>
+<FONT color="green">519</FONT>                for (int j = startColumn; j &lt;= endColumn; ++j) {<a name="line.519"></a>
+<FONT color="green">520</FONT>                    rowI[j] = visitor.visit(i, j, rowI[j]);<a name="line.520"></a>
+<FONT color="green">521</FONT>                }<a name="line.521"></a>
+<FONT color="green">522</FONT>            }<a name="line.522"></a>
+<FONT color="green">523</FONT>            return visitor.end();<a name="line.523"></a>
+<FONT color="green">524</FONT>        }<a name="line.524"></a>
+<FONT color="green">525</FONT>    <a name="line.525"></a>
+<FONT color="green">526</FONT>        /** {@inheritDoc} */<a name="line.526"></a>
+<FONT color="green">527</FONT>        @Override<a name="line.527"></a>
+<FONT color="green">528</FONT>        public double walkInRowOrder(final RealMatrixPreservingVisitor visitor,<a name="line.528"></a>
+<FONT color="green">529</FONT>                                     final int startRow, final int endRow,<a name="line.529"></a>
+<FONT color="green">530</FONT>                                     final int startColumn, final int endColumn)<a name="line.530"></a>
+<FONT color="green">531</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.531"></a>
+<FONT color="green">532</FONT>            MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);<a name="line.532"></a>
+<FONT color="green">533</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.533"></a>
+<FONT color="green">534</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.534"></a>
+<FONT color="green">535</FONT>            for (int i = startRow; i &lt;= endRow; ++i) {<a name="line.535"></a>
+<FONT color="green">536</FONT>                final double[] rowI = data[i];<a name="line.536"></a>
+<FONT color="green">537</FONT>                for (int j = startColumn; j &lt;= endColumn; ++j) {<a name="line.537"></a>
+<FONT color="green">538</FONT>                    visitor.visit(i, j, rowI[j]);<a name="line.538"></a>
+<FONT color="green">539</FONT>                }<a name="line.539"></a>
+<FONT color="green">540</FONT>            }<a name="line.540"></a>
+<FONT color="green">541</FONT>            return visitor.end();<a name="line.541"></a>
+<FONT color="green">542</FONT>        }<a name="line.542"></a>
+<FONT color="green">543</FONT>    <a name="line.543"></a>
+<FONT color="green">544</FONT>        /** {@inheritDoc} */<a name="line.544"></a>
+<FONT color="green">545</FONT>        @Override<a name="line.545"></a>
+<FONT color="green">546</FONT>        public double walkInColumnOrder(final RealMatrixChangingVisitor visitor)<a name="line.546"></a>
+<FONT color="green">547</FONT>            throws MatrixVisitorException {<a name="line.547"></a>
+<FONT color="green">548</FONT>            final int rows    = getRowDimension();<a name="line.548"></a>
+<FONT color="green">549</FONT>            final int columns = getColumnDimension();<a name="line.549"></a>
+<FONT color="green">550</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.550"></a>
+<FONT color="green">551</FONT>            for (int j = 0; j &lt; columns; ++j) {<a name="line.551"></a>
+<FONT color="green">552</FONT>                for (int i = 0; i &lt; rows; ++i) {<a name="line.552"></a>
+<FONT color="green">553</FONT>                    final double[] rowI = data[i];<a name="line.553"></a>
+<FONT color="green">554</FONT>                    rowI[j] = visitor.visit(i, j, rowI[j]);<a name="line.554"></a>
+<FONT color="green">555</FONT>                }<a name="line.555"></a>
+<FONT color="green">556</FONT>            }<a name="line.556"></a>
+<FONT color="green">557</FONT>            return visitor.end();<a name="line.557"></a>
+<FONT color="green">558</FONT>        }<a name="line.558"></a>
+<FONT color="green">559</FONT>    <a name="line.559"></a>
+<FONT color="green">560</FONT>        /** {@inheritDoc} */<a name="line.560"></a>
+<FONT color="green">561</FONT>        @Override<a name="line.561"></a>
+<FONT color="green">562</FONT>        public double walkInColumnOrder(final RealMatrixPreservingVisitor visitor)<a name="line.562"></a>
+<FONT color="green">563</FONT>            throws MatrixVisitorException {<a name="line.563"></a>
+<FONT color="green">564</FONT>            final int rows    = getRowDimension();<a name="line.564"></a>
+<FONT color="green">565</FONT>            final int columns = getColumnDimension();<a name="line.565"></a>
+<FONT color="green">566</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.566"></a>
+<FONT color="green">567</FONT>            for (int j = 0; j &lt; columns; ++j) {<a name="line.567"></a>
+<FONT color="green">568</FONT>                for (int i = 0; i &lt; rows; ++i) {<a name="line.568"></a>
+<FONT color="green">569</FONT>                    visitor.visit(i, j, data[i][j]);<a name="line.569"></a>
+<FONT color="green">570</FONT>                }<a name="line.570"></a>
+<FONT color="green">571</FONT>            }<a name="line.571"></a>
+<FONT color="green">572</FONT>            return visitor.end();<a name="line.572"></a>
+<FONT color="green">573</FONT>        }<a name="line.573"></a>
+<FONT color="green">574</FONT>    <a name="line.574"></a>
+<FONT color="green">575</FONT>        /** {@inheritDoc} */<a name="line.575"></a>
+<FONT color="green">576</FONT>        @Override<a name="line.576"></a>
+<FONT color="green">577</FONT>        public double walkInColumnOrder(final RealMatrixChangingVisitor visitor,<a name="line.577"></a>
+<FONT color="green">578</FONT>                                        final int startRow, final int endRow,<a name="line.578"></a>
+<FONT color="green">579</FONT>                                        final int startColumn, final int endColumn)<a name="line.579"></a>
+<FONT color="green">580</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.580"></a>
+<FONT color="green">581</FONT>            MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);<a name="line.581"></a>
+<FONT color="green">582</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.582"></a>
+<FONT color="green">583</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.583"></a>
+<FONT color="green">584</FONT>            for (int j = startColumn; j &lt;= endColumn; ++j) {<a name="line.584"></a>
+<FONT color="green">585</FONT>                for (int i = startRow; i &lt;= endRow; ++i) {<a name="line.585"></a>
+<FONT color="green">586</FONT>                    final double[] rowI = data[i];<a name="line.586"></a>
+<FONT color="green">587</FONT>                    rowI[j] = visitor.visit(i, j, rowI[j]);<a name="line.587"></a>
+<FONT color="green">588</FONT>                }<a name="line.588"></a>
+<FONT color="green">589</FONT>            }<a name="line.589"></a>
+<FONT color="green">590</FONT>            return visitor.end();<a name="line.590"></a>
+<FONT color="green">591</FONT>        }<a name="line.591"></a>
+<FONT color="green">592</FONT>    <a name="line.592"></a>
+<FONT color="green">593</FONT>        /** {@inheritDoc} */<a name="line.593"></a>
+<FONT color="green">594</FONT>        @Override<a name="line.594"></a>
+<FONT color="green">595</FONT>        public double walkInColumnOrder(final RealMatrixPreservingVisitor visitor,<a name="line.595"></a>
+<FONT color="green">596</FONT>                                        final int startRow, final int endRow,<a name="line.596"></a>
+<FONT color="green">597</FONT>                                        final int startColumn, final int endColumn)<a name="line.597"></a>
+<FONT color="green">598</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.598"></a>
+<FONT color="green">599</FONT>            MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);<a name="line.599"></a>
+<FONT color="green">600</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.600"></a>
+<FONT color="green">601</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.601"></a>
+<FONT color="green">602</FONT>            for (int j = startColumn; j &lt;= endColumn; ++j) {<a name="line.602"></a>
+<FONT color="green">603</FONT>                for (int i = startRow; i &lt;= endRow; ++i) {<a name="line.603"></a>
+<FONT color="green">604</FONT>                    visitor.visit(i, j, data[i][j]);<a name="line.604"></a>
+<FONT color="green">605</FONT>                }<a name="line.605"></a>
+<FONT color="green">606</FONT>            }<a name="line.606"></a>
+<FONT color="green">607</FONT>            return visitor.end();<a name="line.607"></a>
+<FONT color="green">608</FONT>        }<a name="line.608"></a>
+<FONT color="green">609</FONT>    <a name="line.609"></a>
+<FONT color="green">610</FONT>        /**<a name="line.610"></a>
+<FONT color="green">611</FONT>         * Returns a fresh copy of the underlying data array.<a name="line.611"></a>
+<FONT color="green">612</FONT>         *<a name="line.612"></a>
+<FONT color="green">613</FONT>         * @return a copy of the underlying data array.<a name="line.613"></a>
+<FONT color="green">614</FONT>         */<a name="line.614"></a>
+<FONT color="green">615</FONT>        private double[][] copyOut() {<a name="line.615"></a>
+<FONT color="green">616</FONT>            final int nRows = this.getRowDimension();<a name="line.616"></a>
+<FONT color="green">617</FONT>            final double[][] out = new double[nRows][this.getColumnDimension()];<a name="line.617"></a>
+<FONT color="green">618</FONT>            // can't copy 2-d array in one shot, otherwise get row references<a name="line.618"></a>
+<FONT color="green">619</FONT>            for (int i = 0; i &lt; nRows; i++) {<a name="line.619"></a>
+<FONT color="green">620</FONT>                System.arraycopy(data[i], 0, out[i], 0, data[i].length);<a name="line.620"></a>
+<FONT color="green">621</FONT>            }<a name="line.621"></a>
+<FONT color="green">622</FONT>            return out;<a name="line.622"></a>
+<FONT color="green">623</FONT>        }<a name="line.623"></a>
+<FONT color="green">624</FONT>    <a name="line.624"></a>
+<FONT color="green">625</FONT>        /**<a name="line.625"></a>
+<FONT color="green">626</FONT>         * Replaces data with a fresh copy of the input array.<a name="line.626"></a>
+<FONT color="green">627</FONT>         * &lt;p&gt;<a name="line.627"></a>
+<FONT color="green">628</FONT>         * Verifies that the input array is rectangular and non-empty.&lt;/p&gt;<a name="line.628"></a>
+<FONT color="green">629</FONT>         *<a name="line.629"></a>
+<FONT color="green">630</FONT>         * @param in data to copy in<a name="line.630"></a>
+<FONT color="green">631</FONT>         * @throws IllegalArgumentException if input array is empty or not<a name="line.631"></a>
+<FONT color="green">632</FONT>         *    rectangular<a name="line.632"></a>
+<FONT color="green">633</FONT>         * @throws NullPointerException if input array is null<a name="line.633"></a>
+<FONT color="green">634</FONT>         */<a name="line.634"></a>
+<FONT color="green">635</FONT>        private void copyIn(final double[][] in) {<a name="line.635"></a>
+<FONT color="green">636</FONT>            setSubMatrix(in, 0, 0);<a name="line.636"></a>
+<FONT color="green">637</FONT>        }<a name="line.637"></a>
+<FONT color="green">638</FONT>    <a name="line.638"></a>
+<FONT color="green">639</FONT>    }<a name="line.639"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/ArrayFieldVector.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,868 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.linear;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.lang.reflect.Array;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.Arrays;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.Field;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.FieldElement;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    /**<a name="line.27"></a>
+<FONT color="green">028</FONT>     * This class implements the {@link FieldVector} interface with a {@link FieldElement} array.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @param &lt;T&gt; the type of the field elements<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 903046 $ $Date: 2010-01-25 21:07:26 -0500 (Mon, 25 Jan 2010) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 2.0<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public class ArrayFieldVector&lt;T extends FieldElement&lt;T&gt;&gt; implements FieldVector&lt;T&gt;, Serializable {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Serializable version identifier. */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private static final long serialVersionUID = 7648186910365927050L;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Entries of the vector. */<a name="line.38"></a>
+<FONT color="green">039</FONT>        protected T[] data;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Field to which the elements belong. */<a name="line.41"></a>
+<FONT color="green">042</FONT>        private final Field&lt;T&gt; field;<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /**<a name="line.44"></a>
+<FONT color="green">045</FONT>         * Build a 0-length vector.<a name="line.45"></a>
+<FONT color="green">046</FONT>         * &lt;p&gt;Zero-length vectors may be used to initialized construction of vectors<a name="line.46"></a>
+<FONT color="green">047</FONT>         * by data gathering. We start with zero-length and use either the {@link<a name="line.47"></a>
+<FONT color="green">048</FONT>         * #ArrayFieldVector(ArrayFieldVector, ArrayFieldVector)} constructor<a name="line.48"></a>
+<FONT color="green">049</FONT>         * or one of the &lt;code&gt;append&lt;/code&gt; methods ({@link #append(FieldElement[])},<a name="line.49"></a>
+<FONT color="green">050</FONT>         * {@link #add(FieldVector)}, {@link #append(ArrayFieldVector)}) to gather data<a name="line.50"></a>
+<FONT color="green">051</FONT>         * into this vector.&lt;/p&gt;<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @param field field to which the elements belong<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        public ArrayFieldVector(final Field&lt;T&gt; field) {<a name="line.54"></a>
+<FONT color="green">055</FONT>            this(field, 0);<a name="line.55"></a>
+<FONT color="green">056</FONT>        }<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /**<a name="line.58"></a>
+<FONT color="green">059</FONT>         * Construct a (size)-length vector of zeros.<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @param field field to which the elements belong<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param size size of the vector<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        public ArrayFieldVector(Field&lt;T&gt; field, int size) {<a name="line.63"></a>
+<FONT color="green">064</FONT>            this.field = field;<a name="line.64"></a>
+<FONT color="green">065</FONT>            data = buildArray(size);<a name="line.65"></a>
+<FONT color="green">066</FONT>            Arrays.fill(data, field.getZero());<a name="line.66"></a>
+<FONT color="green">067</FONT>        }<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * Construct an (size)-length vector with preset values.<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param size size of the vector<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param preset fill the vector with this scalar value<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        public ArrayFieldVector(int size, T preset) {<a name="line.74"></a>
+<FONT color="green">075</FONT>            this(preset.getField(), size);<a name="line.75"></a>
+<FONT color="green">076</FONT>            Arrays.fill(data, preset);<a name="line.76"></a>
+<FONT color="green">077</FONT>        }<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        /**<a name="line.79"></a>
+<FONT color="green">080</FONT>         * Construct a vector from an array, copying the input array.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @param d array of Ts.<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @throws IllegalArgumentException if &lt;code&gt;d&lt;/code&gt; is empty<a name="line.82"></a>
+<FONT color="green">083</FONT>         */<a name="line.83"></a>
+<FONT color="green">084</FONT>        public ArrayFieldVector(T[] d)<a name="line.84"></a>
+<FONT color="green">085</FONT>            throws IllegalArgumentException {<a name="line.85"></a>
+<FONT color="green">086</FONT>            try {<a name="line.86"></a>
+<FONT color="green">087</FONT>                field = d[0].getField();<a name="line.87"></a>
+<FONT color="green">088</FONT>                data = d.clone();<a name="line.88"></a>
+<FONT color="green">089</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.89"></a>
+<FONT color="green">090</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.90"></a>
+<FONT color="green">091</FONT>                          "vector must have at least one element");<a name="line.91"></a>
+<FONT color="green">092</FONT>            }<a name="line.92"></a>
+<FONT color="green">093</FONT>        }<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /**<a name="line.95"></a>
+<FONT color="green">096</FONT>         * Create a new ArrayFieldVector using the input array as the underlying<a name="line.96"></a>
+<FONT color="green">097</FONT>         * data array.<a name="line.97"></a>
+<FONT color="green">098</FONT>         * &lt;p&gt;If an array is built specially in order to be embedded in a<a name="line.98"></a>
+<FONT color="green">099</FONT>         * ArrayFieldVector and not used directly, the &lt;code&gt;copyArray&lt;/code&gt; may be<a name="line.99"></a>
+<FONT color="green">100</FONT>         * set to &lt;code&gt;false&lt;/code. This will prevent the copying and improve<a name="line.100"></a>
+<FONT color="green">101</FONT>         * performance as no new array will be built and no data will be copied.&lt;/p&gt;<a name="line.101"></a>
+<FONT color="green">102</FONT>         * @param d data for new vector<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @param copyArray if true, the input array will be copied, otherwise<a name="line.103"></a>
+<FONT color="green">104</FONT>         * it will be referenced<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @throws IllegalArgumentException if &lt;code&gt;d&lt;/code&gt; is empty<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @throws NullPointerException if &lt;code&gt;d&lt;/code&gt; is null<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @see #ArrayFieldVector(FieldElement[])<a name="line.107"></a>
+<FONT color="green">108</FONT>         */<a name="line.108"></a>
+<FONT color="green">109</FONT>        public ArrayFieldVector(T[] d, boolean copyArray)<a name="line.109"></a>
+<FONT color="green">110</FONT>            throws NullPointerException, IllegalArgumentException {<a name="line.110"></a>
+<FONT color="green">111</FONT>            try {<a name="line.111"></a>
+<FONT color="green">112</FONT>                field = d[0].getField();<a name="line.112"></a>
+<FONT color="green">113</FONT>                data = copyArray ? d.clone() :  d;<a name="line.113"></a>
+<FONT color="green">114</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.114"></a>
+<FONT color="green">115</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.115"></a>
+<FONT color="green">116</FONT>                          "vector must have at least one element");<a name="line.116"></a>
+<FONT color="green">117</FONT>            }<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /**<a name="line.120"></a>
+<FONT color="green">121</FONT>         * Construct a vector from part of a array.<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @param d array of Ts.<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @param pos position of first entry<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @param size number of entries to copy<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        public ArrayFieldVector(T[] d, int pos, int size) {<a name="line.126"></a>
+<FONT color="green">127</FONT>            if (d.length &lt; pos + size) {<a name="line.127"></a>
+<FONT color="green">128</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.128"></a>
+<FONT color="green">129</FONT>                        "position {0} and size {1} don't fit to the size of the input array {2}",<a name="line.129"></a>
+<FONT color="green">130</FONT>                        pos, size, d.length);<a name="line.130"></a>
+<FONT color="green">131</FONT>            }<a name="line.131"></a>
+<FONT color="green">132</FONT>            field = d[0].getField();<a name="line.132"></a>
+<FONT color="green">133</FONT>            data = buildArray(size);<a name="line.133"></a>
+<FONT color="green">134</FONT>            System.arraycopy(d, pos, data, 0, size);<a name="line.134"></a>
+<FONT color="green">135</FONT>        }<a name="line.135"></a>
+<FONT color="green">136</FONT>    <a name="line.136"></a>
+<FONT color="green">137</FONT>        /**<a name="line.137"></a>
+<FONT color="green">138</FONT>         * Construct a vector from another vector, using a deep copy.<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @param v vector to copy<a name="line.139"></a>
+<FONT color="green">140</FONT>         */<a name="line.140"></a>
+<FONT color="green">141</FONT>        public ArrayFieldVector(FieldVector&lt;T&gt; v) {<a name="line.141"></a>
+<FONT color="green">142</FONT>            field = v.getField();<a name="line.142"></a>
+<FONT color="green">143</FONT>            data = buildArray(v.getDimension());<a name="line.143"></a>
+<FONT color="green">144</FONT>            for (int i = 0; i &lt; data.length; ++i) {<a name="line.144"></a>
+<FONT color="green">145</FONT>                data[i] = v.getEntry(i);<a name="line.145"></a>
+<FONT color="green">146</FONT>            }<a name="line.146"></a>
+<FONT color="green">147</FONT>        }<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>        /**<a name="line.149"></a>
+<FONT color="green">150</FONT>         * Construct a vector from another vector, using a deep copy.<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @param v vector to copy<a name="line.151"></a>
+<FONT color="green">152</FONT>         */<a name="line.152"></a>
+<FONT color="green">153</FONT>        public ArrayFieldVector(ArrayFieldVector&lt;T&gt; v) {<a name="line.153"></a>
+<FONT color="green">154</FONT>            field = v.getField();<a name="line.154"></a>
+<FONT color="green">155</FONT>            data = v.data.clone();<a name="line.155"></a>
+<FONT color="green">156</FONT>        }<a name="line.156"></a>
+<FONT color="green">157</FONT>    <a name="line.157"></a>
+<FONT color="green">158</FONT>        /**<a name="line.158"></a>
+<FONT color="green">159</FONT>         * Construct a vector from another vector.<a name="line.159"></a>
+<FONT color="green">160</FONT>         * @param v vector to copy<a name="line.160"></a>
+<FONT color="green">161</FONT>         * @param deep if true perform a deep copy otherwise perform a shallow copy<a name="line.161"></a>
+<FONT color="green">162</FONT>         */<a name="line.162"></a>
+<FONT color="green">163</FONT>        public ArrayFieldVector(ArrayFieldVector&lt;T&gt; v, boolean deep) {<a name="line.163"></a>
+<FONT color="green">164</FONT>            field = v.getField();<a name="line.164"></a>
+<FONT color="green">165</FONT>            data = deep ? v.data.clone() : v.data;<a name="line.165"></a>
+<FONT color="green">166</FONT>        }<a name="line.166"></a>
+<FONT color="green">167</FONT>    <a name="line.167"></a>
+<FONT color="green">168</FONT>        /**<a name="line.168"></a>
+<FONT color="green">169</FONT>         * Construct a vector by appending one vector to another vector.<a name="line.169"></a>
+<FONT color="green">170</FONT>         * @param v1 first vector (will be put in front of the new vector)<a name="line.170"></a>
+<FONT color="green">171</FONT>         * @param v2 second vector (will be put at back of the new vector)<a name="line.171"></a>
+<FONT color="green">172</FONT>         */<a name="line.172"></a>
+<FONT color="green">173</FONT>        public ArrayFieldVector(ArrayFieldVector&lt;T&gt; v1, ArrayFieldVector&lt;T&gt; v2) {<a name="line.173"></a>
+<FONT color="green">174</FONT>            field = v1.getField();<a name="line.174"></a>
+<FONT color="green">175</FONT>            data = buildArray(v1.data.length + v2.data.length);<a name="line.175"></a>
+<FONT color="green">176</FONT>            System.arraycopy(v1.data, 0, data, 0, v1.data.length);<a name="line.176"></a>
+<FONT color="green">177</FONT>            System.arraycopy(v2.data, 0, data, v1.data.length, v2.data.length);<a name="line.177"></a>
+<FONT color="green">178</FONT>        }<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>        /**<a name="line.180"></a>
+<FONT color="green">181</FONT>         * Construct a vector by appending one vector to another vector.<a name="line.181"></a>
+<FONT color="green">182</FONT>         * @param v1 first vector (will be put in front of the new vector)<a name="line.182"></a>
+<FONT color="green">183</FONT>         * @param v2 second vector (will be put at back of the new vector)<a name="line.183"></a>
+<FONT color="green">184</FONT>         */<a name="line.184"></a>
+<FONT color="green">185</FONT>        public ArrayFieldVector(ArrayFieldVector&lt;T&gt; v1, T[] v2) {<a name="line.185"></a>
+<FONT color="green">186</FONT>            field = v1.getField();<a name="line.186"></a>
+<FONT color="green">187</FONT>            data = buildArray(v1.data.length + v2.length);<a name="line.187"></a>
+<FONT color="green">188</FONT>            System.arraycopy(v1.data, 0, data, 0, v1.data.length);<a name="line.188"></a>
+<FONT color="green">189</FONT>            System.arraycopy(v2, 0, data, v1.data.length, v2.length);<a name="line.189"></a>
+<FONT color="green">190</FONT>        }<a name="line.190"></a>
+<FONT color="green">191</FONT>    <a name="line.191"></a>
+<FONT color="green">192</FONT>        /**<a name="line.192"></a>
+<FONT color="green">193</FONT>         * Construct a vector by appending one vector to another vector.<a name="line.193"></a>
+<FONT color="green">194</FONT>         * @param v1 first vector (will be put in front of the new vector)<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @param v2 second vector (will be put at back of the new vector)<a name="line.195"></a>
+<FONT color="green">196</FONT>         */<a name="line.196"></a>
+<FONT color="green">197</FONT>        public ArrayFieldVector(T[] v1, ArrayFieldVector&lt;T&gt; v2) {<a name="line.197"></a>
+<FONT color="green">198</FONT>            field = v2.getField();<a name="line.198"></a>
+<FONT color="green">199</FONT>            data = buildArray(v1.length + v2.data.length);<a name="line.199"></a>
+<FONT color="green">200</FONT>            System.arraycopy(v1, 0, data, 0, v1.length);<a name="line.200"></a>
+<FONT color="green">201</FONT>            System.arraycopy(v2.data, 0, data, v1.length, v2.data.length);<a name="line.201"></a>
+<FONT color="green">202</FONT>        }<a name="line.202"></a>
+<FONT color="green">203</FONT>    <a name="line.203"></a>
+<FONT color="green">204</FONT>        /**<a name="line.204"></a>
+<FONT color="green">205</FONT>         * Construct a vector by appending one vector to another vector.<a name="line.205"></a>
+<FONT color="green">206</FONT>         * @param v1 first vector (will be put in front of the new vector)<a name="line.206"></a>
+<FONT color="green">207</FONT>         * @param v2 second vector (will be put at back of the new vector)<a name="line.207"></a>
+<FONT color="green">208</FONT>         * @exception IllegalArgumentException if both vectors are empty<a name="line.208"></a>
+<FONT color="green">209</FONT>         */<a name="line.209"></a>
+<FONT color="green">210</FONT>        public ArrayFieldVector(T[] v1, T[] v2) {<a name="line.210"></a>
+<FONT color="green">211</FONT>            try {<a name="line.211"></a>
+<FONT color="green">212</FONT>                data = buildArray(v1.length + v2.length);<a name="line.212"></a>
+<FONT color="green">213</FONT>                System.arraycopy(v1, 0, data, 0, v1.length);<a name="line.213"></a>
+<FONT color="green">214</FONT>                System.arraycopy(v2, 0, data, v1.length, v2.length);<a name="line.214"></a>
+<FONT color="green">215</FONT>                field = data[0].getField();<a name="line.215"></a>
+<FONT color="green">216</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.216"></a>
+<FONT color="green">217</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.217"></a>
+<FONT color="green">218</FONT>                          "vector must have at least one element");<a name="line.218"></a>
+<FONT color="green">219</FONT>            }<a name="line.219"></a>
+<FONT color="green">220</FONT>        }<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>        /** Build an array of elements.<a name="line.222"></a>
+<FONT color="green">223</FONT>         * @param length size of the array to build<a name="line.223"></a>
+<FONT color="green">224</FONT>         * @return a new array<a name="line.224"></a>
+<FONT color="green">225</FONT>         */<a name="line.225"></a>
+<FONT color="green">226</FONT>        @SuppressWarnings("unchecked") // field is of type T<a name="line.226"></a>
+<FONT color="green">227</FONT>        private T[] buildArray(final int length) {<a name="line.227"></a>
+<FONT color="green">228</FONT>            return (T[]) Array.newInstance(field.getZero().getClass(), length);<a name="line.228"></a>
+<FONT color="green">229</FONT>        }<a name="line.229"></a>
+<FONT color="green">230</FONT>    <a name="line.230"></a>
+<FONT color="green">231</FONT>        /** {@inheritDoc} */<a name="line.231"></a>
+<FONT color="green">232</FONT>        public Field&lt;T&gt; getField() {<a name="line.232"></a>
+<FONT color="green">233</FONT>            return field;<a name="line.233"></a>
+<FONT color="green">234</FONT>        }<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>        /** {@inheritDoc} */<a name="line.236"></a>
+<FONT color="green">237</FONT>        public FieldVector&lt;T&gt; copy() {<a name="line.237"></a>
+<FONT color="green">238</FONT>            return new ArrayFieldVector&lt;T&gt;(this, true);<a name="line.238"></a>
+<FONT color="green">239</FONT>        }<a name="line.239"></a>
+<FONT color="green">240</FONT>    <a name="line.240"></a>
+<FONT color="green">241</FONT>        /** {@inheritDoc} */<a name="line.241"></a>
+<FONT color="green">242</FONT>        public FieldVector&lt;T&gt; add(FieldVector&lt;T&gt; v) throws IllegalArgumentException {<a name="line.242"></a>
+<FONT color="green">243</FONT>            try {<a name="line.243"></a>
+<FONT color="green">244</FONT>                return add((ArrayFieldVector&lt;T&gt;) v);<a name="line.244"></a>
+<FONT color="green">245</FONT>            } catch (ClassCastException cce) {<a name="line.245"></a>
+<FONT color="green">246</FONT>                checkVectorDimensions(v);<a name="line.246"></a>
+<FONT color="green">247</FONT>                T[] out = buildArray(data.length);<a name="line.247"></a>
+<FONT color="green">248</FONT>                for (int i = 0; i &lt; data.length; i++) {<a name="line.248"></a>
+<FONT color="green">249</FONT>                    out[i] = data[i].add(v.getEntry(i));<a name="line.249"></a>
+<FONT color="green">250</FONT>                }<a name="line.250"></a>
+<FONT color="green">251</FONT>                return new ArrayFieldVector&lt;T&gt;(out);<a name="line.251"></a>
+<FONT color="green">252</FONT>            }<a name="line.252"></a>
+<FONT color="green">253</FONT>        }<a name="line.253"></a>
+<FONT color="green">254</FONT>    <a name="line.254"></a>
+<FONT color="green">255</FONT>        /** {@inheritDoc} */<a name="line.255"></a>
+<FONT color="green">256</FONT>        public FieldVector&lt;T&gt; add(T[] v) throws IllegalArgumentException {<a name="line.256"></a>
+<FONT color="green">257</FONT>            checkVectorDimensions(v.length);<a name="line.257"></a>
+<FONT color="green">258</FONT>            T[] out = buildArray(data.length);<a name="line.258"></a>
+<FONT color="green">259</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.259"></a>
+<FONT color="green">260</FONT>                out[i] = data[i].add(v[i]);<a name="line.260"></a>
+<FONT color="green">261</FONT>            }<a name="line.261"></a>
+<FONT color="green">262</FONT>            return new ArrayFieldVector&lt;T&gt;(out);<a name="line.262"></a>
+<FONT color="green">263</FONT>        }<a name="line.263"></a>
+<FONT color="green">264</FONT>    <a name="line.264"></a>
+<FONT color="green">265</FONT>        /**<a name="line.265"></a>
+<FONT color="green">266</FONT>         * Compute the sum of this and v.<a name="line.266"></a>
+<FONT color="green">267</FONT>         * @param v vector to be added<a name="line.267"></a>
+<FONT color="green">268</FONT>         * @return this + v<a name="line.268"></a>
+<FONT color="green">269</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.269"></a>
+<FONT color="green">270</FONT>         */<a name="line.270"></a>
+<FONT color="green">271</FONT>        public ArrayFieldVector&lt;T&gt; add(ArrayFieldVector&lt;T&gt; v)<a name="line.271"></a>
+<FONT color="green">272</FONT>            throws IllegalArgumentException {<a name="line.272"></a>
+<FONT color="green">273</FONT>            return (ArrayFieldVector&lt;T&gt;) add(v.data);<a name="line.273"></a>
+<FONT color="green">274</FONT>        }<a name="line.274"></a>
+<FONT color="green">275</FONT>    <a name="line.275"></a>
+<FONT color="green">276</FONT>        /** {@inheritDoc} */<a name="line.276"></a>
+<FONT color="green">277</FONT>        public FieldVector&lt;T&gt; subtract(FieldVector&lt;T&gt; v) throws IllegalArgumentException {<a name="line.277"></a>
+<FONT color="green">278</FONT>            try {<a name="line.278"></a>
+<FONT color="green">279</FONT>                return subtract((ArrayFieldVector&lt;T&gt;) v);<a name="line.279"></a>
+<FONT color="green">280</FONT>            } catch (ClassCastException cce) {<a name="line.280"></a>
+<FONT color="green">281</FONT>                checkVectorDimensions(v);<a name="line.281"></a>
+<FONT color="green">282</FONT>                T[] out = buildArray(data.length);<a name="line.282"></a>
+<FONT color="green">283</FONT>                for (int i = 0; i &lt; data.length; i++) {<a name="line.283"></a>
+<FONT color="green">284</FONT>                    out[i] = data[i].subtract(v.getEntry(i));<a name="line.284"></a>
+<FONT color="green">285</FONT>                }<a name="line.285"></a>
+<FONT color="green">286</FONT>                return new ArrayFieldVector&lt;T&gt;(out);<a name="line.286"></a>
+<FONT color="green">287</FONT>            }<a name="line.287"></a>
+<FONT color="green">288</FONT>        }<a name="line.288"></a>
+<FONT color="green">289</FONT>    <a name="line.289"></a>
+<FONT color="green">290</FONT>        /** {@inheritDoc} */<a name="line.290"></a>
+<FONT color="green">291</FONT>        public FieldVector&lt;T&gt; subtract(T[] v) throws IllegalArgumentException {<a name="line.291"></a>
+<FONT color="green">292</FONT>            checkVectorDimensions(v.length);<a name="line.292"></a>
+<FONT color="green">293</FONT>            T[] out = buildArray(data.length);<a name="line.293"></a>
+<FONT color="green">294</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.294"></a>
+<FONT color="green">295</FONT>                out[i] = data[i].subtract(v[i]);<a name="line.295"></a>
+<FONT color="green">296</FONT>            }<a name="line.296"></a>
+<FONT color="green">297</FONT>            return new ArrayFieldVector&lt;T&gt;(out);<a name="line.297"></a>
+<FONT color="green">298</FONT>        }<a name="line.298"></a>
+<FONT color="green">299</FONT>    <a name="line.299"></a>
+<FONT color="green">300</FONT>        /**<a name="line.300"></a>
+<FONT color="green">301</FONT>         * Compute this minus v.<a name="line.301"></a>
+<FONT color="green">302</FONT>         * @param v vector to be subtracted<a name="line.302"></a>
+<FONT color="green">303</FONT>         * @return this + v<a name="line.303"></a>
+<FONT color="green">304</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.304"></a>
+<FONT color="green">305</FONT>         */<a name="line.305"></a>
+<FONT color="green">306</FONT>        public ArrayFieldVector&lt;T&gt; subtract(ArrayFieldVector&lt;T&gt; v)<a name="line.306"></a>
+<FONT color="green">307</FONT>            throws IllegalArgumentException {<a name="line.307"></a>
+<FONT color="green">308</FONT>            return (ArrayFieldVector&lt;T&gt;) subtract(v.data);<a name="line.308"></a>
+<FONT color="green">309</FONT>        }<a name="line.309"></a>
+<FONT color="green">310</FONT>    <a name="line.310"></a>
+<FONT color="green">311</FONT>        /** {@inheritDoc} */<a name="line.311"></a>
+<FONT color="green">312</FONT>        public FieldVector&lt;T&gt; mapAdd(T d) {<a name="line.312"></a>
+<FONT color="green">313</FONT>            T[] out = buildArray(data.length);<a name="line.313"></a>
+<FONT color="green">314</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.314"></a>
+<FONT color="green">315</FONT>                out[i] = data[i].add(d);<a name="line.315"></a>
+<FONT color="green">316</FONT>            }<a name="line.316"></a>
+<FONT color="green">317</FONT>            return new ArrayFieldVector&lt;T&gt;(out);<a name="line.317"></a>
+<FONT color="green">318</FONT>        }<a name="line.318"></a>
+<FONT color="green">319</FONT>    <a name="line.319"></a>
+<FONT color="green">320</FONT>        /** {@inheritDoc} */<a name="line.320"></a>
+<FONT color="green">321</FONT>        public FieldVector&lt;T&gt; mapAddToSelf(T d) {<a name="line.321"></a>
+<FONT color="green">322</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.322"></a>
+<FONT color="green">323</FONT>                data[i] = data[i].add(d);<a name="line.323"></a>
+<FONT color="green">324</FONT>            }<a name="line.324"></a>
+<FONT color="green">325</FONT>            return this;<a name="line.325"></a>
+<FONT color="green">326</FONT>        }<a name="line.326"></a>
+<FONT color="green">327</FONT>    <a name="line.327"></a>
+<FONT color="green">328</FONT>        /** {@inheritDoc} */<a name="line.328"></a>
+<FONT color="green">329</FONT>        public FieldVector&lt;T&gt; mapSubtract(T d) {<a name="line.329"></a>
+<FONT color="green">330</FONT>            T[] out = buildArray(data.length);<a name="line.330"></a>
+<FONT color="green">331</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.331"></a>
+<FONT color="green">332</FONT>                out[i] = data[i].subtract(d);<a name="line.332"></a>
+<FONT color="green">333</FONT>            }<a name="line.333"></a>
+<FONT color="green">334</FONT>            return new ArrayFieldVector&lt;T&gt;(out);<a name="line.334"></a>
+<FONT color="green">335</FONT>        }<a name="line.335"></a>
+<FONT color="green">336</FONT>    <a name="line.336"></a>
+<FONT color="green">337</FONT>        /** {@inheritDoc} */<a name="line.337"></a>
+<FONT color="green">338</FONT>        public FieldVector&lt;T&gt; mapSubtractToSelf(T d) {<a name="line.338"></a>
+<FONT color="green">339</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.339"></a>
+<FONT color="green">340</FONT>                data[i] = data[i].subtract(d);<a name="line.340"></a>
+<FONT color="green">341</FONT>            }<a name="line.341"></a>
+<FONT color="green">342</FONT>            return this;<a name="line.342"></a>
+<FONT color="green">343</FONT>        }<a name="line.343"></a>
+<FONT color="green">344</FONT>    <a name="line.344"></a>
+<FONT color="green">345</FONT>        /** {@inheritDoc} */<a name="line.345"></a>
+<FONT color="green">346</FONT>        public FieldVector&lt;T&gt; mapMultiply(T d) {<a name="line.346"></a>
+<FONT color="green">347</FONT>            T[] out = buildArray(data.length);<a name="line.347"></a>
+<FONT color="green">348</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.348"></a>
+<FONT color="green">349</FONT>                out[i] = data[i].multiply(d);<a name="line.349"></a>
+<FONT color="green">350</FONT>            }<a name="line.350"></a>
+<FONT color="green">351</FONT>            return new ArrayFieldVector&lt;T&gt;(out);<a name="line.351"></a>
+<FONT color="green">352</FONT>        }<a name="line.352"></a>
+<FONT color="green">353</FONT>    <a name="line.353"></a>
+<FONT color="green">354</FONT>        /** {@inheritDoc} */<a name="line.354"></a>
+<FONT color="green">355</FONT>        public FieldVector&lt;T&gt; mapMultiplyToSelf(T d) {<a name="line.355"></a>
+<FONT color="green">356</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.356"></a>
+<FONT color="green">357</FONT>                data[i] = data[i].multiply(d);<a name="line.357"></a>
+<FONT color="green">358</FONT>            }<a name="line.358"></a>
+<FONT color="green">359</FONT>            return this;<a name="line.359"></a>
+<FONT color="green">360</FONT>        }<a name="line.360"></a>
+<FONT color="green">361</FONT>    <a name="line.361"></a>
+<FONT color="green">362</FONT>        /** {@inheritDoc} */<a name="line.362"></a>
+<FONT color="green">363</FONT>        public FieldVector&lt;T&gt; mapDivide(T d) {<a name="line.363"></a>
+<FONT color="green">364</FONT>            T[] out = buildArray(data.length);<a name="line.364"></a>
+<FONT color="green">365</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.365"></a>
+<FONT color="green">366</FONT>                out[i] = data[i].divide(d);<a name="line.366"></a>
+<FONT color="green">367</FONT>            }<a name="line.367"></a>
+<FONT color="green">368</FONT>            return new ArrayFieldVector&lt;T&gt;(out);<a name="line.368"></a>
+<FONT color="green">369</FONT>        }<a name="line.369"></a>
+<FONT color="green">370</FONT>    <a name="line.370"></a>
+<FONT color="green">371</FONT>        /** {@inheritDoc} */<a name="line.371"></a>
+<FONT color="green">372</FONT>        public FieldVector&lt;T&gt; mapDivideToSelf(T d) {<a name="line.372"></a>
+<FONT color="green">373</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.373"></a>
+<FONT color="green">374</FONT>                data[i] = data[i].divide(d);<a name="line.374"></a>
+<FONT color="green">375</FONT>            }<a name="line.375"></a>
+<FONT color="green">376</FONT>            return this;<a name="line.376"></a>
+<FONT color="green">377</FONT>        }<a name="line.377"></a>
+<FONT color="green">378</FONT>    <a name="line.378"></a>
+<FONT color="green">379</FONT>        /** {@inheritDoc} */<a name="line.379"></a>
+<FONT color="green">380</FONT>        public FieldVector&lt;T&gt; mapInv() {<a name="line.380"></a>
+<FONT color="green">381</FONT>            T[] out = buildArray(data.length);<a name="line.381"></a>
+<FONT color="green">382</FONT>            final T one = field.getOne();<a name="line.382"></a>
+<FONT color="green">383</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.383"></a>
+<FONT color="green">384</FONT>                out[i] = one.divide(data[i]);<a name="line.384"></a>
+<FONT color="green">385</FONT>            }<a name="line.385"></a>
+<FONT color="green">386</FONT>            return new ArrayFieldVector&lt;T&gt;(out);<a name="line.386"></a>
+<FONT color="green">387</FONT>        }<a name="line.387"></a>
+<FONT color="green">388</FONT>    <a name="line.388"></a>
+<FONT color="green">389</FONT>        /** {@inheritDoc} */<a name="line.389"></a>
+<FONT color="green">390</FONT>        public FieldVector&lt;T&gt; mapInvToSelf() {<a name="line.390"></a>
+<FONT color="green">391</FONT>            final T one = field.getOne();<a name="line.391"></a>
+<FONT color="green">392</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.392"></a>
+<FONT color="green">393</FONT>                data[i] = one.divide(data[i]);<a name="line.393"></a>
+<FONT color="green">394</FONT>            }<a name="line.394"></a>
+<FONT color="green">395</FONT>            return this;<a name="line.395"></a>
+<FONT color="green">396</FONT>        }<a name="line.396"></a>
+<FONT color="green">397</FONT>    <a name="line.397"></a>
+<FONT color="green">398</FONT>        /** {@inheritDoc} */<a name="line.398"></a>
+<FONT color="green">399</FONT>        public FieldVector&lt;T&gt; ebeMultiply(FieldVector&lt;T&gt; v)<a name="line.399"></a>
+<FONT color="green">400</FONT>            throws IllegalArgumentException {<a name="line.400"></a>
+<FONT color="green">401</FONT>            try {<a name="line.401"></a>
+<FONT color="green">402</FONT>                return ebeMultiply((ArrayFieldVector&lt;T&gt;) v);<a name="line.402"></a>
+<FONT color="green">403</FONT>            } catch (ClassCastException cce) {<a name="line.403"></a>
+<FONT color="green">404</FONT>                checkVectorDimensions(v);<a name="line.404"></a>
+<FONT color="green">405</FONT>                T[] out = buildArray(data.length);<a name="line.405"></a>
+<FONT color="green">406</FONT>                for (int i = 0; i &lt; data.length; i++) {<a name="line.406"></a>
+<FONT color="green">407</FONT>                    out[i] = data[i].multiply(v.getEntry(i));<a name="line.407"></a>
+<FONT color="green">408</FONT>                }<a name="line.408"></a>
+<FONT color="green">409</FONT>                return new ArrayFieldVector&lt;T&gt;(out);<a name="line.409"></a>
+<FONT color="green">410</FONT>            }<a name="line.410"></a>
+<FONT color="green">411</FONT>        }<a name="line.411"></a>
+<FONT color="green">412</FONT>    <a name="line.412"></a>
+<FONT color="green">413</FONT>        /** {@inheritDoc} */<a name="line.413"></a>
+<FONT color="green">414</FONT>        public FieldVector&lt;T&gt; ebeMultiply(T[] v)<a name="line.414"></a>
+<FONT color="green">415</FONT>            throws IllegalArgumentException {<a name="line.415"></a>
+<FONT color="green">416</FONT>            checkVectorDimensions(v.length);<a name="line.416"></a>
+<FONT color="green">417</FONT>            T[] out = buildArray(data.length);<a name="line.417"></a>
+<FONT color="green">418</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.418"></a>
+<FONT color="green">419</FONT>                out[i] = data[i].multiply(v[i]);<a name="line.419"></a>
+<FONT color="green">420</FONT>            }<a name="line.420"></a>
+<FONT color="green">421</FONT>            return new ArrayFieldVector&lt;T&gt;(out);<a name="line.421"></a>
+<FONT color="green">422</FONT>        }<a name="line.422"></a>
+<FONT color="green">423</FONT>    <a name="line.423"></a>
+<FONT color="green">424</FONT>        /**<a name="line.424"></a>
+<FONT color="green">425</FONT>         * Element-by-element multiplication.<a name="line.425"></a>
+<FONT color="green">426</FONT>         * @param v vector by which instance elements must be multiplied<a name="line.426"></a>
+<FONT color="green">427</FONT>         * @return a vector containing this[i] * v[i] for all i<a name="line.427"></a>
+<FONT color="green">428</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.428"></a>
+<FONT color="green">429</FONT>         */<a name="line.429"></a>
+<FONT color="green">430</FONT>        public ArrayFieldVector&lt;T&gt; ebeMultiply(ArrayFieldVector&lt;T&gt; v)<a name="line.430"></a>
+<FONT color="green">431</FONT>            throws IllegalArgumentException {<a name="line.431"></a>
+<FONT color="green">432</FONT>            return (ArrayFieldVector&lt;T&gt;) ebeMultiply(v.data);<a name="line.432"></a>
+<FONT color="green">433</FONT>        }<a name="line.433"></a>
+<FONT color="green">434</FONT>    <a name="line.434"></a>
+<FONT color="green">435</FONT>        /** {@inheritDoc} */<a name="line.435"></a>
+<FONT color="green">436</FONT>        public FieldVector&lt;T&gt; ebeDivide(FieldVector&lt;T&gt; v)<a name="line.436"></a>
+<FONT color="green">437</FONT>            throws IllegalArgumentException {<a name="line.437"></a>
+<FONT color="green">438</FONT>            try {<a name="line.438"></a>
+<FONT color="green">439</FONT>                return ebeDivide((ArrayFieldVector&lt;T&gt;) v);<a name="line.439"></a>
+<FONT color="green">440</FONT>            } catch (ClassCastException cce) {<a name="line.440"></a>
+<FONT color="green">441</FONT>                checkVectorDimensions(v);<a name="line.441"></a>
+<FONT color="green">442</FONT>                T[] out = buildArray(data.length);<a name="line.442"></a>
+<FONT color="green">443</FONT>                for (int i = 0; i &lt; data.length; i++) {<a name="line.443"></a>
+<FONT color="green">444</FONT>                    out[i] = data[i].divide(v.getEntry(i));<a name="line.444"></a>
+<FONT color="green">445</FONT>                }<a name="line.445"></a>
+<FONT color="green">446</FONT>                return new ArrayFieldVector&lt;T&gt;(out);<a name="line.446"></a>
+<FONT color="green">447</FONT>            }<a name="line.447"></a>
+<FONT color="green">448</FONT>        }<a name="line.448"></a>
+<FONT color="green">449</FONT>    <a name="line.449"></a>
+<FONT color="green">450</FONT>        /** {@inheritDoc} */<a name="line.450"></a>
+<FONT color="green">451</FONT>        public FieldVector&lt;T&gt; ebeDivide(T[] v)<a name="line.451"></a>
+<FONT color="green">452</FONT>            throws IllegalArgumentException {<a name="line.452"></a>
+<FONT color="green">453</FONT>            checkVectorDimensions(v.length);<a name="line.453"></a>
+<FONT color="green">454</FONT>            T[] out = buildArray(data.length);<a name="line.454"></a>
+<FONT color="green">455</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.455"></a>
+<FONT color="green">456</FONT>                    out[i] = data[i].divide(v[i]);<a name="line.456"></a>
+<FONT color="green">457</FONT>            }<a name="line.457"></a>
+<FONT color="green">458</FONT>            return new ArrayFieldVector&lt;T&gt;(out);<a name="line.458"></a>
+<FONT color="green">459</FONT>        }<a name="line.459"></a>
+<FONT color="green">460</FONT>    <a name="line.460"></a>
+<FONT color="green">461</FONT>        /**<a name="line.461"></a>
+<FONT color="green">462</FONT>         * Element-by-element division.<a name="line.462"></a>
+<FONT color="green">463</FONT>         * @param v vector by which instance elements must be divided<a name="line.463"></a>
+<FONT color="green">464</FONT>         * @return a vector containing this[i] / v[i] for all i<a name="line.464"></a>
+<FONT color="green">465</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.465"></a>
+<FONT color="green">466</FONT>         */<a name="line.466"></a>
+<FONT color="green">467</FONT>        public ArrayFieldVector&lt;T&gt; ebeDivide(ArrayFieldVector&lt;T&gt; v)<a name="line.467"></a>
+<FONT color="green">468</FONT>            throws IllegalArgumentException {<a name="line.468"></a>
+<FONT color="green">469</FONT>            return (ArrayFieldVector&lt;T&gt;) ebeDivide(v.data);<a name="line.469"></a>
+<FONT color="green">470</FONT>        }<a name="line.470"></a>
+<FONT color="green">471</FONT>    <a name="line.471"></a>
+<FONT color="green">472</FONT>        /** {@inheritDoc} */<a name="line.472"></a>
+<FONT color="green">473</FONT>        public T[] getData() {<a name="line.473"></a>
+<FONT color="green">474</FONT>            return data.clone();<a name="line.474"></a>
+<FONT color="green">475</FONT>        }<a name="line.475"></a>
+<FONT color="green">476</FONT>    <a name="line.476"></a>
+<FONT color="green">477</FONT>        /**<a name="line.477"></a>
+<FONT color="green">478</FONT>         * Returns a reference to the underlying data array.<a name="line.478"></a>
+<FONT color="green">479</FONT>         * &lt;p&gt;Does not make a fresh copy of the underlying data.&lt;/p&gt;<a name="line.479"></a>
+<FONT color="green">480</FONT>         * @return array of entries<a name="line.480"></a>
+<FONT color="green">481</FONT>         */<a name="line.481"></a>
+<FONT color="green">482</FONT>        public T[] getDataRef() {<a name="line.482"></a>
+<FONT color="green">483</FONT>            return data;<a name="line.483"></a>
+<FONT color="green">484</FONT>        }<a name="line.484"></a>
+<FONT color="green">485</FONT>    <a name="line.485"></a>
+<FONT color="green">486</FONT>        /** {@inheritDoc} */<a name="line.486"></a>
+<FONT color="green">487</FONT>        public T dotProduct(FieldVector&lt;T&gt; v)<a name="line.487"></a>
+<FONT color="green">488</FONT>            throws IllegalArgumentException {<a name="line.488"></a>
+<FONT color="green">489</FONT>            try {<a name="line.489"></a>
+<FONT color="green">490</FONT>                return dotProduct((ArrayFieldVector&lt;T&gt;) v);<a name="line.490"></a>
+<FONT color="green">491</FONT>            } catch (ClassCastException cce) {<a name="line.491"></a>
+<FONT color="green">492</FONT>                checkVectorDimensions(v);<a name="line.492"></a>
+<FONT color="green">493</FONT>                T dot = field.getZero();<a name="line.493"></a>
+<FONT color="green">494</FONT>                for (int i = 0; i &lt; data.length; i++) {<a name="line.494"></a>
+<FONT color="green">495</FONT>                    dot = dot.add(data[i].multiply(v.getEntry(i)));<a name="line.495"></a>
+<FONT color="green">496</FONT>                }<a name="line.496"></a>
+<FONT color="green">497</FONT>                return dot;<a name="line.497"></a>
+<FONT color="green">498</FONT>            }<a name="line.498"></a>
+<FONT color="green">499</FONT>        }<a name="line.499"></a>
+<FONT color="green">500</FONT>    <a name="line.500"></a>
+<FONT color="green">501</FONT>        /** {@inheritDoc} */<a name="line.501"></a>
+<FONT color="green">502</FONT>        public T dotProduct(T[] v)<a name="line.502"></a>
+<FONT color="green">503</FONT>            throws IllegalArgumentException {<a name="line.503"></a>
+<FONT color="green">504</FONT>            checkVectorDimensions(v.length);<a name="line.504"></a>
+<FONT color="green">505</FONT>            T dot = field.getZero();<a name="line.505"></a>
+<FONT color="green">506</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.506"></a>
+<FONT color="green">507</FONT>                dot = dot.add(data[i].multiply(v[i]));<a name="line.507"></a>
+<FONT color="green">508</FONT>            }<a name="line.508"></a>
+<FONT color="green">509</FONT>            return dot;<a name="line.509"></a>
+<FONT color="green">510</FONT>        }<a name="line.510"></a>
+<FONT color="green">511</FONT>    <a name="line.511"></a>
+<FONT color="green">512</FONT>        /**<a name="line.512"></a>
+<FONT color="green">513</FONT>         * Compute the dot product.<a name="line.513"></a>
+<FONT color="green">514</FONT>         * @param v vector with which dot product should be computed<a name="line.514"></a>
+<FONT color="green">515</FONT>         * @return the scalar dot product between instance and v<a name="line.515"></a>
+<FONT color="green">516</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.516"></a>
+<FONT color="green">517</FONT>         */<a name="line.517"></a>
+<FONT color="green">518</FONT>        public T dotProduct(ArrayFieldVector&lt;T&gt; v)<a name="line.518"></a>
+<FONT color="green">519</FONT>            throws IllegalArgumentException {<a name="line.519"></a>
+<FONT color="green">520</FONT>            return dotProduct(v.data);<a name="line.520"></a>
+<FONT color="green">521</FONT>        }<a name="line.521"></a>
+<FONT color="green">522</FONT>    <a name="line.522"></a>
+<FONT color="green">523</FONT>        /** {@inheritDoc} */<a name="line.523"></a>
+<FONT color="green">524</FONT>        public FieldVector&lt;T&gt; projection(FieldVector&lt;T&gt; v) {<a name="line.524"></a>
+<FONT color="green">525</FONT>            return v.mapMultiply(dotProduct(v).divide(v.dotProduct(v)));<a name="line.525"></a>
+<FONT color="green">526</FONT>        }<a name="line.526"></a>
+<FONT color="green">527</FONT>    <a name="line.527"></a>
+<FONT color="green">528</FONT>        /** {@inheritDoc} */<a name="line.528"></a>
+<FONT color="green">529</FONT>        public FieldVector&lt;T&gt; projection(T[] v) {<a name="line.529"></a>
+<FONT color="green">530</FONT>            return projection(new ArrayFieldVector&lt;T&gt;(v, false));<a name="line.530"></a>
+<FONT color="green">531</FONT>        }<a name="line.531"></a>
+<FONT color="green">532</FONT>    <a name="line.532"></a>
+<FONT color="green">533</FONT>       /** Find the orthogonal projection of this vector onto another vector.<a name="line.533"></a>
+<FONT color="green">534</FONT>         * @param v vector onto which instance must be projected<a name="line.534"></a>
+<FONT color="green">535</FONT>         * @return projection of the instance onto v<a name="line.535"></a>
+<FONT color="green">536</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.536"></a>
+<FONT color="green">537</FONT>         */<a name="line.537"></a>
+<FONT color="green">538</FONT>        public ArrayFieldVector&lt;T&gt; projection(ArrayFieldVector&lt;T&gt; v) {<a name="line.538"></a>
+<FONT color="green">539</FONT>            return (ArrayFieldVector&lt;T&gt;) v.mapMultiply(dotProduct(v).divide(v.dotProduct(v)));<a name="line.539"></a>
+<FONT color="green">540</FONT>        }<a name="line.540"></a>
+<FONT color="green">541</FONT>    <a name="line.541"></a>
+<FONT color="green">542</FONT>        /** {@inheritDoc} */<a name="line.542"></a>
+<FONT color="green">543</FONT>        public FieldMatrix&lt;T&gt; outerProduct(FieldVector&lt;T&gt; v)<a name="line.543"></a>
+<FONT color="green">544</FONT>            throws IllegalArgumentException {<a name="line.544"></a>
+<FONT color="green">545</FONT>            try {<a name="line.545"></a>
+<FONT color="green">546</FONT>                return outerProduct((ArrayFieldVector&lt;T&gt;) v);<a name="line.546"></a>
+<FONT color="green">547</FONT>            } catch (ClassCastException cce) {<a name="line.547"></a>
+<FONT color="green">548</FONT>                checkVectorDimensions(v);<a name="line.548"></a>
+<FONT color="green">549</FONT>                final int m = data.length;<a name="line.549"></a>
+<FONT color="green">550</FONT>                final FieldMatrix&lt;T&gt; out = new Array2DRowFieldMatrix&lt;T&gt;(field, m, m);<a name="line.550"></a>
+<FONT color="green">551</FONT>                for (int i = 0; i &lt; data.length; i++) {<a name="line.551"></a>
+<FONT color="green">552</FONT>                    for (int j = 0; j &lt; data.length; j++) {<a name="line.552"></a>
+<FONT color="green">553</FONT>                        out.setEntry(i, j, data[i].multiply(v.getEntry(j)));<a name="line.553"></a>
+<FONT color="green">554</FONT>                    }<a name="line.554"></a>
+<FONT color="green">555</FONT>                }<a name="line.555"></a>
+<FONT color="green">556</FONT>                return out;<a name="line.556"></a>
+<FONT color="green">557</FONT>            }<a name="line.557"></a>
+<FONT color="green">558</FONT>        }<a name="line.558"></a>
+<FONT color="green">559</FONT>    <a name="line.559"></a>
+<FONT color="green">560</FONT>        /**<a name="line.560"></a>
+<FONT color="green">561</FONT>         * Compute the outer product.<a name="line.561"></a>
+<FONT color="green">562</FONT>         * @param v vector with which outer product should be computed<a name="line.562"></a>
+<FONT color="green">563</FONT>         * @return the square matrix outer product between instance and v<a name="line.563"></a>
+<FONT color="green">564</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.564"></a>
+<FONT color="green">565</FONT>         */<a name="line.565"></a>
+<FONT color="green">566</FONT>        public FieldMatrix&lt;T&gt; outerProduct(ArrayFieldVector&lt;T&gt; v)<a name="line.566"></a>
+<FONT color="green">567</FONT>            throws IllegalArgumentException {<a name="line.567"></a>
+<FONT color="green">568</FONT>            return outerProduct(v.data);<a name="line.568"></a>
+<FONT color="green">569</FONT>        }<a name="line.569"></a>
+<FONT color="green">570</FONT>    <a name="line.570"></a>
+<FONT color="green">571</FONT>        /** {@inheritDoc} */<a name="line.571"></a>
+<FONT color="green">572</FONT>        public FieldMatrix&lt;T&gt; outerProduct(T[] v)<a name="line.572"></a>
+<FONT color="green">573</FONT>            throws IllegalArgumentException {<a name="line.573"></a>
+<FONT color="green">574</FONT>            checkVectorDimensions(v.length);<a name="line.574"></a>
+<FONT color="green">575</FONT>            final int m = data.length;<a name="line.575"></a>
+<FONT color="green">576</FONT>            final FieldMatrix&lt;T&gt; out = new Array2DRowFieldMatrix&lt;T&gt;(field, m, m);<a name="line.576"></a>
+<FONT color="green">577</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.577"></a>
+<FONT color="green">578</FONT>                for (int j = 0; j &lt; data.length; j++) {<a name="line.578"></a>
+<FONT color="green">579</FONT>                    out.setEntry(i, j, data[i].multiply(v[j]));<a name="line.579"></a>
+<FONT color="green">580</FONT>                }<a name="line.580"></a>
+<FONT color="green">581</FONT>            }<a name="line.581"></a>
+<FONT color="green">582</FONT>            return out;<a name="line.582"></a>
+<FONT color="green">583</FONT>        }<a name="line.583"></a>
+<FONT color="green">584</FONT>    <a name="line.584"></a>
+<FONT color="green">585</FONT>        /** {@inheritDoc} */<a name="line.585"></a>
+<FONT color="green">586</FONT>        public T getEntry(int index) throws MatrixIndexException {<a name="line.586"></a>
+<FONT color="green">587</FONT>            return data[index];<a name="line.587"></a>
+<FONT color="green">588</FONT>        }<a name="line.588"></a>
+<FONT color="green">589</FONT>    <a name="line.589"></a>
+<FONT color="green">590</FONT>        /** {@inheritDoc} */<a name="line.590"></a>
+<FONT color="green">591</FONT>        public int getDimension() {<a name="line.591"></a>
+<FONT color="green">592</FONT>            return data.length;<a name="line.592"></a>
+<FONT color="green">593</FONT>        }<a name="line.593"></a>
+<FONT color="green">594</FONT>    <a name="line.594"></a>
+<FONT color="green">595</FONT>        /** {@inheritDoc} */<a name="line.595"></a>
+<FONT color="green">596</FONT>        public FieldVector&lt;T&gt; append(FieldVector&lt;T&gt; v) {<a name="line.596"></a>
+<FONT color="green">597</FONT>            try {<a name="line.597"></a>
+<FONT color="green">598</FONT>                return append((ArrayFieldVector&lt;T&gt;) v);<a name="line.598"></a>
+<FONT color="green">599</FONT>            } catch (ClassCastException cce) {<a name="line.599"></a>
+<FONT color="green">600</FONT>                return new ArrayFieldVector&lt;T&gt;(this,new ArrayFieldVector&lt;T&gt;(v));<a name="line.600"></a>
+<FONT color="green">601</FONT>            }<a name="line.601"></a>
+<FONT color="green">602</FONT>        }<a name="line.602"></a>
+<FONT color="green">603</FONT>    <a name="line.603"></a>
+<FONT color="green">604</FONT>        /**<a name="line.604"></a>
+<FONT color="green">605</FONT>         * Construct a vector by appending a vector to this vector.<a name="line.605"></a>
+<FONT color="green">606</FONT>         * @param v vector to append to this one.<a name="line.606"></a>
+<FONT color="green">607</FONT>         * @return a new vector<a name="line.607"></a>
+<FONT color="green">608</FONT>         */<a name="line.608"></a>
+<FONT color="green">609</FONT>        public ArrayFieldVector&lt;T&gt; append(ArrayFieldVector&lt;T&gt; v) {<a name="line.609"></a>
+<FONT color="green">610</FONT>            return new ArrayFieldVector&lt;T&gt;(this, v);<a name="line.610"></a>
+<FONT color="green">611</FONT>        }<a name="line.611"></a>
+<FONT color="green">612</FONT>    <a name="line.612"></a>
+<FONT color="green">613</FONT>        /** {@inheritDoc} */<a name="line.613"></a>
+<FONT color="green">614</FONT>        public FieldVector&lt;T&gt; append(T in) {<a name="line.614"></a>
+<FONT color="green">615</FONT>            final T[] out = buildArray(data.length + 1);<a name="line.615"></a>
+<FONT color="green">616</FONT>            System.arraycopy(data, 0, out, 0, data.length);<a name="line.616"></a>
+<FONT color="green">617</FONT>            out[data.length] = in;<a name="line.617"></a>
+<FONT color="green">618</FONT>            return new ArrayFieldVector&lt;T&gt;(out);<a name="line.618"></a>
+<FONT color="green">619</FONT>        }<a name="line.619"></a>
+<FONT color="green">620</FONT>    <a name="line.620"></a>
+<FONT color="green">621</FONT>        /** {@inheritDoc} */<a name="line.621"></a>
+<FONT color="green">622</FONT>        public FieldVector&lt;T&gt; append(T[] in) {<a name="line.622"></a>
+<FONT color="green">623</FONT>            return new ArrayFieldVector&lt;T&gt;(this, in);<a name="line.623"></a>
+<FONT color="green">624</FONT>        }<a name="line.624"></a>
+<FONT color="green">625</FONT>    <a name="line.625"></a>
+<FONT color="green">626</FONT>        /** {@inheritDoc} */<a name="line.626"></a>
+<FONT color="green">627</FONT>        public FieldVector&lt;T&gt; getSubVector(int index, int n) {<a name="line.627"></a>
+<FONT color="green">628</FONT>            ArrayFieldVector&lt;T&gt; out = new ArrayFieldVector&lt;T&gt;(field, n);<a name="line.628"></a>
+<FONT color="green">629</FONT>            try {<a name="line.629"></a>
+<FONT color="green">630</FONT>                System.arraycopy(data, index, out.data, 0, n);<a name="line.630"></a>
+<FONT color="green">631</FONT>            } catch (IndexOutOfBoundsException e) {<a name="line.631"></a>
+<FONT color="green">632</FONT>                checkIndex(index);<a name="line.632"></a>
+<FONT color="green">633</FONT>                checkIndex(index + n - 1);<a name="line.633"></a>
+<FONT color="green">634</FONT>            }<a name="line.634"></a>
+<FONT color="green">635</FONT>            return out;<a name="line.635"></a>
+<FONT color="green">636</FONT>        }<a name="line.636"></a>
+<FONT color="green">637</FONT>    <a name="line.637"></a>
+<FONT color="green">638</FONT>        /** {@inheritDoc} */<a name="line.638"></a>
+<FONT color="green">639</FONT>        public void setEntry(int index, T value) {<a name="line.639"></a>
+<FONT color="green">640</FONT>            try {<a name="line.640"></a>
+<FONT color="green">641</FONT>                data[index] = value;<a name="line.641"></a>
+<FONT color="green">642</FONT>            } catch (IndexOutOfBoundsException e) {<a name="line.642"></a>
+<FONT color="green">643</FONT>                checkIndex(index);<a name="line.643"></a>
+<FONT color="green">644</FONT>            }<a name="line.644"></a>
+<FONT color="green">645</FONT>        }<a name="line.645"></a>
+<FONT color="green">646</FONT>    <a name="line.646"></a>
+<FONT color="green">647</FONT>        /** {@inheritDoc} */<a name="line.647"></a>
+<FONT color="green">648</FONT>        public void setSubVector(int index, FieldVector&lt;T&gt; v) {<a name="line.648"></a>
+<FONT color="green">649</FONT>            try {<a name="line.649"></a>
+<FONT color="green">650</FONT>                try {<a name="line.650"></a>
+<FONT color="green">651</FONT>                    set(index, (ArrayFieldVector&lt;T&gt;) v);<a name="line.651"></a>
+<FONT color="green">652</FONT>                } catch (ClassCastException cce) {<a name="line.652"></a>
+<FONT color="green">653</FONT>                    for (int i = index; i &lt; index + v.getDimension(); ++i) {<a name="line.653"></a>
+<FONT color="green">654</FONT>                        data[i] = v.getEntry(i-index);<a name="line.654"></a>
+<FONT color="green">655</FONT>                    }<a name="line.655"></a>
+<FONT color="green">656</FONT>                }<a name="line.656"></a>
+<FONT color="green">657</FONT>            } catch (IndexOutOfBoundsException e) {<a name="line.657"></a>
+<FONT color="green">658</FONT>                checkIndex(index);<a name="line.658"></a>
+<FONT color="green">659</FONT>                checkIndex(index + v.getDimension() - 1);<a name="line.659"></a>
+<FONT color="green">660</FONT>            }<a name="line.660"></a>
+<FONT color="green">661</FONT>        }<a name="line.661"></a>
+<FONT color="green">662</FONT>    <a name="line.662"></a>
+<FONT color="green">663</FONT>        /** {@inheritDoc} */<a name="line.663"></a>
+<FONT color="green">664</FONT>        public void setSubVector(int index, T[] v) {<a name="line.664"></a>
+<FONT color="green">665</FONT>            try {<a name="line.665"></a>
+<FONT color="green">666</FONT>                System.arraycopy(v, 0, data, index, v.length);<a name="line.666"></a>
+<FONT color="green">667</FONT>            } catch (IndexOutOfBoundsException e) {<a name="line.667"></a>
+<FONT color="green">668</FONT>                checkIndex(index);<a name="line.668"></a>
+<FONT color="green">669</FONT>                checkIndex(index + v.length - 1);<a name="line.669"></a>
+<FONT color="green">670</FONT>            }<a name="line.670"></a>
+<FONT color="green">671</FONT>        }<a name="line.671"></a>
+<FONT color="green">672</FONT>    <a name="line.672"></a>
+<FONT color="green">673</FONT>        /**<a name="line.673"></a>
+<FONT color="green">674</FONT>         * Set a set of consecutive elements.<a name="line.674"></a>
+<FONT color="green">675</FONT>         *<a name="line.675"></a>
+<FONT color="green">676</FONT>         * @param index index of first element to be set.<a name="line.676"></a>
+<FONT color="green">677</FONT>         * @param v vector containing the values to set.<a name="line.677"></a>
+<FONT color="green">678</FONT>         * @exception MatrixIndexException if the index is<a name="line.678"></a>
+<FONT color="green">679</FONT>         * inconsistent with vector size<a name="line.679"></a>
+<FONT color="green">680</FONT>         */<a name="line.680"></a>
+<FONT color="green">681</FONT>        public void set(int index, ArrayFieldVector&lt;T&gt; v)<a name="line.681"></a>
+<FONT color="green">682</FONT>            throws MatrixIndexException {<a name="line.682"></a>
+<FONT color="green">683</FONT>            setSubVector(index, v.data);<a name="line.683"></a>
+<FONT color="green">684</FONT>        }<a name="line.684"></a>
+<FONT color="green">685</FONT>    <a name="line.685"></a>
+<FONT color="green">686</FONT>        /** {@inheritDoc} */<a name="line.686"></a>
+<FONT color="green">687</FONT>        public void set(T value) {<a name="line.687"></a>
+<FONT color="green">688</FONT>            Arrays.fill(data, value);<a name="line.688"></a>
+<FONT color="green">689</FONT>        }<a name="line.689"></a>
+<FONT color="green">690</FONT>    <a name="line.690"></a>
+<FONT color="green">691</FONT>        /** {@inheritDoc} */<a name="line.691"></a>
+<FONT color="green">692</FONT>        public T[] toArray(){<a name="line.692"></a>
+<FONT color="green">693</FONT>            return data.clone();<a name="line.693"></a>
+<FONT color="green">694</FONT>        }<a name="line.694"></a>
+<FONT color="green">695</FONT>    <a name="line.695"></a>
+<FONT color="green">696</FONT>        /**<a name="line.696"></a>
+<FONT color="green">697</FONT>         * Check if instance and specified vectors have the same dimension.<a name="line.697"></a>
+<FONT color="green">698</FONT>         * @param v vector to compare instance with<a name="line.698"></a>
+<FONT color="green">699</FONT>         * @exception IllegalArgumentException if the vectors do not<a name="line.699"></a>
+<FONT color="green">700</FONT>         * have the same dimension<a name="line.700"></a>
+<FONT color="green">701</FONT>         */<a name="line.701"></a>
+<FONT color="green">702</FONT>        protected void checkVectorDimensions(FieldVector&lt;T&gt; v)<a name="line.702"></a>
+<FONT color="green">703</FONT>            throws IllegalArgumentException {<a name="line.703"></a>
+<FONT color="green">704</FONT>            checkVectorDimensions(v.getDimension());<a name="line.704"></a>
+<FONT color="green">705</FONT>        }<a name="line.705"></a>
+<FONT color="green">706</FONT>    <a name="line.706"></a>
+<FONT color="green">707</FONT>        /**<a name="line.707"></a>
+<FONT color="green">708</FONT>         * Check if instance dimension is equal to some expected value.<a name="line.708"></a>
+<FONT color="green">709</FONT>         *<a name="line.709"></a>
+<FONT color="green">710</FONT>         * @param n expected dimension.<a name="line.710"></a>
+<FONT color="green">711</FONT>         * @exception IllegalArgumentException if the dimension is<a name="line.711"></a>
+<FONT color="green">712</FONT>         * inconsistent with vector size<a name="line.712"></a>
+<FONT color="green">713</FONT>         */<a name="line.713"></a>
+<FONT color="green">714</FONT>        protected void checkVectorDimensions(int n)<a name="line.714"></a>
+<FONT color="green">715</FONT>            throws IllegalArgumentException {<a name="line.715"></a>
+<FONT color="green">716</FONT>            if (data.length != n) {<a name="line.716"></a>
+<FONT color="green">717</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.717"></a>
+<FONT color="green">718</FONT>                        "vector length mismatch: got {0} but expected {1}",<a name="line.718"></a>
+<FONT color="green">719</FONT>                        data.length, n);<a name="line.719"></a>
+<FONT color="green">720</FONT>            }<a name="line.720"></a>
+<FONT color="green">721</FONT>        }<a name="line.721"></a>
+<FONT color="green">722</FONT>    <a name="line.722"></a>
+<FONT color="green">723</FONT>        /**<a name="line.723"></a>
+<FONT color="green">724</FONT>         * Test for the equality of two real vectors.<a name="line.724"></a>
+<FONT color="green">725</FONT>         * &lt;p&gt;<a name="line.725"></a>
+<FONT color="green">726</FONT>         * If all coordinates of two real vectors are exactly the same, and none are<a name="line.726"></a>
+<FONT color="green">727</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt;, the two real vectors are considered to be equal.<a name="line.727"></a>
+<FONT color="green">728</FONT>         * &lt;/p&gt;<a name="line.728"></a>
+<FONT color="green">729</FONT>         * &lt;p&gt;<a name="line.729"></a>
+<FONT color="green">730</FONT>         * &lt;code&gt;NaN&lt;/code&gt; coordinates are considered to affect globally the vector<a name="line.730"></a>
+<FONT color="green">731</FONT>         * and be equals to each other - i.e, if either (or all) coordinates of the<a name="line.731"></a>
+<FONT color="green">732</FONT>         * real vector are equal to &lt;code&gt;Double.NaN&lt;/code&gt;, the real vector is equal to<a name="line.732"></a>
+<FONT color="green">733</FONT>         * a vector with all &lt;code&gt;Double.NaN&lt;/code&gt; coordinates.<a name="line.733"></a>
+<FONT color="green">734</FONT>         * &lt;/p&gt;<a name="line.734"></a>
+<FONT color="green">735</FONT>         *<a name="line.735"></a>
+<FONT color="green">736</FONT>         * @param other Object to test for equality to this<a name="line.736"></a>
+<FONT color="green">737</FONT>         * @return true if two 3D vector objects are equal, false if<a name="line.737"></a>
+<FONT color="green">738</FONT>         *         object is null, not an instance of Vector3D, or<a name="line.738"></a>
+<FONT color="green">739</FONT>         *         not equal to this Vector3D instance<a name="line.739"></a>
+<FONT color="green">740</FONT>         *<a name="line.740"></a>
+<FONT color="green">741</FONT>         */<a name="line.741"></a>
+<FONT color="green">742</FONT>        @Override<a name="line.742"></a>
+<FONT color="green">743</FONT>        public boolean equals(Object other) {<a name="line.743"></a>
+<FONT color="green">744</FONT>    <a name="line.744"></a>
+<FONT color="green">745</FONT>          if (this == other) {<a name="line.745"></a>
+<FONT color="green">746</FONT>            return true;<a name="line.746"></a>
+<FONT color="green">747</FONT>          }<a name="line.747"></a>
+<FONT color="green">748</FONT>    <a name="line.748"></a>
+<FONT color="green">749</FONT>          if (other == null) {<a name="line.749"></a>
+<FONT color="green">750</FONT>            return false;<a name="line.750"></a>
+<FONT color="green">751</FONT>          }<a name="line.751"></a>
+<FONT color="green">752</FONT>    <a name="line.752"></a>
+<FONT color="green">753</FONT>          try {<a name="line.753"></a>
+<FONT color="green">754</FONT>              @SuppressWarnings("unchecked") // May fail, but we ignore ClassCastException<a name="line.754"></a>
+<FONT color="green">755</FONT>              FieldVector&lt;T&gt; rhs = (FieldVector&lt;T&gt;) other;<a name="line.755"></a>
+<FONT color="green">756</FONT>              if (data.length != rhs.getDimension()) {<a name="line.756"></a>
+<FONT color="green">757</FONT>                  return false;<a name="line.757"></a>
+<FONT color="green">758</FONT>              }<a name="line.758"></a>
+<FONT color="green">759</FONT>    <a name="line.759"></a>
+<FONT color="green">760</FONT>              for (int i = 0; i &lt; data.length; ++i) {<a name="line.760"></a>
+<FONT color="green">761</FONT>                  if (!data[i].equals(rhs.getEntry(i))) {<a name="line.761"></a>
+<FONT color="green">762</FONT>                      return false;<a name="line.762"></a>
+<FONT color="green">763</FONT>                  }<a name="line.763"></a>
+<FONT color="green">764</FONT>              }<a name="line.764"></a>
+<FONT color="green">765</FONT>              return true;<a name="line.765"></a>
+<FONT color="green">766</FONT>    <a name="line.766"></a>
+<FONT color="green">767</FONT>          } catch (ClassCastException ex) {<a name="line.767"></a>
+<FONT color="green">768</FONT>              // ignore exception<a name="line.768"></a>
+<FONT color="green">769</FONT>              return false;<a name="line.769"></a>
+<FONT color="green">770</FONT>          }<a name="line.770"></a>
+<FONT color="green">771</FONT>    <a name="line.771"></a>
+<FONT color="green">772</FONT>        }<a name="line.772"></a>
+<FONT color="green">773</FONT>    <a name="line.773"></a>
+<FONT color="green">774</FONT>        /**<a name="line.774"></a>
+<FONT color="green">775</FONT>         * Get a hashCode for the real vector.<a name="line.775"></a>
+<FONT color="green">776</FONT>         * &lt;p&gt;All NaN values have the same hash code.&lt;/p&gt;<a name="line.776"></a>
+<FONT color="green">777</FONT>         * @return a hash code value for this object<a name="line.777"></a>
+<FONT color="green">778</FONT>         */<a name="line.778"></a>
+<FONT color="green">779</FONT>        @Override<a name="line.779"></a>
+<FONT color="green">780</FONT>        public int hashCode() {<a name="line.780"></a>
+<FONT color="green">781</FONT>            int h = 3542;<a name="line.781"></a>
+<FONT color="green">782</FONT>            for (final T a : data) {<a name="line.782"></a>
+<FONT color="green">783</FONT>                h = h ^ a.hashCode();<a name="line.783"></a>
+<FONT color="green">784</FONT>            }<a name="line.784"></a>
+<FONT color="green">785</FONT>            return h;<a name="line.785"></a>
+<FONT color="green">786</FONT>        }<a name="line.786"></a>
+<FONT color="green">787</FONT>    <a name="line.787"></a>
+<FONT color="green">788</FONT>        /**<a name="line.788"></a>
+<FONT color="green">789</FONT>         * Check if an index is valid.<a name="line.789"></a>
+<FONT color="green">790</FONT>         * @param index index to check<a name="line.790"></a>
+<FONT color="green">791</FONT>         * @exception MatrixIndexException if index is not valid<a name="line.791"></a>
+<FONT color="green">792</FONT>         */<a name="line.792"></a>
+<FONT color="green">793</FONT>        private void checkIndex(final int index)<a name="line.793"></a>
+<FONT color="green">794</FONT>            throws MatrixIndexException {<a name="line.794"></a>
+<FONT color="green">795</FONT>            if (index &lt; 0 || index &gt;= getDimension()) {<a name="line.795"></a>
+<FONT color="green">796</FONT>                throw new MatrixIndexException(<a name="line.796"></a>
+<FONT color="green">797</FONT>                        "index {0} out of allowed range [{1}, {2}]",<a name="line.797"></a>
+<FONT color="green">798</FONT>                        index, 0, getDimension() - 1);<a name="line.798"></a>
+<FONT color="green">799</FONT>            }<a name="line.799"></a>
+<FONT color="green">800</FONT>        }<a name="line.800"></a>
+<FONT color="green">801</FONT>    <a name="line.801"></a>
+<FONT color="green">802</FONT>    }<a name="line.802"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/ArrayRealVector.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,1305 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.linear;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.Iterator;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * This class implements the {@link RealVector} interface with a double array.<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @version $Revision: 902203 $ $Date: 2010-01-22 13:27:41 -0500 (Fri, 22 Jan 2010) $<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @since 2.0<a name="line.29"></a>
+<FONT color="green">030</FONT>     */<a name="line.30"></a>
+<FONT color="green">031</FONT>    public class ArrayRealVector extends AbstractRealVector implements Serializable {<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** Message for non fitting position and size. */<a name="line.33"></a>
+<FONT color="green">034</FONT>        private static final String NON_FITTING_POSITION_AND_SIZE_MESSAGE =<a name="line.34"></a>
+<FONT color="green">035</FONT>            "position {0} and size {1} don't fit to the size of the input array {2}";<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /** Serializable version identifier. */<a name="line.37"></a>
+<FONT color="green">038</FONT>        private static final long serialVersionUID = -1097961340710804027L;<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Default format. */<a name="line.40"></a>
+<FONT color="green">041</FONT>        private static final RealVectorFormat DEFAULT_FORMAT =<a name="line.41"></a>
+<FONT color="green">042</FONT>            RealVectorFormat.getInstance();<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Entries of the vector. */<a name="line.44"></a>
+<FONT color="green">045</FONT>        protected double data[];<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Build a 0-length vector.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * &lt;p&gt;Zero-length vectors may be used to initialized construction of vectors<a name="line.49"></a>
+<FONT color="green">050</FONT>         * by data gathering. We start with zero-length and use either the {@link<a name="line.50"></a>
+<FONT color="green">051</FONT>         * #ArrayRealVector(ArrayRealVector, ArrayRealVector)} constructor<a name="line.51"></a>
+<FONT color="green">052</FONT>         * or one of the &lt;code&gt;append&lt;/code&gt; method ({@link #append(double)}, {@link<a name="line.52"></a>
+<FONT color="green">053</FONT>         * #append(double[])}, {@link #append(ArrayRealVector)}) to gather data<a name="line.53"></a>
+<FONT color="green">054</FONT>         * into this vector.&lt;/p&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public ArrayRealVector() {<a name="line.56"></a>
+<FONT color="green">057</FONT>            data = new double[0];<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /**<a name="line.60"></a>
+<FONT color="green">061</FONT>         * Construct a (size)-length vector of zeros.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param size size of the vector<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public ArrayRealVector(int size) {<a name="line.64"></a>
+<FONT color="green">065</FONT>            data = new double[size];<a name="line.65"></a>
+<FONT color="green">066</FONT>        }<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /**<a name="line.68"></a>
+<FONT color="green">069</FONT>         * Construct an (size)-length vector with preset values.<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @param size size of the vector<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param preset fill the vector with this scalar value<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        public ArrayRealVector(int size, double preset) {<a name="line.73"></a>
+<FONT color="green">074</FONT>            data = new double[size];<a name="line.74"></a>
+<FONT color="green">075</FONT>            Arrays.fill(data, preset);<a name="line.75"></a>
+<FONT color="green">076</FONT>        }<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /**<a name="line.78"></a>
+<FONT color="green">079</FONT>         * Construct a vector from an array, copying the input array.<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @param d array of doubles.<a name="line.80"></a>
+<FONT color="green">081</FONT>         */<a name="line.81"></a>
+<FONT color="green">082</FONT>        public ArrayRealVector(double[] d) {<a name="line.82"></a>
+<FONT color="green">083</FONT>            data = d.clone();<a name="line.83"></a>
+<FONT color="green">084</FONT>        }<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /**<a name="line.86"></a>
+<FONT color="green">087</FONT>         * Create a new ArrayRealVector using the input array as the underlying<a name="line.87"></a>
+<FONT color="green">088</FONT>         * data array.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * &lt;p&gt;If an array is built specially in order to be embedded in a<a name="line.89"></a>
+<FONT color="green">090</FONT>         * ArrayRealVector and not used directly, the &lt;code&gt;copyArray&lt;/code&gt; may be<a name="line.90"></a>
+<FONT color="green">091</FONT>         * set to &lt;code&gt;false&lt;/code. This will prevent the copying and improve<a name="line.91"></a>
+<FONT color="green">092</FONT>         * performance as no new array will be built and no data will be copied.&lt;/p&gt;<a name="line.92"></a>
+<FONT color="green">093</FONT>         * @param d data for new vector<a name="line.93"></a>
+<FONT color="green">094</FONT>         * @param copyArray if true, the input array will be copied, otherwise<a name="line.94"></a>
+<FONT color="green">095</FONT>         * it will be referenced<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @throws IllegalArgumentException if &lt;code&gt;d&lt;/code&gt; is empty<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @throws NullPointerException if &lt;code&gt;d&lt;/code&gt; is null<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @see #ArrayRealVector(double[])<a name="line.98"></a>
+<FONT color="green">099</FONT>         */<a name="line.99"></a>
+<FONT color="green">100</FONT>        public ArrayRealVector(double[] d, boolean copyArray)<a name="line.100"></a>
+<FONT color="green">101</FONT>            throws NullPointerException, IllegalArgumentException {<a name="line.101"></a>
+<FONT color="green">102</FONT>            if (d == null) {<a name="line.102"></a>
+<FONT color="green">103</FONT>                throw new NullPointerException();<a name="line.103"></a>
+<FONT color="green">104</FONT>            }<a name="line.104"></a>
+<FONT color="green">105</FONT>            if (d.length == 0) {<a name="line.105"></a>
+<FONT color="green">106</FONT>                throw MathRuntimeException.createIllegalArgumentException("vector must have at least one element");<a name="line.106"></a>
+<FONT color="green">107</FONT>            }<a name="line.107"></a>
+<FONT color="green">108</FONT>            data = copyArray ? d.clone() :  d;<a name="line.108"></a>
+<FONT color="green">109</FONT>        }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /**<a name="line.111"></a>
+<FONT color="green">112</FONT>         * Construct a vector from part of a array.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param d array of doubles.<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param pos position of first entry<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @param size number of entries to copy<a name="line.115"></a>
+<FONT color="green">116</FONT>         */<a name="line.116"></a>
+<FONT color="green">117</FONT>        public ArrayRealVector(double[] d, int pos, int size) {<a name="line.117"></a>
+<FONT color="green">118</FONT>            if (d.length &lt; pos + size) {<a name="line.118"></a>
+<FONT color="green">119</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.119"></a>
+<FONT color="green">120</FONT>                      NON_FITTING_POSITION_AND_SIZE_MESSAGE, pos, size, d.length);<a name="line.120"></a>
+<FONT color="green">121</FONT>            }<a name="line.121"></a>
+<FONT color="green">122</FONT>            data = new double[size];<a name="line.122"></a>
+<FONT color="green">123</FONT>            System.arraycopy(d, pos, data, 0, size);<a name="line.123"></a>
+<FONT color="green">124</FONT>        }<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>        /**<a name="line.126"></a>
+<FONT color="green">127</FONT>         * Construct a vector from an array.<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @param d array of Doubles.<a name="line.128"></a>
+<FONT color="green">129</FONT>         */<a name="line.129"></a>
+<FONT color="green">130</FONT>        public ArrayRealVector(Double[] d) {<a name="line.130"></a>
+<FONT color="green">131</FONT>            data = new double[d.length];<a name="line.131"></a>
+<FONT color="green">132</FONT>            for (int i = 0; i &lt; d.length; i++) {<a name="line.132"></a>
+<FONT color="green">133</FONT>                data[i] = d[i].doubleValue();<a name="line.133"></a>
+<FONT color="green">134</FONT>            }<a name="line.134"></a>
+<FONT color="green">135</FONT>        }<a name="line.135"></a>
+<FONT color="green">136</FONT>    <a name="line.136"></a>
+<FONT color="green">137</FONT>        /**<a name="line.137"></a>
+<FONT color="green">138</FONT>         * Construct a vector from part of a Double array<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @param d array of Doubles.<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @param pos position of first entry<a name="line.140"></a>
+<FONT color="green">141</FONT>         * @param size number of entries to copy<a name="line.141"></a>
+<FONT color="green">142</FONT>         */<a name="line.142"></a>
+<FONT color="green">143</FONT>        public ArrayRealVector(Double[] d, int pos, int size) {<a name="line.143"></a>
+<FONT color="green">144</FONT>            if (d.length &lt; pos + size) {<a name="line.144"></a>
+<FONT color="green">145</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.145"></a>
+<FONT color="green">146</FONT>                      NON_FITTING_POSITION_AND_SIZE_MESSAGE, pos, size, d.length);<a name="line.146"></a>
+<FONT color="green">147</FONT>            }<a name="line.147"></a>
+<FONT color="green">148</FONT>            data = new double[size];<a name="line.148"></a>
+<FONT color="green">149</FONT>            for (int i = pos; i &lt; pos + size; i++) {<a name="line.149"></a>
+<FONT color="green">150</FONT>                data[i-pos] = d[i].doubleValue();<a name="line.150"></a>
+<FONT color="green">151</FONT>            }<a name="line.151"></a>
+<FONT color="green">152</FONT>        }<a name="line.152"></a>
+<FONT color="green">153</FONT>    <a name="line.153"></a>
+<FONT color="green">154</FONT>        /**<a name="line.154"></a>
+<FONT color="green">155</FONT>         * Construct a vector from another vector, using a deep copy.<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @param v vector to copy<a name="line.156"></a>
+<FONT color="green">157</FONT>         */<a name="line.157"></a>
+<FONT color="green">158</FONT>        public ArrayRealVector(RealVector v) {<a name="line.158"></a>
+<FONT color="green">159</FONT>            data = new double[v.getDimension()];<a name="line.159"></a>
+<FONT color="green">160</FONT>            for (int i = 0; i &lt; data.length; ++i) {<a name="line.160"></a>
+<FONT color="green">161</FONT>                data[i] = v.getEntry(i);<a name="line.161"></a>
+<FONT color="green">162</FONT>            }<a name="line.162"></a>
+<FONT color="green">163</FONT>        }<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>        /**<a name="line.165"></a>
+<FONT color="green">166</FONT>         * Construct a vector from another vector, using a deep copy.<a name="line.166"></a>
+<FONT color="green">167</FONT>         * @param v vector to copy<a name="line.167"></a>
+<FONT color="green">168</FONT>         */<a name="line.168"></a>
+<FONT color="green">169</FONT>        public ArrayRealVector(ArrayRealVector v) {<a name="line.169"></a>
+<FONT color="green">170</FONT>            this(v, true);<a name="line.170"></a>
+<FONT color="green">171</FONT>        }<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>        /**<a name="line.173"></a>
+<FONT color="green">174</FONT>         * Construct a vector from another vector.<a name="line.174"></a>
+<FONT color="green">175</FONT>         * @param v vector to copy<a name="line.175"></a>
+<FONT color="green">176</FONT>         * @param deep if true perform a deep copy otherwise perform a shallow copy<a name="line.176"></a>
+<FONT color="green">177</FONT>         */<a name="line.177"></a>
+<FONT color="green">178</FONT>        public ArrayRealVector(ArrayRealVector v, boolean deep) {<a name="line.178"></a>
+<FONT color="green">179</FONT>            data = deep ? v.data.clone() : v.data;<a name="line.179"></a>
+<FONT color="green">180</FONT>        }<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>        /**<a name="line.182"></a>
+<FONT color="green">183</FONT>         * Construct a vector by appending one vector to another vector.<a name="line.183"></a>
+<FONT color="green">184</FONT>         * @param v1 first vector (will be put in front of the new vector)<a name="line.184"></a>
+<FONT color="green">185</FONT>         * @param v2 second vector (will be put at back of the new vector)<a name="line.185"></a>
+<FONT color="green">186</FONT>         */<a name="line.186"></a>
+<FONT color="green">187</FONT>        public ArrayRealVector(ArrayRealVector v1, ArrayRealVector v2) {<a name="line.187"></a>
+<FONT color="green">188</FONT>            data = new double[v1.data.length + v2.data.length];<a name="line.188"></a>
+<FONT color="green">189</FONT>            System.arraycopy(v1.data, 0, data, 0, v1.data.length);<a name="line.189"></a>
+<FONT color="green">190</FONT>            System.arraycopy(v2.data, 0, data, v1.data.length, v2.data.length);<a name="line.190"></a>
+<FONT color="green">191</FONT>        }<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>        /**<a name="line.193"></a>
+<FONT color="green">194</FONT>         * Construct a vector by appending one vector to another vector.<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @param v1 first vector (will be put in front of the new vector)<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @param v2 second vector (will be put at back of the new vector)<a name="line.196"></a>
+<FONT color="green">197</FONT>         */<a name="line.197"></a>
+<FONT color="green">198</FONT>        public ArrayRealVector(ArrayRealVector v1, RealVector v2) {<a name="line.198"></a>
+<FONT color="green">199</FONT>            final int l1 = v1.data.length;<a name="line.199"></a>
+<FONT color="green">200</FONT>            final int l2 = v2.getDimension();<a name="line.200"></a>
+<FONT color="green">201</FONT>            data = new double[l1 + l2];<a name="line.201"></a>
+<FONT color="green">202</FONT>            System.arraycopy(v1.data, 0, data, 0, l1);<a name="line.202"></a>
+<FONT color="green">203</FONT>            for (int i = 0; i &lt; l2; ++i) {<a name="line.203"></a>
+<FONT color="green">204</FONT>                data[l1 + i] = v2.getEntry(i);<a name="line.204"></a>
+<FONT color="green">205</FONT>            }<a name="line.205"></a>
+<FONT color="green">206</FONT>        }<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>        /**<a name="line.208"></a>
+<FONT color="green">209</FONT>         * Construct a vector by appending one vector to another vector.<a name="line.209"></a>
+<FONT color="green">210</FONT>         * @param v1 first vector (will be put in front of the new vector)<a name="line.210"></a>
+<FONT color="green">211</FONT>         * @param v2 second vector (will be put at back of the new vector)<a name="line.211"></a>
+<FONT color="green">212</FONT>         */<a name="line.212"></a>
+<FONT color="green">213</FONT>        public ArrayRealVector(RealVector v1, ArrayRealVector v2) {<a name="line.213"></a>
+<FONT color="green">214</FONT>            final int l1 = v1.getDimension();<a name="line.214"></a>
+<FONT color="green">215</FONT>            final int l2 = v2.data.length;<a name="line.215"></a>
+<FONT color="green">216</FONT>            data = new double[l1 + l2];<a name="line.216"></a>
+<FONT color="green">217</FONT>            for (int i = 0; i &lt; l1; ++i) {<a name="line.217"></a>
+<FONT color="green">218</FONT>                data[i] = v1.getEntry(i);<a name="line.218"></a>
+<FONT color="green">219</FONT>            }<a name="line.219"></a>
+<FONT color="green">220</FONT>            System.arraycopy(v2.data, 0, data, l1, l2);<a name="line.220"></a>
+<FONT color="green">221</FONT>        }<a name="line.221"></a>
+<FONT color="green">222</FONT>    <a name="line.222"></a>
+<FONT color="green">223</FONT>        /**<a name="line.223"></a>
+<FONT color="green">224</FONT>         * Construct a vector by appending one vector to another vector.<a name="line.224"></a>
+<FONT color="green">225</FONT>         * @param v1 first vector (will be put in front of the new vector)<a name="line.225"></a>
+<FONT color="green">226</FONT>         * @param v2 second vector (will be put at back of the new vector)<a name="line.226"></a>
+<FONT color="green">227</FONT>         */<a name="line.227"></a>
+<FONT color="green">228</FONT>        public ArrayRealVector(ArrayRealVector v1, double[] v2) {<a name="line.228"></a>
+<FONT color="green">229</FONT>            final int l1 = v1.getDimension();<a name="line.229"></a>
+<FONT color="green">230</FONT>            final int l2 = v2.length;<a name="line.230"></a>
+<FONT color="green">231</FONT>            data = new double[l1 + l2];<a name="line.231"></a>
+<FONT color="green">232</FONT>            System.arraycopy(v1.data, 0, data, 0, l1);<a name="line.232"></a>
+<FONT color="green">233</FONT>            System.arraycopy(v2, 0, data, l1, l2);<a name="line.233"></a>
+<FONT color="green">234</FONT>        }<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>        /**<a name="line.236"></a>
+<FONT color="green">237</FONT>         * Construct a vector by appending one vector to another vector.<a name="line.237"></a>
+<FONT color="green">238</FONT>         * @param v1 first vector (will be put in front of the new vector)<a name="line.238"></a>
+<FONT color="green">239</FONT>         * @param v2 second vector (will be put at back of the new vector)<a name="line.239"></a>
+<FONT color="green">240</FONT>         */<a name="line.240"></a>
+<FONT color="green">241</FONT>        public ArrayRealVector(double[] v1, ArrayRealVector v2) {<a name="line.241"></a>
+<FONT color="green">242</FONT>            final int l1 = v1.length;<a name="line.242"></a>
+<FONT color="green">243</FONT>            final int l2 = v2.getDimension();<a name="line.243"></a>
+<FONT color="green">244</FONT>            data = new double[l1 + l2];<a name="line.244"></a>
+<FONT color="green">245</FONT>            System.arraycopy(v1, 0, data, 0, l1);<a name="line.245"></a>
+<FONT color="green">246</FONT>            System.arraycopy(v2.data, 0, data, l1, l2);<a name="line.246"></a>
+<FONT color="green">247</FONT>        }<a name="line.247"></a>
+<FONT color="green">248</FONT>    <a name="line.248"></a>
+<FONT color="green">249</FONT>        /**<a name="line.249"></a>
+<FONT color="green">250</FONT>         * Construct a vector by appending one vector to another vector.<a name="line.250"></a>
+<FONT color="green">251</FONT>         * @param v1 first vector (will be put in front of the new vector)<a name="line.251"></a>
+<FONT color="green">252</FONT>         * @param v2 second vector (will be put at back of the new vector)<a name="line.252"></a>
+<FONT color="green">253</FONT>         */<a name="line.253"></a>
+<FONT color="green">254</FONT>        public ArrayRealVector(double[] v1, double[] v2) {<a name="line.254"></a>
+<FONT color="green">255</FONT>            final int l1 = v1.length;<a name="line.255"></a>
+<FONT color="green">256</FONT>            final int l2 = v2.length;<a name="line.256"></a>
+<FONT color="green">257</FONT>            data = new double[l1 + l2];<a name="line.257"></a>
+<FONT color="green">258</FONT>            System.arraycopy(v1, 0, data, 0, l1);<a name="line.258"></a>
+<FONT color="green">259</FONT>            System.arraycopy(v2, 0, data, l1, l2);<a name="line.259"></a>
+<FONT color="green">260</FONT>        }<a name="line.260"></a>
+<FONT color="green">261</FONT>    <a name="line.261"></a>
+<FONT color="green">262</FONT>        /** {@inheritDoc} */<a name="line.262"></a>
+<FONT color="green">263</FONT>        @Override<a name="line.263"></a>
+<FONT color="green">264</FONT>        public AbstractRealVector copy() {<a name="line.264"></a>
+<FONT color="green">265</FONT>            return new ArrayRealVector(this, true);<a name="line.265"></a>
+<FONT color="green">266</FONT>        }<a name="line.266"></a>
+<FONT color="green">267</FONT>    <a name="line.267"></a>
+<FONT color="green">268</FONT>        /** {@inheritDoc} */<a name="line.268"></a>
+<FONT color="green">269</FONT>        @Override<a name="line.269"></a>
+<FONT color="green">270</FONT>        public RealVector add(RealVector v)<a name="line.270"></a>
+<FONT color="green">271</FONT>            throws IllegalArgumentException {<a name="line.271"></a>
+<FONT color="green">272</FONT>            if (v instanceof ArrayRealVector) {<a name="line.272"></a>
+<FONT color="green">273</FONT>                return add((ArrayRealVector) v);<a name="line.273"></a>
+<FONT color="green">274</FONT>            } else {<a name="line.274"></a>
+<FONT color="green">275</FONT>                checkVectorDimensions(v);<a name="line.275"></a>
+<FONT color="green">276</FONT>                double[] out = data.clone();<a name="line.276"></a>
+<FONT color="green">277</FONT>                Iterator&lt;Entry&gt; it = v.sparseIterator();<a name="line.277"></a>
+<FONT color="green">278</FONT>                Entry e;<a name="line.278"></a>
+<FONT color="green">279</FONT>                while (it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.279"></a>
+<FONT color="green">280</FONT>                    out[e.getIndex()] += e.getValue();<a name="line.280"></a>
+<FONT color="green">281</FONT>                }<a name="line.281"></a>
+<FONT color="green">282</FONT>                return new ArrayRealVector(out, false);<a name="line.282"></a>
+<FONT color="green">283</FONT>            }<a name="line.283"></a>
+<FONT color="green">284</FONT>        }<a name="line.284"></a>
+<FONT color="green">285</FONT>    <a name="line.285"></a>
+<FONT color="green">286</FONT>        /** {@inheritDoc} */<a name="line.286"></a>
+<FONT color="green">287</FONT>        @Override<a name="line.287"></a>
+<FONT color="green">288</FONT>        public RealVector add(double[] v)<a name="line.288"></a>
+<FONT color="green">289</FONT>            throws IllegalArgumentException {<a name="line.289"></a>
+<FONT color="green">290</FONT>            checkVectorDimensions(v.length);<a name="line.290"></a>
+<FONT color="green">291</FONT>            double[] out = data.clone();<a name="line.291"></a>
+<FONT color="green">292</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.292"></a>
+<FONT color="green">293</FONT>                out[i] += v[i];<a name="line.293"></a>
+<FONT color="green">294</FONT>            }<a name="line.294"></a>
+<FONT color="green">295</FONT>            return new ArrayRealVector(out, false);<a name="line.295"></a>
+<FONT color="green">296</FONT>        }<a name="line.296"></a>
+<FONT color="green">297</FONT>    <a name="line.297"></a>
+<FONT color="green">298</FONT>        /**<a name="line.298"></a>
+<FONT color="green">299</FONT>         * Compute the sum of this and v.<a name="line.299"></a>
+<FONT color="green">300</FONT>         * @param v vector to be added<a name="line.300"></a>
+<FONT color="green">301</FONT>         * @return this + v<a name="line.301"></a>
+<FONT color="green">302</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.302"></a>
+<FONT color="green">303</FONT>         */<a name="line.303"></a>
+<FONT color="green">304</FONT>        public ArrayRealVector add(ArrayRealVector v)<a name="line.304"></a>
+<FONT color="green">305</FONT>            throws IllegalArgumentException {<a name="line.305"></a>
+<FONT color="green">306</FONT>            return (ArrayRealVector) add(v.data);<a name="line.306"></a>
+<FONT color="green">307</FONT>        }<a name="line.307"></a>
+<FONT color="green">308</FONT>    <a name="line.308"></a>
+<FONT color="green">309</FONT>        /** {@inheritDoc} */<a name="line.309"></a>
+<FONT color="green">310</FONT>        @Override<a name="line.310"></a>
+<FONT color="green">311</FONT>        public RealVector subtract(RealVector v)<a name="line.311"></a>
+<FONT color="green">312</FONT>            throws IllegalArgumentException {<a name="line.312"></a>
+<FONT color="green">313</FONT>            if (v instanceof ArrayRealVector) {<a name="line.313"></a>
+<FONT color="green">314</FONT>                return subtract((ArrayRealVector) v);<a name="line.314"></a>
+<FONT color="green">315</FONT>            } else {<a name="line.315"></a>
+<FONT color="green">316</FONT>                checkVectorDimensions(v);<a name="line.316"></a>
+<FONT color="green">317</FONT>                double[] out = data.clone();<a name="line.317"></a>
+<FONT color="green">318</FONT>                Iterator&lt;Entry&gt; it = v.sparseIterator();<a name="line.318"></a>
+<FONT color="green">319</FONT>                Entry e;<a name="line.319"></a>
+<FONT color="green">320</FONT>                while(it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.320"></a>
+<FONT color="green">321</FONT>                    out[e.getIndex()] -= e.getValue();<a name="line.321"></a>
+<FONT color="green">322</FONT>                }<a name="line.322"></a>
+<FONT color="green">323</FONT>                return new ArrayRealVector(out, false);<a name="line.323"></a>
+<FONT color="green">324</FONT>            }<a name="line.324"></a>
+<FONT color="green">325</FONT>        }<a name="line.325"></a>
+<FONT color="green">326</FONT>    <a name="line.326"></a>
+<FONT color="green">327</FONT>        /** {@inheritDoc} */<a name="line.327"></a>
+<FONT color="green">328</FONT>        @Override<a name="line.328"></a>
+<FONT color="green">329</FONT>        public RealVector subtract(double[] v)<a name="line.329"></a>
+<FONT color="green">330</FONT>            throws IllegalArgumentException {<a name="line.330"></a>
+<FONT color="green">331</FONT>            checkVectorDimensions(v.length);<a name="line.331"></a>
+<FONT color="green">332</FONT>            double[] out = data.clone();<a name="line.332"></a>
+<FONT color="green">333</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.333"></a>
+<FONT color="green">334</FONT>                out[i] -= v[i];<a name="line.334"></a>
+<FONT color="green">335</FONT>            }<a name="line.335"></a>
+<FONT color="green">336</FONT>            return new ArrayRealVector(out, false);<a name="line.336"></a>
+<FONT color="green">337</FONT>        }<a name="line.337"></a>
+<FONT color="green">338</FONT>    <a name="line.338"></a>
+<FONT color="green">339</FONT>        /**<a name="line.339"></a>
+<FONT color="green">340</FONT>         * Compute this minus v.<a name="line.340"></a>
+<FONT color="green">341</FONT>         * @param v vector to be subtracted<a name="line.341"></a>
+<FONT color="green">342</FONT>         * @return this + v<a name="line.342"></a>
+<FONT color="green">343</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.343"></a>
+<FONT color="green">344</FONT>         */<a name="line.344"></a>
+<FONT color="green">345</FONT>        public ArrayRealVector subtract(ArrayRealVector v)<a name="line.345"></a>
+<FONT color="green">346</FONT>            throws IllegalArgumentException {<a name="line.346"></a>
+<FONT color="green">347</FONT>            return (ArrayRealVector) subtract(v.data);<a name="line.347"></a>
+<FONT color="green">348</FONT>        }<a name="line.348"></a>
+<FONT color="green">349</FONT>    <a name="line.349"></a>
+<FONT color="green">350</FONT>        /** {@inheritDoc} */<a name="line.350"></a>
+<FONT color="green">351</FONT>        @Override<a name="line.351"></a>
+<FONT color="green">352</FONT>        public RealVector mapAddToSelf(double d) {<a name="line.352"></a>
+<FONT color="green">353</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.353"></a>
+<FONT color="green">354</FONT>                data[i] = data[i] + d;<a name="line.354"></a>
+<FONT color="green">355</FONT>            }<a name="line.355"></a>
+<FONT color="green">356</FONT>            return this;<a name="line.356"></a>
+<FONT color="green">357</FONT>        }<a name="line.357"></a>
+<FONT color="green">358</FONT>    <a name="line.358"></a>
+<FONT color="green">359</FONT>        /** {@inheritDoc} */<a name="line.359"></a>
+<FONT color="green">360</FONT>        @Override<a name="line.360"></a>
+<FONT color="green">361</FONT>        public RealVector mapSubtractToSelf(double d) {<a name="line.361"></a>
+<FONT color="green">362</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.362"></a>
+<FONT color="green">363</FONT>                data[i] = data[i] - d;<a name="line.363"></a>
+<FONT color="green">364</FONT>            }<a name="line.364"></a>
+<FONT color="green">365</FONT>            return this;<a name="line.365"></a>
+<FONT color="green">366</FONT>        }<a name="line.366"></a>
+<FONT color="green">367</FONT>    <a name="line.367"></a>
+<FONT color="green">368</FONT>        /** {@inheritDoc} */<a name="line.368"></a>
+<FONT color="green">369</FONT>        @Override<a name="line.369"></a>
+<FONT color="green">370</FONT>        public RealVector mapMultiplyToSelf(double d) {<a name="line.370"></a>
+<FONT color="green">371</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.371"></a>
+<FONT color="green">372</FONT>                data[i] = data[i] * d;<a name="line.372"></a>
+<FONT color="green">373</FONT>            }<a name="line.373"></a>
+<FONT color="green">374</FONT>            return this;<a name="line.374"></a>
+<FONT color="green">375</FONT>        }<a name="line.375"></a>
+<FONT color="green">376</FONT>    <a name="line.376"></a>
+<FONT color="green">377</FONT>        /** {@inheritDoc} */<a name="line.377"></a>
+<FONT color="green">378</FONT>        @Override<a name="line.378"></a>
+<FONT color="green">379</FONT>        public RealVector mapDivideToSelf(double d) {<a name="line.379"></a>
+<FONT color="green">380</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.380"></a>
+<FONT color="green">381</FONT>                data[i] = data[i] / d;<a name="line.381"></a>
+<FONT color="green">382</FONT>            }<a name="line.382"></a>
+<FONT color="green">383</FONT>            return this;<a name="line.383"></a>
+<FONT color="green">384</FONT>        }<a name="line.384"></a>
+<FONT color="green">385</FONT>    <a name="line.385"></a>
+<FONT color="green">386</FONT>        /** {@inheritDoc} */<a name="line.386"></a>
+<FONT color="green">387</FONT>        @Override<a name="line.387"></a>
+<FONT color="green">388</FONT>        public RealVector mapPowToSelf(double d) {<a name="line.388"></a>
+<FONT color="green">389</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.389"></a>
+<FONT color="green">390</FONT>                data[i] = Math.pow(data[i], d);<a name="line.390"></a>
+<FONT color="green">391</FONT>            }<a name="line.391"></a>
+<FONT color="green">392</FONT>            return this;<a name="line.392"></a>
+<FONT color="green">393</FONT>        }<a name="line.393"></a>
+<FONT color="green">394</FONT>    <a name="line.394"></a>
+<FONT color="green">395</FONT>        /** {@inheritDoc} */<a name="line.395"></a>
+<FONT color="green">396</FONT>        @Override<a name="line.396"></a>
+<FONT color="green">397</FONT>        public RealVector mapExpToSelf() {<a name="line.397"></a>
+<FONT color="green">398</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.398"></a>
+<FONT color="green">399</FONT>                data[i] = Math.exp(data[i]);<a name="line.399"></a>
+<FONT color="green">400</FONT>            }<a name="line.400"></a>
+<FONT color="green">401</FONT>            return this;<a name="line.401"></a>
+<FONT color="green">402</FONT>        }<a name="line.402"></a>
+<FONT color="green">403</FONT>    <a name="line.403"></a>
+<FONT color="green">404</FONT>        /** {@inheritDoc} */<a name="line.404"></a>
+<FONT color="green">405</FONT>        @Override<a name="line.405"></a>
+<FONT color="green">406</FONT>        public RealVector mapExpm1ToSelf() {<a name="line.406"></a>
+<FONT color="green">407</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.407"></a>
+<FONT color="green">408</FONT>                data[i] = Math.expm1(data[i]);<a name="line.408"></a>
+<FONT color="green">409</FONT>            }<a name="line.409"></a>
+<FONT color="green">410</FONT>            return this;<a name="line.410"></a>
+<FONT color="green">411</FONT>        }<a name="line.411"></a>
+<FONT color="green">412</FONT>    <a name="line.412"></a>
+<FONT color="green">413</FONT>        /** {@inheritDoc} */<a name="line.413"></a>
+<FONT color="green">414</FONT>        @Override<a name="line.414"></a>
+<FONT color="green">415</FONT>        public RealVector mapLogToSelf() {<a name="line.415"></a>
+<FONT color="green">416</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.416"></a>
+<FONT color="green">417</FONT>                data[i] = Math.log(data[i]);<a name="line.417"></a>
+<FONT color="green">418</FONT>            }<a name="line.418"></a>
+<FONT color="green">419</FONT>            return this;<a name="line.419"></a>
+<FONT color="green">420</FONT>        }<a name="line.420"></a>
+<FONT color="green">421</FONT>    <a name="line.421"></a>
+<FONT color="green">422</FONT>        /** {@inheritDoc} */<a name="line.422"></a>
+<FONT color="green">423</FONT>        @Override<a name="line.423"></a>
+<FONT color="green">424</FONT>        public RealVector mapLog10ToSelf() {<a name="line.424"></a>
+<FONT color="green">425</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.425"></a>
+<FONT color="green">426</FONT>                data[i] = Math.log10(data[i]);<a name="line.426"></a>
+<FONT color="green">427</FONT>            }<a name="line.427"></a>
+<FONT color="green">428</FONT>            return this;<a name="line.428"></a>
+<FONT color="green">429</FONT>        }<a name="line.429"></a>
+<FONT color="green">430</FONT>    <a name="line.430"></a>
+<FONT color="green">431</FONT>        /** {@inheritDoc} */<a name="line.431"></a>
+<FONT color="green">432</FONT>        @Override<a name="line.432"></a>
+<FONT color="green">433</FONT>        public RealVector mapLog1pToSelf() {<a name="line.433"></a>
+<FONT color="green">434</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.434"></a>
+<FONT color="green">435</FONT>                data[i] = Math.log1p(data[i]);<a name="line.435"></a>
+<FONT color="green">436</FONT>            }<a name="line.436"></a>
+<FONT color="green">437</FONT>            return this;<a name="line.437"></a>
+<FONT color="green">438</FONT>        }<a name="line.438"></a>
+<FONT color="green">439</FONT>    <a name="line.439"></a>
+<FONT color="green">440</FONT>        /** {@inheritDoc} */<a name="line.440"></a>
+<FONT color="green">441</FONT>        @Override<a name="line.441"></a>
+<FONT color="green">442</FONT>        public RealVector mapCoshToSelf() {<a name="line.442"></a>
+<FONT color="green">443</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.443"></a>
+<FONT color="green">444</FONT>                data[i] = Math.cosh(data[i]);<a name="line.444"></a>
+<FONT color="green">445</FONT>            }<a name="line.445"></a>
+<FONT color="green">446</FONT>            return this;<a name="line.446"></a>
+<FONT color="green">447</FONT>        }<a name="line.447"></a>
+<FONT color="green">448</FONT>    <a name="line.448"></a>
+<FONT color="green">449</FONT>        /** {@inheritDoc} */<a name="line.449"></a>
+<FONT color="green">450</FONT>        @Override<a name="line.450"></a>
+<FONT color="green">451</FONT>        public RealVector mapSinhToSelf() {<a name="line.451"></a>
+<FONT color="green">452</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.452"></a>
+<FONT color="green">453</FONT>                data[i] = Math.sinh(data[i]);<a name="line.453"></a>
+<FONT color="green">454</FONT>            }<a name="line.454"></a>
+<FONT color="green">455</FONT>            return this;<a name="line.455"></a>
+<FONT color="green">456</FONT>        }<a name="line.456"></a>
+<FONT color="green">457</FONT>    <a name="line.457"></a>
+<FONT color="green">458</FONT>        /** {@inheritDoc} */<a name="line.458"></a>
+<FONT color="green">459</FONT>        @Override<a name="line.459"></a>
+<FONT color="green">460</FONT>        public RealVector mapTanhToSelf() {<a name="line.460"></a>
+<FONT color="green">461</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.461"></a>
+<FONT color="green">462</FONT>                data[i] = Math.tanh(data[i]);<a name="line.462"></a>
+<FONT color="green">463</FONT>            }<a name="line.463"></a>
+<FONT color="green">464</FONT>            return this;<a name="line.464"></a>
+<FONT color="green">465</FONT>        }<a name="line.465"></a>
+<FONT color="green">466</FONT>    <a name="line.466"></a>
+<FONT color="green">467</FONT>        /** {@inheritDoc} */<a name="line.467"></a>
+<FONT color="green">468</FONT>        @Override<a name="line.468"></a>
+<FONT color="green">469</FONT>        public RealVector mapCosToSelf() {<a name="line.469"></a>
+<FONT color="green">470</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.470"></a>
+<FONT color="green">471</FONT>                data[i] = Math.cos(data[i]);<a name="line.471"></a>
+<FONT color="green">472</FONT>            }<a name="line.472"></a>
+<FONT color="green">473</FONT>            return this;<a name="line.473"></a>
+<FONT color="green">474</FONT>        }<a name="line.474"></a>
+<FONT color="green">475</FONT>    <a name="line.475"></a>
+<FONT color="green">476</FONT>        /** {@inheritDoc} */<a name="line.476"></a>
+<FONT color="green">477</FONT>        @Override<a name="line.477"></a>
+<FONT color="green">478</FONT>        public RealVector mapSinToSelf() {<a name="line.478"></a>
+<FONT color="green">479</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.479"></a>
+<FONT color="green">480</FONT>                data[i] = Math.sin(data[i]);<a name="line.480"></a>
+<FONT color="green">481</FONT>            }<a name="line.481"></a>
+<FONT color="green">482</FONT>            return this;<a name="line.482"></a>
+<FONT color="green">483</FONT>        }<a name="line.483"></a>
+<FONT color="green">484</FONT>    <a name="line.484"></a>
+<FONT color="green">485</FONT>        /** {@inheritDoc} */<a name="line.485"></a>
+<FONT color="green">486</FONT>        @Override<a name="line.486"></a>
+<FONT color="green">487</FONT>        public RealVector mapTanToSelf() {<a name="line.487"></a>
+<FONT color="green">488</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.488"></a>
+<FONT color="green">489</FONT>                data[i] = Math.tan(data[i]);<a name="line.489"></a>
+<FONT color="green">490</FONT>            }<a name="line.490"></a>
+<FONT color="green">491</FONT>            return this;<a name="line.491"></a>
+<FONT color="green">492</FONT>        }<a name="line.492"></a>
+<FONT color="green">493</FONT>    <a name="line.493"></a>
+<FONT color="green">494</FONT>        /** {@inheritDoc} */<a name="line.494"></a>
+<FONT color="green">495</FONT>        @Override<a name="line.495"></a>
+<FONT color="green">496</FONT>        public RealVector mapAcosToSelf() {<a name="line.496"></a>
+<FONT color="green">497</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.497"></a>
+<FONT color="green">498</FONT>                data[i] = Math.acos(data[i]);<a name="line.498"></a>
+<FONT color="green">499</FONT>            }<a name="line.499"></a>
+<FONT color="green">500</FONT>            return this;<a name="line.500"></a>
+<FONT color="green">501</FONT>        }<a name="line.501"></a>
+<FONT color="green">502</FONT>    <a name="line.502"></a>
+<FONT color="green">503</FONT>        /** {@inheritDoc} */<a name="line.503"></a>
+<FONT color="green">504</FONT>        @Override<a name="line.504"></a>
+<FONT color="green">505</FONT>        public RealVector mapAsinToSelf() {<a name="line.505"></a>
+<FONT color="green">506</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.506"></a>
+<FONT color="green">507</FONT>                data[i] = Math.asin(data[i]);<a name="line.507"></a>
+<FONT color="green">508</FONT>            }<a name="line.508"></a>
+<FONT color="green">509</FONT>            return this;<a name="line.509"></a>
+<FONT color="green">510</FONT>        }<a name="line.510"></a>
+<FONT color="green">511</FONT>    <a name="line.511"></a>
+<FONT color="green">512</FONT>        /** {@inheritDoc} */<a name="line.512"></a>
+<FONT color="green">513</FONT>        @Override<a name="line.513"></a>
+<FONT color="green">514</FONT>        public RealVector mapAtanToSelf() {<a name="line.514"></a>
+<FONT color="green">515</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.515"></a>
+<FONT color="green">516</FONT>                data[i] = Math.atan(data[i]);<a name="line.516"></a>
+<FONT color="green">517</FONT>            }<a name="line.517"></a>
+<FONT color="green">518</FONT>            return this;<a name="line.518"></a>
+<FONT color="green">519</FONT>        }<a name="line.519"></a>
+<FONT color="green">520</FONT>    <a name="line.520"></a>
+<FONT color="green">521</FONT>        /** {@inheritDoc} */<a name="line.521"></a>
+<FONT color="green">522</FONT>        @Override<a name="line.522"></a>
+<FONT color="green">523</FONT>        public RealVector mapInvToSelf() {<a name="line.523"></a>
+<FONT color="green">524</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.524"></a>
+<FONT color="green">525</FONT>                data[i] = 1.0 / data[i];<a name="line.525"></a>
+<FONT color="green">526</FONT>            }<a name="line.526"></a>
+<FONT color="green">527</FONT>            return this;<a name="line.527"></a>
+<FONT color="green">528</FONT>        }<a name="line.528"></a>
+<FONT color="green">529</FONT>    <a name="line.529"></a>
+<FONT color="green">530</FONT>        /** {@inheritDoc} */<a name="line.530"></a>
+<FONT color="green">531</FONT>        @Override<a name="line.531"></a>
+<FONT color="green">532</FONT>        public RealVector mapAbsToSelf() {<a name="line.532"></a>
+<FONT color="green">533</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.533"></a>
+<FONT color="green">534</FONT>                data[i] = Math.abs(data[i]);<a name="line.534"></a>
+<FONT color="green">535</FONT>            }<a name="line.535"></a>
+<FONT color="green">536</FONT>            return this;<a name="line.536"></a>
+<FONT color="green">537</FONT>        }<a name="line.537"></a>
+<FONT color="green">538</FONT>    <a name="line.538"></a>
+<FONT color="green">539</FONT>        /** {@inheritDoc} */<a name="line.539"></a>
+<FONT color="green">540</FONT>        @Override<a name="line.540"></a>
+<FONT color="green">541</FONT>        public RealVector mapSqrtToSelf() {<a name="line.541"></a>
+<FONT color="green">542</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.542"></a>
+<FONT color="green">543</FONT>                data[i] = Math.sqrt(data[i]);<a name="line.543"></a>
+<FONT color="green">544</FONT>            }<a name="line.544"></a>
+<FONT color="green">545</FONT>            return this;<a name="line.545"></a>
+<FONT color="green">546</FONT>        }<a name="line.546"></a>
+<FONT color="green">547</FONT>    <a name="line.547"></a>
+<FONT color="green">548</FONT>        /** {@inheritDoc} */<a name="line.548"></a>
+<FONT color="green">549</FONT>        @Override<a name="line.549"></a>
+<FONT color="green">550</FONT>        public RealVector mapCbrtToSelf() {<a name="line.550"></a>
+<FONT color="green">551</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.551"></a>
+<FONT color="green">552</FONT>                data[i] = Math.cbrt(data[i]);<a name="line.552"></a>
+<FONT color="green">553</FONT>            }<a name="line.553"></a>
+<FONT color="green">554</FONT>            return this;<a name="line.554"></a>
+<FONT color="green">555</FONT>        }<a name="line.555"></a>
+<FONT color="green">556</FONT>    <a name="line.556"></a>
+<FONT color="green">557</FONT>        /** {@inheritDoc} */<a name="line.557"></a>
+<FONT color="green">558</FONT>        @Override<a name="line.558"></a>
+<FONT color="green">559</FONT>        public RealVector mapCeilToSelf() {<a name="line.559"></a>
+<FONT color="green">560</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.560"></a>
+<FONT color="green">561</FONT>                data[i] = Math.ceil(data[i]);<a name="line.561"></a>
+<FONT color="green">562</FONT>            }<a name="line.562"></a>
+<FONT color="green">563</FONT>            return this;<a name="line.563"></a>
+<FONT color="green">564</FONT>        }<a name="line.564"></a>
+<FONT color="green">565</FONT>    <a name="line.565"></a>
+<FONT color="green">566</FONT>        /** {@inheritDoc} */<a name="line.566"></a>
+<FONT color="green">567</FONT>        @Override<a name="line.567"></a>
+<FONT color="green">568</FONT>        public RealVector mapFloorToSelf() {<a name="line.568"></a>
+<FONT color="green">569</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.569"></a>
+<FONT color="green">570</FONT>                data[i] = Math.floor(data[i]);<a name="line.570"></a>
+<FONT color="green">571</FONT>            }<a name="line.571"></a>
+<FONT color="green">572</FONT>            return this;<a name="line.572"></a>
+<FONT color="green">573</FONT>        }<a name="line.573"></a>
+<FONT color="green">574</FONT>    <a name="line.574"></a>
+<FONT color="green">575</FONT>        /** {@inheritDoc} */<a name="line.575"></a>
+<FONT color="green">576</FONT>        @Override<a name="line.576"></a>
+<FONT color="green">577</FONT>        public RealVector mapRintToSelf() {<a name="line.577"></a>
+<FONT color="green">578</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.578"></a>
+<FONT color="green">579</FONT>                data[i] = Math.rint(data[i]);<a name="line.579"></a>
+<FONT color="green">580</FONT>            }<a name="line.580"></a>
+<FONT color="green">581</FONT>            return this;<a name="line.581"></a>
+<FONT color="green">582</FONT>        }<a name="line.582"></a>
+<FONT color="green">583</FONT>    <a name="line.583"></a>
+<FONT color="green">584</FONT>        /** {@inheritDoc} */<a name="line.584"></a>
+<FONT color="green">585</FONT>        @Override<a name="line.585"></a>
+<FONT color="green">586</FONT>        public RealVector mapSignumToSelf() {<a name="line.586"></a>
+<FONT color="green">587</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.587"></a>
+<FONT color="green">588</FONT>                data[i] = Math.signum(data[i]);<a name="line.588"></a>
+<FONT color="green">589</FONT>            }<a name="line.589"></a>
+<FONT color="green">590</FONT>            return this;<a name="line.590"></a>
+<FONT color="green">591</FONT>        }<a name="line.591"></a>
+<FONT color="green">592</FONT>    <a name="line.592"></a>
+<FONT color="green">593</FONT>        /** {@inheritDoc} */<a name="line.593"></a>
+<FONT color="green">594</FONT>        @Override<a name="line.594"></a>
+<FONT color="green">595</FONT>        public RealVector mapUlpToSelf() {<a name="line.595"></a>
+<FONT color="green">596</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.596"></a>
+<FONT color="green">597</FONT>                data[i] = Math.ulp(data[i]);<a name="line.597"></a>
+<FONT color="green">598</FONT>            }<a name="line.598"></a>
+<FONT color="green">599</FONT>            return this;<a name="line.599"></a>
+<FONT color="green">600</FONT>        }<a name="line.600"></a>
+<FONT color="green">601</FONT>    <a name="line.601"></a>
+<FONT color="green">602</FONT>        /** {@inheritDoc} */<a name="line.602"></a>
+<FONT color="green">603</FONT>        public RealVector ebeMultiply(RealVector v)<a name="line.603"></a>
+<FONT color="green">604</FONT>            throws IllegalArgumentException {<a name="line.604"></a>
+<FONT color="green">605</FONT>            if (v instanceof ArrayRealVector) {<a name="line.605"></a>
+<FONT color="green">606</FONT>                return ebeMultiply((ArrayRealVector) v);<a name="line.606"></a>
+<FONT color="green">607</FONT>            } else {<a name="line.607"></a>
+<FONT color="green">608</FONT>                checkVectorDimensions(v);<a name="line.608"></a>
+<FONT color="green">609</FONT>                double[] out = data.clone();<a name="line.609"></a>
+<FONT color="green">610</FONT>                for (int i = 0; i &lt; data.length; i++) {<a name="line.610"></a>
+<FONT color="green">611</FONT>                    out[i] *= v.getEntry(i);<a name="line.611"></a>
+<FONT color="green">612</FONT>                }<a name="line.612"></a>
+<FONT color="green">613</FONT>                return new ArrayRealVector(out, false);<a name="line.613"></a>
+<FONT color="green">614</FONT>            }<a name="line.614"></a>
+<FONT color="green">615</FONT>        }<a name="line.615"></a>
+<FONT color="green">616</FONT>    <a name="line.616"></a>
+<FONT color="green">617</FONT>        /** {@inheritDoc} */<a name="line.617"></a>
+<FONT color="green">618</FONT>        @Override<a name="line.618"></a>
+<FONT color="green">619</FONT>        public RealVector ebeMultiply(double[] v)<a name="line.619"></a>
+<FONT color="green">620</FONT>            throws IllegalArgumentException {<a name="line.620"></a>
+<FONT color="green">621</FONT>            checkVectorDimensions(v.length);<a name="line.621"></a>
+<FONT color="green">622</FONT>            double[] out = data.clone();<a name="line.622"></a>
+<FONT color="green">623</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.623"></a>
+<FONT color="green">624</FONT>                out[i] *= v[i];<a name="line.624"></a>
+<FONT color="green">625</FONT>            }<a name="line.625"></a>
+<FONT color="green">626</FONT>            return new ArrayRealVector(out, false);<a name="line.626"></a>
+<FONT color="green">627</FONT>        }<a name="line.627"></a>
+<FONT color="green">628</FONT>    <a name="line.628"></a>
+<FONT color="green">629</FONT>        /**<a name="line.629"></a>
+<FONT color="green">630</FONT>         * Element-by-element multiplication.<a name="line.630"></a>
+<FONT color="green">631</FONT>         * @param v vector by which instance elements must be multiplied<a name="line.631"></a>
+<FONT color="green">632</FONT>         * @return a vector containing this[i] * v[i] for all i<a name="line.632"></a>
+<FONT color="green">633</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.633"></a>
+<FONT color="green">634</FONT>         */<a name="line.634"></a>
+<FONT color="green">635</FONT>        public ArrayRealVector ebeMultiply(ArrayRealVector v)<a name="line.635"></a>
+<FONT color="green">636</FONT>            throws IllegalArgumentException {<a name="line.636"></a>
+<FONT color="green">637</FONT>            return (ArrayRealVector) ebeMultiply(v.data);<a name="line.637"></a>
+<FONT color="green">638</FONT>        }<a name="line.638"></a>
+<FONT color="green">639</FONT>    <a name="line.639"></a>
+<FONT color="green">640</FONT>        /** {@inheritDoc} */<a name="line.640"></a>
+<FONT color="green">641</FONT>        public RealVector ebeDivide(RealVector v)<a name="line.641"></a>
+<FONT color="green">642</FONT>            throws IllegalArgumentException {<a name="line.642"></a>
+<FONT color="green">643</FONT>            if (v instanceof ArrayRealVector) {<a name="line.643"></a>
+<FONT color="green">644</FONT>                return ebeDivide((ArrayRealVector) v);<a name="line.644"></a>
+<FONT color="green">645</FONT>            } else {<a name="line.645"></a>
+<FONT color="green">646</FONT>                checkVectorDimensions(v);<a name="line.646"></a>
+<FONT color="green">647</FONT>                double[] out = data.clone();<a name="line.647"></a>
+<FONT color="green">648</FONT>                for (int i = 0; i &lt; data.length; i++) {<a name="line.648"></a>
+<FONT color="green">649</FONT>                    out[i] /= v.getEntry(i);<a name="line.649"></a>
+<FONT color="green">650</FONT>                }<a name="line.650"></a>
+<FONT color="green">651</FONT>                return new ArrayRealVector(out, false);<a name="line.651"></a>
+<FONT color="green">652</FONT>            }<a name="line.652"></a>
+<FONT color="green">653</FONT>        }<a name="line.653"></a>
+<FONT color="green">654</FONT>    <a name="line.654"></a>
+<FONT color="green">655</FONT>        /** {@inheritDoc} */<a name="line.655"></a>
+<FONT color="green">656</FONT>        @Override<a name="line.656"></a>
+<FONT color="green">657</FONT>        public RealVector ebeDivide(double[] v)<a name="line.657"></a>
+<FONT color="green">658</FONT>            throws IllegalArgumentException {<a name="line.658"></a>
+<FONT color="green">659</FONT>            checkVectorDimensions(v.length);<a name="line.659"></a>
+<FONT color="green">660</FONT>            double[] out = data.clone();<a name="line.660"></a>
+<FONT color="green">661</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.661"></a>
+<FONT color="green">662</FONT>                    out[i] /= v[i];<a name="line.662"></a>
+<FONT color="green">663</FONT>            }<a name="line.663"></a>
+<FONT color="green">664</FONT>            return new ArrayRealVector(out, false);<a name="line.664"></a>
+<FONT color="green">665</FONT>        }<a name="line.665"></a>
+<FONT color="green">666</FONT>    <a name="line.666"></a>
+<FONT color="green">667</FONT>        /**<a name="line.667"></a>
+<FONT color="green">668</FONT>         * Element-by-element division.<a name="line.668"></a>
+<FONT color="green">669</FONT>         * @param v vector by which instance elements must be divided<a name="line.669"></a>
+<FONT color="green">670</FONT>         * @return a vector containing this[i] / v[i] for all i<a name="line.670"></a>
+<FONT color="green">671</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.671"></a>
+<FONT color="green">672</FONT>         */<a name="line.672"></a>
+<FONT color="green">673</FONT>        public ArrayRealVector ebeDivide(ArrayRealVector v)<a name="line.673"></a>
+<FONT color="green">674</FONT>            throws IllegalArgumentException {<a name="line.674"></a>
+<FONT color="green">675</FONT>            return (ArrayRealVector) ebeDivide(v.data);<a name="line.675"></a>
+<FONT color="green">676</FONT>        }<a name="line.676"></a>
+<FONT color="green">677</FONT>    <a name="line.677"></a>
+<FONT color="green">678</FONT>        /** {@inheritDoc} */<a name="line.678"></a>
+<FONT color="green">679</FONT>        @Override<a name="line.679"></a>
+<FONT color="green">680</FONT>        public double[] getData() {<a name="line.680"></a>
+<FONT color="green">681</FONT>            return data.clone();<a name="line.681"></a>
+<FONT color="green">682</FONT>        }<a name="line.682"></a>
+<FONT color="green">683</FONT>    <a name="line.683"></a>
+<FONT color="green">684</FONT>        /**<a name="line.684"></a>
+<FONT color="green">685</FONT>         * Returns a reference to the underlying data array.<a name="line.685"></a>
+<FONT color="green">686</FONT>         * &lt;p&gt;Does not make a fresh copy of the underlying data.&lt;/p&gt;<a name="line.686"></a>
+<FONT color="green">687</FONT>         * @return array of entries<a name="line.687"></a>
+<FONT color="green">688</FONT>         */<a name="line.688"></a>
+<FONT color="green">689</FONT>        public double[] getDataRef() {<a name="line.689"></a>
+<FONT color="green">690</FONT>            return data;<a name="line.690"></a>
+<FONT color="green">691</FONT>        }<a name="line.691"></a>
+<FONT color="green">692</FONT>    <a name="line.692"></a>
+<FONT color="green">693</FONT>        /** {@inheritDoc} */<a name="line.693"></a>
+<FONT color="green">694</FONT>        @Override<a name="line.694"></a>
+<FONT color="green">695</FONT>        public double dotProduct(RealVector v)<a name="line.695"></a>
+<FONT color="green">696</FONT>            throws IllegalArgumentException {<a name="line.696"></a>
+<FONT color="green">697</FONT>            if (v instanceof ArrayRealVector) {<a name="line.697"></a>
+<FONT color="green">698</FONT>                return dotProduct((ArrayRealVector) v);<a name="line.698"></a>
+<FONT color="green">699</FONT>            } else {<a name="line.699"></a>
+<FONT color="green">700</FONT>                checkVectorDimensions(v);<a name="line.700"></a>
+<FONT color="green">701</FONT>                double dot = 0;<a name="line.701"></a>
+<FONT color="green">702</FONT>                Iterator&lt;Entry&gt; it = v.sparseIterator();<a name="line.702"></a>
+<FONT color="green">703</FONT>                Entry e;<a name="line.703"></a>
+<FONT color="green">704</FONT>                while(it.hasNext() &amp;&amp; (e = it.next()) != null) {<a name="line.704"></a>
+<FONT color="green">705</FONT>                    dot += data[e.getIndex()] * e.getValue();<a name="line.705"></a>
+<FONT color="green">706</FONT>                }<a name="line.706"></a>
+<FONT color="green">707</FONT>                return dot;<a name="line.707"></a>
+<FONT color="green">708</FONT>            }<a name="line.708"></a>
+<FONT color="green">709</FONT>        }<a name="line.709"></a>
+<FONT color="green">710</FONT>    <a name="line.710"></a>
+<FONT color="green">711</FONT>        /** {@inheritDoc} */<a name="line.711"></a>
+<FONT color="green">712</FONT>        @Override<a name="line.712"></a>
+<FONT color="green">713</FONT>        public double dotProduct(double[] v)<a name="line.713"></a>
+<FONT color="green">714</FONT>            throws IllegalArgumentException {<a name="line.714"></a>
+<FONT color="green">715</FONT>            checkVectorDimensions(v.length);<a name="line.715"></a>
+<FONT color="green">716</FONT>            double dot = 0;<a name="line.716"></a>
+<FONT color="green">717</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.717"></a>
+<FONT color="green">718</FONT>                dot += data[i] * v[i];<a name="line.718"></a>
+<FONT color="green">719</FONT>            }<a name="line.719"></a>
+<FONT color="green">720</FONT>            return dot;<a name="line.720"></a>
+<FONT color="green">721</FONT>        }<a name="line.721"></a>
+<FONT color="green">722</FONT>    <a name="line.722"></a>
+<FONT color="green">723</FONT>        /**<a name="line.723"></a>
+<FONT color="green">724</FONT>         * Compute the dot product.<a name="line.724"></a>
+<FONT color="green">725</FONT>         * @param v vector with which dot product should be computed<a name="line.725"></a>
+<FONT color="green">726</FONT>         * @return the scalar dot product between instance and v<a name="line.726"></a>
+<FONT color="green">727</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.727"></a>
+<FONT color="green">728</FONT>         */<a name="line.728"></a>
+<FONT color="green">729</FONT>        public double dotProduct(ArrayRealVector v)<a name="line.729"></a>
+<FONT color="green">730</FONT>            throws IllegalArgumentException {<a name="line.730"></a>
+<FONT color="green">731</FONT>            return dotProduct(v.data);<a name="line.731"></a>
+<FONT color="green">732</FONT>        }<a name="line.732"></a>
+<FONT color="green">733</FONT>    <a name="line.733"></a>
+<FONT color="green">734</FONT>        /** {@inheritDoc} */<a name="line.734"></a>
+<FONT color="green">735</FONT>        @Override<a name="line.735"></a>
+<FONT color="green">736</FONT>        public double getNorm() {<a name="line.736"></a>
+<FONT color="green">737</FONT>            double sum = 0;<a name="line.737"></a>
+<FONT color="green">738</FONT>            for (double a : data) {<a name="line.738"></a>
+<FONT color="green">739</FONT>                sum += a * a;<a name="line.739"></a>
+<FONT color="green">740</FONT>            }<a name="line.740"></a>
+<FONT color="green">741</FONT>            return Math.sqrt(sum);<a name="line.741"></a>
+<FONT color="green">742</FONT>        }<a name="line.742"></a>
+<FONT color="green">743</FONT>    <a name="line.743"></a>
+<FONT color="green">744</FONT>        /** {@inheritDoc} */<a name="line.744"></a>
+<FONT color="green">745</FONT>        @Override<a name="line.745"></a>
+<FONT color="green">746</FONT>        public double getL1Norm() {<a name="line.746"></a>
+<FONT color="green">747</FONT>            double sum = 0;<a name="line.747"></a>
+<FONT color="green">748</FONT>            for (double a : data) {<a name="line.748"></a>
+<FONT color="green">749</FONT>                sum += Math.abs(a);<a name="line.749"></a>
+<FONT color="green">750</FONT>            }<a name="line.750"></a>
+<FONT color="green">751</FONT>            return sum;<a name="line.751"></a>
+<FONT color="green">752</FONT>        }<a name="line.752"></a>
+<FONT color="green">753</FONT>    <a name="line.753"></a>
+<FONT color="green">754</FONT>        /** {@inheritDoc} */<a name="line.754"></a>
+<FONT color="green">755</FONT>        @Override<a name="line.755"></a>
+<FONT color="green">756</FONT>        public double getLInfNorm() {<a name="line.756"></a>
+<FONT color="green">757</FONT>            double max = 0;<a name="line.757"></a>
+<FONT color="green">758</FONT>            for (double a : data) {<a name="line.758"></a>
+<FONT color="green">759</FONT>                max = Math.max(max, Math.abs(a));<a name="line.759"></a>
+<FONT color="green">760</FONT>            }<a name="line.760"></a>
+<FONT color="green">761</FONT>            return max;<a name="line.761"></a>
+<FONT color="green">762</FONT>        }<a name="line.762"></a>
+<FONT color="green">763</FONT>    <a name="line.763"></a>
+<FONT color="green">764</FONT>        /** {@inheritDoc} */<a name="line.764"></a>
+<FONT color="green">765</FONT>        @Override<a name="line.765"></a>
+<FONT color="green">766</FONT>        public double getDistance(RealVector v)<a name="line.766"></a>
+<FONT color="green">767</FONT>            throws IllegalArgumentException {<a name="line.767"></a>
+<FONT color="green">768</FONT>            if (v instanceof ArrayRealVector) {<a name="line.768"></a>
+<FONT color="green">769</FONT>                return getDistance((ArrayRealVector) v);<a name="line.769"></a>
+<FONT color="green">770</FONT>            } else {<a name="line.770"></a>
+<FONT color="green">771</FONT>                checkVectorDimensions(v);<a name="line.771"></a>
+<FONT color="green">772</FONT>                double sum = 0;<a name="line.772"></a>
+<FONT color="green">773</FONT>                for (int i = 0; i &lt; data.length; ++i) {<a name="line.773"></a>
+<FONT color="green">774</FONT>                    final double delta = data[i] - v.getEntry(i);<a name="line.774"></a>
+<FONT color="green">775</FONT>                    sum += delta * delta;<a name="line.775"></a>
+<FONT color="green">776</FONT>                }<a name="line.776"></a>
+<FONT color="green">777</FONT>                return Math.sqrt(sum);<a name="line.777"></a>
+<FONT color="green">778</FONT>            }<a name="line.778"></a>
+<FONT color="green">779</FONT>        }<a name="line.779"></a>
+<FONT color="green">780</FONT>    <a name="line.780"></a>
+<FONT color="green">781</FONT>        /** {@inheritDoc} */<a name="line.781"></a>
+<FONT color="green">782</FONT>        @Override<a name="line.782"></a>
+<FONT color="green">783</FONT>        public double getDistance(double[] v)<a name="line.783"></a>
+<FONT color="green">784</FONT>            throws IllegalArgumentException {<a name="line.784"></a>
+<FONT color="green">785</FONT>            checkVectorDimensions(v.length);<a name="line.785"></a>
+<FONT color="green">786</FONT>            double sum = 0;<a name="line.786"></a>
+<FONT color="green">787</FONT>            for (int i = 0; i &lt; data.length; ++i) {<a name="line.787"></a>
+<FONT color="green">788</FONT>                final double delta = data[i] - v[i];<a name="line.788"></a>
+<FONT color="green">789</FONT>                sum += delta * delta;<a name="line.789"></a>
+<FONT color="green">790</FONT>            }<a name="line.790"></a>
+<FONT color="green">791</FONT>            return Math.sqrt(sum);<a name="line.791"></a>
+<FONT color="green">792</FONT>        }<a name="line.792"></a>
+<FONT color="green">793</FONT>    <a name="line.793"></a>
+<FONT color="green">794</FONT>       /**<a name="line.794"></a>
+<FONT color="green">795</FONT>         * Distance between two vectors.<a name="line.795"></a>
+<FONT color="green">796</FONT>         * &lt;p&gt;This method computes the distance consistent with the<a name="line.796"></a>
+<FONT color="green">797</FONT>         * L&lt;sub&gt;2&lt;/sub&gt; norm, i.e. the square root of the sum of<a name="line.797"></a>
+<FONT color="green">798</FONT>         * elements differences, or euclidian distance.&lt;/p&gt;<a name="line.798"></a>
+<FONT color="green">799</FONT>         * @param v vector to which distance is requested<a name="line.799"></a>
+<FONT color="green">800</FONT>         * @return distance between two vectors.<a name="line.800"></a>
+<FONT color="green">801</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.801"></a>
+<FONT color="green">802</FONT>         * @see #getDistance(RealVector)<a name="line.802"></a>
+<FONT color="green">803</FONT>         * @see #getL1Distance(ArrayRealVector)<a name="line.803"></a>
+<FONT color="green">804</FONT>         * @see #getLInfDistance(ArrayRealVector)<a name="line.804"></a>
+<FONT color="green">805</FONT>         * @see #getNorm()<a name="line.805"></a>
+<FONT color="green">806</FONT>         */<a name="line.806"></a>
+<FONT color="green">807</FONT>        public double getDistance(ArrayRealVector v)<a name="line.807"></a>
+<FONT color="green">808</FONT>            throws IllegalArgumentException {<a name="line.808"></a>
+<FONT color="green">809</FONT>            return getDistance(v.data);<a name="line.809"></a>
+<FONT color="green">810</FONT>        }<a name="line.810"></a>
+<FONT color="green">811</FONT>    <a name="line.811"></a>
+<FONT color="green">812</FONT>        /** {@inheritDoc} */<a name="line.812"></a>
+<FONT color="green">813</FONT>        @Override<a name="line.813"></a>
+<FONT color="green">814</FONT>        public double getL1Distance(RealVector v)<a name="line.814"></a>
+<FONT color="green">815</FONT>            throws IllegalArgumentException {<a name="line.815"></a>
+<FONT color="green">816</FONT>            if (v instanceof ArrayRealVector) {<a name="line.816"></a>
+<FONT color="green">817</FONT>                return getL1Distance((ArrayRealVector) v);<a name="line.817"></a>
+<FONT color="green">818</FONT>            } else {<a name="line.818"></a>
+<FONT color="green">819</FONT>                checkVectorDimensions(v);<a name="line.819"></a>
+<FONT color="green">820</FONT>                double sum = 0;<a name="line.820"></a>
+<FONT color="green">821</FONT>                for (int i = 0; i &lt; data.length; ++i) {<a name="line.821"></a>
+<FONT color="green">822</FONT>                    final double delta = data[i] - v.getEntry(i);<a name="line.822"></a>
+<FONT color="green">823</FONT>                    sum += Math.abs(delta);<a name="line.823"></a>
+<FONT color="green">824</FONT>                }<a name="line.824"></a>
+<FONT color="green">825</FONT>                return sum;<a name="line.825"></a>
+<FONT color="green">826</FONT>            }<a name="line.826"></a>
+<FONT color="green">827</FONT>        }<a name="line.827"></a>
+<FONT color="green">828</FONT>    <a name="line.828"></a>
+<FONT color="green">829</FONT>        /** {@inheritDoc} */<a name="line.829"></a>
+<FONT color="green">830</FONT>        @Override<a name="line.830"></a>
+<FONT color="green">831</FONT>        public double getL1Distance(double[] v)<a name="line.831"></a>
+<FONT color="green">832</FONT>            throws IllegalArgumentException {<a name="line.832"></a>
+<FONT color="green">833</FONT>            checkVectorDimensions(v.length);<a name="line.833"></a>
+<FONT color="green">834</FONT>            double sum = 0;<a name="line.834"></a>
+<FONT color="green">835</FONT>            for (int i = 0; i &lt; data.length; ++i) {<a name="line.835"></a>
+<FONT color="green">836</FONT>                final double delta = data[i] - v[i];<a name="line.836"></a>
+<FONT color="green">837</FONT>                sum += Math.abs(delta);<a name="line.837"></a>
+<FONT color="green">838</FONT>            }<a name="line.838"></a>
+<FONT color="green">839</FONT>            return sum;<a name="line.839"></a>
+<FONT color="green">840</FONT>        }<a name="line.840"></a>
+<FONT color="green">841</FONT>    <a name="line.841"></a>
+<FONT color="green">842</FONT>        /**<a name="line.842"></a>
+<FONT color="green">843</FONT>         * Distance between two vectors.<a name="line.843"></a>
+<FONT color="green">844</FONT>         * &lt;p&gt;This method computes the distance consistent with<a name="line.844"></a>
+<FONT color="green">845</FONT>         * L&lt;sub&gt;1&lt;/sub&gt; norm, i.e. the sum of the absolute values of<a name="line.845"></a>
+<FONT color="green">846</FONT>         * elements differences.&lt;/p&gt;<a name="line.846"></a>
+<FONT color="green">847</FONT>         * @param v vector to which distance is requested<a name="line.847"></a>
+<FONT color="green">848</FONT>         * @return distance between two vectors.<a name="line.848"></a>
+<FONT color="green">849</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.849"></a>
+<FONT color="green">850</FONT>         * @see #getDistance(RealVector)<a name="line.850"></a>
+<FONT color="green">851</FONT>         * @see #getL1Distance(ArrayRealVector)<a name="line.851"></a>
+<FONT color="green">852</FONT>         * @see #getLInfDistance(ArrayRealVector)<a name="line.852"></a>
+<FONT color="green">853</FONT>         * @see #getNorm()<a name="line.853"></a>
+<FONT color="green">854</FONT>         */<a name="line.854"></a>
+<FONT color="green">855</FONT>        public double getL1Distance(ArrayRealVector v)<a name="line.855"></a>
+<FONT color="green">856</FONT>            throws IllegalArgumentException {<a name="line.856"></a>
+<FONT color="green">857</FONT>            return getL1Distance(v.data);<a name="line.857"></a>
+<FONT color="green">858</FONT>        }<a name="line.858"></a>
+<FONT color="green">859</FONT>    <a name="line.859"></a>
+<FONT color="green">860</FONT>        /** {@inheritDoc} */<a name="line.860"></a>
+<FONT color="green">861</FONT>        @Override<a name="line.861"></a>
+<FONT color="green">862</FONT>        public double getLInfDistance(RealVector v)<a name="line.862"></a>
+<FONT color="green">863</FONT>            throws IllegalArgumentException {<a name="line.863"></a>
+<FONT color="green">864</FONT>            if (v instanceof ArrayRealVector) {<a name="line.864"></a>
+<FONT color="green">865</FONT>                return getLInfDistance((ArrayRealVector) v);<a name="line.865"></a>
+<FONT color="green">866</FONT>            } else {<a name="line.866"></a>
+<FONT color="green">867</FONT>                checkVectorDimensions(v);<a name="line.867"></a>
+<FONT color="green">868</FONT>                double max = 0;<a name="line.868"></a>
+<FONT color="green">869</FONT>                for (int i = 0; i &lt; data.length; ++i) {<a name="line.869"></a>
+<FONT color="green">870</FONT>                    final double delta = data[i] - v.getEntry(i);<a name="line.870"></a>
+<FONT color="green">871</FONT>                    max = Math.max(max, Math.abs(delta));<a name="line.871"></a>
+<FONT color="green">872</FONT>                }<a name="line.872"></a>
+<FONT color="green">873</FONT>                return max;<a name="line.873"></a>
+<FONT color="green">874</FONT>            }<a name="line.874"></a>
+<FONT color="green">875</FONT>        }<a name="line.875"></a>
+<FONT color="green">876</FONT>    <a name="line.876"></a>
+<FONT color="green">877</FONT>        /** {@inheritDoc} */<a name="line.877"></a>
+<FONT color="green">878</FONT>        @Override<a name="line.878"></a>
+<FONT color="green">879</FONT>        public double getLInfDistance(double[] v)<a name="line.879"></a>
+<FONT color="green">880</FONT>            throws IllegalArgumentException {<a name="line.880"></a>
+<FONT color="green">881</FONT>            checkVectorDimensions(v.length);<a name="line.881"></a>
+<FONT color="green">882</FONT>            double max = 0;<a name="line.882"></a>
+<FONT color="green">883</FONT>            for (int i = 0; i &lt; data.length; ++i) {<a name="line.883"></a>
+<FONT color="green">884</FONT>                final double delta = data[i] - v[i];<a name="line.884"></a>
+<FONT color="green">885</FONT>                max = Math.max(max, Math.abs(delta));<a name="line.885"></a>
+<FONT color="green">886</FONT>            }<a name="line.886"></a>
+<FONT color="green">887</FONT>            return max;<a name="line.887"></a>
+<FONT color="green">888</FONT>        }<a name="line.888"></a>
+<FONT color="green">889</FONT>    <a name="line.889"></a>
+<FONT color="green">890</FONT>        /**<a name="line.890"></a>
+<FONT color="green">891</FONT>         * Distance between two vectors.<a name="line.891"></a>
+<FONT color="green">892</FONT>         * &lt;p&gt;This method computes the distance consistent with<a name="line.892"></a>
+<FONT color="green">893</FONT>         * L&lt;sub&gt;&amp;infin;&lt;/sub&gt; norm, i.e. the max of the absolute values of<a name="line.893"></a>
+<FONT color="green">894</FONT>         * elements differences.&lt;/p&gt;<a name="line.894"></a>
+<FONT color="green">895</FONT>         * @param v vector to which distance is requested<a name="line.895"></a>
+<FONT color="green">896</FONT>         * @return distance between two vectors.<a name="line.896"></a>
+<FONT color="green">897</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.897"></a>
+<FONT color="green">898</FONT>         * @see #getDistance(RealVector)<a name="line.898"></a>
+<FONT color="green">899</FONT>         * @see #getL1Distance(ArrayRealVector)<a name="line.899"></a>
+<FONT color="green">900</FONT>         * @see #getLInfDistance(ArrayRealVector)<a name="line.900"></a>
+<FONT color="green">901</FONT>         * @see #getNorm()<a name="line.901"></a>
+<FONT color="green">902</FONT>         */<a name="line.902"></a>
+<FONT color="green">903</FONT>        public double getLInfDistance(ArrayRealVector v)<a name="line.903"></a>
+<FONT color="green">904</FONT>            throws IllegalArgumentException {<a name="line.904"></a>
+<FONT color="green">905</FONT>            return getLInfDistance(v.data);<a name="line.905"></a>
+<FONT color="green">906</FONT>        }<a name="line.906"></a>
+<FONT color="green">907</FONT>    <a name="line.907"></a>
+<FONT color="green">908</FONT>        /** {@inheritDoc} */<a name="line.908"></a>
+<FONT color="green">909</FONT>        @Override<a name="line.909"></a>
+<FONT color="green">910</FONT>        public RealVector unitVector() throws ArithmeticException {<a name="line.910"></a>
+<FONT color="green">911</FONT>            final double norm = getNorm();<a name="line.911"></a>
+<FONT color="green">912</FONT>            if (norm == 0) {<a name="line.912"></a>
+<FONT color="green">913</FONT>                throw MathRuntimeException.createArithmeticException("zero norm");<a name="line.913"></a>
+<FONT color="green">914</FONT>            }<a name="line.914"></a>
+<FONT color="green">915</FONT>            return mapDivide(norm);<a name="line.915"></a>
+<FONT color="green">916</FONT>        }<a name="line.916"></a>
+<FONT color="green">917</FONT>    <a name="line.917"></a>
+<FONT color="green">918</FONT>        /** {@inheritDoc} */<a name="line.918"></a>
+<FONT color="green">919</FONT>        @Override<a name="line.919"></a>
+<FONT color="green">920</FONT>        public void unitize() throws ArithmeticException {<a name="line.920"></a>
+<FONT color="green">921</FONT>            final double norm = getNorm();<a name="line.921"></a>
+<FONT color="green">922</FONT>            if (norm == 0) {<a name="line.922"></a>
+<FONT color="green">923</FONT>                throw MathRuntimeException.createArithmeticException("cannot normalize a zero norm vector");<a name="line.923"></a>
+<FONT color="green">924</FONT>            }<a name="line.924"></a>
+<FONT color="green">925</FONT>            mapDivideToSelf(norm);<a name="line.925"></a>
+<FONT color="green">926</FONT>        }<a name="line.926"></a>
+<FONT color="green">927</FONT>    <a name="line.927"></a>
+<FONT color="green">928</FONT>        /** {@inheritDoc} */<a name="line.928"></a>
+<FONT color="green">929</FONT>        public RealVector projection(RealVector v) {<a name="line.929"></a>
+<FONT color="green">930</FONT>            return v.mapMultiply(dotProduct(v) / v.dotProduct(v));<a name="line.930"></a>
+<FONT color="green">931</FONT>        }<a name="line.931"></a>
+<FONT color="green">932</FONT>    <a name="line.932"></a>
+<FONT color="green">933</FONT>        /** {@inheritDoc} */<a name="line.933"></a>
+<FONT color="green">934</FONT>        @Override<a name="line.934"></a>
+<FONT color="green">935</FONT>        public RealVector projection(double[] v) {<a name="line.935"></a>
+<FONT color="green">936</FONT>            return projection(new ArrayRealVector(v, false));<a name="line.936"></a>
+<FONT color="green">937</FONT>        }<a name="line.937"></a>
+<FONT color="green">938</FONT>    <a name="line.938"></a>
+<FONT color="green">939</FONT>       /** Find the orthogonal projection of this vector onto another vector.<a name="line.939"></a>
+<FONT color="green">940</FONT>         * @param v vector onto which instance must be projected<a name="line.940"></a>
+<FONT color="green">941</FONT>         * @return projection of the instance onto v<a name="line.941"></a>
+<FONT color="green">942</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.942"></a>
+<FONT color="green">943</FONT>         */<a name="line.943"></a>
+<FONT color="green">944</FONT>        public ArrayRealVector projection(ArrayRealVector v) {<a name="line.944"></a>
+<FONT color="green">945</FONT>            return (ArrayRealVector) v.mapMultiply(dotProduct(v) / v.dotProduct(v));<a name="line.945"></a>
+<FONT color="green">946</FONT>        }<a name="line.946"></a>
+<FONT color="green">947</FONT>    <a name="line.947"></a>
+<FONT color="green">948</FONT>        /** {@inheritDoc} */<a name="line.948"></a>
+<FONT color="green">949</FONT>        @Override<a name="line.949"></a>
+<FONT color="green">950</FONT>        public RealMatrix outerProduct(RealVector v)<a name="line.950"></a>
+<FONT color="green">951</FONT>            throws IllegalArgumentException {<a name="line.951"></a>
+<FONT color="green">952</FONT>            if (v instanceof ArrayRealVector) {<a name="line.952"></a>
+<FONT color="green">953</FONT>                return outerProduct((ArrayRealVector) v);<a name="line.953"></a>
+<FONT color="green">954</FONT>            } else {<a name="line.954"></a>
+<FONT color="green">955</FONT>                checkVectorDimensions(v);<a name="line.955"></a>
+<FONT color="green">956</FONT>                final int m = data.length;<a name="line.956"></a>
+<FONT color="green">957</FONT>                final RealMatrix out = MatrixUtils.createRealMatrix(m, m);<a name="line.957"></a>
+<FONT color="green">958</FONT>                for (int i = 0; i &lt; data.length; i++) {<a name="line.958"></a>
+<FONT color="green">959</FONT>                    for (int j = 0; j &lt; data.length; j++) {<a name="line.959"></a>
+<FONT color="green">960</FONT>                        out.setEntry(i, j, data[i] * v.getEntry(j));<a name="line.960"></a>
+<FONT color="green">961</FONT>                    }<a name="line.961"></a>
+<FONT color="green">962</FONT>                }<a name="line.962"></a>
+<FONT color="green">963</FONT>                return out;<a name="line.963"></a>
+<FONT color="green">964</FONT>            }<a name="line.964"></a>
+<FONT color="green">965</FONT>        }<a name="line.965"></a>
+<FONT color="green">966</FONT>    <a name="line.966"></a>
+<FONT color="green">967</FONT>        /**<a name="line.967"></a>
+<FONT color="green">968</FONT>         * Compute the outer product.<a name="line.968"></a>
+<FONT color="green">969</FONT>         * @param v vector with which outer product should be computed<a name="line.969"></a>
+<FONT color="green">970</FONT>         * @return the square matrix outer product between instance and v<a name="line.970"></a>
+<FONT color="green">971</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.971"></a>
+<FONT color="green">972</FONT>         */<a name="line.972"></a>
+<FONT color="green">973</FONT>        public RealMatrix outerProduct(ArrayRealVector v)<a name="line.973"></a>
+<FONT color="green">974</FONT>            throws IllegalArgumentException {<a name="line.974"></a>
+<FONT color="green">975</FONT>            return outerProduct(v.data);<a name="line.975"></a>
+<FONT color="green">976</FONT>        }<a name="line.976"></a>
+<FONT color="green">977</FONT>    <a name="line.977"></a>
+<FONT color="green">978</FONT>        /** {@inheritDoc} */<a name="line.978"></a>
+<FONT color="green">979</FONT>        @Override<a name="line.979"></a>
+<FONT color="green">980</FONT>        public RealMatrix outerProduct(double[] v)<a name="line.980"></a>
+<FONT color="green">981</FONT>            throws IllegalArgumentException {<a name="line.981"></a>
+<FONT color="green">982</FONT>            checkVectorDimensions(v.length);<a name="line.982"></a>
+<FONT color="green">983</FONT>            final int m = data.length;<a name="line.983"></a>
+<FONT color="green">984</FONT>            final RealMatrix out = MatrixUtils.createRealMatrix(m, m);<a name="line.984"></a>
+<FONT color="green">985</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.985"></a>
+<FONT color="green">986</FONT>                for (int j = 0; j &lt; data.length; j++) {<a name="line.986"></a>
+<FONT color="green">987</FONT>                    out.setEntry(i, j, data[i] * v[j]);<a name="line.987"></a>
+<FONT color="green">988</FONT>                }<a name="line.988"></a>
+<FONT color="green">989</FONT>            }<a name="line.989"></a>
+<FONT color="green">990</FONT>            return out;<a name="line.990"></a>
+<FONT color="green">991</FONT>        }<a name="line.991"></a>
+<FONT color="green">992</FONT>    <a name="line.992"></a>
+<FONT color="green">993</FONT>        /** {@inheritDoc} */<a name="line.993"></a>
+<FONT color="green">994</FONT>        public double getEntry(int index) throws MatrixIndexException {<a name="line.994"></a>
+<FONT color="green">995</FONT>            return data[index];<a name="line.995"></a>
+<FONT color="green">996</FONT>        }<a name="line.996"></a>
+<FONT color="green">997</FONT>    <a name="line.997"></a>
+<FONT color="green">998</FONT>        /** {@inheritDoc} */<a name="line.998"></a>
+<FONT color="green">999</FONT>        public int getDimension() {<a name="line.999"></a>
+<FONT color="green">1000</FONT>            return data.length;<a name="line.1000"></a>
+<FONT color="green">1001</FONT>        }<a name="line.1001"></a>
+<FONT color="green">1002</FONT>    <a name="line.1002"></a>
+<FONT color="green">1003</FONT>        /** {@inheritDoc} */<a name="line.1003"></a>
+<FONT color="green">1004</FONT>        public RealVector append(RealVector v) {<a name="line.1004"></a>
+<FONT color="green">1005</FONT>            try {<a name="line.1005"></a>
+<FONT color="green">1006</FONT>                return new ArrayRealVector(this, (ArrayRealVector) v);<a name="line.1006"></a>
+<FONT color="green">1007</FONT>            } catch (ClassCastException cce) {<a name="line.1007"></a>
+<FONT color="green">1008</FONT>                return new ArrayRealVector(this, v);<a name="line.1008"></a>
+<FONT color="green">1009</FONT>            }<a name="line.1009"></a>
+<FONT color="green">1010</FONT>        }<a name="line.1010"></a>
+<FONT color="green">1011</FONT>    <a name="line.1011"></a>
+<FONT color="green">1012</FONT>        /**<a name="line.1012"></a>
+<FONT color="green">1013</FONT>         * Construct a vector by appending a vector to this vector.<a name="line.1013"></a>
+<FONT color="green">1014</FONT>         * @param v vector to append to this one.<a name="line.1014"></a>
+<FONT color="green">1015</FONT>         * @return a new vector<a name="line.1015"></a>
+<FONT color="green">1016</FONT>         */<a name="line.1016"></a>
+<FONT color="green">1017</FONT>        public ArrayRealVector append(ArrayRealVector v) {<a name="line.1017"></a>
+<FONT color="green">1018</FONT>            return new ArrayRealVector(this, v);<a name="line.1018"></a>
+<FONT color="green">1019</FONT>        }<a name="line.1019"></a>
+<FONT color="green">1020</FONT>    <a name="line.1020"></a>
+<FONT color="green">1021</FONT>        /** {@inheritDoc} */<a name="line.1021"></a>
+<FONT color="green">1022</FONT>        public RealVector append(double in) {<a name="line.1022"></a>
+<FONT color="green">1023</FONT>            final double[] out = new double[data.length + 1];<a name="line.1023"></a>
+<FONT color="green">1024</FONT>            System.arraycopy(data, 0, out, 0, data.length);<a name="line.1024"></a>
+<FONT color="green">1025</FONT>            out[data.length] = in;<a name="line.1025"></a>
+<FONT color="green">1026</FONT>            return new ArrayRealVector(out, false);<a name="line.1026"></a>
+<FONT color="green">1027</FONT>        }<a name="line.1027"></a>
+<FONT color="green">1028</FONT>    <a name="line.1028"></a>
+<FONT color="green">1029</FONT>        /** {@inheritDoc} */<a name="line.1029"></a>
+<FONT color="green">1030</FONT>        public RealVector append(double[] in) {<a name="line.1030"></a>
+<FONT color="green">1031</FONT>            return new ArrayRealVector(this, in);<a name="line.1031"></a>
+<FONT color="green">1032</FONT>        }<a name="line.1032"></a>
+<FONT color="green">1033</FONT>    <a name="line.1033"></a>
+<FONT color="green">1034</FONT>        /** {@inheritDoc} */<a name="line.1034"></a>
+<FONT color="green">1035</FONT>        public RealVector getSubVector(int index, int n) {<a name="line.1035"></a>
+<FONT color="green">1036</FONT>            ArrayRealVector out = new ArrayRealVector(n);<a name="line.1036"></a>
+<FONT color="green">1037</FONT>            try {<a name="line.1037"></a>
+<FONT color="green">1038</FONT>                System.arraycopy(data, index, out.data, 0, n);<a name="line.1038"></a>
+<FONT color="green">1039</FONT>            } catch (IndexOutOfBoundsException e) {<a name="line.1039"></a>
+<FONT color="green">1040</FONT>                checkIndex(index);<a name="line.1040"></a>
+<FONT color="green">1041</FONT>                checkIndex(index + n - 1);<a name="line.1041"></a>
+<FONT color="green">1042</FONT>            }<a name="line.1042"></a>
+<FONT color="green">1043</FONT>            return out;<a name="line.1043"></a>
+<FONT color="green">1044</FONT>        }<a name="line.1044"></a>
+<FONT color="green">1045</FONT>    <a name="line.1045"></a>
+<FONT color="green">1046</FONT>        /** {@inheritDoc} */<a name="line.1046"></a>
+<FONT color="green">1047</FONT>        public void setEntry(int index, double value) {<a name="line.1047"></a>
+<FONT color="green">1048</FONT>            try {<a name="line.1048"></a>
+<FONT color="green">1049</FONT>                data[index] = value;<a name="line.1049"></a>
+<FONT color="green">1050</FONT>            } catch (IndexOutOfBoundsException e) {<a name="line.1050"></a>
+<FONT color="green">1051</FONT>                checkIndex(index);<a name="line.1051"></a>
+<FONT color="green">1052</FONT>            }<a name="line.1052"></a>
+<FONT color="green">1053</FONT>        }<a name="line.1053"></a>
+<FONT color="green">1054</FONT>    <a name="line.1054"></a>
+<FONT color="green">1055</FONT>        /** {@inheritDoc} */<a name="line.1055"></a>
+<FONT color="green">1056</FONT>        @Override<a name="line.1056"></a>
+<FONT color="green">1057</FONT>        public void setSubVector(int index, RealVector v) {<a name="line.1057"></a>
+<FONT color="green">1058</FONT>            try {<a name="line.1058"></a>
+<FONT color="green">1059</FONT>                try {<a name="line.1059"></a>
+<FONT color="green">1060</FONT>                    set(index, (ArrayRealVector) v);<a name="line.1060"></a>
+<FONT color="green">1061</FONT>                } catch (ClassCastException cce) {<a name="line.1061"></a>
+<FONT color="green">1062</FONT>                    for (int i = index; i &lt; index + v.getDimension(); ++i) {<a name="line.1062"></a>
+<FONT color="green">1063</FONT>                        data[i] = v.getEntry(i-index);<a name="line.1063"></a>
+<FONT color="green">1064</FONT>                    }<a name="line.1064"></a>
+<FONT color="green">1065</FONT>                }<a name="line.1065"></a>
+<FONT color="green">1066</FONT>            } catch (IndexOutOfBoundsException e) {<a name="line.1066"></a>
+<FONT color="green">1067</FONT>                checkIndex(index);<a name="line.1067"></a>
+<FONT color="green">1068</FONT>                checkIndex(index + v.getDimension() - 1);<a name="line.1068"></a>
+<FONT color="green">1069</FONT>            }<a name="line.1069"></a>
+<FONT color="green">1070</FONT>        }<a name="line.1070"></a>
+<FONT color="green">1071</FONT>    <a name="line.1071"></a>
+<FONT color="green">1072</FONT>        /** {@inheritDoc} */<a name="line.1072"></a>
+<FONT color="green">1073</FONT>        @Override<a name="line.1073"></a>
+<FONT color="green">1074</FONT>        public void setSubVector(int index, double[] v) {<a name="line.1074"></a>
+<FONT color="green">1075</FONT>            try {<a name="line.1075"></a>
+<FONT color="green">1076</FONT>                System.arraycopy(v, 0, data, index, v.length);<a name="line.1076"></a>
+<FONT color="green">1077</FONT>            } catch (IndexOutOfBoundsException e) {<a name="line.1077"></a>
+<FONT color="green">1078</FONT>                checkIndex(index);<a name="line.1078"></a>
+<FONT color="green">1079</FONT>                checkIndex(index + v.length - 1);<a name="line.1079"></a>
+<FONT color="green">1080</FONT>            }<a name="line.1080"></a>
+<FONT color="green">1081</FONT>        }<a name="line.1081"></a>
+<FONT color="green">1082</FONT>    <a name="line.1082"></a>
+<FONT color="green">1083</FONT>        /**<a name="line.1083"></a>
+<FONT color="green">1084</FONT>         * Set a set of consecutive elements.<a name="line.1084"></a>
+<FONT color="green">1085</FONT>         *<a name="line.1085"></a>
+<FONT color="green">1086</FONT>         * @param index index of first element to be set.<a name="line.1086"></a>
+<FONT color="green">1087</FONT>         * @param v vector containing the values to set.<a name="line.1087"></a>
+<FONT color="green">1088</FONT>         * @exception MatrixIndexException if the index is<a name="line.1088"></a>
+<FONT color="green">1089</FONT>         * inconsistent with vector size<a name="line.1089"></a>
+<FONT color="green">1090</FONT>         */<a name="line.1090"></a>
+<FONT color="green">1091</FONT>        public void set(int index, ArrayRealVector v)<a name="line.1091"></a>
+<FONT color="green">1092</FONT>            throws MatrixIndexException {<a name="line.1092"></a>
+<FONT color="green">1093</FONT>            setSubVector(index, v.data);<a name="line.1093"></a>
+<FONT color="green">1094</FONT>        }<a name="line.1094"></a>
+<FONT color="green">1095</FONT>    <a name="line.1095"></a>
+<FONT color="green">1096</FONT>        /** {@inheritDoc} */<a name="line.1096"></a>
+<FONT color="green">1097</FONT>        @Override<a name="line.1097"></a>
+<FONT color="green">1098</FONT>        public void set(double value) {<a name="line.1098"></a>
+<FONT color="green">1099</FONT>            Arrays.fill(data, value);<a name="line.1099"></a>
+<FONT color="green">1100</FONT>        }<a name="line.1100"></a>
+<FONT color="green">1101</FONT>    <a name="line.1101"></a>
+<FONT color="green">1102</FONT>        /** {@inheritDoc} */<a name="line.1102"></a>
+<FONT color="green">1103</FONT>        @Override<a name="line.1103"></a>
+<FONT color="green">1104</FONT>        public double[] toArray(){<a name="line.1104"></a>
+<FONT color="green">1105</FONT>            return data.clone();<a name="line.1105"></a>
+<FONT color="green">1106</FONT>        }<a name="line.1106"></a>
+<FONT color="green">1107</FONT>    <a name="line.1107"></a>
+<FONT color="green">1108</FONT>        /** {@inheritDoc} */<a name="line.1108"></a>
+<FONT color="green">1109</FONT>        @Override<a name="line.1109"></a>
+<FONT color="green">1110</FONT>        public String toString(){<a name="line.1110"></a>
+<FONT color="green">1111</FONT>            return DEFAULT_FORMAT.format(this);<a name="line.1111"></a>
+<FONT color="green">1112</FONT>        }<a name="line.1112"></a>
+<FONT color="green">1113</FONT>    <a name="line.1113"></a>
+<FONT color="green">1114</FONT>        /**<a name="line.1114"></a>
+<FONT color="green">1115</FONT>         * Check if instance and specified vectors have the same dimension.<a name="line.1115"></a>
+<FONT color="green">1116</FONT>         * @param v vector to compare instance with<a name="line.1116"></a>
+<FONT color="green">1117</FONT>         * @exception IllegalArgumentException if the vectors do not<a name="line.1117"></a>
+<FONT color="green">1118</FONT>         * have the same dimension<a name="line.1118"></a>
+<FONT color="green">1119</FONT>         */<a name="line.1119"></a>
+<FONT color="green">1120</FONT>        @Override<a name="line.1120"></a>
+<FONT color="green">1121</FONT>        protected void checkVectorDimensions(RealVector v)<a name="line.1121"></a>
+<FONT color="green">1122</FONT>            throws IllegalArgumentException {<a name="line.1122"></a>
+<FONT color="green">1123</FONT>            checkVectorDimensions(v.getDimension());<a name="line.1123"></a>
+<FONT color="green">1124</FONT>        }<a name="line.1124"></a>
+<FONT color="green">1125</FONT>    <a name="line.1125"></a>
+<FONT color="green">1126</FONT>        /**<a name="line.1126"></a>
+<FONT color="green">1127</FONT>         * Check if instance dimension is equal to some expected value.<a name="line.1127"></a>
+<FONT color="green">1128</FONT>         *<a name="line.1128"></a>
+<FONT color="green">1129</FONT>         * @param n expected dimension.<a name="line.1129"></a>
+<FONT color="green">1130</FONT>         * @exception IllegalArgumentException if the dimension is<a name="line.1130"></a>
+<FONT color="green">1131</FONT>         * inconsistent with vector size<a name="line.1131"></a>
+<FONT color="green">1132</FONT>         */<a name="line.1132"></a>
+<FONT color="green">1133</FONT>        @Override<a name="line.1133"></a>
+<FONT color="green">1134</FONT>        protected void checkVectorDimensions(int n)<a name="line.1134"></a>
+<FONT color="green">1135</FONT>            throws IllegalArgumentException {<a name="line.1135"></a>
+<FONT color="green">1136</FONT>            if (data.length != n) {<a name="line.1136"></a>
+<FONT color="green">1137</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1137"></a>
+<FONT color="green">1138</FONT>                        "vector length mismatch: got {0} but expected {1}",<a name="line.1138"></a>
+<FONT color="green">1139</FONT>                        data.length, n);<a name="line.1139"></a>
+<FONT color="green">1140</FONT>            }<a name="line.1140"></a>
+<FONT color="green">1141</FONT>        }<a name="line.1141"></a>
+<FONT color="green">1142</FONT>    <a name="line.1142"></a>
+<FONT color="green">1143</FONT>        /**<a name="line.1143"></a>
+<FONT color="green">1144</FONT>         * Returns true if any coordinate of this vector is NaN; false otherwise<a name="line.1144"></a>
+<FONT color="green">1145</FONT>         * @return  true if any coordinate of this vector is NaN; false otherwise<a name="line.1145"></a>
+<FONT color="green">1146</FONT>         */<a name="line.1146"></a>
+<FONT color="green">1147</FONT>        public boolean isNaN() {<a name="line.1147"></a>
+<FONT color="green">1148</FONT>            for (double v : data) {<a name="line.1148"></a>
+<FONT color="green">1149</FONT>                if (Double.isNaN(v)) {<a name="line.1149"></a>
+<FONT color="green">1150</FONT>                    return true;<a name="line.1150"></a>
+<FONT color="green">1151</FONT>                }<a name="line.1151"></a>
+<FONT color="green">1152</FONT>            }<a name="line.1152"></a>
+<FONT color="green">1153</FONT>            return false;<a name="line.1153"></a>
+<FONT color="green">1154</FONT>        }<a name="line.1154"></a>
+<FONT color="green">1155</FONT>    <a name="line.1155"></a>
+<FONT color="green">1156</FONT>        /**<a name="line.1156"></a>
+<FONT color="green">1157</FONT>         * Returns true if any coordinate of this vector is infinite and none are NaN;<a name="line.1157"></a>
+<FONT color="green">1158</FONT>         * false otherwise<a name="line.1158"></a>
+<FONT color="green">1159</FONT>         * @return  true if any coordinate of this vector is infinite and none are NaN;<a name="line.1159"></a>
+<FONT color="green">1160</FONT>         * false otherwise<a name="line.1160"></a>
+<FONT color="green">1161</FONT>         */<a name="line.1161"></a>
+<FONT color="green">1162</FONT>        public boolean isInfinite() {<a name="line.1162"></a>
+<FONT color="green">1163</FONT>    <a name="line.1163"></a>
+<FONT color="green">1164</FONT>            if (isNaN()) {<a name="line.1164"></a>
+<FONT color="green">1165</FONT>                return false;<a name="line.1165"></a>
+<FONT color="green">1166</FONT>            }<a name="line.1166"></a>
+<FONT color="green">1167</FONT>    <a name="line.1167"></a>
+<FONT color="green">1168</FONT>            for (double v : data) {<a name="line.1168"></a>
+<FONT color="green">1169</FONT>                if (Double.isInfinite(v)) {<a name="line.1169"></a>
+<FONT color="green">1170</FONT>                    return true;<a name="line.1170"></a>
+<FONT color="green">1171</FONT>                }<a name="line.1171"></a>
+<FONT color="green">1172</FONT>            }<a name="line.1172"></a>
+<FONT color="green">1173</FONT>    <a name="line.1173"></a>
+<FONT color="green">1174</FONT>            return false;<a name="line.1174"></a>
+<FONT color="green">1175</FONT>    <a name="line.1175"></a>
+<FONT color="green">1176</FONT>        }<a name="line.1176"></a>
+<FONT color="green">1177</FONT>    <a name="line.1177"></a>
+<FONT color="green">1178</FONT>        /**<a name="line.1178"></a>
+<FONT color="green">1179</FONT>         * Test for the equality of two real vectors.<a name="line.1179"></a>
+<FONT color="green">1180</FONT>         * &lt;p&gt;<a name="line.1180"></a>
+<FONT color="green">1181</FONT>         * If all coordinates of two real vectors are exactly the same, and none are<a name="line.1181"></a>
+<FONT color="green">1182</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt;, the two real vectors are considered to be equal.<a name="line.1182"></a>
+<FONT color="green">1183</FONT>         * &lt;/p&gt;<a name="line.1183"></a>
+<FONT color="green">1184</FONT>         * &lt;p&gt;<a name="line.1184"></a>
+<FONT color="green">1185</FONT>         * &lt;code&gt;NaN&lt;/code&gt; coordinates are considered to affect globally the vector<a name="line.1185"></a>
+<FONT color="green">1186</FONT>         * and be equals to each other - i.e, if either (or all) coordinates of the<a name="line.1186"></a>
+<FONT color="green">1187</FONT>         * real vector are equal to &lt;code&gt;Double.NaN&lt;/code&gt;, the real vector is equal to<a name="line.1187"></a>
+<FONT color="green">1188</FONT>         * a vector with all &lt;code&gt;Double.NaN&lt;/code&gt; coordinates.<a name="line.1188"></a>
+<FONT color="green">1189</FONT>         * &lt;/p&gt;<a name="line.1189"></a>
+<FONT color="green">1190</FONT>         *<a name="line.1190"></a>
+<FONT color="green">1191</FONT>         * @param other Object to test for equality to this<a name="line.1191"></a>
+<FONT color="green">1192</FONT>         * @return true if two vector objects are equal, false if<a name="line.1192"></a>
+<FONT color="green">1193</FONT>         *         object is null, not an instance of RealVector, or<a name="line.1193"></a>
+<FONT color="green">1194</FONT>         *         not equal to this RealVector instance<a name="line.1194"></a>
+<FONT color="green">1195</FONT>         *<a name="line.1195"></a>
+<FONT color="green">1196</FONT>         */<a name="line.1196"></a>
+<FONT color="green">1197</FONT>        @Override<a name="line.1197"></a>
+<FONT color="green">1198</FONT>        public boolean equals(Object other) {<a name="line.1198"></a>
+<FONT color="green">1199</FONT>    <a name="line.1199"></a>
+<FONT color="green">1200</FONT>          if (this == other) {<a name="line.1200"></a>
+<FONT color="green">1201</FONT>            return true;<a name="line.1201"></a>
+<FONT color="green">1202</FONT>          }<a name="line.1202"></a>
+<FONT color="green">1203</FONT>    <a name="line.1203"></a>
+<FONT color="green">1204</FONT>          if (other == null || !(other instanceof RealVector)) {<a name="line.1204"></a>
+<FONT color="green">1205</FONT>            return false;<a name="line.1205"></a>
+<FONT color="green">1206</FONT>          }<a name="line.1206"></a>
+<FONT color="green">1207</FONT>    <a name="line.1207"></a>
+<FONT color="green">1208</FONT>    <a name="line.1208"></a>
+<FONT color="green">1209</FONT>          RealVector rhs = (RealVector) other;<a name="line.1209"></a>
+<FONT color="green">1210</FONT>          if (data.length != rhs.getDimension()) {<a name="line.1210"></a>
+<FONT color="green">1211</FONT>            return false;<a name="line.1211"></a>
+<FONT color="green">1212</FONT>          }<a name="line.1212"></a>
+<FONT color="green">1213</FONT>    <a name="line.1213"></a>
+<FONT color="green">1214</FONT>          if (rhs.isNaN()) {<a name="line.1214"></a>
+<FONT color="green">1215</FONT>            return this.isNaN();<a name="line.1215"></a>
+<FONT color="green">1216</FONT>          }<a name="line.1216"></a>
+<FONT color="green">1217</FONT>    <a name="line.1217"></a>
+<FONT color="green">1218</FONT>          for (int i = 0; i &lt; data.length; ++i) {<a name="line.1218"></a>
+<FONT color="green">1219</FONT>            if (data[i] != rhs.getEntry(i)) {<a name="line.1219"></a>
+<FONT color="green">1220</FONT>              return false;<a name="line.1220"></a>
+<FONT color="green">1221</FONT>            }<a name="line.1221"></a>
+<FONT color="green">1222</FONT>          }<a name="line.1222"></a>
+<FONT color="green">1223</FONT>          return true;<a name="line.1223"></a>
+<FONT color="green">1224</FONT>        }<a name="line.1224"></a>
+<FONT color="green">1225</FONT>    <a name="line.1225"></a>
+<FONT color="green">1226</FONT>        /**<a name="line.1226"></a>
+<FONT color="green">1227</FONT>         * Get a hashCode for the real vector.<a name="line.1227"></a>
+<FONT color="green">1228</FONT>         * &lt;p&gt;All NaN values have the same hash code.&lt;/p&gt;<a name="line.1228"></a>
+<FONT color="green">1229</FONT>         * @return a hash code value for this object<a name="line.1229"></a>
+<FONT color="green">1230</FONT>         */<a name="line.1230"></a>
+<FONT color="green">1231</FONT>        @Override<a name="line.1231"></a>
+<FONT color="green">1232</FONT>        public int hashCode() {<a name="line.1232"></a>
+<FONT color="green">1233</FONT>            if (isNaN()) {<a name="line.1233"></a>
+<FONT color="green">1234</FONT>                return 9;<a name="line.1234"></a>
+<FONT color="green">1235</FONT>            }<a name="line.1235"></a>
+<FONT color="green">1236</FONT>            return MathUtils.hash(data);<a name="line.1236"></a>
+<FONT color="green">1237</FONT>        }<a name="line.1237"></a>
+<FONT color="green">1238</FONT>    <a name="line.1238"></a>
+<FONT color="green">1239</FONT>    }<a name="line.1239"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/BigMatrix.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,397 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.math.BigDecimal;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Interface defining a real-valued matrix with basic algebraic operations, using<a name="line.23"></a>
+<FONT color="green">024</FONT>     * BigDecimal representations for the entries.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Matrix element indexing is 0-based -- e.g., &lt;code&gt;getEntry(0, 0)&lt;/code&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * returns the element in the first row, first column of the matrix.&lt;/p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @deprecated as of 2.0, replaced by {@link FieldMatrix} with a {@link<a name="line.30"></a>
+<FONT color="green">031</FONT>     * org.apache.commons.math.util.BigReal} parameter<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    @Deprecated<a name="line.33"></a>
+<FONT color="green">034</FONT>    public interface BigMatrix extends AnyMatrix {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /**<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Returns a (deep) copy of this.<a name="line.37"></a>
+<FONT color="green">038</FONT>         *<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @return matrix copy<a name="line.39"></a>
+<FONT color="green">040</FONT>         */<a name="line.40"></a>
+<FONT color="green">041</FONT>        BigMatrix copy();<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /**<a name="line.43"></a>
+<FONT color="green">044</FONT>         * Compute the sum of this and m.<a name="line.44"></a>
+<FONT color="green">045</FONT>         *<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param m    matrix to be added<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @return     this + m<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @exception  IllegalArgumentException if m is not the same size as this<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        BigMatrix add(BigMatrix m) throws IllegalArgumentException;<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * Compute this minus m.<a name="line.53"></a>
+<FONT color="green">054</FONT>         *<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param m    matrix to be subtracted<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @return     this + m<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @exception  IllegalArgumentException if m is not the same size as this<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        BigMatrix subtract(BigMatrix m) throws IllegalArgumentException;<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>         /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Returns the result of adding d to each entry of this.<a name="line.62"></a>
+<FONT color="green">063</FONT>         *<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @param d    value to be added to each entry<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @return     d + this<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        BigMatrix scalarAdd(BigDecimal d);<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * Returns the result multiplying each entry of this by d.<a name="line.70"></a>
+<FONT color="green">071</FONT>         *<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param d    value to multiply all entries by<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @return     d * this<a name="line.73"></a>
+<FONT color="green">074</FONT>         */<a name="line.74"></a>
+<FONT color="green">075</FONT>        BigMatrix scalarMultiply(BigDecimal d);<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /**<a name="line.77"></a>
+<FONT color="green">078</FONT>         * Returns the result of postmultiplying this by m.<a name="line.78"></a>
+<FONT color="green">079</FONT>         *<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @param m    matrix to postmultiply by<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @return     this * m<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @throws     IllegalArgumentException<a name="line.82"></a>
+<FONT color="green">083</FONT>         *             if columnDimension(this) != rowDimension(m)<a name="line.83"></a>
+<FONT color="green">084</FONT>         */<a name="line.84"></a>
+<FONT color="green">085</FONT>        BigMatrix multiply(BigMatrix m) throws IllegalArgumentException;<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>        /**<a name="line.87"></a>
+<FONT color="green">088</FONT>         * Returns the result premultiplying this by &lt;code&gt;m&lt;/code&gt;.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @param m    matrix to premultiply by<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @return     m * this<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @throws     IllegalArgumentException<a name="line.91"></a>
+<FONT color="green">092</FONT>         *             if rowDimension(this) != columnDimension(m)<a name="line.92"></a>
+<FONT color="green">093</FONT>         */<a name="line.93"></a>
+<FONT color="green">094</FONT>        BigMatrix preMultiply(BigMatrix m) throws IllegalArgumentException;<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /**<a name="line.96"></a>
+<FONT color="green">097</FONT>         * Returns matrix entries as a two-dimensional array.<a name="line.97"></a>
+<FONT color="green">098</FONT>         *<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @return    2-dimensional array of entries<a name="line.99"></a>
+<FONT color="green">100</FONT>         */<a name="line.100"></a>
+<FONT color="green">101</FONT>        BigDecimal[][] getData();<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        /**<a name="line.103"></a>
+<FONT color="green">104</FONT>         * Returns matrix entries as a two-dimensional array.<a name="line.104"></a>
+<FONT color="green">105</FONT>         *<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @return    2-dimensional array of entries<a name="line.106"></a>
+<FONT color="green">107</FONT>         */<a name="line.107"></a>
+<FONT color="green">108</FONT>        double [][] getDataAsDoubleArray();<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>        /***<a name="line.110"></a>
+<FONT color="green">111</FONT>         * Gets the rounding mode<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @return the rounding mode<a name="line.112"></a>
+<FONT color="green">113</FONT>         */<a name="line.113"></a>
+<FONT color="green">114</FONT>        int getRoundingMode();<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>        /**<a name="line.116"></a>
+<FONT color="green">117</FONT>         * Returns the &lt;a href="http://mathworld.wolfram.com/MaximumAbsoluteRowSumNorm.html"&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>         * maximum absolute row sum norm&lt;/a&gt; of the matrix.<a name="line.118"></a>
+<FONT color="green">119</FONT>         *<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @return norm<a name="line.120"></a>
+<FONT color="green">121</FONT>         */<a name="line.121"></a>
+<FONT color="green">122</FONT>        BigDecimal getNorm();<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>        /**<a name="line.124"></a>
+<FONT color="green">125</FONT>         * Gets a submatrix. Rows and columns are indicated<a name="line.125"></a>
+<FONT color="green">126</FONT>         * counting from 0 to n-1.<a name="line.126"></a>
+<FONT color="green">127</FONT>         *<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @param startRow Initial row index<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @param endRow Final row index<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @param startColumn Initial column index<a name="line.130"></a>
+<FONT color="green">131</FONT>         * @param endColumn Final column index<a name="line.131"></a>
+<FONT color="green">132</FONT>         * @return The subMatrix containing the data of the<a name="line.132"></a>
+<FONT color="green">133</FONT>         *         specified rows and columns<a name="line.133"></a>
+<FONT color="green">134</FONT>         * @exception MatrixIndexException  if the indices are not valid<a name="line.134"></a>
+<FONT color="green">135</FONT>         */<a name="line.135"></a>
+<FONT color="green">136</FONT>        BigMatrix getSubMatrix(int startRow, int endRow, int startColumn,<a name="line.136"></a>
+<FONT color="green">137</FONT>                int endColumn) throws MatrixIndexException;<a name="line.137"></a>
+<FONT color="green">138</FONT>    <a name="line.138"></a>
+<FONT color="green">139</FONT>        /**<a name="line.139"></a>
+<FONT color="green">140</FONT>         * Gets a submatrix. Rows and columns are indicated<a name="line.140"></a>
+<FONT color="green">141</FONT>         * counting from 0 to n-1.<a name="line.141"></a>
+<FONT color="green">142</FONT>         *<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @param selectedRows Array of row indices.<a name="line.143"></a>
+<FONT color="green">144</FONT>         * @param selectedColumns Array of column indices.<a name="line.144"></a>
+<FONT color="green">145</FONT>         * @return The subMatrix containing the data in the<a name="line.145"></a>
+<FONT color="green">146</FONT>         *         specified rows and columns<a name="line.146"></a>
+<FONT color="green">147</FONT>         * @exception MatrixIndexException if row or column selections are not valid<a name="line.147"></a>
+<FONT color="green">148</FONT>         */<a name="line.148"></a>
+<FONT color="green">149</FONT>        BigMatrix getSubMatrix(int[] selectedRows, int[] selectedColumns)<a name="line.149"></a>
+<FONT color="green">150</FONT>        throws MatrixIndexException;<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>        /**<a name="line.152"></a>
+<FONT color="green">153</FONT>         * Returns the entries in row number &lt;code&gt;row&lt;/code&gt;<a name="line.153"></a>
+<FONT color="green">154</FONT>         * as a row matrix.  Row indices start at 0.<a name="line.154"></a>
+<FONT color="green">155</FONT>         *<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @param row the row to be fetched<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @return row matrix<a name="line.157"></a>
+<FONT color="green">158</FONT>         * @throws MatrixIndexException if the specified row index is invalid<a name="line.158"></a>
+<FONT color="green">159</FONT>         */<a name="line.159"></a>
+<FONT color="green">160</FONT>        BigMatrix getRowMatrix(int row) throws MatrixIndexException;<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>        /**<a name="line.162"></a>
+<FONT color="green">163</FONT>         * Returns the entries in column number &lt;code&gt;column&lt;/code&gt;<a name="line.163"></a>
+<FONT color="green">164</FONT>         * as a column matrix.  Column indices start at 0.<a name="line.164"></a>
+<FONT color="green">165</FONT>         *<a name="line.165"></a>
+<FONT color="green">166</FONT>         * @param column the column to be fetched<a name="line.166"></a>
+<FONT color="green">167</FONT>         * @return column matrix<a name="line.167"></a>
+<FONT color="green">168</FONT>         * @throws MatrixIndexException if the specified column index is invalid<a name="line.168"></a>
+<FONT color="green">169</FONT>         */<a name="line.169"></a>
+<FONT color="green">170</FONT>        BigMatrix getColumnMatrix(int column) throws MatrixIndexException;<a name="line.170"></a>
+<FONT color="green">171</FONT>    <a name="line.171"></a>
+<FONT color="green">172</FONT>        /**<a name="line.172"></a>
+<FONT color="green">173</FONT>         * Returns the entries in row number &lt;code&gt;row&lt;/code&gt; as an array.<a name="line.173"></a>
+<FONT color="green">174</FONT>         * &lt;p&gt;<a name="line.174"></a>
+<FONT color="green">175</FONT>         * Row indices start at 0.  A &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown<a name="line.175"></a>
+<FONT color="green">176</FONT>         * unless &lt;code&gt;0 &lt;= row &lt; rowDimension.&lt;/code&gt;&lt;/p&gt;<a name="line.176"></a>
+<FONT color="green">177</FONT>         *<a name="line.177"></a>
+<FONT color="green">178</FONT>         * @param row the row to be fetched<a name="line.178"></a>
+<FONT color="green">179</FONT>         * @return array of entries in the row<a name="line.179"></a>
+<FONT color="green">180</FONT>         * @throws MatrixIndexException if the specified row index is not valid<a name="line.180"></a>
+<FONT color="green">181</FONT>         */<a name="line.181"></a>
+<FONT color="green">182</FONT>        BigDecimal[] getRow(int row) throws MatrixIndexException;<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>        /**<a name="line.184"></a>
+<FONT color="green">185</FONT>         * Returns the entries in row number &lt;code&gt;row&lt;/code&gt; as an array<a name="line.185"></a>
+<FONT color="green">186</FONT>         * of double values.<a name="line.186"></a>
+<FONT color="green">187</FONT>         * &lt;p&gt;<a name="line.187"></a>
+<FONT color="green">188</FONT>         * Row indices start at 0.  A &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown<a name="line.188"></a>
+<FONT color="green">189</FONT>         * unless &lt;code&gt;0 &lt;= row &lt; rowDimension.&lt;/code&gt;&lt;/p&gt;<a name="line.189"></a>
+<FONT color="green">190</FONT>         *<a name="line.190"></a>
+<FONT color="green">191</FONT>         * @param row the row to be fetched<a name="line.191"></a>
+<FONT color="green">192</FONT>         * @return array of entries in the row<a name="line.192"></a>
+<FONT color="green">193</FONT>         * @throws MatrixIndexException if the specified row index is not valid<a name="line.193"></a>
+<FONT color="green">194</FONT>         */<a name="line.194"></a>
+<FONT color="green">195</FONT>        double [] getRowAsDoubleArray(int row) throws MatrixIndexException;<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>        /**<a name="line.197"></a>
+<FONT color="green">198</FONT>         * Returns the entries in column number &lt;code&gt;col&lt;/code&gt; as an array.<a name="line.198"></a>
+<FONT color="green">199</FONT>         * &lt;p&gt;<a name="line.199"></a>
+<FONT color="green">200</FONT>         * Column indices start at 0.  A &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown<a name="line.200"></a>
+<FONT color="green">201</FONT>         * unless &lt;code&gt;0 &lt;= column &lt; columnDimension.&lt;/code&gt;&lt;/p&gt;<a name="line.201"></a>
+<FONT color="green">202</FONT>         *<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @param col the column to be fetched<a name="line.203"></a>
+<FONT color="green">204</FONT>         * @return array of entries in the column<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @throws MatrixIndexException if the specified column index is not valid<a name="line.205"></a>
+<FONT color="green">206</FONT>         */<a name="line.206"></a>
+<FONT color="green">207</FONT>        BigDecimal[] getColumn(int col) throws MatrixIndexException;<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>        /**<a name="line.209"></a>
+<FONT color="green">210</FONT>         * Returns the entries in column number &lt;code&gt;col&lt;/code&gt; as an array<a name="line.210"></a>
+<FONT color="green">211</FONT>         * of double values.<a name="line.211"></a>
+<FONT color="green">212</FONT>         * &lt;p&gt;<a name="line.212"></a>
+<FONT color="green">213</FONT>         * Column indices start at 0.  A &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown<a name="line.213"></a>
+<FONT color="green">214</FONT>         * unless &lt;code&gt;0 &lt;= column &lt; columnDimension.&lt;/code&gt;&lt;/p&gt;<a name="line.214"></a>
+<FONT color="green">215</FONT>         *<a name="line.215"></a>
+<FONT color="green">216</FONT>         * @param col the column to be fetched<a name="line.216"></a>
+<FONT color="green">217</FONT>         * @return array of entries in the column<a name="line.217"></a>
+<FONT color="green">218</FONT>         * @throws MatrixIndexException if the specified column index is not valid<a name="line.218"></a>
+<FONT color="green">219</FONT>         */<a name="line.219"></a>
+<FONT color="green">220</FONT>        double [] getColumnAsDoubleArray(int col) throws MatrixIndexException;<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>        /**<a name="line.222"></a>
+<FONT color="green">223</FONT>         * Returns the entry in the specified row and column.<a name="line.223"></a>
+<FONT color="green">224</FONT>         * &lt;p&gt;<a name="line.224"></a>
+<FONT color="green">225</FONT>         * Row and column indices start at 0 and must satisfy<a name="line.225"></a>
+<FONT color="green">226</FONT>         * &lt;ul&gt;<a name="line.226"></a>
+<FONT color="green">227</FONT>         * &lt;li&gt;&lt;code&gt;0 &lt;= row &lt; rowDimension&lt;/code&gt;&lt;/li&gt;<a name="line.227"></a>
+<FONT color="green">228</FONT>         * &lt;li&gt;&lt;code&gt; 0 &lt;= column &lt; columnDimension&lt;/code&gt;&lt;/li&gt;<a name="line.228"></a>
+<FONT color="green">229</FONT>         * &lt;/ul&gt;<a name="line.229"></a>
+<FONT color="green">230</FONT>         * otherwise a &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.230"></a>
+<FONT color="green">231</FONT>         *<a name="line.231"></a>
+<FONT color="green">232</FONT>         * @param row  row location of entry to be fetched<a name="line.232"></a>
+<FONT color="green">233</FONT>         * @param column  column location of entry to be fetched<a name="line.233"></a>
+<FONT color="green">234</FONT>         * @return matrix entry in row,column<a name="line.234"></a>
+<FONT color="green">235</FONT>         * @throws MatrixIndexException if the row or column index is not valid<a name="line.235"></a>
+<FONT color="green">236</FONT>         */<a name="line.236"></a>
+<FONT color="green">237</FONT>        BigDecimal getEntry(int row, int column) throws MatrixIndexException;<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>        /**<a name="line.239"></a>
+<FONT color="green">240</FONT>         * Returns the entry in the specified row and column as a double.<a name="line.240"></a>
+<FONT color="green">241</FONT>         * &lt;p&gt;<a name="line.241"></a>
+<FONT color="green">242</FONT>         * Row and column indices start at 0 and must satisfy<a name="line.242"></a>
+<FONT color="green">243</FONT>         * &lt;ul&gt;<a name="line.243"></a>
+<FONT color="green">244</FONT>         * &lt;li&gt;&lt;code&gt;0 &lt;= row &lt; rowDimension&lt;/code&gt;&lt;/li&gt;<a name="line.244"></a>
+<FONT color="green">245</FONT>         * &lt;li&gt;&lt;code&gt; 0 &lt;= column &lt; columnDimension&lt;/code&gt;&lt;/li&gt;<a name="line.245"></a>
+<FONT color="green">246</FONT>         * &lt;/ul&gt;<a name="line.246"></a>
+<FONT color="green">247</FONT>         * otherwise a &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.247"></a>
+<FONT color="green">248</FONT>         *<a name="line.248"></a>
+<FONT color="green">249</FONT>         * @param row  row location of entry to be fetched<a name="line.249"></a>
+<FONT color="green">250</FONT>         * @param column  column location of entry to be fetched<a name="line.250"></a>
+<FONT color="green">251</FONT>         * @return matrix entry in row,column<a name="line.251"></a>
+<FONT color="green">252</FONT>         * @throws MatrixIndexException if the row or column index is not valid<a name="line.252"></a>
+<FONT color="green">253</FONT>         */<a name="line.253"></a>
+<FONT color="green">254</FONT>        double getEntryAsDouble(int row, int column) throws MatrixIndexException;<a name="line.254"></a>
+<FONT color="green">255</FONT>    <a name="line.255"></a>
+<FONT color="green">256</FONT>        /**<a name="line.256"></a>
+<FONT color="green">257</FONT>         * Returns the transpose of this matrix.<a name="line.257"></a>
+<FONT color="green">258</FONT>         *<a name="line.258"></a>
+<FONT color="green">259</FONT>         * @return transpose matrix<a name="line.259"></a>
+<FONT color="green">260</FONT>         */<a name="line.260"></a>
+<FONT color="green">261</FONT>        BigMatrix transpose();<a name="line.261"></a>
+<FONT color="green">262</FONT>    <a name="line.262"></a>
+<FONT color="green">263</FONT>        /**<a name="line.263"></a>
+<FONT color="green">264</FONT>         * Returns the inverse of this matrix.<a name="line.264"></a>
+<FONT color="green">265</FONT>         *<a name="line.265"></a>
+<FONT color="green">266</FONT>         * @return inverse matrix<a name="line.266"></a>
+<FONT color="green">267</FONT>         * @throws org.apache.commons.math.linear.InvalidMatrixException if<a name="line.267"></a>
+<FONT color="green">268</FONT>         *     this is not invertible<a name="line.268"></a>
+<FONT color="green">269</FONT>         */<a name="line.269"></a>
+<FONT color="green">270</FONT>        BigMatrix inverse() throws InvalidMatrixException;<a name="line.270"></a>
+<FONT color="green">271</FONT>    <a name="line.271"></a>
+<FONT color="green">272</FONT>        /**<a name="line.272"></a>
+<FONT color="green">273</FONT>         * Returns the determinant of this matrix.<a name="line.273"></a>
+<FONT color="green">274</FONT>         *<a name="line.274"></a>
+<FONT color="green">275</FONT>         * @return determinant<a name="line.275"></a>
+<FONT color="green">276</FONT>          *@throws org.apache.commons.math.linear.InvalidMatrixException if<a name="line.276"></a>
+<FONT color="green">277</FONT>          *    matrix is not square<a name="line.277"></a>
+<FONT color="green">278</FONT>         */<a name="line.278"></a>
+<FONT color="green">279</FONT>        BigDecimal getDeterminant() throws InvalidMatrixException;<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>        /**<a name="line.281"></a>
+<FONT color="green">282</FONT>         * Returns the &lt;a href="http://mathworld.wolfram.com/MatrixTrace.html"&gt;<a name="line.282"></a>
+<FONT color="green">283</FONT>         * trace&lt;/a&gt; of the matrix (the sum of the elements on the main diagonal).<a name="line.283"></a>
+<FONT color="green">284</FONT>         *<a name="line.284"></a>
+<FONT color="green">285</FONT>         * @return trace<a name="line.285"></a>
+<FONT color="green">286</FONT>         */<a name="line.286"></a>
+<FONT color="green">287</FONT>        BigDecimal getTrace();<a name="line.287"></a>
+<FONT color="green">288</FONT>    <a name="line.288"></a>
+<FONT color="green">289</FONT>        /**<a name="line.289"></a>
+<FONT color="green">290</FONT>         * Returns the result of multiplying this by the vector &lt;code&gt;v&lt;/code&gt;.<a name="line.290"></a>
+<FONT color="green">291</FONT>         *<a name="line.291"></a>
+<FONT color="green">292</FONT>         * @param v the vector to operate on<a name="line.292"></a>
+<FONT color="green">293</FONT>         * @return this*v<a name="line.293"></a>
+<FONT color="green">294</FONT>         * @throws IllegalArgumentException if columnDimension != v.size()<a name="line.294"></a>
+<FONT color="green">295</FONT>         */<a name="line.295"></a>
+<FONT color="green">296</FONT>        BigDecimal[] operate(BigDecimal[] v) throws IllegalArgumentException;<a name="line.296"></a>
+<FONT color="green">297</FONT>    <a name="line.297"></a>
+<FONT color="green">298</FONT>        /**<a name="line.298"></a>
+<FONT color="green">299</FONT>         * Returns the (row) vector result of premultiplying this by the vector &lt;code&gt;v&lt;/code&gt;.<a name="line.299"></a>
+<FONT color="green">300</FONT>         *<a name="line.300"></a>
+<FONT color="green">301</FONT>         * @param v the row vector to premultiply by<a name="line.301"></a>
+<FONT color="green">302</FONT>         * @return v*this<a name="line.302"></a>
+<FONT color="green">303</FONT>         * @throws IllegalArgumentException if rowDimension != v.size()<a name="line.303"></a>
+<FONT color="green">304</FONT>         */<a name="line.304"></a>
+<FONT color="green">305</FONT>        BigDecimal[] preMultiply(BigDecimal[] v) throws IllegalArgumentException;<a name="line.305"></a>
+<FONT color="green">306</FONT>    <a name="line.306"></a>
+<FONT color="green">307</FONT>        /**<a name="line.307"></a>
+<FONT color="green">308</FONT>         * Returns the solution vector for a linear system with coefficient<a name="line.308"></a>
+<FONT color="green">309</FONT>         * matrix = this and constant vector = &lt;code&gt;b&lt;/code&gt;.<a name="line.309"></a>
+<FONT color="green">310</FONT>         *<a name="line.310"></a>
+<FONT color="green">311</FONT>         * @param b  constant vector<a name="line.311"></a>
+<FONT color="green">312</FONT>         * @return vector of solution values to AX = b, where A is *this<a name="line.312"></a>
+<FONT color="green">313</FONT>         * @throws IllegalArgumentException if this.rowDimension != b.length<a name="line.313"></a>
+<FONT color="green">314</FONT>         * @throws org.apache.commons.math.linear.InvalidMatrixException if this matrix is not square or is singular<a name="line.314"></a>
+<FONT color="green">315</FONT>         */<a name="line.315"></a>
+<FONT color="green">316</FONT>        BigDecimal[] solve(BigDecimal[] b) throws IllegalArgumentException, InvalidMatrixException;<a name="line.316"></a>
+<FONT color="green">317</FONT>    <a name="line.317"></a>
+<FONT color="green">318</FONT>        /**<a name="line.318"></a>
+<FONT color="green">319</FONT>         * Returns a matrix of (column) solution vectors for linear systems with<a name="line.319"></a>
+<FONT color="green">320</FONT>         * coefficient matrix = this and constant vectors = columns of<a name="line.320"></a>
+<FONT color="green">321</FONT>         * &lt;code&gt;b&lt;/code&gt;.<a name="line.321"></a>
+<FONT color="green">322</FONT>         *<a name="line.322"></a>
+<FONT color="green">323</FONT>         * @param b  matrix of constant vectors forming RHS of linear systems to<a name="line.323"></a>
+<FONT color="green">324</FONT>         * to solve<a name="line.324"></a>
+<FONT color="green">325</FONT>         * @return matrix of solution vectors<a name="line.325"></a>
+<FONT color="green">326</FONT>         * @throws IllegalArgumentException if this.rowDimension != row dimension<a name="line.326"></a>
+<FONT color="green">327</FONT>         * @throws org.apache.commons.math.linear.InvalidMatrixException if this matrix is not square or is singular<a name="line.327"></a>
+<FONT color="green">328</FONT>         */<a name="line.328"></a>
+<FONT color="green">329</FONT>        BigMatrix solve(BigMatrix b) throws IllegalArgumentException, InvalidMatrixException;<a name="line.329"></a>
+<FONT color="green">330</FONT>    }<a name="line.330"></a>
+<FONT color="green">331</FONT>    <a name="line.331"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/BigMatrixImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,1572 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.math.BigDecimal;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Implementation of {@link BigMatrix} using a BigDecimal[][] array to store entries<a name="line.25"></a>
+<FONT color="green">026</FONT>     * and &lt;a href="http://www.math.gatech.edu/~bourbaki/math2601/Web-notes/2num.pdf"&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * LU decompostion&lt;/a&gt; to support linear system<a name="line.27"></a>
+<FONT color="green">028</FONT>     * solution and inverse.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * The LU decompostion is performed as needed, to support the following operations: &lt;ul&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;li&gt;solve&lt;/li&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;li&gt;isSingular&lt;/li&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;li&gt;getDeterminant&lt;/li&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;li&gt;inverse&lt;/li&gt; &lt;/ul&gt;&lt;/p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>    * &lt;strong&gt;Usage notes&lt;/strong&gt;:&lt;br&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;ul&gt;&lt;li&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * The LU decomposition is stored and reused on subsequent calls.  If matrix<a name="line.38"></a>
+<FONT color="green">039</FONT>     * data are modified using any of the public setXxx methods, the saved<a name="line.39"></a>
+<FONT color="green">040</FONT>     * decomposition is discarded.  If data are modified via references to the<a name="line.40"></a>
+<FONT color="green">041</FONT>     * underlying array obtained using &lt;code&gt;getDataRef()&lt;/code&gt;, then the stored<a name="line.41"></a>
+<FONT color="green">042</FONT>     * LU decomposition will not be discarded.  In this case, you need to<a name="line.42"></a>
+<FONT color="green">043</FONT>     * explicitly invoke &lt;code&gt;LUDecompose()&lt;/code&gt; to recompute the decomposition<a name="line.43"></a>
+<FONT color="green">044</FONT>     * before using any of the methods above.&lt;/li&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     * &lt;li&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     * As specified in the {@link BigMatrix} interface, matrix element indexing<a name="line.46"></a>
+<FONT color="green">047</FONT>     * is 0-based -- e.g., &lt;code&gt;getEntry(0, 0)&lt;/code&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     * returns the element in the first row, first column of the matrix.&lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>     *<a name="line.49"></a>
+<FONT color="green">050</FONT>     * @deprecated as of 2.0, replaced by {@link Array2DRowFieldMatrix} with a {@link<a name="line.50"></a>
+<FONT color="green">051</FONT>     * org.apache.commons.math.util.BigReal} parameter<a name="line.51"></a>
+<FONT color="green">052</FONT>     * @version $Revision: 811833 $ $Date: 2009-09-06 12:27:50 -0400 (Sun, 06 Sep 2009) $<a name="line.52"></a>
+<FONT color="green">053</FONT>     */<a name="line.53"></a>
+<FONT color="green">054</FONT>    @Deprecated<a name="line.54"></a>
+<FONT color="green">055</FONT>    public class BigMatrixImpl implements BigMatrix, Serializable {<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /** BigDecimal 0 */<a name="line.57"></a>
+<FONT color="green">058</FONT>        static final BigDecimal ZERO = new BigDecimal(0);<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** BigDecimal 1 */<a name="line.60"></a>
+<FONT color="green">061</FONT>        static final BigDecimal ONE = new BigDecimal(1);<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /** Bound to determine effective singularity in LU decomposition */<a name="line.63"></a>
+<FONT color="green">064</FONT>        private static final BigDecimal TOO_SMALL = new BigDecimal(10E-12);<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /** Serialization id */<a name="line.66"></a>
+<FONT color="green">067</FONT>        private static final long serialVersionUID = -1011428905656140431L;<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /** Entries of the matrix */<a name="line.69"></a>
+<FONT color="green">070</FONT>        protected BigDecimal data[][] = null;<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /** Entries of cached LU decomposition.<a name="line.72"></a>
+<FONT color="green">073</FONT>         *  All updates to data (other than luDecompose()) *must* set this to null<a name="line.73"></a>
+<FONT color="green">074</FONT>         */<a name="line.74"></a>
+<FONT color="green">075</FONT>        protected BigDecimal lu[][] = null;<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** Permutation associated with LU decomposition */<a name="line.77"></a>
+<FONT color="green">078</FONT>        protected int[] permutation = null;<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /** Parity of the permutation associated with the LU decomposition */<a name="line.80"></a>
+<FONT color="green">081</FONT>        protected int parity = 1;<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /** Rounding mode for divisions **/<a name="line.83"></a>
+<FONT color="green">084</FONT>        private int roundingMode = BigDecimal.ROUND_HALF_UP;<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /*** BigDecimal scale ***/<a name="line.86"></a>
+<FONT color="green">087</FONT>        private int scale = 64;<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /**<a name="line.89"></a>
+<FONT color="green">090</FONT>         * Creates a matrix with no data<a name="line.90"></a>
+<FONT color="green">091</FONT>         */<a name="line.91"></a>
+<FONT color="green">092</FONT>        public BigMatrixImpl() {<a name="line.92"></a>
+<FONT color="green">093</FONT>        }<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /**<a name="line.95"></a>
+<FONT color="green">096</FONT>         * Create a new BigMatrix with the supplied row and column dimensions.<a name="line.96"></a>
+<FONT color="green">097</FONT>         *<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @param rowDimension      the number of rows in the new matrix<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @param columnDimension   the number of columns in the new matrix<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @throws IllegalArgumentException if row or column dimension is not<a name="line.100"></a>
+<FONT color="green">101</FONT>         *  positive<a name="line.101"></a>
+<FONT color="green">102</FONT>         */<a name="line.102"></a>
+<FONT color="green">103</FONT>        public BigMatrixImpl(int rowDimension, int columnDimension) {<a name="line.103"></a>
+<FONT color="green">104</FONT>            if (rowDimension &lt;= 0 ) {<a name="line.104"></a>
+<FONT color="green">105</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.105"></a>
+<FONT color="green">106</FONT>                        "invalid row dimension {0} (must be positive)",<a name="line.106"></a>
+<FONT color="green">107</FONT>                        rowDimension);<a name="line.107"></a>
+<FONT color="green">108</FONT>            }<a name="line.108"></a>
+<FONT color="green">109</FONT>            if (columnDimension &lt;= 0) {<a name="line.109"></a>
+<FONT color="green">110</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.110"></a>
+<FONT color="green">111</FONT>                        "invalid column dimension {0} (must be positive)",<a name="line.111"></a>
+<FONT color="green">112</FONT>                        columnDimension);<a name="line.112"></a>
+<FONT color="green">113</FONT>            }<a name="line.113"></a>
+<FONT color="green">114</FONT>            data = new BigDecimal[rowDimension][columnDimension];<a name="line.114"></a>
+<FONT color="green">115</FONT>            lu = null;<a name="line.115"></a>
+<FONT color="green">116</FONT>        }<a name="line.116"></a>
+<FONT color="green">117</FONT>    <a name="line.117"></a>
+<FONT color="green">118</FONT>        /**<a name="line.118"></a>
+<FONT color="green">119</FONT>         * Create a new BigMatrix using &lt;code&gt;d&lt;/code&gt; as the underlying<a name="line.119"></a>
+<FONT color="green">120</FONT>         * data array.<a name="line.120"></a>
+<FONT color="green">121</FONT>         * &lt;p&gt;The input array is copied, not referenced. This constructor has<a name="line.121"></a>
+<FONT color="green">122</FONT>         * the same effect as calling {@link #BigMatrixImpl(BigDecimal[][], boolean)}<a name="line.122"></a>
+<FONT color="green">123</FONT>         * with the second argument set to &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;<a name="line.123"></a>
+<FONT color="green">124</FONT>         *<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @param d data for new matrix<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @throws IllegalArgumentException if &lt;code&gt;d&lt;/code&gt; is not rectangular<a name="line.126"></a>
+<FONT color="green">127</FONT>         *  (not all rows have the same length) or empty<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @throws NullPointerException if &lt;code&gt;d&lt;/code&gt; is null<a name="line.128"></a>
+<FONT color="green">129</FONT>         */<a name="line.129"></a>
+<FONT color="green">130</FONT>        public BigMatrixImpl(BigDecimal[][] d) {<a name="line.130"></a>
+<FONT color="green">131</FONT>            this.copyIn(d);<a name="line.131"></a>
+<FONT color="green">132</FONT>            lu = null;<a name="line.132"></a>
+<FONT color="green">133</FONT>        }<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>        /**<a name="line.135"></a>
+<FONT color="green">136</FONT>         * Create a new BigMatrix using the input array as the underlying<a name="line.136"></a>
+<FONT color="green">137</FONT>         * data array.<a name="line.137"></a>
+<FONT color="green">138</FONT>         * &lt;p&gt;If an array is built specially in order to be embedded in a<a name="line.138"></a>
+<FONT color="green">139</FONT>         * BigMatrix and not used directly, the &lt;code&gt;copyArray&lt;/code&gt; may be<a name="line.139"></a>
+<FONT color="green">140</FONT>         * set to &lt;code&gt;false&lt;/code. This will prevent the copying and improve<a name="line.140"></a>
+<FONT color="green">141</FONT>         * performance as no new array will be built and no data will be copied.&lt;/p&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>         * @param d data for new matrix<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @param copyArray if true, the input array will be copied, otherwise<a name="line.143"></a>
+<FONT color="green">144</FONT>         * it will be referenced<a name="line.144"></a>
+<FONT color="green">145</FONT>         * @throws IllegalArgumentException if &lt;code&gt;d&lt;/code&gt; is not rectangular<a name="line.145"></a>
+<FONT color="green">146</FONT>         *  (not all rows have the same length) or empty<a name="line.146"></a>
+<FONT color="green">147</FONT>         * @throws NullPointerException if &lt;code&gt;d&lt;/code&gt; is null<a name="line.147"></a>
+<FONT color="green">148</FONT>         * @see #BigMatrixImpl(BigDecimal[][])<a name="line.148"></a>
+<FONT color="green">149</FONT>         */<a name="line.149"></a>
+<FONT color="green">150</FONT>        public BigMatrixImpl(BigDecimal[][] d, boolean copyArray) {<a name="line.150"></a>
+<FONT color="green">151</FONT>            if (copyArray) {<a name="line.151"></a>
+<FONT color="green">152</FONT>                copyIn(d);<a name="line.152"></a>
+<FONT color="green">153</FONT>            } else {<a name="line.153"></a>
+<FONT color="green">154</FONT>                if (d == null) {<a name="line.154"></a>
+<FONT color="green">155</FONT>                    throw new NullPointerException();<a name="line.155"></a>
+<FONT color="green">156</FONT>                }<a name="line.156"></a>
+<FONT color="green">157</FONT>                final int nRows = d.length;<a name="line.157"></a>
+<FONT color="green">158</FONT>                if (nRows == 0) {<a name="line.158"></a>
+<FONT color="green">159</FONT>                    throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");<a name="line.159"></a>
+<FONT color="green">160</FONT>                }<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>                final int nCols = d[0].length;<a name="line.162"></a>
+<FONT color="green">163</FONT>                if (nCols == 0) {<a name="line.163"></a>
+<FONT color="green">164</FONT>                    throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");<a name="line.164"></a>
+<FONT color="green">165</FONT>                }<a name="line.165"></a>
+<FONT color="green">166</FONT>                for (int r = 1; r &lt; nRows; r++) {<a name="line.166"></a>
+<FONT color="green">167</FONT>                    if (d[r].length != nCols) {<a name="line.167"></a>
+<FONT color="green">168</FONT>                        throw MathRuntimeException.createIllegalArgumentException(<a name="line.168"></a>
+<FONT color="green">169</FONT>                              "some rows have length {0} while others have length {1}",<a name="line.169"></a>
+<FONT color="green">170</FONT>                              nCols, d[r].length);<a name="line.170"></a>
+<FONT color="green">171</FONT>                    }<a name="line.171"></a>
+<FONT color="green">172</FONT>                }<a name="line.172"></a>
+<FONT color="green">173</FONT>                data = d;<a name="line.173"></a>
+<FONT color="green">174</FONT>            }<a name="line.174"></a>
+<FONT color="green">175</FONT>            lu = null;<a name="line.175"></a>
+<FONT color="green">176</FONT>        }<a name="line.176"></a>
+<FONT color="green">177</FONT>    <a name="line.177"></a>
+<FONT color="green">178</FONT>        /**<a name="line.178"></a>
+<FONT color="green">179</FONT>         * Create a new BigMatrix using &lt;code&gt;d&lt;/code&gt; as the underlying<a name="line.179"></a>
+<FONT color="green">180</FONT>         * data array.<a name="line.180"></a>
+<FONT color="green">181</FONT>         * &lt;p&gt;Since the underlying array will hold &lt;code&gt;BigDecimal&lt;/code&gt;<a name="line.181"></a>
+<FONT color="green">182</FONT>         * instances, it will be created.&lt;/p&gt;<a name="line.182"></a>
+<FONT color="green">183</FONT>         *<a name="line.183"></a>
+<FONT color="green">184</FONT>         * @param d data for new matrix<a name="line.184"></a>
+<FONT color="green">185</FONT>         * @throws IllegalArgumentException if &lt;code&gt;d&lt;/code&gt; is not rectangular<a name="line.185"></a>
+<FONT color="green">186</FONT>         *  (not all rows have the same length) or empty<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @throws NullPointerException if &lt;code&gt;d&lt;/code&gt; is null<a name="line.187"></a>
+<FONT color="green">188</FONT>         */<a name="line.188"></a>
+<FONT color="green">189</FONT>        public BigMatrixImpl(double[][] d) {<a name="line.189"></a>
+<FONT color="green">190</FONT>            final int nRows = d.length;<a name="line.190"></a>
+<FONT color="green">191</FONT>            if (nRows == 0) {<a name="line.191"></a>
+<FONT color="green">192</FONT>                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");<a name="line.192"></a>
+<FONT color="green">193</FONT>            }<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>            final int nCols = d[0].length;<a name="line.195"></a>
+<FONT color="green">196</FONT>            if (nCols == 0) {<a name="line.196"></a>
+<FONT color="green">197</FONT>                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");<a name="line.197"></a>
+<FONT color="green">198</FONT>            }<a name="line.198"></a>
+<FONT color="green">199</FONT>            for (int row = 1; row &lt; nRows; row++) {<a name="line.199"></a>
+<FONT color="green">200</FONT>                if (d[row].length != nCols) {<a name="line.200"></a>
+<FONT color="green">201</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.201"></a>
+<FONT color="green">202</FONT>                          "some rows have length {0} while others have length {1}",<a name="line.202"></a>
+<FONT color="green">203</FONT>                          nCols, d[row].length);<a name="line.203"></a>
+<FONT color="green">204</FONT>                }<a name="line.204"></a>
+<FONT color="green">205</FONT>            }<a name="line.205"></a>
+<FONT color="green">206</FONT>            this.copyIn(d);<a name="line.206"></a>
+<FONT color="green">207</FONT>            lu = null;<a name="line.207"></a>
+<FONT color="green">208</FONT>        }<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>        /**<a name="line.210"></a>
+<FONT color="green">211</FONT>         * Create a new BigMatrix using the values represented by the strings in<a name="line.211"></a>
+<FONT color="green">212</FONT>         * &lt;code&gt;d&lt;/code&gt; as the underlying data array.<a name="line.212"></a>
+<FONT color="green">213</FONT>         *<a name="line.213"></a>
+<FONT color="green">214</FONT>         * @param d data for new matrix<a name="line.214"></a>
+<FONT color="green">215</FONT>         * @throws IllegalArgumentException if &lt;code&gt;d&lt;/code&gt; is not rectangular<a name="line.215"></a>
+<FONT color="green">216</FONT>         *  (not all rows have the same length) or empty<a name="line.216"></a>
+<FONT color="green">217</FONT>         * @throws NullPointerException if &lt;code&gt;d&lt;/code&gt; is null<a name="line.217"></a>
+<FONT color="green">218</FONT>         */<a name="line.218"></a>
+<FONT color="green">219</FONT>        public BigMatrixImpl(String[][] d) {<a name="line.219"></a>
+<FONT color="green">220</FONT>            final int nRows = d.length;<a name="line.220"></a>
+<FONT color="green">221</FONT>            if (nRows == 0) {<a name="line.221"></a>
+<FONT color="green">222</FONT>                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");<a name="line.222"></a>
+<FONT color="green">223</FONT>            }<a name="line.223"></a>
+<FONT color="green">224</FONT>    <a name="line.224"></a>
+<FONT color="green">225</FONT>            final int nCols = d[0].length;<a name="line.225"></a>
+<FONT color="green">226</FONT>            if (nCols == 0) {<a name="line.226"></a>
+<FONT color="green">227</FONT>                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");<a name="line.227"></a>
+<FONT color="green">228</FONT>            }<a name="line.228"></a>
+<FONT color="green">229</FONT>            for (int row = 1; row &lt; nRows; row++) {<a name="line.229"></a>
+<FONT color="green">230</FONT>                if (d[row].length != nCols) {<a name="line.230"></a>
+<FONT color="green">231</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.231"></a>
+<FONT color="green">232</FONT>                          "some rows have length {0} while others have length {1}",<a name="line.232"></a>
+<FONT color="green">233</FONT>                          nCols, d[row].length);<a name="line.233"></a>
+<FONT color="green">234</FONT>                }<a name="line.234"></a>
+<FONT color="green">235</FONT>            }<a name="line.235"></a>
+<FONT color="green">236</FONT>            this.copyIn(d);<a name="line.236"></a>
+<FONT color="green">237</FONT>            lu = null;<a name="line.237"></a>
+<FONT color="green">238</FONT>        }<a name="line.238"></a>
+<FONT color="green">239</FONT>    <a name="line.239"></a>
+<FONT color="green">240</FONT>        /**<a name="line.240"></a>
+<FONT color="green">241</FONT>         * Create a new (column) BigMatrix using &lt;code&gt;v&lt;/code&gt; as the<a name="line.241"></a>
+<FONT color="green">242</FONT>         * data for the unique column of the &lt;code&gt;v.length x 1&lt;/code&gt; matrix<a name="line.242"></a>
+<FONT color="green">243</FONT>         * created.<a name="line.243"></a>
+<FONT color="green">244</FONT>         * &lt;p&gt;<a name="line.244"></a>
+<FONT color="green">245</FONT>         * The input array is copied, not referenced.&lt;/p&gt;<a name="line.245"></a>
+<FONT color="green">246</FONT>         *<a name="line.246"></a>
+<FONT color="green">247</FONT>         * @param v column vector holding data for new matrix<a name="line.247"></a>
+<FONT color="green">248</FONT>         */<a name="line.248"></a>
+<FONT color="green">249</FONT>        public BigMatrixImpl(BigDecimal[] v) {<a name="line.249"></a>
+<FONT color="green">250</FONT>            final int nRows = v.length;<a name="line.250"></a>
+<FONT color="green">251</FONT>            data = new BigDecimal[nRows][1];<a name="line.251"></a>
+<FONT color="green">252</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.252"></a>
+<FONT color="green">253</FONT>                data[row][0] = v[row];<a name="line.253"></a>
+<FONT color="green">254</FONT>            }<a name="line.254"></a>
+<FONT color="green">255</FONT>        }<a name="line.255"></a>
+<FONT color="green">256</FONT>    <a name="line.256"></a>
+<FONT color="green">257</FONT>        /**<a name="line.257"></a>
+<FONT color="green">258</FONT>         * Create a new BigMatrix which is a copy of this.<a name="line.258"></a>
+<FONT color="green">259</FONT>         *<a name="line.259"></a>
+<FONT color="green">260</FONT>         * @return  the cloned matrix<a name="line.260"></a>
+<FONT color="green">261</FONT>         */<a name="line.261"></a>
+<FONT color="green">262</FONT>        public BigMatrix copy() {<a name="line.262"></a>
+<FONT color="green">263</FONT>            return new BigMatrixImpl(this.copyOut(), false);<a name="line.263"></a>
+<FONT color="green">264</FONT>        }<a name="line.264"></a>
+<FONT color="green">265</FONT>    <a name="line.265"></a>
+<FONT color="green">266</FONT>        /**<a name="line.266"></a>
+<FONT color="green">267</FONT>         * Compute the sum of this and &lt;code&gt;m&lt;/code&gt;.<a name="line.267"></a>
+<FONT color="green">268</FONT>         *<a name="line.268"></a>
+<FONT color="green">269</FONT>         * @param m    matrix to be added<a name="line.269"></a>
+<FONT color="green">270</FONT>         * @return     this + m<a name="line.270"></a>
+<FONT color="green">271</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.271"></a>
+<FONT color="green">272</FONT>         */<a name="line.272"></a>
+<FONT color="green">273</FONT>        public BigMatrix add(BigMatrix m) throws IllegalArgumentException {<a name="line.273"></a>
+<FONT color="green">274</FONT>            try {<a name="line.274"></a>
+<FONT color="green">275</FONT>                return add((BigMatrixImpl) m);<a name="line.275"></a>
+<FONT color="green">276</FONT>            } catch (ClassCastException cce) {<a name="line.276"></a>
+<FONT color="green">277</FONT>    <a name="line.277"></a>
+<FONT color="green">278</FONT>                // safety check<a name="line.278"></a>
+<FONT color="green">279</FONT>                MatrixUtils.checkAdditionCompatible(this, m);<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>                final int rowCount    = getRowDimension();<a name="line.281"></a>
+<FONT color="green">282</FONT>                final int columnCount = getColumnDimension();<a name="line.282"></a>
+<FONT color="green">283</FONT>                final BigDecimal[][] outData = new BigDecimal[rowCount][columnCount];<a name="line.283"></a>
+<FONT color="green">284</FONT>                for (int row = 0; row &lt; rowCount; row++) {<a name="line.284"></a>
+<FONT color="green">285</FONT>                    final BigDecimal[] dataRow    = data[row];<a name="line.285"></a>
+<FONT color="green">286</FONT>                    final BigDecimal[] outDataRow = outData[row];<a name="line.286"></a>
+<FONT color="green">287</FONT>                    for (int col = 0; col &lt; columnCount; col++) {<a name="line.287"></a>
+<FONT color="green">288</FONT>                        outDataRow[col] = dataRow[col].add(m.getEntry(row, col));<a name="line.288"></a>
+<FONT color="green">289</FONT>                    }<a name="line.289"></a>
+<FONT color="green">290</FONT>                }<a name="line.290"></a>
+<FONT color="green">291</FONT>                return new BigMatrixImpl(outData, false);<a name="line.291"></a>
+<FONT color="green">292</FONT>            }<a name="line.292"></a>
+<FONT color="green">293</FONT>        }<a name="line.293"></a>
+<FONT color="green">294</FONT>    <a name="line.294"></a>
+<FONT color="green">295</FONT>        /**<a name="line.295"></a>
+<FONT color="green">296</FONT>         * Compute the sum of this and &lt;code&gt;m&lt;/code&gt;.<a name="line.296"></a>
+<FONT color="green">297</FONT>         *<a name="line.297"></a>
+<FONT color="green">298</FONT>         * @param m    matrix to be added<a name="line.298"></a>
+<FONT color="green">299</FONT>         * @return     this + m<a name="line.299"></a>
+<FONT color="green">300</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.300"></a>
+<FONT color="green">301</FONT>         */<a name="line.301"></a>
+<FONT color="green">302</FONT>        public BigMatrixImpl add(BigMatrixImpl m) throws IllegalArgumentException {<a name="line.302"></a>
+<FONT color="green">303</FONT>    <a name="line.303"></a>
+<FONT color="green">304</FONT>            // safety check<a name="line.304"></a>
+<FONT color="green">305</FONT>            MatrixUtils.checkAdditionCompatible(this, m);<a name="line.305"></a>
+<FONT color="green">306</FONT>    <a name="line.306"></a>
+<FONT color="green">307</FONT>            final int rowCount    = getRowDimension();<a name="line.307"></a>
+<FONT color="green">308</FONT>            final int columnCount = getColumnDimension();<a name="line.308"></a>
+<FONT color="green">309</FONT>            final BigDecimal[][] outData = new BigDecimal[rowCount][columnCount];<a name="line.309"></a>
+<FONT color="green">310</FONT>            for (int row = 0; row &lt; rowCount; row++) {<a name="line.310"></a>
+<FONT color="green">311</FONT>                final BigDecimal[] dataRow    = data[row];<a name="line.311"></a>
+<FONT color="green">312</FONT>                final BigDecimal[] mRow       = m.data[row];<a name="line.312"></a>
+<FONT color="green">313</FONT>                final BigDecimal[] outDataRow = outData[row];<a name="line.313"></a>
+<FONT color="green">314</FONT>                for (int col = 0; col &lt; columnCount; col++) {<a name="line.314"></a>
+<FONT color="green">315</FONT>                    outDataRow[col] = dataRow[col].add(mRow[col]);<a name="line.315"></a>
+<FONT color="green">316</FONT>                }<a name="line.316"></a>
+<FONT color="green">317</FONT>            }<a name="line.317"></a>
+<FONT color="green">318</FONT>            return new BigMatrixImpl(outData, false);<a name="line.318"></a>
+<FONT color="green">319</FONT>        }<a name="line.319"></a>
+<FONT color="green">320</FONT>    <a name="line.320"></a>
+<FONT color="green">321</FONT>        /**<a name="line.321"></a>
+<FONT color="green">322</FONT>         * Compute  this minus &lt;code&gt;m&lt;/code&gt;.<a name="line.322"></a>
+<FONT color="green">323</FONT>         *<a name="line.323"></a>
+<FONT color="green">324</FONT>         * @param m    matrix to be subtracted<a name="line.324"></a>
+<FONT color="green">325</FONT>         * @return     this + m<a name="line.325"></a>
+<FONT color="green">326</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.326"></a>
+<FONT color="green">327</FONT>         */<a name="line.327"></a>
+<FONT color="green">328</FONT>        public BigMatrix subtract(BigMatrix m) throws IllegalArgumentException {<a name="line.328"></a>
+<FONT color="green">329</FONT>            try {<a name="line.329"></a>
+<FONT color="green">330</FONT>                return subtract((BigMatrixImpl) m);<a name="line.330"></a>
+<FONT color="green">331</FONT>            } catch (ClassCastException cce) {<a name="line.331"></a>
+<FONT color="green">332</FONT>    <a name="line.332"></a>
+<FONT color="green">333</FONT>                // safety check<a name="line.333"></a>
+<FONT color="green">334</FONT>                MatrixUtils.checkSubtractionCompatible(this, m);<a name="line.334"></a>
+<FONT color="green">335</FONT>    <a name="line.335"></a>
+<FONT color="green">336</FONT>                final int rowCount    = getRowDimension();<a name="line.336"></a>
+<FONT color="green">337</FONT>                final int columnCount = getColumnDimension();<a name="line.337"></a>
+<FONT color="green">338</FONT>                final BigDecimal[][] outData = new BigDecimal[rowCount][columnCount];<a name="line.338"></a>
+<FONT color="green">339</FONT>                for (int row = 0; row &lt; rowCount; row++) {<a name="line.339"></a>
+<FONT color="green">340</FONT>                    final BigDecimal[] dataRow    = data[row];<a name="line.340"></a>
+<FONT color="green">341</FONT>                    final BigDecimal[] outDataRow = outData[row];<a name="line.341"></a>
+<FONT color="green">342</FONT>                    for (int col = 0; col &lt; columnCount; col++) {<a name="line.342"></a>
+<FONT color="green">343</FONT>                        outDataRow[col] = dataRow[col].subtract(getEntry(row, col));<a name="line.343"></a>
+<FONT color="green">344</FONT>                    }<a name="line.344"></a>
+<FONT color="green">345</FONT>                }<a name="line.345"></a>
+<FONT color="green">346</FONT>                return new BigMatrixImpl(outData, false);<a name="line.346"></a>
+<FONT color="green">347</FONT>            }<a name="line.347"></a>
+<FONT color="green">348</FONT>        }<a name="line.348"></a>
+<FONT color="green">349</FONT>    <a name="line.349"></a>
+<FONT color="green">350</FONT>        /**<a name="line.350"></a>
+<FONT color="green">351</FONT>         * Compute  this minus &lt;code&gt;m&lt;/code&gt;.<a name="line.351"></a>
+<FONT color="green">352</FONT>         *<a name="line.352"></a>
+<FONT color="green">353</FONT>         * @param m    matrix to be subtracted<a name="line.353"></a>
+<FONT color="green">354</FONT>         * @return     this + m<a name="line.354"></a>
+<FONT color="green">355</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.355"></a>
+<FONT color="green">356</FONT>         */<a name="line.356"></a>
+<FONT color="green">357</FONT>        public BigMatrixImpl subtract(BigMatrixImpl m) throws IllegalArgumentException {<a name="line.357"></a>
+<FONT color="green">358</FONT>    <a name="line.358"></a>
+<FONT color="green">359</FONT>            // safety check<a name="line.359"></a>
+<FONT color="green">360</FONT>            MatrixUtils.checkSubtractionCompatible(this, m);<a name="line.360"></a>
+<FONT color="green">361</FONT>    <a name="line.361"></a>
+<FONT color="green">362</FONT>            final int rowCount    = getRowDimension();<a name="line.362"></a>
+<FONT color="green">363</FONT>            final int columnCount = getColumnDimension();<a name="line.363"></a>
+<FONT color="green">364</FONT>            final BigDecimal[][] outData = new BigDecimal[rowCount][columnCount];<a name="line.364"></a>
+<FONT color="green">365</FONT>            for (int row = 0; row &lt; rowCount; row++) {<a name="line.365"></a>
+<FONT color="green">366</FONT>                final BigDecimal[] dataRow    = data[row];<a name="line.366"></a>
+<FONT color="green">367</FONT>                final BigDecimal[] mRow       = m.data[row];<a name="line.367"></a>
+<FONT color="green">368</FONT>                final BigDecimal[] outDataRow = outData[row];<a name="line.368"></a>
+<FONT color="green">369</FONT>                for (int col = 0; col &lt; columnCount; col++) {<a name="line.369"></a>
+<FONT color="green">370</FONT>                    outDataRow[col] = dataRow[col].subtract(mRow[col]);<a name="line.370"></a>
+<FONT color="green">371</FONT>                }<a name="line.371"></a>
+<FONT color="green">372</FONT>            }<a name="line.372"></a>
+<FONT color="green">373</FONT>            return new BigMatrixImpl(outData, false);<a name="line.373"></a>
+<FONT color="green">374</FONT>        }<a name="line.374"></a>
+<FONT color="green">375</FONT>    <a name="line.375"></a>
+<FONT color="green">376</FONT>        /**<a name="line.376"></a>
+<FONT color="green">377</FONT>         * Returns the result of adding d to each entry of this.<a name="line.377"></a>
+<FONT color="green">378</FONT>         *<a name="line.378"></a>
+<FONT color="green">379</FONT>         * @param d    value to be added to each entry<a name="line.379"></a>
+<FONT color="green">380</FONT>         * @return     d + this<a name="line.380"></a>
+<FONT color="green">381</FONT>         */<a name="line.381"></a>
+<FONT color="green">382</FONT>        public BigMatrix scalarAdd(BigDecimal d) {<a name="line.382"></a>
+<FONT color="green">383</FONT>            final int rowCount    = getRowDimension();<a name="line.383"></a>
+<FONT color="green">384</FONT>            final int columnCount = getColumnDimension();<a name="line.384"></a>
+<FONT color="green">385</FONT>            final BigDecimal[][] outData = new BigDecimal[rowCount][columnCount];<a name="line.385"></a>
+<FONT color="green">386</FONT>            for (int row = 0; row &lt; rowCount; row++) {<a name="line.386"></a>
+<FONT color="green">387</FONT>                final BigDecimal[] dataRow    = data[row];<a name="line.387"></a>
+<FONT color="green">388</FONT>                final BigDecimal[] outDataRow = outData[row];<a name="line.388"></a>
+<FONT color="green">389</FONT>                for (int col = 0; col &lt; columnCount; col++) {<a name="line.389"></a>
+<FONT color="green">390</FONT>                    outDataRow[col] = dataRow[col].add(d);<a name="line.390"></a>
+<FONT color="green">391</FONT>                }<a name="line.391"></a>
+<FONT color="green">392</FONT>            }<a name="line.392"></a>
+<FONT color="green">393</FONT>            return new BigMatrixImpl(outData, false);<a name="line.393"></a>
+<FONT color="green">394</FONT>        }<a name="line.394"></a>
+<FONT color="green">395</FONT>    <a name="line.395"></a>
+<FONT color="green">396</FONT>        /**<a name="line.396"></a>
+<FONT color="green">397</FONT>         * Returns the result of multiplying each entry of this by &lt;code&gt;d&lt;/code&gt;<a name="line.397"></a>
+<FONT color="green">398</FONT>         * @param d  value to multiply all entries by<a name="line.398"></a>
+<FONT color="green">399</FONT>         * @return d * this<a name="line.399"></a>
+<FONT color="green">400</FONT>         */<a name="line.400"></a>
+<FONT color="green">401</FONT>        public BigMatrix scalarMultiply(BigDecimal d) {<a name="line.401"></a>
+<FONT color="green">402</FONT>            final int rowCount    = getRowDimension();<a name="line.402"></a>
+<FONT color="green">403</FONT>            final int columnCount = getColumnDimension();<a name="line.403"></a>
+<FONT color="green">404</FONT>            final BigDecimal[][] outData = new BigDecimal[rowCount][columnCount];<a name="line.404"></a>
+<FONT color="green">405</FONT>            for (int row = 0; row &lt; rowCount; row++) {<a name="line.405"></a>
+<FONT color="green">406</FONT>                final BigDecimal[] dataRow    = data[row];<a name="line.406"></a>
+<FONT color="green">407</FONT>                final BigDecimal[] outDataRow = outData[row];<a name="line.407"></a>
+<FONT color="green">408</FONT>                for (int col = 0; col &lt; columnCount; col++) {<a name="line.408"></a>
+<FONT color="green">409</FONT>                    outDataRow[col] = dataRow[col].multiply(d);<a name="line.409"></a>
+<FONT color="green">410</FONT>                }<a name="line.410"></a>
+<FONT color="green">411</FONT>            }<a name="line.411"></a>
+<FONT color="green">412</FONT>            return new BigMatrixImpl(outData, false);<a name="line.412"></a>
+<FONT color="green">413</FONT>        }<a name="line.413"></a>
+<FONT color="green">414</FONT>    <a name="line.414"></a>
+<FONT color="green">415</FONT>        /**<a name="line.415"></a>
+<FONT color="green">416</FONT>         * Returns the result of postmultiplying this by &lt;code&gt;m&lt;/code&gt;.<a name="line.416"></a>
+<FONT color="green">417</FONT>         * @param m    matrix to postmultiply by<a name="line.417"></a>
+<FONT color="green">418</FONT>         * @return     this*m<a name="line.418"></a>
+<FONT color="green">419</FONT>         * @throws     IllegalArgumentException<a name="line.419"></a>
+<FONT color="green">420</FONT>         *             if columnDimension(this) != rowDimension(m)<a name="line.420"></a>
+<FONT color="green">421</FONT>         */<a name="line.421"></a>
+<FONT color="green">422</FONT>        public BigMatrix multiply(BigMatrix m) throws IllegalArgumentException {<a name="line.422"></a>
+<FONT color="green">423</FONT>            try {<a name="line.423"></a>
+<FONT color="green">424</FONT>                return multiply((BigMatrixImpl) m);<a name="line.424"></a>
+<FONT color="green">425</FONT>            } catch (ClassCastException cce) {<a name="line.425"></a>
+<FONT color="green">426</FONT>    <a name="line.426"></a>
+<FONT color="green">427</FONT>                // safety check<a name="line.427"></a>
+<FONT color="green">428</FONT>                MatrixUtils.checkMultiplicationCompatible(this, m);<a name="line.428"></a>
+<FONT color="green">429</FONT>    <a name="line.429"></a>
+<FONT color="green">430</FONT>                final int nRows = this.getRowDimension();<a name="line.430"></a>
+<FONT color="green">431</FONT>                final int nCols = m.getColumnDimension();<a name="line.431"></a>
+<FONT color="green">432</FONT>                final int nSum = this.getColumnDimension();<a name="line.432"></a>
+<FONT color="green">433</FONT>                final BigDecimal[][] outData = new BigDecimal[nRows][nCols];<a name="line.433"></a>
+<FONT color="green">434</FONT>                for (int row = 0; row &lt; nRows; row++) {<a name="line.434"></a>
+<FONT color="green">435</FONT>                    final BigDecimal[] dataRow    = data[row];<a name="line.435"></a>
+<FONT color="green">436</FONT>                    final BigDecimal[] outDataRow = outData[row];<a name="line.436"></a>
+<FONT color="green">437</FONT>                    for (int col = 0; col &lt; nCols; col++) {<a name="line.437"></a>
+<FONT color="green">438</FONT>                        BigDecimal sum = ZERO;<a name="line.438"></a>
+<FONT color="green">439</FONT>                        for (int i = 0; i &lt; nSum; i++) {<a name="line.439"></a>
+<FONT color="green">440</FONT>                            sum = sum.add(dataRow[i].multiply(m.getEntry(i, col)));<a name="line.440"></a>
+<FONT color="green">441</FONT>                        }<a name="line.441"></a>
+<FONT color="green">442</FONT>                        outDataRow[col] = sum;<a name="line.442"></a>
+<FONT color="green">443</FONT>                    }<a name="line.443"></a>
+<FONT color="green">444</FONT>                }<a name="line.444"></a>
+<FONT color="green">445</FONT>                return new BigMatrixImpl(outData, false);<a name="line.445"></a>
+<FONT color="green">446</FONT>            }<a name="line.446"></a>
+<FONT color="green">447</FONT>        }<a name="line.447"></a>
+<FONT color="green">448</FONT>    <a name="line.448"></a>
+<FONT color="green">449</FONT>        /**<a name="line.449"></a>
+<FONT color="green">450</FONT>         * Returns the result of postmultiplying this by &lt;code&gt;m&lt;/code&gt;.<a name="line.450"></a>
+<FONT color="green">451</FONT>         * @param m    matrix to postmultiply by<a name="line.451"></a>
+<FONT color="green">452</FONT>         * @return     this*m<a name="line.452"></a>
+<FONT color="green">453</FONT>         * @throws     IllegalArgumentException<a name="line.453"></a>
+<FONT color="green">454</FONT>         *             if columnDimension(this) != rowDimension(m)<a name="line.454"></a>
+<FONT color="green">455</FONT>         */<a name="line.455"></a>
+<FONT color="green">456</FONT>        public BigMatrixImpl multiply(BigMatrixImpl m) throws IllegalArgumentException {<a name="line.456"></a>
+<FONT color="green">457</FONT>    <a name="line.457"></a>
+<FONT color="green">458</FONT>            // safety check<a name="line.458"></a>
+<FONT color="green">459</FONT>            MatrixUtils.checkMultiplicationCompatible(this, m);<a name="line.459"></a>
+<FONT color="green">460</FONT>    <a name="line.460"></a>
+<FONT color="green">461</FONT>            final int nRows = this.getRowDimension();<a name="line.461"></a>
+<FONT color="green">462</FONT>            final int nCols = m.getColumnDimension();<a name="line.462"></a>
+<FONT color="green">463</FONT>            final int nSum = this.getColumnDimension();<a name="line.463"></a>
+<FONT color="green">464</FONT>            final BigDecimal[][] outData = new BigDecimal[nRows][nCols];<a name="line.464"></a>
+<FONT color="green">465</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.465"></a>
+<FONT color="green">466</FONT>                final BigDecimal[] dataRow    = data[row];<a name="line.466"></a>
+<FONT color="green">467</FONT>                final BigDecimal[] outDataRow = outData[row];<a name="line.467"></a>
+<FONT color="green">468</FONT>                for (int col = 0; col &lt; nCols; col++) {<a name="line.468"></a>
+<FONT color="green">469</FONT>                    BigDecimal sum = ZERO;<a name="line.469"></a>
+<FONT color="green">470</FONT>                    for (int i = 0; i &lt; nSum; i++) {<a name="line.470"></a>
+<FONT color="green">471</FONT>                        sum = sum.add(dataRow[i].multiply(m.data[i][col]));<a name="line.471"></a>
+<FONT color="green">472</FONT>                    }<a name="line.472"></a>
+<FONT color="green">473</FONT>                    outDataRow[col] = sum;<a name="line.473"></a>
+<FONT color="green">474</FONT>                }<a name="line.474"></a>
+<FONT color="green">475</FONT>            }<a name="line.475"></a>
+<FONT color="green">476</FONT>            return new BigMatrixImpl(outData, false);<a name="line.476"></a>
+<FONT color="green">477</FONT>        }<a name="line.477"></a>
+<FONT color="green">478</FONT>    <a name="line.478"></a>
+<FONT color="green">479</FONT>        /**<a name="line.479"></a>
+<FONT color="green">480</FONT>         * Returns the result premultiplying this by &lt;code&gt;m&lt;/code&gt;.<a name="line.480"></a>
+<FONT color="green">481</FONT>         * @param m    matrix to premultiply by<a name="line.481"></a>
+<FONT color="green">482</FONT>         * @return     m * this<a name="line.482"></a>
+<FONT color="green">483</FONT>         * @throws     IllegalArgumentException<a name="line.483"></a>
+<FONT color="green">484</FONT>         *             if rowDimension(this) != columnDimension(m)<a name="line.484"></a>
+<FONT color="green">485</FONT>         */<a name="line.485"></a>
+<FONT color="green">486</FONT>        public BigMatrix preMultiply(BigMatrix m) throws IllegalArgumentException {<a name="line.486"></a>
+<FONT color="green">487</FONT>            return m.multiply(this);<a name="line.487"></a>
+<FONT color="green">488</FONT>        }<a name="line.488"></a>
+<FONT color="green">489</FONT>    <a name="line.489"></a>
+<FONT color="green">490</FONT>        /**<a name="line.490"></a>
+<FONT color="green">491</FONT>         * Returns matrix entries as a two-dimensional array.<a name="line.491"></a>
+<FONT color="green">492</FONT>         * &lt;p&gt;<a name="line.492"></a>
+<FONT color="green">493</FONT>         * Makes a fresh copy of the underlying data.&lt;/p&gt;<a name="line.493"></a>
+<FONT color="green">494</FONT>         *<a name="line.494"></a>
+<FONT color="green">495</FONT>         * @return    2-dimensional array of entries<a name="line.495"></a>
+<FONT color="green">496</FONT>         */<a name="line.496"></a>
+<FONT color="green">497</FONT>        public BigDecimal[][] getData() {<a name="line.497"></a>
+<FONT color="green">498</FONT>            return copyOut();<a name="line.498"></a>
+<FONT color="green">499</FONT>        }<a name="line.499"></a>
+<FONT color="green">500</FONT>    <a name="line.500"></a>
+<FONT color="green">501</FONT>        /**<a name="line.501"></a>
+<FONT color="green">502</FONT>         * Returns matrix entries as a two-dimensional array.<a name="line.502"></a>
+<FONT color="green">503</FONT>         * &lt;p&gt;<a name="line.503"></a>
+<FONT color="green">504</FONT>         * Makes a fresh copy of the underlying data converted to<a name="line.504"></a>
+<FONT color="green">505</FONT>         * &lt;code&gt;double&lt;/code&gt; values.&lt;/p&gt;<a name="line.505"></a>
+<FONT color="green">506</FONT>         *<a name="line.506"></a>
+<FONT color="green">507</FONT>         * @return    2-dimensional array of entries<a name="line.507"></a>
+<FONT color="green">508</FONT>         */<a name="line.508"></a>
+<FONT color="green">509</FONT>        public double[][] getDataAsDoubleArray() {<a name="line.509"></a>
+<FONT color="green">510</FONT>            final int nRows = getRowDimension();<a name="line.510"></a>
+<FONT color="green">511</FONT>            final int nCols = getColumnDimension();<a name="line.511"></a>
+<FONT color="green">512</FONT>            final double d[][] = new double[nRows][nCols];<a name="line.512"></a>
+<FONT color="green">513</FONT>            for (int i = 0; i &lt; nRows; i++) {<a name="line.513"></a>
+<FONT color="green">514</FONT>                for (int j = 0; j &lt; nCols; j++) {<a name="line.514"></a>
+<FONT color="green">515</FONT>                    d[i][j] = data[i][j].doubleValue();<a name="line.515"></a>
+<FONT color="green">516</FONT>                }<a name="line.516"></a>
+<FONT color="green">517</FONT>            }<a name="line.517"></a>
+<FONT color="green">518</FONT>            return d;<a name="line.518"></a>
+<FONT color="green">519</FONT>        }<a name="line.519"></a>
+<FONT color="green">520</FONT>    <a name="line.520"></a>
+<FONT color="green">521</FONT>        /**<a name="line.521"></a>
+<FONT color="green">522</FONT>         * Returns a reference to the underlying data array.<a name="line.522"></a>
+<FONT color="green">523</FONT>         * &lt;p&gt;<a name="line.523"></a>
+<FONT color="green">524</FONT>         * Does not make a fresh copy of the underlying data.&lt;/p&gt;<a name="line.524"></a>
+<FONT color="green">525</FONT>         *<a name="line.525"></a>
+<FONT color="green">526</FONT>         * @return 2-dimensional array of entries<a name="line.526"></a>
+<FONT color="green">527</FONT>         */<a name="line.527"></a>
+<FONT color="green">528</FONT>        public BigDecimal[][] getDataRef() {<a name="line.528"></a>
+<FONT color="green">529</FONT>            return data;<a name="line.529"></a>
+<FONT color="green">530</FONT>        }<a name="line.530"></a>
+<FONT color="green">531</FONT>    <a name="line.531"></a>
+<FONT color="green">532</FONT>        /***<a name="line.532"></a>
+<FONT color="green">533</FONT>         * Gets the rounding mode for division operations<a name="line.533"></a>
+<FONT color="green">534</FONT>         * The default is {@link java.math.BigDecimal#ROUND_HALF_UP}<a name="line.534"></a>
+<FONT color="green">535</FONT>         * @see BigDecimal<a name="line.535"></a>
+<FONT color="green">536</FONT>         * @return the rounding mode.<a name="line.536"></a>
+<FONT color="green">537</FONT>         */<a name="line.537"></a>
+<FONT color="green">538</FONT>        public int getRoundingMode() {<a name="line.538"></a>
+<FONT color="green">539</FONT>            return roundingMode;<a name="line.539"></a>
+<FONT color="green">540</FONT>        }<a name="line.540"></a>
+<FONT color="green">541</FONT>    <a name="line.541"></a>
+<FONT color="green">542</FONT>        /***<a name="line.542"></a>
+<FONT color="green">543</FONT>         * Sets the rounding mode for decimal divisions.<a name="line.543"></a>
+<FONT color="green">544</FONT>         * @see BigDecimal<a name="line.544"></a>
+<FONT color="green">545</FONT>         * @param roundingMode rounding mode for decimal divisions<a name="line.545"></a>
+<FONT color="green">546</FONT>         */<a name="line.546"></a>
+<FONT color="green">547</FONT>        public void setRoundingMode(int roundingMode) {<a name="line.547"></a>
+<FONT color="green">548</FONT>            this.roundingMode = roundingMode;<a name="line.548"></a>
+<FONT color="green">549</FONT>        }<a name="line.549"></a>
+<FONT color="green">550</FONT>    <a name="line.550"></a>
+<FONT color="green">551</FONT>        /***<a name="line.551"></a>
+<FONT color="green">552</FONT>         * Sets the scale for division operations.<a name="line.552"></a>
+<FONT color="green">553</FONT>         * The default is 64<a name="line.553"></a>
+<FONT color="green">554</FONT>         * @see BigDecimal<a name="line.554"></a>
+<FONT color="green">555</FONT>         * @return the scale<a name="line.555"></a>
+<FONT color="green">556</FONT>         */<a name="line.556"></a>
+<FONT color="green">557</FONT>        public int getScale() {<a name="line.557"></a>
+<FONT color="green">558</FONT>            return scale;<a name="line.558"></a>
+<FONT color="green">559</FONT>        }<a name="line.559"></a>
+<FONT color="green">560</FONT>    <a name="line.560"></a>
+<FONT color="green">561</FONT>        /***<a name="line.561"></a>
+<FONT color="green">562</FONT>         * Sets the scale for division operations.<a name="line.562"></a>
+<FONT color="green">563</FONT>         * @see BigDecimal<a name="line.563"></a>
+<FONT color="green">564</FONT>         * @param scale scale for division operations<a name="line.564"></a>
+<FONT color="green">565</FONT>         */<a name="line.565"></a>
+<FONT color="green">566</FONT>        public void setScale(int scale) {<a name="line.566"></a>
+<FONT color="green">567</FONT>            this.scale = scale;<a name="line.567"></a>
+<FONT color="green">568</FONT>        }<a name="line.568"></a>
+<FONT color="green">569</FONT>    <a name="line.569"></a>
+<FONT color="green">570</FONT>        /**<a name="line.570"></a>
+<FONT color="green">571</FONT>         * Returns the &lt;a href="http://mathworld.wolfram.com/MaximumAbsoluteRowSumNorm.html"&gt;<a name="line.571"></a>
+<FONT color="green">572</FONT>         * maximum absolute row sum norm&lt;/a&gt; of the matrix.<a name="line.572"></a>
+<FONT color="green">573</FONT>         *<a name="line.573"></a>
+<FONT color="green">574</FONT>         * @return norm<a name="line.574"></a>
+<FONT color="green">575</FONT>         */<a name="line.575"></a>
+<FONT color="green">576</FONT>        public BigDecimal getNorm() {<a name="line.576"></a>
+<FONT color="green">577</FONT>            BigDecimal maxColSum = ZERO;<a name="line.577"></a>
+<FONT color="green">578</FONT>            for (int col = 0; col &lt; this.getColumnDimension(); col++) {<a name="line.578"></a>
+<FONT color="green">579</FONT>                BigDecimal sum = ZERO;<a name="line.579"></a>
+<FONT color="green">580</FONT>                for (int row = 0; row &lt; this.getRowDimension(); row++) {<a name="line.580"></a>
+<FONT color="green">581</FONT>                    sum = sum.add(data[row][col].abs());<a name="line.581"></a>
+<FONT color="green">582</FONT>                }<a name="line.582"></a>
+<FONT color="green">583</FONT>                maxColSum = maxColSum.max(sum);<a name="line.583"></a>
+<FONT color="green">584</FONT>            }<a name="line.584"></a>
+<FONT color="green">585</FONT>            return maxColSum;<a name="line.585"></a>
+<FONT color="green">586</FONT>        }<a name="line.586"></a>
+<FONT color="green">587</FONT>    <a name="line.587"></a>
+<FONT color="green">588</FONT>        /**<a name="line.588"></a>
+<FONT color="green">589</FONT>         * Gets a submatrix. Rows and columns are indicated<a name="line.589"></a>
+<FONT color="green">590</FONT>         * counting from 0 to n-1.<a name="line.590"></a>
+<FONT color="green">591</FONT>         *<a name="line.591"></a>
+<FONT color="green">592</FONT>         * @param startRow Initial row index<a name="line.592"></a>
+<FONT color="green">593</FONT>         * @param endRow Final row index<a name="line.593"></a>
+<FONT color="green">594</FONT>         * @param startColumn Initial column index<a name="line.594"></a>
+<FONT color="green">595</FONT>         * @param endColumn Final column index<a name="line.595"></a>
+<FONT color="green">596</FONT>         * @return The subMatrix containing the data of the<a name="line.596"></a>
+<FONT color="green">597</FONT>         *         specified rows and columns<a name="line.597"></a>
+<FONT color="green">598</FONT>         * @exception MatrixIndexException if row or column selections are not valid<a name="line.598"></a>
+<FONT color="green">599</FONT>         */<a name="line.599"></a>
+<FONT color="green">600</FONT>        public BigMatrix getSubMatrix(int startRow, int endRow,<a name="line.600"></a>
+<FONT color="green">601</FONT>                                      int startColumn, int endColumn)<a name="line.601"></a>
+<FONT color="green">602</FONT>            throws MatrixIndexException {<a name="line.602"></a>
+<FONT color="green">603</FONT>    <a name="line.603"></a>
+<FONT color="green">604</FONT>            MatrixUtils.checkRowIndex(this, startRow);<a name="line.604"></a>
+<FONT color="green">605</FONT>            MatrixUtils.checkRowIndex(this, endRow);<a name="line.605"></a>
+<FONT color="green">606</FONT>            if (startRow &gt; endRow) {<a name="line.606"></a>
+<FONT color="green">607</FONT>                throw new MatrixIndexException("initial row {0} after final row {1}",<a name="line.607"></a>
+<FONT color="green">608</FONT>                                               startRow, endRow);<a name="line.608"></a>
+<FONT color="green">609</FONT>            }<a name="line.609"></a>
+<FONT color="green">610</FONT>    <a name="line.610"></a>
+<FONT color="green">611</FONT>            MatrixUtils.checkColumnIndex(this, startColumn);<a name="line.611"></a>
+<FONT color="green">612</FONT>            MatrixUtils.checkColumnIndex(this, endColumn);<a name="line.612"></a>
+<FONT color="green">613</FONT>            if (startColumn &gt; endColumn) {<a name="line.613"></a>
+<FONT color="green">614</FONT>                throw new MatrixIndexException("initial column {0} after final column {1}",<a name="line.614"></a>
+<FONT color="green">615</FONT>                                               startColumn, endColumn);<a name="line.615"></a>
+<FONT color="green">616</FONT>            }<a name="line.616"></a>
+<FONT color="green">617</FONT>    <a name="line.617"></a>
+<FONT color="green">618</FONT>            final BigDecimal[][] subMatrixData =<a name="line.618"></a>
+<FONT color="green">619</FONT>                new BigDecimal[endRow - startRow + 1][endColumn - startColumn + 1];<a name="line.619"></a>
+<FONT color="green">620</FONT>            for (int i = startRow; i &lt;= endRow; i++) {<a name="line.620"></a>
+<FONT color="green">621</FONT>                System.arraycopy(data[i], startColumn,<a name="line.621"></a>
+<FONT color="green">622</FONT>                                 subMatrixData[i - startRow], 0,<a name="line.622"></a>
+<FONT color="green">623</FONT>                                 endColumn - startColumn + 1);<a name="line.623"></a>
+<FONT color="green">624</FONT>            }<a name="line.624"></a>
+<FONT color="green">625</FONT>    <a name="line.625"></a>
+<FONT color="green">626</FONT>            return new BigMatrixImpl(subMatrixData, false);<a name="line.626"></a>
+<FONT color="green">627</FONT>    <a name="line.627"></a>
+<FONT color="green">628</FONT>        }<a name="line.628"></a>
+<FONT color="green">629</FONT>    <a name="line.629"></a>
+<FONT color="green">630</FONT>        /**<a name="line.630"></a>
+<FONT color="green">631</FONT>         * Gets a submatrix. Rows and columns are indicated<a name="line.631"></a>
+<FONT color="green">632</FONT>         * counting from 0 to n-1.<a name="line.632"></a>
+<FONT color="green">633</FONT>         *<a name="line.633"></a>
+<FONT color="green">634</FONT>         * @param selectedRows Array of row indices must be non-empty<a name="line.634"></a>
+<FONT color="green">635</FONT>         * @param selectedColumns Array of column indices must be non-empty<a name="line.635"></a>
+<FONT color="green">636</FONT>         * @return The subMatrix containing the data in the<a name="line.636"></a>
+<FONT color="green">637</FONT>         *     specified rows and columns<a name="line.637"></a>
+<FONT color="green">638</FONT>         * @exception MatrixIndexException  if supplied row or column index arrays<a name="line.638"></a>
+<FONT color="green">639</FONT>         *     are not valid<a name="line.639"></a>
+<FONT color="green">640</FONT>         */<a name="line.640"></a>
+<FONT color="green">641</FONT>        public BigMatrix getSubMatrix(int[] selectedRows, int[] selectedColumns)<a name="line.641"></a>
+<FONT color="green">642</FONT>            throws MatrixIndexException {<a name="line.642"></a>
+<FONT color="green">643</FONT>    <a name="line.643"></a>
+<FONT color="green">644</FONT>            if (selectedRows.length * selectedColumns.length == 0) {<a name="line.644"></a>
+<FONT color="green">645</FONT>                if (selectedRows.length == 0) {<a name="line.645"></a>
+<FONT color="green">646</FONT>                    throw new MatrixIndexException("empty selected row index array");<a name="line.646"></a>
+<FONT color="green">647</FONT>                }<a name="line.647"></a>
+<FONT color="green">648</FONT>                throw new MatrixIndexException("empty selected column index array");<a name="line.648"></a>
+<FONT color="green">649</FONT>            }<a name="line.649"></a>
+<FONT color="green">650</FONT>    <a name="line.650"></a>
+<FONT color="green">651</FONT>            final BigDecimal[][] subMatrixData =<a name="line.651"></a>
+<FONT color="green">652</FONT>                new BigDecimal[selectedRows.length][selectedColumns.length];<a name="line.652"></a>
+<FONT color="green">653</FONT>            try  {<a name="line.653"></a>
+<FONT color="green">654</FONT>                for (int i = 0; i &lt; selectedRows.length; i++) {<a name="line.654"></a>
+<FONT color="green">655</FONT>                    final BigDecimal[] subI = subMatrixData[i];<a name="line.655"></a>
+<FONT color="green">656</FONT>                    final BigDecimal[] dataSelectedI = data[selectedRows[i]];<a name="line.656"></a>
+<FONT color="green">657</FONT>                    for (int j = 0; j &lt; selectedColumns.length; j++) {<a name="line.657"></a>
+<FONT color="green">658</FONT>                        subI[j] = dataSelectedI[selectedColumns[j]];<a name="line.658"></a>
+<FONT color="green">659</FONT>                    }<a name="line.659"></a>
+<FONT color="green">660</FONT>                }<a name="line.660"></a>
+<FONT color="green">661</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.661"></a>
+<FONT color="green">662</FONT>                // we redo the loop with checks enabled<a name="line.662"></a>
+<FONT color="green">663</FONT>                // in order to generate an appropriate message<a name="line.663"></a>
+<FONT color="green">664</FONT>                for (final int row : selectedRows) {<a name="line.664"></a>
+<FONT color="green">665</FONT>                    MatrixUtils.checkRowIndex(this, row);<a name="line.665"></a>
+<FONT color="green">666</FONT>                }<a name="line.666"></a>
+<FONT color="green">667</FONT>                for (final int column : selectedColumns) {<a name="line.667"></a>
+<FONT color="green">668</FONT>                    MatrixUtils.checkColumnIndex(this, column);<a name="line.668"></a>
+<FONT color="green">669</FONT>                }<a name="line.669"></a>
+<FONT color="green">670</FONT>            }<a name="line.670"></a>
+<FONT color="green">671</FONT>            return new BigMatrixImpl(subMatrixData, false);<a name="line.671"></a>
+<FONT color="green">672</FONT>        }<a name="line.672"></a>
+<FONT color="green">673</FONT>    <a name="line.673"></a>
+<FONT color="green">674</FONT>        /**<a name="line.674"></a>
+<FONT color="green">675</FONT>         * Replace the submatrix starting at &lt;code&gt;row, column&lt;/code&gt; using data in<a name="line.675"></a>
+<FONT color="green">676</FONT>         * the input &lt;code&gt;subMatrix&lt;/code&gt; array. Indexes are 0-based.<a name="line.676"></a>
+<FONT color="green">677</FONT>         * &lt;p&gt;<a name="line.677"></a>
+<FONT color="green">678</FONT>         * Example:&lt;br&gt;<a name="line.678"></a>
+<FONT color="green">679</FONT>         * Starting with &lt;pre&gt;<a name="line.679"></a>
+<FONT color="green">680</FONT>         * 1  2  3  4<a name="line.680"></a>
+<FONT color="green">681</FONT>         * 5  6  7  8<a name="line.681"></a>
+<FONT color="green">682</FONT>         * 9  0  1  2<a name="line.682"></a>
+<FONT color="green">683</FONT>         * &lt;/pre&gt;<a name="line.683"></a>
+<FONT color="green">684</FONT>         * and &lt;code&gt;subMatrix = {{3, 4} {5,6}}&lt;/code&gt;, invoking<a name="line.684"></a>
+<FONT color="green">685</FONT>         * &lt;code&gt;setSubMatrix(subMatrix,1,1))&lt;/code&gt; will result in &lt;pre&gt;<a name="line.685"></a>
+<FONT color="green">686</FONT>         * 1  2  3  4<a name="line.686"></a>
+<FONT color="green">687</FONT>         * 5  3  4  8<a name="line.687"></a>
+<FONT color="green">688</FONT>         * 9  5  6  2<a name="line.688"></a>
+<FONT color="green">689</FONT>         * &lt;/pre&gt;&lt;/p&gt;<a name="line.689"></a>
+<FONT color="green">690</FONT>         *<a name="line.690"></a>
+<FONT color="green">691</FONT>         * @param subMatrix  array containing the submatrix replacement data<a name="line.691"></a>
+<FONT color="green">692</FONT>         * @param row  row coordinate of the top, left element to be replaced<a name="line.692"></a>
+<FONT color="green">693</FONT>         * @param column  column coordinate of the top, left element to be replaced<a name="line.693"></a>
+<FONT color="green">694</FONT>         * @throws MatrixIndexException  if subMatrix does not fit into this<a name="line.694"></a>
+<FONT color="green">695</FONT>         *    matrix from element in (row, column)<a name="line.695"></a>
+<FONT color="green">696</FONT>         * @throws IllegalArgumentException if &lt;code&gt;subMatrix&lt;/code&gt; is not rectangular<a name="line.696"></a>
+<FONT color="green">697</FONT>         *  (not all rows have the same length) or empty<a name="line.697"></a>
+<FONT color="green">698</FONT>         * @throws NullPointerException if &lt;code&gt;subMatrix&lt;/code&gt; is null<a name="line.698"></a>
+<FONT color="green">699</FONT>         * @since 1.1<a name="line.699"></a>
+<FONT color="green">700</FONT>         */<a name="line.700"></a>
+<FONT color="green">701</FONT>        public void setSubMatrix(BigDecimal[][] subMatrix, int row, int column)<a name="line.701"></a>
+<FONT color="green">702</FONT>        throws MatrixIndexException {<a name="line.702"></a>
+<FONT color="green">703</FONT>    <a name="line.703"></a>
+<FONT color="green">704</FONT>            final int nRows = subMatrix.length;<a name="line.704"></a>
+<FONT color="green">705</FONT>            if (nRows == 0) {<a name="line.705"></a>
+<FONT color="green">706</FONT>                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");<a name="line.706"></a>
+<FONT color="green">707</FONT>            }<a name="line.707"></a>
+<FONT color="green">708</FONT>    <a name="line.708"></a>
+<FONT color="green">709</FONT>            final int nCols = subMatrix[0].length;<a name="line.709"></a>
+<FONT color="green">710</FONT>            if (nCols == 0) {<a name="line.710"></a>
+<FONT color="green">711</FONT>                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");<a name="line.711"></a>
+<FONT color="green">712</FONT>            }<a name="line.712"></a>
+<FONT color="green">713</FONT>    <a name="line.713"></a>
+<FONT color="green">714</FONT>            for (int r = 1; r &lt; nRows; r++) {<a name="line.714"></a>
+<FONT color="green">715</FONT>                if (subMatrix[r].length != nCols) {<a name="line.715"></a>
+<FONT color="green">716</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.716"></a>
+<FONT color="green">717</FONT>                          "some rows have length {0} while others have length {1}",<a name="line.717"></a>
+<FONT color="green">718</FONT>                          nCols, subMatrix[r].length);<a name="line.718"></a>
+<FONT color="green">719</FONT>                }<a name="line.719"></a>
+<FONT color="green">720</FONT>            }<a name="line.720"></a>
+<FONT color="green">721</FONT>    <a name="line.721"></a>
+<FONT color="green">722</FONT>            if (data == null) {<a name="line.722"></a>
+<FONT color="green">723</FONT>                if (row &gt; 0) {<a name="line.723"></a>
+<FONT color="green">724</FONT>                    throw MathRuntimeException.createIllegalStateException(<a name="line.724"></a>
+<FONT color="green">725</FONT>                            "first {0} rows are not initialized yet",<a name="line.725"></a>
+<FONT color="green">726</FONT>                            row);<a name="line.726"></a>
+<FONT color="green">727</FONT>                }<a name="line.727"></a>
+<FONT color="green">728</FONT>                if (column &gt; 0) {<a name="line.728"></a>
+<FONT color="green">729</FONT>                    throw MathRuntimeException.createIllegalStateException(<a name="line.729"></a>
+<FONT color="green">730</FONT>                            "first {0} columns are not initialized yet",<a name="line.730"></a>
+<FONT color="green">731</FONT>                            column);<a name="line.731"></a>
+<FONT color="green">732</FONT>                }<a name="line.732"></a>
+<FONT color="green">733</FONT>                data = new BigDecimal[nRows][nCols];<a name="line.733"></a>
+<FONT color="green">734</FONT>                System.arraycopy(subMatrix, 0, data, 0, subMatrix.length);<a name="line.734"></a>
+<FONT color="green">735</FONT>            } else {<a name="line.735"></a>
+<FONT color="green">736</FONT>                MatrixUtils.checkRowIndex(this, row);<a name="line.736"></a>
+<FONT color="green">737</FONT>                MatrixUtils.checkColumnIndex(this, column);<a name="line.737"></a>
+<FONT color="green">738</FONT>                MatrixUtils.checkRowIndex(this, nRows + row - 1);<a name="line.738"></a>
+<FONT color="green">739</FONT>                MatrixUtils.checkColumnIndex(this, nCols + column - 1);<a name="line.739"></a>
+<FONT color="green">740</FONT>            }<a name="line.740"></a>
+<FONT color="green">741</FONT>            for (int i = 0; i &lt; nRows; i++) {<a name="line.741"></a>
+<FONT color="green">742</FONT>                System.arraycopy(subMatrix[i], 0, data[row + i], column, nCols);<a name="line.742"></a>
+<FONT color="green">743</FONT>            }<a name="line.743"></a>
+<FONT color="green">744</FONT>    <a name="line.744"></a>
+<FONT color="green">745</FONT>            lu = null;<a name="line.745"></a>
+<FONT color="green">746</FONT>    <a name="line.746"></a>
+<FONT color="green">747</FONT>        }<a name="line.747"></a>
+<FONT color="green">748</FONT>    <a name="line.748"></a>
+<FONT color="green">749</FONT>        /**<a name="line.749"></a>
+<FONT color="green">750</FONT>         * Returns the entries in row number &lt;code&gt;row&lt;/code&gt;<a name="line.750"></a>
+<FONT color="green">751</FONT>         * as a row matrix.  Row indices start at 0.<a name="line.751"></a>
+<FONT color="green">752</FONT>         *<a name="line.752"></a>
+<FONT color="green">753</FONT>         * @param row the row to be fetched<a name="line.753"></a>
+<FONT color="green">754</FONT>         * @return row matrix<a name="line.754"></a>
+<FONT color="green">755</FONT>         * @throws MatrixIndexException if the specified row index is invalid<a name="line.755"></a>
+<FONT color="green">756</FONT>         */<a name="line.756"></a>
+<FONT color="green">757</FONT>        public BigMatrix getRowMatrix(int row) throws MatrixIndexException {<a name="line.757"></a>
+<FONT color="green">758</FONT>            MatrixUtils.checkRowIndex(this, row);<a name="line.758"></a>
+<FONT color="green">759</FONT>            final int ncols = this.getColumnDimension();<a name="line.759"></a>
+<FONT color="green">760</FONT>            final BigDecimal[][] out = new BigDecimal[1][ncols];<a name="line.760"></a>
+<FONT color="green">761</FONT>            System.arraycopy(data[row], 0, out[0], 0, ncols);<a name="line.761"></a>
+<FONT color="green">762</FONT>            return new BigMatrixImpl(out, false);<a name="line.762"></a>
+<FONT color="green">763</FONT>        }<a name="line.763"></a>
+<FONT color="green">764</FONT>    <a name="line.764"></a>
+<FONT color="green">765</FONT>        /**<a name="line.765"></a>
+<FONT color="green">766</FONT>         * Returns the entries in column number &lt;code&gt;column&lt;/code&gt;<a name="line.766"></a>
+<FONT color="green">767</FONT>         * as a column matrix.  Column indices start at 0.<a name="line.767"></a>
+<FONT color="green">768</FONT>         *<a name="line.768"></a>
+<FONT color="green">769</FONT>         * @param column the column to be fetched<a name="line.769"></a>
+<FONT color="green">770</FONT>         * @return column matrix<a name="line.770"></a>
+<FONT color="green">771</FONT>         * @throws MatrixIndexException if the specified column index is invalid<a name="line.771"></a>
+<FONT color="green">772</FONT>         */<a name="line.772"></a>
+<FONT color="green">773</FONT>        public BigMatrix getColumnMatrix(int column) throws MatrixIndexException {<a name="line.773"></a>
+<FONT color="green">774</FONT>            MatrixUtils.checkColumnIndex(this, column);<a name="line.774"></a>
+<FONT color="green">775</FONT>            final int nRows = this.getRowDimension();<a name="line.775"></a>
+<FONT color="green">776</FONT>            final BigDecimal[][] out = new BigDecimal[nRows][1];<a name="line.776"></a>
+<FONT color="green">777</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.777"></a>
+<FONT color="green">778</FONT>                out[row][0] = data[row][column];<a name="line.778"></a>
+<FONT color="green">779</FONT>            }<a name="line.779"></a>
+<FONT color="green">780</FONT>            return new BigMatrixImpl(out, false);<a name="line.780"></a>
+<FONT color="green">781</FONT>        }<a name="line.781"></a>
+<FONT color="green">782</FONT>    <a name="line.782"></a>
+<FONT color="green">783</FONT>        /**<a name="line.783"></a>
+<FONT color="green">784</FONT>         * Returns the entries in row number &lt;code&gt;row&lt;/code&gt; as an array.<a name="line.784"></a>
+<FONT color="green">785</FONT>         * &lt;p&gt;<a name="line.785"></a>
+<FONT color="green">786</FONT>         * Row indices start at 0.  A &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown<a name="line.786"></a>
+<FONT color="green">787</FONT>         * unless &lt;code&gt;0 &lt;= row &lt; rowDimension.&lt;/code&gt;&lt;/p&gt;<a name="line.787"></a>
+<FONT color="green">788</FONT>         *<a name="line.788"></a>
+<FONT color="green">789</FONT>         * @param row the row to be fetched<a name="line.789"></a>
+<FONT color="green">790</FONT>         * @return array of entries in the row<a name="line.790"></a>
+<FONT color="green">791</FONT>         * @throws MatrixIndexException if the specified row index is not valid<a name="line.791"></a>
+<FONT color="green">792</FONT>         */<a name="line.792"></a>
+<FONT color="green">793</FONT>        public BigDecimal[] getRow(int row) throws MatrixIndexException {<a name="line.793"></a>
+<FONT color="green">794</FONT>            MatrixUtils.checkRowIndex(this, row);<a name="line.794"></a>
+<FONT color="green">795</FONT>            final int ncols = this.getColumnDimension();<a name="line.795"></a>
+<FONT color="green">796</FONT>            final BigDecimal[] out = new BigDecimal[ncols];<a name="line.796"></a>
+<FONT color="green">797</FONT>            System.arraycopy(data[row], 0, out, 0, ncols);<a name="line.797"></a>
+<FONT color="green">798</FONT>            return out;<a name="line.798"></a>
+<FONT color="green">799</FONT>        }<a name="line.799"></a>
+<FONT color="green">800</FONT>    <a name="line.800"></a>
+<FONT color="green">801</FONT>         /**<a name="line.801"></a>
+<FONT color="green">802</FONT>         * Returns the entries in row number &lt;code&gt;row&lt;/code&gt; as an array<a name="line.802"></a>
+<FONT color="green">803</FONT>         * of double values.<a name="line.803"></a>
+<FONT color="green">804</FONT>         * &lt;p&gt;<a name="line.804"></a>
+<FONT color="green">805</FONT>         * Row indices start at 0.  A &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown<a name="line.805"></a>
+<FONT color="green">806</FONT>         * unless &lt;code&gt;0 &lt;= row &lt; rowDimension.&lt;/code&gt;&lt;/p&gt;<a name="line.806"></a>
+<FONT color="green">807</FONT>         *<a name="line.807"></a>
+<FONT color="green">808</FONT>         * @param row the row to be fetched<a name="line.808"></a>
+<FONT color="green">809</FONT>         * @return array of entries in the row<a name="line.809"></a>
+<FONT color="green">810</FONT>         * @throws MatrixIndexException if the specified row index is not valid<a name="line.810"></a>
+<FONT color="green">811</FONT>         */<a name="line.811"></a>
+<FONT color="green">812</FONT>        public double[] getRowAsDoubleArray(int row) throws MatrixIndexException {<a name="line.812"></a>
+<FONT color="green">813</FONT>            MatrixUtils.checkRowIndex(this, row);<a name="line.813"></a>
+<FONT color="green">814</FONT>            final int ncols = this.getColumnDimension();<a name="line.814"></a>
+<FONT color="green">815</FONT>            final double[] out = new double[ncols];<a name="line.815"></a>
+<FONT color="green">816</FONT>            for (int i=0;i&lt;ncols;i++) {<a name="line.816"></a>
+<FONT color="green">817</FONT>                out[i] = data[row][i].doubleValue();<a name="line.817"></a>
+<FONT color="green">818</FONT>            }<a name="line.818"></a>
+<FONT color="green">819</FONT>            return out;<a name="line.819"></a>
+<FONT color="green">820</FONT>        }<a name="line.820"></a>
+<FONT color="green">821</FONT>    <a name="line.821"></a>
+<FONT color="green">822</FONT>         /**<a name="line.822"></a>
+<FONT color="green">823</FONT>         * Returns the entries in column number &lt;code&gt;col&lt;/code&gt; as an array.<a name="line.823"></a>
+<FONT color="green">824</FONT>         * &lt;p&gt;<a name="line.824"></a>
+<FONT color="green">825</FONT>         * Column indices start at 0.  A &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown<a name="line.825"></a>
+<FONT color="green">826</FONT>         * unless &lt;code&gt;0 &lt;= column &lt; columnDimension.&lt;/code&gt;&lt;/p&gt;<a name="line.826"></a>
+<FONT color="green">827</FONT>         *<a name="line.827"></a>
+<FONT color="green">828</FONT>         * @param col the column to be fetched<a name="line.828"></a>
+<FONT color="green">829</FONT>         * @return array of entries in the column<a name="line.829"></a>
+<FONT color="green">830</FONT>         * @throws MatrixIndexException if the specified column index is not valid<a name="line.830"></a>
+<FONT color="green">831</FONT>         */<a name="line.831"></a>
+<FONT color="green">832</FONT>        public BigDecimal[] getColumn(int col) throws MatrixIndexException {<a name="line.832"></a>
+<FONT color="green">833</FONT>            MatrixUtils.checkColumnIndex(this, col);<a name="line.833"></a>
+<FONT color="green">834</FONT>            final int nRows = this.getRowDimension();<a name="line.834"></a>
+<FONT color="green">835</FONT>            final BigDecimal[] out = new BigDecimal[nRows];<a name="line.835"></a>
+<FONT color="green">836</FONT>            for (int i = 0; i &lt; nRows; i++) {<a name="line.836"></a>
+<FONT color="green">837</FONT>                out[i] = data[i][col];<a name="line.837"></a>
+<FONT color="green">838</FONT>            }<a name="line.838"></a>
+<FONT color="green">839</FONT>            return out;<a name="line.839"></a>
+<FONT color="green">840</FONT>        }<a name="line.840"></a>
+<FONT color="green">841</FONT>    <a name="line.841"></a>
+<FONT color="green">842</FONT>        /**<a name="line.842"></a>
+<FONT color="green">843</FONT>         * Returns the entries in column number &lt;code&gt;col&lt;/code&gt; as an array<a name="line.843"></a>
+<FONT color="green">844</FONT>         * of double values.<a name="line.844"></a>
+<FONT color="green">845</FONT>         * &lt;p&gt;<a name="line.845"></a>
+<FONT color="green">846</FONT>         * Column indices start at 0.  A &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown<a name="line.846"></a>
+<FONT color="green">847</FONT>         * unless &lt;code&gt;0 &lt;= column &lt; columnDimension.&lt;/code&gt;&lt;/p&gt;<a name="line.847"></a>
+<FONT color="green">848</FONT>         *<a name="line.848"></a>
+<FONT color="green">849</FONT>         * @param col the column to be fetched<a name="line.849"></a>
+<FONT color="green">850</FONT>         * @return array of entries in the column<a name="line.850"></a>
+<FONT color="green">851</FONT>         * @throws MatrixIndexException if the specified column index is not valid<a name="line.851"></a>
+<FONT color="green">852</FONT>         */<a name="line.852"></a>
+<FONT color="green">853</FONT>        public double[] getColumnAsDoubleArray(int col) throws MatrixIndexException {<a name="line.853"></a>
+<FONT color="green">854</FONT>            MatrixUtils.checkColumnIndex(this, col);<a name="line.854"></a>
+<FONT color="green">855</FONT>            final int nrows = this.getRowDimension();<a name="line.855"></a>
+<FONT color="green">856</FONT>            final double[] out = new double[nrows];<a name="line.856"></a>
+<FONT color="green">857</FONT>            for (int i=0;i&lt;nrows;i++) {<a name="line.857"></a>
+<FONT color="green">858</FONT>                out[i] = data[i][col].doubleValue();<a name="line.858"></a>
+<FONT color="green">859</FONT>            }<a name="line.859"></a>
+<FONT color="green">860</FONT>            return out;<a name="line.860"></a>
+<FONT color="green">861</FONT>        }<a name="line.861"></a>
+<FONT color="green">862</FONT>    <a name="line.862"></a>
+<FONT color="green">863</FONT>         /**<a name="line.863"></a>
+<FONT color="green">864</FONT>         * Returns the entry in the specified row and column.<a name="line.864"></a>
+<FONT color="green">865</FONT>         * &lt;p&gt;<a name="line.865"></a>
+<FONT color="green">866</FONT>         * Row and column indices start at 0 and must satisfy<a name="line.866"></a>
+<FONT color="green">867</FONT>         * &lt;ul&gt;<a name="line.867"></a>
+<FONT color="green">868</FONT>         * &lt;li&gt;&lt;code&gt;0 &lt;= row &lt; rowDimension&lt;/code&gt;&lt;/li&gt;<a name="line.868"></a>
+<FONT color="green">869</FONT>         * &lt;li&gt;&lt;code&gt; 0 &lt;= column &lt; columnDimension&lt;/code&gt;&lt;/li&gt;<a name="line.869"></a>
+<FONT color="green">870</FONT>         * &lt;/ul&gt;<a name="line.870"></a>
+<FONT color="green">871</FONT>         * otherwise a &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.871"></a>
+<FONT color="green">872</FONT>         *<a name="line.872"></a>
+<FONT color="green">873</FONT>         * @param row  row location of entry to be fetched<a name="line.873"></a>
+<FONT color="green">874</FONT>         * @param column  column location of entry to be fetched<a name="line.874"></a>
+<FONT color="green">875</FONT>         * @return matrix entry in row,column<a name="line.875"></a>
+<FONT color="green">876</FONT>         * @throws MatrixIndexException if the row or column index is not valid<a name="line.876"></a>
+<FONT color="green">877</FONT>         */<a name="line.877"></a>
+<FONT color="green">878</FONT>        public BigDecimal getEntry(int row, int column)<a name="line.878"></a>
+<FONT color="green">879</FONT>        throws MatrixIndexException {<a name="line.879"></a>
+<FONT color="green">880</FONT>            try {<a name="line.880"></a>
+<FONT color="green">881</FONT>                return data[row][column];<a name="line.881"></a>
+<FONT color="green">882</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.882"></a>
+<FONT color="green">883</FONT>                throw new MatrixIndexException(<a name="line.883"></a>
+<FONT color="green">884</FONT>                        "no entry at indices ({0}, {1}) in a {2}x{3} matrix",<a name="line.884"></a>
+<FONT color="green">885</FONT>                        row, column, getRowDimension(), getColumnDimension());<a name="line.885"></a>
+<FONT color="green">886</FONT>            }<a name="line.886"></a>
+<FONT color="green">887</FONT>        }<a name="line.887"></a>
+<FONT color="green">888</FONT>    <a name="line.888"></a>
+<FONT color="green">889</FONT>        /**<a name="line.889"></a>
+<FONT color="green">890</FONT>         * Returns the entry in the specified row and column as a double.<a name="line.890"></a>
+<FONT color="green">891</FONT>         * &lt;p&gt;<a name="line.891"></a>
+<FONT color="green">892</FONT>         * Row and column indices start at 0 and must satisfy<a name="line.892"></a>
+<FONT color="green">893</FONT>         * &lt;ul&gt;<a name="line.893"></a>
+<FONT color="green">894</FONT>         * &lt;li&gt;&lt;code&gt;0 &lt;= row &lt; rowDimension&lt;/code&gt;&lt;/li&gt;<a name="line.894"></a>
+<FONT color="green">895</FONT>         * &lt;li&gt;&lt;code&gt; 0 &lt;= column &lt; columnDimension&lt;/code&gt;&lt;/li&gt;<a name="line.895"></a>
+<FONT color="green">896</FONT>         * &lt;/ul&gt;<a name="line.896"></a>
+<FONT color="green">897</FONT>         * otherwise a &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.897"></a>
+<FONT color="green">898</FONT>         *<a name="line.898"></a>
+<FONT color="green">899</FONT>         * @param row  row location of entry to be fetched<a name="line.899"></a>
+<FONT color="green">900</FONT>         * @param column  column location of entry to be fetched<a name="line.900"></a>
+<FONT color="green">901</FONT>         * @return matrix entry in row,column<a name="line.901"></a>
+<FONT color="green">902</FONT>         * @throws MatrixIndexException if the row<a name="line.902"></a>
+<FONT color="green">903</FONT>         * or column index is not valid<a name="line.903"></a>
+<FONT color="green">904</FONT>         */<a name="line.904"></a>
+<FONT color="green">905</FONT>        public double getEntryAsDouble(int row, int column) throws MatrixIndexException {<a name="line.905"></a>
+<FONT color="green">906</FONT>            return getEntry(row,column).doubleValue();<a name="line.906"></a>
+<FONT color="green">907</FONT>        }<a name="line.907"></a>
+<FONT color="green">908</FONT>    <a name="line.908"></a>
+<FONT color="green">909</FONT>        /**<a name="line.909"></a>
+<FONT color="green">910</FONT>         * Returns the transpose matrix.<a name="line.910"></a>
+<FONT color="green">911</FONT>         *<a name="line.911"></a>
+<FONT color="green">912</FONT>         * @return transpose matrix<a name="line.912"></a>
+<FONT color="green">913</FONT>         */<a name="line.913"></a>
+<FONT color="green">914</FONT>        public BigMatrix transpose() {<a name="line.914"></a>
+<FONT color="green">915</FONT>            final int nRows = this.getRowDimension();<a name="line.915"></a>
+<FONT color="green">916</FONT>            final int nCols = this.getColumnDimension();<a name="line.916"></a>
+<FONT color="green">917</FONT>            final BigDecimal[][] outData = new BigDecimal[nCols][nRows];<a name="line.917"></a>
+<FONT color="green">918</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.918"></a>
+<FONT color="green">919</FONT>                final BigDecimal[] dataRow = data[row];<a name="line.919"></a>
+<FONT color="green">920</FONT>                for (int col = 0; col &lt; nCols; col++) {<a name="line.920"></a>
+<FONT color="green">921</FONT>                    outData[col][row] = dataRow[col];<a name="line.921"></a>
+<FONT color="green">922</FONT>                }<a name="line.922"></a>
+<FONT color="green">923</FONT>            }<a name="line.923"></a>
+<FONT color="green">924</FONT>            return new BigMatrixImpl(outData, false);<a name="line.924"></a>
+<FONT color="green">925</FONT>        }<a name="line.925"></a>
+<FONT color="green">926</FONT>    <a name="line.926"></a>
+<FONT color="green">927</FONT>        /**<a name="line.927"></a>
+<FONT color="green">928</FONT>         * Returns the inverse matrix if this matrix is invertible.<a name="line.928"></a>
+<FONT color="green">929</FONT>         *<a name="line.929"></a>
+<FONT color="green">930</FONT>         * @return inverse matrix<a name="line.930"></a>
+<FONT color="green">931</FONT>         * @throws InvalidMatrixException if this is not invertible<a name="line.931"></a>
+<FONT color="green">932</FONT>         */<a name="line.932"></a>
+<FONT color="green">933</FONT>        public BigMatrix inverse() throws InvalidMatrixException {<a name="line.933"></a>
+<FONT color="green">934</FONT>            return solve(MatrixUtils.createBigIdentityMatrix(getRowDimension()));<a name="line.934"></a>
+<FONT color="green">935</FONT>        }<a name="line.935"></a>
+<FONT color="green">936</FONT>    <a name="line.936"></a>
+<FONT color="green">937</FONT>        /**<a name="line.937"></a>
+<FONT color="green">938</FONT>         * Returns the determinant of this matrix.<a name="line.938"></a>
+<FONT color="green">939</FONT>         *<a name="line.939"></a>
+<FONT color="green">940</FONT>         * @return determinant<a name="line.940"></a>
+<FONT color="green">941</FONT>         * @throws InvalidMatrixException if matrix is not square<a name="line.941"></a>
+<FONT color="green">942</FONT>         */<a name="line.942"></a>
+<FONT color="green">943</FONT>        public BigDecimal getDeterminant() throws InvalidMatrixException {<a name="line.943"></a>
+<FONT color="green">944</FONT>            if (!isSquare()) {<a name="line.944"></a>
+<FONT color="green">945</FONT>                throw new NonSquareMatrixException(getRowDimension(), getColumnDimension());<a name="line.945"></a>
+<FONT color="green">946</FONT>            }<a name="line.946"></a>
+<FONT color="green">947</FONT>            if (isSingular()) {   // note: this has side effect of attempting LU decomp if lu == null<a name="line.947"></a>
+<FONT color="green">948</FONT>                return ZERO;<a name="line.948"></a>
+<FONT color="green">949</FONT>            } else {<a name="line.949"></a>
+<FONT color="green">950</FONT>                BigDecimal det = (parity == 1) ? ONE : ONE.negate();<a name="line.950"></a>
+<FONT color="green">951</FONT>                for (int i = 0; i &lt; getRowDimension(); i++) {<a name="line.951"></a>
+<FONT color="green">952</FONT>                    det = det.multiply(lu[i][i]);<a name="line.952"></a>
+<FONT color="green">953</FONT>                }<a name="line.953"></a>
+<FONT color="green">954</FONT>                return det;<a name="line.954"></a>
+<FONT color="green">955</FONT>            }<a name="line.955"></a>
+<FONT color="green">956</FONT>        }<a name="line.956"></a>
+<FONT color="green">957</FONT>    <a name="line.957"></a>
+<FONT color="green">958</FONT>         /**<a name="line.958"></a>
+<FONT color="green">959</FONT>         * Is this a square matrix?<a name="line.959"></a>
+<FONT color="green">960</FONT>         * @return true if the matrix is square (rowDimension = columnDimension)<a name="line.960"></a>
+<FONT color="green">961</FONT>         */<a name="line.961"></a>
+<FONT color="green">962</FONT>        public boolean isSquare() {<a name="line.962"></a>
+<FONT color="green">963</FONT>            return getColumnDimension() == getRowDimension();<a name="line.963"></a>
+<FONT color="green">964</FONT>        }<a name="line.964"></a>
+<FONT color="green">965</FONT>    <a name="line.965"></a>
+<FONT color="green">966</FONT>        /**<a name="line.966"></a>
+<FONT color="green">967</FONT>         * Is this a singular matrix?<a name="line.967"></a>
+<FONT color="green">968</FONT>         * @return true if the matrix is singular<a name="line.968"></a>
+<FONT color="green">969</FONT>         */<a name="line.969"></a>
+<FONT color="green">970</FONT>        public boolean isSingular() {<a name="line.970"></a>
+<FONT color="green">971</FONT>            if (lu == null) {<a name="line.971"></a>
+<FONT color="green">972</FONT>                try {<a name="line.972"></a>
+<FONT color="green">973</FONT>                    luDecompose();<a name="line.973"></a>
+<FONT color="green">974</FONT>                    return false;<a name="line.974"></a>
+<FONT color="green">975</FONT>                } catch (InvalidMatrixException ex) {<a name="line.975"></a>
+<FONT color="green">976</FONT>                    return true;<a name="line.976"></a>
+<FONT color="green">977</FONT>                }<a name="line.977"></a>
+<FONT color="green">978</FONT>            } else { // LU decomp must have been successfully performed<a name="line.978"></a>
+<FONT color="green">979</FONT>                return false; // so the matrix is not singular<a name="line.979"></a>
+<FONT color="green">980</FONT>            }<a name="line.980"></a>
+<FONT color="green">981</FONT>        }<a name="line.981"></a>
+<FONT color="green">982</FONT>    <a name="line.982"></a>
+<FONT color="green">983</FONT>        /**<a name="line.983"></a>
+<FONT color="green">984</FONT>         * Returns the number of rows in the matrix.<a name="line.984"></a>
+<FONT color="green">985</FONT>         *<a name="line.985"></a>
+<FONT color="green">986</FONT>         * @return rowDimension<a name="line.986"></a>
+<FONT color="green">987</FONT>         */<a name="line.987"></a>
+<FONT color="green">988</FONT>        public int getRowDimension() {<a name="line.988"></a>
+<FONT color="green">989</FONT>            return data.length;<a name="line.989"></a>
+<FONT color="green">990</FONT>        }<a name="line.990"></a>
+<FONT color="green">991</FONT>    <a name="line.991"></a>
+<FONT color="green">992</FONT>        /**<a name="line.992"></a>
+<FONT color="green">993</FONT>         * Returns the number of columns in the matrix.<a name="line.993"></a>
+<FONT color="green">994</FONT>         *<a name="line.994"></a>
+<FONT color="green">995</FONT>         * @return columnDimension<a name="line.995"></a>
+<FONT color="green">996</FONT>         */<a name="line.996"></a>
+<FONT color="green">997</FONT>        public int getColumnDimension() {<a name="line.997"></a>
+<FONT color="green">998</FONT>            return data[0].length;<a name="line.998"></a>
+<FONT color="green">999</FONT>        }<a name="line.999"></a>
+<FONT color="green">1000</FONT>    <a name="line.1000"></a>
+<FONT color="green">1001</FONT>         /**<a name="line.1001"></a>
+<FONT color="green">1002</FONT>         * Returns the &lt;a href="http://mathworld.wolfram.com/MatrixTrace.html"&gt;<a name="line.1002"></a>
+<FONT color="green">1003</FONT>         * trace&lt;/a&gt; of the matrix (the sum of the elements on the main diagonal).<a name="line.1003"></a>
+<FONT color="green">1004</FONT>         *<a name="line.1004"></a>
+<FONT color="green">1005</FONT>         * @return trace<a name="line.1005"></a>
+<FONT color="green">1006</FONT>         *<a name="line.1006"></a>
+<FONT color="green">1007</FONT>         * @throws IllegalArgumentException if this matrix is not square.<a name="line.1007"></a>
+<FONT color="green">1008</FONT>         */<a name="line.1008"></a>
+<FONT color="green">1009</FONT>        public BigDecimal getTrace() throws IllegalArgumentException {<a name="line.1009"></a>
+<FONT color="green">1010</FONT>            if (!isSquare()) {<a name="line.1010"></a>
+<FONT color="green">1011</FONT>                throw new NonSquareMatrixException(getRowDimension(), getColumnDimension());<a name="line.1011"></a>
+<FONT color="green">1012</FONT>            }<a name="line.1012"></a>
+<FONT color="green">1013</FONT>            BigDecimal trace = data[0][0];<a name="line.1013"></a>
+<FONT color="green">1014</FONT>            for (int i = 1; i &lt; this.getRowDimension(); i++) {<a name="line.1014"></a>
+<FONT color="green">1015</FONT>                trace = trace.add(data[i][i]);<a name="line.1015"></a>
+<FONT color="green">1016</FONT>            }<a name="line.1016"></a>
+<FONT color="green">1017</FONT>            return trace;<a name="line.1017"></a>
+<FONT color="green">1018</FONT>        }<a name="line.1018"></a>
+<FONT color="green">1019</FONT>    <a name="line.1019"></a>
+<FONT color="green">1020</FONT>        /**<a name="line.1020"></a>
+<FONT color="green">1021</FONT>         * Returns the result of multiplying this by the vector &lt;code&gt;v&lt;/code&gt;.<a name="line.1021"></a>
+<FONT color="green">1022</FONT>         *<a name="line.1022"></a>
+<FONT color="green">1023</FONT>         * @param v the vector to operate on<a name="line.1023"></a>
+<FONT color="green">1024</FONT>         * @return this*v<a name="line.1024"></a>
+<FONT color="green">1025</FONT>         * @throws IllegalArgumentException if columnDimension != v.size()<a name="line.1025"></a>
+<FONT color="green">1026</FONT>         */<a name="line.1026"></a>
+<FONT color="green">1027</FONT>        public BigDecimal[] operate(BigDecimal[] v) throws IllegalArgumentException {<a name="line.1027"></a>
+<FONT color="green">1028</FONT>            if (v.length != getColumnDimension()) {<a name="line.1028"></a>
+<FONT color="green">1029</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1029"></a>
+<FONT color="green">1030</FONT>                        "vector length mismatch: got {0} but expected {1}",<a name="line.1030"></a>
+<FONT color="green">1031</FONT>                        v.length, getColumnDimension() );<a name="line.1031"></a>
+<FONT color="green">1032</FONT>            }<a name="line.1032"></a>
+<FONT color="green">1033</FONT>            final int nRows = this.getRowDimension();<a name="line.1033"></a>
+<FONT color="green">1034</FONT>            final int nCols = this.getColumnDimension();<a name="line.1034"></a>
+<FONT color="green">1035</FONT>            final BigDecimal[] out = new BigDecimal[nRows];<a name="line.1035"></a>
+<FONT color="green">1036</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.1036"></a>
+<FONT color="green">1037</FONT>                BigDecimal sum = ZERO;<a name="line.1037"></a>
+<FONT color="green">1038</FONT>                for (int i = 0; i &lt; nCols; i++) {<a name="line.1038"></a>
+<FONT color="green">1039</FONT>                    sum = sum.add(data[row][i].multiply(v[i]));<a name="line.1039"></a>
+<FONT color="green">1040</FONT>                }<a name="line.1040"></a>
+<FONT color="green">1041</FONT>                out[row] = sum;<a name="line.1041"></a>
+<FONT color="green">1042</FONT>            }<a name="line.1042"></a>
+<FONT color="green">1043</FONT>            return out;<a name="line.1043"></a>
+<FONT color="green">1044</FONT>        }<a name="line.1044"></a>
+<FONT color="green">1045</FONT>    <a name="line.1045"></a>
+<FONT color="green">1046</FONT>        /**<a name="line.1046"></a>
+<FONT color="green">1047</FONT>         * Returns the result of multiplying this by the vector &lt;code&gt;v&lt;/code&gt;.<a name="line.1047"></a>
+<FONT color="green">1048</FONT>         *<a name="line.1048"></a>
+<FONT color="green">1049</FONT>         * @param v the vector to operate on<a name="line.1049"></a>
+<FONT color="green">1050</FONT>         * @return this*v<a name="line.1050"></a>
+<FONT color="green">1051</FONT>         * @throws IllegalArgumentException if columnDimension != v.size()<a name="line.1051"></a>
+<FONT color="green">1052</FONT>         */<a name="line.1052"></a>
+<FONT color="green">1053</FONT>        public BigDecimal[] operate(double[] v) throws IllegalArgumentException {<a name="line.1053"></a>
+<FONT color="green">1054</FONT>            final BigDecimal bd[] = new BigDecimal[v.length];<a name="line.1054"></a>
+<FONT color="green">1055</FONT>            for (int i = 0; i &lt; bd.length; i++) {<a name="line.1055"></a>
+<FONT color="green">1056</FONT>                bd[i] = new BigDecimal(v[i]);<a name="line.1056"></a>
+<FONT color="green">1057</FONT>            }<a name="line.1057"></a>
+<FONT color="green">1058</FONT>            return operate(bd);<a name="line.1058"></a>
+<FONT color="green">1059</FONT>        }<a name="line.1059"></a>
+<FONT color="green">1060</FONT>    <a name="line.1060"></a>
+<FONT color="green">1061</FONT>        /**<a name="line.1061"></a>
+<FONT color="green">1062</FONT>         * Returns the (row) vector result of premultiplying this by the vector &lt;code&gt;v&lt;/code&gt;.<a name="line.1062"></a>
+<FONT color="green">1063</FONT>         *<a name="line.1063"></a>
+<FONT color="green">1064</FONT>         * @param v the row vector to premultiply by<a name="line.1064"></a>
+<FONT color="green">1065</FONT>         * @return v*this<a name="line.1065"></a>
+<FONT color="green">1066</FONT>         * @throws IllegalArgumentException if rowDimension != v.size()<a name="line.1066"></a>
+<FONT color="green">1067</FONT>         */<a name="line.1067"></a>
+<FONT color="green">1068</FONT>        public BigDecimal[] preMultiply(BigDecimal[] v) throws IllegalArgumentException {<a name="line.1068"></a>
+<FONT color="green">1069</FONT>            final int nRows = this.getRowDimension();<a name="line.1069"></a>
+<FONT color="green">1070</FONT>            if (v.length != nRows) {<a name="line.1070"></a>
+<FONT color="green">1071</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1071"></a>
+<FONT color="green">1072</FONT>                        "vector length mismatch: got {0} but expected {1}",<a name="line.1072"></a>
+<FONT color="green">1073</FONT>                        v.length, nRows );<a name="line.1073"></a>
+<FONT color="green">1074</FONT>            }<a name="line.1074"></a>
+<FONT color="green">1075</FONT>            final int nCols = this.getColumnDimension();<a name="line.1075"></a>
+<FONT color="green">1076</FONT>            final BigDecimal[] out = new BigDecimal[nCols];<a name="line.1076"></a>
+<FONT color="green">1077</FONT>            for (int col = 0; col &lt; nCols; col++) {<a name="line.1077"></a>
+<FONT color="green">1078</FONT>                BigDecimal sum = ZERO;<a name="line.1078"></a>
+<FONT color="green">1079</FONT>                for (int i = 0; i &lt; nRows; i++) {<a name="line.1079"></a>
+<FONT color="green">1080</FONT>                    sum = sum.add(data[i][col].multiply(v[i]));<a name="line.1080"></a>
+<FONT color="green">1081</FONT>                }<a name="line.1081"></a>
+<FONT color="green">1082</FONT>                out[col] = sum;<a name="line.1082"></a>
+<FONT color="green">1083</FONT>            }<a name="line.1083"></a>
+<FONT color="green">1084</FONT>            return out;<a name="line.1084"></a>
+<FONT color="green">1085</FONT>        }<a name="line.1085"></a>
+<FONT color="green">1086</FONT>    <a name="line.1086"></a>
+<FONT color="green">1087</FONT>        /**<a name="line.1087"></a>
+<FONT color="green">1088</FONT>         * Returns a matrix of (column) solution vectors for linear systems with<a name="line.1088"></a>
+<FONT color="green">1089</FONT>         * coefficient matrix = this and constant vectors = columns of<a name="line.1089"></a>
+<FONT color="green">1090</FONT>         * &lt;code&gt;b&lt;/code&gt;.<a name="line.1090"></a>
+<FONT color="green">1091</FONT>         *<a name="line.1091"></a>
+<FONT color="green">1092</FONT>         * @param b  array of constants forming RHS of linear systems to<a name="line.1092"></a>
+<FONT color="green">1093</FONT>         * to solve<a name="line.1093"></a>
+<FONT color="green">1094</FONT>         * @return solution array<a name="line.1094"></a>
+<FONT color="green">1095</FONT>         * @throws IllegalArgumentException if this.rowDimension != row dimension<a name="line.1095"></a>
+<FONT color="green">1096</FONT>         * @throws InvalidMatrixException if this matrix is not square or is singular<a name="line.1096"></a>
+<FONT color="green">1097</FONT>         */<a name="line.1097"></a>
+<FONT color="green">1098</FONT>        public BigDecimal[] solve(BigDecimal[] b) throws IllegalArgumentException, InvalidMatrixException {<a name="line.1098"></a>
+<FONT color="green">1099</FONT>            final int nRows = this.getRowDimension();<a name="line.1099"></a>
+<FONT color="green">1100</FONT>            if (b.length != nRows) {<a name="line.1100"></a>
+<FONT color="green">1101</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1101"></a>
+<FONT color="green">1102</FONT>                        "vector length mismatch: got {0} but expected {1}",<a name="line.1102"></a>
+<FONT color="green">1103</FONT>                        b.length, nRows);<a name="line.1103"></a>
+<FONT color="green">1104</FONT>            }<a name="line.1104"></a>
+<FONT color="green">1105</FONT>            final BigMatrix bMatrix = new BigMatrixImpl(b);<a name="line.1105"></a>
+<FONT color="green">1106</FONT>            final BigDecimal[][] solution = ((BigMatrixImpl) (solve(bMatrix))).getDataRef();<a name="line.1106"></a>
+<FONT color="green">1107</FONT>            final BigDecimal[] out = new BigDecimal[nRows];<a name="line.1107"></a>
+<FONT color="green">1108</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.1108"></a>
+<FONT color="green">1109</FONT>                out[row] = solution[row][0];<a name="line.1109"></a>
+<FONT color="green">1110</FONT>            }<a name="line.1110"></a>
+<FONT color="green">1111</FONT>            return out;<a name="line.1111"></a>
+<FONT color="green">1112</FONT>        }<a name="line.1112"></a>
+<FONT color="green">1113</FONT>    <a name="line.1113"></a>
+<FONT color="green">1114</FONT>        /**<a name="line.1114"></a>
+<FONT color="green">1115</FONT>         * Returns a matrix of (column) solution vectors for linear systems with<a name="line.1115"></a>
+<FONT color="green">1116</FONT>         * coefficient matrix = this and constant vectors = columns of<a name="line.1116"></a>
+<FONT color="green">1117</FONT>         * &lt;code&gt;b&lt;/code&gt;.<a name="line.1117"></a>
+<FONT color="green">1118</FONT>         *<a name="line.1118"></a>
+<FONT color="green">1119</FONT>         * @param b  array of constants forming RHS of linear systems to<a name="line.1119"></a>
+<FONT color="green">1120</FONT>         * to solve<a name="line.1120"></a>
+<FONT color="green">1121</FONT>         * @return solution array<a name="line.1121"></a>
+<FONT color="green">1122</FONT>         * @throws IllegalArgumentException if this.rowDimension != row dimension<a name="line.1122"></a>
+<FONT color="green">1123</FONT>         * @throws InvalidMatrixException if this matrix is not square or is singular<a name="line.1123"></a>
+<FONT color="green">1124</FONT>         */<a name="line.1124"></a>
+<FONT color="green">1125</FONT>        public BigDecimal[] solve(double[] b) throws IllegalArgumentException, InvalidMatrixException {<a name="line.1125"></a>
+<FONT color="green">1126</FONT>            final BigDecimal bd[] = new BigDecimal[b.length];<a name="line.1126"></a>
+<FONT color="green">1127</FONT>            for (int i = 0; i &lt; bd.length; i++) {<a name="line.1127"></a>
+<FONT color="green">1128</FONT>                bd[i] = new BigDecimal(b[i]);<a name="line.1128"></a>
+<FONT color="green">1129</FONT>            }<a name="line.1129"></a>
+<FONT color="green">1130</FONT>            return solve(bd);<a name="line.1130"></a>
+<FONT color="green">1131</FONT>        }<a name="line.1131"></a>
+<FONT color="green">1132</FONT>    <a name="line.1132"></a>
+<FONT color="green">1133</FONT>        /**<a name="line.1133"></a>
+<FONT color="green">1134</FONT>         * Returns a matrix of (column) solution vectors for linear systems with<a name="line.1134"></a>
+<FONT color="green">1135</FONT>         * coefficient matrix = this and constant vectors = columns of<a name="line.1135"></a>
+<FONT color="green">1136</FONT>         * &lt;code&gt;b&lt;/code&gt;.<a name="line.1136"></a>
+<FONT color="green">1137</FONT>         *<a name="line.1137"></a>
+<FONT color="green">1138</FONT>         * @param b  matrix of constant vectors forming RHS of linear systems to<a name="line.1138"></a>
+<FONT color="green">1139</FONT>         * to solve<a name="line.1139"></a>
+<FONT color="green">1140</FONT>         * @return matrix of solution vectors<a name="line.1140"></a>
+<FONT color="green">1141</FONT>         * @throws IllegalArgumentException if this.rowDimension != row dimension<a name="line.1141"></a>
+<FONT color="green">1142</FONT>         * @throws InvalidMatrixException if this matrix is not square or is singular<a name="line.1142"></a>
+<FONT color="green">1143</FONT>         */<a name="line.1143"></a>
+<FONT color="green">1144</FONT>        public BigMatrix solve(BigMatrix b) throws IllegalArgumentException, InvalidMatrixException  {<a name="line.1144"></a>
+<FONT color="green">1145</FONT>            if (b.getRowDimension() != getRowDimension()) {<a name="line.1145"></a>
+<FONT color="green">1146</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1146"></a>
+<FONT color="green">1147</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.1147"></a>
+<FONT color="green">1148</FONT>                        b.getRowDimension(), b.getColumnDimension(), getRowDimension(), "n");<a name="line.1148"></a>
+<FONT color="green">1149</FONT>            }<a name="line.1149"></a>
+<FONT color="green">1150</FONT>            if (!isSquare()) {<a name="line.1150"></a>
+<FONT color="green">1151</FONT>                throw new NonSquareMatrixException(getRowDimension(), getColumnDimension());<a name="line.1151"></a>
+<FONT color="green">1152</FONT>            }<a name="line.1152"></a>
+<FONT color="green">1153</FONT>            if (this.isSingular()) { // side effect: compute LU decomp<a name="line.1153"></a>
+<FONT color="green">1154</FONT>                throw new SingularMatrixException();<a name="line.1154"></a>
+<FONT color="green">1155</FONT>            }<a name="line.1155"></a>
+<FONT color="green">1156</FONT>    <a name="line.1156"></a>
+<FONT color="green">1157</FONT>            final int nCol = this.getColumnDimension();<a name="line.1157"></a>
+<FONT color="green">1158</FONT>            final int nColB = b.getColumnDimension();<a name="line.1158"></a>
+<FONT color="green">1159</FONT>            final int nRowB = b.getRowDimension();<a name="line.1159"></a>
+<FONT color="green">1160</FONT>    <a name="line.1160"></a>
+<FONT color="green">1161</FONT>            // Apply permutations to b<a name="line.1161"></a>
+<FONT color="green">1162</FONT>            final BigDecimal[][] bp = new BigDecimal[nRowB][nColB];<a name="line.1162"></a>
+<FONT color="green">1163</FONT>            for (int row = 0; row &lt; nRowB; row++) {<a name="line.1163"></a>
+<FONT color="green">1164</FONT>                final BigDecimal[] bpRow = bp[row];<a name="line.1164"></a>
+<FONT color="green">1165</FONT>                for (int col = 0; col &lt; nColB; col++) {<a name="line.1165"></a>
+<FONT color="green">1166</FONT>                    bpRow[col] = b.getEntry(permutation[row], col);<a name="line.1166"></a>
+<FONT color="green">1167</FONT>                }<a name="line.1167"></a>
+<FONT color="green">1168</FONT>            }<a name="line.1168"></a>
+<FONT color="green">1169</FONT>    <a name="line.1169"></a>
+<FONT color="green">1170</FONT>            // Solve LY = b<a name="line.1170"></a>
+<FONT color="green">1171</FONT>            for (int col = 0; col &lt; nCol; col++) {<a name="line.1171"></a>
+<FONT color="green">1172</FONT>                for (int i = col + 1; i &lt; nCol; i++) {<a name="line.1172"></a>
+<FONT color="green">1173</FONT>                    final BigDecimal[] bpI = bp[i];<a name="line.1173"></a>
+<FONT color="green">1174</FONT>                    final BigDecimal[] luI = lu[i];<a name="line.1174"></a>
+<FONT color="green">1175</FONT>                    for (int j = 0; j &lt; nColB; j++) {<a name="line.1175"></a>
+<FONT color="green">1176</FONT>                        bpI[j] = bpI[j].subtract(bp[col][j].multiply(luI[col]));<a name="line.1176"></a>
+<FONT color="green">1177</FONT>                    }<a name="line.1177"></a>
+<FONT color="green">1178</FONT>                }<a name="line.1178"></a>
+<FONT color="green">1179</FONT>            }<a name="line.1179"></a>
+<FONT color="green">1180</FONT>    <a name="line.1180"></a>
+<FONT color="green">1181</FONT>            // Solve UX = Y<a name="line.1181"></a>
+<FONT color="green">1182</FONT>            for (int col = nCol - 1; col &gt;= 0; col--) {<a name="line.1182"></a>
+<FONT color="green">1183</FONT>                final BigDecimal[] bpCol = bp[col];<a name="line.1183"></a>
+<FONT color="green">1184</FONT>                final BigDecimal luDiag = lu[col][col];<a name="line.1184"></a>
+<FONT color="green">1185</FONT>                for (int j = 0; j &lt; nColB; j++) {<a name="line.1185"></a>
+<FONT color="green">1186</FONT>                    bpCol[j] = bpCol[j].divide(luDiag, scale, roundingMode);<a name="line.1186"></a>
+<FONT color="green">1187</FONT>                }<a name="line.1187"></a>
+<FONT color="green">1188</FONT>                for (int i = 0; i &lt; col; i++) {<a name="line.1188"></a>
+<FONT color="green">1189</FONT>                    final BigDecimal[] bpI = bp[i];<a name="line.1189"></a>
+<FONT color="green">1190</FONT>                    final BigDecimal[] luI = lu[i];<a name="line.1190"></a>
+<FONT color="green">1191</FONT>                    for (int j = 0; j &lt; nColB; j++) {<a name="line.1191"></a>
+<FONT color="green">1192</FONT>                        bpI[j] = bpI[j].subtract(bp[col][j].multiply(luI[col]));<a name="line.1192"></a>
+<FONT color="green">1193</FONT>                    }<a name="line.1193"></a>
+<FONT color="green">1194</FONT>                }<a name="line.1194"></a>
+<FONT color="green">1195</FONT>            }<a name="line.1195"></a>
+<FONT color="green">1196</FONT>    <a name="line.1196"></a>
+<FONT color="green">1197</FONT>            return new BigMatrixImpl(bp, false);<a name="line.1197"></a>
+<FONT color="green">1198</FONT>    <a name="line.1198"></a>
+<FONT color="green">1199</FONT>        }<a name="line.1199"></a>
+<FONT color="green">1200</FONT>    <a name="line.1200"></a>
+<FONT color="green">1201</FONT>        /**<a name="line.1201"></a>
+<FONT color="green">1202</FONT>         * Computes a new<a name="line.1202"></a>
+<FONT color="green">1203</FONT>         * &lt;a href="http://www.math.gatech.edu/~bourbaki/math2601/Web-notes/2num.pdf"&gt;<a name="line.1203"></a>
+<FONT color="green">1204</FONT>         * LU decompostion&lt;/a&gt; for this matrix, storing the result for use by other methods.<a name="line.1204"></a>
+<FONT color="green">1205</FONT>         * &lt;p&gt;<a name="line.1205"></a>
+<FONT color="green">1206</FONT>         * &lt;strong&gt;Implementation Note&lt;/strong&gt;:&lt;br&gt;<a name="line.1206"></a>
+<FONT color="green">1207</FONT>         * Uses &lt;a href="http://www.damtp.cam.ac.uk/user/fdl/people/sd/lectures/nummeth98/linear.htm"&gt;<a name="line.1207"></a>
+<FONT color="green">1208</FONT>         * Crout's algortithm&lt;/a&gt;, with partial pivoting.&lt;/p&gt;<a name="line.1208"></a>
+<FONT color="green">1209</FONT>         * &lt;p&gt;<a name="line.1209"></a>
+<FONT color="green">1210</FONT>         * &lt;strong&gt;Usage Note&lt;/strong&gt;:&lt;br&gt;<a name="line.1210"></a>
+<FONT color="green">1211</FONT>         * This method should rarely be invoked directly. Its only use is<a name="line.1211"></a>
+<FONT color="green">1212</FONT>         * to force recomputation of the LU decomposition when changes have been<a name="line.1212"></a>
+<FONT color="green">1213</FONT>         * made to the underlying data using direct array references. Changes<a name="line.1213"></a>
+<FONT color="green">1214</FONT>         * made using setXxx methods will trigger recomputation when needed<a name="line.1214"></a>
+<FONT color="green">1215</FONT>         * automatically.&lt;/p&gt;<a name="line.1215"></a>
+<FONT color="green">1216</FONT>         *<a name="line.1216"></a>
+<FONT color="green">1217</FONT>         * @throws InvalidMatrixException if the matrix is non-square or singular.<a name="line.1217"></a>
+<FONT color="green">1218</FONT>         */<a name="line.1218"></a>
+<FONT color="green">1219</FONT>        public void luDecompose() throws InvalidMatrixException {<a name="line.1219"></a>
+<FONT color="green">1220</FONT>    <a name="line.1220"></a>
+<FONT color="green">1221</FONT>            final int nRows = this.getRowDimension();<a name="line.1221"></a>
+<FONT color="green">1222</FONT>            final int nCols = this.getColumnDimension();<a name="line.1222"></a>
+<FONT color="green">1223</FONT>            if (nRows != nCols) {<a name="line.1223"></a>
+<FONT color="green">1224</FONT>                throw new NonSquareMatrixException(getRowDimension(), getColumnDimension());<a name="line.1224"></a>
+<FONT color="green">1225</FONT>            }<a name="line.1225"></a>
+<FONT color="green">1226</FONT>            lu = this.getData();<a name="line.1226"></a>
+<FONT color="green">1227</FONT>    <a name="line.1227"></a>
+<FONT color="green">1228</FONT>            // Initialize permutation array and parity<a name="line.1228"></a>
+<FONT color="green">1229</FONT>            permutation = new int[nRows];<a name="line.1229"></a>
+<FONT color="green">1230</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.1230"></a>
+<FONT color="green">1231</FONT>                permutation[row] = row;<a name="line.1231"></a>
+<FONT color="green">1232</FONT>            }<a name="line.1232"></a>
+<FONT color="green">1233</FONT>            parity = 1;<a name="line.1233"></a>
+<FONT color="green">1234</FONT>    <a name="line.1234"></a>
+<FONT color="green">1235</FONT>            // Loop over columns<a name="line.1235"></a>
+<FONT color="green">1236</FONT>            for (int col = 0; col &lt; nCols; col++) {<a name="line.1236"></a>
+<FONT color="green">1237</FONT>    <a name="line.1237"></a>
+<FONT color="green">1238</FONT>                BigDecimal sum = ZERO;<a name="line.1238"></a>
+<FONT color="green">1239</FONT>    <a name="line.1239"></a>
+<FONT color="green">1240</FONT>                // upper<a name="line.1240"></a>
+<FONT color="green">1241</FONT>                for (int row = 0; row &lt; col; row++) {<a name="line.1241"></a>
+<FONT color="green">1242</FONT>                    final BigDecimal[] luRow = lu[row];<a name="line.1242"></a>
+<FONT color="green">1243</FONT>                    sum = luRow[col];<a name="line.1243"></a>
+<FONT color="green">1244</FONT>                    for (int i = 0; i &lt; row; i++) {<a name="line.1244"></a>
+<FONT color="green">1245</FONT>                        sum = sum.subtract(luRow[i].multiply(lu[i][col]));<a name="line.1245"></a>
+<FONT color="green">1246</FONT>                    }<a name="line.1246"></a>
+<FONT color="green">1247</FONT>                    luRow[col] = sum;<a name="line.1247"></a>
+<FONT color="green">1248</FONT>                }<a name="line.1248"></a>
+<FONT color="green">1249</FONT>    <a name="line.1249"></a>
+<FONT color="green">1250</FONT>                // lower<a name="line.1250"></a>
+<FONT color="green">1251</FONT>                int max = col; // permutation row<a name="line.1251"></a>
+<FONT color="green">1252</FONT>                BigDecimal largest = ZERO;<a name="line.1252"></a>
+<FONT color="green">1253</FONT>                for (int row = col; row &lt; nRows; row++) {<a name="line.1253"></a>
+<FONT color="green">1254</FONT>                    final BigDecimal[] luRow = lu[row];<a name="line.1254"></a>
+<FONT color="green">1255</FONT>                    sum = luRow[col];<a name="line.1255"></a>
+<FONT color="green">1256</FONT>                    for (int i = 0; i &lt; col; i++) {<a name="line.1256"></a>
+<FONT color="green">1257</FONT>                        sum = sum.subtract(luRow[i].multiply(lu[i][col]));<a name="line.1257"></a>
+<FONT color="green">1258</FONT>                    }<a name="line.1258"></a>
+<FONT color="green">1259</FONT>                    luRow[col] = sum;<a name="line.1259"></a>
+<FONT color="green">1260</FONT>    <a name="line.1260"></a>
+<FONT color="green">1261</FONT>                    // maintain best permutation choice<a name="line.1261"></a>
+<FONT color="green">1262</FONT>                    if (sum.abs().compareTo(largest) == 1) {<a name="line.1262"></a>
+<FONT color="green">1263</FONT>                        largest = sum.abs();<a name="line.1263"></a>
+<FONT color="green">1264</FONT>                        max = row;<a name="line.1264"></a>
+<FONT color="green">1265</FONT>                    }<a name="line.1265"></a>
+<FONT color="green">1266</FONT>                }<a name="line.1266"></a>
+<FONT color="green">1267</FONT>    <a name="line.1267"></a>
+<FONT color="green">1268</FONT>                // Singularity check<a name="line.1268"></a>
+<FONT color="green">1269</FONT>                if (lu[max][col].abs().compareTo(TOO_SMALL) &lt;= 0) {<a name="line.1269"></a>
+<FONT color="green">1270</FONT>                    lu = null;<a name="line.1270"></a>
+<FONT color="green">1271</FONT>                    throw new SingularMatrixException();<a name="line.1271"></a>
+<FONT color="green">1272</FONT>                }<a name="line.1272"></a>
+<FONT color="green">1273</FONT>    <a name="line.1273"></a>
+<FONT color="green">1274</FONT>                // Pivot if necessary<a name="line.1274"></a>
+<FONT color="green">1275</FONT>                if (max != col) {<a name="line.1275"></a>
+<FONT color="green">1276</FONT>                    BigDecimal tmp = ZERO;<a name="line.1276"></a>
+<FONT color="green">1277</FONT>                    for (int i = 0; i &lt; nCols; i++) {<a name="line.1277"></a>
+<FONT color="green">1278</FONT>                        tmp = lu[max][i];<a name="line.1278"></a>
+<FONT color="green">1279</FONT>                        lu[max][i] = lu[col][i];<a name="line.1279"></a>
+<FONT color="green">1280</FONT>                        lu[col][i] = tmp;<a name="line.1280"></a>
+<FONT color="green">1281</FONT>                    }<a name="line.1281"></a>
+<FONT color="green">1282</FONT>                    int temp = permutation[max];<a name="line.1282"></a>
+<FONT color="green">1283</FONT>                    permutation[max] = permutation[col];<a name="line.1283"></a>
+<FONT color="green">1284</FONT>                    permutation[col] = temp;<a name="line.1284"></a>
+<FONT color="green">1285</FONT>                    parity = -parity;<a name="line.1285"></a>
+<FONT color="green">1286</FONT>                }<a name="line.1286"></a>
+<FONT color="green">1287</FONT>    <a name="line.1287"></a>
+<FONT color="green">1288</FONT>                // Divide the lower elements by the "winning" diagonal elt.<a name="line.1288"></a>
+<FONT color="green">1289</FONT>                final BigDecimal luDiag = lu[col][col];<a name="line.1289"></a>
+<FONT color="green">1290</FONT>                for (int row = col + 1; row &lt; nRows; row++) {<a name="line.1290"></a>
+<FONT color="green">1291</FONT>                    final BigDecimal[] luRow = lu[row];<a name="line.1291"></a>
+<FONT color="green">1292</FONT>                    luRow[col] = luRow[col].divide(luDiag, scale, roundingMode);<a name="line.1292"></a>
+<FONT color="green">1293</FONT>                }<a name="line.1293"></a>
+<FONT color="green">1294</FONT>    <a name="line.1294"></a>
+<FONT color="green">1295</FONT>            }<a name="line.1295"></a>
+<FONT color="green">1296</FONT>    <a name="line.1296"></a>
+<FONT color="green">1297</FONT>        }<a name="line.1297"></a>
+<FONT color="green">1298</FONT>    <a name="line.1298"></a>
+<FONT color="green">1299</FONT>        /**<a name="line.1299"></a>
+<FONT color="green">1300</FONT>         * Get a string representation for this matrix.<a name="line.1300"></a>
+<FONT color="green">1301</FONT>         * @return a string representation for this matrix<a name="line.1301"></a>
+<FONT color="green">1302</FONT>         */<a name="line.1302"></a>
+<FONT color="green">1303</FONT>        @Override<a name="line.1303"></a>
+<FONT color="green">1304</FONT>        public String toString() {<a name="line.1304"></a>
+<FONT color="green">1305</FONT>            StringBuffer res = new StringBuffer();<a name="line.1305"></a>
+<FONT color="green">1306</FONT>            res.append("BigMatrixImpl{");<a name="line.1306"></a>
+<FONT color="green">1307</FONT>            if (data != null) {<a name="line.1307"></a>
+<FONT color="green">1308</FONT>                for (int i = 0; i &lt; data.length; i++) {<a name="line.1308"></a>
+<FONT color="green">1309</FONT>                    if (i &gt; 0) {<a name="line.1309"></a>
+<FONT color="green">1310</FONT>                        res.append(",");<a name="line.1310"></a>
+<FONT color="green">1311</FONT>                    }<a name="line.1311"></a>
+<FONT color="green">1312</FONT>                    res.append("{");<a name="line.1312"></a>
+<FONT color="green">1313</FONT>                    for (int j = 0; j &lt; data[0].length; j++) {<a name="line.1313"></a>
+<FONT color="green">1314</FONT>                        if (j &gt; 0) {<a name="line.1314"></a>
+<FONT color="green">1315</FONT>                            res.append(",");<a name="line.1315"></a>
+<FONT color="green">1316</FONT>                        }<a name="line.1316"></a>
+<FONT color="green">1317</FONT>                        res.append(data[i][j]);<a name="line.1317"></a>
+<FONT color="green">1318</FONT>                    }<a name="line.1318"></a>
+<FONT color="green">1319</FONT>                    res.append("}");<a name="line.1319"></a>
+<FONT color="green">1320</FONT>                }<a name="line.1320"></a>
+<FONT color="green">1321</FONT>            }<a name="line.1321"></a>
+<FONT color="green">1322</FONT>            res.append("}");<a name="line.1322"></a>
+<FONT color="green">1323</FONT>            return res.toString();<a name="line.1323"></a>
+<FONT color="green">1324</FONT>        }<a name="line.1324"></a>
+<FONT color="green">1325</FONT>    <a name="line.1325"></a>
+<FONT color="green">1326</FONT>        /**<a name="line.1326"></a>
+<FONT color="green">1327</FONT>         * Returns true iff &lt;code&gt;object&lt;/code&gt; is a<a name="line.1327"></a>
+<FONT color="green">1328</FONT>         * &lt;code&gt;BigMatrixImpl&lt;/code&gt; instance with the same dimensions as this<a name="line.1328"></a>
+<FONT color="green">1329</FONT>         * and all corresponding matrix entries are equal.  BigDecimal.equals<a name="line.1329"></a>
+<FONT color="green">1330</FONT>         * is used to compare corresponding entries.<a name="line.1330"></a>
+<FONT color="green">1331</FONT>         *<a name="line.1331"></a>
+<FONT color="green">1332</FONT>         * @param object the object to test equality against.<a name="line.1332"></a>
+<FONT color="green">1333</FONT>         * @return true if object equals this<a name="line.1333"></a>
+<FONT color="green">1334</FONT>         */<a name="line.1334"></a>
+<FONT color="green">1335</FONT>        @Override<a name="line.1335"></a>
+<FONT color="green">1336</FONT>        public boolean equals(Object object) {<a name="line.1336"></a>
+<FONT color="green">1337</FONT>            if (object == this ) {<a name="line.1337"></a>
+<FONT color="green">1338</FONT>                return true;<a name="line.1338"></a>
+<FONT color="green">1339</FONT>            }<a name="line.1339"></a>
+<FONT color="green">1340</FONT>            if (object instanceof BigMatrixImpl == false) {<a name="line.1340"></a>
+<FONT color="green">1341</FONT>                return false;<a name="line.1341"></a>
+<FONT color="green">1342</FONT>            }<a name="line.1342"></a>
+<FONT color="green">1343</FONT>            final BigMatrix m = (BigMatrix) object;<a name="line.1343"></a>
+<FONT color="green">1344</FONT>            final int nRows = getRowDimension();<a name="line.1344"></a>
+<FONT color="green">1345</FONT>            final int nCols = getColumnDimension();<a name="line.1345"></a>
+<FONT color="green">1346</FONT>            if (m.getColumnDimension() != nCols || m.getRowDimension() != nRows) {<a name="line.1346"></a>
+<FONT color="green">1347</FONT>                return false;<a name="line.1347"></a>
+<FONT color="green">1348</FONT>            }<a name="line.1348"></a>
+<FONT color="green">1349</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.1349"></a>
+<FONT color="green">1350</FONT>                final BigDecimal[] dataRow = data[row];<a name="line.1350"></a>
+<FONT color="green">1351</FONT>                for (int col = 0; col &lt; nCols; col++) {<a name="line.1351"></a>
+<FONT color="green">1352</FONT>                    if (!dataRow[col].equals(m.getEntry(row, col))) {<a name="line.1352"></a>
+<FONT color="green">1353</FONT>                        return false;<a name="line.1353"></a>
+<FONT color="green">1354</FONT>                    }<a name="line.1354"></a>
+<FONT color="green">1355</FONT>                }<a name="line.1355"></a>
+<FONT color="green">1356</FONT>            }<a name="line.1356"></a>
+<FONT color="green">1357</FONT>            return true;<a name="line.1357"></a>
+<FONT color="green">1358</FONT>        }<a name="line.1358"></a>
+<FONT color="green">1359</FONT>    <a name="line.1359"></a>
+<FONT color="green">1360</FONT>        /**<a name="line.1360"></a>
+<FONT color="green">1361</FONT>         * Computes a hashcode for the matrix.<a name="line.1361"></a>
+<FONT color="green">1362</FONT>         *<a name="line.1362"></a>
+<FONT color="green">1363</FONT>         * @return hashcode for matrix<a name="line.1363"></a>
+<FONT color="green">1364</FONT>         */<a name="line.1364"></a>
+<FONT color="green">1365</FONT>        @Override<a name="line.1365"></a>
+<FONT color="green">1366</FONT>        public int hashCode() {<a name="line.1366"></a>
+<FONT color="green">1367</FONT>            int ret = 7;<a name="line.1367"></a>
+<FONT color="green">1368</FONT>            final int nRows = getRowDimension();<a name="line.1368"></a>
+<FONT color="green">1369</FONT>            final int nCols = getColumnDimension();<a name="line.1369"></a>
+<FONT color="green">1370</FONT>            ret = ret * 31 + nRows;<a name="line.1370"></a>
+<FONT color="green">1371</FONT>            ret = ret * 31 + nCols;<a name="line.1371"></a>
+<FONT color="green">1372</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.1372"></a>
+<FONT color="green">1373</FONT>                final BigDecimal[] dataRow = data[row];<a name="line.1373"></a>
+<FONT color="green">1374</FONT>                for (int col = 0; col &lt; nCols; col++) {<a name="line.1374"></a>
+<FONT color="green">1375</FONT>                    ret = ret * 31 + (11 * (row+1) + 17 * (col+1)) *<a name="line.1375"></a>
+<FONT color="green">1376</FONT>                    dataRow[col].hashCode();<a name="line.1376"></a>
+<FONT color="green">1377</FONT>                }<a name="line.1377"></a>
+<FONT color="green">1378</FONT>            }<a name="line.1378"></a>
+<FONT color="green">1379</FONT>            return ret;<a name="line.1379"></a>
+<FONT color="green">1380</FONT>        }<a name="line.1380"></a>
+<FONT color="green">1381</FONT>    <a name="line.1381"></a>
+<FONT color="green">1382</FONT>        //------------------------ Protected methods<a name="line.1382"></a>
+<FONT color="green">1383</FONT>    <a name="line.1383"></a>
+<FONT color="green">1384</FONT>        /**<a name="line.1384"></a>
+<FONT color="green">1385</FONT>         *  Returns the LU decomposition as a BigMatrix.<a name="line.1385"></a>
+<FONT color="green">1386</FONT>         *  Returns a fresh copy of the cached LU matrix if this has been computed;<a name="line.1386"></a>
+<FONT color="green">1387</FONT>         *  otherwise the composition is computed and cached for use by other methods.<a name="line.1387"></a>
+<FONT color="green">1388</FONT>         *  Since a copy is returned in either case, changes to the returned matrix do not<a name="line.1388"></a>
+<FONT color="green">1389</FONT>         *  affect the LU decomposition property.<a name="line.1389"></a>
+<FONT color="green">1390</FONT>         * &lt;p&gt;<a name="line.1390"></a>
+<FONT color="green">1391</FONT>         * The matrix returned is a compact representation of the LU decomposition.<a name="line.1391"></a>
+<FONT color="green">1392</FONT>         * Elements below the main diagonal correspond to entries of the "L" matrix;<a name="line.1392"></a>
+<FONT color="green">1393</FONT>         * elements on and above the main diagonal correspond to entries of the "U"<a name="line.1393"></a>
+<FONT color="green">1394</FONT>         * matrix.&lt;/p&gt;<a name="line.1394"></a>
+<FONT color="green">1395</FONT>         * &lt;p&gt;<a name="line.1395"></a>
+<FONT color="green">1396</FONT>         * Example: &lt;pre&gt;<a name="line.1396"></a>
+<FONT color="green">1397</FONT>         *<a name="line.1397"></a>
+<FONT color="green">1398</FONT>         *     Returned matrix                L                  U<a name="line.1398"></a>
+<FONT color="green">1399</FONT>         *         2  3  1                   1  0  0            2  3  1<a name="line.1399"></a>
+<FONT color="green">1400</FONT>         *         5  4  6                   5  1  0            0  4  6<a name="line.1400"></a>
+<FONT color="green">1401</FONT>         *         1  7  8                   1  7  1            0  0  8<a name="line.1401"></a>
+<FONT color="green">1402</FONT>         * &lt;/pre&gt;<a name="line.1402"></a>
+<FONT color="green">1403</FONT>         *<a name="line.1403"></a>
+<FONT color="green">1404</FONT>         * The L and U matrices satisfy the matrix equation LU = permuteRows(this), &lt;br&gt;<a name="line.1404"></a>
+<FONT color="green">1405</FONT>         *  where permuteRows reorders the rows of the matrix to follow the order determined<a name="line.1405"></a>
+<FONT color="green">1406</FONT>         *  by the &lt;a href=#getPermutation()&gt;permutation&lt;/a&gt; property.&lt;/p&gt;<a name="line.1406"></a>
+<FONT color="green">1407</FONT>         *<a name="line.1407"></a>
+<FONT color="green">1408</FONT>         * @return LU decomposition matrix<a name="line.1408"></a>
+<FONT color="green">1409</FONT>         * @throws InvalidMatrixException if the matrix is non-square or singular.<a name="line.1409"></a>
+<FONT color="green">1410</FONT>         */<a name="line.1410"></a>
+<FONT color="green">1411</FONT>        protected BigMatrix getLUMatrix() throws InvalidMatrixException {<a name="line.1411"></a>
+<FONT color="green">1412</FONT>            if (lu == null) {<a name="line.1412"></a>
+<FONT color="green">1413</FONT>                luDecompose();<a name="line.1413"></a>
+<FONT color="green">1414</FONT>            }<a name="line.1414"></a>
+<FONT color="green">1415</FONT>            return new BigMatrixImpl(lu);<a name="line.1415"></a>
+<FONT color="green">1416</FONT>        }<a name="line.1416"></a>
+<FONT color="green">1417</FONT>    <a name="line.1417"></a>
+<FONT color="green">1418</FONT>        /**<a name="line.1418"></a>
+<FONT color="green">1419</FONT>         * Returns the permutation associated with the lu decomposition.<a name="line.1419"></a>
+<FONT color="green">1420</FONT>         * The entries of the array represent a permutation of the numbers 0, ... , nRows - 1.<a name="line.1420"></a>
+<FONT color="green">1421</FONT>         * &lt;p&gt;<a name="line.1421"></a>
+<FONT color="green">1422</FONT>         * Example:<a name="line.1422"></a>
+<FONT color="green">1423</FONT>         * permutation = [1, 2, 0] means current 2nd row is first, current third row is second<a name="line.1423"></a>
+<FONT color="green">1424</FONT>         * and current first row is last.&lt;/p&gt;<a name="line.1424"></a>
+<FONT color="green">1425</FONT>         * &lt;p&gt;<a name="line.1425"></a>
+<FONT color="green">1426</FONT>         * Returns a fresh copy of the array.&lt;/p&gt;<a name="line.1426"></a>
+<FONT color="green">1427</FONT>         *<a name="line.1427"></a>
+<FONT color="green">1428</FONT>         * @return the permutation<a name="line.1428"></a>
+<FONT color="green">1429</FONT>         */<a name="line.1429"></a>
+<FONT color="green">1430</FONT>        protected int[] getPermutation() {<a name="line.1430"></a>
+<FONT color="green">1431</FONT>            final int[] out = new int[permutation.length];<a name="line.1431"></a>
+<FONT color="green">1432</FONT>            System.arraycopy(permutation, 0, out, 0, permutation.length);<a name="line.1432"></a>
+<FONT color="green">1433</FONT>            return out;<a name="line.1433"></a>
+<FONT color="green">1434</FONT>        }<a name="line.1434"></a>
+<FONT color="green">1435</FONT>    <a name="line.1435"></a>
+<FONT color="green">1436</FONT>        //------------------------ Private methods<a name="line.1436"></a>
+<FONT color="green">1437</FONT>    <a name="line.1437"></a>
+<FONT color="green">1438</FONT>        /**<a name="line.1438"></a>
+<FONT color="green">1439</FONT>         * Returns a fresh copy of the underlying data array.<a name="line.1439"></a>
+<FONT color="green">1440</FONT>         *<a name="line.1440"></a>
+<FONT color="green">1441</FONT>         * @return a copy of the underlying data array.<a name="line.1441"></a>
+<FONT color="green">1442</FONT>         */<a name="line.1442"></a>
+<FONT color="green">1443</FONT>        private BigDecimal[][] copyOut() {<a name="line.1443"></a>
+<FONT color="green">1444</FONT>            final int nRows = this.getRowDimension();<a name="line.1444"></a>
+<FONT color="green">1445</FONT>            final BigDecimal[][] out = new BigDecimal[nRows][this.getColumnDimension()];<a name="line.1445"></a>
+<FONT color="green">1446</FONT>            // can't copy 2-d array in one shot, otherwise get row references<a name="line.1446"></a>
+<FONT color="green">1447</FONT>            for (int i = 0; i &lt; nRows; i++) {<a name="line.1447"></a>
+<FONT color="green">1448</FONT>                System.arraycopy(data[i], 0, out[i], 0, data[i].length);<a name="line.1448"></a>
+<FONT color="green">1449</FONT>            }<a name="line.1449"></a>
+<FONT color="green">1450</FONT>            return out;<a name="line.1450"></a>
+<FONT color="green">1451</FONT>        }<a name="line.1451"></a>
+<FONT color="green">1452</FONT>    <a name="line.1452"></a>
+<FONT color="green">1453</FONT>        /**<a name="line.1453"></a>
+<FONT color="green">1454</FONT>         * Replaces data with a fresh copy of the input array.<a name="line.1454"></a>
+<FONT color="green">1455</FONT>         * &lt;p&gt;<a name="line.1455"></a>
+<FONT color="green">1456</FONT>         * Verifies that the input array is rectangular and non-empty.&lt;/p&gt;<a name="line.1456"></a>
+<FONT color="green">1457</FONT>         *<a name="line.1457"></a>
+<FONT color="green">1458</FONT>         * @param in data to copy in<a name="line.1458"></a>
+<FONT color="green">1459</FONT>         * @throws IllegalArgumentException if input array is emtpy or not<a name="line.1459"></a>
+<FONT color="green">1460</FONT>         *    rectangular<a name="line.1460"></a>
+<FONT color="green">1461</FONT>         * @throws NullPointerException if input array is null<a name="line.1461"></a>
+<FONT color="green">1462</FONT>         */<a name="line.1462"></a>
+<FONT color="green">1463</FONT>        private void copyIn(BigDecimal[][] in) {<a name="line.1463"></a>
+<FONT color="green">1464</FONT>            setSubMatrix(in,0,0);<a name="line.1464"></a>
+<FONT color="green">1465</FONT>        }<a name="line.1465"></a>
+<FONT color="green">1466</FONT>    <a name="line.1466"></a>
+<FONT color="green">1467</FONT>        /**<a name="line.1467"></a>
+<FONT color="green">1468</FONT>         * Replaces data with a fresh copy of the input array.<a name="line.1468"></a>
+<FONT color="green">1469</FONT>         *<a name="line.1469"></a>
+<FONT color="green">1470</FONT>         * @param in data to copy in<a name="line.1470"></a>
+<FONT color="green">1471</FONT>         */<a name="line.1471"></a>
+<FONT color="green">1472</FONT>        private void copyIn(double[][] in) {<a name="line.1472"></a>
+<FONT color="green">1473</FONT>            final int nRows = in.length;<a name="line.1473"></a>
+<FONT color="green">1474</FONT>            final int nCols = in[0].length;<a name="line.1474"></a>
+<FONT color="green">1475</FONT>            data = new BigDecimal[nRows][nCols];<a name="line.1475"></a>
+<FONT color="green">1476</FONT>            for (int i = 0; i &lt; nRows; i++) {<a name="line.1476"></a>
+<FONT color="green">1477</FONT>                final BigDecimal[] dataI = data[i];<a name="line.1477"></a>
+<FONT color="green">1478</FONT>                final double[] inI = in[i];<a name="line.1478"></a>
+<FONT color="green">1479</FONT>                for (int j = 0; j &lt; nCols; j++) {<a name="line.1479"></a>
+<FONT color="green">1480</FONT>                    dataI[j] = new BigDecimal(inI[j]);<a name="line.1480"></a>
+<FONT color="green">1481</FONT>                }<a name="line.1481"></a>
+<FONT color="green">1482</FONT>            }<a name="line.1482"></a>
+<FONT color="green">1483</FONT>            lu = null;<a name="line.1483"></a>
+<FONT color="green">1484</FONT>        }<a name="line.1484"></a>
+<FONT color="green">1485</FONT>    <a name="line.1485"></a>
+<FONT color="green">1486</FONT>        /**<a name="line.1486"></a>
+<FONT color="green">1487</FONT>         * Replaces data with BigDecimals represented by the strings in the input<a name="line.1487"></a>
+<FONT color="green">1488</FONT>         * array.<a name="line.1488"></a>
+<FONT color="green">1489</FONT>         *<a name="line.1489"></a>
+<FONT color="green">1490</FONT>         * @param in data to copy in<a name="line.1490"></a>
+<FONT color="green">1491</FONT>         */<a name="line.1491"></a>
+<FONT color="green">1492</FONT>        private void copyIn(String[][] in) {<a name="line.1492"></a>
+<FONT color="green">1493</FONT>            final int nRows = in.length;<a name="line.1493"></a>
+<FONT color="green">1494</FONT>            final int nCols = in[0].length;<a name="line.1494"></a>
+<FONT color="green">1495</FONT>            data = new BigDecimal[nRows][nCols];<a name="line.1495"></a>
+<FONT color="green">1496</FONT>            for (int i = 0; i &lt; nRows; i++) {<a name="line.1496"></a>
+<FONT color="green">1497</FONT>                final BigDecimal[] dataI = data[i];<a name="line.1497"></a>
+<FONT color="green">1498</FONT>                final String[] inI = in[i];<a name="line.1498"></a>
+<FONT color="green">1499</FONT>                for (int j = 0; j &lt; nCols; j++) {<a name="line.1499"></a>
+<FONT color="green">1500</FONT>                    dataI[j] = new BigDecimal(inI[j]);<a name="line.1500"></a>
+<FONT color="green">1501</FONT>                }<a name="line.1501"></a>
+<FONT color="green">1502</FONT>            }<a name="line.1502"></a>
+<FONT color="green">1503</FONT>            lu = null;<a name="line.1503"></a>
+<FONT color="green">1504</FONT>        }<a name="line.1504"></a>
+<FONT color="green">1505</FONT>    <a name="line.1505"></a>
+<FONT color="green">1506</FONT>    }<a name="line.1506"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/BlockFieldMatrix.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,1733 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.Field;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.FieldElement;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Cache-friendly implementation of FieldMatrix using a flat arrays to store<a name="line.27"></a>
+<FONT color="green">028</FONT>     * square blocks of the matrix.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * This implementation is specially designed to be cache-friendly. Square blocks are<a name="line.30"></a>
+<FONT color="green">031</FONT>     * stored as small arrays and allow efficient traversal of data both in row major direction<a name="line.31"></a>
+<FONT color="green">032</FONT>     * and columns major direction, one block at a time. This greatly increases performances<a name="line.32"></a>
+<FONT color="green">033</FONT>     * for algorithms that use crossed directions loops like multiplication or transposition.<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;/p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * The size of square blocks is a static parameter. It may be tuned according to the cache<a name="line.36"></a>
+<FONT color="green">037</FONT>     * size of the target computer processor. As a rule of thumbs, it should be the largest<a name="line.37"></a>
+<FONT color="green">038</FONT>     * value that allows three blocks to be simultaneously cached (this is necessary for example<a name="line.38"></a>
+<FONT color="green">039</FONT>     * for matrix multiplication). The default value is to use 36x36 blocks.<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;/p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;p&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * The regular blocks represent {@link #BLOCK_SIZE} x {@link #BLOCK_SIZE} squares. Blocks<a name="line.42"></a>
+<FONT color="green">043</FONT>     * at right hand side and bottom side which may be smaller to fit matrix dimensions. The square<a name="line.43"></a>
+<FONT color="green">044</FONT>     * blocks are flattened in row major order in single dimension arrays which are therefore<a name="line.44"></a>
+<FONT color="green">045</FONT>     * {@link #BLOCK_SIZE}&lt;sup&gt;2&lt;/sup&gt; elements long for regular blocks. The blocks are themselves<a name="line.45"></a>
+<FONT color="green">046</FONT>     * organized in row major order.<a name="line.46"></a>
+<FONT color="green">047</FONT>     * &lt;/p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     * &lt;p&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>     * As an example, for a block size of 36x36, a 100x60 matrix would be stored in 6 blocks.<a name="line.49"></a>
+<FONT color="green">050</FONT>     * Block 0 would be a Field[1296] array holding the upper left 36x36 square, block 1 would be<a name="line.50"></a>
+<FONT color="green">051</FONT>     * a Field[1296] array holding the upper center 36x36 square, block 2 would be a Field[1008]<a name="line.51"></a>
+<FONT color="green">052</FONT>     * array holding the upper right 36x28 rectangle, block 3 would be a Field[864] array holding<a name="line.52"></a>
+<FONT color="green">053</FONT>     * the lower left 24x36 rectangle, block 4 would be a Field[864] array holding the lower center<a name="line.53"></a>
+<FONT color="green">054</FONT>     * 24x36 rectangle and block 5 would be a Field[672] array holding the lower right 24x28<a name="line.54"></a>
+<FONT color="green">055</FONT>     * rectangle.<a name="line.55"></a>
+<FONT color="green">056</FONT>     * &lt;/p&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>     * &lt;p&gt;<a name="line.57"></a>
+<FONT color="green">058</FONT>     * The layout complexity overhead versus simple mapping of matrices to java<a name="line.58"></a>
+<FONT color="green">059</FONT>     * arrays is negligible for small matrices (about 1%). The gain from cache efficiency leads<a name="line.59"></a>
+<FONT color="green">060</FONT>     * to up to 3-fold improvements for matrices of moderate to large size.<a name="line.60"></a>
+<FONT color="green">061</FONT>     * &lt;/p&gt;<a name="line.61"></a>
+<FONT color="green">062</FONT>     * @param &lt;T&gt; the type of the field elements<a name="line.62"></a>
+<FONT color="green">063</FONT>     * @version $Revision: 825919 $ $Date: 2009-10-16 10:51:55 -0400 (Fri, 16 Oct 2009) $<a name="line.63"></a>
+<FONT color="green">064</FONT>     * @since 2.0<a name="line.64"></a>
+<FONT color="green">065</FONT>     */<a name="line.65"></a>
+<FONT color="green">066</FONT>    public class BlockFieldMatrix&lt;T extends FieldElement&lt;T&gt;&gt; extends AbstractFieldMatrix&lt;T&gt; implements Serializable {<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /** Block size. */<a name="line.68"></a>
+<FONT color="green">069</FONT>        public static final int BLOCK_SIZE = 36;<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** Serializable version identifier */<a name="line.71"></a>
+<FONT color="green">072</FONT>        private static final long serialVersionUID = -4602336630143123183L;<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /** Blocks of matrix entries. */<a name="line.74"></a>
+<FONT color="green">075</FONT>        private final T blocks[][];<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** Number of rows of the matrix. */<a name="line.77"></a>
+<FONT color="green">078</FONT>        private final int rows;<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /** Number of columns of the matrix. */<a name="line.80"></a>
+<FONT color="green">081</FONT>        private final int columns;<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /** Number of block rows of the matrix. */<a name="line.83"></a>
+<FONT color="green">084</FONT>        private final int blockRows;<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /** Number of block columns of the matrix. */<a name="line.86"></a>
+<FONT color="green">087</FONT>        private final int blockColumns;<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /**<a name="line.89"></a>
+<FONT color="green">090</FONT>         * Create a new matrix with the supplied row and column dimensions.<a name="line.90"></a>
+<FONT color="green">091</FONT>         *<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @param field field to which the elements belong<a name="line.92"></a>
+<FONT color="green">093</FONT>         * @param rows  the number of rows in the new matrix<a name="line.93"></a>
+<FONT color="green">094</FONT>         * @param columns  the number of columns in the new matrix<a name="line.94"></a>
+<FONT color="green">095</FONT>         * @throws IllegalArgumentException if row or column dimension is not<a name="line.95"></a>
+<FONT color="green">096</FONT>         *  positive<a name="line.96"></a>
+<FONT color="green">097</FONT>         */<a name="line.97"></a>
+<FONT color="green">098</FONT>        public BlockFieldMatrix(final Field&lt;T&gt; field, final int rows, final int columns)<a name="line.98"></a>
+<FONT color="green">099</FONT>            throws IllegalArgumentException {<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>            super(field, rows, columns);<a name="line.101"></a>
+<FONT color="green">102</FONT>            this.rows    = rows;<a name="line.102"></a>
+<FONT color="green">103</FONT>            this.columns = columns;<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>            // number of blocks<a name="line.105"></a>
+<FONT color="green">106</FONT>            blockRows    = (rows    + BLOCK_SIZE - 1) / BLOCK_SIZE;<a name="line.106"></a>
+<FONT color="green">107</FONT>            blockColumns = (columns + BLOCK_SIZE - 1) / BLOCK_SIZE;<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>            // allocate storage blocks, taking care of smaller ones at right and bottom<a name="line.109"></a>
+<FONT color="green">110</FONT>            blocks = createBlocksLayout(field, rows, columns);<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>        }<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /**<a name="line.114"></a>
+<FONT color="green">115</FONT>         * Create a new dense matrix copying entries from raw layout data.<a name="line.115"></a>
+<FONT color="green">116</FONT>         * &lt;p&gt;The input array &lt;em&gt;must&lt;/em&gt; already be in raw layout.&lt;/p&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * &lt;p&gt;Calling this constructor is equivalent to call:<a name="line.117"></a>
+<FONT color="green">118</FONT>         * &lt;pre&gt;matrix = new BlockFieldMatrix&lt;T&gt;(getField(), rawData.length, rawData[0].length,<a name="line.118"></a>
+<FONT color="green">119</FONT>         *                                   toBlocksLayout(rawData), false);&lt;/pre&gt;<a name="line.119"></a>
+<FONT color="green">120</FONT>         * &lt;/p&gt;<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @param rawData data for new matrix, in raw layout<a name="line.121"></a>
+<FONT color="green">122</FONT>         *<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @exception IllegalArgumentException if &lt;code&gt;blockData&lt;/code&gt; shape is<a name="line.123"></a>
+<FONT color="green">124</FONT>         * inconsistent with block layout<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @see #BlockFieldMatrix(int, int, FieldElement[][], boolean)<a name="line.125"></a>
+<FONT color="green">126</FONT>         */<a name="line.126"></a>
+<FONT color="green">127</FONT>        public BlockFieldMatrix(final T[][] rawData)<a name="line.127"></a>
+<FONT color="green">128</FONT>            throws IllegalArgumentException {<a name="line.128"></a>
+<FONT color="green">129</FONT>            this(rawData.length, rawData[0].length, toBlocksLayout(rawData), false);<a name="line.129"></a>
+<FONT color="green">130</FONT>        }<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>        /**<a name="line.132"></a>
+<FONT color="green">133</FONT>         * Create a new dense matrix copying entries from block layout data.<a name="line.133"></a>
+<FONT color="green">134</FONT>         * &lt;p&gt;The input array &lt;em&gt;must&lt;/em&gt; already be in blocks layout.&lt;/p&gt;<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @param rows  the number of rows in the new matrix<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @param columns  the number of columns in the new matrix<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @param blockData data for new matrix<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @param copyArray if true, the input array will be copied, otherwise<a name="line.138"></a>
+<FONT color="green">139</FONT>         * it will be referenced<a name="line.139"></a>
+<FONT color="green">140</FONT>         *<a name="line.140"></a>
+<FONT color="green">141</FONT>         * @exception IllegalArgumentException if &lt;code&gt;blockData&lt;/code&gt; shape is<a name="line.141"></a>
+<FONT color="green">142</FONT>         * inconsistent with block layout<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @see #createBlocksLayout(Field, int, int)<a name="line.143"></a>
+<FONT color="green">144</FONT>         * @see #toBlocksLayout(FieldElement[][])<a name="line.144"></a>
+<FONT color="green">145</FONT>         * @see #BlockFieldMatrix(FieldElement[][])<a name="line.145"></a>
+<FONT color="green">146</FONT>         */<a name="line.146"></a>
+<FONT color="green">147</FONT>        public BlockFieldMatrix(final int rows, final int columns,<a name="line.147"></a>
+<FONT color="green">148</FONT>                                final T[][] blockData, final boolean copyArray)<a name="line.148"></a>
+<FONT color="green">149</FONT>            throws IllegalArgumentException {<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>            super(extractField(blockData), rows, columns);<a name="line.151"></a>
+<FONT color="green">152</FONT>            this.rows    = rows;<a name="line.152"></a>
+<FONT color="green">153</FONT>            this.columns = columns;<a name="line.153"></a>
+<FONT color="green">154</FONT>    <a name="line.154"></a>
+<FONT color="green">155</FONT>            // number of blocks<a name="line.155"></a>
+<FONT color="green">156</FONT>            blockRows    = (rows    + BLOCK_SIZE - 1) / BLOCK_SIZE;<a name="line.156"></a>
+<FONT color="green">157</FONT>            blockColumns = (columns + BLOCK_SIZE - 1) / BLOCK_SIZE;<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>            if (copyArray) {<a name="line.159"></a>
+<FONT color="green">160</FONT>                // allocate storage blocks, taking care of smaller ones at right and bottom<a name="line.160"></a>
+<FONT color="green">161</FONT>                blocks = buildArray(getField(), blockRows * blockColumns, -1);<a name="line.161"></a>
+<FONT color="green">162</FONT>            } else {<a name="line.162"></a>
+<FONT color="green">163</FONT>                // reference existing array<a name="line.163"></a>
+<FONT color="green">164</FONT>                blocks = blockData;<a name="line.164"></a>
+<FONT color="green">165</FONT>            }<a name="line.165"></a>
+<FONT color="green">166</FONT>    <a name="line.166"></a>
+<FONT color="green">167</FONT>            int index = 0;<a name="line.167"></a>
+<FONT color="green">168</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.168"></a>
+<FONT color="green">169</FONT>                final int iHeight = blockHeight(iBlock);<a name="line.169"></a>
+<FONT color="green">170</FONT>                for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock, ++index) {<a name="line.170"></a>
+<FONT color="green">171</FONT>                    if (blockData[index].length != iHeight * blockWidth(jBlock)) {<a name="line.171"></a>
+<FONT color="green">172</FONT>                        throw MathRuntimeException.createIllegalArgumentException(<a name="line.172"></a>
+<FONT color="green">173</FONT>                                "wrong array shape (block length = {0}, expected {1})",<a name="line.173"></a>
+<FONT color="green">174</FONT>                                blockData[index].length, iHeight * blockWidth(jBlock));<a name="line.174"></a>
+<FONT color="green">175</FONT>                    }<a name="line.175"></a>
+<FONT color="green">176</FONT>                    if (copyArray) {<a name="line.176"></a>
+<FONT color="green">177</FONT>                        blocks[index] = blockData[index].clone();<a name="line.177"></a>
+<FONT color="green">178</FONT>                    }<a name="line.178"></a>
+<FONT color="green">179</FONT>                }<a name="line.179"></a>
+<FONT color="green">180</FONT>            }<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>        }<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>        /**<a name="line.184"></a>
+<FONT color="green">185</FONT>         * Convert a data array from raw layout to blocks layout.<a name="line.185"></a>
+<FONT color="green">186</FONT>         * &lt;p&gt;<a name="line.186"></a>
+<FONT color="green">187</FONT>         * Raw layout is the straightforward layout where element at row i and<a name="line.187"></a>
+<FONT color="green">188</FONT>         * column j is in array element &lt;code&gt;rawData[i][j]&lt;/code&gt;. Blocks layout<a name="line.188"></a>
+<FONT color="green">189</FONT>         * is the layout used in {@link BlockFieldMatrix} instances, where the matrix<a name="line.189"></a>
+<FONT color="green">190</FONT>         * is split in square blocks (except at right and bottom side where blocks may<a name="line.190"></a>
+<FONT color="green">191</FONT>         * be rectangular to fit matrix size) and each block is stored in a flattened<a name="line.191"></a>
+<FONT color="green">192</FONT>         * one-dimensional array.<a name="line.192"></a>
+<FONT color="green">193</FONT>         * &lt;/p&gt;<a name="line.193"></a>
+<FONT color="green">194</FONT>         * &lt;p&gt;<a name="line.194"></a>
+<FONT color="green">195</FONT>         * This method creates an array in blocks layout from an input array in raw layout.<a name="line.195"></a>
+<FONT color="green">196</FONT>         * It can be used to provide the array argument of the {@link<a name="line.196"></a>
+<FONT color="green">197</FONT>         * #BlockFieldMatrix(int, int, FieldElement[][], boolean)}<a name="line.197"></a>
+<FONT color="green">198</FONT>         * constructor.<a name="line.198"></a>
+<FONT color="green">199</FONT>         * &lt;/p&gt;<a name="line.199"></a>
+<FONT color="green">200</FONT>         * @param &lt;T&gt; the type of the field elements<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @param rawData data array in raw layout<a name="line.201"></a>
+<FONT color="green">202</FONT>         * @return a new data array containing the same entries but in blocks layout<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @exception IllegalArgumentException if &lt;code&gt;rawData&lt;/code&gt; is not rectangular<a name="line.203"></a>
+<FONT color="green">204</FONT>         *  (not all rows have the same length)<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @see #createBlocksLayout(Field, int, int)<a name="line.205"></a>
+<FONT color="green">206</FONT>         * @see #BlockFieldMatrix(int, int, FieldElement[][], boolean)<a name="line.206"></a>
+<FONT color="green">207</FONT>         */<a name="line.207"></a>
+<FONT color="green">208</FONT>        public static &lt;T extends FieldElement&lt;T&gt;&gt; T[][] toBlocksLayout(final T[][] rawData)<a name="line.208"></a>
+<FONT color="green">209</FONT>            throws IllegalArgumentException {<a name="line.209"></a>
+<FONT color="green">210</FONT>    <a name="line.210"></a>
+<FONT color="green">211</FONT>            final int rows         = rawData.length;<a name="line.211"></a>
+<FONT color="green">212</FONT>            final int columns      = rawData[0].length;<a name="line.212"></a>
+<FONT color="green">213</FONT>            final int blockRows    = (rows    + BLOCK_SIZE - 1) / BLOCK_SIZE;<a name="line.213"></a>
+<FONT color="green">214</FONT>            final int blockColumns = (columns + BLOCK_SIZE - 1) / BLOCK_SIZE;<a name="line.214"></a>
+<FONT color="green">215</FONT>    <a name="line.215"></a>
+<FONT color="green">216</FONT>            // safety checks<a name="line.216"></a>
+<FONT color="green">217</FONT>            for (int i = 0; i &lt; rawData.length; ++i) {<a name="line.217"></a>
+<FONT color="green">218</FONT>                final int length = rawData[i].length;<a name="line.218"></a>
+<FONT color="green">219</FONT>                if (length != columns) {<a name="line.219"></a>
+<FONT color="green">220</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.220"></a>
+<FONT color="green">221</FONT>                            "some rows have length {0} while others have length {1}",<a name="line.221"></a>
+<FONT color="green">222</FONT>                            columns, length);<a name="line.222"></a>
+<FONT color="green">223</FONT>                }<a name="line.223"></a>
+<FONT color="green">224</FONT>            }<a name="line.224"></a>
+<FONT color="green">225</FONT>    <a name="line.225"></a>
+<FONT color="green">226</FONT>            // convert array<a name="line.226"></a>
+<FONT color="green">227</FONT>            final Field&lt;T&gt; field = extractField(rawData);<a name="line.227"></a>
+<FONT color="green">228</FONT>            final T[][] blocks = buildArray(field, blockRows * blockColumns, -1);<a name="line.228"></a>
+<FONT color="green">229</FONT>            int blockIndex = 0;<a name="line.229"></a>
+<FONT color="green">230</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.230"></a>
+<FONT color="green">231</FONT>                final int pStart  = iBlock * BLOCK_SIZE;<a name="line.231"></a>
+<FONT color="green">232</FONT>                final int pEnd    = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.232"></a>
+<FONT color="green">233</FONT>                final int iHeight = pEnd - pStart;<a name="line.233"></a>
+<FONT color="green">234</FONT>                for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.234"></a>
+<FONT color="green">235</FONT>                    final int qStart = jBlock * BLOCK_SIZE;<a name="line.235"></a>
+<FONT color="green">236</FONT>                    final int qEnd   = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.236"></a>
+<FONT color="green">237</FONT>                    final int jWidth = qEnd - qStart;<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>                    // allocate new block<a name="line.239"></a>
+<FONT color="green">240</FONT>                    final T[] block = buildArray(field, iHeight * jWidth);<a name="line.240"></a>
+<FONT color="green">241</FONT>                    blocks[blockIndex] = block;<a name="line.241"></a>
+<FONT color="green">242</FONT>    <a name="line.242"></a>
+<FONT color="green">243</FONT>                    // copy data<a name="line.243"></a>
+<FONT color="green">244</FONT>                    int index = 0;<a name="line.244"></a>
+<FONT color="green">245</FONT>                    for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.245"></a>
+<FONT color="green">246</FONT>                        System.arraycopy(rawData[p], qStart, block, index, jWidth);<a name="line.246"></a>
+<FONT color="green">247</FONT>                        index += jWidth;<a name="line.247"></a>
+<FONT color="green">248</FONT>                    }<a name="line.248"></a>
+<FONT color="green">249</FONT>    <a name="line.249"></a>
+<FONT color="green">250</FONT>                    ++blockIndex;<a name="line.250"></a>
+<FONT color="green">251</FONT>    <a name="line.251"></a>
+<FONT color="green">252</FONT>                }<a name="line.252"></a>
+<FONT color="green">253</FONT>            }<a name="line.253"></a>
+<FONT color="green">254</FONT>    <a name="line.254"></a>
+<FONT color="green">255</FONT>            return blocks;<a name="line.255"></a>
+<FONT color="green">256</FONT>    <a name="line.256"></a>
+<FONT color="green">257</FONT>        }<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>        /**<a name="line.259"></a>
+<FONT color="green">260</FONT>         * Create a data array in blocks layout.<a name="line.260"></a>
+<FONT color="green">261</FONT>         * &lt;p&gt;<a name="line.261"></a>
+<FONT color="green">262</FONT>         * This method can be used to create the array argument of the {@link<a name="line.262"></a>
+<FONT color="green">263</FONT>         * #BlockFieldMatrix(int, int, FieldElement[][], boolean)}<a name="line.263"></a>
+<FONT color="green">264</FONT>         * constructor.<a name="line.264"></a>
+<FONT color="green">265</FONT>         * &lt;/p&gt;<a name="line.265"></a>
+<FONT color="green">266</FONT>         * @param &lt;T&gt; the type of the field elements<a name="line.266"></a>
+<FONT color="green">267</FONT>         * @param field field to which the elements belong<a name="line.267"></a>
+<FONT color="green">268</FONT>         * @param rows  the number of rows in the new matrix<a name="line.268"></a>
+<FONT color="green">269</FONT>         * @param columns  the number of columns in the new matrix<a name="line.269"></a>
+<FONT color="green">270</FONT>         * @return a new data array in blocks layout<a name="line.270"></a>
+<FONT color="green">271</FONT>         * @see #toBlocksLayout(FieldElement[][])<a name="line.271"></a>
+<FONT color="green">272</FONT>         * @see #BlockFieldMatrix(int, int, FieldElement[][], boolean)<a name="line.272"></a>
+<FONT color="green">273</FONT>         */<a name="line.273"></a>
+<FONT color="green">274</FONT>        public static &lt;T extends FieldElement&lt;T&gt;&gt; T[][] createBlocksLayout(final Field&lt;T&gt; field,<a name="line.274"></a>
+<FONT color="green">275</FONT>                                                                           final int rows, final int columns) {<a name="line.275"></a>
+<FONT color="green">276</FONT>    <a name="line.276"></a>
+<FONT color="green">277</FONT>            final int blockRows    = (rows    + BLOCK_SIZE - 1) / BLOCK_SIZE;<a name="line.277"></a>
+<FONT color="green">278</FONT>            final int blockColumns = (columns + BLOCK_SIZE - 1) / BLOCK_SIZE;<a name="line.278"></a>
+<FONT color="green">279</FONT>    <a name="line.279"></a>
+<FONT color="green">280</FONT>            final T[][] blocks = buildArray(field, blockRows * blockColumns, -1);<a name="line.280"></a>
+<FONT color="green">281</FONT>            int blockIndex = 0;<a name="line.281"></a>
+<FONT color="green">282</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.282"></a>
+<FONT color="green">283</FONT>                final int pStart  = iBlock * BLOCK_SIZE;<a name="line.283"></a>
+<FONT color="green">284</FONT>                final int pEnd    = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.284"></a>
+<FONT color="green">285</FONT>                final int iHeight = pEnd - pStart;<a name="line.285"></a>
+<FONT color="green">286</FONT>                for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.286"></a>
+<FONT color="green">287</FONT>                    final int qStart = jBlock * BLOCK_SIZE;<a name="line.287"></a>
+<FONT color="green">288</FONT>                    final int qEnd   = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.288"></a>
+<FONT color="green">289</FONT>                    final int jWidth = qEnd - qStart;<a name="line.289"></a>
+<FONT color="green">290</FONT>                    blocks[blockIndex] = buildArray(field, iHeight * jWidth);<a name="line.290"></a>
+<FONT color="green">291</FONT>                    ++blockIndex;<a name="line.291"></a>
+<FONT color="green">292</FONT>                }<a name="line.292"></a>
+<FONT color="green">293</FONT>            }<a name="line.293"></a>
+<FONT color="green">294</FONT>    <a name="line.294"></a>
+<FONT color="green">295</FONT>            return blocks;<a name="line.295"></a>
+<FONT color="green">296</FONT>    <a name="line.296"></a>
+<FONT color="green">297</FONT>        }<a name="line.297"></a>
+<FONT color="green">298</FONT>    <a name="line.298"></a>
+<FONT color="green">299</FONT>        /** {@inheritDoc} */<a name="line.299"></a>
+<FONT color="green">300</FONT>        @Override<a name="line.300"></a>
+<FONT color="green">301</FONT>        public FieldMatrix&lt;T&gt; createMatrix(final int rowDimension, final int columnDimension)<a name="line.301"></a>
+<FONT color="green">302</FONT>            throws IllegalArgumentException {<a name="line.302"></a>
+<FONT color="green">303</FONT>            return new BlockFieldMatrix&lt;T&gt;(getField(), rowDimension, columnDimension);<a name="line.303"></a>
+<FONT color="green">304</FONT>        }<a name="line.304"></a>
+<FONT color="green">305</FONT>    <a name="line.305"></a>
+<FONT color="green">306</FONT>        /** {@inheritDoc} */<a name="line.306"></a>
+<FONT color="green">307</FONT>        @Override<a name="line.307"></a>
+<FONT color="green">308</FONT>        public FieldMatrix&lt;T&gt; copy() {<a name="line.308"></a>
+<FONT color="green">309</FONT>    <a name="line.309"></a>
+<FONT color="green">310</FONT>            // create an empty matrix<a name="line.310"></a>
+<FONT color="green">311</FONT>            BlockFieldMatrix&lt;T&gt; copied = new BlockFieldMatrix&lt;T&gt;(getField(), rows, columns);<a name="line.311"></a>
+<FONT color="green">312</FONT>    <a name="line.312"></a>
+<FONT color="green">313</FONT>            // copy the blocks<a name="line.313"></a>
+<FONT color="green">314</FONT>            for (int i = 0; i &lt; blocks.length; ++i) {<a name="line.314"></a>
+<FONT color="green">315</FONT>                System.arraycopy(blocks[i], 0, copied.blocks[i], 0, blocks[i].length);<a name="line.315"></a>
+<FONT color="green">316</FONT>            }<a name="line.316"></a>
+<FONT color="green">317</FONT>    <a name="line.317"></a>
+<FONT color="green">318</FONT>            return copied;<a name="line.318"></a>
+<FONT color="green">319</FONT>    <a name="line.319"></a>
+<FONT color="green">320</FONT>        }<a name="line.320"></a>
+<FONT color="green">321</FONT>    <a name="line.321"></a>
+<FONT color="green">322</FONT>        /** {@inheritDoc} */<a name="line.322"></a>
+<FONT color="green">323</FONT>        @Override<a name="line.323"></a>
+<FONT color="green">324</FONT>        public FieldMatrix&lt;T&gt; add(final FieldMatrix&lt;T&gt; m)<a name="line.324"></a>
+<FONT color="green">325</FONT>            throws IllegalArgumentException {<a name="line.325"></a>
+<FONT color="green">326</FONT>            try {<a name="line.326"></a>
+<FONT color="green">327</FONT>                return add((BlockFieldMatrix&lt;T&gt;) m);<a name="line.327"></a>
+<FONT color="green">328</FONT>            } catch (ClassCastException cce) {<a name="line.328"></a>
+<FONT color="green">329</FONT>    <a name="line.329"></a>
+<FONT color="green">330</FONT>                // safety check<a name="line.330"></a>
+<FONT color="green">331</FONT>                checkAdditionCompatible(m);<a name="line.331"></a>
+<FONT color="green">332</FONT>    <a name="line.332"></a>
+<FONT color="green">333</FONT>                final BlockFieldMatrix&lt;T&gt; out = new BlockFieldMatrix&lt;T&gt;(getField(), rows, columns);<a name="line.333"></a>
+<FONT color="green">334</FONT>    <a name="line.334"></a>
+<FONT color="green">335</FONT>                // perform addition block-wise, to ensure good cache behavior<a name="line.335"></a>
+<FONT color="green">336</FONT>                int blockIndex = 0;<a name="line.336"></a>
+<FONT color="green">337</FONT>                for (int iBlock = 0; iBlock &lt; out.blockRows; ++iBlock) {<a name="line.337"></a>
+<FONT color="green">338</FONT>                    for (int jBlock = 0; jBlock &lt; out.blockColumns; ++jBlock) {<a name="line.338"></a>
+<FONT color="green">339</FONT>    <a name="line.339"></a>
+<FONT color="green">340</FONT>                        // perform addition on the current block<a name="line.340"></a>
+<FONT color="green">341</FONT>                        final T[] outBlock = out.blocks[blockIndex];<a name="line.341"></a>
+<FONT color="green">342</FONT>                        final T[] tBlock   = blocks[blockIndex];<a name="line.342"></a>
+<FONT color="green">343</FONT>                        final int      pStart   = iBlock * BLOCK_SIZE;<a name="line.343"></a>
+<FONT color="green">344</FONT>                        final int      pEnd     = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.344"></a>
+<FONT color="green">345</FONT>                        final int      qStart   = jBlock * BLOCK_SIZE;<a name="line.345"></a>
+<FONT color="green">346</FONT>                        final int      qEnd     = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.346"></a>
+<FONT color="green">347</FONT>                        int k = 0;<a name="line.347"></a>
+<FONT color="green">348</FONT>                        for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.348"></a>
+<FONT color="green">349</FONT>                            for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.349"></a>
+<FONT color="green">350</FONT>                                outBlock[k] = tBlock[k].add(m.getEntry(p, q));<a name="line.350"></a>
+<FONT color="green">351</FONT>                                ++k;<a name="line.351"></a>
+<FONT color="green">352</FONT>                            }<a name="line.352"></a>
+<FONT color="green">353</FONT>                        }<a name="line.353"></a>
+<FONT color="green">354</FONT>    <a name="line.354"></a>
+<FONT color="green">355</FONT>                        // go to next block<a name="line.355"></a>
+<FONT color="green">356</FONT>                        ++blockIndex;<a name="line.356"></a>
+<FONT color="green">357</FONT>    <a name="line.357"></a>
+<FONT color="green">358</FONT>                    }<a name="line.358"></a>
+<FONT color="green">359</FONT>                }<a name="line.359"></a>
+<FONT color="green">360</FONT>    <a name="line.360"></a>
+<FONT color="green">361</FONT>                return out;<a name="line.361"></a>
+<FONT color="green">362</FONT>    <a name="line.362"></a>
+<FONT color="green">363</FONT>            }<a name="line.363"></a>
+<FONT color="green">364</FONT>        }<a name="line.364"></a>
+<FONT color="green">365</FONT>    <a name="line.365"></a>
+<FONT color="green">366</FONT>        /**<a name="line.366"></a>
+<FONT color="green">367</FONT>         * Compute the sum of this and &lt;code&gt;m&lt;/code&gt;.<a name="line.367"></a>
+<FONT color="green">368</FONT>         *<a name="line.368"></a>
+<FONT color="green">369</FONT>         * @param m    matrix to be added<a name="line.369"></a>
+<FONT color="green">370</FONT>         * @return     this + m<a name="line.370"></a>
+<FONT color="green">371</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.371"></a>
+<FONT color="green">372</FONT>         */<a name="line.372"></a>
+<FONT color="green">373</FONT>        public BlockFieldMatrix&lt;T&gt; add(final BlockFieldMatrix&lt;T&gt; m)<a name="line.373"></a>
+<FONT color="green">374</FONT>            throws IllegalArgumentException {<a name="line.374"></a>
+<FONT color="green">375</FONT>    <a name="line.375"></a>
+<FONT color="green">376</FONT>            // safety check<a name="line.376"></a>
+<FONT color="green">377</FONT>            checkAdditionCompatible(m);<a name="line.377"></a>
+<FONT color="green">378</FONT>    <a name="line.378"></a>
+<FONT color="green">379</FONT>            final BlockFieldMatrix&lt;T&gt; out = new BlockFieldMatrix&lt;T&gt;(getField(), rows, columns);<a name="line.379"></a>
+<FONT color="green">380</FONT>    <a name="line.380"></a>
+<FONT color="green">381</FONT>            // perform addition block-wise, to ensure good cache behavior<a name="line.381"></a>
+<FONT color="green">382</FONT>            for (int blockIndex = 0; blockIndex &lt; out.blocks.length; ++blockIndex) {<a name="line.382"></a>
+<FONT color="green">383</FONT>                final T[] outBlock = out.blocks[blockIndex];<a name="line.383"></a>
+<FONT color="green">384</FONT>                final T[] tBlock   = blocks[blockIndex];<a name="line.384"></a>
+<FONT color="green">385</FONT>                final T[] mBlock   = m.blocks[blockIndex];<a name="line.385"></a>
+<FONT color="green">386</FONT>                for (int k = 0; k &lt; outBlock.length; ++k) {<a name="line.386"></a>
+<FONT color="green">387</FONT>                    outBlock[k] = tBlock[k].add(mBlock[k]);<a name="line.387"></a>
+<FONT color="green">388</FONT>                }<a name="line.388"></a>
+<FONT color="green">389</FONT>            }<a name="line.389"></a>
+<FONT color="green">390</FONT>    <a name="line.390"></a>
+<FONT color="green">391</FONT>            return out;<a name="line.391"></a>
+<FONT color="green">392</FONT>    <a name="line.392"></a>
+<FONT color="green">393</FONT>        }<a name="line.393"></a>
+<FONT color="green">394</FONT>    <a name="line.394"></a>
+<FONT color="green">395</FONT>        /** {@inheritDoc} */<a name="line.395"></a>
+<FONT color="green">396</FONT>        @Override<a name="line.396"></a>
+<FONT color="green">397</FONT>        public FieldMatrix&lt;T&gt; subtract(final FieldMatrix&lt;T&gt; m)<a name="line.397"></a>
+<FONT color="green">398</FONT>            throws IllegalArgumentException {<a name="line.398"></a>
+<FONT color="green">399</FONT>            try {<a name="line.399"></a>
+<FONT color="green">400</FONT>                return subtract((BlockFieldMatrix&lt;T&gt;) m);<a name="line.400"></a>
+<FONT color="green">401</FONT>            } catch (ClassCastException cce) {<a name="line.401"></a>
+<FONT color="green">402</FONT>    <a name="line.402"></a>
+<FONT color="green">403</FONT>                // safety check<a name="line.403"></a>
+<FONT color="green">404</FONT>                checkSubtractionCompatible(m);<a name="line.404"></a>
+<FONT color="green">405</FONT>    <a name="line.405"></a>
+<FONT color="green">406</FONT>                final BlockFieldMatrix&lt;T&gt; out = new BlockFieldMatrix&lt;T&gt;(getField(), rows, columns);<a name="line.406"></a>
+<FONT color="green">407</FONT>    <a name="line.407"></a>
+<FONT color="green">408</FONT>                // perform subtraction block-wise, to ensure good cache behavior<a name="line.408"></a>
+<FONT color="green">409</FONT>                int blockIndex = 0;<a name="line.409"></a>
+<FONT color="green">410</FONT>                for (int iBlock = 0; iBlock &lt; out.blockRows; ++iBlock) {<a name="line.410"></a>
+<FONT color="green">411</FONT>                    for (int jBlock = 0; jBlock &lt; out.blockColumns; ++jBlock) {<a name="line.411"></a>
+<FONT color="green">412</FONT>    <a name="line.412"></a>
+<FONT color="green">413</FONT>                        // perform subtraction on the current block<a name="line.413"></a>
+<FONT color="green">414</FONT>                        final T[] outBlock = out.blocks[blockIndex];<a name="line.414"></a>
+<FONT color="green">415</FONT>                        final T[] tBlock   = blocks[blockIndex];<a name="line.415"></a>
+<FONT color="green">416</FONT>                        final int      pStart   = iBlock * BLOCK_SIZE;<a name="line.416"></a>
+<FONT color="green">417</FONT>                        final int      pEnd     = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.417"></a>
+<FONT color="green">418</FONT>                        final int      qStart   = jBlock * BLOCK_SIZE;<a name="line.418"></a>
+<FONT color="green">419</FONT>                        final int      qEnd     = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.419"></a>
+<FONT color="green">420</FONT>                        int k = 0;<a name="line.420"></a>
+<FONT color="green">421</FONT>                        for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.421"></a>
+<FONT color="green">422</FONT>                            for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.422"></a>
+<FONT color="green">423</FONT>                                outBlock[k] = tBlock[k].subtract(m.getEntry(p, q));<a name="line.423"></a>
+<FONT color="green">424</FONT>                                ++k;<a name="line.424"></a>
+<FONT color="green">425</FONT>                            }<a name="line.425"></a>
+<FONT color="green">426</FONT>                        }<a name="line.426"></a>
+<FONT color="green">427</FONT>    <a name="line.427"></a>
+<FONT color="green">428</FONT>                        // go to next block<a name="line.428"></a>
+<FONT color="green">429</FONT>                        ++blockIndex;<a name="line.429"></a>
+<FONT color="green">430</FONT>    <a name="line.430"></a>
+<FONT color="green">431</FONT>                    }<a name="line.431"></a>
+<FONT color="green">432</FONT>                }<a name="line.432"></a>
+<FONT color="green">433</FONT>    <a name="line.433"></a>
+<FONT color="green">434</FONT>                return out;<a name="line.434"></a>
+<FONT color="green">435</FONT>    <a name="line.435"></a>
+<FONT color="green">436</FONT>            }<a name="line.436"></a>
+<FONT color="green">437</FONT>        }<a name="line.437"></a>
+<FONT color="green">438</FONT>    <a name="line.438"></a>
+<FONT color="green">439</FONT>        /**<a name="line.439"></a>
+<FONT color="green">440</FONT>         * Compute this minus &lt;code&gt;m&lt;/code&gt;.<a name="line.440"></a>
+<FONT color="green">441</FONT>         *<a name="line.441"></a>
+<FONT color="green">442</FONT>         * @param m    matrix to be subtracted<a name="line.442"></a>
+<FONT color="green">443</FONT>         * @return     this - m<a name="line.443"></a>
+<FONT color="green">444</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.444"></a>
+<FONT color="green">445</FONT>         */<a name="line.445"></a>
+<FONT color="green">446</FONT>        public BlockFieldMatrix&lt;T&gt; subtract(final BlockFieldMatrix&lt;T&gt; m)<a name="line.446"></a>
+<FONT color="green">447</FONT>            throws IllegalArgumentException {<a name="line.447"></a>
+<FONT color="green">448</FONT>    <a name="line.448"></a>
+<FONT color="green">449</FONT>            // safety check<a name="line.449"></a>
+<FONT color="green">450</FONT>            checkSubtractionCompatible(m);<a name="line.450"></a>
+<FONT color="green">451</FONT>    <a name="line.451"></a>
+<FONT color="green">452</FONT>            final BlockFieldMatrix&lt;T&gt; out = new BlockFieldMatrix&lt;T&gt;(getField(), rows, columns);<a name="line.452"></a>
+<FONT color="green">453</FONT>    <a name="line.453"></a>
+<FONT color="green">454</FONT>            // perform subtraction block-wise, to ensure good cache behavior<a name="line.454"></a>
+<FONT color="green">455</FONT>            for (int blockIndex = 0; blockIndex &lt; out.blocks.length; ++blockIndex) {<a name="line.455"></a>
+<FONT color="green">456</FONT>                final T[] outBlock = out.blocks[blockIndex];<a name="line.456"></a>
+<FONT color="green">457</FONT>                final T[] tBlock   = blocks[blockIndex];<a name="line.457"></a>
+<FONT color="green">458</FONT>                final T[] mBlock   = m.blocks[blockIndex];<a name="line.458"></a>
+<FONT color="green">459</FONT>                for (int k = 0; k &lt; outBlock.length; ++k) {<a name="line.459"></a>
+<FONT color="green">460</FONT>                    outBlock[k] = tBlock[k].subtract(mBlock[k]);<a name="line.460"></a>
+<FONT color="green">461</FONT>                }<a name="line.461"></a>
+<FONT color="green">462</FONT>            }<a name="line.462"></a>
+<FONT color="green">463</FONT>    <a name="line.463"></a>
+<FONT color="green">464</FONT>            return out;<a name="line.464"></a>
+<FONT color="green">465</FONT>    <a name="line.465"></a>
+<FONT color="green">466</FONT>        }<a name="line.466"></a>
+<FONT color="green">467</FONT>    <a name="line.467"></a>
+<FONT color="green">468</FONT>        /** {@inheritDoc} */<a name="line.468"></a>
+<FONT color="green">469</FONT>        @Override<a name="line.469"></a>
+<FONT color="green">470</FONT>        public FieldMatrix&lt;T&gt; scalarAdd(final T d)<a name="line.470"></a>
+<FONT color="green">471</FONT>            throws IllegalArgumentException {<a name="line.471"></a>
+<FONT color="green">472</FONT>    <a name="line.472"></a>
+<FONT color="green">473</FONT>            final BlockFieldMatrix&lt;T&gt; out = new BlockFieldMatrix&lt;T&gt;(getField(), rows, columns);<a name="line.473"></a>
+<FONT color="green">474</FONT>    <a name="line.474"></a>
+<FONT color="green">475</FONT>            // perform subtraction block-wise, to ensure good cache behavior<a name="line.475"></a>
+<FONT color="green">476</FONT>            for (int blockIndex = 0; blockIndex &lt; out.blocks.length; ++blockIndex) {<a name="line.476"></a>
+<FONT color="green">477</FONT>                final T[] outBlock = out.blocks[blockIndex];<a name="line.477"></a>
+<FONT color="green">478</FONT>                final T[] tBlock   = blocks[blockIndex];<a name="line.478"></a>
+<FONT color="green">479</FONT>                for (int k = 0; k &lt; outBlock.length; ++k) {<a name="line.479"></a>
+<FONT color="green">480</FONT>                    outBlock[k] = tBlock[k].add(d);<a name="line.480"></a>
+<FONT color="green">481</FONT>                }<a name="line.481"></a>
+<FONT color="green">482</FONT>            }<a name="line.482"></a>
+<FONT color="green">483</FONT>    <a name="line.483"></a>
+<FONT color="green">484</FONT>            return out;<a name="line.484"></a>
+<FONT color="green">485</FONT>    <a name="line.485"></a>
+<FONT color="green">486</FONT>        }<a name="line.486"></a>
+<FONT color="green">487</FONT>    <a name="line.487"></a>
+<FONT color="green">488</FONT>        /** {@inheritDoc} */<a name="line.488"></a>
+<FONT color="green">489</FONT>        @Override<a name="line.489"></a>
+<FONT color="green">490</FONT>        public FieldMatrix&lt;T&gt; scalarMultiply(final T d)<a name="line.490"></a>
+<FONT color="green">491</FONT>            throws IllegalArgumentException {<a name="line.491"></a>
+<FONT color="green">492</FONT>    <a name="line.492"></a>
+<FONT color="green">493</FONT>            final BlockFieldMatrix&lt;T&gt; out = new BlockFieldMatrix&lt;T&gt;(getField(), rows, columns);<a name="line.493"></a>
+<FONT color="green">494</FONT>    <a name="line.494"></a>
+<FONT color="green">495</FONT>            // perform subtraction block-wise, to ensure good cache behavior<a name="line.495"></a>
+<FONT color="green">496</FONT>            for (int blockIndex = 0; blockIndex &lt; out.blocks.length; ++blockIndex) {<a name="line.496"></a>
+<FONT color="green">497</FONT>                final T[] outBlock = out.blocks[blockIndex];<a name="line.497"></a>
+<FONT color="green">498</FONT>                final T[] tBlock   = blocks[blockIndex];<a name="line.498"></a>
+<FONT color="green">499</FONT>                for (int k = 0; k &lt; outBlock.length; ++k) {<a name="line.499"></a>
+<FONT color="green">500</FONT>                    outBlock[k] = tBlock[k].multiply(d);<a name="line.500"></a>
+<FONT color="green">501</FONT>                }<a name="line.501"></a>
+<FONT color="green">502</FONT>            }<a name="line.502"></a>
+<FONT color="green">503</FONT>    <a name="line.503"></a>
+<FONT color="green">504</FONT>            return out;<a name="line.504"></a>
+<FONT color="green">505</FONT>    <a name="line.505"></a>
+<FONT color="green">506</FONT>        }<a name="line.506"></a>
+<FONT color="green">507</FONT>    <a name="line.507"></a>
+<FONT color="green">508</FONT>        /** {@inheritDoc} */<a name="line.508"></a>
+<FONT color="green">509</FONT>        @Override<a name="line.509"></a>
+<FONT color="green">510</FONT>        public FieldMatrix&lt;T&gt; multiply(final FieldMatrix&lt;T&gt; m)<a name="line.510"></a>
+<FONT color="green">511</FONT>            throws IllegalArgumentException {<a name="line.511"></a>
+<FONT color="green">512</FONT>            try {<a name="line.512"></a>
+<FONT color="green">513</FONT>                return multiply((BlockFieldMatrix&lt;T&gt;) m);<a name="line.513"></a>
+<FONT color="green">514</FONT>            } catch (ClassCastException cce) {<a name="line.514"></a>
+<FONT color="green">515</FONT>    <a name="line.515"></a>
+<FONT color="green">516</FONT>                // safety check<a name="line.516"></a>
+<FONT color="green">517</FONT>                checkMultiplicationCompatible(m);<a name="line.517"></a>
+<FONT color="green">518</FONT>    <a name="line.518"></a>
+<FONT color="green">519</FONT>                final BlockFieldMatrix&lt;T&gt; out = new BlockFieldMatrix&lt;T&gt;(getField(), rows, m.getColumnDimension());<a name="line.519"></a>
+<FONT color="green">520</FONT>                final T zero = getField().getZero();<a name="line.520"></a>
+<FONT color="green">521</FONT>    <a name="line.521"></a>
+<FONT color="green">522</FONT>                // perform multiplication block-wise, to ensure good cache behavior<a name="line.522"></a>
+<FONT color="green">523</FONT>                int blockIndex = 0;<a name="line.523"></a>
+<FONT color="green">524</FONT>                for (int iBlock = 0; iBlock &lt; out.blockRows; ++iBlock) {<a name="line.524"></a>
+<FONT color="green">525</FONT>    <a name="line.525"></a>
+<FONT color="green">526</FONT>                    final int pStart = iBlock * BLOCK_SIZE;<a name="line.526"></a>
+<FONT color="green">527</FONT>                    final int pEnd   = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.527"></a>
+<FONT color="green">528</FONT>    <a name="line.528"></a>
+<FONT color="green">529</FONT>                    for (int jBlock = 0; jBlock &lt; out.blockColumns; ++jBlock) {<a name="line.529"></a>
+<FONT color="green">530</FONT>    <a name="line.530"></a>
+<FONT color="green">531</FONT>                        final int qStart = jBlock * BLOCK_SIZE;<a name="line.531"></a>
+<FONT color="green">532</FONT>                        final int qEnd   = Math.min(qStart + BLOCK_SIZE, m.getColumnDimension());<a name="line.532"></a>
+<FONT color="green">533</FONT>    <a name="line.533"></a>
+<FONT color="green">534</FONT>                        // select current block<a name="line.534"></a>
+<FONT color="green">535</FONT>                        final T[] outBlock = out.blocks[blockIndex];<a name="line.535"></a>
+<FONT color="green">536</FONT>    <a name="line.536"></a>
+<FONT color="green">537</FONT>                        // perform multiplication on current block<a name="line.537"></a>
+<FONT color="green">538</FONT>                        for (int kBlock = 0; kBlock &lt; blockColumns; ++kBlock) {<a name="line.538"></a>
+<FONT color="green">539</FONT>                            final int kWidth      = blockWidth(kBlock);<a name="line.539"></a>
+<FONT color="green">540</FONT>                            final T[] tBlock = blocks[iBlock * blockColumns + kBlock];<a name="line.540"></a>
+<FONT color="green">541</FONT>                            final int rStart      = kBlock * BLOCK_SIZE;<a name="line.541"></a>
+<FONT color="green">542</FONT>                            int k = 0;<a name="line.542"></a>
+<FONT color="green">543</FONT>                            for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.543"></a>
+<FONT color="green">544</FONT>                                final int lStart = (p - pStart) * kWidth;<a name="line.544"></a>
+<FONT color="green">545</FONT>                                final int lEnd   = lStart + kWidth;<a name="line.545"></a>
+<FONT color="green">546</FONT>                                for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.546"></a>
+<FONT color="green">547</FONT>                                    T sum = zero;<a name="line.547"></a>
+<FONT color="green">548</FONT>                                    int r = rStart;<a name="line.548"></a>
+<FONT color="green">549</FONT>                                    for (int l = lStart; l &lt; lEnd; ++l) {<a name="line.549"></a>
+<FONT color="green">550</FONT>                                        sum = sum.add(tBlock[l].multiply(m.getEntry(r, q)));<a name="line.550"></a>
+<FONT color="green">551</FONT>                                        ++r;<a name="line.551"></a>
+<FONT color="green">552</FONT>                                    }<a name="line.552"></a>
+<FONT color="green">553</FONT>                                    outBlock[k] = outBlock[k].add(sum);<a name="line.553"></a>
+<FONT color="green">554</FONT>                                    ++k;<a name="line.554"></a>
+<FONT color="green">555</FONT>                                }<a name="line.555"></a>
+<FONT color="green">556</FONT>                            }<a name="line.556"></a>
+<FONT color="green">557</FONT>                        }<a name="line.557"></a>
+<FONT color="green">558</FONT>    <a name="line.558"></a>
+<FONT color="green">559</FONT>                        // go to next block<a name="line.559"></a>
+<FONT color="green">560</FONT>                        ++blockIndex;<a name="line.560"></a>
+<FONT color="green">561</FONT>    <a name="line.561"></a>
+<FONT color="green">562</FONT>                    }<a name="line.562"></a>
+<FONT color="green">563</FONT>                }<a name="line.563"></a>
+<FONT color="green">564</FONT>    <a name="line.564"></a>
+<FONT color="green">565</FONT>                return out;<a name="line.565"></a>
+<FONT color="green">566</FONT>    <a name="line.566"></a>
+<FONT color="green">567</FONT>            }<a name="line.567"></a>
+<FONT color="green">568</FONT>        }<a name="line.568"></a>
+<FONT color="green">569</FONT>    <a name="line.569"></a>
+<FONT color="green">570</FONT>        /**<a name="line.570"></a>
+<FONT color="green">571</FONT>         * Returns the result of postmultiplying this by m.<a name="line.571"></a>
+<FONT color="green">572</FONT>         *<a name="line.572"></a>
+<FONT color="green">573</FONT>         * @param m    matrix to postmultiply by<a name="line.573"></a>
+<FONT color="green">574</FONT>         * @return     this * m<a name="line.574"></a>
+<FONT color="green">575</FONT>         * @throws     IllegalArgumentException<a name="line.575"></a>
+<FONT color="green">576</FONT>         *             if columnDimension(this) != rowDimension(m)<a name="line.576"></a>
+<FONT color="green">577</FONT>         */<a name="line.577"></a>
+<FONT color="green">578</FONT>        public BlockFieldMatrix&lt;T&gt; multiply(BlockFieldMatrix&lt;T&gt; m) throws IllegalArgumentException {<a name="line.578"></a>
+<FONT color="green">579</FONT>    <a name="line.579"></a>
+<FONT color="green">580</FONT>            // safety check<a name="line.580"></a>
+<FONT color="green">581</FONT>            checkMultiplicationCompatible(m);<a name="line.581"></a>
+<FONT color="green">582</FONT>    <a name="line.582"></a>
+<FONT color="green">583</FONT>            final BlockFieldMatrix&lt;T&gt; out = new BlockFieldMatrix&lt;T&gt;(getField(), rows, m.columns);<a name="line.583"></a>
+<FONT color="green">584</FONT>            final T zero = getField().getZero();<a name="line.584"></a>
+<FONT color="green">585</FONT>    <a name="line.585"></a>
+<FONT color="green">586</FONT>            // perform multiplication block-wise, to ensure good cache behavior<a name="line.586"></a>
+<FONT color="green">587</FONT>            int blockIndex = 0;<a name="line.587"></a>
+<FONT color="green">588</FONT>            for (int iBlock = 0; iBlock &lt; out.blockRows; ++iBlock) {<a name="line.588"></a>
+<FONT color="green">589</FONT>    <a name="line.589"></a>
+<FONT color="green">590</FONT>                final int pStart = iBlock * BLOCK_SIZE;<a name="line.590"></a>
+<FONT color="green">591</FONT>                final int pEnd   = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.591"></a>
+<FONT color="green">592</FONT>    <a name="line.592"></a>
+<FONT color="green">593</FONT>                for (int jBlock = 0; jBlock &lt; out.blockColumns; ++jBlock) {<a name="line.593"></a>
+<FONT color="green">594</FONT>                    final int jWidth = out.blockWidth(jBlock);<a name="line.594"></a>
+<FONT color="green">595</FONT>                    final int jWidth2 = jWidth  + jWidth;<a name="line.595"></a>
+<FONT color="green">596</FONT>                    final int jWidth3 = jWidth2 + jWidth;<a name="line.596"></a>
+<FONT color="green">597</FONT>                    final int jWidth4 = jWidth3 + jWidth;<a name="line.597"></a>
+<FONT color="green">598</FONT>    <a name="line.598"></a>
+<FONT color="green">599</FONT>                    // select current block<a name="line.599"></a>
+<FONT color="green">600</FONT>                    final T[] outBlock = out.blocks[blockIndex];<a name="line.600"></a>
+<FONT color="green">601</FONT>    <a name="line.601"></a>
+<FONT color="green">602</FONT>                    // perform multiplication on current block<a name="line.602"></a>
+<FONT color="green">603</FONT>                    for (int kBlock = 0; kBlock &lt; blockColumns; ++kBlock) {<a name="line.603"></a>
+<FONT color="green">604</FONT>                        final int kWidth = blockWidth(kBlock);<a name="line.604"></a>
+<FONT color="green">605</FONT>                        final T[] tBlock = blocks[iBlock * blockColumns + kBlock];<a name="line.605"></a>
+<FONT color="green">606</FONT>                        final T[] mBlock = m.blocks[kBlock * m.blockColumns + jBlock];<a name="line.606"></a>
+<FONT color="green">607</FONT>                        int k = 0;<a name="line.607"></a>
+<FONT color="green">608</FONT>                        for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.608"></a>
+<FONT color="green">609</FONT>                            final int lStart = (p - pStart) * kWidth;<a name="line.609"></a>
+<FONT color="green">610</FONT>                            final int lEnd   = lStart + kWidth;<a name="line.610"></a>
+<FONT color="green">611</FONT>                            for (int nStart = 0; nStart &lt; jWidth; ++nStart) {<a name="line.611"></a>
+<FONT color="green">612</FONT>                                T sum = zero;<a name="line.612"></a>
+<FONT color="green">613</FONT>                                int l = lStart;<a name="line.613"></a>
+<FONT color="green">614</FONT>                                int n = nStart;<a name="line.614"></a>
+<FONT color="green">615</FONT>                                while (l &lt; lEnd - 3) {<a name="line.615"></a>
+<FONT color="green">616</FONT>                                    sum = sum.<a name="line.616"></a>
+<FONT color="green">617</FONT>                                          add(tBlock[l].multiply(mBlock[n])).<a name="line.617"></a>
+<FONT color="green">618</FONT>                                          add(tBlock[l + 1].multiply(mBlock[n + jWidth])).<a name="line.618"></a>
+<FONT color="green">619</FONT>                                          add(tBlock[l + 2].multiply(mBlock[n + jWidth2])).<a name="line.619"></a>
+<FONT color="green">620</FONT>                                          add(tBlock[l + 3].multiply(mBlock[n + jWidth3]));<a name="line.620"></a>
+<FONT color="green">621</FONT>                                    l += 4;<a name="line.621"></a>
+<FONT color="green">622</FONT>                                    n += jWidth4;<a name="line.622"></a>
+<FONT color="green">623</FONT>                                }<a name="line.623"></a>
+<FONT color="green">624</FONT>                                while (l &lt; lEnd) {<a name="line.624"></a>
+<FONT color="green">625</FONT>                                    sum = sum.add(tBlock[l++].multiply(mBlock[n]));<a name="line.625"></a>
+<FONT color="green">626</FONT>                                    n += jWidth;<a name="line.626"></a>
+<FONT color="green">627</FONT>                                }<a name="line.627"></a>
+<FONT color="green">628</FONT>                                outBlock[k] = outBlock[k].add(sum);<a name="line.628"></a>
+<FONT color="green">629</FONT>                                ++k;<a name="line.629"></a>
+<FONT color="green">630</FONT>                            }<a name="line.630"></a>
+<FONT color="green">631</FONT>                        }<a name="line.631"></a>
+<FONT color="green">632</FONT>                    }<a name="line.632"></a>
+<FONT color="green">633</FONT>    <a name="line.633"></a>
+<FONT color="green">634</FONT>                    // go to next block<a name="line.634"></a>
+<FONT color="green">635</FONT>                    ++blockIndex;<a name="line.635"></a>
+<FONT color="green">636</FONT>    <a name="line.636"></a>
+<FONT color="green">637</FONT>                }<a name="line.637"></a>
+<FONT color="green">638</FONT>            }<a name="line.638"></a>
+<FONT color="green">639</FONT>    <a name="line.639"></a>
+<FONT color="green">640</FONT>            return out;<a name="line.640"></a>
+<FONT color="green">641</FONT>    <a name="line.641"></a>
+<FONT color="green">642</FONT>        }<a name="line.642"></a>
+<FONT color="green">643</FONT>    <a name="line.643"></a>
+<FONT color="green">644</FONT>        /** {@inheritDoc} */<a name="line.644"></a>
+<FONT color="green">645</FONT>        @Override<a name="line.645"></a>
+<FONT color="green">646</FONT>        public T[][] getData() {<a name="line.646"></a>
+<FONT color="green">647</FONT>    <a name="line.647"></a>
+<FONT color="green">648</FONT>            final T[][] data = buildArray(getField(), getRowDimension(), getColumnDimension());<a name="line.648"></a>
+<FONT color="green">649</FONT>            final int lastColumns = columns - (blockColumns - 1) * BLOCK_SIZE;<a name="line.649"></a>
+<FONT color="green">650</FONT>    <a name="line.650"></a>
+<FONT color="green">651</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.651"></a>
+<FONT color="green">652</FONT>                final int pStart = iBlock * BLOCK_SIZE;<a name="line.652"></a>
+<FONT color="green">653</FONT>                final int pEnd   = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.653"></a>
+<FONT color="green">654</FONT>                int regularPos   = 0;<a name="line.654"></a>
+<FONT color="green">655</FONT>                int lastPos      = 0;<a name="line.655"></a>
+<FONT color="green">656</FONT>                for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.656"></a>
+<FONT color="green">657</FONT>                    final T[] dataP = data[p];<a name="line.657"></a>
+<FONT color="green">658</FONT>                    int blockIndex = iBlock * blockColumns;<a name="line.658"></a>
+<FONT color="green">659</FONT>                    int dataPos    = 0;<a name="line.659"></a>
+<FONT color="green">660</FONT>                    for (int jBlock = 0; jBlock &lt; blockColumns - 1; ++jBlock) {<a name="line.660"></a>
+<FONT color="green">661</FONT>                        System.arraycopy(blocks[blockIndex++], regularPos, dataP, dataPos, BLOCK_SIZE);<a name="line.661"></a>
+<FONT color="green">662</FONT>                        dataPos += BLOCK_SIZE;<a name="line.662"></a>
+<FONT color="green">663</FONT>                    }<a name="line.663"></a>
+<FONT color="green">664</FONT>                    System.arraycopy(blocks[blockIndex], lastPos, dataP, dataPos, lastColumns);<a name="line.664"></a>
+<FONT color="green">665</FONT>                    regularPos += BLOCK_SIZE;<a name="line.665"></a>
+<FONT color="green">666</FONT>                    lastPos    += lastColumns;<a name="line.666"></a>
+<FONT color="green">667</FONT>                }<a name="line.667"></a>
+<FONT color="green">668</FONT>            }<a name="line.668"></a>
+<FONT color="green">669</FONT>    <a name="line.669"></a>
+<FONT color="green">670</FONT>            return data;<a name="line.670"></a>
+<FONT color="green">671</FONT>    <a name="line.671"></a>
+<FONT color="green">672</FONT>        }<a name="line.672"></a>
+<FONT color="green">673</FONT>    <a name="line.673"></a>
+<FONT color="green">674</FONT>        /** {@inheritDoc} */<a name="line.674"></a>
+<FONT color="green">675</FONT>        @Override<a name="line.675"></a>
+<FONT color="green">676</FONT>        public FieldMatrix&lt;T&gt; getSubMatrix(final int startRow, final int endRow,<a name="line.676"></a>
+<FONT color="green">677</FONT>                                       final int startColumn, final int endColumn)<a name="line.677"></a>
+<FONT color="green">678</FONT>            throws MatrixIndexException {<a name="line.678"></a>
+<FONT color="green">679</FONT>    <a name="line.679"></a>
+<FONT color="green">680</FONT>            // safety checks<a name="line.680"></a>
+<FONT color="green">681</FONT>            checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);<a name="line.681"></a>
+<FONT color="green">682</FONT>    <a name="line.682"></a>
+<FONT color="green">683</FONT>            // create the output matrix<a name="line.683"></a>
+<FONT color="green">684</FONT>            final BlockFieldMatrix&lt;T&gt; out =<a name="line.684"></a>
+<FONT color="green">685</FONT>                new BlockFieldMatrix&lt;T&gt;(getField(), endRow - startRow + 1, endColumn - startColumn + 1);<a name="line.685"></a>
+<FONT color="green">686</FONT>    <a name="line.686"></a>
+<FONT color="green">687</FONT>            // compute blocks shifts<a name="line.687"></a>
+<FONT color="green">688</FONT>            final int blockStartRow    = startRow    / BLOCK_SIZE;<a name="line.688"></a>
+<FONT color="green">689</FONT>            final int rowsShift        = startRow    % BLOCK_SIZE;<a name="line.689"></a>
+<FONT color="green">690</FONT>            final int blockStartColumn = startColumn / BLOCK_SIZE;<a name="line.690"></a>
+<FONT color="green">691</FONT>            final int columnsShift     = startColumn % BLOCK_SIZE;<a name="line.691"></a>
+<FONT color="green">692</FONT>    <a name="line.692"></a>
+<FONT color="green">693</FONT>            // perform extraction block-wise, to ensure good cache behavior<a name="line.693"></a>
+<FONT color="green">694</FONT>            int pBlock = blockStartRow;<a name="line.694"></a>
+<FONT color="green">695</FONT>            for (int iBlock = 0; iBlock &lt; out.blockRows; ++iBlock) {<a name="line.695"></a>
+<FONT color="green">696</FONT>                final int iHeight = out.blockHeight(iBlock);<a name="line.696"></a>
+<FONT color="green">697</FONT>                int qBlock = blockStartColumn;<a name="line.697"></a>
+<FONT color="green">698</FONT>                for (int jBlock = 0; jBlock &lt; out.blockColumns; ++jBlock) {<a name="line.698"></a>
+<FONT color="green">699</FONT>                    final int jWidth = out.blockWidth(jBlock);<a name="line.699"></a>
+<FONT color="green">700</FONT>    <a name="line.700"></a>
+<FONT color="green">701</FONT>                    // handle one block of the output matrix<a name="line.701"></a>
+<FONT color="green">702</FONT>                    final int      outIndex = iBlock * out.blockColumns + jBlock;<a name="line.702"></a>
+<FONT color="green">703</FONT>                    final T[] outBlock = out.blocks[outIndex];<a name="line.703"></a>
+<FONT color="green">704</FONT>                    final int      index    = pBlock * blockColumns + qBlock;<a name="line.704"></a>
+<FONT color="green">705</FONT>                    final int      width    = blockWidth(qBlock);<a name="line.705"></a>
+<FONT color="green">706</FONT>    <a name="line.706"></a>
+<FONT color="green">707</FONT>                    final int heightExcess = iHeight + rowsShift - BLOCK_SIZE;<a name="line.707"></a>
+<FONT color="green">708</FONT>                    final int widthExcess  = jWidth + columnsShift - BLOCK_SIZE;<a name="line.708"></a>
+<FONT color="green">709</FONT>                    if (heightExcess &gt; 0) {<a name="line.709"></a>
+<FONT color="green">710</FONT>                        // the submatrix block spans on two blocks rows from the original matrix<a name="line.710"></a>
+<FONT color="green">711</FONT>                        if (widthExcess &gt; 0) {<a name="line.711"></a>
+<FONT color="green">712</FONT>                            // the submatrix block spans on two blocks columns from the original matrix<a name="line.712"></a>
+<FONT color="green">713</FONT>                            final int width2 = blockWidth(qBlock + 1);<a name="line.713"></a>
+<FONT color="green">714</FONT>                            copyBlockPart(blocks[index], width,<a name="line.714"></a>
+<FONT color="green">715</FONT>                                          rowsShift, BLOCK_SIZE,<a name="line.715"></a>
+<FONT color="green">716</FONT>                                          columnsShift, BLOCK_SIZE,<a name="line.716"></a>
+<FONT color="green">717</FONT>                                          outBlock, jWidth, 0, 0);<a name="line.717"></a>
+<FONT color="green">718</FONT>                            copyBlockPart(blocks[index + 1], width2,<a name="line.718"></a>
+<FONT color="green">719</FONT>                                          rowsShift, BLOCK_SIZE,<a name="line.719"></a>
+<FONT color="green">720</FONT>                                          0, widthExcess,<a name="line.720"></a>
+<FONT color="green">721</FONT>                                          outBlock, jWidth, 0, jWidth - widthExcess);<a name="line.721"></a>
+<FONT color="green">722</FONT>                            copyBlockPart(blocks[index + blockColumns], width,<a name="line.722"></a>
+<FONT color="green">723</FONT>                                          0, heightExcess,<a name="line.723"></a>
+<FONT color="green">724</FONT>                                          columnsShift, BLOCK_SIZE,<a name="line.724"></a>
+<FONT color="green">725</FONT>                                          outBlock, jWidth, iHeight - heightExcess, 0);<a name="line.725"></a>
+<FONT color="green">726</FONT>                            copyBlockPart(blocks[index + blockColumns + 1], width2,<a name="line.726"></a>
+<FONT color="green">727</FONT>                                          0, heightExcess,<a name="line.727"></a>
+<FONT color="green">728</FONT>                                          0, widthExcess,<a name="line.728"></a>
+<FONT color="green">729</FONT>                                          outBlock, jWidth, iHeight - heightExcess, jWidth - widthExcess);<a name="line.729"></a>
+<FONT color="green">730</FONT>                        } else {<a name="line.730"></a>
+<FONT color="green">731</FONT>                            // the submatrix block spans on one block column from the original matrix<a name="line.731"></a>
+<FONT color="green">732</FONT>                            copyBlockPart(blocks[index], width,<a name="line.732"></a>
+<FONT color="green">733</FONT>                                          rowsShift, BLOCK_SIZE,<a name="line.733"></a>
+<FONT color="green">734</FONT>                                          columnsShift, jWidth + columnsShift,<a name="line.734"></a>
+<FONT color="green">735</FONT>                                          outBlock, jWidth, 0, 0);<a name="line.735"></a>
+<FONT color="green">736</FONT>                            copyBlockPart(blocks[index + blockColumns], width,<a name="line.736"></a>
+<FONT color="green">737</FONT>                                          0, heightExcess,<a name="line.737"></a>
+<FONT color="green">738</FONT>                                          columnsShift, jWidth + columnsShift,<a name="line.738"></a>
+<FONT color="green">739</FONT>                                          outBlock, jWidth, iHeight - heightExcess, 0);<a name="line.739"></a>
+<FONT color="green">740</FONT>                        }<a name="line.740"></a>
+<FONT color="green">741</FONT>                    } else {<a name="line.741"></a>
+<FONT color="green">742</FONT>                        // the submatrix block spans on one block row from the original matrix<a name="line.742"></a>
+<FONT color="green">743</FONT>                        if (widthExcess &gt; 0) {<a name="line.743"></a>
+<FONT color="green">744</FONT>                            // the submatrix block spans on two blocks columns from the original matrix<a name="line.744"></a>
+<FONT color="green">745</FONT>                            final int width2 = blockWidth(qBlock + 1);<a name="line.745"></a>
+<FONT color="green">746</FONT>                            copyBlockPart(blocks[index], width,<a name="line.746"></a>
+<FONT color="green">747</FONT>                                          rowsShift, iHeight + rowsShift,<a name="line.747"></a>
+<FONT color="green">748</FONT>                                          columnsShift, BLOCK_SIZE,<a name="line.748"></a>
+<FONT color="green">749</FONT>                                          outBlock, jWidth, 0, 0);<a name="line.749"></a>
+<FONT color="green">750</FONT>                            copyBlockPart(blocks[index + 1], width2,<a name="line.750"></a>
+<FONT color="green">751</FONT>                                          rowsShift, iHeight + rowsShift,<a name="line.751"></a>
+<FONT color="green">752</FONT>                                          0, widthExcess,<a name="line.752"></a>
+<FONT color="green">753</FONT>                                          outBlock, jWidth, 0, jWidth - widthExcess);<a name="line.753"></a>
+<FONT color="green">754</FONT>                        } else {<a name="line.754"></a>
+<FONT color="green">755</FONT>                            // the submatrix block spans on one block column from the original matrix<a name="line.755"></a>
+<FONT color="green">756</FONT>                            copyBlockPart(blocks[index], width,<a name="line.756"></a>
+<FONT color="green">757</FONT>                                          rowsShift, iHeight + rowsShift,<a name="line.757"></a>
+<FONT color="green">758</FONT>                                          columnsShift, jWidth + columnsShift,<a name="line.758"></a>
+<FONT color="green">759</FONT>                                          outBlock, jWidth, 0, 0);<a name="line.759"></a>
+<FONT color="green">760</FONT>                        }<a name="line.760"></a>
+<FONT color="green">761</FONT>                   }<a name="line.761"></a>
+<FONT color="green">762</FONT>    <a name="line.762"></a>
+<FONT color="green">763</FONT>                    ++qBlock;<a name="line.763"></a>
+<FONT color="green">764</FONT>                }<a name="line.764"></a>
+<FONT color="green">765</FONT>    <a name="line.765"></a>
+<FONT color="green">766</FONT>                ++pBlock;<a name="line.766"></a>
+<FONT color="green">767</FONT>    <a name="line.767"></a>
+<FONT color="green">768</FONT>            }<a name="line.768"></a>
+<FONT color="green">769</FONT>    <a name="line.769"></a>
+<FONT color="green">770</FONT>            return out;<a name="line.770"></a>
+<FONT color="green">771</FONT>    <a name="line.771"></a>
+<FONT color="green">772</FONT>        }<a name="line.772"></a>
+<FONT color="green">773</FONT>    <a name="line.773"></a>
+<FONT color="green">774</FONT>        /**<a name="line.774"></a>
+<FONT color="green">775</FONT>         * Copy a part of a block into another one<a name="line.775"></a>
+<FONT color="green">776</FONT>         * &lt;p&gt;This method can be called only when the specified part fits in both<a name="line.776"></a>
+<FONT color="green">777</FONT>         * blocks, no verification is done here.&lt;/p&gt;<a name="line.777"></a>
+<FONT color="green">778</FONT>         * @param srcBlock source block<a name="line.778"></a>
+<FONT color="green">779</FONT>         * @param srcWidth source block width ({@link #BLOCK_SIZE} or smaller)<a name="line.779"></a>
+<FONT color="green">780</FONT>         * @param srcStartRow start row in the source block<a name="line.780"></a>
+<FONT color="green">781</FONT>         * @param srcEndRow end row (exclusive) in the source block<a name="line.781"></a>
+<FONT color="green">782</FONT>         * @param srcStartColumn start column in the source block<a name="line.782"></a>
+<FONT color="green">783</FONT>         * @param srcEndColumn end column (exclusive) in the source block<a name="line.783"></a>
+<FONT color="green">784</FONT>         * @param dstBlock destination block<a name="line.784"></a>
+<FONT color="green">785</FONT>         * @param dstWidth destination block width ({@link #BLOCK_SIZE} or smaller)<a name="line.785"></a>
+<FONT color="green">786</FONT>         * @param dstStartRow start row in the destination block<a name="line.786"></a>
+<FONT color="green">787</FONT>         * @param dstStartColumn start column in the destination block<a name="line.787"></a>
+<FONT color="green">788</FONT>         */<a name="line.788"></a>
+<FONT color="green">789</FONT>        private void copyBlockPart(final T[] srcBlock, final int srcWidth,<a name="line.789"></a>
+<FONT color="green">790</FONT>                                   final int srcStartRow, final int srcEndRow,<a name="line.790"></a>
+<FONT color="green">791</FONT>                                   final int srcStartColumn, final int srcEndColumn,<a name="line.791"></a>
+<FONT color="green">792</FONT>                                   final T[] dstBlock, final int dstWidth,<a name="line.792"></a>
+<FONT color="green">793</FONT>                                   final int dstStartRow, final int dstStartColumn) {<a name="line.793"></a>
+<FONT color="green">794</FONT>            final int length = srcEndColumn - srcStartColumn;<a name="line.794"></a>
+<FONT color="green">795</FONT>            int srcPos = srcStartRow * srcWidth + srcStartColumn;<a name="line.795"></a>
+<FONT color="green">796</FONT>            int dstPos = dstStartRow * dstWidth + dstStartColumn;<a name="line.796"></a>
+<FONT color="green">797</FONT>            for (int srcRow = srcStartRow; srcRow &lt; srcEndRow; ++srcRow) {<a name="line.797"></a>
+<FONT color="green">798</FONT>                System.arraycopy(srcBlock, srcPos, dstBlock, dstPos, length);<a name="line.798"></a>
+<FONT color="green">799</FONT>                srcPos += srcWidth;<a name="line.799"></a>
+<FONT color="green">800</FONT>                dstPos += dstWidth;<a name="line.800"></a>
+<FONT color="green">801</FONT>            }<a name="line.801"></a>
+<FONT color="green">802</FONT>        }<a name="line.802"></a>
+<FONT color="green">803</FONT>    <a name="line.803"></a>
+<FONT color="green">804</FONT>        /** {@inheritDoc} */<a name="line.804"></a>
+<FONT color="green">805</FONT>        @Override<a name="line.805"></a>
+<FONT color="green">806</FONT>        public void setSubMatrix(final T[][] subMatrix, final int row, final int column)<a name="line.806"></a>
+<FONT color="green">807</FONT>            throws MatrixIndexException {<a name="line.807"></a>
+<FONT color="green">808</FONT>    <a name="line.808"></a>
+<FONT color="green">809</FONT>            // safety checks<a name="line.809"></a>
+<FONT color="green">810</FONT>            final int refLength = subMatrix[0].length;<a name="line.810"></a>
+<FONT color="green">811</FONT>            if (refLength &lt; 1) {<a name="line.811"></a>
+<FONT color="green">812</FONT>                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");<a name="line.812"></a>
+<FONT color="green">813</FONT>            }<a name="line.813"></a>
+<FONT color="green">814</FONT>            final int endRow    = row + subMatrix.length - 1;<a name="line.814"></a>
+<FONT color="green">815</FONT>            final int endColumn = column + refLength - 1;<a name="line.815"></a>
+<FONT color="green">816</FONT>            checkSubMatrixIndex(row, endRow, column, endColumn);<a name="line.816"></a>
+<FONT color="green">817</FONT>            for (final T[] subRow : subMatrix) {<a name="line.817"></a>
+<FONT color="green">818</FONT>                if (subRow.length != refLength) {<a name="line.818"></a>
+<FONT color="green">819</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.819"></a>
+<FONT color="green">820</FONT>                            "some rows have length {0} while others have length {1}",<a name="line.820"></a>
+<FONT color="green">821</FONT>                            refLength, subRow.length);<a name="line.821"></a>
+<FONT color="green">822</FONT>                }<a name="line.822"></a>
+<FONT color="green">823</FONT>            }<a name="line.823"></a>
+<FONT color="green">824</FONT>    <a name="line.824"></a>
+<FONT color="green">825</FONT>            // compute blocks bounds<a name="line.825"></a>
+<FONT color="green">826</FONT>            final int blockStartRow    = row / BLOCK_SIZE;<a name="line.826"></a>
+<FONT color="green">827</FONT>            final int blockEndRow      = (endRow + BLOCK_SIZE) / BLOCK_SIZE;<a name="line.827"></a>
+<FONT color="green">828</FONT>            final int blockStartColumn = column / BLOCK_SIZE;<a name="line.828"></a>
+<FONT color="green">829</FONT>            final int blockEndColumn   = (endColumn + BLOCK_SIZE) / BLOCK_SIZE;<a name="line.829"></a>
+<FONT color="green">830</FONT>    <a name="line.830"></a>
+<FONT color="green">831</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.831"></a>
+<FONT color="green">832</FONT>            for (int iBlock = blockStartRow; iBlock &lt; blockEndRow; ++iBlock) {<a name="line.832"></a>
+<FONT color="green">833</FONT>                final int iHeight  = blockHeight(iBlock);<a name="line.833"></a>
+<FONT color="green">834</FONT>                final int firstRow = iBlock * BLOCK_SIZE;<a name="line.834"></a>
+<FONT color="green">835</FONT>                final int iStart   = Math.max(row,    firstRow);<a name="line.835"></a>
+<FONT color="green">836</FONT>                final int iEnd     = Math.min(endRow + 1, firstRow + iHeight);<a name="line.836"></a>
+<FONT color="green">837</FONT>    <a name="line.837"></a>
+<FONT color="green">838</FONT>                for (int jBlock = blockStartColumn; jBlock &lt; blockEndColumn; ++jBlock) {<a name="line.838"></a>
+<FONT color="green">839</FONT>                    final int jWidth      = blockWidth(jBlock);<a name="line.839"></a>
+<FONT color="green">840</FONT>                    final int firstColumn = jBlock * BLOCK_SIZE;<a name="line.840"></a>
+<FONT color="green">841</FONT>                    final int jStart      = Math.max(column,    firstColumn);<a name="line.841"></a>
+<FONT color="green">842</FONT>                    final int jEnd        = Math.min(endColumn + 1, firstColumn + jWidth);<a name="line.842"></a>
+<FONT color="green">843</FONT>                    final int jLength     = jEnd - jStart;<a name="line.843"></a>
+<FONT color="green">844</FONT>    <a name="line.844"></a>
+<FONT color="green">845</FONT>                    // handle one block, row by row<a name="line.845"></a>
+<FONT color="green">846</FONT>                    final T[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.846"></a>
+<FONT color="green">847</FONT>                    for (int i = iStart; i &lt; iEnd; ++i) {<a name="line.847"></a>
+<FONT color="green">848</FONT>                        System.arraycopy(subMatrix[i - row], jStart - column,<a name="line.848"></a>
+<FONT color="green">849</FONT>                                         block, (i - firstRow) * jWidth + (jStart - firstColumn),<a name="line.849"></a>
+<FONT color="green">850</FONT>                                         jLength);<a name="line.850"></a>
+<FONT color="green">851</FONT>                    }<a name="line.851"></a>
+<FONT color="green">852</FONT>    <a name="line.852"></a>
+<FONT color="green">853</FONT>                }<a name="line.853"></a>
+<FONT color="green">854</FONT>            }<a name="line.854"></a>
+<FONT color="green">855</FONT>        }<a name="line.855"></a>
+<FONT color="green">856</FONT>    <a name="line.856"></a>
+<FONT color="green">857</FONT>        /** {@inheritDoc} */<a name="line.857"></a>
+<FONT color="green">858</FONT>        @Override<a name="line.858"></a>
+<FONT color="green">859</FONT>        public FieldMatrix&lt;T&gt; getRowMatrix(final int row)<a name="line.859"></a>
+<FONT color="green">860</FONT>            throws MatrixIndexException {<a name="line.860"></a>
+<FONT color="green">861</FONT>    <a name="line.861"></a>
+<FONT color="green">862</FONT>            checkRowIndex(row);<a name="line.862"></a>
+<FONT color="green">863</FONT>            final BlockFieldMatrix&lt;T&gt; out = new BlockFieldMatrix&lt;T&gt;(getField(), 1, columns);<a name="line.863"></a>
+<FONT color="green">864</FONT>    <a name="line.864"></a>
+<FONT color="green">865</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.865"></a>
+<FONT color="green">866</FONT>            final int iBlock  = row / BLOCK_SIZE;<a name="line.866"></a>
+<FONT color="green">867</FONT>            final int iRow    = row - iBlock * BLOCK_SIZE;<a name="line.867"></a>
+<FONT color="green">868</FONT>            int outBlockIndex = 0;<a name="line.868"></a>
+<FONT color="green">869</FONT>            int outIndex      = 0;<a name="line.869"></a>
+<FONT color="green">870</FONT>            T[] outBlock = out.blocks[outBlockIndex];<a name="line.870"></a>
+<FONT color="green">871</FONT>            for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.871"></a>
+<FONT color="green">872</FONT>                final int jWidth     = blockWidth(jBlock);<a name="line.872"></a>
+<FONT color="green">873</FONT>                final T[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.873"></a>
+<FONT color="green">874</FONT>                final int available  = outBlock.length - outIndex;<a name="line.874"></a>
+<FONT color="green">875</FONT>                if (jWidth &gt; available) {<a name="line.875"></a>
+<FONT color="green">876</FONT>                    System.arraycopy(block, iRow * jWidth, outBlock, outIndex, available);<a name="line.876"></a>
+<FONT color="green">877</FONT>                    outBlock = out.blocks[++outBlockIndex];<a name="line.877"></a>
+<FONT color="green">878</FONT>                    System.arraycopy(block, iRow * jWidth, outBlock, 0, jWidth - available);<a name="line.878"></a>
+<FONT color="green">879</FONT>                    outIndex = jWidth - available;<a name="line.879"></a>
+<FONT color="green">880</FONT>                } else {<a name="line.880"></a>
+<FONT color="green">881</FONT>                    System.arraycopy(block, iRow * jWidth, outBlock, outIndex, jWidth);<a name="line.881"></a>
+<FONT color="green">882</FONT>                    outIndex += jWidth;<a name="line.882"></a>
+<FONT color="green">883</FONT>                }<a name="line.883"></a>
+<FONT color="green">884</FONT>            }<a name="line.884"></a>
+<FONT color="green">885</FONT>    <a name="line.885"></a>
+<FONT color="green">886</FONT>            return out;<a name="line.886"></a>
+<FONT color="green">887</FONT>    <a name="line.887"></a>
+<FONT color="green">888</FONT>        }<a name="line.888"></a>
+<FONT color="green">889</FONT>    <a name="line.889"></a>
+<FONT color="green">890</FONT>        /** {@inheritDoc} */<a name="line.890"></a>
+<FONT color="green">891</FONT>        @Override<a name="line.891"></a>
+<FONT color="green">892</FONT>        public void setRowMatrix(final int row, final FieldMatrix&lt;T&gt; matrix)<a name="line.892"></a>
+<FONT color="green">893</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.893"></a>
+<FONT color="green">894</FONT>            try {<a name="line.894"></a>
+<FONT color="green">895</FONT>                setRowMatrix(row, (BlockFieldMatrix&lt;T&gt;) matrix);<a name="line.895"></a>
+<FONT color="green">896</FONT>            } catch (ClassCastException cce) {<a name="line.896"></a>
+<FONT color="green">897</FONT>                super.setRowMatrix(row, matrix);<a name="line.897"></a>
+<FONT color="green">898</FONT>            }<a name="line.898"></a>
+<FONT color="green">899</FONT>        }<a name="line.899"></a>
+<FONT color="green">900</FONT>    <a name="line.900"></a>
+<FONT color="green">901</FONT>        /**<a name="line.901"></a>
+<FONT color="green">902</FONT>         * Sets the entries in row number &lt;code&gt;row&lt;/code&gt;<a name="line.902"></a>
+<FONT color="green">903</FONT>         * as a row matrix.  Row indices start at 0.<a name="line.903"></a>
+<FONT color="green">904</FONT>         *<a name="line.904"></a>
+<FONT color="green">905</FONT>         * @param row the row to be set<a name="line.905"></a>
+<FONT color="green">906</FONT>         * @param matrix row matrix (must have one row and the same number of columns<a name="line.906"></a>
+<FONT color="green">907</FONT>         * as the instance)<a name="line.907"></a>
+<FONT color="green">908</FONT>         * @throws MatrixIndexException if the specified row index is invalid<a name="line.908"></a>
+<FONT color="green">909</FONT>         * @throws InvalidMatrixException if the matrix dimensions do not match one<a name="line.909"></a>
+<FONT color="green">910</FONT>         * instance row<a name="line.910"></a>
+<FONT color="green">911</FONT>         */<a name="line.911"></a>
+<FONT color="green">912</FONT>        public void setRowMatrix(final int row, final BlockFieldMatrix&lt;T&gt; matrix)<a name="line.912"></a>
+<FONT color="green">913</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.913"></a>
+<FONT color="green">914</FONT>    <a name="line.914"></a>
+<FONT color="green">915</FONT>            checkRowIndex(row);<a name="line.915"></a>
+<FONT color="green">916</FONT>            final int nCols = getColumnDimension();<a name="line.916"></a>
+<FONT color="green">917</FONT>            if ((matrix.getRowDimension() != 1) ||<a name="line.917"></a>
+<FONT color="green">918</FONT>                (matrix.getColumnDimension() != nCols)) {<a name="line.918"></a>
+<FONT color="green">919</FONT>                throw new InvalidMatrixException(<a name="line.919"></a>
+<FONT color="green">920</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.920"></a>
+<FONT color="green">921</FONT>                        matrix.getRowDimension(), matrix.getColumnDimension(),<a name="line.921"></a>
+<FONT color="green">922</FONT>                        1, nCols);<a name="line.922"></a>
+<FONT color="green">923</FONT>            }<a name="line.923"></a>
+<FONT color="green">924</FONT>    <a name="line.924"></a>
+<FONT color="green">925</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.925"></a>
+<FONT color="green">926</FONT>            final int iBlock = row / BLOCK_SIZE;<a name="line.926"></a>
+<FONT color="green">927</FONT>            final int iRow   = row - iBlock * BLOCK_SIZE;<a name="line.927"></a>
+<FONT color="green">928</FONT>            int mBlockIndex  = 0;<a name="line.928"></a>
+<FONT color="green">929</FONT>            int mIndex       = 0;<a name="line.929"></a>
+<FONT color="green">930</FONT>            T[] mBlock  = matrix.blocks[mBlockIndex];<a name="line.930"></a>
+<FONT color="green">931</FONT>            for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.931"></a>
+<FONT color="green">932</FONT>                final int jWidth     = blockWidth(jBlock);<a name="line.932"></a>
+<FONT color="green">933</FONT>                final T[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.933"></a>
+<FONT color="green">934</FONT>                final int available  = mBlock.length - mIndex;<a name="line.934"></a>
+<FONT color="green">935</FONT>                if (jWidth &gt; available) {<a name="line.935"></a>
+<FONT color="green">936</FONT>                    System.arraycopy(mBlock, mIndex, block, iRow * jWidth, available);<a name="line.936"></a>
+<FONT color="green">937</FONT>                    mBlock = matrix.blocks[++mBlockIndex];<a name="line.937"></a>
+<FONT color="green">938</FONT>                    System.arraycopy(mBlock, 0, block, iRow * jWidth, jWidth - available);<a name="line.938"></a>
+<FONT color="green">939</FONT>                    mIndex = jWidth - available;<a name="line.939"></a>
+<FONT color="green">940</FONT>                } else {<a name="line.940"></a>
+<FONT color="green">941</FONT>                    System.arraycopy(mBlock, mIndex, block, iRow * jWidth, jWidth);<a name="line.941"></a>
+<FONT color="green">942</FONT>                    mIndex += jWidth;<a name="line.942"></a>
+<FONT color="green">943</FONT>               }<a name="line.943"></a>
+<FONT color="green">944</FONT>            }<a name="line.944"></a>
+<FONT color="green">945</FONT>    <a name="line.945"></a>
+<FONT color="green">946</FONT>        }<a name="line.946"></a>
+<FONT color="green">947</FONT>    <a name="line.947"></a>
+<FONT color="green">948</FONT>        /** {@inheritDoc} */<a name="line.948"></a>
+<FONT color="green">949</FONT>        @Override<a name="line.949"></a>
+<FONT color="green">950</FONT>        public FieldMatrix&lt;T&gt; getColumnMatrix(final int column)<a name="line.950"></a>
+<FONT color="green">951</FONT>            throws MatrixIndexException {<a name="line.951"></a>
+<FONT color="green">952</FONT>    <a name="line.952"></a>
+<FONT color="green">953</FONT>            checkColumnIndex(column);<a name="line.953"></a>
+<FONT color="green">954</FONT>            final BlockFieldMatrix&lt;T&gt; out = new BlockFieldMatrix&lt;T&gt;(getField(), rows, 1);<a name="line.954"></a>
+<FONT color="green">955</FONT>    <a name="line.955"></a>
+<FONT color="green">956</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.956"></a>
+<FONT color="green">957</FONT>            final int jBlock  = column / BLOCK_SIZE;<a name="line.957"></a>
+<FONT color="green">958</FONT>            final int jColumn = column - jBlock * BLOCK_SIZE;<a name="line.958"></a>
+<FONT color="green">959</FONT>            final int jWidth  = blockWidth(jBlock);<a name="line.959"></a>
+<FONT color="green">960</FONT>            int outBlockIndex = 0;<a name="line.960"></a>
+<FONT color="green">961</FONT>            int outIndex      = 0;<a name="line.961"></a>
+<FONT color="green">962</FONT>            T[] outBlock = out.blocks[outBlockIndex];<a name="line.962"></a>
+<FONT color="green">963</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.963"></a>
+<FONT color="green">964</FONT>                final int iHeight = blockHeight(iBlock);<a name="line.964"></a>
+<FONT color="green">965</FONT>                final T[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.965"></a>
+<FONT color="green">966</FONT>                for (int i = 0; i &lt; iHeight; ++i) {<a name="line.966"></a>
+<FONT color="green">967</FONT>                    if (outIndex &gt;= outBlock.length) {<a name="line.967"></a>
+<FONT color="green">968</FONT>                        outBlock = out.blocks[++outBlockIndex];<a name="line.968"></a>
+<FONT color="green">969</FONT>                        outIndex = 0;<a name="line.969"></a>
+<FONT color="green">970</FONT>                    }<a name="line.970"></a>
+<FONT color="green">971</FONT>                    outBlock[outIndex++] = block[i * jWidth + jColumn];<a name="line.971"></a>
+<FONT color="green">972</FONT>                }<a name="line.972"></a>
+<FONT color="green">973</FONT>            }<a name="line.973"></a>
+<FONT color="green">974</FONT>    <a name="line.974"></a>
+<FONT color="green">975</FONT>            return out;<a name="line.975"></a>
+<FONT color="green">976</FONT>    <a name="line.976"></a>
+<FONT color="green">977</FONT>        }<a name="line.977"></a>
+<FONT color="green">978</FONT>    <a name="line.978"></a>
+<FONT color="green">979</FONT>        /** {@inheritDoc} */<a name="line.979"></a>
+<FONT color="green">980</FONT>        @Override<a name="line.980"></a>
+<FONT color="green">981</FONT>        public void setColumnMatrix(final int column, final FieldMatrix&lt;T&gt; matrix)<a name="line.981"></a>
+<FONT color="green">982</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.982"></a>
+<FONT color="green">983</FONT>            try {<a name="line.983"></a>
+<FONT color="green">984</FONT>                setColumnMatrix(column, (BlockFieldMatrix&lt;T&gt;) matrix);<a name="line.984"></a>
+<FONT color="green">985</FONT>            } catch (ClassCastException cce) {<a name="line.985"></a>
+<FONT color="green">986</FONT>                super.setColumnMatrix(column, matrix);<a name="line.986"></a>
+<FONT color="green">987</FONT>            }<a name="line.987"></a>
+<FONT color="green">988</FONT>        }<a name="line.988"></a>
+<FONT color="green">989</FONT>    <a name="line.989"></a>
+<FONT color="green">990</FONT>        /**<a name="line.990"></a>
+<FONT color="green">991</FONT>         * Sets the entries in column number &lt;code&gt;column&lt;/code&gt;<a name="line.991"></a>
+<FONT color="green">992</FONT>         * as a column matrix.  Column indices start at 0.<a name="line.992"></a>
+<FONT color="green">993</FONT>         *<a name="line.993"></a>
+<FONT color="green">994</FONT>         * @param column the column to be set<a name="line.994"></a>
+<FONT color="green">995</FONT>         * @param matrix column matrix (must have one column and the same number of rows<a name="line.995"></a>
+<FONT color="green">996</FONT>         * as the instance)<a name="line.996"></a>
+<FONT color="green">997</FONT>         * @throws MatrixIndexException if the specified column index is invalid<a name="line.997"></a>
+<FONT color="green">998</FONT>         * @throws InvalidMatrixException if the matrix dimensions do not match one<a name="line.998"></a>
+<FONT color="green">999</FONT>         * instance column<a name="line.999"></a>
+<FONT color="green">1000</FONT>         */<a name="line.1000"></a>
+<FONT color="green">1001</FONT>        void setColumnMatrix(final int column, final BlockFieldMatrix&lt;T&gt; matrix)<a name="line.1001"></a>
+<FONT color="green">1002</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.1002"></a>
+<FONT color="green">1003</FONT>    <a name="line.1003"></a>
+<FONT color="green">1004</FONT>            checkColumnIndex(column);<a name="line.1004"></a>
+<FONT color="green">1005</FONT>            final int nRows = getRowDimension();<a name="line.1005"></a>
+<FONT color="green">1006</FONT>            if ((matrix.getRowDimension() != nRows) ||<a name="line.1006"></a>
+<FONT color="green">1007</FONT>                (matrix.getColumnDimension() != 1)) {<a name="line.1007"></a>
+<FONT color="green">1008</FONT>                throw new InvalidMatrixException(<a name="line.1008"></a>
+<FONT color="green">1009</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.1009"></a>
+<FONT color="green">1010</FONT>                        matrix.getRowDimension(), matrix.getColumnDimension(),<a name="line.1010"></a>
+<FONT color="green">1011</FONT>                        nRows, 1);<a name="line.1011"></a>
+<FONT color="green">1012</FONT>            }<a name="line.1012"></a>
+<FONT color="green">1013</FONT>    <a name="line.1013"></a>
+<FONT color="green">1014</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.1014"></a>
+<FONT color="green">1015</FONT>            final int jBlock  = column / BLOCK_SIZE;<a name="line.1015"></a>
+<FONT color="green">1016</FONT>            final int jColumn = column - jBlock * BLOCK_SIZE;<a name="line.1016"></a>
+<FONT color="green">1017</FONT>            final int jWidth  = blockWidth(jBlock);<a name="line.1017"></a>
+<FONT color="green">1018</FONT>            int mBlockIndex = 0;<a name="line.1018"></a>
+<FONT color="green">1019</FONT>            int mIndex      = 0;<a name="line.1019"></a>
+<FONT color="green">1020</FONT>            T[] mBlock = matrix.blocks[mBlockIndex];<a name="line.1020"></a>
+<FONT color="green">1021</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1021"></a>
+<FONT color="green">1022</FONT>                final int iHeight = blockHeight(iBlock);<a name="line.1022"></a>
+<FONT color="green">1023</FONT>                final T[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1023"></a>
+<FONT color="green">1024</FONT>                for (int i = 0; i &lt; iHeight; ++i) {<a name="line.1024"></a>
+<FONT color="green">1025</FONT>                    if (mIndex &gt;= mBlock.length) {<a name="line.1025"></a>
+<FONT color="green">1026</FONT>                        mBlock = matrix.blocks[++mBlockIndex];<a name="line.1026"></a>
+<FONT color="green">1027</FONT>                        mIndex = 0;<a name="line.1027"></a>
+<FONT color="green">1028</FONT>                    }<a name="line.1028"></a>
+<FONT color="green">1029</FONT>                    block[i * jWidth + jColumn] = mBlock[mIndex++];<a name="line.1029"></a>
+<FONT color="green">1030</FONT>                }<a name="line.1030"></a>
+<FONT color="green">1031</FONT>            }<a name="line.1031"></a>
+<FONT color="green">1032</FONT>    <a name="line.1032"></a>
+<FONT color="green">1033</FONT>        }<a name="line.1033"></a>
+<FONT color="green">1034</FONT>    <a name="line.1034"></a>
+<FONT color="green">1035</FONT>        /** {@inheritDoc} */<a name="line.1035"></a>
+<FONT color="green">1036</FONT>        @Override<a name="line.1036"></a>
+<FONT color="green">1037</FONT>        public FieldVector&lt;T&gt; getRowVector(final int row)<a name="line.1037"></a>
+<FONT color="green">1038</FONT>            throws MatrixIndexException {<a name="line.1038"></a>
+<FONT color="green">1039</FONT>    <a name="line.1039"></a>
+<FONT color="green">1040</FONT>            checkRowIndex(row);<a name="line.1040"></a>
+<FONT color="green">1041</FONT>            final T[] outData = buildArray(getField(), columns);<a name="line.1041"></a>
+<FONT color="green">1042</FONT>    <a name="line.1042"></a>
+<FONT color="green">1043</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.1043"></a>
+<FONT color="green">1044</FONT>            final int iBlock  = row / BLOCK_SIZE;<a name="line.1044"></a>
+<FONT color="green">1045</FONT>            final int iRow    = row - iBlock * BLOCK_SIZE;<a name="line.1045"></a>
+<FONT color="green">1046</FONT>            int outIndex      = 0;<a name="line.1046"></a>
+<FONT color="green">1047</FONT>            for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.1047"></a>
+<FONT color="green">1048</FONT>                final int jWidth     = blockWidth(jBlock);<a name="line.1048"></a>
+<FONT color="green">1049</FONT>                final T[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1049"></a>
+<FONT color="green">1050</FONT>                System.arraycopy(block, iRow * jWidth, outData, outIndex, jWidth);<a name="line.1050"></a>
+<FONT color="green">1051</FONT>                outIndex += jWidth;<a name="line.1051"></a>
+<FONT color="green">1052</FONT>            }<a name="line.1052"></a>
+<FONT color="green">1053</FONT>    <a name="line.1053"></a>
+<FONT color="green">1054</FONT>            return new ArrayFieldVector&lt;T&gt;(outData, false);<a name="line.1054"></a>
+<FONT color="green">1055</FONT>    <a name="line.1055"></a>
+<FONT color="green">1056</FONT>        }<a name="line.1056"></a>
+<FONT color="green">1057</FONT>    <a name="line.1057"></a>
+<FONT color="green">1058</FONT>        /** {@inheritDoc} */<a name="line.1058"></a>
+<FONT color="green">1059</FONT>        @Override<a name="line.1059"></a>
+<FONT color="green">1060</FONT>        public void setRowVector(final int row, final FieldVector&lt;T&gt; vector)<a name="line.1060"></a>
+<FONT color="green">1061</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.1061"></a>
+<FONT color="green">1062</FONT>            try {<a name="line.1062"></a>
+<FONT color="green">1063</FONT>                setRow(row, ((ArrayFieldVector&lt;T&gt;) vector).getDataRef());<a name="line.1063"></a>
+<FONT color="green">1064</FONT>            } catch (ClassCastException cce) {<a name="line.1064"></a>
+<FONT color="green">1065</FONT>                super.setRowVector(row, vector);<a name="line.1065"></a>
+<FONT color="green">1066</FONT>            }<a name="line.1066"></a>
+<FONT color="green">1067</FONT>        }<a name="line.1067"></a>
+<FONT color="green">1068</FONT>    <a name="line.1068"></a>
+<FONT color="green">1069</FONT>        /** {@inheritDoc} */<a name="line.1069"></a>
+<FONT color="green">1070</FONT>        @Override<a name="line.1070"></a>
+<FONT color="green">1071</FONT>        public FieldVector&lt;T&gt; getColumnVector(final int column)<a name="line.1071"></a>
+<FONT color="green">1072</FONT>            throws MatrixIndexException {<a name="line.1072"></a>
+<FONT color="green">1073</FONT>    <a name="line.1073"></a>
+<FONT color="green">1074</FONT>            checkColumnIndex(column);<a name="line.1074"></a>
+<FONT color="green">1075</FONT>            final T[] outData = buildArray(getField(), rows);<a name="line.1075"></a>
+<FONT color="green">1076</FONT>    <a name="line.1076"></a>
+<FONT color="green">1077</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.1077"></a>
+<FONT color="green">1078</FONT>            final int jBlock  = column / BLOCK_SIZE;<a name="line.1078"></a>
+<FONT color="green">1079</FONT>            final int jColumn = column - jBlock * BLOCK_SIZE;<a name="line.1079"></a>
+<FONT color="green">1080</FONT>            final int jWidth  = blockWidth(jBlock);<a name="line.1080"></a>
+<FONT color="green">1081</FONT>            int outIndex      = 0;<a name="line.1081"></a>
+<FONT color="green">1082</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1082"></a>
+<FONT color="green">1083</FONT>                final int iHeight = blockHeight(iBlock);<a name="line.1083"></a>
+<FONT color="green">1084</FONT>                final T[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1084"></a>
+<FONT color="green">1085</FONT>                for (int i = 0; i &lt; iHeight; ++i) {<a name="line.1085"></a>
+<FONT color="green">1086</FONT>                    outData[outIndex++] = block[i * jWidth + jColumn];<a name="line.1086"></a>
+<FONT color="green">1087</FONT>                }<a name="line.1087"></a>
+<FONT color="green">1088</FONT>            }<a name="line.1088"></a>
+<FONT color="green">1089</FONT>    <a name="line.1089"></a>
+<FONT color="green">1090</FONT>            return new ArrayFieldVector&lt;T&gt;(outData, false);<a name="line.1090"></a>
+<FONT color="green">1091</FONT>    <a name="line.1091"></a>
+<FONT color="green">1092</FONT>        }<a name="line.1092"></a>
+<FONT color="green">1093</FONT>    <a name="line.1093"></a>
+<FONT color="green">1094</FONT>        /** {@inheritDoc} */<a name="line.1094"></a>
+<FONT color="green">1095</FONT>        @Override<a name="line.1095"></a>
+<FONT color="green">1096</FONT>        public void setColumnVector(final int column, final FieldVector&lt;T&gt; vector)<a name="line.1096"></a>
+<FONT color="green">1097</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.1097"></a>
+<FONT color="green">1098</FONT>            try {<a name="line.1098"></a>
+<FONT color="green">1099</FONT>                setColumn(column, ((ArrayFieldVector&lt;T&gt;) vector).getDataRef());<a name="line.1099"></a>
+<FONT color="green">1100</FONT>            } catch (ClassCastException cce) {<a name="line.1100"></a>
+<FONT color="green">1101</FONT>                super.setColumnVector(column, vector);<a name="line.1101"></a>
+<FONT color="green">1102</FONT>            }<a name="line.1102"></a>
+<FONT color="green">1103</FONT>        }<a name="line.1103"></a>
+<FONT color="green">1104</FONT>    <a name="line.1104"></a>
+<FONT color="green">1105</FONT>        /** {@inheritDoc} */<a name="line.1105"></a>
+<FONT color="green">1106</FONT>        @Override<a name="line.1106"></a>
+<FONT color="green">1107</FONT>        public T[] getRow(final int row)<a name="line.1107"></a>
+<FONT color="green">1108</FONT>            throws MatrixIndexException {<a name="line.1108"></a>
+<FONT color="green">1109</FONT>    <a name="line.1109"></a>
+<FONT color="green">1110</FONT>            checkRowIndex(row);<a name="line.1110"></a>
+<FONT color="green">1111</FONT>            final T[] out = buildArray(getField(), columns);<a name="line.1111"></a>
+<FONT color="green">1112</FONT>    <a name="line.1112"></a>
+<FONT color="green">1113</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.1113"></a>
+<FONT color="green">1114</FONT>            final int iBlock  = row / BLOCK_SIZE;<a name="line.1114"></a>
+<FONT color="green">1115</FONT>            final int iRow    = row - iBlock * BLOCK_SIZE;<a name="line.1115"></a>
+<FONT color="green">1116</FONT>            int outIndex      = 0;<a name="line.1116"></a>
+<FONT color="green">1117</FONT>            for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.1117"></a>
+<FONT color="green">1118</FONT>                final int jWidth     = blockWidth(jBlock);<a name="line.1118"></a>
+<FONT color="green">1119</FONT>                final T[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1119"></a>
+<FONT color="green">1120</FONT>                System.arraycopy(block, iRow * jWidth, out, outIndex, jWidth);<a name="line.1120"></a>
+<FONT color="green">1121</FONT>                outIndex += jWidth;<a name="line.1121"></a>
+<FONT color="green">1122</FONT>            }<a name="line.1122"></a>
+<FONT color="green">1123</FONT>    <a name="line.1123"></a>
+<FONT color="green">1124</FONT>            return out;<a name="line.1124"></a>
+<FONT color="green">1125</FONT>    <a name="line.1125"></a>
+<FONT color="green">1126</FONT>        }<a name="line.1126"></a>
+<FONT color="green">1127</FONT>    <a name="line.1127"></a>
+<FONT color="green">1128</FONT>        /** {@inheritDoc} */<a name="line.1128"></a>
+<FONT color="green">1129</FONT>        @Override<a name="line.1129"></a>
+<FONT color="green">1130</FONT>        public void setRow(final int row, final T[] array)<a name="line.1130"></a>
+<FONT color="green">1131</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.1131"></a>
+<FONT color="green">1132</FONT>    <a name="line.1132"></a>
+<FONT color="green">1133</FONT>            checkRowIndex(row);<a name="line.1133"></a>
+<FONT color="green">1134</FONT>            final int nCols = getColumnDimension();<a name="line.1134"></a>
+<FONT color="green">1135</FONT>            if (array.length != nCols) {<a name="line.1135"></a>
+<FONT color="green">1136</FONT>                throw new InvalidMatrixException(<a name="line.1136"></a>
+<FONT color="green">1137</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.1137"></a>
+<FONT color="green">1138</FONT>                        1, array.length, 1, nCols);<a name="line.1138"></a>
+<FONT color="green">1139</FONT>            }<a name="line.1139"></a>
+<FONT color="green">1140</FONT>    <a name="line.1140"></a>
+<FONT color="green">1141</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.1141"></a>
+<FONT color="green">1142</FONT>            final int iBlock  = row / BLOCK_SIZE;<a name="line.1142"></a>
+<FONT color="green">1143</FONT>            final int iRow    = row - iBlock * BLOCK_SIZE;<a name="line.1143"></a>
+<FONT color="green">1144</FONT>            int outIndex      = 0;<a name="line.1144"></a>
+<FONT color="green">1145</FONT>            for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.1145"></a>
+<FONT color="green">1146</FONT>                final int jWidth     = blockWidth(jBlock);<a name="line.1146"></a>
+<FONT color="green">1147</FONT>                final T[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1147"></a>
+<FONT color="green">1148</FONT>                System.arraycopy(array, outIndex, block, iRow * jWidth, jWidth);<a name="line.1148"></a>
+<FONT color="green">1149</FONT>                outIndex += jWidth;<a name="line.1149"></a>
+<FONT color="green">1150</FONT>            }<a name="line.1150"></a>
+<FONT color="green">1151</FONT>    <a name="line.1151"></a>
+<FONT color="green">1152</FONT>        }<a name="line.1152"></a>
+<FONT color="green">1153</FONT>    <a name="line.1153"></a>
+<FONT color="green">1154</FONT>        /** {@inheritDoc} */<a name="line.1154"></a>
+<FONT color="green">1155</FONT>        @Override<a name="line.1155"></a>
+<FONT color="green">1156</FONT>        public T[] getColumn(final int column)<a name="line.1156"></a>
+<FONT color="green">1157</FONT>            throws MatrixIndexException {<a name="line.1157"></a>
+<FONT color="green">1158</FONT>    <a name="line.1158"></a>
+<FONT color="green">1159</FONT>            checkColumnIndex(column);<a name="line.1159"></a>
+<FONT color="green">1160</FONT>            final T[] out = buildArray(getField(), rows);<a name="line.1160"></a>
+<FONT color="green">1161</FONT>    <a name="line.1161"></a>
+<FONT color="green">1162</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.1162"></a>
+<FONT color="green">1163</FONT>            final int jBlock  = column / BLOCK_SIZE;<a name="line.1163"></a>
+<FONT color="green">1164</FONT>            final int jColumn = column - jBlock * BLOCK_SIZE;<a name="line.1164"></a>
+<FONT color="green">1165</FONT>            final int jWidth  = blockWidth(jBlock);<a name="line.1165"></a>
+<FONT color="green">1166</FONT>            int outIndex      = 0;<a name="line.1166"></a>
+<FONT color="green">1167</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1167"></a>
+<FONT color="green">1168</FONT>                final int iHeight = blockHeight(iBlock);<a name="line.1168"></a>
+<FONT color="green">1169</FONT>                final T[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1169"></a>
+<FONT color="green">1170</FONT>                for (int i = 0; i &lt; iHeight; ++i) {<a name="line.1170"></a>
+<FONT color="green">1171</FONT>                    out[outIndex++] = block[i * jWidth + jColumn];<a name="line.1171"></a>
+<FONT color="green">1172</FONT>                }<a name="line.1172"></a>
+<FONT color="green">1173</FONT>            }<a name="line.1173"></a>
+<FONT color="green">1174</FONT>    <a name="line.1174"></a>
+<FONT color="green">1175</FONT>            return out;<a name="line.1175"></a>
+<FONT color="green">1176</FONT>    <a name="line.1176"></a>
+<FONT color="green">1177</FONT>        }<a name="line.1177"></a>
+<FONT color="green">1178</FONT>    <a name="line.1178"></a>
+<FONT color="green">1179</FONT>        /** {@inheritDoc} */<a name="line.1179"></a>
+<FONT color="green">1180</FONT>        @Override<a name="line.1180"></a>
+<FONT color="green">1181</FONT>        public void setColumn(final int column, final T[] array)<a name="line.1181"></a>
+<FONT color="green">1182</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.1182"></a>
+<FONT color="green">1183</FONT>    <a name="line.1183"></a>
+<FONT color="green">1184</FONT>            checkColumnIndex(column);<a name="line.1184"></a>
+<FONT color="green">1185</FONT>            final int nRows = getRowDimension();<a name="line.1185"></a>
+<FONT color="green">1186</FONT>            if (array.length != nRows) {<a name="line.1186"></a>
+<FONT color="green">1187</FONT>                throw new InvalidMatrixException(<a name="line.1187"></a>
+<FONT color="green">1188</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.1188"></a>
+<FONT color="green">1189</FONT>                        array.length, 1, nRows, 1);<a name="line.1189"></a>
+<FONT color="green">1190</FONT>            }<a name="line.1190"></a>
+<FONT color="green">1191</FONT>    <a name="line.1191"></a>
+<FONT color="green">1192</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.1192"></a>
+<FONT color="green">1193</FONT>            final int jBlock  = column / BLOCK_SIZE;<a name="line.1193"></a>
+<FONT color="green">1194</FONT>            final int jColumn = column - jBlock * BLOCK_SIZE;<a name="line.1194"></a>
+<FONT color="green">1195</FONT>            final int jWidth  = blockWidth(jBlock);<a name="line.1195"></a>
+<FONT color="green">1196</FONT>            int outIndex      = 0;<a name="line.1196"></a>
+<FONT color="green">1197</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1197"></a>
+<FONT color="green">1198</FONT>                final int iHeight = blockHeight(iBlock);<a name="line.1198"></a>
+<FONT color="green">1199</FONT>                final T[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1199"></a>
+<FONT color="green">1200</FONT>                for (int i = 0; i &lt; iHeight; ++i) {<a name="line.1200"></a>
+<FONT color="green">1201</FONT>                    block[i * jWidth + jColumn] = array[outIndex++];<a name="line.1201"></a>
+<FONT color="green">1202</FONT>                }<a name="line.1202"></a>
+<FONT color="green">1203</FONT>            }<a name="line.1203"></a>
+<FONT color="green">1204</FONT>    <a name="line.1204"></a>
+<FONT color="green">1205</FONT>        }<a name="line.1205"></a>
+<FONT color="green">1206</FONT>    <a name="line.1206"></a>
+<FONT color="green">1207</FONT>        /** {@inheritDoc} */<a name="line.1207"></a>
+<FONT color="green">1208</FONT>        @Override<a name="line.1208"></a>
+<FONT color="green">1209</FONT>        public T getEntry(final int row, final int column)<a name="line.1209"></a>
+<FONT color="green">1210</FONT>            throws MatrixIndexException {<a name="line.1210"></a>
+<FONT color="green">1211</FONT>            try {<a name="line.1211"></a>
+<FONT color="green">1212</FONT>                final int iBlock = row    / BLOCK_SIZE;<a name="line.1212"></a>
+<FONT color="green">1213</FONT>                final int jBlock = column / BLOCK_SIZE;<a name="line.1213"></a>
+<FONT color="green">1214</FONT>                final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +<a name="line.1214"></a>
+<FONT color="green">1215</FONT>                                   (column - jBlock * BLOCK_SIZE);<a name="line.1215"></a>
+<FONT color="green">1216</FONT>                return blocks[iBlock * blockColumns + jBlock][k];<a name="line.1216"></a>
+<FONT color="green">1217</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.1217"></a>
+<FONT color="green">1218</FONT>                throw new MatrixIndexException(<a name="line.1218"></a>
+<FONT color="green">1219</FONT>                        "no entry at indices ({0}, {1}) in a {2}x{3} matrix",<a name="line.1219"></a>
+<FONT color="green">1220</FONT>                        row, column, getRowDimension(), getColumnDimension());<a name="line.1220"></a>
+<FONT color="green">1221</FONT>            }<a name="line.1221"></a>
+<FONT color="green">1222</FONT>        }<a name="line.1222"></a>
+<FONT color="green">1223</FONT>    <a name="line.1223"></a>
+<FONT color="green">1224</FONT>        /** {@inheritDoc} */<a name="line.1224"></a>
+<FONT color="green">1225</FONT>        @Override<a name="line.1225"></a>
+<FONT color="green">1226</FONT>        public void setEntry(final int row, final int column, final T value)<a name="line.1226"></a>
+<FONT color="green">1227</FONT>            throws MatrixIndexException {<a name="line.1227"></a>
+<FONT color="green">1228</FONT>            try {<a name="line.1228"></a>
+<FONT color="green">1229</FONT>                final int iBlock = row    / BLOCK_SIZE;<a name="line.1229"></a>
+<FONT color="green">1230</FONT>                final int jBlock = column / BLOCK_SIZE;<a name="line.1230"></a>
+<FONT color="green">1231</FONT>                final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +<a name="line.1231"></a>
+<FONT color="green">1232</FONT>                                   (column - jBlock * BLOCK_SIZE);<a name="line.1232"></a>
+<FONT color="green">1233</FONT>                blocks[iBlock * blockColumns + jBlock][k] = value;<a name="line.1233"></a>
+<FONT color="green">1234</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.1234"></a>
+<FONT color="green">1235</FONT>                throw new MatrixIndexException(<a name="line.1235"></a>
+<FONT color="green">1236</FONT>                        "no entry at indices ({0}, {1}) in a {2}x{3} matrix",<a name="line.1236"></a>
+<FONT color="green">1237</FONT>                        row, column, getRowDimension(), getColumnDimension());<a name="line.1237"></a>
+<FONT color="green">1238</FONT>            }<a name="line.1238"></a>
+<FONT color="green">1239</FONT>        }<a name="line.1239"></a>
+<FONT color="green">1240</FONT>    <a name="line.1240"></a>
+<FONT color="green">1241</FONT>        /** {@inheritDoc} */<a name="line.1241"></a>
+<FONT color="green">1242</FONT>        @Override<a name="line.1242"></a>
+<FONT color="green">1243</FONT>        public void addToEntry(final int row, final int column, final T increment)<a name="line.1243"></a>
+<FONT color="green">1244</FONT>            throws MatrixIndexException {<a name="line.1244"></a>
+<FONT color="green">1245</FONT>            try {<a name="line.1245"></a>
+<FONT color="green">1246</FONT>                final int iBlock = row    / BLOCK_SIZE;<a name="line.1246"></a>
+<FONT color="green">1247</FONT>                final int jBlock = column / BLOCK_SIZE;<a name="line.1247"></a>
+<FONT color="green">1248</FONT>                final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +<a name="line.1248"></a>
+<FONT color="green">1249</FONT>                                   (column - jBlock * BLOCK_SIZE);<a name="line.1249"></a>
+<FONT color="green">1250</FONT>                final T[] blockIJ = blocks[iBlock * blockColumns + jBlock];<a name="line.1250"></a>
+<FONT color="green">1251</FONT>                blockIJ[k] = blockIJ[k].add(increment);<a name="line.1251"></a>
+<FONT color="green">1252</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.1252"></a>
+<FONT color="green">1253</FONT>                throw new MatrixIndexException(<a name="line.1253"></a>
+<FONT color="green">1254</FONT>                        "no entry at indices ({0}, {1}) in a {2}x{3} matrix",<a name="line.1254"></a>
+<FONT color="green">1255</FONT>                        row, column, getRowDimension(), getColumnDimension());<a name="line.1255"></a>
+<FONT color="green">1256</FONT>            }<a name="line.1256"></a>
+<FONT color="green">1257</FONT>        }<a name="line.1257"></a>
+<FONT color="green">1258</FONT>    <a name="line.1258"></a>
+<FONT color="green">1259</FONT>        /** {@inheritDoc} */<a name="line.1259"></a>
+<FONT color="green">1260</FONT>        @Override<a name="line.1260"></a>
+<FONT color="green">1261</FONT>        public void multiplyEntry(final int row, final int column, final T factor)<a name="line.1261"></a>
+<FONT color="green">1262</FONT>            throws MatrixIndexException {<a name="line.1262"></a>
+<FONT color="green">1263</FONT>            try {<a name="line.1263"></a>
+<FONT color="green">1264</FONT>                final int iBlock = row    / BLOCK_SIZE;<a name="line.1264"></a>
+<FONT color="green">1265</FONT>                final int jBlock = column / BLOCK_SIZE;<a name="line.1265"></a>
+<FONT color="green">1266</FONT>                final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +<a name="line.1266"></a>
+<FONT color="green">1267</FONT>                                   (column - jBlock * BLOCK_SIZE);<a name="line.1267"></a>
+<FONT color="green">1268</FONT>                final T[] blockIJ = blocks[iBlock * blockColumns + jBlock];<a name="line.1268"></a>
+<FONT color="green">1269</FONT>                blockIJ[k] = blockIJ[k].multiply(factor);<a name="line.1269"></a>
+<FONT color="green">1270</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.1270"></a>
+<FONT color="green">1271</FONT>                throw new MatrixIndexException(<a name="line.1271"></a>
+<FONT color="green">1272</FONT>                        "no entry at indices ({0}, {1}) in a {2}x{3} matrix",<a name="line.1272"></a>
+<FONT color="green">1273</FONT>                        row, column, getRowDimension(), getColumnDimension());<a name="line.1273"></a>
+<FONT color="green">1274</FONT>            }<a name="line.1274"></a>
+<FONT color="green">1275</FONT>        }<a name="line.1275"></a>
+<FONT color="green">1276</FONT>    <a name="line.1276"></a>
+<FONT color="green">1277</FONT>        /** {@inheritDoc} */<a name="line.1277"></a>
+<FONT color="green">1278</FONT>        @Override<a name="line.1278"></a>
+<FONT color="green">1279</FONT>        public FieldMatrix&lt;T&gt; transpose() {<a name="line.1279"></a>
+<FONT color="green">1280</FONT>    <a name="line.1280"></a>
+<FONT color="green">1281</FONT>            final int nRows = getRowDimension();<a name="line.1281"></a>
+<FONT color="green">1282</FONT>            final int nCols = getColumnDimension();<a name="line.1282"></a>
+<FONT color="green">1283</FONT>            final BlockFieldMatrix&lt;T&gt; out = new BlockFieldMatrix&lt;T&gt;(getField(), nCols, nRows);<a name="line.1283"></a>
+<FONT color="green">1284</FONT>    <a name="line.1284"></a>
+<FONT color="green">1285</FONT>            // perform transpose block-wise, to ensure good cache behavior<a name="line.1285"></a>
+<FONT color="green">1286</FONT>            int blockIndex = 0;<a name="line.1286"></a>
+<FONT color="green">1287</FONT>            for (int iBlock = 0; iBlock &lt; blockColumns; ++iBlock) {<a name="line.1287"></a>
+<FONT color="green">1288</FONT>                for (int jBlock = 0; jBlock &lt; blockRows; ++jBlock) {<a name="line.1288"></a>
+<FONT color="green">1289</FONT>    <a name="line.1289"></a>
+<FONT color="green">1290</FONT>                    // transpose current block<a name="line.1290"></a>
+<FONT color="green">1291</FONT>                    final T[] outBlock = out.blocks[blockIndex];<a name="line.1291"></a>
+<FONT color="green">1292</FONT>                    final T[] tBlock   = blocks[jBlock * blockColumns + iBlock];<a name="line.1292"></a>
+<FONT color="green">1293</FONT>                    final int      pStart   = iBlock * BLOCK_SIZE;<a name="line.1293"></a>
+<FONT color="green">1294</FONT>                    final int      pEnd     = Math.min(pStart + BLOCK_SIZE, columns);<a name="line.1294"></a>
+<FONT color="green">1295</FONT>                    final int      qStart   = jBlock * BLOCK_SIZE;<a name="line.1295"></a>
+<FONT color="green">1296</FONT>                    final int      qEnd     = Math.min(qStart + BLOCK_SIZE, rows);<a name="line.1296"></a>
+<FONT color="green">1297</FONT>                    int k = 0;<a name="line.1297"></a>
+<FONT color="green">1298</FONT>                    for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1298"></a>
+<FONT color="green">1299</FONT>                        final int lInc = pEnd - pStart;<a name="line.1299"></a>
+<FONT color="green">1300</FONT>                        int l = p - pStart;<a name="line.1300"></a>
+<FONT color="green">1301</FONT>                        for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1301"></a>
+<FONT color="green">1302</FONT>                            outBlock[k] = tBlock[l];<a name="line.1302"></a>
+<FONT color="green">1303</FONT>                            ++k;<a name="line.1303"></a>
+<FONT color="green">1304</FONT>                            l+= lInc;<a name="line.1304"></a>
+<FONT color="green">1305</FONT>                        }<a name="line.1305"></a>
+<FONT color="green">1306</FONT>                    }<a name="line.1306"></a>
+<FONT color="green">1307</FONT>    <a name="line.1307"></a>
+<FONT color="green">1308</FONT>                    // go to next block<a name="line.1308"></a>
+<FONT color="green">1309</FONT>                    ++blockIndex;<a name="line.1309"></a>
+<FONT color="green">1310</FONT>    <a name="line.1310"></a>
+<FONT color="green">1311</FONT>                }<a name="line.1311"></a>
+<FONT color="green">1312</FONT>            }<a name="line.1312"></a>
+<FONT color="green">1313</FONT>    <a name="line.1313"></a>
+<FONT color="green">1314</FONT>            return out;<a name="line.1314"></a>
+<FONT color="green">1315</FONT>    <a name="line.1315"></a>
+<FONT color="green">1316</FONT>        }<a name="line.1316"></a>
+<FONT color="green">1317</FONT>    <a name="line.1317"></a>
+<FONT color="green">1318</FONT>        /** {@inheritDoc} */<a name="line.1318"></a>
+<FONT color="green">1319</FONT>        @Override<a name="line.1319"></a>
+<FONT color="green">1320</FONT>        public int getRowDimension() {<a name="line.1320"></a>
+<FONT color="green">1321</FONT>            return rows;<a name="line.1321"></a>
+<FONT color="green">1322</FONT>        }<a name="line.1322"></a>
+<FONT color="green">1323</FONT>    <a name="line.1323"></a>
+<FONT color="green">1324</FONT>        /** {@inheritDoc} */<a name="line.1324"></a>
+<FONT color="green">1325</FONT>        @Override<a name="line.1325"></a>
+<FONT color="green">1326</FONT>        public int getColumnDimension() {<a name="line.1326"></a>
+<FONT color="green">1327</FONT>            return columns;<a name="line.1327"></a>
+<FONT color="green">1328</FONT>        }<a name="line.1328"></a>
+<FONT color="green">1329</FONT>    <a name="line.1329"></a>
+<FONT color="green">1330</FONT>        /** {@inheritDoc} */<a name="line.1330"></a>
+<FONT color="green">1331</FONT>        @Override<a name="line.1331"></a>
+<FONT color="green">1332</FONT>        public T[] operate(final T[] v)<a name="line.1332"></a>
+<FONT color="green">1333</FONT>            throws IllegalArgumentException {<a name="line.1333"></a>
+<FONT color="green">1334</FONT>    <a name="line.1334"></a>
+<FONT color="green">1335</FONT>            if (v.length != columns) {<a name="line.1335"></a>
+<FONT color="green">1336</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1336"></a>
+<FONT color="green">1337</FONT>                        "vector length mismatch: got {0} but expected {1}",<a name="line.1337"></a>
+<FONT color="green">1338</FONT>                        v.length, columns);<a name="line.1338"></a>
+<FONT color="green">1339</FONT>            }<a name="line.1339"></a>
+<FONT color="green">1340</FONT>            final T[] out = buildArray(getField(), rows);<a name="line.1340"></a>
+<FONT color="green">1341</FONT>            final T zero = getField().getZero();<a name="line.1341"></a>
+<FONT color="green">1342</FONT>    <a name="line.1342"></a>
+<FONT color="green">1343</FONT>            // perform multiplication block-wise, to ensure good cache behavior<a name="line.1343"></a>
+<FONT color="green">1344</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1344"></a>
+<FONT color="green">1345</FONT>                final int pStart = iBlock * BLOCK_SIZE;<a name="line.1345"></a>
+<FONT color="green">1346</FONT>                final int pEnd   = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.1346"></a>
+<FONT color="green">1347</FONT>                for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.1347"></a>
+<FONT color="green">1348</FONT>                    final T[] block  = blocks[iBlock * blockColumns + jBlock];<a name="line.1348"></a>
+<FONT color="green">1349</FONT>                    final int      qStart = jBlock * BLOCK_SIZE;<a name="line.1349"></a>
+<FONT color="green">1350</FONT>                    final int      qEnd   = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.1350"></a>
+<FONT color="green">1351</FONT>                    int k = 0;<a name="line.1351"></a>
+<FONT color="green">1352</FONT>                    for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1352"></a>
+<FONT color="green">1353</FONT>                        T sum = zero;<a name="line.1353"></a>
+<FONT color="green">1354</FONT>                        int q = qStart;<a name="line.1354"></a>
+<FONT color="green">1355</FONT>                        while (q &lt; qEnd - 3) {<a name="line.1355"></a>
+<FONT color="green">1356</FONT>                            sum = sum.<a name="line.1356"></a>
+<FONT color="green">1357</FONT>                                  add(block[k].multiply(v[q])).<a name="line.1357"></a>
+<FONT color="green">1358</FONT>                                  add(block[k + 1].multiply(v[q + 1])).<a name="line.1358"></a>
+<FONT color="green">1359</FONT>                                  add(block[k + 2].multiply(v[q + 2])).<a name="line.1359"></a>
+<FONT color="green">1360</FONT>                                  add(block[k + 3].multiply(v[q + 3]));<a name="line.1360"></a>
+<FONT color="green">1361</FONT>                            k += 4;<a name="line.1361"></a>
+<FONT color="green">1362</FONT>                            q += 4;<a name="line.1362"></a>
+<FONT color="green">1363</FONT>                        }<a name="line.1363"></a>
+<FONT color="green">1364</FONT>                        while (q &lt; qEnd) {<a name="line.1364"></a>
+<FONT color="green">1365</FONT>                            sum = sum.add(block[k++].multiply(v[q++]));<a name="line.1365"></a>
+<FONT color="green">1366</FONT>                        }<a name="line.1366"></a>
+<FONT color="green">1367</FONT>                        out[p] = out[p].add(sum);<a name="line.1367"></a>
+<FONT color="green">1368</FONT>                    }<a name="line.1368"></a>
+<FONT color="green">1369</FONT>                }<a name="line.1369"></a>
+<FONT color="green">1370</FONT>            }<a name="line.1370"></a>
+<FONT color="green">1371</FONT>    <a name="line.1371"></a>
+<FONT color="green">1372</FONT>            return out;<a name="line.1372"></a>
+<FONT color="green">1373</FONT>    <a name="line.1373"></a>
+<FONT color="green">1374</FONT>        }<a name="line.1374"></a>
+<FONT color="green">1375</FONT>    <a name="line.1375"></a>
+<FONT color="green">1376</FONT>        /** {@inheritDoc} */<a name="line.1376"></a>
+<FONT color="green">1377</FONT>        @Override<a name="line.1377"></a>
+<FONT color="green">1378</FONT>        public T[] preMultiply(final T[] v)<a name="line.1378"></a>
+<FONT color="green">1379</FONT>            throws IllegalArgumentException {<a name="line.1379"></a>
+<FONT color="green">1380</FONT>    <a name="line.1380"></a>
+<FONT color="green">1381</FONT>            if (v.length != rows) {<a name="line.1381"></a>
+<FONT color="green">1382</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1382"></a>
+<FONT color="green">1383</FONT>                        "vector length mismatch: got {0} but expected {1}",<a name="line.1383"></a>
+<FONT color="green">1384</FONT>                        v.length, rows);<a name="line.1384"></a>
+<FONT color="green">1385</FONT>            }<a name="line.1385"></a>
+<FONT color="green">1386</FONT>            final T[] out = buildArray(getField(), columns);<a name="line.1386"></a>
+<FONT color="green">1387</FONT>            final T zero = getField().getZero();<a name="line.1387"></a>
+<FONT color="green">1388</FONT>    <a name="line.1388"></a>
+<FONT color="green">1389</FONT>            // perform multiplication block-wise, to ensure good cache behavior<a name="line.1389"></a>
+<FONT color="green">1390</FONT>            for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.1390"></a>
+<FONT color="green">1391</FONT>                final int jWidth  = blockWidth(jBlock);<a name="line.1391"></a>
+<FONT color="green">1392</FONT>                final int jWidth2 = jWidth  + jWidth;<a name="line.1392"></a>
+<FONT color="green">1393</FONT>                final int jWidth3 = jWidth2 + jWidth;<a name="line.1393"></a>
+<FONT color="green">1394</FONT>                final int jWidth4 = jWidth3 + jWidth;<a name="line.1394"></a>
+<FONT color="green">1395</FONT>                final int qStart = jBlock * BLOCK_SIZE;<a name="line.1395"></a>
+<FONT color="green">1396</FONT>                final int qEnd   = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.1396"></a>
+<FONT color="green">1397</FONT>                for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1397"></a>
+<FONT color="green">1398</FONT>                    final T[] block  = blocks[iBlock * blockColumns + jBlock];<a name="line.1398"></a>
+<FONT color="green">1399</FONT>                    final int      pStart = iBlock * BLOCK_SIZE;<a name="line.1399"></a>
+<FONT color="green">1400</FONT>                    final int      pEnd   = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.1400"></a>
+<FONT color="green">1401</FONT>                    for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1401"></a>
+<FONT color="green">1402</FONT>                        int k = q - qStart;<a name="line.1402"></a>
+<FONT color="green">1403</FONT>                        T sum = zero;<a name="line.1403"></a>
+<FONT color="green">1404</FONT>                        int p = pStart;<a name="line.1404"></a>
+<FONT color="green">1405</FONT>                        while (p &lt; pEnd - 3) {<a name="line.1405"></a>
+<FONT color="green">1406</FONT>                            sum = sum.<a name="line.1406"></a>
+<FONT color="green">1407</FONT>                                  add(block[k].multiply(v[p])).<a name="line.1407"></a>
+<FONT color="green">1408</FONT>                                  add(block[k + jWidth].multiply(v[p + 1])).<a name="line.1408"></a>
+<FONT color="green">1409</FONT>                                  add(block[k + jWidth2].multiply(v[p + 2])).<a name="line.1409"></a>
+<FONT color="green">1410</FONT>                                  add(block[k + jWidth3].multiply(v[p + 3]));<a name="line.1410"></a>
+<FONT color="green">1411</FONT>                            k += jWidth4;<a name="line.1411"></a>
+<FONT color="green">1412</FONT>                            p += 4;<a name="line.1412"></a>
+<FONT color="green">1413</FONT>                        }<a name="line.1413"></a>
+<FONT color="green">1414</FONT>                        while (p &lt; pEnd) {<a name="line.1414"></a>
+<FONT color="green">1415</FONT>                            sum = sum.add(block[k].multiply(v[p++]));<a name="line.1415"></a>
+<FONT color="green">1416</FONT>                            k += jWidth;<a name="line.1416"></a>
+<FONT color="green">1417</FONT>                        }<a name="line.1417"></a>
+<FONT color="green">1418</FONT>                        out[q] = out[q].add(sum);<a name="line.1418"></a>
+<FONT color="green">1419</FONT>                    }<a name="line.1419"></a>
+<FONT color="green">1420</FONT>                }<a name="line.1420"></a>
+<FONT color="green">1421</FONT>            }<a name="line.1421"></a>
+<FONT color="green">1422</FONT>    <a name="line.1422"></a>
+<FONT color="green">1423</FONT>            return out;<a name="line.1423"></a>
+<FONT color="green">1424</FONT>    <a name="line.1424"></a>
+<FONT color="green">1425</FONT>        }<a name="line.1425"></a>
+<FONT color="green">1426</FONT>    <a name="line.1426"></a>
+<FONT color="green">1427</FONT>        /** {@inheritDoc} */<a name="line.1427"></a>
+<FONT color="green">1428</FONT>        @Override<a name="line.1428"></a>
+<FONT color="green">1429</FONT>        public T walkInRowOrder(final FieldMatrixChangingVisitor&lt;T&gt; visitor)<a name="line.1429"></a>
+<FONT color="green">1430</FONT>            throws MatrixVisitorException {<a name="line.1430"></a>
+<FONT color="green">1431</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.1431"></a>
+<FONT color="green">1432</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1432"></a>
+<FONT color="green">1433</FONT>                final int pStart = iBlock * BLOCK_SIZE;<a name="line.1433"></a>
+<FONT color="green">1434</FONT>                final int pEnd   = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.1434"></a>
+<FONT color="green">1435</FONT>                for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1435"></a>
+<FONT color="green">1436</FONT>                    for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.1436"></a>
+<FONT color="green">1437</FONT>                        final int jWidth = blockWidth(jBlock);<a name="line.1437"></a>
+<FONT color="green">1438</FONT>                        final int qStart = jBlock * BLOCK_SIZE;<a name="line.1438"></a>
+<FONT color="green">1439</FONT>                        final int qEnd   = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.1439"></a>
+<FONT color="green">1440</FONT>                        final T[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1440"></a>
+<FONT color="green">1441</FONT>                        int k = (p - pStart) * jWidth;<a name="line.1441"></a>
+<FONT color="green">1442</FONT>                        for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1442"></a>
+<FONT color="green">1443</FONT>                            block[k] = visitor.visit(p, q, block[k]);<a name="line.1443"></a>
+<FONT color="green">1444</FONT>                            ++k;<a name="line.1444"></a>
+<FONT color="green">1445</FONT>                        }<a name="line.1445"></a>
+<FONT color="green">1446</FONT>                    }<a name="line.1446"></a>
+<FONT color="green">1447</FONT>                 }<a name="line.1447"></a>
+<FONT color="green">1448</FONT>            }<a name="line.1448"></a>
+<FONT color="green">1449</FONT>            return visitor.end();<a name="line.1449"></a>
+<FONT color="green">1450</FONT>        }<a name="line.1450"></a>
+<FONT color="green">1451</FONT>    <a name="line.1451"></a>
+<FONT color="green">1452</FONT>        /** {@inheritDoc} */<a name="line.1452"></a>
+<FONT color="green">1453</FONT>        @Override<a name="line.1453"></a>
+<FONT color="green">1454</FONT>        public T walkInRowOrder(final FieldMatrixPreservingVisitor&lt;T&gt; visitor)<a name="line.1454"></a>
+<FONT color="green">1455</FONT>            throws MatrixVisitorException {<a name="line.1455"></a>
+<FONT color="green">1456</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.1456"></a>
+<FONT color="green">1457</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1457"></a>
+<FONT color="green">1458</FONT>                final int pStart = iBlock * BLOCK_SIZE;<a name="line.1458"></a>
+<FONT color="green">1459</FONT>                final int pEnd   = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.1459"></a>
+<FONT color="green">1460</FONT>                for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1460"></a>
+<FONT color="green">1461</FONT>                    for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.1461"></a>
+<FONT color="green">1462</FONT>                        final int jWidth = blockWidth(jBlock);<a name="line.1462"></a>
+<FONT color="green">1463</FONT>                        final int qStart = jBlock * BLOCK_SIZE;<a name="line.1463"></a>
+<FONT color="green">1464</FONT>                        final int qEnd   = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.1464"></a>
+<FONT color="green">1465</FONT>                        final T[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1465"></a>
+<FONT color="green">1466</FONT>                        int k = (p - pStart) * jWidth;<a name="line.1466"></a>
+<FONT color="green">1467</FONT>                        for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1467"></a>
+<FONT color="green">1468</FONT>                            visitor.visit(p, q, block[k]);<a name="line.1468"></a>
+<FONT color="green">1469</FONT>                            ++k;<a name="line.1469"></a>
+<FONT color="green">1470</FONT>                        }<a name="line.1470"></a>
+<FONT color="green">1471</FONT>                    }<a name="line.1471"></a>
+<FONT color="green">1472</FONT>                 }<a name="line.1472"></a>
+<FONT color="green">1473</FONT>            }<a name="line.1473"></a>
+<FONT color="green">1474</FONT>            return visitor.end();<a name="line.1474"></a>
+<FONT color="green">1475</FONT>        }<a name="line.1475"></a>
+<FONT color="green">1476</FONT>    <a name="line.1476"></a>
+<FONT color="green">1477</FONT>        /** {@inheritDoc} */<a name="line.1477"></a>
+<FONT color="green">1478</FONT>        @Override<a name="line.1478"></a>
+<FONT color="green">1479</FONT>        public T walkInRowOrder(final FieldMatrixChangingVisitor&lt;T&gt; visitor,<a name="line.1479"></a>
+<FONT color="green">1480</FONT>                                     final int startRow, final int endRow,<a name="line.1480"></a>
+<FONT color="green">1481</FONT>                                     final int startColumn, final int endColumn)<a name="line.1481"></a>
+<FONT color="green">1482</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.1482"></a>
+<FONT color="green">1483</FONT>            checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);<a name="line.1483"></a>
+<FONT color="green">1484</FONT>            visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);<a name="line.1484"></a>
+<FONT color="green">1485</FONT>            for (int iBlock = startRow / BLOCK_SIZE; iBlock &lt; 1 + endRow / BLOCK_SIZE; ++iBlock) {<a name="line.1485"></a>
+<FONT color="green">1486</FONT>                final int p0     = iBlock * BLOCK_SIZE;<a name="line.1486"></a>
+<FONT color="green">1487</FONT>                final int pStart = Math.max(startRow, p0);<a name="line.1487"></a>
+<FONT color="green">1488</FONT>                final int pEnd   = Math.min((iBlock + 1) * BLOCK_SIZE, 1 + endRow);<a name="line.1488"></a>
+<FONT color="green">1489</FONT>                for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1489"></a>
+<FONT color="green">1490</FONT>                    for (int jBlock = startColumn / BLOCK_SIZE; jBlock &lt; 1 + endColumn / BLOCK_SIZE; ++jBlock) {<a name="line.1490"></a>
+<FONT color="green">1491</FONT>                        final int jWidth = blockWidth(jBlock);<a name="line.1491"></a>
+<FONT color="green">1492</FONT>                        final int q0     = jBlock * BLOCK_SIZE;<a name="line.1492"></a>
+<FONT color="green">1493</FONT>                        final int qStart = Math.max(startColumn, q0);<a name="line.1493"></a>
+<FONT color="green">1494</FONT>                        final int qEnd   = Math.min((jBlock + 1) * BLOCK_SIZE, 1 + endColumn);<a name="line.1494"></a>
+<FONT color="green">1495</FONT>                        final T[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1495"></a>
+<FONT color="green">1496</FONT>                        int k = (p - p0) * jWidth + qStart - q0;<a name="line.1496"></a>
+<FONT color="green">1497</FONT>                        for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1497"></a>
+<FONT color="green">1498</FONT>                            block[k] = visitor.visit(p, q, block[k]);<a name="line.1498"></a>
+<FONT color="green">1499</FONT>                            ++k;<a name="line.1499"></a>
+<FONT color="green">1500</FONT>                        }<a name="line.1500"></a>
+<FONT color="green">1501</FONT>                    }<a name="line.1501"></a>
+<FONT color="green">1502</FONT>                 }<a name="line.1502"></a>
+<FONT color="green">1503</FONT>            }<a name="line.1503"></a>
+<FONT color="green">1504</FONT>            return visitor.end();<a name="line.1504"></a>
+<FONT color="green">1505</FONT>        }<a name="line.1505"></a>
+<FONT color="green">1506</FONT>    <a name="line.1506"></a>
+<FONT color="green">1507</FONT>        /** {@inheritDoc} */<a name="line.1507"></a>
+<FONT color="green">1508</FONT>        @Override<a name="line.1508"></a>
+<FONT color="green">1509</FONT>        public T walkInRowOrder(final FieldMatrixPreservingVisitor&lt;T&gt; visitor,<a name="line.1509"></a>
+<FONT color="green">1510</FONT>                                     final int startRow, final int endRow,<a name="line.1510"></a>
+<FONT color="green">1511</FONT>                                     final int startColumn, final int endColumn)<a name="line.1511"></a>
+<FONT color="green">1512</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.1512"></a>
+<FONT color="green">1513</FONT>            checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);<a name="line.1513"></a>
+<FONT color="green">1514</FONT>            visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);<a name="line.1514"></a>
+<FONT color="green">1515</FONT>            for (int iBlock = startRow / BLOCK_SIZE; iBlock &lt; 1 + endRow / BLOCK_SIZE; ++iBlock) {<a name="line.1515"></a>
+<FONT color="green">1516</FONT>                final int p0     = iBlock * BLOCK_SIZE;<a name="line.1516"></a>
+<FONT color="green">1517</FONT>                final int pStart = Math.max(startRow, p0);<a name="line.1517"></a>
+<FONT color="green">1518</FONT>                final int pEnd   = Math.min((iBlock + 1) * BLOCK_SIZE, 1 + endRow);<a name="line.1518"></a>
+<FONT color="green">1519</FONT>                for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1519"></a>
+<FONT color="green">1520</FONT>                    for (int jBlock = startColumn / BLOCK_SIZE; jBlock &lt; 1 + endColumn / BLOCK_SIZE; ++jBlock) {<a name="line.1520"></a>
+<FONT color="green">1521</FONT>                        final int jWidth = blockWidth(jBlock);<a name="line.1521"></a>
+<FONT color="green">1522</FONT>                        final int q0     = jBlock * BLOCK_SIZE;<a name="line.1522"></a>
+<FONT color="green">1523</FONT>                        final int qStart = Math.max(startColumn, q0);<a name="line.1523"></a>
+<FONT color="green">1524</FONT>                        final int qEnd   = Math.min((jBlock + 1) * BLOCK_SIZE, 1 + endColumn);<a name="line.1524"></a>
+<FONT color="green">1525</FONT>                        final T[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1525"></a>
+<FONT color="green">1526</FONT>                        int k = (p - p0) * jWidth + qStart - q0;<a name="line.1526"></a>
+<FONT color="green">1527</FONT>                        for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1527"></a>
+<FONT color="green">1528</FONT>                            visitor.visit(p, q, block[k]);<a name="line.1528"></a>
+<FONT color="green">1529</FONT>                            ++k;<a name="line.1529"></a>
+<FONT color="green">1530</FONT>                        }<a name="line.1530"></a>
+<FONT color="green">1531</FONT>                    }<a name="line.1531"></a>
+<FONT color="green">1532</FONT>                 }<a name="line.1532"></a>
+<FONT color="green">1533</FONT>            }<a name="line.1533"></a>
+<FONT color="green">1534</FONT>            return visitor.end();<a name="line.1534"></a>
+<FONT color="green">1535</FONT>        }<a name="line.1535"></a>
+<FONT color="green">1536</FONT>    <a name="line.1536"></a>
+<FONT color="green">1537</FONT>        /** {@inheritDoc} */<a name="line.1537"></a>
+<FONT color="green">1538</FONT>        @Override<a name="line.1538"></a>
+<FONT color="green">1539</FONT>        public T walkInOptimizedOrder(final FieldMatrixChangingVisitor&lt;T&gt; visitor)<a name="line.1539"></a>
+<FONT color="green">1540</FONT>            throws MatrixVisitorException {<a name="line.1540"></a>
+<FONT color="green">1541</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.1541"></a>
+<FONT color="green">1542</FONT>            int blockIndex = 0;<a name="line.1542"></a>
+<FONT color="green">1543</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1543"></a>
+<FONT color="green">1544</FONT>                final int pStart = iBlock * BLOCK_SIZE;<a name="line.1544"></a>
+<FONT color="green">1545</FONT>                final int pEnd   = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.1545"></a>
+<FONT color="green">1546</FONT>                for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.1546"></a>
+<FONT color="green">1547</FONT>                    final int qStart = jBlock * BLOCK_SIZE;<a name="line.1547"></a>
+<FONT color="green">1548</FONT>                    final int qEnd   = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.1548"></a>
+<FONT color="green">1549</FONT>                    final T[] block = blocks[blockIndex];<a name="line.1549"></a>
+<FONT color="green">1550</FONT>                    int k = 0;<a name="line.1550"></a>
+<FONT color="green">1551</FONT>                    for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1551"></a>
+<FONT color="green">1552</FONT>                        for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1552"></a>
+<FONT color="green">1553</FONT>                            block[k] = visitor.visit(p, q, block[k]);<a name="line.1553"></a>
+<FONT color="green">1554</FONT>                            ++k;<a name="line.1554"></a>
+<FONT color="green">1555</FONT>                        }<a name="line.1555"></a>
+<FONT color="green">1556</FONT>                    }<a name="line.1556"></a>
+<FONT color="green">1557</FONT>                    ++blockIndex;<a name="line.1557"></a>
+<FONT color="green">1558</FONT>                }<a name="line.1558"></a>
+<FONT color="green">1559</FONT>            }<a name="line.1559"></a>
+<FONT color="green">1560</FONT>            return visitor.end();<a name="line.1560"></a>
+<FONT color="green">1561</FONT>        }<a name="line.1561"></a>
+<FONT color="green">1562</FONT>    <a name="line.1562"></a>
+<FONT color="green">1563</FONT>        /** {@inheritDoc} */<a name="line.1563"></a>
+<FONT color="green">1564</FONT>        @Override<a name="line.1564"></a>
+<FONT color="green">1565</FONT>        public T walkInOptimizedOrder(final FieldMatrixPreservingVisitor&lt;T&gt; visitor)<a name="line.1565"></a>
+<FONT color="green">1566</FONT>            throws MatrixVisitorException {<a name="line.1566"></a>
+<FONT color="green">1567</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.1567"></a>
+<FONT color="green">1568</FONT>            int blockIndex = 0;<a name="line.1568"></a>
+<FONT color="green">1569</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1569"></a>
+<FONT color="green">1570</FONT>                final int pStart = iBlock * BLOCK_SIZE;<a name="line.1570"></a>
+<FONT color="green">1571</FONT>                final int pEnd   = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.1571"></a>
+<FONT color="green">1572</FONT>                for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.1572"></a>
+<FONT color="green">1573</FONT>                    final int qStart = jBlock * BLOCK_SIZE;<a name="line.1573"></a>
+<FONT color="green">1574</FONT>                    final int qEnd   = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.1574"></a>
+<FONT color="green">1575</FONT>                    final T[] block = blocks[blockIndex];<a name="line.1575"></a>
+<FONT color="green">1576</FONT>                    int k = 0;<a name="line.1576"></a>
+<FONT color="green">1577</FONT>                    for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1577"></a>
+<FONT color="green">1578</FONT>                        for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1578"></a>
+<FONT color="green">1579</FONT>                            visitor.visit(p, q, block[k]);<a name="line.1579"></a>
+<FONT color="green">1580</FONT>                            ++k;<a name="line.1580"></a>
+<FONT color="green">1581</FONT>                        }<a name="line.1581"></a>
+<FONT color="green">1582</FONT>                    }<a name="line.1582"></a>
+<FONT color="green">1583</FONT>                    ++blockIndex;<a name="line.1583"></a>
+<FONT color="green">1584</FONT>                }<a name="line.1584"></a>
+<FONT color="green">1585</FONT>            }<a name="line.1585"></a>
+<FONT color="green">1586</FONT>            return visitor.end();<a name="line.1586"></a>
+<FONT color="green">1587</FONT>        }<a name="line.1587"></a>
+<FONT color="green">1588</FONT>    <a name="line.1588"></a>
+<FONT color="green">1589</FONT>        /** {@inheritDoc} */<a name="line.1589"></a>
+<FONT color="green">1590</FONT>        @Override<a name="line.1590"></a>
+<FONT color="green">1591</FONT>        public T walkInOptimizedOrder(final FieldMatrixChangingVisitor&lt;T&gt; visitor,<a name="line.1591"></a>
+<FONT color="green">1592</FONT>                                           final int startRow, final int endRow,<a name="line.1592"></a>
+<FONT color="green">1593</FONT>                                           final int startColumn, final int endColumn)<a name="line.1593"></a>
+<FONT color="green">1594</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.1594"></a>
+<FONT color="green">1595</FONT>            checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);<a name="line.1595"></a>
+<FONT color="green">1596</FONT>            visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);<a name="line.1596"></a>
+<FONT color="green">1597</FONT>            for (int iBlock = startRow / BLOCK_SIZE; iBlock &lt; 1 + endRow / BLOCK_SIZE; ++iBlock) {<a name="line.1597"></a>
+<FONT color="green">1598</FONT>                final int p0     = iBlock * BLOCK_SIZE;<a name="line.1598"></a>
+<FONT color="green">1599</FONT>                final int pStart = Math.max(startRow, p0);<a name="line.1599"></a>
+<FONT color="green">1600</FONT>                final int pEnd   = Math.min((iBlock + 1) * BLOCK_SIZE, 1 + endRow);<a name="line.1600"></a>
+<FONT color="green">1601</FONT>                for (int jBlock = startColumn / BLOCK_SIZE; jBlock &lt; 1 + endColumn / BLOCK_SIZE; ++jBlock) {<a name="line.1601"></a>
+<FONT color="green">1602</FONT>                    final int jWidth = blockWidth(jBlock);<a name="line.1602"></a>
+<FONT color="green">1603</FONT>                    final int q0     = jBlock * BLOCK_SIZE;<a name="line.1603"></a>
+<FONT color="green">1604</FONT>                    final int qStart = Math.max(startColumn, q0);<a name="line.1604"></a>
+<FONT color="green">1605</FONT>                    final int qEnd   = Math.min((jBlock + 1) * BLOCK_SIZE, 1 + endColumn);<a name="line.1605"></a>
+<FONT color="green">1606</FONT>                    final T[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1606"></a>
+<FONT color="green">1607</FONT>                    for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1607"></a>
+<FONT color="green">1608</FONT>                        int k = (p - p0) * jWidth + qStart - q0;<a name="line.1608"></a>
+<FONT color="green">1609</FONT>                        for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1609"></a>
+<FONT color="green">1610</FONT>                            block[k] = visitor.visit(p, q, block[k]);<a name="line.1610"></a>
+<FONT color="green">1611</FONT>                            ++k;<a name="line.1611"></a>
+<FONT color="green">1612</FONT>                        }<a name="line.1612"></a>
+<FONT color="green">1613</FONT>                    }<a name="line.1613"></a>
+<FONT color="green">1614</FONT>                }<a name="line.1614"></a>
+<FONT color="green">1615</FONT>            }<a name="line.1615"></a>
+<FONT color="green">1616</FONT>            return visitor.end();<a name="line.1616"></a>
+<FONT color="green">1617</FONT>        }<a name="line.1617"></a>
+<FONT color="green">1618</FONT>    <a name="line.1618"></a>
+<FONT color="green">1619</FONT>        /** {@inheritDoc} */<a name="line.1619"></a>
+<FONT color="green">1620</FONT>        @Override<a name="line.1620"></a>
+<FONT color="green">1621</FONT>        public T walkInOptimizedOrder(final FieldMatrixPreservingVisitor&lt;T&gt; visitor,<a name="line.1621"></a>
+<FONT color="green">1622</FONT>                                           final int startRow, final int endRow,<a name="line.1622"></a>
+<FONT color="green">1623</FONT>                                           final int startColumn, final int endColumn)<a name="line.1623"></a>
+<FONT color="green">1624</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.1624"></a>
+<FONT color="green">1625</FONT>            checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);<a name="line.1625"></a>
+<FONT color="green">1626</FONT>            visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);<a name="line.1626"></a>
+<FONT color="green">1627</FONT>            for (int iBlock = startRow / BLOCK_SIZE; iBlock &lt; 1 + endRow / BLOCK_SIZE; ++iBlock) {<a name="line.1627"></a>
+<FONT color="green">1628</FONT>                final int p0     = iBlock * BLOCK_SIZE;<a name="line.1628"></a>
+<FONT color="green">1629</FONT>                final int pStart = Math.max(startRow, p0);<a name="line.1629"></a>
+<FONT color="green">1630</FONT>                final int pEnd   = Math.min((iBlock + 1) * BLOCK_SIZE, 1 + endRow);<a name="line.1630"></a>
+<FONT color="green">1631</FONT>                for (int jBlock = startColumn / BLOCK_SIZE; jBlock &lt; 1 + endColumn / BLOCK_SIZE; ++jBlock) {<a name="line.1631"></a>
+<FONT color="green">1632</FONT>                    final int jWidth = blockWidth(jBlock);<a name="line.1632"></a>
+<FONT color="green">1633</FONT>                    final int q0     = jBlock * BLOCK_SIZE;<a name="line.1633"></a>
+<FONT color="green">1634</FONT>                    final int qStart = Math.max(startColumn, q0);<a name="line.1634"></a>
+<FONT color="green">1635</FONT>                    final int qEnd   = Math.min((jBlock + 1) * BLOCK_SIZE, 1 + endColumn);<a name="line.1635"></a>
+<FONT color="green">1636</FONT>                    final T[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1636"></a>
+<FONT color="green">1637</FONT>                    for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1637"></a>
+<FONT color="green">1638</FONT>                        int k = (p - p0) * jWidth + qStart - q0;<a name="line.1638"></a>
+<FONT color="green">1639</FONT>                        for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1639"></a>
+<FONT color="green">1640</FONT>                            visitor.visit(p, q, block[k]);<a name="line.1640"></a>
+<FONT color="green">1641</FONT>                            ++k;<a name="line.1641"></a>
+<FONT color="green">1642</FONT>                        }<a name="line.1642"></a>
+<FONT color="green">1643</FONT>                    }<a name="line.1643"></a>
+<FONT color="green">1644</FONT>                }<a name="line.1644"></a>
+<FONT color="green">1645</FONT>            }<a name="line.1645"></a>
+<FONT color="green">1646</FONT>            return visitor.end();<a name="line.1646"></a>
+<FONT color="green">1647</FONT>        }<a name="line.1647"></a>
+<FONT color="green">1648</FONT>    <a name="line.1648"></a>
+<FONT color="green">1649</FONT>        /**<a name="line.1649"></a>
+<FONT color="green">1650</FONT>         * Get the height of a block.<a name="line.1650"></a>
+<FONT color="green">1651</FONT>         * @param blockRow row index (in block sense) of the block<a name="line.1651"></a>
+<FONT color="green">1652</FONT>         * @return height (number of rows) of the block<a name="line.1652"></a>
+<FONT color="green">1653</FONT>         */<a name="line.1653"></a>
+<FONT color="green">1654</FONT>        private int blockHeight(final int blockRow) {<a name="line.1654"></a>
+<FONT color="green">1655</FONT>            return (blockRow == blockRows - 1) ? rows - blockRow * BLOCK_SIZE : BLOCK_SIZE;<a name="line.1655"></a>
+<FONT color="green">1656</FONT>        }<a name="line.1656"></a>
+<FONT color="green">1657</FONT>    <a name="line.1657"></a>
+<FONT color="green">1658</FONT>        /**<a name="line.1658"></a>
+<FONT color="green">1659</FONT>         * Get the width of a block.<a name="line.1659"></a>
+<FONT color="green">1660</FONT>         * @param blockColumn column index (in block sense) of the block<a name="line.1660"></a>
+<FONT color="green">1661</FONT>         * @return width (number of columns) of the block<a name="line.1661"></a>
+<FONT color="green">1662</FONT>         */<a name="line.1662"></a>
+<FONT color="green">1663</FONT>        private int blockWidth(final int blockColumn) {<a name="line.1663"></a>
+<FONT color="green">1664</FONT>            return (blockColumn == blockColumns - 1) ? columns - blockColumn * BLOCK_SIZE : BLOCK_SIZE;<a name="line.1664"></a>
+<FONT color="green">1665</FONT>        }<a name="line.1665"></a>
+<FONT color="green">1666</FONT>    <a name="line.1666"></a>
+<FONT color="green">1667</FONT>    }<a name="line.1667"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/BlockRealMatrix.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,1753 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.Arrays;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Cache-friendly implementation of RealMatrix using a flat arrays to store<a name="line.26"></a>
+<FONT color="green">027</FONT>     * square blocks of the matrix.<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * This implementation is specially designed to be cache-friendly. Square blocks are<a name="line.29"></a>
+<FONT color="green">030</FONT>     * stored as small arrays and allow efficient traversal of data both in row major direction<a name="line.30"></a>
+<FONT color="green">031</FONT>     * and columns major direction, one block at a time. This greatly increases performances<a name="line.31"></a>
+<FONT color="green">032</FONT>     * for algorithms that use crossed directions loops like multiplication or transposition.<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * The size of square blocks is a static parameter. It may be tuned according to the cache<a name="line.35"></a>
+<FONT color="green">036</FONT>     * size of the target computer processor. As a rule of thumbs, it should be the largest<a name="line.36"></a>
+<FONT color="green">037</FONT>     * value that allows three blocks to be simultaneously cached (this is necessary for example<a name="line.37"></a>
+<FONT color="green">038</FONT>     * for matrix multiplication). The default value is to use 52x52 blocks which is well suited<a name="line.38"></a>
+<FONT color="green">039</FONT>     * for processors with 64k L1 cache (one block holds 2704 values or 21632 bytes). This value<a name="line.39"></a>
+<FONT color="green">040</FONT>     * could be lowered to 36x36 for processors with 32k L1 cache.<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;/p&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;p&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     * The regular blocks represent {@link #BLOCK_SIZE} x {@link #BLOCK_SIZE} squares. Blocks<a name="line.43"></a>
+<FONT color="green">044</FONT>     * at right hand side and bottom side which may be smaller to fit matrix dimensions. The square<a name="line.44"></a>
+<FONT color="green">045</FONT>     * blocks are flattened in row major order in single dimension arrays which are therefore<a name="line.45"></a>
+<FONT color="green">046</FONT>     * {@link #BLOCK_SIZE}&lt;sup&gt;2&lt;/sup&gt; elements long for regular blocks. The blocks are themselves<a name="line.46"></a>
+<FONT color="green">047</FONT>     * organized in row major order.<a name="line.47"></a>
+<FONT color="green">048</FONT>     * &lt;/p&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>     * &lt;p&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     * As an example, for a block size of 52x52, a 100x60 matrix would be stored in 4 blocks.<a name="line.50"></a>
+<FONT color="green">051</FONT>     * Block 0 would be a double[2704] array holding the upper left 52x52 square, block 1 would be<a name="line.51"></a>
+<FONT color="green">052</FONT>     * a double[416] array holding the upper right 52x8 rectangle, block 2 would be a double[2496]<a name="line.52"></a>
+<FONT color="green">053</FONT>     * array holding the lower left 48x52 rectangle and block 3 would be a double[384] array<a name="line.53"></a>
+<FONT color="green">054</FONT>     * holding the lower right 48x8 rectangle.<a name="line.54"></a>
+<FONT color="green">055</FONT>     * &lt;/p&gt;<a name="line.55"></a>
+<FONT color="green">056</FONT>     * &lt;p&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>     * The layout complexity overhead versus simple mapping of matrices to java<a name="line.57"></a>
+<FONT color="green">058</FONT>     * arrays is negligible for small matrices (about 1%). The gain from cache efficiency leads<a name="line.58"></a>
+<FONT color="green">059</FONT>     * to up to 3-fold improvements for matrices of moderate to large size.<a name="line.59"></a>
+<FONT color="green">060</FONT>     * &lt;/p&gt;<a name="line.60"></a>
+<FONT color="green">061</FONT>     * @version $Revision: 825919 $ $Date: 2009-10-16 10:51:55 -0400 (Fri, 16 Oct 2009) $<a name="line.61"></a>
+<FONT color="green">062</FONT>     * @since 2.0<a name="line.62"></a>
+<FONT color="green">063</FONT>     */<a name="line.63"></a>
+<FONT color="green">064</FONT>    public class BlockRealMatrix extends AbstractRealMatrix implements Serializable {<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /** Block size. */<a name="line.66"></a>
+<FONT color="green">067</FONT>        public static final int BLOCK_SIZE = 52;<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /** Serializable version identifier */<a name="line.69"></a>
+<FONT color="green">070</FONT>        private static final long serialVersionUID = 4991895511313664478L;<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /** Blocks of matrix entries. */<a name="line.72"></a>
+<FONT color="green">073</FONT>        private final double blocks[][];<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /** Number of rows of the matrix. */<a name="line.75"></a>
+<FONT color="green">076</FONT>        private final int rows;<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /** Number of columns of the matrix. */<a name="line.78"></a>
+<FONT color="green">079</FONT>        private final int columns;<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /** Number of block rows of the matrix. */<a name="line.81"></a>
+<FONT color="green">082</FONT>        private final int blockRows;<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /** Number of block columns of the matrix. */<a name="line.84"></a>
+<FONT color="green">085</FONT>        private final int blockColumns;<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>        /**<a name="line.87"></a>
+<FONT color="green">088</FONT>         * Create a new matrix with the supplied row and column dimensions.<a name="line.88"></a>
+<FONT color="green">089</FONT>         *<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @param rows  the number of rows in the new matrix<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @param columns  the number of columns in the new matrix<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @throws IllegalArgumentException if row or column dimension is not<a name="line.92"></a>
+<FONT color="green">093</FONT>         *  positive<a name="line.93"></a>
+<FONT color="green">094</FONT>         */<a name="line.94"></a>
+<FONT color="green">095</FONT>        public BlockRealMatrix(final int rows, final int columns)<a name="line.95"></a>
+<FONT color="green">096</FONT>            throws IllegalArgumentException {<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>            super(rows, columns);<a name="line.98"></a>
+<FONT color="green">099</FONT>            this.rows    = rows;<a name="line.99"></a>
+<FONT color="green">100</FONT>            this.columns = columns;<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>            // number of blocks<a name="line.102"></a>
+<FONT color="green">103</FONT>            blockRows    = (rows    + BLOCK_SIZE - 1) / BLOCK_SIZE;<a name="line.103"></a>
+<FONT color="green">104</FONT>            blockColumns = (columns + BLOCK_SIZE - 1) / BLOCK_SIZE;<a name="line.104"></a>
+<FONT color="green">105</FONT>    <a name="line.105"></a>
+<FONT color="green">106</FONT>            // allocate storage blocks, taking care of smaller ones at right and bottom<a name="line.106"></a>
+<FONT color="green">107</FONT>            blocks = createBlocksLayout(rows, columns);<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /**<a name="line.111"></a>
+<FONT color="green">112</FONT>         * Create a new dense matrix copying entries from raw layout data.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * &lt;p&gt;The input array &lt;em&gt;must&lt;/em&gt; already be in raw layout.&lt;/p&gt;<a name="line.113"></a>
+<FONT color="green">114</FONT>         * &lt;p&gt;Calling this constructor is equivalent to call:<a name="line.114"></a>
+<FONT color="green">115</FONT>         * &lt;pre&gt;matrix = new BlockRealMatrix(rawData.length, rawData[0].length,<a name="line.115"></a>
+<FONT color="green">116</FONT>         *                                   toBlocksLayout(rawData), false);&lt;/pre&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * &lt;/p&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @param rawData data for new matrix, in raw layout<a name="line.118"></a>
+<FONT color="green">119</FONT>         *<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @exception IllegalArgumentException if &lt;code&gt;blockData&lt;/code&gt; shape is<a name="line.120"></a>
+<FONT color="green">121</FONT>         * inconsistent with block layout<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @see #BlockRealMatrix(int, int, double[][], boolean)<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        public BlockRealMatrix(final double[][] rawData)<a name="line.124"></a>
+<FONT color="green">125</FONT>            throws IllegalArgumentException {<a name="line.125"></a>
+<FONT color="green">126</FONT>            this(rawData.length, rawData[0].length, toBlocksLayout(rawData), false);<a name="line.126"></a>
+<FONT color="green">127</FONT>        }<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>        /**<a name="line.129"></a>
+<FONT color="green">130</FONT>         * Create a new dense matrix copying entries from block layout data.<a name="line.130"></a>
+<FONT color="green">131</FONT>         * &lt;p&gt;The input array &lt;em&gt;must&lt;/em&gt; already be in blocks layout.&lt;/p&gt;<a name="line.131"></a>
+<FONT color="green">132</FONT>         * @param rows  the number of rows in the new matrix<a name="line.132"></a>
+<FONT color="green">133</FONT>         * @param columns  the number of columns in the new matrix<a name="line.133"></a>
+<FONT color="green">134</FONT>         * @param blockData data for new matrix<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @param copyArray if true, the input array will be copied, otherwise<a name="line.135"></a>
+<FONT color="green">136</FONT>         * it will be referenced<a name="line.136"></a>
+<FONT color="green">137</FONT>         *<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @exception IllegalArgumentException if &lt;code&gt;blockData&lt;/code&gt; shape is<a name="line.138"></a>
+<FONT color="green">139</FONT>         * inconsistent with block layout<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @see #createBlocksLayout(int, int)<a name="line.140"></a>
+<FONT color="green">141</FONT>         * @see #toBlocksLayout(double[][])<a name="line.141"></a>
+<FONT color="green">142</FONT>         * @see #BlockRealMatrix(double[][])<a name="line.142"></a>
+<FONT color="green">143</FONT>         */<a name="line.143"></a>
+<FONT color="green">144</FONT>        public BlockRealMatrix(final int rows, final int columns,<a name="line.144"></a>
+<FONT color="green">145</FONT>                               final double[][] blockData, final boolean copyArray)<a name="line.145"></a>
+<FONT color="green">146</FONT>            throws IllegalArgumentException {<a name="line.146"></a>
+<FONT color="green">147</FONT>    <a name="line.147"></a>
+<FONT color="green">148</FONT>            super(rows, columns);<a name="line.148"></a>
+<FONT color="green">149</FONT>            this.rows    = rows;<a name="line.149"></a>
+<FONT color="green">150</FONT>            this.columns = columns;<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>            // number of blocks<a name="line.152"></a>
+<FONT color="green">153</FONT>            blockRows    = (rows    + BLOCK_SIZE - 1) / BLOCK_SIZE;<a name="line.153"></a>
+<FONT color="green">154</FONT>            blockColumns = (columns + BLOCK_SIZE - 1) / BLOCK_SIZE;<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>            if (copyArray) {<a name="line.156"></a>
+<FONT color="green">157</FONT>                // allocate storage blocks, taking care of smaller ones at right and bottom<a name="line.157"></a>
+<FONT color="green">158</FONT>                blocks = new double[blockRows * blockColumns][];<a name="line.158"></a>
+<FONT color="green">159</FONT>            } else {<a name="line.159"></a>
+<FONT color="green">160</FONT>                // reference existing array<a name="line.160"></a>
+<FONT color="green">161</FONT>                blocks = blockData;<a name="line.161"></a>
+<FONT color="green">162</FONT>            }<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>            int index = 0;<a name="line.164"></a>
+<FONT color="green">165</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.165"></a>
+<FONT color="green">166</FONT>                final int iHeight = blockHeight(iBlock);<a name="line.166"></a>
+<FONT color="green">167</FONT>                for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock, ++index) {<a name="line.167"></a>
+<FONT color="green">168</FONT>                    if (blockData[index].length != iHeight * blockWidth(jBlock)) {<a name="line.168"></a>
+<FONT color="green">169</FONT>                        throw MathRuntimeException.createIllegalArgumentException(<a name="line.169"></a>
+<FONT color="green">170</FONT>                                "wrong array shape (block length = {0}, expected {1})",<a name="line.170"></a>
+<FONT color="green">171</FONT>                                blockData[index].length, iHeight * blockWidth(jBlock));<a name="line.171"></a>
+<FONT color="green">172</FONT>                    }<a name="line.172"></a>
+<FONT color="green">173</FONT>                    if (copyArray) {<a name="line.173"></a>
+<FONT color="green">174</FONT>                        blocks[index] = blockData[index].clone();<a name="line.174"></a>
+<FONT color="green">175</FONT>                    }<a name="line.175"></a>
+<FONT color="green">176</FONT>                }<a name="line.176"></a>
+<FONT color="green">177</FONT>            }<a name="line.177"></a>
+<FONT color="green">178</FONT>    <a name="line.178"></a>
+<FONT color="green">179</FONT>        }<a name="line.179"></a>
+<FONT color="green">180</FONT>    <a name="line.180"></a>
+<FONT color="green">181</FONT>        /**<a name="line.181"></a>
+<FONT color="green">182</FONT>         * Convert a data array from raw layout to blocks layout.<a name="line.182"></a>
+<FONT color="green">183</FONT>         * &lt;p&gt;<a name="line.183"></a>
+<FONT color="green">184</FONT>         * Raw layout is the straightforward layout where element at row i and<a name="line.184"></a>
+<FONT color="green">185</FONT>         * column j is in array element &lt;code&gt;rawData[i][j]&lt;/code&gt;. Blocks layout<a name="line.185"></a>
+<FONT color="green">186</FONT>         * is the layout used in {@link BlockRealMatrix} instances, where the matrix<a name="line.186"></a>
+<FONT color="green">187</FONT>         * is split in square blocks (except at right and bottom side where blocks may<a name="line.187"></a>
+<FONT color="green">188</FONT>         * be rectangular to fit matrix size) and each block is stored in a flattened<a name="line.188"></a>
+<FONT color="green">189</FONT>         * one-dimensional array.<a name="line.189"></a>
+<FONT color="green">190</FONT>         * &lt;/p&gt;<a name="line.190"></a>
+<FONT color="green">191</FONT>         * &lt;p&gt;<a name="line.191"></a>
+<FONT color="green">192</FONT>         * This method creates an array in blocks layout from an input array in raw layout.<a name="line.192"></a>
+<FONT color="green">193</FONT>         * It can be used to provide the array argument of the {@link<a name="line.193"></a>
+<FONT color="green">194</FONT>         * #BlockRealMatrix(int, int, double[][], boolean)} constructor.<a name="line.194"></a>
+<FONT color="green">195</FONT>         * &lt;/p&gt;<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @param rawData data array in raw layout<a name="line.196"></a>
+<FONT color="green">197</FONT>         * @return a new data array containing the same entries but in blocks layout<a name="line.197"></a>
+<FONT color="green">198</FONT>         * @exception IllegalArgumentException if &lt;code&gt;rawData&lt;/code&gt; is not rectangular<a name="line.198"></a>
+<FONT color="green">199</FONT>         *  (not all rows have the same length)<a name="line.199"></a>
+<FONT color="green">200</FONT>         * @see #createBlocksLayout(int, int)<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @see #BlockRealMatrix(int, int, double[][], boolean)<a name="line.201"></a>
+<FONT color="green">202</FONT>         */<a name="line.202"></a>
+<FONT color="green">203</FONT>        public static double[][] toBlocksLayout(final double[][] rawData)<a name="line.203"></a>
+<FONT color="green">204</FONT>            throws IllegalArgumentException {<a name="line.204"></a>
+<FONT color="green">205</FONT>    <a name="line.205"></a>
+<FONT color="green">206</FONT>            final int rows         = rawData.length;<a name="line.206"></a>
+<FONT color="green">207</FONT>            final int columns      = rawData[0].length;<a name="line.207"></a>
+<FONT color="green">208</FONT>            final int blockRows    = (rows    + BLOCK_SIZE - 1) / BLOCK_SIZE;<a name="line.208"></a>
+<FONT color="green">209</FONT>            final int blockColumns = (columns + BLOCK_SIZE - 1) / BLOCK_SIZE;<a name="line.209"></a>
+<FONT color="green">210</FONT>    <a name="line.210"></a>
+<FONT color="green">211</FONT>            // safety checks<a name="line.211"></a>
+<FONT color="green">212</FONT>            for (int i = 0; i &lt; rawData.length; ++i) {<a name="line.212"></a>
+<FONT color="green">213</FONT>                final int length = rawData[i].length;<a name="line.213"></a>
+<FONT color="green">214</FONT>                if (length != columns) {<a name="line.214"></a>
+<FONT color="green">215</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.215"></a>
+<FONT color="green">216</FONT>                            "some rows have length {0} while others have length {1}",<a name="line.216"></a>
+<FONT color="green">217</FONT>                            columns, length);<a name="line.217"></a>
+<FONT color="green">218</FONT>                }<a name="line.218"></a>
+<FONT color="green">219</FONT>            }<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>            // convert array<a name="line.221"></a>
+<FONT color="green">222</FONT>            final double[][] blocks = new double[blockRows * blockColumns][];<a name="line.222"></a>
+<FONT color="green">223</FONT>            int blockIndex = 0;<a name="line.223"></a>
+<FONT color="green">224</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.224"></a>
+<FONT color="green">225</FONT>                final int pStart  = iBlock * BLOCK_SIZE;<a name="line.225"></a>
+<FONT color="green">226</FONT>                final int pEnd    = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.226"></a>
+<FONT color="green">227</FONT>                final int iHeight = pEnd - pStart;<a name="line.227"></a>
+<FONT color="green">228</FONT>                for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.228"></a>
+<FONT color="green">229</FONT>                    final int qStart = jBlock * BLOCK_SIZE;<a name="line.229"></a>
+<FONT color="green">230</FONT>                    final int qEnd   = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.230"></a>
+<FONT color="green">231</FONT>                    final int jWidth = qEnd - qStart;<a name="line.231"></a>
+<FONT color="green">232</FONT>    <a name="line.232"></a>
+<FONT color="green">233</FONT>                    // allocate new block<a name="line.233"></a>
+<FONT color="green">234</FONT>                    final double[] block = new double[iHeight * jWidth];<a name="line.234"></a>
+<FONT color="green">235</FONT>                    blocks[blockIndex] = block;<a name="line.235"></a>
+<FONT color="green">236</FONT>    <a name="line.236"></a>
+<FONT color="green">237</FONT>                    // copy data<a name="line.237"></a>
+<FONT color="green">238</FONT>                    int index = 0;<a name="line.238"></a>
+<FONT color="green">239</FONT>                    for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.239"></a>
+<FONT color="green">240</FONT>                        System.arraycopy(rawData[p], qStart, block, index, jWidth);<a name="line.240"></a>
+<FONT color="green">241</FONT>                        index += jWidth;<a name="line.241"></a>
+<FONT color="green">242</FONT>                    }<a name="line.242"></a>
+<FONT color="green">243</FONT>    <a name="line.243"></a>
+<FONT color="green">244</FONT>                    ++blockIndex;<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>                }<a name="line.246"></a>
+<FONT color="green">247</FONT>            }<a name="line.247"></a>
+<FONT color="green">248</FONT>    <a name="line.248"></a>
+<FONT color="green">249</FONT>            return blocks;<a name="line.249"></a>
+<FONT color="green">250</FONT>    <a name="line.250"></a>
+<FONT color="green">251</FONT>        }<a name="line.251"></a>
+<FONT color="green">252</FONT>    <a name="line.252"></a>
+<FONT color="green">253</FONT>        /**<a name="line.253"></a>
+<FONT color="green">254</FONT>         * Create a data array in blocks layout.<a name="line.254"></a>
+<FONT color="green">255</FONT>         * &lt;p&gt;<a name="line.255"></a>
+<FONT color="green">256</FONT>         * This method can be used to create the array argument of the {@link<a name="line.256"></a>
+<FONT color="green">257</FONT>         * #BlockRealMatrix(int, int, double[][], boolean)} constructor.<a name="line.257"></a>
+<FONT color="green">258</FONT>         * &lt;/p&gt;<a name="line.258"></a>
+<FONT color="green">259</FONT>         * @param rows  the number of rows in the new matrix<a name="line.259"></a>
+<FONT color="green">260</FONT>         * @param columns  the number of columns in the new matrix<a name="line.260"></a>
+<FONT color="green">261</FONT>         * @return a new data array in blocks layout<a name="line.261"></a>
+<FONT color="green">262</FONT>         * @see #toBlocksLayout(double[][])<a name="line.262"></a>
+<FONT color="green">263</FONT>         * @see #BlockRealMatrix(int, int, double[][], boolean)<a name="line.263"></a>
+<FONT color="green">264</FONT>         */<a name="line.264"></a>
+<FONT color="green">265</FONT>        public static double[][] createBlocksLayout(final int rows, final int columns) {<a name="line.265"></a>
+<FONT color="green">266</FONT>    <a name="line.266"></a>
+<FONT color="green">267</FONT>            final int blockRows    = (rows    + BLOCK_SIZE - 1) / BLOCK_SIZE;<a name="line.267"></a>
+<FONT color="green">268</FONT>            final int blockColumns = (columns + BLOCK_SIZE - 1) / BLOCK_SIZE;<a name="line.268"></a>
+<FONT color="green">269</FONT>    <a name="line.269"></a>
+<FONT color="green">270</FONT>            final double[][] blocks = new double[blockRows * blockColumns][];<a name="line.270"></a>
+<FONT color="green">271</FONT>            int blockIndex = 0;<a name="line.271"></a>
+<FONT color="green">272</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.272"></a>
+<FONT color="green">273</FONT>                final int pStart  = iBlock * BLOCK_SIZE;<a name="line.273"></a>
+<FONT color="green">274</FONT>                final int pEnd    = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.274"></a>
+<FONT color="green">275</FONT>                final int iHeight = pEnd - pStart;<a name="line.275"></a>
+<FONT color="green">276</FONT>                for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.276"></a>
+<FONT color="green">277</FONT>                    final int qStart = jBlock * BLOCK_SIZE;<a name="line.277"></a>
+<FONT color="green">278</FONT>                    final int qEnd   = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.278"></a>
+<FONT color="green">279</FONT>                    final int jWidth = qEnd - qStart;<a name="line.279"></a>
+<FONT color="green">280</FONT>                    blocks[blockIndex] = new double[iHeight * jWidth];<a name="line.280"></a>
+<FONT color="green">281</FONT>                    ++blockIndex;<a name="line.281"></a>
+<FONT color="green">282</FONT>                }<a name="line.282"></a>
+<FONT color="green">283</FONT>            }<a name="line.283"></a>
+<FONT color="green">284</FONT>    <a name="line.284"></a>
+<FONT color="green">285</FONT>            return blocks;<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>        }<a name="line.287"></a>
+<FONT color="green">288</FONT>    <a name="line.288"></a>
+<FONT color="green">289</FONT>        /** {@inheritDoc} */<a name="line.289"></a>
+<FONT color="green">290</FONT>        @Override<a name="line.290"></a>
+<FONT color="green">291</FONT>        public BlockRealMatrix createMatrix(final int rowDimension, final int columnDimension)<a name="line.291"></a>
+<FONT color="green">292</FONT>            throws IllegalArgumentException {<a name="line.292"></a>
+<FONT color="green">293</FONT>            return new BlockRealMatrix(rowDimension, columnDimension);<a name="line.293"></a>
+<FONT color="green">294</FONT>        }<a name="line.294"></a>
+<FONT color="green">295</FONT>    <a name="line.295"></a>
+<FONT color="green">296</FONT>        /** {@inheritDoc} */<a name="line.296"></a>
+<FONT color="green">297</FONT>        @Override<a name="line.297"></a>
+<FONT color="green">298</FONT>        public BlockRealMatrix copy() {<a name="line.298"></a>
+<FONT color="green">299</FONT>    <a name="line.299"></a>
+<FONT color="green">300</FONT>            // create an empty matrix<a name="line.300"></a>
+<FONT color="green">301</FONT>            BlockRealMatrix copied = new BlockRealMatrix(rows, columns);<a name="line.301"></a>
+<FONT color="green">302</FONT>    <a name="line.302"></a>
+<FONT color="green">303</FONT>            // copy the blocks<a name="line.303"></a>
+<FONT color="green">304</FONT>            for (int i = 0; i &lt; blocks.length; ++i) {<a name="line.304"></a>
+<FONT color="green">305</FONT>                System.arraycopy(blocks[i], 0, copied.blocks[i], 0, blocks[i].length);<a name="line.305"></a>
+<FONT color="green">306</FONT>            }<a name="line.306"></a>
+<FONT color="green">307</FONT>    <a name="line.307"></a>
+<FONT color="green">308</FONT>            return copied;<a name="line.308"></a>
+<FONT color="green">309</FONT>    <a name="line.309"></a>
+<FONT color="green">310</FONT>        }<a name="line.310"></a>
+<FONT color="green">311</FONT>    <a name="line.311"></a>
+<FONT color="green">312</FONT>        /** {@inheritDoc} */<a name="line.312"></a>
+<FONT color="green">313</FONT>        @Override<a name="line.313"></a>
+<FONT color="green">314</FONT>        public BlockRealMatrix add(final RealMatrix m)<a name="line.314"></a>
+<FONT color="green">315</FONT>            throws IllegalArgumentException {<a name="line.315"></a>
+<FONT color="green">316</FONT>            try {<a name="line.316"></a>
+<FONT color="green">317</FONT>                return add((BlockRealMatrix) m);<a name="line.317"></a>
+<FONT color="green">318</FONT>            } catch (ClassCastException cce) {<a name="line.318"></a>
+<FONT color="green">319</FONT>    <a name="line.319"></a>
+<FONT color="green">320</FONT>                // safety check<a name="line.320"></a>
+<FONT color="green">321</FONT>                MatrixUtils.checkAdditionCompatible(this, m);<a name="line.321"></a>
+<FONT color="green">322</FONT>    <a name="line.322"></a>
+<FONT color="green">323</FONT>                final BlockRealMatrix out = new BlockRealMatrix(rows, columns);<a name="line.323"></a>
+<FONT color="green">324</FONT>    <a name="line.324"></a>
+<FONT color="green">325</FONT>                // perform addition block-wise, to ensure good cache behavior<a name="line.325"></a>
+<FONT color="green">326</FONT>                int blockIndex = 0;<a name="line.326"></a>
+<FONT color="green">327</FONT>                for (int iBlock = 0; iBlock &lt; out.blockRows; ++iBlock) {<a name="line.327"></a>
+<FONT color="green">328</FONT>                    for (int jBlock = 0; jBlock &lt; out.blockColumns; ++jBlock) {<a name="line.328"></a>
+<FONT color="green">329</FONT>    <a name="line.329"></a>
+<FONT color="green">330</FONT>                        // perform addition on the current block<a name="line.330"></a>
+<FONT color="green">331</FONT>                        final double[] outBlock = out.blocks[blockIndex];<a name="line.331"></a>
+<FONT color="green">332</FONT>                        final double[] tBlock   = blocks[blockIndex];<a name="line.332"></a>
+<FONT color="green">333</FONT>                        final int      pStart   = iBlock * BLOCK_SIZE;<a name="line.333"></a>
+<FONT color="green">334</FONT>                        final int      pEnd     = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.334"></a>
+<FONT color="green">335</FONT>                        final int      qStart   = jBlock * BLOCK_SIZE;<a name="line.335"></a>
+<FONT color="green">336</FONT>                        final int      qEnd     = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.336"></a>
+<FONT color="green">337</FONT>                        int k = 0;<a name="line.337"></a>
+<FONT color="green">338</FONT>                        for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.338"></a>
+<FONT color="green">339</FONT>                            for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.339"></a>
+<FONT color="green">340</FONT>                                outBlock[k] = tBlock[k] + m.getEntry(p, q);<a name="line.340"></a>
+<FONT color="green">341</FONT>                                ++k;<a name="line.341"></a>
+<FONT color="green">342</FONT>                            }<a name="line.342"></a>
+<FONT color="green">343</FONT>                        }<a name="line.343"></a>
+<FONT color="green">344</FONT>    <a name="line.344"></a>
+<FONT color="green">345</FONT>                        // go to next block<a name="line.345"></a>
+<FONT color="green">346</FONT>                        ++blockIndex;<a name="line.346"></a>
+<FONT color="green">347</FONT>    <a name="line.347"></a>
+<FONT color="green">348</FONT>                    }<a name="line.348"></a>
+<FONT color="green">349</FONT>                }<a name="line.349"></a>
+<FONT color="green">350</FONT>    <a name="line.350"></a>
+<FONT color="green">351</FONT>                return out;<a name="line.351"></a>
+<FONT color="green">352</FONT>    <a name="line.352"></a>
+<FONT color="green">353</FONT>            }<a name="line.353"></a>
+<FONT color="green">354</FONT>        }<a name="line.354"></a>
+<FONT color="green">355</FONT>    <a name="line.355"></a>
+<FONT color="green">356</FONT>        /**<a name="line.356"></a>
+<FONT color="green">357</FONT>         * Compute the sum of this and &lt;code&gt;m&lt;/code&gt;.<a name="line.357"></a>
+<FONT color="green">358</FONT>         *<a name="line.358"></a>
+<FONT color="green">359</FONT>         * @param m    matrix to be added<a name="line.359"></a>
+<FONT color="green">360</FONT>         * @return     this + m<a name="line.360"></a>
+<FONT color="green">361</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.361"></a>
+<FONT color="green">362</FONT>         */<a name="line.362"></a>
+<FONT color="green">363</FONT>        public BlockRealMatrix add(final BlockRealMatrix m)<a name="line.363"></a>
+<FONT color="green">364</FONT>            throws IllegalArgumentException {<a name="line.364"></a>
+<FONT color="green">365</FONT>    <a name="line.365"></a>
+<FONT color="green">366</FONT>            // safety check<a name="line.366"></a>
+<FONT color="green">367</FONT>            MatrixUtils.checkAdditionCompatible(this, m);<a name="line.367"></a>
+<FONT color="green">368</FONT>    <a name="line.368"></a>
+<FONT color="green">369</FONT>            final BlockRealMatrix out = new BlockRealMatrix(rows, columns);<a name="line.369"></a>
+<FONT color="green">370</FONT>    <a name="line.370"></a>
+<FONT color="green">371</FONT>            // perform addition block-wise, to ensure good cache behavior<a name="line.371"></a>
+<FONT color="green">372</FONT>            for (int blockIndex = 0; blockIndex &lt; out.blocks.length; ++blockIndex) {<a name="line.372"></a>
+<FONT color="green">373</FONT>                final double[] outBlock = out.blocks[blockIndex];<a name="line.373"></a>
+<FONT color="green">374</FONT>                final double[] tBlock   = blocks[blockIndex];<a name="line.374"></a>
+<FONT color="green">375</FONT>                final double[] mBlock   = m.blocks[blockIndex];<a name="line.375"></a>
+<FONT color="green">376</FONT>                for (int k = 0; k &lt; outBlock.length; ++k) {<a name="line.376"></a>
+<FONT color="green">377</FONT>                    outBlock[k] = tBlock[k] + mBlock[k];<a name="line.377"></a>
+<FONT color="green">378</FONT>                }<a name="line.378"></a>
+<FONT color="green">379</FONT>            }<a name="line.379"></a>
+<FONT color="green">380</FONT>    <a name="line.380"></a>
+<FONT color="green">381</FONT>            return out;<a name="line.381"></a>
+<FONT color="green">382</FONT>    <a name="line.382"></a>
+<FONT color="green">383</FONT>        }<a name="line.383"></a>
+<FONT color="green">384</FONT>    <a name="line.384"></a>
+<FONT color="green">385</FONT>        /** {@inheritDoc} */<a name="line.385"></a>
+<FONT color="green">386</FONT>        @Override<a name="line.386"></a>
+<FONT color="green">387</FONT>        public BlockRealMatrix subtract(final RealMatrix m)<a name="line.387"></a>
+<FONT color="green">388</FONT>            throws IllegalArgumentException {<a name="line.388"></a>
+<FONT color="green">389</FONT>            try {<a name="line.389"></a>
+<FONT color="green">390</FONT>                return subtract((BlockRealMatrix) m);<a name="line.390"></a>
+<FONT color="green">391</FONT>            } catch (ClassCastException cce) {<a name="line.391"></a>
+<FONT color="green">392</FONT>    <a name="line.392"></a>
+<FONT color="green">393</FONT>                // safety check<a name="line.393"></a>
+<FONT color="green">394</FONT>                MatrixUtils.checkSubtractionCompatible(this, m);<a name="line.394"></a>
+<FONT color="green">395</FONT>    <a name="line.395"></a>
+<FONT color="green">396</FONT>                final BlockRealMatrix out = new BlockRealMatrix(rows, columns);<a name="line.396"></a>
+<FONT color="green">397</FONT>    <a name="line.397"></a>
+<FONT color="green">398</FONT>                // perform subtraction block-wise, to ensure good cache behavior<a name="line.398"></a>
+<FONT color="green">399</FONT>                int blockIndex = 0;<a name="line.399"></a>
+<FONT color="green">400</FONT>                for (int iBlock = 0; iBlock &lt; out.blockRows; ++iBlock) {<a name="line.400"></a>
+<FONT color="green">401</FONT>                    for (int jBlock = 0; jBlock &lt; out.blockColumns; ++jBlock) {<a name="line.401"></a>
+<FONT color="green">402</FONT>    <a name="line.402"></a>
+<FONT color="green">403</FONT>                        // perform subtraction on the current block<a name="line.403"></a>
+<FONT color="green">404</FONT>                        final double[] outBlock = out.blocks[blockIndex];<a name="line.404"></a>
+<FONT color="green">405</FONT>                        final double[] tBlock   = blocks[blockIndex];<a name="line.405"></a>
+<FONT color="green">406</FONT>                        final int      pStart   = iBlock * BLOCK_SIZE;<a name="line.406"></a>
+<FONT color="green">407</FONT>                        final int      pEnd     = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.407"></a>
+<FONT color="green">408</FONT>                        final int      qStart   = jBlock * BLOCK_SIZE;<a name="line.408"></a>
+<FONT color="green">409</FONT>                        final int      qEnd     = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.409"></a>
+<FONT color="green">410</FONT>                        int k = 0;<a name="line.410"></a>
+<FONT color="green">411</FONT>                        for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.411"></a>
+<FONT color="green">412</FONT>                            for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.412"></a>
+<FONT color="green">413</FONT>                                outBlock[k] = tBlock[k] - m.getEntry(p, q);<a name="line.413"></a>
+<FONT color="green">414</FONT>                                ++k;<a name="line.414"></a>
+<FONT color="green">415</FONT>                            }<a name="line.415"></a>
+<FONT color="green">416</FONT>                        }<a name="line.416"></a>
+<FONT color="green">417</FONT>    <a name="line.417"></a>
+<FONT color="green">418</FONT>                        // go to next block<a name="line.418"></a>
+<FONT color="green">419</FONT>                        ++blockIndex;<a name="line.419"></a>
+<FONT color="green">420</FONT>    <a name="line.420"></a>
+<FONT color="green">421</FONT>                    }<a name="line.421"></a>
+<FONT color="green">422</FONT>                }<a name="line.422"></a>
+<FONT color="green">423</FONT>    <a name="line.423"></a>
+<FONT color="green">424</FONT>                return out;<a name="line.424"></a>
+<FONT color="green">425</FONT>    <a name="line.425"></a>
+<FONT color="green">426</FONT>            }<a name="line.426"></a>
+<FONT color="green">427</FONT>        }<a name="line.427"></a>
+<FONT color="green">428</FONT>    <a name="line.428"></a>
+<FONT color="green">429</FONT>        /**<a name="line.429"></a>
+<FONT color="green">430</FONT>         * Compute this minus &lt;code&gt;m&lt;/code&gt;.<a name="line.430"></a>
+<FONT color="green">431</FONT>         *<a name="line.431"></a>
+<FONT color="green">432</FONT>         * @param m    matrix to be subtracted<a name="line.432"></a>
+<FONT color="green">433</FONT>         * @return     this - m<a name="line.433"></a>
+<FONT color="green">434</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.434"></a>
+<FONT color="green">435</FONT>         */<a name="line.435"></a>
+<FONT color="green">436</FONT>        public BlockRealMatrix subtract(final BlockRealMatrix m)<a name="line.436"></a>
+<FONT color="green">437</FONT>            throws IllegalArgumentException {<a name="line.437"></a>
+<FONT color="green">438</FONT>    <a name="line.438"></a>
+<FONT color="green">439</FONT>            // safety check<a name="line.439"></a>
+<FONT color="green">440</FONT>            MatrixUtils.checkSubtractionCompatible(this, m);<a name="line.440"></a>
+<FONT color="green">441</FONT>    <a name="line.441"></a>
+<FONT color="green">442</FONT>            final BlockRealMatrix out = new BlockRealMatrix(rows, columns);<a name="line.442"></a>
+<FONT color="green">443</FONT>    <a name="line.443"></a>
+<FONT color="green">444</FONT>            // perform subtraction block-wise, to ensure good cache behavior<a name="line.444"></a>
+<FONT color="green">445</FONT>            for (int blockIndex = 0; blockIndex &lt; out.blocks.length; ++blockIndex) {<a name="line.445"></a>
+<FONT color="green">446</FONT>                final double[] outBlock = out.blocks[blockIndex];<a name="line.446"></a>
+<FONT color="green">447</FONT>                final double[] tBlock   = blocks[blockIndex];<a name="line.447"></a>
+<FONT color="green">448</FONT>                final double[] mBlock   = m.blocks[blockIndex];<a name="line.448"></a>
+<FONT color="green">449</FONT>                for (int k = 0; k &lt; outBlock.length; ++k) {<a name="line.449"></a>
+<FONT color="green">450</FONT>                    outBlock[k] = tBlock[k] - mBlock[k];<a name="line.450"></a>
+<FONT color="green">451</FONT>                }<a name="line.451"></a>
+<FONT color="green">452</FONT>            }<a name="line.452"></a>
+<FONT color="green">453</FONT>    <a name="line.453"></a>
+<FONT color="green">454</FONT>            return out;<a name="line.454"></a>
+<FONT color="green">455</FONT>    <a name="line.455"></a>
+<FONT color="green">456</FONT>        }<a name="line.456"></a>
+<FONT color="green">457</FONT>    <a name="line.457"></a>
+<FONT color="green">458</FONT>        /** {@inheritDoc} */<a name="line.458"></a>
+<FONT color="green">459</FONT>        @Override<a name="line.459"></a>
+<FONT color="green">460</FONT>        public BlockRealMatrix scalarAdd(final double d)<a name="line.460"></a>
+<FONT color="green">461</FONT>            throws IllegalArgumentException {<a name="line.461"></a>
+<FONT color="green">462</FONT>    <a name="line.462"></a>
+<FONT color="green">463</FONT>            final BlockRealMatrix out = new BlockRealMatrix(rows, columns);<a name="line.463"></a>
+<FONT color="green">464</FONT>    <a name="line.464"></a>
+<FONT color="green">465</FONT>            // perform subtraction block-wise, to ensure good cache behavior<a name="line.465"></a>
+<FONT color="green">466</FONT>            for (int blockIndex = 0; blockIndex &lt; out.blocks.length; ++blockIndex) {<a name="line.466"></a>
+<FONT color="green">467</FONT>                final double[] outBlock = out.blocks[blockIndex];<a name="line.467"></a>
+<FONT color="green">468</FONT>                final double[] tBlock   = blocks[blockIndex];<a name="line.468"></a>
+<FONT color="green">469</FONT>                for (int k = 0; k &lt; outBlock.length; ++k) {<a name="line.469"></a>
+<FONT color="green">470</FONT>                    outBlock[k] = tBlock[k] + d;<a name="line.470"></a>
+<FONT color="green">471</FONT>                }<a name="line.471"></a>
+<FONT color="green">472</FONT>            }<a name="line.472"></a>
+<FONT color="green">473</FONT>    <a name="line.473"></a>
+<FONT color="green">474</FONT>            return out;<a name="line.474"></a>
+<FONT color="green">475</FONT>    <a name="line.475"></a>
+<FONT color="green">476</FONT>        }<a name="line.476"></a>
+<FONT color="green">477</FONT>    <a name="line.477"></a>
+<FONT color="green">478</FONT>        /** {@inheritDoc} */<a name="line.478"></a>
+<FONT color="green">479</FONT>        @Override<a name="line.479"></a>
+<FONT color="green">480</FONT>        public RealMatrix scalarMultiply(final double d)<a name="line.480"></a>
+<FONT color="green">481</FONT>            throws IllegalArgumentException {<a name="line.481"></a>
+<FONT color="green">482</FONT>    <a name="line.482"></a>
+<FONT color="green">483</FONT>            final BlockRealMatrix out = new BlockRealMatrix(rows, columns);<a name="line.483"></a>
+<FONT color="green">484</FONT>    <a name="line.484"></a>
+<FONT color="green">485</FONT>            // perform subtraction block-wise, to ensure good cache behavior<a name="line.485"></a>
+<FONT color="green">486</FONT>            for (int blockIndex = 0; blockIndex &lt; out.blocks.length; ++blockIndex) {<a name="line.486"></a>
+<FONT color="green">487</FONT>                final double[] outBlock = out.blocks[blockIndex];<a name="line.487"></a>
+<FONT color="green">488</FONT>                final double[] tBlock   = blocks[blockIndex];<a name="line.488"></a>
+<FONT color="green">489</FONT>                for (int k = 0; k &lt; outBlock.length; ++k) {<a name="line.489"></a>
+<FONT color="green">490</FONT>                    outBlock[k] = tBlock[k] * d;<a name="line.490"></a>
+<FONT color="green">491</FONT>                }<a name="line.491"></a>
+<FONT color="green">492</FONT>            }<a name="line.492"></a>
+<FONT color="green">493</FONT>    <a name="line.493"></a>
+<FONT color="green">494</FONT>            return out;<a name="line.494"></a>
+<FONT color="green">495</FONT>    <a name="line.495"></a>
+<FONT color="green">496</FONT>        }<a name="line.496"></a>
+<FONT color="green">497</FONT>    <a name="line.497"></a>
+<FONT color="green">498</FONT>        /** {@inheritDoc} */<a name="line.498"></a>
+<FONT color="green">499</FONT>        @Override<a name="line.499"></a>
+<FONT color="green">500</FONT>        public BlockRealMatrix multiply(final RealMatrix m)<a name="line.500"></a>
+<FONT color="green">501</FONT>            throws IllegalArgumentException {<a name="line.501"></a>
+<FONT color="green">502</FONT>            try {<a name="line.502"></a>
+<FONT color="green">503</FONT>                return multiply((BlockRealMatrix) m);<a name="line.503"></a>
+<FONT color="green">504</FONT>            } catch (ClassCastException cce) {<a name="line.504"></a>
+<FONT color="green">505</FONT>    <a name="line.505"></a>
+<FONT color="green">506</FONT>                // safety check<a name="line.506"></a>
+<FONT color="green">507</FONT>                MatrixUtils.checkMultiplicationCompatible(this, m);<a name="line.507"></a>
+<FONT color="green">508</FONT>    <a name="line.508"></a>
+<FONT color="green">509</FONT>                final BlockRealMatrix out = new BlockRealMatrix(rows, m.getColumnDimension());<a name="line.509"></a>
+<FONT color="green">510</FONT>    <a name="line.510"></a>
+<FONT color="green">511</FONT>                // perform multiplication block-wise, to ensure good cache behavior<a name="line.511"></a>
+<FONT color="green">512</FONT>                int blockIndex = 0;<a name="line.512"></a>
+<FONT color="green">513</FONT>                for (int iBlock = 0; iBlock &lt; out.blockRows; ++iBlock) {<a name="line.513"></a>
+<FONT color="green">514</FONT>    <a name="line.514"></a>
+<FONT color="green">515</FONT>                    final int pStart = iBlock * BLOCK_SIZE;<a name="line.515"></a>
+<FONT color="green">516</FONT>                    final int pEnd   = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.516"></a>
+<FONT color="green">517</FONT>    <a name="line.517"></a>
+<FONT color="green">518</FONT>                    for (int jBlock = 0; jBlock &lt; out.blockColumns; ++jBlock) {<a name="line.518"></a>
+<FONT color="green">519</FONT>    <a name="line.519"></a>
+<FONT color="green">520</FONT>                        final int qStart = jBlock * BLOCK_SIZE;<a name="line.520"></a>
+<FONT color="green">521</FONT>                        final int qEnd   = Math.min(qStart + BLOCK_SIZE, m.getColumnDimension());<a name="line.521"></a>
+<FONT color="green">522</FONT>    <a name="line.522"></a>
+<FONT color="green">523</FONT>                        // select current block<a name="line.523"></a>
+<FONT color="green">524</FONT>                        final double[] outBlock = out.blocks[blockIndex];<a name="line.524"></a>
+<FONT color="green">525</FONT>    <a name="line.525"></a>
+<FONT color="green">526</FONT>                        // perform multiplication on current block<a name="line.526"></a>
+<FONT color="green">527</FONT>                        for (int kBlock = 0; kBlock &lt; blockColumns; ++kBlock) {<a name="line.527"></a>
+<FONT color="green">528</FONT>                            final int kWidth      = blockWidth(kBlock);<a name="line.528"></a>
+<FONT color="green">529</FONT>                            final double[] tBlock = blocks[iBlock * blockColumns + kBlock];<a name="line.529"></a>
+<FONT color="green">530</FONT>                            final int rStart      = kBlock * BLOCK_SIZE;<a name="line.530"></a>
+<FONT color="green">531</FONT>                            int k = 0;<a name="line.531"></a>
+<FONT color="green">532</FONT>                            for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.532"></a>
+<FONT color="green">533</FONT>                                final int lStart = (p - pStart) * kWidth;<a name="line.533"></a>
+<FONT color="green">534</FONT>                                final int lEnd   = lStart + kWidth;<a name="line.534"></a>
+<FONT color="green">535</FONT>                                for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.535"></a>
+<FONT color="green">536</FONT>                                    double sum = 0;<a name="line.536"></a>
+<FONT color="green">537</FONT>                                    int r = rStart;<a name="line.537"></a>
+<FONT color="green">538</FONT>                                    for (int l = lStart; l &lt; lEnd; ++l) {<a name="line.538"></a>
+<FONT color="green">539</FONT>                                        sum += tBlock[l] * m.getEntry(r, q);<a name="line.539"></a>
+<FONT color="green">540</FONT>                                        ++r;<a name="line.540"></a>
+<FONT color="green">541</FONT>                                    }<a name="line.541"></a>
+<FONT color="green">542</FONT>                                    outBlock[k] += sum;<a name="line.542"></a>
+<FONT color="green">543</FONT>                                    ++k;<a name="line.543"></a>
+<FONT color="green">544</FONT>                                }<a name="line.544"></a>
+<FONT color="green">545</FONT>                            }<a name="line.545"></a>
+<FONT color="green">546</FONT>                        }<a name="line.546"></a>
+<FONT color="green">547</FONT>    <a name="line.547"></a>
+<FONT color="green">548</FONT>                        // go to next block<a name="line.548"></a>
+<FONT color="green">549</FONT>                        ++blockIndex;<a name="line.549"></a>
+<FONT color="green">550</FONT>    <a name="line.550"></a>
+<FONT color="green">551</FONT>                    }<a name="line.551"></a>
+<FONT color="green">552</FONT>                }<a name="line.552"></a>
+<FONT color="green">553</FONT>    <a name="line.553"></a>
+<FONT color="green">554</FONT>                return out;<a name="line.554"></a>
+<FONT color="green">555</FONT>    <a name="line.555"></a>
+<FONT color="green">556</FONT>            }<a name="line.556"></a>
+<FONT color="green">557</FONT>        }<a name="line.557"></a>
+<FONT color="green">558</FONT>    <a name="line.558"></a>
+<FONT color="green">559</FONT>        /**<a name="line.559"></a>
+<FONT color="green">560</FONT>         * Returns the result of postmultiplying this by m.<a name="line.560"></a>
+<FONT color="green">561</FONT>         *<a name="line.561"></a>
+<FONT color="green">562</FONT>         * @param m    matrix to postmultiply by<a name="line.562"></a>
+<FONT color="green">563</FONT>         * @return     this * m<a name="line.563"></a>
+<FONT color="green">564</FONT>         * @throws     IllegalArgumentException<a name="line.564"></a>
+<FONT color="green">565</FONT>         *             if columnDimension(this) != rowDimension(m)<a name="line.565"></a>
+<FONT color="green">566</FONT>         */<a name="line.566"></a>
+<FONT color="green">567</FONT>        public BlockRealMatrix multiply(BlockRealMatrix m) throws IllegalArgumentException {<a name="line.567"></a>
+<FONT color="green">568</FONT>    <a name="line.568"></a>
+<FONT color="green">569</FONT>            // safety check<a name="line.569"></a>
+<FONT color="green">570</FONT>            MatrixUtils.checkMultiplicationCompatible(this, m);<a name="line.570"></a>
+<FONT color="green">571</FONT>    <a name="line.571"></a>
+<FONT color="green">572</FONT>            final BlockRealMatrix out = new BlockRealMatrix(rows, m.columns);<a name="line.572"></a>
+<FONT color="green">573</FONT>    <a name="line.573"></a>
+<FONT color="green">574</FONT>            // perform multiplication block-wise, to ensure good cache behavior<a name="line.574"></a>
+<FONT color="green">575</FONT>            int blockIndex = 0;<a name="line.575"></a>
+<FONT color="green">576</FONT>            for (int iBlock = 0; iBlock &lt; out.blockRows; ++iBlock) {<a name="line.576"></a>
+<FONT color="green">577</FONT>    <a name="line.577"></a>
+<FONT color="green">578</FONT>                final int pStart = iBlock * BLOCK_SIZE;<a name="line.578"></a>
+<FONT color="green">579</FONT>                final int pEnd   = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.579"></a>
+<FONT color="green">580</FONT>    <a name="line.580"></a>
+<FONT color="green">581</FONT>                for (int jBlock = 0; jBlock &lt; out.blockColumns; ++jBlock) {<a name="line.581"></a>
+<FONT color="green">582</FONT>                    final int jWidth = out.blockWidth(jBlock);<a name="line.582"></a>
+<FONT color="green">583</FONT>                    final int jWidth2 = jWidth  + jWidth;<a name="line.583"></a>
+<FONT color="green">584</FONT>                    final int jWidth3 = jWidth2 + jWidth;<a name="line.584"></a>
+<FONT color="green">585</FONT>                    final int jWidth4 = jWidth3 + jWidth;<a name="line.585"></a>
+<FONT color="green">586</FONT>    <a name="line.586"></a>
+<FONT color="green">587</FONT>                    // select current block<a name="line.587"></a>
+<FONT color="green">588</FONT>                    final double[] outBlock = out.blocks[blockIndex];<a name="line.588"></a>
+<FONT color="green">589</FONT>    <a name="line.589"></a>
+<FONT color="green">590</FONT>                    // perform multiplication on current block<a name="line.590"></a>
+<FONT color="green">591</FONT>                    for (int kBlock = 0; kBlock &lt; blockColumns; ++kBlock) {<a name="line.591"></a>
+<FONT color="green">592</FONT>                        final int kWidth = blockWidth(kBlock);<a name="line.592"></a>
+<FONT color="green">593</FONT>                        final double[] tBlock = blocks[iBlock * blockColumns + kBlock];<a name="line.593"></a>
+<FONT color="green">594</FONT>                        final double[] mBlock = m.blocks[kBlock * m.blockColumns + jBlock];<a name="line.594"></a>
+<FONT color="green">595</FONT>                        int k = 0;<a name="line.595"></a>
+<FONT color="green">596</FONT>                        for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.596"></a>
+<FONT color="green">597</FONT>                            final int lStart = (p - pStart) * kWidth;<a name="line.597"></a>
+<FONT color="green">598</FONT>                            final int lEnd   = lStart + kWidth;<a name="line.598"></a>
+<FONT color="green">599</FONT>                            for (int nStart = 0; nStart &lt; jWidth; ++nStart) {<a name="line.599"></a>
+<FONT color="green">600</FONT>                                double sum = 0;<a name="line.600"></a>
+<FONT color="green">601</FONT>                                int l = lStart;<a name="line.601"></a>
+<FONT color="green">602</FONT>                                int n = nStart;<a name="line.602"></a>
+<FONT color="green">603</FONT>                                while (l &lt; lEnd - 3) {<a name="line.603"></a>
+<FONT color="green">604</FONT>                                    sum += tBlock[l] * mBlock[n] +<a name="line.604"></a>
+<FONT color="green">605</FONT>                                           tBlock[l + 1] * mBlock[n + jWidth] +<a name="line.605"></a>
+<FONT color="green">606</FONT>                                           tBlock[l + 2] * mBlock[n + jWidth2] +<a name="line.606"></a>
+<FONT color="green">607</FONT>                                           tBlock[l + 3] * mBlock[n + jWidth3];<a name="line.607"></a>
+<FONT color="green">608</FONT>                                    l += 4;<a name="line.608"></a>
+<FONT color="green">609</FONT>                                    n += jWidth4;<a name="line.609"></a>
+<FONT color="green">610</FONT>                                }<a name="line.610"></a>
+<FONT color="green">611</FONT>                                while (l &lt; lEnd) {<a name="line.611"></a>
+<FONT color="green">612</FONT>                                    sum += tBlock[l++] * mBlock[n];<a name="line.612"></a>
+<FONT color="green">613</FONT>                                    n += jWidth;<a name="line.613"></a>
+<FONT color="green">614</FONT>                                }<a name="line.614"></a>
+<FONT color="green">615</FONT>                                outBlock[k] += sum;<a name="line.615"></a>
+<FONT color="green">616</FONT>                                ++k;<a name="line.616"></a>
+<FONT color="green">617</FONT>                            }<a name="line.617"></a>
+<FONT color="green">618</FONT>                        }<a name="line.618"></a>
+<FONT color="green">619</FONT>                    }<a name="line.619"></a>
+<FONT color="green">620</FONT>    <a name="line.620"></a>
+<FONT color="green">621</FONT>                    // go to next block<a name="line.621"></a>
+<FONT color="green">622</FONT>                    ++blockIndex;<a name="line.622"></a>
+<FONT color="green">623</FONT>    <a name="line.623"></a>
+<FONT color="green">624</FONT>                }<a name="line.624"></a>
+<FONT color="green">625</FONT>            }<a name="line.625"></a>
+<FONT color="green">626</FONT>    <a name="line.626"></a>
+<FONT color="green">627</FONT>            return out;<a name="line.627"></a>
+<FONT color="green">628</FONT>    <a name="line.628"></a>
+<FONT color="green">629</FONT>        }<a name="line.629"></a>
+<FONT color="green">630</FONT>    <a name="line.630"></a>
+<FONT color="green">631</FONT>        /** {@inheritDoc} */<a name="line.631"></a>
+<FONT color="green">632</FONT>        @Override<a name="line.632"></a>
+<FONT color="green">633</FONT>        public double[][] getData() {<a name="line.633"></a>
+<FONT color="green">634</FONT>    <a name="line.634"></a>
+<FONT color="green">635</FONT>            final double[][] data = new double[getRowDimension()][getColumnDimension()];<a name="line.635"></a>
+<FONT color="green">636</FONT>            final int lastColumns = columns - (blockColumns - 1) * BLOCK_SIZE;<a name="line.636"></a>
+<FONT color="green">637</FONT>    <a name="line.637"></a>
+<FONT color="green">638</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.638"></a>
+<FONT color="green">639</FONT>                final int pStart = iBlock * BLOCK_SIZE;<a name="line.639"></a>
+<FONT color="green">640</FONT>                final int pEnd   = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.640"></a>
+<FONT color="green">641</FONT>                int regularPos   = 0;<a name="line.641"></a>
+<FONT color="green">642</FONT>                int lastPos      = 0;<a name="line.642"></a>
+<FONT color="green">643</FONT>                for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.643"></a>
+<FONT color="green">644</FONT>                    final double[] dataP = data[p];<a name="line.644"></a>
+<FONT color="green">645</FONT>                    int blockIndex = iBlock * blockColumns;<a name="line.645"></a>
+<FONT color="green">646</FONT>                    int dataPos    = 0;<a name="line.646"></a>
+<FONT color="green">647</FONT>                    for (int jBlock = 0; jBlock &lt; blockColumns - 1; ++jBlock) {<a name="line.647"></a>
+<FONT color="green">648</FONT>                        System.arraycopy(blocks[blockIndex++], regularPos, dataP, dataPos, BLOCK_SIZE);<a name="line.648"></a>
+<FONT color="green">649</FONT>                        dataPos += BLOCK_SIZE;<a name="line.649"></a>
+<FONT color="green">650</FONT>                    }<a name="line.650"></a>
+<FONT color="green">651</FONT>                    System.arraycopy(blocks[blockIndex], lastPos, dataP, dataPos, lastColumns);<a name="line.651"></a>
+<FONT color="green">652</FONT>                    regularPos += BLOCK_SIZE;<a name="line.652"></a>
+<FONT color="green">653</FONT>                    lastPos    += lastColumns;<a name="line.653"></a>
+<FONT color="green">654</FONT>                }<a name="line.654"></a>
+<FONT color="green">655</FONT>            }<a name="line.655"></a>
+<FONT color="green">656</FONT>    <a name="line.656"></a>
+<FONT color="green">657</FONT>            return data;<a name="line.657"></a>
+<FONT color="green">658</FONT>    <a name="line.658"></a>
+<FONT color="green">659</FONT>        }<a name="line.659"></a>
+<FONT color="green">660</FONT>    <a name="line.660"></a>
+<FONT color="green">661</FONT>        /** {@inheritDoc} */<a name="line.661"></a>
+<FONT color="green">662</FONT>        @Override<a name="line.662"></a>
+<FONT color="green">663</FONT>        public double getNorm() {<a name="line.663"></a>
+<FONT color="green">664</FONT>            final double[] colSums = new double[BLOCK_SIZE];<a name="line.664"></a>
+<FONT color="green">665</FONT>            double maxColSum = 0;<a name="line.665"></a>
+<FONT color="green">666</FONT>            for (int jBlock = 0; jBlock &lt; blockColumns; jBlock++) {<a name="line.666"></a>
+<FONT color="green">667</FONT>                final int jWidth = blockWidth(jBlock);<a name="line.667"></a>
+<FONT color="green">668</FONT>                Arrays.fill(colSums, 0, jWidth, 0.0);<a name="line.668"></a>
+<FONT color="green">669</FONT>                for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.669"></a>
+<FONT color="green">670</FONT>                    final int iHeight = blockHeight(iBlock);<a name="line.670"></a>
+<FONT color="green">671</FONT>                    final double[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.671"></a>
+<FONT color="green">672</FONT>                    for (int j = 0; j &lt; jWidth; ++j) {<a name="line.672"></a>
+<FONT color="green">673</FONT>                        double sum = 0;<a name="line.673"></a>
+<FONT color="green">674</FONT>                        for (int i = 0; i &lt; iHeight; ++i) {<a name="line.674"></a>
+<FONT color="green">675</FONT>                            sum += Math.abs(block[i * jWidth + j]);<a name="line.675"></a>
+<FONT color="green">676</FONT>                        }<a name="line.676"></a>
+<FONT color="green">677</FONT>                        colSums[j] += sum;<a name="line.677"></a>
+<FONT color="green">678</FONT>                    }<a name="line.678"></a>
+<FONT color="green">679</FONT>                }<a name="line.679"></a>
+<FONT color="green">680</FONT>                for (int j = 0; j &lt; jWidth; ++j) {<a name="line.680"></a>
+<FONT color="green">681</FONT>                    maxColSum = Math.max(maxColSum, colSums[j]);<a name="line.681"></a>
+<FONT color="green">682</FONT>                }<a name="line.682"></a>
+<FONT color="green">683</FONT>            }<a name="line.683"></a>
+<FONT color="green">684</FONT>            return maxColSum;<a name="line.684"></a>
+<FONT color="green">685</FONT>        }<a name="line.685"></a>
+<FONT color="green">686</FONT>    <a name="line.686"></a>
+<FONT color="green">687</FONT>        /** {@inheritDoc} */<a name="line.687"></a>
+<FONT color="green">688</FONT>        @Override<a name="line.688"></a>
+<FONT color="green">689</FONT>        public double getFrobeniusNorm() {<a name="line.689"></a>
+<FONT color="green">690</FONT>            double sum2 = 0;<a name="line.690"></a>
+<FONT color="green">691</FONT>            for (int blockIndex = 0; blockIndex &lt; blocks.length; ++blockIndex) {<a name="line.691"></a>
+<FONT color="green">692</FONT>                for (final double entry : blocks[blockIndex]) {<a name="line.692"></a>
+<FONT color="green">693</FONT>                    sum2 += entry * entry;<a name="line.693"></a>
+<FONT color="green">694</FONT>                }<a name="line.694"></a>
+<FONT color="green">695</FONT>            }<a name="line.695"></a>
+<FONT color="green">696</FONT>            return Math.sqrt(sum2);<a name="line.696"></a>
+<FONT color="green">697</FONT>        }<a name="line.697"></a>
+<FONT color="green">698</FONT>    <a name="line.698"></a>
+<FONT color="green">699</FONT>        /** {@inheritDoc} */<a name="line.699"></a>
+<FONT color="green">700</FONT>        @Override<a name="line.700"></a>
+<FONT color="green">701</FONT>        public BlockRealMatrix getSubMatrix(final int startRow, final int endRow,<a name="line.701"></a>
+<FONT color="green">702</FONT>                                       final int startColumn, final int endColumn)<a name="line.702"></a>
+<FONT color="green">703</FONT>            throws MatrixIndexException {<a name="line.703"></a>
+<FONT color="green">704</FONT>    <a name="line.704"></a>
+<FONT color="green">705</FONT>            // safety checks<a name="line.705"></a>
+<FONT color="green">706</FONT>            MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);<a name="line.706"></a>
+<FONT color="green">707</FONT>    <a name="line.707"></a>
+<FONT color="green">708</FONT>            // create the output matrix<a name="line.708"></a>
+<FONT color="green">709</FONT>            final BlockRealMatrix out =<a name="line.709"></a>
+<FONT color="green">710</FONT>                new BlockRealMatrix(endRow - startRow + 1, endColumn - startColumn + 1);<a name="line.710"></a>
+<FONT color="green">711</FONT>    <a name="line.711"></a>
+<FONT color="green">712</FONT>            // compute blocks shifts<a name="line.712"></a>
+<FONT color="green">713</FONT>            final int blockStartRow    = startRow    / BLOCK_SIZE;<a name="line.713"></a>
+<FONT color="green">714</FONT>            final int rowsShift        = startRow    % BLOCK_SIZE;<a name="line.714"></a>
+<FONT color="green">715</FONT>            final int blockStartColumn = startColumn / BLOCK_SIZE;<a name="line.715"></a>
+<FONT color="green">716</FONT>            final int columnsShift     = startColumn % BLOCK_SIZE;<a name="line.716"></a>
+<FONT color="green">717</FONT>    <a name="line.717"></a>
+<FONT color="green">718</FONT>            // perform extraction block-wise, to ensure good cache behavior<a name="line.718"></a>
+<FONT color="green">719</FONT>            int pBlock = blockStartRow;<a name="line.719"></a>
+<FONT color="green">720</FONT>            for (int iBlock = 0; iBlock &lt; out.blockRows; ++iBlock) {<a name="line.720"></a>
+<FONT color="green">721</FONT>                final int iHeight = out.blockHeight(iBlock);<a name="line.721"></a>
+<FONT color="green">722</FONT>                int qBlock = blockStartColumn;<a name="line.722"></a>
+<FONT color="green">723</FONT>                for (int jBlock = 0; jBlock &lt; out.blockColumns; ++jBlock) {<a name="line.723"></a>
+<FONT color="green">724</FONT>                    final int jWidth = out.blockWidth(jBlock);<a name="line.724"></a>
+<FONT color="green">725</FONT>    <a name="line.725"></a>
+<FONT color="green">726</FONT>                    // handle one block of the output matrix<a name="line.726"></a>
+<FONT color="green">727</FONT>                    final int      outIndex = iBlock * out.blockColumns + jBlock;<a name="line.727"></a>
+<FONT color="green">728</FONT>                    final double[] outBlock = out.blocks[outIndex];<a name="line.728"></a>
+<FONT color="green">729</FONT>                    final int      index    = pBlock * blockColumns + qBlock;<a name="line.729"></a>
+<FONT color="green">730</FONT>                    final int      width    = blockWidth(qBlock);<a name="line.730"></a>
+<FONT color="green">731</FONT>    <a name="line.731"></a>
+<FONT color="green">732</FONT>                    final int heightExcess = iHeight + rowsShift - BLOCK_SIZE;<a name="line.732"></a>
+<FONT color="green">733</FONT>                    final int widthExcess  = jWidth + columnsShift - BLOCK_SIZE;<a name="line.733"></a>
+<FONT color="green">734</FONT>                    if (heightExcess &gt; 0) {<a name="line.734"></a>
+<FONT color="green">735</FONT>                        // the submatrix block spans on two blocks rows from the original matrix<a name="line.735"></a>
+<FONT color="green">736</FONT>                        if (widthExcess &gt; 0) {<a name="line.736"></a>
+<FONT color="green">737</FONT>                            // the submatrix block spans on two blocks columns from the original matrix<a name="line.737"></a>
+<FONT color="green">738</FONT>                            final int width2 = blockWidth(qBlock + 1);<a name="line.738"></a>
+<FONT color="green">739</FONT>                            copyBlockPart(blocks[index], width,<a name="line.739"></a>
+<FONT color="green">740</FONT>                                          rowsShift, BLOCK_SIZE,<a name="line.740"></a>
+<FONT color="green">741</FONT>                                          columnsShift, BLOCK_SIZE,<a name="line.741"></a>
+<FONT color="green">742</FONT>                                          outBlock, jWidth, 0, 0);<a name="line.742"></a>
+<FONT color="green">743</FONT>                            copyBlockPart(blocks[index + 1], width2,<a name="line.743"></a>
+<FONT color="green">744</FONT>                                          rowsShift, BLOCK_SIZE,<a name="line.744"></a>
+<FONT color="green">745</FONT>                                          0, widthExcess,<a name="line.745"></a>
+<FONT color="green">746</FONT>                                          outBlock, jWidth, 0, jWidth - widthExcess);<a name="line.746"></a>
+<FONT color="green">747</FONT>                            copyBlockPart(blocks[index + blockColumns], width,<a name="line.747"></a>
+<FONT color="green">748</FONT>                                          0, heightExcess,<a name="line.748"></a>
+<FONT color="green">749</FONT>                                          columnsShift, BLOCK_SIZE,<a name="line.749"></a>
+<FONT color="green">750</FONT>                                          outBlock, jWidth, iHeight - heightExcess, 0);<a name="line.750"></a>
+<FONT color="green">751</FONT>                            copyBlockPart(blocks[index + blockColumns + 1], width2,<a name="line.751"></a>
+<FONT color="green">752</FONT>                                          0, heightExcess,<a name="line.752"></a>
+<FONT color="green">753</FONT>                                          0, widthExcess,<a name="line.753"></a>
+<FONT color="green">754</FONT>                                          outBlock, jWidth, iHeight - heightExcess, jWidth - widthExcess);<a name="line.754"></a>
+<FONT color="green">755</FONT>                        } else {<a name="line.755"></a>
+<FONT color="green">756</FONT>                            // the submatrix block spans on one block column from the original matrix<a name="line.756"></a>
+<FONT color="green">757</FONT>                            copyBlockPart(blocks[index], width,<a name="line.757"></a>
+<FONT color="green">758</FONT>                                          rowsShift, BLOCK_SIZE,<a name="line.758"></a>
+<FONT color="green">759</FONT>                                          columnsShift, jWidth + columnsShift,<a name="line.759"></a>
+<FONT color="green">760</FONT>                                          outBlock, jWidth, 0, 0);<a name="line.760"></a>
+<FONT color="green">761</FONT>                            copyBlockPart(blocks[index + blockColumns], width,<a name="line.761"></a>
+<FONT color="green">762</FONT>                                          0, heightExcess,<a name="line.762"></a>
+<FONT color="green">763</FONT>                                          columnsShift, jWidth + columnsShift,<a name="line.763"></a>
+<FONT color="green">764</FONT>                                          outBlock, jWidth, iHeight - heightExcess, 0);<a name="line.764"></a>
+<FONT color="green">765</FONT>                        }<a name="line.765"></a>
+<FONT color="green">766</FONT>                    } else {<a name="line.766"></a>
+<FONT color="green">767</FONT>                        // the submatrix block spans on one block row from the original matrix<a name="line.767"></a>
+<FONT color="green">768</FONT>                        if (widthExcess &gt; 0) {<a name="line.768"></a>
+<FONT color="green">769</FONT>                            // the submatrix block spans on two blocks columns from the original matrix<a name="line.769"></a>
+<FONT color="green">770</FONT>                            final int width2 = blockWidth(qBlock + 1);<a name="line.770"></a>
+<FONT color="green">771</FONT>                            copyBlockPart(blocks[index], width,<a name="line.771"></a>
+<FONT color="green">772</FONT>                                          rowsShift, iHeight + rowsShift,<a name="line.772"></a>
+<FONT color="green">773</FONT>                                          columnsShift, BLOCK_SIZE,<a name="line.773"></a>
+<FONT color="green">774</FONT>                                          outBlock, jWidth, 0, 0);<a name="line.774"></a>
+<FONT color="green">775</FONT>                            copyBlockPart(blocks[index + 1], width2,<a name="line.775"></a>
+<FONT color="green">776</FONT>                                          rowsShift, iHeight + rowsShift,<a name="line.776"></a>
+<FONT color="green">777</FONT>                                          0, widthExcess,<a name="line.777"></a>
+<FONT color="green">778</FONT>                                          outBlock, jWidth, 0, jWidth - widthExcess);<a name="line.778"></a>
+<FONT color="green">779</FONT>                        } else {<a name="line.779"></a>
+<FONT color="green">780</FONT>                            // the submatrix block spans on one block column from the original matrix<a name="line.780"></a>
+<FONT color="green">781</FONT>                            copyBlockPart(blocks[index], width,<a name="line.781"></a>
+<FONT color="green">782</FONT>                                          rowsShift, iHeight + rowsShift,<a name="line.782"></a>
+<FONT color="green">783</FONT>                                          columnsShift, jWidth + columnsShift,<a name="line.783"></a>
+<FONT color="green">784</FONT>                                          outBlock, jWidth, 0, 0);<a name="line.784"></a>
+<FONT color="green">785</FONT>                        }<a name="line.785"></a>
+<FONT color="green">786</FONT>                   }<a name="line.786"></a>
+<FONT color="green">787</FONT>    <a name="line.787"></a>
+<FONT color="green">788</FONT>                    ++qBlock;<a name="line.788"></a>
+<FONT color="green">789</FONT>    <a name="line.789"></a>
+<FONT color="green">790</FONT>                }<a name="line.790"></a>
+<FONT color="green">791</FONT>    <a name="line.791"></a>
+<FONT color="green">792</FONT>                ++pBlock;<a name="line.792"></a>
+<FONT color="green">793</FONT>    <a name="line.793"></a>
+<FONT color="green">794</FONT>            }<a name="line.794"></a>
+<FONT color="green">795</FONT>    <a name="line.795"></a>
+<FONT color="green">796</FONT>            return out;<a name="line.796"></a>
+<FONT color="green">797</FONT>    <a name="line.797"></a>
+<FONT color="green">798</FONT>        }<a name="line.798"></a>
+<FONT color="green">799</FONT>    <a name="line.799"></a>
+<FONT color="green">800</FONT>        /**<a name="line.800"></a>
+<FONT color="green">801</FONT>         * Copy a part of a block into another one<a name="line.801"></a>
+<FONT color="green">802</FONT>         * &lt;p&gt;This method can be called only when the specified part fits in both<a name="line.802"></a>
+<FONT color="green">803</FONT>         * blocks, no verification is done here.&lt;/p&gt;<a name="line.803"></a>
+<FONT color="green">804</FONT>         * @param srcBlock source block<a name="line.804"></a>
+<FONT color="green">805</FONT>         * @param srcWidth source block width ({@link #BLOCK_SIZE} or smaller)<a name="line.805"></a>
+<FONT color="green">806</FONT>         * @param srcStartRow start row in the source block<a name="line.806"></a>
+<FONT color="green">807</FONT>         * @param srcEndRow end row (exclusive) in the source block<a name="line.807"></a>
+<FONT color="green">808</FONT>         * @param srcStartColumn start column in the source block<a name="line.808"></a>
+<FONT color="green">809</FONT>         * @param srcEndColumn end column (exclusive) in the source block<a name="line.809"></a>
+<FONT color="green">810</FONT>         * @param dstBlock destination block<a name="line.810"></a>
+<FONT color="green">811</FONT>         * @param dstWidth destination block width ({@link #BLOCK_SIZE} or smaller)<a name="line.811"></a>
+<FONT color="green">812</FONT>         * @param dstStartRow start row in the destination block<a name="line.812"></a>
+<FONT color="green">813</FONT>         * @param dstStartColumn start column in the destination block<a name="line.813"></a>
+<FONT color="green">814</FONT>         */<a name="line.814"></a>
+<FONT color="green">815</FONT>        private void copyBlockPart(final double[] srcBlock, final int srcWidth,<a name="line.815"></a>
+<FONT color="green">816</FONT>                                   final int srcStartRow, final int srcEndRow,<a name="line.816"></a>
+<FONT color="green">817</FONT>                                   final int srcStartColumn, final int srcEndColumn,<a name="line.817"></a>
+<FONT color="green">818</FONT>                                   final double[] dstBlock, final int dstWidth,<a name="line.818"></a>
+<FONT color="green">819</FONT>                                   final int dstStartRow, final int dstStartColumn) {<a name="line.819"></a>
+<FONT color="green">820</FONT>            final int length = srcEndColumn - srcStartColumn;<a name="line.820"></a>
+<FONT color="green">821</FONT>            int srcPos = srcStartRow * srcWidth + srcStartColumn;<a name="line.821"></a>
+<FONT color="green">822</FONT>            int dstPos = dstStartRow * dstWidth + dstStartColumn;<a name="line.822"></a>
+<FONT color="green">823</FONT>            for (int srcRow = srcStartRow; srcRow &lt; srcEndRow; ++srcRow) {<a name="line.823"></a>
+<FONT color="green">824</FONT>                System.arraycopy(srcBlock, srcPos, dstBlock, dstPos, length);<a name="line.824"></a>
+<FONT color="green">825</FONT>                srcPos += srcWidth;<a name="line.825"></a>
+<FONT color="green">826</FONT>                dstPos += dstWidth;<a name="line.826"></a>
+<FONT color="green">827</FONT>            }<a name="line.827"></a>
+<FONT color="green">828</FONT>        }<a name="line.828"></a>
+<FONT color="green">829</FONT>    <a name="line.829"></a>
+<FONT color="green">830</FONT>        /** {@inheritDoc} */<a name="line.830"></a>
+<FONT color="green">831</FONT>        @Override<a name="line.831"></a>
+<FONT color="green">832</FONT>        public void setSubMatrix(final double[][] subMatrix, final int row, final int column)<a name="line.832"></a>
+<FONT color="green">833</FONT>            throws MatrixIndexException {<a name="line.833"></a>
+<FONT color="green">834</FONT>    <a name="line.834"></a>
+<FONT color="green">835</FONT>            // safety checks<a name="line.835"></a>
+<FONT color="green">836</FONT>            final int refLength = subMatrix[0].length;<a name="line.836"></a>
+<FONT color="green">837</FONT>            if (refLength &lt; 1) {<a name="line.837"></a>
+<FONT color="green">838</FONT>                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");<a name="line.838"></a>
+<FONT color="green">839</FONT>            }<a name="line.839"></a>
+<FONT color="green">840</FONT>            final int endRow    = row + subMatrix.length - 1;<a name="line.840"></a>
+<FONT color="green">841</FONT>            final int endColumn = column + refLength - 1;<a name="line.841"></a>
+<FONT color="green">842</FONT>            MatrixUtils.checkSubMatrixIndex(this, row, endRow, column, endColumn);<a name="line.842"></a>
+<FONT color="green">843</FONT>            for (final double[] subRow : subMatrix) {<a name="line.843"></a>
+<FONT color="green">844</FONT>                if (subRow.length != refLength) {<a name="line.844"></a>
+<FONT color="green">845</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.845"></a>
+<FONT color="green">846</FONT>                            "some rows have length {0} while others have length {1}",<a name="line.846"></a>
+<FONT color="green">847</FONT>                            refLength, subRow.length);<a name="line.847"></a>
+<FONT color="green">848</FONT>                }<a name="line.848"></a>
+<FONT color="green">849</FONT>            }<a name="line.849"></a>
+<FONT color="green">850</FONT>    <a name="line.850"></a>
+<FONT color="green">851</FONT>            // compute blocks bounds<a name="line.851"></a>
+<FONT color="green">852</FONT>            final int blockStartRow    = row / BLOCK_SIZE;<a name="line.852"></a>
+<FONT color="green">853</FONT>            final int blockEndRow      = (endRow + BLOCK_SIZE) / BLOCK_SIZE;<a name="line.853"></a>
+<FONT color="green">854</FONT>            final int blockStartColumn = column / BLOCK_SIZE;<a name="line.854"></a>
+<FONT color="green">855</FONT>            final int blockEndColumn   = (endColumn + BLOCK_SIZE) / BLOCK_SIZE;<a name="line.855"></a>
+<FONT color="green">856</FONT>    <a name="line.856"></a>
+<FONT color="green">857</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.857"></a>
+<FONT color="green">858</FONT>            for (int iBlock = blockStartRow; iBlock &lt; blockEndRow; ++iBlock) {<a name="line.858"></a>
+<FONT color="green">859</FONT>                final int iHeight  = blockHeight(iBlock);<a name="line.859"></a>
+<FONT color="green">860</FONT>                final int firstRow = iBlock * BLOCK_SIZE;<a name="line.860"></a>
+<FONT color="green">861</FONT>                final int iStart   = Math.max(row,    firstRow);<a name="line.861"></a>
+<FONT color="green">862</FONT>                final int iEnd     = Math.min(endRow + 1, firstRow + iHeight);<a name="line.862"></a>
+<FONT color="green">863</FONT>    <a name="line.863"></a>
+<FONT color="green">864</FONT>                for (int jBlock = blockStartColumn; jBlock &lt; blockEndColumn; ++jBlock) {<a name="line.864"></a>
+<FONT color="green">865</FONT>                    final int jWidth      = blockWidth(jBlock);<a name="line.865"></a>
+<FONT color="green">866</FONT>                    final int firstColumn = jBlock * BLOCK_SIZE;<a name="line.866"></a>
+<FONT color="green">867</FONT>                    final int jStart      = Math.max(column,    firstColumn);<a name="line.867"></a>
+<FONT color="green">868</FONT>                    final int jEnd        = Math.min(endColumn + 1, firstColumn + jWidth);<a name="line.868"></a>
+<FONT color="green">869</FONT>                    final int jLength     = jEnd - jStart;<a name="line.869"></a>
+<FONT color="green">870</FONT>    <a name="line.870"></a>
+<FONT color="green">871</FONT>                    // handle one block, row by row<a name="line.871"></a>
+<FONT color="green">872</FONT>                    final double[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.872"></a>
+<FONT color="green">873</FONT>                    for (int i = iStart; i &lt; iEnd; ++i) {<a name="line.873"></a>
+<FONT color="green">874</FONT>                        System.arraycopy(subMatrix[i - row], jStart - column,<a name="line.874"></a>
+<FONT color="green">875</FONT>                                         block, (i - firstRow) * jWidth + (jStart - firstColumn),<a name="line.875"></a>
+<FONT color="green">876</FONT>                                         jLength);<a name="line.876"></a>
+<FONT color="green">877</FONT>                    }<a name="line.877"></a>
+<FONT color="green">878</FONT>    <a name="line.878"></a>
+<FONT color="green">879</FONT>                }<a name="line.879"></a>
+<FONT color="green">880</FONT>            }<a name="line.880"></a>
+<FONT color="green">881</FONT>        }<a name="line.881"></a>
+<FONT color="green">882</FONT>    <a name="line.882"></a>
+<FONT color="green">883</FONT>        /** {@inheritDoc} */<a name="line.883"></a>
+<FONT color="green">884</FONT>        @Override<a name="line.884"></a>
+<FONT color="green">885</FONT>        public BlockRealMatrix getRowMatrix(final int row)<a name="line.885"></a>
+<FONT color="green">886</FONT>            throws MatrixIndexException {<a name="line.886"></a>
+<FONT color="green">887</FONT>    <a name="line.887"></a>
+<FONT color="green">888</FONT>            MatrixUtils.checkRowIndex(this, row);<a name="line.888"></a>
+<FONT color="green">889</FONT>            final BlockRealMatrix out = new BlockRealMatrix(1, columns);<a name="line.889"></a>
+<FONT color="green">890</FONT>    <a name="line.890"></a>
+<FONT color="green">891</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.891"></a>
+<FONT color="green">892</FONT>            final int iBlock  = row / BLOCK_SIZE;<a name="line.892"></a>
+<FONT color="green">893</FONT>            final int iRow    = row - iBlock * BLOCK_SIZE;<a name="line.893"></a>
+<FONT color="green">894</FONT>            int outBlockIndex = 0;<a name="line.894"></a>
+<FONT color="green">895</FONT>            int outIndex      = 0;<a name="line.895"></a>
+<FONT color="green">896</FONT>            double[] outBlock = out.blocks[outBlockIndex];<a name="line.896"></a>
+<FONT color="green">897</FONT>            for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.897"></a>
+<FONT color="green">898</FONT>                final int jWidth     = blockWidth(jBlock);<a name="line.898"></a>
+<FONT color="green">899</FONT>                final double[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.899"></a>
+<FONT color="green">900</FONT>                final int available  = outBlock.length - outIndex;<a name="line.900"></a>
+<FONT color="green">901</FONT>                if (jWidth &gt; available) {<a name="line.901"></a>
+<FONT color="green">902</FONT>                    System.arraycopy(block, iRow * jWidth, outBlock, outIndex, available);<a name="line.902"></a>
+<FONT color="green">903</FONT>                    outBlock = out.blocks[++outBlockIndex];<a name="line.903"></a>
+<FONT color="green">904</FONT>                    System.arraycopy(block, iRow * jWidth, outBlock, 0, jWidth - available);<a name="line.904"></a>
+<FONT color="green">905</FONT>                    outIndex = jWidth - available;<a name="line.905"></a>
+<FONT color="green">906</FONT>                } else {<a name="line.906"></a>
+<FONT color="green">907</FONT>                    System.arraycopy(block, iRow * jWidth, outBlock, outIndex, jWidth);<a name="line.907"></a>
+<FONT color="green">908</FONT>                    outIndex += jWidth;<a name="line.908"></a>
+<FONT color="green">909</FONT>                }<a name="line.909"></a>
+<FONT color="green">910</FONT>            }<a name="line.910"></a>
+<FONT color="green">911</FONT>    <a name="line.911"></a>
+<FONT color="green">912</FONT>            return out;<a name="line.912"></a>
+<FONT color="green">913</FONT>    <a name="line.913"></a>
+<FONT color="green">914</FONT>        }<a name="line.914"></a>
+<FONT color="green">915</FONT>    <a name="line.915"></a>
+<FONT color="green">916</FONT>        /** {@inheritDoc} */<a name="line.916"></a>
+<FONT color="green">917</FONT>        @Override<a name="line.917"></a>
+<FONT color="green">918</FONT>        public void setRowMatrix(final int row, final RealMatrix matrix)<a name="line.918"></a>
+<FONT color="green">919</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.919"></a>
+<FONT color="green">920</FONT>            try {<a name="line.920"></a>
+<FONT color="green">921</FONT>                setRowMatrix(row, (BlockRealMatrix) matrix);<a name="line.921"></a>
+<FONT color="green">922</FONT>            } catch (ClassCastException cce) {<a name="line.922"></a>
+<FONT color="green">923</FONT>                super.setRowMatrix(row, matrix);<a name="line.923"></a>
+<FONT color="green">924</FONT>            }<a name="line.924"></a>
+<FONT color="green">925</FONT>        }<a name="line.925"></a>
+<FONT color="green">926</FONT>    <a name="line.926"></a>
+<FONT color="green">927</FONT>        /**<a name="line.927"></a>
+<FONT color="green">928</FONT>         * Sets the entries in row number &lt;code&gt;row&lt;/code&gt;<a name="line.928"></a>
+<FONT color="green">929</FONT>         * as a row matrix.  Row indices start at 0.<a name="line.929"></a>
+<FONT color="green">930</FONT>         *<a name="line.930"></a>
+<FONT color="green">931</FONT>         * @param row the row to be set<a name="line.931"></a>
+<FONT color="green">932</FONT>         * @param matrix row matrix (must have one row and the same number of columns<a name="line.932"></a>
+<FONT color="green">933</FONT>         * as the instance)<a name="line.933"></a>
+<FONT color="green">934</FONT>         * @throws MatrixIndexException if the specified row index is invalid<a name="line.934"></a>
+<FONT color="green">935</FONT>         * @throws InvalidMatrixException if the matrix dimensions do not match one<a name="line.935"></a>
+<FONT color="green">936</FONT>         * instance row<a name="line.936"></a>
+<FONT color="green">937</FONT>         */<a name="line.937"></a>
+<FONT color="green">938</FONT>        public void setRowMatrix(final int row, final BlockRealMatrix matrix)<a name="line.938"></a>
+<FONT color="green">939</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.939"></a>
+<FONT color="green">940</FONT>    <a name="line.940"></a>
+<FONT color="green">941</FONT>            MatrixUtils.checkRowIndex(this, row);<a name="line.941"></a>
+<FONT color="green">942</FONT>            final int nCols = getColumnDimension();<a name="line.942"></a>
+<FONT color="green">943</FONT>            if ((matrix.getRowDimension() != 1) ||<a name="line.943"></a>
+<FONT color="green">944</FONT>                (matrix.getColumnDimension() != nCols)) {<a name="line.944"></a>
+<FONT color="green">945</FONT>                throw new InvalidMatrixException(<a name="line.945"></a>
+<FONT color="green">946</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.946"></a>
+<FONT color="green">947</FONT>                        matrix.getRowDimension(), matrix.getColumnDimension(),<a name="line.947"></a>
+<FONT color="green">948</FONT>                        1, nCols);<a name="line.948"></a>
+<FONT color="green">949</FONT>            }<a name="line.949"></a>
+<FONT color="green">950</FONT>    <a name="line.950"></a>
+<FONT color="green">951</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.951"></a>
+<FONT color="green">952</FONT>            final int iBlock = row / BLOCK_SIZE;<a name="line.952"></a>
+<FONT color="green">953</FONT>            final int iRow   = row - iBlock * BLOCK_SIZE;<a name="line.953"></a>
+<FONT color="green">954</FONT>            int mBlockIndex  = 0;<a name="line.954"></a>
+<FONT color="green">955</FONT>            int mIndex       = 0;<a name="line.955"></a>
+<FONT color="green">956</FONT>            double[] mBlock  = matrix.blocks[mBlockIndex];<a name="line.956"></a>
+<FONT color="green">957</FONT>            for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.957"></a>
+<FONT color="green">958</FONT>                final int jWidth     = blockWidth(jBlock);<a name="line.958"></a>
+<FONT color="green">959</FONT>                final double[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.959"></a>
+<FONT color="green">960</FONT>                final int available  = mBlock.length - mIndex;<a name="line.960"></a>
+<FONT color="green">961</FONT>                if (jWidth &gt; available) {<a name="line.961"></a>
+<FONT color="green">962</FONT>                    System.arraycopy(mBlock, mIndex, block, iRow * jWidth, available);<a name="line.962"></a>
+<FONT color="green">963</FONT>                    mBlock = matrix.blocks[++mBlockIndex];<a name="line.963"></a>
+<FONT color="green">964</FONT>                    System.arraycopy(mBlock, 0, block, iRow * jWidth, jWidth - available);<a name="line.964"></a>
+<FONT color="green">965</FONT>                    mIndex = jWidth - available;<a name="line.965"></a>
+<FONT color="green">966</FONT>                } else {<a name="line.966"></a>
+<FONT color="green">967</FONT>                    System.arraycopy(mBlock, mIndex, block, iRow * jWidth, jWidth);<a name="line.967"></a>
+<FONT color="green">968</FONT>                    mIndex += jWidth;<a name="line.968"></a>
+<FONT color="green">969</FONT>               }<a name="line.969"></a>
+<FONT color="green">970</FONT>            }<a name="line.970"></a>
+<FONT color="green">971</FONT>    <a name="line.971"></a>
+<FONT color="green">972</FONT>        }<a name="line.972"></a>
+<FONT color="green">973</FONT>    <a name="line.973"></a>
+<FONT color="green">974</FONT>        /** {@inheritDoc} */<a name="line.974"></a>
+<FONT color="green">975</FONT>        @Override<a name="line.975"></a>
+<FONT color="green">976</FONT>        public BlockRealMatrix getColumnMatrix(final int column)<a name="line.976"></a>
+<FONT color="green">977</FONT>            throws MatrixIndexException {<a name="line.977"></a>
+<FONT color="green">978</FONT>    <a name="line.978"></a>
+<FONT color="green">979</FONT>            MatrixUtils.checkColumnIndex(this, column);<a name="line.979"></a>
+<FONT color="green">980</FONT>            final BlockRealMatrix out = new BlockRealMatrix(rows, 1);<a name="line.980"></a>
+<FONT color="green">981</FONT>    <a name="line.981"></a>
+<FONT color="green">982</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.982"></a>
+<FONT color="green">983</FONT>            final int jBlock  = column / BLOCK_SIZE;<a name="line.983"></a>
+<FONT color="green">984</FONT>            final int jColumn = column - jBlock * BLOCK_SIZE;<a name="line.984"></a>
+<FONT color="green">985</FONT>            final int jWidth  = blockWidth(jBlock);<a name="line.985"></a>
+<FONT color="green">986</FONT>            int outBlockIndex = 0;<a name="line.986"></a>
+<FONT color="green">987</FONT>            int outIndex      = 0;<a name="line.987"></a>
+<FONT color="green">988</FONT>            double[] outBlock = out.blocks[outBlockIndex];<a name="line.988"></a>
+<FONT color="green">989</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.989"></a>
+<FONT color="green">990</FONT>                final int iHeight = blockHeight(iBlock);<a name="line.990"></a>
+<FONT color="green">991</FONT>                final double[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.991"></a>
+<FONT color="green">992</FONT>                for (int i = 0; i &lt; iHeight; ++i) {<a name="line.992"></a>
+<FONT color="green">993</FONT>                    if (outIndex &gt;= outBlock.length) {<a name="line.993"></a>
+<FONT color="green">994</FONT>                        outBlock = out.blocks[++outBlockIndex];<a name="line.994"></a>
+<FONT color="green">995</FONT>                        outIndex = 0;<a name="line.995"></a>
+<FONT color="green">996</FONT>                    }<a name="line.996"></a>
+<FONT color="green">997</FONT>                    outBlock[outIndex++] = block[i * jWidth + jColumn];<a name="line.997"></a>
+<FONT color="green">998</FONT>                }<a name="line.998"></a>
+<FONT color="green">999</FONT>            }<a name="line.999"></a>
+<FONT color="green">1000</FONT>    <a name="line.1000"></a>
+<FONT color="green">1001</FONT>            return out;<a name="line.1001"></a>
+<FONT color="green">1002</FONT>    <a name="line.1002"></a>
+<FONT color="green">1003</FONT>        }<a name="line.1003"></a>
+<FONT color="green">1004</FONT>    <a name="line.1004"></a>
+<FONT color="green">1005</FONT>        /** {@inheritDoc} */<a name="line.1005"></a>
+<FONT color="green">1006</FONT>        @Override<a name="line.1006"></a>
+<FONT color="green">1007</FONT>        public void setColumnMatrix(final int column, final RealMatrix matrix)<a name="line.1007"></a>
+<FONT color="green">1008</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.1008"></a>
+<FONT color="green">1009</FONT>            try {<a name="line.1009"></a>
+<FONT color="green">1010</FONT>                setColumnMatrix(column, (BlockRealMatrix) matrix);<a name="line.1010"></a>
+<FONT color="green">1011</FONT>            } catch (ClassCastException cce) {<a name="line.1011"></a>
+<FONT color="green">1012</FONT>                super.setColumnMatrix(column, matrix);<a name="line.1012"></a>
+<FONT color="green">1013</FONT>            }<a name="line.1013"></a>
+<FONT color="green">1014</FONT>        }<a name="line.1014"></a>
+<FONT color="green">1015</FONT>    <a name="line.1015"></a>
+<FONT color="green">1016</FONT>        /**<a name="line.1016"></a>
+<FONT color="green">1017</FONT>         * Sets the entries in column number &lt;code&gt;column&lt;/code&gt;<a name="line.1017"></a>
+<FONT color="green">1018</FONT>         * as a column matrix.  Column indices start at 0.<a name="line.1018"></a>
+<FONT color="green">1019</FONT>         *<a name="line.1019"></a>
+<FONT color="green">1020</FONT>         * @param column the column to be set<a name="line.1020"></a>
+<FONT color="green">1021</FONT>         * @param matrix column matrix (must have one column and the same number of rows<a name="line.1021"></a>
+<FONT color="green">1022</FONT>         * as the instance)<a name="line.1022"></a>
+<FONT color="green">1023</FONT>         * @throws MatrixIndexException if the specified column index is invalid<a name="line.1023"></a>
+<FONT color="green">1024</FONT>         * @throws InvalidMatrixException if the matrix dimensions do not match one<a name="line.1024"></a>
+<FONT color="green">1025</FONT>         * instance column<a name="line.1025"></a>
+<FONT color="green">1026</FONT>         */<a name="line.1026"></a>
+<FONT color="green">1027</FONT>        void setColumnMatrix(final int column, final BlockRealMatrix matrix)<a name="line.1027"></a>
+<FONT color="green">1028</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.1028"></a>
+<FONT color="green">1029</FONT>    <a name="line.1029"></a>
+<FONT color="green">1030</FONT>            MatrixUtils.checkColumnIndex(this, column);<a name="line.1030"></a>
+<FONT color="green">1031</FONT>            final int nRows = getRowDimension();<a name="line.1031"></a>
+<FONT color="green">1032</FONT>            if ((matrix.getRowDimension() != nRows) ||<a name="line.1032"></a>
+<FONT color="green">1033</FONT>                (matrix.getColumnDimension() != 1)) {<a name="line.1033"></a>
+<FONT color="green">1034</FONT>                throw new InvalidMatrixException(<a name="line.1034"></a>
+<FONT color="green">1035</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.1035"></a>
+<FONT color="green">1036</FONT>                        matrix.getRowDimension(), matrix.getColumnDimension(),<a name="line.1036"></a>
+<FONT color="green">1037</FONT>                        nRows, 1);<a name="line.1037"></a>
+<FONT color="green">1038</FONT>            }<a name="line.1038"></a>
+<FONT color="green">1039</FONT>    <a name="line.1039"></a>
+<FONT color="green">1040</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.1040"></a>
+<FONT color="green">1041</FONT>            final int jBlock  = column / BLOCK_SIZE;<a name="line.1041"></a>
+<FONT color="green">1042</FONT>            final int jColumn = column - jBlock * BLOCK_SIZE;<a name="line.1042"></a>
+<FONT color="green">1043</FONT>            final int jWidth  = blockWidth(jBlock);<a name="line.1043"></a>
+<FONT color="green">1044</FONT>            int mBlockIndex = 0;<a name="line.1044"></a>
+<FONT color="green">1045</FONT>            int mIndex      = 0;<a name="line.1045"></a>
+<FONT color="green">1046</FONT>            double[] mBlock = matrix.blocks[mBlockIndex];<a name="line.1046"></a>
+<FONT color="green">1047</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1047"></a>
+<FONT color="green">1048</FONT>                final int iHeight = blockHeight(iBlock);<a name="line.1048"></a>
+<FONT color="green">1049</FONT>                final double[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1049"></a>
+<FONT color="green">1050</FONT>                for (int i = 0; i &lt; iHeight; ++i) {<a name="line.1050"></a>
+<FONT color="green">1051</FONT>                    if (mIndex &gt;= mBlock.length) {<a name="line.1051"></a>
+<FONT color="green">1052</FONT>                        mBlock = matrix.blocks[++mBlockIndex];<a name="line.1052"></a>
+<FONT color="green">1053</FONT>                        mIndex = 0;<a name="line.1053"></a>
+<FONT color="green">1054</FONT>                    }<a name="line.1054"></a>
+<FONT color="green">1055</FONT>                    block[i * jWidth + jColumn] = mBlock[mIndex++];<a name="line.1055"></a>
+<FONT color="green">1056</FONT>                }<a name="line.1056"></a>
+<FONT color="green">1057</FONT>            }<a name="line.1057"></a>
+<FONT color="green">1058</FONT>    <a name="line.1058"></a>
+<FONT color="green">1059</FONT>        }<a name="line.1059"></a>
+<FONT color="green">1060</FONT>    <a name="line.1060"></a>
+<FONT color="green">1061</FONT>        /** {@inheritDoc} */<a name="line.1061"></a>
+<FONT color="green">1062</FONT>        @Override<a name="line.1062"></a>
+<FONT color="green">1063</FONT>        public RealVector getRowVector(final int row)<a name="line.1063"></a>
+<FONT color="green">1064</FONT>            throws MatrixIndexException {<a name="line.1064"></a>
+<FONT color="green">1065</FONT>    <a name="line.1065"></a>
+<FONT color="green">1066</FONT>            MatrixUtils.checkRowIndex(this, row);<a name="line.1066"></a>
+<FONT color="green">1067</FONT>            final double[] outData = new double[columns];<a name="line.1067"></a>
+<FONT color="green">1068</FONT>    <a name="line.1068"></a>
+<FONT color="green">1069</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.1069"></a>
+<FONT color="green">1070</FONT>            final int iBlock  = row / BLOCK_SIZE;<a name="line.1070"></a>
+<FONT color="green">1071</FONT>            final int iRow    = row - iBlock * BLOCK_SIZE;<a name="line.1071"></a>
+<FONT color="green">1072</FONT>            int outIndex      = 0;<a name="line.1072"></a>
+<FONT color="green">1073</FONT>            for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.1073"></a>
+<FONT color="green">1074</FONT>                final int jWidth     = blockWidth(jBlock);<a name="line.1074"></a>
+<FONT color="green">1075</FONT>                final double[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1075"></a>
+<FONT color="green">1076</FONT>                System.arraycopy(block, iRow * jWidth, outData, outIndex, jWidth);<a name="line.1076"></a>
+<FONT color="green">1077</FONT>                outIndex += jWidth;<a name="line.1077"></a>
+<FONT color="green">1078</FONT>            }<a name="line.1078"></a>
+<FONT color="green">1079</FONT>    <a name="line.1079"></a>
+<FONT color="green">1080</FONT>            return new ArrayRealVector(outData, false);<a name="line.1080"></a>
+<FONT color="green">1081</FONT>    <a name="line.1081"></a>
+<FONT color="green">1082</FONT>        }<a name="line.1082"></a>
+<FONT color="green">1083</FONT>    <a name="line.1083"></a>
+<FONT color="green">1084</FONT>        /** {@inheritDoc} */<a name="line.1084"></a>
+<FONT color="green">1085</FONT>        @Override<a name="line.1085"></a>
+<FONT color="green">1086</FONT>        public void setRowVector(final int row, final RealVector vector)<a name="line.1086"></a>
+<FONT color="green">1087</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.1087"></a>
+<FONT color="green">1088</FONT>            try {<a name="line.1088"></a>
+<FONT color="green">1089</FONT>                setRow(row, ((ArrayRealVector) vector).getDataRef());<a name="line.1089"></a>
+<FONT color="green">1090</FONT>            } catch (ClassCastException cce) {<a name="line.1090"></a>
+<FONT color="green">1091</FONT>                super.setRowVector(row, vector);<a name="line.1091"></a>
+<FONT color="green">1092</FONT>            }<a name="line.1092"></a>
+<FONT color="green">1093</FONT>        }<a name="line.1093"></a>
+<FONT color="green">1094</FONT>    <a name="line.1094"></a>
+<FONT color="green">1095</FONT>        /** {@inheritDoc} */<a name="line.1095"></a>
+<FONT color="green">1096</FONT>        @Override<a name="line.1096"></a>
+<FONT color="green">1097</FONT>        public RealVector getColumnVector(final int column)<a name="line.1097"></a>
+<FONT color="green">1098</FONT>            throws MatrixIndexException {<a name="line.1098"></a>
+<FONT color="green">1099</FONT>    <a name="line.1099"></a>
+<FONT color="green">1100</FONT>            MatrixUtils.checkColumnIndex(this, column);<a name="line.1100"></a>
+<FONT color="green">1101</FONT>            final double[] outData = new double[rows];<a name="line.1101"></a>
+<FONT color="green">1102</FONT>    <a name="line.1102"></a>
+<FONT color="green">1103</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.1103"></a>
+<FONT color="green">1104</FONT>            final int jBlock  = column / BLOCK_SIZE;<a name="line.1104"></a>
+<FONT color="green">1105</FONT>            final int jColumn = column - jBlock * BLOCK_SIZE;<a name="line.1105"></a>
+<FONT color="green">1106</FONT>            final int jWidth  = blockWidth(jBlock);<a name="line.1106"></a>
+<FONT color="green">1107</FONT>            int outIndex      = 0;<a name="line.1107"></a>
+<FONT color="green">1108</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1108"></a>
+<FONT color="green">1109</FONT>                final int iHeight = blockHeight(iBlock);<a name="line.1109"></a>
+<FONT color="green">1110</FONT>                final double[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1110"></a>
+<FONT color="green">1111</FONT>                for (int i = 0; i &lt; iHeight; ++i) {<a name="line.1111"></a>
+<FONT color="green">1112</FONT>                    outData[outIndex++] = block[i * jWidth + jColumn];<a name="line.1112"></a>
+<FONT color="green">1113</FONT>                }<a name="line.1113"></a>
+<FONT color="green">1114</FONT>            }<a name="line.1114"></a>
+<FONT color="green">1115</FONT>    <a name="line.1115"></a>
+<FONT color="green">1116</FONT>            return new ArrayRealVector(outData, false);<a name="line.1116"></a>
+<FONT color="green">1117</FONT>    <a name="line.1117"></a>
+<FONT color="green">1118</FONT>        }<a name="line.1118"></a>
+<FONT color="green">1119</FONT>    <a name="line.1119"></a>
+<FONT color="green">1120</FONT>        /** {@inheritDoc} */<a name="line.1120"></a>
+<FONT color="green">1121</FONT>        @Override<a name="line.1121"></a>
+<FONT color="green">1122</FONT>        public void setColumnVector(final int column, final RealVector vector)<a name="line.1122"></a>
+<FONT color="green">1123</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.1123"></a>
+<FONT color="green">1124</FONT>            try {<a name="line.1124"></a>
+<FONT color="green">1125</FONT>                setColumn(column, ((ArrayRealVector) vector).getDataRef());<a name="line.1125"></a>
+<FONT color="green">1126</FONT>            } catch (ClassCastException cce) {<a name="line.1126"></a>
+<FONT color="green">1127</FONT>                super.setColumnVector(column, vector);<a name="line.1127"></a>
+<FONT color="green">1128</FONT>            }<a name="line.1128"></a>
+<FONT color="green">1129</FONT>        }<a name="line.1129"></a>
+<FONT color="green">1130</FONT>    <a name="line.1130"></a>
+<FONT color="green">1131</FONT>        /** {@inheritDoc} */<a name="line.1131"></a>
+<FONT color="green">1132</FONT>        @Override<a name="line.1132"></a>
+<FONT color="green">1133</FONT>        public double[] getRow(final int row)<a name="line.1133"></a>
+<FONT color="green">1134</FONT>            throws MatrixIndexException {<a name="line.1134"></a>
+<FONT color="green">1135</FONT>    <a name="line.1135"></a>
+<FONT color="green">1136</FONT>            MatrixUtils.checkRowIndex(this, row);<a name="line.1136"></a>
+<FONT color="green">1137</FONT>            final double[] out = new double[columns];<a name="line.1137"></a>
+<FONT color="green">1138</FONT>    <a name="line.1138"></a>
+<FONT color="green">1139</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.1139"></a>
+<FONT color="green">1140</FONT>            final int iBlock  = row / BLOCK_SIZE;<a name="line.1140"></a>
+<FONT color="green">1141</FONT>            final int iRow    = row - iBlock * BLOCK_SIZE;<a name="line.1141"></a>
+<FONT color="green">1142</FONT>            int outIndex      = 0;<a name="line.1142"></a>
+<FONT color="green">1143</FONT>            for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.1143"></a>
+<FONT color="green">1144</FONT>                final int jWidth     = blockWidth(jBlock);<a name="line.1144"></a>
+<FONT color="green">1145</FONT>                final double[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1145"></a>
+<FONT color="green">1146</FONT>                System.arraycopy(block, iRow * jWidth, out, outIndex, jWidth);<a name="line.1146"></a>
+<FONT color="green">1147</FONT>                outIndex += jWidth;<a name="line.1147"></a>
+<FONT color="green">1148</FONT>            }<a name="line.1148"></a>
+<FONT color="green">1149</FONT>    <a name="line.1149"></a>
+<FONT color="green">1150</FONT>            return out;<a name="line.1150"></a>
+<FONT color="green">1151</FONT>    <a name="line.1151"></a>
+<FONT color="green">1152</FONT>        }<a name="line.1152"></a>
+<FONT color="green">1153</FONT>    <a name="line.1153"></a>
+<FONT color="green">1154</FONT>        /** {@inheritDoc} */<a name="line.1154"></a>
+<FONT color="green">1155</FONT>        @Override<a name="line.1155"></a>
+<FONT color="green">1156</FONT>        public void setRow(final int row, final double[] array)<a name="line.1156"></a>
+<FONT color="green">1157</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.1157"></a>
+<FONT color="green">1158</FONT>    <a name="line.1158"></a>
+<FONT color="green">1159</FONT>            MatrixUtils.checkRowIndex(this, row);<a name="line.1159"></a>
+<FONT color="green">1160</FONT>            final int nCols = getColumnDimension();<a name="line.1160"></a>
+<FONT color="green">1161</FONT>            if (array.length != nCols) {<a name="line.1161"></a>
+<FONT color="green">1162</FONT>                throw new InvalidMatrixException(<a name="line.1162"></a>
+<FONT color="green">1163</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.1163"></a>
+<FONT color="green">1164</FONT>                        1, array.length, 1, nCols);<a name="line.1164"></a>
+<FONT color="green">1165</FONT>            }<a name="line.1165"></a>
+<FONT color="green">1166</FONT>    <a name="line.1166"></a>
+<FONT color="green">1167</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.1167"></a>
+<FONT color="green">1168</FONT>            final int iBlock  = row / BLOCK_SIZE;<a name="line.1168"></a>
+<FONT color="green">1169</FONT>            final int iRow    = row - iBlock * BLOCK_SIZE;<a name="line.1169"></a>
+<FONT color="green">1170</FONT>            int outIndex      = 0;<a name="line.1170"></a>
+<FONT color="green">1171</FONT>            for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.1171"></a>
+<FONT color="green">1172</FONT>                final int jWidth     = blockWidth(jBlock);<a name="line.1172"></a>
+<FONT color="green">1173</FONT>                final double[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1173"></a>
+<FONT color="green">1174</FONT>                System.arraycopy(array, outIndex, block, iRow * jWidth, jWidth);<a name="line.1174"></a>
+<FONT color="green">1175</FONT>                outIndex += jWidth;<a name="line.1175"></a>
+<FONT color="green">1176</FONT>            }<a name="line.1176"></a>
+<FONT color="green">1177</FONT>    <a name="line.1177"></a>
+<FONT color="green">1178</FONT>        }<a name="line.1178"></a>
+<FONT color="green">1179</FONT>    <a name="line.1179"></a>
+<FONT color="green">1180</FONT>        /** {@inheritDoc} */<a name="line.1180"></a>
+<FONT color="green">1181</FONT>        @Override<a name="line.1181"></a>
+<FONT color="green">1182</FONT>        public double[] getColumn(final int column)<a name="line.1182"></a>
+<FONT color="green">1183</FONT>            throws MatrixIndexException {<a name="line.1183"></a>
+<FONT color="green">1184</FONT>    <a name="line.1184"></a>
+<FONT color="green">1185</FONT>            MatrixUtils.checkColumnIndex(this, column);<a name="line.1185"></a>
+<FONT color="green">1186</FONT>            final double[] out = new double[rows];<a name="line.1186"></a>
+<FONT color="green">1187</FONT>    <a name="line.1187"></a>
+<FONT color="green">1188</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.1188"></a>
+<FONT color="green">1189</FONT>            final int jBlock  = column / BLOCK_SIZE;<a name="line.1189"></a>
+<FONT color="green">1190</FONT>            final int jColumn = column - jBlock * BLOCK_SIZE;<a name="line.1190"></a>
+<FONT color="green">1191</FONT>            final int jWidth  = blockWidth(jBlock);<a name="line.1191"></a>
+<FONT color="green">1192</FONT>            int outIndex      = 0;<a name="line.1192"></a>
+<FONT color="green">1193</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1193"></a>
+<FONT color="green">1194</FONT>                final int iHeight = blockHeight(iBlock);<a name="line.1194"></a>
+<FONT color="green">1195</FONT>                final double[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1195"></a>
+<FONT color="green">1196</FONT>                for (int i = 0; i &lt; iHeight; ++i) {<a name="line.1196"></a>
+<FONT color="green">1197</FONT>                    out[outIndex++] = block[i * jWidth + jColumn];<a name="line.1197"></a>
+<FONT color="green">1198</FONT>                }<a name="line.1198"></a>
+<FONT color="green">1199</FONT>            }<a name="line.1199"></a>
+<FONT color="green">1200</FONT>    <a name="line.1200"></a>
+<FONT color="green">1201</FONT>            return out;<a name="line.1201"></a>
+<FONT color="green">1202</FONT>    <a name="line.1202"></a>
+<FONT color="green">1203</FONT>        }<a name="line.1203"></a>
+<FONT color="green">1204</FONT>    <a name="line.1204"></a>
+<FONT color="green">1205</FONT>        /** {@inheritDoc} */<a name="line.1205"></a>
+<FONT color="green">1206</FONT>        @Override<a name="line.1206"></a>
+<FONT color="green">1207</FONT>        public void setColumn(final int column, final double[] array)<a name="line.1207"></a>
+<FONT color="green">1208</FONT>            throws MatrixIndexException, InvalidMatrixException {<a name="line.1208"></a>
+<FONT color="green">1209</FONT>    <a name="line.1209"></a>
+<FONT color="green">1210</FONT>            MatrixUtils.checkColumnIndex(this, column);<a name="line.1210"></a>
+<FONT color="green">1211</FONT>            final int nRows = getRowDimension();<a name="line.1211"></a>
+<FONT color="green">1212</FONT>            if (array.length != nRows) {<a name="line.1212"></a>
+<FONT color="green">1213</FONT>                throw new InvalidMatrixException(<a name="line.1213"></a>
+<FONT color="green">1214</FONT>                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.1214"></a>
+<FONT color="green">1215</FONT>                        array.length, 1, nRows, 1);<a name="line.1215"></a>
+<FONT color="green">1216</FONT>            }<a name="line.1216"></a>
+<FONT color="green">1217</FONT>    <a name="line.1217"></a>
+<FONT color="green">1218</FONT>            // perform copy block-wise, to ensure good cache behavior<a name="line.1218"></a>
+<FONT color="green">1219</FONT>            final int jBlock  = column / BLOCK_SIZE;<a name="line.1219"></a>
+<FONT color="green">1220</FONT>            final int jColumn = column - jBlock * BLOCK_SIZE;<a name="line.1220"></a>
+<FONT color="green">1221</FONT>            final int jWidth  = blockWidth(jBlock);<a name="line.1221"></a>
+<FONT color="green">1222</FONT>            int outIndex      = 0;<a name="line.1222"></a>
+<FONT color="green">1223</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1223"></a>
+<FONT color="green">1224</FONT>                final int iHeight = blockHeight(iBlock);<a name="line.1224"></a>
+<FONT color="green">1225</FONT>                final double[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1225"></a>
+<FONT color="green">1226</FONT>                for (int i = 0; i &lt; iHeight; ++i) {<a name="line.1226"></a>
+<FONT color="green">1227</FONT>                    block[i * jWidth + jColumn] = array[outIndex++];<a name="line.1227"></a>
+<FONT color="green">1228</FONT>                }<a name="line.1228"></a>
+<FONT color="green">1229</FONT>            }<a name="line.1229"></a>
+<FONT color="green">1230</FONT>    <a name="line.1230"></a>
+<FONT color="green">1231</FONT>        }<a name="line.1231"></a>
+<FONT color="green">1232</FONT>    <a name="line.1232"></a>
+<FONT color="green">1233</FONT>        /** {@inheritDoc} */<a name="line.1233"></a>
+<FONT color="green">1234</FONT>        @Override<a name="line.1234"></a>
+<FONT color="green">1235</FONT>        public double getEntry(final int row, final int column)<a name="line.1235"></a>
+<FONT color="green">1236</FONT>            throws MatrixIndexException {<a name="line.1236"></a>
+<FONT color="green">1237</FONT>            try {<a name="line.1237"></a>
+<FONT color="green">1238</FONT>                final int iBlock = row    / BLOCK_SIZE;<a name="line.1238"></a>
+<FONT color="green">1239</FONT>                final int jBlock = column / BLOCK_SIZE;<a name="line.1239"></a>
+<FONT color="green">1240</FONT>                final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +<a name="line.1240"></a>
+<FONT color="green">1241</FONT>                                   (column - jBlock * BLOCK_SIZE);<a name="line.1241"></a>
+<FONT color="green">1242</FONT>                return blocks[iBlock * blockColumns + jBlock][k];<a name="line.1242"></a>
+<FONT color="green">1243</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.1243"></a>
+<FONT color="green">1244</FONT>                throw new MatrixIndexException(<a name="line.1244"></a>
+<FONT color="green">1245</FONT>                        "no entry at indices ({0}, {1}) in a {2}x{3} matrix",<a name="line.1245"></a>
+<FONT color="green">1246</FONT>                        row, column, getRowDimension(), getColumnDimension());<a name="line.1246"></a>
+<FONT color="green">1247</FONT>            }<a name="line.1247"></a>
+<FONT color="green">1248</FONT>        }<a name="line.1248"></a>
+<FONT color="green">1249</FONT>    <a name="line.1249"></a>
+<FONT color="green">1250</FONT>        /** {@inheritDoc} */<a name="line.1250"></a>
+<FONT color="green">1251</FONT>        @Override<a name="line.1251"></a>
+<FONT color="green">1252</FONT>        public void setEntry(final int row, final int column, final double value)<a name="line.1252"></a>
+<FONT color="green">1253</FONT>            throws MatrixIndexException {<a name="line.1253"></a>
+<FONT color="green">1254</FONT>            try {<a name="line.1254"></a>
+<FONT color="green">1255</FONT>                final int iBlock = row    / BLOCK_SIZE;<a name="line.1255"></a>
+<FONT color="green">1256</FONT>                final int jBlock = column / BLOCK_SIZE;<a name="line.1256"></a>
+<FONT color="green">1257</FONT>                final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +<a name="line.1257"></a>
+<FONT color="green">1258</FONT>                                   (column - jBlock * BLOCK_SIZE);<a name="line.1258"></a>
+<FONT color="green">1259</FONT>                blocks[iBlock * blockColumns + jBlock][k] = value;<a name="line.1259"></a>
+<FONT color="green">1260</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.1260"></a>
+<FONT color="green">1261</FONT>                throw new MatrixIndexException(<a name="line.1261"></a>
+<FONT color="green">1262</FONT>                        "no entry at indices ({0}, {1}) in a {2}x{3} matrix",<a name="line.1262"></a>
+<FONT color="green">1263</FONT>                        row, column, getRowDimension(), getColumnDimension());<a name="line.1263"></a>
+<FONT color="green">1264</FONT>            }<a name="line.1264"></a>
+<FONT color="green">1265</FONT>        }<a name="line.1265"></a>
+<FONT color="green">1266</FONT>    <a name="line.1266"></a>
+<FONT color="green">1267</FONT>        /** {@inheritDoc} */<a name="line.1267"></a>
+<FONT color="green">1268</FONT>        @Override<a name="line.1268"></a>
+<FONT color="green">1269</FONT>        public void addToEntry(final int row, final int column, final double increment)<a name="line.1269"></a>
+<FONT color="green">1270</FONT>            throws MatrixIndexException {<a name="line.1270"></a>
+<FONT color="green">1271</FONT>            try {<a name="line.1271"></a>
+<FONT color="green">1272</FONT>                final int iBlock = row    / BLOCK_SIZE;<a name="line.1272"></a>
+<FONT color="green">1273</FONT>                final int jBlock = column / BLOCK_SIZE;<a name="line.1273"></a>
+<FONT color="green">1274</FONT>                final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +<a name="line.1274"></a>
+<FONT color="green">1275</FONT>                                   (column - jBlock * BLOCK_SIZE);<a name="line.1275"></a>
+<FONT color="green">1276</FONT>                blocks[iBlock * blockColumns + jBlock][k] += increment;<a name="line.1276"></a>
+<FONT color="green">1277</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.1277"></a>
+<FONT color="green">1278</FONT>                throw new MatrixIndexException(<a name="line.1278"></a>
+<FONT color="green">1279</FONT>                        "no entry at indices ({0}, {1}) in a {2}x{3} matrix",<a name="line.1279"></a>
+<FONT color="green">1280</FONT>                        row, column, getRowDimension(), getColumnDimension());<a name="line.1280"></a>
+<FONT color="green">1281</FONT>            }<a name="line.1281"></a>
+<FONT color="green">1282</FONT>        }<a name="line.1282"></a>
+<FONT color="green">1283</FONT>    <a name="line.1283"></a>
+<FONT color="green">1284</FONT>        /** {@inheritDoc} */<a name="line.1284"></a>
+<FONT color="green">1285</FONT>        @Override<a name="line.1285"></a>
+<FONT color="green">1286</FONT>        public void multiplyEntry(final int row, final int column, final double factor)<a name="line.1286"></a>
+<FONT color="green">1287</FONT>            throws MatrixIndexException {<a name="line.1287"></a>
+<FONT color="green">1288</FONT>            try {<a name="line.1288"></a>
+<FONT color="green">1289</FONT>                final int iBlock = row    / BLOCK_SIZE;<a name="line.1289"></a>
+<FONT color="green">1290</FONT>                final int jBlock = column / BLOCK_SIZE;<a name="line.1290"></a>
+<FONT color="green">1291</FONT>                final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +<a name="line.1291"></a>
+<FONT color="green">1292</FONT>                                   (column - jBlock * BLOCK_SIZE);<a name="line.1292"></a>
+<FONT color="green">1293</FONT>                blocks[iBlock * blockColumns + jBlock][k] *= factor;<a name="line.1293"></a>
+<FONT color="green">1294</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.1294"></a>
+<FONT color="green">1295</FONT>                throw new MatrixIndexException(<a name="line.1295"></a>
+<FONT color="green">1296</FONT>                        "no entry at indices ({0}, {1}) in a {2}x{3} matrix",<a name="line.1296"></a>
+<FONT color="green">1297</FONT>                        row, column, getRowDimension(), getColumnDimension());<a name="line.1297"></a>
+<FONT color="green">1298</FONT>            }<a name="line.1298"></a>
+<FONT color="green">1299</FONT>        }<a name="line.1299"></a>
+<FONT color="green">1300</FONT>    <a name="line.1300"></a>
+<FONT color="green">1301</FONT>        /** {@inheritDoc} */<a name="line.1301"></a>
+<FONT color="green">1302</FONT>        @Override<a name="line.1302"></a>
+<FONT color="green">1303</FONT>        public BlockRealMatrix transpose() {<a name="line.1303"></a>
+<FONT color="green">1304</FONT>    <a name="line.1304"></a>
+<FONT color="green">1305</FONT>            final int nRows = getRowDimension();<a name="line.1305"></a>
+<FONT color="green">1306</FONT>            final int nCols = getColumnDimension();<a name="line.1306"></a>
+<FONT color="green">1307</FONT>            final BlockRealMatrix out = new BlockRealMatrix(nCols, nRows);<a name="line.1307"></a>
+<FONT color="green">1308</FONT>    <a name="line.1308"></a>
+<FONT color="green">1309</FONT>            // perform transpose block-wise, to ensure good cache behavior<a name="line.1309"></a>
+<FONT color="green">1310</FONT>            int blockIndex = 0;<a name="line.1310"></a>
+<FONT color="green">1311</FONT>            for (int iBlock = 0; iBlock &lt; blockColumns; ++iBlock) {<a name="line.1311"></a>
+<FONT color="green">1312</FONT>                for (int jBlock = 0; jBlock &lt; blockRows; ++jBlock) {<a name="line.1312"></a>
+<FONT color="green">1313</FONT>    <a name="line.1313"></a>
+<FONT color="green">1314</FONT>                    // transpose current block<a name="line.1314"></a>
+<FONT color="green">1315</FONT>                    final double[] outBlock = out.blocks[blockIndex];<a name="line.1315"></a>
+<FONT color="green">1316</FONT>                    final double[] tBlock   = blocks[jBlock * blockColumns + iBlock];<a name="line.1316"></a>
+<FONT color="green">1317</FONT>                    final int      pStart   = iBlock * BLOCK_SIZE;<a name="line.1317"></a>
+<FONT color="green">1318</FONT>                    final int      pEnd     = Math.min(pStart + BLOCK_SIZE, columns);<a name="line.1318"></a>
+<FONT color="green">1319</FONT>                    final int      qStart   = jBlock * BLOCK_SIZE;<a name="line.1319"></a>
+<FONT color="green">1320</FONT>                    final int      qEnd     = Math.min(qStart + BLOCK_SIZE, rows);<a name="line.1320"></a>
+<FONT color="green">1321</FONT>                    int k = 0;<a name="line.1321"></a>
+<FONT color="green">1322</FONT>                    for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1322"></a>
+<FONT color="green">1323</FONT>                        final int lInc = pEnd - pStart;<a name="line.1323"></a>
+<FONT color="green">1324</FONT>                        int l = p - pStart;<a name="line.1324"></a>
+<FONT color="green">1325</FONT>                        for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1325"></a>
+<FONT color="green">1326</FONT>                            outBlock[k] = tBlock[l];<a name="line.1326"></a>
+<FONT color="green">1327</FONT>                            ++k;<a name="line.1327"></a>
+<FONT color="green">1328</FONT>                            l+= lInc;<a name="line.1328"></a>
+<FONT color="green">1329</FONT>                        }<a name="line.1329"></a>
+<FONT color="green">1330</FONT>                    }<a name="line.1330"></a>
+<FONT color="green">1331</FONT>    <a name="line.1331"></a>
+<FONT color="green">1332</FONT>                    // go to next block<a name="line.1332"></a>
+<FONT color="green">1333</FONT>                    ++blockIndex;<a name="line.1333"></a>
+<FONT color="green">1334</FONT>    <a name="line.1334"></a>
+<FONT color="green">1335</FONT>                }<a name="line.1335"></a>
+<FONT color="green">1336</FONT>            }<a name="line.1336"></a>
+<FONT color="green">1337</FONT>    <a name="line.1337"></a>
+<FONT color="green">1338</FONT>            return out;<a name="line.1338"></a>
+<FONT color="green">1339</FONT>    <a name="line.1339"></a>
+<FONT color="green">1340</FONT>        }<a name="line.1340"></a>
+<FONT color="green">1341</FONT>    <a name="line.1341"></a>
+<FONT color="green">1342</FONT>        /** {@inheritDoc} */<a name="line.1342"></a>
+<FONT color="green">1343</FONT>        @Override<a name="line.1343"></a>
+<FONT color="green">1344</FONT>        public int getRowDimension() {<a name="line.1344"></a>
+<FONT color="green">1345</FONT>            return rows;<a name="line.1345"></a>
+<FONT color="green">1346</FONT>        }<a name="line.1346"></a>
+<FONT color="green">1347</FONT>    <a name="line.1347"></a>
+<FONT color="green">1348</FONT>        /** {@inheritDoc} */<a name="line.1348"></a>
+<FONT color="green">1349</FONT>        @Override<a name="line.1349"></a>
+<FONT color="green">1350</FONT>        public int getColumnDimension() {<a name="line.1350"></a>
+<FONT color="green">1351</FONT>            return columns;<a name="line.1351"></a>
+<FONT color="green">1352</FONT>        }<a name="line.1352"></a>
+<FONT color="green">1353</FONT>    <a name="line.1353"></a>
+<FONT color="green">1354</FONT>        /** {@inheritDoc} */<a name="line.1354"></a>
+<FONT color="green">1355</FONT>        @Override<a name="line.1355"></a>
+<FONT color="green">1356</FONT>        public double[] operate(final double[] v)<a name="line.1356"></a>
+<FONT color="green">1357</FONT>            throws IllegalArgumentException {<a name="line.1357"></a>
+<FONT color="green">1358</FONT>    <a name="line.1358"></a>
+<FONT color="green">1359</FONT>            if (v.length != columns) {<a name="line.1359"></a>
+<FONT color="green">1360</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1360"></a>
+<FONT color="green">1361</FONT>                        "vector length mismatch: got {0} but expected {1}",<a name="line.1361"></a>
+<FONT color="green">1362</FONT>                        v.length, columns);<a name="line.1362"></a>
+<FONT color="green">1363</FONT>            }<a name="line.1363"></a>
+<FONT color="green">1364</FONT>            final double[] out = new double[rows];<a name="line.1364"></a>
+<FONT color="green">1365</FONT>    <a name="line.1365"></a>
+<FONT color="green">1366</FONT>            // perform multiplication block-wise, to ensure good cache behavior<a name="line.1366"></a>
+<FONT color="green">1367</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1367"></a>
+<FONT color="green">1368</FONT>                final int pStart = iBlock * BLOCK_SIZE;<a name="line.1368"></a>
+<FONT color="green">1369</FONT>                final int pEnd   = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.1369"></a>
+<FONT color="green">1370</FONT>                for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.1370"></a>
+<FONT color="green">1371</FONT>                    final double[] block  = blocks[iBlock * blockColumns + jBlock];<a name="line.1371"></a>
+<FONT color="green">1372</FONT>                    final int      qStart = jBlock * BLOCK_SIZE;<a name="line.1372"></a>
+<FONT color="green">1373</FONT>                    final int      qEnd   = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.1373"></a>
+<FONT color="green">1374</FONT>                    int k = 0;<a name="line.1374"></a>
+<FONT color="green">1375</FONT>                    for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1375"></a>
+<FONT color="green">1376</FONT>                        double sum = 0;<a name="line.1376"></a>
+<FONT color="green">1377</FONT>                        int q = qStart;<a name="line.1377"></a>
+<FONT color="green">1378</FONT>                        while (q &lt; qEnd - 3) {<a name="line.1378"></a>
+<FONT color="green">1379</FONT>                            sum += block[k]     * v[q]     +<a name="line.1379"></a>
+<FONT color="green">1380</FONT>                                   block[k + 1] * v[q + 1] +<a name="line.1380"></a>
+<FONT color="green">1381</FONT>                                   block[k + 2] * v[q + 2] +<a name="line.1381"></a>
+<FONT color="green">1382</FONT>                                   block[k + 3] * v[q + 3];<a name="line.1382"></a>
+<FONT color="green">1383</FONT>                            k += 4;<a name="line.1383"></a>
+<FONT color="green">1384</FONT>                            q += 4;<a name="line.1384"></a>
+<FONT color="green">1385</FONT>                        }<a name="line.1385"></a>
+<FONT color="green">1386</FONT>                        while (q &lt; qEnd) {<a name="line.1386"></a>
+<FONT color="green">1387</FONT>                            sum += block[k++] * v[q++];<a name="line.1387"></a>
+<FONT color="green">1388</FONT>                        }<a name="line.1388"></a>
+<FONT color="green">1389</FONT>                        out[p] += sum;<a name="line.1389"></a>
+<FONT color="green">1390</FONT>                    }<a name="line.1390"></a>
+<FONT color="green">1391</FONT>                }<a name="line.1391"></a>
+<FONT color="green">1392</FONT>            }<a name="line.1392"></a>
+<FONT color="green">1393</FONT>    <a name="line.1393"></a>
+<FONT color="green">1394</FONT>            return out;<a name="line.1394"></a>
+<FONT color="green">1395</FONT>    <a name="line.1395"></a>
+<FONT color="green">1396</FONT>        }<a name="line.1396"></a>
+<FONT color="green">1397</FONT>    <a name="line.1397"></a>
+<FONT color="green">1398</FONT>        /** {@inheritDoc} */<a name="line.1398"></a>
+<FONT color="green">1399</FONT>        @Override<a name="line.1399"></a>
+<FONT color="green">1400</FONT>        public double[] preMultiply(final double[] v)<a name="line.1400"></a>
+<FONT color="green">1401</FONT>            throws IllegalArgumentException {<a name="line.1401"></a>
+<FONT color="green">1402</FONT>    <a name="line.1402"></a>
+<FONT color="green">1403</FONT>            if (v.length != rows) {<a name="line.1403"></a>
+<FONT color="green">1404</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1404"></a>
+<FONT color="green">1405</FONT>                        "vector length mismatch: got {0} but expected {1}",<a name="line.1405"></a>
+<FONT color="green">1406</FONT>                        v.length, rows);<a name="line.1406"></a>
+<FONT color="green">1407</FONT>            }<a name="line.1407"></a>
+<FONT color="green">1408</FONT>            final double[] out = new double[columns];<a name="line.1408"></a>
+<FONT color="green">1409</FONT>    <a name="line.1409"></a>
+<FONT color="green">1410</FONT>            // perform multiplication block-wise, to ensure good cache behavior<a name="line.1410"></a>
+<FONT color="green">1411</FONT>            for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.1411"></a>
+<FONT color="green">1412</FONT>                final int jWidth  = blockWidth(jBlock);<a name="line.1412"></a>
+<FONT color="green">1413</FONT>                final int jWidth2 = jWidth  + jWidth;<a name="line.1413"></a>
+<FONT color="green">1414</FONT>                final int jWidth3 = jWidth2 + jWidth;<a name="line.1414"></a>
+<FONT color="green">1415</FONT>                final int jWidth4 = jWidth3 + jWidth;<a name="line.1415"></a>
+<FONT color="green">1416</FONT>                final int qStart = jBlock * BLOCK_SIZE;<a name="line.1416"></a>
+<FONT color="green">1417</FONT>                final int qEnd   = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.1417"></a>
+<FONT color="green">1418</FONT>                for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1418"></a>
+<FONT color="green">1419</FONT>                    final double[] block  = blocks[iBlock * blockColumns + jBlock];<a name="line.1419"></a>
+<FONT color="green">1420</FONT>                    final int      pStart = iBlock * BLOCK_SIZE;<a name="line.1420"></a>
+<FONT color="green">1421</FONT>                    final int      pEnd   = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.1421"></a>
+<FONT color="green">1422</FONT>                    for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1422"></a>
+<FONT color="green">1423</FONT>                        int k = q - qStart;<a name="line.1423"></a>
+<FONT color="green">1424</FONT>                        double sum = 0;<a name="line.1424"></a>
+<FONT color="green">1425</FONT>                        int p = pStart;<a name="line.1425"></a>
+<FONT color="green">1426</FONT>                        while (p &lt; pEnd - 3) {<a name="line.1426"></a>
+<FONT color="green">1427</FONT>                            sum += block[k]           * v[p]     +<a name="line.1427"></a>
+<FONT color="green">1428</FONT>                                   block[k + jWidth]  * v[p + 1] +<a name="line.1428"></a>
+<FONT color="green">1429</FONT>                                   block[k + jWidth2] * v[p + 2] +<a name="line.1429"></a>
+<FONT color="green">1430</FONT>                                   block[k + jWidth3] * v[p + 3];<a name="line.1430"></a>
+<FONT color="green">1431</FONT>                            k += jWidth4;<a name="line.1431"></a>
+<FONT color="green">1432</FONT>                            p += 4;<a name="line.1432"></a>
+<FONT color="green">1433</FONT>                        }<a name="line.1433"></a>
+<FONT color="green">1434</FONT>                        while (p &lt; pEnd) {<a name="line.1434"></a>
+<FONT color="green">1435</FONT>                            sum += block[k] * v[p++];<a name="line.1435"></a>
+<FONT color="green">1436</FONT>                            k += jWidth;<a name="line.1436"></a>
+<FONT color="green">1437</FONT>                        }<a name="line.1437"></a>
+<FONT color="green">1438</FONT>                        out[q] += sum;<a name="line.1438"></a>
+<FONT color="green">1439</FONT>                    }<a name="line.1439"></a>
+<FONT color="green">1440</FONT>                }<a name="line.1440"></a>
+<FONT color="green">1441</FONT>            }<a name="line.1441"></a>
+<FONT color="green">1442</FONT>    <a name="line.1442"></a>
+<FONT color="green">1443</FONT>            return out;<a name="line.1443"></a>
+<FONT color="green">1444</FONT>    <a name="line.1444"></a>
+<FONT color="green">1445</FONT>        }<a name="line.1445"></a>
+<FONT color="green">1446</FONT>    <a name="line.1446"></a>
+<FONT color="green">1447</FONT>        /** {@inheritDoc} */<a name="line.1447"></a>
+<FONT color="green">1448</FONT>        @Override<a name="line.1448"></a>
+<FONT color="green">1449</FONT>        public double walkInRowOrder(final RealMatrixChangingVisitor visitor)<a name="line.1449"></a>
+<FONT color="green">1450</FONT>            throws MatrixVisitorException {<a name="line.1450"></a>
+<FONT color="green">1451</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.1451"></a>
+<FONT color="green">1452</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1452"></a>
+<FONT color="green">1453</FONT>                final int pStart = iBlock * BLOCK_SIZE;<a name="line.1453"></a>
+<FONT color="green">1454</FONT>                final int pEnd   = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.1454"></a>
+<FONT color="green">1455</FONT>                for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1455"></a>
+<FONT color="green">1456</FONT>                    for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.1456"></a>
+<FONT color="green">1457</FONT>                        final int jWidth = blockWidth(jBlock);<a name="line.1457"></a>
+<FONT color="green">1458</FONT>                        final int qStart = jBlock * BLOCK_SIZE;<a name="line.1458"></a>
+<FONT color="green">1459</FONT>                        final int qEnd   = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.1459"></a>
+<FONT color="green">1460</FONT>                        final double[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1460"></a>
+<FONT color="green">1461</FONT>                        int k = (p - pStart) * jWidth;<a name="line.1461"></a>
+<FONT color="green">1462</FONT>                        for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1462"></a>
+<FONT color="green">1463</FONT>                            block[k] = visitor.visit(p, q, block[k]);<a name="line.1463"></a>
+<FONT color="green">1464</FONT>                            ++k;<a name="line.1464"></a>
+<FONT color="green">1465</FONT>                        }<a name="line.1465"></a>
+<FONT color="green">1466</FONT>                    }<a name="line.1466"></a>
+<FONT color="green">1467</FONT>                 }<a name="line.1467"></a>
+<FONT color="green">1468</FONT>            }<a name="line.1468"></a>
+<FONT color="green">1469</FONT>            return visitor.end();<a name="line.1469"></a>
+<FONT color="green">1470</FONT>        }<a name="line.1470"></a>
+<FONT color="green">1471</FONT>    <a name="line.1471"></a>
+<FONT color="green">1472</FONT>        /** {@inheritDoc} */<a name="line.1472"></a>
+<FONT color="green">1473</FONT>        @Override<a name="line.1473"></a>
+<FONT color="green">1474</FONT>        public double walkInRowOrder(final RealMatrixPreservingVisitor visitor)<a name="line.1474"></a>
+<FONT color="green">1475</FONT>            throws MatrixVisitorException {<a name="line.1475"></a>
+<FONT color="green">1476</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.1476"></a>
+<FONT color="green">1477</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1477"></a>
+<FONT color="green">1478</FONT>                final int pStart = iBlock * BLOCK_SIZE;<a name="line.1478"></a>
+<FONT color="green">1479</FONT>                final int pEnd   = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.1479"></a>
+<FONT color="green">1480</FONT>                for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1480"></a>
+<FONT color="green">1481</FONT>                    for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.1481"></a>
+<FONT color="green">1482</FONT>                        final int jWidth = blockWidth(jBlock);<a name="line.1482"></a>
+<FONT color="green">1483</FONT>                        final int qStart = jBlock * BLOCK_SIZE;<a name="line.1483"></a>
+<FONT color="green">1484</FONT>                        final int qEnd   = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.1484"></a>
+<FONT color="green">1485</FONT>                        final double[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1485"></a>
+<FONT color="green">1486</FONT>                        int k = (p - pStart) * jWidth;<a name="line.1486"></a>
+<FONT color="green">1487</FONT>                        for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1487"></a>
+<FONT color="green">1488</FONT>                            visitor.visit(p, q, block[k]);<a name="line.1488"></a>
+<FONT color="green">1489</FONT>                            ++k;<a name="line.1489"></a>
+<FONT color="green">1490</FONT>                        }<a name="line.1490"></a>
+<FONT color="green">1491</FONT>                    }<a name="line.1491"></a>
+<FONT color="green">1492</FONT>                 }<a name="line.1492"></a>
+<FONT color="green">1493</FONT>            }<a name="line.1493"></a>
+<FONT color="green">1494</FONT>            return visitor.end();<a name="line.1494"></a>
+<FONT color="green">1495</FONT>        }<a name="line.1495"></a>
+<FONT color="green">1496</FONT>    <a name="line.1496"></a>
+<FONT color="green">1497</FONT>        /** {@inheritDoc} */<a name="line.1497"></a>
+<FONT color="green">1498</FONT>        @Override<a name="line.1498"></a>
+<FONT color="green">1499</FONT>        public double walkInRowOrder(final RealMatrixChangingVisitor visitor,<a name="line.1499"></a>
+<FONT color="green">1500</FONT>                                     final int startRow, final int endRow,<a name="line.1500"></a>
+<FONT color="green">1501</FONT>                                     final int startColumn, final int endColumn)<a name="line.1501"></a>
+<FONT color="green">1502</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.1502"></a>
+<FONT color="green">1503</FONT>            MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);<a name="line.1503"></a>
+<FONT color="green">1504</FONT>            visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);<a name="line.1504"></a>
+<FONT color="green">1505</FONT>            for (int iBlock = startRow / BLOCK_SIZE; iBlock &lt; 1 + endRow / BLOCK_SIZE; ++iBlock) {<a name="line.1505"></a>
+<FONT color="green">1506</FONT>                final int p0     = iBlock * BLOCK_SIZE;<a name="line.1506"></a>
+<FONT color="green">1507</FONT>                final int pStart = Math.max(startRow, p0);<a name="line.1507"></a>
+<FONT color="green">1508</FONT>                final int pEnd   = Math.min((iBlock + 1) * BLOCK_SIZE, 1 + endRow);<a name="line.1508"></a>
+<FONT color="green">1509</FONT>                for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1509"></a>
+<FONT color="green">1510</FONT>                    for (int jBlock = startColumn / BLOCK_SIZE; jBlock &lt; 1 + endColumn / BLOCK_SIZE; ++jBlock) {<a name="line.1510"></a>
+<FONT color="green">1511</FONT>                        final int jWidth = blockWidth(jBlock);<a name="line.1511"></a>
+<FONT color="green">1512</FONT>                        final int q0     = jBlock * BLOCK_SIZE;<a name="line.1512"></a>
+<FONT color="green">1513</FONT>                        final int qStart = Math.max(startColumn, q0);<a name="line.1513"></a>
+<FONT color="green">1514</FONT>                        final int qEnd   = Math.min((jBlock + 1) * BLOCK_SIZE, 1 + endColumn);<a name="line.1514"></a>
+<FONT color="green">1515</FONT>                        final double[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1515"></a>
+<FONT color="green">1516</FONT>                        int k = (p - p0) * jWidth + qStart - q0;<a name="line.1516"></a>
+<FONT color="green">1517</FONT>                        for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1517"></a>
+<FONT color="green">1518</FONT>                            block[k] = visitor.visit(p, q, block[k]);<a name="line.1518"></a>
+<FONT color="green">1519</FONT>                            ++k;<a name="line.1519"></a>
+<FONT color="green">1520</FONT>                        }<a name="line.1520"></a>
+<FONT color="green">1521</FONT>                    }<a name="line.1521"></a>
+<FONT color="green">1522</FONT>                 }<a name="line.1522"></a>
+<FONT color="green">1523</FONT>            }<a name="line.1523"></a>
+<FONT color="green">1524</FONT>            return visitor.end();<a name="line.1524"></a>
+<FONT color="green">1525</FONT>        }<a name="line.1525"></a>
+<FONT color="green">1526</FONT>    <a name="line.1526"></a>
+<FONT color="green">1527</FONT>        /** {@inheritDoc} */<a name="line.1527"></a>
+<FONT color="green">1528</FONT>        @Override<a name="line.1528"></a>
+<FONT color="green">1529</FONT>        public double walkInRowOrder(final RealMatrixPreservingVisitor visitor,<a name="line.1529"></a>
+<FONT color="green">1530</FONT>                                     final int startRow, final int endRow,<a name="line.1530"></a>
+<FONT color="green">1531</FONT>                                     final int startColumn, final int endColumn)<a name="line.1531"></a>
+<FONT color="green">1532</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.1532"></a>
+<FONT color="green">1533</FONT>            MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);<a name="line.1533"></a>
+<FONT color="green">1534</FONT>            visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);<a name="line.1534"></a>
+<FONT color="green">1535</FONT>            for (int iBlock = startRow / BLOCK_SIZE; iBlock &lt; 1 + endRow / BLOCK_SIZE; ++iBlock) {<a name="line.1535"></a>
+<FONT color="green">1536</FONT>                final int p0     = iBlock * BLOCK_SIZE;<a name="line.1536"></a>
+<FONT color="green">1537</FONT>                final int pStart = Math.max(startRow, p0);<a name="line.1537"></a>
+<FONT color="green">1538</FONT>                final int pEnd   = Math.min((iBlock + 1) * BLOCK_SIZE, 1 + endRow);<a name="line.1538"></a>
+<FONT color="green">1539</FONT>                for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1539"></a>
+<FONT color="green">1540</FONT>                    for (int jBlock = startColumn / BLOCK_SIZE; jBlock &lt; 1 + endColumn / BLOCK_SIZE; ++jBlock) {<a name="line.1540"></a>
+<FONT color="green">1541</FONT>                        final int jWidth = blockWidth(jBlock);<a name="line.1541"></a>
+<FONT color="green">1542</FONT>                        final int q0     = jBlock * BLOCK_SIZE;<a name="line.1542"></a>
+<FONT color="green">1543</FONT>                        final int qStart = Math.max(startColumn, q0);<a name="line.1543"></a>
+<FONT color="green">1544</FONT>                        final int qEnd   = Math.min((jBlock + 1) * BLOCK_SIZE, 1 + endColumn);<a name="line.1544"></a>
+<FONT color="green">1545</FONT>                        final double[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1545"></a>
+<FONT color="green">1546</FONT>                        int k = (p - p0) * jWidth + qStart - q0;<a name="line.1546"></a>
+<FONT color="green">1547</FONT>                        for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1547"></a>
+<FONT color="green">1548</FONT>                            visitor.visit(p, q, block[k]);<a name="line.1548"></a>
+<FONT color="green">1549</FONT>                            ++k;<a name="line.1549"></a>
+<FONT color="green">1550</FONT>                        }<a name="line.1550"></a>
+<FONT color="green">1551</FONT>                    }<a name="line.1551"></a>
+<FONT color="green">1552</FONT>                 }<a name="line.1552"></a>
+<FONT color="green">1553</FONT>            }<a name="line.1553"></a>
+<FONT color="green">1554</FONT>            return visitor.end();<a name="line.1554"></a>
+<FONT color="green">1555</FONT>        }<a name="line.1555"></a>
+<FONT color="green">1556</FONT>    <a name="line.1556"></a>
+<FONT color="green">1557</FONT>        /** {@inheritDoc} */<a name="line.1557"></a>
+<FONT color="green">1558</FONT>        @Override<a name="line.1558"></a>
+<FONT color="green">1559</FONT>        public double walkInOptimizedOrder(final RealMatrixChangingVisitor visitor)<a name="line.1559"></a>
+<FONT color="green">1560</FONT>            throws MatrixVisitorException {<a name="line.1560"></a>
+<FONT color="green">1561</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.1561"></a>
+<FONT color="green">1562</FONT>            int blockIndex = 0;<a name="line.1562"></a>
+<FONT color="green">1563</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1563"></a>
+<FONT color="green">1564</FONT>                final int pStart = iBlock * BLOCK_SIZE;<a name="line.1564"></a>
+<FONT color="green">1565</FONT>                final int pEnd   = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.1565"></a>
+<FONT color="green">1566</FONT>                for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.1566"></a>
+<FONT color="green">1567</FONT>                    final int qStart = jBlock * BLOCK_SIZE;<a name="line.1567"></a>
+<FONT color="green">1568</FONT>                    final int qEnd   = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.1568"></a>
+<FONT color="green">1569</FONT>                    final double[] block = blocks[blockIndex];<a name="line.1569"></a>
+<FONT color="green">1570</FONT>                    int k = 0;<a name="line.1570"></a>
+<FONT color="green">1571</FONT>                    for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1571"></a>
+<FONT color="green">1572</FONT>                        for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1572"></a>
+<FONT color="green">1573</FONT>                            block[k] = visitor.visit(p, q, block[k]);<a name="line.1573"></a>
+<FONT color="green">1574</FONT>                            ++k;<a name="line.1574"></a>
+<FONT color="green">1575</FONT>                        }<a name="line.1575"></a>
+<FONT color="green">1576</FONT>                    }<a name="line.1576"></a>
+<FONT color="green">1577</FONT>                    ++blockIndex;<a name="line.1577"></a>
+<FONT color="green">1578</FONT>                }<a name="line.1578"></a>
+<FONT color="green">1579</FONT>            }<a name="line.1579"></a>
+<FONT color="green">1580</FONT>            return visitor.end();<a name="line.1580"></a>
+<FONT color="green">1581</FONT>        }<a name="line.1581"></a>
+<FONT color="green">1582</FONT>    <a name="line.1582"></a>
+<FONT color="green">1583</FONT>        /** {@inheritDoc} */<a name="line.1583"></a>
+<FONT color="green">1584</FONT>        @Override<a name="line.1584"></a>
+<FONT color="green">1585</FONT>        public double walkInOptimizedOrder(final RealMatrixPreservingVisitor visitor)<a name="line.1585"></a>
+<FONT color="green">1586</FONT>            throws MatrixVisitorException {<a name="line.1586"></a>
+<FONT color="green">1587</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.1587"></a>
+<FONT color="green">1588</FONT>            int blockIndex = 0;<a name="line.1588"></a>
+<FONT color="green">1589</FONT>            for (int iBlock = 0; iBlock &lt; blockRows; ++iBlock) {<a name="line.1589"></a>
+<FONT color="green">1590</FONT>                final int pStart = iBlock * BLOCK_SIZE;<a name="line.1590"></a>
+<FONT color="green">1591</FONT>                final int pEnd   = Math.min(pStart + BLOCK_SIZE, rows);<a name="line.1591"></a>
+<FONT color="green">1592</FONT>                for (int jBlock = 0; jBlock &lt; blockColumns; ++jBlock) {<a name="line.1592"></a>
+<FONT color="green">1593</FONT>                    final int qStart = jBlock * BLOCK_SIZE;<a name="line.1593"></a>
+<FONT color="green">1594</FONT>                    final int qEnd   = Math.min(qStart + BLOCK_SIZE, columns);<a name="line.1594"></a>
+<FONT color="green">1595</FONT>                    final double[] block = blocks[blockIndex];<a name="line.1595"></a>
+<FONT color="green">1596</FONT>                    int k = 0;<a name="line.1596"></a>
+<FONT color="green">1597</FONT>                    for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1597"></a>
+<FONT color="green">1598</FONT>                        for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1598"></a>
+<FONT color="green">1599</FONT>                            visitor.visit(p, q, block[k]);<a name="line.1599"></a>
+<FONT color="green">1600</FONT>                            ++k;<a name="line.1600"></a>
+<FONT color="green">1601</FONT>                        }<a name="line.1601"></a>
+<FONT color="green">1602</FONT>                    }<a name="line.1602"></a>
+<FONT color="green">1603</FONT>                    ++blockIndex;<a name="line.1603"></a>
+<FONT color="green">1604</FONT>                }<a name="line.1604"></a>
+<FONT color="green">1605</FONT>            }<a name="line.1605"></a>
+<FONT color="green">1606</FONT>            return visitor.end();<a name="line.1606"></a>
+<FONT color="green">1607</FONT>        }<a name="line.1607"></a>
+<FONT color="green">1608</FONT>    <a name="line.1608"></a>
+<FONT color="green">1609</FONT>        /** {@inheritDoc} */<a name="line.1609"></a>
+<FONT color="green">1610</FONT>        @Override<a name="line.1610"></a>
+<FONT color="green">1611</FONT>        public double walkInOptimizedOrder(final RealMatrixChangingVisitor visitor,<a name="line.1611"></a>
+<FONT color="green">1612</FONT>                                           final int startRow, final int endRow,<a name="line.1612"></a>
+<FONT color="green">1613</FONT>                                           final int startColumn, final int endColumn)<a name="line.1613"></a>
+<FONT color="green">1614</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.1614"></a>
+<FONT color="green">1615</FONT>            MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);<a name="line.1615"></a>
+<FONT color="green">1616</FONT>            visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);<a name="line.1616"></a>
+<FONT color="green">1617</FONT>            for (int iBlock = startRow / BLOCK_SIZE; iBlock &lt; 1 + endRow / BLOCK_SIZE; ++iBlock) {<a name="line.1617"></a>
+<FONT color="green">1618</FONT>                final int p0     = iBlock * BLOCK_SIZE;<a name="line.1618"></a>
+<FONT color="green">1619</FONT>                final int pStart = Math.max(startRow, p0);<a name="line.1619"></a>
+<FONT color="green">1620</FONT>                final int pEnd   = Math.min((iBlock + 1) * BLOCK_SIZE, 1 + endRow);<a name="line.1620"></a>
+<FONT color="green">1621</FONT>                for (int jBlock = startColumn / BLOCK_SIZE; jBlock &lt; 1 + endColumn / BLOCK_SIZE; ++jBlock) {<a name="line.1621"></a>
+<FONT color="green">1622</FONT>                    final int jWidth = blockWidth(jBlock);<a name="line.1622"></a>
+<FONT color="green">1623</FONT>                    final int q0     = jBlock * BLOCK_SIZE;<a name="line.1623"></a>
+<FONT color="green">1624</FONT>                    final int qStart = Math.max(startColumn, q0);<a name="line.1624"></a>
+<FONT color="green">1625</FONT>                    final int qEnd   = Math.min((jBlock + 1) * BLOCK_SIZE, 1 + endColumn);<a name="line.1625"></a>
+<FONT color="green">1626</FONT>                    final double[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1626"></a>
+<FONT color="green">1627</FONT>                    for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1627"></a>
+<FONT color="green">1628</FONT>                        int k = (p - p0) * jWidth + qStart - q0;<a name="line.1628"></a>
+<FONT color="green">1629</FONT>                        for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1629"></a>
+<FONT color="green">1630</FONT>                            block[k] = visitor.visit(p, q, block[k]);<a name="line.1630"></a>
+<FONT color="green">1631</FONT>                            ++k;<a name="line.1631"></a>
+<FONT color="green">1632</FONT>                        }<a name="line.1632"></a>
+<FONT color="green">1633</FONT>                    }<a name="line.1633"></a>
+<FONT color="green">1634</FONT>                }<a name="line.1634"></a>
+<FONT color="green">1635</FONT>            }<a name="line.1635"></a>
+<FONT color="green">1636</FONT>            return visitor.end();<a name="line.1636"></a>
+<FONT color="green">1637</FONT>        }<a name="line.1637"></a>
+<FONT color="green">1638</FONT>    <a name="line.1638"></a>
+<FONT color="green">1639</FONT>        /** {@inheritDoc} */<a name="line.1639"></a>
+<FONT color="green">1640</FONT>        @Override<a name="line.1640"></a>
+<FONT color="green">1641</FONT>        public double walkInOptimizedOrder(final RealMatrixPreservingVisitor visitor,<a name="line.1641"></a>
+<FONT color="green">1642</FONT>                                           final int startRow, final int endRow,<a name="line.1642"></a>
+<FONT color="green">1643</FONT>                                           final int startColumn, final int endColumn)<a name="line.1643"></a>
+<FONT color="green">1644</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.1644"></a>
+<FONT color="green">1645</FONT>            MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);<a name="line.1645"></a>
+<FONT color="green">1646</FONT>            visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);<a name="line.1646"></a>
+<FONT color="green">1647</FONT>            for (int iBlock = startRow / BLOCK_SIZE; iBlock &lt; 1 + endRow / BLOCK_SIZE; ++iBlock) {<a name="line.1647"></a>
+<FONT color="green">1648</FONT>                final int p0     = iBlock * BLOCK_SIZE;<a name="line.1648"></a>
+<FONT color="green">1649</FONT>                final int pStart = Math.max(startRow, p0);<a name="line.1649"></a>
+<FONT color="green">1650</FONT>                final int pEnd   = Math.min((iBlock + 1) * BLOCK_SIZE, 1 + endRow);<a name="line.1650"></a>
+<FONT color="green">1651</FONT>                for (int jBlock = startColumn / BLOCK_SIZE; jBlock &lt; 1 + endColumn / BLOCK_SIZE; ++jBlock) {<a name="line.1651"></a>
+<FONT color="green">1652</FONT>                    final int jWidth = blockWidth(jBlock);<a name="line.1652"></a>
+<FONT color="green">1653</FONT>                    final int q0     = jBlock * BLOCK_SIZE;<a name="line.1653"></a>
+<FONT color="green">1654</FONT>                    final int qStart = Math.max(startColumn, q0);<a name="line.1654"></a>
+<FONT color="green">1655</FONT>                    final int qEnd   = Math.min((jBlock + 1) * BLOCK_SIZE, 1 + endColumn);<a name="line.1655"></a>
+<FONT color="green">1656</FONT>                    final double[] block = blocks[iBlock * blockColumns + jBlock];<a name="line.1656"></a>
+<FONT color="green">1657</FONT>                    for (int p = pStart; p &lt; pEnd; ++p) {<a name="line.1657"></a>
+<FONT color="green">1658</FONT>                        int k = (p - p0) * jWidth + qStart - q0;<a name="line.1658"></a>
+<FONT color="green">1659</FONT>                        for (int q = qStart; q &lt; qEnd; ++q) {<a name="line.1659"></a>
+<FONT color="green">1660</FONT>                            visitor.visit(p, q, block[k]);<a name="line.1660"></a>
+<FONT color="green">1661</FONT>                            ++k;<a name="line.1661"></a>
+<FONT color="green">1662</FONT>                        }<a name="line.1662"></a>
+<FONT color="green">1663</FONT>                    }<a name="line.1663"></a>
+<FONT color="green">1664</FONT>                }<a name="line.1664"></a>
+<FONT color="green">1665</FONT>            }<a name="line.1665"></a>
+<FONT color="green">1666</FONT>            return visitor.end();<a name="line.1666"></a>
+<FONT color="green">1667</FONT>        }<a name="line.1667"></a>
+<FONT color="green">1668</FONT>    <a name="line.1668"></a>
+<FONT color="green">1669</FONT>        /**<a name="line.1669"></a>
+<FONT color="green">1670</FONT>         * Get the height of a block.<a name="line.1670"></a>
+<FONT color="green">1671</FONT>         * @param blockRow row index (in block sense) of the block<a name="line.1671"></a>
+<FONT color="green">1672</FONT>         * @return height (number of rows) of the block<a name="line.1672"></a>
+<FONT color="green">1673</FONT>         */<a name="line.1673"></a>
+<FONT color="green">1674</FONT>        private int blockHeight(final int blockRow) {<a name="line.1674"></a>
+<FONT color="green">1675</FONT>            return (blockRow == blockRows - 1) ? rows - blockRow * BLOCK_SIZE : BLOCK_SIZE;<a name="line.1675"></a>
+<FONT color="green">1676</FONT>        }<a name="line.1676"></a>
+<FONT color="green">1677</FONT>    <a name="line.1677"></a>
+<FONT color="green">1678</FONT>        /**<a name="line.1678"></a>
+<FONT color="green">1679</FONT>         * Get the width of a block.<a name="line.1679"></a>
+<FONT color="green">1680</FONT>         * @param blockColumn column index (in block sense) of the block<a name="line.1680"></a>
+<FONT color="green">1681</FONT>         * @return width (number of columns) of the block<a name="line.1681"></a>
+<FONT color="green">1682</FONT>         */<a name="line.1682"></a>
+<FONT color="green">1683</FONT>        private int blockWidth(final int blockColumn) {<a name="line.1683"></a>
+<FONT color="green">1684</FONT>            return (blockColumn == blockColumns - 1) ? columns - blockColumn * BLOCK_SIZE : BLOCK_SIZE;<a name="line.1684"></a>
+<FONT color="green">1685</FONT>        }<a name="line.1685"></a>
+<FONT color="green">1686</FONT>    <a name="line.1686"></a>
+<FONT color="green">1687</FONT>    }<a name="line.1687"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/CholeskyDecomposition.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,137 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * An interface to classes that implement an algorithm to calculate the<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Cholesky decomposition of a real symmetric positive-definite matrix.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;This interface is based on the class with similar name from the<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;a href="http://math.nist.gov/javanumerics/jama/"&gt;JAMA&lt;/a&gt; library, with the<a name="line.25"></a>
+<FONT color="green">026</FONT>     * following changes:&lt;/p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;ul&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     *   &lt;li&gt;a {@link #getLT() getLT} method has been added,&lt;/li&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     *   &lt;li&gt;the &lt;code&gt;isspd&lt;/code&gt; method has been removed, the constructors of<a name="line.29"></a>
+<FONT color="green">030</FONT>     *   implementation classes being expected to throw {@link<a name="line.30"></a>
+<FONT color="green">031</FONT>     *   NotPositiveDefiniteMatrixException} when a matrix cannot be decomposed,&lt;/li&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     *   &lt;li&gt;a {@link #getDeterminant() getDeterminant} method has been added,&lt;/li&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     *   &lt;li&gt;the &lt;code&gt;solve&lt;/code&gt; method has been replaced by a {@link<a name="line.33"></a>
+<FONT color="green">034</FONT>     *   #getSolver() getSolver} method and the equivalent method provided by<a name="line.34"></a>
+<FONT color="green">035</FONT>     *   the returned {@link DecompositionSolver}.&lt;/li&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;/ul&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @see &lt;a href="http://mathworld.wolfram.com/CholeskyDecomposition.html"&gt;MathWorld&lt;/a&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @see &lt;a href="http://en.wikipedia.org/wiki/Cholesky_decomposition"&gt;Wikipedia&lt;/a&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @version $Revision: 826627 $ $Date: 2009-10-19 06:27:47 -0400 (Mon, 19 Oct 2009) $<a name="line.40"></a>
+<FONT color="green">041</FONT>     * @since 2.0<a name="line.41"></a>
+<FONT color="green">042</FONT>     */<a name="line.42"></a>
+<FONT color="green">043</FONT>    public interface CholeskyDecomposition {<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**<a name="line.45"></a>
+<FONT color="green">046</FONT>         * Returns the matrix L of the decomposition.<a name="line.46"></a>
+<FONT color="green">047</FONT>         * &lt;p&gt;L is an lower-triangular matrix&lt;/p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @return the L matrix<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        RealMatrix getL();<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * Returns the transpose of the matrix L of the decomposition.<a name="line.53"></a>
+<FONT color="green">054</FONT>         * &lt;p&gt;L&lt;sup&gt;T&lt;/sup&gt; is an upper-triangular matrix&lt;/p&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @return the transpose of the matrix L of the decomposition<a name="line.55"></a>
+<FONT color="green">056</FONT>         */<a name="line.56"></a>
+<FONT color="green">057</FONT>        RealMatrix getLT();<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /**<a name="line.59"></a>
+<FONT color="green">060</FONT>         * Return the determinant of the matrix<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @return determinant of the matrix<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        double getDeterminant();<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /**<a name="line.65"></a>
+<FONT color="green">066</FONT>         * Get a solver for finding the A &amp;times; X = B solution in least square sense.<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @return a solver<a name="line.67"></a>
+<FONT color="green">068</FONT>         */<a name="line.68"></a>
+<FONT color="green">069</FONT>        DecompositionSolver getSolver();<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>    }<a name="line.71"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/CholeskyDecompositionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,420 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Calculates the Cholesky decomposition of a matrix.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;The Cholesky decomposition of a real symmetric positive-definite<a name="line.25"></a>
+<FONT color="green">026</FONT>     * matrix A consists of a lower triangular matrix L with same size that<a name="line.26"></a>
+<FONT color="green">027</FONT>     * satisfy: A = LL&lt;sup&gt;T&lt;/sup&gt;Q = I). In a sense, this is the square root of A.&lt;/p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @see &lt;a href="http://mathworld.wolfram.com/CholeskyDecomposition.html"&gt;MathWorld&lt;/a&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @see &lt;a href="http://en.wikipedia.org/wiki/Cholesky_decomposition"&gt;Wikipedia&lt;/a&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 2.0<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public class CholeskyDecompositionImpl implements CholeskyDecomposition {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Default threshold above which off-diagonal elements are considered too different<a name="line.36"></a>
+<FONT color="green">037</FONT>         * and matrix not symmetric. */<a name="line.37"></a>
+<FONT color="green">038</FONT>        public static final double DEFAULT_RELATIVE_SYMMETRY_THRESHOLD = 1.0e-15;<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Default threshold below which diagonal elements are considered null<a name="line.40"></a>
+<FONT color="green">041</FONT>         * and matrix not positive definite. */<a name="line.41"></a>
+<FONT color="green">042</FONT>        public static final double DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD = 1.0e-10;<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Row-oriented storage for L&lt;sup&gt;T&lt;/sup&gt; matrix data. */<a name="line.44"></a>
+<FONT color="green">045</FONT>        private double[][] lTData;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** Cached value of L. */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private RealMatrix cachedL;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Cached value of LT. */<a name="line.50"></a>
+<FONT color="green">051</FONT>        private RealMatrix cachedLT;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Calculates the Cholesky decomposition of the given matrix.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * &lt;p&gt;<a name="line.55"></a>
+<FONT color="green">056</FONT>         * Calling this constructor is equivalent to call {@link<a name="line.56"></a>
+<FONT color="green">057</FONT>         * #CholeskyDecompositionImpl(RealMatrix, double, double)} with the<a name="line.57"></a>
+<FONT color="green">058</FONT>         * thresholds set to the default values {@link<a name="line.58"></a>
+<FONT color="green">059</FONT>         * #DEFAULT_RELATIVE_SYMMETRY_THRESHOLD} and {@link<a name="line.59"></a>
+<FONT color="green">060</FONT>         * #DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD}<a name="line.60"></a>
+<FONT color="green">061</FONT>         * &lt;/p&gt;<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param matrix the matrix to decompose<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @exception NonSquareMatrixException if matrix is not square<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @exception NotSymmetricMatrixException if matrix is not symmetric<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @exception NotPositiveDefiniteMatrixException if the matrix is not<a name="line.65"></a>
+<FONT color="green">066</FONT>         * strictly positive definite<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @see #CholeskyDecompositionImpl(RealMatrix, double, double)<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @see #DEFAULT_RELATIVE_SYMMETRY_THRESHOLD<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @see #DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        public CholeskyDecompositionImpl(final RealMatrix matrix)<a name="line.71"></a>
+<FONT color="green">072</FONT>            throws NonSquareMatrixException,<a name="line.72"></a>
+<FONT color="green">073</FONT>                   NotSymmetricMatrixException, NotPositiveDefiniteMatrixException {<a name="line.73"></a>
+<FONT color="green">074</FONT>            this(matrix, DEFAULT_RELATIVE_SYMMETRY_THRESHOLD,<a name="line.74"></a>
+<FONT color="green">075</FONT>                 DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD);<a name="line.75"></a>
+<FONT color="green">076</FONT>        }<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /**<a name="line.78"></a>
+<FONT color="green">079</FONT>         * Calculates the Cholesky decomposition of the given matrix.<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @param matrix the matrix to decompose<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @param relativeSymmetryThreshold threshold above which off-diagonal<a name="line.81"></a>
+<FONT color="green">082</FONT>         * elements are considered too different and matrix not symmetric<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param absolutePositivityThreshold threshold below which diagonal<a name="line.83"></a>
+<FONT color="green">084</FONT>         * elements are considered null and matrix not positive definite<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @exception NonSquareMatrixException if matrix is not square<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @exception NotSymmetricMatrixException if matrix is not symmetric<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @exception NotPositiveDefiniteMatrixException if the matrix is not<a name="line.87"></a>
+<FONT color="green">088</FONT>         * strictly positive definite<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @see #CholeskyDecompositionImpl(RealMatrix)<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @see #DEFAULT_RELATIVE_SYMMETRY_THRESHOLD<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @see #DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD<a name="line.91"></a>
+<FONT color="green">092</FONT>         */<a name="line.92"></a>
+<FONT color="green">093</FONT>        public CholeskyDecompositionImpl(final RealMatrix matrix,<a name="line.93"></a>
+<FONT color="green">094</FONT>                                         final double relativeSymmetryThreshold,<a name="line.94"></a>
+<FONT color="green">095</FONT>                                         final double absolutePositivityThreshold)<a name="line.95"></a>
+<FONT color="green">096</FONT>            throws NonSquareMatrixException,<a name="line.96"></a>
+<FONT color="green">097</FONT>                   NotSymmetricMatrixException, NotPositiveDefiniteMatrixException {<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>            if (!matrix.isSquare()) {<a name="line.99"></a>
+<FONT color="green">100</FONT>                throw new NonSquareMatrixException(matrix.getRowDimension(),<a name="line.100"></a>
+<FONT color="green">101</FONT>                                                   matrix.getColumnDimension());<a name="line.101"></a>
+<FONT color="green">102</FONT>            }<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>            final int order = matrix.getRowDimension();<a name="line.104"></a>
+<FONT color="green">105</FONT>            lTData   = matrix.getData();<a name="line.105"></a>
+<FONT color="green">106</FONT>            cachedL  = null;<a name="line.106"></a>
+<FONT color="green">107</FONT>            cachedLT = null;<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>            // check the matrix before transformation<a name="line.109"></a>
+<FONT color="green">110</FONT>            for (int i = 0; i &lt; order; ++i) {<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>                final double[] lI = lTData[i];<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>                // check off-diagonal elements (and reset them to 0)<a name="line.114"></a>
+<FONT color="green">115</FONT>                for (int j = i + 1; j &lt; order; ++j) {<a name="line.115"></a>
+<FONT color="green">116</FONT>                    final double[] lJ = lTData[j];<a name="line.116"></a>
+<FONT color="green">117</FONT>                    final double lIJ = lI[j];<a name="line.117"></a>
+<FONT color="green">118</FONT>                    final double lJI = lJ[i];<a name="line.118"></a>
+<FONT color="green">119</FONT>                    final double maxDelta =<a name="line.119"></a>
+<FONT color="green">120</FONT>                        relativeSymmetryThreshold * Math.max(Math.abs(lIJ), Math.abs(lJI));<a name="line.120"></a>
+<FONT color="green">121</FONT>                    if (Math.abs(lIJ - lJI) &gt; maxDelta) {<a name="line.121"></a>
+<FONT color="green">122</FONT>                        throw new NotSymmetricMatrixException();<a name="line.122"></a>
+<FONT color="green">123</FONT>                    }<a name="line.123"></a>
+<FONT color="green">124</FONT>                    lJ[i] = 0;<a name="line.124"></a>
+<FONT color="green">125</FONT>               }<a name="line.125"></a>
+<FONT color="green">126</FONT>            }<a name="line.126"></a>
+<FONT color="green">127</FONT>    <a name="line.127"></a>
+<FONT color="green">128</FONT>            // transform the matrix<a name="line.128"></a>
+<FONT color="green">129</FONT>            for (int i = 0; i &lt; order; ++i) {<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>                final double[] ltI = lTData[i];<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>                // check diagonal element<a name="line.133"></a>
+<FONT color="green">134</FONT>                if (ltI[i] &lt; absolutePositivityThreshold) {<a name="line.134"></a>
+<FONT color="green">135</FONT>                    throw new NotPositiveDefiniteMatrixException();<a name="line.135"></a>
+<FONT color="green">136</FONT>                }<a name="line.136"></a>
+<FONT color="green">137</FONT>    <a name="line.137"></a>
+<FONT color="green">138</FONT>                ltI[i] = Math.sqrt(ltI[i]);<a name="line.138"></a>
+<FONT color="green">139</FONT>                final double inverse = 1.0 / ltI[i];<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>                for (int q = order - 1; q &gt; i; --q) {<a name="line.141"></a>
+<FONT color="green">142</FONT>                    ltI[q] *= inverse;<a name="line.142"></a>
+<FONT color="green">143</FONT>                    final double[] ltQ = lTData[q];<a name="line.143"></a>
+<FONT color="green">144</FONT>                    for (int p = q; p &lt; order; ++p) {<a name="line.144"></a>
+<FONT color="green">145</FONT>                        ltQ[p] -= ltI[q] * ltI[p];<a name="line.145"></a>
+<FONT color="green">146</FONT>                    }<a name="line.146"></a>
+<FONT color="green">147</FONT>                }<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>            }<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>        }<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>        /** {@inheritDoc} */<a name="line.153"></a>
+<FONT color="green">154</FONT>        public RealMatrix getL() {<a name="line.154"></a>
+<FONT color="green">155</FONT>            if (cachedL == null) {<a name="line.155"></a>
+<FONT color="green">156</FONT>                cachedL = getLT().transpose();<a name="line.156"></a>
+<FONT color="green">157</FONT>            }<a name="line.157"></a>
+<FONT color="green">158</FONT>            return cachedL;<a name="line.158"></a>
+<FONT color="green">159</FONT>        }<a name="line.159"></a>
+<FONT color="green">160</FONT>    <a name="line.160"></a>
+<FONT color="green">161</FONT>        /** {@inheritDoc} */<a name="line.161"></a>
+<FONT color="green">162</FONT>        public RealMatrix getLT() {<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>            if (cachedLT == null) {<a name="line.164"></a>
+<FONT color="green">165</FONT>                cachedLT = MatrixUtils.createRealMatrix(lTData);<a name="line.165"></a>
+<FONT color="green">166</FONT>            }<a name="line.166"></a>
+<FONT color="green">167</FONT>    <a name="line.167"></a>
+<FONT color="green">168</FONT>            // return the cached matrix<a name="line.168"></a>
+<FONT color="green">169</FONT>            return cachedLT;<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>        }<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>        /** {@inheritDoc} */<a name="line.173"></a>
+<FONT color="green">174</FONT>        public double getDeterminant() {<a name="line.174"></a>
+<FONT color="green">175</FONT>            double determinant = 1.0;<a name="line.175"></a>
+<FONT color="green">176</FONT>            for (int i = 0; i &lt; lTData.length; ++i) {<a name="line.176"></a>
+<FONT color="green">177</FONT>                double lTii = lTData[i][i];<a name="line.177"></a>
+<FONT color="green">178</FONT>                determinant *= lTii * lTii;<a name="line.178"></a>
+<FONT color="green">179</FONT>            }<a name="line.179"></a>
+<FONT color="green">180</FONT>            return determinant;<a name="line.180"></a>
+<FONT color="green">181</FONT>        }<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>        /** {@inheritDoc} */<a name="line.183"></a>
+<FONT color="green">184</FONT>        public DecompositionSolver getSolver() {<a name="line.184"></a>
+<FONT color="green">185</FONT>            return new Solver(lTData);<a name="line.185"></a>
+<FONT color="green">186</FONT>        }<a name="line.186"></a>
+<FONT color="green">187</FONT>    <a name="line.187"></a>
+<FONT color="green">188</FONT>        /** Specialized solver. */<a name="line.188"></a>
+<FONT color="green">189</FONT>        private static class Solver implements DecompositionSolver {<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>            /** Row-oriented storage for L&lt;sup&gt;T&lt;/sup&gt; matrix data. */<a name="line.191"></a>
+<FONT color="green">192</FONT>            private final double[][] lTData;<a name="line.192"></a>
+<FONT color="green">193</FONT>    <a name="line.193"></a>
+<FONT color="green">194</FONT>            /**<a name="line.194"></a>
+<FONT color="green">195</FONT>             * Build a solver from decomposed matrix.<a name="line.195"></a>
+<FONT color="green">196</FONT>             * @param lTData row-oriented storage for L&lt;sup&gt;T&lt;/sup&gt; matrix data<a name="line.196"></a>
+<FONT color="green">197</FONT>             */<a name="line.197"></a>
+<FONT color="green">198</FONT>            private Solver(final double[][] lTData) {<a name="line.198"></a>
+<FONT color="green">199</FONT>                this.lTData = lTData;<a name="line.199"></a>
+<FONT color="green">200</FONT>            }<a name="line.200"></a>
+<FONT color="green">201</FONT>    <a name="line.201"></a>
+<FONT color="green">202</FONT>            /** {@inheritDoc} */<a name="line.202"></a>
+<FONT color="green">203</FONT>            public boolean isNonSingular() {<a name="line.203"></a>
+<FONT color="green">204</FONT>                // if we get this far, the matrix was positive definite, hence non-singular<a name="line.204"></a>
+<FONT color="green">205</FONT>                return true;<a name="line.205"></a>
+<FONT color="green">206</FONT>            }<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>            /** {@inheritDoc} */<a name="line.208"></a>
+<FONT color="green">209</FONT>            public double[] solve(double[] b)<a name="line.209"></a>
+<FONT color="green">210</FONT>                throws IllegalArgumentException, InvalidMatrixException {<a name="line.210"></a>
+<FONT color="green">211</FONT>    <a name="line.211"></a>
+<FONT color="green">212</FONT>                final int m = lTData.length;<a name="line.212"></a>
+<FONT color="green">213</FONT>                if (b.length != m) {<a name="line.213"></a>
+<FONT color="green">214</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.214"></a>
+<FONT color="green">215</FONT>                            "vector length mismatch: got {0} but expected {1}",<a name="line.215"></a>
+<FONT color="green">216</FONT>                            b.length, m);<a name="line.216"></a>
+<FONT color="green">217</FONT>                }<a name="line.217"></a>
+<FONT color="green">218</FONT>    <a name="line.218"></a>
+<FONT color="green">219</FONT>                final double[] x = b.clone();<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>                // Solve LY = b<a name="line.221"></a>
+<FONT color="green">222</FONT>                for (int j = 0; j &lt; m; j++) {<a name="line.222"></a>
+<FONT color="green">223</FONT>                    final double[] lJ = lTData[j];<a name="line.223"></a>
+<FONT color="green">224</FONT>                    x[j] /= lJ[j];<a name="line.224"></a>
+<FONT color="green">225</FONT>                    final double xJ = x[j];<a name="line.225"></a>
+<FONT color="green">226</FONT>                    for (int i = j + 1; i &lt; m; i++) {<a name="line.226"></a>
+<FONT color="green">227</FONT>                        x[i] -= xJ * lJ[i];<a name="line.227"></a>
+<FONT color="green">228</FONT>                    }<a name="line.228"></a>
+<FONT color="green">229</FONT>                }<a name="line.229"></a>
+<FONT color="green">230</FONT>    <a name="line.230"></a>
+<FONT color="green">231</FONT>                // Solve LTX = Y<a name="line.231"></a>
+<FONT color="green">232</FONT>                for (int j = m - 1; j &gt;= 0; j--) {<a name="line.232"></a>
+<FONT color="green">233</FONT>                    x[j] /= lTData[j][j];<a name="line.233"></a>
+<FONT color="green">234</FONT>                    final double xJ = x[j];<a name="line.234"></a>
+<FONT color="green">235</FONT>                    for (int i = 0; i &lt; j; i++) {<a name="line.235"></a>
+<FONT color="green">236</FONT>                        x[i] -= xJ * lTData[i][j];<a name="line.236"></a>
+<FONT color="green">237</FONT>                    }<a name="line.237"></a>
+<FONT color="green">238</FONT>                }<a name="line.238"></a>
+<FONT color="green">239</FONT>    <a name="line.239"></a>
+<FONT color="green">240</FONT>                return x;<a name="line.240"></a>
+<FONT color="green">241</FONT>    <a name="line.241"></a>
+<FONT color="green">242</FONT>            }<a name="line.242"></a>
+<FONT color="green">243</FONT>    <a name="line.243"></a>
+<FONT color="green">244</FONT>            /** {@inheritDoc} */<a name="line.244"></a>
+<FONT color="green">245</FONT>            public RealVector solve(RealVector b)<a name="line.245"></a>
+<FONT color="green">246</FONT>                throws IllegalArgumentException, InvalidMatrixException {<a name="line.246"></a>
+<FONT color="green">247</FONT>                try {<a name="line.247"></a>
+<FONT color="green">248</FONT>                    return solve((ArrayRealVector) b);<a name="line.248"></a>
+<FONT color="green">249</FONT>                } catch (ClassCastException cce) {<a name="line.249"></a>
+<FONT color="green">250</FONT>    <a name="line.250"></a>
+<FONT color="green">251</FONT>                    final int m = lTData.length;<a name="line.251"></a>
+<FONT color="green">252</FONT>                    if (b.getDimension() != m) {<a name="line.252"></a>
+<FONT color="green">253</FONT>                        throw MathRuntimeException.createIllegalArgumentException(<a name="line.253"></a>
+<FONT color="green">254</FONT>                                "vector length mismatch: got {0} but expected {1}",<a name="line.254"></a>
+<FONT color="green">255</FONT>                                b.getDimension(), m);<a name="line.255"></a>
+<FONT color="green">256</FONT>                    }<a name="line.256"></a>
+<FONT color="green">257</FONT>    <a name="line.257"></a>
+<FONT color="green">258</FONT>                    final double[] x = b.getData();<a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>                    // Solve LY = b<a name="line.260"></a>
+<FONT color="green">261</FONT>                    for (int j = 0; j &lt; m; j++) {<a name="line.261"></a>
+<FONT color="green">262</FONT>                        final double[] lJ = lTData[j];<a name="line.262"></a>
+<FONT color="green">263</FONT>                        x[j] /= lJ[j];<a name="line.263"></a>
+<FONT color="green">264</FONT>                        final double xJ = x[j];<a name="line.264"></a>
+<FONT color="green">265</FONT>                        for (int i = j + 1; i &lt; m; i++) {<a name="line.265"></a>
+<FONT color="green">266</FONT>                            x[i] -= xJ * lJ[i];<a name="line.266"></a>
+<FONT color="green">267</FONT>                        }<a name="line.267"></a>
+<FONT color="green">268</FONT>                    }<a name="line.268"></a>
+<FONT color="green">269</FONT>    <a name="line.269"></a>
+<FONT color="green">270</FONT>                    // Solve LTX = Y<a name="line.270"></a>
+<FONT color="green">271</FONT>                    for (int j = m - 1; j &gt;= 0; j--) {<a name="line.271"></a>
+<FONT color="green">272</FONT>                        x[j] /= lTData[j][j];<a name="line.272"></a>
+<FONT color="green">273</FONT>                        final double xJ = x[j];<a name="line.273"></a>
+<FONT color="green">274</FONT>                        for (int i = 0; i &lt; j; i++) {<a name="line.274"></a>
+<FONT color="green">275</FONT>                            x[i] -= xJ * lTData[i][j];<a name="line.275"></a>
+<FONT color="green">276</FONT>                        }<a name="line.276"></a>
+<FONT color="green">277</FONT>                    }<a name="line.277"></a>
+<FONT color="green">278</FONT>    <a name="line.278"></a>
+<FONT color="green">279</FONT>                    return new ArrayRealVector(x, false);<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>                }<a name="line.281"></a>
+<FONT color="green">282</FONT>            }<a name="line.282"></a>
+<FONT color="green">283</FONT>    <a name="line.283"></a>
+<FONT color="green">284</FONT>            /** Solve the linear equation A &amp;times; X = B.<a name="line.284"></a>
+<FONT color="green">285</FONT>             * &lt;p&gt;The A matrix is implicit here. It is &lt;/p&gt;<a name="line.285"></a>
+<FONT color="green">286</FONT>             * @param b right-hand side of the equation A &amp;times; X = B<a name="line.286"></a>
+<FONT color="green">287</FONT>             * @return a vector X such that A &amp;times; X = B<a name="line.287"></a>
+<FONT color="green">288</FONT>             * @exception IllegalArgumentException if matrices dimensions don't match<a name="line.288"></a>
+<FONT color="green">289</FONT>             * @exception InvalidMatrixException if decomposed matrix is singular<a name="line.289"></a>
+<FONT color="green">290</FONT>             */<a name="line.290"></a>
+<FONT color="green">291</FONT>            public ArrayRealVector solve(ArrayRealVector b)<a name="line.291"></a>
+<FONT color="green">292</FONT>                throws IllegalArgumentException, InvalidMatrixException {<a name="line.292"></a>
+<FONT color="green">293</FONT>                return new ArrayRealVector(solve(b.getDataRef()), false);<a name="line.293"></a>
+<FONT color="green">294</FONT>            }<a name="line.294"></a>
+<FONT color="green">295</FONT>    <a name="line.295"></a>
+<FONT color="green">296</FONT>            /** {@inheritDoc} */<a name="line.296"></a>
+<FONT color="green">297</FONT>            public RealMatrix solve(RealMatrix b)<a name="line.297"></a>
+<FONT color="green">298</FONT>                throws IllegalArgumentException, InvalidMatrixException {<a name="line.298"></a>
+<FONT color="green">299</FONT>    <a name="line.299"></a>
+<FONT color="green">300</FONT>                final int m = lTData.length;<a name="line.300"></a>
+<FONT color="green">301</FONT>                if (b.getRowDimension() != m) {<a name="line.301"></a>
+<FONT color="green">302</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.302"></a>
+<FONT color="green">303</FONT>                            "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.303"></a>
+<FONT color="green">304</FONT>                            b.getRowDimension(), b.getColumnDimension(), m, "n");<a name="line.304"></a>
+<FONT color="green">305</FONT>                }<a name="line.305"></a>
+<FONT color="green">306</FONT>    <a name="line.306"></a>
+<FONT color="green">307</FONT>                final int nColB = b.getColumnDimension();<a name="line.307"></a>
+<FONT color="green">308</FONT>                double[][] x = b.getData();<a name="line.308"></a>
+<FONT color="green">309</FONT>    <a name="line.309"></a>
+<FONT color="green">310</FONT>                // Solve LY = b<a name="line.310"></a>
+<FONT color="green">311</FONT>                for (int j = 0; j &lt; m; j++) {<a name="line.311"></a>
+<FONT color="green">312</FONT>                    final double[] lJ = lTData[j];<a name="line.312"></a>
+<FONT color="green">313</FONT>                    final double lJJ = lJ[j];<a name="line.313"></a>
+<FONT color="green">314</FONT>                    final double[] xJ = x[j];<a name="line.314"></a>
+<FONT color="green">315</FONT>                    for (int k = 0; k &lt; nColB; ++k) {<a name="line.315"></a>
+<FONT color="green">316</FONT>                        xJ[k] /= lJJ;<a name="line.316"></a>
+<FONT color="green">317</FONT>                    }<a name="line.317"></a>
+<FONT color="green">318</FONT>                    for (int i = j + 1; i &lt; m; i++) {<a name="line.318"></a>
+<FONT color="green">319</FONT>                        final double[] xI = x[i];<a name="line.319"></a>
+<FONT color="green">320</FONT>                        final double lJI = lJ[i];<a name="line.320"></a>
+<FONT color="green">321</FONT>                        for (int k = 0; k &lt; nColB; ++k) {<a name="line.321"></a>
+<FONT color="green">322</FONT>                            xI[k] -= xJ[k] * lJI;<a name="line.322"></a>
+<FONT color="green">323</FONT>                        }<a name="line.323"></a>
+<FONT color="green">324</FONT>                    }<a name="line.324"></a>
+<FONT color="green">325</FONT>                }<a name="line.325"></a>
+<FONT color="green">326</FONT>    <a name="line.326"></a>
+<FONT color="green">327</FONT>                // Solve LTX = Y<a name="line.327"></a>
+<FONT color="green">328</FONT>                for (int j = m - 1; j &gt;= 0; j--) {<a name="line.328"></a>
+<FONT color="green">329</FONT>                    final double lJJ = lTData[j][j];<a name="line.329"></a>
+<FONT color="green">330</FONT>                    final double[] xJ = x[j];<a name="line.330"></a>
+<FONT color="green">331</FONT>                    for (int k = 0; k &lt; nColB; ++k) {<a name="line.331"></a>
+<FONT color="green">332</FONT>                        xJ[k] /= lJJ;<a name="line.332"></a>
+<FONT color="green">333</FONT>                    }<a name="line.333"></a>
+<FONT color="green">334</FONT>                    for (int i = 0; i &lt; j; i++) {<a name="line.334"></a>
+<FONT color="green">335</FONT>                        final double[] xI = x[i];<a name="line.335"></a>
+<FONT color="green">336</FONT>                        final double lIJ = lTData[i][j];<a name="line.336"></a>
+<FONT color="green">337</FONT>                        for (int k = 0; k &lt; nColB; ++k) {<a name="line.337"></a>
+<FONT color="green">338</FONT>                            xI[k] -= xJ[k] * lIJ;<a name="line.338"></a>
+<FONT color="green">339</FONT>                        }<a name="line.339"></a>
+<FONT color="green">340</FONT>                    }<a name="line.340"></a>
+<FONT color="green">341</FONT>                }<a name="line.341"></a>
+<FONT color="green">342</FONT>    <a name="line.342"></a>
+<FONT color="green">343</FONT>                return new Array2DRowRealMatrix(x, false);<a name="line.343"></a>
+<FONT color="green">344</FONT>    <a name="line.344"></a>
+<FONT color="green">345</FONT>            }<a name="line.345"></a>
+<FONT color="green">346</FONT>    <a name="line.346"></a>
+<FONT color="green">347</FONT>            /** {@inheritDoc} */<a name="line.347"></a>
+<FONT color="green">348</FONT>            public RealMatrix getInverse() throws InvalidMatrixException {<a name="line.348"></a>
+<FONT color="green">349</FONT>                return solve(MatrixUtils.createRealIdentityMatrix(lTData.length));<a name="line.349"></a>
+<FONT color="green">350</FONT>            }<a name="line.350"></a>
+<FONT color="green">351</FONT>    <a name="line.351"></a>
+<FONT color="green">352</FONT>        }<a name="line.352"></a>
+<FONT color="green">353</FONT>    <a name="line.353"></a>
+<FONT color="green">354</FONT>    }<a name="line.354"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/DecompositionSolver.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,150 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Interface handling decomposition algorithms that can solve A &amp;times; X = B.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;Decomposition algorithms decompose an A matrix has a product of several specific<a name="line.24"></a>
+<FONT color="green">025</FONT>     * matrices from which they can solve A &amp;times; X = B in least squares sense: they find X<a name="line.25"></a>
+<FONT color="green">026</FONT>     * such that ||A &amp;times; X - B|| is minimal.&lt;/p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;Some solvers like {@link LUDecomposition} can only find the solution for<a name="line.27"></a>
+<FONT color="green">028</FONT>     * square matrices and when the solution is an exact linear solution, i.e. when<a name="line.28"></a>
+<FONT color="green">029</FONT>     * ||A &amp;times; X - B|| is exactly 0. Other solvers can also find solutions<a name="line.29"></a>
+<FONT color="green">030</FONT>     * with non-square matrix A and with non-null minimal norm. If an exact linear<a name="line.30"></a>
+<FONT color="green">031</FONT>     * solution exists it is also the minimal norm solution.&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     *<a name="line.32"></a>
+<FONT color="green">033</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @since 2.0<a name="line.34"></a>
+<FONT color="green">035</FONT>     */<a name="line.35"></a>
+<FONT color="green">036</FONT>    public interface DecompositionSolver {<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Solve the linear equation A &amp;times; X = B for matrices A.<a name="line.38"></a>
+<FONT color="green">039</FONT>         * &lt;p&gt;The A matrix is implicit, it is provided by the underlying<a name="line.39"></a>
+<FONT color="green">040</FONT>         * decomposition algorithm.&lt;/p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @param b right-hand side of the equation A &amp;times; X = B<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @return a vector X that minimizes the two norm of A &amp;times; X - B<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @exception IllegalArgumentException if matrices dimensions don't match<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @exception InvalidMatrixException if decomposed matrix is singular<a name="line.44"></a>
+<FONT color="green">045</FONT>         */<a name="line.45"></a>
+<FONT color="green">046</FONT>        double[] solve(final double[] b)<a name="line.46"></a>
+<FONT color="green">047</FONT>            throws IllegalArgumentException, InvalidMatrixException;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** Solve the linear equation A &amp;times; X = B for matrices A.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * &lt;p&gt;The A matrix is implicit, it is provided by the underlying<a name="line.50"></a>
+<FONT color="green">051</FONT>         * decomposition algorithm.&lt;/p&gt;<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @param b right-hand side of the equation A &amp;times; X = B<a name="line.52"></a>
+<FONT color="green">053</FONT>         * @return a vector X that minimizes the two norm of A &amp;times; X - B<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @exception IllegalArgumentException if matrices dimensions don't match<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @exception InvalidMatrixException if decomposed matrix is singular<a name="line.55"></a>
+<FONT color="green">056</FONT>         */<a name="line.56"></a>
+<FONT color="green">057</FONT>        RealVector solve(final RealVector b)<a name="line.57"></a>
+<FONT color="green">058</FONT>            throws IllegalArgumentException, InvalidMatrixException;<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Solve the linear equation A &amp;times; X = B for matrices A.<a name="line.60"></a>
+<FONT color="green">061</FONT>         * &lt;p&gt;The A matrix is implicit, it is provided by the underlying<a name="line.61"></a>
+<FONT color="green">062</FONT>         * decomposition algorithm.&lt;/p&gt;<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @param b right-hand side of the equation A &amp;times; X = B<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @return a matrix X that minimizes the two norm of A &amp;times; X - B<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @exception IllegalArgumentException if matrices dimensions don't match<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @exception InvalidMatrixException if decomposed matrix is singular<a name="line.66"></a>
+<FONT color="green">067</FONT>         */<a name="line.67"></a>
+<FONT color="green">068</FONT>        RealMatrix solve(final RealMatrix b)<a name="line.68"></a>
+<FONT color="green">069</FONT>            throws IllegalArgumentException, InvalidMatrixException;<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /**<a name="line.71"></a>
+<FONT color="green">072</FONT>         * Check if the decomposed matrix is non-singular.<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @return true if the decomposed matrix is non-singular<a name="line.73"></a>
+<FONT color="green">074</FONT>         */<a name="line.74"></a>
+<FONT color="green">075</FONT>        boolean isNonSingular();<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** Get the inverse (or pseudo-inverse) of the decomposed matrix.<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @return inverse matrix<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @throws InvalidMatrixException if decomposed matrix is singular<a name="line.79"></a>
+<FONT color="green">080</FONT>         */<a name="line.80"></a>
+<FONT color="green">081</FONT>        RealMatrix getInverse()<a name="line.81"></a>
+<FONT color="green">082</FONT>            throws InvalidMatrixException;<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>    }<a name="line.84"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/DefaultFieldMatrixChangingVisitor.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,128 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FieldElement;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Default implementation of the {@link FieldMatrixChangingVisitor} interface.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * This class is a convenience to create custom visitors without defining all<a name="line.25"></a>
+<FONT color="green">026</FONT>     * methods. This class provides default implementations that do nothing.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;/p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @param &lt;T&gt; the type of the field elements<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 2.0<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public class DefaultFieldMatrixChangingVisitor&lt;T extends FieldElement&lt;T&gt;&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>        implements FieldMatrixChangingVisitor&lt;T&gt; {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Zero element of the field. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private final T zero;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Build a new instance.<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @param zero additive identity of the field<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        public DefaultFieldMatrixChangingVisitor(final T zero) {<a name="line.42"></a>
+<FONT color="green">043</FONT>            this.zero = zero;<a name="line.43"></a>
+<FONT color="green">044</FONT>        }<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** {@inheritDoc} */<a name="line.46"></a>
+<FONT color="green">047</FONT>        public void start(int rows, int columns,<a name="line.47"></a>
+<FONT color="green">048</FONT>                          int startRow, int endRow, int startColumn, int endColumn) {<a name="line.48"></a>
+<FONT color="green">049</FONT>        }<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /** {@inheritDoc} */<a name="line.51"></a>
+<FONT color="green">052</FONT>        public T visit(int row, int column, T value)<a name="line.52"></a>
+<FONT color="green">053</FONT>            throws MatrixVisitorException {<a name="line.53"></a>
+<FONT color="green">054</FONT>            return value;<a name="line.54"></a>
+<FONT color="green">055</FONT>        }<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /** {@inheritDoc} */<a name="line.57"></a>
+<FONT color="green">058</FONT>        public T end() {<a name="line.58"></a>
+<FONT color="green">059</FONT>            return zero;<a name="line.59"></a>
+<FONT color="green">060</FONT>        }<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>    }<a name="line.62"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/DefaultFieldMatrixPreservingVisitor.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,127 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FieldElement;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Default implementation of the {@link FieldMatrixPreservingVisitor} interface.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * This class is a convenience to create custom visitors without defining all<a name="line.25"></a>
+<FONT color="green">026</FONT>     * methods. This class provides default implementations that do nothing.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;/p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @param &lt;T&gt; the type of the field elements<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 2.0<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public class DefaultFieldMatrixPreservingVisitor&lt;T extends FieldElement&lt;T&gt;&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>        implements FieldMatrixPreservingVisitor&lt;T&gt; {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Zero element of the field. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private final T zero;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Build a new instance.<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @param zero additive identity of the field<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        public DefaultFieldMatrixPreservingVisitor(final T zero) {<a name="line.42"></a>
+<FONT color="green">043</FONT>            this.zero = zero;<a name="line.43"></a>
+<FONT color="green">044</FONT>        }<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** {@inheritDoc} */<a name="line.46"></a>
+<FONT color="green">047</FONT>        public void start(int rows, int columns,<a name="line.47"></a>
+<FONT color="green">048</FONT>                          int startRow, int endRow, int startColumn, int endColumn) {<a name="line.48"></a>
+<FONT color="green">049</FONT>        }<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /** {@inheritDoc} */<a name="line.51"></a>
+<FONT color="green">052</FONT>        public void visit(int row, int column, T value)<a name="line.52"></a>
+<FONT color="green">053</FONT>            throws MatrixVisitorException {<a name="line.53"></a>
+<FONT color="green">054</FONT>        }<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** {@inheritDoc} */<a name="line.56"></a>
+<FONT color="green">057</FONT>        public T end() {<a name="line.57"></a>
+<FONT color="green">058</FONT>            return zero;<a name="line.58"></a>
+<FONT color="green">059</FONT>        }<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>    }<a name="line.61"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/DefaultRealMatrixChangingVisitor.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,114 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Default implementation of the {@link RealMatrixChangingVisitor} interface.<a name="line.21"></a>
+<FONT color="green">022</FONT>     * &lt;p&gt;<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This class is a convenience to create custom visitors without defining all<a name="line.23"></a>
+<FONT color="green">024</FONT>     * methods. This class provides default implementations that do nothing.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;/p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @since 2.0<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public class DefaultRealMatrixChangingVisitor implements RealMatrixChangingVisitor {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** {@inheritDoc} */<a name="line.32"></a>
+<FONT color="green">033</FONT>        public void start(int rows, int columns,<a name="line.33"></a>
+<FONT color="green">034</FONT>                          int startRow, int endRow, int startColumn, int endColumn) {<a name="line.34"></a>
+<FONT color="green">035</FONT>        }<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /** {@inheritDoc} */<a name="line.37"></a>
+<FONT color="green">038</FONT>        public double visit(int row, int column, double value)<a name="line.38"></a>
+<FONT color="green">039</FONT>            throws MatrixVisitorException {<a name="line.39"></a>
+<FONT color="green">040</FONT>            return value;<a name="line.40"></a>
+<FONT color="green">041</FONT>        }<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** {@inheritDoc} */<a name="line.43"></a>
+<FONT color="green">044</FONT>        public double end() {<a name="line.44"></a>
+<FONT color="green">045</FONT>            return 0;<a name="line.45"></a>
+<FONT color="green">046</FONT>        }<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>    }<a name="line.48"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/DefaultRealMatrixPreservingVisitor.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,113 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Default implementation of the {@link RealMatrixPreservingVisitor} interface.<a name="line.21"></a>
+<FONT color="green">022</FONT>     * &lt;p&gt;<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This class is a convenience to create custom visitors without defining all<a name="line.23"></a>
+<FONT color="green">024</FONT>     * methods. This class provides default implementations that do nothing.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;/p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @since 2.0<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public class DefaultRealMatrixPreservingVisitor implements RealMatrixPreservingVisitor {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** {@inheritDoc} */<a name="line.32"></a>
+<FONT color="green">033</FONT>        public void start(int rows, int columns,<a name="line.33"></a>
+<FONT color="green">034</FONT>                          int startRow, int endRow, int startColumn, int endColumn) {<a name="line.34"></a>
+<FONT color="green">035</FONT>        }<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /** {@inheritDoc} */<a name="line.37"></a>
+<FONT color="green">038</FONT>        public void visit(int row, int column, double value)<a name="line.38"></a>
+<FONT color="green">039</FONT>            throws MatrixVisitorException {<a name="line.39"></a>
+<FONT color="green">040</FONT>        }<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** {@inheritDoc} */<a name="line.42"></a>
+<FONT color="green">043</FONT>        public double end() {<a name="line.43"></a>
+<FONT color="green">044</FONT>            return 0;<a name="line.44"></a>
+<FONT color="green">045</FONT>        }<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>    }<a name="line.47"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/EigenDecomposition.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,197 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * An interface to classes that implement an algorithm to calculate the<a name="line.22"></a>
+<FONT color="green">023</FONT>     * eigen decomposition of a real matrix.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;The eigen decomposition of matrix A is a set of two matrices:<a name="line.24"></a>
+<FONT color="green">025</FONT>     * V and D such that A = V &amp;times; D &amp;times; V&lt;sup&gt;T&lt;/sup&gt;.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * A, V and D are all m &amp;times; m matrices.&lt;/p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;This interface is similar in spirit to the &lt;code&gt;EigenvalueDecomposition&lt;/code&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * class from the &lt;a href="http://math.nist.gov/javanumerics/jama/"&gt;JAMA&lt;/a&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * library, with the following changes:&lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;ul&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     *   &lt;li&gt;a {@link #getVT() getVt} method has been added,&lt;/li&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     *   &lt;li&gt;two {@link #getRealEigenvalue(int) getRealEigenvalue} and {@link #getImagEigenvalue(int)<a name="line.32"></a>
+<FONT color="green">033</FONT>     *   getImagEigenvalue} methods to pick up a single eigenvalue have been added,&lt;/li&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     *   &lt;li&gt;a {@link #getEigenvector(int) getEigenvector} method to pick up a single<a name="line.34"></a>
+<FONT color="green">035</FONT>     *   eigenvector has been added,&lt;/li&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     *   &lt;li&gt;a {@link #getDeterminant() getDeterminant} method has been added.&lt;/li&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *   &lt;li&gt;a {@link #getSolver() getSolver} method has been added.&lt;/li&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * &lt;/ul&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @see &lt;a href="http://mathworld.wolfram.com/EigenDecomposition.html"&gt;MathWorld&lt;/a&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @see &lt;a href="http://en.wikipedia.org/wiki/Eigendecomposition_of_a_matrix"&gt;Wikipedia&lt;/a&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * @version $Revision: 826627 $ $Date: 2009-10-19 06:27:47 -0400 (Mon, 19 Oct 2009) $<a name="line.41"></a>
+<FONT color="green">042</FONT>     * @since 2.0<a name="line.42"></a>
+<FONT color="green">043</FONT>     */<a name="line.43"></a>
+<FONT color="green">044</FONT>    public interface EigenDecomposition {<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /**<a name="line.46"></a>
+<FONT color="green">047</FONT>         * Returns the matrix V of the decomposition.<a name="line.47"></a>
+<FONT color="green">048</FONT>         * &lt;p&gt;V is an orthogonal matrix, i.e. its transpose is also its inverse.&lt;/p&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>         * &lt;p&gt;The columns of V are the eigenvectors of the original matrix.&lt;/p&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @return the V matrix<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        RealMatrix getV();<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /**<a name="line.54"></a>
+<FONT color="green">055</FONT>         * Returns the block diagonal matrix D of the decomposition.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * &lt;p&gt;D is a block diagonal matrix.&lt;/p&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>         * &lt;p&gt;Real eigenvalues are on the diagonal while complex values are on<a name="line.57"></a>
+<FONT color="green">058</FONT>         * 2x2 blocks { {real +imaginary}, {-imaginary, real} }.&lt;/p&gt;<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @return the D matrix<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @see #getRealEigenvalues()<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @see #getImagEigenvalues()<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        RealMatrix getD();<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /**<a name="line.65"></a>
+<FONT color="green">066</FONT>         * Returns the transpose of the matrix V of the decomposition.<a name="line.66"></a>
+<FONT color="green">067</FONT>         * &lt;p&gt;V is an orthogonal matrix, i.e. its transpose is also its inverse.&lt;/p&gt;<a name="line.67"></a>
+<FONT color="green">068</FONT>         * &lt;p&gt;The columns of V are the eigenvectors of the original matrix.&lt;/p&gt;<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @return the transpose of the V matrix<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        RealMatrix getVT();<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /**<a name="line.73"></a>
+<FONT color="green">074</FONT>         * Returns a copy of the real parts of the eigenvalues of the original matrix.<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @return a copy of the real parts of the eigenvalues of the original matrix<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @see #getD()<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @see #getRealEigenvalue(int)<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @see #getImagEigenvalues()<a name="line.78"></a>
+<FONT color="green">079</FONT>         */<a name="line.79"></a>
+<FONT color="green">080</FONT>        double[] getRealEigenvalues();<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>        /**<a name="line.82"></a>
+<FONT color="green">083</FONT>         * Returns the real part of the i&lt;sup&gt;th&lt;/sup&gt; eigenvalue of the original matrix.<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @param i index of the eigenvalue (counting from 0)<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @return real part of the i&lt;sup&gt;th&lt;/sup&gt; eigenvalue of the original matrix<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @see #getD()<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @see #getRealEigenvalues()<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @see #getImagEigenvalue(int)<a name="line.88"></a>
+<FONT color="green">089</FONT>         */<a name="line.89"></a>
+<FONT color="green">090</FONT>        double getRealEigenvalue(int i);<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /**<a name="line.92"></a>
+<FONT color="green">093</FONT>         * Returns a copy of the imaginary parts of the eigenvalues of the original matrix.<a name="line.93"></a>
+<FONT color="green">094</FONT>         * @return a copy of the imaginary parts of the eigenvalues of the original matrix<a name="line.94"></a>
+<FONT color="green">095</FONT>         * @see #getD()<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @see #getImagEigenvalue(int)<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @see #getRealEigenvalues()<a name="line.97"></a>
+<FONT color="green">098</FONT>         */<a name="line.98"></a>
+<FONT color="green">099</FONT>        double[] getImagEigenvalues();<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /**<a name="line.101"></a>
+<FONT color="green">102</FONT>         * Returns the imaginary part of the i&lt;sup&gt;th&lt;/sup&gt; eigenvalue of the original matrix.<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @param i index of the eigenvalue (counting from 0)<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @return imaginary part of the i&lt;sup&gt;th&lt;/sup&gt; eigenvalue of the original matrix<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @see #getD()<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @see #getImagEigenvalues()<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @see #getRealEigenvalue(int)<a name="line.107"></a>
+<FONT color="green">108</FONT>         */<a name="line.108"></a>
+<FONT color="green">109</FONT>        double getImagEigenvalue(int i);<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /**<a name="line.111"></a>
+<FONT color="green">112</FONT>         * Returns a copy of the i&lt;sup&gt;th&lt;/sup&gt; eigenvector of the original matrix.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param i index of the eigenvector (counting from 0)<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @return copy of the i&lt;sup&gt;th&lt;/sup&gt; eigenvector of the original matrix<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @see #getD()<a name="line.115"></a>
+<FONT color="green">116</FONT>         */<a name="line.116"></a>
+<FONT color="green">117</FONT>        RealVector getEigenvector(int i);<a name="line.117"></a>
+<FONT color="green">118</FONT>    <a name="line.118"></a>
+<FONT color="green">119</FONT>        /**<a name="line.119"></a>
+<FONT color="green">120</FONT>         * Return the determinant of the matrix<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @return determinant of the matrix<a name="line.121"></a>
+<FONT color="green">122</FONT>         */<a name="line.122"></a>
+<FONT color="green">123</FONT>        double getDeterminant();<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>        /**<a name="line.125"></a>
+<FONT color="green">126</FONT>         * Get a solver for finding the A &amp;times; X = B solution in exact linear sense.<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @return a solver<a name="line.127"></a>
+<FONT color="green">128</FONT>         */<a name="line.128"></a>
+<FONT color="green">129</FONT>        DecompositionSolver getSolver();<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>    }<a name="line.131"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/EigenDecompositionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,683 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Calculates the eigen decomposition of a real &lt;strong&gt;symmetric&lt;/strong&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * matrix.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * The eigen decomposition of matrix A is a set of two matrices: V and D such<a name="line.28"></a>
+<FONT color="green">029</FONT>     * that A = V D V&lt;sup&gt;T&lt;/sup&gt;. A, V and D are all m &amp;times; m matrices.<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * As of 2.0, this class supports only &lt;strong&gt;symmetric&lt;/strong&gt; matrices, and<a name="line.32"></a>
+<FONT color="green">033</FONT>     * hence computes only real realEigenvalues. This implies the D matrix returned<a name="line.33"></a>
+<FONT color="green">034</FONT>     * by {@link #getD()} is always diagonal and the imaginary values returned<a name="line.34"></a>
+<FONT color="green">035</FONT>     * {@link #getImagEigenvalue(int)} and {@link #getImagEigenvalues()} are always<a name="line.35"></a>
+<FONT color="green">036</FONT>     * null.<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;/p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * &lt;p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * When called with a {@link RealMatrix} argument, this implementation only uses<a name="line.39"></a>
+<FONT color="green">040</FONT>     * the upper part of the matrix, the part below the diagonal is not accessed at<a name="line.40"></a>
+<FONT color="green">041</FONT>     * all.<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;/p&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     * &lt;p&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     * This implementation is based on the paper by A. Drubrulle, R.S. Martin and<a name="line.44"></a>
+<FONT color="green">045</FONT>     * J.H. Wilkinson 'The Implicit QL Algorithm' in Wilksinson and Reinsch (1971)<a name="line.45"></a>
+<FONT color="green">046</FONT>     * Handbook for automatic computation, vol. 2, Linear algebra, Springer-Verlag,<a name="line.46"></a>
+<FONT color="green">047</FONT>     * New-York<a name="line.47"></a>
+<FONT color="green">048</FONT>     * &lt;/p&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>     * @version $Revision: 912413 $ $Date: 2010-02-21 16:46:12 -0500 (Sun, 21 Feb 2010) $<a name="line.49"></a>
+<FONT color="green">050</FONT>     * @since 2.0<a name="line.50"></a>
+<FONT color="green">051</FONT>     */<a name="line.51"></a>
+<FONT color="green">052</FONT>    public class EigenDecompositionImpl implements EigenDecomposition {<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /** Maximum number of iterations accepted in the implicit QL transformation */<a name="line.54"></a>
+<FONT color="green">055</FONT>        private byte maxIter = 30;<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /** Main diagonal of the tridiagonal matrix. */<a name="line.57"></a>
+<FONT color="green">058</FONT>        private double[] main;<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Secondary diagonal of the tridiagonal matrix. */<a name="line.60"></a>
+<FONT color="green">061</FONT>        private double[] secondary;<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /**<a name="line.63"></a>
+<FONT color="green">064</FONT>         * Transformer to tridiagonal (may be null if matrix is already<a name="line.64"></a>
+<FONT color="green">065</FONT>         * tridiagonal).<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        private TriDiagonalTransformer transformer;<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /** Real part of the realEigenvalues. */<a name="line.69"></a>
+<FONT color="green">070</FONT>        private double[] realEigenvalues;<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /** Imaginary part of the realEigenvalues. */<a name="line.72"></a>
+<FONT color="green">073</FONT>        private double[] imagEigenvalues;<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /** Eigenvectors. */<a name="line.75"></a>
+<FONT color="green">076</FONT>        private ArrayRealVector[] eigenvectors;<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /** Cached value of V. */<a name="line.78"></a>
+<FONT color="green">079</FONT>        private RealMatrix cachedV;<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /** Cached value of D. */<a name="line.81"></a>
+<FONT color="green">082</FONT>        private RealMatrix cachedD;<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /** Cached value of Vt. */<a name="line.84"></a>
+<FONT color="green">085</FONT>        private RealMatrix cachedVt;<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>        /**<a name="line.87"></a>
+<FONT color="green">088</FONT>         * Calculates the eigen decomposition of the given symmetric matrix.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @param matrix The &lt;strong&gt;symmetric&lt;/strong&gt; matrix to decompose.<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @param splitTolerance dummy parameter, present for backward compatibility only.<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @exception InvalidMatrixException (wrapping a<a name="line.91"></a>
+<FONT color="green">092</FONT>         * {@link org.apache.commons.math.ConvergenceException} if algorithm<a name="line.92"></a>
+<FONT color="green">093</FONT>         * fails to converge<a name="line.93"></a>
+<FONT color="green">094</FONT>         */<a name="line.94"></a>
+<FONT color="green">095</FONT>        public EigenDecompositionImpl(final RealMatrix matrix,final double splitTolerance)<a name="line.95"></a>
+<FONT color="green">096</FONT>                throws InvalidMatrixException {<a name="line.96"></a>
+<FONT color="green">097</FONT>            if (isSymmetric(matrix)) {<a name="line.97"></a>
+<FONT color="green">098</FONT>                transformToTridiagonal(matrix);<a name="line.98"></a>
+<FONT color="green">099</FONT>                findEigenVectors(transformer.getQ().getData());<a name="line.99"></a>
+<FONT color="green">100</FONT>            } else {<a name="line.100"></a>
+<FONT color="green">101</FONT>                // as of 2.0, non-symmetric matrices (i.e. complex eigenvalues) are<a name="line.101"></a>
+<FONT color="green">102</FONT>                // NOT supported<a name="line.102"></a>
+<FONT color="green">103</FONT>                // see issue https://issues.apache.org/jira/browse/MATH-235<a name="line.103"></a>
+<FONT color="green">104</FONT>                throw new InvalidMatrixException(<a name="line.104"></a>
+<FONT color="green">105</FONT>                        "eigen decomposition of assymetric matrices not supported yet");<a name="line.105"></a>
+<FONT color="green">106</FONT>            }<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /**<a name="line.109"></a>
+<FONT color="green">110</FONT>         * Calculates the eigen decomposition of the symmetric tridiagonal<a name="line.110"></a>
+<FONT color="green">111</FONT>         * matrix.  The Householder matrix is assumed to be the identity matrix.<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @param main Main diagonal of the symmetric triadiagonal form<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param secondary Secondary of the tridiagonal form<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param splitTolerance dummy parameter, present for backward compatibility only.<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @exception InvalidMatrixException (wrapping a<a name="line.115"></a>
+<FONT color="green">116</FONT>         * {@link org.apache.commons.math.ConvergenceException} if algorithm<a name="line.116"></a>
+<FONT color="green">117</FONT>         * fails to converge<a name="line.117"></a>
+<FONT color="green">118</FONT>         */<a name="line.118"></a>
+<FONT color="green">119</FONT>        public EigenDecompositionImpl(final double[] main,final double[] secondary,<a name="line.119"></a>
+<FONT color="green">120</FONT>                final double splitTolerance)<a name="line.120"></a>
+<FONT color="green">121</FONT>                throws InvalidMatrixException {<a name="line.121"></a>
+<FONT color="green">122</FONT>            this.main      = main.clone();<a name="line.122"></a>
+<FONT color="green">123</FONT>            this.secondary = secondary.clone();<a name="line.123"></a>
+<FONT color="green">124</FONT>            transformer    = null;<a name="line.124"></a>
+<FONT color="green">125</FONT>            final int size=main.length;<a name="line.125"></a>
+<FONT color="green">126</FONT>            double[][] z = new double[size][size];<a name="line.126"></a>
+<FONT color="green">127</FONT>            for (int i=0;i&lt;size;i++) {<a name="line.127"></a>
+<FONT color="green">128</FONT>                z[i][i]=1.0;<a name="line.128"></a>
+<FONT color="green">129</FONT>            }<a name="line.129"></a>
+<FONT color="green">130</FONT>            findEigenVectors(z);<a name="line.130"></a>
+<FONT color="green">131</FONT>        }<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>        /**<a name="line.133"></a>
+<FONT color="green">134</FONT>         * Check if a matrix is symmetric.<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @param matrix<a name="line.135"></a>
+<FONT color="green">136</FONT>         *            matrix to check<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @return true if matrix is symmetric<a name="line.137"></a>
+<FONT color="green">138</FONT>         */<a name="line.138"></a>
+<FONT color="green">139</FONT>        private boolean isSymmetric(final RealMatrix matrix) {<a name="line.139"></a>
+<FONT color="green">140</FONT>            final int rows = matrix.getRowDimension();<a name="line.140"></a>
+<FONT color="green">141</FONT>            final int columns = matrix.getColumnDimension();<a name="line.141"></a>
+<FONT color="green">142</FONT>            final double eps = 10 * rows * columns * MathUtils.EPSILON;<a name="line.142"></a>
+<FONT color="green">143</FONT>            for (int i = 0; i &lt; rows; ++i) {<a name="line.143"></a>
+<FONT color="green">144</FONT>                for (int j = i + 1; j &lt; columns; ++j) {<a name="line.144"></a>
+<FONT color="green">145</FONT>                    final double mij = matrix.getEntry(i, j);<a name="line.145"></a>
+<FONT color="green">146</FONT>                    final double mji = matrix.getEntry(j, i);<a name="line.146"></a>
+<FONT color="green">147</FONT>                    if (Math.abs(mij - mji) &gt; (Math.max(Math.abs(mij), Math<a name="line.147"></a>
+<FONT color="green">148</FONT>                            .abs(mji)) * eps)) {<a name="line.148"></a>
+<FONT color="green">149</FONT>                        return false;<a name="line.149"></a>
+<FONT color="green">150</FONT>                    }<a name="line.150"></a>
+<FONT color="green">151</FONT>                }<a name="line.151"></a>
+<FONT color="green">152</FONT>            }<a name="line.152"></a>
+<FONT color="green">153</FONT>            return true;<a name="line.153"></a>
+<FONT color="green">154</FONT>        }<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>        /** {@inheritDoc} */<a name="line.156"></a>
+<FONT color="green">157</FONT>        public RealMatrix getV() throws InvalidMatrixException {<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>            if (cachedV == null) {<a name="line.159"></a>
+<FONT color="green">160</FONT>                final int m = eigenvectors.length;<a name="line.160"></a>
+<FONT color="green">161</FONT>                cachedV = MatrixUtils.createRealMatrix(m, m);<a name="line.161"></a>
+<FONT color="green">162</FONT>                for (int k = 0; k &lt; m; ++k) {<a name="line.162"></a>
+<FONT color="green">163</FONT>                    cachedV.setColumnVector(k, eigenvectors[k]);<a name="line.163"></a>
+<FONT color="green">164</FONT>                }<a name="line.164"></a>
+<FONT color="green">165</FONT>            }<a name="line.165"></a>
+<FONT color="green">166</FONT>            // return the cached matrix<a name="line.166"></a>
+<FONT color="green">167</FONT>            return cachedV;<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>        }<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>        /** {@inheritDoc} */<a name="line.171"></a>
+<FONT color="green">172</FONT>        public RealMatrix getD() throws InvalidMatrixException {<a name="line.172"></a>
+<FONT color="green">173</FONT>            if (cachedD == null) {<a name="line.173"></a>
+<FONT color="green">174</FONT>                // cache the matrix for subsequent calls<a name="line.174"></a>
+<FONT color="green">175</FONT>                cachedD = MatrixUtils.createRealDiagonalMatrix(realEigenvalues);<a name="line.175"></a>
+<FONT color="green">176</FONT>            }<a name="line.176"></a>
+<FONT color="green">177</FONT>            return cachedD;<a name="line.177"></a>
+<FONT color="green">178</FONT>        }<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>        /** {@inheritDoc} */<a name="line.180"></a>
+<FONT color="green">181</FONT>        public RealMatrix getVT() throws InvalidMatrixException {<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>            if (cachedVt == null) {<a name="line.183"></a>
+<FONT color="green">184</FONT>                final int m = eigenvectors.length;<a name="line.184"></a>
+<FONT color="green">185</FONT>                cachedVt = MatrixUtils.createRealMatrix(m, m);<a name="line.185"></a>
+<FONT color="green">186</FONT>                for (int k = 0; k &lt; m; ++k) {<a name="line.186"></a>
+<FONT color="green">187</FONT>                    cachedVt.setRowVector(k, eigenvectors[k]);<a name="line.187"></a>
+<FONT color="green">188</FONT>                }<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>            }<a name="line.190"></a>
+<FONT color="green">191</FONT>    <a name="line.191"></a>
+<FONT color="green">192</FONT>            // return the cached matrix<a name="line.192"></a>
+<FONT color="green">193</FONT>            return cachedVt;<a name="line.193"></a>
+<FONT color="green">194</FONT>        }<a name="line.194"></a>
+<FONT color="green">195</FONT>    <a name="line.195"></a>
+<FONT color="green">196</FONT>        /** {@inheritDoc} */<a name="line.196"></a>
+<FONT color="green">197</FONT>        public double[] getRealEigenvalues() throws InvalidMatrixException {<a name="line.197"></a>
+<FONT color="green">198</FONT>            return realEigenvalues.clone();<a name="line.198"></a>
+<FONT color="green">199</FONT>        }<a name="line.199"></a>
+<FONT color="green">200</FONT>    <a name="line.200"></a>
+<FONT color="green">201</FONT>        /** {@inheritDoc} */<a name="line.201"></a>
+<FONT color="green">202</FONT>        public double getRealEigenvalue(final int i) throws InvalidMatrixException,<a name="line.202"></a>
+<FONT color="green">203</FONT>                ArrayIndexOutOfBoundsException {<a name="line.203"></a>
+<FONT color="green">204</FONT>            return realEigenvalues[i];<a name="line.204"></a>
+<FONT color="green">205</FONT>        }<a name="line.205"></a>
+<FONT color="green">206</FONT>    <a name="line.206"></a>
+<FONT color="green">207</FONT>        /** {@inheritDoc} */<a name="line.207"></a>
+<FONT color="green">208</FONT>        public double[] getImagEigenvalues() throws InvalidMatrixException {<a name="line.208"></a>
+<FONT color="green">209</FONT>            return imagEigenvalues.clone();<a name="line.209"></a>
+<FONT color="green">210</FONT>        }<a name="line.210"></a>
+<FONT color="green">211</FONT>    <a name="line.211"></a>
+<FONT color="green">212</FONT>        /** {@inheritDoc} */<a name="line.212"></a>
+<FONT color="green">213</FONT>        public double getImagEigenvalue(final int i) throws InvalidMatrixException,<a name="line.213"></a>
+<FONT color="green">214</FONT>                ArrayIndexOutOfBoundsException {<a name="line.214"></a>
+<FONT color="green">215</FONT>            return imagEigenvalues[i];<a name="line.215"></a>
+<FONT color="green">216</FONT>        }<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>        /** {@inheritDoc} */<a name="line.218"></a>
+<FONT color="green">219</FONT>        public RealVector getEigenvector(final int i)<a name="line.219"></a>
+<FONT color="green">220</FONT>                throws InvalidMatrixException, ArrayIndexOutOfBoundsException {<a name="line.220"></a>
+<FONT color="green">221</FONT>            return eigenvectors[i].copy();<a name="line.221"></a>
+<FONT color="green">222</FONT>        }<a name="line.222"></a>
+<FONT color="green">223</FONT>    <a name="line.223"></a>
+<FONT color="green">224</FONT>        /**<a name="line.224"></a>
+<FONT color="green">225</FONT>         * Return the determinant of the matrix<a name="line.225"></a>
+<FONT color="green">226</FONT>         * @return determinant of the matrix<a name="line.226"></a>
+<FONT color="green">227</FONT>         */<a name="line.227"></a>
+<FONT color="green">228</FONT>        public double getDeterminant() {<a name="line.228"></a>
+<FONT color="green">229</FONT>            double determinant = 1;<a name="line.229"></a>
+<FONT color="green">230</FONT>            for (double lambda : realEigenvalues) {<a name="line.230"></a>
+<FONT color="green">231</FONT>                determinant *= lambda;<a name="line.231"></a>
+<FONT color="green">232</FONT>            }<a name="line.232"></a>
+<FONT color="green">233</FONT>            return determinant;<a name="line.233"></a>
+<FONT color="green">234</FONT>        }<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>        /** {@inheritDoc} */<a name="line.236"></a>
+<FONT color="green">237</FONT>        public DecompositionSolver getSolver() {<a name="line.237"></a>
+<FONT color="green">238</FONT>            return new Solver(realEigenvalues, imagEigenvalues, eigenvectors);<a name="line.238"></a>
+<FONT color="green">239</FONT>        }<a name="line.239"></a>
+<FONT color="green">240</FONT>    <a name="line.240"></a>
+<FONT color="green">241</FONT>        /** Specialized solver. */<a name="line.241"></a>
+<FONT color="green">242</FONT>        private static class Solver implements DecompositionSolver {<a name="line.242"></a>
+<FONT color="green">243</FONT>    <a name="line.243"></a>
+<FONT color="green">244</FONT>            /** Real part of the realEigenvalues. */<a name="line.244"></a>
+<FONT color="green">245</FONT>            private double[] realEigenvalues;<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>            /** Imaginary part of the realEigenvalues. */<a name="line.247"></a>
+<FONT color="green">248</FONT>            private double[] imagEigenvalues;<a name="line.248"></a>
+<FONT color="green">249</FONT>    <a name="line.249"></a>
+<FONT color="green">250</FONT>            /** Eigenvectors. */<a name="line.250"></a>
+<FONT color="green">251</FONT>            private final ArrayRealVector[] eigenvectors;<a name="line.251"></a>
+<FONT color="green">252</FONT>    <a name="line.252"></a>
+<FONT color="green">253</FONT>            /**<a name="line.253"></a>
+<FONT color="green">254</FONT>             * Build a solver from decomposed matrix.<a name="line.254"></a>
+<FONT color="green">255</FONT>             * @param realEigenvalues<a name="line.255"></a>
+<FONT color="green">256</FONT>             *            real parts of the eigenvalues<a name="line.256"></a>
+<FONT color="green">257</FONT>             * @param imagEigenvalues<a name="line.257"></a>
+<FONT color="green">258</FONT>             *            imaginary parts of the eigenvalues<a name="line.258"></a>
+<FONT color="green">259</FONT>             * @param eigenvectors<a name="line.259"></a>
+<FONT color="green">260</FONT>             *            eigenvectors<a name="line.260"></a>
+<FONT color="green">261</FONT>             */<a name="line.261"></a>
+<FONT color="green">262</FONT>            private Solver(final double[] realEigenvalues,<a name="line.262"></a>
+<FONT color="green">263</FONT>                    final double[] imagEigenvalues,<a name="line.263"></a>
+<FONT color="green">264</FONT>                    final ArrayRealVector[] eigenvectors) {<a name="line.264"></a>
+<FONT color="green">265</FONT>                this.realEigenvalues = realEigenvalues;<a name="line.265"></a>
+<FONT color="green">266</FONT>                this.imagEigenvalues = imagEigenvalues;<a name="line.266"></a>
+<FONT color="green">267</FONT>                this.eigenvectors = eigenvectors;<a name="line.267"></a>
+<FONT color="green">268</FONT>            }<a name="line.268"></a>
+<FONT color="green">269</FONT>    <a name="line.269"></a>
+<FONT color="green">270</FONT>            /**<a name="line.270"></a>
+<FONT color="green">271</FONT>             * Solve the linear equation A &amp;times; X = B for symmetric matrices A.<a name="line.271"></a>
+<FONT color="green">272</FONT>             * &lt;p&gt;<a name="line.272"></a>
+<FONT color="green">273</FONT>             * This method only find exact linear solutions, i.e. solutions for<a name="line.273"></a>
+<FONT color="green">274</FONT>             * which ||A &amp;times; X - B|| is exactly 0.<a name="line.274"></a>
+<FONT color="green">275</FONT>             * &lt;/p&gt;<a name="line.275"></a>
+<FONT color="green">276</FONT>             * @param b<a name="line.276"></a>
+<FONT color="green">277</FONT>             *            right-hand side of the equation A &amp;times; X = B<a name="line.277"></a>
+<FONT color="green">278</FONT>             * @return a vector X that minimizes the two norm of A &amp;times; X - B<a name="line.278"></a>
+<FONT color="green">279</FONT>             * @exception IllegalArgumentException<a name="line.279"></a>
+<FONT color="green">280</FONT>             *                if matrices dimensions don't match<a name="line.280"></a>
+<FONT color="green">281</FONT>             * @exception InvalidMatrixException<a name="line.281"></a>
+<FONT color="green">282</FONT>             *                if decomposed matrix is singular<a name="line.282"></a>
+<FONT color="green">283</FONT>             */<a name="line.283"></a>
+<FONT color="green">284</FONT>            public double[] solve(final double[] b)<a name="line.284"></a>
+<FONT color="green">285</FONT>                    throws IllegalArgumentException, InvalidMatrixException {<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>                if (!isNonSingular()) {<a name="line.287"></a>
+<FONT color="green">288</FONT>                    throw new SingularMatrixException();<a name="line.288"></a>
+<FONT color="green">289</FONT>                }<a name="line.289"></a>
+<FONT color="green">290</FONT>    <a name="line.290"></a>
+<FONT color="green">291</FONT>                final int m = realEigenvalues.length;<a name="line.291"></a>
+<FONT color="green">292</FONT>                if (b.length != m) {<a name="line.292"></a>
+<FONT color="green">293</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.293"></a>
+<FONT color="green">294</FONT>                            "vector length mismatch: got {0} but expected {1}",<a name="line.294"></a>
+<FONT color="green">295</FONT>                            b.length, m);<a name="line.295"></a>
+<FONT color="green">296</FONT>                }<a name="line.296"></a>
+<FONT color="green">297</FONT>    <a name="line.297"></a>
+<FONT color="green">298</FONT>                final double[] bp = new double[m];<a name="line.298"></a>
+<FONT color="green">299</FONT>                for (int i = 0; i &lt; m; ++i) {<a name="line.299"></a>
+<FONT color="green">300</FONT>                    final ArrayRealVector v = eigenvectors[i];<a name="line.300"></a>
+<FONT color="green">301</FONT>                    final double[] vData = v.getDataRef();<a name="line.301"></a>
+<FONT color="green">302</FONT>                    final double s = v.dotProduct(b) / realEigenvalues[i];<a name="line.302"></a>
+<FONT color="green">303</FONT>                    for (int j = 0; j &lt; m; ++j) {<a name="line.303"></a>
+<FONT color="green">304</FONT>                        bp[j] += s * vData[j];<a name="line.304"></a>
+<FONT color="green">305</FONT>                    }<a name="line.305"></a>
+<FONT color="green">306</FONT>                }<a name="line.306"></a>
+<FONT color="green">307</FONT>    <a name="line.307"></a>
+<FONT color="green">308</FONT>                return bp;<a name="line.308"></a>
+<FONT color="green">309</FONT>    <a name="line.309"></a>
+<FONT color="green">310</FONT>            }<a name="line.310"></a>
+<FONT color="green">311</FONT>    <a name="line.311"></a>
+<FONT color="green">312</FONT>            /**<a name="line.312"></a>
+<FONT color="green">313</FONT>             * Solve the linear equation A &amp;times; X = B for symmetric matrices A.<a name="line.313"></a>
+<FONT color="green">314</FONT>             * &lt;p&gt;<a name="line.314"></a>
+<FONT color="green">315</FONT>             * This method only find exact linear solutions, i.e. solutions for<a name="line.315"></a>
+<FONT color="green">316</FONT>             * which ||A &amp;times; X - B|| is exactly 0.<a name="line.316"></a>
+<FONT color="green">317</FONT>             * &lt;/p&gt;<a name="line.317"></a>
+<FONT color="green">318</FONT>             * @param b<a name="line.318"></a>
+<FONT color="green">319</FONT>             *            right-hand side of the equation A &amp;times; X = B<a name="line.319"></a>
+<FONT color="green">320</FONT>             * @return a vector X that minimizes the two norm of A &amp;times; X - B<a name="line.320"></a>
+<FONT color="green">321</FONT>             * @exception IllegalArgumentException<a name="line.321"></a>
+<FONT color="green">322</FONT>             *                if matrices dimensions don't match<a name="line.322"></a>
+<FONT color="green">323</FONT>             * @exception InvalidMatrixException<a name="line.323"></a>
+<FONT color="green">324</FONT>             *                if decomposed matrix is singular<a name="line.324"></a>
+<FONT color="green">325</FONT>             */<a name="line.325"></a>
+<FONT color="green">326</FONT>            public RealVector solve(final RealVector b)<a name="line.326"></a>
+<FONT color="green">327</FONT>                    throws IllegalArgumentException, InvalidMatrixException {<a name="line.327"></a>
+<FONT color="green">328</FONT>    <a name="line.328"></a>
+<FONT color="green">329</FONT>                if (!isNonSingular()) {<a name="line.329"></a>
+<FONT color="green">330</FONT>                    throw new SingularMatrixException();<a name="line.330"></a>
+<FONT color="green">331</FONT>                }<a name="line.331"></a>
+<FONT color="green">332</FONT>    <a name="line.332"></a>
+<FONT color="green">333</FONT>                final int m = realEigenvalues.length;<a name="line.333"></a>
+<FONT color="green">334</FONT>                if (b.getDimension() != m) {<a name="line.334"></a>
+<FONT color="green">335</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.335"></a>
+<FONT color="green">336</FONT>                            "vector length mismatch: got {0} but expected {1}", b<a name="line.336"></a>
+<FONT color="green">337</FONT>                                    .getDimension(), m);<a name="line.337"></a>
+<FONT color="green">338</FONT>                }<a name="line.338"></a>
+<FONT color="green">339</FONT>    <a name="line.339"></a>
+<FONT color="green">340</FONT>                final double[] bp = new double[m];<a name="line.340"></a>
+<FONT color="green">341</FONT>                for (int i = 0; i &lt; m; ++i) {<a name="line.341"></a>
+<FONT color="green">342</FONT>                    final ArrayRealVector v = eigenvectors[i];<a name="line.342"></a>
+<FONT color="green">343</FONT>                    final double[] vData = v.getDataRef();<a name="line.343"></a>
+<FONT color="green">344</FONT>                    final double s = v.dotProduct(b) / realEigenvalues[i];<a name="line.344"></a>
+<FONT color="green">345</FONT>                    for (int j = 0; j &lt; m; ++j) {<a name="line.345"></a>
+<FONT color="green">346</FONT>                        bp[j] += s * vData[j];<a name="line.346"></a>
+<FONT color="green">347</FONT>                    }<a name="line.347"></a>
+<FONT color="green">348</FONT>                }<a name="line.348"></a>
+<FONT color="green">349</FONT>    <a name="line.349"></a>
+<FONT color="green">350</FONT>                return new ArrayRealVector(bp, false);<a name="line.350"></a>
+<FONT color="green">351</FONT>    <a name="line.351"></a>
+<FONT color="green">352</FONT>            }<a name="line.352"></a>
+<FONT color="green">353</FONT>    <a name="line.353"></a>
+<FONT color="green">354</FONT>            /**<a name="line.354"></a>
+<FONT color="green">355</FONT>             * Solve the linear equation A &amp;times; X = B for symmetric matrices A.<a name="line.355"></a>
+<FONT color="green">356</FONT>             * &lt;p&gt;<a name="line.356"></a>
+<FONT color="green">357</FONT>             * This method only find exact linear solutions, i.e. solutions for<a name="line.357"></a>
+<FONT color="green">358</FONT>             * which ||A &amp;times; X - B|| is exactly 0.<a name="line.358"></a>
+<FONT color="green">359</FONT>             * &lt;/p&gt;<a name="line.359"></a>
+<FONT color="green">360</FONT>             * @param b<a name="line.360"></a>
+<FONT color="green">361</FONT>             *            right-hand side of the equation A &amp;times; X = B<a name="line.361"></a>
+<FONT color="green">362</FONT>             * @return a matrix X that minimizes the two norm of A &amp;times; X - B<a name="line.362"></a>
+<FONT color="green">363</FONT>             * @exception IllegalArgumentException<a name="line.363"></a>
+<FONT color="green">364</FONT>             *                if matrices dimensions don't match<a name="line.364"></a>
+<FONT color="green">365</FONT>             * @exception InvalidMatrixException<a name="line.365"></a>
+<FONT color="green">366</FONT>             *                if decomposed matrix is singular<a name="line.366"></a>
+<FONT color="green">367</FONT>             */<a name="line.367"></a>
+<FONT color="green">368</FONT>            public RealMatrix solve(final RealMatrix b)<a name="line.368"></a>
+<FONT color="green">369</FONT>                    throws IllegalArgumentException, InvalidMatrixException {<a name="line.369"></a>
+<FONT color="green">370</FONT>    <a name="line.370"></a>
+<FONT color="green">371</FONT>                if (!isNonSingular()) {<a name="line.371"></a>
+<FONT color="green">372</FONT>                    throw new SingularMatrixException();<a name="line.372"></a>
+<FONT color="green">373</FONT>                }<a name="line.373"></a>
+<FONT color="green">374</FONT>    <a name="line.374"></a>
+<FONT color="green">375</FONT>                final int m = realEigenvalues.length;<a name="line.375"></a>
+<FONT color="green">376</FONT>                if (b.getRowDimension() != m) {<a name="line.376"></a>
+<FONT color="green">377</FONT>                    throw MathRuntimeException<a name="line.377"></a>
+<FONT color="green">378</FONT>                            .createIllegalArgumentException(<a name="line.378"></a>
+<FONT color="green">379</FONT>                                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.379"></a>
+<FONT color="green">380</FONT>                                    b.getRowDimension(), b.getColumnDimension(), m,<a name="line.380"></a>
+<FONT color="green">381</FONT>                                    "n");<a name="line.381"></a>
+<FONT color="green">382</FONT>                }<a name="line.382"></a>
+<FONT color="green">383</FONT>    <a name="line.383"></a>
+<FONT color="green">384</FONT>                final int nColB = b.getColumnDimension();<a name="line.384"></a>
+<FONT color="green">385</FONT>                final double[][] bp = new double[m][nColB];<a name="line.385"></a>
+<FONT color="green">386</FONT>                for (int k = 0; k &lt; nColB; ++k) {<a name="line.386"></a>
+<FONT color="green">387</FONT>                    for (int i = 0; i &lt; m; ++i) {<a name="line.387"></a>
+<FONT color="green">388</FONT>                        final ArrayRealVector v = eigenvectors[i];<a name="line.388"></a>
+<FONT color="green">389</FONT>                        final double[] vData = v.getDataRef();<a name="line.389"></a>
+<FONT color="green">390</FONT>                        double s = 0;<a name="line.390"></a>
+<FONT color="green">391</FONT>                        for (int j = 0; j &lt; m; ++j) {<a name="line.391"></a>
+<FONT color="green">392</FONT>                            s += v.getEntry(j) * b.getEntry(j, k);<a name="line.392"></a>
+<FONT color="green">393</FONT>                        }<a name="line.393"></a>
+<FONT color="green">394</FONT>                        s /= realEigenvalues[i];<a name="line.394"></a>
+<FONT color="green">395</FONT>                        for (int j = 0; j &lt; m; ++j) {<a name="line.395"></a>
+<FONT color="green">396</FONT>                            bp[j][k] += s * vData[j];<a name="line.396"></a>
+<FONT color="green">397</FONT>                        }<a name="line.397"></a>
+<FONT color="green">398</FONT>                    }<a name="line.398"></a>
+<FONT color="green">399</FONT>                }<a name="line.399"></a>
+<FONT color="green">400</FONT>    <a name="line.400"></a>
+<FONT color="green">401</FONT>                return MatrixUtils.createRealMatrix(bp);<a name="line.401"></a>
+<FONT color="green">402</FONT>    <a name="line.402"></a>
+<FONT color="green">403</FONT>            }<a name="line.403"></a>
+<FONT color="green">404</FONT>    <a name="line.404"></a>
+<FONT color="green">405</FONT>            /**<a name="line.405"></a>
+<FONT color="green">406</FONT>             * Check if the decomposed matrix is non-singular.<a name="line.406"></a>
+<FONT color="green">407</FONT>             * @return true if the decomposed matrix is non-singular<a name="line.407"></a>
+<FONT color="green">408</FONT>             */<a name="line.408"></a>
+<FONT color="green">409</FONT>            public boolean isNonSingular() {<a name="line.409"></a>
+<FONT color="green">410</FONT>                for (int i = 0; i &lt; realEigenvalues.length; ++i) {<a name="line.410"></a>
+<FONT color="green">411</FONT>                    if ((realEigenvalues[i] == 0) &amp;&amp; (imagEigenvalues[i] == 0)) {<a name="line.411"></a>
+<FONT color="green">412</FONT>                        return false;<a name="line.412"></a>
+<FONT color="green">413</FONT>                    }<a name="line.413"></a>
+<FONT color="green">414</FONT>                }<a name="line.414"></a>
+<FONT color="green">415</FONT>                return true;<a name="line.415"></a>
+<FONT color="green">416</FONT>            }<a name="line.416"></a>
+<FONT color="green">417</FONT>    <a name="line.417"></a>
+<FONT color="green">418</FONT>            /**<a name="line.418"></a>
+<FONT color="green">419</FONT>             * Get the inverse of the decomposed matrix.<a name="line.419"></a>
+<FONT color="green">420</FONT>             * @return inverse matrix<a name="line.420"></a>
+<FONT color="green">421</FONT>             * @throws InvalidMatrixException<a name="line.421"></a>
+<FONT color="green">422</FONT>             *             if decomposed matrix is singular<a name="line.422"></a>
+<FONT color="green">423</FONT>             */<a name="line.423"></a>
+<FONT color="green">424</FONT>            public RealMatrix getInverse() throws InvalidMatrixException {<a name="line.424"></a>
+<FONT color="green">425</FONT>    <a name="line.425"></a>
+<FONT color="green">426</FONT>                if (!isNonSingular()) {<a name="line.426"></a>
+<FONT color="green">427</FONT>                    throw new SingularMatrixException();<a name="line.427"></a>
+<FONT color="green">428</FONT>                }<a name="line.428"></a>
+<FONT color="green">429</FONT>    <a name="line.429"></a>
+<FONT color="green">430</FONT>                final int m = realEigenvalues.length;<a name="line.430"></a>
+<FONT color="green">431</FONT>                final double[][] invData = new double[m][m];<a name="line.431"></a>
+<FONT color="green">432</FONT>    <a name="line.432"></a>
+<FONT color="green">433</FONT>                for (int i = 0; i &lt; m; ++i) {<a name="line.433"></a>
+<FONT color="green">434</FONT>                    final double[] invI = invData[i];<a name="line.434"></a>
+<FONT color="green">435</FONT>                    for (int j = 0; j &lt; m; ++j) {<a name="line.435"></a>
+<FONT color="green">436</FONT>                        double invIJ = 0;<a name="line.436"></a>
+<FONT color="green">437</FONT>                        for (int k = 0; k &lt; m; ++k) {<a name="line.437"></a>
+<FONT color="green">438</FONT>                            final double[] vK = eigenvectors[k].getDataRef();<a name="line.438"></a>
+<FONT color="green">439</FONT>                            invIJ += vK[i] * vK[j] / realEigenvalues[k];<a name="line.439"></a>
+<FONT color="green">440</FONT>                        }<a name="line.440"></a>
+<FONT color="green">441</FONT>                        invI[j] = invIJ;<a name="line.441"></a>
+<FONT color="green">442</FONT>                    }<a name="line.442"></a>
+<FONT color="green">443</FONT>                }<a name="line.443"></a>
+<FONT color="green">444</FONT>                return MatrixUtils.createRealMatrix(invData);<a name="line.444"></a>
+<FONT color="green">445</FONT>    <a name="line.445"></a>
+<FONT color="green">446</FONT>            }<a name="line.446"></a>
+<FONT color="green">447</FONT>    <a name="line.447"></a>
+<FONT color="green">448</FONT>        }<a name="line.448"></a>
+<FONT color="green">449</FONT>    <a name="line.449"></a>
+<FONT color="green">450</FONT>        /**<a name="line.450"></a>
+<FONT color="green">451</FONT>         * Transform matrix to tridiagonal.<a name="line.451"></a>
+<FONT color="green">452</FONT>         * @param matrix<a name="line.452"></a>
+<FONT color="green">453</FONT>         *            matrix to transform<a name="line.453"></a>
+<FONT color="green">454</FONT>         */<a name="line.454"></a>
+<FONT color="green">455</FONT>        private void transformToTridiagonal(final RealMatrix matrix) {<a name="line.455"></a>
+<FONT color="green">456</FONT>    <a name="line.456"></a>
+<FONT color="green">457</FONT>            // transform the matrix to tridiagonal<a name="line.457"></a>
+<FONT color="green">458</FONT>            transformer = new TriDiagonalTransformer(matrix);<a name="line.458"></a>
+<FONT color="green">459</FONT>            main = transformer.getMainDiagonalRef();<a name="line.459"></a>
+<FONT color="green">460</FONT>            secondary = transformer.getSecondaryDiagonalRef();<a name="line.460"></a>
+<FONT color="green">461</FONT>    <a name="line.461"></a>
+<FONT color="green">462</FONT>        }<a name="line.462"></a>
+<FONT color="green">463</FONT>    <a name="line.463"></a>
+<FONT color="green">464</FONT>        /**<a name="line.464"></a>
+<FONT color="green">465</FONT>         * Find eigenvalues and eigenvectors (Dubrulle et al., 1971)<a name="line.465"></a>
+<FONT color="green">466</FONT>         * @param householderMatrix Householder matrix of the transformation<a name="line.466"></a>
+<FONT color="green">467</FONT>         *  to tri-diagonal form.<a name="line.467"></a>
+<FONT color="green">468</FONT>         */<a name="line.468"></a>
+<FONT color="green">469</FONT>        private void findEigenVectors(double[][] householderMatrix) {<a name="line.469"></a>
+<FONT color="green">470</FONT>    <a name="line.470"></a>
+<FONT color="green">471</FONT>            double[][]z = householderMatrix.clone();<a name="line.471"></a>
+<FONT color="green">472</FONT>            final int n = main.length;<a name="line.472"></a>
+<FONT color="green">473</FONT>            realEigenvalues = new double[n];<a name="line.473"></a>
+<FONT color="green">474</FONT>            imagEigenvalues = new double[n];<a name="line.474"></a>
+<FONT color="green">475</FONT>            double[] e = new double[n];<a name="line.475"></a>
+<FONT color="green">476</FONT>            for (int i = 0; i &lt; n - 1; i++) {<a name="line.476"></a>
+<FONT color="green">477</FONT>                realEigenvalues[i] = main[i];<a name="line.477"></a>
+<FONT color="green">478</FONT>                e[i] = secondary[i];<a name="line.478"></a>
+<FONT color="green">479</FONT>            }<a name="line.479"></a>
+<FONT color="green">480</FONT>            realEigenvalues[n - 1] = main[n - 1];<a name="line.480"></a>
+<FONT color="green">481</FONT>            e[n - 1] = 0.0;<a name="line.481"></a>
+<FONT color="green">482</FONT>    <a name="line.482"></a>
+<FONT color="green">483</FONT>            // Determine the largest main and secondary value in absolute term.<a name="line.483"></a>
+<FONT color="green">484</FONT>            double maxAbsoluteValue=0.0;<a name="line.484"></a>
+<FONT color="green">485</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.485"></a>
+<FONT color="green">486</FONT>                if (Math.abs(realEigenvalues[i])&gt;maxAbsoluteValue) {<a name="line.486"></a>
+<FONT color="green">487</FONT>                    maxAbsoluteValue=Math.abs(realEigenvalues[i]);<a name="line.487"></a>
+<FONT color="green">488</FONT>                }<a name="line.488"></a>
+<FONT color="green">489</FONT>                if (Math.abs(e[i])&gt;maxAbsoluteValue) {<a name="line.489"></a>
+<FONT color="green">490</FONT>                    maxAbsoluteValue=Math.abs(e[i]);<a name="line.490"></a>
+<FONT color="green">491</FONT>                }<a name="line.491"></a>
+<FONT color="green">492</FONT>            }<a name="line.492"></a>
+<FONT color="green">493</FONT>            // Make null any main and secondary value too small to be significant<a name="line.493"></a>
+<FONT color="green">494</FONT>            if (maxAbsoluteValue!=0.0) {<a name="line.494"></a>
+<FONT color="green">495</FONT>                for (int i=0; i &lt; n; i++) {<a name="line.495"></a>
+<FONT color="green">496</FONT>                    if (Math.abs(realEigenvalues[i])&lt;=MathUtils.EPSILON*maxAbsoluteValue) {<a name="line.496"></a>
+<FONT color="green">497</FONT>                        realEigenvalues[i]=0.0;<a name="line.497"></a>
+<FONT color="green">498</FONT>                    }<a name="line.498"></a>
+<FONT color="green">499</FONT>                    if (Math.abs(e[i])&lt;=MathUtils.EPSILON*maxAbsoluteValue) {<a name="line.499"></a>
+<FONT color="green">500</FONT>                        e[i]=0.0;<a name="line.500"></a>
+<FONT color="green">501</FONT>                    }<a name="line.501"></a>
+<FONT color="green">502</FONT>                }<a name="line.502"></a>
+<FONT color="green">503</FONT>            }<a name="line.503"></a>
+<FONT color="green">504</FONT>    <a name="line.504"></a>
+<FONT color="green">505</FONT>            for (int j = 0; j &lt; n; j++) {<a name="line.505"></a>
+<FONT color="green">506</FONT>                int its = 0;<a name="line.506"></a>
+<FONT color="green">507</FONT>                int m;<a name="line.507"></a>
+<FONT color="green">508</FONT>                do {<a name="line.508"></a>
+<FONT color="green">509</FONT>                    for (m = j; m &lt; n - 1; m++) {<a name="line.509"></a>
+<FONT color="green">510</FONT>                        double delta = Math.abs(realEigenvalues[m]) + Math.abs(realEigenvalues[m + 1]);<a name="line.510"></a>
+<FONT color="green">511</FONT>                        if (Math.abs(e[m]) + delta == delta) {<a name="line.511"></a>
+<FONT color="green">512</FONT>                            break;<a name="line.512"></a>
+<FONT color="green">513</FONT>                        }<a name="line.513"></a>
+<FONT color="green">514</FONT>                    }<a name="line.514"></a>
+<FONT color="green">515</FONT>                    if (m != j) {<a name="line.515"></a>
+<FONT color="green">516</FONT>                        if (its == maxIter)<a name="line.516"></a>
+<FONT color="green">517</FONT>                            throw new InvalidMatrixException(<a name="line.517"></a>
+<FONT color="green">518</FONT>                                    new MaxIterationsExceededException(maxIter));<a name="line.518"></a>
+<FONT color="green">519</FONT>                        its++;<a name="line.519"></a>
+<FONT color="green">520</FONT>                        double q = (realEigenvalues[j + 1] - realEigenvalues[j]) / (2 * e[j]);<a name="line.520"></a>
+<FONT color="green">521</FONT>                        double t = Math.sqrt(1 + q * q);<a name="line.521"></a>
+<FONT color="green">522</FONT>                        if (q &lt; 0.0) {<a name="line.522"></a>
+<FONT color="green">523</FONT>                            q = realEigenvalues[m] - realEigenvalues[j] + e[j] / (q - t);<a name="line.523"></a>
+<FONT color="green">524</FONT>                        } else {<a name="line.524"></a>
+<FONT color="green">525</FONT>                            q = realEigenvalues[m] - realEigenvalues[j] + e[j] / (q + t);<a name="line.525"></a>
+<FONT color="green">526</FONT>                        }<a name="line.526"></a>
+<FONT color="green">527</FONT>                        double u = 0.0;<a name="line.527"></a>
+<FONT color="green">528</FONT>                        double s = 1.0;<a name="line.528"></a>
+<FONT color="green">529</FONT>                        double c = 1.0;<a name="line.529"></a>
+<FONT color="green">530</FONT>                        int i;<a name="line.530"></a>
+<FONT color="green">531</FONT>                        for (i = m - 1; i &gt;= j; i--) {<a name="line.531"></a>
+<FONT color="green">532</FONT>                            double p = s * e[i];<a name="line.532"></a>
+<FONT color="green">533</FONT>                            double h = c * e[i];<a name="line.533"></a>
+<FONT color="green">534</FONT>                            if (Math.abs(p) &gt;= Math.abs(q)) {<a name="line.534"></a>
+<FONT color="green">535</FONT>                                c = q / p;<a name="line.535"></a>
+<FONT color="green">536</FONT>                                t = Math.sqrt(c * c + 1.0);<a name="line.536"></a>
+<FONT color="green">537</FONT>                                e[i + 1] = p * t;<a name="line.537"></a>
+<FONT color="green">538</FONT>                                s = 1.0 / t;<a name="line.538"></a>
+<FONT color="green">539</FONT>                                c = c * s;<a name="line.539"></a>
+<FONT color="green">540</FONT>                            } else {<a name="line.540"></a>
+<FONT color="green">541</FONT>                                s = p / q;<a name="line.541"></a>
+<FONT color="green">542</FONT>                                t = Math.sqrt(s * s + 1.0);<a name="line.542"></a>
+<FONT color="green">543</FONT>                                e[i + 1] = q * t;<a name="line.543"></a>
+<FONT color="green">544</FONT>                                c = 1.0 / t;<a name="line.544"></a>
+<FONT color="green">545</FONT>                                s = s * c;<a name="line.545"></a>
+<FONT color="green">546</FONT>                            }<a name="line.546"></a>
+<FONT color="green">547</FONT>                            if (e[i + 1] == 0.0) {<a name="line.547"></a>
+<FONT color="green">548</FONT>                                realEigenvalues[i + 1] -= u;<a name="line.548"></a>
+<FONT color="green">549</FONT>                                e[m] = 0.0;<a name="line.549"></a>
+<FONT color="green">550</FONT>                                break;<a name="line.550"></a>
+<FONT color="green">551</FONT>                            }<a name="line.551"></a>
+<FONT color="green">552</FONT>                            q = realEigenvalues[i + 1] - u;<a name="line.552"></a>
+<FONT color="green">553</FONT>                            t = (realEigenvalues[i] - q) * s + 2.0 * c * h;<a name="line.553"></a>
+<FONT color="green">554</FONT>                            u = s * t;<a name="line.554"></a>
+<FONT color="green">555</FONT>                            realEigenvalues[i + 1] = q + u;<a name="line.555"></a>
+<FONT color="green">556</FONT>                            q = c * t - h;<a name="line.556"></a>
+<FONT color="green">557</FONT>                            for (int ia = 0; ia &lt; n; ia++) {<a name="line.557"></a>
+<FONT color="green">558</FONT>                                p = z[ia][i + 1];<a name="line.558"></a>
+<FONT color="green">559</FONT>                                z[ia][i + 1] = s * z[ia][i] + c * p;<a name="line.559"></a>
+<FONT color="green">560</FONT>                                z[ia][i] = c * z[ia][i] - s * p;<a name="line.560"></a>
+<FONT color="green">561</FONT>                            }<a name="line.561"></a>
+<FONT color="green">562</FONT>                        }<a name="line.562"></a>
+<FONT color="green">563</FONT>                        if (e[i + 1] == 0.0 &amp;&amp; i &gt;= j)<a name="line.563"></a>
+<FONT color="green">564</FONT>                            continue;<a name="line.564"></a>
+<FONT color="green">565</FONT>                        realEigenvalues[j] -= u;<a name="line.565"></a>
+<FONT color="green">566</FONT>                        e[j] = q;<a name="line.566"></a>
+<FONT color="green">567</FONT>                        e[m] = 0.0;<a name="line.567"></a>
+<FONT color="green">568</FONT>                    }<a name="line.568"></a>
+<FONT color="green">569</FONT>                } while (m != j);<a name="line.569"></a>
+<FONT color="green">570</FONT>            }<a name="line.570"></a>
+<FONT color="green">571</FONT>    <a name="line.571"></a>
+<FONT color="green">572</FONT>            //Sort the eigen values (and vectors) in increase order<a name="line.572"></a>
+<FONT color="green">573</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.573"></a>
+<FONT color="green">574</FONT>                int k = i;<a name="line.574"></a>
+<FONT color="green">575</FONT>                double p = realEigenvalues[i];<a name="line.575"></a>
+<FONT color="green">576</FONT>                for (int j = i + 1; j &lt; n; j++) {<a name="line.576"></a>
+<FONT color="green">577</FONT>                    if (realEigenvalues[j] &gt; p) {<a name="line.577"></a>
+<FONT color="green">578</FONT>                        k = j;<a name="line.578"></a>
+<FONT color="green">579</FONT>                        p = realEigenvalues[j];<a name="line.579"></a>
+<FONT color="green">580</FONT>                    }<a name="line.580"></a>
+<FONT color="green">581</FONT>                }<a name="line.581"></a>
+<FONT color="green">582</FONT>                if (k != i) {<a name="line.582"></a>
+<FONT color="green">583</FONT>                    realEigenvalues[k] = realEigenvalues[i];<a name="line.583"></a>
+<FONT color="green">584</FONT>                    realEigenvalues[i] = p;<a name="line.584"></a>
+<FONT color="green">585</FONT>                    for (int j = 0; j &lt; n; j++) {<a name="line.585"></a>
+<FONT color="green">586</FONT>                        p = z[j][i];<a name="line.586"></a>
+<FONT color="green">587</FONT>                        z[j][i] = z[j][k];<a name="line.587"></a>
+<FONT color="green">588</FONT>                        z[j][k] = p;<a name="line.588"></a>
+<FONT color="green">589</FONT>                    }<a name="line.589"></a>
+<FONT color="green">590</FONT>                }<a name="line.590"></a>
+<FONT color="green">591</FONT>            }<a name="line.591"></a>
+<FONT color="green">592</FONT>    <a name="line.592"></a>
+<FONT color="green">593</FONT>            // Determine the largest eigen value in absolute term.<a name="line.593"></a>
+<FONT color="green">594</FONT>            maxAbsoluteValue=0.0;<a name="line.594"></a>
+<FONT color="green">595</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.595"></a>
+<FONT color="green">596</FONT>                if (Math.abs(realEigenvalues[i])&gt;maxAbsoluteValue) {<a name="line.596"></a>
+<FONT color="green">597</FONT>                    maxAbsoluteValue=Math.abs(realEigenvalues[i]);<a name="line.597"></a>
+<FONT color="green">598</FONT>                }<a name="line.598"></a>
+<FONT color="green">599</FONT>            }<a name="line.599"></a>
+<FONT color="green">600</FONT>            // Make null any eigen value too small to be significant<a name="line.600"></a>
+<FONT color="green">601</FONT>            if (maxAbsoluteValue!=0.0) {<a name="line.601"></a>
+<FONT color="green">602</FONT>                for (int i=0; i &lt; n; i++) {<a name="line.602"></a>
+<FONT color="green">603</FONT>                    if (Math.abs(realEigenvalues[i])&lt;MathUtils.EPSILON*maxAbsoluteValue) {<a name="line.603"></a>
+<FONT color="green">604</FONT>                        realEigenvalues[i]=0.0;<a name="line.604"></a>
+<FONT color="green">605</FONT>                    }<a name="line.605"></a>
+<FONT color="green">606</FONT>                }<a name="line.606"></a>
+<FONT color="green">607</FONT>            }<a name="line.607"></a>
+<FONT color="green">608</FONT>            eigenvectors = new ArrayRealVector[n];<a name="line.608"></a>
+<FONT color="green">609</FONT>            double[] tmp = new double[n];<a name="line.609"></a>
+<FONT color="green">610</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.610"></a>
+<FONT color="green">611</FONT>                for (int j = 0; j &lt; n; j++) {<a name="line.611"></a>
+<FONT color="green">612</FONT>                    tmp[j] = z[j][i];<a name="line.612"></a>
+<FONT color="green">613</FONT>                }<a name="line.613"></a>
+<FONT color="green">614</FONT>                eigenvectors[i] = new ArrayRealVector(tmp);<a name="line.614"></a>
+<FONT color="green">615</FONT>            }<a name="line.615"></a>
+<FONT color="green">616</FONT>        }<a name="line.616"></a>
+<FONT color="green">617</FONT>    }<a name="line.617"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/FieldDecompositionSolver.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,152 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FieldElement;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Interface handling decomposition algorithms that can solve A &amp;times; X = B.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;Decomposition algorithms decompose an A matrix has a product of several specific<a name="line.25"></a>
+<FONT color="green">026</FONT>     * matrices from which they can solve A &amp;times; X = B in least squares sense: they find X<a name="line.26"></a>
+<FONT color="green">027</FONT>     * such that ||A &amp;times; X - B|| is minimal.&lt;/p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;Some solvers like {@link LUDecomposition} can only find the solution for<a name="line.28"></a>
+<FONT color="green">029</FONT>     * square matrices and when the solution is an exact linear solution, i.e. when<a name="line.29"></a>
+<FONT color="green">030</FONT>     * ||A &amp;times; X - B|| is exactly 0. Other solvers can also find solutions<a name="line.30"></a>
+<FONT color="green">031</FONT>     * with non-square matrix A and with non-null minimal norm. If an exact linear<a name="line.31"></a>
+<FONT color="green">032</FONT>     * solution exists it is also the minimal norm solution.&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @param &lt;T&gt; the type of the field elements<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @version $Revision: 781122 $ $Date: 2009-06-02 14:53:23 -0400 (Tue, 02 Jun 2009) $<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @since 2.0<a name="line.36"></a>
+<FONT color="green">037</FONT>     */<a name="line.37"></a>
+<FONT color="green">038</FONT>    public interface FieldDecompositionSolver&lt;T extends FieldElement&lt;T&gt;&gt; {<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Solve the linear equation A &amp;times; X = B for matrices A.<a name="line.40"></a>
+<FONT color="green">041</FONT>         * &lt;p&gt;The A matrix is implicit, it is provided by the underlying<a name="line.41"></a>
+<FONT color="green">042</FONT>         * decomposition algorithm.&lt;/p&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @param b right-hand side of the equation A &amp;times; X = B<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @return a vector X that minimizes the two norm of A &amp;times; X - B<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @exception IllegalArgumentException if matrices dimensions don't match<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @exception InvalidMatrixException if decomposed matrix is singular<a name="line.46"></a>
+<FONT color="green">047</FONT>         */<a name="line.47"></a>
+<FONT color="green">048</FONT>        T[] solve(final T[] b)<a name="line.48"></a>
+<FONT color="green">049</FONT>            throws IllegalArgumentException, InvalidMatrixException;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /** Solve the linear equation A &amp;times; X = B for matrices A.<a name="line.51"></a>
+<FONT color="green">052</FONT>         * &lt;p&gt;The A matrix is implicit, it is provided by the underlying<a name="line.52"></a>
+<FONT color="green">053</FONT>         * decomposition algorithm.&lt;/p&gt;<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @param b right-hand side of the equation A &amp;times; X = B<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @return a vector X that minimizes the two norm of A &amp;times; X - B<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @exception IllegalArgumentException if matrices dimensions don't match<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @exception InvalidMatrixException if decomposed matrix is singular<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        FieldVector&lt;T&gt; solve(final FieldVector&lt;T&gt; b)<a name="line.59"></a>
+<FONT color="green">060</FONT>            throws IllegalArgumentException, InvalidMatrixException;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** Solve the linear equation A &amp;times; X = B for matrices A.<a name="line.62"></a>
+<FONT color="green">063</FONT>         * &lt;p&gt;The A matrix is implicit, it is provided by the underlying<a name="line.63"></a>
+<FONT color="green">064</FONT>         * decomposition algorithm.&lt;/p&gt;<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param b right-hand side of the equation A &amp;times; X = B<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @return a matrix X that minimizes the two norm of A &amp;times; X - B<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @exception IllegalArgumentException if matrices dimensions don't match<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @exception InvalidMatrixException if decomposed matrix is singular<a name="line.68"></a>
+<FONT color="green">069</FONT>         */<a name="line.69"></a>
+<FONT color="green">070</FONT>        FieldMatrix&lt;T&gt; solve(final FieldMatrix&lt;T&gt; b)<a name="line.70"></a>
+<FONT color="green">071</FONT>            throws IllegalArgumentException, InvalidMatrixException;<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /**<a name="line.73"></a>
+<FONT color="green">074</FONT>         * Check if the decomposed matrix is non-singular.<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @return true if the decomposed matrix is non-singular<a name="line.75"></a>
+<FONT color="green">076</FONT>         */<a name="line.76"></a>
+<FONT color="green">077</FONT>        boolean isNonSingular();<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        /** Get the inverse (or pseudo-inverse) of the decomposed matrix.<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @return inverse matrix<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @throws InvalidMatrixException if decomposed matrix is singular<a name="line.81"></a>
+<FONT color="green">082</FONT>         */<a name="line.82"></a>
+<FONT color="green">083</FONT>        FieldMatrix&lt;T&gt; getInverse()<a name="line.83"></a>
+<FONT color="green">084</FONT>            throws InvalidMatrixException;<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>    }<a name="line.86"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/FieldLUDecomposition.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,160 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FieldElement;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * An interface to classes that implement an algorithm to calculate the<a name="line.23"></a>
+<FONT color="green">024</FONT>     * LU-decomposition of a real matrix.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;The LU-decomposition of matrix A is a set of three matrices: P, L and U<a name="line.25"></a>
+<FONT color="green">026</FONT>     * such that P&amp;times;A = L&amp;times;U. P is a rows permutation matrix that is used<a name="line.26"></a>
+<FONT color="green">027</FONT>     * to rearrange the rows of A before so that it can be decomposed. L is a lower<a name="line.27"></a>
+<FONT color="green">028</FONT>     * triangular matrix with unit diagonal terms and U is an upper triangular matrix.&lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;This interface is based on the class with similar name from the<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;a href="http://math.nist.gov/javanumerics/jama/"&gt;JAMA&lt;/a&gt; library.&lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;ul&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     *   &lt;li&gt;a {@link #getP() getP} method has been added,&lt;/li&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     *   &lt;li&gt;the &lt;code&gt;det&lt;/code&gt; method has been renamed as {@link #getDeterminant()<a name="line.33"></a>
+<FONT color="green">034</FONT>     *   getDeterminant},&lt;/li&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     *   &lt;li&gt;the &lt;code&gt;getDoublePivot&lt;/code&gt; method has been removed (but the int based<a name="line.35"></a>
+<FONT color="green">036</FONT>     *   {@link #getPivot() getPivot} method has been kept),&lt;/li&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *   &lt;li&gt;the &lt;code&gt;solve&lt;/code&gt; and &lt;code&gt;isNonSingular&lt;/code&gt; methods have been replaced<a name="line.37"></a>
+<FONT color="green">038</FONT>     *   by a {@link #getSolver() getSolver} method and the equivalent methods provided by<a name="line.38"></a>
+<FONT color="green">039</FONT>     *   the returned {@link DecompositionSolver}.&lt;/li&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;/ul&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     *<a name="line.41"></a>
+<FONT color="green">042</FONT>     * @param &lt;T&gt; the type of the field elements<a name="line.42"></a>
+<FONT color="green">043</FONT>     * @see &lt;a href="http://mathworld.wolfram.com/LUDecomposition.html"&gt;MathWorld&lt;/a&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     * @see &lt;a href="http://en.wikipedia.org/wiki/LU_decomposition"&gt;Wikipedia&lt;/a&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     * @version $Revision: 826627 $ $Date: 2009-10-19 06:27:47 -0400 (Mon, 19 Oct 2009) $<a name="line.45"></a>
+<FONT color="green">046</FONT>     * @since 2.0<a name="line.46"></a>
+<FONT color="green">047</FONT>     */<a name="line.47"></a>
+<FONT color="green">048</FONT>    public interface FieldLUDecomposition&lt;T extends FieldElement&lt;T&gt;&gt; {<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Returns the matrix L of the decomposition.<a name="line.51"></a>
+<FONT color="green">052</FONT>         * &lt;p&gt;L is an lower-triangular matrix&lt;/p&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>         * @return the L matrix (or null if decomposed matrix is singular)<a name="line.53"></a>
+<FONT color="green">054</FONT>         */<a name="line.54"></a>
+<FONT color="green">055</FONT>        FieldMatrix&lt;T&gt; getL();<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /**<a name="line.57"></a>
+<FONT color="green">058</FONT>         * Returns the matrix U of the decomposition.<a name="line.58"></a>
+<FONT color="green">059</FONT>         * &lt;p&gt;U is an upper-triangular matrix&lt;/p&gt;<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @return the U matrix (or null if decomposed matrix is singular)<a name="line.60"></a>
+<FONT color="green">061</FONT>         */<a name="line.61"></a>
+<FONT color="green">062</FONT>        FieldMatrix&lt;T&gt; getU();<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /**<a name="line.64"></a>
+<FONT color="green">065</FONT>         * Returns the P rows permutation matrix.<a name="line.65"></a>
+<FONT color="green">066</FONT>         * &lt;p&gt;P is a sparse matrix with exactly one element set to 1.0 in<a name="line.66"></a>
+<FONT color="green">067</FONT>         * each row and each column, all other elements being set to 0.0.&lt;/p&gt;<a name="line.67"></a>
+<FONT color="green">068</FONT>         * &lt;p&gt;The positions of the 1 elements are given by the {@link #getPivot()<a name="line.68"></a>
+<FONT color="green">069</FONT>         * pivot permutation vector}.&lt;/p&gt;<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @return the P rows permutation matrix (or null if decomposed matrix is singular)<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @see #getPivot()<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        FieldMatrix&lt;T&gt; getP();<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /**<a name="line.75"></a>
+<FONT color="green">076</FONT>         * Returns the pivot permutation vector.<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @return the pivot permutation vector<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @see #getP()<a name="line.78"></a>
+<FONT color="green">079</FONT>         */<a name="line.79"></a>
+<FONT color="green">080</FONT>        int[] getPivot();<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>        /**<a name="line.82"></a>
+<FONT color="green">083</FONT>         * Return the determinant of the matrix<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @return determinant of the matrix<a name="line.84"></a>
+<FONT color="green">085</FONT>         */<a name="line.85"></a>
+<FONT color="green">086</FONT>        T getDeterminant();<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>        /**<a name="line.88"></a>
+<FONT color="green">089</FONT>         * Get a solver for finding the A &amp;times; X = B solution in exact linear sense.<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @return a solver<a name="line.90"></a>
+<FONT color="green">091</FONT>         */<a name="line.91"></a>
+<FONT color="green">092</FONT>        FieldDecompositionSolver&lt;T&gt; getSolver();<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>    }<a name="line.94"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/FieldLUDecompositionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,499 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.lang.reflect.Array;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.Field;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.FieldElement;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Calculates the LUP-decomposition of a square matrix.<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;The LUP-decomposition of a matrix A consists of three matrices<a name="line.28"></a>
+<FONT color="green">029</FONT>     * L, U and P that satisfy: PA = LU, L is lower triangular, and U is<a name="line.29"></a>
+<FONT color="green">030</FONT>     * upper triangular and P is a permutation matrix. All matrices are<a name="line.30"></a>
+<FONT color="green">031</FONT>     * m&amp;times;m.&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;Since {@link FieldElement field elements} do not provide an ordering<a name="line.32"></a>
+<FONT color="green">033</FONT>     * operator, the permutation matrix is computed here only in order to avoid<a name="line.33"></a>
+<FONT color="green">034</FONT>     * a zero pivot element, no attempt is done to get the largest pivot element.&lt;/p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     *<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @param &lt;T&gt; the type of the field elements<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @version $Revision: 903046 $ $Date: 2010-01-25 21:07:26 -0500 (Mon, 25 Jan 2010) $<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @since 2.0<a name="line.38"></a>
+<FONT color="green">039</FONT>     */<a name="line.39"></a>
+<FONT color="green">040</FONT>    public class FieldLUDecompositionImpl&lt;T extends FieldElement&lt;T&gt;&gt; implements FieldLUDecomposition&lt;T&gt; {<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Field to which the elements belong. */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private final Field&lt;T&gt; field;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Entries of LU decomposition. */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private T lu[][];<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** Pivot permutation associated with LU decomposition */<a name="line.48"></a>
+<FONT color="green">049</FONT>        private int[] pivot;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /** Parity of the permutation associated with the LU decomposition */<a name="line.51"></a>
+<FONT color="green">052</FONT>        private boolean even;<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /** Singularity indicator. */<a name="line.54"></a>
+<FONT color="green">055</FONT>        private boolean singular;<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /** Cached value of L. */<a name="line.57"></a>
+<FONT color="green">058</FONT>        private FieldMatrix&lt;T&gt; cachedL;<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Cached value of U. */<a name="line.60"></a>
+<FONT color="green">061</FONT>        private FieldMatrix&lt;T&gt; cachedU;<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /** Cached value of P. */<a name="line.63"></a>
+<FONT color="green">064</FONT>        private FieldMatrix&lt;T&gt; cachedP;<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /**<a name="line.66"></a>
+<FONT color="green">067</FONT>         * Calculates the LU-decomposition of the given matrix.<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param matrix The matrix to decompose.<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @exception NonSquareMatrixException if matrix is not square<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        public FieldLUDecompositionImpl(FieldMatrix&lt;T&gt; matrix)<a name="line.71"></a>
+<FONT color="green">072</FONT>            throws NonSquareMatrixException {<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>            if (!matrix.isSquare()) {<a name="line.74"></a>
+<FONT color="green">075</FONT>                throw new NonSquareMatrixException(matrix.getRowDimension(), matrix.getColumnDimension());<a name="line.75"></a>
+<FONT color="green">076</FONT>            }<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>            final int m = matrix.getColumnDimension();<a name="line.78"></a>
+<FONT color="green">079</FONT>            field = matrix.getField();<a name="line.79"></a>
+<FONT color="green">080</FONT>            lu = matrix.getData();<a name="line.80"></a>
+<FONT color="green">081</FONT>            pivot = new int[m];<a name="line.81"></a>
+<FONT color="green">082</FONT>            cachedL = null;<a name="line.82"></a>
+<FONT color="green">083</FONT>            cachedU = null;<a name="line.83"></a>
+<FONT color="green">084</FONT>            cachedP = null;<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>            // Initialize permutation array and parity<a name="line.86"></a>
+<FONT color="green">087</FONT>            for (int row = 0; row &lt; m; row++) {<a name="line.87"></a>
+<FONT color="green">088</FONT>                pivot[row] = row;<a name="line.88"></a>
+<FONT color="green">089</FONT>            }<a name="line.89"></a>
+<FONT color="green">090</FONT>            even     = true;<a name="line.90"></a>
+<FONT color="green">091</FONT>            singular = false;<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>            // Loop over columns<a name="line.93"></a>
+<FONT color="green">094</FONT>            for (int col = 0; col &lt; m; col++) {<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>                T sum = field.getZero();<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>                // upper<a name="line.98"></a>
+<FONT color="green">099</FONT>                for (int row = 0; row &lt; col; row++) {<a name="line.99"></a>
+<FONT color="green">100</FONT>                    final T[] luRow = lu[row];<a name="line.100"></a>
+<FONT color="green">101</FONT>                    sum = luRow[col];<a name="line.101"></a>
+<FONT color="green">102</FONT>                    for (int i = 0; i &lt; row; i++) {<a name="line.102"></a>
+<FONT color="green">103</FONT>                        sum = sum.subtract(luRow[i].multiply(lu[i][col]));<a name="line.103"></a>
+<FONT color="green">104</FONT>                    }<a name="line.104"></a>
+<FONT color="green">105</FONT>                    luRow[col] = sum;<a name="line.105"></a>
+<FONT color="green">106</FONT>                }<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>                // lower<a name="line.108"></a>
+<FONT color="green">109</FONT>                int nonZero = col; // permutation row<a name="line.109"></a>
+<FONT color="green">110</FONT>                for (int row = col; row &lt; m; row++) {<a name="line.110"></a>
+<FONT color="green">111</FONT>                    final T[] luRow = lu[row];<a name="line.111"></a>
+<FONT color="green">112</FONT>                    sum = luRow[col];<a name="line.112"></a>
+<FONT color="green">113</FONT>                    for (int i = 0; i &lt; col; i++) {<a name="line.113"></a>
+<FONT color="green">114</FONT>                        sum = sum.subtract(luRow[i].multiply(lu[i][col]));<a name="line.114"></a>
+<FONT color="green">115</FONT>                    }<a name="line.115"></a>
+<FONT color="green">116</FONT>                    luRow[col] = sum;<a name="line.116"></a>
+<FONT color="green">117</FONT>    <a name="line.117"></a>
+<FONT color="green">118</FONT>                    if (lu[nonZero][col].equals(field.getZero())) {<a name="line.118"></a>
+<FONT color="green">119</FONT>                        // try to select a better permutation choice<a name="line.119"></a>
+<FONT color="green">120</FONT>                        ++nonZero;<a name="line.120"></a>
+<FONT color="green">121</FONT>                    }<a name="line.121"></a>
+<FONT color="green">122</FONT>                }<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>                // Singularity check<a name="line.124"></a>
+<FONT color="green">125</FONT>                if (nonZero &gt;= m) {<a name="line.125"></a>
+<FONT color="green">126</FONT>                    singular = true;<a name="line.126"></a>
+<FONT color="green">127</FONT>                    return;<a name="line.127"></a>
+<FONT color="green">128</FONT>                }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>                // Pivot if necessary<a name="line.130"></a>
+<FONT color="green">131</FONT>                if (nonZero != col) {<a name="line.131"></a>
+<FONT color="green">132</FONT>                    T tmp = field.getZero();<a name="line.132"></a>
+<FONT color="green">133</FONT>                    for (int i = 0; i &lt; m; i++) {<a name="line.133"></a>
+<FONT color="green">134</FONT>                        tmp = lu[nonZero][i];<a name="line.134"></a>
+<FONT color="green">135</FONT>                        lu[nonZero][i] = lu[col][i];<a name="line.135"></a>
+<FONT color="green">136</FONT>                        lu[col][i] = tmp;<a name="line.136"></a>
+<FONT color="green">137</FONT>                    }<a name="line.137"></a>
+<FONT color="green">138</FONT>                    int temp = pivot[nonZero];<a name="line.138"></a>
+<FONT color="green">139</FONT>                    pivot[nonZero] = pivot[col];<a name="line.139"></a>
+<FONT color="green">140</FONT>                    pivot[col] = temp;<a name="line.140"></a>
+<FONT color="green">141</FONT>                    even = !even;<a name="line.141"></a>
+<FONT color="green">142</FONT>                }<a name="line.142"></a>
+<FONT color="green">143</FONT>    <a name="line.143"></a>
+<FONT color="green">144</FONT>                // Divide the lower elements by the "winning" diagonal elt.<a name="line.144"></a>
+<FONT color="green">145</FONT>                final T luDiag = lu[col][col];<a name="line.145"></a>
+<FONT color="green">146</FONT>                for (int row = col + 1; row &lt; m; row++) {<a name="line.146"></a>
+<FONT color="green">147</FONT>                    final T[] luRow = lu[row];<a name="line.147"></a>
+<FONT color="green">148</FONT>                    luRow[col] = luRow[col].divide(luDiag);<a name="line.148"></a>
+<FONT color="green">149</FONT>                }<a name="line.149"></a>
+<FONT color="green">150</FONT>            }<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>        }<a name="line.152"></a>
+<FONT color="green">153</FONT>    <a name="line.153"></a>
+<FONT color="green">154</FONT>        /** {@inheritDoc} */<a name="line.154"></a>
+<FONT color="green">155</FONT>        public FieldMatrix&lt;T&gt; getL() {<a name="line.155"></a>
+<FONT color="green">156</FONT>            if ((cachedL == null) &amp;&amp; !singular) {<a name="line.156"></a>
+<FONT color="green">157</FONT>                final int m = pivot.length;<a name="line.157"></a>
+<FONT color="green">158</FONT>                cachedL = new Array2DRowFieldMatrix&lt;T&gt;(field, m, m);<a name="line.158"></a>
+<FONT color="green">159</FONT>                for (int i = 0; i &lt; m; ++i) {<a name="line.159"></a>
+<FONT color="green">160</FONT>                    final T[] luI = lu[i];<a name="line.160"></a>
+<FONT color="green">161</FONT>                    for (int j = 0; j &lt; i; ++j) {<a name="line.161"></a>
+<FONT color="green">162</FONT>                        cachedL.setEntry(i, j, luI[j]);<a name="line.162"></a>
+<FONT color="green">163</FONT>                    }<a name="line.163"></a>
+<FONT color="green">164</FONT>                    cachedL.setEntry(i, i, field.getOne());<a name="line.164"></a>
+<FONT color="green">165</FONT>                }<a name="line.165"></a>
+<FONT color="green">166</FONT>            }<a name="line.166"></a>
+<FONT color="green">167</FONT>            return cachedL;<a name="line.167"></a>
+<FONT color="green">168</FONT>        }<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>        /** {@inheritDoc} */<a name="line.170"></a>
+<FONT color="green">171</FONT>        public FieldMatrix&lt;T&gt; getU() {<a name="line.171"></a>
+<FONT color="green">172</FONT>            if ((cachedU == null) &amp;&amp; !singular) {<a name="line.172"></a>
+<FONT color="green">173</FONT>                final int m = pivot.length;<a name="line.173"></a>
+<FONT color="green">174</FONT>                cachedU = new Array2DRowFieldMatrix&lt;T&gt;(field, m, m);<a name="line.174"></a>
+<FONT color="green">175</FONT>                for (int i = 0; i &lt; m; ++i) {<a name="line.175"></a>
+<FONT color="green">176</FONT>                    final T[] luI = lu[i];<a name="line.176"></a>
+<FONT color="green">177</FONT>                    for (int j = i; j &lt; m; ++j) {<a name="line.177"></a>
+<FONT color="green">178</FONT>                        cachedU.setEntry(i, j, luI[j]);<a name="line.178"></a>
+<FONT color="green">179</FONT>                    }<a name="line.179"></a>
+<FONT color="green">180</FONT>                }<a name="line.180"></a>
+<FONT color="green">181</FONT>            }<a name="line.181"></a>
+<FONT color="green">182</FONT>            return cachedU;<a name="line.182"></a>
+<FONT color="green">183</FONT>        }<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>        /** {@inheritDoc} */<a name="line.185"></a>
+<FONT color="green">186</FONT>        public FieldMatrix&lt;T&gt; getP() {<a name="line.186"></a>
+<FONT color="green">187</FONT>            if ((cachedP == null) &amp;&amp; !singular) {<a name="line.187"></a>
+<FONT color="green">188</FONT>                final int m = pivot.length;<a name="line.188"></a>
+<FONT color="green">189</FONT>                cachedP = new Array2DRowFieldMatrix&lt;T&gt;(field, m, m);<a name="line.189"></a>
+<FONT color="green">190</FONT>                for (int i = 0; i &lt; m; ++i) {<a name="line.190"></a>
+<FONT color="green">191</FONT>                    cachedP.setEntry(i, pivot[i], field.getOne());<a name="line.191"></a>
+<FONT color="green">192</FONT>                }<a name="line.192"></a>
+<FONT color="green">193</FONT>            }<a name="line.193"></a>
+<FONT color="green">194</FONT>            return cachedP;<a name="line.194"></a>
+<FONT color="green">195</FONT>        }<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>        /** {@inheritDoc} */<a name="line.197"></a>
+<FONT color="green">198</FONT>        public int[] getPivot() {<a name="line.198"></a>
+<FONT color="green">199</FONT>            return pivot.clone();<a name="line.199"></a>
+<FONT color="green">200</FONT>        }<a name="line.200"></a>
+<FONT color="green">201</FONT>    <a name="line.201"></a>
+<FONT color="green">202</FONT>        /** {@inheritDoc} */<a name="line.202"></a>
+<FONT color="green">203</FONT>        public T getDeterminant() {<a name="line.203"></a>
+<FONT color="green">204</FONT>            if (singular) {<a name="line.204"></a>
+<FONT color="green">205</FONT>                return field.getZero();<a name="line.205"></a>
+<FONT color="green">206</FONT>            } else {<a name="line.206"></a>
+<FONT color="green">207</FONT>                final int m = pivot.length;<a name="line.207"></a>
+<FONT color="green">208</FONT>                T determinant = even ? field.getOne() : field.getZero().subtract(field.getOne());<a name="line.208"></a>
+<FONT color="green">209</FONT>                for (int i = 0; i &lt; m; i++) {<a name="line.209"></a>
+<FONT color="green">210</FONT>                    determinant = determinant.multiply(lu[i][i]);<a name="line.210"></a>
+<FONT color="green">211</FONT>                }<a name="line.211"></a>
+<FONT color="green">212</FONT>                return determinant;<a name="line.212"></a>
+<FONT color="green">213</FONT>            }<a name="line.213"></a>
+<FONT color="green">214</FONT>        }<a name="line.214"></a>
+<FONT color="green">215</FONT>    <a name="line.215"></a>
+<FONT color="green">216</FONT>        /** {@inheritDoc} */<a name="line.216"></a>
+<FONT color="green">217</FONT>        public FieldDecompositionSolver&lt;T&gt; getSolver() {<a name="line.217"></a>
+<FONT color="green">218</FONT>            return new Solver&lt;T&gt;(field, lu, pivot, singular);<a name="line.218"></a>
+<FONT color="green">219</FONT>        }<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>        /** Specialized solver. */<a name="line.221"></a>
+<FONT color="green">222</FONT>        private static class Solver&lt;T extends FieldElement&lt;T&gt;&gt; implements FieldDecompositionSolver&lt;T&gt; {<a name="line.222"></a>
+<FONT color="green">223</FONT>    <a name="line.223"></a>
+<FONT color="green">224</FONT>            /** Serializable version identifier. */<a name="line.224"></a>
+<FONT color="green">225</FONT>            private static final long serialVersionUID = -6353105415121373022L;<a name="line.225"></a>
+<FONT color="green">226</FONT>    <a name="line.226"></a>
+<FONT color="green">227</FONT>            /** Field to which the elements belong. */<a name="line.227"></a>
+<FONT color="green">228</FONT>            private final Field&lt;T&gt; field;<a name="line.228"></a>
+<FONT color="green">229</FONT>    <a name="line.229"></a>
+<FONT color="green">230</FONT>            /** Entries of LU decomposition. */<a name="line.230"></a>
+<FONT color="green">231</FONT>            private final T lu[][];<a name="line.231"></a>
+<FONT color="green">232</FONT>    <a name="line.232"></a>
+<FONT color="green">233</FONT>            /** Pivot permutation associated with LU decomposition. */<a name="line.233"></a>
+<FONT color="green">234</FONT>            private final int[] pivot;<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>            /** Singularity indicator. */<a name="line.236"></a>
+<FONT color="green">237</FONT>            private final boolean singular;<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>            /**<a name="line.239"></a>
+<FONT color="green">240</FONT>             * Build a solver from decomposed matrix.<a name="line.240"></a>
+<FONT color="green">241</FONT>             * @param field field to which the matrix elements belong<a name="line.241"></a>
+<FONT color="green">242</FONT>             * @param lu entries of LU decomposition<a name="line.242"></a>
+<FONT color="green">243</FONT>             * @param pivot pivot permutation associated with LU decomposition<a name="line.243"></a>
+<FONT color="green">244</FONT>             * @param singular singularity indicator<a name="line.244"></a>
+<FONT color="green">245</FONT>             */<a name="line.245"></a>
+<FONT color="green">246</FONT>            private Solver(final Field&lt;T&gt; field, final T[][] lu,<a name="line.246"></a>
+<FONT color="green">247</FONT>                           final int[] pivot, final boolean singular) {<a name="line.247"></a>
+<FONT color="green">248</FONT>                this.field    = field;<a name="line.248"></a>
+<FONT color="green">249</FONT>                this.lu       = lu;<a name="line.249"></a>
+<FONT color="green">250</FONT>                this.pivot    = pivot;<a name="line.250"></a>
+<FONT color="green">251</FONT>                this.singular = singular;<a name="line.251"></a>
+<FONT color="green">252</FONT>            }<a name="line.252"></a>
+<FONT color="green">253</FONT>    <a name="line.253"></a>
+<FONT color="green">254</FONT>            /** {@inheritDoc} */<a name="line.254"></a>
+<FONT color="green">255</FONT>            public boolean isNonSingular() {<a name="line.255"></a>
+<FONT color="green">256</FONT>                return !singular;<a name="line.256"></a>
+<FONT color="green">257</FONT>            }<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>            /** {@inheritDoc} */<a name="line.259"></a>
+<FONT color="green">260</FONT>            public T[] solve(T[] b)<a name="line.260"></a>
+<FONT color="green">261</FONT>                throws IllegalArgumentException, InvalidMatrixException {<a name="line.261"></a>
+<FONT color="green">262</FONT>    <a name="line.262"></a>
+<FONT color="green">263</FONT>                final int m = pivot.length;<a name="line.263"></a>
+<FONT color="green">264</FONT>                if (b.length != m) {<a name="line.264"></a>
+<FONT color="green">265</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.265"></a>
+<FONT color="green">266</FONT>                            "vector length mismatch: got {0} but expected {1}",<a name="line.266"></a>
+<FONT color="green">267</FONT>                            b.length, m);<a name="line.267"></a>
+<FONT color="green">268</FONT>                }<a name="line.268"></a>
+<FONT color="green">269</FONT>                if (singular) {<a name="line.269"></a>
+<FONT color="green">270</FONT>                    throw new SingularMatrixException();<a name="line.270"></a>
+<FONT color="green">271</FONT>                }<a name="line.271"></a>
+<FONT color="green">272</FONT>    <a name="line.272"></a>
+<FONT color="green">273</FONT>                @SuppressWarnings("unchecked") // field is of type T<a name="line.273"></a>
+<FONT color="green">274</FONT>                final T[] bp = (T[]) Array.newInstance(field.getZero().getClass(), m);<a name="line.274"></a>
+<FONT color="green">275</FONT>    <a name="line.275"></a>
+<FONT color="green">276</FONT>                // Apply permutations to b<a name="line.276"></a>
+<FONT color="green">277</FONT>                for (int row = 0; row &lt; m; row++) {<a name="line.277"></a>
+<FONT color="green">278</FONT>                    bp[row] = b[pivot[row]];<a name="line.278"></a>
+<FONT color="green">279</FONT>                }<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>                // Solve LY = b<a name="line.281"></a>
+<FONT color="green">282</FONT>                for (int col = 0; col &lt; m; col++) {<a name="line.282"></a>
+<FONT color="green">283</FONT>                    final T bpCol = bp[col];<a name="line.283"></a>
+<FONT color="green">284</FONT>                    for (int i = col + 1; i &lt; m; i++) {<a name="line.284"></a>
+<FONT color="green">285</FONT>                        bp[i] = bp[i].subtract(bpCol.multiply(lu[i][col]));<a name="line.285"></a>
+<FONT color="green">286</FONT>                    }<a name="line.286"></a>
+<FONT color="green">287</FONT>                }<a name="line.287"></a>
+<FONT color="green">288</FONT>    <a name="line.288"></a>
+<FONT color="green">289</FONT>                // Solve UX = Y<a name="line.289"></a>
+<FONT color="green">290</FONT>                for (int col = m - 1; col &gt;= 0; col--) {<a name="line.290"></a>
+<FONT color="green">291</FONT>                    bp[col] = bp[col].divide(lu[col][col]);<a name="line.291"></a>
+<FONT color="green">292</FONT>                    final T bpCol = bp[col];<a name="line.292"></a>
+<FONT color="green">293</FONT>                    for (int i = 0; i &lt; col; i++) {<a name="line.293"></a>
+<FONT color="green">294</FONT>                        bp[i] = bp[i].subtract(bpCol.multiply(lu[i][col]));<a name="line.294"></a>
+<FONT color="green">295</FONT>                    }<a name="line.295"></a>
+<FONT color="green">296</FONT>                }<a name="line.296"></a>
+<FONT color="green">297</FONT>    <a name="line.297"></a>
+<FONT color="green">298</FONT>                return bp;<a name="line.298"></a>
+<FONT color="green">299</FONT>    <a name="line.299"></a>
+<FONT color="green">300</FONT>            }<a name="line.300"></a>
+<FONT color="green">301</FONT>    <a name="line.301"></a>
+<FONT color="green">302</FONT>            /** {@inheritDoc} */<a name="line.302"></a>
+<FONT color="green">303</FONT>            public FieldVector&lt;T&gt; solve(FieldVector&lt;T&gt; b)<a name="line.303"></a>
+<FONT color="green">304</FONT>                throws IllegalArgumentException, InvalidMatrixException {<a name="line.304"></a>
+<FONT color="green">305</FONT>                try {<a name="line.305"></a>
+<FONT color="green">306</FONT>                    return solve((ArrayFieldVector&lt;T&gt;) b);<a name="line.306"></a>
+<FONT color="green">307</FONT>                } catch (ClassCastException cce) {<a name="line.307"></a>
+<FONT color="green">308</FONT>    <a name="line.308"></a>
+<FONT color="green">309</FONT>                    final int m = pivot.length;<a name="line.309"></a>
+<FONT color="green">310</FONT>                    if (b.getDimension() != m) {<a name="line.310"></a>
+<FONT color="green">311</FONT>                        throw MathRuntimeException.createIllegalArgumentException(<a name="line.311"></a>
+<FONT color="green">312</FONT>                                "vector length mismatch: got {0} but expected {1}",<a name="line.312"></a>
+<FONT color="green">313</FONT>                                b.getDimension(), m);<a name="line.313"></a>
+<FONT color="green">314</FONT>                    }<a name="line.314"></a>
+<FONT color="green">315</FONT>                    if (singular) {<a name="line.315"></a>
+<FONT color="green">316</FONT>                        throw new SingularMatrixException();<a name="line.316"></a>
+<FONT color="green">317</FONT>                    }<a name="line.317"></a>
+<FONT color="green">318</FONT>    <a name="line.318"></a>
+<FONT color="green">319</FONT>                    @SuppressWarnings("unchecked") // field is of type T<a name="line.319"></a>
+<FONT color="green">320</FONT>                    final T[] bp = (T[]) Array.newInstance(field.getZero().getClass(), m);<a name="line.320"></a>
+<FONT color="green">321</FONT>    <a name="line.321"></a>
+<FONT color="green">322</FONT>                    // Apply permutations to b<a name="line.322"></a>
+<FONT color="green">323</FONT>                    for (int row = 0; row &lt; m; row++) {<a name="line.323"></a>
+<FONT color="green">324</FONT>                        bp[row] = b.getEntry(pivot[row]);<a name="line.324"></a>
+<FONT color="green">325</FONT>                    }<a name="line.325"></a>
+<FONT color="green">326</FONT>    <a name="line.326"></a>
+<FONT color="green">327</FONT>                    // Solve LY = b<a name="line.327"></a>
+<FONT color="green">328</FONT>                    for (int col = 0; col &lt; m; col++) {<a name="line.328"></a>
+<FONT color="green">329</FONT>                        final T bpCol = bp[col];<a name="line.329"></a>
+<FONT color="green">330</FONT>                        for (int i = col + 1; i &lt; m; i++) {<a name="line.330"></a>
+<FONT color="green">331</FONT>                            bp[i] = bp[i].subtract(bpCol.multiply(lu[i][col]));<a name="line.331"></a>
+<FONT color="green">332</FONT>                        }<a name="line.332"></a>
+<FONT color="green">333</FONT>                    }<a name="line.333"></a>
+<FONT color="green">334</FONT>    <a name="line.334"></a>
+<FONT color="green">335</FONT>                    // Solve UX = Y<a name="line.335"></a>
+<FONT color="green">336</FONT>                    for (int col = m - 1; col &gt;= 0; col--) {<a name="line.336"></a>
+<FONT color="green">337</FONT>                        bp[col] = bp[col].divide(lu[col][col]);<a name="line.337"></a>
+<FONT color="green">338</FONT>                        final T bpCol = bp[col];<a name="line.338"></a>
+<FONT color="green">339</FONT>                        for (int i = 0; i &lt; col; i++) {<a name="line.339"></a>
+<FONT color="green">340</FONT>                            bp[i] = bp[i].subtract(bpCol.multiply(lu[i][col]));<a name="line.340"></a>
+<FONT color="green">341</FONT>                        }<a name="line.341"></a>
+<FONT color="green">342</FONT>                    }<a name="line.342"></a>
+<FONT color="green">343</FONT>    <a name="line.343"></a>
+<FONT color="green">344</FONT>                    return new ArrayFieldVector&lt;T&gt;(bp, false);<a name="line.344"></a>
+<FONT color="green">345</FONT>    <a name="line.345"></a>
+<FONT color="green">346</FONT>                }<a name="line.346"></a>
+<FONT color="green">347</FONT>            }<a name="line.347"></a>
+<FONT color="green">348</FONT>    <a name="line.348"></a>
+<FONT color="green">349</FONT>            /** Solve the linear equation A &amp;times; X = B.<a name="line.349"></a>
+<FONT color="green">350</FONT>             * &lt;p&gt;The A matrix is implicit here. It is &lt;/p&gt;<a name="line.350"></a>
+<FONT color="green">351</FONT>             * @param b right-hand side of the equation A &amp;times; X = B<a name="line.351"></a>
+<FONT color="green">352</FONT>             * @return a vector X such that A &amp;times; X = B<a name="line.352"></a>
+<FONT color="green">353</FONT>             * @exception IllegalArgumentException if matrices dimensions don't match<a name="line.353"></a>
+<FONT color="green">354</FONT>             * @exception InvalidMatrixException if decomposed matrix is singular<a name="line.354"></a>
+<FONT color="green">355</FONT>             */<a name="line.355"></a>
+<FONT color="green">356</FONT>            public ArrayFieldVector&lt;T&gt; solve(ArrayFieldVector&lt;T&gt; b)<a name="line.356"></a>
+<FONT color="green">357</FONT>                throws IllegalArgumentException, InvalidMatrixException {<a name="line.357"></a>
+<FONT color="green">358</FONT>                return new ArrayFieldVector&lt;T&gt;(solve(b.getDataRef()), false);<a name="line.358"></a>
+<FONT color="green">359</FONT>            }<a name="line.359"></a>
+<FONT color="green">360</FONT>    <a name="line.360"></a>
+<FONT color="green">361</FONT>            /** {@inheritDoc} */<a name="line.361"></a>
+<FONT color="green">362</FONT>            public FieldMatrix&lt;T&gt; solve(FieldMatrix&lt;T&gt; b)<a name="line.362"></a>
+<FONT color="green">363</FONT>                throws IllegalArgumentException, InvalidMatrixException {<a name="line.363"></a>
+<FONT color="green">364</FONT>    <a name="line.364"></a>
+<FONT color="green">365</FONT>                final int m = pivot.length;<a name="line.365"></a>
+<FONT color="green">366</FONT>                if (b.getRowDimension() != m) {<a name="line.366"></a>
+<FONT color="green">367</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.367"></a>
+<FONT color="green">368</FONT>                            "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.368"></a>
+<FONT color="green">369</FONT>                            b.getRowDimension(), b.getColumnDimension(), m, "n");<a name="line.369"></a>
+<FONT color="green">370</FONT>                }<a name="line.370"></a>
+<FONT color="green">371</FONT>                if (singular) {<a name="line.371"></a>
+<FONT color="green">372</FONT>                    throw new SingularMatrixException();<a name="line.372"></a>
+<FONT color="green">373</FONT>                }<a name="line.373"></a>
+<FONT color="green">374</FONT>    <a name="line.374"></a>
+<FONT color="green">375</FONT>                final int nColB = b.getColumnDimension();<a name="line.375"></a>
+<FONT color="green">376</FONT>    <a name="line.376"></a>
+<FONT color="green">377</FONT>                // Apply permutations to b<a name="line.377"></a>
+<FONT color="green">378</FONT>                @SuppressWarnings("unchecked") // field is of type T<a name="line.378"></a>
+<FONT color="green">379</FONT>                final T[][] bp = (T[][]) Array.newInstance(field.getZero().getClass(), new int[] { m, nColB });<a name="line.379"></a>
+<FONT color="green">380</FONT>                for (int row = 0; row &lt; m; row++) {<a name="line.380"></a>
+<FONT color="green">381</FONT>                    final T[] bpRow = bp[row];<a name="line.381"></a>
+<FONT color="green">382</FONT>                    final int pRow = pivot[row];<a name="line.382"></a>
+<FONT color="green">383</FONT>                    for (int col = 0; col &lt; nColB; col++) {<a name="line.383"></a>
+<FONT color="green">384</FONT>                        bpRow[col] = b.getEntry(pRow, col);<a name="line.384"></a>
+<FONT color="green">385</FONT>                    }<a name="line.385"></a>
+<FONT color="green">386</FONT>                }<a name="line.386"></a>
+<FONT color="green">387</FONT>    <a name="line.387"></a>
+<FONT color="green">388</FONT>                // Solve LY = b<a name="line.388"></a>
+<FONT color="green">389</FONT>                for (int col = 0; col &lt; m; col++) {<a name="line.389"></a>
+<FONT color="green">390</FONT>                    final T[] bpCol = bp[col];<a name="line.390"></a>
+<FONT color="green">391</FONT>                    for (int i = col + 1; i &lt; m; i++) {<a name="line.391"></a>
+<FONT color="green">392</FONT>                        final T[] bpI = bp[i];<a name="line.392"></a>
+<FONT color="green">393</FONT>                        final T luICol = lu[i][col];<a name="line.393"></a>
+<FONT color="green">394</FONT>                        for (int j = 0; j &lt; nColB; j++) {<a name="line.394"></a>
+<FONT color="green">395</FONT>                            bpI[j] = bpI[j].subtract(bpCol[j].multiply(luICol));<a name="line.395"></a>
+<FONT color="green">396</FONT>                        }<a name="line.396"></a>
+<FONT color="green">397</FONT>                    }<a name="line.397"></a>
+<FONT color="green">398</FONT>                }<a name="line.398"></a>
+<FONT color="green">399</FONT>    <a name="line.399"></a>
+<FONT color="green">400</FONT>                // Solve UX = Y<a name="line.400"></a>
+<FONT color="green">401</FONT>                for (int col = m - 1; col &gt;= 0; col--) {<a name="line.401"></a>
+<FONT color="green">402</FONT>                    final T[] bpCol = bp[col];<a name="line.402"></a>
+<FONT color="green">403</FONT>                    final T luDiag = lu[col][col];<a name="line.403"></a>
+<FONT color="green">404</FONT>                    for (int j = 0; j &lt; nColB; j++) {<a name="line.404"></a>
+<FONT color="green">405</FONT>                        bpCol[j] = bpCol[j].divide(luDiag);<a name="line.405"></a>
+<FONT color="green">406</FONT>                    }<a name="line.406"></a>
+<FONT color="green">407</FONT>                    for (int i = 0; i &lt; col; i++) {<a name="line.407"></a>
+<FONT color="green">408</FONT>                        final T[] bpI = bp[i];<a name="line.408"></a>
+<FONT color="green">409</FONT>                        final T luICol = lu[i][col];<a name="line.409"></a>
+<FONT color="green">410</FONT>                        for (int j = 0; j &lt; nColB; j++) {<a name="line.410"></a>
+<FONT color="green">411</FONT>                            bpI[j] = bpI[j].subtract(bpCol[j].multiply(luICol));<a name="line.411"></a>
+<FONT color="green">412</FONT>                        }<a name="line.412"></a>
+<FONT color="green">413</FONT>                    }<a name="line.413"></a>
+<FONT color="green">414</FONT>                }<a name="line.414"></a>
+<FONT color="green">415</FONT>    <a name="line.415"></a>
+<FONT color="green">416</FONT>                return new Array2DRowFieldMatrix&lt;T&gt;(bp, false);<a name="line.416"></a>
+<FONT color="green">417</FONT>    <a name="line.417"></a>
+<FONT color="green">418</FONT>            }<a name="line.418"></a>
+<FONT color="green">419</FONT>    <a name="line.419"></a>
+<FONT color="green">420</FONT>            /** {@inheritDoc} */<a name="line.420"></a>
+<FONT color="green">421</FONT>            public FieldMatrix&lt;T&gt; getInverse() throws InvalidMatrixException {<a name="line.421"></a>
+<FONT color="green">422</FONT>                final int m = pivot.length;<a name="line.422"></a>
+<FONT color="green">423</FONT>                final T one = field.getOne();<a name="line.423"></a>
+<FONT color="green">424</FONT>                FieldMatrix&lt;T&gt; identity = new Array2DRowFieldMatrix&lt;T&gt;(field, m, m);<a name="line.424"></a>
+<FONT color="green">425</FONT>                for (int i = 0; i &lt; m; ++i) {<a name="line.425"></a>
+<FONT color="green">426</FONT>                    identity.setEntry(i, i, one);<a name="line.426"></a>
+<FONT color="green">427</FONT>                }<a name="line.427"></a>
+<FONT color="green">428</FONT>                return solve(identity);<a name="line.428"></a>
+<FONT color="green">429</FONT>            }<a name="line.429"></a>
+<FONT color="green">430</FONT>    <a name="line.430"></a>
+<FONT color="green">431</FONT>        }<a name="line.431"></a>
+<FONT color="green">432</FONT>    <a name="line.432"></a>
+<FONT color="green">433</FONT>    }<a name="line.433"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/FieldMatrix.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,863 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.Field;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.FieldElement;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Interface defining field-valued matrix with basic algebraic operations.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Matrix element indexing is 0-based -- e.g., &lt;code&gt;getEntry(0, 0)&lt;/code&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * returns the element in the first row, first column of the matrix.&lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     *<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @param &lt;T&gt; the type of the field elements<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public interface FieldMatrix&lt;T extends FieldElement&lt;T&gt;&gt; extends AnyMatrix {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /**<a name="line.35"></a>
+<FONT color="green">036</FONT>         * Get the type of field elements of the matrix.<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @return type of field elements of the matrix<a name="line.37"></a>
+<FONT color="green">038</FONT>         */<a name="line.38"></a>
+<FONT color="green">039</FONT>        Field&lt;T&gt; getField();<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * Create a new FieldMatrix&lt;T&gt; of the same type as the instance with the supplied<a name="line.42"></a>
+<FONT color="green">043</FONT>         * row and column dimensions.<a name="line.43"></a>
+<FONT color="green">044</FONT>         *<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @param rowDimension  the number of rows in the new matrix<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param columnDimension  the number of columns in the new matrix<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @return a new matrix of the same type as the instance<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @throws IllegalArgumentException if row or column dimension is not positive<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @since 2.0<a name="line.49"></a>
+<FONT color="green">050</FONT>         */<a name="line.50"></a>
+<FONT color="green">051</FONT>        FieldMatrix&lt;T&gt; createMatrix(final int rowDimension, final int columnDimension);<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Returns a (deep) copy of this.<a name="line.54"></a>
+<FONT color="green">055</FONT>         *<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @return matrix copy<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        FieldMatrix&lt;T&gt; copy();<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /**<a name="line.60"></a>
+<FONT color="green">061</FONT>         * Compute the sum of this and m.<a name="line.61"></a>
+<FONT color="green">062</FONT>         *<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @param m    matrix to be added<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @return     this + m<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        FieldMatrix&lt;T&gt; add(FieldMatrix&lt;T&gt; m) throws IllegalArgumentException;<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * Compute this minus m.<a name="line.70"></a>
+<FONT color="green">071</FONT>         *<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param m    matrix to be subtracted<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @return     this + m<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.74"></a>
+<FONT color="green">075</FONT>         */<a name="line.75"></a>
+<FONT color="green">076</FONT>        FieldMatrix&lt;T&gt; subtract(FieldMatrix&lt;T&gt; m) throws IllegalArgumentException;<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>         /**<a name="line.78"></a>
+<FONT color="green">079</FONT>         * Returns the result of adding d to each entry of this.<a name="line.79"></a>
+<FONT color="green">080</FONT>         *<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @param d    value to be added to each entry<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @return     d + this<a name="line.82"></a>
+<FONT color="green">083</FONT>         */<a name="line.83"></a>
+<FONT color="green">084</FONT>        FieldMatrix&lt;T&gt; scalarAdd(T d);<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /**<a name="line.86"></a>
+<FONT color="green">087</FONT>         * Returns the result multiplying each entry of this by d.<a name="line.87"></a>
+<FONT color="green">088</FONT>         *<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @param d    value to multiply all entries by<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @return     d * this<a name="line.90"></a>
+<FONT color="green">091</FONT>         */<a name="line.91"></a>
+<FONT color="green">092</FONT>        FieldMatrix&lt;T&gt; scalarMultiply(T d);<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>        /**<a name="line.94"></a>
+<FONT color="green">095</FONT>         * Returns the result of postmultiplying this by m.<a name="line.95"></a>
+<FONT color="green">096</FONT>         *<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @param m    matrix to postmultiply by<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @return     this * m<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @throws     IllegalArgumentException<a name="line.99"></a>
+<FONT color="green">100</FONT>         *             if columnDimension(this) != rowDimension(m)<a name="line.100"></a>
+<FONT color="green">101</FONT>         */<a name="line.101"></a>
+<FONT color="green">102</FONT>        FieldMatrix&lt;T&gt; multiply(FieldMatrix&lt;T&gt; m) throws IllegalArgumentException;<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /**<a name="line.104"></a>
+<FONT color="green">105</FONT>         * Returns the result premultiplying this by &lt;code&gt;m&lt;/code&gt;.<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @param m    matrix to premultiply by<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @return     m * this<a name="line.107"></a>
+<FONT color="green">108</FONT>         * @throws     IllegalArgumentException<a name="line.108"></a>
+<FONT color="green">109</FONT>         *             if rowDimension(this) != columnDimension(m)<a name="line.109"></a>
+<FONT color="green">110</FONT>         */<a name="line.110"></a>
+<FONT color="green">111</FONT>        FieldMatrix&lt;T&gt; preMultiply(FieldMatrix&lt;T&gt; m) throws IllegalArgumentException;<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>        /**<a name="line.113"></a>
+<FONT color="green">114</FONT>         * Returns matrix entries as a two-dimensional array.<a name="line.114"></a>
+<FONT color="green">115</FONT>         *<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @return    2-dimensional array of entries<a name="line.116"></a>
+<FONT color="green">117</FONT>         */<a name="line.117"></a>
+<FONT color="green">118</FONT>        T[][] getData();<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /**<a name="line.120"></a>
+<FONT color="green">121</FONT>         * Gets a submatrix. Rows and columns are indicated<a name="line.121"></a>
+<FONT color="green">122</FONT>         * counting from 0 to n-1.<a name="line.122"></a>
+<FONT color="green">123</FONT>         *<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @param startRow Initial row index<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @param endRow Final row index (inclusive)<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @param startColumn Initial column index<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @param endColumn Final column index (inclusive)<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @return The subMatrix containing the data of the<a name="line.128"></a>
+<FONT color="green">129</FONT>         *         specified rows and columns<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @exception MatrixIndexException  if the indices are not valid<a name="line.130"></a>
+<FONT color="green">131</FONT>         */<a name="line.131"></a>
+<FONT color="green">132</FONT>       FieldMatrix&lt;T&gt; getSubMatrix(int startRow, int endRow, int startColumn, int endColumn)<a name="line.132"></a>
+<FONT color="green">133</FONT>           throws MatrixIndexException;<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>       /**<a name="line.135"></a>
+<FONT color="green">136</FONT>        * Gets a submatrix. Rows and columns are indicated<a name="line.136"></a>
+<FONT color="green">137</FONT>        * counting from 0 to n-1.<a name="line.137"></a>
+<FONT color="green">138</FONT>        *<a name="line.138"></a>
+<FONT color="green">139</FONT>        * @param selectedRows Array of row indices.<a name="line.139"></a>
+<FONT color="green">140</FONT>        * @param selectedColumns Array of column indices.<a name="line.140"></a>
+<FONT color="green">141</FONT>        * @return The subMatrix containing the data in the<a name="line.141"></a>
+<FONT color="green">142</FONT>        *         specified rows and columns<a name="line.142"></a>
+<FONT color="green">143</FONT>        * @exception MatrixIndexException if row or column selections are not valid<a name="line.143"></a>
+<FONT color="green">144</FONT>        */<a name="line.144"></a>
+<FONT color="green">145</FONT>       FieldMatrix&lt;T&gt; getSubMatrix(int[] selectedRows, int[] selectedColumns)<a name="line.145"></a>
+<FONT color="green">146</FONT>           throws MatrixIndexException;<a name="line.146"></a>
+<FONT color="green">147</FONT>    <a name="line.147"></a>
+<FONT color="green">148</FONT>       /**<a name="line.148"></a>
+<FONT color="green">149</FONT>        * Copy a submatrix. Rows and columns are indicated<a name="line.149"></a>
+<FONT color="green">150</FONT>        * counting from 0 to n-1.<a name="line.150"></a>
+<FONT color="green">151</FONT>        *<a name="line.151"></a>
+<FONT color="green">152</FONT>        * @param startRow Initial row index<a name="line.152"></a>
+<FONT color="green">153</FONT>        * @param endRow Final row index (inclusive)<a name="line.153"></a>
+<FONT color="green">154</FONT>        * @param startColumn Initial column index<a name="line.154"></a>
+<FONT color="green">155</FONT>        * @param endColumn Final column index (inclusive)<a name="line.155"></a>
+<FONT color="green">156</FONT>        * @param destination The arrays where the submatrix data should be copied<a name="line.156"></a>
+<FONT color="green">157</FONT>        * (if larger than rows/columns counts, only the upper-left part will be used)<a name="line.157"></a>
+<FONT color="green">158</FONT>        * @exception MatrixIndexException if the indices are not valid<a name="line.158"></a>
+<FONT color="green">159</FONT>        * @exception IllegalArgumentException if the destination array is too small<a name="line.159"></a>
+<FONT color="green">160</FONT>        */<a name="line.160"></a>
+<FONT color="green">161</FONT>      void copySubMatrix(int startRow, int endRow, int startColumn, int endColumn,<a name="line.161"></a>
+<FONT color="green">162</FONT>                         T[][] destination)<a name="line.162"></a>
+<FONT color="green">163</FONT>          throws MatrixIndexException, IllegalArgumentException;<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>      /**<a name="line.165"></a>
+<FONT color="green">166</FONT>       * Copy a submatrix. Rows and columns are indicated<a name="line.166"></a>
+<FONT color="green">167</FONT>       * counting from 0 to n-1.<a name="line.167"></a>
+<FONT color="green">168</FONT>       *<a name="line.168"></a>
+<FONT color="green">169</FONT>        * @param selectedRows Array of row indices.<a name="line.169"></a>
+<FONT color="green">170</FONT>        * @param selectedColumns Array of column indices.<a name="line.170"></a>
+<FONT color="green">171</FONT>       * @param destination The arrays where the submatrix data should be copied<a name="line.171"></a>
+<FONT color="green">172</FONT>       * (if larger than rows/columns counts, only the upper-left part will be used)<a name="line.172"></a>
+<FONT color="green">173</FONT>       * @exception MatrixIndexException if the indices are not valid<a name="line.173"></a>
+<FONT color="green">174</FONT>       * @exception IllegalArgumentException if the destination array is too small<a name="line.174"></a>
+<FONT color="green">175</FONT>       */<a name="line.175"></a>
+<FONT color="green">176</FONT>      void copySubMatrix(int[] selectedRows, int[] selectedColumns, T[][] destination)<a name="line.176"></a>
+<FONT color="green">177</FONT>          throws MatrixIndexException, IllegalArgumentException;<a name="line.177"></a>
+<FONT color="green">178</FONT>    <a name="line.178"></a>
+<FONT color="green">179</FONT>       /**<a name="line.179"></a>
+<FONT color="green">180</FONT>        * Replace the submatrix starting at &lt;code&gt;row, column&lt;/code&gt; using data in<a name="line.180"></a>
+<FONT color="green">181</FONT>        * the input &lt;code&gt;subMatrix&lt;/code&gt; array. Indexes are 0-based.<a name="line.181"></a>
+<FONT color="green">182</FONT>        * &lt;p&gt;<a name="line.182"></a>
+<FONT color="green">183</FONT>        * Example:&lt;br&gt;<a name="line.183"></a>
+<FONT color="green">184</FONT>        * Starting with &lt;pre&gt;<a name="line.184"></a>
+<FONT color="green">185</FONT>        * 1  2  3  4<a name="line.185"></a>
+<FONT color="green">186</FONT>        * 5  6  7  8<a name="line.186"></a>
+<FONT color="green">187</FONT>        * 9  0  1  2<a name="line.187"></a>
+<FONT color="green">188</FONT>        * &lt;/pre&gt;<a name="line.188"></a>
+<FONT color="green">189</FONT>        * and &lt;code&gt;subMatrix = {{3, 4} {5,6}}&lt;/code&gt;, invoking<a name="line.189"></a>
+<FONT color="green">190</FONT>        * &lt;code&gt;setSubMatrix(subMatrix,1,1))&lt;/code&gt; will result in &lt;pre&gt;<a name="line.190"></a>
+<FONT color="green">191</FONT>        * 1  2  3  4<a name="line.191"></a>
+<FONT color="green">192</FONT>        * 5  3  4  8<a name="line.192"></a>
+<FONT color="green">193</FONT>        * 9  5  6  2<a name="line.193"></a>
+<FONT color="green">194</FONT>        * &lt;/pre&gt;&lt;/p&gt;<a name="line.194"></a>
+<FONT color="green">195</FONT>        *<a name="line.195"></a>
+<FONT color="green">196</FONT>        * @param subMatrix  array containing the submatrix replacement data<a name="line.196"></a>
+<FONT color="green">197</FONT>        * @param row  row coordinate of the top, left element to be replaced<a name="line.197"></a>
+<FONT color="green">198</FONT>        * @param column  column coordinate of the top, left element to be replaced<a name="line.198"></a>
+<FONT color="green">199</FONT>        * @throws MatrixIndexException  if subMatrix does not fit into this<a name="line.199"></a>
+<FONT color="green">200</FONT>        *    matrix from element in (row, column)<a name="line.200"></a>
+<FONT color="green">201</FONT>        * @throws IllegalArgumentException if &lt;code&gt;subMatrix&lt;/code&gt; is not rectangular<a name="line.201"></a>
+<FONT color="green">202</FONT>        *  (not all rows have the same length) or empty<a name="line.202"></a>
+<FONT color="green">203</FONT>        * @throws NullPointerException if &lt;code&gt;subMatrix&lt;/code&gt; is null<a name="line.203"></a>
+<FONT color="green">204</FONT>        * @since 2.0<a name="line.204"></a>
+<FONT color="green">205</FONT>        */<a name="line.205"></a>
+<FONT color="green">206</FONT>       void setSubMatrix(T[][] subMatrix, int row, int column)<a name="line.206"></a>
+<FONT color="green">207</FONT>           throws MatrixIndexException;<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>       /**<a name="line.209"></a>
+<FONT color="green">210</FONT>        * Returns the entries in row number &lt;code&gt;row&lt;/code&gt;<a name="line.210"></a>
+<FONT color="green">211</FONT>        * as a row matrix.  Row indices start at 0.<a name="line.211"></a>
+<FONT color="green">212</FONT>        *<a name="line.212"></a>
+<FONT color="green">213</FONT>        * @param row the row to be fetched<a name="line.213"></a>
+<FONT color="green">214</FONT>        * @return row matrix<a name="line.214"></a>
+<FONT color="green">215</FONT>        * @throws MatrixIndexException if the specified row index is invalid<a name="line.215"></a>
+<FONT color="green">216</FONT>        */<a name="line.216"></a>
+<FONT color="green">217</FONT>       FieldMatrix&lt;T&gt; getRowMatrix(int row) throws MatrixIndexException;<a name="line.217"></a>
+<FONT color="green">218</FONT>    <a name="line.218"></a>
+<FONT color="green">219</FONT>       /**<a name="line.219"></a>
+<FONT color="green">220</FONT>        * Sets the entries in row number &lt;code&gt;row&lt;/code&gt;<a name="line.220"></a>
+<FONT color="green">221</FONT>        * as a row matrix.  Row indices start at 0.<a name="line.221"></a>
+<FONT color="green">222</FONT>        *<a name="line.222"></a>
+<FONT color="green">223</FONT>        * @param row the row to be set<a name="line.223"></a>
+<FONT color="green">224</FONT>        * @param matrix row matrix (must have one row and the same number of columns<a name="line.224"></a>
+<FONT color="green">225</FONT>        * as the instance)<a name="line.225"></a>
+<FONT color="green">226</FONT>        * @throws MatrixIndexException if the specified row index is invalid<a name="line.226"></a>
+<FONT color="green">227</FONT>        * @throws InvalidMatrixException if the matrix dimensions do not match one<a name="line.227"></a>
+<FONT color="green">228</FONT>        * instance row<a name="line.228"></a>
+<FONT color="green">229</FONT>        */<a name="line.229"></a>
+<FONT color="green">230</FONT>       void setRowMatrix(int row, FieldMatrix&lt;T&gt; matrix)<a name="line.230"></a>
+<FONT color="green">231</FONT>           throws MatrixIndexException, InvalidMatrixException;<a name="line.231"></a>
+<FONT color="green">232</FONT>    <a name="line.232"></a>
+<FONT color="green">233</FONT>       /**<a name="line.233"></a>
+<FONT color="green">234</FONT>        * Returns the entries in column number &lt;code&gt;column&lt;/code&gt;<a name="line.234"></a>
+<FONT color="green">235</FONT>        * as a column matrix.  Column indices start at 0.<a name="line.235"></a>
+<FONT color="green">236</FONT>        *<a name="line.236"></a>
+<FONT color="green">237</FONT>        * @param column the column to be fetched<a name="line.237"></a>
+<FONT color="green">238</FONT>        * @return column matrix<a name="line.238"></a>
+<FONT color="green">239</FONT>        * @throws MatrixIndexException if the specified column index is invalid<a name="line.239"></a>
+<FONT color="green">240</FONT>        */<a name="line.240"></a>
+<FONT color="green">241</FONT>       FieldMatrix&lt;T&gt; getColumnMatrix(int column) throws MatrixIndexException;<a name="line.241"></a>
+<FONT color="green">242</FONT>    <a name="line.242"></a>
+<FONT color="green">243</FONT>       /**<a name="line.243"></a>
+<FONT color="green">244</FONT>        * Sets the entries in column number &lt;code&gt;column&lt;/code&gt;<a name="line.244"></a>
+<FONT color="green">245</FONT>        * as a column matrix.  Column indices start at 0.<a name="line.245"></a>
+<FONT color="green">246</FONT>        *<a name="line.246"></a>
+<FONT color="green">247</FONT>        * @param column the column to be set<a name="line.247"></a>
+<FONT color="green">248</FONT>        * @param matrix column matrix (must have one column and the same number of rows<a name="line.248"></a>
+<FONT color="green">249</FONT>        * as the instance)<a name="line.249"></a>
+<FONT color="green">250</FONT>        * @throws MatrixIndexException if the specified column index is invalid<a name="line.250"></a>
+<FONT color="green">251</FONT>        * @throws InvalidMatrixException if the matrix dimensions do not match one<a name="line.251"></a>
+<FONT color="green">252</FONT>        * instance column<a name="line.252"></a>
+<FONT color="green">253</FONT>        */<a name="line.253"></a>
+<FONT color="green">254</FONT>       void setColumnMatrix(int column, FieldMatrix&lt;T&gt; matrix)<a name="line.254"></a>
+<FONT color="green">255</FONT>           throws MatrixIndexException, InvalidMatrixException;<a name="line.255"></a>
+<FONT color="green">256</FONT>    <a name="line.256"></a>
+<FONT color="green">257</FONT>       /**<a name="line.257"></a>
+<FONT color="green">258</FONT>        * Returns the entries in row number &lt;code&gt;row&lt;/code&gt;<a name="line.258"></a>
+<FONT color="green">259</FONT>        * as a vector.  Row indices start at 0.<a name="line.259"></a>
+<FONT color="green">260</FONT>        *<a name="line.260"></a>
+<FONT color="green">261</FONT>        * @param row the row to be fetched<a name="line.261"></a>
+<FONT color="green">262</FONT>        * @return row vector<a name="line.262"></a>
+<FONT color="green">263</FONT>        * @throws MatrixIndexException if the specified row index is invalid<a name="line.263"></a>
+<FONT color="green">264</FONT>        */<a name="line.264"></a>
+<FONT color="green">265</FONT>       FieldVector&lt;T&gt; getRowVector(int row) throws MatrixIndexException;<a name="line.265"></a>
+<FONT color="green">266</FONT>    <a name="line.266"></a>
+<FONT color="green">267</FONT>       /**<a name="line.267"></a>
+<FONT color="green">268</FONT>        * Sets the entries in row number &lt;code&gt;row&lt;/code&gt;<a name="line.268"></a>
+<FONT color="green">269</FONT>        * as a vector.  Row indices start at 0.<a name="line.269"></a>
+<FONT color="green">270</FONT>        *<a name="line.270"></a>
+<FONT color="green">271</FONT>        * @param row the row to be set<a name="line.271"></a>
+<FONT color="green">272</FONT>        * @param vector row vector (must have the same number of columns<a name="line.272"></a>
+<FONT color="green">273</FONT>        * as the instance)<a name="line.273"></a>
+<FONT color="green">274</FONT>        * @throws MatrixIndexException if the specified row index is invalid<a name="line.274"></a>
+<FONT color="green">275</FONT>        * @throws InvalidMatrixException if the vector dimension does not match one<a name="line.275"></a>
+<FONT color="green">276</FONT>        * instance row<a name="line.276"></a>
+<FONT color="green">277</FONT>        */<a name="line.277"></a>
+<FONT color="green">278</FONT>       void setRowVector(int row, FieldVector&lt;T&gt; vector)<a name="line.278"></a>
+<FONT color="green">279</FONT>           throws MatrixIndexException, InvalidMatrixException;<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>       /**<a name="line.281"></a>
+<FONT color="green">282</FONT>        * Returns the entries in column number &lt;code&gt;column&lt;/code&gt;<a name="line.282"></a>
+<FONT color="green">283</FONT>        * as a vector.  Column indices start at 0.<a name="line.283"></a>
+<FONT color="green">284</FONT>        *<a name="line.284"></a>
+<FONT color="green">285</FONT>        * @param column the column to be fetched<a name="line.285"></a>
+<FONT color="green">286</FONT>        * @return column vector<a name="line.286"></a>
+<FONT color="green">287</FONT>        * @throws MatrixIndexException if the specified column index is invalid<a name="line.287"></a>
+<FONT color="green">288</FONT>        */<a name="line.288"></a>
+<FONT color="green">289</FONT>       FieldVector&lt;T&gt; getColumnVector(int column) throws MatrixIndexException;<a name="line.289"></a>
+<FONT color="green">290</FONT>    <a name="line.290"></a>
+<FONT color="green">291</FONT>       /**<a name="line.291"></a>
+<FONT color="green">292</FONT>        * Sets the entries in column number &lt;code&gt;column&lt;/code&gt;<a name="line.292"></a>
+<FONT color="green">293</FONT>        * as a vector.  Column indices start at 0.<a name="line.293"></a>
+<FONT color="green">294</FONT>        *<a name="line.294"></a>
+<FONT color="green">295</FONT>        * @param column the column to be set<a name="line.295"></a>
+<FONT color="green">296</FONT>        * @param vector column vector (must have the same number of rows as the instance)<a name="line.296"></a>
+<FONT color="green">297</FONT>        * @throws MatrixIndexException if the specified column index is invalid<a name="line.297"></a>
+<FONT color="green">298</FONT>        * @throws InvalidMatrixException if the vector dimension does not match one<a name="line.298"></a>
+<FONT color="green">299</FONT>        * instance column<a name="line.299"></a>
+<FONT color="green">300</FONT>        */<a name="line.300"></a>
+<FONT color="green">301</FONT>       void setColumnVector(int column, FieldVector&lt;T&gt; vector)<a name="line.301"></a>
+<FONT color="green">302</FONT>           throws MatrixIndexException, InvalidMatrixException;<a name="line.302"></a>
+<FONT color="green">303</FONT>    <a name="line.303"></a>
+<FONT color="green">304</FONT>        /**<a name="line.304"></a>
+<FONT color="green">305</FONT>         * Returns the entries in row number &lt;code&gt;row&lt;/code&gt; as an array.<a name="line.305"></a>
+<FONT color="green">306</FONT>         * &lt;p&gt;<a name="line.306"></a>
+<FONT color="green">307</FONT>         * Row indices start at 0.  A &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown<a name="line.307"></a>
+<FONT color="green">308</FONT>         * unless &lt;code&gt;0 &lt;= row &lt; rowDimension.&lt;/code&gt;&lt;/p&gt;<a name="line.308"></a>
+<FONT color="green">309</FONT>         *<a name="line.309"></a>
+<FONT color="green">310</FONT>         * @param row the row to be fetched<a name="line.310"></a>
+<FONT color="green">311</FONT>         * @return array of entries in the row<a name="line.311"></a>
+<FONT color="green">312</FONT>         * @throws MatrixIndexException if the specified row index is not valid<a name="line.312"></a>
+<FONT color="green">313</FONT>         */<a name="line.313"></a>
+<FONT color="green">314</FONT>        T[] getRow(int row) throws MatrixIndexException;<a name="line.314"></a>
+<FONT color="green">315</FONT>    <a name="line.315"></a>
+<FONT color="green">316</FONT>        /**<a name="line.316"></a>
+<FONT color="green">317</FONT>         * Sets the entries in row number &lt;code&gt;row&lt;/code&gt;<a name="line.317"></a>
+<FONT color="green">318</FONT>         * as a row matrix.  Row indices start at 0.<a name="line.318"></a>
+<FONT color="green">319</FONT>         *<a name="line.319"></a>
+<FONT color="green">320</FONT>         * @param row the row to be set<a name="line.320"></a>
+<FONT color="green">321</FONT>         * @param array row matrix (must have the same number of columns as the instance)<a name="line.321"></a>
+<FONT color="green">322</FONT>         * @throws MatrixIndexException if the specified row index is invalid<a name="line.322"></a>
+<FONT color="green">323</FONT>         * @throws InvalidMatrixException if the array size does not match one<a name="line.323"></a>
+<FONT color="green">324</FONT>         * instance row<a name="line.324"></a>
+<FONT color="green">325</FONT>         */<a name="line.325"></a>
+<FONT color="green">326</FONT>        void setRow(int row, T[] array)<a name="line.326"></a>
+<FONT color="green">327</FONT>            throws MatrixIndexException, InvalidMatrixException;<a name="line.327"></a>
+<FONT color="green">328</FONT>    <a name="line.328"></a>
+<FONT color="green">329</FONT>        /**<a name="line.329"></a>
+<FONT color="green">330</FONT>         * Returns the entries in column number &lt;code&gt;col&lt;/code&gt; as an array.<a name="line.330"></a>
+<FONT color="green">331</FONT>         * &lt;p&gt;<a name="line.331"></a>
+<FONT color="green">332</FONT>         * Column indices start at 0.  A &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown<a name="line.332"></a>
+<FONT color="green">333</FONT>         * unless &lt;code&gt;0 &lt;= column &lt; columnDimension.&lt;/code&gt;&lt;/p&gt;<a name="line.333"></a>
+<FONT color="green">334</FONT>         *<a name="line.334"></a>
+<FONT color="green">335</FONT>         * @param column the column to be fetched<a name="line.335"></a>
+<FONT color="green">336</FONT>         * @return array of entries in the column<a name="line.336"></a>
+<FONT color="green">337</FONT>         * @throws MatrixIndexException if the specified column index is not valid<a name="line.337"></a>
+<FONT color="green">338</FONT>         */<a name="line.338"></a>
+<FONT color="green">339</FONT>        T[] getColumn(int column) throws MatrixIndexException;<a name="line.339"></a>
+<FONT color="green">340</FONT>    <a name="line.340"></a>
+<FONT color="green">341</FONT>        /**<a name="line.341"></a>
+<FONT color="green">342</FONT>         * Sets the entries in column number &lt;code&gt;column&lt;/code&gt;<a name="line.342"></a>
+<FONT color="green">343</FONT>         * as a column matrix.  Column indices start at 0.<a name="line.343"></a>
+<FONT color="green">344</FONT>         *<a name="line.344"></a>
+<FONT color="green">345</FONT>         * @param column the column to be set<a name="line.345"></a>
+<FONT color="green">346</FONT>         * @param array column array (must have the same number of rows as the instance)<a name="line.346"></a>
+<FONT color="green">347</FONT>         * @throws MatrixIndexException if the specified column index is invalid<a name="line.347"></a>
+<FONT color="green">348</FONT>         * @throws InvalidMatrixException if the array size does not match one<a name="line.348"></a>
+<FONT color="green">349</FONT>         * instance column<a name="line.349"></a>
+<FONT color="green">350</FONT>         */<a name="line.350"></a>
+<FONT color="green">351</FONT>        void setColumn(int column, T[] array)<a name="line.351"></a>
+<FONT color="green">352</FONT>            throws MatrixIndexException, InvalidMatrixException;<a name="line.352"></a>
+<FONT color="green">353</FONT>    <a name="line.353"></a>
+<FONT color="green">354</FONT>        /**<a name="line.354"></a>
+<FONT color="green">355</FONT>         * Returns the entry in the specified row and column.<a name="line.355"></a>
+<FONT color="green">356</FONT>         * &lt;p&gt;<a name="line.356"></a>
+<FONT color="green">357</FONT>         * Row and column indices start at 0 and must satisfy<a name="line.357"></a>
+<FONT color="green">358</FONT>         * &lt;ul&gt;<a name="line.358"></a>
+<FONT color="green">359</FONT>         * &lt;li&gt;&lt;code&gt;0 &lt;= row &lt; rowDimension&lt;/code&gt;&lt;/li&gt;<a name="line.359"></a>
+<FONT color="green">360</FONT>         * &lt;li&gt;&lt;code&gt; 0 &lt;= column &lt; columnDimension&lt;/code&gt;&lt;/li&gt;<a name="line.360"></a>
+<FONT color="green">361</FONT>         * &lt;/ul&gt;<a name="line.361"></a>
+<FONT color="green">362</FONT>         * otherwise a &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.362"></a>
+<FONT color="green">363</FONT>         *<a name="line.363"></a>
+<FONT color="green">364</FONT>         * @param row  row location of entry to be fetched<a name="line.364"></a>
+<FONT color="green">365</FONT>         * @param column  column location of entry to be fetched<a name="line.365"></a>
+<FONT color="green">366</FONT>         * @return matrix entry in row,column<a name="line.366"></a>
+<FONT color="green">367</FONT>         * @throws MatrixIndexException if the row or column index is not valid<a name="line.367"></a>
+<FONT color="green">368</FONT>         */<a name="line.368"></a>
+<FONT color="green">369</FONT>        T getEntry(int row, int column) throws MatrixIndexException;<a name="line.369"></a>
+<FONT color="green">370</FONT>    <a name="line.370"></a>
+<FONT color="green">371</FONT>        /**<a name="line.371"></a>
+<FONT color="green">372</FONT>         * Set the entry in the specified row and column.<a name="line.372"></a>
+<FONT color="green">373</FONT>         * &lt;p&gt;<a name="line.373"></a>
+<FONT color="green">374</FONT>         * Row and column indices start at 0 and must satisfy<a name="line.374"></a>
+<FONT color="green">375</FONT>         * &lt;ul&gt;<a name="line.375"></a>
+<FONT color="green">376</FONT>         * &lt;li&gt;&lt;code&gt;0 &lt;= row &lt; rowDimension&lt;/code&gt;&lt;/li&gt;<a name="line.376"></a>
+<FONT color="green">377</FONT>         * &lt;li&gt;&lt;code&gt; 0 &lt;= column &lt; columnDimension&lt;/code&gt;&lt;/li&gt;<a name="line.377"></a>
+<FONT color="green">378</FONT>         * &lt;/ul&gt;<a name="line.378"></a>
+<FONT color="green">379</FONT>         * otherwise a &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.379"></a>
+<FONT color="green">380</FONT>         *<a name="line.380"></a>
+<FONT color="green">381</FONT>         * @param row  row location of entry to be set<a name="line.381"></a>
+<FONT color="green">382</FONT>         * @param column  column location of entry to be set<a name="line.382"></a>
+<FONT color="green">383</FONT>         * @param value matrix entry to be set in row,column<a name="line.383"></a>
+<FONT color="green">384</FONT>         * @throws MatrixIndexException if the row or column index is not valid<a name="line.384"></a>
+<FONT color="green">385</FONT>         * @since 2.0<a name="line.385"></a>
+<FONT color="green">386</FONT>         */<a name="line.386"></a>
+<FONT color="green">387</FONT>        void setEntry(int row, int column, T value) throws MatrixIndexException;<a name="line.387"></a>
+<FONT color="green">388</FONT>    <a name="line.388"></a>
+<FONT color="green">389</FONT>        /**<a name="line.389"></a>
+<FONT color="green">390</FONT>         * Change an entry in the specified row and column.<a name="line.390"></a>
+<FONT color="green">391</FONT>         * &lt;p&gt;<a name="line.391"></a>
+<FONT color="green">392</FONT>         * Row and column indices start at 0 and must satisfy<a name="line.392"></a>
+<FONT color="green">393</FONT>         * &lt;ul&gt;<a name="line.393"></a>
+<FONT color="green">394</FONT>         * &lt;li&gt;&lt;code&gt;0 &lt;= row &lt; rowDimension&lt;/code&gt;&lt;/li&gt;<a name="line.394"></a>
+<FONT color="green">395</FONT>         * &lt;li&gt;&lt;code&gt; 0 &lt;= column &lt; columnDimension&lt;/code&gt;&lt;/li&gt;<a name="line.395"></a>
+<FONT color="green">396</FONT>         * &lt;/ul&gt;<a name="line.396"></a>
+<FONT color="green">397</FONT>         * otherwise a &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.397"></a>
+<FONT color="green">398</FONT>         *<a name="line.398"></a>
+<FONT color="green">399</FONT>         * @param row  row location of entry to be set<a name="line.399"></a>
+<FONT color="green">400</FONT>         * @param column  column location of entry to be set<a name="line.400"></a>
+<FONT color="green">401</FONT>         * @param increment value to add to the current matrix entry in row,column<a name="line.401"></a>
+<FONT color="green">402</FONT>         * @throws MatrixIndexException if the row or column index is not valid<a name="line.402"></a>
+<FONT color="green">403</FONT>         * @since 2.0<a name="line.403"></a>
+<FONT color="green">404</FONT>         */<a name="line.404"></a>
+<FONT color="green">405</FONT>        void addToEntry(int row, int column, T increment) throws MatrixIndexException;<a name="line.405"></a>
+<FONT color="green">406</FONT>    <a name="line.406"></a>
+<FONT color="green">407</FONT>        /**<a name="line.407"></a>
+<FONT color="green">408</FONT>         * Change an entry in the specified row and column.<a name="line.408"></a>
+<FONT color="green">409</FONT>         * &lt;p&gt;<a name="line.409"></a>
+<FONT color="green">410</FONT>         * Row and column indices start at 0 and must satisfy<a name="line.410"></a>
+<FONT color="green">411</FONT>         * &lt;ul&gt;<a name="line.411"></a>
+<FONT color="green">412</FONT>         * &lt;li&gt;&lt;code&gt;0 &lt;= row &lt; rowDimension&lt;/code&gt;&lt;/li&gt;<a name="line.412"></a>
+<FONT color="green">413</FONT>         * &lt;li&gt;&lt;code&gt; 0 &lt;= column &lt; columnDimension&lt;/code&gt;&lt;/li&gt;<a name="line.413"></a>
+<FONT color="green">414</FONT>         * &lt;/ul&gt;<a name="line.414"></a>
+<FONT color="green">415</FONT>         * otherwise a &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.415"></a>
+<FONT color="green">416</FONT>         *<a name="line.416"></a>
+<FONT color="green">417</FONT>         * @param row  row location of entry to be set<a name="line.417"></a>
+<FONT color="green">418</FONT>         * @param column  column location of entry to be set<a name="line.418"></a>
+<FONT color="green">419</FONT>         * @param factor multiplication factor for the current matrix entry in row,column<a name="line.419"></a>
+<FONT color="green">420</FONT>         * @throws MatrixIndexException if the row or column index is not valid<a name="line.420"></a>
+<FONT color="green">421</FONT>         * @since 2.0<a name="line.421"></a>
+<FONT color="green">422</FONT>         */<a name="line.422"></a>
+<FONT color="green">423</FONT>        void multiplyEntry(int row, int column, T factor) throws MatrixIndexException;<a name="line.423"></a>
+<FONT color="green">424</FONT>    <a name="line.424"></a>
+<FONT color="green">425</FONT>        /**<a name="line.425"></a>
+<FONT color="green">426</FONT>         * Returns the transpose of this matrix.<a name="line.426"></a>
+<FONT color="green">427</FONT>         *<a name="line.427"></a>
+<FONT color="green">428</FONT>         * @return transpose matrix<a name="line.428"></a>
+<FONT color="green">429</FONT>         */<a name="line.429"></a>
+<FONT color="green">430</FONT>        FieldMatrix&lt;T&gt; transpose();<a name="line.430"></a>
+<FONT color="green">431</FONT>    <a name="line.431"></a>
+<FONT color="green">432</FONT>        /**<a name="line.432"></a>
+<FONT color="green">433</FONT>         * Returns the &lt;a href="http://mathworld.wolfram.com/MatrixTrace.html"&gt;<a name="line.433"></a>
+<FONT color="green">434</FONT>         * trace&lt;/a&gt; of the matrix (the sum of the elements on the main diagonal).<a name="line.434"></a>
+<FONT color="green">435</FONT>         *<a name="line.435"></a>
+<FONT color="green">436</FONT>         * @return trace<a name="line.436"></a>
+<FONT color="green">437</FONT>         * @throws NonSquareMatrixException if the matrix is not square<a name="line.437"></a>
+<FONT color="green">438</FONT>         */<a name="line.438"></a>
+<FONT color="green">439</FONT>        T getTrace() throws NonSquareMatrixException;<a name="line.439"></a>
+<FONT color="green">440</FONT>    <a name="line.440"></a>
+<FONT color="green">441</FONT>        /**<a name="line.441"></a>
+<FONT color="green">442</FONT>         * Returns the result of multiplying this by the vector &lt;code&gt;v&lt;/code&gt;.<a name="line.442"></a>
+<FONT color="green">443</FONT>         *<a name="line.443"></a>
+<FONT color="green">444</FONT>         * @param v the vector to operate on<a name="line.444"></a>
+<FONT color="green">445</FONT>         * @return this*v<a name="line.445"></a>
+<FONT color="green">446</FONT>         * @throws IllegalArgumentException if columnDimension != v.size()<a name="line.446"></a>
+<FONT color="green">447</FONT>         */<a name="line.447"></a>
+<FONT color="green">448</FONT>        T[] operate(T[] v) throws IllegalArgumentException;<a name="line.448"></a>
+<FONT color="green">449</FONT>    <a name="line.449"></a>
+<FONT color="green">450</FONT>        /**<a name="line.450"></a>
+<FONT color="green">451</FONT>         * Returns the result of multiplying this by the vector &lt;code&gt;v&lt;/code&gt;.<a name="line.451"></a>
+<FONT color="green">452</FONT>         *<a name="line.452"></a>
+<FONT color="green">453</FONT>         * @param v the vector to operate on<a name="line.453"></a>
+<FONT color="green">454</FONT>         * @return this*v<a name="line.454"></a>
+<FONT color="green">455</FONT>         * @throws IllegalArgumentException if columnDimension != v.size()<a name="line.455"></a>
+<FONT color="green">456</FONT>         */<a name="line.456"></a>
+<FONT color="green">457</FONT>        FieldVector&lt;T&gt; operate(FieldVector&lt;T&gt; v) throws IllegalArgumentException;<a name="line.457"></a>
+<FONT color="green">458</FONT>    <a name="line.458"></a>
+<FONT color="green">459</FONT>        /**<a name="line.459"></a>
+<FONT color="green">460</FONT>         * Returns the (row) vector result of premultiplying this by the vector &lt;code&gt;v&lt;/code&gt;.<a name="line.460"></a>
+<FONT color="green">461</FONT>         *<a name="line.461"></a>
+<FONT color="green">462</FONT>         * @param v the row vector to premultiply by<a name="line.462"></a>
+<FONT color="green">463</FONT>         * @return v*this<a name="line.463"></a>
+<FONT color="green">464</FONT>         * @throws IllegalArgumentException if rowDimension != v.size()<a name="line.464"></a>
+<FONT color="green">465</FONT>         */<a name="line.465"></a>
+<FONT color="green">466</FONT>        T[] preMultiply(T[] v) throws IllegalArgumentException;<a name="line.466"></a>
+<FONT color="green">467</FONT>    <a name="line.467"></a>
+<FONT color="green">468</FONT>        /**<a name="line.468"></a>
+<FONT color="green">469</FONT>         * Returns the (row) vector result of premultiplying this by the vector &lt;code&gt;v&lt;/code&gt;.<a name="line.469"></a>
+<FONT color="green">470</FONT>         *<a name="line.470"></a>
+<FONT color="green">471</FONT>         * @param v the row vector to premultiply by<a name="line.471"></a>
+<FONT color="green">472</FONT>         * @return v*this<a name="line.472"></a>
+<FONT color="green">473</FONT>         * @throws IllegalArgumentException if rowDimension != v.size()<a name="line.473"></a>
+<FONT color="green">474</FONT>         */<a name="line.474"></a>
+<FONT color="green">475</FONT>        FieldVector&lt;T&gt; preMultiply(FieldVector&lt;T&gt; v) throws IllegalArgumentException;<a name="line.475"></a>
+<FONT color="green">476</FONT>    <a name="line.476"></a>
+<FONT color="green">477</FONT>        /**<a name="line.477"></a>
+<FONT color="green">478</FONT>         * Visit (and possibly change) all matrix entries in row order.<a name="line.478"></a>
+<FONT color="green">479</FONT>         * &lt;p&gt;Row order starts at upper left and iterating through all elements<a name="line.479"></a>
+<FONT color="green">480</FONT>         * of a row from left to right before going to the leftmost element<a name="line.480"></a>
+<FONT color="green">481</FONT>         * of the next row.&lt;/p&gt;<a name="line.481"></a>
+<FONT color="green">482</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.482"></a>
+<FONT color="green">483</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.483"></a>
+<FONT color="green">484</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor)<a name="line.484"></a>
+<FONT color="green">485</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.485"></a>
+<FONT color="green">486</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.486"></a>
+<FONT color="green">487</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor)<a name="line.487"></a>
+<FONT color="green">488</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)<a name="line.488"></a>
+<FONT color="green">489</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.489"></a>
+<FONT color="green">490</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.490"></a>
+<FONT color="green">491</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)<a name="line.491"></a>
+<FONT color="green">492</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)<a name="line.492"></a>
+<FONT color="green">493</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.493"></a>
+<FONT color="green">494</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.494"></a>
+<FONT color="green">495</FONT>         * @return the value returned by {@link FieldMatrixChangingVisitor#end()} at the end<a name="line.495"></a>
+<FONT color="green">496</FONT>         * of the walk<a name="line.496"></a>
+<FONT color="green">497</FONT>         */<a name="line.497"></a>
+<FONT color="green">498</FONT>        T walkInRowOrder(FieldMatrixChangingVisitor&lt;T&gt; visitor)<a name="line.498"></a>
+<FONT color="green">499</FONT>            throws MatrixVisitorException;<a name="line.499"></a>
+<FONT color="green">500</FONT>    <a name="line.500"></a>
+<FONT color="green">501</FONT>        /**<a name="line.501"></a>
+<FONT color="green">502</FONT>         * Visit (but don't change) all matrix entries in row order.<a name="line.502"></a>
+<FONT color="green">503</FONT>         * &lt;p&gt;Row order starts at upper left and iterating through all elements<a name="line.503"></a>
+<FONT color="green">504</FONT>         * of a row from left to right before going to the leftmost element<a name="line.504"></a>
+<FONT color="green">505</FONT>         * of the next row.&lt;/p&gt;<a name="line.505"></a>
+<FONT color="green">506</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.506"></a>
+<FONT color="green">507</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.507"></a>
+<FONT color="green">508</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor)<a name="line.508"></a>
+<FONT color="green">509</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.509"></a>
+<FONT color="green">510</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.510"></a>
+<FONT color="green">511</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor)<a name="line.511"></a>
+<FONT color="green">512</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)<a name="line.512"></a>
+<FONT color="green">513</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.513"></a>
+<FONT color="green">514</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.514"></a>
+<FONT color="green">515</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)<a name="line.515"></a>
+<FONT color="green">516</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)<a name="line.516"></a>
+<FONT color="green">517</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.517"></a>
+<FONT color="green">518</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.518"></a>
+<FONT color="green">519</FONT>         * @return the value returned by {@link FieldMatrixPreservingVisitor#end()} at the end<a name="line.519"></a>
+<FONT color="green">520</FONT>         * of the walk<a name="line.520"></a>
+<FONT color="green">521</FONT>         */<a name="line.521"></a>
+<FONT color="green">522</FONT>        T walkInRowOrder(FieldMatrixPreservingVisitor&lt;T&gt; visitor)<a name="line.522"></a>
+<FONT color="green">523</FONT>            throws MatrixVisitorException;<a name="line.523"></a>
+<FONT color="green">524</FONT>    <a name="line.524"></a>
+<FONT color="green">525</FONT>        /**<a name="line.525"></a>
+<FONT color="green">526</FONT>         * Visit (and possibly change) some matrix entries in row order.<a name="line.526"></a>
+<FONT color="green">527</FONT>         * &lt;p&gt;Row order starts at upper left and iterating through all elements<a name="line.527"></a>
+<FONT color="green">528</FONT>         * of a row from left to right before going to the leftmost element<a name="line.528"></a>
+<FONT color="green">529</FONT>         * of the next row.&lt;/p&gt;<a name="line.529"></a>
+<FONT color="green">530</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.530"></a>
+<FONT color="green">531</FONT>         * @param startRow Initial row index<a name="line.531"></a>
+<FONT color="green">532</FONT>         * @param endRow Final row index (inclusive)<a name="line.532"></a>
+<FONT color="green">533</FONT>         * @param startColumn Initial column index<a name="line.533"></a>
+<FONT color="green">534</FONT>         * @param endColumn Final column index<a name="line.534"></a>
+<FONT color="green">535</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.535"></a>
+<FONT color="green">536</FONT>         * @exception MatrixIndexException  if the indices are not valid<a name="line.536"></a>
+<FONT color="green">537</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor)<a name="line.537"></a>
+<FONT color="green">538</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor)<a name="line.538"></a>
+<FONT color="green">539</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.539"></a>
+<FONT color="green">540</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor)<a name="line.540"></a>
+<FONT color="green">541</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)<a name="line.541"></a>
+<FONT color="green">542</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.542"></a>
+<FONT color="green">543</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.543"></a>
+<FONT color="green">544</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)<a name="line.544"></a>
+<FONT color="green">545</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)<a name="line.545"></a>
+<FONT color="green">546</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.546"></a>
+<FONT color="green">547</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.547"></a>
+<FONT color="green">548</FONT>         * @return the value returned by {@link FieldMatrixChangingVisitor#end()} at the end<a name="line.548"></a>
+<FONT color="green">549</FONT>         * of the walk<a name="line.549"></a>
+<FONT color="green">550</FONT>         */<a name="line.550"></a>
+<FONT color="green">551</FONT>        T walkInRowOrder(FieldMatrixChangingVisitor&lt;T&gt; visitor,<a name="line.551"></a>
+<FONT color="green">552</FONT>                              int startRow, int endRow, int startColumn, int endColumn)<a name="line.552"></a>
+<FONT color="green">553</FONT>            throws MatrixIndexException, MatrixVisitorException;<a name="line.553"></a>
+<FONT color="green">554</FONT>    <a name="line.554"></a>
+<FONT color="green">555</FONT>        /**<a name="line.555"></a>
+<FONT color="green">556</FONT>         * Visit (but don't change) some matrix entries in row order.<a name="line.556"></a>
+<FONT color="green">557</FONT>         * &lt;p&gt;Row order starts at upper left and iterating through all elements<a name="line.557"></a>
+<FONT color="green">558</FONT>         * of a row from left to right before going to the leftmost element<a name="line.558"></a>
+<FONT color="green">559</FONT>         * of the next row.&lt;/p&gt;<a name="line.559"></a>
+<FONT color="green">560</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.560"></a>
+<FONT color="green">561</FONT>         * @param startRow Initial row index<a name="line.561"></a>
+<FONT color="green">562</FONT>         * @param endRow Final row index (inclusive)<a name="line.562"></a>
+<FONT color="green">563</FONT>         * @param startColumn Initial column index<a name="line.563"></a>
+<FONT color="green">564</FONT>         * @param endColumn Final column index<a name="line.564"></a>
+<FONT color="green">565</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.565"></a>
+<FONT color="green">566</FONT>         * @exception MatrixIndexException  if the indices are not valid<a name="line.566"></a>
+<FONT color="green">567</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor)<a name="line.567"></a>
+<FONT color="green">568</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor)<a name="line.568"></a>
+<FONT color="green">569</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.569"></a>
+<FONT color="green">570</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor)<a name="line.570"></a>
+<FONT color="green">571</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)<a name="line.571"></a>
+<FONT color="green">572</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.572"></a>
+<FONT color="green">573</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.573"></a>
+<FONT color="green">574</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)<a name="line.574"></a>
+<FONT color="green">575</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)<a name="line.575"></a>
+<FONT color="green">576</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.576"></a>
+<FONT color="green">577</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.577"></a>
+<FONT color="green">578</FONT>         * @return the value returned by {@link FieldMatrixPreservingVisitor#end()} at the end<a name="line.578"></a>
+<FONT color="green">579</FONT>         * of the walk<a name="line.579"></a>
+<FONT color="green">580</FONT>         */<a name="line.580"></a>
+<FONT color="green">581</FONT>        T walkInRowOrder(FieldMatrixPreservingVisitor&lt;T&gt; visitor,<a name="line.581"></a>
+<FONT color="green">582</FONT>                              int startRow, int endRow, int startColumn, int endColumn)<a name="line.582"></a>
+<FONT color="green">583</FONT>            throws MatrixIndexException, MatrixVisitorException;<a name="line.583"></a>
+<FONT color="green">584</FONT>    <a name="line.584"></a>
+<FONT color="green">585</FONT>        /**<a name="line.585"></a>
+<FONT color="green">586</FONT>         * Visit (and possibly change) all matrix entries in column order.<a name="line.586"></a>
+<FONT color="green">587</FONT>         * &lt;p&gt;Column order starts at upper left and iterating through all elements<a name="line.587"></a>
+<FONT color="green">588</FONT>         * of a column from top to bottom before going to the topmost element<a name="line.588"></a>
+<FONT color="green">589</FONT>         * of the next column.&lt;/p&gt;<a name="line.589"></a>
+<FONT color="green">590</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.590"></a>
+<FONT color="green">591</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.591"></a>
+<FONT color="green">592</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor)<a name="line.592"></a>
+<FONT color="green">593</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor)<a name="line.593"></a>
+<FONT color="green">594</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.594"></a>
+<FONT color="green">595</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.595"></a>
+<FONT color="green">596</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)<a name="line.596"></a>
+<FONT color="green">597</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.597"></a>
+<FONT color="green">598</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.598"></a>
+<FONT color="green">599</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)<a name="line.599"></a>
+<FONT color="green">600</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)<a name="line.600"></a>
+<FONT color="green">601</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.601"></a>
+<FONT color="green">602</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.602"></a>
+<FONT color="green">603</FONT>         * @return the value returned by {@link FieldMatrixChangingVisitor#end()} at the end<a name="line.603"></a>
+<FONT color="green">604</FONT>         * of the walk<a name="line.604"></a>
+<FONT color="green">605</FONT>         */<a name="line.605"></a>
+<FONT color="green">606</FONT>        T walkInColumnOrder(FieldMatrixChangingVisitor&lt;T&gt; visitor)<a name="line.606"></a>
+<FONT color="green">607</FONT>            throws MatrixVisitorException;<a name="line.607"></a>
+<FONT color="green">608</FONT>    <a name="line.608"></a>
+<FONT color="green">609</FONT>        /**<a name="line.609"></a>
+<FONT color="green">610</FONT>         * Visit (but don't change) all matrix entries in column order.<a name="line.610"></a>
+<FONT color="green">611</FONT>         * &lt;p&gt;Column order starts at upper left and iterating through all elements<a name="line.611"></a>
+<FONT color="green">612</FONT>         * of a column from top to bottom before going to the topmost element<a name="line.612"></a>
+<FONT color="green">613</FONT>         * of the next column.&lt;/p&gt;<a name="line.613"></a>
+<FONT color="green">614</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.614"></a>
+<FONT color="green">615</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.615"></a>
+<FONT color="green">616</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor)<a name="line.616"></a>
+<FONT color="green">617</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor)<a name="line.617"></a>
+<FONT color="green">618</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.618"></a>
+<FONT color="green">619</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.619"></a>
+<FONT color="green">620</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor)<a name="line.620"></a>
+<FONT color="green">621</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.621"></a>
+<FONT color="green">622</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.622"></a>
+<FONT color="green">623</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)<a name="line.623"></a>
+<FONT color="green">624</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)<a name="line.624"></a>
+<FONT color="green">625</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.625"></a>
+<FONT color="green">626</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.626"></a>
+<FONT color="green">627</FONT>         * @return the value returned by {@link FieldMatrixPreservingVisitor#end()} at the end<a name="line.627"></a>
+<FONT color="green">628</FONT>         * of the walk<a name="line.628"></a>
+<FONT color="green">629</FONT>         */<a name="line.629"></a>
+<FONT color="green">630</FONT>        T walkInColumnOrder(FieldMatrixPreservingVisitor&lt;T&gt; visitor)<a name="line.630"></a>
+<FONT color="green">631</FONT>            throws MatrixVisitorException;<a name="line.631"></a>
+<FONT color="green">632</FONT>    <a name="line.632"></a>
+<FONT color="green">633</FONT>        /**<a name="line.633"></a>
+<FONT color="green">634</FONT>         * Visit (and possibly change) some matrix entries in column order.<a name="line.634"></a>
+<FONT color="green">635</FONT>         * &lt;p&gt;Column order starts at upper left and iterating through all elements<a name="line.635"></a>
+<FONT color="green">636</FONT>         * of a column from top to bottom before going to the topmost element<a name="line.636"></a>
+<FONT color="green">637</FONT>         * of the next column.&lt;/p&gt;<a name="line.637"></a>
+<FONT color="green">638</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.638"></a>
+<FONT color="green">639</FONT>         * @param startRow Initial row index<a name="line.639"></a>
+<FONT color="green">640</FONT>         * @param endRow Final row index (inclusive)<a name="line.640"></a>
+<FONT color="green">641</FONT>         * @param startColumn Initial column index<a name="line.641"></a>
+<FONT color="green">642</FONT>         * @param endColumn Final column index<a name="line.642"></a>
+<FONT color="green">643</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.643"></a>
+<FONT color="green">644</FONT>         * @exception MatrixIndexException  if the indices are not valid<a name="line.644"></a>
+<FONT color="green">645</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor)<a name="line.645"></a>
+<FONT color="green">646</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor)<a name="line.646"></a>
+<FONT color="green">647</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.647"></a>
+<FONT color="green">648</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.648"></a>
+<FONT color="green">649</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor)<a name="line.649"></a>
+<FONT color="green">650</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)<a name="line.650"></a>
+<FONT color="green">651</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.651"></a>
+<FONT color="green">652</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)<a name="line.652"></a>
+<FONT color="green">653</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)<a name="line.653"></a>
+<FONT color="green">654</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.654"></a>
+<FONT color="green">655</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.655"></a>
+<FONT color="green">656</FONT>         * @return the value returned by {@link FieldMatrixChangingVisitor#end()} at the end<a name="line.656"></a>
+<FONT color="green">657</FONT>         * of the walk<a name="line.657"></a>
+<FONT color="green">658</FONT>         */<a name="line.658"></a>
+<FONT color="green">659</FONT>        T walkInColumnOrder(FieldMatrixChangingVisitor&lt;T&gt; visitor,<a name="line.659"></a>
+<FONT color="green">660</FONT>                                 int startRow, int endRow, int startColumn, int endColumn)<a name="line.660"></a>
+<FONT color="green">661</FONT>            throws MatrixIndexException, MatrixVisitorException;<a name="line.661"></a>
+<FONT color="green">662</FONT>    <a name="line.662"></a>
+<FONT color="green">663</FONT>        /**<a name="line.663"></a>
+<FONT color="green">664</FONT>         * Visit (but don't change) some matrix entries in column order.<a name="line.664"></a>
+<FONT color="green">665</FONT>         * &lt;p&gt;Column order starts at upper left and iterating through all elements<a name="line.665"></a>
+<FONT color="green">666</FONT>         * of a column from top to bottom before going to the topmost element<a name="line.666"></a>
+<FONT color="green">667</FONT>         * of the next column.&lt;/p&gt;<a name="line.667"></a>
+<FONT color="green">668</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.668"></a>
+<FONT color="green">669</FONT>         * @param startRow Initial row index<a name="line.669"></a>
+<FONT color="green">670</FONT>         * @param endRow Final row index (inclusive)<a name="line.670"></a>
+<FONT color="green">671</FONT>         * @param startColumn Initial column index<a name="line.671"></a>
+<FONT color="green">672</FONT>         * @param endColumn Final column index<a name="line.672"></a>
+<FONT color="green">673</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.673"></a>
+<FONT color="green">674</FONT>         * @exception MatrixIndexException  if the indices are not valid<a name="line.674"></a>
+<FONT color="green">675</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor)<a name="line.675"></a>
+<FONT color="green">676</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor)<a name="line.676"></a>
+<FONT color="green">677</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.677"></a>
+<FONT color="green">678</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.678"></a>
+<FONT color="green">679</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor)<a name="line.679"></a>
+<FONT color="green">680</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)<a name="line.680"></a>
+<FONT color="green">681</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.681"></a>
+<FONT color="green">682</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)<a name="line.682"></a>
+<FONT color="green">683</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)<a name="line.683"></a>
+<FONT color="green">684</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.684"></a>
+<FONT color="green">685</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.685"></a>
+<FONT color="green">686</FONT>         * @return the value returned by {@link FieldMatrixPreservingVisitor#end()} at the end<a name="line.686"></a>
+<FONT color="green">687</FONT>         * of the walk<a name="line.687"></a>
+<FONT color="green">688</FONT>         */<a name="line.688"></a>
+<FONT color="green">689</FONT>        T walkInColumnOrder(FieldMatrixPreservingVisitor&lt;T&gt; visitor,<a name="line.689"></a>
+<FONT color="green">690</FONT>                                 int startRow, int endRow, int startColumn, int endColumn)<a name="line.690"></a>
+<FONT color="green">691</FONT>            throws MatrixIndexException, MatrixVisitorException;<a name="line.691"></a>
+<FONT color="green">692</FONT>    <a name="line.692"></a>
+<FONT color="green">693</FONT>        /**<a name="line.693"></a>
+<FONT color="green">694</FONT>         * Visit (and possibly change) all matrix entries using the fastest possible order.<a name="line.694"></a>
+<FONT color="green">695</FONT>         * &lt;p&gt;The fastest walking order depends on the exact matrix class. It may be<a name="line.695"></a>
+<FONT color="green">696</FONT>         * different from traditional row or column orders.&lt;/p&gt;<a name="line.696"></a>
+<FONT color="green">697</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.697"></a>
+<FONT color="green">698</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.698"></a>
+<FONT color="green">699</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor)<a name="line.699"></a>
+<FONT color="green">700</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor)<a name="line.700"></a>
+<FONT color="green">701</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.701"></a>
+<FONT color="green">702</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.702"></a>
+<FONT color="green">703</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor)<a name="line.703"></a>
+<FONT color="green">704</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)<a name="line.704"></a>
+<FONT color="green">705</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.705"></a>
+<FONT color="green">706</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.706"></a>
+<FONT color="green">707</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)<a name="line.707"></a>
+<FONT color="green">708</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.708"></a>
+<FONT color="green">709</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.709"></a>
+<FONT color="green">710</FONT>         * @return the value returned by {@link FieldMatrixChangingVisitor#end()} at the end<a name="line.710"></a>
+<FONT color="green">711</FONT>         * of the walk<a name="line.711"></a>
+<FONT color="green">712</FONT>         */<a name="line.712"></a>
+<FONT color="green">713</FONT>        T walkInOptimizedOrder(FieldMatrixChangingVisitor&lt;T&gt; visitor)<a name="line.713"></a>
+<FONT color="green">714</FONT>            throws MatrixVisitorException;<a name="line.714"></a>
+<FONT color="green">715</FONT>    <a name="line.715"></a>
+<FONT color="green">716</FONT>        /**<a name="line.716"></a>
+<FONT color="green">717</FONT>         * Visit (but don't change) all matrix entries using the fastest possible order.<a name="line.717"></a>
+<FONT color="green">718</FONT>         * &lt;p&gt;The fastest walking order depends on the exact matrix class. It may be<a name="line.718"></a>
+<FONT color="green">719</FONT>         * different from traditional row or column orders.&lt;/p&gt;<a name="line.719"></a>
+<FONT color="green">720</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.720"></a>
+<FONT color="green">721</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.721"></a>
+<FONT color="green">722</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor)<a name="line.722"></a>
+<FONT color="green">723</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor)<a name="line.723"></a>
+<FONT color="green">724</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.724"></a>
+<FONT color="green">725</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.725"></a>
+<FONT color="green">726</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor)<a name="line.726"></a>
+<FONT color="green">727</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)<a name="line.727"></a>
+<FONT color="green">728</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.728"></a>
+<FONT color="green">729</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.729"></a>
+<FONT color="green">730</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)<a name="line.730"></a>
+<FONT color="green">731</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.731"></a>
+<FONT color="green">732</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.732"></a>
+<FONT color="green">733</FONT>         * @return the value returned by {@link FieldMatrixPreservingVisitor#end()} at the end<a name="line.733"></a>
+<FONT color="green">734</FONT>         * of the walk<a name="line.734"></a>
+<FONT color="green">735</FONT>         */<a name="line.735"></a>
+<FONT color="green">736</FONT>        T walkInOptimizedOrder(FieldMatrixPreservingVisitor&lt;T&gt; visitor)<a name="line.736"></a>
+<FONT color="green">737</FONT>            throws MatrixVisitorException;<a name="line.737"></a>
+<FONT color="green">738</FONT>    <a name="line.738"></a>
+<FONT color="green">739</FONT>        /**<a name="line.739"></a>
+<FONT color="green">740</FONT>         * Visit (and possibly change) some matrix entries using the fastest possible order.<a name="line.740"></a>
+<FONT color="green">741</FONT>         * &lt;p&gt;The fastest walking order depends on the exact matrix class. It may be<a name="line.741"></a>
+<FONT color="green">742</FONT>         * different from traditional row or column orders.&lt;/p&gt;<a name="line.742"></a>
+<FONT color="green">743</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.743"></a>
+<FONT color="green">744</FONT>         * @param startRow Initial row index<a name="line.744"></a>
+<FONT color="green">745</FONT>         * @param endRow Final row index (inclusive)<a name="line.745"></a>
+<FONT color="green">746</FONT>         * @param startColumn Initial column index<a name="line.746"></a>
+<FONT color="green">747</FONT>         * @param endColumn Final column index (inclusive)<a name="line.747"></a>
+<FONT color="green">748</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.748"></a>
+<FONT color="green">749</FONT>         * @exception MatrixIndexException  if the indices are not valid<a name="line.749"></a>
+<FONT color="green">750</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor)<a name="line.750"></a>
+<FONT color="green">751</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor)<a name="line.751"></a>
+<FONT color="green">752</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.752"></a>
+<FONT color="green">753</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.753"></a>
+<FONT color="green">754</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor)<a name="line.754"></a>
+<FONT color="green">755</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)<a name="line.755"></a>
+<FONT color="green">756</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.756"></a>
+<FONT color="green">757</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.757"></a>
+<FONT color="green">758</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)<a name="line.758"></a>
+<FONT color="green">759</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)<a name="line.759"></a>
+<FONT color="green">760</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.760"></a>
+<FONT color="green">761</FONT>         * @return the value returned by {@link FieldMatrixChangingVisitor#end()} at the end<a name="line.761"></a>
+<FONT color="green">762</FONT>         * of the walk<a name="line.762"></a>
+<FONT color="green">763</FONT>         */<a name="line.763"></a>
+<FONT color="green">764</FONT>        T walkInOptimizedOrder(FieldMatrixChangingVisitor&lt;T&gt; visitor,<a name="line.764"></a>
+<FONT color="green">765</FONT>                                    int startRow, int endRow, int startColumn, int endColumn)<a name="line.765"></a>
+<FONT color="green">766</FONT>            throws MatrixIndexException, MatrixVisitorException;<a name="line.766"></a>
+<FONT color="green">767</FONT>    <a name="line.767"></a>
+<FONT color="green">768</FONT>        /**<a name="line.768"></a>
+<FONT color="green">769</FONT>         * Visit (but don't change) some matrix entries using the fastest possible order.<a name="line.769"></a>
+<FONT color="green">770</FONT>         * &lt;p&gt;The fastest walking order depends on the exact matrix class. It may be<a name="line.770"></a>
+<FONT color="green">771</FONT>         * different from traditional row or column orders.&lt;/p&gt;<a name="line.771"></a>
+<FONT color="green">772</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.772"></a>
+<FONT color="green">773</FONT>         * @param startRow Initial row index<a name="line.773"></a>
+<FONT color="green">774</FONT>         * @param endRow Final row index (inclusive)<a name="line.774"></a>
+<FONT color="green">775</FONT>         * @param startColumn Initial column index<a name="line.775"></a>
+<FONT color="green">776</FONT>         * @param endColumn Final column index (inclusive)<a name="line.776"></a>
+<FONT color="green">777</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.777"></a>
+<FONT color="green">778</FONT>         * @exception MatrixIndexException  if the indices are not valid<a name="line.778"></a>
+<FONT color="green">779</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor)<a name="line.779"></a>
+<FONT color="green">780</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor)<a name="line.780"></a>
+<FONT color="green">781</FONT>         * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.781"></a>
+<FONT color="green">782</FONT>         * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.782"></a>
+<FONT color="green">783</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor)<a name="line.783"></a>
+<FONT color="green">784</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)<a name="line.784"></a>
+<FONT color="green">785</FONT>         * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.785"></a>
+<FONT color="green">786</FONT>         * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)<a name="line.786"></a>
+<FONT color="green">787</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)<a name="line.787"></a>
+<FONT color="green">788</FONT>         * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)<a name="line.788"></a>
+<FONT color="green">789</FONT>         * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)<a name="line.789"></a>
+<FONT color="green">790</FONT>         * @return the value returned by {@link FieldMatrixPreservingVisitor#end()} at the end<a name="line.790"></a>
+<FONT color="green">791</FONT>         * of the walk<a name="line.791"></a>
+<FONT color="green">792</FONT>         */<a name="line.792"></a>
+<FONT color="green">793</FONT>        T walkInOptimizedOrder(FieldMatrixPreservingVisitor&lt;T&gt; visitor,<a name="line.793"></a>
+<FONT color="green">794</FONT>                                    int startRow, int endRow, int startColumn, int endColumn)<a name="line.794"></a>
+<FONT color="green">795</FONT>            throws MatrixIndexException, MatrixVisitorException;<a name="line.795"></a>
+<FONT color="green">796</FONT>    <a name="line.796"></a>
+<FONT color="green">797</FONT>    }<a name="line.797"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/FieldMatrixChangingVisitor.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,128 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FieldElement;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Interface defining a visitor for matrix entries.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @param &lt;T&gt; the type of the field elements<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @since 2.0<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public interface FieldMatrixChangingVisitor&lt;T extends FieldElement&lt;?&gt;&gt; {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /**<a name="line.31"></a>
+<FONT color="green">032</FONT>         * Start visiting a matrix.<a name="line.32"></a>
+<FONT color="green">033</FONT>         * &lt;p&gt;This method is called once before any entry of the matrix is visited.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @param rows number of rows of the matrix<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @param columns number of columns of the matrix<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @param startRow Initial row index<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @param endRow Final row index (inclusive)<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @param startColumn Initial column index<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @param endColumn Final column index (inclusive)<a name="line.39"></a>
+<FONT color="green">040</FONT>         */<a name="line.40"></a>
+<FONT color="green">041</FONT>        void start(int rows, int columns,<a name="line.41"></a>
+<FONT color="green">042</FONT>                   int startRow, int endRow, int startColumn, int endColumn);<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /**<a name="line.44"></a>
+<FONT color="green">045</FONT>         * Visit one matrix entry.<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param row row index of the entry<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @param column column index of the entry<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @param value current value of the entry<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @return the new value to be set for the entry<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @throws MatrixVisitorException if something wrong occurs<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        T visit(int row, int column, T value)<a name="line.52"></a>
+<FONT color="green">053</FONT>            throws MatrixVisitorException;<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * End visiting a matrix.<a name="line.56"></a>
+<FONT color="green">057</FONT>         * &lt;p&gt;This method is called once after all entries of the matrix have been visited.&lt;/p&gt;<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @return the value that the &lt;code&gt;walkInXxxOrder&lt;/code&gt; must return<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        T end();<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>    }<a name="line.62"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/FieldMatrixPreservingVisitor.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,127 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FieldElement;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Interface defining a visitor for matrix entries.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @param &lt;T&gt; the type of the field elements<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @since 2.0<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public interface FieldMatrixPreservingVisitor&lt;T extends FieldElement&lt;?&gt;&gt; {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /**<a name="line.31"></a>
+<FONT color="green">032</FONT>         * Start visiting a matrix.<a name="line.32"></a>
+<FONT color="green">033</FONT>         * &lt;p&gt;This method is called once before any entry of the matrix is visited.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @param rows number of rows of the matrix<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @param columns number of columns of the matrix<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @param startRow Initial row index<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @param endRow Final row index (inclusive)<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @param startColumn Initial column index<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @param endColumn Final column index (inclusive)<a name="line.39"></a>
+<FONT color="green">040</FONT>         */<a name="line.40"></a>
+<FONT color="green">041</FONT>        void start(int rows, int columns,<a name="line.41"></a>
+<FONT color="green">042</FONT>                   int startRow, int endRow, int startColumn, int endColumn);<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /**<a name="line.44"></a>
+<FONT color="green">045</FONT>         * Visit one matrix entry.<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param row row index of the entry<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @param column column index of the entry<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @param value current value of the entry<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @throws MatrixVisitorException if something wrong occurs<a name="line.49"></a>
+<FONT color="green">050</FONT>         */<a name="line.50"></a>
+<FONT color="green">051</FONT>        void visit(int row, int column, T value)<a name="line.51"></a>
+<FONT color="green">052</FONT>            throws MatrixVisitorException;<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /**<a name="line.54"></a>
+<FONT color="green">055</FONT>         * End visiting a matrix.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * &lt;p&gt;This method is called once after all entries of the matrix have been visited.&lt;/p&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @return the value that the &lt;code&gt;walkInXxxOrder&lt;/code&gt; must return<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        T end();<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>    }<a name="line.61"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/FieldVector.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,424 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.linear;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.Field;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FieldElement;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Interface defining a field-valued vector with basic algebraic operations.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * vector element indexing is 0-based -- e.g., &lt;code&gt;getEntry(0)&lt;/code&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * returns the first element of the vector.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;/p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * The various &lt;code&gt;mapXxx&lt;/code&gt; and &lt;code&gt;mapXxxToSelf&lt;/code&gt; methods operate<a name="line.29"></a>
+<FONT color="green">030</FONT>     * on vectors element-wise, i.e. they perform the same operation (adding a scalar,<a name="line.30"></a>
+<FONT color="green">031</FONT>     * applying a function ...) on each element in turn. The &lt;code&gt;mapXxx&lt;/code&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * versions create a new vector to hold the result and do not change the instance.<a name="line.32"></a>
+<FONT color="green">033</FONT>     * The &lt;code&gt;mapXxxToSelf&lt;/code&gt; versions use the instance itself to store the<a name="line.33"></a>
+<FONT color="green">034</FONT>     * results, so the instance is changed by these methods. In both cases, the result<a name="line.34"></a>
+<FONT color="green">035</FONT>     * vector is returned by the methods, this allows to use the &lt;i&gt;fluent API&lt;/i&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * style, like this:<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;/p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * &lt;pre&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     *   RealVector result = v.mapAddToSelf(3.0).mapTanToSelf().mapSquareToSelf();<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;/pre&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     *<a name="line.41"></a>
+<FONT color="green">042</FONT>     * @param &lt;T&gt; the type of the field elements<a name="line.42"></a>
+<FONT color="green">043</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.43"></a>
+<FONT color="green">044</FONT>     * @since 2.0<a name="line.44"></a>
+<FONT color="green">045</FONT>     */<a name="line.45"></a>
+<FONT color="green">046</FONT>    public interface FieldVector&lt;T extends FieldElement&lt;T&gt;&gt;  {<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /**<a name="line.48"></a>
+<FONT color="green">049</FONT>         * Get the type of field elements of the vector.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @return type of field elements of the vector<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        Field&lt;T&gt; getField();<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /**<a name="line.54"></a>
+<FONT color="green">055</FONT>         * Returns a (deep) copy of this.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @return vector copy<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        FieldVector&lt;T&gt; copy();<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /**<a name="line.60"></a>
+<FONT color="green">061</FONT>         * Compute the sum of this and v.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param v vector to be added<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @return this + v<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.64"></a>
+<FONT color="green">065</FONT>         */<a name="line.65"></a>
+<FONT color="green">066</FONT>        FieldVector&lt;T&gt; add(FieldVector&lt;T&gt; v)<a name="line.66"></a>
+<FONT color="green">067</FONT>            throws IllegalArgumentException;<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * Compute the sum of this and v.<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param v vector to be added<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @return this + v<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.73"></a>
+<FONT color="green">074</FONT>         */<a name="line.74"></a>
+<FONT color="green">075</FONT>        FieldVector&lt;T&gt; add(T[] v)<a name="line.75"></a>
+<FONT color="green">076</FONT>            throws IllegalArgumentException;<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /**<a name="line.78"></a>
+<FONT color="green">079</FONT>         * Compute this minus v.<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @param v vector to be subtracted<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @return this + v<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.82"></a>
+<FONT color="green">083</FONT>         */<a name="line.83"></a>
+<FONT color="green">084</FONT>        FieldVector&lt;T&gt; subtract(FieldVector&lt;T&gt; v)<a name="line.84"></a>
+<FONT color="green">085</FONT>            throws IllegalArgumentException;<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>        /**<a name="line.87"></a>
+<FONT color="green">088</FONT>         * Compute this minus v.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @param v vector to be subtracted<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @return this + v<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.91"></a>
+<FONT color="green">092</FONT>         */<a name="line.92"></a>
+<FONT color="green">093</FONT>        FieldVector&lt;T&gt; subtract(T[] v)<a name="line.93"></a>
+<FONT color="green">094</FONT>            throws IllegalArgumentException;<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /**<a name="line.96"></a>
+<FONT color="green">097</FONT>         * Map an addition operation to each entry.<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @param d value to be added to each entry<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @return this + d<a name="line.99"></a>
+<FONT color="green">100</FONT>         */<a name="line.100"></a>
+<FONT color="green">101</FONT>        FieldVector&lt;T&gt; mapAdd(T d);<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        /**<a name="line.103"></a>
+<FONT color="green">104</FONT>         * Map an addition operation to each entry.<a name="line.104"></a>
+<FONT color="green">105</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @param d value to be added to each entry<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @return for convenience, return this<a name="line.107"></a>
+<FONT color="green">108</FONT>         */<a name="line.108"></a>
+<FONT color="green">109</FONT>        FieldVector&lt;T&gt; mapAddToSelf(T d);<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /**<a name="line.111"></a>
+<FONT color="green">112</FONT>         * Map a subtraction operation to each entry.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param d value to be subtracted to each entry<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @return this - d<a name="line.114"></a>
+<FONT color="green">115</FONT>         */<a name="line.115"></a>
+<FONT color="green">116</FONT>        FieldVector&lt;T&gt; mapSubtract(T d);<a name="line.116"></a>
+<FONT color="green">117</FONT>    <a name="line.117"></a>
+<FONT color="green">118</FONT>        /**<a name="line.118"></a>
+<FONT color="green">119</FONT>         * Map a subtraction operation to each entry.<a name="line.119"></a>
+<FONT color="green">120</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @param d value to be subtracted to each entry<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @return for convenience, return this<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        FieldVector&lt;T&gt; mapSubtractToSelf(T d);<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>        /**<a name="line.126"></a>
+<FONT color="green">127</FONT>         * Map a multiplication operation to each entry.<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @param d value to multiply all entries by<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @return this * d<a name="line.129"></a>
+<FONT color="green">130</FONT>         */<a name="line.130"></a>
+<FONT color="green">131</FONT>        FieldVector&lt;T&gt; mapMultiply(T d);<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>        /**<a name="line.133"></a>
+<FONT color="green">134</FONT>         * Map a multiplication operation to each entry.<a name="line.134"></a>
+<FONT color="green">135</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @param d value to multiply all entries by<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @return for convenience, return this<a name="line.137"></a>
+<FONT color="green">138</FONT>         */<a name="line.138"></a>
+<FONT color="green">139</FONT>        FieldVector&lt;T&gt; mapMultiplyToSelf(T d);<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>        /**<a name="line.141"></a>
+<FONT color="green">142</FONT>         * Map a division operation to each entry.<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @param d value to divide all entries by<a name="line.143"></a>
+<FONT color="green">144</FONT>         * @return this / d<a name="line.144"></a>
+<FONT color="green">145</FONT>         */<a name="line.145"></a>
+<FONT color="green">146</FONT>        FieldVector&lt;T&gt; mapDivide(T d);<a name="line.146"></a>
+<FONT color="green">147</FONT>    <a name="line.147"></a>
+<FONT color="green">148</FONT>        /**<a name="line.148"></a>
+<FONT color="green">149</FONT>         * Map a division operation to each entry.<a name="line.149"></a>
+<FONT color="green">150</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @param d value to divide all entries by<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @return for convenience, return this<a name="line.152"></a>
+<FONT color="green">153</FONT>         */<a name="line.153"></a>
+<FONT color="green">154</FONT>        FieldVector&lt;T&gt; mapDivideToSelf(T d);<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>        /**<a name="line.156"></a>
+<FONT color="green">157</FONT>         * Map the 1/x function to each entry.<a name="line.157"></a>
+<FONT color="green">158</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.158"></a>
+<FONT color="green">159</FONT>         */<a name="line.159"></a>
+<FONT color="green">160</FONT>        FieldVector&lt;T&gt; mapInv();<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>        /**<a name="line.162"></a>
+<FONT color="green">163</FONT>         * Map the 1/x function to each entry.<a name="line.163"></a>
+<FONT color="green">164</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.164"></a>
+<FONT color="green">165</FONT>         * @return for convenience, return this<a name="line.165"></a>
+<FONT color="green">166</FONT>         */<a name="line.166"></a>
+<FONT color="green">167</FONT>        FieldVector&lt;T&gt; mapInvToSelf();<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>        /**<a name="line.169"></a>
+<FONT color="green">170</FONT>         * Element-by-element multiplication.<a name="line.170"></a>
+<FONT color="green">171</FONT>         * @param v vector by which instance elements must be multiplied<a name="line.171"></a>
+<FONT color="green">172</FONT>         * @return a vector containing this[i] * v[i] for all i<a name="line.172"></a>
+<FONT color="green">173</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.173"></a>
+<FONT color="green">174</FONT>         */<a name="line.174"></a>
+<FONT color="green">175</FONT>        FieldVector&lt;T&gt; ebeMultiply(FieldVector&lt;T&gt; v) throws IllegalArgumentException;<a name="line.175"></a>
+<FONT color="green">176</FONT>    <a name="line.176"></a>
+<FONT color="green">177</FONT>        /**<a name="line.177"></a>
+<FONT color="green">178</FONT>         * Element-by-element multiplication.<a name="line.178"></a>
+<FONT color="green">179</FONT>         * @param v vector by which instance elements must be multiplied<a name="line.179"></a>
+<FONT color="green">180</FONT>         * @return a vector containing this[i] * v[i] for all i<a name="line.180"></a>
+<FONT color="green">181</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.181"></a>
+<FONT color="green">182</FONT>         */<a name="line.182"></a>
+<FONT color="green">183</FONT>        FieldVector&lt;T&gt; ebeMultiply(T[] v) throws IllegalArgumentException;<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>        /**<a name="line.185"></a>
+<FONT color="green">186</FONT>         * Element-by-element division.<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @param v vector by which instance elements must be divided<a name="line.187"></a>
+<FONT color="green">188</FONT>         * @return a vector containing this[i] / v[i] for all i<a name="line.188"></a>
+<FONT color="green">189</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.189"></a>
+<FONT color="green">190</FONT>         */<a name="line.190"></a>
+<FONT color="green">191</FONT>        FieldVector&lt;T&gt; ebeDivide(FieldVector&lt;T&gt; v) throws IllegalArgumentException;<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>        /**<a name="line.193"></a>
+<FONT color="green">194</FONT>         * Element-by-element division.<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @param v vector by which instance elements must be divided<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @return a vector containing this[i] / v[i] for all i<a name="line.196"></a>
+<FONT color="green">197</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.197"></a>
+<FONT color="green">198</FONT>         */<a name="line.198"></a>
+<FONT color="green">199</FONT>        FieldVector&lt;T&gt; ebeDivide(T[] v) throws IllegalArgumentException;<a name="line.199"></a>
+<FONT color="green">200</FONT>    <a name="line.200"></a>
+<FONT color="green">201</FONT>        /**<a name="line.201"></a>
+<FONT color="green">202</FONT>         * Returns vector entries as a T array.<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @return T array of entries<a name="line.203"></a>
+<FONT color="green">204</FONT>         */<a name="line.204"></a>
+<FONT color="green">205</FONT>         T[] getData();<a name="line.205"></a>
+<FONT color="green">206</FONT>    <a name="line.206"></a>
+<FONT color="green">207</FONT>        /**<a name="line.207"></a>
+<FONT color="green">208</FONT>         * Compute the dot product.<a name="line.208"></a>
+<FONT color="green">209</FONT>         * @param v vector with which dot product should be computed<a name="line.209"></a>
+<FONT color="green">210</FONT>         * @return the scalar dot product between instance and v<a name="line.210"></a>
+<FONT color="green">211</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.211"></a>
+<FONT color="green">212</FONT>         */<a name="line.212"></a>
+<FONT color="green">213</FONT>        T dotProduct(FieldVector&lt;T&gt; v)<a name="line.213"></a>
+<FONT color="green">214</FONT>            throws IllegalArgumentException;<a name="line.214"></a>
+<FONT color="green">215</FONT>    <a name="line.215"></a>
+<FONT color="green">216</FONT>        /**<a name="line.216"></a>
+<FONT color="green">217</FONT>         * Compute the dot product.<a name="line.217"></a>
+<FONT color="green">218</FONT>         * @param v vector with which dot product should be computed<a name="line.218"></a>
+<FONT color="green">219</FONT>         * @return the scalar dot product between instance and v<a name="line.219"></a>
+<FONT color="green">220</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.220"></a>
+<FONT color="green">221</FONT>         */<a name="line.221"></a>
+<FONT color="green">222</FONT>        T dotProduct(T[] v)<a name="line.222"></a>
+<FONT color="green">223</FONT>            throws IllegalArgumentException;<a name="line.223"></a>
+<FONT color="green">224</FONT>    <a name="line.224"></a>
+<FONT color="green">225</FONT>        /** Find the orthogonal projection of this vector onto another vector.<a name="line.225"></a>
+<FONT color="green">226</FONT>         * @param v vector onto which instance must be projected<a name="line.226"></a>
+<FONT color="green">227</FONT>         * @return projection of the instance onto v<a name="line.227"></a>
+<FONT color="green">228</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.228"></a>
+<FONT color="green">229</FONT>         */<a name="line.229"></a>
+<FONT color="green">230</FONT>        FieldVector&lt;T&gt; projection(FieldVector&lt;T&gt; v)<a name="line.230"></a>
+<FONT color="green">231</FONT>            throws IllegalArgumentException;<a name="line.231"></a>
+<FONT color="green">232</FONT>    <a name="line.232"></a>
+<FONT color="green">233</FONT>        /** Find the orthogonal projection of this vector onto another vector.<a name="line.233"></a>
+<FONT color="green">234</FONT>         * @param v vector onto which instance must be projected<a name="line.234"></a>
+<FONT color="green">235</FONT>         * @return projection of the instance onto v<a name="line.235"></a>
+<FONT color="green">236</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.236"></a>
+<FONT color="green">237</FONT>         */<a name="line.237"></a>
+<FONT color="green">238</FONT>        FieldVector&lt;T&gt; projection(T[] v)<a name="line.238"></a>
+<FONT color="green">239</FONT>            throws IllegalArgumentException;<a name="line.239"></a>
+<FONT color="green">240</FONT>    <a name="line.240"></a>
+<FONT color="green">241</FONT>        /**<a name="line.241"></a>
+<FONT color="green">242</FONT>         * Compute the outer product.<a name="line.242"></a>
+<FONT color="green">243</FONT>         * @param v vector with which outer product should be computed<a name="line.243"></a>
+<FONT color="green">244</FONT>         * @return the square matrix outer product between instance and v<a name="line.244"></a>
+<FONT color="green">245</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.245"></a>
+<FONT color="green">246</FONT>         */<a name="line.246"></a>
+<FONT color="green">247</FONT>        FieldMatrix&lt;T&gt; outerProduct(FieldVector&lt;T&gt; v)<a name="line.247"></a>
+<FONT color="green">248</FONT>            throws IllegalArgumentException;<a name="line.248"></a>
+<FONT color="green">249</FONT>    <a name="line.249"></a>
+<FONT color="green">250</FONT>        /**<a name="line.250"></a>
+<FONT color="green">251</FONT>         * Compute the outer product.<a name="line.251"></a>
+<FONT color="green">252</FONT>         * @param v vector with which outer product should be computed<a name="line.252"></a>
+<FONT color="green">253</FONT>         * @return the square matrix outer product between instance and v<a name="line.253"></a>
+<FONT color="green">254</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.254"></a>
+<FONT color="green">255</FONT>         */<a name="line.255"></a>
+<FONT color="green">256</FONT>        FieldMatrix&lt;T&gt; outerProduct(T[] v)<a name="line.256"></a>
+<FONT color="green">257</FONT>            throws IllegalArgumentException;<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>        /**<a name="line.259"></a>
+<FONT color="green">260</FONT>         * Returns the entry in the specified index.<a name="line.260"></a>
+<FONT color="green">261</FONT>         * &lt;p&gt;<a name="line.261"></a>
+<FONT color="green">262</FONT>         * The index start at 0 and must be lesser than the size,<a name="line.262"></a>
+<FONT color="green">263</FONT>         * otherwise a {@link MatrixIndexException} is thrown.<a name="line.263"></a>
+<FONT color="green">264</FONT>         * &lt;/p&gt;<a name="line.264"></a>
+<FONT color="green">265</FONT>         * @param index  index location of entry to be fetched<a name="line.265"></a>
+<FONT color="green">266</FONT>         * @return vector entry at index<a name="line.266"></a>
+<FONT color="green">267</FONT>         * @throws MatrixIndexException if the index is not valid<a name="line.267"></a>
+<FONT color="green">268</FONT>         * @see #setEntry(int, FieldElement)<a name="line.268"></a>
+<FONT color="green">269</FONT>         */<a name="line.269"></a>
+<FONT color="green">270</FONT>        T getEntry(int index)<a name="line.270"></a>
+<FONT color="green">271</FONT>            throws MatrixIndexException;<a name="line.271"></a>
+<FONT color="green">272</FONT>    <a name="line.272"></a>
+<FONT color="green">273</FONT>        /**<a name="line.273"></a>
+<FONT color="green">274</FONT>         * Set a single element.<a name="line.274"></a>
+<FONT color="green">275</FONT>         * @param index element index.<a name="line.275"></a>
+<FONT color="green">276</FONT>         * @param value new value for the element.<a name="line.276"></a>
+<FONT color="green">277</FONT>         * @exception MatrixIndexException if the index is<a name="line.277"></a>
+<FONT color="green">278</FONT>         * inconsistent with vector size<a name="line.278"></a>
+<FONT color="green">279</FONT>         * @see #getEntry(int)<a name="line.279"></a>
+<FONT color="green">280</FONT>         */<a name="line.280"></a>
+<FONT color="green">281</FONT>        void setEntry(int index, T value)<a name="line.281"></a>
+<FONT color="green">282</FONT>            throws MatrixIndexException;<a name="line.282"></a>
+<FONT color="green">283</FONT>    <a name="line.283"></a>
+<FONT color="green">284</FONT>        /**<a name="line.284"></a>
+<FONT color="green">285</FONT>         * Returns the size of the vector.<a name="line.285"></a>
+<FONT color="green">286</FONT>         * @return size<a name="line.286"></a>
+<FONT color="green">287</FONT>         */<a name="line.287"></a>
+<FONT color="green">288</FONT>        int getDimension();<a name="line.288"></a>
+<FONT color="green">289</FONT>    <a name="line.289"></a>
+<FONT color="green">290</FONT>        /**<a name="line.290"></a>
+<FONT color="green">291</FONT>         * Construct a vector by appending a vector to this vector.<a name="line.291"></a>
+<FONT color="green">292</FONT>         * @param v vector to append to this one.<a name="line.292"></a>
+<FONT color="green">293</FONT>         * @return a new vector<a name="line.293"></a>
+<FONT color="green">294</FONT>         */<a name="line.294"></a>
+<FONT color="green">295</FONT>        FieldVector&lt;T&gt; append(FieldVector&lt;T&gt; v);<a name="line.295"></a>
+<FONT color="green">296</FONT>    <a name="line.296"></a>
+<FONT color="green">297</FONT>        /**<a name="line.297"></a>
+<FONT color="green">298</FONT>         * Construct a vector by appending a T to this vector.<a name="line.298"></a>
+<FONT color="green">299</FONT>         * @param d T to append.<a name="line.299"></a>
+<FONT color="green">300</FONT>         * @return a new vector<a name="line.300"></a>
+<FONT color="green">301</FONT>         */<a name="line.301"></a>
+<FONT color="green">302</FONT>        FieldVector&lt;T&gt; append(T d);<a name="line.302"></a>
+<FONT color="green">303</FONT>    <a name="line.303"></a>
+<FONT color="green">304</FONT>        /**<a name="line.304"></a>
+<FONT color="green">305</FONT>         * Construct a vector by appending a T array to this vector.<a name="line.305"></a>
+<FONT color="green">306</FONT>         * @param a T array to append.<a name="line.306"></a>
+<FONT color="green">307</FONT>         * @return a new vector<a name="line.307"></a>
+<FONT color="green">308</FONT>         */<a name="line.308"></a>
+<FONT color="green">309</FONT>        FieldVector&lt;T&gt; append(T[] a);<a name="line.309"></a>
+<FONT color="green">310</FONT>    <a name="line.310"></a>
+<FONT color="green">311</FONT>        /**<a name="line.311"></a>
+<FONT color="green">312</FONT>         * Get a subvector from consecutive elements.<a name="line.312"></a>
+<FONT color="green">313</FONT>         * @param index index of first element.<a name="line.313"></a>
+<FONT color="green">314</FONT>         * @param n number of elements to be retrieved.<a name="line.314"></a>
+<FONT color="green">315</FONT>         * @return a vector containing n elements.<a name="line.315"></a>
+<FONT color="green">316</FONT>         * @exception MatrixIndexException if the index is<a name="line.316"></a>
+<FONT color="green">317</FONT>         * inconsistent with vector size<a name="line.317"></a>
+<FONT color="green">318</FONT>         */<a name="line.318"></a>
+<FONT color="green">319</FONT>        FieldVector&lt;T&gt; getSubVector(int index, int n)<a name="line.319"></a>
+<FONT color="green">320</FONT>            throws MatrixIndexException;<a name="line.320"></a>
+<FONT color="green">321</FONT>    <a name="line.321"></a>
+<FONT color="green">322</FONT>        /**<a name="line.322"></a>
+<FONT color="green">323</FONT>         * Set a set of consecutive elements.<a name="line.323"></a>
+<FONT color="green">324</FONT>         * @param index index of first element to be set.<a name="line.324"></a>
+<FONT color="green">325</FONT>         * @param v vector containing the values to set.<a name="line.325"></a>
+<FONT color="green">326</FONT>         * @exception MatrixIndexException if the index is<a name="line.326"></a>
+<FONT color="green">327</FONT>         * inconsistent with vector size<a name="line.327"></a>
+<FONT color="green">328</FONT>         * @see #setSubVector(int, FieldElement[])<a name="line.328"></a>
+<FONT color="green">329</FONT>         */<a name="line.329"></a>
+<FONT color="green">330</FONT>        void setSubVector(int index, FieldVector&lt;T&gt; v)<a name="line.330"></a>
+<FONT color="green">331</FONT>            throws MatrixIndexException;<a name="line.331"></a>
+<FONT color="green">332</FONT>    <a name="line.332"></a>
+<FONT color="green">333</FONT>        /**<a name="line.333"></a>
+<FONT color="green">334</FONT>         * Set a set of consecutive elements.<a name="line.334"></a>
+<FONT color="green">335</FONT>         * @param index index of first element to be set.<a name="line.335"></a>
+<FONT color="green">336</FONT>         * @param v vector containing the values to set.<a name="line.336"></a>
+<FONT color="green">337</FONT>         * @exception MatrixIndexException if the index is<a name="line.337"></a>
+<FONT color="green">338</FONT>         * inconsistent with vector size<a name="line.338"></a>
+<FONT color="green">339</FONT>         * @see #setSubVector(int, FieldVector)<a name="line.339"></a>
+<FONT color="green">340</FONT>         */<a name="line.340"></a>
+<FONT color="green">341</FONT>        void setSubVector(int index, T[] v)<a name="line.341"></a>
+<FONT color="green">342</FONT>            throws MatrixIndexException;<a name="line.342"></a>
+<FONT color="green">343</FONT>    <a name="line.343"></a>
+<FONT color="green">344</FONT>        /**<a name="line.344"></a>
+<FONT color="green">345</FONT>         * Set all elements to a single value.<a name="line.345"></a>
+<FONT color="green">346</FONT>         * @param value single value to set for all elements<a name="line.346"></a>
+<FONT color="green">347</FONT>         */<a name="line.347"></a>
+<FONT color="green">348</FONT>        void set(T value);<a name="line.348"></a>
+<FONT color="green">349</FONT>    <a name="line.349"></a>
+<FONT color="green">350</FONT>        /**<a name="line.350"></a>
+<FONT color="green">351</FONT>         * Convert the vector to a T array.<a name="line.351"></a>
+<FONT color="green">352</FONT>         * &lt;p&gt;The array is independent from vector data, it's elements<a name="line.352"></a>
+<FONT color="green">353</FONT>         * are copied.&lt;/p&gt;<a name="line.353"></a>
+<FONT color="green">354</FONT>         * @return array containing a copy of vector elements<a name="line.354"></a>
+<FONT color="green">355</FONT>         */<a name="line.355"></a>
+<FONT color="green">356</FONT>        T[] toArray();<a name="line.356"></a>
+<FONT color="green">357</FONT>    <a name="line.357"></a>
+<FONT color="green">358</FONT>    }<a name="line.358"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/InvalidMatrixException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,119 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Thrown when a system attempts an operation on a matrix, and<a name="line.23"></a>
+<FONT color="green">024</FONT>     * that matrix does not satisfy the preconditions for the<a name="line.24"></a>
+<FONT color="green">025</FONT>     * aforementioned operation.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 746578 $ $Date: 2009-02-21 15:01:14 -0500 (Sat, 21 Feb 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public class InvalidMatrixException extends MathRuntimeException {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /** Serializable version identifier. */<a name="line.30"></a>
+<FONT color="green">031</FONT>        private static final long serialVersionUID = 1135533765052675495L;<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /**<a name="line.33"></a>
+<FONT color="green">034</FONT>         * Construct an exception with the given message.<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @param pattern format specifier<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @param arguments format arguments<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @since 2.0<a name="line.37"></a>
+<FONT color="green">038</FONT>         */<a name="line.38"></a>
+<FONT color="green">039</FONT>        public InvalidMatrixException(final String pattern, final Object ... arguments) {<a name="line.39"></a>
+<FONT color="green">040</FONT>            super(pattern, arguments);<a name="line.40"></a>
+<FONT color="green">041</FONT>        }<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /**<a name="line.43"></a>
+<FONT color="green">044</FONT>         * Construct an exception with the given message.<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @param cause the exception or error that caused this exception<a name="line.45"></a>
+<FONT color="green">046</FONT>         * to be thrown.<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @since 2.0<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        public InvalidMatrixException(final Throwable cause) {<a name="line.49"></a>
+<FONT color="green">050</FONT>            super(cause);<a name="line.50"></a>
+<FONT color="green">051</FONT>        }<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>    }<a name="line.53"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/LUDecomposition.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,158 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * An interface to classes that implement an algorithm to calculate the<a name="line.22"></a>
+<FONT color="green">023</FONT>     * LU-decomposition of a real matrix.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;The LU-decomposition of matrix A is a set of three matrices: P, L and U<a name="line.24"></a>
+<FONT color="green">025</FONT>     * such that P&amp;times;A = L&amp;times;U. P is a rows permutation matrix that is used<a name="line.25"></a>
+<FONT color="green">026</FONT>     * to rearrange the rows of A before so that it can be decomposed. L is a lower<a name="line.26"></a>
+<FONT color="green">027</FONT>     * triangular matrix with unit diagonal terms and U is an upper triangular matrix.&lt;/p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;This interface is based on the class with similar name from the<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;a href="http://math.nist.gov/javanumerics/jama/"&gt;JAMA&lt;/a&gt; library.&lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;ul&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     *   &lt;li&gt;a {@link #getP() getP} method has been added,&lt;/li&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     *   &lt;li&gt;the &lt;code&gt;det&lt;/code&gt; method has been renamed as {@link #getDeterminant()<a name="line.32"></a>
+<FONT color="green">033</FONT>     *   getDeterminant},&lt;/li&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     *   &lt;li&gt;the &lt;code&gt;getDoublePivot&lt;/code&gt; method has been removed (but the int based<a name="line.34"></a>
+<FONT color="green">035</FONT>     *   {@link #getPivot() getPivot} method has been kept),&lt;/li&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     *   &lt;li&gt;the &lt;code&gt;solve&lt;/code&gt; and &lt;code&gt;isNonSingular&lt;/code&gt; methods have been replaced<a name="line.36"></a>
+<FONT color="green">037</FONT>     *   by a {@link #getSolver() getSolver} method and the equivalent methods provided by<a name="line.37"></a>
+<FONT color="green">038</FONT>     *   the returned {@link DecompositionSolver}.&lt;/li&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;/ul&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     *<a name="line.40"></a>
+<FONT color="green">041</FONT>     * @see &lt;a href="http://mathworld.wolfram.com/LUDecomposition.html"&gt;MathWorld&lt;/a&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * @see &lt;a href="http://en.wikipedia.org/wiki/LU_decomposition"&gt;Wikipedia&lt;/a&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     * @version $Revision: 826627 $ $Date: 2009-10-19 06:27:47 -0400 (Mon, 19 Oct 2009) $<a name="line.43"></a>
+<FONT color="green">044</FONT>     * @since 2.0<a name="line.44"></a>
+<FONT color="green">045</FONT>     */<a name="line.45"></a>
+<FONT color="green">046</FONT>    public interface LUDecomposition {<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /**<a name="line.48"></a>
+<FONT color="green">049</FONT>         * Returns the matrix L of the decomposition.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * &lt;p&gt;L is an lower-triangular matrix&lt;/p&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @return the L matrix (or null if decomposed matrix is singular)<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        RealMatrix getL();<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * Returns the matrix U of the decomposition.<a name="line.56"></a>
+<FONT color="green">057</FONT>         * &lt;p&gt;U is an upper-triangular matrix&lt;/p&gt;<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @return the U matrix (or null if decomposed matrix is singular)<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        RealMatrix getU();<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /**<a name="line.62"></a>
+<FONT color="green">063</FONT>         * Returns the P rows permutation matrix.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * &lt;p&gt;P is a sparse matrix with exactly one element set to 1.0 in<a name="line.64"></a>
+<FONT color="green">065</FONT>         * each row and each column, all other elements being set to 0.0.&lt;/p&gt;<a name="line.65"></a>
+<FONT color="green">066</FONT>         * &lt;p&gt;The positions of the 1 elements are given by the {@link #getPivot()<a name="line.66"></a>
+<FONT color="green">067</FONT>         * pivot permutation vector}.&lt;/p&gt;<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @return the P rows permutation matrix (or null if decomposed matrix is singular)<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @see #getPivot()<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        RealMatrix getP();<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /**<a name="line.73"></a>
+<FONT color="green">074</FONT>         * Returns the pivot permutation vector.<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @return the pivot permutation vector<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @see #getP()<a name="line.76"></a>
+<FONT color="green">077</FONT>         */<a name="line.77"></a>
+<FONT color="green">078</FONT>        int[] getPivot();<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /**<a name="line.80"></a>
+<FONT color="green">081</FONT>         * Return the determinant of the matrix<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @return determinant of the matrix<a name="line.82"></a>
+<FONT color="green">083</FONT>         */<a name="line.83"></a>
+<FONT color="green">084</FONT>        double getDeterminant();<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /**<a name="line.86"></a>
+<FONT color="green">087</FONT>         * Get a solver for finding the A &amp;times; X = B solution in exact linear sense.<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @return a solver<a name="line.88"></a>
+<FONT color="green">089</FONT>         */<a name="line.89"></a>
+<FONT color="green">090</FONT>        DecompositionSolver getSolver();<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>    }<a name="line.92"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/LUDecompositionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,491 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Calculates the LUP-decomposition of a square matrix.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;The LUP-decomposition of a matrix A consists of three matrices<a name="line.24"></a>
+<FONT color="green">025</FONT>     * L, U and P that satisfy: PA = LU, L is lower triangular, and U is<a name="line.25"></a>
+<FONT color="green">026</FONT>     * upper triangular and P is a permutation matrix. All matrices are<a name="line.26"></a>
+<FONT color="green">027</FONT>     * m&amp;times;m.&lt;/p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;As shown by the presence of the P matrix, this decomposition is<a name="line.28"></a>
+<FONT color="green">029</FONT>     * implemented using partial pivoting.&lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 885278 $ $Date: 2009-11-29 16:47:51 -0500 (Sun, 29 Nov 2009) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 2.0<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public class LUDecompositionImpl implements LUDecomposition {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Default bound to determine effective singularity in LU decomposition */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private static final double DEFAULT_TOO_SMALL = 10E-12;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Message for vector length mismatch. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private static final String VECTOR_LENGTH_MISMATCH_MESSAGE =<a name="line.40"></a>
+<FONT color="green">041</FONT>            "vector length mismatch: got {0} but expected {1}";<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** Entries of LU decomposition. */<a name="line.43"></a>
+<FONT color="green">044</FONT>        private double lu[][];<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** Pivot permutation associated with LU decomposition */<a name="line.46"></a>
+<FONT color="green">047</FONT>        private int[] pivot;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** Parity of the permutation associated with the LU decomposition */<a name="line.49"></a>
+<FONT color="green">050</FONT>        private boolean even;<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /** Singularity indicator. */<a name="line.52"></a>
+<FONT color="green">053</FONT>        private boolean singular;<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** Cached value of L. */<a name="line.55"></a>
+<FONT color="green">056</FONT>        private RealMatrix cachedL;<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /** Cached value of U. */<a name="line.58"></a>
+<FONT color="green">059</FONT>        private RealMatrix cachedU;<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /** Cached value of P. */<a name="line.61"></a>
+<FONT color="green">062</FONT>        private RealMatrix cachedP;<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /**<a name="line.64"></a>
+<FONT color="green">065</FONT>         * Calculates the LU-decomposition of the given matrix.<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @param matrix The matrix to decompose.<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @exception InvalidMatrixException if matrix is not square<a name="line.67"></a>
+<FONT color="green">068</FONT>         */<a name="line.68"></a>
+<FONT color="green">069</FONT>        public LUDecompositionImpl(RealMatrix matrix)<a name="line.69"></a>
+<FONT color="green">070</FONT>            throws InvalidMatrixException {<a name="line.70"></a>
+<FONT color="green">071</FONT>            this(matrix, DEFAULT_TOO_SMALL);<a name="line.71"></a>
+<FONT color="green">072</FONT>        }<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /**<a name="line.74"></a>
+<FONT color="green">075</FONT>         * Calculates the LU-decomposition of the given matrix.<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @param matrix The matrix to decompose.<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @param singularityThreshold threshold (based on partial row norm)<a name="line.77"></a>
+<FONT color="green">078</FONT>         * under which a matrix is considered singular<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @exception NonSquareMatrixException if matrix is not square<a name="line.79"></a>
+<FONT color="green">080</FONT>         */<a name="line.80"></a>
+<FONT color="green">081</FONT>        public LUDecompositionImpl(RealMatrix matrix, double singularityThreshold)<a name="line.81"></a>
+<FONT color="green">082</FONT>            throws NonSquareMatrixException {<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>            if (!matrix.isSquare()) {<a name="line.84"></a>
+<FONT color="green">085</FONT>                throw new NonSquareMatrixException(matrix.getRowDimension(), matrix.getColumnDimension());<a name="line.85"></a>
+<FONT color="green">086</FONT>            }<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>            final int m = matrix.getColumnDimension();<a name="line.88"></a>
+<FONT color="green">089</FONT>            lu = matrix.getData();<a name="line.89"></a>
+<FONT color="green">090</FONT>            pivot = new int[m];<a name="line.90"></a>
+<FONT color="green">091</FONT>            cachedL = null;<a name="line.91"></a>
+<FONT color="green">092</FONT>            cachedU = null;<a name="line.92"></a>
+<FONT color="green">093</FONT>            cachedP = null;<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>            // Initialize permutation array and parity<a name="line.95"></a>
+<FONT color="green">096</FONT>            for (int row = 0; row &lt; m; row++) {<a name="line.96"></a>
+<FONT color="green">097</FONT>                pivot[row] = row;<a name="line.97"></a>
+<FONT color="green">098</FONT>            }<a name="line.98"></a>
+<FONT color="green">099</FONT>            even     = true;<a name="line.99"></a>
+<FONT color="green">100</FONT>            singular = false;<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>            // Loop over columns<a name="line.102"></a>
+<FONT color="green">103</FONT>            for (int col = 0; col &lt; m; col++) {<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>                double sum = 0;<a name="line.105"></a>
+<FONT color="green">106</FONT>    <a name="line.106"></a>
+<FONT color="green">107</FONT>                // upper<a name="line.107"></a>
+<FONT color="green">108</FONT>                for (int row = 0; row &lt; col; row++) {<a name="line.108"></a>
+<FONT color="green">109</FONT>                    final double[] luRow = lu[row];<a name="line.109"></a>
+<FONT color="green">110</FONT>                    sum = luRow[col];<a name="line.110"></a>
+<FONT color="green">111</FONT>                    for (int i = 0; i &lt; row; i++) {<a name="line.111"></a>
+<FONT color="green">112</FONT>                        sum -= luRow[i] * lu[i][col];<a name="line.112"></a>
+<FONT color="green">113</FONT>                    }<a name="line.113"></a>
+<FONT color="green">114</FONT>                    luRow[col] = sum;<a name="line.114"></a>
+<FONT color="green">115</FONT>                }<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>                // lower<a name="line.117"></a>
+<FONT color="green">118</FONT>                int max = col; // permutation row<a name="line.118"></a>
+<FONT color="green">119</FONT>                double largest = Double.NEGATIVE_INFINITY;<a name="line.119"></a>
+<FONT color="green">120</FONT>                for (int row = col; row &lt; m; row++) {<a name="line.120"></a>
+<FONT color="green">121</FONT>                    final double[] luRow = lu[row];<a name="line.121"></a>
+<FONT color="green">122</FONT>                    sum = luRow[col];<a name="line.122"></a>
+<FONT color="green">123</FONT>                    for (int i = 0; i &lt; col; i++) {<a name="line.123"></a>
+<FONT color="green">124</FONT>                        sum -= luRow[i] * lu[i][col];<a name="line.124"></a>
+<FONT color="green">125</FONT>                    }<a name="line.125"></a>
+<FONT color="green">126</FONT>                    luRow[col] = sum;<a name="line.126"></a>
+<FONT color="green">127</FONT>    <a name="line.127"></a>
+<FONT color="green">128</FONT>                    // maintain best permutation choice<a name="line.128"></a>
+<FONT color="green">129</FONT>                    if (Math.abs(sum) &gt; largest) {<a name="line.129"></a>
+<FONT color="green">130</FONT>                        largest = Math.abs(sum);<a name="line.130"></a>
+<FONT color="green">131</FONT>                        max = row;<a name="line.131"></a>
+<FONT color="green">132</FONT>                    }<a name="line.132"></a>
+<FONT color="green">133</FONT>                }<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>                // Singularity check<a name="line.135"></a>
+<FONT color="green">136</FONT>                if (Math.abs(lu[max][col]) &lt; singularityThreshold) {<a name="line.136"></a>
+<FONT color="green">137</FONT>                    singular = true;<a name="line.137"></a>
+<FONT color="green">138</FONT>                    return;<a name="line.138"></a>
+<FONT color="green">139</FONT>                }<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>                // Pivot if necessary<a name="line.141"></a>
+<FONT color="green">142</FONT>                if (max != col) {<a name="line.142"></a>
+<FONT color="green">143</FONT>                    double tmp = 0;<a name="line.143"></a>
+<FONT color="green">144</FONT>                    final double[] luMax = lu[max];<a name="line.144"></a>
+<FONT color="green">145</FONT>                    final double[] luCol = lu[col];<a name="line.145"></a>
+<FONT color="green">146</FONT>                    for (int i = 0; i &lt; m; i++) {<a name="line.146"></a>
+<FONT color="green">147</FONT>                        tmp = luMax[i];<a name="line.147"></a>
+<FONT color="green">148</FONT>                        luMax[i] = luCol[i];<a name="line.148"></a>
+<FONT color="green">149</FONT>                        luCol[i] = tmp;<a name="line.149"></a>
+<FONT color="green">150</FONT>                    }<a name="line.150"></a>
+<FONT color="green">151</FONT>                    int temp = pivot[max];<a name="line.151"></a>
+<FONT color="green">152</FONT>                    pivot[max] = pivot[col];<a name="line.152"></a>
+<FONT color="green">153</FONT>                    pivot[col] = temp;<a name="line.153"></a>
+<FONT color="green">154</FONT>                    even = !even;<a name="line.154"></a>
+<FONT color="green">155</FONT>                }<a name="line.155"></a>
+<FONT color="green">156</FONT>    <a name="line.156"></a>
+<FONT color="green">157</FONT>                // Divide the lower elements by the "winning" diagonal elt.<a name="line.157"></a>
+<FONT color="green">158</FONT>                final double luDiag = lu[col][col];<a name="line.158"></a>
+<FONT color="green">159</FONT>                for (int row = col + 1; row &lt; m; row++) {<a name="line.159"></a>
+<FONT color="green">160</FONT>                    lu[row][col] /= luDiag;<a name="line.160"></a>
+<FONT color="green">161</FONT>                }<a name="line.161"></a>
+<FONT color="green">162</FONT>            }<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>        }<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>        /** {@inheritDoc} */<a name="line.166"></a>
+<FONT color="green">167</FONT>        public RealMatrix getL() {<a name="line.167"></a>
+<FONT color="green">168</FONT>            if ((cachedL == null) &amp;&amp; !singular) {<a name="line.168"></a>
+<FONT color="green">169</FONT>                final int m = pivot.length;<a name="line.169"></a>
+<FONT color="green">170</FONT>                cachedL = MatrixUtils.createRealMatrix(m, m);<a name="line.170"></a>
+<FONT color="green">171</FONT>                for (int i = 0; i &lt; m; ++i) {<a name="line.171"></a>
+<FONT color="green">172</FONT>                    final double[] luI = lu[i];<a name="line.172"></a>
+<FONT color="green">173</FONT>                    for (int j = 0; j &lt; i; ++j) {<a name="line.173"></a>
+<FONT color="green">174</FONT>                        cachedL.setEntry(i, j, luI[j]);<a name="line.174"></a>
+<FONT color="green">175</FONT>                    }<a name="line.175"></a>
+<FONT color="green">176</FONT>                    cachedL.setEntry(i, i, 1.0);<a name="line.176"></a>
+<FONT color="green">177</FONT>                }<a name="line.177"></a>
+<FONT color="green">178</FONT>            }<a name="line.178"></a>
+<FONT color="green">179</FONT>            return cachedL;<a name="line.179"></a>
+<FONT color="green">180</FONT>        }<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>        /** {@inheritDoc} */<a name="line.182"></a>
+<FONT color="green">183</FONT>        public RealMatrix getU() {<a name="line.183"></a>
+<FONT color="green">184</FONT>            if ((cachedU == null) &amp;&amp; !singular) {<a name="line.184"></a>
+<FONT color="green">185</FONT>                final int m = pivot.length;<a name="line.185"></a>
+<FONT color="green">186</FONT>                cachedU = MatrixUtils.createRealMatrix(m, m);<a name="line.186"></a>
+<FONT color="green">187</FONT>                for (int i = 0; i &lt; m; ++i) {<a name="line.187"></a>
+<FONT color="green">188</FONT>                    final double[] luI = lu[i];<a name="line.188"></a>
+<FONT color="green">189</FONT>                    for (int j = i; j &lt; m; ++j) {<a name="line.189"></a>
+<FONT color="green">190</FONT>                        cachedU.setEntry(i, j, luI[j]);<a name="line.190"></a>
+<FONT color="green">191</FONT>                    }<a name="line.191"></a>
+<FONT color="green">192</FONT>                }<a name="line.192"></a>
+<FONT color="green">193</FONT>            }<a name="line.193"></a>
+<FONT color="green">194</FONT>            return cachedU;<a name="line.194"></a>
+<FONT color="green">195</FONT>        }<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>        /** {@inheritDoc} */<a name="line.197"></a>
+<FONT color="green">198</FONT>        public RealMatrix getP() {<a name="line.198"></a>
+<FONT color="green">199</FONT>            if ((cachedP == null) &amp;&amp; !singular) {<a name="line.199"></a>
+<FONT color="green">200</FONT>                final int m = pivot.length;<a name="line.200"></a>
+<FONT color="green">201</FONT>                cachedP = MatrixUtils.createRealMatrix(m, m);<a name="line.201"></a>
+<FONT color="green">202</FONT>                for (int i = 0; i &lt; m; ++i) {<a name="line.202"></a>
+<FONT color="green">203</FONT>                    cachedP.setEntry(i, pivot[i], 1.0);<a name="line.203"></a>
+<FONT color="green">204</FONT>                }<a name="line.204"></a>
+<FONT color="green">205</FONT>            }<a name="line.205"></a>
+<FONT color="green">206</FONT>            return cachedP;<a name="line.206"></a>
+<FONT color="green">207</FONT>        }<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>        /** {@inheritDoc} */<a name="line.209"></a>
+<FONT color="green">210</FONT>        public int[] getPivot() {<a name="line.210"></a>
+<FONT color="green">211</FONT>            return pivot.clone();<a name="line.211"></a>
+<FONT color="green">212</FONT>        }<a name="line.212"></a>
+<FONT color="green">213</FONT>    <a name="line.213"></a>
+<FONT color="green">214</FONT>        /** {@inheritDoc} */<a name="line.214"></a>
+<FONT color="green">215</FONT>        public double getDeterminant() {<a name="line.215"></a>
+<FONT color="green">216</FONT>            if (singular) {<a name="line.216"></a>
+<FONT color="green">217</FONT>                return 0;<a name="line.217"></a>
+<FONT color="green">218</FONT>            } else {<a name="line.218"></a>
+<FONT color="green">219</FONT>                final int m = pivot.length;<a name="line.219"></a>
+<FONT color="green">220</FONT>                double determinant = even ? 1 : -1;<a name="line.220"></a>
+<FONT color="green">221</FONT>                for (int i = 0; i &lt; m; i++) {<a name="line.221"></a>
+<FONT color="green">222</FONT>                    determinant *= lu[i][i];<a name="line.222"></a>
+<FONT color="green">223</FONT>                }<a name="line.223"></a>
+<FONT color="green">224</FONT>                return determinant;<a name="line.224"></a>
+<FONT color="green">225</FONT>            }<a name="line.225"></a>
+<FONT color="green">226</FONT>        }<a name="line.226"></a>
+<FONT color="green">227</FONT>    <a name="line.227"></a>
+<FONT color="green">228</FONT>        /** {@inheritDoc} */<a name="line.228"></a>
+<FONT color="green">229</FONT>        public DecompositionSolver getSolver() {<a name="line.229"></a>
+<FONT color="green">230</FONT>            return new Solver(lu, pivot, singular);<a name="line.230"></a>
+<FONT color="green">231</FONT>        }<a name="line.231"></a>
+<FONT color="green">232</FONT>    <a name="line.232"></a>
+<FONT color="green">233</FONT>        /** Specialized solver. */<a name="line.233"></a>
+<FONT color="green">234</FONT>        private static class Solver implements DecompositionSolver {<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>            /** Entries of LU decomposition. */<a name="line.236"></a>
+<FONT color="green">237</FONT>            private final double lu[][];<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>            /** Pivot permutation associated with LU decomposition. */<a name="line.239"></a>
+<FONT color="green">240</FONT>            private final int[] pivot;<a name="line.240"></a>
+<FONT color="green">241</FONT>    <a name="line.241"></a>
+<FONT color="green">242</FONT>            /** Singularity indicator. */<a name="line.242"></a>
+<FONT color="green">243</FONT>            private final boolean singular;<a name="line.243"></a>
+<FONT color="green">244</FONT>    <a name="line.244"></a>
+<FONT color="green">245</FONT>            /**<a name="line.245"></a>
+<FONT color="green">246</FONT>             * Build a solver from decomposed matrix.<a name="line.246"></a>
+<FONT color="green">247</FONT>             * @param lu entries of LU decomposition<a name="line.247"></a>
+<FONT color="green">248</FONT>             * @param pivot pivot permutation associated with LU decomposition<a name="line.248"></a>
+<FONT color="green">249</FONT>             * @param singular singularity indicator<a name="line.249"></a>
+<FONT color="green">250</FONT>             */<a name="line.250"></a>
+<FONT color="green">251</FONT>            private Solver(final double[][] lu, final int[] pivot, final boolean singular) {<a name="line.251"></a>
+<FONT color="green">252</FONT>                this.lu       = lu;<a name="line.252"></a>
+<FONT color="green">253</FONT>                this.pivot    = pivot;<a name="line.253"></a>
+<FONT color="green">254</FONT>                this.singular = singular;<a name="line.254"></a>
+<FONT color="green">255</FONT>            }<a name="line.255"></a>
+<FONT color="green">256</FONT>    <a name="line.256"></a>
+<FONT color="green">257</FONT>            /** {@inheritDoc} */<a name="line.257"></a>
+<FONT color="green">258</FONT>            public boolean isNonSingular() {<a name="line.258"></a>
+<FONT color="green">259</FONT>                return !singular;<a name="line.259"></a>
+<FONT color="green">260</FONT>            }<a name="line.260"></a>
+<FONT color="green">261</FONT>    <a name="line.261"></a>
+<FONT color="green">262</FONT>            /** {@inheritDoc} */<a name="line.262"></a>
+<FONT color="green">263</FONT>            public double[] solve(double[] b)<a name="line.263"></a>
+<FONT color="green">264</FONT>                throws IllegalArgumentException, InvalidMatrixException {<a name="line.264"></a>
+<FONT color="green">265</FONT>    <a name="line.265"></a>
+<FONT color="green">266</FONT>                final int m = pivot.length;<a name="line.266"></a>
+<FONT color="green">267</FONT>                if (b.length != m) {<a name="line.267"></a>
+<FONT color="green">268</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.268"></a>
+<FONT color="green">269</FONT>                            VECTOR_LENGTH_MISMATCH_MESSAGE, b.length, m);<a name="line.269"></a>
+<FONT color="green">270</FONT>                }<a name="line.270"></a>
+<FONT color="green">271</FONT>                if (singular) {<a name="line.271"></a>
+<FONT color="green">272</FONT>                    throw new SingularMatrixException();<a name="line.272"></a>
+<FONT color="green">273</FONT>                }<a name="line.273"></a>
+<FONT color="green">274</FONT>    <a name="line.274"></a>
+<FONT color="green">275</FONT>                final double[] bp = new double[m];<a name="line.275"></a>
+<FONT color="green">276</FONT>    <a name="line.276"></a>
+<FONT color="green">277</FONT>                // Apply permutations to b<a name="line.277"></a>
+<FONT color="green">278</FONT>                for (int row = 0; row &lt; m; row++) {<a name="line.278"></a>
+<FONT color="green">279</FONT>                    bp[row] = b[pivot[row]];<a name="line.279"></a>
+<FONT color="green">280</FONT>                }<a name="line.280"></a>
+<FONT color="green">281</FONT>    <a name="line.281"></a>
+<FONT color="green">282</FONT>                // Solve LY = b<a name="line.282"></a>
+<FONT color="green">283</FONT>                for (int col = 0; col &lt; m; col++) {<a name="line.283"></a>
+<FONT color="green">284</FONT>                    final double bpCol = bp[col];<a name="line.284"></a>
+<FONT color="green">285</FONT>                    for (int i = col + 1; i &lt; m; i++) {<a name="line.285"></a>
+<FONT color="green">286</FONT>                        bp[i] -= bpCol * lu[i][col];<a name="line.286"></a>
+<FONT color="green">287</FONT>                    }<a name="line.287"></a>
+<FONT color="green">288</FONT>                }<a name="line.288"></a>
+<FONT color="green">289</FONT>    <a name="line.289"></a>
+<FONT color="green">290</FONT>                // Solve UX = Y<a name="line.290"></a>
+<FONT color="green">291</FONT>                for (int col = m - 1; col &gt;= 0; col--) {<a name="line.291"></a>
+<FONT color="green">292</FONT>                    bp[col] /= lu[col][col];<a name="line.292"></a>
+<FONT color="green">293</FONT>                    final double bpCol = bp[col];<a name="line.293"></a>
+<FONT color="green">294</FONT>                    for (int i = 0; i &lt; col; i++) {<a name="line.294"></a>
+<FONT color="green">295</FONT>                        bp[i] -= bpCol * lu[i][col];<a name="line.295"></a>
+<FONT color="green">296</FONT>                    }<a name="line.296"></a>
+<FONT color="green">297</FONT>                }<a name="line.297"></a>
+<FONT color="green">298</FONT>    <a name="line.298"></a>
+<FONT color="green">299</FONT>                return bp;<a name="line.299"></a>
+<FONT color="green">300</FONT>    <a name="line.300"></a>
+<FONT color="green">301</FONT>            }<a name="line.301"></a>
+<FONT color="green">302</FONT>    <a name="line.302"></a>
+<FONT color="green">303</FONT>            /** {@inheritDoc} */<a name="line.303"></a>
+<FONT color="green">304</FONT>            public RealVector solve(RealVector b)<a name="line.304"></a>
+<FONT color="green">305</FONT>                throws IllegalArgumentException, InvalidMatrixException {<a name="line.305"></a>
+<FONT color="green">306</FONT>                try {<a name="line.306"></a>
+<FONT color="green">307</FONT>                    return solve((ArrayRealVector) b);<a name="line.307"></a>
+<FONT color="green">308</FONT>                } catch (ClassCastException cce) {<a name="line.308"></a>
+<FONT color="green">309</FONT>    <a name="line.309"></a>
+<FONT color="green">310</FONT>                    final int m = pivot.length;<a name="line.310"></a>
+<FONT color="green">311</FONT>                    if (b.getDimension() != m) {<a name="line.311"></a>
+<FONT color="green">312</FONT>                        throw MathRuntimeException.createIllegalArgumentException(<a name="line.312"></a>
+<FONT color="green">313</FONT>                                VECTOR_LENGTH_MISMATCH_MESSAGE, b.getDimension(), m);<a name="line.313"></a>
+<FONT color="green">314</FONT>                    }<a name="line.314"></a>
+<FONT color="green">315</FONT>                    if (singular) {<a name="line.315"></a>
+<FONT color="green">316</FONT>                        throw new SingularMatrixException();<a name="line.316"></a>
+<FONT color="green">317</FONT>                    }<a name="line.317"></a>
+<FONT color="green">318</FONT>    <a name="line.318"></a>
+<FONT color="green">319</FONT>                    final double[] bp = new double[m];<a name="line.319"></a>
+<FONT color="green">320</FONT>    <a name="line.320"></a>
+<FONT color="green">321</FONT>                    // Apply permutations to b<a name="line.321"></a>
+<FONT color="green">322</FONT>                    for (int row = 0; row &lt; m; row++) {<a name="line.322"></a>
+<FONT color="green">323</FONT>                        bp[row] = b.getEntry(pivot[row]);<a name="line.323"></a>
+<FONT color="green">324</FONT>                    }<a name="line.324"></a>
+<FONT color="green">325</FONT>    <a name="line.325"></a>
+<FONT color="green">326</FONT>                    // Solve LY = b<a name="line.326"></a>
+<FONT color="green">327</FONT>                    for (int col = 0; col &lt; m; col++) {<a name="line.327"></a>
+<FONT color="green">328</FONT>                        final double bpCol = bp[col];<a name="line.328"></a>
+<FONT color="green">329</FONT>                        for (int i = col + 1; i &lt; m; i++) {<a name="line.329"></a>
+<FONT color="green">330</FONT>                            bp[i] -= bpCol * lu[i][col];<a name="line.330"></a>
+<FONT color="green">331</FONT>                        }<a name="line.331"></a>
+<FONT color="green">332</FONT>                    }<a name="line.332"></a>
+<FONT color="green">333</FONT>    <a name="line.333"></a>
+<FONT color="green">334</FONT>                    // Solve UX = Y<a name="line.334"></a>
+<FONT color="green">335</FONT>                    for (int col = m - 1; col &gt;= 0; col--) {<a name="line.335"></a>
+<FONT color="green">336</FONT>                        bp[col] /= lu[col][col];<a name="line.336"></a>
+<FONT color="green">337</FONT>                        final double bpCol = bp[col];<a name="line.337"></a>
+<FONT color="green">338</FONT>                        for (int i = 0; i &lt; col; i++) {<a name="line.338"></a>
+<FONT color="green">339</FONT>                            bp[i] -= bpCol * lu[i][col];<a name="line.339"></a>
+<FONT color="green">340</FONT>                        }<a name="line.340"></a>
+<FONT color="green">341</FONT>                    }<a name="line.341"></a>
+<FONT color="green">342</FONT>    <a name="line.342"></a>
+<FONT color="green">343</FONT>                    return new ArrayRealVector(bp, false);<a name="line.343"></a>
+<FONT color="green">344</FONT>    <a name="line.344"></a>
+<FONT color="green">345</FONT>                }<a name="line.345"></a>
+<FONT color="green">346</FONT>            }<a name="line.346"></a>
+<FONT color="green">347</FONT>    <a name="line.347"></a>
+<FONT color="green">348</FONT>            /** Solve the linear equation A &amp;times; X = B.<a name="line.348"></a>
+<FONT color="green">349</FONT>             * &lt;p&gt;The A matrix is implicit here. It is &lt;/p&gt;<a name="line.349"></a>
+<FONT color="green">350</FONT>             * @param b right-hand side of the equation A &amp;times; X = B<a name="line.350"></a>
+<FONT color="green">351</FONT>             * @return a vector X such that A &amp;times; X = B<a name="line.351"></a>
+<FONT color="green">352</FONT>             * @exception IllegalArgumentException if matrices dimensions don't match<a name="line.352"></a>
+<FONT color="green">353</FONT>             * @exception InvalidMatrixException if decomposed matrix is singular<a name="line.353"></a>
+<FONT color="green">354</FONT>             */<a name="line.354"></a>
+<FONT color="green">355</FONT>            public ArrayRealVector solve(ArrayRealVector b)<a name="line.355"></a>
+<FONT color="green">356</FONT>                throws IllegalArgumentException, InvalidMatrixException {<a name="line.356"></a>
+<FONT color="green">357</FONT>                return new ArrayRealVector(solve(b.getDataRef()), false);<a name="line.357"></a>
+<FONT color="green">358</FONT>            }<a name="line.358"></a>
+<FONT color="green">359</FONT>    <a name="line.359"></a>
+<FONT color="green">360</FONT>            /** {@inheritDoc} */<a name="line.360"></a>
+<FONT color="green">361</FONT>            public RealMatrix solve(RealMatrix b)<a name="line.361"></a>
+<FONT color="green">362</FONT>                throws IllegalArgumentException, InvalidMatrixException {<a name="line.362"></a>
+<FONT color="green">363</FONT>    <a name="line.363"></a>
+<FONT color="green">364</FONT>                final int m = pivot.length;<a name="line.364"></a>
+<FONT color="green">365</FONT>                if (b.getRowDimension() != m) {<a name="line.365"></a>
+<FONT color="green">366</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.366"></a>
+<FONT color="green">367</FONT>                            "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.367"></a>
+<FONT color="green">368</FONT>                            b.getRowDimension(), b.getColumnDimension(), m, "n");<a name="line.368"></a>
+<FONT color="green">369</FONT>                }<a name="line.369"></a>
+<FONT color="green">370</FONT>                if (singular) {<a name="line.370"></a>
+<FONT color="green">371</FONT>                    throw new SingularMatrixException();<a name="line.371"></a>
+<FONT color="green">372</FONT>                }<a name="line.372"></a>
+<FONT color="green">373</FONT>    <a name="line.373"></a>
+<FONT color="green">374</FONT>                final int nColB = b.getColumnDimension();<a name="line.374"></a>
+<FONT color="green">375</FONT>    <a name="line.375"></a>
+<FONT color="green">376</FONT>                // Apply permutations to b<a name="line.376"></a>
+<FONT color="green">377</FONT>                final double[][] bp = new double[m][nColB];<a name="line.377"></a>
+<FONT color="green">378</FONT>                for (int row = 0; row &lt; m; row++) {<a name="line.378"></a>
+<FONT color="green">379</FONT>                    final double[] bpRow = bp[row];<a name="line.379"></a>
+<FONT color="green">380</FONT>                    final int pRow = pivot[row];<a name="line.380"></a>
+<FONT color="green">381</FONT>                    for (int col = 0; col &lt; nColB; col++) {<a name="line.381"></a>
+<FONT color="green">382</FONT>                        bpRow[col] = b.getEntry(pRow, col);<a name="line.382"></a>
+<FONT color="green">383</FONT>                    }<a name="line.383"></a>
+<FONT color="green">384</FONT>                }<a name="line.384"></a>
+<FONT color="green">385</FONT>    <a name="line.385"></a>
+<FONT color="green">386</FONT>                // Solve LY = b<a name="line.386"></a>
+<FONT color="green">387</FONT>                for (int col = 0; col &lt; m; col++) {<a name="line.387"></a>
+<FONT color="green">388</FONT>                    final double[] bpCol = bp[col];<a name="line.388"></a>
+<FONT color="green">389</FONT>                    for (int i = col + 1; i &lt; m; i++) {<a name="line.389"></a>
+<FONT color="green">390</FONT>                        final double[] bpI = bp[i];<a name="line.390"></a>
+<FONT color="green">391</FONT>                        final double luICol = lu[i][col];<a name="line.391"></a>
+<FONT color="green">392</FONT>                        for (int j = 0; j &lt; nColB; j++) {<a name="line.392"></a>
+<FONT color="green">393</FONT>                            bpI[j] -= bpCol[j] * luICol;<a name="line.393"></a>
+<FONT color="green">394</FONT>                        }<a name="line.394"></a>
+<FONT color="green">395</FONT>                    }<a name="line.395"></a>
+<FONT color="green">396</FONT>                }<a name="line.396"></a>
+<FONT color="green">397</FONT>    <a name="line.397"></a>
+<FONT color="green">398</FONT>                // Solve UX = Y<a name="line.398"></a>
+<FONT color="green">399</FONT>                for (int col = m - 1; col &gt;= 0; col--) {<a name="line.399"></a>
+<FONT color="green">400</FONT>                    final double[] bpCol = bp[col];<a name="line.400"></a>
+<FONT color="green">401</FONT>                    final double luDiag = lu[col][col];<a name="line.401"></a>
+<FONT color="green">402</FONT>                    for (int j = 0; j &lt; nColB; j++) {<a name="line.402"></a>
+<FONT color="green">403</FONT>                        bpCol[j] /= luDiag;<a name="line.403"></a>
+<FONT color="green">404</FONT>                    }<a name="line.404"></a>
+<FONT color="green">405</FONT>                    for (int i = 0; i &lt; col; i++) {<a name="line.405"></a>
+<FONT color="green">406</FONT>                        final double[] bpI = bp[i];<a name="line.406"></a>
+<FONT color="green">407</FONT>                        final double luICol = lu[i][col];<a name="line.407"></a>
+<FONT color="green">408</FONT>                        for (int j = 0; j &lt; nColB; j++) {<a name="line.408"></a>
+<FONT color="green">409</FONT>                            bpI[j] -= bpCol[j] * luICol;<a name="line.409"></a>
+<FONT color="green">410</FONT>                        }<a name="line.410"></a>
+<FONT color="green">411</FONT>                    }<a name="line.411"></a>
+<FONT color="green">412</FONT>                }<a name="line.412"></a>
+<FONT color="green">413</FONT>    <a name="line.413"></a>
+<FONT color="green">414</FONT>                return new Array2DRowRealMatrix(bp, false);<a name="line.414"></a>
+<FONT color="green">415</FONT>    <a name="line.415"></a>
+<FONT color="green">416</FONT>            }<a name="line.416"></a>
+<FONT color="green">417</FONT>    <a name="line.417"></a>
+<FONT color="green">418</FONT>            /** {@inheritDoc} */<a name="line.418"></a>
+<FONT color="green">419</FONT>            public RealMatrix getInverse() throws InvalidMatrixException {<a name="line.419"></a>
+<FONT color="green">420</FONT>                return solve(MatrixUtils.createRealIdentityMatrix(pivot.length));<a name="line.420"></a>
+<FONT color="green">421</FONT>            }<a name="line.421"></a>
+<FONT color="green">422</FONT>    <a name="line.422"></a>
+<FONT color="green">423</FONT>        }<a name="line.423"></a>
+<FONT color="green">424</FONT>    <a name="line.424"></a>
+<FONT color="green">425</FONT>    }<a name="line.425"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/MatrixIndexException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,107 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Thrown when an operation addresses a matrix coordinate (row, col)<a name="line.23"></a>
+<FONT color="green">024</FONT>     * which is outside of the dimensions of a matrix.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 746578 $ $Date: 2009-02-21 15:01:14 -0500 (Sat, 21 Feb 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public class MatrixIndexException extends MathRuntimeException {<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>        /** Serializable version identifier */<a name="line.29"></a>
+<FONT color="green">030</FONT>        private static final long serialVersionUID = -2382324504109300625L;<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /**<a name="line.32"></a>
+<FONT color="green">033</FONT>         * Constructs a new instance with specified formatted detail message.<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @param pattern format specifier<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @param arguments format arguments<a name="line.35"></a>
+<FONT color="green">036</FONT>         */<a name="line.36"></a>
+<FONT color="green">037</FONT>        public MatrixIndexException(final String pattern, final Object ... arguments) {<a name="line.37"></a>
+<FONT color="green">038</FONT>          super(pattern, arguments);<a name="line.38"></a>
+<FONT color="green">039</FONT>        }<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>    }<a name="line.41"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/MatrixUtils.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,1022 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.IOException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.io.ObjectInputStream;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.io.ObjectOutputStream;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.lang.reflect.Array;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import java.math.BigDecimal;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import java.util.Arrays;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.Field;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.FieldElement;<a name="line.28"></a>
+<FONT color="green">029</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.29"></a>
+<FONT color="green">030</FONT>    import org.apache.commons.math.fraction.BigFraction;<a name="line.30"></a>
+<FONT color="green">031</FONT>    import org.apache.commons.math.fraction.Fraction;<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>    /**<a name="line.33"></a>
+<FONT color="green">034</FONT>     * A collection of static methods that operate on or return matrices.<a name="line.34"></a>
+<FONT color="green">035</FONT>     *<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @version $Revision: 903046 $ $Date: 2010-01-25 21:07:26 -0500 (Mon, 25 Jan 2010) $<a name="line.36"></a>
+<FONT color="green">037</FONT>     */<a name="line.37"></a>
+<FONT color="green">038</FONT>    public class MatrixUtils {<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /**<a name="line.40"></a>
+<FONT color="green">041</FONT>         * Private constructor.<a name="line.41"></a>
+<FONT color="green">042</FONT>         */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private MatrixUtils() {<a name="line.43"></a>
+<FONT color="green">044</FONT>            super();<a name="line.44"></a>
+<FONT color="green">045</FONT>        }<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Returns a {@link RealMatrix} with specified dimensions.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * &lt;p&gt;The type of matrix returned depends on the dimension. Below<a name="line.49"></a>
+<FONT color="green">050</FONT>         * 2&lt;sup&gt;12&lt;/sup&gt; elements (i.e. 4096 elements or 64&amp;times;64 for a<a name="line.50"></a>
+<FONT color="green">051</FONT>         * square matrix) which can be stored in a 32kB array, a {@link<a name="line.51"></a>
+<FONT color="green">052</FONT>         * Array2DRowRealMatrix} instance is built. Above this threshold a {@link<a name="line.52"></a>
+<FONT color="green">053</FONT>         * BlockRealMatrix} instance is built.&lt;/p&gt;<a name="line.53"></a>
+<FONT color="green">054</FONT>         * &lt;p&gt;The matrix elements are all set to 0.0.&lt;/p&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param rows number of rows of the matrix<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param columns number of columns of the matrix<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @return  RealMatrix with specified dimensions<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @see #createRealMatrix(double[][])<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        public static RealMatrix createRealMatrix(final int rows, final int columns) {<a name="line.60"></a>
+<FONT color="green">061</FONT>            return (rows * columns &lt;= 4096) ?<a name="line.61"></a>
+<FONT color="green">062</FONT>                    new Array2DRowRealMatrix(rows, columns) : new BlockRealMatrix(rows, columns);<a name="line.62"></a>
+<FONT color="green">063</FONT>        }<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /**<a name="line.65"></a>
+<FONT color="green">066</FONT>         * Returns a {@link FieldMatrix} with specified dimensions.<a name="line.66"></a>
+<FONT color="green">067</FONT>         * &lt;p&gt;The type of matrix returned depends on the dimension. Below<a name="line.67"></a>
+<FONT color="green">068</FONT>         * 2&lt;sup&gt;12&lt;/sup&gt; elements (i.e. 4096 elements or 64&amp;times;64 for a<a name="line.68"></a>
+<FONT color="green">069</FONT>         * square matrix), a {@link FieldMatrix} instance is built. Above<a name="line.69"></a>
+<FONT color="green">070</FONT>         * this threshold a {@link BlockFieldMatrix} instance is built.&lt;/p&gt;<a name="line.70"></a>
+<FONT color="green">071</FONT>         * &lt;p&gt;The matrix elements are all set to field.getZero().&lt;/p&gt;<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param &lt;T&gt; the type of the field elements<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @param field field to which the matrix elements belong<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @param rows number of rows of the matrix<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @param columns number of columns of the matrix<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @return  FieldMatrix with specified dimensions<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @see #createFieldMatrix(FieldElement[][])<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @since 2.0<a name="line.78"></a>
+<FONT color="green">079</FONT>         */<a name="line.79"></a>
+<FONT color="green">080</FONT>        public static &lt;T extends FieldElement&lt;T&gt;&gt; FieldMatrix&lt;T&gt; createFieldMatrix(final Field&lt;T&gt; field,<a name="line.80"></a>
+<FONT color="green">081</FONT>                                                                                   final int rows,<a name="line.81"></a>
+<FONT color="green">082</FONT>                                                                                   final int columns) {<a name="line.82"></a>
+<FONT color="green">083</FONT>            return (rows * columns &lt;= 4096) ?<a name="line.83"></a>
+<FONT color="green">084</FONT>                    new Array2DRowFieldMatrix&lt;T&gt;(field, rows, columns) : new BlockFieldMatrix&lt;T&gt;(field, rows, columns);<a name="line.84"></a>
+<FONT color="green">085</FONT>        }<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>        /**<a name="line.87"></a>
+<FONT color="green">088</FONT>         * Returns a {@link RealMatrix} whose entries are the the values in the<a name="line.88"></a>
+<FONT color="green">089</FONT>         * the input array.<a name="line.89"></a>
+<FONT color="green">090</FONT>         * &lt;p&gt;The type of matrix returned depends on the dimension. Below<a name="line.90"></a>
+<FONT color="green">091</FONT>         * 2&lt;sup&gt;12&lt;/sup&gt; elements (i.e. 4096 elements or 64&amp;times;64 for a<a name="line.91"></a>
+<FONT color="green">092</FONT>         * square matrix) which can be stored in a 32kB array, a {@link<a name="line.92"></a>
+<FONT color="green">093</FONT>         * Array2DRowRealMatrix} instance is built. Above this threshold a {@link<a name="line.93"></a>
+<FONT color="green">094</FONT>         * BlockRealMatrix} instance is built.&lt;/p&gt;<a name="line.94"></a>
+<FONT color="green">095</FONT>         * &lt;p&gt;The input array is copied, not referenced.&lt;/p&gt;<a name="line.95"></a>
+<FONT color="green">096</FONT>         *<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @param data input array<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @return  RealMatrix containing the values of the array<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @throws IllegalArgumentException if &lt;code&gt;data&lt;/code&gt; is not rectangular<a name="line.99"></a>
+<FONT color="green">100</FONT>         *  (not all rows have the same length) or empty<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @throws NullPointerException if either &lt;code&gt;data&lt;/code&gt; or<a name="line.101"></a>
+<FONT color="green">102</FONT>         * &lt;code&gt;data[0]&lt;/code&gt; is null<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @see #createRealMatrix(int, int)<a name="line.103"></a>
+<FONT color="green">104</FONT>         */<a name="line.104"></a>
+<FONT color="green">105</FONT>        public static RealMatrix createRealMatrix(double[][] data) {<a name="line.105"></a>
+<FONT color="green">106</FONT>            return (data.length * data[0].length &lt;= 4096) ?<a name="line.106"></a>
+<FONT color="green">107</FONT>                    new Array2DRowRealMatrix(data) : new BlockRealMatrix(data);<a name="line.107"></a>
+<FONT color="green">108</FONT>        }<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>        /**<a name="line.110"></a>
+<FONT color="green">111</FONT>         * Returns a {@link FieldMatrix} whose entries are the the values in the<a name="line.111"></a>
+<FONT color="green">112</FONT>         * the input array.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * &lt;p&gt;The type of matrix returned depends on the dimension. Below<a name="line.113"></a>
+<FONT color="green">114</FONT>         * 2&lt;sup&gt;12&lt;/sup&gt; elements (i.e. 4096 elements or 64&amp;times;64 for a<a name="line.114"></a>
+<FONT color="green">115</FONT>         * square matrix), a {@link FieldMatrix} instance is built. Above<a name="line.115"></a>
+<FONT color="green">116</FONT>         * this threshold a {@link BlockFieldMatrix} instance is built.&lt;/p&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * &lt;p&gt;The input array is copied, not referenced.&lt;/p&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @param &lt;T&gt; the type of the field elements<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @param data input array<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @return  RealMatrix containing the values of the array<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @throws IllegalArgumentException if &lt;code&gt;data&lt;/code&gt; is not rectangular<a name="line.121"></a>
+<FONT color="green">122</FONT>         *  (not all rows have the same length) or empty<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @throws NullPointerException if either &lt;code&gt;data&lt;/code&gt; or<a name="line.123"></a>
+<FONT color="green">124</FONT>         * &lt;code&gt;data[0]&lt;/code&gt; is null<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @see #createFieldMatrix(Field, int, int)<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @since 2.0<a name="line.126"></a>
+<FONT color="green">127</FONT>         */<a name="line.127"></a>
+<FONT color="green">128</FONT>        public static &lt;T extends FieldElement&lt;T&gt;&gt; FieldMatrix&lt;T&gt; createFieldMatrix(T[][] data) {<a name="line.128"></a>
+<FONT color="green">129</FONT>            return (data.length * data[0].length &lt;= 4096) ?<a name="line.129"></a>
+<FONT color="green">130</FONT>                    new Array2DRowFieldMatrix&lt;T&gt;(data) : new BlockFieldMatrix&lt;T&gt;(data);<a name="line.130"></a>
+<FONT color="green">131</FONT>        }<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>        /**<a name="line.133"></a>
+<FONT color="green">134</FONT>         * Returns &lt;code&gt;dimension x dimension&lt;/code&gt; identity matrix.<a name="line.134"></a>
+<FONT color="green">135</FONT>         *<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @param dimension dimension of identity matrix to generate<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @return identity matrix<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @throws IllegalArgumentException if dimension is not positive<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @since 1.1<a name="line.139"></a>
+<FONT color="green">140</FONT>         */<a name="line.140"></a>
+<FONT color="green">141</FONT>        public static RealMatrix createRealIdentityMatrix(int dimension) {<a name="line.141"></a>
+<FONT color="green">142</FONT>            final RealMatrix m = createRealMatrix(dimension, dimension);<a name="line.142"></a>
+<FONT color="green">143</FONT>            for (int i = 0; i &lt; dimension; ++i) {<a name="line.143"></a>
+<FONT color="green">144</FONT>                m.setEntry(i, i, 1.0);<a name="line.144"></a>
+<FONT color="green">145</FONT>            }<a name="line.145"></a>
+<FONT color="green">146</FONT>            return m;<a name="line.146"></a>
+<FONT color="green">147</FONT>        }<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>        /**<a name="line.149"></a>
+<FONT color="green">150</FONT>         * Returns &lt;code&gt;dimension x dimension&lt;/code&gt; identity matrix.<a name="line.150"></a>
+<FONT color="green">151</FONT>         *<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @param &lt;T&gt; the type of the field elements<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @param field field to which the elements belong<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @param dimension dimension of identity matrix to generate<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @return identity matrix<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @throws IllegalArgumentException if dimension is not positive<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @since 2.0<a name="line.157"></a>
+<FONT color="green">158</FONT>         */<a name="line.158"></a>
+<FONT color="green">159</FONT>        public static &lt;T extends FieldElement&lt;T&gt;&gt; FieldMatrix&lt;T&gt;<a name="line.159"></a>
+<FONT color="green">160</FONT>            createFieldIdentityMatrix(final Field&lt;T&gt; field, final int dimension) {<a name="line.160"></a>
+<FONT color="green">161</FONT>            final T zero = field.getZero();<a name="line.161"></a>
+<FONT color="green">162</FONT>            final T one  = field.getOne();<a name="line.162"></a>
+<FONT color="green">163</FONT>            @SuppressWarnings("unchecked") // zero is type T<a name="line.163"></a>
+<FONT color="green">164</FONT>            final T[][] d = (T[][]) Array.newInstance(zero.getClass(), new int[] { dimension, dimension });<a name="line.164"></a>
+<FONT color="green">165</FONT>            for (int row = 0; row &lt; dimension; row++) {<a name="line.165"></a>
+<FONT color="green">166</FONT>                final T[] dRow = d[row];<a name="line.166"></a>
+<FONT color="green">167</FONT>                Arrays.fill(dRow, zero);<a name="line.167"></a>
+<FONT color="green">168</FONT>                dRow[row] = one;<a name="line.168"></a>
+<FONT color="green">169</FONT>            }<a name="line.169"></a>
+<FONT color="green">170</FONT>            return new Array2DRowFieldMatrix&lt;T&gt;(d, false);<a name="line.170"></a>
+<FONT color="green">171</FONT>        }<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>        /**<a name="line.173"></a>
+<FONT color="green">174</FONT>         * Returns &lt;code&gt;dimension x dimension&lt;/code&gt; identity matrix.<a name="line.174"></a>
+<FONT color="green">175</FONT>         *<a name="line.175"></a>
+<FONT color="green">176</FONT>         * @param dimension dimension of identity matrix to generate<a name="line.176"></a>
+<FONT color="green">177</FONT>         * @return identity matrix<a name="line.177"></a>
+<FONT color="green">178</FONT>         * @throws IllegalArgumentException if dimension is not positive<a name="line.178"></a>
+<FONT color="green">179</FONT>         * @since 1.1<a name="line.179"></a>
+<FONT color="green">180</FONT>         * @deprecated since 2.0, replaced by {@link #createFieldIdentityMatrix(Field, int)}<a name="line.180"></a>
+<FONT color="green">181</FONT>         */<a name="line.181"></a>
+<FONT color="green">182</FONT>        @Deprecated<a name="line.182"></a>
+<FONT color="green">183</FONT>        public static BigMatrix createBigIdentityMatrix(int dimension) {<a name="line.183"></a>
+<FONT color="green">184</FONT>            final BigDecimal[][] d = new BigDecimal[dimension][dimension];<a name="line.184"></a>
+<FONT color="green">185</FONT>            for (int row = 0; row &lt; dimension; row++) {<a name="line.185"></a>
+<FONT color="green">186</FONT>                final BigDecimal[] dRow = d[row];<a name="line.186"></a>
+<FONT color="green">187</FONT>                Arrays.fill(dRow, BigMatrixImpl.ZERO);<a name="line.187"></a>
+<FONT color="green">188</FONT>                dRow[row] = BigMatrixImpl.ONE;<a name="line.188"></a>
+<FONT color="green">189</FONT>            }<a name="line.189"></a>
+<FONT color="green">190</FONT>            return new BigMatrixImpl(d, false);<a name="line.190"></a>
+<FONT color="green">191</FONT>        }<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>        /**<a name="line.193"></a>
+<FONT color="green">194</FONT>         * Returns a diagonal matrix with specified elements.<a name="line.194"></a>
+<FONT color="green">195</FONT>         *<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @param diagonal diagonal elements of the matrix (the array elements<a name="line.196"></a>
+<FONT color="green">197</FONT>         * will be copied)<a name="line.197"></a>
+<FONT color="green">198</FONT>         * @return diagonal matrix<a name="line.198"></a>
+<FONT color="green">199</FONT>         * @since 2.0<a name="line.199"></a>
+<FONT color="green">200</FONT>         */<a name="line.200"></a>
+<FONT color="green">201</FONT>        public static RealMatrix createRealDiagonalMatrix(final double[] diagonal) {<a name="line.201"></a>
+<FONT color="green">202</FONT>            final RealMatrix m = createRealMatrix(diagonal.length, diagonal.length);<a name="line.202"></a>
+<FONT color="green">203</FONT>            for (int i = 0; i &lt; diagonal.length; ++i) {<a name="line.203"></a>
+<FONT color="green">204</FONT>                m.setEntry(i, i, diagonal[i]);<a name="line.204"></a>
+<FONT color="green">205</FONT>            }<a name="line.205"></a>
+<FONT color="green">206</FONT>            return m;<a name="line.206"></a>
+<FONT color="green">207</FONT>        }<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>        /**<a name="line.209"></a>
+<FONT color="green">210</FONT>         * Returns a diagonal matrix with specified elements.<a name="line.210"></a>
+<FONT color="green">211</FONT>         *<a name="line.211"></a>
+<FONT color="green">212</FONT>         * @param &lt;T&gt; the type of the field elements<a name="line.212"></a>
+<FONT color="green">213</FONT>         * @param diagonal diagonal elements of the matrix (the array elements<a name="line.213"></a>
+<FONT color="green">214</FONT>         * will be copied)<a name="line.214"></a>
+<FONT color="green">215</FONT>         * @return diagonal matrix<a name="line.215"></a>
+<FONT color="green">216</FONT>         * @since 2.0<a name="line.216"></a>
+<FONT color="green">217</FONT>         */<a name="line.217"></a>
+<FONT color="green">218</FONT>        public static &lt;T extends FieldElement&lt;T&gt;&gt; FieldMatrix&lt;T&gt;<a name="line.218"></a>
+<FONT color="green">219</FONT>            createFieldDiagonalMatrix(final T[] diagonal) {<a name="line.219"></a>
+<FONT color="green">220</FONT>            final FieldMatrix&lt;T&gt; m =<a name="line.220"></a>
+<FONT color="green">221</FONT>                createFieldMatrix(diagonal[0].getField(), diagonal.length, diagonal.length);<a name="line.221"></a>
+<FONT color="green">222</FONT>            for (int i = 0; i &lt; diagonal.length; ++i) {<a name="line.222"></a>
+<FONT color="green">223</FONT>                m.setEntry(i, i, diagonal[i]);<a name="line.223"></a>
+<FONT color="green">224</FONT>            }<a name="line.224"></a>
+<FONT color="green">225</FONT>            return m;<a name="line.225"></a>
+<FONT color="green">226</FONT>        }<a name="line.226"></a>
+<FONT color="green">227</FONT>    <a name="line.227"></a>
+<FONT color="green">228</FONT>        /**<a name="line.228"></a>
+<FONT color="green">229</FONT>         * Returns a {@link BigMatrix} whose entries are the the values in the<a name="line.229"></a>
+<FONT color="green">230</FONT>         * the input array.  The input array is copied, not referenced.<a name="line.230"></a>
+<FONT color="green">231</FONT>         *<a name="line.231"></a>
+<FONT color="green">232</FONT>         * @param data input array<a name="line.232"></a>
+<FONT color="green">233</FONT>         * @return  RealMatrix containing the values of the array<a name="line.233"></a>
+<FONT color="green">234</FONT>         * @throws IllegalArgumentException if &lt;code&gt;data&lt;/code&gt; is not rectangular<a name="line.234"></a>
+<FONT color="green">235</FONT>         *  (not all rows have the same length) or empty<a name="line.235"></a>
+<FONT color="green">236</FONT>         * @throws NullPointerException if data is null<a name="line.236"></a>
+<FONT color="green">237</FONT>         * @deprecated since 2.0 replaced by {@link #createFieldMatrix(FieldElement[][])}<a name="line.237"></a>
+<FONT color="green">238</FONT>         */<a name="line.238"></a>
+<FONT color="green">239</FONT>        @Deprecated<a name="line.239"></a>
+<FONT color="green">240</FONT>        public static BigMatrix createBigMatrix(double[][] data) {<a name="line.240"></a>
+<FONT color="green">241</FONT>            return new BigMatrixImpl(data);<a name="line.241"></a>
+<FONT color="green">242</FONT>        }<a name="line.242"></a>
+<FONT color="green">243</FONT>    <a name="line.243"></a>
+<FONT color="green">244</FONT>        /**<a name="line.244"></a>
+<FONT color="green">245</FONT>         * Returns a {@link BigMatrix} whose entries are the the values in the<a name="line.245"></a>
+<FONT color="green">246</FONT>         * the input array.  The input array is copied, not referenced.<a name="line.246"></a>
+<FONT color="green">247</FONT>         *<a name="line.247"></a>
+<FONT color="green">248</FONT>         * @param data input array<a name="line.248"></a>
+<FONT color="green">249</FONT>         * @return  RealMatrix containing the values of the array<a name="line.249"></a>
+<FONT color="green">250</FONT>         * @throws IllegalArgumentException if &lt;code&gt;data&lt;/code&gt; is not rectangular<a name="line.250"></a>
+<FONT color="green">251</FONT>         *  (not all rows have the same length) or empty<a name="line.251"></a>
+<FONT color="green">252</FONT>         * @throws NullPointerException if data is null<a name="line.252"></a>
+<FONT color="green">253</FONT>         * @deprecated since 2.0 replaced by {@link #createFieldMatrix(FieldElement[][])}<a name="line.253"></a>
+<FONT color="green">254</FONT>         */<a name="line.254"></a>
+<FONT color="green">255</FONT>        @Deprecated<a name="line.255"></a>
+<FONT color="green">256</FONT>        public static BigMatrix createBigMatrix(BigDecimal[][] data) {<a name="line.256"></a>
+<FONT color="green">257</FONT>            return new BigMatrixImpl(data);<a name="line.257"></a>
+<FONT color="green">258</FONT>        }<a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>        /**<a name="line.260"></a>
+<FONT color="green">261</FONT>         * Returns a {@link BigMatrix} whose entries are the the values in the<a name="line.261"></a>
+<FONT color="green">262</FONT>         * the input array.<a name="line.262"></a>
+<FONT color="green">263</FONT>         * &lt;p&gt;If an array is built specially in order to be embedded in a<a name="line.263"></a>
+<FONT color="green">264</FONT>         * BigMatrix and not used directly, the &lt;code&gt;copyArray&lt;/code&gt; may be<a name="line.264"></a>
+<FONT color="green">265</FONT>         * set to &lt;code&gt;false&lt;/code. This will prevent the copying and improve<a name="line.265"></a>
+<FONT color="green">266</FONT>         * performance as no new array will be built and no data will be copied.&lt;/p&gt;<a name="line.266"></a>
+<FONT color="green">267</FONT>         * @param data data for new matrix<a name="line.267"></a>
+<FONT color="green">268</FONT>         * @param copyArray if true, the input array will be copied, otherwise<a name="line.268"></a>
+<FONT color="green">269</FONT>         * it will be referenced<a name="line.269"></a>
+<FONT color="green">270</FONT>         * @return  BigMatrix containing the values of the array<a name="line.270"></a>
+<FONT color="green">271</FONT>         * @throws IllegalArgumentException if &lt;code&gt;data&lt;/code&gt; is not rectangular<a name="line.271"></a>
+<FONT color="green">272</FONT>         *  (not all rows have the same length) or empty<a name="line.272"></a>
+<FONT color="green">273</FONT>         * @throws NullPointerException if &lt;code&gt;data&lt;/code&gt; is null<a name="line.273"></a>
+<FONT color="green">274</FONT>         * @see #createRealMatrix(double[][])<a name="line.274"></a>
+<FONT color="green">275</FONT>         * @deprecated since 2.0 replaced by {@link #createFieldMatrix(FieldElement[][])}<a name="line.275"></a>
+<FONT color="green">276</FONT>         */<a name="line.276"></a>
+<FONT color="green">277</FONT>        @Deprecated<a name="line.277"></a>
+<FONT color="green">278</FONT>        public static BigMatrix createBigMatrix(BigDecimal[][] data, boolean copyArray) {<a name="line.278"></a>
+<FONT color="green">279</FONT>            return new BigMatrixImpl(data, copyArray);<a name="line.279"></a>
+<FONT color="green">280</FONT>        }<a name="line.280"></a>
+<FONT color="green">281</FONT>    <a name="line.281"></a>
+<FONT color="green">282</FONT>        /**<a name="line.282"></a>
+<FONT color="green">283</FONT>         * Returns a {@link BigMatrix} whose entries are the the values in the<a name="line.283"></a>
+<FONT color="green">284</FONT>         * the input array.  The input array is copied, not referenced.<a name="line.284"></a>
+<FONT color="green">285</FONT>         *<a name="line.285"></a>
+<FONT color="green">286</FONT>         * @param data input array<a name="line.286"></a>
+<FONT color="green">287</FONT>         * @return  RealMatrix containing the values of the array<a name="line.287"></a>
+<FONT color="green">288</FONT>         * @throws IllegalArgumentException if &lt;code&gt;data&lt;/code&gt; is not rectangular<a name="line.288"></a>
+<FONT color="green">289</FONT>         *  (not all rows have the same length) or empty<a name="line.289"></a>
+<FONT color="green">290</FONT>         * @throws NullPointerException if data is null<a name="line.290"></a>
+<FONT color="green">291</FONT>         * @deprecated since 2.0 replaced by {@link #createFieldMatrix(FieldElement[][])}<a name="line.291"></a>
+<FONT color="green">292</FONT>         */<a name="line.292"></a>
+<FONT color="green">293</FONT>        @Deprecated<a name="line.293"></a>
+<FONT color="green">294</FONT>        public static BigMatrix createBigMatrix(String[][] data) {<a name="line.294"></a>
+<FONT color="green">295</FONT>            return new BigMatrixImpl(data);<a name="line.295"></a>
+<FONT color="green">296</FONT>        }<a name="line.296"></a>
+<FONT color="green">297</FONT>    <a name="line.297"></a>
+<FONT color="green">298</FONT>        /**<a name="line.298"></a>
+<FONT color="green">299</FONT>         * Creates a {@link RealVector} using the data from the input array.<a name="line.299"></a>
+<FONT color="green">300</FONT>         *<a name="line.300"></a>
+<FONT color="green">301</FONT>         * @param data the input data<a name="line.301"></a>
+<FONT color="green">302</FONT>         * @return a data.length RealVector<a name="line.302"></a>
+<FONT color="green">303</FONT>         * @throws IllegalArgumentException if &lt;code&gt;data&lt;/code&gt; is empty<a name="line.303"></a>
+<FONT color="green">304</FONT>         * @throws NullPointerException if &lt;code&gt;data&lt;/code&gt;is null<a name="line.304"></a>
+<FONT color="green">305</FONT>         */<a name="line.305"></a>
+<FONT color="green">306</FONT>        public static RealVector createRealVector(double[] data) {<a name="line.306"></a>
+<FONT color="green">307</FONT>            return new ArrayRealVector(data, true);<a name="line.307"></a>
+<FONT color="green">308</FONT>        }<a name="line.308"></a>
+<FONT color="green">309</FONT>    <a name="line.309"></a>
+<FONT color="green">310</FONT>        /**<a name="line.310"></a>
+<FONT color="green">311</FONT>         * Creates a {@link FieldVector} using the data from the input array.<a name="line.311"></a>
+<FONT color="green">312</FONT>         *<a name="line.312"></a>
+<FONT color="green">313</FONT>         * @param &lt;T&gt; the type of the field elements<a name="line.313"></a>
+<FONT color="green">314</FONT>         * @param data the input data<a name="line.314"></a>
+<FONT color="green">315</FONT>         * @return a data.length FieldVector<a name="line.315"></a>
+<FONT color="green">316</FONT>         * @throws IllegalArgumentException if &lt;code&gt;data&lt;/code&gt; is empty<a name="line.316"></a>
+<FONT color="green">317</FONT>         * @throws NullPointerException if &lt;code&gt;data&lt;/code&gt;is null<a name="line.317"></a>
+<FONT color="green">318</FONT>         */<a name="line.318"></a>
+<FONT color="green">319</FONT>        public static &lt;T extends FieldElement&lt;T&gt;&gt; FieldVector&lt;T&gt; createFieldVector(final T[] data) {<a name="line.319"></a>
+<FONT color="green">320</FONT>            return new ArrayFieldVector&lt;T&gt;(data, true);<a name="line.320"></a>
+<FONT color="green">321</FONT>        }<a name="line.321"></a>
+<FONT color="green">322</FONT>    <a name="line.322"></a>
+<FONT color="green">323</FONT>        /**<a name="line.323"></a>
+<FONT color="green">324</FONT>         * Creates a row {@link RealMatrix} using the data from the input<a name="line.324"></a>
+<FONT color="green">325</FONT>         * array.<a name="line.325"></a>
+<FONT color="green">326</FONT>         *<a name="line.326"></a>
+<FONT color="green">327</FONT>         * @param rowData the input row data<a name="line.327"></a>
+<FONT color="green">328</FONT>         * @return a 1 x rowData.length RealMatrix<a name="line.328"></a>
+<FONT color="green">329</FONT>         * @throws IllegalArgumentException if &lt;code&gt;rowData&lt;/code&gt; is empty<a name="line.329"></a>
+<FONT color="green">330</FONT>         * @throws NullPointerException if &lt;code&gt;rowData&lt;/code&gt;is null<a name="line.330"></a>
+<FONT color="green">331</FONT>         */<a name="line.331"></a>
+<FONT color="green">332</FONT>        public static RealMatrix createRowRealMatrix(double[] rowData) {<a name="line.332"></a>
+<FONT color="green">333</FONT>            final int nCols = rowData.length;<a name="line.333"></a>
+<FONT color="green">334</FONT>            final RealMatrix m = createRealMatrix(1, nCols);<a name="line.334"></a>
+<FONT color="green">335</FONT>            for (int i = 0; i &lt; nCols; ++i) {<a name="line.335"></a>
+<FONT color="green">336</FONT>                m.setEntry(0, i, rowData[i]);<a name="line.336"></a>
+<FONT color="green">337</FONT>            }<a name="line.337"></a>
+<FONT color="green">338</FONT>            return m;<a name="line.338"></a>
+<FONT color="green">339</FONT>        }<a name="line.339"></a>
+<FONT color="green">340</FONT>    <a name="line.340"></a>
+<FONT color="green">341</FONT>        /**<a name="line.341"></a>
+<FONT color="green">342</FONT>         * Creates a row {@link FieldMatrix} using the data from the input<a name="line.342"></a>
+<FONT color="green">343</FONT>         * array.<a name="line.343"></a>
+<FONT color="green">344</FONT>         *<a name="line.344"></a>
+<FONT color="green">345</FONT>         * @param &lt;T&gt; the type of the field elements<a name="line.345"></a>
+<FONT color="green">346</FONT>         * @param rowData the input row data<a name="line.346"></a>
+<FONT color="green">347</FONT>         * @return a 1 x rowData.length FieldMatrix<a name="line.347"></a>
+<FONT color="green">348</FONT>         * @throws IllegalArgumentException if &lt;code&gt;rowData&lt;/code&gt; is empty<a name="line.348"></a>
+<FONT color="green">349</FONT>         * @throws NullPointerException if &lt;code&gt;rowData&lt;/code&gt;is null<a name="line.349"></a>
+<FONT color="green">350</FONT>         */<a name="line.350"></a>
+<FONT color="green">351</FONT>        public static &lt;T extends FieldElement&lt;T&gt;&gt; FieldMatrix&lt;T&gt;<a name="line.351"></a>
+<FONT color="green">352</FONT>            createRowFieldMatrix(final T[] rowData) {<a name="line.352"></a>
+<FONT color="green">353</FONT>            final int nCols = rowData.length;<a name="line.353"></a>
+<FONT color="green">354</FONT>            if (nCols == 0) {<a name="line.354"></a>
+<FONT color="green">355</FONT>                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");<a name="line.355"></a>
+<FONT color="green">356</FONT>            }<a name="line.356"></a>
+<FONT color="green">357</FONT>            final FieldMatrix&lt;T&gt; m = createFieldMatrix(rowData[0].getField(), 1, nCols);<a name="line.357"></a>
+<FONT color="green">358</FONT>            for (int i = 0; i &lt; nCols; ++i) {<a name="line.358"></a>
+<FONT color="green">359</FONT>                m.setEntry(0, i, rowData[i]);<a name="line.359"></a>
+<FONT color="green">360</FONT>            }<a name="line.360"></a>
+<FONT color="green">361</FONT>            return m;<a name="line.361"></a>
+<FONT color="green">362</FONT>        }<a name="line.362"></a>
+<FONT color="green">363</FONT>    <a name="line.363"></a>
+<FONT color="green">364</FONT>        /**<a name="line.364"></a>
+<FONT color="green">365</FONT>         * Creates a row {@link BigMatrix} using the data from the input<a name="line.365"></a>
+<FONT color="green">366</FONT>         * array.<a name="line.366"></a>
+<FONT color="green">367</FONT>         *<a name="line.367"></a>
+<FONT color="green">368</FONT>         * @param rowData the input row data<a name="line.368"></a>
+<FONT color="green">369</FONT>         * @return a 1 x rowData.length BigMatrix<a name="line.369"></a>
+<FONT color="green">370</FONT>         * @throws IllegalArgumentException if &lt;code&gt;rowData&lt;/code&gt; is empty<a name="line.370"></a>
+<FONT color="green">371</FONT>         * @throws NullPointerException if &lt;code&gt;rowData&lt;/code&gt;is null<a name="line.371"></a>
+<FONT color="green">372</FONT>         * @deprecated since 2.0 replaced by {@link #createRowFieldMatrix(FieldElement[])}<a name="line.372"></a>
+<FONT color="green">373</FONT>         */<a name="line.373"></a>
+<FONT color="green">374</FONT>        @Deprecated<a name="line.374"></a>
+<FONT color="green">375</FONT>        public static BigMatrix createRowBigMatrix(double[] rowData) {<a name="line.375"></a>
+<FONT color="green">376</FONT>            final int nCols = rowData.length;<a name="line.376"></a>
+<FONT color="green">377</FONT>            final BigDecimal[][] data = new BigDecimal[1][nCols];<a name="line.377"></a>
+<FONT color="green">378</FONT>            for (int i = 0; i &lt; nCols; ++i) {<a name="line.378"></a>
+<FONT color="green">379</FONT>                data[0][i] = new BigDecimal(rowData[i]);<a name="line.379"></a>
+<FONT color="green">380</FONT>            }<a name="line.380"></a>
+<FONT color="green">381</FONT>            return new BigMatrixImpl(data, false);<a name="line.381"></a>
+<FONT color="green">382</FONT>        }<a name="line.382"></a>
+<FONT color="green">383</FONT>    <a name="line.383"></a>
+<FONT color="green">384</FONT>        /**<a name="line.384"></a>
+<FONT color="green">385</FONT>         * Creates a row {@link BigMatrix} using the data from the input<a name="line.385"></a>
+<FONT color="green">386</FONT>         * array.<a name="line.386"></a>
+<FONT color="green">387</FONT>         *<a name="line.387"></a>
+<FONT color="green">388</FONT>         * @param rowData the input row data<a name="line.388"></a>
+<FONT color="green">389</FONT>         * @return a 1 x rowData.length BigMatrix<a name="line.389"></a>
+<FONT color="green">390</FONT>         * @throws IllegalArgumentException if &lt;code&gt;rowData&lt;/code&gt; is empty<a name="line.390"></a>
+<FONT color="green">391</FONT>         * @throws NullPointerException if &lt;code&gt;rowData&lt;/code&gt;is null<a name="line.391"></a>
+<FONT color="green">392</FONT>         * @deprecated since 2.0 replaced by {@link #createRowFieldMatrix(FieldElement[])}<a name="line.392"></a>
+<FONT color="green">393</FONT>         */<a name="line.393"></a>
+<FONT color="green">394</FONT>        @Deprecated<a name="line.394"></a>
+<FONT color="green">395</FONT>        public static BigMatrix createRowBigMatrix(BigDecimal[] rowData) {<a name="line.395"></a>
+<FONT color="green">396</FONT>            final int nCols = rowData.length;<a name="line.396"></a>
+<FONT color="green">397</FONT>            final BigDecimal[][] data = new BigDecimal[1][nCols];<a name="line.397"></a>
+<FONT color="green">398</FONT>            System.arraycopy(rowData, 0, data[0], 0, nCols);<a name="line.398"></a>
+<FONT color="green">399</FONT>            return new BigMatrixImpl(data, false);<a name="line.399"></a>
+<FONT color="green">400</FONT>        }<a name="line.400"></a>
+<FONT color="green">401</FONT>    <a name="line.401"></a>
+<FONT color="green">402</FONT>        /**<a name="line.402"></a>
+<FONT color="green">403</FONT>         * Creates a row {@link BigMatrix} using the data from the input<a name="line.403"></a>
+<FONT color="green">404</FONT>         * array.<a name="line.404"></a>
+<FONT color="green">405</FONT>         *<a name="line.405"></a>
+<FONT color="green">406</FONT>         * @param rowData the input row data<a name="line.406"></a>
+<FONT color="green">407</FONT>         * @return a 1 x rowData.length BigMatrix<a name="line.407"></a>
+<FONT color="green">408</FONT>         * @throws IllegalArgumentException if &lt;code&gt;rowData&lt;/code&gt; is empty<a name="line.408"></a>
+<FONT color="green">409</FONT>         * @throws NullPointerException if &lt;code&gt;rowData&lt;/code&gt;is null<a name="line.409"></a>
+<FONT color="green">410</FONT>         * @deprecated since 2.0 replaced by {@link #createRowFieldMatrix(FieldElement[])}<a name="line.410"></a>
+<FONT color="green">411</FONT>         */<a name="line.411"></a>
+<FONT color="green">412</FONT>        @Deprecated<a name="line.412"></a>
+<FONT color="green">413</FONT>        public static BigMatrix createRowBigMatrix(String[] rowData) {<a name="line.413"></a>
+<FONT color="green">414</FONT>            final int nCols = rowData.length;<a name="line.414"></a>
+<FONT color="green">415</FONT>            final BigDecimal[][] data = new BigDecimal[1][nCols];<a name="line.415"></a>
+<FONT color="green">416</FONT>            for (int i = 0; i &lt; nCols; ++i) {<a name="line.416"></a>
+<FONT color="green">417</FONT>                data[0][i] = new BigDecimal(rowData[i]);<a name="line.417"></a>
+<FONT color="green">418</FONT>            }<a name="line.418"></a>
+<FONT color="green">419</FONT>            return new BigMatrixImpl(data, false);<a name="line.419"></a>
+<FONT color="green">420</FONT>        }<a name="line.420"></a>
+<FONT color="green">421</FONT>    <a name="line.421"></a>
+<FONT color="green">422</FONT>        /**<a name="line.422"></a>
+<FONT color="green">423</FONT>         * Creates a column {@link RealMatrix} using the data from the input<a name="line.423"></a>
+<FONT color="green">424</FONT>         * array.<a name="line.424"></a>
+<FONT color="green">425</FONT>         *<a name="line.425"></a>
+<FONT color="green">426</FONT>         * @param columnData  the input column data<a name="line.426"></a>
+<FONT color="green">427</FONT>         * @return a columnData x 1 RealMatrix<a name="line.427"></a>
+<FONT color="green">428</FONT>         * @throws IllegalArgumentException if &lt;code&gt;columnData&lt;/code&gt; is empty<a name="line.428"></a>
+<FONT color="green">429</FONT>         * @throws NullPointerException if &lt;code&gt;columnData&lt;/code&gt;is null<a name="line.429"></a>
+<FONT color="green">430</FONT>         */<a name="line.430"></a>
+<FONT color="green">431</FONT>        public static RealMatrix createColumnRealMatrix(double[] columnData) {<a name="line.431"></a>
+<FONT color="green">432</FONT>            final int nRows = columnData.length;<a name="line.432"></a>
+<FONT color="green">433</FONT>            final RealMatrix m = createRealMatrix(nRows, 1);<a name="line.433"></a>
+<FONT color="green">434</FONT>            for (int i = 0; i &lt; nRows; ++i) {<a name="line.434"></a>
+<FONT color="green">435</FONT>                m.setEntry(i, 0, columnData[i]);<a name="line.435"></a>
+<FONT color="green">436</FONT>            }<a name="line.436"></a>
+<FONT color="green">437</FONT>            return m;<a name="line.437"></a>
+<FONT color="green">438</FONT>        }<a name="line.438"></a>
+<FONT color="green">439</FONT>    <a name="line.439"></a>
+<FONT color="green">440</FONT>        /**<a name="line.440"></a>
+<FONT color="green">441</FONT>         * Creates a column {@link FieldMatrix} using the data from the input<a name="line.441"></a>
+<FONT color="green">442</FONT>         * array.<a name="line.442"></a>
+<FONT color="green">443</FONT>         *<a name="line.443"></a>
+<FONT color="green">444</FONT>         * @param &lt;T&gt; the type of the field elements<a name="line.444"></a>
+<FONT color="green">445</FONT>         * @param columnData  the input column data<a name="line.445"></a>
+<FONT color="green">446</FONT>         * @return a columnData x 1 FieldMatrix<a name="line.446"></a>
+<FONT color="green">447</FONT>         * @throws IllegalArgumentException if &lt;code&gt;columnData&lt;/code&gt; is empty<a name="line.447"></a>
+<FONT color="green">448</FONT>         * @throws NullPointerException if &lt;code&gt;columnData&lt;/code&gt;is null<a name="line.448"></a>
+<FONT color="green">449</FONT>         */<a name="line.449"></a>
+<FONT color="green">450</FONT>        public static &lt;T extends FieldElement&lt;T&gt;&gt; FieldMatrix&lt;T&gt;<a name="line.450"></a>
+<FONT color="green">451</FONT>            createColumnFieldMatrix(final T[] columnData) {<a name="line.451"></a>
+<FONT color="green">452</FONT>            final int nRows = columnData.length;<a name="line.452"></a>
+<FONT color="green">453</FONT>            if (nRows == 0) {<a name="line.453"></a>
+<FONT color="green">454</FONT>                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");<a name="line.454"></a>
+<FONT color="green">455</FONT>            }<a name="line.455"></a>
+<FONT color="green">456</FONT>            final FieldMatrix&lt;T&gt; m = createFieldMatrix(columnData[0].getField(), nRows, 1);<a name="line.456"></a>
+<FONT color="green">457</FONT>            for (int i = 0; i &lt; nRows; ++i) {<a name="line.457"></a>
+<FONT color="green">458</FONT>                m.setEntry(i, 0, columnData[i]);<a name="line.458"></a>
+<FONT color="green">459</FONT>            }<a name="line.459"></a>
+<FONT color="green">460</FONT>            return m;<a name="line.460"></a>
+<FONT color="green">461</FONT>        }<a name="line.461"></a>
+<FONT color="green">462</FONT>    <a name="line.462"></a>
+<FONT color="green">463</FONT>        /**<a name="line.463"></a>
+<FONT color="green">464</FONT>         * Creates a column {@link BigMatrix} using the data from the input<a name="line.464"></a>
+<FONT color="green">465</FONT>         * array.<a name="line.465"></a>
+<FONT color="green">466</FONT>         *<a name="line.466"></a>
+<FONT color="green">467</FONT>         * @param columnData  the input column data<a name="line.467"></a>
+<FONT color="green">468</FONT>         * @return a columnData x 1 BigMatrix<a name="line.468"></a>
+<FONT color="green">469</FONT>         * @throws IllegalArgumentException if &lt;code&gt;columnData&lt;/code&gt; is empty<a name="line.469"></a>
+<FONT color="green">470</FONT>         * @throws NullPointerException if &lt;code&gt;columnData&lt;/code&gt;is null<a name="line.470"></a>
+<FONT color="green">471</FONT>         * @deprecated since 2.0 replaced by {@link #createColumnFieldMatrix(FieldElement[])}<a name="line.471"></a>
+<FONT color="green">472</FONT>         */<a name="line.472"></a>
+<FONT color="green">473</FONT>        @Deprecated<a name="line.473"></a>
+<FONT color="green">474</FONT>        public static BigMatrix createColumnBigMatrix(double[] columnData) {<a name="line.474"></a>
+<FONT color="green">475</FONT>            final int nRows = columnData.length;<a name="line.475"></a>
+<FONT color="green">476</FONT>            final BigDecimal[][] data = new BigDecimal[nRows][1];<a name="line.476"></a>
+<FONT color="green">477</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.477"></a>
+<FONT color="green">478</FONT>                data[row][0] = new BigDecimal(columnData[row]);<a name="line.478"></a>
+<FONT color="green">479</FONT>            }<a name="line.479"></a>
+<FONT color="green">480</FONT>            return new BigMatrixImpl(data, false);<a name="line.480"></a>
+<FONT color="green">481</FONT>        }<a name="line.481"></a>
+<FONT color="green">482</FONT>    <a name="line.482"></a>
+<FONT color="green">483</FONT>        /**<a name="line.483"></a>
+<FONT color="green">484</FONT>         * Creates a column {@link BigMatrix} using the data from the input<a name="line.484"></a>
+<FONT color="green">485</FONT>         * array.<a name="line.485"></a>
+<FONT color="green">486</FONT>         *<a name="line.486"></a>
+<FONT color="green">487</FONT>         * @param columnData  the input column data<a name="line.487"></a>
+<FONT color="green">488</FONT>         * @return a columnData x 1 BigMatrix<a name="line.488"></a>
+<FONT color="green">489</FONT>         * @throws IllegalArgumentException if &lt;code&gt;columnData&lt;/code&gt; is empty<a name="line.489"></a>
+<FONT color="green">490</FONT>         * @throws NullPointerException if &lt;code&gt;columnData&lt;/code&gt;is null<a name="line.490"></a>
+<FONT color="green">491</FONT>         * @deprecated since 2.0 replaced by {@link #createColumnFieldMatrix(FieldElement[])}<a name="line.491"></a>
+<FONT color="green">492</FONT>         */<a name="line.492"></a>
+<FONT color="green">493</FONT>        @Deprecated<a name="line.493"></a>
+<FONT color="green">494</FONT>        public static BigMatrix createColumnBigMatrix(BigDecimal[] columnData) {<a name="line.494"></a>
+<FONT color="green">495</FONT>            final int nRows = columnData.length;<a name="line.495"></a>
+<FONT color="green">496</FONT>            final BigDecimal[][] data = new BigDecimal[nRows][1];<a name="line.496"></a>
+<FONT color="green">497</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.497"></a>
+<FONT color="green">498</FONT>                data[row][0] = columnData[row];<a name="line.498"></a>
+<FONT color="green">499</FONT>            }<a name="line.499"></a>
+<FONT color="green">500</FONT>            return new BigMatrixImpl(data, false);<a name="line.500"></a>
+<FONT color="green">501</FONT>        }<a name="line.501"></a>
+<FONT color="green">502</FONT>    <a name="line.502"></a>
+<FONT color="green">503</FONT>        /**<a name="line.503"></a>
+<FONT color="green">504</FONT>         * Creates a column {@link BigMatrix} using the data from the input<a name="line.504"></a>
+<FONT color="green">505</FONT>         * array.<a name="line.505"></a>
+<FONT color="green">506</FONT>         *<a name="line.506"></a>
+<FONT color="green">507</FONT>         * @param columnData  the input column data<a name="line.507"></a>
+<FONT color="green">508</FONT>         * @return a columnData x 1 BigMatrix<a name="line.508"></a>
+<FONT color="green">509</FONT>         * @throws IllegalArgumentException if &lt;code&gt;columnData&lt;/code&gt; is empty<a name="line.509"></a>
+<FONT color="green">510</FONT>         * @throws NullPointerException if &lt;code&gt;columnData&lt;/code&gt;is null<a name="line.510"></a>
+<FONT color="green">511</FONT>         * @deprecated since 2.0 replaced by {@link #createColumnFieldMatrix(FieldElement[])}<a name="line.511"></a>
+<FONT color="green">512</FONT>         */<a name="line.512"></a>
+<FONT color="green">513</FONT>        @Deprecated<a name="line.513"></a>
+<FONT color="green">514</FONT>        public static BigMatrix createColumnBigMatrix(String[] columnData) {<a name="line.514"></a>
+<FONT color="green">515</FONT>            int nRows = columnData.length;<a name="line.515"></a>
+<FONT color="green">516</FONT>            final BigDecimal[][] data = new BigDecimal[nRows][1];<a name="line.516"></a>
+<FONT color="green">517</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.517"></a>
+<FONT color="green">518</FONT>                data[row][0] = new BigDecimal(columnData[row]);<a name="line.518"></a>
+<FONT color="green">519</FONT>            }<a name="line.519"></a>
+<FONT color="green">520</FONT>            return new BigMatrixImpl(data, false);<a name="line.520"></a>
+<FONT color="green">521</FONT>        }<a name="line.521"></a>
+<FONT color="green">522</FONT>    <a name="line.522"></a>
+<FONT color="green">523</FONT>        /**<a name="line.523"></a>
+<FONT color="green">524</FONT>         * Check if a row index is valid.<a name="line.524"></a>
+<FONT color="green">525</FONT>         * @param m matrix containing the submatrix<a name="line.525"></a>
+<FONT color="green">526</FONT>         * @param row row index to check<a name="line.526"></a>
+<FONT color="green">527</FONT>         * @exception MatrixIndexException if index is not valid<a name="line.527"></a>
+<FONT color="green">528</FONT>         */<a name="line.528"></a>
+<FONT color="green">529</FONT>        public static void checkRowIndex(final AnyMatrix m, final int row) {<a name="line.529"></a>
+<FONT color="green">530</FONT>            if (row &lt; 0 || row &gt;= m.getRowDimension()) {<a name="line.530"></a>
+<FONT color="green">531</FONT>                throw new MatrixIndexException("row index {0} out of allowed range [{1}, {2}]",<a name="line.531"></a>
+<FONT color="green">532</FONT>                                               row, 0, m.getRowDimension() - 1);<a name="line.532"></a>
+<FONT color="green">533</FONT>            }<a name="line.533"></a>
+<FONT color="green">534</FONT>        }<a name="line.534"></a>
+<FONT color="green">535</FONT>    <a name="line.535"></a>
+<FONT color="green">536</FONT>        /**<a name="line.536"></a>
+<FONT color="green">537</FONT>         * Check if a column index is valid.<a name="line.537"></a>
+<FONT color="green">538</FONT>         * @param m matrix containing the submatrix<a name="line.538"></a>
+<FONT color="green">539</FONT>         * @param column column index to check<a name="line.539"></a>
+<FONT color="green">540</FONT>         * @exception MatrixIndexException if index is not valid<a name="line.540"></a>
+<FONT color="green">541</FONT>         */<a name="line.541"></a>
+<FONT color="green">542</FONT>        public static void checkColumnIndex(final AnyMatrix m, final int column)<a name="line.542"></a>
+<FONT color="green">543</FONT>            throws MatrixIndexException {<a name="line.543"></a>
+<FONT color="green">544</FONT>            if (column &lt; 0 || column &gt;= m.getColumnDimension()) {<a name="line.544"></a>
+<FONT color="green">545</FONT>                throw new MatrixIndexException("column index {0} out of allowed range [{1}, {2}]",<a name="line.545"></a>
+<FONT color="green">546</FONT>                                               column, 0, m.getColumnDimension() - 1);<a name="line.546"></a>
+<FONT color="green">547</FONT>            }<a name="line.547"></a>
+<FONT color="green">548</FONT>        }<a name="line.548"></a>
+<FONT color="green">549</FONT>    <a name="line.549"></a>
+<FONT color="green">550</FONT>        /**<a name="line.550"></a>
+<FONT color="green">551</FONT>         * Check if submatrix ranges indices are valid.<a name="line.551"></a>
+<FONT color="green">552</FONT>         * Rows and columns are indicated counting from 0 to n-1.<a name="line.552"></a>
+<FONT color="green">553</FONT>         *<a name="line.553"></a>
+<FONT color="green">554</FONT>         * @param m matrix containing the submatrix<a name="line.554"></a>
+<FONT color="green">555</FONT>         * @param startRow Initial row index<a name="line.555"></a>
+<FONT color="green">556</FONT>         * @param endRow Final row index<a name="line.556"></a>
+<FONT color="green">557</FONT>         * @param startColumn Initial column index<a name="line.557"></a>
+<FONT color="green">558</FONT>         * @param endColumn Final column index<a name="line.558"></a>
+<FONT color="green">559</FONT>         * @exception MatrixIndexException  if the indices are not valid<a name="line.559"></a>
+<FONT color="green">560</FONT>         */<a name="line.560"></a>
+<FONT color="green">561</FONT>        public static void checkSubMatrixIndex(final AnyMatrix m,<a name="line.561"></a>
+<FONT color="green">562</FONT>                                               final int startRow, final int endRow,<a name="line.562"></a>
+<FONT color="green">563</FONT>                                               final int startColumn, final int endColumn) {<a name="line.563"></a>
+<FONT color="green">564</FONT>            checkRowIndex(m, startRow);<a name="line.564"></a>
+<FONT color="green">565</FONT>            checkRowIndex(m, endRow);<a name="line.565"></a>
+<FONT color="green">566</FONT>            if (startRow &gt; endRow) {<a name="line.566"></a>
+<FONT color="green">567</FONT>                throw new MatrixIndexException("initial row {0} after final row {1}",<a name="line.567"></a>
+<FONT color="green">568</FONT>                                               startRow, endRow);<a name="line.568"></a>
+<FONT color="green">569</FONT>            }<a name="line.569"></a>
+<FONT color="green">570</FONT>    <a name="line.570"></a>
+<FONT color="green">571</FONT>            checkColumnIndex(m, startColumn);<a name="line.571"></a>
+<FONT color="green">572</FONT>            checkColumnIndex(m, endColumn);<a name="line.572"></a>
+<FONT color="green">573</FONT>            if (startColumn &gt; endColumn) {<a name="line.573"></a>
+<FONT color="green">574</FONT>                throw new MatrixIndexException("initial column {0} after final column {1}",<a name="line.574"></a>
+<FONT color="green">575</FONT>                                               startColumn, endColumn);<a name="line.575"></a>
+<FONT color="green">576</FONT>            }<a name="line.576"></a>
+<FONT color="green">577</FONT>    <a name="line.577"></a>
+<FONT color="green">578</FONT>    <a name="line.578"></a>
+<FONT color="green">579</FONT>        }<a name="line.579"></a>
+<FONT color="green">580</FONT>    <a name="line.580"></a>
+<FONT color="green">581</FONT>        /**<a name="line.581"></a>
+<FONT color="green">582</FONT>         * Check if submatrix ranges indices are valid.<a name="line.582"></a>
+<FONT color="green">583</FONT>         * Rows and columns are indicated counting from 0 to n-1.<a name="line.583"></a>
+<FONT color="green">584</FONT>         *<a name="line.584"></a>
+<FONT color="green">585</FONT>         * @param m matrix containing the submatrix<a name="line.585"></a>
+<FONT color="green">586</FONT>         * @param selectedRows Array of row indices.<a name="line.586"></a>
+<FONT color="green">587</FONT>         * @param selectedColumns Array of column indices.<a name="line.587"></a>
+<FONT color="green">588</FONT>         * @exception MatrixIndexException if row or column selections are not valid<a name="line.588"></a>
+<FONT color="green">589</FONT>         */<a name="line.589"></a>
+<FONT color="green">590</FONT>        public static void checkSubMatrixIndex(final AnyMatrix m,<a name="line.590"></a>
+<FONT color="green">591</FONT>                                               final int[] selectedRows, final int[] selectedColumns)<a name="line.591"></a>
+<FONT color="green">592</FONT>            throws MatrixIndexException {<a name="line.592"></a>
+<FONT color="green">593</FONT>            if (selectedRows.length * selectedColumns.length == 0) {<a name="line.593"></a>
+<FONT color="green">594</FONT>                if (selectedRows.length == 0) {<a name="line.594"></a>
+<FONT color="green">595</FONT>                    throw new MatrixIndexException("empty selected row index array");<a name="line.595"></a>
+<FONT color="green">596</FONT>                }<a name="line.596"></a>
+<FONT color="green">597</FONT>                throw new MatrixIndexException("empty selected column index array");<a name="line.597"></a>
+<FONT color="green">598</FONT>            }<a name="line.598"></a>
+<FONT color="green">599</FONT>    <a name="line.599"></a>
+<FONT color="green">600</FONT>            for (final int row : selectedRows) {<a name="line.600"></a>
+<FONT color="green">601</FONT>                checkRowIndex(m, row);<a name="line.601"></a>
+<FONT color="green">602</FONT>            }<a name="line.602"></a>
+<FONT color="green">603</FONT>            for (final int column : selectedColumns) {<a name="line.603"></a>
+<FONT color="green">604</FONT>                checkColumnIndex(m, column);<a name="line.604"></a>
+<FONT color="green">605</FONT>            }<a name="line.605"></a>
+<FONT color="green">606</FONT>        }<a name="line.606"></a>
+<FONT color="green">607</FONT>    <a name="line.607"></a>
+<FONT color="green">608</FONT>        /**<a name="line.608"></a>
+<FONT color="green">609</FONT>         * Check if matrices are addition compatible<a name="line.609"></a>
+<FONT color="green">610</FONT>         * @param left left hand side matrix<a name="line.610"></a>
+<FONT color="green">611</FONT>         * @param right right hand side matrix<a name="line.611"></a>
+<FONT color="green">612</FONT>         * @exception IllegalArgumentException if matrices are not addition compatible<a name="line.612"></a>
+<FONT color="green">613</FONT>         */<a name="line.613"></a>
+<FONT color="green">614</FONT>        public static void checkAdditionCompatible(final AnyMatrix left, final AnyMatrix right)<a name="line.614"></a>
+<FONT color="green">615</FONT>            throws IllegalArgumentException {<a name="line.615"></a>
+<FONT color="green">616</FONT>            if ((left.getRowDimension()    != right.getRowDimension()) ||<a name="line.616"></a>
+<FONT color="green">617</FONT>                (left.getColumnDimension() != right.getColumnDimension())) {<a name="line.617"></a>
+<FONT color="green">618</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.618"></a>
+<FONT color="green">619</FONT>                        "{0}x{1} and {2}x{3} matrices are not addition compatible",<a name="line.619"></a>
+<FONT color="green">620</FONT>                        left.getRowDimension(), left.getColumnDimension(),<a name="line.620"></a>
+<FONT color="green">621</FONT>                        right.getRowDimension(), right.getColumnDimension());<a name="line.621"></a>
+<FONT color="green">622</FONT>            }<a name="line.622"></a>
+<FONT color="green">623</FONT>        }<a name="line.623"></a>
+<FONT color="green">624</FONT>    <a name="line.624"></a>
+<FONT color="green">625</FONT>        /**<a name="line.625"></a>
+<FONT color="green">626</FONT>         * Check if matrices are subtraction compatible<a name="line.626"></a>
+<FONT color="green">627</FONT>         * @param left left hand side matrix<a name="line.627"></a>
+<FONT color="green">628</FONT>         * @param right right hand side matrix<a name="line.628"></a>
+<FONT color="green">629</FONT>         * @exception IllegalArgumentException if matrices are not subtraction compatible<a name="line.629"></a>
+<FONT color="green">630</FONT>         */<a name="line.630"></a>
+<FONT color="green">631</FONT>        public static void checkSubtractionCompatible(final AnyMatrix left, final AnyMatrix right)<a name="line.631"></a>
+<FONT color="green">632</FONT>            throws IllegalArgumentException {<a name="line.632"></a>
+<FONT color="green">633</FONT>            if ((left.getRowDimension()    != right.getRowDimension()) ||<a name="line.633"></a>
+<FONT color="green">634</FONT>                (left.getColumnDimension() != right.getColumnDimension())) {<a name="line.634"></a>
+<FONT color="green">635</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.635"></a>
+<FONT color="green">636</FONT>                        "{0}x{1} and {2}x{3} matrices are not subtraction compatible",<a name="line.636"></a>
+<FONT color="green">637</FONT>                        left.getRowDimension(), left.getColumnDimension(),<a name="line.637"></a>
+<FONT color="green">638</FONT>                        right.getRowDimension(), right.getColumnDimension());<a name="line.638"></a>
+<FONT color="green">639</FONT>            }<a name="line.639"></a>
+<FONT color="green">640</FONT>        }<a name="line.640"></a>
+<FONT color="green">641</FONT>    <a name="line.641"></a>
+<FONT color="green">642</FONT>        /**<a name="line.642"></a>
+<FONT color="green">643</FONT>         * Check if matrices are multiplication compatible<a name="line.643"></a>
+<FONT color="green">644</FONT>         * @param left left hand side matrix<a name="line.644"></a>
+<FONT color="green">645</FONT>         * @param right right hand side matrix<a name="line.645"></a>
+<FONT color="green">646</FONT>         * @exception IllegalArgumentException if matrices are not multiplication compatible<a name="line.646"></a>
+<FONT color="green">647</FONT>         */<a name="line.647"></a>
+<FONT color="green">648</FONT>        public static void checkMultiplicationCompatible(final AnyMatrix left, final AnyMatrix right)<a name="line.648"></a>
+<FONT color="green">649</FONT>            throws IllegalArgumentException {<a name="line.649"></a>
+<FONT color="green">650</FONT>            if (left.getColumnDimension() != right.getRowDimension()) {<a name="line.650"></a>
+<FONT color="green">651</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.651"></a>
+<FONT color="green">652</FONT>                        "{0}x{1} and {2}x{3} matrices are not multiplication compatible",<a name="line.652"></a>
+<FONT color="green">653</FONT>                        left.getRowDimension(), left.getColumnDimension(),<a name="line.653"></a>
+<FONT color="green">654</FONT>                        right.getRowDimension(), right.getColumnDimension());<a name="line.654"></a>
+<FONT color="green">655</FONT>            }<a name="line.655"></a>
+<FONT color="green">656</FONT>        }<a name="line.656"></a>
+<FONT color="green">657</FONT>    <a name="line.657"></a>
+<FONT color="green">658</FONT>        /**<a name="line.658"></a>
+<FONT color="green">659</FONT>         * Convert a {@link FieldMatrix}/{@link Fraction} matrix to a {@link RealMatrix}.<a name="line.659"></a>
+<FONT color="green">660</FONT>         * @param m matrix to convert<a name="line.660"></a>
+<FONT color="green">661</FONT>         * @return converted matrix<a name="line.661"></a>
+<FONT color="green">662</FONT>         */<a name="line.662"></a>
+<FONT color="green">663</FONT>        public static Array2DRowRealMatrix fractionMatrixToRealMatrix(final FieldMatrix&lt;Fraction&gt; m) {<a name="line.663"></a>
+<FONT color="green">664</FONT>            final FractionMatrixConverter converter = new FractionMatrixConverter();<a name="line.664"></a>
+<FONT color="green">665</FONT>            m.walkInOptimizedOrder(converter);<a name="line.665"></a>
+<FONT color="green">666</FONT>            return converter.getConvertedMatrix();<a name="line.666"></a>
+<FONT color="green">667</FONT>        }<a name="line.667"></a>
+<FONT color="green">668</FONT>    <a name="line.668"></a>
+<FONT color="green">669</FONT>        /** Converter for {@link FieldMatrix}/{@link Fraction}. */<a name="line.669"></a>
+<FONT color="green">670</FONT>        private static class FractionMatrixConverter extends DefaultFieldMatrixPreservingVisitor&lt;Fraction&gt; {<a name="line.670"></a>
+<FONT color="green">671</FONT>    <a name="line.671"></a>
+<FONT color="green">672</FONT>            /** Converted array. */<a name="line.672"></a>
+<FONT color="green">673</FONT>            private double[][] data;<a name="line.673"></a>
+<FONT color="green">674</FONT>    <a name="line.674"></a>
+<FONT color="green">675</FONT>            /** Simple constructor. */<a name="line.675"></a>
+<FONT color="green">676</FONT>            public FractionMatrixConverter() {<a name="line.676"></a>
+<FONT color="green">677</FONT>                super(Fraction.ZERO);<a name="line.677"></a>
+<FONT color="green">678</FONT>            }<a name="line.678"></a>
+<FONT color="green">679</FONT>    <a name="line.679"></a>
+<FONT color="green">680</FONT>            /** {@inheritDoc} */<a name="line.680"></a>
+<FONT color="green">681</FONT>            @Override<a name="line.681"></a>
+<FONT color="green">682</FONT>            public void start(int rows, int columns,<a name="line.682"></a>
+<FONT color="green">683</FONT>                              int startRow, int endRow, int startColumn, int endColumn) {<a name="line.683"></a>
+<FONT color="green">684</FONT>                data = new double[rows][columns];<a name="line.684"></a>
+<FONT color="green">685</FONT>            }<a name="line.685"></a>
+<FONT color="green">686</FONT>    <a name="line.686"></a>
+<FONT color="green">687</FONT>            /** {@inheritDoc} */<a name="line.687"></a>
+<FONT color="green">688</FONT>            @Override<a name="line.688"></a>
+<FONT color="green">689</FONT>            public void visit(int row, int column, Fraction value) {<a name="line.689"></a>
+<FONT color="green">690</FONT>                data[row][column] = value.doubleValue();<a name="line.690"></a>
+<FONT color="green">691</FONT>            }<a name="line.691"></a>
+<FONT color="green">692</FONT>    <a name="line.692"></a>
+<FONT color="green">693</FONT>            /** Get the converted matrix.<a name="line.693"></a>
+<FONT color="green">694</FONT>             * @return converted matrix<a name="line.694"></a>
+<FONT color="green">695</FONT>             */<a name="line.695"></a>
+<FONT color="green">696</FONT>            Array2DRowRealMatrix getConvertedMatrix() {<a name="line.696"></a>
+<FONT color="green">697</FONT>                return new Array2DRowRealMatrix(data, false);<a name="line.697"></a>
+<FONT color="green">698</FONT>            }<a name="line.698"></a>
+<FONT color="green">699</FONT>    <a name="line.699"></a>
+<FONT color="green">700</FONT>        }<a name="line.700"></a>
+<FONT color="green">701</FONT>    <a name="line.701"></a>
+<FONT color="green">702</FONT>        /**<a name="line.702"></a>
+<FONT color="green">703</FONT>         * Convert a {@link FieldMatrix}/{@link BigFraction} matrix to a {@link RealMatrix}.<a name="line.703"></a>
+<FONT color="green">704</FONT>         * @param m matrix to convert<a name="line.704"></a>
+<FONT color="green">705</FONT>         * @return converted matrix<a name="line.705"></a>
+<FONT color="green">706</FONT>         */<a name="line.706"></a>
+<FONT color="green">707</FONT>        public static Array2DRowRealMatrix bigFractionMatrixToRealMatrix(final FieldMatrix&lt;BigFraction&gt; m) {<a name="line.707"></a>
+<FONT color="green">708</FONT>            final BigFractionMatrixConverter converter = new BigFractionMatrixConverter();<a name="line.708"></a>
+<FONT color="green">709</FONT>            m.walkInOptimizedOrder(converter);<a name="line.709"></a>
+<FONT color="green">710</FONT>            return converter.getConvertedMatrix();<a name="line.710"></a>
+<FONT color="green">711</FONT>        }<a name="line.711"></a>
+<FONT color="green">712</FONT>    <a name="line.712"></a>
+<FONT color="green">713</FONT>        /** Converter for {@link FieldMatrix}/{@link BigFraction}. */<a name="line.713"></a>
+<FONT color="green">714</FONT>        private static class BigFractionMatrixConverter extends DefaultFieldMatrixPreservingVisitor&lt;BigFraction&gt; {<a name="line.714"></a>
+<FONT color="green">715</FONT>    <a name="line.715"></a>
+<FONT color="green">716</FONT>            /** Converted array. */<a name="line.716"></a>
+<FONT color="green">717</FONT>            private double[][] data;<a name="line.717"></a>
+<FONT color="green">718</FONT>    <a name="line.718"></a>
+<FONT color="green">719</FONT>            /** Simple constructor. */<a name="line.719"></a>
+<FONT color="green">720</FONT>            public BigFractionMatrixConverter() {<a name="line.720"></a>
+<FONT color="green">721</FONT>                super(BigFraction.ZERO);<a name="line.721"></a>
+<FONT color="green">722</FONT>            }<a name="line.722"></a>
+<FONT color="green">723</FONT>    <a name="line.723"></a>
+<FONT color="green">724</FONT>            /** {@inheritDoc} */<a name="line.724"></a>
+<FONT color="green">725</FONT>            @Override<a name="line.725"></a>
+<FONT color="green">726</FONT>            public void start(int rows, int columns,<a name="line.726"></a>
+<FONT color="green">727</FONT>                              int startRow, int endRow, int startColumn, int endColumn) {<a name="line.727"></a>
+<FONT color="green">728</FONT>                data = new double[rows][columns];<a name="line.728"></a>
+<FONT color="green">729</FONT>            }<a name="line.729"></a>
+<FONT color="green">730</FONT>    <a name="line.730"></a>
+<FONT color="green">731</FONT>            /** {@inheritDoc} */<a name="line.731"></a>
+<FONT color="green">732</FONT>            @Override<a name="line.732"></a>
+<FONT color="green">733</FONT>            public void visit(int row, int column, BigFraction value) {<a name="line.733"></a>
+<FONT color="green">734</FONT>                data[row][column] = value.doubleValue();<a name="line.734"></a>
+<FONT color="green">735</FONT>            }<a name="line.735"></a>
+<FONT color="green">736</FONT>    <a name="line.736"></a>
+<FONT color="green">737</FONT>            /** Get the converted matrix.<a name="line.737"></a>
+<FONT color="green">738</FONT>             * @return converted matrix<a name="line.738"></a>
+<FONT color="green">739</FONT>             */<a name="line.739"></a>
+<FONT color="green">740</FONT>            Array2DRowRealMatrix getConvertedMatrix() {<a name="line.740"></a>
+<FONT color="green">741</FONT>                return new Array2DRowRealMatrix(data, false);<a name="line.741"></a>
+<FONT color="green">742</FONT>            }<a name="line.742"></a>
+<FONT color="green">743</FONT>    <a name="line.743"></a>
+<FONT color="green">744</FONT>        }<a name="line.744"></a>
+<FONT color="green">745</FONT>    <a name="line.745"></a>
+<FONT color="green">746</FONT>        /** Serialize a {@link RealVector}.<a name="line.746"></a>
+<FONT color="green">747</FONT>         * &lt;p&gt;<a name="line.747"></a>
+<FONT color="green">748</FONT>         * This method is intended to be called from within a private<a name="line.748"></a>
+<FONT color="green">749</FONT>         * &lt;code&gt;writeObject&lt;/code&gt; method (after a call to<a name="line.749"></a>
+<FONT color="green">750</FONT>         * &lt;code&gt;oos.defaultWriteObject()&lt;/code&gt;) in a class that has a<a name="line.750"></a>
+<FONT color="green">751</FONT>         * {@link RealVector} field, which should be declared &lt;code&gt;transient&lt;/code&gt;.<a name="line.751"></a>
+<FONT color="green">752</FONT>         * This way, the default handling does not serialize the vector (the {@link<a name="line.752"></a>
+<FONT color="green">753</FONT>         * RealVector} interface is not serializable by default) but this method does<a name="line.753"></a>
+<FONT color="green">754</FONT>         * serialize it specifically.<a name="line.754"></a>
+<FONT color="green">755</FONT>         * &lt;/p&gt;<a name="line.755"></a>
+<FONT color="green">756</FONT>         * &lt;p&gt;<a name="line.756"></a>
+<FONT color="green">757</FONT>         * The following example shows how a simple class with a name and a real vector<a name="line.757"></a>
+<FONT color="green">758</FONT>         * should be written:<a name="line.758"></a>
+<FONT color="green">759</FONT>         * &lt;pre&gt;&lt;code&gt;<a name="line.759"></a>
+<FONT color="green">760</FONT>         * public class NamedVector implements Serializable {<a name="line.760"></a>
+<FONT color="green">761</FONT>         *<a name="line.761"></a>
+<FONT color="green">762</FONT>         *     private final String name;<a name="line.762"></a>
+<FONT color="green">763</FONT>         *     private final transient RealVector coefficients;<a name="line.763"></a>
+<FONT color="green">764</FONT>         *<a name="line.764"></a>
+<FONT color="green">765</FONT>         *     // omitted constructors, getters ...<a name="line.765"></a>
+<FONT color="green">766</FONT>         *<a name="line.766"></a>
+<FONT color="green">767</FONT>         *     private void writeObject(ObjectOutputStream oos) throws IOException {<a name="line.767"></a>
+<FONT color="green">768</FONT>         *         oos.defaultWriteObject();  // takes care of name field<a name="line.768"></a>
+<FONT color="green">769</FONT>         *         MatrixUtils.serializeRealVector(coefficients, oos);<a name="line.769"></a>
+<FONT color="green">770</FONT>         *     }<a name="line.770"></a>
+<FONT color="green">771</FONT>         *<a name="line.771"></a>
+<FONT color="green">772</FONT>         *     private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {<a name="line.772"></a>
+<FONT color="green">773</FONT>         *         ois.defaultReadObject();  // takes care of name field<a name="line.773"></a>
+<FONT color="green">774</FONT>         *         MatrixUtils.deserializeRealVector(this, "coefficients", ois);<a name="line.774"></a>
+<FONT color="green">775</FONT>         *     }<a name="line.775"></a>
+<FONT color="green">776</FONT>         *<a name="line.776"></a>
+<FONT color="green">777</FONT>         * }<a name="line.777"></a>
+<FONT color="green">778</FONT>         * &lt;/code&gt;&lt;/pre&gt;<a name="line.778"></a>
+<FONT color="green">779</FONT>         * &lt;/p&gt;<a name="line.779"></a>
+<FONT color="green">780</FONT>         *<a name="line.780"></a>
+<FONT color="green">781</FONT>         * @param vector real vector to serialize<a name="line.781"></a>
+<FONT color="green">782</FONT>         * @param oos stream where the real vector should be written<a name="line.782"></a>
+<FONT color="green">783</FONT>         * @exception IOException if object cannot be written to stream<a name="line.783"></a>
+<FONT color="green">784</FONT>         * @see #deserializeRealVector(Object, String, ObjectInputStream)<a name="line.784"></a>
+<FONT color="green">785</FONT>         */<a name="line.785"></a>
+<FONT color="green">786</FONT>        public static void serializeRealVector(final RealVector vector,<a name="line.786"></a>
+<FONT color="green">787</FONT>                                               final ObjectOutputStream oos)<a name="line.787"></a>
+<FONT color="green">788</FONT>            throws IOException {<a name="line.788"></a>
+<FONT color="green">789</FONT>            final int n = vector.getDimension();<a name="line.789"></a>
+<FONT color="green">790</FONT>            oos.writeInt(n);<a name="line.790"></a>
+<FONT color="green">791</FONT>            for (int i = 0; i &lt; n; ++i) {<a name="line.791"></a>
+<FONT color="green">792</FONT>                oos.writeDouble(vector.getEntry(i));<a name="line.792"></a>
+<FONT color="green">793</FONT>            }<a name="line.793"></a>
+<FONT color="green">794</FONT>        }<a name="line.794"></a>
+<FONT color="green">795</FONT>    <a name="line.795"></a>
+<FONT color="green">796</FONT>        /** Deserialize  a {@link RealVector} field in a class.<a name="line.796"></a>
+<FONT color="green">797</FONT>         * &lt;p&gt;<a name="line.797"></a>
+<FONT color="green">798</FONT>         * This method is intended to be called from within a private<a name="line.798"></a>
+<FONT color="green">799</FONT>         * &lt;code&gt;readObject&lt;/code&gt; method (after a call to<a name="line.799"></a>
+<FONT color="green">800</FONT>         * &lt;code&gt;ois.defaultReadObject()&lt;/code&gt;) in a class that has a<a name="line.800"></a>
+<FONT color="green">801</FONT>         * {@link RealVector} field, which should be declared &lt;code&gt;transient&lt;/code&gt;.<a name="line.801"></a>
+<FONT color="green">802</FONT>         * This way, the default handling does not deserialize the vector (the {@link<a name="line.802"></a>
+<FONT color="green">803</FONT>         * RealVector} interface is not serializable by default) but this method does<a name="line.803"></a>
+<FONT color="green">804</FONT>         * deserialize it specifically.<a name="line.804"></a>
+<FONT color="green">805</FONT>         * &lt;/p&gt;<a name="line.805"></a>
+<FONT color="green">806</FONT>         * @param instance instance in which the field must be set up<a name="line.806"></a>
+<FONT color="green">807</FONT>         * @param fieldName name of the field within the class (may be private and final)<a name="line.807"></a>
+<FONT color="green">808</FONT>         * @param ois stream from which the real vector should be read<a name="line.808"></a>
+<FONT color="green">809</FONT>         * @exception ClassNotFoundException if a class in the stream cannot be found<a name="line.809"></a>
+<FONT color="green">810</FONT>         * @exception IOException if object cannot be read from the stream<a name="line.810"></a>
+<FONT color="green">811</FONT>         * @see #serializeRealVector(RealVector, ObjectOutputStream)<a name="line.811"></a>
+<FONT color="green">812</FONT>         */<a name="line.812"></a>
+<FONT color="green">813</FONT>        public static void deserializeRealVector(final Object instance,<a name="line.813"></a>
+<FONT color="green">814</FONT>                                                 final String fieldName,<a name="line.814"></a>
+<FONT color="green">815</FONT>                                                 final ObjectInputStream ois)<a name="line.815"></a>
+<FONT color="green">816</FONT>          throws ClassNotFoundException, IOException {<a name="line.816"></a>
+<FONT color="green">817</FONT>            try {<a name="line.817"></a>
+<FONT color="green">818</FONT>    <a name="line.818"></a>
+<FONT color="green">819</FONT>                // read the vector data<a name="line.819"></a>
+<FONT color="green">820</FONT>                final int n = ois.readInt();<a name="line.820"></a>
+<FONT color="green">821</FONT>                final double[] data = new double[n];<a name="line.821"></a>
+<FONT color="green">822</FONT>                for (int i = 0; i &lt; n; ++i) {<a name="line.822"></a>
+<FONT color="green">823</FONT>                    data[i] = ois.readDouble();<a name="line.823"></a>
+<FONT color="green">824</FONT>                }<a name="line.824"></a>
+<FONT color="green">825</FONT>    <a name="line.825"></a>
+<FONT color="green">826</FONT>                // create the instance<a name="line.826"></a>
+<FONT color="green">827</FONT>                final RealVector vector = new ArrayRealVector(data, false);<a name="line.827"></a>
+<FONT color="green">828</FONT>    <a name="line.828"></a>
+<FONT color="green">829</FONT>                // set up the field<a name="line.829"></a>
+<FONT color="green">830</FONT>                final java.lang.reflect.Field f =<a name="line.830"></a>
+<FONT color="green">831</FONT>                    instance.getClass().getDeclaredField(fieldName);<a name="line.831"></a>
+<FONT color="green">832</FONT>                f.setAccessible(true);<a name="line.832"></a>
+<FONT color="green">833</FONT>                f.set(instance, vector);<a name="line.833"></a>
+<FONT color="green">834</FONT>    <a name="line.834"></a>
+<FONT color="green">835</FONT>            } catch (NoSuchFieldException nsfe) {<a name="line.835"></a>
+<FONT color="green">836</FONT>                IOException ioe = new IOException();<a name="line.836"></a>
+<FONT color="green">837</FONT>                ioe.initCause(nsfe);<a name="line.837"></a>
+<FONT color="green">838</FONT>                throw ioe;<a name="line.838"></a>
+<FONT color="green">839</FONT>            } catch (IllegalAccessException iae) {<a name="line.839"></a>
+<FONT color="green">840</FONT>                IOException ioe = new IOException();<a name="line.840"></a>
+<FONT color="green">841</FONT>                ioe.initCause(iae);<a name="line.841"></a>
+<FONT color="green">842</FONT>                throw ioe;<a name="line.842"></a>
+<FONT color="green">843</FONT>            }<a name="line.843"></a>
+<FONT color="green">844</FONT>    <a name="line.844"></a>
+<FONT color="green">845</FONT>        }<a name="line.845"></a>
+<FONT color="green">846</FONT>    <a name="line.846"></a>
+<FONT color="green">847</FONT>        /** Serialize a {@link RealMatrix}.<a name="line.847"></a>
+<FONT color="green">848</FONT>         * &lt;p&gt;<a name="line.848"></a>
+<FONT color="green">849</FONT>         * This method is intended to be called from within a private<a name="line.849"></a>
+<FONT color="green">850</FONT>         * &lt;code&gt;writeObject&lt;/code&gt; method (after a call to<a name="line.850"></a>
+<FONT color="green">851</FONT>         * &lt;code&gt;oos.defaultWriteObject()&lt;/code&gt;) in a class that has a<a name="line.851"></a>
+<FONT color="green">852</FONT>         * {@link RealMatrix} field, which should be declared &lt;code&gt;transient&lt;/code&gt;.<a name="line.852"></a>
+<FONT color="green">853</FONT>         * This way, the default handling does not serialize the matrix (the {@link<a name="line.853"></a>
+<FONT color="green">854</FONT>         * RealMatrix} interface is not serializable by default) but this method does<a name="line.854"></a>
+<FONT color="green">855</FONT>         * serialize it specifically.<a name="line.855"></a>
+<FONT color="green">856</FONT>         * &lt;/p&gt;<a name="line.856"></a>
+<FONT color="green">857</FONT>         * &lt;p&gt;<a name="line.857"></a>
+<FONT color="green">858</FONT>         * The following example shows how a simple class with a name and a real matrix<a name="line.858"></a>
+<FONT color="green">859</FONT>         * should be written:<a name="line.859"></a>
+<FONT color="green">860</FONT>         * &lt;pre&gt;&lt;code&gt;<a name="line.860"></a>
+<FONT color="green">861</FONT>         * public class NamedMatrix implements Serializable {<a name="line.861"></a>
+<FONT color="green">862</FONT>         *<a name="line.862"></a>
+<FONT color="green">863</FONT>         *     private final String name;<a name="line.863"></a>
+<FONT color="green">864</FONT>         *     private final transient RealMatrix coefficients;<a name="line.864"></a>
+<FONT color="green">865</FONT>         *<a name="line.865"></a>
+<FONT color="green">866</FONT>         *     // omitted constructors, getters ...<a name="line.866"></a>
+<FONT color="green">867</FONT>         *<a name="line.867"></a>
+<FONT color="green">868</FONT>         *     private void writeObject(ObjectOutputStream oos) throws IOException {<a name="line.868"></a>
+<FONT color="green">869</FONT>         *         oos.defaultWriteObject();  // takes care of name field<a name="line.869"></a>
+<FONT color="green">870</FONT>         *         MatrixUtils.serializeRealMatrix(coefficients, oos);<a name="line.870"></a>
+<FONT color="green">871</FONT>         *     }<a name="line.871"></a>
+<FONT color="green">872</FONT>         *<a name="line.872"></a>
+<FONT color="green">873</FONT>         *     private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {<a name="line.873"></a>
+<FONT color="green">874</FONT>         *         ois.defaultReadObject();  // takes care of name field<a name="line.874"></a>
+<FONT color="green">875</FONT>         *         MatrixUtils.deserializeRealMatrix(this, "coefficients", ois);<a name="line.875"></a>
+<FONT color="green">876</FONT>         *     }<a name="line.876"></a>
+<FONT color="green">877</FONT>         *<a name="line.877"></a>
+<FONT color="green">878</FONT>         * }<a name="line.878"></a>
+<FONT color="green">879</FONT>         * &lt;/code&gt;&lt;/pre&gt;<a name="line.879"></a>
+<FONT color="green">880</FONT>         * &lt;/p&gt;<a name="line.880"></a>
+<FONT color="green">881</FONT>         *<a name="line.881"></a>
+<FONT color="green">882</FONT>         * @param matrix real matrix to serialize<a name="line.882"></a>
+<FONT color="green">883</FONT>         * @param oos stream where the real matrix should be written<a name="line.883"></a>
+<FONT color="green">884</FONT>         * @exception IOException if object cannot be written to stream<a name="line.884"></a>
+<FONT color="green">885</FONT>         * @see #deserializeRealMatrix(Object, String, ObjectInputStream)<a name="line.885"></a>
+<FONT color="green">886</FONT>         */<a name="line.886"></a>
+<FONT color="green">887</FONT>        public static void serializeRealMatrix(final RealMatrix matrix,<a name="line.887"></a>
+<FONT color="green">888</FONT>                                               final ObjectOutputStream oos)<a name="line.888"></a>
+<FONT color="green">889</FONT>            throws IOException {<a name="line.889"></a>
+<FONT color="green">890</FONT>            final int n = matrix.getRowDimension();<a name="line.890"></a>
+<FONT color="green">891</FONT>            final int m = matrix.getColumnDimension();<a name="line.891"></a>
+<FONT color="green">892</FONT>            oos.writeInt(n);<a name="line.892"></a>
+<FONT color="green">893</FONT>            oos.writeInt(m);<a name="line.893"></a>
+<FONT color="green">894</FONT>            for (int i = 0; i &lt; n; ++i) {<a name="line.894"></a>
+<FONT color="green">895</FONT>                for (int j = 0; j &lt; m; ++j) {<a name="line.895"></a>
+<FONT color="green">896</FONT>                    oos.writeDouble(matrix.getEntry(i, j));<a name="line.896"></a>
+<FONT color="green">897</FONT>                }<a name="line.897"></a>
+<FONT color="green">898</FONT>            }<a name="line.898"></a>
+<FONT color="green">899</FONT>        }<a name="line.899"></a>
+<FONT color="green">900</FONT>    <a name="line.900"></a>
+<FONT color="green">901</FONT>        /** Deserialize  a {@link RealMatrix} field in a class.<a name="line.901"></a>
+<FONT color="green">902</FONT>         * &lt;p&gt;<a name="line.902"></a>
+<FONT color="green">903</FONT>         * This method is intended to be called from within a private<a name="line.903"></a>
+<FONT color="green">904</FONT>         * &lt;code&gt;readObject&lt;/code&gt; method (after a call to<a name="line.904"></a>
+<FONT color="green">905</FONT>         * &lt;code&gt;ois.defaultReadObject()&lt;/code&gt;) in a class that has a<a name="line.905"></a>
+<FONT color="green">906</FONT>         * {@link RealMatrix} field, which should be declared &lt;code&gt;transient&lt;/code&gt;.<a name="line.906"></a>
+<FONT color="green">907</FONT>         * This way, the default handling does not deserialize the matrix (the {@link<a name="line.907"></a>
+<FONT color="green">908</FONT>         * RealMatrix} interface is not serializable by default) but this method does<a name="line.908"></a>
+<FONT color="green">909</FONT>         * deserialize it specifically.<a name="line.909"></a>
+<FONT color="green">910</FONT>         * &lt;/p&gt;<a name="line.910"></a>
+<FONT color="green">911</FONT>         * @param instance instance in which the field must be set up<a name="line.911"></a>
+<FONT color="green">912</FONT>         * @param fieldName name of the field within the class (may be private and final)<a name="line.912"></a>
+<FONT color="green">913</FONT>         * @param ois stream from which the real matrix should be read<a name="line.913"></a>
+<FONT color="green">914</FONT>         * @exception ClassNotFoundException if a class in the stream cannot be found<a name="line.914"></a>
+<FONT color="green">915</FONT>         * @exception IOException if object cannot be read from the stream<a name="line.915"></a>
+<FONT color="green">916</FONT>         * @see #serializeRealMatrix(RealMatrix, ObjectOutputStream)<a name="line.916"></a>
+<FONT color="green">917</FONT>         */<a name="line.917"></a>
+<FONT color="green">918</FONT>        public static void deserializeRealMatrix(final Object instance,<a name="line.918"></a>
+<FONT color="green">919</FONT>                                                 final String fieldName,<a name="line.919"></a>
+<FONT color="green">920</FONT>                                                 final ObjectInputStream ois)<a name="line.920"></a>
+<FONT color="green">921</FONT>          throws ClassNotFoundException, IOException {<a name="line.921"></a>
+<FONT color="green">922</FONT>            try {<a name="line.922"></a>
+<FONT color="green">923</FONT>    <a name="line.923"></a>
+<FONT color="green">924</FONT>                // read the matrix data<a name="line.924"></a>
+<FONT color="green">925</FONT>                final int n = ois.readInt();<a name="line.925"></a>
+<FONT color="green">926</FONT>                final int m = ois.readInt();<a name="line.926"></a>
+<FONT color="green">927</FONT>                final double[][] data = new double[n][m];<a name="line.927"></a>
+<FONT color="green">928</FONT>                for (int i = 0; i &lt; n; ++i) {<a name="line.928"></a>
+<FONT color="green">929</FONT>                    final double[] dataI = data[i];<a name="line.929"></a>
+<FONT color="green">930</FONT>                    for (int j = 0; j &lt; m; ++j) {<a name="line.930"></a>
+<FONT color="green">931</FONT>                        dataI[j] = ois.readDouble();<a name="line.931"></a>
+<FONT color="green">932</FONT>                    }<a name="line.932"></a>
+<FONT color="green">933</FONT>                }<a name="line.933"></a>
+<FONT color="green">934</FONT>    <a name="line.934"></a>
+<FONT color="green">935</FONT>                // create the instance<a name="line.935"></a>
+<FONT color="green">936</FONT>                final RealMatrix matrix = new Array2DRowRealMatrix(data, false);<a name="line.936"></a>
+<FONT color="green">937</FONT>    <a name="line.937"></a>
+<FONT color="green">938</FONT>                // set up the field<a name="line.938"></a>
+<FONT color="green">939</FONT>                final java.lang.reflect.Field f =<a name="line.939"></a>
+<FONT color="green">940</FONT>                    instance.getClass().getDeclaredField(fieldName);<a name="line.940"></a>
+<FONT color="green">941</FONT>                f.setAccessible(true);<a name="line.941"></a>
+<FONT color="green">942</FONT>                f.set(instance, matrix);<a name="line.942"></a>
+<FONT color="green">943</FONT>    <a name="line.943"></a>
+<FONT color="green">944</FONT>            } catch (NoSuchFieldException nsfe) {<a name="line.944"></a>
+<FONT color="green">945</FONT>                IOException ioe = new IOException();<a name="line.945"></a>
+<FONT color="green">946</FONT>                ioe.initCause(nsfe);<a name="line.946"></a>
+<FONT color="green">947</FONT>                throw ioe;<a name="line.947"></a>
+<FONT color="green">948</FONT>            } catch (IllegalAccessException iae) {<a name="line.948"></a>
+<FONT color="green">949</FONT>                IOException ioe = new IOException();<a name="line.949"></a>
+<FONT color="green">950</FONT>                ioe.initCause(iae);<a name="line.950"></a>
+<FONT color="green">951</FONT>                throw ioe;<a name="line.951"></a>
+<FONT color="green">952</FONT>            }<a name="line.952"></a>
+<FONT color="green">953</FONT>    <a name="line.953"></a>
+<FONT color="green">954</FONT>        }<a name="line.954"></a>
+<FONT color="green">955</FONT>    <a name="line.955"></a>
+<FONT color="green">956</FONT>    }<a name="line.956"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/MatrixVisitorException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,106 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Thrown when a visitor encounters an error while processing a matrix entry.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 729673 $ $Date: 2008-12-27 15:55:12 -0500 (Sat, 27 Dec 2008) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     */<a name="line.25"></a>
+<FONT color="green">026</FONT>    public class MatrixVisitorException extends MathRuntimeException {<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>        /** Serializable version identifier */<a name="line.28"></a>
+<FONT color="green">029</FONT>        private static final long serialVersionUID = 3814333035048617048L;<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /**<a name="line.31"></a>
+<FONT color="green">032</FONT>         * Constructs a new instance with specified formatted detail message.<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @param pattern format specifier<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @param arguments format arguments<a name="line.34"></a>
+<FONT color="green">035</FONT>         */<a name="line.35"></a>
+<FONT color="green">036</FONT>        public MatrixVisitorException(final String pattern, final Object[] arguments) {<a name="line.36"></a>
+<FONT color="green">037</FONT>          super(pattern, arguments);<a name="line.37"></a>
+<FONT color="green">038</FONT>        }<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>    }<a name="line.40"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/NonSquareMatrixException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,107 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Thrown when an operation defined only for square matrices is applied to non-square ones.<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 799857 $ $Date: 2009-08-01 09:07:12 -0400 (Sat, 01 Aug 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @since 2.0<a name="line.24"></a>
+<FONT color="green">025</FONT>     */<a name="line.25"></a>
+<FONT color="green">026</FONT>    public class NonSquareMatrixException extends InvalidMatrixException {<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>        /** Serializable version identifier. */<a name="line.28"></a>
+<FONT color="green">029</FONT>        private static final long serialVersionUID = 8996207526636673730L;<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /**<a name="line.31"></a>
+<FONT color="green">032</FONT>         * Construct an exception with the given message.<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @param rows number of rows of the faulty matrix<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @param columns number of columns of the faulty matrix<a name="line.34"></a>
+<FONT color="green">035</FONT>         */<a name="line.35"></a>
+<FONT color="green">036</FONT>        public NonSquareMatrixException(final int rows, final int columns) {<a name="line.36"></a>
+<FONT color="green">037</FONT>            super("a {0}x{1} matrix was provided instead of a square matrix",<a name="line.37"></a>
+<FONT color="green">038</FONT>                  rows, columns);<a name="line.38"></a>
+<FONT color="green">039</FONT>        }<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>    }<a name="line.41"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/NotPositiveDefiniteMatrixException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,108 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This class represents exceptions thrown when a matrix expected to<a name="line.23"></a>
+<FONT color="green">024</FONT>     * be positive definite is not.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 1.2<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>    public class NotPositiveDefiniteMatrixException extends MathException {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** Serializable version identifier */<a name="line.32"></a>
+<FONT color="green">033</FONT>        private static final long serialVersionUID = 4122929125438624648L;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Simple constructor.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * build an exception with a default message.<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        public NotPositiveDefiniteMatrixException() {<a name="line.38"></a>
+<FONT color="green">039</FONT>            super("not positive definite matrix");<a name="line.39"></a>
+<FONT color="green">040</FONT>        }<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>    }<a name="line.42"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/NotSymmetricMatrixException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,108 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This class represents exceptions thrown when a matrix expected to<a name="line.23"></a>
+<FONT color="green">024</FONT>     * be symmetric is not<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 2.0<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>    public class NotSymmetricMatrixException extends MathException {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** Serializable version identifier */<a name="line.32"></a>
+<FONT color="green">033</FONT>        private static final long serialVersionUID = -7012803946709786097L;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Simple constructor.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * build an exception with a default message.<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        public NotSymmetricMatrixException() {<a name="line.38"></a>
+<FONT color="green">039</FONT>            super("not symmetric matrix");<a name="line.39"></a>
+<FONT color="green">040</FONT>        }<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>    }<a name="line.42"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/OpenMapRealMatrix.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,358 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.util.OpenIntToDoubleHashMap;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Sparse matrix implementation based on an open addressed map.<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @since 2.0<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public class OpenMapRealMatrix extends AbstractRealMatrix implements SparseRealMatrix, Serializable {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** Serializable version identifier. */<a name="line.32"></a>
+<FONT color="green">033</FONT>        private static final long serialVersionUID = -5962461716457143437L;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Number of rows of the matrix. */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private final int rows;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Number of columns of the matrix. */<a name="line.38"></a>
+<FONT color="green">039</FONT>        private final int columns;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Storage for (sparse) matrix elements. */<a name="line.41"></a>
+<FONT color="green">042</FONT>        private final OpenIntToDoubleHashMap entries;<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /**<a name="line.44"></a>
+<FONT color="green">045</FONT>         * Build a sparse matrix with the supplied row and column dimensions.<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param rowDimension number of rows of the matrix<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @param columnDimension number of columns of the matrix<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        public OpenMapRealMatrix(int rowDimension, int columnDimension) {<a name="line.49"></a>
+<FONT color="green">050</FONT>            super(rowDimension, columnDimension);<a name="line.50"></a>
+<FONT color="green">051</FONT>            this.rows    = rowDimension;<a name="line.51"></a>
+<FONT color="green">052</FONT>            this.columns = columnDimension;<a name="line.52"></a>
+<FONT color="green">053</FONT>            this.entries = new OpenIntToDoubleHashMap(0.0);<a name="line.53"></a>
+<FONT color="green">054</FONT>        }<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /**<a name="line.56"></a>
+<FONT color="green">057</FONT>         * Build a matrix by copying another one.<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @param matrix matrix to copy<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        public OpenMapRealMatrix(OpenMapRealMatrix matrix) {<a name="line.60"></a>
+<FONT color="green">061</FONT>            this.rows    = matrix.rows;<a name="line.61"></a>
+<FONT color="green">062</FONT>            this.columns = matrix.columns;<a name="line.62"></a>
+<FONT color="green">063</FONT>            this.entries = new OpenIntToDoubleHashMap(matrix.entries);<a name="line.63"></a>
+<FONT color="green">064</FONT>        }<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /** {@inheritDoc} */<a name="line.66"></a>
+<FONT color="green">067</FONT>        @Override<a name="line.67"></a>
+<FONT color="green">068</FONT>        public OpenMapRealMatrix copy() {<a name="line.68"></a>
+<FONT color="green">069</FONT>            return new OpenMapRealMatrix(this);<a name="line.69"></a>
+<FONT color="green">070</FONT>        }<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /** {@inheritDoc} */<a name="line.72"></a>
+<FONT color="green">073</FONT>        @Override<a name="line.73"></a>
+<FONT color="green">074</FONT>        public OpenMapRealMatrix createMatrix(int rowDimension, int columnDimension)<a name="line.74"></a>
+<FONT color="green">075</FONT>                throws IllegalArgumentException {<a name="line.75"></a>
+<FONT color="green">076</FONT>            return new OpenMapRealMatrix(rowDimension, columnDimension);<a name="line.76"></a>
+<FONT color="green">077</FONT>        }<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        /** {@inheritDoc} */<a name="line.79"></a>
+<FONT color="green">080</FONT>        @Override<a name="line.80"></a>
+<FONT color="green">081</FONT>        public int getColumnDimension() {<a name="line.81"></a>
+<FONT color="green">082</FONT>            return columns;<a name="line.82"></a>
+<FONT color="green">083</FONT>        }<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>        /** {@inheritDoc} */<a name="line.85"></a>
+<FONT color="green">086</FONT>        @Override<a name="line.86"></a>
+<FONT color="green">087</FONT>        public OpenMapRealMatrix add(final RealMatrix m)<a name="line.87"></a>
+<FONT color="green">088</FONT>            throws IllegalArgumentException {<a name="line.88"></a>
+<FONT color="green">089</FONT>            try {<a name="line.89"></a>
+<FONT color="green">090</FONT>                return add((OpenMapRealMatrix) m);<a name="line.90"></a>
+<FONT color="green">091</FONT>            } catch (ClassCastException cce) {<a name="line.91"></a>
+<FONT color="green">092</FONT>                return (OpenMapRealMatrix) super.add(m);<a name="line.92"></a>
+<FONT color="green">093</FONT>            }<a name="line.93"></a>
+<FONT color="green">094</FONT>        }<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /**<a name="line.96"></a>
+<FONT color="green">097</FONT>         * Compute the sum of this and &lt;code&gt;m&lt;/code&gt;.<a name="line.97"></a>
+<FONT color="green">098</FONT>         *<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @param m    matrix to be added<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @return     this + m<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.101"></a>
+<FONT color="green">102</FONT>         */<a name="line.102"></a>
+<FONT color="green">103</FONT>        public OpenMapRealMatrix add(OpenMapRealMatrix m) throws IllegalArgumentException {<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>            // safety check<a name="line.105"></a>
+<FONT color="green">106</FONT>            MatrixUtils.checkAdditionCompatible(this, m);<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>            final OpenMapRealMatrix out = new OpenMapRealMatrix(this);<a name="line.108"></a>
+<FONT color="green">109</FONT>            for (OpenIntToDoubleHashMap.Iterator iterator = m.entries.iterator(); iterator.hasNext();) {<a name="line.109"></a>
+<FONT color="green">110</FONT>                iterator.advance();<a name="line.110"></a>
+<FONT color="green">111</FONT>                final int row = iterator.key() / columns;<a name="line.111"></a>
+<FONT color="green">112</FONT>                final int col = iterator.key() - row * columns;<a name="line.112"></a>
+<FONT color="green">113</FONT>                out.setEntry(row, col, getEntry(row, col) + iterator.value());<a name="line.113"></a>
+<FONT color="green">114</FONT>            }<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>            return out;<a name="line.116"></a>
+<FONT color="green">117</FONT>    <a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /** {@inheritDoc} */<a name="line.120"></a>
+<FONT color="green">121</FONT>        @Override<a name="line.121"></a>
+<FONT color="green">122</FONT>        public OpenMapRealMatrix subtract(final RealMatrix m)<a name="line.122"></a>
+<FONT color="green">123</FONT>            throws IllegalArgumentException {<a name="line.123"></a>
+<FONT color="green">124</FONT>            try {<a name="line.124"></a>
+<FONT color="green">125</FONT>                return subtract((OpenMapRealMatrix) m);<a name="line.125"></a>
+<FONT color="green">126</FONT>            } catch (ClassCastException cce) {<a name="line.126"></a>
+<FONT color="green">127</FONT>                return (OpenMapRealMatrix) super.subtract(m);<a name="line.127"></a>
+<FONT color="green">128</FONT>            }<a name="line.128"></a>
+<FONT color="green">129</FONT>        }<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>        /**<a name="line.131"></a>
+<FONT color="green">132</FONT>         * Compute this minus &lt;code&gt;m&lt;/code&gt;.<a name="line.132"></a>
+<FONT color="green">133</FONT>         *<a name="line.133"></a>
+<FONT color="green">134</FONT>         * @param m    matrix to be subtracted<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @return     this - m<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.136"></a>
+<FONT color="green">137</FONT>         */<a name="line.137"></a>
+<FONT color="green">138</FONT>        public OpenMapRealMatrix subtract(OpenMapRealMatrix m) throws IllegalArgumentException {<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>            // safety check<a name="line.140"></a>
+<FONT color="green">141</FONT>            MatrixUtils.checkAdditionCompatible(this, m);<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>            final OpenMapRealMatrix out = new OpenMapRealMatrix(this);<a name="line.143"></a>
+<FONT color="green">144</FONT>            for (OpenIntToDoubleHashMap.Iterator iterator = m.entries.iterator(); iterator.hasNext();) {<a name="line.144"></a>
+<FONT color="green">145</FONT>                iterator.advance();<a name="line.145"></a>
+<FONT color="green">146</FONT>                final int row = iterator.key() / columns;<a name="line.146"></a>
+<FONT color="green">147</FONT>                final int col = iterator.key() - row * columns;<a name="line.147"></a>
+<FONT color="green">148</FONT>                out.setEntry(row, col, getEntry(row, col) - iterator.value());<a name="line.148"></a>
+<FONT color="green">149</FONT>            }<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>            return out;<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>        }<a name="line.153"></a>
+<FONT color="green">154</FONT>    <a name="line.154"></a>
+<FONT color="green">155</FONT>        /** {@inheritDoc} */<a name="line.155"></a>
+<FONT color="green">156</FONT>        @Override<a name="line.156"></a>
+<FONT color="green">157</FONT>        public RealMatrix multiply(final RealMatrix m)<a name="line.157"></a>
+<FONT color="green">158</FONT>            throws IllegalArgumentException {<a name="line.158"></a>
+<FONT color="green">159</FONT>            try {<a name="line.159"></a>
+<FONT color="green">160</FONT>                return multiply((OpenMapRealMatrix) m);<a name="line.160"></a>
+<FONT color="green">161</FONT>            } catch (ClassCastException cce) {<a name="line.161"></a>
+<FONT color="green">162</FONT>    <a name="line.162"></a>
+<FONT color="green">163</FONT>                // safety check<a name="line.163"></a>
+<FONT color="green">164</FONT>                MatrixUtils.checkMultiplicationCompatible(this, m);<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>                final int outCols = m.getColumnDimension();<a name="line.166"></a>
+<FONT color="green">167</FONT>                final BlockRealMatrix out = new BlockRealMatrix(rows, outCols);<a name="line.167"></a>
+<FONT color="green">168</FONT>                for (OpenIntToDoubleHashMap.Iterator iterator = entries.iterator(); iterator.hasNext();) {<a name="line.168"></a>
+<FONT color="green">169</FONT>                    iterator.advance();<a name="line.169"></a>
+<FONT color="green">170</FONT>                    final double value = iterator.value();<a name="line.170"></a>
+<FONT color="green">171</FONT>                    final int key      = iterator.key();<a name="line.171"></a>
+<FONT color="green">172</FONT>                    final int i        = key / columns;<a name="line.172"></a>
+<FONT color="green">173</FONT>                    final int k        = key % columns;<a name="line.173"></a>
+<FONT color="green">174</FONT>                    for (int j = 0; j &lt; outCols; ++j) {<a name="line.174"></a>
+<FONT color="green">175</FONT>                        out.addToEntry(i, j, value * m.getEntry(k, j));<a name="line.175"></a>
+<FONT color="green">176</FONT>                    }<a name="line.176"></a>
+<FONT color="green">177</FONT>                }<a name="line.177"></a>
+<FONT color="green">178</FONT>    <a name="line.178"></a>
+<FONT color="green">179</FONT>                return out;<a name="line.179"></a>
+<FONT color="green">180</FONT>    <a name="line.180"></a>
+<FONT color="green">181</FONT>            }<a name="line.181"></a>
+<FONT color="green">182</FONT>        }<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>        /**<a name="line.184"></a>
+<FONT color="green">185</FONT>         * Returns the result of postmultiplying this by m.<a name="line.185"></a>
+<FONT color="green">186</FONT>         *<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @param m    matrix to postmultiply by<a name="line.187"></a>
+<FONT color="green">188</FONT>         * @return     this * m<a name="line.188"></a>
+<FONT color="green">189</FONT>         * @throws     IllegalArgumentException<a name="line.189"></a>
+<FONT color="green">190</FONT>         *             if columnDimension(this) != rowDimension(m)<a name="line.190"></a>
+<FONT color="green">191</FONT>         */<a name="line.191"></a>
+<FONT color="green">192</FONT>        public OpenMapRealMatrix multiply(OpenMapRealMatrix m) throws IllegalArgumentException {<a name="line.192"></a>
+<FONT color="green">193</FONT>    <a name="line.193"></a>
+<FONT color="green">194</FONT>            // safety check<a name="line.194"></a>
+<FONT color="green">195</FONT>            MatrixUtils.checkMultiplicationCompatible(this, m);<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>            final int outCols = m.getColumnDimension();<a name="line.197"></a>
+<FONT color="green">198</FONT>            OpenMapRealMatrix out = new OpenMapRealMatrix(rows, outCols);<a name="line.198"></a>
+<FONT color="green">199</FONT>            for (OpenIntToDoubleHashMap.Iterator iterator = entries.iterator(); iterator.hasNext();) {<a name="line.199"></a>
+<FONT color="green">200</FONT>                iterator.advance();<a name="line.200"></a>
+<FONT color="green">201</FONT>                final double value = iterator.value();<a name="line.201"></a>
+<FONT color="green">202</FONT>                final int key      = iterator.key();<a name="line.202"></a>
+<FONT color="green">203</FONT>                final int i        = key / columns;<a name="line.203"></a>
+<FONT color="green">204</FONT>                final int k        = key % columns;<a name="line.204"></a>
+<FONT color="green">205</FONT>                for (int j = 0; j &lt; outCols; ++j) {<a name="line.205"></a>
+<FONT color="green">206</FONT>                    final int rightKey = m.computeKey(k, j);<a name="line.206"></a>
+<FONT color="green">207</FONT>                    if (m.entries.containsKey(rightKey)) {<a name="line.207"></a>
+<FONT color="green">208</FONT>                        final int outKey = out.computeKey(i, j);<a name="line.208"></a>
+<FONT color="green">209</FONT>                        final double outValue =<a name="line.209"></a>
+<FONT color="green">210</FONT>                            out.entries.get(outKey) + value * m.entries.get(rightKey);<a name="line.210"></a>
+<FONT color="green">211</FONT>                        if (outValue == 0.0) {<a name="line.211"></a>
+<FONT color="green">212</FONT>                            out.entries.remove(outKey);<a name="line.212"></a>
+<FONT color="green">213</FONT>                        } else {<a name="line.213"></a>
+<FONT color="green">214</FONT>                            out.entries.put(outKey, outValue);<a name="line.214"></a>
+<FONT color="green">215</FONT>                        }<a name="line.215"></a>
+<FONT color="green">216</FONT>                    }<a name="line.216"></a>
+<FONT color="green">217</FONT>                }<a name="line.217"></a>
+<FONT color="green">218</FONT>            }<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>            return out;<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>        }<a name="line.222"></a>
+<FONT color="green">223</FONT>    <a name="line.223"></a>
+<FONT color="green">224</FONT>        /** {@inheritDoc} */<a name="line.224"></a>
+<FONT color="green">225</FONT>        @Override<a name="line.225"></a>
+<FONT color="green">226</FONT>        public double getEntry(int row, int column) throws MatrixIndexException {<a name="line.226"></a>
+<FONT color="green">227</FONT>            MatrixUtils.checkRowIndex(this, row);<a name="line.227"></a>
+<FONT color="green">228</FONT>            MatrixUtils.checkColumnIndex(this, column);<a name="line.228"></a>
+<FONT color="green">229</FONT>            return entries.get(computeKey(row, column));<a name="line.229"></a>
+<FONT color="green">230</FONT>        }<a name="line.230"></a>
+<FONT color="green">231</FONT>    <a name="line.231"></a>
+<FONT color="green">232</FONT>        /** {@inheritDoc} */<a name="line.232"></a>
+<FONT color="green">233</FONT>        @Override<a name="line.233"></a>
+<FONT color="green">234</FONT>        public int getRowDimension() {<a name="line.234"></a>
+<FONT color="green">235</FONT>            return rows;<a name="line.235"></a>
+<FONT color="green">236</FONT>        }<a name="line.236"></a>
+<FONT color="green">237</FONT>    <a name="line.237"></a>
+<FONT color="green">238</FONT>        /** {@inheritDoc} */<a name="line.238"></a>
+<FONT color="green">239</FONT>        @Override<a name="line.239"></a>
+<FONT color="green">240</FONT>        public void setEntry(int row, int column, double value)<a name="line.240"></a>
+<FONT color="green">241</FONT>                throws MatrixIndexException {<a name="line.241"></a>
+<FONT color="green">242</FONT>            MatrixUtils.checkRowIndex(this, row);<a name="line.242"></a>
+<FONT color="green">243</FONT>            MatrixUtils.checkColumnIndex(this, column);<a name="line.243"></a>
+<FONT color="green">244</FONT>            if (value == 0.0) {<a name="line.244"></a>
+<FONT color="green">245</FONT>                entries.remove(computeKey(row, column));<a name="line.245"></a>
+<FONT color="green">246</FONT>            } else {<a name="line.246"></a>
+<FONT color="green">247</FONT>                entries.put(computeKey(row, column), value);<a name="line.247"></a>
+<FONT color="green">248</FONT>            }<a name="line.248"></a>
+<FONT color="green">249</FONT>        }<a name="line.249"></a>
+<FONT color="green">250</FONT>    <a name="line.250"></a>
+<FONT color="green">251</FONT>        /** {@inheritDoc} */<a name="line.251"></a>
+<FONT color="green">252</FONT>        @Override<a name="line.252"></a>
+<FONT color="green">253</FONT>        public void addToEntry(int row, int column, double increment)<a name="line.253"></a>
+<FONT color="green">254</FONT>                throws MatrixIndexException {<a name="line.254"></a>
+<FONT color="green">255</FONT>            MatrixUtils.checkRowIndex(this, row);<a name="line.255"></a>
+<FONT color="green">256</FONT>            MatrixUtils.checkColumnIndex(this, column);<a name="line.256"></a>
+<FONT color="green">257</FONT>            final int key = computeKey(row, column);<a name="line.257"></a>
+<FONT color="green">258</FONT>            final double value = entries.get(key) + increment;<a name="line.258"></a>
+<FONT color="green">259</FONT>            if (value == 0.0) {<a name="line.259"></a>
+<FONT color="green">260</FONT>                entries.remove(key);<a name="line.260"></a>
+<FONT color="green">261</FONT>            } else {<a name="line.261"></a>
+<FONT color="green">262</FONT>                entries.put(key, value);<a name="line.262"></a>
+<FONT color="green">263</FONT>            }<a name="line.263"></a>
+<FONT color="green">264</FONT>        }<a name="line.264"></a>
+<FONT color="green">265</FONT>    <a name="line.265"></a>
+<FONT color="green">266</FONT>        /** {@inheritDoc} */<a name="line.266"></a>
+<FONT color="green">267</FONT>        @Override<a name="line.267"></a>
+<FONT color="green">268</FONT>        public void multiplyEntry(int row, int column, double factor)<a name="line.268"></a>
+<FONT color="green">269</FONT>                throws MatrixIndexException {<a name="line.269"></a>
+<FONT color="green">270</FONT>            MatrixUtils.checkRowIndex(this, row);<a name="line.270"></a>
+<FONT color="green">271</FONT>            MatrixUtils.checkColumnIndex(this, column);<a name="line.271"></a>
+<FONT color="green">272</FONT>            final int key = computeKey(row, column);<a name="line.272"></a>
+<FONT color="green">273</FONT>            final double value = entries.get(key) * factor;<a name="line.273"></a>
+<FONT color="green">274</FONT>            if (value == 0.0) {<a name="line.274"></a>
+<FONT color="green">275</FONT>                entries.remove(key);<a name="line.275"></a>
+<FONT color="green">276</FONT>            } else {<a name="line.276"></a>
+<FONT color="green">277</FONT>                entries.put(key, value);<a name="line.277"></a>
+<FONT color="green">278</FONT>            }<a name="line.278"></a>
+<FONT color="green">279</FONT>        }<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>        /**<a name="line.281"></a>
+<FONT color="green">282</FONT>         * Compute the key to access a matrix element<a name="line.282"></a>
+<FONT color="green">283</FONT>         * @param row row index of the matrix element<a name="line.283"></a>
+<FONT color="green">284</FONT>         * @param column column index of the matrix element<a name="line.284"></a>
+<FONT color="green">285</FONT>         * @return key within the map to access the matrix element<a name="line.285"></a>
+<FONT color="green">286</FONT>         */<a name="line.286"></a>
+<FONT color="green">287</FONT>        private int computeKey(int row, int column) {<a name="line.287"></a>
+<FONT color="green">288</FONT>            return row * columns + column;<a name="line.288"></a>
+<FONT color="green">289</FONT>        }<a name="line.289"></a>
+<FONT color="green">290</FONT>    <a name="line.290"></a>
+<FONT color="green">291</FONT>    <a name="line.291"></a>
+<FONT color="green">292</FONT>    }<a name="line.292"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/OpenMapRealVector.OpenMapEntry.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,968 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.linear;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.util.OpenIntToDoubleHashMap;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.util.OpenIntToDoubleHashMap.Iterator;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * This class implements the {@link RealVector} interface with a {@link OpenIntToDoubleHashMap} backing store.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @since 2.0<a name="line.28"></a>
+<FONT color="green">029</FONT>    */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public class OpenMapRealVector extends AbstractRealVector implements SparseRealVector, Serializable {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** Default Tolerance for having a value considered zero. */<a name="line.32"></a>
+<FONT color="green">033</FONT>        public static final double DEFAULT_ZERO_TOLERANCE = 1.0e-12;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Serializable version identifier. */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private static final long serialVersionUID = 8772222695580707260L;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Entries of the vector. */<a name="line.38"></a>
+<FONT color="green">039</FONT>        private final OpenIntToDoubleHashMap entries;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Dimension of the vector. */<a name="line.41"></a>
+<FONT color="green">042</FONT>        private final int virtualSize;<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Tolerance for having a value considered zero. */<a name="line.44"></a>
+<FONT color="green">045</FONT>        private double epsilon;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Build a 0-length vector.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * &lt;p&gt;Zero-length vectors may be used to initialized construction of vectors<a name="line.49"></a>
+<FONT color="green">050</FONT>         * by data gathering. We start with zero-length and use either the {@link<a name="line.50"></a>
+<FONT color="green">051</FONT>         * #OpenMapRealVector(OpenMapRealVector, int)} constructor<a name="line.51"></a>
+<FONT color="green">052</FONT>         * or one of the &lt;code&gt;append&lt;/code&gt; method ({@link #append(double)}, {@link<a name="line.52"></a>
+<FONT color="green">053</FONT>         * #append(double[])}, {@link #append(RealVector)}) to gather data<a name="line.53"></a>
+<FONT color="green">054</FONT>         * into this vector.&lt;/p&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public OpenMapRealVector() {<a name="line.56"></a>
+<FONT color="green">057</FONT>            this(0, DEFAULT_ZERO_TOLERANCE);<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /**<a name="line.60"></a>
+<FONT color="green">061</FONT>         * Construct a (dimension)-length vector of zeros.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param dimension size of the vector<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public OpenMapRealVector(int dimension) {<a name="line.64"></a>
+<FONT color="green">065</FONT>            this(dimension, DEFAULT_ZERO_TOLERANCE);<a name="line.65"></a>
+<FONT color="green">066</FONT>        }<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /**<a name="line.68"></a>
+<FONT color="green">069</FONT>         * Construct a (dimension)-length vector of zeros, specifying zero tolerance.<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @param dimension Size of the vector<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param epsilon The tolerance for having a value considered zero<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        public OpenMapRealVector(int dimension, double epsilon) {<a name="line.73"></a>
+<FONT color="green">074</FONT>            virtualSize = dimension;<a name="line.74"></a>
+<FONT color="green">075</FONT>            entries = new OpenIntToDoubleHashMap(0.0);<a name="line.75"></a>
+<FONT color="green">076</FONT>            this.epsilon = epsilon;<a name="line.76"></a>
+<FONT color="green">077</FONT>        }<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        /**<a name="line.79"></a>
+<FONT color="green">080</FONT>         * Build a resized vector, for use with append.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @param v The original vector<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @param resize The amount to resize it<a name="line.82"></a>
+<FONT color="green">083</FONT>         */<a name="line.83"></a>
+<FONT color="green">084</FONT>        protected OpenMapRealVector(OpenMapRealVector v, int resize) {<a name="line.84"></a>
+<FONT color="green">085</FONT>            virtualSize = v.getDimension() + resize;<a name="line.85"></a>
+<FONT color="green">086</FONT>            entries = new OpenIntToDoubleHashMap(v.entries);<a name="line.86"></a>
+<FONT color="green">087</FONT>            epsilon = v.epsilon;<a name="line.87"></a>
+<FONT color="green">088</FONT>        }<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>        /**<a name="line.90"></a>
+<FONT color="green">091</FONT>         * Build a vector with known the sparseness (for advanced use only).<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @param dimension The size of the vector<a name="line.92"></a>
+<FONT color="green">093</FONT>         * @param expectedSize The expected number of non-zero entries<a name="line.93"></a>
+<FONT color="green">094</FONT>         */<a name="line.94"></a>
+<FONT color="green">095</FONT>        public OpenMapRealVector(int dimension, int expectedSize) {<a name="line.95"></a>
+<FONT color="green">096</FONT>            this(dimension, expectedSize, DEFAULT_ZERO_TOLERANCE);<a name="line.96"></a>
+<FONT color="green">097</FONT>        }<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>        /**<a name="line.99"></a>
+<FONT color="green">100</FONT>         * Build a vector with known the sparseness and zero tolerance setting (for advanced use only).<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @param dimension The size of the vector<a name="line.101"></a>
+<FONT color="green">102</FONT>         * @param expectedSize The expected number of non-zero entries<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @param epsilon The tolerance for having a value considered zero<a name="line.103"></a>
+<FONT color="green">104</FONT>         */<a name="line.104"></a>
+<FONT color="green">105</FONT>        public OpenMapRealVector(int dimension, int expectedSize, double epsilon) {<a name="line.105"></a>
+<FONT color="green">106</FONT>            virtualSize = dimension;<a name="line.106"></a>
+<FONT color="green">107</FONT>            entries = new OpenIntToDoubleHashMap(expectedSize, 0.0);<a name="line.107"></a>
+<FONT color="green">108</FONT>            this.epsilon = epsilon;<a name="line.108"></a>
+<FONT color="green">109</FONT>        }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /**<a name="line.111"></a>
+<FONT color="green">112</FONT>         * Create from a double array.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * Only non-zero entries will be stored<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param values The set of values to create from<a name="line.114"></a>
+<FONT color="green">115</FONT>         */<a name="line.115"></a>
+<FONT color="green">116</FONT>        public OpenMapRealVector(double[] values) {<a name="line.116"></a>
+<FONT color="green">117</FONT>            this(values, DEFAULT_ZERO_TOLERANCE);<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /**<a name="line.120"></a>
+<FONT color="green">121</FONT>         * Create from a double array, specifying zero tolerance.<a name="line.121"></a>
+<FONT color="green">122</FONT>         * Only non-zero entries will be stored<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @param values The set of values to create from<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @param epsilon The tolerance for having a value considered zero<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        public OpenMapRealVector(double[] values, double epsilon) {<a name="line.126"></a>
+<FONT color="green">127</FONT>            virtualSize = values.length;<a name="line.127"></a>
+<FONT color="green">128</FONT>            entries = new OpenIntToDoubleHashMap(0.0);<a name="line.128"></a>
+<FONT color="green">129</FONT>            this.epsilon = epsilon;<a name="line.129"></a>
+<FONT color="green">130</FONT>            for (int key = 0; key &lt; values.length; key++) {<a name="line.130"></a>
+<FONT color="green">131</FONT>                double value = values[key];<a name="line.131"></a>
+<FONT color="green">132</FONT>                if (!isDefaultValue(value)) {<a name="line.132"></a>
+<FONT color="green">133</FONT>                    entries.put(key, value);<a name="line.133"></a>
+<FONT color="green">134</FONT>                }<a name="line.134"></a>
+<FONT color="green">135</FONT>            }<a name="line.135"></a>
+<FONT color="green">136</FONT>        }<a name="line.136"></a>
+<FONT color="green">137</FONT>    <a name="line.137"></a>
+<FONT color="green">138</FONT>        /**<a name="line.138"></a>
+<FONT color="green">139</FONT>         * Create from a Double array.<a name="line.139"></a>
+<FONT color="green">140</FONT>         * Only non-zero entries will be stored<a name="line.140"></a>
+<FONT color="green">141</FONT>         * @param values The set of values to create from<a name="line.141"></a>
+<FONT color="green">142</FONT>         */<a name="line.142"></a>
+<FONT color="green">143</FONT>        public OpenMapRealVector(Double[] values) {<a name="line.143"></a>
+<FONT color="green">144</FONT>            this(values, DEFAULT_ZERO_TOLERANCE);<a name="line.144"></a>
+<FONT color="green">145</FONT>        }<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>        /**<a name="line.147"></a>
+<FONT color="green">148</FONT>         * Create from a Double array.<a name="line.148"></a>
+<FONT color="green">149</FONT>         * Only non-zero entries will be stored<a name="line.149"></a>
+<FONT color="green">150</FONT>         * @param values The set of values to create from<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @param epsilon The tolerance for having a value considered zero<a name="line.151"></a>
+<FONT color="green">152</FONT>         */<a name="line.152"></a>
+<FONT color="green">153</FONT>        public OpenMapRealVector(Double[] values, double epsilon) {<a name="line.153"></a>
+<FONT color="green">154</FONT>            virtualSize = values.length;<a name="line.154"></a>
+<FONT color="green">155</FONT>            entries = new OpenIntToDoubleHashMap(0.0);<a name="line.155"></a>
+<FONT color="green">156</FONT>            this.epsilon = epsilon;<a name="line.156"></a>
+<FONT color="green">157</FONT>            for (int key = 0; key &lt; values.length; key++) {<a name="line.157"></a>
+<FONT color="green">158</FONT>                double value = values[key].doubleValue();<a name="line.158"></a>
+<FONT color="green">159</FONT>                if (!isDefaultValue(value)) {<a name="line.159"></a>
+<FONT color="green">160</FONT>                    entries.put(key, value);<a name="line.160"></a>
+<FONT color="green">161</FONT>                }<a name="line.161"></a>
+<FONT color="green">162</FONT>            }<a name="line.162"></a>
+<FONT color="green">163</FONT>        }<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>        /**<a name="line.165"></a>
+<FONT color="green">166</FONT>         * Copy constructor.<a name="line.166"></a>
+<FONT color="green">167</FONT>         * @param v The instance to copy from<a name="line.167"></a>
+<FONT color="green">168</FONT>         */<a name="line.168"></a>
+<FONT color="green">169</FONT>        public OpenMapRealVector(OpenMapRealVector v) {<a name="line.169"></a>
+<FONT color="green">170</FONT>            virtualSize = v.getDimension();<a name="line.170"></a>
+<FONT color="green">171</FONT>            entries = new OpenIntToDoubleHashMap(v.getEntries());<a name="line.171"></a>
+<FONT color="green">172</FONT>            epsilon = v.epsilon;<a name="line.172"></a>
+<FONT color="green">173</FONT>        }<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>        /**<a name="line.175"></a>
+<FONT color="green">176</FONT>         * Generic copy constructor.<a name="line.176"></a>
+<FONT color="green">177</FONT>         * @param v The instance to copy from<a name="line.177"></a>
+<FONT color="green">178</FONT>         */<a name="line.178"></a>
+<FONT color="green">179</FONT>        public OpenMapRealVector(RealVector v) {<a name="line.179"></a>
+<FONT color="green">180</FONT>            virtualSize = v.getDimension();<a name="line.180"></a>
+<FONT color="green">181</FONT>            entries = new OpenIntToDoubleHashMap(0.0);<a name="line.181"></a>
+<FONT color="green">182</FONT>            epsilon = DEFAULT_ZERO_TOLERANCE;<a name="line.182"></a>
+<FONT color="green">183</FONT>            for (int key = 0; key &lt; virtualSize; key++) {<a name="line.183"></a>
+<FONT color="green">184</FONT>                double value = v.getEntry(key);<a name="line.184"></a>
+<FONT color="green">185</FONT>                if (!isDefaultValue(value)) {<a name="line.185"></a>
+<FONT color="green">186</FONT>                    entries.put(key, value);<a name="line.186"></a>
+<FONT color="green">187</FONT>                }<a name="line.187"></a>
+<FONT color="green">188</FONT>            }<a name="line.188"></a>
+<FONT color="green">189</FONT>        }<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>        /**<a name="line.191"></a>
+<FONT color="green">192</FONT>         * Get the entries of this instance.<a name="line.192"></a>
+<FONT color="green">193</FONT>         * @return entries of this instance<a name="line.193"></a>
+<FONT color="green">194</FONT>         */<a name="line.194"></a>
+<FONT color="green">195</FONT>        private OpenIntToDoubleHashMap getEntries() {<a name="line.195"></a>
+<FONT color="green">196</FONT>            return entries;<a name="line.196"></a>
+<FONT color="green">197</FONT>        }<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>        /**<a name="line.199"></a>
+<FONT color="green">200</FONT>         * Determine if this value is within epsilon of zero.<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @param value The value to test<a name="line.201"></a>
+<FONT color="green">202</FONT>         * @return &lt;code&gt;true&lt;/code&gt; if this value is within epsilon to zero, &lt;code&gt;false&lt;/code&gt; otherwise<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @since 2.1<a name="line.203"></a>
+<FONT color="green">204</FONT>         */<a name="line.204"></a>
+<FONT color="green">205</FONT>        protected boolean isDefaultValue(double value) {<a name="line.205"></a>
+<FONT color="green">206</FONT>            return Math.abs(value) &lt; epsilon;<a name="line.206"></a>
+<FONT color="green">207</FONT>        }<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>        /** {@inheritDoc} */<a name="line.209"></a>
+<FONT color="green">210</FONT>        @Override<a name="line.210"></a>
+<FONT color="green">211</FONT>        public RealVector add(RealVector v) throws IllegalArgumentException {<a name="line.211"></a>
+<FONT color="green">212</FONT>            checkVectorDimensions(v.getDimension());<a name="line.212"></a>
+<FONT color="green">213</FONT>            if (v instanceof OpenMapRealVector) {<a name="line.213"></a>
+<FONT color="green">214</FONT>                return add((OpenMapRealVector) v);<a name="line.214"></a>
+<FONT color="green">215</FONT>            } else {<a name="line.215"></a>
+<FONT color="green">216</FONT>                return super.add(v);<a name="line.216"></a>
+<FONT color="green">217</FONT>            }<a name="line.217"></a>
+<FONT color="green">218</FONT>        }<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>        /**<a name="line.220"></a>
+<FONT color="green">221</FONT>         * Optimized method to add two OpenMapRealVectors.  Copies the larger vector, iterates over the smaller.<a name="line.221"></a>
+<FONT color="green">222</FONT>         * @param v Vector to add with<a name="line.222"></a>
+<FONT color="green">223</FONT>         * @return The sum of &lt;code&gt;this&lt;/code&gt; with &lt;code&gt;v&lt;/code&gt;<a name="line.223"></a>
+<FONT color="green">224</FONT>         * @throws IllegalArgumentException If the dimensions don't match<a name="line.224"></a>
+<FONT color="green">225</FONT>         */<a name="line.225"></a>
+<FONT color="green">226</FONT>        public OpenMapRealVector add(OpenMapRealVector v) throws IllegalArgumentException{<a name="line.226"></a>
+<FONT color="green">227</FONT>            checkVectorDimensions(v.getDimension());<a name="line.227"></a>
+<FONT color="green">228</FONT>            boolean copyThis = entries.size() &gt; v.entries.size();<a name="line.228"></a>
+<FONT color="green">229</FONT>            OpenMapRealVector res = copyThis ? this.copy() : v.copy();<a name="line.229"></a>
+<FONT color="green">230</FONT>            Iterator iter = copyThis ? v.entries.iterator() : entries.iterator();<a name="line.230"></a>
+<FONT color="green">231</FONT>            OpenIntToDoubleHashMap randomAccess = copyThis ? entries : v.entries;<a name="line.231"></a>
+<FONT color="green">232</FONT>            while (iter.hasNext()) {<a name="line.232"></a>
+<FONT color="green">233</FONT>                iter.advance();<a name="line.233"></a>
+<FONT color="green">234</FONT>                int key = iter.key();<a name="line.234"></a>
+<FONT color="green">235</FONT>                if (randomAccess.containsKey(key)) {<a name="line.235"></a>
+<FONT color="green">236</FONT>                    res.setEntry(key, randomAccess.get(key) + iter.value());<a name="line.236"></a>
+<FONT color="green">237</FONT>                } else {<a name="line.237"></a>
+<FONT color="green">238</FONT>                    res.setEntry(key, iter.value());<a name="line.238"></a>
+<FONT color="green">239</FONT>                }<a name="line.239"></a>
+<FONT color="green">240</FONT>            }<a name="line.240"></a>
+<FONT color="green">241</FONT>            return res;<a name="line.241"></a>
+<FONT color="green">242</FONT>        }<a name="line.242"></a>
+<FONT color="green">243</FONT>    <a name="line.243"></a>
+<FONT color="green">244</FONT>        /**<a name="line.244"></a>
+<FONT color="green">245</FONT>         * Optimized method to append a OpenMapRealVector.<a name="line.245"></a>
+<FONT color="green">246</FONT>         * @param v vector to append<a name="line.246"></a>
+<FONT color="green">247</FONT>         * @return The result of appending &lt;code&gt;v&lt;/code&gt; to self<a name="line.247"></a>
+<FONT color="green">248</FONT>         */<a name="line.248"></a>
+<FONT color="green">249</FONT>        public OpenMapRealVector append(OpenMapRealVector v) {<a name="line.249"></a>
+<FONT color="green">250</FONT>            OpenMapRealVector res = new OpenMapRealVector(this, v.getDimension());<a name="line.250"></a>
+<FONT color="green">251</FONT>            Iterator iter = v.entries.iterator();<a name="line.251"></a>
+<FONT color="green">252</FONT>            while (iter.hasNext()) {<a name="line.252"></a>
+<FONT color="green">253</FONT>                iter.advance();<a name="line.253"></a>
+<FONT color="green">254</FONT>                res.setEntry(iter.key() + virtualSize, iter.value());<a name="line.254"></a>
+<FONT color="green">255</FONT>            }<a name="line.255"></a>
+<FONT color="green">256</FONT>            return res;<a name="line.256"></a>
+<FONT color="green">257</FONT>        }<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>        /** {@inheritDoc} */<a name="line.259"></a>
+<FONT color="green">260</FONT>        public OpenMapRealVector append(RealVector v) {<a name="line.260"></a>
+<FONT color="green">261</FONT>            if (v instanceof OpenMapRealVector) {<a name="line.261"></a>
+<FONT color="green">262</FONT>                return append((OpenMapRealVector) v);<a name="line.262"></a>
+<FONT color="green">263</FONT>            }<a name="line.263"></a>
+<FONT color="green">264</FONT>            return append(v.getData());<a name="line.264"></a>
+<FONT color="green">265</FONT>        }<a name="line.265"></a>
+<FONT color="green">266</FONT>    <a name="line.266"></a>
+<FONT color="green">267</FONT>        /** {@inheritDoc} */<a name="line.267"></a>
+<FONT color="green">268</FONT>        public OpenMapRealVector append(double d) {<a name="line.268"></a>
+<FONT color="green">269</FONT>            OpenMapRealVector res = new OpenMapRealVector(this, 1);<a name="line.269"></a>
+<FONT color="green">270</FONT>            res.setEntry(virtualSize, d);<a name="line.270"></a>
+<FONT color="green">271</FONT>            return res;<a name="line.271"></a>
+<FONT color="green">272</FONT>        }<a name="line.272"></a>
+<FONT color="green">273</FONT>    <a name="line.273"></a>
+<FONT color="green">274</FONT>        /** {@inheritDoc} */<a name="line.274"></a>
+<FONT color="green">275</FONT>        public OpenMapRealVector append(double[] a) {<a name="line.275"></a>
+<FONT color="green">276</FONT>            OpenMapRealVector res = new OpenMapRealVector(this, a.length);<a name="line.276"></a>
+<FONT color="green">277</FONT>            for (int i = 0; i &lt; a.length; i++) {<a name="line.277"></a>
+<FONT color="green">278</FONT>                res.setEntry(i + virtualSize, a[i]);<a name="line.278"></a>
+<FONT color="green">279</FONT>            }<a name="line.279"></a>
+<FONT color="green">280</FONT>            return res;<a name="line.280"></a>
+<FONT color="green">281</FONT>        }<a name="line.281"></a>
+<FONT color="green">282</FONT>    <a name="line.282"></a>
+<FONT color="green">283</FONT>        /**<a name="line.283"></a>
+<FONT color="green">284</FONT>         * {@inheritDoc}<a name="line.284"></a>
+<FONT color="green">285</FONT>         * @since 2.1<a name="line.285"></a>
+<FONT color="green">286</FONT>         */<a name="line.286"></a>
+<FONT color="green">287</FONT>        @Override<a name="line.287"></a>
+<FONT color="green">288</FONT>        public OpenMapRealVector copy() {<a name="line.288"></a>
+<FONT color="green">289</FONT>            return new OpenMapRealVector(this);<a name="line.289"></a>
+<FONT color="green">290</FONT>        }<a name="line.290"></a>
+<FONT color="green">291</FONT>    <a name="line.291"></a>
+<FONT color="green">292</FONT>        /**<a name="line.292"></a>
+<FONT color="green">293</FONT>         * Optimized method to compute the dot product with an OpenMapRealVector.<a name="line.293"></a>
+<FONT color="green">294</FONT>         * Iterates over the smaller of the two.<a name="line.294"></a>
+<FONT color="green">295</FONT>         * @param v The vector to compute the dot product with<a name="line.295"></a>
+<FONT color="green">296</FONT>         * @return The dot product of &lt;code&gt;this&lt;/code&gt; and &lt;code&gt;v&lt;/code&gt;<a name="line.296"></a>
+<FONT color="green">297</FONT>         * @throws IllegalArgumentException If the dimensions don't match<a name="line.297"></a>
+<FONT color="green">298</FONT>         */<a name="line.298"></a>
+<FONT color="green">299</FONT>        public double dotProduct(OpenMapRealVector v) throws IllegalArgumentException {<a name="line.299"></a>
+<FONT color="green">300</FONT>            checkVectorDimensions(v.getDimension());<a name="line.300"></a>
+<FONT color="green">301</FONT>            boolean thisIsSmaller  = entries.size() &lt; v.entries.size();<a name="line.301"></a>
+<FONT color="green">302</FONT>            Iterator iter = thisIsSmaller  ? entries.iterator() : v.entries.iterator();<a name="line.302"></a>
+<FONT color="green">303</FONT>            OpenIntToDoubleHashMap larger = thisIsSmaller  ? v.entries : entries;<a name="line.303"></a>
+<FONT color="green">304</FONT>            double d = 0;<a name="line.304"></a>
+<FONT color="green">305</FONT>            while(iter.hasNext()) {<a name="line.305"></a>
+<FONT color="green">306</FONT>                iter.advance();<a name="line.306"></a>
+<FONT color="green">307</FONT>                d += iter.value() * larger.get(iter.key());<a name="line.307"></a>
+<FONT color="green">308</FONT>            }<a name="line.308"></a>
+<FONT color="green">309</FONT>            return d;<a name="line.309"></a>
+<FONT color="green">310</FONT>        }<a name="line.310"></a>
+<FONT color="green">311</FONT>    <a name="line.311"></a>
+<FONT color="green">312</FONT>        /** {@inheritDoc} */<a name="line.312"></a>
+<FONT color="green">313</FONT>        @Override<a name="line.313"></a>
+<FONT color="green">314</FONT>        public double dotProduct(RealVector v) throws IllegalArgumentException {<a name="line.314"></a>
+<FONT color="green">315</FONT>            if(v instanceof OpenMapRealVector) {<a name="line.315"></a>
+<FONT color="green">316</FONT>                return dotProduct((OpenMapRealVector)v);<a name="line.316"></a>
+<FONT color="green">317</FONT>            } else {<a name="line.317"></a>
+<FONT color="green">318</FONT>                return super.dotProduct(v);<a name="line.318"></a>
+<FONT color="green">319</FONT>            }<a name="line.319"></a>
+<FONT color="green">320</FONT>        }<a name="line.320"></a>
+<FONT color="green">321</FONT>    <a name="line.321"></a>
+<FONT color="green">322</FONT>        /** {@inheritDoc} */<a name="line.322"></a>
+<FONT color="green">323</FONT>        public OpenMapRealVector ebeDivide(RealVector v) throws IllegalArgumentException {<a name="line.323"></a>
+<FONT color="green">324</FONT>            checkVectorDimensions(v.getDimension());<a name="line.324"></a>
+<FONT color="green">325</FONT>            OpenMapRealVector res = new OpenMapRealVector(this);<a name="line.325"></a>
+<FONT color="green">326</FONT>            Iterator iter = res.entries.iterator();<a name="line.326"></a>
+<FONT color="green">327</FONT>            while (iter.hasNext()) {<a name="line.327"></a>
+<FONT color="green">328</FONT>                iter.advance();<a name="line.328"></a>
+<FONT color="green">329</FONT>                res.setEntry(iter.key(), iter.value() / v.getEntry(iter.key()));<a name="line.329"></a>
+<FONT color="green">330</FONT>            }<a name="line.330"></a>
+<FONT color="green">331</FONT>            return res;<a name="line.331"></a>
+<FONT color="green">332</FONT>        }<a name="line.332"></a>
+<FONT color="green">333</FONT>    <a name="line.333"></a>
+<FONT color="green">334</FONT>        /** {@inheritDoc} */<a name="line.334"></a>
+<FONT color="green">335</FONT>        @Override<a name="line.335"></a>
+<FONT color="green">336</FONT>        public OpenMapRealVector ebeDivide(double[] v) throws IllegalArgumentException {<a name="line.336"></a>
+<FONT color="green">337</FONT>            checkVectorDimensions(v.length);<a name="line.337"></a>
+<FONT color="green">338</FONT>            OpenMapRealVector res = new OpenMapRealVector(this);<a name="line.338"></a>
+<FONT color="green">339</FONT>            Iterator iter = res.entries.iterator();<a name="line.339"></a>
+<FONT color="green">340</FONT>            while (iter.hasNext()) {<a name="line.340"></a>
+<FONT color="green">341</FONT>                iter.advance();<a name="line.341"></a>
+<FONT color="green">342</FONT>                res.setEntry(iter.key(), iter.value() / v[iter.key()]);<a name="line.342"></a>
+<FONT color="green">343</FONT>            }<a name="line.343"></a>
+<FONT color="green">344</FONT>            return res;<a name="line.344"></a>
+<FONT color="green">345</FONT>        }<a name="line.345"></a>
+<FONT color="green">346</FONT>    <a name="line.346"></a>
+<FONT color="green">347</FONT>        /** {@inheritDoc} */<a name="line.347"></a>
+<FONT color="green">348</FONT>        public OpenMapRealVector ebeMultiply(RealVector v) throws IllegalArgumentException {<a name="line.348"></a>
+<FONT color="green">349</FONT>            checkVectorDimensions(v.getDimension());<a name="line.349"></a>
+<FONT color="green">350</FONT>            OpenMapRealVector res = new OpenMapRealVector(this);<a name="line.350"></a>
+<FONT color="green">351</FONT>            Iterator iter = res.entries.iterator();<a name="line.351"></a>
+<FONT color="green">352</FONT>            while (iter.hasNext()) {<a name="line.352"></a>
+<FONT color="green">353</FONT>                iter.advance();<a name="line.353"></a>
+<FONT color="green">354</FONT>                res.setEntry(iter.key(), iter.value() * v.getEntry(iter.key()));<a name="line.354"></a>
+<FONT color="green">355</FONT>            }<a name="line.355"></a>
+<FONT color="green">356</FONT>            return res;<a name="line.356"></a>
+<FONT color="green">357</FONT>        }<a name="line.357"></a>
+<FONT color="green">358</FONT>    <a name="line.358"></a>
+<FONT color="green">359</FONT>        /** {@inheritDoc} */<a name="line.359"></a>
+<FONT color="green">360</FONT>        @Override<a name="line.360"></a>
+<FONT color="green">361</FONT>        public OpenMapRealVector ebeMultiply(double[] v) throws IllegalArgumentException {<a name="line.361"></a>
+<FONT color="green">362</FONT>            checkVectorDimensions(v.length);<a name="line.362"></a>
+<FONT color="green">363</FONT>            OpenMapRealVector res = new OpenMapRealVector(this);<a name="line.363"></a>
+<FONT color="green">364</FONT>            Iterator iter = res.entries.iterator();<a name="line.364"></a>
+<FONT color="green">365</FONT>            while (iter.hasNext()) {<a name="line.365"></a>
+<FONT color="green">366</FONT>                iter.advance();<a name="line.366"></a>
+<FONT color="green">367</FONT>                res.setEntry(iter.key(), iter.value() * v[iter.key()]);<a name="line.367"></a>
+<FONT color="green">368</FONT>            }<a name="line.368"></a>
+<FONT color="green">369</FONT>            return res;<a name="line.369"></a>
+<FONT color="green">370</FONT>        }<a name="line.370"></a>
+<FONT color="green">371</FONT>    <a name="line.371"></a>
+<FONT color="green">372</FONT>        /** {@inheritDoc} */<a name="line.372"></a>
+<FONT color="green">373</FONT>        public OpenMapRealVector getSubVector(int index, int n) throws MatrixIndexException {<a name="line.373"></a>
+<FONT color="green">374</FONT>            checkIndex(index);<a name="line.374"></a>
+<FONT color="green">375</FONT>            checkIndex(index + n - 1);<a name="line.375"></a>
+<FONT color="green">376</FONT>            OpenMapRealVector res = new OpenMapRealVector(n);<a name="line.376"></a>
+<FONT color="green">377</FONT>            int end = index + n;<a name="line.377"></a>
+<FONT color="green">378</FONT>            Iterator iter = entries.iterator();<a name="line.378"></a>
+<FONT color="green">379</FONT>            while (iter.hasNext()) {<a name="line.379"></a>
+<FONT color="green">380</FONT>                iter.advance();<a name="line.380"></a>
+<FONT color="green">381</FONT>                int key = iter.key();<a name="line.381"></a>
+<FONT color="green">382</FONT>                if (key &gt;= index &amp;&amp; key &lt; end) {<a name="line.382"></a>
+<FONT color="green">383</FONT>                    res.setEntry(key - index, iter.value());<a name="line.383"></a>
+<FONT color="green">384</FONT>                }<a name="line.384"></a>
+<FONT color="green">385</FONT>            }<a name="line.385"></a>
+<FONT color="green">386</FONT>            return res;<a name="line.386"></a>
+<FONT color="green">387</FONT>        }<a name="line.387"></a>
+<FONT color="green">388</FONT>    <a name="line.388"></a>
+<FONT color="green">389</FONT>        /** {@inheritDoc} */<a name="line.389"></a>
+<FONT color="green">390</FONT>        @Override<a name="line.390"></a>
+<FONT color="green">391</FONT>        public double[] getData() {<a name="line.391"></a>
+<FONT color="green">392</FONT>            double[] res = new double[virtualSize];<a name="line.392"></a>
+<FONT color="green">393</FONT>            Iterator iter = entries.iterator();<a name="line.393"></a>
+<FONT color="green">394</FONT>            while (iter.hasNext()) {<a name="line.394"></a>
+<FONT color="green">395</FONT>                iter.advance();<a name="line.395"></a>
+<FONT color="green">396</FONT>                res[iter.key()] = iter.value();<a name="line.396"></a>
+<FONT color="green">397</FONT>            }<a name="line.397"></a>
+<FONT color="green">398</FONT>            return res;<a name="line.398"></a>
+<FONT color="green">399</FONT>        }<a name="line.399"></a>
+<FONT color="green">400</FONT>    <a name="line.400"></a>
+<FONT color="green">401</FONT>        /** {@inheritDoc} */<a name="line.401"></a>
+<FONT color="green">402</FONT>        public int getDimension() {<a name="line.402"></a>
+<FONT color="green">403</FONT>            return virtualSize;<a name="line.403"></a>
+<FONT color="green">404</FONT>        }<a name="line.404"></a>
+<FONT color="green">405</FONT>    <a name="line.405"></a>
+<FONT color="green">406</FONT>        /**<a name="line.406"></a>
+<FONT color="green">407</FONT>         * Optimized method to compute distance.<a name="line.407"></a>
+<FONT color="green">408</FONT>         * @param v The vector to compute distance to<a name="line.408"></a>
+<FONT color="green">409</FONT>         * @return The distance from &lt;code&gt;this&lt;/code&gt; and &lt;code&gt;v&lt;/code&gt;<a name="line.409"></a>
+<FONT color="green">410</FONT>         * @throws IllegalArgumentException If the dimensions don't match<a name="line.410"></a>
+<FONT color="green">411</FONT>         */<a name="line.411"></a>
+<FONT color="green">412</FONT>        public double getDistance(OpenMapRealVector v) throws IllegalArgumentException {<a name="line.412"></a>
+<FONT color="green">413</FONT>            Iterator iter = entries.iterator();<a name="line.413"></a>
+<FONT color="green">414</FONT>            double res = 0;<a name="line.414"></a>
+<FONT color="green">415</FONT>            while (iter.hasNext()) {<a name="line.415"></a>
+<FONT color="green">416</FONT>                iter.advance();<a name="line.416"></a>
+<FONT color="green">417</FONT>                int key = iter.key();<a name="line.417"></a>
+<FONT color="green">418</FONT>                double delta;<a name="line.418"></a>
+<FONT color="green">419</FONT>                delta = iter.value() - v.getEntry(key);<a name="line.419"></a>
+<FONT color="green">420</FONT>                res += delta * delta;<a name="line.420"></a>
+<FONT color="green">421</FONT>            }<a name="line.421"></a>
+<FONT color="green">422</FONT>            iter = v.getEntries().iterator();<a name="line.422"></a>
+<FONT color="green">423</FONT>            while (iter.hasNext()) {<a name="line.423"></a>
+<FONT color="green">424</FONT>                iter.advance();<a name="line.424"></a>
+<FONT color="green">425</FONT>                int key = iter.key();<a name="line.425"></a>
+<FONT color="green">426</FONT>                if (!entries.containsKey(key)) {<a name="line.426"></a>
+<FONT color="green">427</FONT>                    final double value = iter.value();<a name="line.427"></a>
+<FONT color="green">428</FONT>                    res += value * value;<a name="line.428"></a>
+<FONT color="green">429</FONT>                }<a name="line.429"></a>
+<FONT color="green">430</FONT>            }<a name="line.430"></a>
+<FONT color="green">431</FONT>            return Math.sqrt(res);<a name="line.431"></a>
+<FONT color="green">432</FONT>        }<a name="line.432"></a>
+<FONT color="green">433</FONT>    <a name="line.433"></a>
+<FONT color="green">434</FONT>        /** {@inheritDoc} */<a name="line.434"></a>
+<FONT color="green">435</FONT>        @Override<a name="line.435"></a>
+<FONT color="green">436</FONT>        public double getDistance(RealVector v) throws IllegalArgumentException {<a name="line.436"></a>
+<FONT color="green">437</FONT>            checkVectorDimensions(v.getDimension());<a name="line.437"></a>
+<FONT color="green">438</FONT>            if (v instanceof OpenMapRealVector) {<a name="line.438"></a>
+<FONT color="green">439</FONT>                return getDistance((OpenMapRealVector) v);<a name="line.439"></a>
+<FONT color="green">440</FONT>            }<a name="line.440"></a>
+<FONT color="green">441</FONT>            return getDistance(v.getData());<a name="line.441"></a>
+<FONT color="green">442</FONT>        }<a name="line.442"></a>
+<FONT color="green">443</FONT>    <a name="line.443"></a>
+<FONT color="green">444</FONT>        /** {@inheritDoc} */<a name="line.444"></a>
+<FONT color="green">445</FONT>        @Override<a name="line.445"></a>
+<FONT color="green">446</FONT>        public double getDistance(double[] v) throws IllegalArgumentException {<a name="line.446"></a>
+<FONT color="green">447</FONT>            checkVectorDimensions(v.length);<a name="line.447"></a>
+<FONT color="green">448</FONT>            double res = 0;<a name="line.448"></a>
+<FONT color="green">449</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.449"></a>
+<FONT color="green">450</FONT>                double delta = entries.get(i) - v[i];<a name="line.450"></a>
+<FONT color="green">451</FONT>                res += delta * delta;<a name="line.451"></a>
+<FONT color="green">452</FONT>            }<a name="line.452"></a>
+<FONT color="green">453</FONT>            return Math.sqrt(res);<a name="line.453"></a>
+<FONT color="green">454</FONT>        }<a name="line.454"></a>
+<FONT color="green">455</FONT>    <a name="line.455"></a>
+<FONT color="green">456</FONT>        /** {@inheritDoc} */<a name="line.456"></a>
+<FONT color="green">457</FONT>        public double getEntry(int index) throws MatrixIndexException {<a name="line.457"></a>
+<FONT color="green">458</FONT>            checkIndex(index);<a name="line.458"></a>
+<FONT color="green">459</FONT>            return entries.get(index);<a name="line.459"></a>
+<FONT color="green">460</FONT>        }<a name="line.460"></a>
+<FONT color="green">461</FONT>    <a name="line.461"></a>
+<FONT color="green">462</FONT>        /**<a name="line.462"></a>
+<FONT color="green">463</FONT>         * Distance between two vectors.<a name="line.463"></a>
+<FONT color="green">464</FONT>         * &lt;p&gt;This method computes the distance consistent with<a name="line.464"></a>
+<FONT color="green">465</FONT>         * L&lt;sub&gt;1&lt;/sub&gt; norm, i.e. the sum of the absolute values of<a name="line.465"></a>
+<FONT color="green">466</FONT>         * elements differences.&lt;/p&gt;<a name="line.466"></a>
+<FONT color="green">467</FONT>         * @param v vector to which distance is requested<a name="line.467"></a>
+<FONT color="green">468</FONT>         * @return distance between two vectors.<a name="line.468"></a>
+<FONT color="green">469</FONT>         */<a name="line.469"></a>
+<FONT color="green">470</FONT>        public double getL1Distance(OpenMapRealVector v) {<a name="line.470"></a>
+<FONT color="green">471</FONT>            double max = 0;<a name="line.471"></a>
+<FONT color="green">472</FONT>            Iterator iter = entries.iterator();<a name="line.472"></a>
+<FONT color="green">473</FONT>            while (iter.hasNext()) {<a name="line.473"></a>
+<FONT color="green">474</FONT>                iter.advance();<a name="line.474"></a>
+<FONT color="green">475</FONT>                double delta = Math.abs(iter.value() - v.getEntry(iter.key()));<a name="line.475"></a>
+<FONT color="green">476</FONT>                max += delta;<a name="line.476"></a>
+<FONT color="green">477</FONT>            }<a name="line.477"></a>
+<FONT color="green">478</FONT>            iter = v.getEntries().iterator();<a name="line.478"></a>
+<FONT color="green">479</FONT>            while (iter.hasNext()) {<a name="line.479"></a>
+<FONT color="green">480</FONT>                iter.advance();<a name="line.480"></a>
+<FONT color="green">481</FONT>                int key = iter.key();<a name="line.481"></a>
+<FONT color="green">482</FONT>                if (!entries.containsKey(key)) {<a name="line.482"></a>
+<FONT color="green">483</FONT>                    double delta = Math.abs(iter.value());<a name="line.483"></a>
+<FONT color="green">484</FONT>                    max +=  Math.abs(delta);<a name="line.484"></a>
+<FONT color="green">485</FONT>                }<a name="line.485"></a>
+<FONT color="green">486</FONT>            }<a name="line.486"></a>
+<FONT color="green">487</FONT>            return max;<a name="line.487"></a>
+<FONT color="green">488</FONT>        }<a name="line.488"></a>
+<FONT color="green">489</FONT>    <a name="line.489"></a>
+<FONT color="green">490</FONT>        /** {@inheritDoc} */<a name="line.490"></a>
+<FONT color="green">491</FONT>        @Override<a name="line.491"></a>
+<FONT color="green">492</FONT>        public double getL1Distance(RealVector v) throws IllegalArgumentException {<a name="line.492"></a>
+<FONT color="green">493</FONT>            checkVectorDimensions(v.getDimension());<a name="line.493"></a>
+<FONT color="green">494</FONT>            if (v instanceof OpenMapRealVector) {<a name="line.494"></a>
+<FONT color="green">495</FONT>                return getL1Distance((OpenMapRealVector) v);<a name="line.495"></a>
+<FONT color="green">496</FONT>            }<a name="line.496"></a>
+<FONT color="green">497</FONT>            return getL1Distance(v.getData());<a name="line.497"></a>
+<FONT color="green">498</FONT>        }<a name="line.498"></a>
+<FONT color="green">499</FONT>    <a name="line.499"></a>
+<FONT color="green">500</FONT>        /** {@inheritDoc} */<a name="line.500"></a>
+<FONT color="green">501</FONT>        @Override<a name="line.501"></a>
+<FONT color="green">502</FONT>        public double getL1Distance(double[] v) throws IllegalArgumentException {<a name="line.502"></a>
+<FONT color="green">503</FONT>            checkVectorDimensions(v.length);<a name="line.503"></a>
+<FONT color="green">504</FONT>            double max = 0;<a name="line.504"></a>
+<FONT color="green">505</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.505"></a>
+<FONT color="green">506</FONT>                double delta = Math.abs(getEntry(i) - v[i]);<a name="line.506"></a>
+<FONT color="green">507</FONT>                max += delta;<a name="line.507"></a>
+<FONT color="green">508</FONT>            }<a name="line.508"></a>
+<FONT color="green">509</FONT>            return max;<a name="line.509"></a>
+<FONT color="green">510</FONT>        }<a name="line.510"></a>
+<FONT color="green">511</FONT>    <a name="line.511"></a>
+<FONT color="green">512</FONT>        /**<a name="line.512"></a>
+<FONT color="green">513</FONT>         * Optimized method to compute LInfDistance.<a name="line.513"></a>
+<FONT color="green">514</FONT>         * @param v The vector to compute from<a name="line.514"></a>
+<FONT color="green">515</FONT>         * @return the LInfDistance<a name="line.515"></a>
+<FONT color="green">516</FONT>         */<a name="line.516"></a>
+<FONT color="green">517</FONT>        private double getLInfDistance(OpenMapRealVector v) {<a name="line.517"></a>
+<FONT color="green">518</FONT>            double max = 0;<a name="line.518"></a>
+<FONT color="green">519</FONT>            Iterator iter = entries.iterator();<a name="line.519"></a>
+<FONT color="green">520</FONT>            while (iter.hasNext()) {<a name="line.520"></a>
+<FONT color="green">521</FONT>                iter.advance();<a name="line.521"></a>
+<FONT color="green">522</FONT>                double delta = Math.abs(iter.value() - v.getEntry(iter.key()));<a name="line.522"></a>
+<FONT color="green">523</FONT>                if (delta &gt; max) {<a name="line.523"></a>
+<FONT color="green">524</FONT>                    max = delta;<a name="line.524"></a>
+<FONT color="green">525</FONT>                }<a name="line.525"></a>
+<FONT color="green">526</FONT>            }<a name="line.526"></a>
+<FONT color="green">527</FONT>            iter = v.getEntries().iterator();<a name="line.527"></a>
+<FONT color="green">528</FONT>            while (iter.hasNext()) {<a name="line.528"></a>
+<FONT color="green">529</FONT>                iter.advance();<a name="line.529"></a>
+<FONT color="green">530</FONT>                int key = iter.key();<a name="line.530"></a>
+<FONT color="green">531</FONT>                if (!entries.containsKey(key)) {<a name="line.531"></a>
+<FONT color="green">532</FONT>                    if (iter.value() &gt; max) {<a name="line.532"></a>
+<FONT color="green">533</FONT>                        max = iter.value();<a name="line.533"></a>
+<FONT color="green">534</FONT>                    }<a name="line.534"></a>
+<FONT color="green">535</FONT>                }<a name="line.535"></a>
+<FONT color="green">536</FONT>            }<a name="line.536"></a>
+<FONT color="green">537</FONT>            return max;<a name="line.537"></a>
+<FONT color="green">538</FONT>        }<a name="line.538"></a>
+<FONT color="green">539</FONT>    <a name="line.539"></a>
+<FONT color="green">540</FONT>        /** {@inheritDoc} */<a name="line.540"></a>
+<FONT color="green">541</FONT>        @Override<a name="line.541"></a>
+<FONT color="green">542</FONT>        public double getLInfDistance(RealVector v) throws IllegalArgumentException {<a name="line.542"></a>
+<FONT color="green">543</FONT>            checkVectorDimensions(v.getDimension());<a name="line.543"></a>
+<FONT color="green">544</FONT>            if (v instanceof OpenMapRealVector) {<a name="line.544"></a>
+<FONT color="green">545</FONT>                return getLInfDistance((OpenMapRealVector) v);<a name="line.545"></a>
+<FONT color="green">546</FONT>            }<a name="line.546"></a>
+<FONT color="green">547</FONT>            return getLInfDistance(v.getData());<a name="line.547"></a>
+<FONT color="green">548</FONT>        }<a name="line.548"></a>
+<FONT color="green">549</FONT>    <a name="line.549"></a>
+<FONT color="green">550</FONT>        /** {@inheritDoc} */<a name="line.550"></a>
+<FONT color="green">551</FONT>        @Override<a name="line.551"></a>
+<FONT color="green">552</FONT>        public double getLInfDistance(double[] v) throws IllegalArgumentException {<a name="line.552"></a>
+<FONT color="green">553</FONT>            checkVectorDimensions(v.length);<a name="line.553"></a>
+<FONT color="green">554</FONT>            double max = 0;<a name="line.554"></a>
+<FONT color="green">555</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.555"></a>
+<FONT color="green">556</FONT>                double delta = Math.abs(getEntry(i) - v[i]);<a name="line.556"></a>
+<FONT color="green">557</FONT>                if (delta &gt; max) {<a name="line.557"></a>
+<FONT color="green">558</FONT>                    max = delta;<a name="line.558"></a>
+<FONT color="green">559</FONT>                }<a name="line.559"></a>
+<FONT color="green">560</FONT>            }<a name="line.560"></a>
+<FONT color="green">561</FONT>            return max;<a name="line.561"></a>
+<FONT color="green">562</FONT>        }<a name="line.562"></a>
+<FONT color="green">563</FONT>    <a name="line.563"></a>
+<FONT color="green">564</FONT>        /** {@inheritDoc} */<a name="line.564"></a>
+<FONT color="green">565</FONT>        public boolean isInfinite() {<a name="line.565"></a>
+<FONT color="green">566</FONT>            boolean infiniteFound = false;<a name="line.566"></a>
+<FONT color="green">567</FONT>            Iterator iter = entries.iterator();<a name="line.567"></a>
+<FONT color="green">568</FONT>            while (iter.hasNext()) {<a name="line.568"></a>
+<FONT color="green">569</FONT>                iter.advance();<a name="line.569"></a>
+<FONT color="green">570</FONT>                final double value = iter.value();<a name="line.570"></a>
+<FONT color="green">571</FONT>                if (Double.isNaN(value)) {<a name="line.571"></a>
+<FONT color="green">572</FONT>                    return false;<a name="line.572"></a>
+<FONT color="green">573</FONT>                }<a name="line.573"></a>
+<FONT color="green">574</FONT>                if (Double.isInfinite(value)) {<a name="line.574"></a>
+<FONT color="green">575</FONT>                    infiniteFound = true;<a name="line.575"></a>
+<FONT color="green">576</FONT>                }<a name="line.576"></a>
+<FONT color="green">577</FONT>            }<a name="line.577"></a>
+<FONT color="green">578</FONT>            return infiniteFound;<a name="line.578"></a>
+<FONT color="green">579</FONT>        }<a name="line.579"></a>
+<FONT color="green">580</FONT>    <a name="line.580"></a>
+<FONT color="green">581</FONT>        /** {@inheritDoc} */<a name="line.581"></a>
+<FONT color="green">582</FONT>        public boolean isNaN() {<a name="line.582"></a>
+<FONT color="green">583</FONT>            Iterator iter = entries.iterator();<a name="line.583"></a>
+<FONT color="green">584</FONT>            while (iter.hasNext()) {<a name="line.584"></a>
+<FONT color="green">585</FONT>                iter.advance();<a name="line.585"></a>
+<FONT color="green">586</FONT>                if (Double.isNaN(iter.value())) {<a name="line.586"></a>
+<FONT color="green">587</FONT>                    return true;<a name="line.587"></a>
+<FONT color="green">588</FONT>                }<a name="line.588"></a>
+<FONT color="green">589</FONT>            }<a name="line.589"></a>
+<FONT color="green">590</FONT>            return false;<a name="line.590"></a>
+<FONT color="green">591</FONT>        }<a name="line.591"></a>
+<FONT color="green">592</FONT>    <a name="line.592"></a>
+<FONT color="green">593</FONT>        /** {@inheritDoc} */<a name="line.593"></a>
+<FONT color="green">594</FONT>        @Override<a name="line.594"></a>
+<FONT color="green">595</FONT>        public OpenMapRealVector mapAdd(double d) {<a name="line.595"></a>
+<FONT color="green">596</FONT>            return copy().mapAddToSelf(d);<a name="line.596"></a>
+<FONT color="green">597</FONT>        }<a name="line.597"></a>
+<FONT color="green">598</FONT>    <a name="line.598"></a>
+<FONT color="green">599</FONT>        /** {@inheritDoc} */<a name="line.599"></a>
+<FONT color="green">600</FONT>        @Override<a name="line.600"></a>
+<FONT color="green">601</FONT>        public OpenMapRealVector mapAddToSelf(double d) {<a name="line.601"></a>
+<FONT color="green">602</FONT>            for (int i = 0; i &lt; virtualSize; i++) {<a name="line.602"></a>
+<FONT color="green">603</FONT>                setEntry(i, getEntry(i) + d);<a name="line.603"></a>
+<FONT color="green">604</FONT>            }<a name="line.604"></a>
+<FONT color="green">605</FONT>            return this;<a name="line.605"></a>
+<FONT color="green">606</FONT>        }<a name="line.606"></a>
+<FONT color="green">607</FONT>    <a name="line.607"></a>
+<FONT color="green">608</FONT>         /** {@inheritDoc} */<a name="line.608"></a>
+<FONT color="green">609</FONT>        @Override<a name="line.609"></a>
+<FONT color="green">610</FONT>        public RealMatrix outerProduct(double[] v) throws IllegalArgumentException {<a name="line.610"></a>
+<FONT color="green">611</FONT>            checkVectorDimensions(v.length);<a name="line.611"></a>
+<FONT color="green">612</FONT>            RealMatrix res = new OpenMapRealMatrix(virtualSize, virtualSize);<a name="line.612"></a>
+<FONT color="green">613</FONT>            Iterator iter = entries.iterator();<a name="line.613"></a>
+<FONT color="green">614</FONT>            while (iter.hasNext()) {<a name="line.614"></a>
+<FONT color="green">615</FONT>                iter.advance();<a name="line.615"></a>
+<FONT color="green">616</FONT>                int row = iter.key();<a name="line.616"></a>
+<FONT color="green">617</FONT>                double value = iter.value();<a name="line.617"></a>
+<FONT color="green">618</FONT>                for (int col = 0; col &lt; virtualSize; col++) {<a name="line.618"></a>
+<FONT color="green">619</FONT>                    res.setEntry(row, col, value * v[col]);<a name="line.619"></a>
+<FONT color="green">620</FONT>                }<a name="line.620"></a>
+<FONT color="green">621</FONT>            }<a name="line.621"></a>
+<FONT color="green">622</FONT>            return res;<a name="line.622"></a>
+<FONT color="green">623</FONT>        }<a name="line.623"></a>
+<FONT color="green">624</FONT>    <a name="line.624"></a>
+<FONT color="green">625</FONT>        /** {@inheritDoc} */<a name="line.625"></a>
+<FONT color="green">626</FONT>        public RealVector projection(RealVector v) throws IllegalArgumentException {<a name="line.626"></a>
+<FONT color="green">627</FONT>            checkVectorDimensions(v.getDimension());<a name="line.627"></a>
+<FONT color="green">628</FONT>            return v.mapMultiply(dotProduct(v) / v.dotProduct(v));<a name="line.628"></a>
+<FONT color="green">629</FONT>        }<a name="line.629"></a>
+<FONT color="green">630</FONT>    <a name="line.630"></a>
+<FONT color="green">631</FONT>        /** {@inheritDoc} */<a name="line.631"></a>
+<FONT color="green">632</FONT>        @Override<a name="line.632"></a>
+<FONT color="green">633</FONT>        public OpenMapRealVector projection(double[] v) throws IllegalArgumentException {<a name="line.633"></a>
+<FONT color="green">634</FONT>            checkVectorDimensions(v.length);<a name="line.634"></a>
+<FONT color="green">635</FONT>            return (OpenMapRealVector) projection(new OpenMapRealVector(v));<a name="line.635"></a>
+<FONT color="green">636</FONT>        }<a name="line.636"></a>
+<FONT color="green">637</FONT>    <a name="line.637"></a>
+<FONT color="green">638</FONT>        /** {@inheritDoc} */<a name="line.638"></a>
+<FONT color="green">639</FONT>        public void setEntry(int index, double value) throws MatrixIndexException {<a name="line.639"></a>
+<FONT color="green">640</FONT>            checkIndex(index);<a name="line.640"></a>
+<FONT color="green">641</FONT>            if (!isDefaultValue(value)) {<a name="line.641"></a>
+<FONT color="green">642</FONT>                entries.put(index, value);<a name="line.642"></a>
+<FONT color="green">643</FONT>            } else if (entries.containsKey(index)) {<a name="line.643"></a>
+<FONT color="green">644</FONT>                entries.remove(index);<a name="line.644"></a>
+<FONT color="green">645</FONT>            }<a name="line.645"></a>
+<FONT color="green">646</FONT>        }<a name="line.646"></a>
+<FONT color="green">647</FONT>    <a name="line.647"></a>
+<FONT color="green">648</FONT>        /** {@inheritDoc} */<a name="line.648"></a>
+<FONT color="green">649</FONT>        @Override<a name="line.649"></a>
+<FONT color="green">650</FONT>        public void setSubVector(int index, RealVector v) throws MatrixIndexException {<a name="line.650"></a>
+<FONT color="green">651</FONT>            checkIndex(index);<a name="line.651"></a>
+<FONT color="green">652</FONT>            checkIndex(index + v.getDimension() - 1);<a name="line.652"></a>
+<FONT color="green">653</FONT>            setSubVector(index, v.getData());<a name="line.653"></a>
+<FONT color="green">654</FONT>        }<a name="line.654"></a>
+<FONT color="green">655</FONT>    <a name="line.655"></a>
+<FONT color="green">656</FONT>        /** {@inheritDoc} */<a name="line.656"></a>
+<FONT color="green">657</FONT>        @Override<a name="line.657"></a>
+<FONT color="green">658</FONT>        public void setSubVector(int index, double[] v) throws MatrixIndexException {<a name="line.658"></a>
+<FONT color="green">659</FONT>            checkIndex(index);<a name="line.659"></a>
+<FONT color="green">660</FONT>            checkIndex(index + v.length - 1);<a name="line.660"></a>
+<FONT color="green">661</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.661"></a>
+<FONT color="green">662</FONT>                setEntry(i + index, v[i]);<a name="line.662"></a>
+<FONT color="green">663</FONT>            }<a name="line.663"></a>
+<FONT color="green">664</FONT>        }<a name="line.664"></a>
+<FONT color="green">665</FONT>    <a name="line.665"></a>
+<FONT color="green">666</FONT>        /** {@inheritDoc} */<a name="line.666"></a>
+<FONT color="green">667</FONT>        @Override<a name="line.667"></a>
+<FONT color="green">668</FONT>        public void set(double value) {<a name="line.668"></a>
+<FONT color="green">669</FONT>            for (int i = 0; i &lt; virtualSize; i++) {<a name="line.669"></a>
+<FONT color="green">670</FONT>                setEntry(i, value);<a name="line.670"></a>
+<FONT color="green">671</FONT>            }<a name="line.671"></a>
+<FONT color="green">672</FONT>        }<a name="line.672"></a>
+<FONT color="green">673</FONT>    <a name="line.673"></a>
+<FONT color="green">674</FONT>        /**<a name="line.674"></a>
+<FONT color="green">675</FONT>         * Optimized method to subtract OpenMapRealVectors.<a name="line.675"></a>
+<FONT color="green">676</FONT>         * @param v The vector to subtract from &lt;code&gt;this&lt;/code&gt;<a name="line.676"></a>
+<FONT color="green">677</FONT>         * @return The difference of &lt;code&gt;this&lt;/code&gt; and &lt;code&gt;v&lt;/code&gt;<a name="line.677"></a>
+<FONT color="green">678</FONT>         * @throws IllegalArgumentException If the dimensions don't match<a name="line.678"></a>
+<FONT color="green">679</FONT>         */<a name="line.679"></a>
+<FONT color="green">680</FONT>        public OpenMapRealVector subtract(OpenMapRealVector v) throws IllegalArgumentException{<a name="line.680"></a>
+<FONT color="green">681</FONT>            checkVectorDimensions(v.getDimension());<a name="line.681"></a>
+<FONT color="green">682</FONT>            OpenMapRealVector res = copy();<a name="line.682"></a>
+<FONT color="green">683</FONT>            Iterator iter = v.getEntries().iterator();<a name="line.683"></a>
+<FONT color="green">684</FONT>            while (iter.hasNext()) {<a name="line.684"></a>
+<FONT color="green">685</FONT>                iter.advance();<a name="line.685"></a>
+<FONT color="green">686</FONT>                int key = iter.key();<a name="line.686"></a>
+<FONT color="green">687</FONT>                if (entries.containsKey(key)) {<a name="line.687"></a>
+<FONT color="green">688</FONT>                    res.setEntry(key, entries.get(key) - iter.value());<a name="line.688"></a>
+<FONT color="green">689</FONT>                } else {<a name="line.689"></a>
+<FONT color="green">690</FONT>                    res.setEntry(key, -iter.value());<a name="line.690"></a>
+<FONT color="green">691</FONT>                }<a name="line.691"></a>
+<FONT color="green">692</FONT>            }<a name="line.692"></a>
+<FONT color="green">693</FONT>            return res;<a name="line.693"></a>
+<FONT color="green">694</FONT>        }<a name="line.694"></a>
+<FONT color="green">695</FONT>    <a name="line.695"></a>
+<FONT color="green">696</FONT>        /** {@inheritDoc} */<a name="line.696"></a>
+<FONT color="green">697</FONT>        @Override<a name="line.697"></a>
+<FONT color="green">698</FONT>        public OpenMapRealVector subtract(RealVector v) throws IllegalArgumentException {<a name="line.698"></a>
+<FONT color="green">699</FONT>            checkVectorDimensions(v.getDimension());<a name="line.699"></a>
+<FONT color="green">700</FONT>            if (v instanceof OpenMapRealVector) {<a name="line.700"></a>
+<FONT color="green">701</FONT>                return subtract((OpenMapRealVector) v);<a name="line.701"></a>
+<FONT color="green">702</FONT>            }<a name="line.702"></a>
+<FONT color="green">703</FONT>            return subtract(v.getData());<a name="line.703"></a>
+<FONT color="green">704</FONT>        }<a name="line.704"></a>
+<FONT color="green">705</FONT>    <a name="line.705"></a>
+<FONT color="green">706</FONT>        /** {@inheritDoc} */<a name="line.706"></a>
+<FONT color="green">707</FONT>        @Override<a name="line.707"></a>
+<FONT color="green">708</FONT>        public OpenMapRealVector subtract(double[] v) throws IllegalArgumentException {<a name="line.708"></a>
+<FONT color="green">709</FONT>            checkVectorDimensions(v.length);<a name="line.709"></a>
+<FONT color="green">710</FONT>            OpenMapRealVector res = new OpenMapRealVector(this);<a name="line.710"></a>
+<FONT color="green">711</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.711"></a>
+<FONT color="green">712</FONT>                if (entries.containsKey(i)) {<a name="line.712"></a>
+<FONT color="green">713</FONT>                    res.setEntry(i, entries.get(i) - v[i]);<a name="line.713"></a>
+<FONT color="green">714</FONT>                } else {<a name="line.714"></a>
+<FONT color="green">715</FONT>                    res.setEntry(i, -v[i]);<a name="line.715"></a>
+<FONT color="green">716</FONT>                }<a name="line.716"></a>
+<FONT color="green">717</FONT>            }<a name="line.717"></a>
+<FONT color="green">718</FONT>            return res;<a name="line.718"></a>
+<FONT color="green">719</FONT>        }<a name="line.719"></a>
+<FONT color="green">720</FONT>    <a name="line.720"></a>
+<FONT color="green">721</FONT>    <a name="line.721"></a>
+<FONT color="green">722</FONT>        /** {@inheritDoc} */<a name="line.722"></a>
+<FONT color="green">723</FONT>        @Override<a name="line.723"></a>
+<FONT color="green">724</FONT>        public OpenMapRealVector unitVector() {<a name="line.724"></a>
+<FONT color="green">725</FONT>            OpenMapRealVector res = copy();<a name="line.725"></a>
+<FONT color="green">726</FONT>            res.unitize();<a name="line.726"></a>
+<FONT color="green">727</FONT>            return res;<a name="line.727"></a>
+<FONT color="green">728</FONT>        }<a name="line.728"></a>
+<FONT color="green">729</FONT>    <a name="line.729"></a>
+<FONT color="green">730</FONT>        /** {@inheritDoc} */<a name="line.730"></a>
+<FONT color="green">731</FONT>        @Override<a name="line.731"></a>
+<FONT color="green">732</FONT>        public void unitize() {<a name="line.732"></a>
+<FONT color="green">733</FONT>            double norm = getNorm();<a name="line.733"></a>
+<FONT color="green">734</FONT>            if (isDefaultValue(norm)) {<a name="line.734"></a>
+<FONT color="green">735</FONT>                throw  MathRuntimeException.createArithmeticException("cannot normalize a zero norm vector");<a name="line.735"></a>
+<FONT color="green">736</FONT>            }<a name="line.736"></a>
+<FONT color="green">737</FONT>            Iterator iter = entries.iterator();<a name="line.737"></a>
+<FONT color="green">738</FONT>            while (iter.hasNext()) {<a name="line.738"></a>
+<FONT color="green">739</FONT>                iter.advance();<a name="line.739"></a>
+<FONT color="green">740</FONT>                entries.put(iter.key(), iter.value() / norm);<a name="line.740"></a>
+<FONT color="green">741</FONT>            }<a name="line.741"></a>
+<FONT color="green">742</FONT>    <a name="line.742"></a>
+<FONT color="green">743</FONT>        }<a name="line.743"></a>
+<FONT color="green">744</FONT>    <a name="line.744"></a>
+<FONT color="green">745</FONT>    <a name="line.745"></a>
+<FONT color="green">746</FONT>        /** {@inheritDoc} */<a name="line.746"></a>
+<FONT color="green">747</FONT>        @Override<a name="line.747"></a>
+<FONT color="green">748</FONT>        public double[] toArray() {<a name="line.748"></a>
+<FONT color="green">749</FONT>            return getData();<a name="line.749"></a>
+<FONT color="green">750</FONT>        }<a name="line.750"></a>
+<FONT color="green">751</FONT>    <a name="line.751"></a>
+<FONT color="green">752</FONT>        /** {@inheritDoc}<a name="line.752"></a>
+<FONT color="green">753</FONT>         * &lt;p&gt; Implementation Note: This works on exact values, and as a result<a name="line.753"></a>
+<FONT color="green">754</FONT>         * it is possible for {@code a.subtract(b)} to be the zero vector, while<a name="line.754"></a>
+<FONT color="green">755</FONT>         * {@code a.hashCode() != b.hashCode()}.&lt;/p&gt;<a name="line.755"></a>
+<FONT color="green">756</FONT>         */<a name="line.756"></a>
+<FONT color="green">757</FONT>        @Override<a name="line.757"></a>
+<FONT color="green">758</FONT>        public int hashCode() {<a name="line.758"></a>
+<FONT color="green">759</FONT>            final int prime = 31;<a name="line.759"></a>
+<FONT color="green">760</FONT>            int result = 1;<a name="line.760"></a>
+<FONT color="green">761</FONT>            long temp;<a name="line.761"></a>
+<FONT color="green">762</FONT>            temp = Double.doubleToLongBits(epsilon);<a name="line.762"></a>
+<FONT color="green">763</FONT>            result = prime * result + (int) (temp ^ (temp &gt;&gt;&gt; 32));<a name="line.763"></a>
+<FONT color="green">764</FONT>            result = prime * result + virtualSize;<a name="line.764"></a>
+<FONT color="green">765</FONT>            Iterator iter = entries.iterator();<a name="line.765"></a>
+<FONT color="green">766</FONT>            while (iter.hasNext()) {<a name="line.766"></a>
+<FONT color="green">767</FONT>                iter.advance();<a name="line.767"></a>
+<FONT color="green">768</FONT>                temp = Double.doubleToLongBits(iter.value());<a name="line.768"></a>
+<FONT color="green">769</FONT>                result = prime * result + (int) (temp ^ (temp &gt;&gt;32));<a name="line.769"></a>
+<FONT color="green">770</FONT>            }<a name="line.770"></a>
+<FONT color="green">771</FONT>            return result;<a name="line.771"></a>
+<FONT color="green">772</FONT>        }<a name="line.772"></a>
+<FONT color="green">773</FONT>    <a name="line.773"></a>
+<FONT color="green">774</FONT>        /**<a name="line.774"></a>
+<FONT color="green">775</FONT>         * &lt;p&gt; Implementation Note: This performs an exact comparison, and as a result<a name="line.775"></a>
+<FONT color="green">776</FONT>         * it is possible for {@code a.subtract(b}} to be the zero vector, while<a name="line.776"></a>
+<FONT color="green">777</FONT>         * {@code  a.equals(b) == false}.&lt;/p&gt;<a name="line.777"></a>
+<FONT color="green">778</FONT>         * {@inheritDoc}<a name="line.778"></a>
+<FONT color="green">779</FONT>         */<a name="line.779"></a>
+<FONT color="green">780</FONT>        @Override<a name="line.780"></a>
+<FONT color="green">781</FONT>        public boolean equals(Object obj) {<a name="line.781"></a>
+<FONT color="green">782</FONT>            if (this == obj) {<a name="line.782"></a>
+<FONT color="green">783</FONT>                return true;<a name="line.783"></a>
+<FONT color="green">784</FONT>            }<a name="line.784"></a>
+<FONT color="green">785</FONT>            if (!(obj instanceof OpenMapRealVector)) {<a name="line.785"></a>
+<FONT color="green">786</FONT>                return false;<a name="line.786"></a>
+<FONT color="green">787</FONT>            }<a name="line.787"></a>
+<FONT color="green">788</FONT>            OpenMapRealVector other = (OpenMapRealVector) obj;<a name="line.788"></a>
+<FONT color="green">789</FONT>            if (virtualSize != other.virtualSize) {<a name="line.789"></a>
+<FONT color="green">790</FONT>                return false;<a name="line.790"></a>
+<FONT color="green">791</FONT>            }<a name="line.791"></a>
+<FONT color="green">792</FONT>            if (Double.doubleToLongBits(epsilon) !=<a name="line.792"></a>
+<FONT color="green">793</FONT>                Double.doubleToLongBits(other.epsilon)) {<a name="line.793"></a>
+<FONT color="green">794</FONT>                return false;<a name="line.794"></a>
+<FONT color="green">795</FONT>            }<a name="line.795"></a>
+<FONT color="green">796</FONT>            Iterator iter = entries.iterator();<a name="line.796"></a>
+<FONT color="green">797</FONT>            while (iter.hasNext()) {<a name="line.797"></a>
+<FONT color="green">798</FONT>                iter.advance();<a name="line.798"></a>
+<FONT color="green">799</FONT>                double test = other.getEntry(iter.key());<a name="line.799"></a>
+<FONT color="green">800</FONT>                if (Double.doubleToLongBits(test) != Double.doubleToLongBits(iter.value())) {<a name="line.800"></a>
+<FONT color="green">801</FONT>                    return false;<a name="line.801"></a>
+<FONT color="green">802</FONT>                }<a name="line.802"></a>
+<FONT color="green">803</FONT>            }<a name="line.803"></a>
+<FONT color="green">804</FONT>            iter = other.getEntries().iterator();<a name="line.804"></a>
+<FONT color="green">805</FONT>            while (iter.hasNext()) {<a name="line.805"></a>
+<FONT color="green">806</FONT>                iter.advance();<a name="line.806"></a>
+<FONT color="green">807</FONT>                double test = iter.value();<a name="line.807"></a>
+<FONT color="green">808</FONT>                if (Double.doubleToLongBits(test) != Double.doubleToLongBits(getEntry(iter.key()))) {<a name="line.808"></a>
+<FONT color="green">809</FONT>                    return false;<a name="line.809"></a>
+<FONT color="green">810</FONT>                }<a name="line.810"></a>
+<FONT color="green">811</FONT>            }<a name="line.811"></a>
+<FONT color="green">812</FONT>            return true;<a name="line.812"></a>
+<FONT color="green">813</FONT>        }<a name="line.813"></a>
+<FONT color="green">814</FONT>    <a name="line.814"></a>
+<FONT color="green">815</FONT>        /**<a name="line.815"></a>
+<FONT color="green">816</FONT>         *<a name="line.816"></a>
+<FONT color="green">817</FONT>         * @return the percentage of none zero elements as a decimal percent.<a name="line.817"></a>
+<FONT color="green">818</FONT>         */<a name="line.818"></a>
+<FONT color="green">819</FONT>        public double getSparcity() {<a name="line.819"></a>
+<FONT color="green">820</FONT>            return (double)entries.size()/(double)getDimension();<a name="line.820"></a>
+<FONT color="green">821</FONT>        }<a name="line.821"></a>
+<FONT color="green">822</FONT>    <a name="line.822"></a>
+<FONT color="green">823</FONT>        /** {@inheritDoc} */<a name="line.823"></a>
+<FONT color="green">824</FONT>        @Override<a name="line.824"></a>
+<FONT color="green">825</FONT>        public java.util.Iterator&lt;Entry&gt; sparseIterator() {<a name="line.825"></a>
+<FONT color="green">826</FONT>            return new OpenMapSparseIterator();<a name="line.826"></a>
+<FONT color="green">827</FONT>        }<a name="line.827"></a>
+<FONT color="green">828</FONT>    <a name="line.828"></a>
+<FONT color="green">829</FONT>        /**<a name="line.829"></a>
+<FONT color="green">830</FONT>         *  Implementation of &lt;code&gt;Entry&lt;/code&gt; optimized for OpenMap.<a name="line.830"></a>
+<FONT color="green">831</FONT>         * &lt;p&gt;This implementation does not allow arbitrary calls to &lt;code&gt;setIndex&lt;/code&gt;<a name="line.831"></a>
+<FONT color="green">832</FONT>         * since the order that entries are returned is undefined.<a name="line.832"></a>
+<FONT color="green">833</FONT>         */<a name="line.833"></a>
+<FONT color="green">834</FONT>        protected class OpenMapEntry extends Entry {<a name="line.834"></a>
+<FONT color="green">835</FONT>    <a name="line.835"></a>
+<FONT color="green">836</FONT>            /** Iterator pointing to the entry. */<a name="line.836"></a>
+<FONT color="green">837</FONT>            private final Iterator iter;<a name="line.837"></a>
+<FONT color="green">838</FONT>    <a name="line.838"></a>
+<FONT color="green">839</FONT>            /** Build an entry from an iterator point to an element.<a name="line.839"></a>
+<FONT color="green">840</FONT>             * @param iter iterator pointing to the entry<a name="line.840"></a>
+<FONT color="green">841</FONT>             */<a name="line.841"></a>
+<FONT color="green">842</FONT>            protected OpenMapEntry(Iterator iter) {<a name="line.842"></a>
+<FONT color="green">843</FONT>                this.iter = iter;<a name="line.843"></a>
+<FONT color="green">844</FONT>            }<a name="line.844"></a>
+<FONT color="green">845</FONT>    <a name="line.845"></a>
+<FONT color="green">846</FONT>            /** {@inheritDoc} */<a name="line.846"></a>
+<FONT color="green">847</FONT>            @Override<a name="line.847"></a>
+<FONT color="green">848</FONT>            public double getValue() {<a name="line.848"></a>
+<FONT color="green">849</FONT>                return iter.value();<a name="line.849"></a>
+<FONT color="green">850</FONT>            }<a name="line.850"></a>
+<FONT color="green">851</FONT>    <a name="line.851"></a>
+<FONT color="green">852</FONT>            /** {@inheritDoc} */<a name="line.852"></a>
+<FONT color="green">853</FONT>            @Override<a name="line.853"></a>
+<FONT color="green">854</FONT>            public void setValue(double value) {<a name="line.854"></a>
+<FONT color="green">855</FONT>                entries.put(iter.key(), value);<a name="line.855"></a>
+<FONT color="green">856</FONT>            }<a name="line.856"></a>
+<FONT color="green">857</FONT>    <a name="line.857"></a>
+<FONT color="green">858</FONT>            /** {@inheritDoc} */<a name="line.858"></a>
+<FONT color="green">859</FONT>            @Override<a name="line.859"></a>
+<FONT color="green">860</FONT>            public int getIndex() {<a name="line.860"></a>
+<FONT color="green">861</FONT>                return iter.key();<a name="line.861"></a>
+<FONT color="green">862</FONT>            }<a name="line.862"></a>
+<FONT color="green">863</FONT>    <a name="line.863"></a>
+<FONT color="green">864</FONT>        }<a name="line.864"></a>
+<FONT color="green">865</FONT>    <a name="line.865"></a>
+<FONT color="green">866</FONT>        /**<a name="line.866"></a>
+<FONT color="green">867</FONT>         *  Iterator class to do iteration over just the non-zero elements.<a name="line.867"></a>
+<FONT color="green">868</FONT>         *  &lt;p&gt;This implementation is fail-fast, so cannot be used to modify any zero element.<a name="line.868"></a>
+<FONT color="green">869</FONT>         *<a name="line.869"></a>
+<FONT color="green">870</FONT>         */<a name="line.870"></a>
+<FONT color="green">871</FONT>        protected class OpenMapSparseIterator implements java.util.Iterator&lt;Entry&gt; {<a name="line.871"></a>
+<FONT color="green">872</FONT>    <a name="line.872"></a>
+<FONT color="green">873</FONT>            /** Underlying iterator. */<a name="line.873"></a>
+<FONT color="green">874</FONT>            private final Iterator iter;<a name="line.874"></a>
+<FONT color="green">875</FONT>    <a name="line.875"></a>
+<FONT color="green">876</FONT>            /** Current entry. */<a name="line.876"></a>
+<FONT color="green">877</FONT>            private final Entry current;<a name="line.877"></a>
+<FONT color="green">878</FONT>    <a name="line.878"></a>
+<FONT color="green">879</FONT>            /** Simple constructor. */<a name="line.879"></a>
+<FONT color="green">880</FONT>            protected OpenMapSparseIterator() {<a name="line.880"></a>
+<FONT color="green">881</FONT>                iter = entries.iterator();<a name="line.881"></a>
+<FONT color="green">882</FONT>                current = new OpenMapEntry(iter);<a name="line.882"></a>
+<FONT color="green">883</FONT>            }<a name="line.883"></a>
+<FONT color="green">884</FONT>    <a name="line.884"></a>
+<FONT color="green">885</FONT>            /** {@inheritDoc} */<a name="line.885"></a>
+<FONT color="green">886</FONT>            public boolean hasNext() {<a name="line.886"></a>
+<FONT color="green">887</FONT>                return iter.hasNext();<a name="line.887"></a>
+<FONT color="green">888</FONT>            }<a name="line.888"></a>
+<FONT color="green">889</FONT>    <a name="line.889"></a>
+<FONT color="green">890</FONT>            /** {@inheritDoc} */<a name="line.890"></a>
+<FONT color="green">891</FONT>            public Entry next() {<a name="line.891"></a>
+<FONT color="green">892</FONT>                iter.advance();<a name="line.892"></a>
+<FONT color="green">893</FONT>                return current;<a name="line.893"></a>
+<FONT color="green">894</FONT>            }<a name="line.894"></a>
+<FONT color="green">895</FONT>    <a name="line.895"></a>
+<FONT color="green">896</FONT>            /** {@inheritDoc} */<a name="line.896"></a>
+<FONT color="green">897</FONT>            public void remove() {<a name="line.897"></a>
+<FONT color="green">898</FONT>                throw new UnsupportedOperationException("Not supported");<a name="line.898"></a>
+<FONT color="green">899</FONT>           }<a name="line.899"></a>
+<FONT color="green">900</FONT>    <a name="line.900"></a>
+<FONT color="green">901</FONT>        }<a name="line.901"></a>
+<FONT color="green">902</FONT>    }<a name="line.902"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/OpenMapRealVector.OpenMapSparseIterator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,968 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.linear;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.util.OpenIntToDoubleHashMap;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.util.OpenIntToDoubleHashMap.Iterator;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * This class implements the {@link RealVector} interface with a {@link OpenIntToDoubleHashMap} backing store.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @since 2.0<a name="line.28"></a>
+<FONT color="green">029</FONT>    */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public class OpenMapRealVector extends AbstractRealVector implements SparseRealVector, Serializable {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** Default Tolerance for having a value considered zero. */<a name="line.32"></a>
+<FONT color="green">033</FONT>        public static final double DEFAULT_ZERO_TOLERANCE = 1.0e-12;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Serializable version identifier. */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private static final long serialVersionUID = 8772222695580707260L;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Entries of the vector. */<a name="line.38"></a>
+<FONT color="green">039</FONT>        private final OpenIntToDoubleHashMap entries;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Dimension of the vector. */<a name="line.41"></a>
+<FONT color="green">042</FONT>        private final int virtualSize;<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Tolerance for having a value considered zero. */<a name="line.44"></a>
+<FONT color="green">045</FONT>        private double epsilon;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Build a 0-length vector.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * &lt;p&gt;Zero-length vectors may be used to initialized construction of vectors<a name="line.49"></a>
+<FONT color="green">050</FONT>         * by data gathering. We start with zero-length and use either the {@link<a name="line.50"></a>
+<FONT color="green">051</FONT>         * #OpenMapRealVector(OpenMapRealVector, int)} constructor<a name="line.51"></a>
+<FONT color="green">052</FONT>         * or one of the &lt;code&gt;append&lt;/code&gt; method ({@link #append(double)}, {@link<a name="line.52"></a>
+<FONT color="green">053</FONT>         * #append(double[])}, {@link #append(RealVector)}) to gather data<a name="line.53"></a>
+<FONT color="green">054</FONT>         * into this vector.&lt;/p&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public OpenMapRealVector() {<a name="line.56"></a>
+<FONT color="green">057</FONT>            this(0, DEFAULT_ZERO_TOLERANCE);<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /**<a name="line.60"></a>
+<FONT color="green">061</FONT>         * Construct a (dimension)-length vector of zeros.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param dimension size of the vector<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public OpenMapRealVector(int dimension) {<a name="line.64"></a>
+<FONT color="green">065</FONT>            this(dimension, DEFAULT_ZERO_TOLERANCE);<a name="line.65"></a>
+<FONT color="green">066</FONT>        }<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /**<a name="line.68"></a>
+<FONT color="green">069</FONT>         * Construct a (dimension)-length vector of zeros, specifying zero tolerance.<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @param dimension Size of the vector<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param epsilon The tolerance for having a value considered zero<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        public OpenMapRealVector(int dimension, double epsilon) {<a name="line.73"></a>
+<FONT color="green">074</FONT>            virtualSize = dimension;<a name="line.74"></a>
+<FONT color="green">075</FONT>            entries = new OpenIntToDoubleHashMap(0.0);<a name="line.75"></a>
+<FONT color="green">076</FONT>            this.epsilon = epsilon;<a name="line.76"></a>
+<FONT color="green">077</FONT>        }<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        /**<a name="line.79"></a>
+<FONT color="green">080</FONT>         * Build a resized vector, for use with append.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @param v The original vector<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @param resize The amount to resize it<a name="line.82"></a>
+<FONT color="green">083</FONT>         */<a name="line.83"></a>
+<FONT color="green">084</FONT>        protected OpenMapRealVector(OpenMapRealVector v, int resize) {<a name="line.84"></a>
+<FONT color="green">085</FONT>            virtualSize = v.getDimension() + resize;<a name="line.85"></a>
+<FONT color="green">086</FONT>            entries = new OpenIntToDoubleHashMap(v.entries);<a name="line.86"></a>
+<FONT color="green">087</FONT>            epsilon = v.epsilon;<a name="line.87"></a>
+<FONT color="green">088</FONT>        }<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>        /**<a name="line.90"></a>
+<FONT color="green">091</FONT>         * Build a vector with known the sparseness (for advanced use only).<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @param dimension The size of the vector<a name="line.92"></a>
+<FONT color="green">093</FONT>         * @param expectedSize The expected number of non-zero entries<a name="line.93"></a>
+<FONT color="green">094</FONT>         */<a name="line.94"></a>
+<FONT color="green">095</FONT>        public OpenMapRealVector(int dimension, int expectedSize) {<a name="line.95"></a>
+<FONT color="green">096</FONT>            this(dimension, expectedSize, DEFAULT_ZERO_TOLERANCE);<a name="line.96"></a>
+<FONT color="green">097</FONT>        }<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>        /**<a name="line.99"></a>
+<FONT color="green">100</FONT>         * Build a vector with known the sparseness and zero tolerance setting (for advanced use only).<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @param dimension The size of the vector<a name="line.101"></a>
+<FONT color="green">102</FONT>         * @param expectedSize The expected number of non-zero entries<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @param epsilon The tolerance for having a value considered zero<a name="line.103"></a>
+<FONT color="green">104</FONT>         */<a name="line.104"></a>
+<FONT color="green">105</FONT>        public OpenMapRealVector(int dimension, int expectedSize, double epsilon) {<a name="line.105"></a>
+<FONT color="green">106</FONT>            virtualSize = dimension;<a name="line.106"></a>
+<FONT color="green">107</FONT>            entries = new OpenIntToDoubleHashMap(expectedSize, 0.0);<a name="line.107"></a>
+<FONT color="green">108</FONT>            this.epsilon = epsilon;<a name="line.108"></a>
+<FONT color="green">109</FONT>        }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /**<a name="line.111"></a>
+<FONT color="green">112</FONT>         * Create from a double array.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * Only non-zero entries will be stored<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param values The set of values to create from<a name="line.114"></a>
+<FONT color="green">115</FONT>         */<a name="line.115"></a>
+<FONT color="green">116</FONT>        public OpenMapRealVector(double[] values) {<a name="line.116"></a>
+<FONT color="green">117</FONT>            this(values, DEFAULT_ZERO_TOLERANCE);<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /**<a name="line.120"></a>
+<FONT color="green">121</FONT>         * Create from a double array, specifying zero tolerance.<a name="line.121"></a>
+<FONT color="green">122</FONT>         * Only non-zero entries will be stored<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @param values The set of values to create from<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @param epsilon The tolerance for having a value considered zero<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        public OpenMapRealVector(double[] values, double epsilon) {<a name="line.126"></a>
+<FONT color="green">127</FONT>            virtualSize = values.length;<a name="line.127"></a>
+<FONT color="green">128</FONT>            entries = new OpenIntToDoubleHashMap(0.0);<a name="line.128"></a>
+<FONT color="green">129</FONT>            this.epsilon = epsilon;<a name="line.129"></a>
+<FONT color="green">130</FONT>            for (int key = 0; key &lt; values.length; key++) {<a name="line.130"></a>
+<FONT color="green">131</FONT>                double value = values[key];<a name="line.131"></a>
+<FONT color="green">132</FONT>                if (!isDefaultValue(value)) {<a name="line.132"></a>
+<FONT color="green">133</FONT>                    entries.put(key, value);<a name="line.133"></a>
+<FONT color="green">134</FONT>                }<a name="line.134"></a>
+<FONT color="green">135</FONT>            }<a name="line.135"></a>
+<FONT color="green">136</FONT>        }<a name="line.136"></a>
+<FONT color="green">137</FONT>    <a name="line.137"></a>
+<FONT color="green">138</FONT>        /**<a name="line.138"></a>
+<FONT color="green">139</FONT>         * Create from a Double array.<a name="line.139"></a>
+<FONT color="green">140</FONT>         * Only non-zero entries will be stored<a name="line.140"></a>
+<FONT color="green">141</FONT>         * @param values The set of values to create from<a name="line.141"></a>
+<FONT color="green">142</FONT>         */<a name="line.142"></a>
+<FONT color="green">143</FONT>        public OpenMapRealVector(Double[] values) {<a name="line.143"></a>
+<FONT color="green">144</FONT>            this(values, DEFAULT_ZERO_TOLERANCE);<a name="line.144"></a>
+<FONT color="green">145</FONT>        }<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>        /**<a name="line.147"></a>
+<FONT color="green">148</FONT>         * Create from a Double array.<a name="line.148"></a>
+<FONT color="green">149</FONT>         * Only non-zero entries will be stored<a name="line.149"></a>
+<FONT color="green">150</FONT>         * @param values The set of values to create from<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @param epsilon The tolerance for having a value considered zero<a name="line.151"></a>
+<FONT color="green">152</FONT>         */<a name="line.152"></a>
+<FONT color="green">153</FONT>        public OpenMapRealVector(Double[] values, double epsilon) {<a name="line.153"></a>
+<FONT color="green">154</FONT>            virtualSize = values.length;<a name="line.154"></a>
+<FONT color="green">155</FONT>            entries = new OpenIntToDoubleHashMap(0.0);<a name="line.155"></a>
+<FONT color="green">156</FONT>            this.epsilon = epsilon;<a name="line.156"></a>
+<FONT color="green">157</FONT>            for (int key = 0; key &lt; values.length; key++) {<a name="line.157"></a>
+<FONT color="green">158</FONT>                double value = values[key].doubleValue();<a name="line.158"></a>
+<FONT color="green">159</FONT>                if (!isDefaultValue(value)) {<a name="line.159"></a>
+<FONT color="green">160</FONT>                    entries.put(key, value);<a name="line.160"></a>
+<FONT color="green">161</FONT>                }<a name="line.161"></a>
+<FONT color="green">162</FONT>            }<a name="line.162"></a>
+<FONT color="green">163</FONT>        }<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>        /**<a name="line.165"></a>
+<FONT color="green">166</FONT>         * Copy constructor.<a name="line.166"></a>
+<FONT color="green">167</FONT>         * @param v The instance to copy from<a name="line.167"></a>
+<FONT color="green">168</FONT>         */<a name="line.168"></a>
+<FONT color="green">169</FONT>        public OpenMapRealVector(OpenMapRealVector v) {<a name="line.169"></a>
+<FONT color="green">170</FONT>            virtualSize = v.getDimension();<a name="line.170"></a>
+<FONT color="green">171</FONT>            entries = new OpenIntToDoubleHashMap(v.getEntries());<a name="line.171"></a>
+<FONT color="green">172</FONT>            epsilon = v.epsilon;<a name="line.172"></a>
+<FONT color="green">173</FONT>        }<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>        /**<a name="line.175"></a>
+<FONT color="green">176</FONT>         * Generic copy constructor.<a name="line.176"></a>
+<FONT color="green">177</FONT>         * @param v The instance to copy from<a name="line.177"></a>
+<FONT color="green">178</FONT>         */<a name="line.178"></a>
+<FONT color="green">179</FONT>        public OpenMapRealVector(RealVector v) {<a name="line.179"></a>
+<FONT color="green">180</FONT>            virtualSize = v.getDimension();<a name="line.180"></a>
+<FONT color="green">181</FONT>            entries = new OpenIntToDoubleHashMap(0.0);<a name="line.181"></a>
+<FONT color="green">182</FONT>            epsilon = DEFAULT_ZERO_TOLERANCE;<a name="line.182"></a>
+<FONT color="green">183</FONT>            for (int key = 0; key &lt; virtualSize; key++) {<a name="line.183"></a>
+<FONT color="green">184</FONT>                double value = v.getEntry(key);<a name="line.184"></a>
+<FONT color="green">185</FONT>                if (!isDefaultValue(value)) {<a name="line.185"></a>
+<FONT color="green">186</FONT>                    entries.put(key, value);<a name="line.186"></a>
+<FONT color="green">187</FONT>                }<a name="line.187"></a>
+<FONT color="green">188</FONT>            }<a name="line.188"></a>
+<FONT color="green">189</FONT>        }<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>        /**<a name="line.191"></a>
+<FONT color="green">192</FONT>         * Get the entries of this instance.<a name="line.192"></a>
+<FONT color="green">193</FONT>         * @return entries of this instance<a name="line.193"></a>
+<FONT color="green">194</FONT>         */<a name="line.194"></a>
+<FONT color="green">195</FONT>        private OpenIntToDoubleHashMap getEntries() {<a name="line.195"></a>
+<FONT color="green">196</FONT>            return entries;<a name="line.196"></a>
+<FONT color="green">197</FONT>        }<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>        /**<a name="line.199"></a>
+<FONT color="green">200</FONT>         * Determine if this value is within epsilon of zero.<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @param value The value to test<a name="line.201"></a>
+<FONT color="green">202</FONT>         * @return &lt;code&gt;true&lt;/code&gt; if this value is within epsilon to zero, &lt;code&gt;false&lt;/code&gt; otherwise<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @since 2.1<a name="line.203"></a>
+<FONT color="green">204</FONT>         */<a name="line.204"></a>
+<FONT color="green">205</FONT>        protected boolean isDefaultValue(double value) {<a name="line.205"></a>
+<FONT color="green">206</FONT>            return Math.abs(value) &lt; epsilon;<a name="line.206"></a>
+<FONT color="green">207</FONT>        }<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>        /** {@inheritDoc} */<a name="line.209"></a>
+<FONT color="green">210</FONT>        @Override<a name="line.210"></a>
+<FONT color="green">211</FONT>        public RealVector add(RealVector v) throws IllegalArgumentException {<a name="line.211"></a>
+<FONT color="green">212</FONT>            checkVectorDimensions(v.getDimension());<a name="line.212"></a>
+<FONT color="green">213</FONT>            if (v instanceof OpenMapRealVector) {<a name="line.213"></a>
+<FONT color="green">214</FONT>                return add((OpenMapRealVector) v);<a name="line.214"></a>
+<FONT color="green">215</FONT>            } else {<a name="line.215"></a>
+<FONT color="green">216</FONT>                return super.add(v);<a name="line.216"></a>
+<FONT color="green">217</FONT>            }<a name="line.217"></a>
+<FONT color="green">218</FONT>        }<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>        /**<a name="line.220"></a>
+<FONT color="green">221</FONT>         * Optimized method to add two OpenMapRealVectors.  Copies the larger vector, iterates over the smaller.<a name="line.221"></a>
+<FONT color="green">222</FONT>         * @param v Vector to add with<a name="line.222"></a>
+<FONT color="green">223</FONT>         * @return The sum of &lt;code&gt;this&lt;/code&gt; with &lt;code&gt;v&lt;/code&gt;<a name="line.223"></a>
+<FONT color="green">224</FONT>         * @throws IllegalArgumentException If the dimensions don't match<a name="line.224"></a>
+<FONT color="green">225</FONT>         */<a name="line.225"></a>
+<FONT color="green">226</FONT>        public OpenMapRealVector add(OpenMapRealVector v) throws IllegalArgumentException{<a name="line.226"></a>
+<FONT color="green">227</FONT>            checkVectorDimensions(v.getDimension());<a name="line.227"></a>
+<FONT color="green">228</FONT>            boolean copyThis = entries.size() &gt; v.entries.size();<a name="line.228"></a>
+<FONT color="green">229</FONT>            OpenMapRealVector res = copyThis ? this.copy() : v.copy();<a name="line.229"></a>
+<FONT color="green">230</FONT>            Iterator iter = copyThis ? v.entries.iterator() : entries.iterator();<a name="line.230"></a>
+<FONT color="green">231</FONT>            OpenIntToDoubleHashMap randomAccess = copyThis ? entries : v.entries;<a name="line.231"></a>
+<FONT color="green">232</FONT>            while (iter.hasNext()) {<a name="line.232"></a>
+<FONT color="green">233</FONT>                iter.advance();<a name="line.233"></a>
+<FONT color="green">234</FONT>                int key = iter.key();<a name="line.234"></a>
+<FONT color="green">235</FONT>                if (randomAccess.containsKey(key)) {<a name="line.235"></a>
+<FONT color="green">236</FONT>                    res.setEntry(key, randomAccess.get(key) + iter.value());<a name="line.236"></a>
+<FONT color="green">237</FONT>                } else {<a name="line.237"></a>
+<FONT color="green">238</FONT>                    res.setEntry(key, iter.value());<a name="line.238"></a>
+<FONT color="green">239</FONT>                }<a name="line.239"></a>
+<FONT color="green">240</FONT>            }<a name="line.240"></a>
+<FONT color="green">241</FONT>            return res;<a name="line.241"></a>
+<FONT color="green">242</FONT>        }<a name="line.242"></a>
+<FONT color="green">243</FONT>    <a name="line.243"></a>
+<FONT color="green">244</FONT>        /**<a name="line.244"></a>
+<FONT color="green">245</FONT>         * Optimized method to append a OpenMapRealVector.<a name="line.245"></a>
+<FONT color="green">246</FONT>         * @param v vector to append<a name="line.246"></a>
+<FONT color="green">247</FONT>         * @return The result of appending &lt;code&gt;v&lt;/code&gt; to self<a name="line.247"></a>
+<FONT color="green">248</FONT>         */<a name="line.248"></a>
+<FONT color="green">249</FONT>        public OpenMapRealVector append(OpenMapRealVector v) {<a name="line.249"></a>
+<FONT color="green">250</FONT>            OpenMapRealVector res = new OpenMapRealVector(this, v.getDimension());<a name="line.250"></a>
+<FONT color="green">251</FONT>            Iterator iter = v.entries.iterator();<a name="line.251"></a>
+<FONT color="green">252</FONT>            while (iter.hasNext()) {<a name="line.252"></a>
+<FONT color="green">253</FONT>                iter.advance();<a name="line.253"></a>
+<FONT color="green">254</FONT>                res.setEntry(iter.key() + virtualSize, iter.value());<a name="line.254"></a>
+<FONT color="green">255</FONT>            }<a name="line.255"></a>
+<FONT color="green">256</FONT>            return res;<a name="line.256"></a>
+<FONT color="green">257</FONT>        }<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>        /** {@inheritDoc} */<a name="line.259"></a>
+<FONT color="green">260</FONT>        public OpenMapRealVector append(RealVector v) {<a name="line.260"></a>
+<FONT color="green">261</FONT>            if (v instanceof OpenMapRealVector) {<a name="line.261"></a>
+<FONT color="green">262</FONT>                return append((OpenMapRealVector) v);<a name="line.262"></a>
+<FONT color="green">263</FONT>            }<a name="line.263"></a>
+<FONT color="green">264</FONT>            return append(v.getData());<a name="line.264"></a>
+<FONT color="green">265</FONT>        }<a name="line.265"></a>
+<FONT color="green">266</FONT>    <a name="line.266"></a>
+<FONT color="green">267</FONT>        /** {@inheritDoc} */<a name="line.267"></a>
+<FONT color="green">268</FONT>        public OpenMapRealVector append(double d) {<a name="line.268"></a>
+<FONT color="green">269</FONT>            OpenMapRealVector res = new OpenMapRealVector(this, 1);<a name="line.269"></a>
+<FONT color="green">270</FONT>            res.setEntry(virtualSize, d);<a name="line.270"></a>
+<FONT color="green">271</FONT>            return res;<a name="line.271"></a>
+<FONT color="green">272</FONT>        }<a name="line.272"></a>
+<FONT color="green">273</FONT>    <a name="line.273"></a>
+<FONT color="green">274</FONT>        /** {@inheritDoc} */<a name="line.274"></a>
+<FONT color="green">275</FONT>        public OpenMapRealVector append(double[] a) {<a name="line.275"></a>
+<FONT color="green">276</FONT>            OpenMapRealVector res = new OpenMapRealVector(this, a.length);<a name="line.276"></a>
+<FONT color="green">277</FONT>            for (int i = 0; i &lt; a.length; i++) {<a name="line.277"></a>
+<FONT color="green">278</FONT>                res.setEntry(i + virtualSize, a[i]);<a name="line.278"></a>
+<FONT color="green">279</FONT>            }<a name="line.279"></a>
+<FONT color="green">280</FONT>            return res;<a name="line.280"></a>
+<FONT color="green">281</FONT>        }<a name="line.281"></a>
+<FONT color="green">282</FONT>    <a name="line.282"></a>
+<FONT color="green">283</FONT>        /**<a name="line.283"></a>
+<FONT color="green">284</FONT>         * {@inheritDoc}<a name="line.284"></a>
+<FONT color="green">285</FONT>         * @since 2.1<a name="line.285"></a>
+<FONT color="green">286</FONT>         */<a name="line.286"></a>
+<FONT color="green">287</FONT>        @Override<a name="line.287"></a>
+<FONT color="green">288</FONT>        public OpenMapRealVector copy() {<a name="line.288"></a>
+<FONT color="green">289</FONT>            return new OpenMapRealVector(this);<a name="line.289"></a>
+<FONT color="green">290</FONT>        }<a name="line.290"></a>
+<FONT color="green">291</FONT>    <a name="line.291"></a>
+<FONT color="green">292</FONT>        /**<a name="line.292"></a>
+<FONT color="green">293</FONT>         * Optimized method to compute the dot product with an OpenMapRealVector.<a name="line.293"></a>
+<FONT color="green">294</FONT>         * Iterates over the smaller of the two.<a name="line.294"></a>
+<FONT color="green">295</FONT>         * @param v The vector to compute the dot product with<a name="line.295"></a>
+<FONT color="green">296</FONT>         * @return The dot product of &lt;code&gt;this&lt;/code&gt; and &lt;code&gt;v&lt;/code&gt;<a name="line.296"></a>
+<FONT color="green">297</FONT>         * @throws IllegalArgumentException If the dimensions don't match<a name="line.297"></a>
+<FONT color="green">298</FONT>         */<a name="line.298"></a>
+<FONT color="green">299</FONT>        public double dotProduct(OpenMapRealVector v) throws IllegalArgumentException {<a name="line.299"></a>
+<FONT color="green">300</FONT>            checkVectorDimensions(v.getDimension());<a name="line.300"></a>
+<FONT color="green">301</FONT>            boolean thisIsSmaller  = entries.size() &lt; v.entries.size();<a name="line.301"></a>
+<FONT color="green">302</FONT>            Iterator iter = thisIsSmaller  ? entries.iterator() : v.entries.iterator();<a name="line.302"></a>
+<FONT color="green">303</FONT>            OpenIntToDoubleHashMap larger = thisIsSmaller  ? v.entries : entries;<a name="line.303"></a>
+<FONT color="green">304</FONT>            double d = 0;<a name="line.304"></a>
+<FONT color="green">305</FONT>            while(iter.hasNext()) {<a name="line.305"></a>
+<FONT color="green">306</FONT>                iter.advance();<a name="line.306"></a>
+<FONT color="green">307</FONT>                d += iter.value() * larger.get(iter.key());<a name="line.307"></a>
+<FONT color="green">308</FONT>            }<a name="line.308"></a>
+<FONT color="green">309</FONT>            return d;<a name="line.309"></a>
+<FONT color="green">310</FONT>        }<a name="line.310"></a>
+<FONT color="green">311</FONT>    <a name="line.311"></a>
+<FONT color="green">312</FONT>        /** {@inheritDoc} */<a name="line.312"></a>
+<FONT color="green">313</FONT>        @Override<a name="line.313"></a>
+<FONT color="green">314</FONT>        public double dotProduct(RealVector v) throws IllegalArgumentException {<a name="line.314"></a>
+<FONT color="green">315</FONT>            if(v instanceof OpenMapRealVector) {<a name="line.315"></a>
+<FONT color="green">316</FONT>                return dotProduct((OpenMapRealVector)v);<a name="line.316"></a>
+<FONT color="green">317</FONT>            } else {<a name="line.317"></a>
+<FONT color="green">318</FONT>                return super.dotProduct(v);<a name="line.318"></a>
+<FONT color="green">319</FONT>            }<a name="line.319"></a>
+<FONT color="green">320</FONT>        }<a name="line.320"></a>
+<FONT color="green">321</FONT>    <a name="line.321"></a>
+<FONT color="green">322</FONT>        /** {@inheritDoc} */<a name="line.322"></a>
+<FONT color="green">323</FONT>        public OpenMapRealVector ebeDivide(RealVector v) throws IllegalArgumentException {<a name="line.323"></a>
+<FONT color="green">324</FONT>            checkVectorDimensions(v.getDimension());<a name="line.324"></a>
+<FONT color="green">325</FONT>            OpenMapRealVector res = new OpenMapRealVector(this);<a name="line.325"></a>
+<FONT color="green">326</FONT>            Iterator iter = res.entries.iterator();<a name="line.326"></a>
+<FONT color="green">327</FONT>            while (iter.hasNext()) {<a name="line.327"></a>
+<FONT color="green">328</FONT>                iter.advance();<a name="line.328"></a>
+<FONT color="green">329</FONT>                res.setEntry(iter.key(), iter.value() / v.getEntry(iter.key()));<a name="line.329"></a>
+<FONT color="green">330</FONT>            }<a name="line.330"></a>
+<FONT color="green">331</FONT>            return res;<a name="line.331"></a>
+<FONT color="green">332</FONT>        }<a name="line.332"></a>
+<FONT color="green">333</FONT>    <a name="line.333"></a>
+<FONT color="green">334</FONT>        /** {@inheritDoc} */<a name="line.334"></a>
+<FONT color="green">335</FONT>        @Override<a name="line.335"></a>
+<FONT color="green">336</FONT>        public OpenMapRealVector ebeDivide(double[] v) throws IllegalArgumentException {<a name="line.336"></a>
+<FONT color="green">337</FONT>            checkVectorDimensions(v.length);<a name="line.337"></a>
+<FONT color="green">338</FONT>            OpenMapRealVector res = new OpenMapRealVector(this);<a name="line.338"></a>
+<FONT color="green">339</FONT>            Iterator iter = res.entries.iterator();<a name="line.339"></a>
+<FONT color="green">340</FONT>            while (iter.hasNext()) {<a name="line.340"></a>
+<FONT color="green">341</FONT>                iter.advance();<a name="line.341"></a>
+<FONT color="green">342</FONT>                res.setEntry(iter.key(), iter.value() / v[iter.key()]);<a name="line.342"></a>
+<FONT color="green">343</FONT>            }<a name="line.343"></a>
+<FONT color="green">344</FONT>            return res;<a name="line.344"></a>
+<FONT color="green">345</FONT>        }<a name="line.345"></a>
+<FONT color="green">346</FONT>    <a name="line.346"></a>
+<FONT color="green">347</FONT>        /** {@inheritDoc} */<a name="line.347"></a>
+<FONT color="green">348</FONT>        public OpenMapRealVector ebeMultiply(RealVector v) throws IllegalArgumentException {<a name="line.348"></a>
+<FONT color="green">349</FONT>            checkVectorDimensions(v.getDimension());<a name="line.349"></a>
+<FONT color="green">350</FONT>            OpenMapRealVector res = new OpenMapRealVector(this);<a name="line.350"></a>
+<FONT color="green">351</FONT>            Iterator iter = res.entries.iterator();<a name="line.351"></a>
+<FONT color="green">352</FONT>            while (iter.hasNext()) {<a name="line.352"></a>
+<FONT color="green">353</FONT>                iter.advance();<a name="line.353"></a>
+<FONT color="green">354</FONT>                res.setEntry(iter.key(), iter.value() * v.getEntry(iter.key()));<a name="line.354"></a>
+<FONT color="green">355</FONT>            }<a name="line.355"></a>
+<FONT color="green">356</FONT>            return res;<a name="line.356"></a>
+<FONT color="green">357</FONT>        }<a name="line.357"></a>
+<FONT color="green">358</FONT>    <a name="line.358"></a>
+<FONT color="green">359</FONT>        /** {@inheritDoc} */<a name="line.359"></a>
+<FONT color="green">360</FONT>        @Override<a name="line.360"></a>
+<FONT color="green">361</FONT>        public OpenMapRealVector ebeMultiply(double[] v) throws IllegalArgumentException {<a name="line.361"></a>
+<FONT color="green">362</FONT>            checkVectorDimensions(v.length);<a name="line.362"></a>
+<FONT color="green">363</FONT>            OpenMapRealVector res = new OpenMapRealVector(this);<a name="line.363"></a>
+<FONT color="green">364</FONT>            Iterator iter = res.entries.iterator();<a name="line.364"></a>
+<FONT color="green">365</FONT>            while (iter.hasNext()) {<a name="line.365"></a>
+<FONT color="green">366</FONT>                iter.advance();<a name="line.366"></a>
+<FONT color="green">367</FONT>                res.setEntry(iter.key(), iter.value() * v[iter.key()]);<a name="line.367"></a>
+<FONT color="green">368</FONT>            }<a name="line.368"></a>
+<FONT color="green">369</FONT>            return res;<a name="line.369"></a>
+<FONT color="green">370</FONT>        }<a name="line.370"></a>
+<FONT color="green">371</FONT>    <a name="line.371"></a>
+<FONT color="green">372</FONT>        /** {@inheritDoc} */<a name="line.372"></a>
+<FONT color="green">373</FONT>        public OpenMapRealVector getSubVector(int index, int n) throws MatrixIndexException {<a name="line.373"></a>
+<FONT color="green">374</FONT>            checkIndex(index);<a name="line.374"></a>
+<FONT color="green">375</FONT>            checkIndex(index + n - 1);<a name="line.375"></a>
+<FONT color="green">376</FONT>            OpenMapRealVector res = new OpenMapRealVector(n);<a name="line.376"></a>
+<FONT color="green">377</FONT>            int end = index + n;<a name="line.377"></a>
+<FONT color="green">378</FONT>            Iterator iter = entries.iterator();<a name="line.378"></a>
+<FONT color="green">379</FONT>            while (iter.hasNext()) {<a name="line.379"></a>
+<FONT color="green">380</FONT>                iter.advance();<a name="line.380"></a>
+<FONT color="green">381</FONT>                int key = iter.key();<a name="line.381"></a>
+<FONT color="green">382</FONT>                if (key &gt;= index &amp;&amp; key &lt; end) {<a name="line.382"></a>
+<FONT color="green">383</FONT>                    res.setEntry(key - index, iter.value());<a name="line.383"></a>
+<FONT color="green">384</FONT>                }<a name="line.384"></a>
+<FONT color="green">385</FONT>            }<a name="line.385"></a>
+<FONT color="green">386</FONT>            return res;<a name="line.386"></a>
+<FONT color="green">387</FONT>        }<a name="line.387"></a>
+<FONT color="green">388</FONT>    <a name="line.388"></a>
+<FONT color="green">389</FONT>        /** {@inheritDoc} */<a name="line.389"></a>
+<FONT color="green">390</FONT>        @Override<a name="line.390"></a>
+<FONT color="green">391</FONT>        public double[] getData() {<a name="line.391"></a>
+<FONT color="green">392</FONT>            double[] res = new double[virtualSize];<a name="line.392"></a>
+<FONT color="green">393</FONT>            Iterator iter = entries.iterator();<a name="line.393"></a>
+<FONT color="green">394</FONT>            while (iter.hasNext()) {<a name="line.394"></a>
+<FONT color="green">395</FONT>                iter.advance();<a name="line.395"></a>
+<FONT color="green">396</FONT>                res[iter.key()] = iter.value();<a name="line.396"></a>
+<FONT color="green">397</FONT>            }<a name="line.397"></a>
+<FONT color="green">398</FONT>            return res;<a name="line.398"></a>
+<FONT color="green">399</FONT>        }<a name="line.399"></a>
+<FONT color="green">400</FONT>    <a name="line.400"></a>
+<FONT color="green">401</FONT>        /** {@inheritDoc} */<a name="line.401"></a>
+<FONT color="green">402</FONT>        public int getDimension() {<a name="line.402"></a>
+<FONT color="green">403</FONT>            return virtualSize;<a name="line.403"></a>
+<FONT color="green">404</FONT>        }<a name="line.404"></a>
+<FONT color="green">405</FONT>    <a name="line.405"></a>
+<FONT color="green">406</FONT>        /**<a name="line.406"></a>
+<FONT color="green">407</FONT>         * Optimized method to compute distance.<a name="line.407"></a>
+<FONT color="green">408</FONT>         * @param v The vector to compute distance to<a name="line.408"></a>
+<FONT color="green">409</FONT>         * @return The distance from &lt;code&gt;this&lt;/code&gt; and &lt;code&gt;v&lt;/code&gt;<a name="line.409"></a>
+<FONT color="green">410</FONT>         * @throws IllegalArgumentException If the dimensions don't match<a name="line.410"></a>
+<FONT color="green">411</FONT>         */<a name="line.411"></a>
+<FONT color="green">412</FONT>        public double getDistance(OpenMapRealVector v) throws IllegalArgumentException {<a name="line.412"></a>
+<FONT color="green">413</FONT>            Iterator iter = entries.iterator();<a name="line.413"></a>
+<FONT color="green">414</FONT>            double res = 0;<a name="line.414"></a>
+<FONT color="green">415</FONT>            while (iter.hasNext()) {<a name="line.415"></a>
+<FONT color="green">416</FONT>                iter.advance();<a name="line.416"></a>
+<FONT color="green">417</FONT>                int key = iter.key();<a name="line.417"></a>
+<FONT color="green">418</FONT>                double delta;<a name="line.418"></a>
+<FONT color="green">419</FONT>                delta = iter.value() - v.getEntry(key);<a name="line.419"></a>
+<FONT color="green">420</FONT>                res += delta * delta;<a name="line.420"></a>
+<FONT color="green">421</FONT>            }<a name="line.421"></a>
+<FONT color="green">422</FONT>            iter = v.getEntries().iterator();<a name="line.422"></a>
+<FONT color="green">423</FONT>            while (iter.hasNext()) {<a name="line.423"></a>
+<FONT color="green">424</FONT>                iter.advance();<a name="line.424"></a>
+<FONT color="green">425</FONT>                int key = iter.key();<a name="line.425"></a>
+<FONT color="green">426</FONT>                if (!entries.containsKey(key)) {<a name="line.426"></a>
+<FONT color="green">427</FONT>                    final double value = iter.value();<a name="line.427"></a>
+<FONT color="green">428</FONT>                    res += value * value;<a name="line.428"></a>
+<FONT color="green">429</FONT>                }<a name="line.429"></a>
+<FONT color="green">430</FONT>            }<a name="line.430"></a>
+<FONT color="green">431</FONT>            return Math.sqrt(res);<a name="line.431"></a>
+<FONT color="green">432</FONT>        }<a name="line.432"></a>
+<FONT color="green">433</FONT>    <a name="line.433"></a>
+<FONT color="green">434</FONT>        /** {@inheritDoc} */<a name="line.434"></a>
+<FONT color="green">435</FONT>        @Override<a name="line.435"></a>
+<FONT color="green">436</FONT>        public double getDistance(RealVector v) throws IllegalArgumentException {<a name="line.436"></a>
+<FONT color="green">437</FONT>            checkVectorDimensions(v.getDimension());<a name="line.437"></a>
+<FONT color="green">438</FONT>            if (v instanceof OpenMapRealVector) {<a name="line.438"></a>
+<FONT color="green">439</FONT>                return getDistance((OpenMapRealVector) v);<a name="line.439"></a>
+<FONT color="green">440</FONT>            }<a name="line.440"></a>
+<FONT color="green">441</FONT>            return getDistance(v.getData());<a name="line.441"></a>
+<FONT color="green">442</FONT>        }<a name="line.442"></a>
+<FONT color="green">443</FONT>    <a name="line.443"></a>
+<FONT color="green">444</FONT>        /** {@inheritDoc} */<a name="line.444"></a>
+<FONT color="green">445</FONT>        @Override<a name="line.445"></a>
+<FONT color="green">446</FONT>        public double getDistance(double[] v) throws IllegalArgumentException {<a name="line.446"></a>
+<FONT color="green">447</FONT>            checkVectorDimensions(v.length);<a name="line.447"></a>
+<FONT color="green">448</FONT>            double res = 0;<a name="line.448"></a>
+<FONT color="green">449</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.449"></a>
+<FONT color="green">450</FONT>                double delta = entries.get(i) - v[i];<a name="line.450"></a>
+<FONT color="green">451</FONT>                res += delta * delta;<a name="line.451"></a>
+<FONT color="green">452</FONT>            }<a name="line.452"></a>
+<FONT color="green">453</FONT>            return Math.sqrt(res);<a name="line.453"></a>
+<FONT color="green">454</FONT>        }<a name="line.454"></a>
+<FONT color="green">455</FONT>    <a name="line.455"></a>
+<FONT color="green">456</FONT>        /** {@inheritDoc} */<a name="line.456"></a>
+<FONT color="green">457</FONT>        public double getEntry(int index) throws MatrixIndexException {<a name="line.457"></a>
+<FONT color="green">458</FONT>            checkIndex(index);<a name="line.458"></a>
+<FONT color="green">459</FONT>            return entries.get(index);<a name="line.459"></a>
+<FONT color="green">460</FONT>        }<a name="line.460"></a>
+<FONT color="green">461</FONT>    <a name="line.461"></a>
+<FONT color="green">462</FONT>        /**<a name="line.462"></a>
+<FONT color="green">463</FONT>         * Distance between two vectors.<a name="line.463"></a>
+<FONT color="green">464</FONT>         * &lt;p&gt;This method computes the distance consistent with<a name="line.464"></a>
+<FONT color="green">465</FONT>         * L&lt;sub&gt;1&lt;/sub&gt; norm, i.e. the sum of the absolute values of<a name="line.465"></a>
+<FONT color="green">466</FONT>         * elements differences.&lt;/p&gt;<a name="line.466"></a>
+<FONT color="green">467</FONT>         * @param v vector to which distance is requested<a name="line.467"></a>
+<FONT color="green">468</FONT>         * @return distance between two vectors.<a name="line.468"></a>
+<FONT color="green">469</FONT>         */<a name="line.469"></a>
+<FONT color="green">470</FONT>        public double getL1Distance(OpenMapRealVector v) {<a name="line.470"></a>
+<FONT color="green">471</FONT>            double max = 0;<a name="line.471"></a>
+<FONT color="green">472</FONT>            Iterator iter = entries.iterator();<a name="line.472"></a>
+<FONT color="green">473</FONT>            while (iter.hasNext()) {<a name="line.473"></a>
+<FONT color="green">474</FONT>                iter.advance();<a name="line.474"></a>
+<FONT color="green">475</FONT>                double delta = Math.abs(iter.value() - v.getEntry(iter.key()));<a name="line.475"></a>
+<FONT color="green">476</FONT>                max += delta;<a name="line.476"></a>
+<FONT color="green">477</FONT>            }<a name="line.477"></a>
+<FONT color="green">478</FONT>            iter = v.getEntries().iterator();<a name="line.478"></a>
+<FONT color="green">479</FONT>            while (iter.hasNext()) {<a name="line.479"></a>
+<FONT color="green">480</FONT>                iter.advance();<a name="line.480"></a>
+<FONT color="green">481</FONT>                int key = iter.key();<a name="line.481"></a>
+<FONT color="green">482</FONT>                if (!entries.containsKey(key)) {<a name="line.482"></a>
+<FONT color="green">483</FONT>                    double delta = Math.abs(iter.value());<a name="line.483"></a>
+<FONT color="green">484</FONT>                    max +=  Math.abs(delta);<a name="line.484"></a>
+<FONT color="green">485</FONT>                }<a name="line.485"></a>
+<FONT color="green">486</FONT>            }<a name="line.486"></a>
+<FONT color="green">487</FONT>            return max;<a name="line.487"></a>
+<FONT color="green">488</FONT>        }<a name="line.488"></a>
+<FONT color="green">489</FONT>    <a name="line.489"></a>
+<FONT color="green">490</FONT>        /** {@inheritDoc} */<a name="line.490"></a>
+<FONT color="green">491</FONT>        @Override<a name="line.491"></a>
+<FONT color="green">492</FONT>        public double getL1Distance(RealVector v) throws IllegalArgumentException {<a name="line.492"></a>
+<FONT color="green">493</FONT>            checkVectorDimensions(v.getDimension());<a name="line.493"></a>
+<FONT color="green">494</FONT>            if (v instanceof OpenMapRealVector) {<a name="line.494"></a>
+<FONT color="green">495</FONT>                return getL1Distance((OpenMapRealVector) v);<a name="line.495"></a>
+<FONT color="green">496</FONT>            }<a name="line.496"></a>
+<FONT color="green">497</FONT>            return getL1Distance(v.getData());<a name="line.497"></a>
+<FONT color="green">498</FONT>        }<a name="line.498"></a>
+<FONT color="green">499</FONT>    <a name="line.499"></a>
+<FONT color="green">500</FONT>        /** {@inheritDoc} */<a name="line.500"></a>
+<FONT color="green">501</FONT>        @Override<a name="line.501"></a>
+<FONT color="green">502</FONT>        public double getL1Distance(double[] v) throws IllegalArgumentException {<a name="line.502"></a>
+<FONT color="green">503</FONT>            checkVectorDimensions(v.length);<a name="line.503"></a>
+<FONT color="green">504</FONT>            double max = 0;<a name="line.504"></a>
+<FONT color="green">505</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.505"></a>
+<FONT color="green">506</FONT>                double delta = Math.abs(getEntry(i) - v[i]);<a name="line.506"></a>
+<FONT color="green">507</FONT>                max += delta;<a name="line.507"></a>
+<FONT color="green">508</FONT>            }<a name="line.508"></a>
+<FONT color="green">509</FONT>            return max;<a name="line.509"></a>
+<FONT color="green">510</FONT>        }<a name="line.510"></a>
+<FONT color="green">511</FONT>    <a name="line.511"></a>
+<FONT color="green">512</FONT>        /**<a name="line.512"></a>
+<FONT color="green">513</FONT>         * Optimized method to compute LInfDistance.<a name="line.513"></a>
+<FONT color="green">514</FONT>         * @param v The vector to compute from<a name="line.514"></a>
+<FONT color="green">515</FONT>         * @return the LInfDistance<a name="line.515"></a>
+<FONT color="green">516</FONT>         */<a name="line.516"></a>
+<FONT color="green">517</FONT>        private double getLInfDistance(OpenMapRealVector v) {<a name="line.517"></a>
+<FONT color="green">518</FONT>            double max = 0;<a name="line.518"></a>
+<FONT color="green">519</FONT>            Iterator iter = entries.iterator();<a name="line.519"></a>
+<FONT color="green">520</FONT>            while (iter.hasNext()) {<a name="line.520"></a>
+<FONT color="green">521</FONT>                iter.advance();<a name="line.521"></a>
+<FONT color="green">522</FONT>                double delta = Math.abs(iter.value() - v.getEntry(iter.key()));<a name="line.522"></a>
+<FONT color="green">523</FONT>                if (delta &gt; max) {<a name="line.523"></a>
+<FONT color="green">524</FONT>                    max = delta;<a name="line.524"></a>
+<FONT color="green">525</FONT>                }<a name="line.525"></a>
+<FONT color="green">526</FONT>            }<a name="line.526"></a>
+<FONT color="green">527</FONT>            iter = v.getEntries().iterator();<a name="line.527"></a>
+<FONT color="green">528</FONT>            while (iter.hasNext()) {<a name="line.528"></a>
+<FONT color="green">529</FONT>                iter.advance();<a name="line.529"></a>
+<FONT color="green">530</FONT>                int key = iter.key();<a name="line.530"></a>
+<FONT color="green">531</FONT>                if (!entries.containsKey(key)) {<a name="line.531"></a>
+<FONT color="green">532</FONT>                    if (iter.value() &gt; max) {<a name="line.532"></a>
+<FONT color="green">533</FONT>                        max = iter.value();<a name="line.533"></a>
+<FONT color="green">534</FONT>                    }<a name="line.534"></a>
+<FONT color="green">535</FONT>                }<a name="line.535"></a>
+<FONT color="green">536</FONT>            }<a name="line.536"></a>
+<FONT color="green">537</FONT>            return max;<a name="line.537"></a>
+<FONT color="green">538</FONT>        }<a name="line.538"></a>
+<FONT color="green">539</FONT>    <a name="line.539"></a>
+<FONT color="green">540</FONT>        /** {@inheritDoc} */<a name="line.540"></a>
+<FONT color="green">541</FONT>        @Override<a name="line.541"></a>
+<FONT color="green">542</FONT>        public double getLInfDistance(RealVector v) throws IllegalArgumentException {<a name="line.542"></a>
+<FONT color="green">543</FONT>            checkVectorDimensions(v.getDimension());<a name="line.543"></a>
+<FONT color="green">544</FONT>            if (v instanceof OpenMapRealVector) {<a name="line.544"></a>
+<FONT color="green">545</FONT>                return getLInfDistance((OpenMapRealVector) v);<a name="line.545"></a>
+<FONT color="green">546</FONT>            }<a name="line.546"></a>
+<FONT color="green">547</FONT>            return getLInfDistance(v.getData());<a name="line.547"></a>
+<FONT color="green">548</FONT>        }<a name="line.548"></a>
+<FONT color="green">549</FONT>    <a name="line.549"></a>
+<FONT color="green">550</FONT>        /** {@inheritDoc} */<a name="line.550"></a>
+<FONT color="green">551</FONT>        @Override<a name="line.551"></a>
+<FONT color="green">552</FONT>        public double getLInfDistance(double[] v) throws IllegalArgumentException {<a name="line.552"></a>
+<FONT color="green">553</FONT>            checkVectorDimensions(v.length);<a name="line.553"></a>
+<FONT color="green">554</FONT>            double max = 0;<a name="line.554"></a>
+<FONT color="green">555</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.555"></a>
+<FONT color="green">556</FONT>                double delta = Math.abs(getEntry(i) - v[i]);<a name="line.556"></a>
+<FONT color="green">557</FONT>                if (delta &gt; max) {<a name="line.557"></a>
+<FONT color="green">558</FONT>                    max = delta;<a name="line.558"></a>
+<FONT color="green">559</FONT>                }<a name="line.559"></a>
+<FONT color="green">560</FONT>            }<a name="line.560"></a>
+<FONT color="green">561</FONT>            return max;<a name="line.561"></a>
+<FONT color="green">562</FONT>        }<a name="line.562"></a>
+<FONT color="green">563</FONT>    <a name="line.563"></a>
+<FONT color="green">564</FONT>        /** {@inheritDoc} */<a name="line.564"></a>
+<FONT color="green">565</FONT>        public boolean isInfinite() {<a name="line.565"></a>
+<FONT color="green">566</FONT>            boolean infiniteFound = false;<a name="line.566"></a>
+<FONT color="green">567</FONT>            Iterator iter = entries.iterator();<a name="line.567"></a>
+<FONT color="green">568</FONT>            while (iter.hasNext()) {<a name="line.568"></a>
+<FONT color="green">569</FONT>                iter.advance();<a name="line.569"></a>
+<FONT color="green">570</FONT>                final double value = iter.value();<a name="line.570"></a>
+<FONT color="green">571</FONT>                if (Double.isNaN(value)) {<a name="line.571"></a>
+<FONT color="green">572</FONT>                    return false;<a name="line.572"></a>
+<FONT color="green">573</FONT>                }<a name="line.573"></a>
+<FONT color="green">574</FONT>                if (Double.isInfinite(value)) {<a name="line.574"></a>
+<FONT color="green">575</FONT>                    infiniteFound = true;<a name="line.575"></a>
+<FONT color="green">576</FONT>                }<a name="line.576"></a>
+<FONT color="green">577</FONT>            }<a name="line.577"></a>
+<FONT color="green">578</FONT>            return infiniteFound;<a name="line.578"></a>
+<FONT color="green">579</FONT>        }<a name="line.579"></a>
+<FONT color="green">580</FONT>    <a name="line.580"></a>
+<FONT color="green">581</FONT>        /** {@inheritDoc} */<a name="line.581"></a>
+<FONT color="green">582</FONT>        public boolean isNaN() {<a name="line.582"></a>
+<FONT color="green">583</FONT>            Iterator iter = entries.iterator();<a name="line.583"></a>
+<FONT color="green">584</FONT>            while (iter.hasNext()) {<a name="line.584"></a>
+<FONT color="green">585</FONT>                iter.advance();<a name="line.585"></a>
+<FONT color="green">586</FONT>                if (Double.isNaN(iter.value())) {<a name="line.586"></a>
+<FONT color="green">587</FONT>                    return true;<a name="line.587"></a>
+<FONT color="green">588</FONT>                }<a name="line.588"></a>
+<FONT color="green">589</FONT>            }<a name="line.589"></a>
+<FONT color="green">590</FONT>            return false;<a name="line.590"></a>
+<FONT color="green">591</FONT>        }<a name="line.591"></a>
+<FONT color="green">592</FONT>    <a name="line.592"></a>
+<FONT color="green">593</FONT>        /** {@inheritDoc} */<a name="line.593"></a>
+<FONT color="green">594</FONT>        @Override<a name="line.594"></a>
+<FONT color="green">595</FONT>        public OpenMapRealVector mapAdd(double d) {<a name="line.595"></a>
+<FONT color="green">596</FONT>            return copy().mapAddToSelf(d);<a name="line.596"></a>
+<FONT color="green">597</FONT>        }<a name="line.597"></a>
+<FONT color="green">598</FONT>    <a name="line.598"></a>
+<FONT color="green">599</FONT>        /** {@inheritDoc} */<a name="line.599"></a>
+<FONT color="green">600</FONT>        @Override<a name="line.600"></a>
+<FONT color="green">601</FONT>        public OpenMapRealVector mapAddToSelf(double d) {<a name="line.601"></a>
+<FONT color="green">602</FONT>            for (int i = 0; i &lt; virtualSize; i++) {<a name="line.602"></a>
+<FONT color="green">603</FONT>                setEntry(i, getEntry(i) + d);<a name="line.603"></a>
+<FONT color="green">604</FONT>            }<a name="line.604"></a>
+<FONT color="green">605</FONT>            return this;<a name="line.605"></a>
+<FONT color="green">606</FONT>        }<a name="line.606"></a>
+<FONT color="green">607</FONT>    <a name="line.607"></a>
+<FONT color="green">608</FONT>         /** {@inheritDoc} */<a name="line.608"></a>
+<FONT color="green">609</FONT>        @Override<a name="line.609"></a>
+<FONT color="green">610</FONT>        public RealMatrix outerProduct(double[] v) throws IllegalArgumentException {<a name="line.610"></a>
+<FONT color="green">611</FONT>            checkVectorDimensions(v.length);<a name="line.611"></a>
+<FONT color="green">612</FONT>            RealMatrix res = new OpenMapRealMatrix(virtualSize, virtualSize);<a name="line.612"></a>
+<FONT color="green">613</FONT>            Iterator iter = entries.iterator();<a name="line.613"></a>
+<FONT color="green">614</FONT>            while (iter.hasNext()) {<a name="line.614"></a>
+<FONT color="green">615</FONT>                iter.advance();<a name="line.615"></a>
+<FONT color="green">616</FONT>                int row = iter.key();<a name="line.616"></a>
+<FONT color="green">617</FONT>                double value = iter.value();<a name="line.617"></a>
+<FONT color="green">618</FONT>                for (int col = 0; col &lt; virtualSize; col++) {<a name="line.618"></a>
+<FONT color="green">619</FONT>                    res.setEntry(row, col, value * v[col]);<a name="line.619"></a>
+<FONT color="green">620</FONT>                }<a name="line.620"></a>
+<FONT color="green">621</FONT>            }<a name="line.621"></a>
+<FONT color="green">622</FONT>            return res;<a name="line.622"></a>
+<FONT color="green">623</FONT>        }<a name="line.623"></a>
+<FONT color="green">624</FONT>    <a name="line.624"></a>
+<FONT color="green">625</FONT>        /** {@inheritDoc} */<a name="line.625"></a>
+<FONT color="green">626</FONT>        public RealVector projection(RealVector v) throws IllegalArgumentException {<a name="line.626"></a>
+<FONT color="green">627</FONT>            checkVectorDimensions(v.getDimension());<a name="line.627"></a>
+<FONT color="green">628</FONT>            return v.mapMultiply(dotProduct(v) / v.dotProduct(v));<a name="line.628"></a>
+<FONT color="green">629</FONT>        }<a name="line.629"></a>
+<FONT color="green">630</FONT>    <a name="line.630"></a>
+<FONT color="green">631</FONT>        /** {@inheritDoc} */<a name="line.631"></a>
+<FONT color="green">632</FONT>        @Override<a name="line.632"></a>
+<FONT color="green">633</FONT>        public OpenMapRealVector projection(double[] v) throws IllegalArgumentException {<a name="line.633"></a>
+<FONT color="green">634</FONT>            checkVectorDimensions(v.length);<a name="line.634"></a>
+<FONT color="green">635</FONT>            return (OpenMapRealVector) projection(new OpenMapRealVector(v));<a name="line.635"></a>
+<FONT color="green">636</FONT>        }<a name="line.636"></a>
+<FONT color="green">637</FONT>    <a name="line.637"></a>
+<FONT color="green">638</FONT>        /** {@inheritDoc} */<a name="line.638"></a>
+<FONT color="green">639</FONT>        public void setEntry(int index, double value) throws MatrixIndexException {<a name="line.639"></a>
+<FONT color="green">640</FONT>            checkIndex(index);<a name="line.640"></a>
+<FONT color="green">641</FONT>            if (!isDefaultValue(value)) {<a name="line.641"></a>
+<FONT color="green">642</FONT>                entries.put(index, value);<a name="line.642"></a>
+<FONT color="green">643</FONT>            } else if (entries.containsKey(index)) {<a name="line.643"></a>
+<FONT color="green">644</FONT>                entries.remove(index);<a name="line.644"></a>
+<FONT color="green">645</FONT>            }<a name="line.645"></a>
+<FONT color="green">646</FONT>        }<a name="line.646"></a>
+<FONT color="green">647</FONT>    <a name="line.647"></a>
+<FONT color="green">648</FONT>        /** {@inheritDoc} */<a name="line.648"></a>
+<FONT color="green">649</FONT>        @Override<a name="line.649"></a>
+<FONT color="green">650</FONT>        public void setSubVector(int index, RealVector v) throws MatrixIndexException {<a name="line.650"></a>
+<FONT color="green">651</FONT>            checkIndex(index);<a name="line.651"></a>
+<FONT color="green">652</FONT>            checkIndex(index + v.getDimension() - 1);<a name="line.652"></a>
+<FONT color="green">653</FONT>            setSubVector(index, v.getData());<a name="line.653"></a>
+<FONT color="green">654</FONT>        }<a name="line.654"></a>
+<FONT color="green">655</FONT>    <a name="line.655"></a>
+<FONT color="green">656</FONT>        /** {@inheritDoc} */<a name="line.656"></a>
+<FONT color="green">657</FONT>        @Override<a name="line.657"></a>
+<FONT color="green">658</FONT>        public void setSubVector(int index, double[] v) throws MatrixIndexException {<a name="line.658"></a>
+<FONT color="green">659</FONT>            checkIndex(index);<a name="line.659"></a>
+<FONT color="green">660</FONT>            checkIndex(index + v.length - 1);<a name="line.660"></a>
+<FONT color="green">661</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.661"></a>
+<FONT color="green">662</FONT>                setEntry(i + index, v[i]);<a name="line.662"></a>
+<FONT color="green">663</FONT>            }<a name="line.663"></a>
+<FONT color="green">664</FONT>        }<a name="line.664"></a>
+<FONT color="green">665</FONT>    <a name="line.665"></a>
+<FONT color="green">666</FONT>        /** {@inheritDoc} */<a name="line.666"></a>
+<FONT color="green">667</FONT>        @Override<a name="line.667"></a>
+<FONT color="green">668</FONT>        public void set(double value) {<a name="line.668"></a>
+<FONT color="green">669</FONT>            for (int i = 0; i &lt; virtualSize; i++) {<a name="line.669"></a>
+<FONT color="green">670</FONT>                setEntry(i, value);<a name="line.670"></a>
+<FONT color="green">671</FONT>            }<a name="line.671"></a>
+<FONT color="green">672</FONT>        }<a name="line.672"></a>
+<FONT color="green">673</FONT>    <a name="line.673"></a>
+<FONT color="green">674</FONT>        /**<a name="line.674"></a>
+<FONT color="green">675</FONT>         * Optimized method to subtract OpenMapRealVectors.<a name="line.675"></a>
+<FONT color="green">676</FONT>         * @param v The vector to subtract from &lt;code&gt;this&lt;/code&gt;<a name="line.676"></a>
+<FONT color="green">677</FONT>         * @return The difference of &lt;code&gt;this&lt;/code&gt; and &lt;code&gt;v&lt;/code&gt;<a name="line.677"></a>
+<FONT color="green">678</FONT>         * @throws IllegalArgumentException If the dimensions don't match<a name="line.678"></a>
+<FONT color="green">679</FONT>         */<a name="line.679"></a>
+<FONT color="green">680</FONT>        public OpenMapRealVector subtract(OpenMapRealVector v) throws IllegalArgumentException{<a name="line.680"></a>
+<FONT color="green">681</FONT>            checkVectorDimensions(v.getDimension());<a name="line.681"></a>
+<FONT color="green">682</FONT>            OpenMapRealVector res = copy();<a name="line.682"></a>
+<FONT color="green">683</FONT>            Iterator iter = v.getEntries().iterator();<a name="line.683"></a>
+<FONT color="green">684</FONT>            while (iter.hasNext()) {<a name="line.684"></a>
+<FONT color="green">685</FONT>                iter.advance();<a name="line.685"></a>
+<FONT color="green">686</FONT>                int key = iter.key();<a name="line.686"></a>
+<FONT color="green">687</FONT>                if (entries.containsKey(key)) {<a name="line.687"></a>
+<FONT color="green">688</FONT>                    res.setEntry(key, entries.get(key) - iter.value());<a name="line.688"></a>
+<FONT color="green">689</FONT>                } else {<a name="line.689"></a>
+<FONT color="green">690</FONT>                    res.setEntry(key, -iter.value());<a name="line.690"></a>
+<FONT color="green">691</FONT>                }<a name="line.691"></a>
+<FONT color="green">692</FONT>            }<a name="line.692"></a>
+<FONT color="green">693</FONT>            return res;<a name="line.693"></a>
+<FONT color="green">694</FONT>        }<a name="line.694"></a>
+<FONT color="green">695</FONT>    <a name="line.695"></a>
+<FONT color="green">696</FONT>        /** {@inheritDoc} */<a name="line.696"></a>
+<FONT color="green">697</FONT>        @Override<a name="line.697"></a>
+<FONT color="green">698</FONT>        public OpenMapRealVector subtract(RealVector v) throws IllegalArgumentException {<a name="line.698"></a>
+<FONT color="green">699</FONT>            checkVectorDimensions(v.getDimension());<a name="line.699"></a>
+<FONT color="green">700</FONT>            if (v instanceof OpenMapRealVector) {<a name="line.700"></a>
+<FONT color="green">701</FONT>                return subtract((OpenMapRealVector) v);<a name="line.701"></a>
+<FONT color="green">702</FONT>            }<a name="line.702"></a>
+<FONT color="green">703</FONT>            return subtract(v.getData());<a name="line.703"></a>
+<FONT color="green">704</FONT>        }<a name="line.704"></a>
+<FONT color="green">705</FONT>    <a name="line.705"></a>
+<FONT color="green">706</FONT>        /** {@inheritDoc} */<a name="line.706"></a>
+<FONT color="green">707</FONT>        @Override<a name="line.707"></a>
+<FONT color="green">708</FONT>        public OpenMapRealVector subtract(double[] v) throws IllegalArgumentException {<a name="line.708"></a>
+<FONT color="green">709</FONT>            checkVectorDimensions(v.length);<a name="line.709"></a>
+<FONT color="green">710</FONT>            OpenMapRealVector res = new OpenMapRealVector(this);<a name="line.710"></a>
+<FONT color="green">711</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.711"></a>
+<FONT color="green">712</FONT>                if (entries.containsKey(i)) {<a name="line.712"></a>
+<FONT color="green">713</FONT>                    res.setEntry(i, entries.get(i) - v[i]);<a name="line.713"></a>
+<FONT color="green">714</FONT>                } else {<a name="line.714"></a>
+<FONT color="green">715</FONT>                    res.setEntry(i, -v[i]);<a name="line.715"></a>
+<FONT color="green">716</FONT>                }<a name="line.716"></a>
+<FONT color="green">717</FONT>            }<a name="line.717"></a>
+<FONT color="green">718</FONT>            return res;<a name="line.718"></a>
+<FONT color="green">719</FONT>        }<a name="line.719"></a>
+<FONT color="green">720</FONT>    <a name="line.720"></a>
+<FONT color="green">721</FONT>    <a name="line.721"></a>
+<FONT color="green">722</FONT>        /** {@inheritDoc} */<a name="line.722"></a>
+<FONT color="green">723</FONT>        @Override<a name="line.723"></a>
+<FONT color="green">724</FONT>        public OpenMapRealVector unitVector() {<a name="line.724"></a>
+<FONT color="green">725</FONT>            OpenMapRealVector res = copy();<a name="line.725"></a>
+<FONT color="green">726</FONT>            res.unitize();<a name="line.726"></a>
+<FONT color="green">727</FONT>            return res;<a name="line.727"></a>
+<FONT color="green">728</FONT>        }<a name="line.728"></a>
+<FONT color="green">729</FONT>    <a name="line.729"></a>
+<FONT color="green">730</FONT>        /** {@inheritDoc} */<a name="line.730"></a>
+<FONT color="green">731</FONT>        @Override<a name="line.731"></a>
+<FONT color="green">732</FONT>        public void unitize() {<a name="line.732"></a>
+<FONT color="green">733</FONT>            double norm = getNorm();<a name="line.733"></a>
+<FONT color="green">734</FONT>            if (isDefaultValue(norm)) {<a name="line.734"></a>
+<FONT color="green">735</FONT>                throw  MathRuntimeException.createArithmeticException("cannot normalize a zero norm vector");<a name="line.735"></a>
+<FONT color="green">736</FONT>            }<a name="line.736"></a>
+<FONT color="green">737</FONT>            Iterator iter = entries.iterator();<a name="line.737"></a>
+<FONT color="green">738</FONT>            while (iter.hasNext()) {<a name="line.738"></a>
+<FONT color="green">739</FONT>                iter.advance();<a name="line.739"></a>
+<FONT color="green">740</FONT>                entries.put(iter.key(), iter.value() / norm);<a name="line.740"></a>
+<FONT color="green">741</FONT>            }<a name="line.741"></a>
+<FONT color="green">742</FONT>    <a name="line.742"></a>
+<FONT color="green">743</FONT>        }<a name="line.743"></a>
+<FONT color="green">744</FONT>    <a name="line.744"></a>
+<FONT color="green">745</FONT>    <a name="line.745"></a>
+<FONT color="green">746</FONT>        /** {@inheritDoc} */<a name="line.746"></a>
+<FONT color="green">747</FONT>        @Override<a name="line.747"></a>
+<FONT color="green">748</FONT>        public double[] toArray() {<a name="line.748"></a>
+<FONT color="green">749</FONT>            return getData();<a name="line.749"></a>
+<FONT color="green">750</FONT>        }<a name="line.750"></a>
+<FONT color="green">751</FONT>    <a name="line.751"></a>
+<FONT color="green">752</FONT>        /** {@inheritDoc}<a name="line.752"></a>
+<FONT color="green">753</FONT>         * &lt;p&gt; Implementation Note: This works on exact values, and as a result<a name="line.753"></a>
+<FONT color="green">754</FONT>         * it is possible for {@code a.subtract(b)} to be the zero vector, while<a name="line.754"></a>
+<FONT color="green">755</FONT>         * {@code a.hashCode() != b.hashCode()}.&lt;/p&gt;<a name="line.755"></a>
+<FONT color="green">756</FONT>         */<a name="line.756"></a>
+<FONT color="green">757</FONT>        @Override<a name="line.757"></a>
+<FONT color="green">758</FONT>        public int hashCode() {<a name="line.758"></a>
+<FONT color="green">759</FONT>            final int prime = 31;<a name="line.759"></a>
+<FONT color="green">760</FONT>            int result = 1;<a name="line.760"></a>
+<FONT color="green">761</FONT>            long temp;<a name="line.761"></a>
+<FONT color="green">762</FONT>            temp = Double.doubleToLongBits(epsilon);<a name="line.762"></a>
+<FONT color="green">763</FONT>            result = prime * result + (int) (temp ^ (temp &gt;&gt;&gt; 32));<a name="line.763"></a>
+<FONT color="green">764</FONT>            result = prime * result + virtualSize;<a name="line.764"></a>
+<FONT color="green">765</FONT>            Iterator iter = entries.iterator();<a name="line.765"></a>
+<FONT color="green">766</FONT>            while (iter.hasNext()) {<a name="line.766"></a>
+<FONT color="green">767</FONT>                iter.advance();<a name="line.767"></a>
+<FONT color="green">768</FONT>                temp = Double.doubleToLongBits(iter.value());<a name="line.768"></a>
+<FONT color="green">769</FONT>                result = prime * result + (int) (temp ^ (temp &gt;&gt;32));<a name="line.769"></a>
+<FONT color="green">770</FONT>            }<a name="line.770"></a>
+<FONT color="green">771</FONT>            return result;<a name="line.771"></a>
+<FONT color="green">772</FONT>        }<a name="line.772"></a>
+<FONT color="green">773</FONT>    <a name="line.773"></a>
+<FONT color="green">774</FONT>        /**<a name="line.774"></a>
+<FONT color="green">775</FONT>         * &lt;p&gt; Implementation Note: This performs an exact comparison, and as a result<a name="line.775"></a>
+<FONT color="green">776</FONT>         * it is possible for {@code a.subtract(b}} to be the zero vector, while<a name="line.776"></a>
+<FONT color="green">777</FONT>         * {@code  a.equals(b) == false}.&lt;/p&gt;<a name="line.777"></a>
+<FONT color="green">778</FONT>         * {@inheritDoc}<a name="line.778"></a>
+<FONT color="green">779</FONT>         */<a name="line.779"></a>
+<FONT color="green">780</FONT>        @Override<a name="line.780"></a>
+<FONT color="green">781</FONT>        public boolean equals(Object obj) {<a name="line.781"></a>
+<FONT color="green">782</FONT>            if (this == obj) {<a name="line.782"></a>
+<FONT color="green">783</FONT>                return true;<a name="line.783"></a>
+<FONT color="green">784</FONT>            }<a name="line.784"></a>
+<FONT color="green">785</FONT>            if (!(obj instanceof OpenMapRealVector)) {<a name="line.785"></a>
+<FONT color="green">786</FONT>                return false;<a name="line.786"></a>
+<FONT color="green">787</FONT>            }<a name="line.787"></a>
+<FONT color="green">788</FONT>            OpenMapRealVector other = (OpenMapRealVector) obj;<a name="line.788"></a>
+<FONT color="green">789</FONT>            if (virtualSize != other.virtualSize) {<a name="line.789"></a>
+<FONT color="green">790</FONT>                return false;<a name="line.790"></a>
+<FONT color="green">791</FONT>            }<a name="line.791"></a>
+<FONT color="green">792</FONT>            if (Double.doubleToLongBits(epsilon) !=<a name="line.792"></a>
+<FONT color="green">793</FONT>                Double.doubleToLongBits(other.epsilon)) {<a name="line.793"></a>
+<FONT color="green">794</FONT>                return false;<a name="line.794"></a>
+<FONT color="green">795</FONT>            }<a name="line.795"></a>
+<FONT color="green">796</FONT>            Iterator iter = entries.iterator();<a name="line.796"></a>
+<FONT color="green">797</FONT>            while (iter.hasNext()) {<a name="line.797"></a>
+<FONT color="green">798</FONT>                iter.advance();<a name="line.798"></a>
+<FONT color="green">799</FONT>                double test = other.getEntry(iter.key());<a name="line.799"></a>
+<FONT color="green">800</FONT>                if (Double.doubleToLongBits(test) != Double.doubleToLongBits(iter.value())) {<a name="line.800"></a>
+<FONT color="green">801</FONT>                    return false;<a name="line.801"></a>
+<FONT color="green">802</FONT>                }<a name="line.802"></a>
+<FONT color="green">803</FONT>            }<a name="line.803"></a>
+<FONT color="green">804</FONT>            iter = other.getEntries().iterator();<a name="line.804"></a>
+<FONT color="green">805</FONT>            while (iter.hasNext()) {<a name="line.805"></a>
+<FONT color="green">806</FONT>                iter.advance();<a name="line.806"></a>
+<FONT color="green">807</FONT>                double test = iter.value();<a name="line.807"></a>
+<FONT color="green">808</FONT>                if (Double.doubleToLongBits(test) != Double.doubleToLongBits(getEntry(iter.key()))) {<a name="line.808"></a>
+<FONT color="green">809</FONT>                    return false;<a name="line.809"></a>
+<FONT color="green">810</FONT>                }<a name="line.810"></a>
+<FONT color="green">811</FONT>            }<a name="line.811"></a>
+<FONT color="green">812</FONT>            return true;<a name="line.812"></a>
+<FONT color="green">813</FONT>        }<a name="line.813"></a>
+<FONT color="green">814</FONT>    <a name="line.814"></a>
+<FONT color="green">815</FONT>        /**<a name="line.815"></a>
+<FONT color="green">816</FONT>         *<a name="line.816"></a>
+<FONT color="green">817</FONT>         * @return the percentage of none zero elements as a decimal percent.<a name="line.817"></a>
+<FONT color="green">818</FONT>         */<a name="line.818"></a>
+<FONT color="green">819</FONT>        public double getSparcity() {<a name="line.819"></a>
+<FONT color="green">820</FONT>            return (double)entries.size()/(double)getDimension();<a name="line.820"></a>
+<FONT color="green">821</FONT>        }<a name="line.821"></a>
+<FONT color="green">822</FONT>    <a name="line.822"></a>
+<FONT color="green">823</FONT>        /** {@inheritDoc} */<a name="line.823"></a>
+<FONT color="green">824</FONT>        @Override<a name="line.824"></a>
+<FONT color="green">825</FONT>        public java.util.Iterator&lt;Entry&gt; sparseIterator() {<a name="line.825"></a>
+<FONT color="green">826</FONT>            return new OpenMapSparseIterator();<a name="line.826"></a>
+<FONT color="green">827</FONT>        }<a name="line.827"></a>
+<FONT color="green">828</FONT>    <a name="line.828"></a>
+<FONT color="green">829</FONT>        /**<a name="line.829"></a>
+<FONT color="green">830</FONT>         *  Implementation of &lt;code&gt;Entry&lt;/code&gt; optimized for OpenMap.<a name="line.830"></a>
+<FONT color="green">831</FONT>         * &lt;p&gt;This implementation does not allow arbitrary calls to &lt;code&gt;setIndex&lt;/code&gt;<a name="line.831"></a>
+<FONT color="green">832</FONT>         * since the order that entries are returned is undefined.<a name="line.832"></a>
+<FONT color="green">833</FONT>         */<a name="line.833"></a>
+<FONT color="green">834</FONT>        protected class OpenMapEntry extends Entry {<a name="line.834"></a>
+<FONT color="green">835</FONT>    <a name="line.835"></a>
+<FONT color="green">836</FONT>            /** Iterator pointing to the entry. */<a name="line.836"></a>
+<FONT color="green">837</FONT>            private final Iterator iter;<a name="line.837"></a>
+<FONT color="green">838</FONT>    <a name="line.838"></a>
+<FONT color="green">839</FONT>            /** Build an entry from an iterator point to an element.<a name="line.839"></a>
+<FONT color="green">840</FONT>             * @param iter iterator pointing to the entry<a name="line.840"></a>
+<FONT color="green">841</FONT>             */<a name="line.841"></a>
+<FONT color="green">842</FONT>            protected OpenMapEntry(Iterator iter) {<a name="line.842"></a>
+<FONT color="green">843</FONT>                this.iter = iter;<a name="line.843"></a>
+<FONT color="green">844</FONT>            }<a name="line.844"></a>
+<FONT color="green">845</FONT>    <a name="line.845"></a>
+<FONT color="green">846</FONT>            /** {@inheritDoc} */<a name="line.846"></a>
+<FONT color="green">847</FONT>            @Override<a name="line.847"></a>
+<FONT color="green">848</FONT>            public double getValue() {<a name="line.848"></a>
+<FONT color="green">849</FONT>                return iter.value();<a name="line.849"></a>
+<FONT color="green">850</FONT>            }<a name="line.850"></a>
+<FONT color="green">851</FONT>    <a name="line.851"></a>
+<FONT color="green">852</FONT>            /** {@inheritDoc} */<a name="line.852"></a>
+<FONT color="green">853</FONT>            @Override<a name="line.853"></a>
+<FONT color="green">854</FONT>            public void setValue(double value) {<a name="line.854"></a>
+<FONT color="green">855</FONT>                entries.put(iter.key(), value);<a name="line.855"></a>
+<FONT color="green">856</FONT>            }<a name="line.856"></a>
+<FONT color="green">857</FONT>    <a name="line.857"></a>
+<FONT color="green">858</FONT>            /** {@inheritDoc} */<a name="line.858"></a>
+<FONT color="green">859</FONT>            @Override<a name="line.859"></a>
+<FONT color="green">860</FONT>            public int getIndex() {<a name="line.860"></a>
+<FONT color="green">861</FONT>                return iter.key();<a name="line.861"></a>
+<FONT color="green">862</FONT>            }<a name="line.862"></a>
+<FONT color="green">863</FONT>    <a name="line.863"></a>
+<FONT color="green">864</FONT>        }<a name="line.864"></a>
+<FONT color="green">865</FONT>    <a name="line.865"></a>
+<FONT color="green">866</FONT>        /**<a name="line.866"></a>
+<FONT color="green">867</FONT>         *  Iterator class to do iteration over just the non-zero elements.<a name="line.867"></a>
+<FONT color="green">868</FONT>         *  &lt;p&gt;This implementation is fail-fast, so cannot be used to modify any zero element.<a name="line.868"></a>
+<FONT color="green">869</FONT>         *<a name="line.869"></a>
+<FONT color="green">870</FONT>         */<a name="line.870"></a>
+<FONT color="green">871</FONT>        protected class OpenMapSparseIterator implements java.util.Iterator&lt;Entry&gt; {<a name="line.871"></a>
+<FONT color="green">872</FONT>    <a name="line.872"></a>
+<FONT color="green">873</FONT>            /** Underlying iterator. */<a name="line.873"></a>
+<FONT color="green">874</FONT>            private final Iterator iter;<a name="line.874"></a>
+<FONT color="green">875</FONT>    <a name="line.875"></a>
+<FONT color="green">876</FONT>            /** Current entry. */<a name="line.876"></a>
+<FONT color="green">877</FONT>            private final Entry current;<a name="line.877"></a>
+<FONT color="green">878</FONT>    <a name="line.878"></a>
+<FONT color="green">879</FONT>            /** Simple constructor. */<a name="line.879"></a>
+<FONT color="green">880</FONT>            protected OpenMapSparseIterator() {<a name="line.880"></a>
+<FONT color="green">881</FONT>                iter = entries.iterator();<a name="line.881"></a>
+<FONT color="green">882</FONT>                current = new OpenMapEntry(iter);<a name="line.882"></a>
+<FONT color="green">883</FONT>            }<a name="line.883"></a>
+<FONT color="green">884</FONT>    <a name="line.884"></a>
+<FONT color="green">885</FONT>            /** {@inheritDoc} */<a name="line.885"></a>
+<FONT color="green">886</FONT>            public boolean hasNext() {<a name="line.886"></a>
+<FONT color="green">887</FONT>                return iter.hasNext();<a name="line.887"></a>
+<FONT color="green">888</FONT>            }<a name="line.888"></a>
+<FONT color="green">889</FONT>    <a name="line.889"></a>
+<FONT color="green">890</FONT>            /** {@inheritDoc} */<a name="line.890"></a>
+<FONT color="green">891</FONT>            public Entry next() {<a name="line.891"></a>
+<FONT color="green">892</FONT>                iter.advance();<a name="line.892"></a>
+<FONT color="green">893</FONT>                return current;<a name="line.893"></a>
+<FONT color="green">894</FONT>            }<a name="line.894"></a>
+<FONT color="green">895</FONT>    <a name="line.895"></a>
+<FONT color="green">896</FONT>            /** {@inheritDoc} */<a name="line.896"></a>
+<FONT color="green">897</FONT>            public void remove() {<a name="line.897"></a>
+<FONT color="green">898</FONT>                throw new UnsupportedOperationException("Not supported");<a name="line.898"></a>
+<FONT color="green">899</FONT>           }<a name="line.899"></a>
+<FONT color="green">900</FONT>    <a name="line.900"></a>
+<FONT color="green">901</FONT>        }<a name="line.901"></a>
+<FONT color="green">902</FONT>    }<a name="line.902"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/OpenMapRealVector.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,968 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.linear;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.util.OpenIntToDoubleHashMap;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.util.OpenIntToDoubleHashMap.Iterator;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * This class implements the {@link RealVector} interface with a {@link OpenIntToDoubleHashMap} backing store.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @since 2.0<a name="line.28"></a>
+<FONT color="green">029</FONT>    */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public class OpenMapRealVector extends AbstractRealVector implements SparseRealVector, Serializable {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** Default Tolerance for having a value considered zero. */<a name="line.32"></a>
+<FONT color="green">033</FONT>        public static final double DEFAULT_ZERO_TOLERANCE = 1.0e-12;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Serializable version identifier. */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private static final long serialVersionUID = 8772222695580707260L;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Entries of the vector. */<a name="line.38"></a>
+<FONT color="green">039</FONT>        private final OpenIntToDoubleHashMap entries;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Dimension of the vector. */<a name="line.41"></a>
+<FONT color="green">042</FONT>        private final int virtualSize;<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Tolerance for having a value considered zero. */<a name="line.44"></a>
+<FONT color="green">045</FONT>        private double epsilon;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Build a 0-length vector.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * &lt;p&gt;Zero-length vectors may be used to initialized construction of vectors<a name="line.49"></a>
+<FONT color="green">050</FONT>         * by data gathering. We start with zero-length and use either the {@link<a name="line.50"></a>
+<FONT color="green">051</FONT>         * #OpenMapRealVector(OpenMapRealVector, int)} constructor<a name="line.51"></a>
+<FONT color="green">052</FONT>         * or one of the &lt;code&gt;append&lt;/code&gt; method ({@link #append(double)}, {@link<a name="line.52"></a>
+<FONT color="green">053</FONT>         * #append(double[])}, {@link #append(RealVector)}) to gather data<a name="line.53"></a>
+<FONT color="green">054</FONT>         * into this vector.&lt;/p&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public OpenMapRealVector() {<a name="line.56"></a>
+<FONT color="green">057</FONT>            this(0, DEFAULT_ZERO_TOLERANCE);<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /**<a name="line.60"></a>
+<FONT color="green">061</FONT>         * Construct a (dimension)-length vector of zeros.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param dimension size of the vector<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public OpenMapRealVector(int dimension) {<a name="line.64"></a>
+<FONT color="green">065</FONT>            this(dimension, DEFAULT_ZERO_TOLERANCE);<a name="line.65"></a>
+<FONT color="green">066</FONT>        }<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /**<a name="line.68"></a>
+<FONT color="green">069</FONT>         * Construct a (dimension)-length vector of zeros, specifying zero tolerance.<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @param dimension Size of the vector<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param epsilon The tolerance for having a value considered zero<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        public OpenMapRealVector(int dimension, double epsilon) {<a name="line.73"></a>
+<FONT color="green">074</FONT>            virtualSize = dimension;<a name="line.74"></a>
+<FONT color="green">075</FONT>            entries = new OpenIntToDoubleHashMap(0.0);<a name="line.75"></a>
+<FONT color="green">076</FONT>            this.epsilon = epsilon;<a name="line.76"></a>
+<FONT color="green">077</FONT>        }<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        /**<a name="line.79"></a>
+<FONT color="green">080</FONT>         * Build a resized vector, for use with append.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @param v The original vector<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @param resize The amount to resize it<a name="line.82"></a>
+<FONT color="green">083</FONT>         */<a name="line.83"></a>
+<FONT color="green">084</FONT>        protected OpenMapRealVector(OpenMapRealVector v, int resize) {<a name="line.84"></a>
+<FONT color="green">085</FONT>            virtualSize = v.getDimension() + resize;<a name="line.85"></a>
+<FONT color="green">086</FONT>            entries = new OpenIntToDoubleHashMap(v.entries);<a name="line.86"></a>
+<FONT color="green">087</FONT>            epsilon = v.epsilon;<a name="line.87"></a>
+<FONT color="green">088</FONT>        }<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>        /**<a name="line.90"></a>
+<FONT color="green">091</FONT>         * Build a vector with known the sparseness (for advanced use only).<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @param dimension The size of the vector<a name="line.92"></a>
+<FONT color="green">093</FONT>         * @param expectedSize The expected number of non-zero entries<a name="line.93"></a>
+<FONT color="green">094</FONT>         */<a name="line.94"></a>
+<FONT color="green">095</FONT>        public OpenMapRealVector(int dimension, int expectedSize) {<a name="line.95"></a>
+<FONT color="green">096</FONT>            this(dimension, expectedSize, DEFAULT_ZERO_TOLERANCE);<a name="line.96"></a>
+<FONT color="green">097</FONT>        }<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>        /**<a name="line.99"></a>
+<FONT color="green">100</FONT>         * Build a vector with known the sparseness and zero tolerance setting (for advanced use only).<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @param dimension The size of the vector<a name="line.101"></a>
+<FONT color="green">102</FONT>         * @param expectedSize The expected number of non-zero entries<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @param epsilon The tolerance for having a value considered zero<a name="line.103"></a>
+<FONT color="green">104</FONT>         */<a name="line.104"></a>
+<FONT color="green">105</FONT>        public OpenMapRealVector(int dimension, int expectedSize, double epsilon) {<a name="line.105"></a>
+<FONT color="green">106</FONT>            virtualSize = dimension;<a name="line.106"></a>
+<FONT color="green">107</FONT>            entries = new OpenIntToDoubleHashMap(expectedSize, 0.0);<a name="line.107"></a>
+<FONT color="green">108</FONT>            this.epsilon = epsilon;<a name="line.108"></a>
+<FONT color="green">109</FONT>        }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /**<a name="line.111"></a>
+<FONT color="green">112</FONT>         * Create from a double array.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * Only non-zero entries will be stored<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param values The set of values to create from<a name="line.114"></a>
+<FONT color="green">115</FONT>         */<a name="line.115"></a>
+<FONT color="green">116</FONT>        public OpenMapRealVector(double[] values) {<a name="line.116"></a>
+<FONT color="green">117</FONT>            this(values, DEFAULT_ZERO_TOLERANCE);<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /**<a name="line.120"></a>
+<FONT color="green">121</FONT>         * Create from a double array, specifying zero tolerance.<a name="line.121"></a>
+<FONT color="green">122</FONT>         * Only non-zero entries will be stored<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @param values The set of values to create from<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @param epsilon The tolerance for having a value considered zero<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        public OpenMapRealVector(double[] values, double epsilon) {<a name="line.126"></a>
+<FONT color="green">127</FONT>            virtualSize = values.length;<a name="line.127"></a>
+<FONT color="green">128</FONT>            entries = new OpenIntToDoubleHashMap(0.0);<a name="line.128"></a>
+<FONT color="green">129</FONT>            this.epsilon = epsilon;<a name="line.129"></a>
+<FONT color="green">130</FONT>            for (int key = 0; key &lt; values.length; key++) {<a name="line.130"></a>
+<FONT color="green">131</FONT>                double value = values[key];<a name="line.131"></a>
+<FONT color="green">132</FONT>                if (!isDefaultValue(value)) {<a name="line.132"></a>
+<FONT color="green">133</FONT>                    entries.put(key, value);<a name="line.133"></a>
+<FONT color="green">134</FONT>                }<a name="line.134"></a>
+<FONT color="green">135</FONT>            }<a name="line.135"></a>
+<FONT color="green">136</FONT>        }<a name="line.136"></a>
+<FONT color="green">137</FONT>    <a name="line.137"></a>
+<FONT color="green">138</FONT>        /**<a name="line.138"></a>
+<FONT color="green">139</FONT>         * Create from a Double array.<a name="line.139"></a>
+<FONT color="green">140</FONT>         * Only non-zero entries will be stored<a name="line.140"></a>
+<FONT color="green">141</FONT>         * @param values The set of values to create from<a name="line.141"></a>
+<FONT color="green">142</FONT>         */<a name="line.142"></a>
+<FONT color="green">143</FONT>        public OpenMapRealVector(Double[] values) {<a name="line.143"></a>
+<FONT color="green">144</FONT>            this(values, DEFAULT_ZERO_TOLERANCE);<a name="line.144"></a>
+<FONT color="green">145</FONT>        }<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>        /**<a name="line.147"></a>
+<FONT color="green">148</FONT>         * Create from a Double array.<a name="line.148"></a>
+<FONT color="green">149</FONT>         * Only non-zero entries will be stored<a name="line.149"></a>
+<FONT color="green">150</FONT>         * @param values The set of values to create from<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @param epsilon The tolerance for having a value considered zero<a name="line.151"></a>
+<FONT color="green">152</FONT>         */<a name="line.152"></a>
+<FONT color="green">153</FONT>        public OpenMapRealVector(Double[] values, double epsilon) {<a name="line.153"></a>
+<FONT color="green">154</FONT>            virtualSize = values.length;<a name="line.154"></a>
+<FONT color="green">155</FONT>            entries = new OpenIntToDoubleHashMap(0.0);<a name="line.155"></a>
+<FONT color="green">156</FONT>            this.epsilon = epsilon;<a name="line.156"></a>
+<FONT color="green">157</FONT>            for (int key = 0; key &lt; values.length; key++) {<a name="line.157"></a>
+<FONT color="green">158</FONT>                double value = values[key].doubleValue();<a name="line.158"></a>
+<FONT color="green">159</FONT>                if (!isDefaultValue(value)) {<a name="line.159"></a>
+<FONT color="green">160</FONT>                    entries.put(key, value);<a name="line.160"></a>
+<FONT color="green">161</FONT>                }<a name="line.161"></a>
+<FONT color="green">162</FONT>            }<a name="line.162"></a>
+<FONT color="green">163</FONT>        }<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>        /**<a name="line.165"></a>
+<FONT color="green">166</FONT>         * Copy constructor.<a name="line.166"></a>
+<FONT color="green">167</FONT>         * @param v The instance to copy from<a name="line.167"></a>
+<FONT color="green">168</FONT>         */<a name="line.168"></a>
+<FONT color="green">169</FONT>        public OpenMapRealVector(OpenMapRealVector v) {<a name="line.169"></a>
+<FONT color="green">170</FONT>            virtualSize = v.getDimension();<a name="line.170"></a>
+<FONT color="green">171</FONT>            entries = new OpenIntToDoubleHashMap(v.getEntries());<a name="line.171"></a>
+<FONT color="green">172</FONT>            epsilon = v.epsilon;<a name="line.172"></a>
+<FONT color="green">173</FONT>        }<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>        /**<a name="line.175"></a>
+<FONT color="green">176</FONT>         * Generic copy constructor.<a name="line.176"></a>
+<FONT color="green">177</FONT>         * @param v The instance to copy from<a name="line.177"></a>
+<FONT color="green">178</FONT>         */<a name="line.178"></a>
+<FONT color="green">179</FONT>        public OpenMapRealVector(RealVector v) {<a name="line.179"></a>
+<FONT color="green">180</FONT>            virtualSize = v.getDimension();<a name="line.180"></a>
+<FONT color="green">181</FONT>            entries = new OpenIntToDoubleHashMap(0.0);<a name="line.181"></a>
+<FONT color="green">182</FONT>            epsilon = DEFAULT_ZERO_TOLERANCE;<a name="line.182"></a>
+<FONT color="green">183</FONT>            for (int key = 0; key &lt; virtualSize; key++) {<a name="line.183"></a>
+<FONT color="green">184</FONT>                double value = v.getEntry(key);<a name="line.184"></a>
+<FONT color="green">185</FONT>                if (!isDefaultValue(value)) {<a name="line.185"></a>
+<FONT color="green">186</FONT>                    entries.put(key, value);<a name="line.186"></a>
+<FONT color="green">187</FONT>                }<a name="line.187"></a>
+<FONT color="green">188</FONT>            }<a name="line.188"></a>
+<FONT color="green">189</FONT>        }<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>        /**<a name="line.191"></a>
+<FONT color="green">192</FONT>         * Get the entries of this instance.<a name="line.192"></a>
+<FONT color="green">193</FONT>         * @return entries of this instance<a name="line.193"></a>
+<FONT color="green">194</FONT>         */<a name="line.194"></a>
+<FONT color="green">195</FONT>        private OpenIntToDoubleHashMap getEntries() {<a name="line.195"></a>
+<FONT color="green">196</FONT>            return entries;<a name="line.196"></a>
+<FONT color="green">197</FONT>        }<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>        /**<a name="line.199"></a>
+<FONT color="green">200</FONT>         * Determine if this value is within epsilon of zero.<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @param value The value to test<a name="line.201"></a>
+<FONT color="green">202</FONT>         * @return &lt;code&gt;true&lt;/code&gt; if this value is within epsilon to zero, &lt;code&gt;false&lt;/code&gt; otherwise<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @since 2.1<a name="line.203"></a>
+<FONT color="green">204</FONT>         */<a name="line.204"></a>
+<FONT color="green">205</FONT>        protected boolean isDefaultValue(double value) {<a name="line.205"></a>
+<FONT color="green">206</FONT>            return Math.abs(value) &lt; epsilon;<a name="line.206"></a>
+<FONT color="green">207</FONT>        }<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>        /** {@inheritDoc} */<a name="line.209"></a>
+<FONT color="green">210</FONT>        @Override<a name="line.210"></a>
+<FONT color="green">211</FONT>        public RealVector add(RealVector v) throws IllegalArgumentException {<a name="line.211"></a>
+<FONT color="green">212</FONT>            checkVectorDimensions(v.getDimension());<a name="line.212"></a>
+<FONT color="green">213</FONT>            if (v instanceof OpenMapRealVector) {<a name="line.213"></a>
+<FONT color="green">214</FONT>                return add((OpenMapRealVector) v);<a name="line.214"></a>
+<FONT color="green">215</FONT>            } else {<a name="line.215"></a>
+<FONT color="green">216</FONT>                return super.add(v);<a name="line.216"></a>
+<FONT color="green">217</FONT>            }<a name="line.217"></a>
+<FONT color="green">218</FONT>        }<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>        /**<a name="line.220"></a>
+<FONT color="green">221</FONT>         * Optimized method to add two OpenMapRealVectors.  Copies the larger vector, iterates over the smaller.<a name="line.221"></a>
+<FONT color="green">222</FONT>         * @param v Vector to add with<a name="line.222"></a>
+<FONT color="green">223</FONT>         * @return The sum of &lt;code&gt;this&lt;/code&gt; with &lt;code&gt;v&lt;/code&gt;<a name="line.223"></a>
+<FONT color="green">224</FONT>         * @throws IllegalArgumentException If the dimensions don't match<a name="line.224"></a>
+<FONT color="green">225</FONT>         */<a name="line.225"></a>
+<FONT color="green">226</FONT>        public OpenMapRealVector add(OpenMapRealVector v) throws IllegalArgumentException{<a name="line.226"></a>
+<FONT color="green">227</FONT>            checkVectorDimensions(v.getDimension());<a name="line.227"></a>
+<FONT color="green">228</FONT>            boolean copyThis = entries.size() &gt; v.entries.size();<a name="line.228"></a>
+<FONT color="green">229</FONT>            OpenMapRealVector res = copyThis ? this.copy() : v.copy();<a name="line.229"></a>
+<FONT color="green">230</FONT>            Iterator iter = copyThis ? v.entries.iterator() : entries.iterator();<a name="line.230"></a>
+<FONT color="green">231</FONT>            OpenIntToDoubleHashMap randomAccess = copyThis ? entries : v.entries;<a name="line.231"></a>
+<FONT color="green">232</FONT>            while (iter.hasNext()) {<a name="line.232"></a>
+<FONT color="green">233</FONT>                iter.advance();<a name="line.233"></a>
+<FONT color="green">234</FONT>                int key = iter.key();<a name="line.234"></a>
+<FONT color="green">235</FONT>                if (randomAccess.containsKey(key)) {<a name="line.235"></a>
+<FONT color="green">236</FONT>                    res.setEntry(key, randomAccess.get(key) + iter.value());<a name="line.236"></a>
+<FONT color="green">237</FONT>                } else {<a name="line.237"></a>
+<FONT color="green">238</FONT>                    res.setEntry(key, iter.value());<a name="line.238"></a>
+<FONT color="green">239</FONT>                }<a name="line.239"></a>
+<FONT color="green">240</FONT>            }<a name="line.240"></a>
+<FONT color="green">241</FONT>            return res;<a name="line.241"></a>
+<FONT color="green">242</FONT>        }<a name="line.242"></a>
+<FONT color="green">243</FONT>    <a name="line.243"></a>
+<FONT color="green">244</FONT>        /**<a name="line.244"></a>
+<FONT color="green">245</FONT>         * Optimized method to append a OpenMapRealVector.<a name="line.245"></a>
+<FONT color="green">246</FONT>         * @param v vector to append<a name="line.246"></a>
+<FONT color="green">247</FONT>         * @return The result of appending &lt;code&gt;v&lt;/code&gt; to self<a name="line.247"></a>
+<FONT color="green">248</FONT>         */<a name="line.248"></a>
+<FONT color="green">249</FONT>        public OpenMapRealVector append(OpenMapRealVector v) {<a name="line.249"></a>
+<FONT color="green">250</FONT>            OpenMapRealVector res = new OpenMapRealVector(this, v.getDimension());<a name="line.250"></a>
+<FONT color="green">251</FONT>            Iterator iter = v.entries.iterator();<a name="line.251"></a>
+<FONT color="green">252</FONT>            while (iter.hasNext()) {<a name="line.252"></a>
+<FONT color="green">253</FONT>                iter.advance();<a name="line.253"></a>
+<FONT color="green">254</FONT>                res.setEntry(iter.key() + virtualSize, iter.value());<a name="line.254"></a>
+<FONT color="green">255</FONT>            }<a name="line.255"></a>
+<FONT color="green">256</FONT>            return res;<a name="line.256"></a>
+<FONT color="green">257</FONT>        }<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>        /** {@inheritDoc} */<a name="line.259"></a>
+<FONT color="green">260</FONT>        public OpenMapRealVector append(RealVector v) {<a name="line.260"></a>
+<FONT color="green">261</FONT>            if (v instanceof OpenMapRealVector) {<a name="line.261"></a>
+<FONT color="green">262</FONT>                return append((OpenMapRealVector) v);<a name="line.262"></a>
+<FONT color="green">263</FONT>            }<a name="line.263"></a>
+<FONT color="green">264</FONT>            return append(v.getData());<a name="line.264"></a>
+<FONT color="green">265</FONT>        }<a name="line.265"></a>
+<FONT color="green">266</FONT>    <a name="line.266"></a>
+<FONT color="green">267</FONT>        /** {@inheritDoc} */<a name="line.267"></a>
+<FONT color="green">268</FONT>        public OpenMapRealVector append(double d) {<a name="line.268"></a>
+<FONT color="green">269</FONT>            OpenMapRealVector res = new OpenMapRealVector(this, 1);<a name="line.269"></a>
+<FONT color="green">270</FONT>            res.setEntry(virtualSize, d);<a name="line.270"></a>
+<FONT color="green">271</FONT>            return res;<a name="line.271"></a>
+<FONT color="green">272</FONT>        }<a name="line.272"></a>
+<FONT color="green">273</FONT>    <a name="line.273"></a>
+<FONT color="green">274</FONT>        /** {@inheritDoc} */<a name="line.274"></a>
+<FONT color="green">275</FONT>        public OpenMapRealVector append(double[] a) {<a name="line.275"></a>
+<FONT color="green">276</FONT>            OpenMapRealVector res = new OpenMapRealVector(this, a.length);<a name="line.276"></a>
+<FONT color="green">277</FONT>            for (int i = 0; i &lt; a.length; i++) {<a name="line.277"></a>
+<FONT color="green">278</FONT>                res.setEntry(i + virtualSize, a[i]);<a name="line.278"></a>
+<FONT color="green">279</FONT>            }<a name="line.279"></a>
+<FONT color="green">280</FONT>            return res;<a name="line.280"></a>
+<FONT color="green">281</FONT>        }<a name="line.281"></a>
+<FONT color="green">282</FONT>    <a name="line.282"></a>
+<FONT color="green">283</FONT>        /**<a name="line.283"></a>
+<FONT color="green">284</FONT>         * {@inheritDoc}<a name="line.284"></a>
+<FONT color="green">285</FONT>         * @since 2.1<a name="line.285"></a>
+<FONT color="green">286</FONT>         */<a name="line.286"></a>
+<FONT color="green">287</FONT>        @Override<a name="line.287"></a>
+<FONT color="green">288</FONT>        public OpenMapRealVector copy() {<a name="line.288"></a>
+<FONT color="green">289</FONT>            return new OpenMapRealVector(this);<a name="line.289"></a>
+<FONT color="green">290</FONT>        }<a name="line.290"></a>
+<FONT color="green">291</FONT>    <a name="line.291"></a>
+<FONT color="green">292</FONT>        /**<a name="line.292"></a>
+<FONT color="green">293</FONT>         * Optimized method to compute the dot product with an OpenMapRealVector.<a name="line.293"></a>
+<FONT color="green">294</FONT>         * Iterates over the smaller of the two.<a name="line.294"></a>
+<FONT color="green">295</FONT>         * @param v The vector to compute the dot product with<a name="line.295"></a>
+<FONT color="green">296</FONT>         * @return The dot product of &lt;code&gt;this&lt;/code&gt; and &lt;code&gt;v&lt;/code&gt;<a name="line.296"></a>
+<FONT color="green">297</FONT>         * @throws IllegalArgumentException If the dimensions don't match<a name="line.297"></a>
+<FONT color="green">298</FONT>         */<a name="line.298"></a>
+<FONT color="green">299</FONT>        public double dotProduct(OpenMapRealVector v) throws IllegalArgumentException {<a name="line.299"></a>
+<FONT color="green">300</FONT>            checkVectorDimensions(v.getDimension());<a name="line.300"></a>
+<FONT color="green">301</FONT>            boolean thisIsSmaller  = entries.size() &lt; v.entries.size();<a name="line.301"></a>
+<FONT color="green">302</FONT>            Iterator iter = thisIsSmaller  ? entries.iterator() : v.entries.iterator();<a name="line.302"></a>
+<FONT color="green">303</FONT>            OpenIntToDoubleHashMap larger = thisIsSmaller  ? v.entries : entries;<a name="line.303"></a>
+<FONT color="green">304</FONT>            double d = 0;<a name="line.304"></a>
+<FONT color="green">305</FONT>            while(iter.hasNext()) {<a name="line.305"></a>
+<FONT color="green">306</FONT>                iter.advance();<a name="line.306"></a>
+<FONT color="green">307</FONT>                d += iter.value() * larger.get(iter.key());<a name="line.307"></a>
+<FONT color="green">308</FONT>            }<a name="line.308"></a>
+<FONT color="green">309</FONT>            return d;<a name="line.309"></a>
+<FONT color="green">310</FONT>        }<a name="line.310"></a>
+<FONT color="green">311</FONT>    <a name="line.311"></a>
+<FONT color="green">312</FONT>        /** {@inheritDoc} */<a name="line.312"></a>
+<FONT color="green">313</FONT>        @Override<a name="line.313"></a>
+<FONT color="green">314</FONT>        public double dotProduct(RealVector v) throws IllegalArgumentException {<a name="line.314"></a>
+<FONT color="green">315</FONT>            if(v instanceof OpenMapRealVector) {<a name="line.315"></a>
+<FONT color="green">316</FONT>                return dotProduct((OpenMapRealVector)v);<a name="line.316"></a>
+<FONT color="green">317</FONT>            } else {<a name="line.317"></a>
+<FONT color="green">318</FONT>                return super.dotProduct(v);<a name="line.318"></a>
+<FONT color="green">319</FONT>            }<a name="line.319"></a>
+<FONT color="green">320</FONT>        }<a name="line.320"></a>
+<FONT color="green">321</FONT>    <a name="line.321"></a>
+<FONT color="green">322</FONT>        /** {@inheritDoc} */<a name="line.322"></a>
+<FONT color="green">323</FONT>        public OpenMapRealVector ebeDivide(RealVector v) throws IllegalArgumentException {<a name="line.323"></a>
+<FONT color="green">324</FONT>            checkVectorDimensions(v.getDimension());<a name="line.324"></a>
+<FONT color="green">325</FONT>            OpenMapRealVector res = new OpenMapRealVector(this);<a name="line.325"></a>
+<FONT color="green">326</FONT>            Iterator iter = res.entries.iterator();<a name="line.326"></a>
+<FONT color="green">327</FONT>            while (iter.hasNext()) {<a name="line.327"></a>
+<FONT color="green">328</FONT>                iter.advance();<a name="line.328"></a>
+<FONT color="green">329</FONT>                res.setEntry(iter.key(), iter.value() / v.getEntry(iter.key()));<a name="line.329"></a>
+<FONT color="green">330</FONT>            }<a name="line.330"></a>
+<FONT color="green">331</FONT>            return res;<a name="line.331"></a>
+<FONT color="green">332</FONT>        }<a name="line.332"></a>
+<FONT color="green">333</FONT>    <a name="line.333"></a>
+<FONT color="green">334</FONT>        /** {@inheritDoc} */<a name="line.334"></a>
+<FONT color="green">335</FONT>        @Override<a name="line.335"></a>
+<FONT color="green">336</FONT>        public OpenMapRealVector ebeDivide(double[] v) throws IllegalArgumentException {<a name="line.336"></a>
+<FONT color="green">337</FONT>            checkVectorDimensions(v.length);<a name="line.337"></a>
+<FONT color="green">338</FONT>            OpenMapRealVector res = new OpenMapRealVector(this);<a name="line.338"></a>
+<FONT color="green">339</FONT>            Iterator iter = res.entries.iterator();<a name="line.339"></a>
+<FONT color="green">340</FONT>            while (iter.hasNext()) {<a name="line.340"></a>
+<FONT color="green">341</FONT>                iter.advance();<a name="line.341"></a>
+<FONT color="green">342</FONT>                res.setEntry(iter.key(), iter.value() / v[iter.key()]);<a name="line.342"></a>
+<FONT color="green">343</FONT>            }<a name="line.343"></a>
+<FONT color="green">344</FONT>            return res;<a name="line.344"></a>
+<FONT color="green">345</FONT>        }<a name="line.345"></a>
+<FONT color="green">346</FONT>    <a name="line.346"></a>
+<FONT color="green">347</FONT>        /** {@inheritDoc} */<a name="line.347"></a>
+<FONT color="green">348</FONT>        public OpenMapRealVector ebeMultiply(RealVector v) throws IllegalArgumentException {<a name="line.348"></a>
+<FONT color="green">349</FONT>            checkVectorDimensions(v.getDimension());<a name="line.349"></a>
+<FONT color="green">350</FONT>            OpenMapRealVector res = new OpenMapRealVector(this);<a name="line.350"></a>
+<FONT color="green">351</FONT>            Iterator iter = res.entries.iterator();<a name="line.351"></a>
+<FONT color="green">352</FONT>            while (iter.hasNext()) {<a name="line.352"></a>
+<FONT color="green">353</FONT>                iter.advance();<a name="line.353"></a>
+<FONT color="green">354</FONT>                res.setEntry(iter.key(), iter.value() * v.getEntry(iter.key()));<a name="line.354"></a>
+<FONT color="green">355</FONT>            }<a name="line.355"></a>
+<FONT color="green">356</FONT>            return res;<a name="line.356"></a>
+<FONT color="green">357</FONT>        }<a name="line.357"></a>
+<FONT color="green">358</FONT>    <a name="line.358"></a>
+<FONT color="green">359</FONT>        /** {@inheritDoc} */<a name="line.359"></a>
+<FONT color="green">360</FONT>        @Override<a name="line.360"></a>
+<FONT color="green">361</FONT>        public OpenMapRealVector ebeMultiply(double[] v) throws IllegalArgumentException {<a name="line.361"></a>
+<FONT color="green">362</FONT>            checkVectorDimensions(v.length);<a name="line.362"></a>
+<FONT color="green">363</FONT>            OpenMapRealVector res = new OpenMapRealVector(this);<a name="line.363"></a>
+<FONT color="green">364</FONT>            Iterator iter = res.entries.iterator();<a name="line.364"></a>
+<FONT color="green">365</FONT>            while (iter.hasNext()) {<a name="line.365"></a>
+<FONT color="green">366</FONT>                iter.advance();<a name="line.366"></a>
+<FONT color="green">367</FONT>                res.setEntry(iter.key(), iter.value() * v[iter.key()]);<a name="line.367"></a>
+<FONT color="green">368</FONT>            }<a name="line.368"></a>
+<FONT color="green">369</FONT>            return res;<a name="line.369"></a>
+<FONT color="green">370</FONT>        }<a name="line.370"></a>
+<FONT color="green">371</FONT>    <a name="line.371"></a>
+<FONT color="green">372</FONT>        /** {@inheritDoc} */<a name="line.372"></a>
+<FONT color="green">373</FONT>        public OpenMapRealVector getSubVector(int index, int n) throws MatrixIndexException {<a name="line.373"></a>
+<FONT color="green">374</FONT>            checkIndex(index);<a name="line.374"></a>
+<FONT color="green">375</FONT>            checkIndex(index + n - 1);<a name="line.375"></a>
+<FONT color="green">376</FONT>            OpenMapRealVector res = new OpenMapRealVector(n);<a name="line.376"></a>
+<FONT color="green">377</FONT>            int end = index + n;<a name="line.377"></a>
+<FONT color="green">378</FONT>            Iterator iter = entries.iterator();<a name="line.378"></a>
+<FONT color="green">379</FONT>            while (iter.hasNext()) {<a name="line.379"></a>
+<FONT color="green">380</FONT>                iter.advance();<a name="line.380"></a>
+<FONT color="green">381</FONT>                int key = iter.key();<a name="line.381"></a>
+<FONT color="green">382</FONT>                if (key &gt;= index &amp;&amp; key &lt; end) {<a name="line.382"></a>
+<FONT color="green">383</FONT>                    res.setEntry(key - index, iter.value());<a name="line.383"></a>
+<FONT color="green">384</FONT>                }<a name="line.384"></a>
+<FONT color="green">385</FONT>            }<a name="line.385"></a>
+<FONT color="green">386</FONT>            return res;<a name="line.386"></a>
+<FONT color="green">387</FONT>        }<a name="line.387"></a>
+<FONT color="green">388</FONT>    <a name="line.388"></a>
+<FONT color="green">389</FONT>        /** {@inheritDoc} */<a name="line.389"></a>
+<FONT color="green">390</FONT>        @Override<a name="line.390"></a>
+<FONT color="green">391</FONT>        public double[] getData() {<a name="line.391"></a>
+<FONT color="green">392</FONT>            double[] res = new double[virtualSize];<a name="line.392"></a>
+<FONT color="green">393</FONT>            Iterator iter = entries.iterator();<a name="line.393"></a>
+<FONT color="green">394</FONT>            while (iter.hasNext()) {<a name="line.394"></a>
+<FONT color="green">395</FONT>                iter.advance();<a name="line.395"></a>
+<FONT color="green">396</FONT>                res[iter.key()] = iter.value();<a name="line.396"></a>
+<FONT color="green">397</FONT>            }<a name="line.397"></a>
+<FONT color="green">398</FONT>            return res;<a name="line.398"></a>
+<FONT color="green">399</FONT>        }<a name="line.399"></a>
+<FONT color="green">400</FONT>    <a name="line.400"></a>
+<FONT color="green">401</FONT>        /** {@inheritDoc} */<a name="line.401"></a>
+<FONT color="green">402</FONT>        public int getDimension() {<a name="line.402"></a>
+<FONT color="green">403</FONT>            return virtualSize;<a name="line.403"></a>
+<FONT color="green">404</FONT>        }<a name="line.404"></a>
+<FONT color="green">405</FONT>    <a name="line.405"></a>
+<FONT color="green">406</FONT>        /**<a name="line.406"></a>
+<FONT color="green">407</FONT>         * Optimized method to compute distance.<a name="line.407"></a>
+<FONT color="green">408</FONT>         * @param v The vector to compute distance to<a name="line.408"></a>
+<FONT color="green">409</FONT>         * @return The distance from &lt;code&gt;this&lt;/code&gt; and &lt;code&gt;v&lt;/code&gt;<a name="line.409"></a>
+<FONT color="green">410</FONT>         * @throws IllegalArgumentException If the dimensions don't match<a name="line.410"></a>
+<FONT color="green">411</FONT>         */<a name="line.411"></a>
+<FONT color="green">412</FONT>        public double getDistance(OpenMapRealVector v) throws IllegalArgumentException {<a name="line.412"></a>
+<FONT color="green">413</FONT>            Iterator iter = entries.iterator();<a name="line.413"></a>
+<FONT color="green">414</FONT>            double res = 0;<a name="line.414"></a>
+<FONT color="green">415</FONT>            while (iter.hasNext()) {<a name="line.415"></a>
+<FONT color="green">416</FONT>                iter.advance();<a name="line.416"></a>
+<FONT color="green">417</FONT>                int key = iter.key();<a name="line.417"></a>
+<FONT color="green">418</FONT>                double delta;<a name="line.418"></a>
+<FONT color="green">419</FONT>                delta = iter.value() - v.getEntry(key);<a name="line.419"></a>
+<FONT color="green">420</FONT>                res += delta * delta;<a name="line.420"></a>
+<FONT color="green">421</FONT>            }<a name="line.421"></a>
+<FONT color="green">422</FONT>            iter = v.getEntries().iterator();<a name="line.422"></a>
+<FONT color="green">423</FONT>            while (iter.hasNext()) {<a name="line.423"></a>
+<FONT color="green">424</FONT>                iter.advance();<a name="line.424"></a>
+<FONT color="green">425</FONT>                int key = iter.key();<a name="line.425"></a>
+<FONT color="green">426</FONT>                if (!entries.containsKey(key)) {<a name="line.426"></a>
+<FONT color="green">427</FONT>                    final double value = iter.value();<a name="line.427"></a>
+<FONT color="green">428</FONT>                    res += value * value;<a name="line.428"></a>
+<FONT color="green">429</FONT>                }<a name="line.429"></a>
+<FONT color="green">430</FONT>            }<a name="line.430"></a>
+<FONT color="green">431</FONT>            return Math.sqrt(res);<a name="line.431"></a>
+<FONT color="green">432</FONT>        }<a name="line.432"></a>
+<FONT color="green">433</FONT>    <a name="line.433"></a>
+<FONT color="green">434</FONT>        /** {@inheritDoc} */<a name="line.434"></a>
+<FONT color="green">435</FONT>        @Override<a name="line.435"></a>
+<FONT color="green">436</FONT>        public double getDistance(RealVector v) throws IllegalArgumentException {<a name="line.436"></a>
+<FONT color="green">437</FONT>            checkVectorDimensions(v.getDimension());<a name="line.437"></a>
+<FONT color="green">438</FONT>            if (v instanceof OpenMapRealVector) {<a name="line.438"></a>
+<FONT color="green">439</FONT>                return getDistance((OpenMapRealVector) v);<a name="line.439"></a>
+<FONT color="green">440</FONT>            }<a name="line.440"></a>
+<FONT color="green">441</FONT>            return getDistance(v.getData());<a name="line.441"></a>
+<FONT color="green">442</FONT>        }<a name="line.442"></a>
+<FONT color="green">443</FONT>    <a name="line.443"></a>
+<FONT color="green">444</FONT>        /** {@inheritDoc} */<a name="line.444"></a>
+<FONT color="green">445</FONT>        @Override<a name="line.445"></a>
+<FONT color="green">446</FONT>        public double getDistance(double[] v) throws IllegalArgumentException {<a name="line.446"></a>
+<FONT color="green">447</FONT>            checkVectorDimensions(v.length);<a name="line.447"></a>
+<FONT color="green">448</FONT>            double res = 0;<a name="line.448"></a>
+<FONT color="green">449</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.449"></a>
+<FONT color="green">450</FONT>                double delta = entries.get(i) - v[i];<a name="line.450"></a>
+<FONT color="green">451</FONT>                res += delta * delta;<a name="line.451"></a>
+<FONT color="green">452</FONT>            }<a name="line.452"></a>
+<FONT color="green">453</FONT>            return Math.sqrt(res);<a name="line.453"></a>
+<FONT color="green">454</FONT>        }<a name="line.454"></a>
+<FONT color="green">455</FONT>    <a name="line.455"></a>
+<FONT color="green">456</FONT>        /** {@inheritDoc} */<a name="line.456"></a>
+<FONT color="green">457</FONT>        public double getEntry(int index) throws MatrixIndexException {<a name="line.457"></a>
+<FONT color="green">458</FONT>            checkIndex(index);<a name="line.458"></a>
+<FONT color="green">459</FONT>            return entries.get(index);<a name="line.459"></a>
+<FONT color="green">460</FONT>        }<a name="line.460"></a>
+<FONT color="green">461</FONT>    <a name="line.461"></a>
+<FONT color="green">462</FONT>        /**<a name="line.462"></a>
+<FONT color="green">463</FONT>         * Distance between two vectors.<a name="line.463"></a>
+<FONT color="green">464</FONT>         * &lt;p&gt;This method computes the distance consistent with<a name="line.464"></a>
+<FONT color="green">465</FONT>         * L&lt;sub&gt;1&lt;/sub&gt; norm, i.e. the sum of the absolute values of<a name="line.465"></a>
+<FONT color="green">466</FONT>         * elements differences.&lt;/p&gt;<a name="line.466"></a>
+<FONT color="green">467</FONT>         * @param v vector to which distance is requested<a name="line.467"></a>
+<FONT color="green">468</FONT>         * @return distance between two vectors.<a name="line.468"></a>
+<FONT color="green">469</FONT>         */<a name="line.469"></a>
+<FONT color="green">470</FONT>        public double getL1Distance(OpenMapRealVector v) {<a name="line.470"></a>
+<FONT color="green">471</FONT>            double max = 0;<a name="line.471"></a>
+<FONT color="green">472</FONT>            Iterator iter = entries.iterator();<a name="line.472"></a>
+<FONT color="green">473</FONT>            while (iter.hasNext()) {<a name="line.473"></a>
+<FONT color="green">474</FONT>                iter.advance();<a name="line.474"></a>
+<FONT color="green">475</FONT>                double delta = Math.abs(iter.value() - v.getEntry(iter.key()));<a name="line.475"></a>
+<FONT color="green">476</FONT>                max += delta;<a name="line.476"></a>
+<FONT color="green">477</FONT>            }<a name="line.477"></a>
+<FONT color="green">478</FONT>            iter = v.getEntries().iterator();<a name="line.478"></a>
+<FONT color="green">479</FONT>            while (iter.hasNext()) {<a name="line.479"></a>
+<FONT color="green">480</FONT>                iter.advance();<a name="line.480"></a>
+<FONT color="green">481</FONT>                int key = iter.key();<a name="line.481"></a>
+<FONT color="green">482</FONT>                if (!entries.containsKey(key)) {<a name="line.482"></a>
+<FONT color="green">483</FONT>                    double delta = Math.abs(iter.value());<a name="line.483"></a>
+<FONT color="green">484</FONT>                    max +=  Math.abs(delta);<a name="line.484"></a>
+<FONT color="green">485</FONT>                }<a name="line.485"></a>
+<FONT color="green">486</FONT>            }<a name="line.486"></a>
+<FONT color="green">487</FONT>            return max;<a name="line.487"></a>
+<FONT color="green">488</FONT>        }<a name="line.488"></a>
+<FONT color="green">489</FONT>    <a name="line.489"></a>
+<FONT color="green">490</FONT>        /** {@inheritDoc} */<a name="line.490"></a>
+<FONT color="green">491</FONT>        @Override<a name="line.491"></a>
+<FONT color="green">492</FONT>        public double getL1Distance(RealVector v) throws IllegalArgumentException {<a name="line.492"></a>
+<FONT color="green">493</FONT>            checkVectorDimensions(v.getDimension());<a name="line.493"></a>
+<FONT color="green">494</FONT>            if (v instanceof OpenMapRealVector) {<a name="line.494"></a>
+<FONT color="green">495</FONT>                return getL1Distance((OpenMapRealVector) v);<a name="line.495"></a>
+<FONT color="green">496</FONT>            }<a name="line.496"></a>
+<FONT color="green">497</FONT>            return getL1Distance(v.getData());<a name="line.497"></a>
+<FONT color="green">498</FONT>        }<a name="line.498"></a>
+<FONT color="green">499</FONT>    <a name="line.499"></a>
+<FONT color="green">500</FONT>        /** {@inheritDoc} */<a name="line.500"></a>
+<FONT color="green">501</FONT>        @Override<a name="line.501"></a>
+<FONT color="green">502</FONT>        public double getL1Distance(double[] v) throws IllegalArgumentException {<a name="line.502"></a>
+<FONT color="green">503</FONT>            checkVectorDimensions(v.length);<a name="line.503"></a>
+<FONT color="green">504</FONT>            double max = 0;<a name="line.504"></a>
+<FONT color="green">505</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.505"></a>
+<FONT color="green">506</FONT>                double delta = Math.abs(getEntry(i) - v[i]);<a name="line.506"></a>
+<FONT color="green">507</FONT>                max += delta;<a name="line.507"></a>
+<FONT color="green">508</FONT>            }<a name="line.508"></a>
+<FONT color="green">509</FONT>            return max;<a name="line.509"></a>
+<FONT color="green">510</FONT>        }<a name="line.510"></a>
+<FONT color="green">511</FONT>    <a name="line.511"></a>
+<FONT color="green">512</FONT>        /**<a name="line.512"></a>
+<FONT color="green">513</FONT>         * Optimized method to compute LInfDistance.<a name="line.513"></a>
+<FONT color="green">514</FONT>         * @param v The vector to compute from<a name="line.514"></a>
+<FONT color="green">515</FONT>         * @return the LInfDistance<a name="line.515"></a>
+<FONT color="green">516</FONT>         */<a name="line.516"></a>
+<FONT color="green">517</FONT>        private double getLInfDistance(OpenMapRealVector v) {<a name="line.517"></a>
+<FONT color="green">518</FONT>            double max = 0;<a name="line.518"></a>
+<FONT color="green">519</FONT>            Iterator iter = entries.iterator();<a name="line.519"></a>
+<FONT color="green">520</FONT>            while (iter.hasNext()) {<a name="line.520"></a>
+<FONT color="green">521</FONT>                iter.advance();<a name="line.521"></a>
+<FONT color="green">522</FONT>                double delta = Math.abs(iter.value() - v.getEntry(iter.key()));<a name="line.522"></a>
+<FONT color="green">523</FONT>                if (delta &gt; max) {<a name="line.523"></a>
+<FONT color="green">524</FONT>                    max = delta;<a name="line.524"></a>
+<FONT color="green">525</FONT>                }<a name="line.525"></a>
+<FONT color="green">526</FONT>            }<a name="line.526"></a>
+<FONT color="green">527</FONT>            iter = v.getEntries().iterator();<a name="line.527"></a>
+<FONT color="green">528</FONT>            while (iter.hasNext()) {<a name="line.528"></a>
+<FONT color="green">529</FONT>                iter.advance();<a name="line.529"></a>
+<FONT color="green">530</FONT>                int key = iter.key();<a name="line.530"></a>
+<FONT color="green">531</FONT>                if (!entries.containsKey(key)) {<a name="line.531"></a>
+<FONT color="green">532</FONT>                    if (iter.value() &gt; max) {<a name="line.532"></a>
+<FONT color="green">533</FONT>                        max = iter.value();<a name="line.533"></a>
+<FONT color="green">534</FONT>                    }<a name="line.534"></a>
+<FONT color="green">535</FONT>                }<a name="line.535"></a>
+<FONT color="green">536</FONT>            }<a name="line.536"></a>
+<FONT color="green">537</FONT>            return max;<a name="line.537"></a>
+<FONT color="green">538</FONT>        }<a name="line.538"></a>
+<FONT color="green">539</FONT>    <a name="line.539"></a>
+<FONT color="green">540</FONT>        /** {@inheritDoc} */<a name="line.540"></a>
+<FONT color="green">541</FONT>        @Override<a name="line.541"></a>
+<FONT color="green">542</FONT>        public double getLInfDistance(RealVector v) throws IllegalArgumentException {<a name="line.542"></a>
+<FONT color="green">543</FONT>            checkVectorDimensions(v.getDimension());<a name="line.543"></a>
+<FONT color="green">544</FONT>            if (v instanceof OpenMapRealVector) {<a name="line.544"></a>
+<FONT color="green">545</FONT>                return getLInfDistance((OpenMapRealVector) v);<a name="line.545"></a>
+<FONT color="green">546</FONT>            }<a name="line.546"></a>
+<FONT color="green">547</FONT>            return getLInfDistance(v.getData());<a name="line.547"></a>
+<FONT color="green">548</FONT>        }<a name="line.548"></a>
+<FONT color="green">549</FONT>    <a name="line.549"></a>
+<FONT color="green">550</FONT>        /** {@inheritDoc} */<a name="line.550"></a>
+<FONT color="green">551</FONT>        @Override<a name="line.551"></a>
+<FONT color="green">552</FONT>        public double getLInfDistance(double[] v) throws IllegalArgumentException {<a name="line.552"></a>
+<FONT color="green">553</FONT>            checkVectorDimensions(v.length);<a name="line.553"></a>
+<FONT color="green">554</FONT>            double max = 0;<a name="line.554"></a>
+<FONT color="green">555</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.555"></a>
+<FONT color="green">556</FONT>                double delta = Math.abs(getEntry(i) - v[i]);<a name="line.556"></a>
+<FONT color="green">557</FONT>                if (delta &gt; max) {<a name="line.557"></a>
+<FONT color="green">558</FONT>                    max = delta;<a name="line.558"></a>
+<FONT color="green">559</FONT>                }<a name="line.559"></a>
+<FONT color="green">560</FONT>            }<a name="line.560"></a>
+<FONT color="green">561</FONT>            return max;<a name="line.561"></a>
+<FONT color="green">562</FONT>        }<a name="line.562"></a>
+<FONT color="green">563</FONT>    <a name="line.563"></a>
+<FONT color="green">564</FONT>        /** {@inheritDoc} */<a name="line.564"></a>
+<FONT color="green">565</FONT>        public boolean isInfinite() {<a name="line.565"></a>
+<FONT color="green">566</FONT>            boolean infiniteFound = false;<a name="line.566"></a>
+<FONT color="green">567</FONT>            Iterator iter = entries.iterator();<a name="line.567"></a>
+<FONT color="green">568</FONT>            while (iter.hasNext()) {<a name="line.568"></a>
+<FONT color="green">569</FONT>                iter.advance();<a name="line.569"></a>
+<FONT color="green">570</FONT>                final double value = iter.value();<a name="line.570"></a>
+<FONT color="green">571</FONT>                if (Double.isNaN(value)) {<a name="line.571"></a>
+<FONT color="green">572</FONT>                    return false;<a name="line.572"></a>
+<FONT color="green">573</FONT>                }<a name="line.573"></a>
+<FONT color="green">574</FONT>                if (Double.isInfinite(value)) {<a name="line.574"></a>
+<FONT color="green">575</FONT>                    infiniteFound = true;<a name="line.575"></a>
+<FONT color="green">576</FONT>                }<a name="line.576"></a>
+<FONT color="green">577</FONT>            }<a name="line.577"></a>
+<FONT color="green">578</FONT>            return infiniteFound;<a name="line.578"></a>
+<FONT color="green">579</FONT>        }<a name="line.579"></a>
+<FONT color="green">580</FONT>    <a name="line.580"></a>
+<FONT color="green">581</FONT>        /** {@inheritDoc} */<a name="line.581"></a>
+<FONT color="green">582</FONT>        public boolean isNaN() {<a name="line.582"></a>
+<FONT color="green">583</FONT>            Iterator iter = entries.iterator();<a name="line.583"></a>
+<FONT color="green">584</FONT>            while (iter.hasNext()) {<a name="line.584"></a>
+<FONT color="green">585</FONT>                iter.advance();<a name="line.585"></a>
+<FONT color="green">586</FONT>                if (Double.isNaN(iter.value())) {<a name="line.586"></a>
+<FONT color="green">587</FONT>                    return true;<a name="line.587"></a>
+<FONT color="green">588</FONT>                }<a name="line.588"></a>
+<FONT color="green">589</FONT>            }<a name="line.589"></a>
+<FONT color="green">590</FONT>            return false;<a name="line.590"></a>
+<FONT color="green">591</FONT>        }<a name="line.591"></a>
+<FONT color="green">592</FONT>    <a name="line.592"></a>
+<FONT color="green">593</FONT>        /** {@inheritDoc} */<a name="line.593"></a>
+<FONT color="green">594</FONT>        @Override<a name="line.594"></a>
+<FONT color="green">595</FONT>        public OpenMapRealVector mapAdd(double d) {<a name="line.595"></a>
+<FONT color="green">596</FONT>            return copy().mapAddToSelf(d);<a name="line.596"></a>
+<FONT color="green">597</FONT>        }<a name="line.597"></a>
+<FONT color="green">598</FONT>    <a name="line.598"></a>
+<FONT color="green">599</FONT>        /** {@inheritDoc} */<a name="line.599"></a>
+<FONT color="green">600</FONT>        @Override<a name="line.600"></a>
+<FONT color="green">601</FONT>        public OpenMapRealVector mapAddToSelf(double d) {<a name="line.601"></a>
+<FONT color="green">602</FONT>            for (int i = 0; i &lt; virtualSize; i++) {<a name="line.602"></a>
+<FONT color="green">603</FONT>                setEntry(i, getEntry(i) + d);<a name="line.603"></a>
+<FONT color="green">604</FONT>            }<a name="line.604"></a>
+<FONT color="green">605</FONT>            return this;<a name="line.605"></a>
+<FONT color="green">606</FONT>        }<a name="line.606"></a>
+<FONT color="green">607</FONT>    <a name="line.607"></a>
+<FONT color="green">608</FONT>         /** {@inheritDoc} */<a name="line.608"></a>
+<FONT color="green">609</FONT>        @Override<a name="line.609"></a>
+<FONT color="green">610</FONT>        public RealMatrix outerProduct(double[] v) throws IllegalArgumentException {<a name="line.610"></a>
+<FONT color="green">611</FONT>            checkVectorDimensions(v.length);<a name="line.611"></a>
+<FONT color="green">612</FONT>            RealMatrix res = new OpenMapRealMatrix(virtualSize, virtualSize);<a name="line.612"></a>
+<FONT color="green">613</FONT>            Iterator iter = entries.iterator();<a name="line.613"></a>
+<FONT color="green">614</FONT>            while (iter.hasNext()) {<a name="line.614"></a>
+<FONT color="green">615</FONT>                iter.advance();<a name="line.615"></a>
+<FONT color="green">616</FONT>                int row = iter.key();<a name="line.616"></a>
+<FONT color="green">617</FONT>                double value = iter.value();<a name="line.617"></a>
+<FONT color="green">618</FONT>                for (int col = 0; col &lt; virtualSize; col++) {<a name="line.618"></a>
+<FONT color="green">619</FONT>                    res.setEntry(row, col, value * v[col]);<a name="line.619"></a>
+<FONT color="green">620</FONT>                }<a name="line.620"></a>
+<FONT color="green">621</FONT>            }<a name="line.621"></a>
+<FONT color="green">622</FONT>            return res;<a name="line.622"></a>
+<FONT color="green">623</FONT>        }<a name="line.623"></a>
+<FONT color="green">624</FONT>    <a name="line.624"></a>
+<FONT color="green">625</FONT>        /** {@inheritDoc} */<a name="line.625"></a>
+<FONT color="green">626</FONT>        public RealVector projection(RealVector v) throws IllegalArgumentException {<a name="line.626"></a>
+<FONT color="green">627</FONT>            checkVectorDimensions(v.getDimension());<a name="line.627"></a>
+<FONT color="green">628</FONT>            return v.mapMultiply(dotProduct(v) / v.dotProduct(v));<a name="line.628"></a>
+<FONT color="green">629</FONT>        }<a name="line.629"></a>
+<FONT color="green">630</FONT>    <a name="line.630"></a>
+<FONT color="green">631</FONT>        /** {@inheritDoc} */<a name="line.631"></a>
+<FONT color="green">632</FONT>        @Override<a name="line.632"></a>
+<FONT color="green">633</FONT>        public OpenMapRealVector projection(double[] v) throws IllegalArgumentException {<a name="line.633"></a>
+<FONT color="green">634</FONT>            checkVectorDimensions(v.length);<a name="line.634"></a>
+<FONT color="green">635</FONT>            return (OpenMapRealVector) projection(new OpenMapRealVector(v));<a name="line.635"></a>
+<FONT color="green">636</FONT>        }<a name="line.636"></a>
+<FONT color="green">637</FONT>    <a name="line.637"></a>
+<FONT color="green">638</FONT>        /** {@inheritDoc} */<a name="line.638"></a>
+<FONT color="green">639</FONT>        public void setEntry(int index, double value) throws MatrixIndexException {<a name="line.639"></a>
+<FONT color="green">640</FONT>            checkIndex(index);<a name="line.640"></a>
+<FONT color="green">641</FONT>            if (!isDefaultValue(value)) {<a name="line.641"></a>
+<FONT color="green">642</FONT>                entries.put(index, value);<a name="line.642"></a>
+<FONT color="green">643</FONT>            } else if (entries.containsKey(index)) {<a name="line.643"></a>
+<FONT color="green">644</FONT>                entries.remove(index);<a name="line.644"></a>
+<FONT color="green">645</FONT>            }<a name="line.645"></a>
+<FONT color="green">646</FONT>        }<a name="line.646"></a>
+<FONT color="green">647</FONT>    <a name="line.647"></a>
+<FONT color="green">648</FONT>        /** {@inheritDoc} */<a name="line.648"></a>
+<FONT color="green">649</FONT>        @Override<a name="line.649"></a>
+<FONT color="green">650</FONT>        public void setSubVector(int index, RealVector v) throws MatrixIndexException {<a name="line.650"></a>
+<FONT color="green">651</FONT>            checkIndex(index);<a name="line.651"></a>
+<FONT color="green">652</FONT>            checkIndex(index + v.getDimension() - 1);<a name="line.652"></a>
+<FONT color="green">653</FONT>            setSubVector(index, v.getData());<a name="line.653"></a>
+<FONT color="green">654</FONT>        }<a name="line.654"></a>
+<FONT color="green">655</FONT>    <a name="line.655"></a>
+<FONT color="green">656</FONT>        /** {@inheritDoc} */<a name="line.656"></a>
+<FONT color="green">657</FONT>        @Override<a name="line.657"></a>
+<FONT color="green">658</FONT>        public void setSubVector(int index, double[] v) throws MatrixIndexException {<a name="line.658"></a>
+<FONT color="green">659</FONT>            checkIndex(index);<a name="line.659"></a>
+<FONT color="green">660</FONT>            checkIndex(index + v.length - 1);<a name="line.660"></a>
+<FONT color="green">661</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.661"></a>
+<FONT color="green">662</FONT>                setEntry(i + index, v[i]);<a name="line.662"></a>
+<FONT color="green">663</FONT>            }<a name="line.663"></a>
+<FONT color="green">664</FONT>        }<a name="line.664"></a>
+<FONT color="green">665</FONT>    <a name="line.665"></a>
+<FONT color="green">666</FONT>        /** {@inheritDoc} */<a name="line.666"></a>
+<FONT color="green">667</FONT>        @Override<a name="line.667"></a>
+<FONT color="green">668</FONT>        public void set(double value) {<a name="line.668"></a>
+<FONT color="green">669</FONT>            for (int i = 0; i &lt; virtualSize; i++) {<a name="line.669"></a>
+<FONT color="green">670</FONT>                setEntry(i, value);<a name="line.670"></a>
+<FONT color="green">671</FONT>            }<a name="line.671"></a>
+<FONT color="green">672</FONT>        }<a name="line.672"></a>
+<FONT color="green">673</FONT>    <a name="line.673"></a>
+<FONT color="green">674</FONT>        /**<a name="line.674"></a>
+<FONT color="green">675</FONT>         * Optimized method to subtract OpenMapRealVectors.<a name="line.675"></a>
+<FONT color="green">676</FONT>         * @param v The vector to subtract from &lt;code&gt;this&lt;/code&gt;<a name="line.676"></a>
+<FONT color="green">677</FONT>         * @return The difference of &lt;code&gt;this&lt;/code&gt; and &lt;code&gt;v&lt;/code&gt;<a name="line.677"></a>
+<FONT color="green">678</FONT>         * @throws IllegalArgumentException If the dimensions don't match<a name="line.678"></a>
+<FONT color="green">679</FONT>         */<a name="line.679"></a>
+<FONT color="green">680</FONT>        public OpenMapRealVector subtract(OpenMapRealVector v) throws IllegalArgumentException{<a name="line.680"></a>
+<FONT color="green">681</FONT>            checkVectorDimensions(v.getDimension());<a name="line.681"></a>
+<FONT color="green">682</FONT>            OpenMapRealVector res = copy();<a name="line.682"></a>
+<FONT color="green">683</FONT>            Iterator iter = v.getEntries().iterator();<a name="line.683"></a>
+<FONT color="green">684</FONT>            while (iter.hasNext()) {<a name="line.684"></a>
+<FONT color="green">685</FONT>                iter.advance();<a name="line.685"></a>
+<FONT color="green">686</FONT>                int key = iter.key();<a name="line.686"></a>
+<FONT color="green">687</FONT>                if (entries.containsKey(key)) {<a name="line.687"></a>
+<FONT color="green">688</FONT>                    res.setEntry(key, entries.get(key) - iter.value());<a name="line.688"></a>
+<FONT color="green">689</FONT>                } else {<a name="line.689"></a>
+<FONT color="green">690</FONT>                    res.setEntry(key, -iter.value());<a name="line.690"></a>
+<FONT color="green">691</FONT>                }<a name="line.691"></a>
+<FONT color="green">692</FONT>            }<a name="line.692"></a>
+<FONT color="green">693</FONT>            return res;<a name="line.693"></a>
+<FONT color="green">694</FONT>        }<a name="line.694"></a>
+<FONT color="green">695</FONT>    <a name="line.695"></a>
+<FONT color="green">696</FONT>        /** {@inheritDoc} */<a name="line.696"></a>
+<FONT color="green">697</FONT>        @Override<a name="line.697"></a>
+<FONT color="green">698</FONT>        public OpenMapRealVector subtract(RealVector v) throws IllegalArgumentException {<a name="line.698"></a>
+<FONT color="green">699</FONT>            checkVectorDimensions(v.getDimension());<a name="line.699"></a>
+<FONT color="green">700</FONT>            if (v instanceof OpenMapRealVector) {<a name="line.700"></a>
+<FONT color="green">701</FONT>                return subtract((OpenMapRealVector) v);<a name="line.701"></a>
+<FONT color="green">702</FONT>            }<a name="line.702"></a>
+<FONT color="green">703</FONT>            return subtract(v.getData());<a name="line.703"></a>
+<FONT color="green">704</FONT>        }<a name="line.704"></a>
+<FONT color="green">705</FONT>    <a name="line.705"></a>
+<FONT color="green">706</FONT>        /** {@inheritDoc} */<a name="line.706"></a>
+<FONT color="green">707</FONT>        @Override<a name="line.707"></a>
+<FONT color="green">708</FONT>        public OpenMapRealVector subtract(double[] v) throws IllegalArgumentException {<a name="line.708"></a>
+<FONT color="green">709</FONT>            checkVectorDimensions(v.length);<a name="line.709"></a>
+<FONT color="green">710</FONT>            OpenMapRealVector res = new OpenMapRealVector(this);<a name="line.710"></a>
+<FONT color="green">711</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.711"></a>
+<FONT color="green">712</FONT>                if (entries.containsKey(i)) {<a name="line.712"></a>
+<FONT color="green">713</FONT>                    res.setEntry(i, entries.get(i) - v[i]);<a name="line.713"></a>
+<FONT color="green">714</FONT>                } else {<a name="line.714"></a>
+<FONT color="green">715</FONT>                    res.setEntry(i, -v[i]);<a name="line.715"></a>
+<FONT color="green">716</FONT>                }<a name="line.716"></a>
+<FONT color="green">717</FONT>            }<a name="line.717"></a>
+<FONT color="green">718</FONT>            return res;<a name="line.718"></a>
+<FONT color="green">719</FONT>        }<a name="line.719"></a>
+<FONT color="green">720</FONT>    <a name="line.720"></a>
+<FONT color="green">721</FONT>    <a name="line.721"></a>
+<FONT color="green">722</FONT>        /** {@inheritDoc} */<a name="line.722"></a>
+<FONT color="green">723</FONT>        @Override<a name="line.723"></a>
+<FONT color="green">724</FONT>        public OpenMapRealVector unitVector() {<a name="line.724"></a>
+<FONT color="green">725</FONT>            OpenMapRealVector res = copy();<a name="line.725"></a>
+<FONT color="green">726</FONT>            res.unitize();<a name="line.726"></a>
+<FONT color="green">727</FONT>            return res;<a name="line.727"></a>
+<FONT color="green">728</FONT>        }<a name="line.728"></a>
+<FONT color="green">729</FONT>    <a name="line.729"></a>
+<FONT color="green">730</FONT>        /** {@inheritDoc} */<a name="line.730"></a>
+<FONT color="green">731</FONT>        @Override<a name="line.731"></a>
+<FONT color="green">732</FONT>        public void unitize() {<a name="line.732"></a>
+<FONT color="green">733</FONT>            double norm = getNorm();<a name="line.733"></a>
+<FONT color="green">734</FONT>            if (isDefaultValue(norm)) {<a name="line.734"></a>
+<FONT color="green">735</FONT>                throw  MathRuntimeException.createArithmeticException("cannot normalize a zero norm vector");<a name="line.735"></a>
+<FONT color="green">736</FONT>            }<a name="line.736"></a>
+<FONT color="green">737</FONT>            Iterator iter = entries.iterator();<a name="line.737"></a>
+<FONT color="green">738</FONT>            while (iter.hasNext()) {<a name="line.738"></a>
+<FONT color="green">739</FONT>                iter.advance();<a name="line.739"></a>
+<FONT color="green">740</FONT>                entries.put(iter.key(), iter.value() / norm);<a name="line.740"></a>
+<FONT color="green">741</FONT>            }<a name="line.741"></a>
+<FONT color="green">742</FONT>    <a name="line.742"></a>
+<FONT color="green">743</FONT>        }<a name="line.743"></a>
+<FONT color="green">744</FONT>    <a name="line.744"></a>
+<FONT color="green">745</FONT>    <a name="line.745"></a>
+<FONT color="green">746</FONT>        /** {@inheritDoc} */<a name="line.746"></a>
+<FONT color="green">747</FONT>        @Override<a name="line.747"></a>
+<FONT color="green">748</FONT>        public double[] toArray() {<a name="line.748"></a>
+<FONT color="green">749</FONT>            return getData();<a name="line.749"></a>
+<FONT color="green">750</FONT>        }<a name="line.750"></a>
+<FONT color="green">751</FONT>    <a name="line.751"></a>
+<FONT color="green">752</FONT>        /** {@inheritDoc}<a name="line.752"></a>
+<FONT color="green">753</FONT>         * &lt;p&gt; Implementation Note: This works on exact values, and as a result<a name="line.753"></a>
+<FONT color="green">754</FONT>         * it is possible for {@code a.subtract(b)} to be the zero vector, while<a name="line.754"></a>
+<FONT color="green">755</FONT>         * {@code a.hashCode() != b.hashCode()}.&lt;/p&gt;<a name="line.755"></a>
+<FONT color="green">756</FONT>         */<a name="line.756"></a>
+<FONT color="green">757</FONT>        @Override<a name="line.757"></a>
+<FONT color="green">758</FONT>        public int hashCode() {<a name="line.758"></a>
+<FONT color="green">759</FONT>            final int prime = 31;<a name="line.759"></a>
+<FONT color="green">760</FONT>            int result = 1;<a name="line.760"></a>
+<FONT color="green">761</FONT>            long temp;<a name="line.761"></a>
+<FONT color="green">762</FONT>            temp = Double.doubleToLongBits(epsilon);<a name="line.762"></a>
+<FONT color="green">763</FONT>            result = prime * result + (int) (temp ^ (temp &gt;&gt;&gt; 32));<a name="line.763"></a>
+<FONT color="green">764</FONT>            result = prime * result + virtualSize;<a name="line.764"></a>
+<FONT color="green">765</FONT>            Iterator iter = entries.iterator();<a name="line.765"></a>
+<FONT color="green">766</FONT>            while (iter.hasNext()) {<a name="line.766"></a>
+<FONT color="green">767</FONT>                iter.advance();<a name="line.767"></a>
+<FONT color="green">768</FONT>                temp = Double.doubleToLongBits(iter.value());<a name="line.768"></a>
+<FONT color="green">769</FONT>                result = prime * result + (int) (temp ^ (temp &gt;&gt;32));<a name="line.769"></a>
+<FONT color="green">770</FONT>            }<a name="line.770"></a>
+<FONT color="green">771</FONT>            return result;<a name="line.771"></a>
+<FONT color="green">772</FONT>        }<a name="line.772"></a>
+<FONT color="green">773</FONT>    <a name="line.773"></a>
+<FONT color="green">774</FONT>        /**<a name="line.774"></a>
+<FONT color="green">775</FONT>         * &lt;p&gt; Implementation Note: This performs an exact comparison, and as a result<a name="line.775"></a>
+<FONT color="green">776</FONT>         * it is possible for {@code a.subtract(b}} to be the zero vector, while<a name="line.776"></a>
+<FONT color="green">777</FONT>         * {@code  a.equals(b) == false}.&lt;/p&gt;<a name="line.777"></a>
+<FONT color="green">778</FONT>         * {@inheritDoc}<a name="line.778"></a>
+<FONT color="green">779</FONT>         */<a name="line.779"></a>
+<FONT color="green">780</FONT>        @Override<a name="line.780"></a>
+<FONT color="green">781</FONT>        public boolean equals(Object obj) {<a name="line.781"></a>
+<FONT color="green">782</FONT>            if (this == obj) {<a name="line.782"></a>
+<FONT color="green">783</FONT>                return true;<a name="line.783"></a>
+<FONT color="green">784</FONT>            }<a name="line.784"></a>
+<FONT color="green">785</FONT>            if (!(obj instanceof OpenMapRealVector)) {<a name="line.785"></a>
+<FONT color="green">786</FONT>                return false;<a name="line.786"></a>
+<FONT color="green">787</FONT>            }<a name="line.787"></a>
+<FONT color="green">788</FONT>            OpenMapRealVector other = (OpenMapRealVector) obj;<a name="line.788"></a>
+<FONT color="green">789</FONT>            if (virtualSize != other.virtualSize) {<a name="line.789"></a>
+<FONT color="green">790</FONT>                return false;<a name="line.790"></a>
+<FONT color="green">791</FONT>            }<a name="line.791"></a>
+<FONT color="green">792</FONT>            if (Double.doubleToLongBits(epsilon) !=<a name="line.792"></a>
+<FONT color="green">793</FONT>                Double.doubleToLongBits(other.epsilon)) {<a name="line.793"></a>
+<FONT color="green">794</FONT>                return false;<a name="line.794"></a>
+<FONT color="green">795</FONT>            }<a name="line.795"></a>
+<FONT color="green">796</FONT>            Iterator iter = entries.iterator();<a name="line.796"></a>
+<FONT color="green">797</FONT>            while (iter.hasNext()) {<a name="line.797"></a>
+<FONT color="green">798</FONT>                iter.advance();<a name="line.798"></a>
+<FONT color="green">799</FONT>                double test = other.getEntry(iter.key());<a name="line.799"></a>
+<FONT color="green">800</FONT>                if (Double.doubleToLongBits(test) != Double.doubleToLongBits(iter.value())) {<a name="line.800"></a>
+<FONT color="green">801</FONT>                    return false;<a name="line.801"></a>
+<FONT color="green">802</FONT>                }<a name="line.802"></a>
+<FONT color="green">803</FONT>            }<a name="line.803"></a>
+<FONT color="green">804</FONT>            iter = other.getEntries().iterator();<a name="line.804"></a>
+<FONT color="green">805</FONT>            while (iter.hasNext()) {<a name="line.805"></a>
+<FONT color="green">806</FONT>                iter.advance();<a name="line.806"></a>
+<FONT color="green">807</FONT>                double test = iter.value();<a name="line.807"></a>
+<FONT color="green">808</FONT>                if (Double.doubleToLongBits(test) != Double.doubleToLongBits(getEntry(iter.key()))) {<a name="line.808"></a>
+<FONT color="green">809</FONT>                    return false;<a name="line.809"></a>
+<FONT color="green">810</FONT>                }<a name="line.810"></a>
+<FONT color="green">811</FONT>            }<a name="line.811"></a>
+<FONT color="green">812</FONT>            return true;<a name="line.812"></a>
+<FONT color="green">813</FONT>        }<a name="line.813"></a>
+<FONT color="green">814</FONT>    <a name="line.814"></a>
+<FONT color="green">815</FONT>        /**<a name="line.815"></a>
+<FONT color="green">816</FONT>         *<a name="line.816"></a>
+<FONT color="green">817</FONT>         * @return the percentage of none zero elements as a decimal percent.<a name="line.817"></a>
+<FONT color="green">818</FONT>         */<a name="line.818"></a>
+<FONT color="green">819</FONT>        public double getSparcity() {<a name="line.819"></a>
+<FONT color="green">820</FONT>            return (double)entries.size()/(double)getDimension();<a name="line.820"></a>
+<FONT color="green">821</FONT>        }<a name="line.821"></a>
+<FONT color="green">822</FONT>    <a name="line.822"></a>
+<FONT color="green">823</FONT>        /** {@inheritDoc} */<a name="line.823"></a>
+<FONT color="green">824</FONT>        @Override<a name="line.824"></a>
+<FONT color="green">825</FONT>        public java.util.Iterator&lt;Entry&gt; sparseIterator() {<a name="line.825"></a>
+<FONT color="green">826</FONT>            return new OpenMapSparseIterator();<a name="line.826"></a>
+<FONT color="green">827</FONT>        }<a name="line.827"></a>
+<FONT color="green">828</FONT>    <a name="line.828"></a>
+<FONT color="green">829</FONT>        /**<a name="line.829"></a>
+<FONT color="green">830</FONT>         *  Implementation of &lt;code&gt;Entry&lt;/code&gt; optimized for OpenMap.<a name="line.830"></a>
+<FONT color="green">831</FONT>         * &lt;p&gt;This implementation does not allow arbitrary calls to &lt;code&gt;setIndex&lt;/code&gt;<a name="line.831"></a>
+<FONT color="green">832</FONT>         * since the order that entries are returned is undefined.<a name="line.832"></a>
+<FONT color="green">833</FONT>         */<a name="line.833"></a>
+<FONT color="green">834</FONT>        protected class OpenMapEntry extends Entry {<a name="line.834"></a>
+<FONT color="green">835</FONT>    <a name="line.835"></a>
+<FONT color="green">836</FONT>            /** Iterator pointing to the entry. */<a name="line.836"></a>
+<FONT color="green">837</FONT>            private final Iterator iter;<a name="line.837"></a>
+<FONT color="green">838</FONT>    <a name="line.838"></a>
+<FONT color="green">839</FONT>            /** Build an entry from an iterator point to an element.<a name="line.839"></a>
+<FONT color="green">840</FONT>             * @param iter iterator pointing to the entry<a name="line.840"></a>
+<FONT color="green">841</FONT>             */<a name="line.841"></a>
+<FONT color="green">842</FONT>            protected OpenMapEntry(Iterator iter) {<a name="line.842"></a>
+<FONT color="green">843</FONT>                this.iter = iter;<a name="line.843"></a>
+<FONT color="green">844</FONT>            }<a name="line.844"></a>
+<FONT color="green">845</FONT>    <a name="line.845"></a>
+<FONT color="green">846</FONT>            /** {@inheritDoc} */<a name="line.846"></a>
+<FONT color="green">847</FONT>            @Override<a name="line.847"></a>
+<FONT color="green">848</FONT>            public double getValue() {<a name="line.848"></a>
+<FONT color="green">849</FONT>                return iter.value();<a name="line.849"></a>
+<FONT color="green">850</FONT>            }<a name="line.850"></a>
+<FONT color="green">851</FONT>    <a name="line.851"></a>
+<FONT color="green">852</FONT>            /** {@inheritDoc} */<a name="line.852"></a>
+<FONT color="green">853</FONT>            @Override<a name="line.853"></a>
+<FONT color="green">854</FONT>            public void setValue(double value) {<a name="line.854"></a>
+<FONT color="green">855</FONT>                entries.put(iter.key(), value);<a name="line.855"></a>
+<FONT color="green">856</FONT>            }<a name="line.856"></a>
+<FONT color="green">857</FONT>    <a name="line.857"></a>
+<FONT color="green">858</FONT>            /** {@inheritDoc} */<a name="line.858"></a>
+<FONT color="green">859</FONT>            @Override<a name="line.859"></a>
+<FONT color="green">860</FONT>            public int getIndex() {<a name="line.860"></a>
+<FONT color="green">861</FONT>                return iter.key();<a name="line.861"></a>
+<FONT color="green">862</FONT>            }<a name="line.862"></a>
+<FONT color="green">863</FONT>    <a name="line.863"></a>
+<FONT color="green">864</FONT>        }<a name="line.864"></a>
+<FONT color="green">865</FONT>    <a name="line.865"></a>
+<FONT color="green">866</FONT>        /**<a name="line.866"></a>
+<FONT color="green">867</FONT>         *  Iterator class to do iteration over just the non-zero elements.<a name="line.867"></a>
+<FONT color="green">868</FONT>         *  &lt;p&gt;This implementation is fail-fast, so cannot be used to modify any zero element.<a name="line.868"></a>
+<FONT color="green">869</FONT>         *<a name="line.869"></a>
+<FONT color="green">870</FONT>         */<a name="line.870"></a>
+<FONT color="green">871</FONT>        protected class OpenMapSparseIterator implements java.util.Iterator&lt;Entry&gt; {<a name="line.871"></a>
+<FONT color="green">872</FONT>    <a name="line.872"></a>
+<FONT color="green">873</FONT>            /** Underlying iterator. */<a name="line.873"></a>
+<FONT color="green">874</FONT>            private final Iterator iter;<a name="line.874"></a>
+<FONT color="green">875</FONT>    <a name="line.875"></a>
+<FONT color="green">876</FONT>            /** Current entry. */<a name="line.876"></a>
+<FONT color="green">877</FONT>            private final Entry current;<a name="line.877"></a>
+<FONT color="green">878</FONT>    <a name="line.878"></a>
+<FONT color="green">879</FONT>            /** Simple constructor. */<a name="line.879"></a>
+<FONT color="green">880</FONT>            protected OpenMapSparseIterator() {<a name="line.880"></a>
+<FONT color="green">881</FONT>                iter = entries.iterator();<a name="line.881"></a>
+<FONT color="green">882</FONT>                current = new OpenMapEntry(iter);<a name="line.882"></a>
+<FONT color="green">883</FONT>            }<a name="line.883"></a>
+<FONT color="green">884</FONT>    <a name="line.884"></a>
+<FONT color="green">885</FONT>            /** {@inheritDoc} */<a name="line.885"></a>
+<FONT color="green">886</FONT>            public boolean hasNext() {<a name="line.886"></a>
+<FONT color="green">887</FONT>                return iter.hasNext();<a name="line.887"></a>
+<FONT color="green">888</FONT>            }<a name="line.888"></a>
+<FONT color="green">889</FONT>    <a name="line.889"></a>
+<FONT color="green">890</FONT>            /** {@inheritDoc} */<a name="line.890"></a>
+<FONT color="green">891</FONT>            public Entry next() {<a name="line.891"></a>
+<FONT color="green">892</FONT>                iter.advance();<a name="line.892"></a>
+<FONT color="green">893</FONT>                return current;<a name="line.893"></a>
+<FONT color="green">894</FONT>            }<a name="line.894"></a>
+<FONT color="green">895</FONT>    <a name="line.895"></a>
+<FONT color="green">896</FONT>            /** {@inheritDoc} */<a name="line.896"></a>
+<FONT color="green">897</FONT>            public void remove() {<a name="line.897"></a>
+<FONT color="green">898</FONT>                throw new UnsupportedOperationException("Not supported");<a name="line.898"></a>
+<FONT color="green">899</FONT>           }<a name="line.899"></a>
+<FONT color="green">900</FONT>    <a name="line.900"></a>
+<FONT color="green">901</FONT>        }<a name="line.901"></a>
+<FONT color="green">902</FONT>    }<a name="line.902"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/QRDecomposition.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,143 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * An interface to classes that implement an algorithm to calculate the<a name="line.22"></a>
+<FONT color="green">023</FONT>     * QR-decomposition of a real matrix.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;This interface is based on the class with similar name from the<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;a href="http://math.nist.gov/javanumerics/jama/"&gt;JAMA&lt;/a&gt; library, with the<a name="line.25"></a>
+<FONT color="green">026</FONT>     * following changes:&lt;/p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;ul&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     *   &lt;li&gt;a {@link #getQT() getQT} method has been added,&lt;/li&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     *   &lt;li&gt;the &lt;code&gt;solve&lt;/code&gt; and &lt;code&gt;isFullRank&lt;/code&gt; methods have been replaced<a name="line.29"></a>
+<FONT color="green">030</FONT>     *   by a {@link #getSolver() getSolver} method and the equivalent methods provided by<a name="line.30"></a>
+<FONT color="green">031</FONT>     *   the returned {@link DecompositionSolver}.&lt;/li&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;/ul&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @see &lt;a href="http://mathworld.wolfram.com/QRDecomposition.html"&gt;MathWorld&lt;/a&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @see &lt;a href="http://en.wikipedia.org/wiki/QR_decomposition"&gt;Wikipedia&lt;/a&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @version $Revision: 826627 $ $Date: 2009-10-19 06:27:47 -0400 (Mon, 19 Oct 2009) $<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @since 1.2<a name="line.37"></a>
+<FONT color="green">038</FONT>     */<a name="line.38"></a>
+<FONT color="green">039</FONT>    public interface QRDecomposition {<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * Returns the matrix R of the decomposition.<a name="line.42"></a>
+<FONT color="green">043</FONT>         * &lt;p&gt;R is an upper-triangular matrix&lt;/p&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @return the R matrix<a name="line.44"></a>
+<FONT color="green">045</FONT>         */<a name="line.45"></a>
+<FONT color="green">046</FONT>        RealMatrix getR();<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /**<a name="line.48"></a>
+<FONT color="green">049</FONT>         * Returns the matrix Q of the decomposition.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * &lt;p&gt;Q is an orthogonal matrix&lt;/p&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @return the Q matrix<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        RealMatrix getQ();<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * Returns the transpose of the matrix Q of the decomposition.<a name="line.56"></a>
+<FONT color="green">057</FONT>         * &lt;p&gt;Q is an orthogonal matrix&lt;/p&gt;<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @return the Q matrix<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        RealMatrix getQT();<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /**<a name="line.62"></a>
+<FONT color="green">063</FONT>         * Returns the Householder reflector vectors.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * &lt;p&gt;H is a lower trapezoidal matrix whose columns represent<a name="line.64"></a>
+<FONT color="green">065</FONT>         * each successive Householder reflector vector. This matrix is used<a name="line.65"></a>
+<FONT color="green">066</FONT>         * to compute Q.&lt;/p&gt;<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @return a matrix containing the Householder reflector vectors<a name="line.67"></a>
+<FONT color="green">068</FONT>         */<a name="line.68"></a>
+<FONT color="green">069</FONT>        RealMatrix getH();<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /**<a name="line.71"></a>
+<FONT color="green">072</FONT>         * Get a solver for finding the A &amp;times; X = B solution in least square sense.<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @return a solver<a name="line.73"></a>
+<FONT color="green">074</FONT>         */<a name="line.74"></a>
+<FONT color="green">075</FONT>        DecompositionSolver getSolver();<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>    }<a name="line.77"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/QRDecompositionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,517 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Calculates the QR-decomposition of a matrix.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;The QR-decomposition of a matrix A consists of two matrices Q and R<a name="line.27"></a>
+<FONT color="green">028</FONT>     * that satisfy: A = QR, Q is orthogonal (Q&lt;sup&gt;T&lt;/sup&gt;Q = I), and R is<a name="line.28"></a>
+<FONT color="green">029</FONT>     * upper triangular. If A is m&amp;times;n, Q is m&amp;times;m and R m&amp;times;n.&lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;p&gt;This class compute the decomposition using Householder reflectors.&lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;For efficiency purposes, the decomposition in packed form is transposed.<a name="line.31"></a>
+<FONT color="green">032</FONT>     * This allows inner loop to iterate inside rows, which is much more cache-efficient<a name="line.32"></a>
+<FONT color="green">033</FONT>     * in Java.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     *<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @see &lt;a href="http://mathworld.wolfram.com/QRDecomposition.html"&gt;MathWorld&lt;/a&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @see &lt;a href="http://en.wikipedia.org/wiki/QR_decomposition"&gt;Wikipedia&lt;/a&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @version $Revision: 825919 $ $Date: 2009-10-16 10:51:55 -0400 (Fri, 16 Oct 2009) $<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @since 1.2<a name="line.39"></a>
+<FONT color="green">040</FONT>     */<a name="line.40"></a>
+<FONT color="green">041</FONT>    public class QRDecompositionImpl implements QRDecomposition {<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /**<a name="line.43"></a>
+<FONT color="green">044</FONT>         * A packed TRANSPOSED representation of the QR decomposition.<a name="line.44"></a>
+<FONT color="green">045</FONT>         * &lt;p&gt;The elements BELOW the diagonal are the elements of the UPPER triangular<a name="line.45"></a>
+<FONT color="green">046</FONT>         * matrix R, and the rows ABOVE the diagonal are the Householder reflector vectors<a name="line.46"></a>
+<FONT color="green">047</FONT>         * from which an explicit form of Q can be recomputed if desired.&lt;/p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        private double[][] qrt;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /** The diagonal elements of R. */<a name="line.51"></a>
+<FONT color="green">052</FONT>        private double[] rDiag;<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /** Cached value of Q. */<a name="line.54"></a>
+<FONT color="green">055</FONT>        private RealMatrix cachedQ;<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /** Cached value of QT. */<a name="line.57"></a>
+<FONT color="green">058</FONT>        private RealMatrix cachedQT;<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Cached value of R. */<a name="line.60"></a>
+<FONT color="green">061</FONT>        private RealMatrix cachedR;<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /** Cached value of H. */<a name="line.63"></a>
+<FONT color="green">064</FONT>        private RealMatrix cachedH;<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /**<a name="line.66"></a>
+<FONT color="green">067</FONT>         * Calculates the QR-decomposition of the given matrix.<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param matrix The matrix to decompose.<a name="line.68"></a>
+<FONT color="green">069</FONT>         */<a name="line.69"></a>
+<FONT color="green">070</FONT>        public QRDecompositionImpl(RealMatrix matrix) {<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>            final int m = matrix.getRowDimension();<a name="line.72"></a>
+<FONT color="green">073</FONT>            final int n = matrix.getColumnDimension();<a name="line.73"></a>
+<FONT color="green">074</FONT>            qrt = matrix.transpose().getData();<a name="line.74"></a>
+<FONT color="green">075</FONT>            rDiag = new double[Math.min(m, n)];<a name="line.75"></a>
+<FONT color="green">076</FONT>            cachedQ  = null;<a name="line.76"></a>
+<FONT color="green">077</FONT>            cachedQT = null;<a name="line.77"></a>
+<FONT color="green">078</FONT>            cachedR  = null;<a name="line.78"></a>
+<FONT color="green">079</FONT>            cachedH  = null;<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>            /*<a name="line.81"></a>
+<FONT color="green">082</FONT>             * The QR decomposition of a matrix A is calculated using Householder<a name="line.82"></a>
+<FONT color="green">083</FONT>             * reflectors by repeating the following operations to each minor<a name="line.83"></a>
+<FONT color="green">084</FONT>             * A(minor,minor) of A:<a name="line.84"></a>
+<FONT color="green">085</FONT>             */<a name="line.85"></a>
+<FONT color="green">086</FONT>            for (int minor = 0; minor &lt; Math.min(m, n); minor++) {<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>                final double[] qrtMinor = qrt[minor];<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>                /*<a name="line.90"></a>
+<FONT color="green">091</FONT>                 * Let x be the first column of the minor, and a^2 = |x|^2.<a name="line.91"></a>
+<FONT color="green">092</FONT>                 * x will be in the positions qr[minor][minor] through qr[m][minor].<a name="line.92"></a>
+<FONT color="green">093</FONT>                 * The first column of the transformed minor will be (a,0,0,..)'<a name="line.93"></a>
+<FONT color="green">094</FONT>                 * The sign of a is chosen to be opposite to the sign of the first<a name="line.94"></a>
+<FONT color="green">095</FONT>                 * component of x. Let's find a:<a name="line.95"></a>
+<FONT color="green">096</FONT>                 */<a name="line.96"></a>
+<FONT color="green">097</FONT>                double xNormSqr = 0;<a name="line.97"></a>
+<FONT color="green">098</FONT>                for (int row = minor; row &lt; m; row++) {<a name="line.98"></a>
+<FONT color="green">099</FONT>                    final double c = qrtMinor[row];<a name="line.99"></a>
+<FONT color="green">100</FONT>                    xNormSqr += c * c;<a name="line.100"></a>
+<FONT color="green">101</FONT>                }<a name="line.101"></a>
+<FONT color="green">102</FONT>                final double a = (qrtMinor[minor] &gt; 0) ? -Math.sqrt(xNormSqr) : Math.sqrt(xNormSqr);<a name="line.102"></a>
+<FONT color="green">103</FONT>                rDiag[minor] = a;<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>                if (a != 0.0) {<a name="line.105"></a>
+<FONT color="green">106</FONT>    <a name="line.106"></a>
+<FONT color="green">107</FONT>                    /*<a name="line.107"></a>
+<FONT color="green">108</FONT>                     * Calculate the normalized reflection vector v and transform<a name="line.108"></a>
+<FONT color="green">109</FONT>                     * the first column. We know the norm of v beforehand: v = x-ae<a name="line.109"></a>
+<FONT color="green">110</FONT>                     * so |v|^2 = &lt;x-ae,x-ae&gt; = &lt;x,x&gt;-2a&lt;x,e&gt;+a^2&lt;e,e&gt; =<a name="line.110"></a>
+<FONT color="green">111</FONT>                     * a^2+a^2-2a&lt;x,e&gt; = 2a*(a - &lt;x,e&gt;).<a name="line.111"></a>
+<FONT color="green">112</FONT>                     * Here &lt;x, e&gt; is now qr[minor][minor].<a name="line.112"></a>
+<FONT color="green">113</FONT>                     * v = x-ae is stored in the column at qr:<a name="line.113"></a>
+<FONT color="green">114</FONT>                     */<a name="line.114"></a>
+<FONT color="green">115</FONT>                    qrtMinor[minor] -= a; // now |v|^2 = -2a*(qr[minor][minor])<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>                    /*<a name="line.117"></a>
+<FONT color="green">118</FONT>                     * Transform the rest of the columns of the minor:<a name="line.118"></a>
+<FONT color="green">119</FONT>                     * They will be transformed by the matrix H = I-2vv'/|v|^2.<a name="line.119"></a>
+<FONT color="green">120</FONT>                     * If x is a column vector of the minor, then<a name="line.120"></a>
+<FONT color="green">121</FONT>                     * Hx = (I-2vv'/|v|^2)x = x-2vv'x/|v|^2 = x - 2&lt;x,v&gt;/|v|^2 v.<a name="line.121"></a>
+<FONT color="green">122</FONT>                     * Therefore the transformation is easily calculated by<a name="line.122"></a>
+<FONT color="green">123</FONT>                     * subtracting the column vector (2&lt;x,v&gt;/|v|^2)v from x.<a name="line.123"></a>
+<FONT color="green">124</FONT>                     *<a name="line.124"></a>
+<FONT color="green">125</FONT>                     * Let 2&lt;x,v&gt;/|v|^2 = alpha. From above we have<a name="line.125"></a>
+<FONT color="green">126</FONT>                     * |v|^2 = -2a*(qr[minor][minor]), so<a name="line.126"></a>
+<FONT color="green">127</FONT>                     * alpha = -&lt;x,v&gt;/(a*qr[minor][minor])<a name="line.127"></a>
+<FONT color="green">128</FONT>                     */<a name="line.128"></a>
+<FONT color="green">129</FONT>                    for (int col = minor+1; col &lt; n; col++) {<a name="line.129"></a>
+<FONT color="green">130</FONT>                        final double[] qrtCol = qrt[col];<a name="line.130"></a>
+<FONT color="green">131</FONT>                        double alpha = 0;<a name="line.131"></a>
+<FONT color="green">132</FONT>                        for (int row = minor; row &lt; m; row++) {<a name="line.132"></a>
+<FONT color="green">133</FONT>                            alpha -= qrtCol[row] * qrtMinor[row];<a name="line.133"></a>
+<FONT color="green">134</FONT>                        }<a name="line.134"></a>
+<FONT color="green">135</FONT>                        alpha /= a * qrtMinor[minor];<a name="line.135"></a>
+<FONT color="green">136</FONT>    <a name="line.136"></a>
+<FONT color="green">137</FONT>                        // Subtract the column vector alpha*v from x.<a name="line.137"></a>
+<FONT color="green">138</FONT>                        for (int row = minor; row &lt; m; row++) {<a name="line.138"></a>
+<FONT color="green">139</FONT>                            qrtCol[row] -= alpha * qrtMinor[row];<a name="line.139"></a>
+<FONT color="green">140</FONT>                        }<a name="line.140"></a>
+<FONT color="green">141</FONT>                    }<a name="line.141"></a>
+<FONT color="green">142</FONT>                }<a name="line.142"></a>
+<FONT color="green">143</FONT>            }<a name="line.143"></a>
+<FONT color="green">144</FONT>        }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>        /** {@inheritDoc} */<a name="line.146"></a>
+<FONT color="green">147</FONT>        public RealMatrix getR() {<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>            if (cachedR == null) {<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>                // R is supposed to be m x n<a name="line.151"></a>
+<FONT color="green">152</FONT>                final int n = qrt.length;<a name="line.152"></a>
+<FONT color="green">153</FONT>                final int m = qrt[0].length;<a name="line.153"></a>
+<FONT color="green">154</FONT>                cachedR = MatrixUtils.createRealMatrix(m, n);<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>                // copy the diagonal from rDiag and the upper triangle of qr<a name="line.156"></a>
+<FONT color="green">157</FONT>                for (int row = Math.min(m, n) - 1; row &gt;= 0; row--) {<a name="line.157"></a>
+<FONT color="green">158</FONT>                    cachedR.setEntry(row, row, rDiag[row]);<a name="line.158"></a>
+<FONT color="green">159</FONT>                    for (int col = row + 1; col &lt; n; col++) {<a name="line.159"></a>
+<FONT color="green">160</FONT>                        cachedR.setEntry(row, col, qrt[col][row]);<a name="line.160"></a>
+<FONT color="green">161</FONT>                    }<a name="line.161"></a>
+<FONT color="green">162</FONT>                }<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>            }<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>            // return the cached matrix<a name="line.166"></a>
+<FONT color="green">167</FONT>            return cachedR;<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>        }<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>        /** {@inheritDoc} */<a name="line.171"></a>
+<FONT color="green">172</FONT>        public RealMatrix getQ() {<a name="line.172"></a>
+<FONT color="green">173</FONT>            if (cachedQ == null) {<a name="line.173"></a>
+<FONT color="green">174</FONT>                cachedQ = getQT().transpose();<a name="line.174"></a>
+<FONT color="green">175</FONT>            }<a name="line.175"></a>
+<FONT color="green">176</FONT>            return cachedQ;<a name="line.176"></a>
+<FONT color="green">177</FONT>        }<a name="line.177"></a>
+<FONT color="green">178</FONT>    <a name="line.178"></a>
+<FONT color="green">179</FONT>        /** {@inheritDoc} */<a name="line.179"></a>
+<FONT color="green">180</FONT>        public RealMatrix getQT() {<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>            if (cachedQT == null) {<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>                // QT is supposed to be m x m<a name="line.184"></a>
+<FONT color="green">185</FONT>                final int n = qrt.length;<a name="line.185"></a>
+<FONT color="green">186</FONT>                final int m = qrt[0].length;<a name="line.186"></a>
+<FONT color="green">187</FONT>                cachedQT = MatrixUtils.createRealMatrix(m, m);<a name="line.187"></a>
+<FONT color="green">188</FONT>    <a name="line.188"></a>
+<FONT color="green">189</FONT>                /*<a name="line.189"></a>
+<FONT color="green">190</FONT>                 * Q = Q1 Q2 ... Q_m, so Q is formed by first constructing Q_m and then<a name="line.190"></a>
+<FONT color="green">191</FONT>                 * applying the Householder transformations Q_(m-1),Q_(m-2),...,Q1 in<a name="line.191"></a>
+<FONT color="green">192</FONT>                 * succession to the result<a name="line.192"></a>
+<FONT color="green">193</FONT>                 */<a name="line.193"></a>
+<FONT color="green">194</FONT>                for (int minor = m - 1; minor &gt;= Math.min(m, n); minor--) {<a name="line.194"></a>
+<FONT color="green">195</FONT>                    cachedQT.setEntry(minor, minor, 1.0);<a name="line.195"></a>
+<FONT color="green">196</FONT>                }<a name="line.196"></a>
+<FONT color="green">197</FONT>    <a name="line.197"></a>
+<FONT color="green">198</FONT>                for (int minor = Math.min(m, n)-1; minor &gt;= 0; minor--){<a name="line.198"></a>
+<FONT color="green">199</FONT>                    final double[] qrtMinor = qrt[minor];<a name="line.199"></a>
+<FONT color="green">200</FONT>                    cachedQT.setEntry(minor, minor, 1.0);<a name="line.200"></a>
+<FONT color="green">201</FONT>                    if (qrtMinor[minor] != 0.0) {<a name="line.201"></a>
+<FONT color="green">202</FONT>                        for (int col = minor; col &lt; m; col++) {<a name="line.202"></a>
+<FONT color="green">203</FONT>                            double alpha = 0;<a name="line.203"></a>
+<FONT color="green">204</FONT>                            for (int row = minor; row &lt; m; row++) {<a name="line.204"></a>
+<FONT color="green">205</FONT>                                alpha -= cachedQT.getEntry(col, row) * qrtMinor[row];<a name="line.205"></a>
+<FONT color="green">206</FONT>                            }<a name="line.206"></a>
+<FONT color="green">207</FONT>                            alpha /= rDiag[minor] * qrtMinor[minor];<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>                            for (int row = minor; row &lt; m; row++) {<a name="line.209"></a>
+<FONT color="green">210</FONT>                                cachedQT.addToEntry(col, row, -alpha * qrtMinor[row]);<a name="line.210"></a>
+<FONT color="green">211</FONT>                            }<a name="line.211"></a>
+<FONT color="green">212</FONT>                        }<a name="line.212"></a>
+<FONT color="green">213</FONT>                    }<a name="line.213"></a>
+<FONT color="green">214</FONT>                }<a name="line.214"></a>
+<FONT color="green">215</FONT>    <a name="line.215"></a>
+<FONT color="green">216</FONT>            }<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>            // return the cached matrix<a name="line.218"></a>
+<FONT color="green">219</FONT>            return cachedQT;<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>        }<a name="line.221"></a>
+<FONT color="green">222</FONT>    <a name="line.222"></a>
+<FONT color="green">223</FONT>        /** {@inheritDoc} */<a name="line.223"></a>
+<FONT color="green">224</FONT>        public RealMatrix getH() {<a name="line.224"></a>
+<FONT color="green">225</FONT>    <a name="line.225"></a>
+<FONT color="green">226</FONT>            if (cachedH == null) {<a name="line.226"></a>
+<FONT color="green">227</FONT>    <a name="line.227"></a>
+<FONT color="green">228</FONT>                final int n = qrt.length;<a name="line.228"></a>
+<FONT color="green">229</FONT>                final int m = qrt[0].length;<a name="line.229"></a>
+<FONT color="green">230</FONT>                cachedH = MatrixUtils.createRealMatrix(m, n);<a name="line.230"></a>
+<FONT color="green">231</FONT>                for (int i = 0; i &lt; m; ++i) {<a name="line.231"></a>
+<FONT color="green">232</FONT>                    for (int j = 0; j &lt; Math.min(i + 1, n); ++j) {<a name="line.232"></a>
+<FONT color="green">233</FONT>                        cachedH.setEntry(i, j, qrt[j][i] / -rDiag[j]);<a name="line.233"></a>
+<FONT color="green">234</FONT>                    }<a name="line.234"></a>
+<FONT color="green">235</FONT>                }<a name="line.235"></a>
+<FONT color="green">236</FONT>    <a name="line.236"></a>
+<FONT color="green">237</FONT>            }<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>            // return the cached matrix<a name="line.239"></a>
+<FONT color="green">240</FONT>            return cachedH;<a name="line.240"></a>
+<FONT color="green">241</FONT>    <a name="line.241"></a>
+<FONT color="green">242</FONT>        }<a name="line.242"></a>
+<FONT color="green">243</FONT>    <a name="line.243"></a>
+<FONT color="green">244</FONT>        /** {@inheritDoc} */<a name="line.244"></a>
+<FONT color="green">245</FONT>        public DecompositionSolver getSolver() {<a name="line.245"></a>
+<FONT color="green">246</FONT>            return new Solver(qrt, rDiag);<a name="line.246"></a>
+<FONT color="green">247</FONT>        }<a name="line.247"></a>
+<FONT color="green">248</FONT>    <a name="line.248"></a>
+<FONT color="green">249</FONT>        /** Specialized solver. */<a name="line.249"></a>
+<FONT color="green">250</FONT>        private static class Solver implements DecompositionSolver {<a name="line.250"></a>
+<FONT color="green">251</FONT>    <a name="line.251"></a>
+<FONT color="green">252</FONT>            /**<a name="line.252"></a>
+<FONT color="green">253</FONT>             * A packed TRANSPOSED representation of the QR decomposition.<a name="line.253"></a>
+<FONT color="green">254</FONT>             * &lt;p&gt;The elements BELOW the diagonal are the elements of the UPPER triangular<a name="line.254"></a>
+<FONT color="green">255</FONT>             * matrix R, and the rows ABOVE the diagonal are the Householder reflector vectors<a name="line.255"></a>
+<FONT color="green">256</FONT>             * from which an explicit form of Q can be recomputed if desired.&lt;/p&gt;<a name="line.256"></a>
+<FONT color="green">257</FONT>             */<a name="line.257"></a>
+<FONT color="green">258</FONT>            private final double[][] qrt;<a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>            /** The diagonal elements of R. */<a name="line.260"></a>
+<FONT color="green">261</FONT>            private final double[] rDiag;<a name="line.261"></a>
+<FONT color="green">262</FONT>    <a name="line.262"></a>
+<FONT color="green">263</FONT>            /**<a name="line.263"></a>
+<FONT color="green">264</FONT>             * Build a solver from decomposed matrix.<a name="line.264"></a>
+<FONT color="green">265</FONT>             * @param qrt packed TRANSPOSED representation of the QR decomposition<a name="line.265"></a>
+<FONT color="green">266</FONT>             * @param rDiag diagonal elements of R<a name="line.266"></a>
+<FONT color="green">267</FONT>             */<a name="line.267"></a>
+<FONT color="green">268</FONT>            private Solver(final double[][] qrt, final double[] rDiag) {<a name="line.268"></a>
+<FONT color="green">269</FONT>                this.qrt   = qrt;<a name="line.269"></a>
+<FONT color="green">270</FONT>                this.rDiag = rDiag;<a name="line.270"></a>
+<FONT color="green">271</FONT>            }<a name="line.271"></a>
+<FONT color="green">272</FONT>    <a name="line.272"></a>
+<FONT color="green">273</FONT>            /** {@inheritDoc} */<a name="line.273"></a>
+<FONT color="green">274</FONT>            public boolean isNonSingular() {<a name="line.274"></a>
+<FONT color="green">275</FONT>    <a name="line.275"></a>
+<FONT color="green">276</FONT>                for (double diag : rDiag) {<a name="line.276"></a>
+<FONT color="green">277</FONT>                    if (diag == 0) {<a name="line.277"></a>
+<FONT color="green">278</FONT>                        return false;<a name="line.278"></a>
+<FONT color="green">279</FONT>                    }<a name="line.279"></a>
+<FONT color="green">280</FONT>                }<a name="line.280"></a>
+<FONT color="green">281</FONT>                return true;<a name="line.281"></a>
+<FONT color="green">282</FONT>    <a name="line.282"></a>
+<FONT color="green">283</FONT>            }<a name="line.283"></a>
+<FONT color="green">284</FONT>    <a name="line.284"></a>
+<FONT color="green">285</FONT>            /** {@inheritDoc} */<a name="line.285"></a>
+<FONT color="green">286</FONT>            public double[] solve(double[] b)<a name="line.286"></a>
+<FONT color="green">287</FONT>            throws IllegalArgumentException, InvalidMatrixException {<a name="line.287"></a>
+<FONT color="green">288</FONT>    <a name="line.288"></a>
+<FONT color="green">289</FONT>                final int n = qrt.length;<a name="line.289"></a>
+<FONT color="green">290</FONT>                final int m = qrt[0].length;<a name="line.290"></a>
+<FONT color="green">291</FONT>                if (b.length != m) {<a name="line.291"></a>
+<FONT color="green">292</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.292"></a>
+<FONT color="green">293</FONT>                            "vector length mismatch: got {0} but expected {1}",<a name="line.293"></a>
+<FONT color="green">294</FONT>                            b.length, m);<a name="line.294"></a>
+<FONT color="green">295</FONT>                }<a name="line.295"></a>
+<FONT color="green">296</FONT>                if (!isNonSingular()) {<a name="line.296"></a>
+<FONT color="green">297</FONT>                    throw new SingularMatrixException();<a name="line.297"></a>
+<FONT color="green">298</FONT>                }<a name="line.298"></a>
+<FONT color="green">299</FONT>    <a name="line.299"></a>
+<FONT color="green">300</FONT>                final double[] x = new double[n];<a name="line.300"></a>
+<FONT color="green">301</FONT>                final double[] y = b.clone();<a name="line.301"></a>
+<FONT color="green">302</FONT>    <a name="line.302"></a>
+<FONT color="green">303</FONT>                // apply Householder transforms to solve Q.y = b<a name="line.303"></a>
+<FONT color="green">304</FONT>                for (int minor = 0; minor &lt; Math.min(m, n); minor++) {<a name="line.304"></a>
+<FONT color="green">305</FONT>    <a name="line.305"></a>
+<FONT color="green">306</FONT>                    final double[] qrtMinor = qrt[minor];<a name="line.306"></a>
+<FONT color="green">307</FONT>                    double dotProduct = 0;<a name="line.307"></a>
+<FONT color="green">308</FONT>                    for (int row = minor; row &lt; m; row++) {<a name="line.308"></a>
+<FONT color="green">309</FONT>                        dotProduct += y[row] * qrtMinor[row];<a name="line.309"></a>
+<FONT color="green">310</FONT>                    }<a name="line.310"></a>
+<FONT color="green">311</FONT>                    dotProduct /= rDiag[minor] * qrtMinor[minor];<a name="line.311"></a>
+<FONT color="green">312</FONT>    <a name="line.312"></a>
+<FONT color="green">313</FONT>                    for (int row = minor; row &lt; m; row++) {<a name="line.313"></a>
+<FONT color="green">314</FONT>                        y[row] += dotProduct * qrtMinor[row];<a name="line.314"></a>
+<FONT color="green">315</FONT>                    }<a name="line.315"></a>
+<FONT color="green">316</FONT>    <a name="line.316"></a>
+<FONT color="green">317</FONT>                }<a name="line.317"></a>
+<FONT color="green">318</FONT>    <a name="line.318"></a>
+<FONT color="green">319</FONT>                // solve triangular system R.x = y<a name="line.319"></a>
+<FONT color="green">320</FONT>                for (int row = rDiag.length - 1; row &gt;= 0; --row) {<a name="line.320"></a>
+<FONT color="green">321</FONT>                    y[row] /= rDiag[row];<a name="line.321"></a>
+<FONT color="green">322</FONT>                    final double yRow   = y[row];<a name="line.322"></a>
+<FONT color="green">323</FONT>                    final double[] qrtRow = qrt[row];<a name="line.323"></a>
+<FONT color="green">324</FONT>                    x[row] = yRow;<a name="line.324"></a>
+<FONT color="green">325</FONT>                    for (int i = 0; i &lt; row; i++) {<a name="line.325"></a>
+<FONT color="green">326</FONT>                        y[i] -= yRow * qrtRow[i];<a name="line.326"></a>
+<FONT color="green">327</FONT>                    }<a name="line.327"></a>
+<FONT color="green">328</FONT>                }<a name="line.328"></a>
+<FONT color="green">329</FONT>    <a name="line.329"></a>
+<FONT color="green">330</FONT>                return x;<a name="line.330"></a>
+<FONT color="green">331</FONT>    <a name="line.331"></a>
+<FONT color="green">332</FONT>            }<a name="line.332"></a>
+<FONT color="green">333</FONT>    <a name="line.333"></a>
+<FONT color="green">334</FONT>            /** {@inheritDoc} */<a name="line.334"></a>
+<FONT color="green">335</FONT>            public RealVector solve(RealVector b)<a name="line.335"></a>
+<FONT color="green">336</FONT>            throws IllegalArgumentException, InvalidMatrixException {<a name="line.336"></a>
+<FONT color="green">337</FONT>                try {<a name="line.337"></a>
+<FONT color="green">338</FONT>                    return solve((ArrayRealVector) b);<a name="line.338"></a>
+<FONT color="green">339</FONT>                } catch (ClassCastException cce) {<a name="line.339"></a>
+<FONT color="green">340</FONT>                    return new ArrayRealVector(solve(b.getData()), false);<a name="line.340"></a>
+<FONT color="green">341</FONT>                }<a name="line.341"></a>
+<FONT color="green">342</FONT>            }<a name="line.342"></a>
+<FONT color="green">343</FONT>    <a name="line.343"></a>
+<FONT color="green">344</FONT>            /** Solve the linear equation A &amp;times; X = B.<a name="line.344"></a>
+<FONT color="green">345</FONT>             * &lt;p&gt;The A matrix is implicit here. It is &lt;/p&gt;<a name="line.345"></a>
+<FONT color="green">346</FONT>             * @param b right-hand side of the equation A &amp;times; X = B<a name="line.346"></a>
+<FONT color="green">347</FONT>             * @return a vector X that minimizes the two norm of A &amp;times; X - B<a name="line.347"></a>
+<FONT color="green">348</FONT>             * @throws IllegalArgumentException if matrices dimensions don't match<a name="line.348"></a>
+<FONT color="green">349</FONT>             * @throws InvalidMatrixException if decomposed matrix is singular<a name="line.349"></a>
+<FONT color="green">350</FONT>             */<a name="line.350"></a>
+<FONT color="green">351</FONT>            public ArrayRealVector solve(ArrayRealVector b)<a name="line.351"></a>
+<FONT color="green">352</FONT>            throws IllegalArgumentException, InvalidMatrixException {<a name="line.352"></a>
+<FONT color="green">353</FONT>                return new ArrayRealVector(solve(b.getDataRef()), false);<a name="line.353"></a>
+<FONT color="green">354</FONT>            }<a name="line.354"></a>
+<FONT color="green">355</FONT>    <a name="line.355"></a>
+<FONT color="green">356</FONT>            /** {@inheritDoc} */<a name="line.356"></a>
+<FONT color="green">357</FONT>            public RealMatrix solve(RealMatrix b)<a name="line.357"></a>
+<FONT color="green">358</FONT>            throws IllegalArgumentException, InvalidMatrixException {<a name="line.358"></a>
+<FONT color="green">359</FONT>    <a name="line.359"></a>
+<FONT color="green">360</FONT>                final int n = qrt.length;<a name="line.360"></a>
+<FONT color="green">361</FONT>                final int m = qrt[0].length;<a name="line.361"></a>
+<FONT color="green">362</FONT>                if (b.getRowDimension() != m) {<a name="line.362"></a>
+<FONT color="green">363</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.363"></a>
+<FONT color="green">364</FONT>                            "dimensions mismatch: got {0}x{1} but expected {2}x{3}",<a name="line.364"></a>
+<FONT color="green">365</FONT>                            b.getRowDimension(), b.getColumnDimension(), m, "n");<a name="line.365"></a>
+<FONT color="green">366</FONT>                }<a name="line.366"></a>
+<FONT color="green">367</FONT>                if (!isNonSingular()) {<a name="line.367"></a>
+<FONT color="green">368</FONT>                    throw new SingularMatrixException();<a name="line.368"></a>
+<FONT color="green">369</FONT>                }<a name="line.369"></a>
+<FONT color="green">370</FONT>    <a name="line.370"></a>
+<FONT color="green">371</FONT>                final int columns        = b.getColumnDimension();<a name="line.371"></a>
+<FONT color="green">372</FONT>                final int blockSize      = BlockRealMatrix.BLOCK_SIZE;<a name="line.372"></a>
+<FONT color="green">373</FONT>                final int cBlocks        = (columns + blockSize - 1) / blockSize;<a name="line.373"></a>
+<FONT color="green">374</FONT>                final double[][] xBlocks = BlockRealMatrix.createBlocksLayout(n, columns);<a name="line.374"></a>
+<FONT color="green">375</FONT>                final double[][] y       = new double[b.getRowDimension()][blockSize];<a name="line.375"></a>
+<FONT color="green">376</FONT>                final double[]   alpha   = new double[blockSize];<a name="line.376"></a>
+<FONT color="green">377</FONT>    <a name="line.377"></a>
+<FONT color="green">378</FONT>                for (int kBlock = 0; kBlock &lt; cBlocks; ++kBlock) {<a name="line.378"></a>
+<FONT color="green">379</FONT>                    final int kStart = kBlock * blockSize;<a name="line.379"></a>
+<FONT color="green">380</FONT>                    final int kEnd   = Math.min(kStart + blockSize, columns);<a name="line.380"></a>
+<FONT color="green">381</FONT>                    final int kWidth = kEnd - kStart;<a name="line.381"></a>
+<FONT color="green">382</FONT>    <a name="line.382"></a>
+<FONT color="green">383</FONT>                    // get the right hand side vector<a name="line.383"></a>
+<FONT color="green">384</FONT>                    b.copySubMatrix(0, m - 1, kStart, kEnd - 1, y);<a name="line.384"></a>
+<FONT color="green">385</FONT>    <a name="line.385"></a>
+<FONT color="green">386</FONT>                    // apply Householder transforms to solve Q.y = b<a name="line.386"></a>
+<FONT color="green">387</FONT>                    for (int minor = 0; minor &lt; Math.min(m, n); minor++) {<a name="line.387"></a>
+<FONT color="green">388</FONT>                        final double[] qrtMinor = qrt[minor];<a name="line.388"></a>
+<FONT color="green">389</FONT>                        final double factor     = 1.0 / (rDiag[minor] * qrtMinor[minor]);<a name="line.389"></a>
+<FONT color="green">390</FONT>    <a name="line.390"></a>
+<FONT color="green">391</FONT>                        Arrays.fill(alpha, 0, kWidth, 0.0);<a name="line.391"></a>
+<FONT color="green">392</FONT>                        for (int row = minor; row &lt; m; ++row) {<a name="line.392"></a>
+<FONT color="green">393</FONT>                            final double   d    = qrtMinor[row];<a name="line.393"></a>
+<FONT color="green">394</FONT>                            final double[] yRow = y[row];<a name="line.394"></a>
+<FONT color="green">395</FONT>                            for (int k = 0; k &lt; kWidth; ++k) {<a name="line.395"></a>
+<FONT color="green">396</FONT>                                alpha[k] += d * yRow[k];<a name="line.396"></a>
+<FONT color="green">397</FONT>                            }<a name="line.397"></a>
+<FONT color="green">398</FONT>                        }<a name="line.398"></a>
+<FONT color="green">399</FONT>                        for (int k = 0; k &lt; kWidth; ++k) {<a name="line.399"></a>
+<FONT color="green">400</FONT>                            alpha[k] *= factor;<a name="line.400"></a>
+<FONT color="green">401</FONT>                        }<a name="line.401"></a>
+<FONT color="green">402</FONT>    <a name="line.402"></a>
+<FONT color="green">403</FONT>                        for (int row = minor; row &lt; m; ++row) {<a name="line.403"></a>
+<FONT color="green">404</FONT>                            final double   d    = qrtMinor[row];<a name="line.404"></a>
+<FONT color="green">405</FONT>                            final double[] yRow = y[row];<a name="line.405"></a>
+<FONT color="green">406</FONT>                            for (int k = 0; k &lt; kWidth; ++k) {<a name="line.406"></a>
+<FONT color="green">407</FONT>                                yRow[k] += alpha[k] * d;<a name="line.407"></a>
+<FONT color="green">408</FONT>                            }<a name="line.408"></a>
+<FONT color="green">409</FONT>                        }<a name="line.409"></a>
+<FONT color="green">410</FONT>    <a name="line.410"></a>
+<FONT color="green">411</FONT>                    }<a name="line.411"></a>
+<FONT color="green">412</FONT>    <a name="line.412"></a>
+<FONT color="green">413</FONT>                    // solve triangular system R.x = y<a name="line.413"></a>
+<FONT color="green">414</FONT>                    for (int j = rDiag.length - 1; j &gt;= 0; --j) {<a name="line.414"></a>
+<FONT color="green">415</FONT>                        final int      jBlock = j / blockSize;<a name="line.415"></a>
+<FONT color="green">416</FONT>                        final int      jStart = jBlock * blockSize;<a name="line.416"></a>
+<FONT color="green">417</FONT>                        final double   factor = 1.0 / rDiag[j];<a name="line.417"></a>
+<FONT color="green">418</FONT>                        final double[] yJ     = y[j];<a name="line.418"></a>
+<FONT color="green">419</FONT>                        final double[] xBlock = xBlocks[jBlock * cBlocks + kBlock];<a name="line.419"></a>
+<FONT color="green">420</FONT>                        int index = (j - jStart) * kWidth;<a name="line.420"></a>
+<FONT color="green">421</FONT>                        for (int k = 0; k &lt; kWidth; ++k) {<a name="line.421"></a>
+<FONT color="green">422</FONT>                            yJ[k]          *= factor;<a name="line.422"></a>
+<FONT color="green">423</FONT>                            xBlock[index++] = yJ[k];<a name="line.423"></a>
+<FONT color="green">424</FONT>                        }<a name="line.424"></a>
+<FONT color="green">425</FONT>    <a name="line.425"></a>
+<FONT color="green">426</FONT>                        final double[] qrtJ = qrt[j];<a name="line.426"></a>
+<FONT color="green">427</FONT>                        for (int i = 0; i &lt; j; ++i) {<a name="line.427"></a>
+<FONT color="green">428</FONT>                            final double rIJ  = qrtJ[i];<a name="line.428"></a>
+<FONT color="green">429</FONT>                            final double[] yI = y[i];<a name="line.429"></a>
+<FONT color="green">430</FONT>                            for (int k = 0; k &lt; kWidth; ++k) {<a name="line.430"></a>
+<FONT color="green">431</FONT>                                yI[k] -= yJ[k] * rIJ;<a name="line.431"></a>
+<FONT color="green">432</FONT>                            }<a name="line.432"></a>
+<FONT color="green">433</FONT>                        }<a name="line.433"></a>
+<FONT color="green">434</FONT>    <a name="line.434"></a>
+<FONT color="green">435</FONT>                    }<a name="line.435"></a>
+<FONT color="green">436</FONT>    <a name="line.436"></a>
+<FONT color="green">437</FONT>                }<a name="line.437"></a>
+<FONT color="green">438</FONT>    <a name="line.438"></a>
+<FONT color="green">439</FONT>                return new BlockRealMatrix(n, columns, xBlocks, false);<a name="line.439"></a>
+<FONT color="green">440</FONT>    <a name="line.440"></a>
+<FONT color="green">441</FONT>            }<a name="line.441"></a>
+<FONT color="green">442</FONT>    <a name="line.442"></a>
+<FONT color="green">443</FONT>            /** {@inheritDoc} */<a name="line.443"></a>
+<FONT color="green">444</FONT>            public RealMatrix getInverse()<a name="line.444"></a>
+<FONT color="green">445</FONT>            throws InvalidMatrixException {<a name="line.445"></a>
+<FONT color="green">446</FONT>                return solve(MatrixUtils.createRealIdentityMatrix(rDiag.length));<a name="line.446"></a>
+<FONT color="green">447</FONT>            }<a name="line.447"></a>
+<FONT color="green">448</FONT>    <a name="line.448"></a>
+<FONT color="green">449</FONT>        }<a name="line.449"></a>
+<FONT color="green">450</FONT>    <a name="line.450"></a>
+<FONT color="green">451</FONT>    }<a name="line.451"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/RealMatrix.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,935 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Interface defining a real-valued matrix with basic algebraic operations.<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;p&gt;<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Matrix element indexing is 0-based -- e.g., &lt;code&gt;getEntry(0, 0)&lt;/code&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * returns the element in the first row, first column of the matrix.&lt;/p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public interface RealMatrix extends AnyMatrix {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /**<a name="line.31"></a>
+<FONT color="green">032</FONT>         * Create a new RealMatrix of the same type as the instance with the supplied<a name="line.32"></a>
+<FONT color="green">033</FONT>         * row and column dimensions.<a name="line.33"></a>
+<FONT color="green">034</FONT>         *<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @param rowDimension  the number of rows in the new matrix<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @param columnDimension  the number of columns in the new matrix<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @return a new matrix of the same type as the instance<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @throws IllegalArgumentException if row or column dimension is not positive<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @since 2.0<a name="line.39"></a>
+<FONT color="green">040</FONT>         */<a name="line.40"></a>
+<FONT color="green">041</FONT>        RealMatrix createMatrix(final int rowDimension, final int columnDimension);<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /**<a name="line.43"></a>
+<FONT color="green">044</FONT>         * Returns a (deep) copy of this.<a name="line.44"></a>
+<FONT color="green">045</FONT>         *<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @return matrix copy<a name="line.46"></a>
+<FONT color="green">047</FONT>         */<a name="line.47"></a>
+<FONT color="green">048</FONT>        RealMatrix copy();<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Compute the sum of this and m.<a name="line.51"></a>
+<FONT color="green">052</FONT>         *<a name="line.52"></a>
+<FONT color="green">053</FONT>         * @param m    matrix to be added<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @return     this + m<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.55"></a>
+<FONT color="green">056</FONT>         */<a name="line.56"></a>
+<FONT color="green">057</FONT>        RealMatrix add(RealMatrix m) throws IllegalArgumentException;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /**<a name="line.59"></a>
+<FONT color="green">060</FONT>         * Compute this minus m.<a name="line.60"></a>
+<FONT color="green">061</FONT>         *<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param m    matrix to be subtracted<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @return     this - m<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.64"></a>
+<FONT color="green">065</FONT>         */<a name="line.65"></a>
+<FONT color="green">066</FONT>        RealMatrix subtract(RealMatrix m) throws IllegalArgumentException;<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>         /**<a name="line.68"></a>
+<FONT color="green">069</FONT>         * Returns the result of adding d to each entry of this.<a name="line.69"></a>
+<FONT color="green">070</FONT>         *<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param d    value to be added to each entry<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @return     d + this<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        RealMatrix scalarAdd(double d);<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        /**<a name="line.76"></a>
+<FONT color="green">077</FONT>         * Returns the result multiplying each entry of this by d.<a name="line.77"></a>
+<FONT color="green">078</FONT>         *<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @param d    value to multiply all entries by<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @return     d * this<a name="line.80"></a>
+<FONT color="green">081</FONT>         */<a name="line.81"></a>
+<FONT color="green">082</FONT>        RealMatrix scalarMultiply(double d);<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /**<a name="line.84"></a>
+<FONT color="green">085</FONT>         * Returns the result of postmultiplying this by m.<a name="line.85"></a>
+<FONT color="green">086</FONT>         *<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @param m    matrix to postmultiply by<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @return     this * m<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @throws     IllegalArgumentException<a name="line.89"></a>
+<FONT color="green">090</FONT>         *             if columnDimension(this) != rowDimension(m)<a name="line.90"></a>
+<FONT color="green">091</FONT>         */<a name="line.91"></a>
+<FONT color="green">092</FONT>        RealMatrix multiply(RealMatrix m) throws IllegalArgumentException;<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>        /**<a name="line.94"></a>
+<FONT color="green">095</FONT>         * Returns the result premultiplying this by &lt;code&gt;m&lt;/code&gt;.<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @param m    matrix to premultiply by<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @return     m * this<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @throws     IllegalArgumentException<a name="line.98"></a>
+<FONT color="green">099</FONT>         *             if rowDimension(this) != columnDimension(m)<a name="line.99"></a>
+<FONT color="green">100</FONT>         */<a name="line.100"></a>
+<FONT color="green">101</FONT>        RealMatrix preMultiply(RealMatrix m) throws IllegalArgumentException;<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        /**<a name="line.103"></a>
+<FONT color="green">104</FONT>         * Returns matrix entries as a two-dimensional array.<a name="line.104"></a>
+<FONT color="green">105</FONT>         *<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @return    2-dimensional array of entries<a name="line.106"></a>
+<FONT color="green">107</FONT>         */<a name="line.107"></a>
+<FONT color="green">108</FONT>        double[][] getData();<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>        /**<a name="line.110"></a>
+<FONT color="green">111</FONT>         * Returns the &lt;a href="http://mathworld.wolfram.com/MaximumAbsoluteRowSumNorm.html"&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>         * maximum absolute row sum norm&lt;/a&gt; of the matrix.<a name="line.112"></a>
+<FONT color="green">113</FONT>         *<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @return norm<a name="line.114"></a>
+<FONT color="green">115</FONT>         */<a name="line.115"></a>
+<FONT color="green">116</FONT>        double getNorm();<a name="line.116"></a>
+<FONT color="green">117</FONT>    <a name="line.117"></a>
+<FONT color="green">118</FONT>        /**<a name="line.118"></a>
+<FONT color="green">119</FONT>         * Returns the &lt;a href="http://mathworld.wolfram.com/FrobeniusNorm.html"&gt;<a name="line.119"></a>
+<FONT color="green">120</FONT>         * Frobenius norm&lt;/a&gt; of the matrix.<a name="line.120"></a>
+<FONT color="green">121</FONT>         *<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @return norm<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        double getFrobeniusNorm();<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>        /**<a name="line.126"></a>
+<FONT color="green">127</FONT>         * Gets a submatrix. Rows and columns are indicated<a name="line.127"></a>
+<FONT color="green">128</FONT>         * counting from 0 to n-1.<a name="line.128"></a>
+<FONT color="green">129</FONT>         *<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @param startRow Initial row index<a name="line.130"></a>
+<FONT color="green">131</FONT>         * @param endRow Final row index (inclusive)<a name="line.131"></a>
+<FONT color="green">132</FONT>         * @param startColumn Initial column index<a name="line.132"></a>
+<FONT color="green">133</FONT>         * @param endColumn Final column index (inclusive)<a name="line.133"></a>
+<FONT color="green">134</FONT>         * @return The subMatrix containing the data of the<a name="line.134"></a>
+<FONT color="green">135</FONT>         *         specified rows and columns<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @exception MatrixIndexException  if the indices are not valid<a name="line.136"></a>
+<FONT color="green">137</FONT>         */<a name="line.137"></a>
+<FONT color="green">138</FONT>       RealMatrix getSubMatrix(int startRow, int endRow, int startColumn, int endColumn)<a name="line.138"></a>
+<FONT color="green">139</FONT>           throws MatrixIndexException;<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>       /**<a name="line.141"></a>
+<FONT color="green">142</FONT>        * Gets a submatrix. Rows and columns are indicated<a name="line.142"></a>
+<FONT color="green">143</FONT>        * counting from 0 to n-1.<a name="line.143"></a>
+<FONT color="green">144</FONT>        *<a name="line.144"></a>
+<FONT color="green">145</FONT>        * @param selectedRows Array of row indices.<a name="line.145"></a>
+<FONT color="green">146</FONT>        * @param selectedColumns Array of column indices.<a name="line.146"></a>
+<FONT color="green">147</FONT>        * @return The subMatrix containing the data in the<a name="line.147"></a>
+<FONT color="green">148</FONT>        *         specified rows and columns<a name="line.148"></a>
+<FONT color="green">149</FONT>        * @exception MatrixIndexException if row or column selections are not valid<a name="line.149"></a>
+<FONT color="green">150</FONT>        */<a name="line.150"></a>
+<FONT color="green">151</FONT>       RealMatrix getSubMatrix(int[] selectedRows, int[] selectedColumns)<a name="line.151"></a>
+<FONT color="green">152</FONT>           throws MatrixIndexException;<a name="line.152"></a>
+<FONT color="green">153</FONT>    <a name="line.153"></a>
+<FONT color="green">154</FONT>       /**<a name="line.154"></a>
+<FONT color="green">155</FONT>        * Copy a submatrix. Rows and columns are indicated<a name="line.155"></a>
+<FONT color="green">156</FONT>        * counting from 0 to n-1.<a name="line.156"></a>
+<FONT color="green">157</FONT>        *<a name="line.157"></a>
+<FONT color="green">158</FONT>        * @param startRow Initial row index<a name="line.158"></a>
+<FONT color="green">159</FONT>        * @param endRow Final row index (inclusive)<a name="line.159"></a>
+<FONT color="green">160</FONT>        * @param startColumn Initial column index<a name="line.160"></a>
+<FONT color="green">161</FONT>        * @param endColumn Final column index (inclusive)<a name="line.161"></a>
+<FONT color="green">162</FONT>        * @param destination The arrays where the submatrix data should be copied<a name="line.162"></a>
+<FONT color="green">163</FONT>        * (if larger than rows/columns counts, only the upper-left part will be used)<a name="line.163"></a>
+<FONT color="green">164</FONT>        * @exception MatrixIndexException if the indices are not valid<a name="line.164"></a>
+<FONT color="green">165</FONT>        * @exception IllegalArgumentException if the destination array is too small<a name="line.165"></a>
+<FONT color="green">166</FONT>        */<a name="line.166"></a>
+<FONT color="green">167</FONT>      void copySubMatrix(int startRow, int endRow, int startColumn, int endColumn,<a name="line.167"></a>
+<FONT color="green">168</FONT>                         double[][] destination)<a name="line.168"></a>
+<FONT color="green">169</FONT>          throws MatrixIndexException, IllegalArgumentException;<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>      /**<a name="line.171"></a>
+<FONT color="green">172</FONT>       * Copy a submatrix. Rows and columns are indicated<a name="line.172"></a>
+<FONT color="green">173</FONT>       * counting from 0 to n-1.<a name="line.173"></a>
+<FONT color="green">174</FONT>       *<a name="line.174"></a>
+<FONT color="green">175</FONT>        * @param selectedRows Array of row indices.<a name="line.175"></a>
+<FONT color="green">176</FONT>        * @param selectedColumns Array of column indices.<a name="line.176"></a>
+<FONT color="green">177</FONT>       * @param destination The arrays where the submatrix data should be copied<a name="line.177"></a>
+<FONT color="green">178</FONT>       * (if larger than rows/columns counts, only the upper-left part will be used)<a name="line.178"></a>
+<FONT color="green">179</FONT>       * @exception MatrixIndexException if the indices are not valid<a name="line.179"></a>
+<FONT color="green">180</FONT>       * @exception IllegalArgumentException if the destination array is too small<a name="line.180"></a>
+<FONT color="green">181</FONT>       */<a name="line.181"></a>
+<FONT color="green">182</FONT>      void copySubMatrix(int[] selectedRows, int[] selectedColumns, double[][] destination)<a name="line.182"></a>
+<FONT color="green">183</FONT>          throws MatrixIndexException, IllegalArgumentException;<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>       /**<a name="line.185"></a>
+<FONT color="green">186</FONT>        * Replace the submatrix starting at &lt;code&gt;row, column&lt;/code&gt; using data in<a name="line.186"></a>
+<FONT color="green">187</FONT>        * the input &lt;code&gt;subMatrix&lt;/code&gt; array. Indexes are 0-based.<a name="line.187"></a>
+<FONT color="green">188</FONT>        * &lt;p&gt;<a name="line.188"></a>
+<FONT color="green">189</FONT>        * Example:&lt;br&gt;<a name="line.189"></a>
+<FONT color="green">190</FONT>        * Starting with &lt;pre&gt;<a name="line.190"></a>
+<FONT color="green">191</FONT>        * 1  2  3  4<a name="line.191"></a>
+<FONT color="green">192</FONT>        * 5  6  7  8<a name="line.192"></a>
+<FONT color="green">193</FONT>        * 9  0  1  2<a name="line.193"></a>
+<FONT color="green">194</FONT>        * &lt;/pre&gt;<a name="line.194"></a>
+<FONT color="green">195</FONT>        * and &lt;code&gt;subMatrix = {{3, 4} {5,6}}&lt;/code&gt;, invoking<a name="line.195"></a>
+<FONT color="green">196</FONT>        * &lt;code&gt;setSubMatrix(subMatrix,1,1))&lt;/code&gt; will result in &lt;pre&gt;<a name="line.196"></a>
+<FONT color="green">197</FONT>        * 1  2  3  4<a name="line.197"></a>
+<FONT color="green">198</FONT>        * 5  3  4  8<a name="line.198"></a>
+<FONT color="green">199</FONT>        * 9  5  6  2<a name="line.199"></a>
+<FONT color="green">200</FONT>        * &lt;/pre&gt;&lt;/p&gt;<a name="line.200"></a>
+<FONT color="green">201</FONT>        *<a name="line.201"></a>
+<FONT color="green">202</FONT>        * @param subMatrix  array containing the submatrix replacement data<a name="line.202"></a>
+<FONT color="green">203</FONT>        * @param row  row coordinate of the top, left element to be replaced<a name="line.203"></a>
+<FONT color="green">204</FONT>        * @param column  column coordinate of the top, left element to be replaced<a name="line.204"></a>
+<FONT color="green">205</FONT>        * @throws MatrixIndexException  if subMatrix does not fit into this<a name="line.205"></a>
+<FONT color="green">206</FONT>        *    matrix from element in (row, column)<a name="line.206"></a>
+<FONT color="green">207</FONT>        * @throws IllegalArgumentException if &lt;code&gt;subMatrix&lt;/code&gt; is not rectangular<a name="line.207"></a>
+<FONT color="green">208</FONT>        *  (not all rows have the same length) or empty<a name="line.208"></a>
+<FONT color="green">209</FONT>        * @throws NullPointerException if &lt;code&gt;subMatrix&lt;/code&gt; is null<a name="line.209"></a>
+<FONT color="green">210</FONT>        * @since 2.0<a name="line.210"></a>
+<FONT color="green">211</FONT>        */<a name="line.211"></a>
+<FONT color="green">212</FONT>       void setSubMatrix(double[][] subMatrix, int row, int column)<a name="line.212"></a>
+<FONT color="green">213</FONT>           throws MatrixIndexException;<a name="line.213"></a>
+<FONT color="green">214</FONT>    <a name="line.214"></a>
+<FONT color="green">215</FONT>       /**<a name="line.215"></a>
+<FONT color="green">216</FONT>        * Returns the entries in row number &lt;code&gt;row&lt;/code&gt;<a name="line.216"></a>
+<FONT color="green">217</FONT>        * as a row matrix.  Row indices start at 0.<a name="line.217"></a>
+<FONT color="green">218</FONT>        *<a name="line.218"></a>
+<FONT color="green">219</FONT>        * @param row the row to be fetched<a name="line.219"></a>
+<FONT color="green">220</FONT>        * @return row matrix<a name="line.220"></a>
+<FONT color="green">221</FONT>        * @throws MatrixIndexException if the specified row index is invalid<a name="line.221"></a>
+<FONT color="green">222</FONT>        */<a name="line.222"></a>
+<FONT color="green">223</FONT>       RealMatrix getRowMatrix(int row) throws MatrixIndexException;<a name="line.223"></a>
+<FONT color="green">224</FONT>    <a name="line.224"></a>
+<FONT color="green">225</FONT>       /**<a name="line.225"></a>
+<FONT color="green">226</FONT>        * Sets the entries in row number &lt;code&gt;row&lt;/code&gt;<a name="line.226"></a>
+<FONT color="green">227</FONT>        * as a row matrix.  Row indices start at 0.<a name="line.227"></a>
+<FONT color="green">228</FONT>        *<a name="line.228"></a>
+<FONT color="green">229</FONT>        * @param row the row to be set<a name="line.229"></a>
+<FONT color="green">230</FONT>        * @param matrix row matrix (must have one row and the same number of columns<a name="line.230"></a>
+<FONT color="green">231</FONT>        * as the instance)<a name="line.231"></a>
+<FONT color="green">232</FONT>        * @throws MatrixIndexException if the specified row index is invalid<a name="line.232"></a>
+<FONT color="green">233</FONT>        * @throws InvalidMatrixException if the matrix dimensions do not match one<a name="line.233"></a>
+<FONT color="green">234</FONT>        * instance row<a name="line.234"></a>
+<FONT color="green">235</FONT>        */<a name="line.235"></a>
+<FONT color="green">236</FONT>       void setRowMatrix(int row, RealMatrix matrix)<a name="line.236"></a>
+<FONT color="green">237</FONT>           throws MatrixIndexException, InvalidMatrixException;<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>       /**<a name="line.239"></a>
+<FONT color="green">240</FONT>        * Returns the entries in column number &lt;code&gt;column&lt;/code&gt;<a name="line.240"></a>
+<FONT color="green">241</FONT>        * as a column matrix.  Column indices start at 0.<a name="line.241"></a>
+<FONT color="green">242</FONT>        *<a name="line.242"></a>
+<FONT color="green">243</FONT>        * @param column the column to be fetched<a name="line.243"></a>
+<FONT color="green">244</FONT>        * @return column matrix<a name="line.244"></a>
+<FONT color="green">245</FONT>        * @throws MatrixIndexException if the specified column index is invalid<a name="line.245"></a>
+<FONT color="green">246</FONT>        */<a name="line.246"></a>
+<FONT color="green">247</FONT>       RealMatrix getColumnMatrix(int column) throws MatrixIndexException;<a name="line.247"></a>
+<FONT color="green">248</FONT>    <a name="line.248"></a>
+<FONT color="green">249</FONT>       /**<a name="line.249"></a>
+<FONT color="green">250</FONT>        * Sets the entries in column number &lt;code&gt;column&lt;/code&gt;<a name="line.250"></a>
+<FONT color="green">251</FONT>        * as a column matrix.  Column indices start at 0.<a name="line.251"></a>
+<FONT color="green">252</FONT>        *<a name="line.252"></a>
+<FONT color="green">253</FONT>        * @param column the column to be set<a name="line.253"></a>
+<FONT color="green">254</FONT>        * @param matrix column matrix (must have one column and the same number of rows<a name="line.254"></a>
+<FONT color="green">255</FONT>        * as the instance)<a name="line.255"></a>
+<FONT color="green">256</FONT>        * @throws MatrixIndexException if the specified column index is invalid<a name="line.256"></a>
+<FONT color="green">257</FONT>        * @throws InvalidMatrixException if the matrix dimensions do not match one<a name="line.257"></a>
+<FONT color="green">258</FONT>        * instance column<a name="line.258"></a>
+<FONT color="green">259</FONT>        */<a name="line.259"></a>
+<FONT color="green">260</FONT>       void setColumnMatrix(int column, RealMatrix matrix)<a name="line.260"></a>
+<FONT color="green">261</FONT>           throws MatrixIndexException, InvalidMatrixException;<a name="line.261"></a>
+<FONT color="green">262</FONT>    <a name="line.262"></a>
+<FONT color="green">263</FONT>       /**<a name="line.263"></a>
+<FONT color="green">264</FONT>        * Returns the entries in row number &lt;code&gt;row&lt;/code&gt;<a name="line.264"></a>
+<FONT color="green">265</FONT>        * as a vector.  Row indices start at 0.<a name="line.265"></a>
+<FONT color="green">266</FONT>        *<a name="line.266"></a>
+<FONT color="green">267</FONT>        * @param row the row to be fetched<a name="line.267"></a>
+<FONT color="green">268</FONT>        * @return row vector<a name="line.268"></a>
+<FONT color="green">269</FONT>        * @throws MatrixIndexException if the specified row index is invalid<a name="line.269"></a>
+<FONT color="green">270</FONT>        */<a name="line.270"></a>
+<FONT color="green">271</FONT>       RealVector getRowVector(int row) throws MatrixIndexException;<a name="line.271"></a>
+<FONT color="green">272</FONT>    <a name="line.272"></a>
+<FONT color="green">273</FONT>       /**<a name="line.273"></a>
+<FONT color="green">274</FONT>        * Sets the entries in row number &lt;code&gt;row&lt;/code&gt;<a name="line.274"></a>
+<FONT color="green">275</FONT>        * as a vector.  Row indices start at 0.<a name="line.275"></a>
+<FONT color="green">276</FONT>        *<a name="line.276"></a>
+<FONT color="green">277</FONT>        * @param row the row to be set<a name="line.277"></a>
+<FONT color="green">278</FONT>        * @param vector row vector (must have the same number of columns<a name="line.278"></a>
+<FONT color="green">279</FONT>        * as the instance)<a name="line.279"></a>
+<FONT color="green">280</FONT>        * @throws MatrixIndexException if the specified row index is invalid<a name="line.280"></a>
+<FONT color="green">281</FONT>        * @throws InvalidMatrixException if the vector dimension does not match one<a name="line.281"></a>
+<FONT color="green">282</FONT>        * instance row<a name="line.282"></a>
+<FONT color="green">283</FONT>        */<a name="line.283"></a>
+<FONT color="green">284</FONT>       void setRowVector(int row, RealVector vector)<a name="line.284"></a>
+<FONT color="green">285</FONT>           throws MatrixIndexException, InvalidMatrixException;<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>       /**<a name="line.287"></a>
+<FONT color="green">288</FONT>        * Returns the entries in column number &lt;code&gt;column&lt;/code&gt;<a name="line.288"></a>
+<FONT color="green">289</FONT>        * as a vector.  Column indices start at 0.<a name="line.289"></a>
+<FONT color="green">290</FONT>        *<a name="line.290"></a>
+<FONT color="green">291</FONT>        * @param column the column to be fetched<a name="line.291"></a>
+<FONT color="green">292</FONT>        * @return column vector<a name="line.292"></a>
+<FONT color="green">293</FONT>        * @throws MatrixIndexException if the specified column index is invalid<a name="line.293"></a>
+<FONT color="green">294</FONT>        */<a name="line.294"></a>
+<FONT color="green">295</FONT>       RealVector getColumnVector(int column) throws MatrixIndexException;<a name="line.295"></a>
+<FONT color="green">296</FONT>    <a name="line.296"></a>
+<FONT color="green">297</FONT>       /**<a name="line.297"></a>
+<FONT color="green">298</FONT>        * Sets the entries in column number &lt;code&gt;column&lt;/code&gt;<a name="line.298"></a>
+<FONT color="green">299</FONT>        * as a vector.  Column indices start at 0.<a name="line.299"></a>
+<FONT color="green">300</FONT>        *<a name="line.300"></a>
+<FONT color="green">301</FONT>        * @param column the column to be set<a name="line.301"></a>
+<FONT color="green">302</FONT>        * @param vector column vector (must have the same number of rows as the instance)<a name="line.302"></a>
+<FONT color="green">303</FONT>        * @throws MatrixIndexException if the specified column index is invalid<a name="line.303"></a>
+<FONT color="green">304</FONT>        * @throws InvalidMatrixException if the vector dimension does not match one<a name="line.304"></a>
+<FONT color="green">305</FONT>        * instance column<a name="line.305"></a>
+<FONT color="green">306</FONT>        */<a name="line.306"></a>
+<FONT color="green">307</FONT>       void setColumnVector(int column, RealVector vector)<a name="line.307"></a>
+<FONT color="green">308</FONT>           throws MatrixIndexException, InvalidMatrixException;<a name="line.308"></a>
+<FONT color="green">309</FONT>    <a name="line.309"></a>
+<FONT color="green">310</FONT>        /**<a name="line.310"></a>
+<FONT color="green">311</FONT>         * Returns the entries in row number &lt;code&gt;row&lt;/code&gt; as an array.<a name="line.311"></a>
+<FONT color="green">312</FONT>         * &lt;p&gt;<a name="line.312"></a>
+<FONT color="green">313</FONT>         * Row indices start at 0.  A &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown<a name="line.313"></a>
+<FONT color="green">314</FONT>         * unless &lt;code&gt;0 &lt;= row &lt; rowDimension.&lt;/code&gt;&lt;/p&gt;<a name="line.314"></a>
+<FONT color="green">315</FONT>         *<a name="line.315"></a>
+<FONT color="green">316</FONT>         * @param row the row to be fetched<a name="line.316"></a>
+<FONT color="green">317</FONT>         * @return array of entries in the row<a name="line.317"></a>
+<FONT color="green">318</FONT>         * @throws MatrixIndexException if the specified row index is not valid<a name="line.318"></a>
+<FONT color="green">319</FONT>         */<a name="line.319"></a>
+<FONT color="green">320</FONT>        double[] getRow(int row) throws MatrixIndexException;<a name="line.320"></a>
+<FONT color="green">321</FONT>    <a name="line.321"></a>
+<FONT color="green">322</FONT>        /**<a name="line.322"></a>
+<FONT color="green">323</FONT>         * Sets the entries in row number &lt;code&gt;row&lt;/code&gt;<a name="line.323"></a>
+<FONT color="green">324</FONT>         * as a row matrix.  Row indices start at 0.<a name="line.324"></a>
+<FONT color="green">325</FONT>         *<a name="line.325"></a>
+<FONT color="green">326</FONT>         * @param row the row to be set<a name="line.326"></a>
+<FONT color="green">327</FONT>         * @param array row matrix (must have the same number of columns as the instance)<a name="line.327"></a>
+<FONT color="green">328</FONT>         * @throws MatrixIndexException if the specified row index is invalid<a name="line.328"></a>
+<FONT color="green">329</FONT>         * @throws InvalidMatrixException if the array size does not match one<a name="line.329"></a>
+<FONT color="green">330</FONT>         * instance row<a name="line.330"></a>
+<FONT color="green">331</FONT>         */<a name="line.331"></a>
+<FONT color="green">332</FONT>        void setRow(int row, double[] array)<a name="line.332"></a>
+<FONT color="green">333</FONT>            throws MatrixIndexException, InvalidMatrixException;<a name="line.333"></a>
+<FONT color="green">334</FONT>    <a name="line.334"></a>
+<FONT color="green">335</FONT>        /**<a name="line.335"></a>
+<FONT color="green">336</FONT>         * Returns the entries in column number &lt;code&gt;col&lt;/code&gt; as an array.<a name="line.336"></a>
+<FONT color="green">337</FONT>         * &lt;p&gt;<a name="line.337"></a>
+<FONT color="green">338</FONT>         * Column indices start at 0.  A &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown<a name="line.338"></a>
+<FONT color="green">339</FONT>         * unless &lt;code&gt;0 &lt;= column &lt; columnDimension.&lt;/code&gt;&lt;/p&gt;<a name="line.339"></a>
+<FONT color="green">340</FONT>         *<a name="line.340"></a>
+<FONT color="green">341</FONT>         * @param column the column to be fetched<a name="line.341"></a>
+<FONT color="green">342</FONT>         * @return array of entries in the column<a name="line.342"></a>
+<FONT color="green">343</FONT>         * @throws MatrixIndexException if the specified column index is not valid<a name="line.343"></a>
+<FONT color="green">344</FONT>         */<a name="line.344"></a>
+<FONT color="green">345</FONT>        double[] getColumn(int column) throws MatrixIndexException;<a name="line.345"></a>
+<FONT color="green">346</FONT>    <a name="line.346"></a>
+<FONT color="green">347</FONT>        /**<a name="line.347"></a>
+<FONT color="green">348</FONT>         * Sets the entries in column number &lt;code&gt;column&lt;/code&gt;<a name="line.348"></a>
+<FONT color="green">349</FONT>         * as a column matrix.  Column indices start at 0.<a name="line.349"></a>
+<FONT color="green">350</FONT>         *<a name="line.350"></a>
+<FONT color="green">351</FONT>         * @param column the column to be set<a name="line.351"></a>
+<FONT color="green">352</FONT>         * @param array column array (must have the same number of rows as the instance)<a name="line.352"></a>
+<FONT color="green">353</FONT>         * @throws MatrixIndexException if the specified column index is invalid<a name="line.353"></a>
+<FONT color="green">354</FONT>         * @throws InvalidMatrixException if the array size does not match one<a name="line.354"></a>
+<FONT color="green">355</FONT>         * instance column<a name="line.355"></a>
+<FONT color="green">356</FONT>         */<a name="line.356"></a>
+<FONT color="green">357</FONT>        void setColumn(int column, double[] array)<a name="line.357"></a>
+<FONT color="green">358</FONT>            throws MatrixIndexException, InvalidMatrixException;<a name="line.358"></a>
+<FONT color="green">359</FONT>    <a name="line.359"></a>
+<FONT color="green">360</FONT>        /**<a name="line.360"></a>
+<FONT color="green">361</FONT>         * Returns the entry in the specified row and column.<a name="line.361"></a>
+<FONT color="green">362</FONT>         * &lt;p&gt;<a name="line.362"></a>
+<FONT color="green">363</FONT>         * Row and column indices start at 0 and must satisfy<a name="line.363"></a>
+<FONT color="green">364</FONT>         * &lt;ul&gt;<a name="line.364"></a>
+<FONT color="green">365</FONT>         * &lt;li&gt;&lt;code&gt;0 &lt;= row &lt; rowDimension&lt;/code&gt;&lt;/li&gt;<a name="line.365"></a>
+<FONT color="green">366</FONT>         * &lt;li&gt;&lt;code&gt; 0 &lt;= column &lt; columnDimension&lt;/code&gt;&lt;/li&gt;<a name="line.366"></a>
+<FONT color="green">367</FONT>         * &lt;/ul&gt;<a name="line.367"></a>
+<FONT color="green">368</FONT>         * otherwise a &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.368"></a>
+<FONT color="green">369</FONT>         *<a name="line.369"></a>
+<FONT color="green">370</FONT>         * @param row  row location of entry to be fetched<a name="line.370"></a>
+<FONT color="green">371</FONT>         * @param column  column location of entry to be fetched<a name="line.371"></a>
+<FONT color="green">372</FONT>         * @return matrix entry in row,column<a name="line.372"></a>
+<FONT color="green">373</FONT>         * @throws MatrixIndexException if the row or column index is not valid<a name="line.373"></a>
+<FONT color="green">374</FONT>         */<a name="line.374"></a>
+<FONT color="green">375</FONT>        double getEntry(int row, int column) throws MatrixIndexException;<a name="line.375"></a>
+<FONT color="green">376</FONT>    <a name="line.376"></a>
+<FONT color="green">377</FONT>        /**<a name="line.377"></a>
+<FONT color="green">378</FONT>         * Set the entry in the specified row and column.<a name="line.378"></a>
+<FONT color="green">379</FONT>         * &lt;p&gt;<a name="line.379"></a>
+<FONT color="green">380</FONT>         * Row and column indices start at 0 and must satisfy<a name="line.380"></a>
+<FONT color="green">381</FONT>         * &lt;ul&gt;<a name="line.381"></a>
+<FONT color="green">382</FONT>         * &lt;li&gt;&lt;code&gt;0 &lt;= row &lt; rowDimension&lt;/code&gt;&lt;/li&gt;<a name="line.382"></a>
+<FONT color="green">383</FONT>         * &lt;li&gt;&lt;code&gt; 0 &lt;= column &lt; columnDimension&lt;/code&gt;&lt;/li&gt;<a name="line.383"></a>
+<FONT color="green">384</FONT>         * &lt;/ul&gt;<a name="line.384"></a>
+<FONT color="green">385</FONT>         * otherwise a &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.385"></a>
+<FONT color="green">386</FONT>         *<a name="line.386"></a>
+<FONT color="green">387</FONT>         * @param row  row location of entry to be set<a name="line.387"></a>
+<FONT color="green">388</FONT>         * @param column  column location of entry to be set<a name="line.388"></a>
+<FONT color="green">389</FONT>         * @param value matrix entry to be set in row,column<a name="line.389"></a>
+<FONT color="green">390</FONT>         * @throws MatrixIndexException if the row or column index is not valid<a name="line.390"></a>
+<FONT color="green">391</FONT>         * @since 2.0<a name="line.391"></a>
+<FONT color="green">392</FONT>         */<a name="line.392"></a>
+<FONT color="green">393</FONT>        void setEntry(int row, int column, double value) throws MatrixIndexException;<a name="line.393"></a>
+<FONT color="green">394</FONT>    <a name="line.394"></a>
+<FONT color="green">395</FONT>        /**<a name="line.395"></a>
+<FONT color="green">396</FONT>         * Change an entry in the specified row and column.<a name="line.396"></a>
+<FONT color="green">397</FONT>         * &lt;p&gt;<a name="line.397"></a>
+<FONT color="green">398</FONT>         * Row and column indices start at 0 and must satisfy<a name="line.398"></a>
+<FONT color="green">399</FONT>         * &lt;ul&gt;<a name="line.399"></a>
+<FONT color="green">400</FONT>         * &lt;li&gt;&lt;code&gt;0 &lt;= row &lt; rowDimension&lt;/code&gt;&lt;/li&gt;<a name="line.400"></a>
+<FONT color="green">401</FONT>         * &lt;li&gt;&lt;code&gt; 0 &lt;= column &lt; columnDimension&lt;/code&gt;&lt;/li&gt;<a name="line.401"></a>
+<FONT color="green">402</FONT>         * &lt;/ul&gt;<a name="line.402"></a>
+<FONT color="green">403</FONT>         * otherwise a &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.403"></a>
+<FONT color="green">404</FONT>         *<a name="line.404"></a>
+<FONT color="green">405</FONT>         * @param row  row location of entry to be set<a name="line.405"></a>
+<FONT color="green">406</FONT>         * @param column  column location of entry to be set<a name="line.406"></a>
+<FONT color="green">407</FONT>         * @param increment value to add to the current matrix entry in row,column<a name="line.407"></a>
+<FONT color="green">408</FONT>         * @throws MatrixIndexException if the row or column index is not valid<a name="line.408"></a>
+<FONT color="green">409</FONT>         * @since 2.0<a name="line.409"></a>
+<FONT color="green">410</FONT>         */<a name="line.410"></a>
+<FONT color="green">411</FONT>        void addToEntry(int row, int column, double increment) throws MatrixIndexException;<a name="line.411"></a>
+<FONT color="green">412</FONT>    <a name="line.412"></a>
+<FONT color="green">413</FONT>        /**<a name="line.413"></a>
+<FONT color="green">414</FONT>         * Change an entry in the specified row and column.<a name="line.414"></a>
+<FONT color="green">415</FONT>         * &lt;p&gt;<a name="line.415"></a>
+<FONT color="green">416</FONT>         * Row and column indices start at 0 and must satisfy<a name="line.416"></a>
+<FONT color="green">417</FONT>         * &lt;ul&gt;<a name="line.417"></a>
+<FONT color="green">418</FONT>         * &lt;li&gt;&lt;code&gt;0 &lt;= row &lt; rowDimension&lt;/code&gt;&lt;/li&gt;<a name="line.418"></a>
+<FONT color="green">419</FONT>         * &lt;li&gt;&lt;code&gt; 0 &lt;= column &lt; columnDimension&lt;/code&gt;&lt;/li&gt;<a name="line.419"></a>
+<FONT color="green">420</FONT>         * &lt;/ul&gt;<a name="line.420"></a>
+<FONT color="green">421</FONT>         * otherwise a &lt;code&gt;MatrixIndexException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.421"></a>
+<FONT color="green">422</FONT>         *<a name="line.422"></a>
+<FONT color="green">423</FONT>         * @param row  row location of entry to be set<a name="line.423"></a>
+<FONT color="green">424</FONT>         * @param column  column location of entry to be set<a name="line.424"></a>
+<FONT color="green">425</FONT>         * @param factor multiplication factor for the current matrix entry in row,column<a name="line.425"></a>
+<FONT color="green">426</FONT>         * @throws MatrixIndexException if the row or column index is not valid<a name="line.426"></a>
+<FONT color="green">427</FONT>         * @since 2.0<a name="line.427"></a>
+<FONT color="green">428</FONT>         */<a name="line.428"></a>
+<FONT color="green">429</FONT>        void multiplyEntry(int row, int column, double factor) throws MatrixIndexException;<a name="line.429"></a>
+<FONT color="green">430</FONT>    <a name="line.430"></a>
+<FONT color="green">431</FONT>        /**<a name="line.431"></a>
+<FONT color="green">432</FONT>         * Returns the transpose of this matrix.<a name="line.432"></a>
+<FONT color="green">433</FONT>         *<a name="line.433"></a>
+<FONT color="green">434</FONT>         * @return transpose matrix<a name="line.434"></a>
+<FONT color="green">435</FONT>         */<a name="line.435"></a>
+<FONT color="green">436</FONT>        RealMatrix transpose();<a name="line.436"></a>
+<FONT color="green">437</FONT>    <a name="line.437"></a>
+<FONT color="green">438</FONT>        /**<a name="line.438"></a>
+<FONT color="green">439</FONT>         * Returns the inverse of this matrix.<a name="line.439"></a>
+<FONT color="green">440</FONT>         *<a name="line.440"></a>
+<FONT color="green">441</FONT>         * @return inverse matrix<a name="line.441"></a>
+<FONT color="green">442</FONT>         * @throws InvalidMatrixException if  this is not invertible<a name="line.442"></a>
+<FONT color="green">443</FONT>         * @deprecated as of release 2.0, replaced by &lt;code&gt;<a name="line.443"></a>
+<FONT color="green">444</FONT>         * {@link LUDecompositionImpl#LUDecompositionImpl(RealMatrix)<a name="line.444"></a>
+<FONT color="green">445</FONT>         * new LUDecompositionImpl(m)}.{@link LUDecomposition#getSolver()<a name="line.445"></a>
+<FONT color="green">446</FONT>         * getSolver()}.{@link DecompositionSolver#getInverse()<a name="line.446"></a>
+<FONT color="green">447</FONT>         * getInverse()}&lt;/code&gt;<a name="line.447"></a>
+<FONT color="green">448</FONT>         */<a name="line.448"></a>
+<FONT color="green">449</FONT>        @Deprecated<a name="line.449"></a>
+<FONT color="green">450</FONT>        RealMatrix inverse() throws InvalidMatrixException;<a name="line.450"></a>
+<FONT color="green">451</FONT>    <a name="line.451"></a>
+<FONT color="green">452</FONT>        /**<a name="line.452"></a>
+<FONT color="green">453</FONT>         * Returns the determinant of this matrix.<a name="line.453"></a>
+<FONT color="green">454</FONT>         *<a name="line.454"></a>
+<FONT color="green">455</FONT>         * @return determinant<a name="line.455"></a>
+<FONT color="green">456</FONT>         * @deprecated as of release 2.0, replaced by &lt;code&gt;<a name="line.456"></a>
+<FONT color="green">457</FONT>         * {@link LUDecompositionImpl#LUDecompositionImpl(RealMatrix)<a name="line.457"></a>
+<FONT color="green">458</FONT>         * new LUDecompositionImpl(m)}.{@link LUDecomposition#getDeterminant()<a name="line.458"></a>
+<FONT color="green">459</FONT>         * getDeterminant()}&lt;/code&gt;<a name="line.459"></a>
+<FONT color="green">460</FONT>         */<a name="line.460"></a>
+<FONT color="green">461</FONT>        @Deprecated<a name="line.461"></a>
+<FONT color="green">462</FONT>        double getDeterminant();<a name="line.462"></a>
+<FONT color="green">463</FONT>    <a name="line.463"></a>
+<FONT color="green">464</FONT>        /**<a name="line.464"></a>
+<FONT color="green">465</FONT>         * Is this a singular matrix?<a name="line.465"></a>
+<FONT color="green">466</FONT>         * @return true if the matrix is singular<a name="line.466"></a>
+<FONT color="green">467</FONT>         * @deprecated as of release 2.0, replaced by the boolean negation of<a name="line.467"></a>
+<FONT color="green">468</FONT>         * &lt;code&gt;{@link LUDecompositionImpl#LUDecompositionImpl(RealMatrix)<a name="line.468"></a>
+<FONT color="green">469</FONT>         * new LUDecompositionImpl(m)}.{@link LUDecomposition#getSolver()<a name="line.469"></a>
+<FONT color="green">470</FONT>         * getSolver()}.{@link DecompositionSolver#isNonSingular()<a name="line.470"></a>
+<FONT color="green">471</FONT>         * isNonSingular()}&lt;/code&gt;<a name="line.471"></a>
+<FONT color="green">472</FONT>         */<a name="line.472"></a>
+<FONT color="green">473</FONT>        @Deprecated<a name="line.473"></a>
+<FONT color="green">474</FONT>        boolean isSingular();<a name="line.474"></a>
+<FONT color="green">475</FONT>    <a name="line.475"></a>
+<FONT color="green">476</FONT>        /**<a name="line.476"></a>
+<FONT color="green">477</FONT>         * Returns the &lt;a href="http://mathworld.wolfram.com/MatrixTrace.html"&gt;<a name="line.477"></a>
+<FONT color="green">478</FONT>         * trace&lt;/a&gt; of the matrix (the sum of the elements on the main diagonal).<a name="line.478"></a>
+<FONT color="green">479</FONT>         *<a name="line.479"></a>
+<FONT color="green">480</FONT>         * @return trace<a name="line.480"></a>
+<FONT color="green">481</FONT>         * @throws NonSquareMatrixException if the matrix is not square<a name="line.481"></a>
+<FONT color="green">482</FONT>         */<a name="line.482"></a>
+<FONT color="green">483</FONT>        double getTrace() throws NonSquareMatrixException;<a name="line.483"></a>
+<FONT color="green">484</FONT>    <a name="line.484"></a>
+<FONT color="green">485</FONT>        /**<a name="line.485"></a>
+<FONT color="green">486</FONT>         * Returns the result of multiplying this by the vector &lt;code&gt;v&lt;/code&gt;.<a name="line.486"></a>
+<FONT color="green">487</FONT>         *<a name="line.487"></a>
+<FONT color="green">488</FONT>         * @param v the vector to operate on<a name="line.488"></a>
+<FONT color="green">489</FONT>         * @return this*v<a name="line.489"></a>
+<FONT color="green">490</FONT>         * @throws IllegalArgumentException if columnDimension != v.size()<a name="line.490"></a>
+<FONT color="green">491</FONT>         */<a name="line.491"></a>
+<FONT color="green">492</FONT>        double[] operate(double[] v) throws IllegalArgumentException;<a name="line.492"></a>
+<FONT color="green">493</FONT>    <a name="line.493"></a>
+<FONT color="green">494</FONT>        /**<a name="line.494"></a>
+<FONT color="green">495</FONT>         * Returns the result of multiplying this by the vector &lt;code&gt;v&lt;/code&gt;.<a name="line.495"></a>
+<FONT color="green">496</FONT>         *<a name="line.496"></a>
+<FONT color="green">497</FONT>         * @param v the vector to operate on<a name="line.497"></a>
+<FONT color="green">498</FONT>         * @return this*v<a name="line.498"></a>
+<FONT color="green">499</FONT>         * @throws IllegalArgumentException if columnDimension != v.size()<a name="line.499"></a>
+<FONT color="green">500</FONT>         */<a name="line.500"></a>
+<FONT color="green">501</FONT>        RealVector operate(RealVector v) throws IllegalArgumentException;<a name="line.501"></a>
+<FONT color="green">502</FONT>    <a name="line.502"></a>
+<FONT color="green">503</FONT>        /**<a name="line.503"></a>
+<FONT color="green">504</FONT>         * Returns the (row) vector result of premultiplying this by the vector &lt;code&gt;v&lt;/code&gt;.<a name="line.504"></a>
+<FONT color="green">505</FONT>         *<a name="line.505"></a>
+<FONT color="green">506</FONT>         * @param v the row vector to premultiply by<a name="line.506"></a>
+<FONT color="green">507</FONT>         * @return v*this<a name="line.507"></a>
+<FONT color="green">508</FONT>         * @throws IllegalArgumentException if rowDimension != v.size()<a name="line.508"></a>
+<FONT color="green">509</FONT>         */<a name="line.509"></a>
+<FONT color="green">510</FONT>        double[] preMultiply(double[] v) throws IllegalArgumentException;<a name="line.510"></a>
+<FONT color="green">511</FONT>    <a name="line.511"></a>
+<FONT color="green">512</FONT>        /**<a name="line.512"></a>
+<FONT color="green">513</FONT>         * Returns the (row) vector result of premultiplying this by the vector &lt;code&gt;v&lt;/code&gt;.<a name="line.513"></a>
+<FONT color="green">514</FONT>         *<a name="line.514"></a>
+<FONT color="green">515</FONT>         * @param v the row vector to premultiply by<a name="line.515"></a>
+<FONT color="green">516</FONT>         * @return v*this<a name="line.516"></a>
+<FONT color="green">517</FONT>         * @throws IllegalArgumentException if rowDimension != v.size()<a name="line.517"></a>
+<FONT color="green">518</FONT>         */<a name="line.518"></a>
+<FONT color="green">519</FONT>        RealVector preMultiply(RealVector v) throws IllegalArgumentException;<a name="line.519"></a>
+<FONT color="green">520</FONT>    <a name="line.520"></a>
+<FONT color="green">521</FONT>        /**<a name="line.521"></a>
+<FONT color="green">522</FONT>         * Visit (and possibly change) all matrix entries in row order.<a name="line.522"></a>
+<FONT color="green">523</FONT>         * &lt;p&gt;Row order starts at upper left and iterating through all elements<a name="line.523"></a>
+<FONT color="green">524</FONT>         * of a row from left to right before going to the leftmost element<a name="line.524"></a>
+<FONT color="green">525</FONT>         * of the next row.&lt;/p&gt;<a name="line.525"></a>
+<FONT color="green">526</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.526"></a>
+<FONT color="green">527</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.527"></a>
+<FONT color="green">528</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor)<a name="line.528"></a>
+<FONT color="green">529</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.529"></a>
+<FONT color="green">530</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.530"></a>
+<FONT color="green">531</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor)<a name="line.531"></a>
+<FONT color="green">532</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor)<a name="line.532"></a>
+<FONT color="green">533</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.533"></a>
+<FONT color="green">534</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.534"></a>
+<FONT color="green">535</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor)<a name="line.535"></a>
+<FONT color="green">536</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor)<a name="line.536"></a>
+<FONT color="green">537</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.537"></a>
+<FONT color="green">538</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.538"></a>
+<FONT color="green">539</FONT>         * @return the value returned by {@link RealMatrixChangingVisitor#end()} at the end<a name="line.539"></a>
+<FONT color="green">540</FONT>         * of the walk<a name="line.540"></a>
+<FONT color="green">541</FONT>         */<a name="line.541"></a>
+<FONT color="green">542</FONT>        double walkInRowOrder(RealMatrixChangingVisitor visitor)<a name="line.542"></a>
+<FONT color="green">543</FONT>            throws MatrixVisitorException;<a name="line.543"></a>
+<FONT color="green">544</FONT>    <a name="line.544"></a>
+<FONT color="green">545</FONT>        /**<a name="line.545"></a>
+<FONT color="green">546</FONT>         * Visit (but don't change) all matrix entries in row order.<a name="line.546"></a>
+<FONT color="green">547</FONT>         * &lt;p&gt;Row order starts at upper left and iterating through all elements<a name="line.547"></a>
+<FONT color="green">548</FONT>         * of a row from left to right before going to the leftmost element<a name="line.548"></a>
+<FONT color="green">549</FONT>         * of the next row.&lt;/p&gt;<a name="line.549"></a>
+<FONT color="green">550</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.550"></a>
+<FONT color="green">551</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.551"></a>
+<FONT color="green">552</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor)<a name="line.552"></a>
+<FONT color="green">553</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.553"></a>
+<FONT color="green">554</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.554"></a>
+<FONT color="green">555</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor)<a name="line.555"></a>
+<FONT color="green">556</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor)<a name="line.556"></a>
+<FONT color="green">557</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.557"></a>
+<FONT color="green">558</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.558"></a>
+<FONT color="green">559</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor)<a name="line.559"></a>
+<FONT color="green">560</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor)<a name="line.560"></a>
+<FONT color="green">561</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.561"></a>
+<FONT color="green">562</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.562"></a>
+<FONT color="green">563</FONT>         * @return the value returned by {@link RealMatrixPreservingVisitor#end()} at the end<a name="line.563"></a>
+<FONT color="green">564</FONT>         * of the walk<a name="line.564"></a>
+<FONT color="green">565</FONT>         */<a name="line.565"></a>
+<FONT color="green">566</FONT>        double walkInRowOrder(RealMatrixPreservingVisitor visitor)<a name="line.566"></a>
+<FONT color="green">567</FONT>            throws MatrixVisitorException;<a name="line.567"></a>
+<FONT color="green">568</FONT>    <a name="line.568"></a>
+<FONT color="green">569</FONT>        /**<a name="line.569"></a>
+<FONT color="green">570</FONT>         * Visit (and possibly change) some matrix entries in row order.<a name="line.570"></a>
+<FONT color="green">571</FONT>         * &lt;p&gt;Row order starts at upper left and iterating through all elements<a name="line.571"></a>
+<FONT color="green">572</FONT>         * of a row from left to right before going to the leftmost element<a name="line.572"></a>
+<FONT color="green">573</FONT>         * of the next row.&lt;/p&gt;<a name="line.573"></a>
+<FONT color="green">574</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.574"></a>
+<FONT color="green">575</FONT>         * @param startRow Initial row index<a name="line.575"></a>
+<FONT color="green">576</FONT>         * @param endRow Final row index (inclusive)<a name="line.576"></a>
+<FONT color="green">577</FONT>         * @param startColumn Initial column index<a name="line.577"></a>
+<FONT color="green">578</FONT>         * @param endColumn Final column index<a name="line.578"></a>
+<FONT color="green">579</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.579"></a>
+<FONT color="green">580</FONT>         * @exception MatrixIndexException  if the indices are not valid<a name="line.580"></a>
+<FONT color="green">581</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor)<a name="line.581"></a>
+<FONT color="green">582</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor)<a name="line.582"></a>
+<FONT color="green">583</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.583"></a>
+<FONT color="green">584</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor)<a name="line.584"></a>
+<FONT color="green">585</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor)<a name="line.585"></a>
+<FONT color="green">586</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.586"></a>
+<FONT color="green">587</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.587"></a>
+<FONT color="green">588</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor)<a name="line.588"></a>
+<FONT color="green">589</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor)<a name="line.589"></a>
+<FONT color="green">590</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.590"></a>
+<FONT color="green">591</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.591"></a>
+<FONT color="green">592</FONT>         * @return the value returned by {@link RealMatrixChangingVisitor#end()} at the end<a name="line.592"></a>
+<FONT color="green">593</FONT>         * of the walk<a name="line.593"></a>
+<FONT color="green">594</FONT>         */<a name="line.594"></a>
+<FONT color="green">595</FONT>        double walkInRowOrder(RealMatrixChangingVisitor visitor,<a name="line.595"></a>
+<FONT color="green">596</FONT>                              int startRow, int endRow, int startColumn, int endColumn)<a name="line.596"></a>
+<FONT color="green">597</FONT>            throws MatrixIndexException, MatrixVisitorException;<a name="line.597"></a>
+<FONT color="green">598</FONT>    <a name="line.598"></a>
+<FONT color="green">599</FONT>        /**<a name="line.599"></a>
+<FONT color="green">600</FONT>         * Visit (but don't change) some matrix entries in row order.<a name="line.600"></a>
+<FONT color="green">601</FONT>         * &lt;p&gt;Row order starts at upper left and iterating through all elements<a name="line.601"></a>
+<FONT color="green">602</FONT>         * of a row from left to right before going to the leftmost element<a name="line.602"></a>
+<FONT color="green">603</FONT>         * of the next row.&lt;/p&gt;<a name="line.603"></a>
+<FONT color="green">604</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.604"></a>
+<FONT color="green">605</FONT>         * @param startRow Initial row index<a name="line.605"></a>
+<FONT color="green">606</FONT>         * @param endRow Final row index (inclusive)<a name="line.606"></a>
+<FONT color="green">607</FONT>         * @param startColumn Initial column index<a name="line.607"></a>
+<FONT color="green">608</FONT>         * @param endColumn Final column index<a name="line.608"></a>
+<FONT color="green">609</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.609"></a>
+<FONT color="green">610</FONT>         * @exception MatrixIndexException  if the indices are not valid<a name="line.610"></a>
+<FONT color="green">611</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor)<a name="line.611"></a>
+<FONT color="green">612</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor)<a name="line.612"></a>
+<FONT color="green">613</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.613"></a>
+<FONT color="green">614</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor)<a name="line.614"></a>
+<FONT color="green">615</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor)<a name="line.615"></a>
+<FONT color="green">616</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.616"></a>
+<FONT color="green">617</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.617"></a>
+<FONT color="green">618</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor)<a name="line.618"></a>
+<FONT color="green">619</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor)<a name="line.619"></a>
+<FONT color="green">620</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.620"></a>
+<FONT color="green">621</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.621"></a>
+<FONT color="green">622</FONT>         * @return the value returned by {@link RealMatrixPreservingVisitor#end()} at the end<a name="line.622"></a>
+<FONT color="green">623</FONT>         * of the walk<a name="line.623"></a>
+<FONT color="green">624</FONT>         */<a name="line.624"></a>
+<FONT color="green">625</FONT>        double walkInRowOrder(RealMatrixPreservingVisitor visitor,<a name="line.625"></a>
+<FONT color="green">626</FONT>                              int startRow, int endRow, int startColumn, int endColumn)<a name="line.626"></a>
+<FONT color="green">627</FONT>            throws MatrixIndexException, MatrixVisitorException;<a name="line.627"></a>
+<FONT color="green">628</FONT>    <a name="line.628"></a>
+<FONT color="green">629</FONT>        /**<a name="line.629"></a>
+<FONT color="green">630</FONT>         * Visit (and possibly change) all matrix entries in column order.<a name="line.630"></a>
+<FONT color="green">631</FONT>         * &lt;p&gt;Column order starts at upper left and iterating through all elements<a name="line.631"></a>
+<FONT color="green">632</FONT>         * of a column from top to bottom before going to the topmost element<a name="line.632"></a>
+<FONT color="green">633</FONT>         * of the next column.&lt;/p&gt;<a name="line.633"></a>
+<FONT color="green">634</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.634"></a>
+<FONT color="green">635</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.635"></a>
+<FONT color="green">636</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor)<a name="line.636"></a>
+<FONT color="green">637</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor)<a name="line.637"></a>
+<FONT color="green">638</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.638"></a>
+<FONT color="green">639</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.639"></a>
+<FONT color="green">640</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor)<a name="line.640"></a>
+<FONT color="green">641</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.641"></a>
+<FONT color="green">642</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.642"></a>
+<FONT color="green">643</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor)<a name="line.643"></a>
+<FONT color="green">644</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor)<a name="line.644"></a>
+<FONT color="green">645</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.645"></a>
+<FONT color="green">646</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.646"></a>
+<FONT color="green">647</FONT>         * @return the value returned by {@link RealMatrixChangingVisitor#end()} at the end<a name="line.647"></a>
+<FONT color="green">648</FONT>         * of the walk<a name="line.648"></a>
+<FONT color="green">649</FONT>         */<a name="line.649"></a>
+<FONT color="green">650</FONT>        double walkInColumnOrder(RealMatrixChangingVisitor visitor)<a name="line.650"></a>
+<FONT color="green">651</FONT>            throws MatrixVisitorException;<a name="line.651"></a>
+<FONT color="green">652</FONT>    <a name="line.652"></a>
+<FONT color="green">653</FONT>        /**<a name="line.653"></a>
+<FONT color="green">654</FONT>         * Visit (but don't change) all matrix entries in column order.<a name="line.654"></a>
+<FONT color="green">655</FONT>         * &lt;p&gt;Column order starts at upper left and iterating through all elements<a name="line.655"></a>
+<FONT color="green">656</FONT>         * of a column from top to bottom before going to the topmost element<a name="line.656"></a>
+<FONT color="green">657</FONT>         * of the next column.&lt;/p&gt;<a name="line.657"></a>
+<FONT color="green">658</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.658"></a>
+<FONT color="green">659</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.659"></a>
+<FONT color="green">660</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor)<a name="line.660"></a>
+<FONT color="green">661</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor)<a name="line.661"></a>
+<FONT color="green">662</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.662"></a>
+<FONT color="green">663</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.663"></a>
+<FONT color="green">664</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor)<a name="line.664"></a>
+<FONT color="green">665</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.665"></a>
+<FONT color="green">666</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.666"></a>
+<FONT color="green">667</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor)<a name="line.667"></a>
+<FONT color="green">668</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor)<a name="line.668"></a>
+<FONT color="green">669</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.669"></a>
+<FONT color="green">670</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.670"></a>
+<FONT color="green">671</FONT>         * @return the value returned by {@link RealMatrixPreservingVisitor#end()} at the end<a name="line.671"></a>
+<FONT color="green">672</FONT>         * of the walk<a name="line.672"></a>
+<FONT color="green">673</FONT>         */<a name="line.673"></a>
+<FONT color="green">674</FONT>        double walkInColumnOrder(RealMatrixPreservingVisitor visitor)<a name="line.674"></a>
+<FONT color="green">675</FONT>            throws MatrixVisitorException;<a name="line.675"></a>
+<FONT color="green">676</FONT>    <a name="line.676"></a>
+<FONT color="green">677</FONT>        /**<a name="line.677"></a>
+<FONT color="green">678</FONT>         * Visit (and possibly change) some matrix entries in column order.<a name="line.678"></a>
+<FONT color="green">679</FONT>         * &lt;p&gt;Column order starts at upper left and iterating through all elements<a name="line.679"></a>
+<FONT color="green">680</FONT>         * of a column from top to bottom before going to the topmost element<a name="line.680"></a>
+<FONT color="green">681</FONT>         * of the next column.&lt;/p&gt;<a name="line.681"></a>
+<FONT color="green">682</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.682"></a>
+<FONT color="green">683</FONT>         * @param startRow Initial row index<a name="line.683"></a>
+<FONT color="green">684</FONT>         * @param endRow Final row index (inclusive)<a name="line.684"></a>
+<FONT color="green">685</FONT>         * @param startColumn Initial column index<a name="line.685"></a>
+<FONT color="green">686</FONT>         * @param endColumn Final column index<a name="line.686"></a>
+<FONT color="green">687</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.687"></a>
+<FONT color="green">688</FONT>         * @exception MatrixIndexException  if the indices are not valid<a name="line.688"></a>
+<FONT color="green">689</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor)<a name="line.689"></a>
+<FONT color="green">690</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor)<a name="line.690"></a>
+<FONT color="green">691</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.691"></a>
+<FONT color="green">692</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.692"></a>
+<FONT color="green">693</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor)<a name="line.693"></a>
+<FONT color="green">694</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor)<a name="line.694"></a>
+<FONT color="green">695</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.695"></a>
+<FONT color="green">696</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor)<a name="line.696"></a>
+<FONT color="green">697</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor)<a name="line.697"></a>
+<FONT color="green">698</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.698"></a>
+<FONT color="green">699</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.699"></a>
+<FONT color="green">700</FONT>         * @return the value returned by {@link RealMatrixChangingVisitor#end()} at the end<a name="line.700"></a>
+<FONT color="green">701</FONT>         * of the walk<a name="line.701"></a>
+<FONT color="green">702</FONT>         */<a name="line.702"></a>
+<FONT color="green">703</FONT>        double walkInColumnOrder(RealMatrixChangingVisitor visitor,<a name="line.703"></a>
+<FONT color="green">704</FONT>                                 int startRow, int endRow, int startColumn, int endColumn)<a name="line.704"></a>
+<FONT color="green">705</FONT>            throws MatrixIndexException, MatrixVisitorException;<a name="line.705"></a>
+<FONT color="green">706</FONT>    <a name="line.706"></a>
+<FONT color="green">707</FONT>        /**<a name="line.707"></a>
+<FONT color="green">708</FONT>         * Visit (but don't change) some matrix entries in column order.<a name="line.708"></a>
+<FONT color="green">709</FONT>         * &lt;p&gt;Column order starts at upper left and iterating through all elements<a name="line.709"></a>
+<FONT color="green">710</FONT>         * of a column from top to bottom before going to the topmost element<a name="line.710"></a>
+<FONT color="green">711</FONT>         * of the next column.&lt;/p&gt;<a name="line.711"></a>
+<FONT color="green">712</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.712"></a>
+<FONT color="green">713</FONT>         * @param startRow Initial row index<a name="line.713"></a>
+<FONT color="green">714</FONT>         * @param endRow Final row index (inclusive)<a name="line.714"></a>
+<FONT color="green">715</FONT>         * @param startColumn Initial column index<a name="line.715"></a>
+<FONT color="green">716</FONT>         * @param endColumn Final column index<a name="line.716"></a>
+<FONT color="green">717</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.717"></a>
+<FONT color="green">718</FONT>         * @exception MatrixIndexException  if the indices are not valid<a name="line.718"></a>
+<FONT color="green">719</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor)<a name="line.719"></a>
+<FONT color="green">720</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor)<a name="line.720"></a>
+<FONT color="green">721</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.721"></a>
+<FONT color="green">722</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.722"></a>
+<FONT color="green">723</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor)<a name="line.723"></a>
+<FONT color="green">724</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor)<a name="line.724"></a>
+<FONT color="green">725</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.725"></a>
+<FONT color="green">726</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor)<a name="line.726"></a>
+<FONT color="green">727</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor)<a name="line.727"></a>
+<FONT color="green">728</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.728"></a>
+<FONT color="green">729</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.729"></a>
+<FONT color="green">730</FONT>         * @return the value returned by {@link RealMatrixPreservingVisitor#end()} at the end<a name="line.730"></a>
+<FONT color="green">731</FONT>         * of the walk<a name="line.731"></a>
+<FONT color="green">732</FONT>         */<a name="line.732"></a>
+<FONT color="green">733</FONT>        double walkInColumnOrder(RealMatrixPreservingVisitor visitor,<a name="line.733"></a>
+<FONT color="green">734</FONT>                                 int startRow, int endRow, int startColumn, int endColumn)<a name="line.734"></a>
+<FONT color="green">735</FONT>            throws MatrixIndexException, MatrixVisitorException;<a name="line.735"></a>
+<FONT color="green">736</FONT>    <a name="line.736"></a>
+<FONT color="green">737</FONT>        /**<a name="line.737"></a>
+<FONT color="green">738</FONT>         * Visit (and possibly change) all matrix entries using the fastest possible order.<a name="line.738"></a>
+<FONT color="green">739</FONT>         * &lt;p&gt;The fastest walking order depends on the exact matrix class. It may be<a name="line.739"></a>
+<FONT color="green">740</FONT>         * different from traditional row or column orders.&lt;/p&gt;<a name="line.740"></a>
+<FONT color="green">741</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.741"></a>
+<FONT color="green">742</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.742"></a>
+<FONT color="green">743</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor)<a name="line.743"></a>
+<FONT color="green">744</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor)<a name="line.744"></a>
+<FONT color="green">745</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.745"></a>
+<FONT color="green">746</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.746"></a>
+<FONT color="green">747</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor)<a name="line.747"></a>
+<FONT color="green">748</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor)<a name="line.748"></a>
+<FONT color="green">749</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.749"></a>
+<FONT color="green">750</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.750"></a>
+<FONT color="green">751</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor)<a name="line.751"></a>
+<FONT color="green">752</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.752"></a>
+<FONT color="green">753</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.753"></a>
+<FONT color="green">754</FONT>         * @return the value returned by {@link RealMatrixChangingVisitor#end()} at the end<a name="line.754"></a>
+<FONT color="green">755</FONT>         * of the walk<a name="line.755"></a>
+<FONT color="green">756</FONT>         */<a name="line.756"></a>
+<FONT color="green">757</FONT>        double walkInOptimizedOrder(RealMatrixChangingVisitor visitor)<a name="line.757"></a>
+<FONT color="green">758</FONT>            throws MatrixVisitorException;<a name="line.758"></a>
+<FONT color="green">759</FONT>    <a name="line.759"></a>
+<FONT color="green">760</FONT>        /**<a name="line.760"></a>
+<FONT color="green">761</FONT>         * Visit (but don't change) all matrix entries using the fastest possible order.<a name="line.761"></a>
+<FONT color="green">762</FONT>         * &lt;p&gt;The fastest walking order depends on the exact matrix class. It may be<a name="line.762"></a>
+<FONT color="green">763</FONT>         * different from traditional row or column orders.&lt;/p&gt;<a name="line.763"></a>
+<FONT color="green">764</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.764"></a>
+<FONT color="green">765</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.765"></a>
+<FONT color="green">766</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor)<a name="line.766"></a>
+<FONT color="green">767</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor)<a name="line.767"></a>
+<FONT color="green">768</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.768"></a>
+<FONT color="green">769</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.769"></a>
+<FONT color="green">770</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor)<a name="line.770"></a>
+<FONT color="green">771</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor)<a name="line.771"></a>
+<FONT color="green">772</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.772"></a>
+<FONT color="green">773</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.773"></a>
+<FONT color="green">774</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor)<a name="line.774"></a>
+<FONT color="green">775</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.775"></a>
+<FONT color="green">776</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.776"></a>
+<FONT color="green">777</FONT>         * @return the value returned by {@link RealMatrixPreservingVisitor#end()} at the end<a name="line.777"></a>
+<FONT color="green">778</FONT>         * of the walk<a name="line.778"></a>
+<FONT color="green">779</FONT>         */<a name="line.779"></a>
+<FONT color="green">780</FONT>        double walkInOptimizedOrder(RealMatrixPreservingVisitor visitor)<a name="line.780"></a>
+<FONT color="green">781</FONT>            throws MatrixVisitorException;<a name="line.781"></a>
+<FONT color="green">782</FONT>    <a name="line.782"></a>
+<FONT color="green">783</FONT>        /**<a name="line.783"></a>
+<FONT color="green">784</FONT>         * Visit (and possibly change) some matrix entries using the fastest possible order.<a name="line.784"></a>
+<FONT color="green">785</FONT>         * &lt;p&gt;The fastest walking order depends on the exact matrix class. It may be<a name="line.785"></a>
+<FONT color="green">786</FONT>         * different from traditional row or column orders.&lt;/p&gt;<a name="line.786"></a>
+<FONT color="green">787</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.787"></a>
+<FONT color="green">788</FONT>         * @param startRow Initial row index<a name="line.788"></a>
+<FONT color="green">789</FONT>         * @param endRow Final row index (inclusive)<a name="line.789"></a>
+<FONT color="green">790</FONT>         * @param startColumn Initial column index<a name="line.790"></a>
+<FONT color="green">791</FONT>         * @param endColumn Final column index (inclusive)<a name="line.791"></a>
+<FONT color="green">792</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.792"></a>
+<FONT color="green">793</FONT>         * @exception MatrixIndexException  if the indices are not valid<a name="line.793"></a>
+<FONT color="green">794</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor)<a name="line.794"></a>
+<FONT color="green">795</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor)<a name="line.795"></a>
+<FONT color="green">796</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.796"></a>
+<FONT color="green">797</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.797"></a>
+<FONT color="green">798</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor)<a name="line.798"></a>
+<FONT color="green">799</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor)<a name="line.799"></a>
+<FONT color="green">800</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.800"></a>
+<FONT color="green">801</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.801"></a>
+<FONT color="green">802</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor)<a name="line.802"></a>
+<FONT color="green">803</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor)<a name="line.803"></a>
+<FONT color="green">804</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.804"></a>
+<FONT color="green">805</FONT>         * @return the value returned by {@link RealMatrixChangingVisitor#end()} at the end<a name="line.805"></a>
+<FONT color="green">806</FONT>         * of the walk<a name="line.806"></a>
+<FONT color="green">807</FONT>         */<a name="line.807"></a>
+<FONT color="green">808</FONT>        double walkInOptimizedOrder(RealMatrixChangingVisitor visitor,<a name="line.808"></a>
+<FONT color="green">809</FONT>                                    int startRow, int endRow, int startColumn, int endColumn)<a name="line.809"></a>
+<FONT color="green">810</FONT>            throws MatrixIndexException, MatrixVisitorException;<a name="line.810"></a>
+<FONT color="green">811</FONT>    <a name="line.811"></a>
+<FONT color="green">812</FONT>        /**<a name="line.812"></a>
+<FONT color="green">813</FONT>         * Visit (but don't change) some matrix entries using the fastest possible order.<a name="line.813"></a>
+<FONT color="green">814</FONT>         * &lt;p&gt;The fastest walking order depends on the exact matrix class. It may be<a name="line.814"></a>
+<FONT color="green">815</FONT>         * different from traditional row or column orders.&lt;/p&gt;<a name="line.815"></a>
+<FONT color="green">816</FONT>         * @param visitor visitor used to process all matrix entries<a name="line.816"></a>
+<FONT color="green">817</FONT>         * @param startRow Initial row index<a name="line.817"></a>
+<FONT color="green">818</FONT>         * @param endRow Final row index (inclusive)<a name="line.818"></a>
+<FONT color="green">819</FONT>         * @param startColumn Initial column index<a name="line.819"></a>
+<FONT color="green">820</FONT>         * @param endColumn Final column index (inclusive)<a name="line.820"></a>
+<FONT color="green">821</FONT>         * @exception  MatrixVisitorException if the visitor cannot process an entry<a name="line.821"></a>
+<FONT color="green">822</FONT>         * @exception MatrixIndexException  if the indices are not valid<a name="line.822"></a>
+<FONT color="green">823</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor)<a name="line.823"></a>
+<FONT color="green">824</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor)<a name="line.824"></a>
+<FONT color="green">825</FONT>         * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.825"></a>
+<FONT color="green">826</FONT>         * @see #walkInRowOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.826"></a>
+<FONT color="green">827</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor)<a name="line.827"></a>
+<FONT color="green">828</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor)<a name="line.828"></a>
+<FONT color="green">829</FONT>         * @see #walkInColumnOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.829"></a>
+<FONT color="green">830</FONT>         * @see #walkInColumnOrder(RealMatrixPreservingVisitor, int, int, int, int)<a name="line.830"></a>
+<FONT color="green">831</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor)<a name="line.831"></a>
+<FONT color="green">832</FONT>         * @see #walkInOptimizedOrder(RealMatrixPreservingVisitor)<a name="line.832"></a>
+<FONT color="green">833</FONT>         * @see #walkInOptimizedOrder(RealMatrixChangingVisitor, int, int, int, int)<a name="line.833"></a>
+<FONT color="green">834</FONT>         * @return the value returned by {@link RealMatrixPreservingVisitor#end()} at the end<a name="line.834"></a>
+<FONT color="green">835</FONT>         * of the walk<a name="line.835"></a>
+<FONT color="green">836</FONT>         */<a name="line.836"></a>
+<FONT color="green">837</FONT>        double walkInOptimizedOrder(RealMatrixPreservingVisitor visitor,<a name="line.837"></a>
+<FONT color="green">838</FONT>                                    int startRow, int endRow, int startColumn, int endColumn)<a name="line.838"></a>
+<FONT color="green">839</FONT>            throws MatrixIndexException, MatrixVisitorException;<a name="line.839"></a>
+<FONT color="green">840</FONT>    <a name="line.840"></a>
+<FONT color="green">841</FONT>        /**<a name="line.841"></a>
+<FONT color="green">842</FONT>         * Returns the solution vector for a linear system with coefficient<a name="line.842"></a>
+<FONT color="green">843</FONT>         * matrix = this and constant vector = &lt;code&gt;b&lt;/code&gt;.<a name="line.843"></a>
+<FONT color="green">844</FONT>         *<a name="line.844"></a>
+<FONT color="green">845</FONT>         * @param b  constant vector<a name="line.845"></a>
+<FONT color="green">846</FONT>         * @return vector of solution values to AX = b, where A is *this<a name="line.846"></a>
+<FONT color="green">847</FONT>         * @throws IllegalArgumentException if this.rowDimension != b.length<a name="line.847"></a>
+<FONT color="green">848</FONT>         * @throws InvalidMatrixException if this matrix is not square or is singular<a name="line.848"></a>
+<FONT color="green">849</FONT>         * @deprecated as of release 2.0, replaced by {@link DecompositionSolver#solve(double[])}<a name="line.849"></a>
+<FONT color="green">850</FONT>         */<a name="line.850"></a>
+<FONT color="green">851</FONT>        @Deprecated<a name="line.851"></a>
+<FONT color="green">852</FONT>        double[] solve(double[] b) throws IllegalArgumentException, InvalidMatrixException;<a name="line.852"></a>
+<FONT color="green">853</FONT>    <a name="line.853"></a>
+<FONT color="green">854</FONT>        /**<a name="line.854"></a>
+<FONT color="green">855</FONT>         * Returns a matrix of (column) solution vectors for linear systems with<a name="line.855"></a>
+<FONT color="green">856</FONT>         * coefficient matrix = this and constant vectors = columns of<a name="line.856"></a>
+<FONT color="green">857</FONT>         * &lt;code&gt;b&lt;/code&gt;.<a name="line.857"></a>
+<FONT color="green">858</FONT>         *<a name="line.858"></a>
+<FONT color="green">859</FONT>         * @param b  matrix of constant vectors forming RHS of linear systems to<a name="line.859"></a>
+<FONT color="green">860</FONT>         * to solve<a name="line.860"></a>
+<FONT color="green">861</FONT>         * @return matrix of solution vectors<a name="line.861"></a>
+<FONT color="green">862</FONT>         * @throws IllegalArgumentException if this.rowDimension != row dimension<a name="line.862"></a>
+<FONT color="green">863</FONT>         * @throws InvalidMatrixException if this matrix is not square or is singular<a name="line.863"></a>
+<FONT color="green">864</FONT>         * @deprecated as of release 2.0, replaced by {@link DecompositionSolver#solve(RealMatrix)}<a name="line.864"></a>
+<FONT color="green">865</FONT>         */<a name="line.865"></a>
+<FONT color="green">866</FONT>        @Deprecated<a name="line.866"></a>
+<FONT color="green">867</FONT>        RealMatrix solve(RealMatrix b) throws IllegalArgumentException, InvalidMatrixException;<a name="line.867"></a>
+<FONT color="green">868</FONT>    <a name="line.868"></a>
+<FONT color="green">869</FONT>    }<a name="line.869"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/RealMatrixChangingVisitor.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,126 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Interface defining a visitor for matrix entries.<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @see DefaultRealMatrixChangingVisitor<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @since 2.0<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public interface RealMatrixChangingVisitor {<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>        /**<a name="line.29"></a>
+<FONT color="green">030</FONT>         * Start visiting a matrix.<a name="line.30"></a>
+<FONT color="green">031</FONT>         * &lt;p&gt;This method is called once before any entry of the matrix is visited.&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>         * @param rows number of rows of the matrix<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @param columns number of columns of the matrix<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @param startRow Initial row index<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @param endRow Final row index (inclusive)<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @param startColumn Initial column index<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @param endColumn Final column index (inclusive)<a name="line.37"></a>
+<FONT color="green">038</FONT>         */<a name="line.38"></a>
+<FONT color="green">039</FONT>        void start(int rows, int columns,<a name="line.39"></a>
+<FONT color="green">040</FONT>                   int startRow, int endRow, int startColumn, int endColumn);<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /**<a name="line.42"></a>
+<FONT color="green">043</FONT>         * Visit one matrix entry.<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @param row row index of the entry<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @param column column index of the entry<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param value current value of the entry<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @return the new value to be set for the entry<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @throws MatrixVisitorException if something wrong occurs<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        double visit(int row, int column, double value)<a name="line.50"></a>
+<FONT color="green">051</FONT>            throws MatrixVisitorException;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * End visiting a matrix.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * &lt;p&gt;This method is called once after all entries of the matrix have been visited.&lt;/p&gt;<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @return the value that the &lt;code&gt;walkInXxxOrder&lt;/code&gt; must return<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        double end();<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>    }<a name="line.60"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/RealMatrixImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,693 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Implementation of RealMatrix using a double[][] array to store entries and<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;a href="http://www.math.gatech.edu/~bourbaki/math2601/Web-notes/2num.pdf"&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * LU decomposition&lt;/a&gt; to support linear system<a name="line.27"></a>
+<FONT color="green">028</FONT>     * solution and inverse.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * The LU decomposition is performed as needed, to support the following operations: &lt;ul&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;li&gt;solve&lt;/li&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;li&gt;isSingular&lt;/li&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;li&gt;getDeterminant&lt;/li&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;li&gt;inverse&lt;/li&gt; &lt;/ul&gt;&lt;/p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;strong&gt;Usage notes&lt;/strong&gt;:&lt;br&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;ul&gt;&lt;li&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * The LU decomposition is cached and reused on subsequent calls.<a name="line.38"></a>
+<FONT color="green">039</FONT>     * If data are modified via references to the underlying array obtained using<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;code&gt;getDataRef()&lt;/code&gt;, then the stored LU decomposition will not be<a name="line.40"></a>
+<FONT color="green">041</FONT>     * discarded.  In this case, you need to explicitly invoke<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;code&gt;LUDecompose()&lt;/code&gt; to recompute the decomposition<a name="line.42"></a>
+<FONT color="green">043</FONT>     * before using any of the methods above.&lt;/li&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;li&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     * As specified in the {@link RealMatrix} interface, matrix element indexing<a name="line.45"></a>
+<FONT color="green">046</FONT>     * is 0-based -- e.g., &lt;code&gt;getEntry(0, 0)&lt;/code&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     * returns the element in the first row, first column of the matrix.&lt;/li&gt;&lt;/ul&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     * &lt;/p&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>     *<a name="line.49"></a>
+<FONT color="green">050</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.50"></a>
+<FONT color="green">051</FONT>     * @deprecated as of 2.0 replaced by {@link Array2DRowRealMatrix}<a name="line.51"></a>
+<FONT color="green">052</FONT>     */<a name="line.52"></a>
+<FONT color="green">053</FONT>    @Deprecated<a name="line.53"></a>
+<FONT color="green">054</FONT>    public class RealMatrixImpl extends AbstractRealMatrix implements Serializable {<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** Serializable version identifier */<a name="line.56"></a>
+<FONT color="green">057</FONT>        private static final long serialVersionUID = -1067294169172445528L;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** Entries of the matrix */<a name="line.59"></a>
+<FONT color="green">060</FONT>        protected double data[][];<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /**<a name="line.62"></a>
+<FONT color="green">063</FONT>         * Creates a matrix with no data<a name="line.63"></a>
+<FONT color="green">064</FONT>         */<a name="line.64"></a>
+<FONT color="green">065</FONT>        public RealMatrixImpl() {<a name="line.65"></a>
+<FONT color="green">066</FONT>        }<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /**<a name="line.68"></a>
+<FONT color="green">069</FONT>         * Create a new RealMatrix with the supplied row and column dimensions.<a name="line.69"></a>
+<FONT color="green">070</FONT>         *<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param rowDimension  the number of rows in the new matrix<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param columnDimension  the number of columns in the new matrix<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @throws IllegalArgumentException if row or column dimension is not<a name="line.73"></a>
+<FONT color="green">074</FONT>         *  positive<a name="line.74"></a>
+<FONT color="green">075</FONT>         */<a name="line.75"></a>
+<FONT color="green">076</FONT>        public RealMatrixImpl(final int rowDimension, final int columnDimension)<a name="line.76"></a>
+<FONT color="green">077</FONT>            throws IllegalArgumentException {<a name="line.77"></a>
+<FONT color="green">078</FONT>            super(rowDimension, columnDimension);<a name="line.78"></a>
+<FONT color="green">079</FONT>            data = new double[rowDimension][columnDimension];<a name="line.79"></a>
+<FONT color="green">080</FONT>        }<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>        /**<a name="line.82"></a>
+<FONT color="green">083</FONT>         * Create a new RealMatrix using the input array as the underlying<a name="line.83"></a>
+<FONT color="green">084</FONT>         * data array.<a name="line.84"></a>
+<FONT color="green">085</FONT>         * &lt;p&gt;The input array is copied, not referenced. This constructor has<a name="line.85"></a>
+<FONT color="green">086</FONT>         * the same effect as calling {@link #RealMatrixImpl(double[][], boolean)}<a name="line.86"></a>
+<FONT color="green">087</FONT>         * with the second argument set to &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;<a name="line.87"></a>
+<FONT color="green">088</FONT>         *<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @param d data for new matrix<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @throws IllegalArgumentException if &lt;code&gt;d&lt;/code&gt; is not rectangular<a name="line.90"></a>
+<FONT color="green">091</FONT>         *  (not all rows have the same length) or empty<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @throws NullPointerException if &lt;code&gt;d&lt;/code&gt; is null<a name="line.92"></a>
+<FONT color="green">093</FONT>         * @see #RealMatrixImpl(double[][], boolean)<a name="line.93"></a>
+<FONT color="green">094</FONT>         */<a name="line.94"></a>
+<FONT color="green">095</FONT>        public RealMatrixImpl(final double[][] d)<a name="line.95"></a>
+<FONT color="green">096</FONT>            throws IllegalArgumentException, NullPointerException {<a name="line.96"></a>
+<FONT color="green">097</FONT>            copyIn(d);<a name="line.97"></a>
+<FONT color="green">098</FONT>        }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>        /**<a name="line.100"></a>
+<FONT color="green">101</FONT>         * Create a new RealMatrix using the input array as the underlying<a name="line.101"></a>
+<FONT color="green">102</FONT>         * data array.<a name="line.102"></a>
+<FONT color="green">103</FONT>         * &lt;p&gt;If an array is built specially in order to be embedded in a<a name="line.103"></a>
+<FONT color="green">104</FONT>         * RealMatrix and not used directly, the &lt;code&gt;copyArray&lt;/code&gt; may be<a name="line.104"></a>
+<FONT color="green">105</FONT>         * set to &lt;code&gt;false&lt;/code. This will prevent the copying and improve<a name="line.105"></a>
+<FONT color="green">106</FONT>         * performance as no new array will be built and no data will be copied.&lt;/p&gt;<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @param d data for new matrix<a name="line.107"></a>
+<FONT color="green">108</FONT>         * @param copyArray if true, the input array will be copied, otherwise<a name="line.108"></a>
+<FONT color="green">109</FONT>         * it will be referenced<a name="line.109"></a>
+<FONT color="green">110</FONT>         * @throws IllegalArgumentException if &lt;code&gt;d&lt;/code&gt; is not rectangular<a name="line.110"></a>
+<FONT color="green">111</FONT>         *  (not all rows have the same length) or empty<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @throws NullPointerException if &lt;code&gt;d&lt;/code&gt; is null<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @see #RealMatrixImpl(double[][])<a name="line.113"></a>
+<FONT color="green">114</FONT>         */<a name="line.114"></a>
+<FONT color="green">115</FONT>        public RealMatrixImpl(final double[][] d, final boolean copyArray)<a name="line.115"></a>
+<FONT color="green">116</FONT>            throws IllegalArgumentException, NullPointerException {<a name="line.116"></a>
+<FONT color="green">117</FONT>            if (copyArray) {<a name="line.117"></a>
+<FONT color="green">118</FONT>                copyIn(d);<a name="line.118"></a>
+<FONT color="green">119</FONT>            } else {<a name="line.119"></a>
+<FONT color="green">120</FONT>                if (d == null) {<a name="line.120"></a>
+<FONT color="green">121</FONT>                    throw new NullPointerException();<a name="line.121"></a>
+<FONT color="green">122</FONT>                }<a name="line.122"></a>
+<FONT color="green">123</FONT>                final int nRows = d.length;<a name="line.123"></a>
+<FONT color="green">124</FONT>                if (nRows == 0) {<a name="line.124"></a>
+<FONT color="green">125</FONT>                    throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");<a name="line.125"></a>
+<FONT color="green">126</FONT>                }<a name="line.126"></a>
+<FONT color="green">127</FONT>                final int nCols = d[0].length;<a name="line.127"></a>
+<FONT color="green">128</FONT>                if (nCols == 0) {<a name="line.128"></a>
+<FONT color="green">129</FONT>                    throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");<a name="line.129"></a>
+<FONT color="green">130</FONT>                }<a name="line.130"></a>
+<FONT color="green">131</FONT>                for (int r = 1; r &lt; nRows; r++) {<a name="line.131"></a>
+<FONT color="green">132</FONT>                    if (d[r].length != nCols) {<a name="line.132"></a>
+<FONT color="green">133</FONT>                        throw MathRuntimeException.createIllegalArgumentException(<a name="line.133"></a>
+<FONT color="green">134</FONT>                                "some rows have length {0} while others have length {1}",<a name="line.134"></a>
+<FONT color="green">135</FONT>                                nCols, d[r].length);<a name="line.135"></a>
+<FONT color="green">136</FONT>                    }<a name="line.136"></a>
+<FONT color="green">137</FONT>                }<a name="line.137"></a>
+<FONT color="green">138</FONT>                data = d;<a name="line.138"></a>
+<FONT color="green">139</FONT>            }<a name="line.139"></a>
+<FONT color="green">140</FONT>        }<a name="line.140"></a>
+<FONT color="green">141</FONT>    <a name="line.141"></a>
+<FONT color="green">142</FONT>        /**<a name="line.142"></a>
+<FONT color="green">143</FONT>         * Create a new (column) RealMatrix using &lt;code&gt;v&lt;/code&gt; as the<a name="line.143"></a>
+<FONT color="green">144</FONT>         * data for the unique column of the &lt;code&gt;v.length x 1&lt;/code&gt; matrix<a name="line.144"></a>
+<FONT color="green">145</FONT>         * created.<a name="line.145"></a>
+<FONT color="green">146</FONT>         * &lt;p&gt;The input array is copied, not referenced.&lt;/p&gt;<a name="line.146"></a>
+<FONT color="green">147</FONT>         *<a name="line.147"></a>
+<FONT color="green">148</FONT>         * @param v column vector holding data for new matrix<a name="line.148"></a>
+<FONT color="green">149</FONT>         */<a name="line.149"></a>
+<FONT color="green">150</FONT>        public RealMatrixImpl(final double[] v) {<a name="line.150"></a>
+<FONT color="green">151</FONT>            final int nRows = v.length;<a name="line.151"></a>
+<FONT color="green">152</FONT>            data = new double[nRows][1];<a name="line.152"></a>
+<FONT color="green">153</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.153"></a>
+<FONT color="green">154</FONT>                data[row][0] = v[row];<a name="line.154"></a>
+<FONT color="green">155</FONT>            }<a name="line.155"></a>
+<FONT color="green">156</FONT>        }<a name="line.156"></a>
+<FONT color="green">157</FONT>    <a name="line.157"></a>
+<FONT color="green">158</FONT>        /** {@inheritDoc} */<a name="line.158"></a>
+<FONT color="green">159</FONT>        @Override<a name="line.159"></a>
+<FONT color="green">160</FONT>        public RealMatrix createMatrix(final int rowDimension, final int columnDimension)<a name="line.160"></a>
+<FONT color="green">161</FONT>            throws IllegalArgumentException {<a name="line.161"></a>
+<FONT color="green">162</FONT>            return new RealMatrixImpl(rowDimension, columnDimension);<a name="line.162"></a>
+<FONT color="green">163</FONT>        }<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>        /** {@inheritDoc} */<a name="line.165"></a>
+<FONT color="green">166</FONT>        @Override<a name="line.166"></a>
+<FONT color="green">167</FONT>        public RealMatrix copy() {<a name="line.167"></a>
+<FONT color="green">168</FONT>            return new RealMatrixImpl(copyOut(), false);<a name="line.168"></a>
+<FONT color="green">169</FONT>        }<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>        /** {@inheritDoc} */<a name="line.171"></a>
+<FONT color="green">172</FONT>        @Override<a name="line.172"></a>
+<FONT color="green">173</FONT>        public RealMatrix add(final RealMatrix m)<a name="line.173"></a>
+<FONT color="green">174</FONT>            throws IllegalArgumentException {<a name="line.174"></a>
+<FONT color="green">175</FONT>            try {<a name="line.175"></a>
+<FONT color="green">176</FONT>                return add((RealMatrixImpl) m);<a name="line.176"></a>
+<FONT color="green">177</FONT>            } catch (ClassCastException cce) {<a name="line.177"></a>
+<FONT color="green">178</FONT>                return super.add(m);<a name="line.178"></a>
+<FONT color="green">179</FONT>            }<a name="line.179"></a>
+<FONT color="green">180</FONT>        }<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>        /**<a name="line.182"></a>
+<FONT color="green">183</FONT>         * Compute the sum of this and &lt;code&gt;m&lt;/code&gt;.<a name="line.183"></a>
+<FONT color="green">184</FONT>         *<a name="line.184"></a>
+<FONT color="green">185</FONT>         * @param m    matrix to be added<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @return     this + m<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.187"></a>
+<FONT color="green">188</FONT>         */<a name="line.188"></a>
+<FONT color="green">189</FONT>        public RealMatrixImpl add(final RealMatrixImpl m)<a name="line.189"></a>
+<FONT color="green">190</FONT>            throws IllegalArgumentException {<a name="line.190"></a>
+<FONT color="green">191</FONT>    <a name="line.191"></a>
+<FONT color="green">192</FONT>            // safety check<a name="line.192"></a>
+<FONT color="green">193</FONT>            MatrixUtils.checkAdditionCompatible(this, m);<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>            final int rowCount    = getRowDimension();<a name="line.195"></a>
+<FONT color="green">196</FONT>            final int columnCount = getColumnDimension();<a name="line.196"></a>
+<FONT color="green">197</FONT>            final double[][] outData = new double[rowCount][columnCount];<a name="line.197"></a>
+<FONT color="green">198</FONT>            for (int row = 0; row &lt; rowCount; row++) {<a name="line.198"></a>
+<FONT color="green">199</FONT>                final double[] dataRow    = data[row];<a name="line.199"></a>
+<FONT color="green">200</FONT>                final double[] mRow       = m.data[row];<a name="line.200"></a>
+<FONT color="green">201</FONT>                final double[] outDataRow = outData[row];<a name="line.201"></a>
+<FONT color="green">202</FONT>                for (int col = 0; col &lt; columnCount; col++) {<a name="line.202"></a>
+<FONT color="green">203</FONT>                    outDataRow[col] = dataRow[col] + mRow[col];<a name="line.203"></a>
+<FONT color="green">204</FONT>                }<a name="line.204"></a>
+<FONT color="green">205</FONT>            }<a name="line.205"></a>
+<FONT color="green">206</FONT>    <a name="line.206"></a>
+<FONT color="green">207</FONT>            return new RealMatrixImpl(outData, false);<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>        }<a name="line.209"></a>
+<FONT color="green">210</FONT>    <a name="line.210"></a>
+<FONT color="green">211</FONT>        /** {@inheritDoc} */<a name="line.211"></a>
+<FONT color="green">212</FONT>        @Override<a name="line.212"></a>
+<FONT color="green">213</FONT>        public RealMatrix subtract(final RealMatrix m)<a name="line.213"></a>
+<FONT color="green">214</FONT>            throws IllegalArgumentException {<a name="line.214"></a>
+<FONT color="green">215</FONT>            try {<a name="line.215"></a>
+<FONT color="green">216</FONT>                return subtract((RealMatrixImpl) m);<a name="line.216"></a>
+<FONT color="green">217</FONT>            } catch (ClassCastException cce) {<a name="line.217"></a>
+<FONT color="green">218</FONT>                return super.subtract(m);<a name="line.218"></a>
+<FONT color="green">219</FONT>            }<a name="line.219"></a>
+<FONT color="green">220</FONT>        }<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>        /**<a name="line.222"></a>
+<FONT color="green">223</FONT>         * Compute  this minus &lt;code&gt;m&lt;/code&gt;.<a name="line.223"></a>
+<FONT color="green">224</FONT>         *<a name="line.224"></a>
+<FONT color="green">225</FONT>         * @param m    matrix to be subtracted<a name="line.225"></a>
+<FONT color="green">226</FONT>         * @return     this + m<a name="line.226"></a>
+<FONT color="green">227</FONT>         * @throws  IllegalArgumentException if m is not the same size as this<a name="line.227"></a>
+<FONT color="green">228</FONT>         */<a name="line.228"></a>
+<FONT color="green">229</FONT>        public RealMatrixImpl subtract(final RealMatrixImpl m)<a name="line.229"></a>
+<FONT color="green">230</FONT>            throws IllegalArgumentException {<a name="line.230"></a>
+<FONT color="green">231</FONT>    <a name="line.231"></a>
+<FONT color="green">232</FONT>            // safety check<a name="line.232"></a>
+<FONT color="green">233</FONT>            MatrixUtils.checkSubtractionCompatible(this, m);<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>            final int rowCount    = getRowDimension();<a name="line.235"></a>
+<FONT color="green">236</FONT>            final int columnCount = getColumnDimension();<a name="line.236"></a>
+<FONT color="green">237</FONT>            final double[][] outData = new double[rowCount][columnCount];<a name="line.237"></a>
+<FONT color="green">238</FONT>            for (int row = 0; row &lt; rowCount; row++) {<a name="line.238"></a>
+<FONT color="green">239</FONT>                final double[] dataRow    = data[row];<a name="line.239"></a>
+<FONT color="green">240</FONT>                final double[] mRow       = m.data[row];<a name="line.240"></a>
+<FONT color="green">241</FONT>                final double[] outDataRow = outData[row];<a name="line.241"></a>
+<FONT color="green">242</FONT>                for (int col = 0; col &lt; columnCount; col++) {<a name="line.242"></a>
+<FONT color="green">243</FONT>                    outDataRow[col] = dataRow[col] - mRow[col];<a name="line.243"></a>
+<FONT color="green">244</FONT>                }<a name="line.244"></a>
+<FONT color="green">245</FONT>            }<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>            return new RealMatrixImpl(outData, false);<a name="line.247"></a>
+<FONT color="green">248</FONT>    <a name="line.248"></a>
+<FONT color="green">249</FONT>        }<a name="line.249"></a>
+<FONT color="green">250</FONT>    <a name="line.250"></a>
+<FONT color="green">251</FONT>        /** {@inheritDoc} */<a name="line.251"></a>
+<FONT color="green">252</FONT>        @Override<a name="line.252"></a>
+<FONT color="green">253</FONT>        public RealMatrix multiply(final RealMatrix m)<a name="line.253"></a>
+<FONT color="green">254</FONT>            throws IllegalArgumentException {<a name="line.254"></a>
+<FONT color="green">255</FONT>            try {<a name="line.255"></a>
+<FONT color="green">256</FONT>                return multiply((RealMatrixImpl) m);<a name="line.256"></a>
+<FONT color="green">257</FONT>            } catch (ClassCastException cce) {<a name="line.257"></a>
+<FONT color="green">258</FONT>                return super.multiply(m);<a name="line.258"></a>
+<FONT color="green">259</FONT>            }<a name="line.259"></a>
+<FONT color="green">260</FONT>        }<a name="line.260"></a>
+<FONT color="green">261</FONT>    <a name="line.261"></a>
+<FONT color="green">262</FONT>        /**<a name="line.262"></a>
+<FONT color="green">263</FONT>         * Returns the result of postmultiplying this by &lt;code&gt;m&lt;/code&gt;.<a name="line.263"></a>
+<FONT color="green">264</FONT>         * @param m    matrix to postmultiply by<a name="line.264"></a>
+<FONT color="green">265</FONT>         * @return     this*m<a name="line.265"></a>
+<FONT color="green">266</FONT>         * @throws     IllegalArgumentException<a name="line.266"></a>
+<FONT color="green">267</FONT>         *             if columnDimension(this) != rowDimension(m)<a name="line.267"></a>
+<FONT color="green">268</FONT>         */<a name="line.268"></a>
+<FONT color="green">269</FONT>        public RealMatrixImpl multiply(final RealMatrixImpl m)<a name="line.269"></a>
+<FONT color="green">270</FONT>            throws IllegalArgumentException {<a name="line.270"></a>
+<FONT color="green">271</FONT>    <a name="line.271"></a>
+<FONT color="green">272</FONT>            // safety check<a name="line.272"></a>
+<FONT color="green">273</FONT>            MatrixUtils.checkMultiplicationCompatible(this, m);<a name="line.273"></a>
+<FONT color="green">274</FONT>    <a name="line.274"></a>
+<FONT color="green">275</FONT>            final int nRows = this.getRowDimension();<a name="line.275"></a>
+<FONT color="green">276</FONT>            final int nCols = m.getColumnDimension();<a name="line.276"></a>
+<FONT color="green">277</FONT>            final int nSum = this.getColumnDimension();<a name="line.277"></a>
+<FONT color="green">278</FONT>            final double[][] outData = new double[nRows][nCols];<a name="line.278"></a>
+<FONT color="green">279</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.279"></a>
+<FONT color="green">280</FONT>                final double[] dataRow    = data[row];<a name="line.280"></a>
+<FONT color="green">281</FONT>                final double[] outDataRow = outData[row];<a name="line.281"></a>
+<FONT color="green">282</FONT>                for (int col = 0; col &lt; nCols; col++) {<a name="line.282"></a>
+<FONT color="green">283</FONT>                    double sum = 0;<a name="line.283"></a>
+<FONT color="green">284</FONT>                    for (int i = 0; i &lt; nSum; i++) {<a name="line.284"></a>
+<FONT color="green">285</FONT>                        sum += dataRow[i] * m.data[i][col];<a name="line.285"></a>
+<FONT color="green">286</FONT>                    }<a name="line.286"></a>
+<FONT color="green">287</FONT>                    outDataRow[col] = sum;<a name="line.287"></a>
+<FONT color="green">288</FONT>                }<a name="line.288"></a>
+<FONT color="green">289</FONT>            }<a name="line.289"></a>
+<FONT color="green">290</FONT>    <a name="line.290"></a>
+<FONT color="green">291</FONT>            return new RealMatrixImpl(outData, false);<a name="line.291"></a>
+<FONT color="green">292</FONT>    <a name="line.292"></a>
+<FONT color="green">293</FONT>        }<a name="line.293"></a>
+<FONT color="green">294</FONT>    <a name="line.294"></a>
+<FONT color="green">295</FONT>        /** {@inheritDoc} */<a name="line.295"></a>
+<FONT color="green">296</FONT>        @Override<a name="line.296"></a>
+<FONT color="green">297</FONT>        public double[][] getData() {<a name="line.297"></a>
+<FONT color="green">298</FONT>            return copyOut();<a name="line.298"></a>
+<FONT color="green">299</FONT>        }<a name="line.299"></a>
+<FONT color="green">300</FONT>    <a name="line.300"></a>
+<FONT color="green">301</FONT>        /**<a name="line.301"></a>
+<FONT color="green">302</FONT>         * Returns a reference to the underlying data array.<a name="line.302"></a>
+<FONT color="green">303</FONT>         * &lt;p&gt;<a name="line.303"></a>
+<FONT color="green">304</FONT>         * Does &lt;strong&gt;not&lt;/strong&gt; make a fresh copy of the underlying data.&lt;/p&gt;<a name="line.304"></a>
+<FONT color="green">305</FONT>         *<a name="line.305"></a>
+<FONT color="green">306</FONT>         * @return 2-dimensional array of entries<a name="line.306"></a>
+<FONT color="green">307</FONT>         */<a name="line.307"></a>
+<FONT color="green">308</FONT>        public double[][] getDataRef() {<a name="line.308"></a>
+<FONT color="green">309</FONT>            return data;<a name="line.309"></a>
+<FONT color="green">310</FONT>        }<a name="line.310"></a>
+<FONT color="green">311</FONT>    <a name="line.311"></a>
+<FONT color="green">312</FONT>        /** {@inheritDoc} */<a name="line.312"></a>
+<FONT color="green">313</FONT>        @Override<a name="line.313"></a>
+<FONT color="green">314</FONT>        public void setSubMatrix(final double[][] subMatrix, final int row, final int column)<a name="line.314"></a>
+<FONT color="green">315</FONT>        throws MatrixIndexException {<a name="line.315"></a>
+<FONT color="green">316</FONT>            if (data == null) {<a name="line.316"></a>
+<FONT color="green">317</FONT>                if (row &gt; 0) {<a name="line.317"></a>
+<FONT color="green">318</FONT>                    throw MathRuntimeException.createIllegalStateException(<a name="line.318"></a>
+<FONT color="green">319</FONT>                            "first {0} rows are not initialized yet",<a name="line.319"></a>
+<FONT color="green">320</FONT>                            row);<a name="line.320"></a>
+<FONT color="green">321</FONT>                }<a name="line.321"></a>
+<FONT color="green">322</FONT>                if (column &gt; 0) {<a name="line.322"></a>
+<FONT color="green">323</FONT>                    throw MathRuntimeException.createIllegalStateException(<a name="line.323"></a>
+<FONT color="green">324</FONT>                            "first {0} columns are not initialized yet",<a name="line.324"></a>
+<FONT color="green">325</FONT>                            column);<a name="line.325"></a>
+<FONT color="green">326</FONT>                }<a name="line.326"></a>
+<FONT color="green">327</FONT>                final int nRows = subMatrix.length;<a name="line.327"></a>
+<FONT color="green">328</FONT>                if (nRows == 0) {<a name="line.328"></a>
+<FONT color="green">329</FONT>                    throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");<a name="line.329"></a>
+<FONT color="green">330</FONT>                }<a name="line.330"></a>
+<FONT color="green">331</FONT>    <a name="line.331"></a>
+<FONT color="green">332</FONT>                final int nCols = subMatrix[0].length;<a name="line.332"></a>
+<FONT color="green">333</FONT>                if (nCols == 0) {<a name="line.333"></a>
+<FONT color="green">334</FONT>                    throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");<a name="line.334"></a>
+<FONT color="green">335</FONT>                }<a name="line.335"></a>
+<FONT color="green">336</FONT>                data = new double[subMatrix.length][nCols];<a name="line.336"></a>
+<FONT color="green">337</FONT>                for (int i = 0; i &lt; data.length; ++i) {<a name="line.337"></a>
+<FONT color="green">338</FONT>                    if (subMatrix[i].length != nCols) {<a name="line.338"></a>
+<FONT color="green">339</FONT>                        throw MathRuntimeException.createIllegalArgumentException(<a name="line.339"></a>
+<FONT color="green">340</FONT>                                "some rows have length {0} while others have length {1}",<a name="line.340"></a>
+<FONT color="green">341</FONT>                                nCols, subMatrix[i].length);<a name="line.341"></a>
+<FONT color="green">342</FONT>                    }<a name="line.342"></a>
+<FONT color="green">343</FONT>                    System.arraycopy(subMatrix[i], 0, data[i + row], column, nCols);<a name="line.343"></a>
+<FONT color="green">344</FONT>                }<a name="line.344"></a>
+<FONT color="green">345</FONT>            } else {<a name="line.345"></a>
+<FONT color="green">346</FONT>                super.setSubMatrix(subMatrix, row, column);<a name="line.346"></a>
+<FONT color="green">347</FONT>            }<a name="line.347"></a>
+<FONT color="green">348</FONT>    <a name="line.348"></a>
+<FONT color="green">349</FONT>        }<a name="line.349"></a>
+<FONT color="green">350</FONT>    <a name="line.350"></a>
+<FONT color="green">351</FONT>        /** {@inheritDoc} */<a name="line.351"></a>
+<FONT color="green">352</FONT>        @Override<a name="line.352"></a>
+<FONT color="green">353</FONT>        public double getEntry(final int row, final int column)<a name="line.353"></a>
+<FONT color="green">354</FONT>            throws MatrixIndexException {<a name="line.354"></a>
+<FONT color="green">355</FONT>            try {<a name="line.355"></a>
+<FONT color="green">356</FONT>                return data[row][column];<a name="line.356"></a>
+<FONT color="green">357</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.357"></a>
+<FONT color="green">358</FONT>                throw new MatrixIndexException(<a name="line.358"></a>
+<FONT color="green">359</FONT>                        "no entry at indices ({0}, {1}) in a {2}x{3} matrix",<a name="line.359"></a>
+<FONT color="green">360</FONT>                        row, column, getRowDimension(), getColumnDimension());<a name="line.360"></a>
+<FONT color="green">361</FONT>            }<a name="line.361"></a>
+<FONT color="green">362</FONT>        }<a name="line.362"></a>
+<FONT color="green">363</FONT>    <a name="line.363"></a>
+<FONT color="green">364</FONT>        /** {@inheritDoc} */<a name="line.364"></a>
+<FONT color="green">365</FONT>        @Override<a name="line.365"></a>
+<FONT color="green">366</FONT>        public void setEntry(final int row, final int column, final double value)<a name="line.366"></a>
+<FONT color="green">367</FONT>            throws MatrixIndexException {<a name="line.367"></a>
+<FONT color="green">368</FONT>            try {<a name="line.368"></a>
+<FONT color="green">369</FONT>                data[row][column] = value;<a name="line.369"></a>
+<FONT color="green">370</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.370"></a>
+<FONT color="green">371</FONT>                throw new MatrixIndexException(<a name="line.371"></a>
+<FONT color="green">372</FONT>                        "no entry at indices ({0}, {1}) in a {2}x{3} matrix",<a name="line.372"></a>
+<FONT color="green">373</FONT>                        row, column, getRowDimension(), getColumnDimension());<a name="line.373"></a>
+<FONT color="green">374</FONT>            }<a name="line.374"></a>
+<FONT color="green">375</FONT>        }<a name="line.375"></a>
+<FONT color="green">376</FONT>    <a name="line.376"></a>
+<FONT color="green">377</FONT>        /** {@inheritDoc} */<a name="line.377"></a>
+<FONT color="green">378</FONT>        @Override<a name="line.378"></a>
+<FONT color="green">379</FONT>        public void addToEntry(final int row, final int column, final double increment)<a name="line.379"></a>
+<FONT color="green">380</FONT>            throws MatrixIndexException {<a name="line.380"></a>
+<FONT color="green">381</FONT>            try {<a name="line.381"></a>
+<FONT color="green">382</FONT>                data[row][column] += increment;<a name="line.382"></a>
+<FONT color="green">383</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.383"></a>
+<FONT color="green">384</FONT>                throw new MatrixIndexException(<a name="line.384"></a>
+<FONT color="green">385</FONT>                        "no entry at indices ({0}, {1}) in a {2}x{3} matrix",<a name="line.385"></a>
+<FONT color="green">386</FONT>                        row, column, getRowDimension(), getColumnDimension());<a name="line.386"></a>
+<FONT color="green">387</FONT>            }<a name="line.387"></a>
+<FONT color="green">388</FONT>        }<a name="line.388"></a>
+<FONT color="green">389</FONT>    <a name="line.389"></a>
+<FONT color="green">390</FONT>        /** {@inheritDoc} */<a name="line.390"></a>
+<FONT color="green">391</FONT>        @Override<a name="line.391"></a>
+<FONT color="green">392</FONT>        public void multiplyEntry(final int row, final int column, final double factor)<a name="line.392"></a>
+<FONT color="green">393</FONT>            throws MatrixIndexException {<a name="line.393"></a>
+<FONT color="green">394</FONT>            try {<a name="line.394"></a>
+<FONT color="green">395</FONT>                data[row][column] *= factor;<a name="line.395"></a>
+<FONT color="green">396</FONT>            } catch (ArrayIndexOutOfBoundsException e) {<a name="line.396"></a>
+<FONT color="green">397</FONT>                throw new MatrixIndexException(<a name="line.397"></a>
+<FONT color="green">398</FONT>                        "no entry at indices ({0}, {1}) in a {2}x{3} matrix",<a name="line.398"></a>
+<FONT color="green">399</FONT>                        row, column, getRowDimension(), getColumnDimension());<a name="line.399"></a>
+<FONT color="green">400</FONT>            }<a name="line.400"></a>
+<FONT color="green">401</FONT>        }<a name="line.401"></a>
+<FONT color="green">402</FONT>    <a name="line.402"></a>
+<FONT color="green">403</FONT>        /** {@inheritDoc} */<a name="line.403"></a>
+<FONT color="green">404</FONT>        @Override<a name="line.404"></a>
+<FONT color="green">405</FONT>        public int getRowDimension() {<a name="line.405"></a>
+<FONT color="green">406</FONT>            return (data == null) ? 0 : data.length;<a name="line.406"></a>
+<FONT color="green">407</FONT>        }<a name="line.407"></a>
+<FONT color="green">408</FONT>    <a name="line.408"></a>
+<FONT color="green">409</FONT>        /** {@inheritDoc} */<a name="line.409"></a>
+<FONT color="green">410</FONT>        @Override<a name="line.410"></a>
+<FONT color="green">411</FONT>        public int getColumnDimension() {<a name="line.411"></a>
+<FONT color="green">412</FONT>            return ((data == null) || (data[0] == null)) ? 0 : data[0].length;<a name="line.412"></a>
+<FONT color="green">413</FONT>        }<a name="line.413"></a>
+<FONT color="green">414</FONT>    <a name="line.414"></a>
+<FONT color="green">415</FONT>        /** {@inheritDoc} */<a name="line.415"></a>
+<FONT color="green">416</FONT>        @Override<a name="line.416"></a>
+<FONT color="green">417</FONT>        public double[] operate(final double[] v)<a name="line.417"></a>
+<FONT color="green">418</FONT>            throws IllegalArgumentException {<a name="line.418"></a>
+<FONT color="green">419</FONT>            final int nRows = this.getRowDimension();<a name="line.419"></a>
+<FONT color="green">420</FONT>            final int nCols = this.getColumnDimension();<a name="line.420"></a>
+<FONT color="green">421</FONT>            if (v.length != nCols) {<a name="line.421"></a>
+<FONT color="green">422</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.422"></a>
+<FONT color="green">423</FONT>                        "vector length mismatch: got {0} but expected {1}",<a name="line.423"></a>
+<FONT color="green">424</FONT>                        v.length, nCols);<a name="line.424"></a>
+<FONT color="green">425</FONT>            }<a name="line.425"></a>
+<FONT color="green">426</FONT>            final double[] out = new double[nRows];<a name="line.426"></a>
+<FONT color="green">427</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.427"></a>
+<FONT color="green">428</FONT>                final double[] dataRow = data[row];<a name="line.428"></a>
+<FONT color="green">429</FONT>                double sum = 0;<a name="line.429"></a>
+<FONT color="green">430</FONT>                for (int i = 0; i &lt; nCols; i++) {<a name="line.430"></a>
+<FONT color="green">431</FONT>                    sum += dataRow[i] * v[i];<a name="line.431"></a>
+<FONT color="green">432</FONT>                }<a name="line.432"></a>
+<FONT color="green">433</FONT>                out[row] = sum;<a name="line.433"></a>
+<FONT color="green">434</FONT>            }<a name="line.434"></a>
+<FONT color="green">435</FONT>            return out;<a name="line.435"></a>
+<FONT color="green">436</FONT>        }<a name="line.436"></a>
+<FONT color="green">437</FONT>    <a name="line.437"></a>
+<FONT color="green">438</FONT>        /** {@inheritDoc} */<a name="line.438"></a>
+<FONT color="green">439</FONT>        @Override<a name="line.439"></a>
+<FONT color="green">440</FONT>        public double[] preMultiply(final double[] v)<a name="line.440"></a>
+<FONT color="green">441</FONT>            throws IllegalArgumentException {<a name="line.441"></a>
+<FONT color="green">442</FONT>    <a name="line.442"></a>
+<FONT color="green">443</FONT>            final int nRows = getRowDimension();<a name="line.443"></a>
+<FONT color="green">444</FONT>            final int nCols = getColumnDimension();<a name="line.444"></a>
+<FONT color="green">445</FONT>            if (v.length != nRows) {<a name="line.445"></a>
+<FONT color="green">446</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.446"></a>
+<FONT color="green">447</FONT>                        "vector length mismatch: got {0} but expected {1}",<a name="line.447"></a>
+<FONT color="green">448</FONT>                        v.length, nRows);<a name="line.448"></a>
+<FONT color="green">449</FONT>            }<a name="line.449"></a>
+<FONT color="green">450</FONT>    <a name="line.450"></a>
+<FONT color="green">451</FONT>            final double[] out = new double[nCols];<a name="line.451"></a>
+<FONT color="green">452</FONT>            for (int col = 0; col &lt; nCols; ++col) {<a name="line.452"></a>
+<FONT color="green">453</FONT>                double sum = 0;<a name="line.453"></a>
+<FONT color="green">454</FONT>                for (int i = 0; i &lt; nRows; ++i) {<a name="line.454"></a>
+<FONT color="green">455</FONT>                    sum += data[i][col] * v[i];<a name="line.455"></a>
+<FONT color="green">456</FONT>                }<a name="line.456"></a>
+<FONT color="green">457</FONT>                out[col] = sum;<a name="line.457"></a>
+<FONT color="green">458</FONT>            }<a name="line.458"></a>
+<FONT color="green">459</FONT>    <a name="line.459"></a>
+<FONT color="green">460</FONT>            return out;<a name="line.460"></a>
+<FONT color="green">461</FONT>    <a name="line.461"></a>
+<FONT color="green">462</FONT>        }<a name="line.462"></a>
+<FONT color="green">463</FONT>    <a name="line.463"></a>
+<FONT color="green">464</FONT>        /** {@inheritDoc} */<a name="line.464"></a>
+<FONT color="green">465</FONT>        @Override<a name="line.465"></a>
+<FONT color="green">466</FONT>        public double walkInRowOrder(final RealMatrixChangingVisitor visitor)<a name="line.466"></a>
+<FONT color="green">467</FONT>            throws MatrixVisitorException {<a name="line.467"></a>
+<FONT color="green">468</FONT>            final int rows    = getRowDimension();<a name="line.468"></a>
+<FONT color="green">469</FONT>            final int columns = getColumnDimension();<a name="line.469"></a>
+<FONT color="green">470</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.470"></a>
+<FONT color="green">471</FONT>            for (int i = 0; i &lt; rows; ++i) {<a name="line.471"></a>
+<FONT color="green">472</FONT>                final double[] rowI = data[i];<a name="line.472"></a>
+<FONT color="green">473</FONT>                for (int j = 0; j &lt; columns; ++j) {<a name="line.473"></a>
+<FONT color="green">474</FONT>                    rowI[j] = visitor.visit(i, j, rowI[j]);<a name="line.474"></a>
+<FONT color="green">475</FONT>                }<a name="line.475"></a>
+<FONT color="green">476</FONT>            }<a name="line.476"></a>
+<FONT color="green">477</FONT>            return visitor.end();<a name="line.477"></a>
+<FONT color="green">478</FONT>        }<a name="line.478"></a>
+<FONT color="green">479</FONT>    <a name="line.479"></a>
+<FONT color="green">480</FONT>        /** {@inheritDoc} */<a name="line.480"></a>
+<FONT color="green">481</FONT>        @Override<a name="line.481"></a>
+<FONT color="green">482</FONT>        public double walkInRowOrder(final RealMatrixPreservingVisitor visitor)<a name="line.482"></a>
+<FONT color="green">483</FONT>            throws MatrixVisitorException {<a name="line.483"></a>
+<FONT color="green">484</FONT>            final int rows    = getRowDimension();<a name="line.484"></a>
+<FONT color="green">485</FONT>            final int columns = getColumnDimension();<a name="line.485"></a>
+<FONT color="green">486</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.486"></a>
+<FONT color="green">487</FONT>            for (int i = 0; i &lt; rows; ++i) {<a name="line.487"></a>
+<FONT color="green">488</FONT>                final double[] rowI = data[i];<a name="line.488"></a>
+<FONT color="green">489</FONT>                for (int j = 0; j &lt; columns; ++j) {<a name="line.489"></a>
+<FONT color="green">490</FONT>                    visitor.visit(i, j, rowI[j]);<a name="line.490"></a>
+<FONT color="green">491</FONT>                }<a name="line.491"></a>
+<FONT color="green">492</FONT>            }<a name="line.492"></a>
+<FONT color="green">493</FONT>            return visitor.end();<a name="line.493"></a>
+<FONT color="green">494</FONT>        }<a name="line.494"></a>
+<FONT color="green">495</FONT>    <a name="line.495"></a>
+<FONT color="green">496</FONT>        /** {@inheritDoc} */<a name="line.496"></a>
+<FONT color="green">497</FONT>        @Override<a name="line.497"></a>
+<FONT color="green">498</FONT>        public double walkInRowOrder(final RealMatrixChangingVisitor visitor,<a name="line.498"></a>
+<FONT color="green">499</FONT>                                     final int startRow, final int endRow,<a name="line.499"></a>
+<FONT color="green">500</FONT>                                     final int startColumn, final int endColumn)<a name="line.500"></a>
+<FONT color="green">501</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.501"></a>
+<FONT color="green">502</FONT>            MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);<a name="line.502"></a>
+<FONT color="green">503</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.503"></a>
+<FONT color="green">504</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.504"></a>
+<FONT color="green">505</FONT>            for (int i = startRow; i &lt;= endRow; ++i) {<a name="line.505"></a>
+<FONT color="green">506</FONT>                final double[] rowI = data[i];<a name="line.506"></a>
+<FONT color="green">507</FONT>                for (int j = startColumn; j &lt;= endColumn; ++j) {<a name="line.507"></a>
+<FONT color="green">508</FONT>                    rowI[j] = visitor.visit(i, j, rowI[j]);<a name="line.508"></a>
+<FONT color="green">509</FONT>                }<a name="line.509"></a>
+<FONT color="green">510</FONT>            }<a name="line.510"></a>
+<FONT color="green">511</FONT>            return visitor.end();<a name="line.511"></a>
+<FONT color="green">512</FONT>        }<a name="line.512"></a>
+<FONT color="green">513</FONT>    <a name="line.513"></a>
+<FONT color="green">514</FONT>        /** {@inheritDoc} */<a name="line.514"></a>
+<FONT color="green">515</FONT>        @Override<a name="line.515"></a>
+<FONT color="green">516</FONT>        public double walkInRowOrder(final RealMatrixPreservingVisitor visitor,<a name="line.516"></a>
+<FONT color="green">517</FONT>                                     final int startRow, final int endRow,<a name="line.517"></a>
+<FONT color="green">518</FONT>                                     final int startColumn, final int endColumn)<a name="line.518"></a>
+<FONT color="green">519</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.519"></a>
+<FONT color="green">520</FONT>            MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);<a name="line.520"></a>
+<FONT color="green">521</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.521"></a>
+<FONT color="green">522</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.522"></a>
+<FONT color="green">523</FONT>            for (int i = startRow; i &lt;= endRow; ++i) {<a name="line.523"></a>
+<FONT color="green">524</FONT>                final double[] rowI = data[i];<a name="line.524"></a>
+<FONT color="green">525</FONT>                for (int j = startColumn; j &lt;= endColumn; ++j) {<a name="line.525"></a>
+<FONT color="green">526</FONT>                    visitor.visit(i, j, rowI[j]);<a name="line.526"></a>
+<FONT color="green">527</FONT>                }<a name="line.527"></a>
+<FONT color="green">528</FONT>            }<a name="line.528"></a>
+<FONT color="green">529</FONT>            return visitor.end();<a name="line.529"></a>
+<FONT color="green">530</FONT>        }<a name="line.530"></a>
+<FONT color="green">531</FONT>    <a name="line.531"></a>
+<FONT color="green">532</FONT>        /** {@inheritDoc} */<a name="line.532"></a>
+<FONT color="green">533</FONT>        @Override<a name="line.533"></a>
+<FONT color="green">534</FONT>        public double walkInColumnOrder(final RealMatrixChangingVisitor visitor)<a name="line.534"></a>
+<FONT color="green">535</FONT>            throws MatrixVisitorException {<a name="line.535"></a>
+<FONT color="green">536</FONT>            final int rows    = getRowDimension();<a name="line.536"></a>
+<FONT color="green">537</FONT>            final int columns = getColumnDimension();<a name="line.537"></a>
+<FONT color="green">538</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.538"></a>
+<FONT color="green">539</FONT>            for (int j = 0; j &lt; columns; ++j) {<a name="line.539"></a>
+<FONT color="green">540</FONT>                for (int i = 0; i &lt; rows; ++i) {<a name="line.540"></a>
+<FONT color="green">541</FONT>                    final double[] rowI = data[i];<a name="line.541"></a>
+<FONT color="green">542</FONT>                    rowI[j] = visitor.visit(i, j, rowI[j]);<a name="line.542"></a>
+<FONT color="green">543</FONT>                }<a name="line.543"></a>
+<FONT color="green">544</FONT>            }<a name="line.544"></a>
+<FONT color="green">545</FONT>            return visitor.end();<a name="line.545"></a>
+<FONT color="green">546</FONT>        }<a name="line.546"></a>
+<FONT color="green">547</FONT>    <a name="line.547"></a>
+<FONT color="green">548</FONT>        /** {@inheritDoc} */<a name="line.548"></a>
+<FONT color="green">549</FONT>        @Override<a name="line.549"></a>
+<FONT color="green">550</FONT>        public double walkInColumnOrder(final RealMatrixPreservingVisitor visitor)<a name="line.550"></a>
+<FONT color="green">551</FONT>            throws MatrixVisitorException {<a name="line.551"></a>
+<FONT color="green">552</FONT>            final int rows    = getRowDimension();<a name="line.552"></a>
+<FONT color="green">553</FONT>            final int columns = getColumnDimension();<a name="line.553"></a>
+<FONT color="green">554</FONT>            visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);<a name="line.554"></a>
+<FONT color="green">555</FONT>            for (int j = 0; j &lt; columns; ++j) {<a name="line.555"></a>
+<FONT color="green">556</FONT>                for (int i = 0; i &lt; rows; ++i) {<a name="line.556"></a>
+<FONT color="green">557</FONT>                    visitor.visit(i, j, data[i][j]);<a name="line.557"></a>
+<FONT color="green">558</FONT>                }<a name="line.558"></a>
+<FONT color="green">559</FONT>            }<a name="line.559"></a>
+<FONT color="green">560</FONT>            return visitor.end();<a name="line.560"></a>
+<FONT color="green">561</FONT>        }<a name="line.561"></a>
+<FONT color="green">562</FONT>    <a name="line.562"></a>
+<FONT color="green">563</FONT>        /** {@inheritDoc} */<a name="line.563"></a>
+<FONT color="green">564</FONT>        @Override<a name="line.564"></a>
+<FONT color="green">565</FONT>        public double walkInColumnOrder(final RealMatrixChangingVisitor visitor,<a name="line.565"></a>
+<FONT color="green">566</FONT>                                        final int startRow, final int endRow,<a name="line.566"></a>
+<FONT color="green">567</FONT>                                        final int startColumn, final int endColumn)<a name="line.567"></a>
+<FONT color="green">568</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.568"></a>
+<FONT color="green">569</FONT>            MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);<a name="line.569"></a>
+<FONT color="green">570</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.570"></a>
+<FONT color="green">571</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.571"></a>
+<FONT color="green">572</FONT>            for (int j = startColumn; j &lt;= endColumn; ++j) {<a name="line.572"></a>
+<FONT color="green">573</FONT>                for (int i = startRow; i &lt;= endRow; ++i) {<a name="line.573"></a>
+<FONT color="green">574</FONT>                    final double[] rowI = data[i];<a name="line.574"></a>
+<FONT color="green">575</FONT>                    rowI[j] = visitor.visit(i, j, rowI[j]);<a name="line.575"></a>
+<FONT color="green">576</FONT>                }<a name="line.576"></a>
+<FONT color="green">577</FONT>            }<a name="line.577"></a>
+<FONT color="green">578</FONT>            return visitor.end();<a name="line.578"></a>
+<FONT color="green">579</FONT>        }<a name="line.579"></a>
+<FONT color="green">580</FONT>    <a name="line.580"></a>
+<FONT color="green">581</FONT>        /** {@inheritDoc} */<a name="line.581"></a>
+<FONT color="green">582</FONT>        @Override<a name="line.582"></a>
+<FONT color="green">583</FONT>        public double walkInColumnOrder(final RealMatrixPreservingVisitor visitor,<a name="line.583"></a>
+<FONT color="green">584</FONT>                                        final int startRow, final int endRow,<a name="line.584"></a>
+<FONT color="green">585</FONT>                                        final int startColumn, final int endColumn)<a name="line.585"></a>
+<FONT color="green">586</FONT>            throws MatrixIndexException, MatrixVisitorException {<a name="line.586"></a>
+<FONT color="green">587</FONT>            MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);<a name="line.587"></a>
+<FONT color="green">588</FONT>            visitor.start(getRowDimension(), getColumnDimension(),<a name="line.588"></a>
+<FONT color="green">589</FONT>                          startRow, endRow, startColumn, endColumn);<a name="line.589"></a>
+<FONT color="green">590</FONT>            for (int j = startColumn; j &lt;= endColumn; ++j) {<a name="line.590"></a>
+<FONT color="green">591</FONT>                for (int i = startRow; i &lt;= endRow; ++i) {<a name="line.591"></a>
+<FONT color="green">592</FONT>                    visitor.visit(i, j, data[i][j]);<a name="line.592"></a>
+<FONT color="green">593</FONT>                }<a name="line.593"></a>
+<FONT color="green">594</FONT>            }<a name="line.594"></a>
+<FONT color="green">595</FONT>            return visitor.end();<a name="line.595"></a>
+<FONT color="green">596</FONT>        }<a name="line.596"></a>
+<FONT color="green">597</FONT>    <a name="line.597"></a>
+<FONT color="green">598</FONT>        /**<a name="line.598"></a>
+<FONT color="green">599</FONT>         * Returns a fresh copy of the underlying data array.<a name="line.599"></a>
+<FONT color="green">600</FONT>         *<a name="line.600"></a>
+<FONT color="green">601</FONT>         * @return a copy of the underlying data array.<a name="line.601"></a>
+<FONT color="green">602</FONT>         */<a name="line.602"></a>
+<FONT color="green">603</FONT>        private double[][] copyOut() {<a name="line.603"></a>
+<FONT color="green">604</FONT>            final int nRows = this.getRowDimension();<a name="line.604"></a>
+<FONT color="green">605</FONT>            final double[][] out = new double[nRows][this.getColumnDimension()];<a name="line.605"></a>
+<FONT color="green">606</FONT>            // can't copy 2-d array in one shot, otherwise get row references<a name="line.606"></a>
+<FONT color="green">607</FONT>            for (int i = 0; i &lt; nRows; i++) {<a name="line.607"></a>
+<FONT color="green">608</FONT>                System.arraycopy(data[i], 0, out[i], 0, data[i].length);<a name="line.608"></a>
+<FONT color="green">609</FONT>            }<a name="line.609"></a>
+<FONT color="green">610</FONT>            return out;<a name="line.610"></a>
+<FONT color="green">611</FONT>        }<a name="line.611"></a>
+<FONT color="green">612</FONT>    <a name="line.612"></a>
+<FONT color="green">613</FONT>        /**<a name="line.613"></a>
+<FONT color="green">614</FONT>         * Replaces data with a fresh copy of the input array.<a name="line.614"></a>
+<FONT color="green">615</FONT>         * &lt;p&gt;<a name="line.615"></a>
+<FONT color="green">616</FONT>         * Verifies that the input array is rectangular and non-empty.&lt;/p&gt;<a name="line.616"></a>
+<FONT color="green">617</FONT>         *<a name="line.617"></a>
+<FONT color="green">618</FONT>         * @param in data to copy in<a name="line.618"></a>
+<FONT color="green">619</FONT>         * @throws IllegalArgumentException if input array is empty or not<a name="line.619"></a>
+<FONT color="green">620</FONT>         *    rectangular<a name="line.620"></a>
+<FONT color="green">621</FONT>         * @throws NullPointerException if input array is null<a name="line.621"></a>
+<FONT color="green">622</FONT>         */<a name="line.622"></a>
+<FONT color="green">623</FONT>        private void copyIn(final double[][] in) {<a name="line.623"></a>
+<FONT color="green">624</FONT>            setSubMatrix(in, 0, 0);<a name="line.624"></a>
+<FONT color="green">625</FONT>        }<a name="line.625"></a>
+<FONT color="green">626</FONT>    <a name="line.626"></a>
+<FONT color="green">627</FONT>    }<a name="line.627"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/RealMatrixPreservingVisitor.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,125 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Interface defining a visitor for matrix entries.<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @see DefaultRealMatrixPreservingVisitor<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @since 2.0<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public interface RealMatrixPreservingVisitor {<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>        /**<a name="line.29"></a>
+<FONT color="green">030</FONT>         * Start visiting a matrix.<a name="line.30"></a>
+<FONT color="green">031</FONT>         * &lt;p&gt;This method is called once before any entry of the matrix is visited.&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>         * @param rows number of rows of the matrix<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @param columns number of columns of the matrix<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @param startRow Initial row index<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @param endRow Final row index (inclusive)<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @param startColumn Initial column index<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @param endColumn Final column index (inclusive)<a name="line.37"></a>
+<FONT color="green">038</FONT>         */<a name="line.38"></a>
+<FONT color="green">039</FONT>        void start(int rows, int columns,<a name="line.39"></a>
+<FONT color="green">040</FONT>                   int startRow, int endRow, int startColumn, int endColumn);<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /**<a name="line.42"></a>
+<FONT color="green">043</FONT>         * Visit one matrix entry.<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @param row row index of the entry<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @param column column index of the entry<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param value current value of the entry<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @throws MatrixVisitorException if something wrong occurs<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        void visit(int row, int column, double value)<a name="line.49"></a>
+<FONT color="green">050</FONT>            throws MatrixVisitorException;<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * End visiting a matrix.<a name="line.53"></a>
+<FONT color="green">054</FONT>         * &lt;p&gt;This method is called once after all entries of the matrix have been visited.&lt;/p&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @return the value that the &lt;code&gt;walkInXxxOrder&lt;/code&gt; must return<a name="line.55"></a>
+<FONT color="green">056</FONT>         */<a name="line.56"></a>
+<FONT color="green">057</FONT>        double end();<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>    }<a name="line.59"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/RealVector.Entry.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,939 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.linear;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.Iterator;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Interface defining a real-valued vector with basic algebraic operations.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * vector element indexing is 0-based -- e.g., &lt;code&gt;getEntry(0)&lt;/code&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * returns the first element of the vector.<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * The various &lt;code&gt;mapXxx&lt;/code&gt; and &lt;code&gt;mapXxxToSelf&lt;/code&gt; methods operate<a name="line.32"></a>
+<FONT color="green">033</FONT>     * on vectors element-wise, i.e. they perform the same operation (adding a scalar,<a name="line.33"></a>
+<FONT color="green">034</FONT>     * applying a function ...) on each element in turn. The &lt;code&gt;mapXxx&lt;/code&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * versions create a new vector to hold the result and do not change the instance.<a name="line.35"></a>
+<FONT color="green">036</FONT>     * The &lt;code&gt;mapXxxToSelf&lt;/code&gt; versions use the instance itself to store the<a name="line.36"></a>
+<FONT color="green">037</FONT>     * results, so the instance is changed by these methods. In both cases, the result<a name="line.37"></a>
+<FONT color="green">038</FONT>     * vector is returned by the methods, this allows to use the &lt;i&gt;fluent API&lt;/i&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * style, like this:<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;/p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;pre&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     *   RealVector result = v.mapAddToSelf(3.0).mapTanToSelf().mapSquareToSelf();<a name="line.42"></a>
+<FONT color="green">043</FONT>     * &lt;/pre&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     *<a name="line.44"></a>
+<FONT color="green">045</FONT>     * @version $Revision: 902214 $ $Date: 2010-01-22 13:40:28 -0500 (Fri, 22 Jan 2010) $<a name="line.45"></a>
+<FONT color="green">046</FONT>     * @since 2.0<a name="line.46"></a>
+<FONT color="green">047</FONT>     */<a name="line.47"></a>
+<FONT color="green">048</FONT>    public interface RealVector {<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Acts as if it is implemented as:<a name="line.51"></a>
+<FONT color="green">052</FONT>         * Entry e = null;<a name="line.52"></a>
+<FONT color="green">053</FONT>         * for(Iterator&lt;Entry&gt; it = iterator(); it.hasNext(); e = it.next()) {<a name="line.53"></a>
+<FONT color="green">054</FONT>         *   e.setValue(function.value(e.getValue()));<a name="line.54"></a>
+<FONT color="green">055</FONT>         * }<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param function to apply to each successive entry<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @return this vector<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @throws FunctionEvaluationException if function throws it on application to any entry<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        RealVector mapToSelf(UnivariateRealFunction function) throws FunctionEvaluationException;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /**<a name="line.62"></a>
+<FONT color="green">063</FONT>         * Acts as if implemented as:<a name="line.63"></a>
+<FONT color="green">064</FONT>         * return copy().map(function);<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param function to apply to each successive entry<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @return a new vector<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @throws FunctionEvaluationException if function throws it on application to any entry<a name="line.67"></a>
+<FONT color="green">068</FONT>         */<a name="line.68"></a>
+<FONT color="green">069</FONT>        RealVector map(UnivariateRealFunction function) throws FunctionEvaluationException;<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** Class representing a modifiable entry in the vector. */<a name="line.71"></a>
+<FONT color="green">072</FONT>        public abstract class Entry {<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>            /** Index of the entry. */<a name="line.74"></a>
+<FONT color="green">075</FONT>            private int index;<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>            /** Get the value of the entry.<a name="line.77"></a>
+<FONT color="green">078</FONT>             * @return value of the entry<a name="line.78"></a>
+<FONT color="green">079</FONT>             */<a name="line.79"></a>
+<FONT color="green">080</FONT>            public abstract double getValue();<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>            /** Set the value of the entry.<a name="line.82"></a>
+<FONT color="green">083</FONT>             * @param value new value for the entry<a name="line.83"></a>
+<FONT color="green">084</FONT>             */<a name="line.84"></a>
+<FONT color="green">085</FONT>            public abstract void setValue(double value);<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>            /** Get the index of the entry.<a name="line.87"></a>
+<FONT color="green">088</FONT>             * @return index of the entry<a name="line.88"></a>
+<FONT color="green">089</FONT>             */<a name="line.89"></a>
+<FONT color="green">090</FONT>            public int getIndex() {<a name="line.90"></a>
+<FONT color="green">091</FONT>                return index;<a name="line.91"></a>
+<FONT color="green">092</FONT>            }<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>            /** Set the index of the entry.<a name="line.94"></a>
+<FONT color="green">095</FONT>             * @param index new index for the entry<a name="line.95"></a>
+<FONT color="green">096</FONT>             */<a name="line.96"></a>
+<FONT color="green">097</FONT>            public void setIndex(int index) {<a name="line.97"></a>
+<FONT color="green">098</FONT>                this.index = index;<a name="line.98"></a>
+<FONT color="green">099</FONT>            }<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        }<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        /**<a name="line.103"></a>
+<FONT color="green">104</FONT>         * Generic dense iterator - starts with index == zero, and hasNext() == true until index == getDimension();<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @return a dense iterator<a name="line.105"></a>
+<FONT color="green">106</FONT>         */<a name="line.106"></a>
+<FONT color="green">107</FONT>        Iterator&lt;Entry&gt; iterator();<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /**<a name="line.109"></a>
+<FONT color="green">110</FONT>         * Specialized implementations may choose to not iterate over all dimensions, either because those values are<a name="line.110"></a>
+<FONT color="green">111</FONT>         * unset, or are equal to defaultValue(), or are small enough to be ignored for the purposes of iteration.<a name="line.111"></a>
+<FONT color="green">112</FONT>         * No guarantees are made about order of iteration.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * In dense implementations, this method will often delegate to {@link #iterator()}<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @return a sparse iterator<a name="line.114"></a>
+<FONT color="green">115</FONT>         */<a name="line.115"></a>
+<FONT color="green">116</FONT>        Iterator&lt;Entry&gt; sparseIterator();<a name="line.116"></a>
+<FONT color="green">117</FONT>    <a name="line.117"></a>
+<FONT color="green">118</FONT>        /**<a name="line.118"></a>
+<FONT color="green">119</FONT>         * Returns a (deep) copy of this.<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @return vector copy<a name="line.120"></a>
+<FONT color="green">121</FONT>         */<a name="line.121"></a>
+<FONT color="green">122</FONT>        RealVector copy();<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>        /**<a name="line.124"></a>
+<FONT color="green">125</FONT>         * Compute the sum of this and v.<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @param v vector to be added<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @return this + v<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.128"></a>
+<FONT color="green">129</FONT>         */<a name="line.129"></a>
+<FONT color="green">130</FONT>        RealVector add(RealVector v)<a name="line.130"></a>
+<FONT color="green">131</FONT>            throws IllegalArgumentException;<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>        /**<a name="line.133"></a>
+<FONT color="green">134</FONT>         * Compute the sum of this and v.<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @param v vector to be added<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @return this + v<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.137"></a>
+<FONT color="green">138</FONT>         */<a name="line.138"></a>
+<FONT color="green">139</FONT>        RealVector add(double[] v)<a name="line.139"></a>
+<FONT color="green">140</FONT>            throws IllegalArgumentException;<a name="line.140"></a>
+<FONT color="green">141</FONT>    <a name="line.141"></a>
+<FONT color="green">142</FONT>        /**<a name="line.142"></a>
+<FONT color="green">143</FONT>         * Compute this minus v.<a name="line.143"></a>
+<FONT color="green">144</FONT>         * @param v vector to be subtracted<a name="line.144"></a>
+<FONT color="green">145</FONT>         * @return this + v<a name="line.145"></a>
+<FONT color="green">146</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.146"></a>
+<FONT color="green">147</FONT>         */<a name="line.147"></a>
+<FONT color="green">148</FONT>        RealVector subtract(RealVector v)<a name="line.148"></a>
+<FONT color="green">149</FONT>            throws IllegalArgumentException;<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>        /**<a name="line.151"></a>
+<FONT color="green">152</FONT>         * Compute this minus v.<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @param v vector to be subtracted<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @return this + v<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.155"></a>
+<FONT color="green">156</FONT>         */<a name="line.156"></a>
+<FONT color="green">157</FONT>        RealVector subtract(double[] v)<a name="line.157"></a>
+<FONT color="green">158</FONT>            throws IllegalArgumentException;<a name="line.158"></a>
+<FONT color="green">159</FONT>    <a name="line.159"></a>
+<FONT color="green">160</FONT>        /**<a name="line.160"></a>
+<FONT color="green">161</FONT>         * Map an addition operation to each entry.<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @param d value to be added to each entry<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @return this + d<a name="line.163"></a>
+<FONT color="green">164</FONT>         */<a name="line.164"></a>
+<FONT color="green">165</FONT>        RealVector mapAdd(double d);<a name="line.165"></a>
+<FONT color="green">166</FONT>    <a name="line.166"></a>
+<FONT color="green">167</FONT>        /**<a name="line.167"></a>
+<FONT color="green">168</FONT>         * Map an addition operation to each entry.<a name="line.168"></a>
+<FONT color="green">169</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.169"></a>
+<FONT color="green">170</FONT>         * @param d value to be added to each entry<a name="line.170"></a>
+<FONT color="green">171</FONT>         * @return for convenience, return this<a name="line.171"></a>
+<FONT color="green">172</FONT>         */<a name="line.172"></a>
+<FONT color="green">173</FONT>        RealVector mapAddToSelf(double d);<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>        /**<a name="line.175"></a>
+<FONT color="green">176</FONT>         * Map a subtraction operation to each entry.<a name="line.176"></a>
+<FONT color="green">177</FONT>         * @param d value to be subtracted to each entry<a name="line.177"></a>
+<FONT color="green">178</FONT>         * @return this - d<a name="line.178"></a>
+<FONT color="green">179</FONT>         */<a name="line.179"></a>
+<FONT color="green">180</FONT>        RealVector mapSubtract(double d);<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>        /**<a name="line.182"></a>
+<FONT color="green">183</FONT>         * Map a subtraction operation to each entry.<a name="line.183"></a>
+<FONT color="green">184</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.184"></a>
+<FONT color="green">185</FONT>         * @param d value to be subtracted to each entry<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @return for convenience, return this<a name="line.186"></a>
+<FONT color="green">187</FONT>         */<a name="line.187"></a>
+<FONT color="green">188</FONT>        RealVector mapSubtractToSelf(double d);<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>        /**<a name="line.190"></a>
+<FONT color="green">191</FONT>         * Map a multiplication operation to each entry.<a name="line.191"></a>
+<FONT color="green">192</FONT>         * @param d value to multiply all entries by<a name="line.192"></a>
+<FONT color="green">193</FONT>         * @return this * d<a name="line.193"></a>
+<FONT color="green">194</FONT>         */<a name="line.194"></a>
+<FONT color="green">195</FONT>        RealVector mapMultiply(double d);<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>        /**<a name="line.197"></a>
+<FONT color="green">198</FONT>         * Map a multiplication operation to each entry.<a name="line.198"></a>
+<FONT color="green">199</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.199"></a>
+<FONT color="green">200</FONT>         * @param d value to multiply all entries by<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @return for convenience, return this<a name="line.201"></a>
+<FONT color="green">202</FONT>         */<a name="line.202"></a>
+<FONT color="green">203</FONT>        RealVector mapMultiplyToSelf(double d);<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>        /**<a name="line.205"></a>
+<FONT color="green">206</FONT>         * Map a division operation to each entry.<a name="line.206"></a>
+<FONT color="green">207</FONT>         * @param d value to divide all entries by<a name="line.207"></a>
+<FONT color="green">208</FONT>         * @return this / d<a name="line.208"></a>
+<FONT color="green">209</FONT>         */<a name="line.209"></a>
+<FONT color="green">210</FONT>        RealVector mapDivide(double d);<a name="line.210"></a>
+<FONT color="green">211</FONT>    <a name="line.211"></a>
+<FONT color="green">212</FONT>        /**<a name="line.212"></a>
+<FONT color="green">213</FONT>         * Map a division operation to each entry.<a name="line.213"></a>
+<FONT color="green">214</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.214"></a>
+<FONT color="green">215</FONT>         * @param d value to divide all entries by<a name="line.215"></a>
+<FONT color="green">216</FONT>         * @return for convenience, return this<a name="line.216"></a>
+<FONT color="green">217</FONT>         */<a name="line.217"></a>
+<FONT color="green">218</FONT>        RealVector mapDivideToSelf(double d);<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>        /**<a name="line.220"></a>
+<FONT color="green">221</FONT>         * Map a power operation to each entry.<a name="line.221"></a>
+<FONT color="green">222</FONT>         * @param d value to raise all entries to<a name="line.222"></a>
+<FONT color="green">223</FONT>         * @return this ^ d<a name="line.223"></a>
+<FONT color="green">224</FONT>         */<a name="line.224"></a>
+<FONT color="green">225</FONT>        RealVector mapPow(double d);<a name="line.225"></a>
+<FONT color="green">226</FONT>    <a name="line.226"></a>
+<FONT color="green">227</FONT>        /**<a name="line.227"></a>
+<FONT color="green">228</FONT>         * Map a power operation to each entry.<a name="line.228"></a>
+<FONT color="green">229</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.229"></a>
+<FONT color="green">230</FONT>         * @param d value to raise all entries to<a name="line.230"></a>
+<FONT color="green">231</FONT>         * @return for convenience, return this<a name="line.231"></a>
+<FONT color="green">232</FONT>         */<a name="line.232"></a>
+<FONT color="green">233</FONT>        RealVector mapPowToSelf(double d);<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>        /**<a name="line.235"></a>
+<FONT color="green">236</FONT>         * Map the {@link Math#exp(double)} function to each entry.<a name="line.236"></a>
+<FONT color="green">237</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.237"></a>
+<FONT color="green">238</FONT>         */<a name="line.238"></a>
+<FONT color="green">239</FONT>        RealVector mapExp();<a name="line.239"></a>
+<FONT color="green">240</FONT>    <a name="line.240"></a>
+<FONT color="green">241</FONT>        /**<a name="line.241"></a>
+<FONT color="green">242</FONT>         * Map the {@link Math#exp(double)} function to each entry.<a name="line.242"></a>
+<FONT color="green">243</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.243"></a>
+<FONT color="green">244</FONT>         * @return for convenience, return this<a name="line.244"></a>
+<FONT color="green">245</FONT>         */<a name="line.245"></a>
+<FONT color="green">246</FONT>        RealVector mapExpToSelf();<a name="line.246"></a>
+<FONT color="green">247</FONT>    <a name="line.247"></a>
+<FONT color="green">248</FONT>        /**<a name="line.248"></a>
+<FONT color="green">249</FONT>         * Map the {@link Math#expm1(double)} function to each entry.<a name="line.249"></a>
+<FONT color="green">250</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.250"></a>
+<FONT color="green">251</FONT>         */<a name="line.251"></a>
+<FONT color="green">252</FONT>        RealVector mapExpm1();<a name="line.252"></a>
+<FONT color="green">253</FONT>    <a name="line.253"></a>
+<FONT color="green">254</FONT>        /**<a name="line.254"></a>
+<FONT color="green">255</FONT>         * Map the {@link Math#expm1(double)} function to each entry.<a name="line.255"></a>
+<FONT color="green">256</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.256"></a>
+<FONT color="green">257</FONT>         * @return for convenience, return this<a name="line.257"></a>
+<FONT color="green">258</FONT>         */<a name="line.258"></a>
+<FONT color="green">259</FONT>        RealVector mapExpm1ToSelf();<a name="line.259"></a>
+<FONT color="green">260</FONT>    <a name="line.260"></a>
+<FONT color="green">261</FONT>        /**<a name="line.261"></a>
+<FONT color="green">262</FONT>         * Map the {@link Math#log(double)} function to each entry.<a name="line.262"></a>
+<FONT color="green">263</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.263"></a>
+<FONT color="green">264</FONT>         */<a name="line.264"></a>
+<FONT color="green">265</FONT>        RealVector mapLog();<a name="line.265"></a>
+<FONT color="green">266</FONT>    <a name="line.266"></a>
+<FONT color="green">267</FONT>        /**<a name="line.267"></a>
+<FONT color="green">268</FONT>         * Map the {@link Math#log(double)} function to each entry.<a name="line.268"></a>
+<FONT color="green">269</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.269"></a>
+<FONT color="green">270</FONT>         * @return for convenience, return this<a name="line.270"></a>
+<FONT color="green">271</FONT>         */<a name="line.271"></a>
+<FONT color="green">272</FONT>        RealVector mapLogToSelf();<a name="line.272"></a>
+<FONT color="green">273</FONT>    <a name="line.273"></a>
+<FONT color="green">274</FONT>        /**<a name="line.274"></a>
+<FONT color="green">275</FONT>         * Map the {@link Math#log10(double)} function to each entry.<a name="line.275"></a>
+<FONT color="green">276</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.276"></a>
+<FONT color="green">277</FONT>         */<a name="line.277"></a>
+<FONT color="green">278</FONT>        RealVector mapLog10();<a name="line.278"></a>
+<FONT color="green">279</FONT>    <a name="line.279"></a>
+<FONT color="green">280</FONT>        /**<a name="line.280"></a>
+<FONT color="green">281</FONT>         * Map the {@link Math#log10(double)} function to each entry.<a name="line.281"></a>
+<FONT color="green">282</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.282"></a>
+<FONT color="green">283</FONT>         * @return for convenience, return this<a name="line.283"></a>
+<FONT color="green">284</FONT>         */<a name="line.284"></a>
+<FONT color="green">285</FONT>        RealVector mapLog10ToSelf();<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>        /**<a name="line.287"></a>
+<FONT color="green">288</FONT>         * Map the {@link Math#log1p(double)} function to each entry.<a name="line.288"></a>
+<FONT color="green">289</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.289"></a>
+<FONT color="green">290</FONT>         */<a name="line.290"></a>
+<FONT color="green">291</FONT>        RealVector mapLog1p();<a name="line.291"></a>
+<FONT color="green">292</FONT>    <a name="line.292"></a>
+<FONT color="green">293</FONT>        /**<a name="line.293"></a>
+<FONT color="green">294</FONT>         * Map the {@link Math#log1p(double)} function to each entry.<a name="line.294"></a>
+<FONT color="green">295</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.295"></a>
+<FONT color="green">296</FONT>         * @return for convenience, return this<a name="line.296"></a>
+<FONT color="green">297</FONT>         */<a name="line.297"></a>
+<FONT color="green">298</FONT>        RealVector mapLog1pToSelf();<a name="line.298"></a>
+<FONT color="green">299</FONT>    <a name="line.299"></a>
+<FONT color="green">300</FONT>        /**<a name="line.300"></a>
+<FONT color="green">301</FONT>         * Map the {@link Math#cosh(double)} function to each entry.<a name="line.301"></a>
+<FONT color="green">302</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.302"></a>
+<FONT color="green">303</FONT>         */<a name="line.303"></a>
+<FONT color="green">304</FONT>        RealVector mapCosh();<a name="line.304"></a>
+<FONT color="green">305</FONT>    <a name="line.305"></a>
+<FONT color="green">306</FONT>        /**<a name="line.306"></a>
+<FONT color="green">307</FONT>         * Map the {@link Math#cosh(double)} function to each entry.<a name="line.307"></a>
+<FONT color="green">308</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.308"></a>
+<FONT color="green">309</FONT>         * @return for convenience, return this<a name="line.309"></a>
+<FONT color="green">310</FONT>         */<a name="line.310"></a>
+<FONT color="green">311</FONT>        RealVector mapCoshToSelf();<a name="line.311"></a>
+<FONT color="green">312</FONT>    <a name="line.312"></a>
+<FONT color="green">313</FONT>        /**<a name="line.313"></a>
+<FONT color="green">314</FONT>         * Map the {@link Math#sinh(double)} function to each entry.<a name="line.314"></a>
+<FONT color="green">315</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.315"></a>
+<FONT color="green">316</FONT>         */<a name="line.316"></a>
+<FONT color="green">317</FONT>        RealVector mapSinh();<a name="line.317"></a>
+<FONT color="green">318</FONT>    <a name="line.318"></a>
+<FONT color="green">319</FONT>        /**<a name="line.319"></a>
+<FONT color="green">320</FONT>         * Map the {@link Math#sinh(double)} function to each entry.<a name="line.320"></a>
+<FONT color="green">321</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.321"></a>
+<FONT color="green">322</FONT>         * @return for convenience, return this<a name="line.322"></a>
+<FONT color="green">323</FONT>         */<a name="line.323"></a>
+<FONT color="green">324</FONT>        RealVector mapSinhToSelf();<a name="line.324"></a>
+<FONT color="green">325</FONT>    <a name="line.325"></a>
+<FONT color="green">326</FONT>        /**<a name="line.326"></a>
+<FONT color="green">327</FONT>         * Map the {@link Math#tanh(double)} function to each entry.<a name="line.327"></a>
+<FONT color="green">328</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.328"></a>
+<FONT color="green">329</FONT>         */<a name="line.329"></a>
+<FONT color="green">330</FONT>        RealVector mapTanh();<a name="line.330"></a>
+<FONT color="green">331</FONT>    <a name="line.331"></a>
+<FONT color="green">332</FONT>        /**<a name="line.332"></a>
+<FONT color="green">333</FONT>         * Map the {@link Math#tanh(double)} function to each entry.<a name="line.333"></a>
+<FONT color="green">334</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.334"></a>
+<FONT color="green">335</FONT>         * @return for convenience, return this<a name="line.335"></a>
+<FONT color="green">336</FONT>         */<a name="line.336"></a>
+<FONT color="green">337</FONT>        RealVector mapTanhToSelf();<a name="line.337"></a>
+<FONT color="green">338</FONT>    <a name="line.338"></a>
+<FONT color="green">339</FONT>        /**<a name="line.339"></a>
+<FONT color="green">340</FONT>         * Map the {@link Math#cos(double)} function to each entry.<a name="line.340"></a>
+<FONT color="green">341</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.341"></a>
+<FONT color="green">342</FONT>         */<a name="line.342"></a>
+<FONT color="green">343</FONT>        RealVector mapCos();<a name="line.343"></a>
+<FONT color="green">344</FONT>    <a name="line.344"></a>
+<FONT color="green">345</FONT>        /**<a name="line.345"></a>
+<FONT color="green">346</FONT>         * Map the {@link Math#cos(double)} function to each entry.<a name="line.346"></a>
+<FONT color="green">347</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.347"></a>
+<FONT color="green">348</FONT>         * @return for convenience, return this<a name="line.348"></a>
+<FONT color="green">349</FONT>         */<a name="line.349"></a>
+<FONT color="green">350</FONT>        RealVector mapCosToSelf();<a name="line.350"></a>
+<FONT color="green">351</FONT>    <a name="line.351"></a>
+<FONT color="green">352</FONT>        /**<a name="line.352"></a>
+<FONT color="green">353</FONT>         * Map the {@link Math#sin(double)} function to each entry.<a name="line.353"></a>
+<FONT color="green">354</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.354"></a>
+<FONT color="green">355</FONT>         */<a name="line.355"></a>
+<FONT color="green">356</FONT>        RealVector mapSin();<a name="line.356"></a>
+<FONT color="green">357</FONT>    <a name="line.357"></a>
+<FONT color="green">358</FONT>        /**<a name="line.358"></a>
+<FONT color="green">359</FONT>         * Map the {@link Math#sin(double)} function to each entry.<a name="line.359"></a>
+<FONT color="green">360</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.360"></a>
+<FONT color="green">361</FONT>         * @return for convenience, return this<a name="line.361"></a>
+<FONT color="green">362</FONT>         */<a name="line.362"></a>
+<FONT color="green">363</FONT>        RealVector mapSinToSelf();<a name="line.363"></a>
+<FONT color="green">364</FONT>    <a name="line.364"></a>
+<FONT color="green">365</FONT>        /**<a name="line.365"></a>
+<FONT color="green">366</FONT>         * Map the {@link Math#tan(double)} function to each entry.<a name="line.366"></a>
+<FONT color="green">367</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.367"></a>
+<FONT color="green">368</FONT>         */<a name="line.368"></a>
+<FONT color="green">369</FONT>        RealVector mapTan();<a name="line.369"></a>
+<FONT color="green">370</FONT>    <a name="line.370"></a>
+<FONT color="green">371</FONT>        /**<a name="line.371"></a>
+<FONT color="green">372</FONT>         * Map the {@link Math#tan(double)} function to each entry.<a name="line.372"></a>
+<FONT color="green">373</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.373"></a>
+<FONT color="green">374</FONT>         * @return for convenience, return this<a name="line.374"></a>
+<FONT color="green">375</FONT>         */<a name="line.375"></a>
+<FONT color="green">376</FONT>        RealVector mapTanToSelf();<a name="line.376"></a>
+<FONT color="green">377</FONT>    <a name="line.377"></a>
+<FONT color="green">378</FONT>        /**<a name="line.378"></a>
+<FONT color="green">379</FONT>         * Map the {@link Math#acos(double)} function to each entry.<a name="line.379"></a>
+<FONT color="green">380</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.380"></a>
+<FONT color="green">381</FONT>         */<a name="line.381"></a>
+<FONT color="green">382</FONT>        RealVector mapAcos();<a name="line.382"></a>
+<FONT color="green">383</FONT>    <a name="line.383"></a>
+<FONT color="green">384</FONT>        /**<a name="line.384"></a>
+<FONT color="green">385</FONT>         * Map the {@link Math#acos(double)} function to each entry.<a name="line.385"></a>
+<FONT color="green">386</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.386"></a>
+<FONT color="green">387</FONT>         * @return for convenience, return this<a name="line.387"></a>
+<FONT color="green">388</FONT>         */<a name="line.388"></a>
+<FONT color="green">389</FONT>        RealVector mapAcosToSelf();<a name="line.389"></a>
+<FONT color="green">390</FONT>    <a name="line.390"></a>
+<FONT color="green">391</FONT>        /**<a name="line.391"></a>
+<FONT color="green">392</FONT>         * Map the {@link Math#asin(double)} function to each entry.<a name="line.392"></a>
+<FONT color="green">393</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.393"></a>
+<FONT color="green">394</FONT>         */<a name="line.394"></a>
+<FONT color="green">395</FONT>        RealVector mapAsin();<a name="line.395"></a>
+<FONT color="green">396</FONT>    <a name="line.396"></a>
+<FONT color="green">397</FONT>        /**<a name="line.397"></a>
+<FONT color="green">398</FONT>         * Map the {@link Math#asin(double)} function to each entry.<a name="line.398"></a>
+<FONT color="green">399</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.399"></a>
+<FONT color="green">400</FONT>         * @return for convenience, return this<a name="line.400"></a>
+<FONT color="green">401</FONT>         */<a name="line.401"></a>
+<FONT color="green">402</FONT>        RealVector mapAsinToSelf();<a name="line.402"></a>
+<FONT color="green">403</FONT>    <a name="line.403"></a>
+<FONT color="green">404</FONT>        /**<a name="line.404"></a>
+<FONT color="green">405</FONT>         * Map the {@link Math#atan(double)} function to each entry.<a name="line.405"></a>
+<FONT color="green">406</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.406"></a>
+<FONT color="green">407</FONT>         */<a name="line.407"></a>
+<FONT color="green">408</FONT>        RealVector mapAtan();<a name="line.408"></a>
+<FONT color="green">409</FONT>    <a name="line.409"></a>
+<FONT color="green">410</FONT>        /**<a name="line.410"></a>
+<FONT color="green">411</FONT>         * Map the {@link Math#atan(double)} function to each entry.<a name="line.411"></a>
+<FONT color="green">412</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.412"></a>
+<FONT color="green">413</FONT>         * @return for convenience, return this<a name="line.413"></a>
+<FONT color="green">414</FONT>         */<a name="line.414"></a>
+<FONT color="green">415</FONT>        RealVector mapAtanToSelf();<a name="line.415"></a>
+<FONT color="green">416</FONT>    <a name="line.416"></a>
+<FONT color="green">417</FONT>        /**<a name="line.417"></a>
+<FONT color="green">418</FONT>         * Map the 1/x function to each entry.<a name="line.418"></a>
+<FONT color="green">419</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.419"></a>
+<FONT color="green">420</FONT>         */<a name="line.420"></a>
+<FONT color="green">421</FONT>        RealVector mapInv();<a name="line.421"></a>
+<FONT color="green">422</FONT>    <a name="line.422"></a>
+<FONT color="green">423</FONT>        /**<a name="line.423"></a>
+<FONT color="green">424</FONT>         * Map the 1/x function to each entry.<a name="line.424"></a>
+<FONT color="green">425</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.425"></a>
+<FONT color="green">426</FONT>         * @return for convenience, return this<a name="line.426"></a>
+<FONT color="green">427</FONT>         */<a name="line.427"></a>
+<FONT color="green">428</FONT>        RealVector mapInvToSelf();<a name="line.428"></a>
+<FONT color="green">429</FONT>    <a name="line.429"></a>
+<FONT color="green">430</FONT>        /**<a name="line.430"></a>
+<FONT color="green">431</FONT>         * Map the {@link Math#abs(double)} function to each entry.<a name="line.431"></a>
+<FONT color="green">432</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.432"></a>
+<FONT color="green">433</FONT>         */<a name="line.433"></a>
+<FONT color="green">434</FONT>        RealVector mapAbs();<a name="line.434"></a>
+<FONT color="green">435</FONT>    <a name="line.435"></a>
+<FONT color="green">436</FONT>        /**<a name="line.436"></a>
+<FONT color="green">437</FONT>         * Map the {@link Math#abs(double)} function to each entry.<a name="line.437"></a>
+<FONT color="green">438</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.438"></a>
+<FONT color="green">439</FONT>         * @return for convenience, return this<a name="line.439"></a>
+<FONT color="green">440</FONT>         */<a name="line.440"></a>
+<FONT color="green">441</FONT>        RealVector mapAbsToSelf();<a name="line.441"></a>
+<FONT color="green">442</FONT>    <a name="line.442"></a>
+<FONT color="green">443</FONT>        /**<a name="line.443"></a>
+<FONT color="green">444</FONT>         * Map the {@link Math#sqrt(double)} function to each entry.<a name="line.444"></a>
+<FONT color="green">445</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.445"></a>
+<FONT color="green">446</FONT>         */<a name="line.446"></a>
+<FONT color="green">447</FONT>        RealVector mapSqrt();<a name="line.447"></a>
+<FONT color="green">448</FONT>    <a name="line.448"></a>
+<FONT color="green">449</FONT>        /**<a name="line.449"></a>
+<FONT color="green">450</FONT>         * Map the {@link Math#sqrt(double)} function to each entry.<a name="line.450"></a>
+<FONT color="green">451</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.451"></a>
+<FONT color="green">452</FONT>         * @return for convenience, return this<a name="line.452"></a>
+<FONT color="green">453</FONT>         */<a name="line.453"></a>
+<FONT color="green">454</FONT>        RealVector mapSqrtToSelf();<a name="line.454"></a>
+<FONT color="green">455</FONT>    <a name="line.455"></a>
+<FONT color="green">456</FONT>        /**<a name="line.456"></a>
+<FONT color="green">457</FONT>         * Map the {@link Math#cbrt(double)} function to each entry.<a name="line.457"></a>
+<FONT color="green">458</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.458"></a>
+<FONT color="green">459</FONT>         */<a name="line.459"></a>
+<FONT color="green">460</FONT>        RealVector mapCbrt();<a name="line.460"></a>
+<FONT color="green">461</FONT>    <a name="line.461"></a>
+<FONT color="green">462</FONT>        /**<a name="line.462"></a>
+<FONT color="green">463</FONT>         * Map the {@link Math#cbrt(double)} function to each entry.<a name="line.463"></a>
+<FONT color="green">464</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.464"></a>
+<FONT color="green">465</FONT>         * @return for convenience, return this<a name="line.465"></a>
+<FONT color="green">466</FONT>         */<a name="line.466"></a>
+<FONT color="green">467</FONT>        RealVector mapCbrtToSelf();<a name="line.467"></a>
+<FONT color="green">468</FONT>    <a name="line.468"></a>
+<FONT color="green">469</FONT>        /**<a name="line.469"></a>
+<FONT color="green">470</FONT>         * Map the {@link Math#ceil(double)} function to each entry.<a name="line.470"></a>
+<FONT color="green">471</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.471"></a>
+<FONT color="green">472</FONT>         */<a name="line.472"></a>
+<FONT color="green">473</FONT>        RealVector mapCeil();<a name="line.473"></a>
+<FONT color="green">474</FONT>    <a name="line.474"></a>
+<FONT color="green">475</FONT>        /**<a name="line.475"></a>
+<FONT color="green">476</FONT>         * Map the {@link Math#ceil(double)} function to each entry.<a name="line.476"></a>
+<FONT color="green">477</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.477"></a>
+<FONT color="green">478</FONT>         * @return for convenience, return this<a name="line.478"></a>
+<FONT color="green">479</FONT>         */<a name="line.479"></a>
+<FONT color="green">480</FONT>        RealVector mapCeilToSelf();<a name="line.480"></a>
+<FONT color="green">481</FONT>    <a name="line.481"></a>
+<FONT color="green">482</FONT>        /**<a name="line.482"></a>
+<FONT color="green">483</FONT>         * Map the {@link Math#floor(double)} function to each entry.<a name="line.483"></a>
+<FONT color="green">484</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.484"></a>
+<FONT color="green">485</FONT>         */<a name="line.485"></a>
+<FONT color="green">486</FONT>        RealVector mapFloor();<a name="line.486"></a>
+<FONT color="green">487</FONT>    <a name="line.487"></a>
+<FONT color="green">488</FONT>        /**<a name="line.488"></a>
+<FONT color="green">489</FONT>         * Map the {@link Math#floor(double)} function to each entry.<a name="line.489"></a>
+<FONT color="green">490</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.490"></a>
+<FONT color="green">491</FONT>         * @return for convenience, return this<a name="line.491"></a>
+<FONT color="green">492</FONT>         */<a name="line.492"></a>
+<FONT color="green">493</FONT>        RealVector mapFloorToSelf();<a name="line.493"></a>
+<FONT color="green">494</FONT>    <a name="line.494"></a>
+<FONT color="green">495</FONT>        /**<a name="line.495"></a>
+<FONT color="green">496</FONT>         * Map the {@link Math#rint(double)} function to each entry.<a name="line.496"></a>
+<FONT color="green">497</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.497"></a>
+<FONT color="green">498</FONT>         */<a name="line.498"></a>
+<FONT color="green">499</FONT>        RealVector mapRint();<a name="line.499"></a>
+<FONT color="green">500</FONT>    <a name="line.500"></a>
+<FONT color="green">501</FONT>        /**<a name="line.501"></a>
+<FONT color="green">502</FONT>         * Map the {@link Math#rint(double)} function to each entry.<a name="line.502"></a>
+<FONT color="green">503</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.503"></a>
+<FONT color="green">504</FONT>         * @return for convenience, return this<a name="line.504"></a>
+<FONT color="green">505</FONT>         */<a name="line.505"></a>
+<FONT color="green">506</FONT>        RealVector mapRintToSelf();<a name="line.506"></a>
+<FONT color="green">507</FONT>    <a name="line.507"></a>
+<FONT color="green">508</FONT>        /**<a name="line.508"></a>
+<FONT color="green">509</FONT>         * Map the {@link Math#signum(double)} function to each entry.<a name="line.509"></a>
+<FONT color="green">510</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.510"></a>
+<FONT color="green">511</FONT>         */<a name="line.511"></a>
+<FONT color="green">512</FONT>        RealVector mapSignum();<a name="line.512"></a>
+<FONT color="green">513</FONT>    <a name="line.513"></a>
+<FONT color="green">514</FONT>        /**<a name="line.514"></a>
+<FONT color="green">515</FONT>         * Map the {@link Math#signum(double)} function to each entry.<a name="line.515"></a>
+<FONT color="green">516</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.516"></a>
+<FONT color="green">517</FONT>         * @return for convenience, return this<a name="line.517"></a>
+<FONT color="green">518</FONT>         */<a name="line.518"></a>
+<FONT color="green">519</FONT>        RealVector mapSignumToSelf();<a name="line.519"></a>
+<FONT color="green">520</FONT>    <a name="line.520"></a>
+<FONT color="green">521</FONT>        /**<a name="line.521"></a>
+<FONT color="green">522</FONT>         * Map the {@link Math#ulp(double)} function to each entry.<a name="line.522"></a>
+<FONT color="green">523</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.523"></a>
+<FONT color="green">524</FONT>         */<a name="line.524"></a>
+<FONT color="green">525</FONT>        RealVector mapUlp();<a name="line.525"></a>
+<FONT color="green">526</FONT>    <a name="line.526"></a>
+<FONT color="green">527</FONT>        /**<a name="line.527"></a>
+<FONT color="green">528</FONT>         * Map the {@link Math#ulp(double)} function to each entry.<a name="line.528"></a>
+<FONT color="green">529</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.529"></a>
+<FONT color="green">530</FONT>         * @return for convenience, return this<a name="line.530"></a>
+<FONT color="green">531</FONT>         */<a name="line.531"></a>
+<FONT color="green">532</FONT>        RealVector mapUlpToSelf();<a name="line.532"></a>
+<FONT color="green">533</FONT>    <a name="line.533"></a>
+<FONT color="green">534</FONT>        /**<a name="line.534"></a>
+<FONT color="green">535</FONT>         * Element-by-element multiplication.<a name="line.535"></a>
+<FONT color="green">536</FONT>         * @param v vector by which instance elements must be multiplied<a name="line.536"></a>
+<FONT color="green">537</FONT>         * @return a vector containing this[i] * v[i] for all i<a name="line.537"></a>
+<FONT color="green">538</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.538"></a>
+<FONT color="green">539</FONT>         */<a name="line.539"></a>
+<FONT color="green">540</FONT>        RealVector ebeMultiply(RealVector v) throws IllegalArgumentException;<a name="line.540"></a>
+<FONT color="green">541</FONT>    <a name="line.541"></a>
+<FONT color="green">542</FONT>        /**<a name="line.542"></a>
+<FONT color="green">543</FONT>         * Element-by-element multiplication.<a name="line.543"></a>
+<FONT color="green">544</FONT>         * @param v vector by which instance elements must be multiplied<a name="line.544"></a>
+<FONT color="green">545</FONT>         * @return a vector containing this[i] * v[i] for all i<a name="line.545"></a>
+<FONT color="green">546</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.546"></a>
+<FONT color="green">547</FONT>         */<a name="line.547"></a>
+<FONT color="green">548</FONT>        RealVector ebeMultiply(double[] v) throws IllegalArgumentException;<a name="line.548"></a>
+<FONT color="green">549</FONT>    <a name="line.549"></a>
+<FONT color="green">550</FONT>        /**<a name="line.550"></a>
+<FONT color="green">551</FONT>         * Element-by-element division.<a name="line.551"></a>
+<FONT color="green">552</FONT>         * @param v vector by which instance elements must be divided<a name="line.552"></a>
+<FONT color="green">553</FONT>         * @return a vector containing this[i] / v[i] for all i<a name="line.553"></a>
+<FONT color="green">554</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.554"></a>
+<FONT color="green">555</FONT>         */<a name="line.555"></a>
+<FONT color="green">556</FONT>        RealVector ebeDivide(RealVector v) throws IllegalArgumentException;<a name="line.556"></a>
+<FONT color="green">557</FONT>    <a name="line.557"></a>
+<FONT color="green">558</FONT>        /**<a name="line.558"></a>
+<FONT color="green">559</FONT>         * Element-by-element division.<a name="line.559"></a>
+<FONT color="green">560</FONT>         * @param v vector by which instance elements must be divided<a name="line.560"></a>
+<FONT color="green">561</FONT>         * @return a vector containing this[i] / v[i] for all i<a name="line.561"></a>
+<FONT color="green">562</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.562"></a>
+<FONT color="green">563</FONT>         */<a name="line.563"></a>
+<FONT color="green">564</FONT>        RealVector ebeDivide(double[] v) throws IllegalArgumentException;<a name="line.564"></a>
+<FONT color="green">565</FONT>    <a name="line.565"></a>
+<FONT color="green">566</FONT>        /**<a name="line.566"></a>
+<FONT color="green">567</FONT>         * Returns vector entries as a double array.<a name="line.567"></a>
+<FONT color="green">568</FONT>         * @return double array of entries<a name="line.568"></a>
+<FONT color="green">569</FONT>         */<a name="line.569"></a>
+<FONT color="green">570</FONT>         double[] getData();<a name="line.570"></a>
+<FONT color="green">571</FONT>    <a name="line.571"></a>
+<FONT color="green">572</FONT>        /**<a name="line.572"></a>
+<FONT color="green">573</FONT>         * Compute the dot product.<a name="line.573"></a>
+<FONT color="green">574</FONT>         * @param v vector with which dot product should be computed<a name="line.574"></a>
+<FONT color="green">575</FONT>         * @return the scalar dot product between instance and v<a name="line.575"></a>
+<FONT color="green">576</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.576"></a>
+<FONT color="green">577</FONT>         */<a name="line.577"></a>
+<FONT color="green">578</FONT>        double dotProduct(RealVector v)<a name="line.578"></a>
+<FONT color="green">579</FONT>            throws IllegalArgumentException;<a name="line.579"></a>
+<FONT color="green">580</FONT>    <a name="line.580"></a>
+<FONT color="green">581</FONT>        /**<a name="line.581"></a>
+<FONT color="green">582</FONT>         * Compute the dot product.<a name="line.582"></a>
+<FONT color="green">583</FONT>         * @param v vector with which dot product should be computed<a name="line.583"></a>
+<FONT color="green">584</FONT>         * @return the scalar dot product between instance and v<a name="line.584"></a>
+<FONT color="green">585</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.585"></a>
+<FONT color="green">586</FONT>         */<a name="line.586"></a>
+<FONT color="green">587</FONT>        double dotProduct(double[] v)<a name="line.587"></a>
+<FONT color="green">588</FONT>            throws IllegalArgumentException;<a name="line.588"></a>
+<FONT color="green">589</FONT>    <a name="line.589"></a>
+<FONT color="green">590</FONT>        /**<a name="line.590"></a>
+<FONT color="green">591</FONT>         * Returns the L&lt;sub&gt;2&lt;/sub&gt; norm of the vector.<a name="line.591"></a>
+<FONT color="green">592</FONT>         * &lt;p&gt;The L&lt;sub&gt;2&lt;/sub&gt; norm is the root of the sum of<a name="line.592"></a>
+<FONT color="green">593</FONT>         * the squared elements.&lt;/p&gt;<a name="line.593"></a>
+<FONT color="green">594</FONT>         * @return norm<a name="line.594"></a>
+<FONT color="green">595</FONT>         * @see #getL1Norm()<a name="line.595"></a>
+<FONT color="green">596</FONT>         * @see #getLInfNorm()<a name="line.596"></a>
+<FONT color="green">597</FONT>         * @see #getDistance(RealVector)<a name="line.597"></a>
+<FONT color="green">598</FONT>         */<a name="line.598"></a>
+<FONT color="green">599</FONT>        double getNorm();<a name="line.599"></a>
+<FONT color="green">600</FONT>    <a name="line.600"></a>
+<FONT color="green">601</FONT>        /**<a name="line.601"></a>
+<FONT color="green">602</FONT>         * Returns the L&lt;sub&gt;1&lt;/sub&gt; norm of the vector.<a name="line.602"></a>
+<FONT color="green">603</FONT>         * &lt;p&gt;The L&lt;sub&gt;1&lt;/sub&gt; norm is the sum of the absolute<a name="line.603"></a>
+<FONT color="green">604</FONT>         * values of elements.&lt;/p&gt;<a name="line.604"></a>
+<FONT color="green">605</FONT>         * @return norm<a name="line.605"></a>
+<FONT color="green">606</FONT>         * @see #getNorm()<a name="line.606"></a>
+<FONT color="green">607</FONT>         * @see #getLInfNorm()<a name="line.607"></a>
+<FONT color="green">608</FONT>         * @see #getL1Distance(RealVector)<a name="line.608"></a>
+<FONT color="green">609</FONT>         */<a name="line.609"></a>
+<FONT color="green">610</FONT>        double getL1Norm();<a name="line.610"></a>
+<FONT color="green">611</FONT>    <a name="line.611"></a>
+<FONT color="green">612</FONT>        /**<a name="line.612"></a>
+<FONT color="green">613</FONT>         * Returns the L&lt;sub&gt;&amp;infin;&lt;/sub&gt; norm of the vector.<a name="line.613"></a>
+<FONT color="green">614</FONT>         * &lt;p&gt;The L&lt;sub&gt;&amp;infin;&lt;/sub&gt; norm is the max of the absolute<a name="line.614"></a>
+<FONT color="green">615</FONT>         * values of elements.&lt;/p&gt;<a name="line.615"></a>
+<FONT color="green">616</FONT>         * @return norm<a name="line.616"></a>
+<FONT color="green">617</FONT>         * @see #getNorm()<a name="line.617"></a>
+<FONT color="green">618</FONT>         * @see #getL1Norm()<a name="line.618"></a>
+<FONT color="green">619</FONT>         * @see #getLInfDistance(RealVector)<a name="line.619"></a>
+<FONT color="green">620</FONT>         */<a name="line.620"></a>
+<FONT color="green">621</FONT>        double getLInfNorm();<a name="line.621"></a>
+<FONT color="green">622</FONT>    <a name="line.622"></a>
+<FONT color="green">623</FONT>        /**<a name="line.623"></a>
+<FONT color="green">624</FONT>         * Distance between two vectors.<a name="line.624"></a>
+<FONT color="green">625</FONT>         * &lt;p&gt;This method computes the distance consistent with the<a name="line.625"></a>
+<FONT color="green">626</FONT>         * L&lt;sub&gt;2&lt;/sub&gt; norm, i.e. the square root of the sum of<a name="line.626"></a>
+<FONT color="green">627</FONT>         * elements differences, or euclidian distance.&lt;/p&gt;<a name="line.627"></a>
+<FONT color="green">628</FONT>         * @param v vector to which distance is requested<a name="line.628"></a>
+<FONT color="green">629</FONT>         * @return distance between two vectors.<a name="line.629"></a>
+<FONT color="green">630</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.630"></a>
+<FONT color="green">631</FONT>         * @see #getL1Distance(RealVector)<a name="line.631"></a>
+<FONT color="green">632</FONT>         * @see #getLInfDistance(RealVector)<a name="line.632"></a>
+<FONT color="green">633</FONT>         * @see #getNorm()<a name="line.633"></a>
+<FONT color="green">634</FONT>         */<a name="line.634"></a>
+<FONT color="green">635</FONT>        double getDistance(RealVector v)<a name="line.635"></a>
+<FONT color="green">636</FONT>            throws IllegalArgumentException;<a name="line.636"></a>
+<FONT color="green">637</FONT>    <a name="line.637"></a>
+<FONT color="green">638</FONT>        /**<a name="line.638"></a>
+<FONT color="green">639</FONT>         * Distance between two vectors.<a name="line.639"></a>
+<FONT color="green">640</FONT>         * &lt;p&gt;This method computes the distance consistent with the<a name="line.640"></a>
+<FONT color="green">641</FONT>         * L&lt;sub&gt;2&lt;/sub&gt; norm, i.e. the square root of the sum of<a name="line.641"></a>
+<FONT color="green">642</FONT>         * elements differences, or euclidian distance.&lt;/p&gt;<a name="line.642"></a>
+<FONT color="green">643</FONT>         * @param v vector to which distance is requested<a name="line.643"></a>
+<FONT color="green">644</FONT>         * @return distance between two vectors.<a name="line.644"></a>
+<FONT color="green">645</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.645"></a>
+<FONT color="green">646</FONT>         * @see #getL1Distance(double[])<a name="line.646"></a>
+<FONT color="green">647</FONT>         * @see #getLInfDistance(double[])<a name="line.647"></a>
+<FONT color="green">648</FONT>         * @see #getNorm()<a name="line.648"></a>
+<FONT color="green">649</FONT>         */<a name="line.649"></a>
+<FONT color="green">650</FONT>        double getDistance(double[] v)<a name="line.650"></a>
+<FONT color="green">651</FONT>            throws IllegalArgumentException;<a name="line.651"></a>
+<FONT color="green">652</FONT>    <a name="line.652"></a>
+<FONT color="green">653</FONT>        /**<a name="line.653"></a>
+<FONT color="green">654</FONT>         * Distance between two vectors.<a name="line.654"></a>
+<FONT color="green">655</FONT>         * &lt;p&gt;This method computes the distance consistent with<a name="line.655"></a>
+<FONT color="green">656</FONT>         * L&lt;sub&gt;1&lt;/sub&gt; norm, i.e. the sum of the absolute values of<a name="line.656"></a>
+<FONT color="green">657</FONT>         * elements differences.&lt;/p&gt;<a name="line.657"></a>
+<FONT color="green">658</FONT>         * @param v vector to which distance is requested<a name="line.658"></a>
+<FONT color="green">659</FONT>         * @return distance between two vectors.<a name="line.659"></a>
+<FONT color="green">660</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.660"></a>
+<FONT color="green">661</FONT>         * @see #getDistance(RealVector)<a name="line.661"></a>
+<FONT color="green">662</FONT>         * @see #getLInfDistance(RealVector)<a name="line.662"></a>
+<FONT color="green">663</FONT>         * @see #getL1Norm()<a name="line.663"></a>
+<FONT color="green">664</FONT>         */<a name="line.664"></a>
+<FONT color="green">665</FONT>        double getL1Distance(RealVector v)<a name="line.665"></a>
+<FONT color="green">666</FONT>            throws IllegalArgumentException;<a name="line.666"></a>
+<FONT color="green">667</FONT>    <a name="line.667"></a>
+<FONT color="green">668</FONT>        /**<a name="line.668"></a>
+<FONT color="green">669</FONT>         * Distance between two vectors.<a name="line.669"></a>
+<FONT color="green">670</FONT>         * &lt;p&gt;This method computes the distance consistent with<a name="line.670"></a>
+<FONT color="green">671</FONT>         * L&lt;sub&gt;1&lt;/sub&gt; norm, i.e. the sum of the absolute values of<a name="line.671"></a>
+<FONT color="green">672</FONT>         * elements differences.&lt;/p&gt;<a name="line.672"></a>
+<FONT color="green">673</FONT>         * @param v vector to which distance is requested<a name="line.673"></a>
+<FONT color="green">674</FONT>         * @return distance between two vectors.<a name="line.674"></a>
+<FONT color="green">675</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.675"></a>
+<FONT color="green">676</FONT>         * @see #getDistance(double[])<a name="line.676"></a>
+<FONT color="green">677</FONT>         * @see #getLInfDistance(double[])<a name="line.677"></a>
+<FONT color="green">678</FONT>         * @see #getL1Norm()<a name="line.678"></a>
+<FONT color="green">679</FONT>         */<a name="line.679"></a>
+<FONT color="green">680</FONT>        double getL1Distance(double[] v)<a name="line.680"></a>
+<FONT color="green">681</FONT>            throws IllegalArgumentException;<a name="line.681"></a>
+<FONT color="green">682</FONT>    <a name="line.682"></a>
+<FONT color="green">683</FONT>        /**<a name="line.683"></a>
+<FONT color="green">684</FONT>         * Distance between two vectors.<a name="line.684"></a>
+<FONT color="green">685</FONT>         * &lt;p&gt;This method computes the distance consistent with<a name="line.685"></a>
+<FONT color="green">686</FONT>         * L&lt;sub&gt;&amp;infin;&lt;/sub&gt; norm, i.e. the max of the absolute values of<a name="line.686"></a>
+<FONT color="green">687</FONT>         * elements differences.&lt;/p&gt;<a name="line.687"></a>
+<FONT color="green">688</FONT>         * @param v vector to which distance is requested<a name="line.688"></a>
+<FONT color="green">689</FONT>         * @return distance between two vectors.<a name="line.689"></a>
+<FONT color="green">690</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.690"></a>
+<FONT color="green">691</FONT>         * @see #getDistance(RealVector)<a name="line.691"></a>
+<FONT color="green">692</FONT>         * @see #getL1Distance(RealVector)<a name="line.692"></a>
+<FONT color="green">693</FONT>         * @see #getLInfNorm()<a name="line.693"></a>
+<FONT color="green">694</FONT>         */<a name="line.694"></a>
+<FONT color="green">695</FONT>        double getLInfDistance(RealVector v)<a name="line.695"></a>
+<FONT color="green">696</FONT>            throws IllegalArgumentException;<a name="line.696"></a>
+<FONT color="green">697</FONT>    <a name="line.697"></a>
+<FONT color="green">698</FONT>        /**<a name="line.698"></a>
+<FONT color="green">699</FONT>         * Distance between two vectors.<a name="line.699"></a>
+<FONT color="green">700</FONT>         * &lt;p&gt;This method computes the distance consistent with<a name="line.700"></a>
+<FONT color="green">701</FONT>         * L&lt;sub&gt;&amp;infin;&lt;/sub&gt; norm, i.e. the max of the absolute values of<a name="line.701"></a>
+<FONT color="green">702</FONT>         * elements differences.&lt;/p&gt;<a name="line.702"></a>
+<FONT color="green">703</FONT>         * @param v vector to which distance is requested<a name="line.703"></a>
+<FONT color="green">704</FONT>         * @return distance between two vectors.<a name="line.704"></a>
+<FONT color="green">705</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.705"></a>
+<FONT color="green">706</FONT>         * @see #getDistance(double[])<a name="line.706"></a>
+<FONT color="green">707</FONT>         * @see #getL1Distance(double[])<a name="line.707"></a>
+<FONT color="green">708</FONT>         * @see #getLInfNorm()<a name="line.708"></a>
+<FONT color="green">709</FONT>         */<a name="line.709"></a>
+<FONT color="green">710</FONT>        double getLInfDistance(double[] v)<a name="line.710"></a>
+<FONT color="green">711</FONT>            throws IllegalArgumentException;<a name="line.711"></a>
+<FONT color="green">712</FONT>    <a name="line.712"></a>
+<FONT color="green">713</FONT>        /** Creates a unit vector pointing in the direction of this vector.<a name="line.713"></a>
+<FONT color="green">714</FONT>         * &lt;p&gt;The instance is not changed by this method.&lt;/p&gt;<a name="line.714"></a>
+<FONT color="green">715</FONT>         * @return a unit vector pointing in direction of this vector<a name="line.715"></a>
+<FONT color="green">716</FONT>         * @exception ArithmeticException if the norm is null<a name="line.716"></a>
+<FONT color="green">717</FONT>         */<a name="line.717"></a>
+<FONT color="green">718</FONT>        RealVector unitVector();<a name="line.718"></a>
+<FONT color="green">719</FONT>    <a name="line.719"></a>
+<FONT color="green">720</FONT>        /** Converts this vector into a unit vector.<a name="line.720"></a>
+<FONT color="green">721</FONT>         * &lt;p&gt;The instance itself is changed by this method.&lt;/p&gt;<a name="line.721"></a>
+<FONT color="green">722</FONT>         * @exception ArithmeticException if the norm is null<a name="line.722"></a>
+<FONT color="green">723</FONT>         */<a name="line.723"></a>
+<FONT color="green">724</FONT>        void unitize();<a name="line.724"></a>
+<FONT color="green">725</FONT>    <a name="line.725"></a>
+<FONT color="green">726</FONT>        /** Find the orthogonal projection of this vector onto another vector.<a name="line.726"></a>
+<FONT color="green">727</FONT>         * @param v vector onto which instance must be projected<a name="line.727"></a>
+<FONT color="green">728</FONT>         * @return projection of the instance onto v<a name="line.728"></a>
+<FONT color="green">729</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.729"></a>
+<FONT color="green">730</FONT>         */<a name="line.730"></a>
+<FONT color="green">731</FONT>        RealVector projection(RealVector v)<a name="line.731"></a>
+<FONT color="green">732</FONT>            throws IllegalArgumentException;<a name="line.732"></a>
+<FONT color="green">733</FONT>    <a name="line.733"></a>
+<FONT color="green">734</FONT>        /** Find the orthogonal projection of this vector onto another vector.<a name="line.734"></a>
+<FONT color="green">735</FONT>         * @param v vector onto which instance must be projected<a name="line.735"></a>
+<FONT color="green">736</FONT>         * @return projection of the instance onto v<a name="line.736"></a>
+<FONT color="green">737</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.737"></a>
+<FONT color="green">738</FONT>         */<a name="line.738"></a>
+<FONT color="green">739</FONT>        RealVector projection(double[] v)<a name="line.739"></a>
+<FONT color="green">740</FONT>            throws IllegalArgumentException;<a name="line.740"></a>
+<FONT color="green">741</FONT>    <a name="line.741"></a>
+<FONT color="green">742</FONT>        /**<a name="line.742"></a>
+<FONT color="green">743</FONT>         * Compute the outer product.<a name="line.743"></a>
+<FONT color="green">744</FONT>         * @param v vector with which outer product should be computed<a name="line.744"></a>
+<FONT color="green">745</FONT>         * @return the square matrix outer product between instance and v<a name="line.745"></a>
+<FONT color="green">746</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.746"></a>
+<FONT color="green">747</FONT>         */<a name="line.747"></a>
+<FONT color="green">748</FONT>        RealMatrix outerProduct(RealVector v)<a name="line.748"></a>
+<FONT color="green">749</FONT>            throws IllegalArgumentException;<a name="line.749"></a>
+<FONT color="green">750</FONT>    <a name="line.750"></a>
+<FONT color="green">751</FONT>        /**<a name="line.751"></a>
+<FONT color="green">752</FONT>         * Compute the outer product.<a name="line.752"></a>
+<FONT color="green">753</FONT>         * @param v vector with which outer product should be computed<a name="line.753"></a>
+<FONT color="green">754</FONT>         * @return the square matrix outer product between instance and v<a name="line.754"></a>
+<FONT color="green">755</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.755"></a>
+<FONT color="green">756</FONT>         */<a name="line.756"></a>
+<FONT color="green">757</FONT>        RealMatrix outerProduct(double[] v)<a name="line.757"></a>
+<FONT color="green">758</FONT>            throws IllegalArgumentException;<a name="line.758"></a>
+<FONT color="green">759</FONT>    <a name="line.759"></a>
+<FONT color="green">760</FONT>        /**<a name="line.760"></a>
+<FONT color="green">761</FONT>         * Returns the entry in the specified index.<a name="line.761"></a>
+<FONT color="green">762</FONT>         * &lt;p&gt;<a name="line.762"></a>
+<FONT color="green">763</FONT>         * The index start at 0 and must be lesser than the size,<a name="line.763"></a>
+<FONT color="green">764</FONT>         * otherwise a {@link MatrixIndexException} is thrown.<a name="line.764"></a>
+<FONT color="green">765</FONT>         * &lt;/p&gt;<a name="line.765"></a>
+<FONT color="green">766</FONT>         * @param index  index location of entry to be fetched<a name="line.766"></a>
+<FONT color="green">767</FONT>         * @return vector entry at index<a name="line.767"></a>
+<FONT color="green">768</FONT>         * @throws MatrixIndexException if the index is not valid<a name="line.768"></a>
+<FONT color="green">769</FONT>         * @see #setEntry(int, double)<a name="line.769"></a>
+<FONT color="green">770</FONT>         */<a name="line.770"></a>
+<FONT color="green">771</FONT>        double getEntry(int index)<a name="line.771"></a>
+<FONT color="green">772</FONT>            throws MatrixIndexException;<a name="line.772"></a>
+<FONT color="green">773</FONT>    <a name="line.773"></a>
+<FONT color="green">774</FONT>        /**<a name="line.774"></a>
+<FONT color="green">775</FONT>         * Set a single element.<a name="line.775"></a>
+<FONT color="green">776</FONT>         * @param index element index.<a name="line.776"></a>
+<FONT color="green">777</FONT>         * @param value new value for the element.<a name="line.777"></a>
+<FONT color="green">778</FONT>         * @exception MatrixIndexException if the index is<a name="line.778"></a>
+<FONT color="green">779</FONT>         * inconsistent with vector size<a name="line.779"></a>
+<FONT color="green">780</FONT>         * @see #getEntry(int)<a name="line.780"></a>
+<FONT color="green">781</FONT>         */<a name="line.781"></a>
+<FONT color="green">782</FONT>        void setEntry(int index, double value)<a name="line.782"></a>
+<FONT color="green">783</FONT>            throws MatrixIndexException;<a name="line.783"></a>
+<FONT color="green">784</FONT>    <a name="line.784"></a>
+<FONT color="green">785</FONT>        /**<a name="line.785"></a>
+<FONT color="green">786</FONT>         * Returns the size of the vector.<a name="line.786"></a>
+<FONT color="green">787</FONT>         * @return size<a name="line.787"></a>
+<FONT color="green">788</FONT>         */<a name="line.788"></a>
+<FONT color="green">789</FONT>        int getDimension();<a name="line.789"></a>
+<FONT color="green">790</FONT>    <a name="line.790"></a>
+<FONT color="green">791</FONT>        /**<a name="line.791"></a>
+<FONT color="green">792</FONT>         * Construct a vector by appending a vector to this vector.<a name="line.792"></a>
+<FONT color="green">793</FONT>         * @param v vector to append to this one.<a name="line.793"></a>
+<FONT color="green">794</FONT>         * @return a new vector<a name="line.794"></a>
+<FONT color="green">795</FONT>         */<a name="line.795"></a>
+<FONT color="green">796</FONT>        RealVector append(RealVector v);<a name="line.796"></a>
+<FONT color="green">797</FONT>    <a name="line.797"></a>
+<FONT color="green">798</FONT>        /**<a name="line.798"></a>
+<FONT color="green">799</FONT>         * Construct a vector by appending a double to this vector.<a name="line.799"></a>
+<FONT color="green">800</FONT>         * @param d double to append.<a name="line.800"></a>
+<FONT color="green">801</FONT>         * @return a new vector<a name="line.801"></a>
+<FONT color="green">802</FONT>         */<a name="line.802"></a>
+<FONT color="green">803</FONT>        RealVector append(double d);<a name="line.803"></a>
+<FONT color="green">804</FONT>    <a name="line.804"></a>
+<FONT color="green">805</FONT>        /**<a name="line.805"></a>
+<FONT color="green">806</FONT>         * Construct a vector by appending a double array to this vector.<a name="line.806"></a>
+<FONT color="green">807</FONT>         * @param a double array to append.<a name="line.807"></a>
+<FONT color="green">808</FONT>         * @return a new vector<a name="line.808"></a>
+<FONT color="green">809</FONT>         */<a name="line.809"></a>
+<FONT color="green">810</FONT>        RealVector append(double[] a);<a name="line.810"></a>
+<FONT color="green">811</FONT>    <a name="line.811"></a>
+<FONT color="green">812</FONT>        /**<a name="line.812"></a>
+<FONT color="green">813</FONT>         * Get a subvector from consecutive elements.<a name="line.813"></a>
+<FONT color="green">814</FONT>         * @param index index of first element.<a name="line.814"></a>
+<FONT color="green">815</FONT>         * @param n number of elements to be retrieved.<a name="line.815"></a>
+<FONT color="green">816</FONT>         * @return a vector containing n elements.<a name="line.816"></a>
+<FONT color="green">817</FONT>         * @exception MatrixIndexException if the index is<a name="line.817"></a>
+<FONT color="green">818</FONT>         * inconsistent with vector size<a name="line.818"></a>
+<FONT color="green">819</FONT>         */<a name="line.819"></a>
+<FONT color="green">820</FONT>        RealVector getSubVector(int index, int n)<a name="line.820"></a>
+<FONT color="green">821</FONT>            throws MatrixIndexException;<a name="line.821"></a>
+<FONT color="green">822</FONT>    <a name="line.822"></a>
+<FONT color="green">823</FONT>        /**<a name="line.823"></a>
+<FONT color="green">824</FONT>         * Set a set of consecutive elements.<a name="line.824"></a>
+<FONT color="green">825</FONT>         * @param index index of first element to be set.<a name="line.825"></a>
+<FONT color="green">826</FONT>         * @param v vector containing the values to set.<a name="line.826"></a>
+<FONT color="green">827</FONT>         * @exception MatrixIndexException if the index is<a name="line.827"></a>
+<FONT color="green">828</FONT>         * inconsistent with vector size<a name="line.828"></a>
+<FONT color="green">829</FONT>         * @see #setSubVector(int, double[])<a name="line.829"></a>
+<FONT color="green">830</FONT>         */<a name="line.830"></a>
+<FONT color="green">831</FONT>        void setSubVector(int index, RealVector v)<a name="line.831"></a>
+<FONT color="green">832</FONT>            throws MatrixIndexException;<a name="line.832"></a>
+<FONT color="green">833</FONT>    <a name="line.833"></a>
+<FONT color="green">834</FONT>        /**<a name="line.834"></a>
+<FONT color="green">835</FONT>         * Set a set of consecutive elements.<a name="line.835"></a>
+<FONT color="green">836</FONT>         * @param index index of first element to be set.<a name="line.836"></a>
+<FONT color="green">837</FONT>         * @param v vector containing the values to set.<a name="line.837"></a>
+<FONT color="green">838</FONT>         * @exception MatrixIndexException if the index is<a name="line.838"></a>
+<FONT color="green">839</FONT>         * inconsistent with vector size<a name="line.839"></a>
+<FONT color="green">840</FONT>         * @see #setSubVector(int, RealVector)<a name="line.840"></a>
+<FONT color="green">841</FONT>         */<a name="line.841"></a>
+<FONT color="green">842</FONT>        void setSubVector(int index, double[] v)<a name="line.842"></a>
+<FONT color="green">843</FONT>            throws MatrixIndexException;<a name="line.843"></a>
+<FONT color="green">844</FONT>    <a name="line.844"></a>
+<FONT color="green">845</FONT>        /**<a name="line.845"></a>
+<FONT color="green">846</FONT>         * Set all elements to a single value.<a name="line.846"></a>
+<FONT color="green">847</FONT>         * @param value single value to set for all elements<a name="line.847"></a>
+<FONT color="green">848</FONT>         */<a name="line.848"></a>
+<FONT color="green">849</FONT>        void set(double value);<a name="line.849"></a>
+<FONT color="green">850</FONT>    <a name="line.850"></a>
+<FONT color="green">851</FONT>        /**<a name="line.851"></a>
+<FONT color="green">852</FONT>         * Convert the vector to a double array.<a name="line.852"></a>
+<FONT color="green">853</FONT>         * &lt;p&gt;The array is independent from vector data, it's elements<a name="line.853"></a>
+<FONT color="green">854</FONT>         * are copied.&lt;/p&gt;<a name="line.854"></a>
+<FONT color="green">855</FONT>         * @return array containing a copy of vector elements<a name="line.855"></a>
+<FONT color="green">856</FONT>         */<a name="line.856"></a>
+<FONT color="green">857</FONT>        double[] toArray();<a name="line.857"></a>
+<FONT color="green">858</FONT>    <a name="line.858"></a>
+<FONT color="green">859</FONT>        /**<a name="line.859"></a>
+<FONT color="green">860</FONT>         * Returns true if any coordinate of this vector is NaN; false otherwise<a name="line.860"></a>
+<FONT color="green">861</FONT>         * @return  true if any coordinate of this vector is NaN; false otherwise<a name="line.861"></a>
+<FONT color="green">862</FONT>         */<a name="line.862"></a>
+<FONT color="green">863</FONT>        boolean isNaN();<a name="line.863"></a>
+<FONT color="green">864</FONT>    <a name="line.864"></a>
+<FONT color="green">865</FONT>        /**<a name="line.865"></a>
+<FONT color="green">866</FONT>         * Returns true if any coordinate of this vector is infinite and none are NaN;<a name="line.866"></a>
+<FONT color="green">867</FONT>         * false otherwise<a name="line.867"></a>
+<FONT color="green">868</FONT>         * @return  true if any coordinate of this vector is infinite and none are NaN;<a name="line.868"></a>
+<FONT color="green">869</FONT>         * false otherwise<a name="line.869"></a>
+<FONT color="green">870</FONT>         */<a name="line.870"></a>
+<FONT color="green">871</FONT>        boolean isInfinite();<a name="line.871"></a>
+<FONT color="green">872</FONT>    <a name="line.872"></a>
+<FONT color="green">873</FONT>    }<a name="line.873"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/RealVector.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,939 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.linear;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.Iterator;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Interface defining a real-valued vector with basic algebraic operations.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * vector element indexing is 0-based -- e.g., &lt;code&gt;getEntry(0)&lt;/code&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * returns the first element of the vector.<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * The various &lt;code&gt;mapXxx&lt;/code&gt; and &lt;code&gt;mapXxxToSelf&lt;/code&gt; methods operate<a name="line.32"></a>
+<FONT color="green">033</FONT>     * on vectors element-wise, i.e. they perform the same operation (adding a scalar,<a name="line.33"></a>
+<FONT color="green">034</FONT>     * applying a function ...) on each element in turn. The &lt;code&gt;mapXxx&lt;/code&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * versions create a new vector to hold the result and do not change the instance.<a name="line.35"></a>
+<FONT color="green">036</FONT>     * The &lt;code&gt;mapXxxToSelf&lt;/code&gt; versions use the instance itself to store the<a name="line.36"></a>
+<FONT color="green">037</FONT>     * results, so the instance is changed by these methods. In both cases, the result<a name="line.37"></a>
+<FONT color="green">038</FONT>     * vector is returned by the methods, this allows to use the &lt;i&gt;fluent API&lt;/i&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * style, like this:<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;/p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;pre&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     *   RealVector result = v.mapAddToSelf(3.0).mapTanToSelf().mapSquareToSelf();<a name="line.42"></a>
+<FONT color="green">043</FONT>     * &lt;/pre&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     *<a name="line.44"></a>
+<FONT color="green">045</FONT>     * @version $Revision: 902214 $ $Date: 2010-01-22 13:40:28 -0500 (Fri, 22 Jan 2010) $<a name="line.45"></a>
+<FONT color="green">046</FONT>     * @since 2.0<a name="line.46"></a>
+<FONT color="green">047</FONT>     */<a name="line.47"></a>
+<FONT color="green">048</FONT>    public interface RealVector {<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Acts as if it is implemented as:<a name="line.51"></a>
+<FONT color="green">052</FONT>         * Entry e = null;<a name="line.52"></a>
+<FONT color="green">053</FONT>         * for(Iterator&lt;Entry&gt; it = iterator(); it.hasNext(); e = it.next()) {<a name="line.53"></a>
+<FONT color="green">054</FONT>         *   e.setValue(function.value(e.getValue()));<a name="line.54"></a>
+<FONT color="green">055</FONT>         * }<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param function to apply to each successive entry<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @return this vector<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @throws FunctionEvaluationException if function throws it on application to any entry<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        RealVector mapToSelf(UnivariateRealFunction function) throws FunctionEvaluationException;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /**<a name="line.62"></a>
+<FONT color="green">063</FONT>         * Acts as if implemented as:<a name="line.63"></a>
+<FONT color="green">064</FONT>         * return copy().map(function);<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param function to apply to each successive entry<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @return a new vector<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @throws FunctionEvaluationException if function throws it on application to any entry<a name="line.67"></a>
+<FONT color="green">068</FONT>         */<a name="line.68"></a>
+<FONT color="green">069</FONT>        RealVector map(UnivariateRealFunction function) throws FunctionEvaluationException;<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** Class representing a modifiable entry in the vector. */<a name="line.71"></a>
+<FONT color="green">072</FONT>        public abstract class Entry {<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>            /** Index of the entry. */<a name="line.74"></a>
+<FONT color="green">075</FONT>            private int index;<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>            /** Get the value of the entry.<a name="line.77"></a>
+<FONT color="green">078</FONT>             * @return value of the entry<a name="line.78"></a>
+<FONT color="green">079</FONT>             */<a name="line.79"></a>
+<FONT color="green">080</FONT>            public abstract double getValue();<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>            /** Set the value of the entry.<a name="line.82"></a>
+<FONT color="green">083</FONT>             * @param value new value for the entry<a name="line.83"></a>
+<FONT color="green">084</FONT>             */<a name="line.84"></a>
+<FONT color="green">085</FONT>            public abstract void setValue(double value);<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>            /** Get the index of the entry.<a name="line.87"></a>
+<FONT color="green">088</FONT>             * @return index of the entry<a name="line.88"></a>
+<FONT color="green">089</FONT>             */<a name="line.89"></a>
+<FONT color="green">090</FONT>            public int getIndex() {<a name="line.90"></a>
+<FONT color="green">091</FONT>                return index;<a name="line.91"></a>
+<FONT color="green">092</FONT>            }<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>            /** Set the index of the entry.<a name="line.94"></a>
+<FONT color="green">095</FONT>             * @param index new index for the entry<a name="line.95"></a>
+<FONT color="green">096</FONT>             */<a name="line.96"></a>
+<FONT color="green">097</FONT>            public void setIndex(int index) {<a name="line.97"></a>
+<FONT color="green">098</FONT>                this.index = index;<a name="line.98"></a>
+<FONT color="green">099</FONT>            }<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        }<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        /**<a name="line.103"></a>
+<FONT color="green">104</FONT>         * Generic dense iterator - starts with index == zero, and hasNext() == true until index == getDimension();<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @return a dense iterator<a name="line.105"></a>
+<FONT color="green">106</FONT>         */<a name="line.106"></a>
+<FONT color="green">107</FONT>        Iterator&lt;Entry&gt; iterator();<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /**<a name="line.109"></a>
+<FONT color="green">110</FONT>         * Specialized implementations may choose to not iterate over all dimensions, either because those values are<a name="line.110"></a>
+<FONT color="green">111</FONT>         * unset, or are equal to defaultValue(), or are small enough to be ignored for the purposes of iteration.<a name="line.111"></a>
+<FONT color="green">112</FONT>         * No guarantees are made about order of iteration.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * In dense implementations, this method will often delegate to {@link #iterator()}<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @return a sparse iterator<a name="line.114"></a>
+<FONT color="green">115</FONT>         */<a name="line.115"></a>
+<FONT color="green">116</FONT>        Iterator&lt;Entry&gt; sparseIterator();<a name="line.116"></a>
+<FONT color="green">117</FONT>    <a name="line.117"></a>
+<FONT color="green">118</FONT>        /**<a name="line.118"></a>
+<FONT color="green">119</FONT>         * Returns a (deep) copy of this.<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @return vector copy<a name="line.120"></a>
+<FONT color="green">121</FONT>         */<a name="line.121"></a>
+<FONT color="green">122</FONT>        RealVector copy();<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>        /**<a name="line.124"></a>
+<FONT color="green">125</FONT>         * Compute the sum of this and v.<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @param v vector to be added<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @return this + v<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.128"></a>
+<FONT color="green">129</FONT>         */<a name="line.129"></a>
+<FONT color="green">130</FONT>        RealVector add(RealVector v)<a name="line.130"></a>
+<FONT color="green">131</FONT>            throws IllegalArgumentException;<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>        /**<a name="line.133"></a>
+<FONT color="green">134</FONT>         * Compute the sum of this and v.<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @param v vector to be added<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @return this + v<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.137"></a>
+<FONT color="green">138</FONT>         */<a name="line.138"></a>
+<FONT color="green">139</FONT>        RealVector add(double[] v)<a name="line.139"></a>
+<FONT color="green">140</FONT>            throws IllegalArgumentException;<a name="line.140"></a>
+<FONT color="green">141</FONT>    <a name="line.141"></a>
+<FONT color="green">142</FONT>        /**<a name="line.142"></a>
+<FONT color="green">143</FONT>         * Compute this minus v.<a name="line.143"></a>
+<FONT color="green">144</FONT>         * @param v vector to be subtracted<a name="line.144"></a>
+<FONT color="green">145</FONT>         * @return this + v<a name="line.145"></a>
+<FONT color="green">146</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.146"></a>
+<FONT color="green">147</FONT>         */<a name="line.147"></a>
+<FONT color="green">148</FONT>        RealVector subtract(RealVector v)<a name="line.148"></a>
+<FONT color="green">149</FONT>            throws IllegalArgumentException;<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>        /**<a name="line.151"></a>
+<FONT color="green">152</FONT>         * Compute this minus v.<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @param v vector to be subtracted<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @return this + v<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.155"></a>
+<FONT color="green">156</FONT>         */<a name="line.156"></a>
+<FONT color="green">157</FONT>        RealVector subtract(double[] v)<a name="line.157"></a>
+<FONT color="green">158</FONT>            throws IllegalArgumentException;<a name="line.158"></a>
+<FONT color="green">159</FONT>    <a name="line.159"></a>
+<FONT color="green">160</FONT>        /**<a name="line.160"></a>
+<FONT color="green">161</FONT>         * Map an addition operation to each entry.<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @param d value to be added to each entry<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @return this + d<a name="line.163"></a>
+<FONT color="green">164</FONT>         */<a name="line.164"></a>
+<FONT color="green">165</FONT>        RealVector mapAdd(double d);<a name="line.165"></a>
+<FONT color="green">166</FONT>    <a name="line.166"></a>
+<FONT color="green">167</FONT>        /**<a name="line.167"></a>
+<FONT color="green">168</FONT>         * Map an addition operation to each entry.<a name="line.168"></a>
+<FONT color="green">169</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.169"></a>
+<FONT color="green">170</FONT>         * @param d value to be added to each entry<a name="line.170"></a>
+<FONT color="green">171</FONT>         * @return for convenience, return this<a name="line.171"></a>
+<FONT color="green">172</FONT>         */<a name="line.172"></a>
+<FONT color="green">173</FONT>        RealVector mapAddToSelf(double d);<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>        /**<a name="line.175"></a>
+<FONT color="green">176</FONT>         * Map a subtraction operation to each entry.<a name="line.176"></a>
+<FONT color="green">177</FONT>         * @param d value to be subtracted to each entry<a name="line.177"></a>
+<FONT color="green">178</FONT>         * @return this - d<a name="line.178"></a>
+<FONT color="green">179</FONT>         */<a name="line.179"></a>
+<FONT color="green">180</FONT>        RealVector mapSubtract(double d);<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>        /**<a name="line.182"></a>
+<FONT color="green">183</FONT>         * Map a subtraction operation to each entry.<a name="line.183"></a>
+<FONT color="green">184</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.184"></a>
+<FONT color="green">185</FONT>         * @param d value to be subtracted to each entry<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @return for convenience, return this<a name="line.186"></a>
+<FONT color="green">187</FONT>         */<a name="line.187"></a>
+<FONT color="green">188</FONT>        RealVector mapSubtractToSelf(double d);<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>        /**<a name="line.190"></a>
+<FONT color="green">191</FONT>         * Map a multiplication operation to each entry.<a name="line.191"></a>
+<FONT color="green">192</FONT>         * @param d value to multiply all entries by<a name="line.192"></a>
+<FONT color="green">193</FONT>         * @return this * d<a name="line.193"></a>
+<FONT color="green">194</FONT>         */<a name="line.194"></a>
+<FONT color="green">195</FONT>        RealVector mapMultiply(double d);<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>        /**<a name="line.197"></a>
+<FONT color="green">198</FONT>         * Map a multiplication operation to each entry.<a name="line.198"></a>
+<FONT color="green">199</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.199"></a>
+<FONT color="green">200</FONT>         * @param d value to multiply all entries by<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @return for convenience, return this<a name="line.201"></a>
+<FONT color="green">202</FONT>         */<a name="line.202"></a>
+<FONT color="green">203</FONT>        RealVector mapMultiplyToSelf(double d);<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>        /**<a name="line.205"></a>
+<FONT color="green">206</FONT>         * Map a division operation to each entry.<a name="line.206"></a>
+<FONT color="green">207</FONT>         * @param d value to divide all entries by<a name="line.207"></a>
+<FONT color="green">208</FONT>         * @return this / d<a name="line.208"></a>
+<FONT color="green">209</FONT>         */<a name="line.209"></a>
+<FONT color="green">210</FONT>        RealVector mapDivide(double d);<a name="line.210"></a>
+<FONT color="green">211</FONT>    <a name="line.211"></a>
+<FONT color="green">212</FONT>        /**<a name="line.212"></a>
+<FONT color="green">213</FONT>         * Map a division operation to each entry.<a name="line.213"></a>
+<FONT color="green">214</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.214"></a>
+<FONT color="green">215</FONT>         * @param d value to divide all entries by<a name="line.215"></a>
+<FONT color="green">216</FONT>         * @return for convenience, return this<a name="line.216"></a>
+<FONT color="green">217</FONT>         */<a name="line.217"></a>
+<FONT color="green">218</FONT>        RealVector mapDivideToSelf(double d);<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>        /**<a name="line.220"></a>
+<FONT color="green">221</FONT>         * Map a power operation to each entry.<a name="line.221"></a>
+<FONT color="green">222</FONT>         * @param d value to raise all entries to<a name="line.222"></a>
+<FONT color="green">223</FONT>         * @return this ^ d<a name="line.223"></a>
+<FONT color="green">224</FONT>         */<a name="line.224"></a>
+<FONT color="green">225</FONT>        RealVector mapPow(double d);<a name="line.225"></a>
+<FONT color="green">226</FONT>    <a name="line.226"></a>
+<FONT color="green">227</FONT>        /**<a name="line.227"></a>
+<FONT color="green">228</FONT>         * Map a power operation to each entry.<a name="line.228"></a>
+<FONT color="green">229</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.229"></a>
+<FONT color="green">230</FONT>         * @param d value to raise all entries to<a name="line.230"></a>
+<FONT color="green">231</FONT>         * @return for convenience, return this<a name="line.231"></a>
+<FONT color="green">232</FONT>         */<a name="line.232"></a>
+<FONT color="green">233</FONT>        RealVector mapPowToSelf(double d);<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>        /**<a name="line.235"></a>
+<FONT color="green">236</FONT>         * Map the {@link Math#exp(double)} function to each entry.<a name="line.236"></a>
+<FONT color="green">237</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.237"></a>
+<FONT color="green">238</FONT>         */<a name="line.238"></a>
+<FONT color="green">239</FONT>        RealVector mapExp();<a name="line.239"></a>
+<FONT color="green">240</FONT>    <a name="line.240"></a>
+<FONT color="green">241</FONT>        /**<a name="line.241"></a>
+<FONT color="green">242</FONT>         * Map the {@link Math#exp(double)} function to each entry.<a name="line.242"></a>
+<FONT color="green">243</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.243"></a>
+<FONT color="green">244</FONT>         * @return for convenience, return this<a name="line.244"></a>
+<FONT color="green">245</FONT>         */<a name="line.245"></a>
+<FONT color="green">246</FONT>        RealVector mapExpToSelf();<a name="line.246"></a>
+<FONT color="green">247</FONT>    <a name="line.247"></a>
+<FONT color="green">248</FONT>        /**<a name="line.248"></a>
+<FONT color="green">249</FONT>         * Map the {@link Math#expm1(double)} function to each entry.<a name="line.249"></a>
+<FONT color="green">250</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.250"></a>
+<FONT color="green">251</FONT>         */<a name="line.251"></a>
+<FONT color="green">252</FONT>        RealVector mapExpm1();<a name="line.252"></a>
+<FONT color="green">253</FONT>    <a name="line.253"></a>
+<FONT color="green">254</FONT>        /**<a name="line.254"></a>
+<FONT color="green">255</FONT>         * Map the {@link Math#expm1(double)} function to each entry.<a name="line.255"></a>
+<FONT color="green">256</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.256"></a>
+<FONT color="green">257</FONT>         * @return for convenience, return this<a name="line.257"></a>
+<FONT color="green">258</FONT>         */<a name="line.258"></a>
+<FONT color="green">259</FONT>        RealVector mapExpm1ToSelf();<a name="line.259"></a>
+<FONT color="green">260</FONT>    <a name="line.260"></a>
+<FONT color="green">261</FONT>        /**<a name="line.261"></a>
+<FONT color="green">262</FONT>         * Map the {@link Math#log(double)} function to each entry.<a name="line.262"></a>
+<FONT color="green">263</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.263"></a>
+<FONT color="green">264</FONT>         */<a name="line.264"></a>
+<FONT color="green">265</FONT>        RealVector mapLog();<a name="line.265"></a>
+<FONT color="green">266</FONT>    <a name="line.266"></a>
+<FONT color="green">267</FONT>        /**<a name="line.267"></a>
+<FONT color="green">268</FONT>         * Map the {@link Math#log(double)} function to each entry.<a name="line.268"></a>
+<FONT color="green">269</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.269"></a>
+<FONT color="green">270</FONT>         * @return for convenience, return this<a name="line.270"></a>
+<FONT color="green">271</FONT>         */<a name="line.271"></a>
+<FONT color="green">272</FONT>        RealVector mapLogToSelf();<a name="line.272"></a>
+<FONT color="green">273</FONT>    <a name="line.273"></a>
+<FONT color="green">274</FONT>        /**<a name="line.274"></a>
+<FONT color="green">275</FONT>         * Map the {@link Math#log10(double)} function to each entry.<a name="line.275"></a>
+<FONT color="green">276</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.276"></a>
+<FONT color="green">277</FONT>         */<a name="line.277"></a>
+<FONT color="green">278</FONT>        RealVector mapLog10();<a name="line.278"></a>
+<FONT color="green">279</FONT>    <a name="line.279"></a>
+<FONT color="green">280</FONT>        /**<a name="line.280"></a>
+<FONT color="green">281</FONT>         * Map the {@link Math#log10(double)} function to each entry.<a name="line.281"></a>
+<FONT color="green">282</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.282"></a>
+<FONT color="green">283</FONT>         * @return for convenience, return this<a name="line.283"></a>
+<FONT color="green">284</FONT>         */<a name="line.284"></a>
+<FONT color="green">285</FONT>        RealVector mapLog10ToSelf();<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>        /**<a name="line.287"></a>
+<FONT color="green">288</FONT>         * Map the {@link Math#log1p(double)} function to each entry.<a name="line.288"></a>
+<FONT color="green">289</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.289"></a>
+<FONT color="green">290</FONT>         */<a name="line.290"></a>
+<FONT color="green">291</FONT>        RealVector mapLog1p();<a name="line.291"></a>
+<FONT color="green">292</FONT>    <a name="line.292"></a>
+<FONT color="green">293</FONT>        /**<a name="line.293"></a>
+<FONT color="green">294</FONT>         * Map the {@link Math#log1p(double)} function to each entry.<a name="line.294"></a>
+<FONT color="green">295</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.295"></a>
+<FONT color="green">296</FONT>         * @return for convenience, return this<a name="line.296"></a>
+<FONT color="green">297</FONT>         */<a name="line.297"></a>
+<FONT color="green">298</FONT>        RealVector mapLog1pToSelf();<a name="line.298"></a>
+<FONT color="green">299</FONT>    <a name="line.299"></a>
+<FONT color="green">300</FONT>        /**<a name="line.300"></a>
+<FONT color="green">301</FONT>         * Map the {@link Math#cosh(double)} function to each entry.<a name="line.301"></a>
+<FONT color="green">302</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.302"></a>
+<FONT color="green">303</FONT>         */<a name="line.303"></a>
+<FONT color="green">304</FONT>        RealVector mapCosh();<a name="line.304"></a>
+<FONT color="green">305</FONT>    <a name="line.305"></a>
+<FONT color="green">306</FONT>        /**<a name="line.306"></a>
+<FONT color="green">307</FONT>         * Map the {@link Math#cosh(double)} function to each entry.<a name="line.307"></a>
+<FONT color="green">308</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.308"></a>
+<FONT color="green">309</FONT>         * @return for convenience, return this<a name="line.309"></a>
+<FONT color="green">310</FONT>         */<a name="line.310"></a>
+<FONT color="green">311</FONT>        RealVector mapCoshToSelf();<a name="line.311"></a>
+<FONT color="green">312</FONT>    <a name="line.312"></a>
+<FONT color="green">313</FONT>        /**<a name="line.313"></a>
+<FONT color="green">314</FONT>         * Map the {@link Math#sinh(double)} function to each entry.<a name="line.314"></a>
+<FONT color="green">315</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.315"></a>
+<FONT color="green">316</FONT>         */<a name="line.316"></a>
+<FONT color="green">317</FONT>        RealVector mapSinh();<a name="line.317"></a>
+<FONT color="green">318</FONT>    <a name="line.318"></a>
+<FONT color="green">319</FONT>        /**<a name="line.319"></a>
+<FONT color="green">320</FONT>         * Map the {@link Math#sinh(double)} function to each entry.<a name="line.320"></a>
+<FONT color="green">321</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.321"></a>
+<FONT color="green">322</FONT>         * @return for convenience, return this<a name="line.322"></a>
+<FONT color="green">323</FONT>         */<a name="line.323"></a>
+<FONT color="green">324</FONT>        RealVector mapSinhToSelf();<a name="line.324"></a>
+<FONT color="green">325</FONT>    <a name="line.325"></a>
+<FONT color="green">326</FONT>        /**<a name="line.326"></a>
+<FONT color="green">327</FONT>         * Map the {@link Math#tanh(double)} function to each entry.<a name="line.327"></a>
+<FONT color="green">328</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.328"></a>
+<FONT color="green">329</FONT>         */<a name="line.329"></a>
+<FONT color="green">330</FONT>        RealVector mapTanh();<a name="line.330"></a>
+<FONT color="green">331</FONT>    <a name="line.331"></a>
+<FONT color="green">332</FONT>        /**<a name="line.332"></a>
+<FONT color="green">333</FONT>         * Map the {@link Math#tanh(double)} function to each entry.<a name="line.333"></a>
+<FONT color="green">334</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.334"></a>
+<FONT color="green">335</FONT>         * @return for convenience, return this<a name="line.335"></a>
+<FONT color="green">336</FONT>         */<a name="line.336"></a>
+<FONT color="green">337</FONT>        RealVector mapTanhToSelf();<a name="line.337"></a>
+<FONT color="green">338</FONT>    <a name="line.338"></a>
+<FONT color="green">339</FONT>        /**<a name="line.339"></a>
+<FONT color="green">340</FONT>         * Map the {@link Math#cos(double)} function to each entry.<a name="line.340"></a>
+<FONT color="green">341</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.341"></a>
+<FONT color="green">342</FONT>         */<a name="line.342"></a>
+<FONT color="green">343</FONT>        RealVector mapCos();<a name="line.343"></a>
+<FONT color="green">344</FONT>    <a name="line.344"></a>
+<FONT color="green">345</FONT>        /**<a name="line.345"></a>
+<FONT color="green">346</FONT>         * Map the {@link Math#cos(double)} function to each entry.<a name="line.346"></a>
+<FONT color="green">347</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.347"></a>
+<FONT color="green">348</FONT>         * @return for convenience, return this<a name="line.348"></a>
+<FONT color="green">349</FONT>         */<a name="line.349"></a>
+<FONT color="green">350</FONT>        RealVector mapCosToSelf();<a name="line.350"></a>
+<FONT color="green">351</FONT>    <a name="line.351"></a>
+<FONT color="green">352</FONT>        /**<a name="line.352"></a>
+<FONT color="green">353</FONT>         * Map the {@link Math#sin(double)} function to each entry.<a name="line.353"></a>
+<FONT color="green">354</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.354"></a>
+<FONT color="green">355</FONT>         */<a name="line.355"></a>
+<FONT color="green">356</FONT>        RealVector mapSin();<a name="line.356"></a>
+<FONT color="green">357</FONT>    <a name="line.357"></a>
+<FONT color="green">358</FONT>        /**<a name="line.358"></a>
+<FONT color="green">359</FONT>         * Map the {@link Math#sin(double)} function to each entry.<a name="line.359"></a>
+<FONT color="green">360</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.360"></a>
+<FONT color="green">361</FONT>         * @return for convenience, return this<a name="line.361"></a>
+<FONT color="green">362</FONT>         */<a name="line.362"></a>
+<FONT color="green">363</FONT>        RealVector mapSinToSelf();<a name="line.363"></a>
+<FONT color="green">364</FONT>    <a name="line.364"></a>
+<FONT color="green">365</FONT>        /**<a name="line.365"></a>
+<FONT color="green">366</FONT>         * Map the {@link Math#tan(double)} function to each entry.<a name="line.366"></a>
+<FONT color="green">367</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.367"></a>
+<FONT color="green">368</FONT>         */<a name="line.368"></a>
+<FONT color="green">369</FONT>        RealVector mapTan();<a name="line.369"></a>
+<FONT color="green">370</FONT>    <a name="line.370"></a>
+<FONT color="green">371</FONT>        /**<a name="line.371"></a>
+<FONT color="green">372</FONT>         * Map the {@link Math#tan(double)} function to each entry.<a name="line.372"></a>
+<FONT color="green">373</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.373"></a>
+<FONT color="green">374</FONT>         * @return for convenience, return this<a name="line.374"></a>
+<FONT color="green">375</FONT>         */<a name="line.375"></a>
+<FONT color="green">376</FONT>        RealVector mapTanToSelf();<a name="line.376"></a>
+<FONT color="green">377</FONT>    <a name="line.377"></a>
+<FONT color="green">378</FONT>        /**<a name="line.378"></a>
+<FONT color="green">379</FONT>         * Map the {@link Math#acos(double)} function to each entry.<a name="line.379"></a>
+<FONT color="green">380</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.380"></a>
+<FONT color="green">381</FONT>         */<a name="line.381"></a>
+<FONT color="green">382</FONT>        RealVector mapAcos();<a name="line.382"></a>
+<FONT color="green">383</FONT>    <a name="line.383"></a>
+<FONT color="green">384</FONT>        /**<a name="line.384"></a>
+<FONT color="green">385</FONT>         * Map the {@link Math#acos(double)} function to each entry.<a name="line.385"></a>
+<FONT color="green">386</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.386"></a>
+<FONT color="green">387</FONT>         * @return for convenience, return this<a name="line.387"></a>
+<FONT color="green">388</FONT>         */<a name="line.388"></a>
+<FONT color="green">389</FONT>        RealVector mapAcosToSelf();<a name="line.389"></a>
+<FONT color="green">390</FONT>    <a name="line.390"></a>
+<FONT color="green">391</FONT>        /**<a name="line.391"></a>
+<FONT color="green">392</FONT>         * Map the {@link Math#asin(double)} function to each entry.<a name="line.392"></a>
+<FONT color="green">393</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.393"></a>
+<FONT color="green">394</FONT>         */<a name="line.394"></a>
+<FONT color="green">395</FONT>        RealVector mapAsin();<a name="line.395"></a>
+<FONT color="green">396</FONT>    <a name="line.396"></a>
+<FONT color="green">397</FONT>        /**<a name="line.397"></a>
+<FONT color="green">398</FONT>         * Map the {@link Math#asin(double)} function to each entry.<a name="line.398"></a>
+<FONT color="green">399</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.399"></a>
+<FONT color="green">400</FONT>         * @return for convenience, return this<a name="line.400"></a>
+<FONT color="green">401</FONT>         */<a name="line.401"></a>
+<FONT color="green">402</FONT>        RealVector mapAsinToSelf();<a name="line.402"></a>
+<FONT color="green">403</FONT>    <a name="line.403"></a>
+<FONT color="green">404</FONT>        /**<a name="line.404"></a>
+<FONT color="green">405</FONT>         * Map the {@link Math#atan(double)} function to each entry.<a name="line.405"></a>
+<FONT color="green">406</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.406"></a>
+<FONT color="green">407</FONT>         */<a name="line.407"></a>
+<FONT color="green">408</FONT>        RealVector mapAtan();<a name="line.408"></a>
+<FONT color="green">409</FONT>    <a name="line.409"></a>
+<FONT color="green">410</FONT>        /**<a name="line.410"></a>
+<FONT color="green">411</FONT>         * Map the {@link Math#atan(double)} function to each entry.<a name="line.411"></a>
+<FONT color="green">412</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.412"></a>
+<FONT color="green">413</FONT>         * @return for convenience, return this<a name="line.413"></a>
+<FONT color="green">414</FONT>         */<a name="line.414"></a>
+<FONT color="green">415</FONT>        RealVector mapAtanToSelf();<a name="line.415"></a>
+<FONT color="green">416</FONT>    <a name="line.416"></a>
+<FONT color="green">417</FONT>        /**<a name="line.417"></a>
+<FONT color="green">418</FONT>         * Map the 1/x function to each entry.<a name="line.418"></a>
+<FONT color="green">419</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.419"></a>
+<FONT color="green">420</FONT>         */<a name="line.420"></a>
+<FONT color="green">421</FONT>        RealVector mapInv();<a name="line.421"></a>
+<FONT color="green">422</FONT>    <a name="line.422"></a>
+<FONT color="green">423</FONT>        /**<a name="line.423"></a>
+<FONT color="green">424</FONT>         * Map the 1/x function to each entry.<a name="line.424"></a>
+<FONT color="green">425</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.425"></a>
+<FONT color="green">426</FONT>         * @return for convenience, return this<a name="line.426"></a>
+<FONT color="green">427</FONT>         */<a name="line.427"></a>
+<FONT color="green">428</FONT>        RealVector mapInvToSelf();<a name="line.428"></a>
+<FONT color="green">429</FONT>    <a name="line.429"></a>
+<FONT color="green">430</FONT>        /**<a name="line.430"></a>
+<FONT color="green">431</FONT>         * Map the {@link Math#abs(double)} function to each entry.<a name="line.431"></a>
+<FONT color="green">432</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.432"></a>
+<FONT color="green">433</FONT>         */<a name="line.433"></a>
+<FONT color="green">434</FONT>        RealVector mapAbs();<a name="line.434"></a>
+<FONT color="green">435</FONT>    <a name="line.435"></a>
+<FONT color="green">436</FONT>        /**<a name="line.436"></a>
+<FONT color="green">437</FONT>         * Map the {@link Math#abs(double)} function to each entry.<a name="line.437"></a>
+<FONT color="green">438</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.438"></a>
+<FONT color="green">439</FONT>         * @return for convenience, return this<a name="line.439"></a>
+<FONT color="green">440</FONT>         */<a name="line.440"></a>
+<FONT color="green">441</FONT>        RealVector mapAbsToSelf();<a name="line.441"></a>
+<FONT color="green">442</FONT>    <a name="line.442"></a>
+<FONT color="green">443</FONT>        /**<a name="line.443"></a>
+<FONT color="green">444</FONT>         * Map the {@link Math#sqrt(double)} function to each entry.<a name="line.444"></a>
+<FONT color="green">445</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.445"></a>
+<FONT color="green">446</FONT>         */<a name="line.446"></a>
+<FONT color="green">447</FONT>        RealVector mapSqrt();<a name="line.447"></a>
+<FONT color="green">448</FONT>    <a name="line.448"></a>
+<FONT color="green">449</FONT>        /**<a name="line.449"></a>
+<FONT color="green">450</FONT>         * Map the {@link Math#sqrt(double)} function to each entry.<a name="line.450"></a>
+<FONT color="green">451</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.451"></a>
+<FONT color="green">452</FONT>         * @return for convenience, return this<a name="line.452"></a>
+<FONT color="green">453</FONT>         */<a name="line.453"></a>
+<FONT color="green">454</FONT>        RealVector mapSqrtToSelf();<a name="line.454"></a>
+<FONT color="green">455</FONT>    <a name="line.455"></a>
+<FONT color="green">456</FONT>        /**<a name="line.456"></a>
+<FONT color="green">457</FONT>         * Map the {@link Math#cbrt(double)} function to each entry.<a name="line.457"></a>
+<FONT color="green">458</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.458"></a>
+<FONT color="green">459</FONT>         */<a name="line.459"></a>
+<FONT color="green">460</FONT>        RealVector mapCbrt();<a name="line.460"></a>
+<FONT color="green">461</FONT>    <a name="line.461"></a>
+<FONT color="green">462</FONT>        /**<a name="line.462"></a>
+<FONT color="green">463</FONT>         * Map the {@link Math#cbrt(double)} function to each entry.<a name="line.463"></a>
+<FONT color="green">464</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.464"></a>
+<FONT color="green">465</FONT>         * @return for convenience, return this<a name="line.465"></a>
+<FONT color="green">466</FONT>         */<a name="line.466"></a>
+<FONT color="green">467</FONT>        RealVector mapCbrtToSelf();<a name="line.467"></a>
+<FONT color="green">468</FONT>    <a name="line.468"></a>
+<FONT color="green">469</FONT>        /**<a name="line.469"></a>
+<FONT color="green">470</FONT>         * Map the {@link Math#ceil(double)} function to each entry.<a name="line.470"></a>
+<FONT color="green">471</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.471"></a>
+<FONT color="green">472</FONT>         */<a name="line.472"></a>
+<FONT color="green">473</FONT>        RealVector mapCeil();<a name="line.473"></a>
+<FONT color="green">474</FONT>    <a name="line.474"></a>
+<FONT color="green">475</FONT>        /**<a name="line.475"></a>
+<FONT color="green">476</FONT>         * Map the {@link Math#ceil(double)} function to each entry.<a name="line.476"></a>
+<FONT color="green">477</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.477"></a>
+<FONT color="green">478</FONT>         * @return for convenience, return this<a name="line.478"></a>
+<FONT color="green">479</FONT>         */<a name="line.479"></a>
+<FONT color="green">480</FONT>        RealVector mapCeilToSelf();<a name="line.480"></a>
+<FONT color="green">481</FONT>    <a name="line.481"></a>
+<FONT color="green">482</FONT>        /**<a name="line.482"></a>
+<FONT color="green">483</FONT>         * Map the {@link Math#floor(double)} function to each entry.<a name="line.483"></a>
+<FONT color="green">484</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.484"></a>
+<FONT color="green">485</FONT>         */<a name="line.485"></a>
+<FONT color="green">486</FONT>        RealVector mapFloor();<a name="line.486"></a>
+<FONT color="green">487</FONT>    <a name="line.487"></a>
+<FONT color="green">488</FONT>        /**<a name="line.488"></a>
+<FONT color="green">489</FONT>         * Map the {@link Math#floor(double)} function to each entry.<a name="line.489"></a>
+<FONT color="green">490</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.490"></a>
+<FONT color="green">491</FONT>         * @return for convenience, return this<a name="line.491"></a>
+<FONT color="green">492</FONT>         */<a name="line.492"></a>
+<FONT color="green">493</FONT>        RealVector mapFloorToSelf();<a name="line.493"></a>
+<FONT color="green">494</FONT>    <a name="line.494"></a>
+<FONT color="green">495</FONT>        /**<a name="line.495"></a>
+<FONT color="green">496</FONT>         * Map the {@link Math#rint(double)} function to each entry.<a name="line.496"></a>
+<FONT color="green">497</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.497"></a>
+<FONT color="green">498</FONT>         */<a name="line.498"></a>
+<FONT color="green">499</FONT>        RealVector mapRint();<a name="line.499"></a>
+<FONT color="green">500</FONT>    <a name="line.500"></a>
+<FONT color="green">501</FONT>        /**<a name="line.501"></a>
+<FONT color="green">502</FONT>         * Map the {@link Math#rint(double)} function to each entry.<a name="line.502"></a>
+<FONT color="green">503</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.503"></a>
+<FONT color="green">504</FONT>         * @return for convenience, return this<a name="line.504"></a>
+<FONT color="green">505</FONT>         */<a name="line.505"></a>
+<FONT color="green">506</FONT>        RealVector mapRintToSelf();<a name="line.506"></a>
+<FONT color="green">507</FONT>    <a name="line.507"></a>
+<FONT color="green">508</FONT>        /**<a name="line.508"></a>
+<FONT color="green">509</FONT>         * Map the {@link Math#signum(double)} function to each entry.<a name="line.509"></a>
+<FONT color="green">510</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.510"></a>
+<FONT color="green">511</FONT>         */<a name="line.511"></a>
+<FONT color="green">512</FONT>        RealVector mapSignum();<a name="line.512"></a>
+<FONT color="green">513</FONT>    <a name="line.513"></a>
+<FONT color="green">514</FONT>        /**<a name="line.514"></a>
+<FONT color="green">515</FONT>         * Map the {@link Math#signum(double)} function to each entry.<a name="line.515"></a>
+<FONT color="green">516</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.516"></a>
+<FONT color="green">517</FONT>         * @return for convenience, return this<a name="line.517"></a>
+<FONT color="green">518</FONT>         */<a name="line.518"></a>
+<FONT color="green">519</FONT>        RealVector mapSignumToSelf();<a name="line.519"></a>
+<FONT color="green">520</FONT>    <a name="line.520"></a>
+<FONT color="green">521</FONT>        /**<a name="line.521"></a>
+<FONT color="green">522</FONT>         * Map the {@link Math#ulp(double)} function to each entry.<a name="line.522"></a>
+<FONT color="green">523</FONT>         * @return a vector containing the result of applying the function to each entry<a name="line.523"></a>
+<FONT color="green">524</FONT>         */<a name="line.524"></a>
+<FONT color="green">525</FONT>        RealVector mapUlp();<a name="line.525"></a>
+<FONT color="green">526</FONT>    <a name="line.526"></a>
+<FONT color="green">527</FONT>        /**<a name="line.527"></a>
+<FONT color="green">528</FONT>         * Map the {@link Math#ulp(double)} function to each entry.<a name="line.528"></a>
+<FONT color="green">529</FONT>         * &lt;p&gt;The instance &lt;strong&gt;is&lt;/strong&gt; changed by this method.&lt;/p&gt;<a name="line.529"></a>
+<FONT color="green">530</FONT>         * @return for convenience, return this<a name="line.530"></a>
+<FONT color="green">531</FONT>         */<a name="line.531"></a>
+<FONT color="green">532</FONT>        RealVector mapUlpToSelf();<a name="line.532"></a>
+<FONT color="green">533</FONT>    <a name="line.533"></a>
+<FONT color="green">534</FONT>        /**<a name="line.534"></a>
+<FONT color="green">535</FONT>         * Element-by-element multiplication.<a name="line.535"></a>
+<FONT color="green">536</FONT>         * @param v vector by which instance elements must be multiplied<a name="line.536"></a>
+<FONT color="green">537</FONT>         * @return a vector containing this[i] * v[i] for all i<a name="line.537"></a>
+<FONT color="green">538</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.538"></a>
+<FONT color="green">539</FONT>         */<a name="line.539"></a>
+<FONT color="green">540</FONT>        RealVector ebeMultiply(RealVector v) throws IllegalArgumentException;<a name="line.540"></a>
+<FONT color="green">541</FONT>    <a name="line.541"></a>
+<FONT color="green">542</FONT>        /**<a name="line.542"></a>
+<FONT color="green">543</FONT>         * Element-by-element multiplication.<a name="line.543"></a>
+<FONT color="green">544</FONT>         * @param v vector by which instance elements must be multiplied<a name="line.544"></a>
+<FONT color="green">545</FONT>         * @return a vector containing this[i] * v[i] for all i<a name="line.545"></a>
+<FONT color="green">546</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.546"></a>
+<FONT color="green">547</FONT>         */<a name="line.547"></a>
+<FONT color="green">548</FONT>        RealVector ebeMultiply(double[] v) throws IllegalArgumentException;<a name="line.548"></a>
+<FONT color="green">549</FONT>    <a name="line.549"></a>
+<FONT color="green">550</FONT>        /**<a name="line.550"></a>
+<FONT color="green">551</FONT>         * Element-by-element division.<a name="line.551"></a>
+<FONT color="green">552</FONT>         * @param v vector by which instance elements must be divided<a name="line.552"></a>
+<FONT color="green">553</FONT>         * @return a vector containing this[i] / v[i] for all i<a name="line.553"></a>
+<FONT color="green">554</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.554"></a>
+<FONT color="green">555</FONT>         */<a name="line.555"></a>
+<FONT color="green">556</FONT>        RealVector ebeDivide(RealVector v) throws IllegalArgumentException;<a name="line.556"></a>
+<FONT color="green">557</FONT>    <a name="line.557"></a>
+<FONT color="green">558</FONT>        /**<a name="line.558"></a>
+<FONT color="green">559</FONT>         * Element-by-element division.<a name="line.559"></a>
+<FONT color="green">560</FONT>         * @param v vector by which instance elements must be divided<a name="line.560"></a>
+<FONT color="green">561</FONT>         * @return a vector containing this[i] / v[i] for all i<a name="line.561"></a>
+<FONT color="green">562</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.562"></a>
+<FONT color="green">563</FONT>         */<a name="line.563"></a>
+<FONT color="green">564</FONT>        RealVector ebeDivide(double[] v) throws IllegalArgumentException;<a name="line.564"></a>
+<FONT color="green">565</FONT>    <a name="line.565"></a>
+<FONT color="green">566</FONT>        /**<a name="line.566"></a>
+<FONT color="green">567</FONT>         * Returns vector entries as a double array.<a name="line.567"></a>
+<FONT color="green">568</FONT>         * @return double array of entries<a name="line.568"></a>
+<FONT color="green">569</FONT>         */<a name="line.569"></a>
+<FONT color="green">570</FONT>         double[] getData();<a name="line.570"></a>
+<FONT color="green">571</FONT>    <a name="line.571"></a>
+<FONT color="green">572</FONT>        /**<a name="line.572"></a>
+<FONT color="green">573</FONT>         * Compute the dot product.<a name="line.573"></a>
+<FONT color="green">574</FONT>         * @param v vector with which dot product should be computed<a name="line.574"></a>
+<FONT color="green">575</FONT>         * @return the scalar dot product between instance and v<a name="line.575"></a>
+<FONT color="green">576</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.576"></a>
+<FONT color="green">577</FONT>         */<a name="line.577"></a>
+<FONT color="green">578</FONT>        double dotProduct(RealVector v)<a name="line.578"></a>
+<FONT color="green">579</FONT>            throws IllegalArgumentException;<a name="line.579"></a>
+<FONT color="green">580</FONT>    <a name="line.580"></a>
+<FONT color="green">581</FONT>        /**<a name="line.581"></a>
+<FONT color="green">582</FONT>         * Compute the dot product.<a name="line.582"></a>
+<FONT color="green">583</FONT>         * @param v vector with which dot product should be computed<a name="line.583"></a>
+<FONT color="green">584</FONT>         * @return the scalar dot product between instance and v<a name="line.584"></a>
+<FONT color="green">585</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.585"></a>
+<FONT color="green">586</FONT>         */<a name="line.586"></a>
+<FONT color="green">587</FONT>        double dotProduct(double[] v)<a name="line.587"></a>
+<FONT color="green">588</FONT>            throws IllegalArgumentException;<a name="line.588"></a>
+<FONT color="green">589</FONT>    <a name="line.589"></a>
+<FONT color="green">590</FONT>        /**<a name="line.590"></a>
+<FONT color="green">591</FONT>         * Returns the L&lt;sub&gt;2&lt;/sub&gt; norm of the vector.<a name="line.591"></a>
+<FONT color="green">592</FONT>         * &lt;p&gt;The L&lt;sub&gt;2&lt;/sub&gt; norm is the root of the sum of<a name="line.592"></a>
+<FONT color="green">593</FONT>         * the squared elements.&lt;/p&gt;<a name="line.593"></a>
+<FONT color="green">594</FONT>         * @return norm<a name="line.594"></a>
+<FONT color="green">595</FONT>         * @see #getL1Norm()<a name="line.595"></a>
+<FONT color="green">596</FONT>         * @see #getLInfNorm()<a name="line.596"></a>
+<FONT color="green">597</FONT>         * @see #getDistance(RealVector)<a name="line.597"></a>
+<FONT color="green">598</FONT>         */<a name="line.598"></a>
+<FONT color="green">599</FONT>        double getNorm();<a name="line.599"></a>
+<FONT color="green">600</FONT>    <a name="line.600"></a>
+<FONT color="green">601</FONT>        /**<a name="line.601"></a>
+<FONT color="green">602</FONT>         * Returns the L&lt;sub&gt;1&lt;/sub&gt; norm of the vector.<a name="line.602"></a>
+<FONT color="green">603</FONT>         * &lt;p&gt;The L&lt;sub&gt;1&lt;/sub&gt; norm is the sum of the absolute<a name="line.603"></a>
+<FONT color="green">604</FONT>         * values of elements.&lt;/p&gt;<a name="line.604"></a>
+<FONT color="green">605</FONT>         * @return norm<a name="line.605"></a>
+<FONT color="green">606</FONT>         * @see #getNorm()<a name="line.606"></a>
+<FONT color="green">607</FONT>         * @see #getLInfNorm()<a name="line.607"></a>
+<FONT color="green">608</FONT>         * @see #getL1Distance(RealVector)<a name="line.608"></a>
+<FONT color="green">609</FONT>         */<a name="line.609"></a>
+<FONT color="green">610</FONT>        double getL1Norm();<a name="line.610"></a>
+<FONT color="green">611</FONT>    <a name="line.611"></a>
+<FONT color="green">612</FONT>        /**<a name="line.612"></a>
+<FONT color="green">613</FONT>         * Returns the L&lt;sub&gt;&amp;infin;&lt;/sub&gt; norm of the vector.<a name="line.613"></a>
+<FONT color="green">614</FONT>         * &lt;p&gt;The L&lt;sub&gt;&amp;infin;&lt;/sub&gt; norm is the max of the absolute<a name="line.614"></a>
+<FONT color="green">615</FONT>         * values of elements.&lt;/p&gt;<a name="line.615"></a>
+<FONT color="green">616</FONT>         * @return norm<a name="line.616"></a>
+<FONT color="green">617</FONT>         * @see #getNorm()<a name="line.617"></a>
+<FONT color="green">618</FONT>         * @see #getL1Norm()<a name="line.618"></a>
+<FONT color="green">619</FONT>         * @see #getLInfDistance(RealVector)<a name="line.619"></a>
+<FONT color="green">620</FONT>         */<a name="line.620"></a>
+<FONT color="green">621</FONT>        double getLInfNorm();<a name="line.621"></a>
+<FONT color="green">622</FONT>    <a name="line.622"></a>
+<FONT color="green">623</FONT>        /**<a name="line.623"></a>
+<FONT color="green">624</FONT>         * Distance between two vectors.<a name="line.624"></a>
+<FONT color="green">625</FONT>         * &lt;p&gt;This method computes the distance consistent with the<a name="line.625"></a>
+<FONT color="green">626</FONT>         * L&lt;sub&gt;2&lt;/sub&gt; norm, i.e. the square root of the sum of<a name="line.626"></a>
+<FONT color="green">627</FONT>         * elements differences, or euclidian distance.&lt;/p&gt;<a name="line.627"></a>
+<FONT color="green">628</FONT>         * @param v vector to which distance is requested<a name="line.628"></a>
+<FONT color="green">629</FONT>         * @return distance between two vectors.<a name="line.629"></a>
+<FONT color="green">630</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.630"></a>
+<FONT color="green">631</FONT>         * @see #getL1Distance(RealVector)<a name="line.631"></a>
+<FONT color="green">632</FONT>         * @see #getLInfDistance(RealVector)<a name="line.632"></a>
+<FONT color="green">633</FONT>         * @see #getNorm()<a name="line.633"></a>
+<FONT color="green">634</FONT>         */<a name="line.634"></a>
+<FONT color="green">635</FONT>        double getDistance(RealVector v)<a name="line.635"></a>
+<FONT color="green">636</FONT>            throws IllegalArgumentException;<a name="line.636"></a>
+<FONT color="green">637</FONT>    <a name="line.637"></a>
+<FONT color="green">638</FONT>        /**<a name="line.638"></a>
+<FONT color="green">639</FONT>         * Distance between two vectors.<a name="line.639"></a>
+<FONT color="green">640</FONT>         * &lt;p&gt;This method computes the distance consistent with the<a name="line.640"></a>
+<FONT color="green">641</FONT>         * L&lt;sub&gt;2&lt;/sub&gt; norm, i.e. the square root of the sum of<a name="line.641"></a>
+<FONT color="green">642</FONT>         * elements differences, or euclidian distance.&lt;/p&gt;<a name="line.642"></a>
+<FONT color="green">643</FONT>         * @param v vector to which distance is requested<a name="line.643"></a>
+<FONT color="green">644</FONT>         * @return distance between two vectors.<a name="line.644"></a>
+<FONT color="green">645</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.645"></a>
+<FONT color="green">646</FONT>         * @see #getL1Distance(double[])<a name="line.646"></a>
+<FONT color="green">647</FONT>         * @see #getLInfDistance(double[])<a name="line.647"></a>
+<FONT color="green">648</FONT>         * @see #getNorm()<a name="line.648"></a>
+<FONT color="green">649</FONT>         */<a name="line.649"></a>
+<FONT color="green">650</FONT>        double getDistance(double[] v)<a name="line.650"></a>
+<FONT color="green">651</FONT>            throws IllegalArgumentException;<a name="line.651"></a>
+<FONT color="green">652</FONT>    <a name="line.652"></a>
+<FONT color="green">653</FONT>        /**<a name="line.653"></a>
+<FONT color="green">654</FONT>         * Distance between two vectors.<a name="line.654"></a>
+<FONT color="green">655</FONT>         * &lt;p&gt;This method computes the distance consistent with<a name="line.655"></a>
+<FONT color="green">656</FONT>         * L&lt;sub&gt;1&lt;/sub&gt; norm, i.e. the sum of the absolute values of<a name="line.656"></a>
+<FONT color="green">657</FONT>         * elements differences.&lt;/p&gt;<a name="line.657"></a>
+<FONT color="green">658</FONT>         * @param v vector to which distance is requested<a name="line.658"></a>
+<FONT color="green">659</FONT>         * @return distance between two vectors.<a name="line.659"></a>
+<FONT color="green">660</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.660"></a>
+<FONT color="green">661</FONT>         * @see #getDistance(RealVector)<a name="line.661"></a>
+<FONT color="green">662</FONT>         * @see #getLInfDistance(RealVector)<a name="line.662"></a>
+<FONT color="green">663</FONT>         * @see #getL1Norm()<a name="line.663"></a>
+<FONT color="green">664</FONT>         */<a name="line.664"></a>
+<FONT color="green">665</FONT>        double getL1Distance(RealVector v)<a name="line.665"></a>
+<FONT color="green">666</FONT>            throws IllegalArgumentException;<a name="line.666"></a>
+<FONT color="green">667</FONT>    <a name="line.667"></a>
+<FONT color="green">668</FONT>        /**<a name="line.668"></a>
+<FONT color="green">669</FONT>         * Distance between two vectors.<a name="line.669"></a>
+<FONT color="green">670</FONT>         * &lt;p&gt;This method computes the distance consistent with<a name="line.670"></a>
+<FONT color="green">671</FONT>         * L&lt;sub&gt;1&lt;/sub&gt; norm, i.e. the sum of the absolute values of<a name="line.671"></a>
+<FONT color="green">672</FONT>         * elements differences.&lt;/p&gt;<a name="line.672"></a>
+<FONT color="green">673</FONT>         * @param v vector to which distance is requested<a name="line.673"></a>
+<FONT color="green">674</FONT>         * @return distance between two vectors.<a name="line.674"></a>
+<FONT color="green">675</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.675"></a>
+<FONT color="green">676</FONT>         * @see #getDistance(double[])<a name="line.676"></a>
+<FONT color="green">677</FONT>         * @see #getLInfDistance(double[])<a name="line.677"></a>
+<FONT color="green">678</FONT>         * @see #getL1Norm()<a name="line.678"></a>
+<FONT color="green">679</FONT>         */<a name="line.679"></a>
+<FONT color="green">680</FONT>        double getL1Distance(double[] v)<a name="line.680"></a>
+<FONT color="green">681</FONT>            throws IllegalArgumentException;<a name="line.681"></a>
+<FONT color="green">682</FONT>    <a name="line.682"></a>
+<FONT color="green">683</FONT>        /**<a name="line.683"></a>
+<FONT color="green">684</FONT>         * Distance between two vectors.<a name="line.684"></a>
+<FONT color="green">685</FONT>         * &lt;p&gt;This method computes the distance consistent with<a name="line.685"></a>
+<FONT color="green">686</FONT>         * L&lt;sub&gt;&amp;infin;&lt;/sub&gt; norm, i.e. the max of the absolute values of<a name="line.686"></a>
+<FONT color="green">687</FONT>         * elements differences.&lt;/p&gt;<a name="line.687"></a>
+<FONT color="green">688</FONT>         * @param v vector to which distance is requested<a name="line.688"></a>
+<FONT color="green">689</FONT>         * @return distance between two vectors.<a name="line.689"></a>
+<FONT color="green">690</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.690"></a>
+<FONT color="green">691</FONT>         * @see #getDistance(RealVector)<a name="line.691"></a>
+<FONT color="green">692</FONT>         * @see #getL1Distance(RealVector)<a name="line.692"></a>
+<FONT color="green">693</FONT>         * @see #getLInfNorm()<a name="line.693"></a>
+<FONT color="green">694</FONT>         */<a name="line.694"></a>
+<FONT color="green">695</FONT>        double getLInfDistance(RealVector v)<a name="line.695"></a>
+<FONT color="green">696</FONT>            throws IllegalArgumentException;<a name="line.696"></a>
+<FONT color="green">697</FONT>    <a name="line.697"></a>
+<FONT color="green">698</FONT>        /**<a name="line.698"></a>
+<FONT color="green">699</FONT>         * Distance between two vectors.<a name="line.699"></a>
+<FONT color="green">700</FONT>         * &lt;p&gt;This method computes the distance consistent with<a name="line.700"></a>
+<FONT color="green">701</FONT>         * L&lt;sub&gt;&amp;infin;&lt;/sub&gt; norm, i.e. the max of the absolute values of<a name="line.701"></a>
+<FONT color="green">702</FONT>         * elements differences.&lt;/p&gt;<a name="line.702"></a>
+<FONT color="green">703</FONT>         * @param v vector to which distance is requested<a name="line.703"></a>
+<FONT color="green">704</FONT>         * @return distance between two vectors.<a name="line.704"></a>
+<FONT color="green">705</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.705"></a>
+<FONT color="green">706</FONT>         * @see #getDistance(double[])<a name="line.706"></a>
+<FONT color="green">707</FONT>         * @see #getL1Distance(double[])<a name="line.707"></a>
+<FONT color="green">708</FONT>         * @see #getLInfNorm()<a name="line.708"></a>
+<FONT color="green">709</FONT>         */<a name="line.709"></a>
+<FONT color="green">710</FONT>        double getLInfDistance(double[] v)<a name="line.710"></a>
+<FONT color="green">711</FONT>            throws IllegalArgumentException;<a name="line.711"></a>
+<FONT color="green">712</FONT>    <a name="line.712"></a>
+<FONT color="green">713</FONT>        /** Creates a unit vector pointing in the direction of this vector.<a name="line.713"></a>
+<FONT color="green">714</FONT>         * &lt;p&gt;The instance is not changed by this method.&lt;/p&gt;<a name="line.714"></a>
+<FONT color="green">715</FONT>         * @return a unit vector pointing in direction of this vector<a name="line.715"></a>
+<FONT color="green">716</FONT>         * @exception ArithmeticException if the norm is null<a name="line.716"></a>
+<FONT color="green">717</FONT>         */<a name="line.717"></a>
+<FONT color="green">718</FONT>        RealVector unitVector();<a name="line.718"></a>
+<FONT color="green">719</FONT>    <a name="line.719"></a>
+<FONT color="green">720</FONT>        /** Converts this vector into a unit vector.<a name="line.720"></a>
+<FONT color="green">721</FONT>         * &lt;p&gt;The instance itself is changed by this method.&lt;/p&gt;<a name="line.721"></a>
+<FONT color="green">722</FONT>         * @exception ArithmeticException if the norm is null<a name="line.722"></a>
+<FONT color="green">723</FONT>         */<a name="line.723"></a>
+<FONT color="green">724</FONT>        void unitize();<a name="line.724"></a>
+<FONT color="green">725</FONT>    <a name="line.725"></a>
+<FONT color="green">726</FONT>        /** Find the orthogonal projection of this vector onto another vector.<a name="line.726"></a>
+<FONT color="green">727</FONT>         * @param v vector onto which instance must be projected<a name="line.727"></a>
+<FONT color="green">728</FONT>         * @return projection of the instance onto v<a name="line.728"></a>
+<FONT color="green">729</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.729"></a>
+<FONT color="green">730</FONT>         */<a name="line.730"></a>
+<FONT color="green">731</FONT>        RealVector projection(RealVector v)<a name="line.731"></a>
+<FONT color="green">732</FONT>            throws IllegalArgumentException;<a name="line.732"></a>
+<FONT color="green">733</FONT>    <a name="line.733"></a>
+<FONT color="green">734</FONT>        /** Find the orthogonal projection of this vector onto another vector.<a name="line.734"></a>
+<FONT color="green">735</FONT>         * @param v vector onto which instance must be projected<a name="line.735"></a>
+<FONT color="green">736</FONT>         * @return projection of the instance onto v<a name="line.736"></a>
+<FONT color="green">737</FONT>         * @throws IllegalArgumentException if v is not the same size as this<a name="line.737"></a>
+<FONT color="green">738</FONT>         */<a name="line.738"></a>
+<FONT color="green">739</FONT>        RealVector projection(double[] v)<a name="line.739"></a>
+<FONT color="green">740</FONT>            throws IllegalArgumentException;<a name="line.740"></a>
+<FONT color="green">741</FONT>    <a name="line.741"></a>
+<FONT color="green">742</FONT>        /**<a name="line.742"></a>
+<FONT color="green">743</FONT>         * Compute the outer product.<a name="line.743"></a>
+<FONT color="green">744</FONT>         * @param v vector with which outer product should be computed<a name="line.744"></a>
+<FONT color="green">745</FONT>         * @return the square matrix outer product between instance and v<a name="line.745"></a>
+<FONT color="green">746</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.746"></a>
+<FONT color="green">747</FONT>         */<a name="line.747"></a>
+<FONT color="green">748</FONT>        RealMatrix outerProduct(RealVector v)<a name="line.748"></a>
+<FONT color="green">749</FONT>            throws IllegalArgumentException;<a name="line.749"></a>
+<FONT color="green">750</FONT>    <a name="line.750"></a>
+<FONT color="green">751</FONT>        /**<a name="line.751"></a>
+<FONT color="green">752</FONT>         * Compute the outer product.<a name="line.752"></a>
+<FONT color="green">753</FONT>         * @param v vector with which outer product should be computed<a name="line.753"></a>
+<FONT color="green">754</FONT>         * @return the square matrix outer product between instance and v<a name="line.754"></a>
+<FONT color="green">755</FONT>         * @exception IllegalArgumentException if v is not the same size as this<a name="line.755"></a>
+<FONT color="green">756</FONT>         */<a name="line.756"></a>
+<FONT color="green">757</FONT>        RealMatrix outerProduct(double[] v)<a name="line.757"></a>
+<FONT color="green">758</FONT>            throws IllegalArgumentException;<a name="line.758"></a>
+<FONT color="green">759</FONT>    <a name="line.759"></a>
+<FONT color="green">760</FONT>        /**<a name="line.760"></a>
+<FONT color="green">761</FONT>         * Returns the entry in the specified index.<a name="line.761"></a>
+<FONT color="green">762</FONT>         * &lt;p&gt;<a name="line.762"></a>
+<FONT color="green">763</FONT>         * The index start at 0 and must be lesser than the size,<a name="line.763"></a>
+<FONT color="green">764</FONT>         * otherwise a {@link MatrixIndexException} is thrown.<a name="line.764"></a>
+<FONT color="green">765</FONT>         * &lt;/p&gt;<a name="line.765"></a>
+<FONT color="green">766</FONT>         * @param index  index location of entry to be fetched<a name="line.766"></a>
+<FONT color="green">767</FONT>         * @return vector entry at index<a name="line.767"></a>
+<FONT color="green">768</FONT>         * @throws MatrixIndexException if the index is not valid<a name="line.768"></a>
+<FONT color="green">769</FONT>         * @see #setEntry(int, double)<a name="line.769"></a>
+<FONT color="green">770</FONT>         */<a name="line.770"></a>
+<FONT color="green">771</FONT>        double getEntry(int index)<a name="line.771"></a>
+<FONT color="green">772</FONT>            throws MatrixIndexException;<a name="line.772"></a>
+<FONT color="green">773</FONT>    <a name="line.773"></a>
+<FONT color="green">774</FONT>        /**<a name="line.774"></a>
+<FONT color="green">775</FONT>         * Set a single element.<a name="line.775"></a>
+<FONT color="green">776</FONT>         * @param index element index.<a name="line.776"></a>
+<FONT color="green">777</FONT>         * @param value new value for the element.<a name="line.777"></a>
+<FONT color="green">778</FONT>         * @exception MatrixIndexException if the index is<a name="line.778"></a>
+<FONT color="green">779</FONT>         * inconsistent with vector size<a name="line.779"></a>
+<FONT color="green">780</FONT>         * @see #getEntry(int)<a name="line.780"></a>
+<FONT color="green">781</FONT>         */<a name="line.781"></a>
+<FONT color="green">782</FONT>        void setEntry(int index, double value)<a name="line.782"></a>
+<FONT color="green">783</FONT>            throws MatrixIndexException;<a name="line.783"></a>
+<FONT color="green">784</FONT>    <a name="line.784"></a>
+<FONT color="green">785</FONT>        /**<a name="line.785"></a>
+<FONT color="green">786</FONT>         * Returns the size of the vector.<a name="line.786"></a>
+<FONT color="green">787</FONT>         * @return size<a name="line.787"></a>
+<FONT color="green">788</FONT>         */<a name="line.788"></a>
+<FONT color="green">789</FONT>        int getDimension();<a name="line.789"></a>
+<FONT color="green">790</FONT>    <a name="line.790"></a>
+<FONT color="green">791</FONT>        /**<a name="line.791"></a>
+<FONT color="green">792</FONT>         * Construct a vector by appending a vector to this vector.<a name="line.792"></a>
+<FONT color="green">793</FONT>         * @param v vector to append to this one.<a name="line.793"></a>
+<FONT color="green">794</FONT>         * @return a new vector<a name="line.794"></a>
+<FONT color="green">795</FONT>         */<a name="line.795"></a>
+<FONT color="green">796</FONT>        RealVector append(RealVector v);<a name="line.796"></a>
+<FONT color="green">797</FONT>    <a name="line.797"></a>
+<FONT color="green">798</FONT>        /**<a name="line.798"></a>
+<FONT color="green">799</FONT>         * Construct a vector by appending a double to this vector.<a name="line.799"></a>
+<FONT color="green">800</FONT>         * @param d double to append.<a name="line.800"></a>
+<FONT color="green">801</FONT>         * @return a new vector<a name="line.801"></a>
+<FONT color="green">802</FONT>         */<a name="line.802"></a>
+<FONT color="green">803</FONT>        RealVector append(double d);<a name="line.803"></a>
+<FONT color="green">804</FONT>    <a name="line.804"></a>
+<FONT color="green">805</FONT>        /**<a name="line.805"></a>
+<FONT color="green">806</FONT>         * Construct a vector by appending a double array to this vector.<a name="line.806"></a>
+<FONT color="green">807</FONT>         * @param a double array to append.<a name="line.807"></a>
+<FONT color="green">808</FONT>         * @return a new vector<a name="line.808"></a>
+<FONT color="green">809</FONT>         */<a name="line.809"></a>
+<FONT color="green">810</FONT>        RealVector append(double[] a);<a name="line.810"></a>
+<FONT color="green">811</FONT>    <a name="line.811"></a>
+<FONT color="green">812</FONT>        /**<a name="line.812"></a>
+<FONT color="green">813</FONT>         * Get a subvector from consecutive elements.<a name="line.813"></a>
+<FONT color="green">814</FONT>         * @param index index of first element.<a name="line.814"></a>
+<FONT color="green">815</FONT>         * @param n number of elements to be retrieved.<a name="line.815"></a>
+<FONT color="green">816</FONT>         * @return a vector containing n elements.<a name="line.816"></a>
+<FONT color="green">817</FONT>         * @exception MatrixIndexException if the index is<a name="line.817"></a>
+<FONT color="green">818</FONT>         * inconsistent with vector size<a name="line.818"></a>
+<FONT color="green">819</FONT>         */<a name="line.819"></a>
+<FONT color="green">820</FONT>        RealVector getSubVector(int index, int n)<a name="line.820"></a>
+<FONT color="green">821</FONT>            throws MatrixIndexException;<a name="line.821"></a>
+<FONT color="green">822</FONT>    <a name="line.822"></a>
+<FONT color="green">823</FONT>        /**<a name="line.823"></a>
+<FONT color="green">824</FONT>         * Set a set of consecutive elements.<a name="line.824"></a>
+<FONT color="green">825</FONT>         * @param index index of first element to be set.<a name="line.825"></a>
+<FONT color="green">826</FONT>         * @param v vector containing the values to set.<a name="line.826"></a>
+<FONT color="green">827</FONT>         * @exception MatrixIndexException if the index is<a name="line.827"></a>
+<FONT color="green">828</FONT>         * inconsistent with vector size<a name="line.828"></a>
+<FONT color="green">829</FONT>         * @see #setSubVector(int, double[])<a name="line.829"></a>
+<FONT color="green">830</FONT>         */<a name="line.830"></a>
+<FONT color="green">831</FONT>        void setSubVector(int index, RealVector v)<a name="line.831"></a>
+<FONT color="green">832</FONT>            throws MatrixIndexException;<a name="line.832"></a>
+<FONT color="green">833</FONT>    <a name="line.833"></a>
+<FONT color="green">834</FONT>        /**<a name="line.834"></a>
+<FONT color="green">835</FONT>         * Set a set of consecutive elements.<a name="line.835"></a>
+<FONT color="green">836</FONT>         * @param index index of first element to be set.<a name="line.836"></a>
+<FONT color="green">837</FONT>         * @param v vector containing the values to set.<a name="line.837"></a>
+<FONT color="green">838</FONT>         * @exception MatrixIndexException if the index is<a name="line.838"></a>
+<FONT color="green">839</FONT>         * inconsistent with vector size<a name="line.839"></a>
+<FONT color="green">840</FONT>         * @see #setSubVector(int, RealVector)<a name="line.840"></a>
+<FONT color="green">841</FONT>         */<a name="line.841"></a>
+<FONT color="green">842</FONT>        void setSubVector(int index, double[] v)<a name="line.842"></a>
+<FONT color="green">843</FONT>            throws MatrixIndexException;<a name="line.843"></a>
+<FONT color="green">844</FONT>    <a name="line.844"></a>
+<FONT color="green">845</FONT>        /**<a name="line.845"></a>
+<FONT color="green">846</FONT>         * Set all elements to a single value.<a name="line.846"></a>
+<FONT color="green">847</FONT>         * @param value single value to set for all elements<a name="line.847"></a>
+<FONT color="green">848</FONT>         */<a name="line.848"></a>
+<FONT color="green">849</FONT>        void set(double value);<a name="line.849"></a>
+<FONT color="green">850</FONT>    <a name="line.850"></a>
+<FONT color="green">851</FONT>        /**<a name="line.851"></a>
+<FONT color="green">852</FONT>         * Convert the vector to a double array.<a name="line.852"></a>
+<FONT color="green">853</FONT>         * &lt;p&gt;The array is independent from vector data, it's elements<a name="line.853"></a>
+<FONT color="green">854</FONT>         * are copied.&lt;/p&gt;<a name="line.854"></a>
+<FONT color="green">855</FONT>         * @return array containing a copy of vector elements<a name="line.855"></a>
+<FONT color="green">856</FONT>         */<a name="line.856"></a>
+<FONT color="green">857</FONT>        double[] toArray();<a name="line.857"></a>
+<FONT color="green">858</FONT>    <a name="line.858"></a>
+<FONT color="green">859</FONT>        /**<a name="line.859"></a>
+<FONT color="green">860</FONT>         * Returns true if any coordinate of this vector is NaN; false otherwise<a name="line.860"></a>
+<FONT color="green">861</FONT>         * @return  true if any coordinate of this vector is NaN; false otherwise<a name="line.861"></a>
+<FONT color="green">862</FONT>         */<a name="line.862"></a>
+<FONT color="green">863</FONT>        boolean isNaN();<a name="line.863"></a>
+<FONT color="green">864</FONT>    <a name="line.864"></a>
+<FONT color="green">865</FONT>        /**<a name="line.865"></a>
+<FONT color="green">866</FONT>         * Returns true if any coordinate of this vector is infinite and none are NaN;<a name="line.866"></a>
+<FONT color="green">867</FONT>         * false otherwise<a name="line.867"></a>
+<FONT color="green">868</FONT>         * @return  true if any coordinate of this vector is infinite and none are NaN;<a name="line.868"></a>
+<FONT color="green">869</FONT>         * false otherwise<a name="line.869"></a>
+<FONT color="green">870</FONT>         */<a name="line.870"></a>
+<FONT color="green">871</FONT>        boolean isInfinite();<a name="line.871"></a>
+<FONT color="green">872</FONT>    <a name="line.872"></a>
+<FONT color="green">873</FONT>    }<a name="line.873"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/RealVectorFormat.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,406 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.text.FieldPosition;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.text.NumberFormat;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.text.ParseException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.text.ParsePosition;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import java.util.ArrayList;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import java.util.List;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import java.util.Locale;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.28"></a>
+<FONT color="green">029</FONT>    import org.apache.commons.math.util.CompositeFormat;<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>    /**<a name="line.31"></a>
+<FONT color="green">032</FONT>     * Formats a vector in components list format "{v0; v1; ...; vk-1}".<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;p&gt;The prefix and suffix "{" and "}" and the separator "; " can be replaced by<a name="line.33"></a>
+<FONT color="green">034</FONT>     * any user-defined strings. The number format for components can be configured.&lt;/p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;p&gt;White space is ignored at parse time, even if it is in the prefix, suffix<a name="line.35"></a>
+<FONT color="green">036</FONT>     * or separator specifications. So even if the default separator does include a space<a name="line.36"></a>
+<FONT color="green">037</FONT>     * character that is used at format time, both input string "{1;1;1}" and<a name="line.37"></a>
+<FONT color="green">038</FONT>     * " { 1 ; 1 ; 1 } " will be parsed without error and the same vector will be<a name="line.38"></a>
+<FONT color="green">039</FONT>     * returned. In the second case, however, the parse position after parsing will be<a name="line.39"></a>
+<FONT color="green">040</FONT>     * just after the closing curly brace, i.e. just before the trailing space.&lt;/p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     *<a name="line.41"></a>
+<FONT color="green">042</FONT>     * @version $Revision: 783702 $ $Date: 2009-06-11 04:54:02 -0400 (Thu, 11 Jun 2009) $<a name="line.42"></a>
+<FONT color="green">043</FONT>     * @since 2.0<a name="line.43"></a>
+<FONT color="green">044</FONT>     */<a name="line.44"></a>
+<FONT color="green">045</FONT>    public class RealVectorFormat extends CompositeFormat {<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** Serializable version identifier */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private static final long serialVersionUID = -708767813036157690L;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** The default prefix: "{". */<a name="line.50"></a>
+<FONT color="green">051</FONT>        private static final String DEFAULT_PREFIX = "{";<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** The default suffix: "}". */<a name="line.53"></a>
+<FONT color="green">054</FONT>        private static final String DEFAULT_SUFFIX = "}";<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** The default separator: ", ". */<a name="line.56"></a>
+<FONT color="green">057</FONT>        private static final String DEFAULT_SEPARATOR = "; ";<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** Prefix. */<a name="line.59"></a>
+<FONT color="green">060</FONT>        private final String prefix;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** Suffix. */<a name="line.62"></a>
+<FONT color="green">063</FONT>        private final String suffix;<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Separator. */<a name="line.65"></a>
+<FONT color="green">066</FONT>        private final String separator;<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /** Trimmed prefix. */<a name="line.68"></a>
+<FONT color="green">069</FONT>        private final String trimmedPrefix;<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** Trimmed suffix. */<a name="line.71"></a>
+<FONT color="green">072</FONT>        private final String trimmedSuffix;<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /** Trimmed separator. */<a name="line.74"></a>
+<FONT color="green">075</FONT>        private final String trimmedSeparator;<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** The format used for components. */<a name="line.77"></a>
+<FONT color="green">078</FONT>        private NumberFormat format;<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /**<a name="line.80"></a>
+<FONT color="green">081</FONT>         * Create an instance with default settings.<a name="line.81"></a>
+<FONT color="green">082</FONT>         * &lt;p&gt;The instance uses the default prefix, suffix and separator:<a name="line.82"></a>
+<FONT color="green">083</FONT>         * "{", "}", and "; " and the default number format for components.&lt;/p&gt;<a name="line.83"></a>
+<FONT color="green">084</FONT>         */<a name="line.84"></a>
+<FONT color="green">085</FONT>        public RealVectorFormat() {<a name="line.85"></a>
+<FONT color="green">086</FONT>            this(DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_SEPARATOR, getDefaultNumberFormat());<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /**<a name="line.89"></a>
+<FONT color="green">090</FONT>         * Create an instance with a custom number format for components.<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @param format the custom format for components.<a name="line.91"></a>
+<FONT color="green">092</FONT>         */<a name="line.92"></a>
+<FONT color="green">093</FONT>        public RealVectorFormat(final NumberFormat format) {<a name="line.93"></a>
+<FONT color="green">094</FONT>            this(DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_SEPARATOR, format);<a name="line.94"></a>
+<FONT color="green">095</FONT>        }<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /**<a name="line.97"></a>
+<FONT color="green">098</FONT>         * Create an instance with custom prefix, suffix and separator.<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @param prefix prefix to use instead of the default "{"<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @param suffix suffix to use instead of the default "}"<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @param separator separator to use instead of the default "; "<a name="line.101"></a>
+<FONT color="green">102</FONT>         */<a name="line.102"></a>
+<FONT color="green">103</FONT>        public RealVectorFormat(final String prefix, final String suffix,<a name="line.103"></a>
+<FONT color="green">104</FONT>                                final String separator) {<a name="line.104"></a>
+<FONT color="green">105</FONT>            this(prefix, suffix, separator, getDefaultNumberFormat());<a name="line.105"></a>
+<FONT color="green">106</FONT>        }<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>        /**<a name="line.108"></a>
+<FONT color="green">109</FONT>         * Create an instance with custom prefix, suffix, separator and format<a name="line.109"></a>
+<FONT color="green">110</FONT>         * for components.<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @param prefix prefix to use instead of the default "{"<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @param suffix suffix to use instead of the default "}"<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param separator separator to use instead of the default "; "<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param format the custom format for components.<a name="line.114"></a>
+<FONT color="green">115</FONT>         */<a name="line.115"></a>
+<FONT color="green">116</FONT>        public RealVectorFormat(final String prefix, final String suffix,<a name="line.116"></a>
+<FONT color="green">117</FONT>                                final String separator, final NumberFormat format) {<a name="line.117"></a>
+<FONT color="green">118</FONT>            this.prefix      = prefix;<a name="line.118"></a>
+<FONT color="green">119</FONT>            this.suffix      = suffix;<a name="line.119"></a>
+<FONT color="green">120</FONT>            this.separator   = separator;<a name="line.120"></a>
+<FONT color="green">121</FONT>            trimmedPrefix    = prefix.trim();<a name="line.121"></a>
+<FONT color="green">122</FONT>            trimmedSuffix    = suffix.trim();<a name="line.122"></a>
+<FONT color="green">123</FONT>            trimmedSeparator = separator.trim();<a name="line.123"></a>
+<FONT color="green">124</FONT>            this.format      = format;<a name="line.124"></a>
+<FONT color="green">125</FONT>        }<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>        /**<a name="line.127"></a>
+<FONT color="green">128</FONT>         * Get the set of locales for which real vectors formats are available.<a name="line.128"></a>
+<FONT color="green">129</FONT>         * &lt;p&gt;This is the same set as the {@link NumberFormat} set.&lt;/p&gt;<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @return available real vector format locales.<a name="line.130"></a>
+<FONT color="green">131</FONT>         */<a name="line.131"></a>
+<FONT color="green">132</FONT>        public static Locale[] getAvailableLocales() {<a name="line.132"></a>
+<FONT color="green">133</FONT>            return NumberFormat.getAvailableLocales();<a name="line.133"></a>
+<FONT color="green">134</FONT>        }<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>        /**<a name="line.136"></a>
+<FONT color="green">137</FONT>         * Get the format prefix.<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @return format prefix.<a name="line.138"></a>
+<FONT color="green">139</FONT>         */<a name="line.139"></a>
+<FONT color="green">140</FONT>        public String getPrefix() {<a name="line.140"></a>
+<FONT color="green">141</FONT>            return prefix;<a name="line.141"></a>
+<FONT color="green">142</FONT>        }<a name="line.142"></a>
+<FONT color="green">143</FONT>    <a name="line.143"></a>
+<FONT color="green">144</FONT>        /**<a name="line.144"></a>
+<FONT color="green">145</FONT>         * Get the format suffix.<a name="line.145"></a>
+<FONT color="green">146</FONT>         * @return format suffix.<a name="line.146"></a>
+<FONT color="green">147</FONT>         */<a name="line.147"></a>
+<FONT color="green">148</FONT>        public String getSuffix() {<a name="line.148"></a>
+<FONT color="green">149</FONT>            return suffix;<a name="line.149"></a>
+<FONT color="green">150</FONT>        }<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>        /**<a name="line.152"></a>
+<FONT color="green">153</FONT>         * Get the format separator between components.<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @return format separator.<a name="line.154"></a>
+<FONT color="green">155</FONT>         */<a name="line.155"></a>
+<FONT color="green">156</FONT>        public String getSeparator() {<a name="line.156"></a>
+<FONT color="green">157</FONT>            return separator;<a name="line.157"></a>
+<FONT color="green">158</FONT>        }<a name="line.158"></a>
+<FONT color="green">159</FONT>    <a name="line.159"></a>
+<FONT color="green">160</FONT>        /**<a name="line.160"></a>
+<FONT color="green">161</FONT>         * Get the components format.<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @return components format.<a name="line.162"></a>
+<FONT color="green">163</FONT>         */<a name="line.163"></a>
+<FONT color="green">164</FONT>        public NumberFormat getFormat() {<a name="line.164"></a>
+<FONT color="green">165</FONT>            return format;<a name="line.165"></a>
+<FONT color="green">166</FONT>        }<a name="line.166"></a>
+<FONT color="green">167</FONT>    <a name="line.167"></a>
+<FONT color="green">168</FONT>        /**<a name="line.168"></a>
+<FONT color="green">169</FONT>         * Returns the default real vector format for the current locale.<a name="line.169"></a>
+<FONT color="green">170</FONT>         * @return the default real vector format.<a name="line.170"></a>
+<FONT color="green">171</FONT>         */<a name="line.171"></a>
+<FONT color="green">172</FONT>        public static RealVectorFormat getInstance() {<a name="line.172"></a>
+<FONT color="green">173</FONT>            return getInstance(Locale.getDefault());<a name="line.173"></a>
+<FONT color="green">174</FONT>        }<a name="line.174"></a>
+<FONT color="green">175</FONT>    <a name="line.175"></a>
+<FONT color="green">176</FONT>        /**<a name="line.176"></a>
+<FONT color="green">177</FONT>         * Returns the default real vector format for the given locale.<a name="line.177"></a>
+<FONT color="green">178</FONT>         * @param locale the specific locale used by the format.<a name="line.178"></a>
+<FONT color="green">179</FONT>         * @return the real vector format specific to the given locale.<a name="line.179"></a>
+<FONT color="green">180</FONT>         */<a name="line.180"></a>
+<FONT color="green">181</FONT>        public static RealVectorFormat getInstance(final Locale locale) {<a name="line.181"></a>
+<FONT color="green">182</FONT>            return new RealVectorFormat(getDefaultNumberFormat(locale));<a name="line.182"></a>
+<FONT color="green">183</FONT>        }<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>        /**<a name="line.185"></a>
+<FONT color="green">186</FONT>         * This static method calls {@link #format(Object)} on a default instance of<a name="line.186"></a>
+<FONT color="green">187</FONT>         * RealVectorFormat.<a name="line.187"></a>
+<FONT color="green">188</FONT>         *<a name="line.188"></a>
+<FONT color="green">189</FONT>         * @param v RealVector object to format<a name="line.189"></a>
+<FONT color="green">190</FONT>         * @return A formatted vector<a name="line.190"></a>
+<FONT color="green">191</FONT>         */<a name="line.191"></a>
+<FONT color="green">192</FONT>        public static String formatRealVector(RealVector v) {<a name="line.192"></a>
+<FONT color="green">193</FONT>            return getInstance().format(v);<a name="line.193"></a>
+<FONT color="green">194</FONT>        }<a name="line.194"></a>
+<FONT color="green">195</FONT>    <a name="line.195"></a>
+<FONT color="green">196</FONT>        /**<a name="line.196"></a>
+<FONT color="green">197</FONT>         * Formats a {@link RealVector} object to produce a string.<a name="line.197"></a>
+<FONT color="green">198</FONT>         * @param vector the object to format.<a name="line.198"></a>
+<FONT color="green">199</FONT>         * @param toAppendTo where the text is to be appended<a name="line.199"></a>
+<FONT color="green">200</FONT>         * @param pos On input: an alignment field, if desired. On output: the<a name="line.200"></a>
+<FONT color="green">201</FONT>         *            offsets of the alignment field<a name="line.201"></a>
+<FONT color="green">202</FONT>         * @return the value passed in as toAppendTo.<a name="line.202"></a>
+<FONT color="green">203</FONT>         */<a name="line.203"></a>
+<FONT color="green">204</FONT>        public StringBuffer format(RealVector vector, StringBuffer toAppendTo,<a name="line.204"></a>
+<FONT color="green">205</FONT>                                   FieldPosition pos) {<a name="line.205"></a>
+<FONT color="green">206</FONT>    <a name="line.206"></a>
+<FONT color="green">207</FONT>            pos.setBeginIndex(0);<a name="line.207"></a>
+<FONT color="green">208</FONT>            pos.setEndIndex(0);<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>            // format prefix<a name="line.210"></a>
+<FONT color="green">211</FONT>            toAppendTo.append(prefix);<a name="line.211"></a>
+<FONT color="green">212</FONT>    <a name="line.212"></a>
+<FONT color="green">213</FONT>            // format components<a name="line.213"></a>
+<FONT color="green">214</FONT>            for (int i = 0; i &lt; vector.getDimension(); ++i) {<a name="line.214"></a>
+<FONT color="green">215</FONT>                if (i &gt; 0) {<a name="line.215"></a>
+<FONT color="green">216</FONT>                    toAppendTo.append(separator);<a name="line.216"></a>
+<FONT color="green">217</FONT>                }<a name="line.217"></a>
+<FONT color="green">218</FONT>                formatDouble(vector.getEntry(i), format, toAppendTo, pos);<a name="line.218"></a>
+<FONT color="green">219</FONT>            }<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>            // format suffix<a name="line.221"></a>
+<FONT color="green">222</FONT>            toAppendTo.append(suffix);<a name="line.222"></a>
+<FONT color="green">223</FONT>    <a name="line.223"></a>
+<FONT color="green">224</FONT>            return toAppendTo;<a name="line.224"></a>
+<FONT color="green">225</FONT>    <a name="line.225"></a>
+<FONT color="green">226</FONT>        }<a name="line.226"></a>
+<FONT color="green">227</FONT>    <a name="line.227"></a>
+<FONT color="green">228</FONT>        /**<a name="line.228"></a>
+<FONT color="green">229</FONT>         * Formats a object to produce a string.<a name="line.229"></a>
+<FONT color="green">230</FONT>         * &lt;p&gt;&lt;code&gt;obj&lt;/code&gt; must be a  {@link RealVector} object. Any other type of<a name="line.230"></a>
+<FONT color="green">231</FONT>         * object will result in an {@link IllegalArgumentException} being thrown.&lt;/p&gt;<a name="line.231"></a>
+<FONT color="green">232</FONT>         * @param obj the object to format.<a name="line.232"></a>
+<FONT color="green">233</FONT>         * @param toAppendTo where the text is to be appended<a name="line.233"></a>
+<FONT color="green">234</FONT>         * @param pos On input: an alignment field, if desired. On output: the<a name="line.234"></a>
+<FONT color="green">235</FONT>         *            offsets of the alignment field<a name="line.235"></a>
+<FONT color="green">236</FONT>         * @return the value passed in as toAppendTo.<a name="line.236"></a>
+<FONT color="green">237</FONT>         * @see java.text.Format#format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)<a name="line.237"></a>
+<FONT color="green">238</FONT>         * @throws IllegalArgumentException is &lt;code&gt;obj&lt;/code&gt; is not a valid type.<a name="line.238"></a>
+<FONT color="green">239</FONT>         */<a name="line.239"></a>
+<FONT color="green">240</FONT>        @Override<a name="line.240"></a>
+<FONT color="green">241</FONT>        public StringBuffer format(Object obj, StringBuffer toAppendTo,<a name="line.241"></a>
+<FONT color="green">242</FONT>                                   FieldPosition pos) {<a name="line.242"></a>
+<FONT color="green">243</FONT>    <a name="line.243"></a>
+<FONT color="green">244</FONT>            if (obj instanceof RealVector) {<a name="line.244"></a>
+<FONT color="green">245</FONT>                return format( (RealVector)obj, toAppendTo, pos);<a name="line.245"></a>
+<FONT color="green">246</FONT>            }<a name="line.246"></a>
+<FONT color="green">247</FONT>    <a name="line.247"></a>
+<FONT color="green">248</FONT>            throw MathRuntimeException.createIllegalArgumentException(<a name="line.248"></a>
+<FONT color="green">249</FONT>                  "cannot format a {0} instance as a real vector",<a name="line.249"></a>
+<FONT color="green">250</FONT>                  obj.getClass().getName());<a name="line.250"></a>
+<FONT color="green">251</FONT>    <a name="line.251"></a>
+<FONT color="green">252</FONT>        }<a name="line.252"></a>
+<FONT color="green">253</FONT>    <a name="line.253"></a>
+<FONT color="green">254</FONT>        /**<a name="line.254"></a>
+<FONT color="green">255</FONT>         * Parses a string to produce a {@link RealVector} object.<a name="line.255"></a>
+<FONT color="green">256</FONT>         * @param source the string to parse<a name="line.256"></a>
+<FONT color="green">257</FONT>         * @return the parsed {@link RealVector} object.<a name="line.257"></a>
+<FONT color="green">258</FONT>         * @exception ParseException if the beginning of the specified string<a name="line.258"></a>
+<FONT color="green">259</FONT>         *            cannot be parsed.<a name="line.259"></a>
+<FONT color="green">260</FONT>         */<a name="line.260"></a>
+<FONT color="green">261</FONT>        public ArrayRealVector parse(String source) throws ParseException {<a name="line.261"></a>
+<FONT color="green">262</FONT>            ParsePosition parsePosition = new ParsePosition(0);<a name="line.262"></a>
+<FONT color="green">263</FONT>            ArrayRealVector result = parse(source, parsePosition);<a name="line.263"></a>
+<FONT color="green">264</FONT>            if (parsePosition.getIndex() == 0) {<a name="line.264"></a>
+<FONT color="green">265</FONT>                throw MathRuntimeException.createParseException(<a name="line.265"></a>
+<FONT color="green">266</FONT>                        parsePosition.getErrorIndex(),<a name="line.266"></a>
+<FONT color="green">267</FONT>                        "unparseable real vector: \"{0}\"", source);<a name="line.267"></a>
+<FONT color="green">268</FONT>            }<a name="line.268"></a>
+<FONT color="green">269</FONT>            return result;<a name="line.269"></a>
+<FONT color="green">270</FONT>        }<a name="line.270"></a>
+<FONT color="green">271</FONT>    <a name="line.271"></a>
+<FONT color="green">272</FONT>        /**<a name="line.272"></a>
+<FONT color="green">273</FONT>         * Parses a string to produce a {@link RealVector} object.<a name="line.273"></a>
+<FONT color="green">274</FONT>         * @param source the string to parse<a name="line.274"></a>
+<FONT color="green">275</FONT>         * @param pos input/ouput parsing parameter.<a name="line.275"></a>
+<FONT color="green">276</FONT>         * @return the parsed {@link RealVector} object.<a name="line.276"></a>
+<FONT color="green">277</FONT>         */<a name="line.277"></a>
+<FONT color="green">278</FONT>        public ArrayRealVector parse(String source, ParsePosition pos) {<a name="line.278"></a>
+<FONT color="green">279</FONT>            int initialIndex = pos.getIndex();<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>            // parse prefix<a name="line.281"></a>
+<FONT color="green">282</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.282"></a>
+<FONT color="green">283</FONT>            if (!parseFixedstring(source, trimmedPrefix, pos)) {<a name="line.283"></a>
+<FONT color="green">284</FONT>                return null;<a name="line.284"></a>
+<FONT color="green">285</FONT>            }<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>            // parse components<a name="line.287"></a>
+<FONT color="green">288</FONT>            List&lt;Number&gt; components = new ArrayList&lt;Number&gt;();<a name="line.288"></a>
+<FONT color="green">289</FONT>            for (boolean loop = true; loop;){<a name="line.289"></a>
+<FONT color="green">290</FONT>    <a name="line.290"></a>
+<FONT color="green">291</FONT>                if (!components.isEmpty()) {<a name="line.291"></a>
+<FONT color="green">292</FONT>                    parseAndIgnoreWhitespace(source, pos);<a name="line.292"></a>
+<FONT color="green">293</FONT>                    if (!parseFixedstring(source, trimmedSeparator, pos)) {<a name="line.293"></a>
+<FONT color="green">294</FONT>                        loop = false;<a name="line.294"></a>
+<FONT color="green">295</FONT>                    }<a name="line.295"></a>
+<FONT color="green">296</FONT>                }<a name="line.296"></a>
+<FONT color="green">297</FONT>    <a name="line.297"></a>
+<FONT color="green">298</FONT>                if (loop) {<a name="line.298"></a>
+<FONT color="green">299</FONT>                    parseAndIgnoreWhitespace(source, pos);<a name="line.299"></a>
+<FONT color="green">300</FONT>                    Number component = parseNumber(source, format, pos);<a name="line.300"></a>
+<FONT color="green">301</FONT>                    if (component != null) {<a name="line.301"></a>
+<FONT color="green">302</FONT>                        components.add(component);<a name="line.302"></a>
+<FONT color="green">303</FONT>                    } else {<a name="line.303"></a>
+<FONT color="green">304</FONT>                        // invalid component<a name="line.304"></a>
+<FONT color="green">305</FONT>                        // set index back to initial, error index should already be set<a name="line.305"></a>
+<FONT color="green">306</FONT>                        pos.setIndex(initialIndex);<a name="line.306"></a>
+<FONT color="green">307</FONT>                        return null;<a name="line.307"></a>
+<FONT color="green">308</FONT>                    }<a name="line.308"></a>
+<FONT color="green">309</FONT>                }<a name="line.309"></a>
+<FONT color="green">310</FONT>    <a name="line.310"></a>
+<FONT color="green">311</FONT>            }<a name="line.311"></a>
+<FONT color="green">312</FONT>    <a name="line.312"></a>
+<FONT color="green">313</FONT>            // parse suffix<a name="line.313"></a>
+<FONT color="green">314</FONT>            parseAndIgnoreWhitespace(source, pos);<a name="line.314"></a>
+<FONT color="green">315</FONT>            if (!parseFixedstring(source, trimmedSuffix, pos)) {<a name="line.315"></a>
+<FONT color="green">316</FONT>                return null;<a name="line.316"></a>
+<FONT color="green">317</FONT>            }<a name="line.317"></a>
+<FONT color="green">318</FONT>    <a name="line.318"></a>
+<FONT color="green">319</FONT>            // build vector<a name="line.319"></a>
+<FONT color="green">320</FONT>            double[] data = new double[components.size()];<a name="line.320"></a>
+<FONT color="green">321</FONT>            for (int i = 0; i &lt; data.length; ++i) {<a name="line.321"></a>
+<FONT color="green">322</FONT>                data[i] = components.get(i).doubleValue();<a name="line.322"></a>
+<FONT color="green">323</FONT>            }<a name="line.323"></a>
+<FONT color="green">324</FONT>            return new ArrayRealVector(data, false);<a name="line.324"></a>
+<FONT color="green">325</FONT>    <a name="line.325"></a>
+<FONT color="green">326</FONT>        }<a name="line.326"></a>
+<FONT color="green">327</FONT>    <a name="line.327"></a>
+<FONT color="green">328</FONT>        /**<a name="line.328"></a>
+<FONT color="green">329</FONT>         * Parses a string to produce a object.<a name="line.329"></a>
+<FONT color="green">330</FONT>         * @param source the string to parse<a name="line.330"></a>
+<FONT color="green">331</FONT>         * @param pos input/ouput parsing parameter.<a name="line.331"></a>
+<FONT color="green">332</FONT>         * @return the parsed object.<a name="line.332"></a>
+<FONT color="green">333</FONT>         * @see java.text.Format#parseObject(java.lang.String, java.text.ParsePosition)<a name="line.333"></a>
+<FONT color="green">334</FONT>         */<a name="line.334"></a>
+<FONT color="green">335</FONT>        @Override<a name="line.335"></a>
+<FONT color="green">336</FONT>        public Object parseObject(String source, ParsePosition pos) {<a name="line.336"></a>
+<FONT color="green">337</FONT>            return parse(source, pos);<a name="line.337"></a>
+<FONT color="green">338</FONT>        }<a name="line.338"></a>
+<FONT color="green">339</FONT>    <a name="line.339"></a>
+<FONT color="green">340</FONT>    }<a name="line.340"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/SingularMatrixException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,104 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Thrown when a matrix is singular.<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 799857 $ $Date: 2009-08-01 09:07:12 -0400 (Sat, 01 Aug 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @since 2.0<a name="line.24"></a>
+<FONT color="green">025</FONT>     */<a name="line.25"></a>
+<FONT color="green">026</FONT>    public class SingularMatrixException extends InvalidMatrixException {<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>        /** Serializable version identifier. */<a name="line.28"></a>
+<FONT color="green">029</FONT>        private static final long serialVersionUID = -7379143356784298432L;<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /**<a name="line.31"></a>
+<FONT color="green">032</FONT>         * Construct an exception with a default message.<a name="line.32"></a>
+<FONT color="green">033</FONT>         */<a name="line.33"></a>
+<FONT color="green">034</FONT>        public SingularMatrixException() {<a name="line.34"></a>
+<FONT color="green">035</FONT>            super("matrix is singular");<a name="line.35"></a>
+<FONT color="green">036</FONT>        }<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>    }<a name="line.38"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/SingularValueDecomposition.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,213 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * An interface to classes that implement an algorithm to calculate the<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Singular Value Decomposition of a real matrix.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * The Singular Value Decomposition of matrix A is a set of three matrices: U,<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &amp;Sigma; and V such that A = U &amp;times; &amp;Sigma; &amp;times; V&lt;sup&gt;T&lt;/sup&gt;. Let A be<a name="line.27"></a>
+<FONT color="green">028</FONT>     * a m &amp;times; n matrix, then U is a m &amp;times; p orthogonal matrix, &amp;Sigma; is a<a name="line.28"></a>
+<FONT color="green">029</FONT>     * p &amp;times; p diagonal matrix with positive or null elements, V is a p &amp;times;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * n orthogonal matrix (hence V&lt;sup&gt;T&lt;/sup&gt; is also orthogonal) where<a name="line.30"></a>
+<FONT color="green">031</FONT>     * p=min(m,n).<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;p&gt;This interface is similar to the class with similar name from the<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;a href="http://math.nist.gov/javanumerics/jama/"&gt;JAMA&lt;/a&gt; library, with the<a name="line.34"></a>
+<FONT color="green">035</FONT>     * following changes:&lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;ul&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *   &lt;li&gt;the &lt;code&gt;norm2&lt;/code&gt; method which has been renamed as {@link #getNorm()<a name="line.37"></a>
+<FONT color="green">038</FONT>     *   getNorm},&lt;/li&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     *   &lt;li&gt;the &lt;code&gt;cond&lt;/code&gt; method which has been renamed as {@link<a name="line.39"></a>
+<FONT color="green">040</FONT>     *   #getConditionNumber() getConditionNumber},&lt;/li&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     *   &lt;li&gt;the &lt;code&gt;rank&lt;/code&gt; method which has been renamed as {@link #getRank()<a name="line.41"></a>
+<FONT color="green">042</FONT>     *   getRank},&lt;/li&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     *   &lt;li&gt;a {@link #getUT() getUT} method has been added,&lt;/li&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     *   &lt;li&gt;a {@link #getVT() getVT} method has been added,&lt;/li&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     *   &lt;li&gt;a {@link #getSolver() getSolver} method has been added,&lt;/li&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     *   &lt;li&gt;a {@link #getCovariance(double) getCovariance} method has been added.&lt;/li&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     * &lt;/ul&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     * @see &lt;a href="http://mathworld.wolfram.com/SingularValueDecomposition.html"&gt;MathWorld&lt;/a&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>     * @see &lt;a href="http://en.wikipedia.org/wiki/Singular_value_decomposition"&gt;Wikipedia&lt;/a&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     * @version $Revision: 928081 $ $Date: 2010-03-26 18:36:38 -0400 (Fri, 26 Mar 2010) $<a name="line.50"></a>
+<FONT color="green">051</FONT>     * @since 2.0<a name="line.51"></a>
+<FONT color="green">052</FONT>     */<a name="line.52"></a>
+<FONT color="green">053</FONT>    public interface SingularValueDecomposition {<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * Returns the matrix U of the decomposition.<a name="line.56"></a>
+<FONT color="green">057</FONT>         * &lt;p&gt;U is an orthogonal matrix, i.e. its transpose is also its inverse.&lt;/p&gt;<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @return the U matrix<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @see #getUT()<a name="line.59"></a>
+<FONT color="green">060</FONT>         */<a name="line.60"></a>
+<FONT color="green">061</FONT>        RealMatrix getU();<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /**<a name="line.63"></a>
+<FONT color="green">064</FONT>         * Returns the transpose of the matrix U of the decomposition.<a name="line.64"></a>
+<FONT color="green">065</FONT>         * &lt;p&gt;U is an orthogonal matrix, i.e. its transpose is also its inverse.&lt;/p&gt;<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @return the U matrix (or null if decomposed matrix is singular)<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @see #getU()<a name="line.67"></a>
+<FONT color="green">068</FONT>         */<a name="line.68"></a>
+<FONT color="green">069</FONT>        RealMatrix getUT();<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /**<a name="line.71"></a>
+<FONT color="green">072</FONT>         * Returns the diagonal matrix &amp;Sigma; of the decomposition.<a name="line.72"></a>
+<FONT color="green">073</FONT>         * &lt;p&gt;&amp;Sigma; is a diagonal matrix. The singular values are provided in<a name="line.73"></a>
+<FONT color="green">074</FONT>         * non-increasing order, for compatibility with Jama.&lt;/p&gt;<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @return the &amp;Sigma; matrix<a name="line.75"></a>
+<FONT color="green">076</FONT>         */<a name="line.76"></a>
+<FONT color="green">077</FONT>        RealMatrix getS();<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        /**<a name="line.79"></a>
+<FONT color="green">080</FONT>         * Returns the diagonal elements of the matrix &amp;Sigma; of the decomposition.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * &lt;p&gt;The singular values are provided in non-increasing order, for<a name="line.81"></a>
+<FONT color="green">082</FONT>         * compatibility with Jama.&lt;/p&gt;<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @return the diagonal elements of the &amp;Sigma; matrix<a name="line.83"></a>
+<FONT color="green">084</FONT>         */<a name="line.84"></a>
+<FONT color="green">085</FONT>        double[] getSingularValues();<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>        /**<a name="line.87"></a>
+<FONT color="green">088</FONT>         * Returns the matrix V of the decomposition.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * &lt;p&gt;V is an orthogonal matrix, i.e. its transpose is also its inverse.&lt;/p&gt;<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @return the V matrix (or null if decomposed matrix is singular)<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @see #getVT()<a name="line.91"></a>
+<FONT color="green">092</FONT>         */<a name="line.92"></a>
+<FONT color="green">093</FONT>        RealMatrix getV();<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /**<a name="line.95"></a>
+<FONT color="green">096</FONT>         * Returns the transpose of the matrix V of the decomposition.<a name="line.96"></a>
+<FONT color="green">097</FONT>         * &lt;p&gt;V is an orthogonal matrix, i.e. its transpose is also its inverse.&lt;/p&gt;<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @return the V matrix (or null if decomposed matrix is singular)<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @see #getV()<a name="line.99"></a>
+<FONT color="green">100</FONT>         */<a name="line.100"></a>
+<FONT color="green">101</FONT>        RealMatrix getVT();<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        /**<a name="line.103"></a>
+<FONT color="green">104</FONT>         * Returns the n &amp;times; n covariance matrix.<a name="line.104"></a>
+<FONT color="green">105</FONT>         * &lt;p&gt;The covariance matrix is V &amp;times; J &amp;times; V&lt;sup&gt;T&lt;/sup&gt;<a name="line.105"></a>
+<FONT color="green">106</FONT>         * where J is the diagonal matrix of the inverse of the squares of<a name="line.106"></a>
+<FONT color="green">107</FONT>         * the singular values.&lt;/p&gt;<a name="line.107"></a>
+<FONT color="green">108</FONT>         * @param minSingularValue value below which singular values are ignored<a name="line.108"></a>
+<FONT color="green">109</FONT>         * (a 0 or negative value implies all singular value will be used)<a name="line.109"></a>
+<FONT color="green">110</FONT>         * @return covariance matrix<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @exception IllegalArgumentException if minSingularValue is larger than<a name="line.111"></a>
+<FONT color="green">112</FONT>         * the largest singular value, meaning all singular values are ignored<a name="line.112"></a>
+<FONT color="green">113</FONT>         */<a name="line.113"></a>
+<FONT color="green">114</FONT>        RealMatrix getCovariance(double minSingularValue) throws IllegalArgumentException;<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>        /**<a name="line.116"></a>
+<FONT color="green">117</FONT>         * Returns the L&lt;sub&gt;2&lt;/sub&gt; norm of the matrix.<a name="line.117"></a>
+<FONT color="green">118</FONT>         * &lt;p&gt;The L&lt;sub&gt;2&lt;/sub&gt; norm is max(|A &amp;times; u|&lt;sub&gt;2&lt;/sub&gt; /<a name="line.118"></a>
+<FONT color="green">119</FONT>         * |u|&lt;sub&gt;2&lt;/sub&gt;), where |.|&lt;sub&gt;2&lt;/sub&gt; denotes the vectorial 2-norm<a name="line.119"></a>
+<FONT color="green">120</FONT>         * (i.e. the traditional euclidian norm).&lt;/p&gt;<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @return norm<a name="line.121"></a>
+<FONT color="green">122</FONT>         */<a name="line.122"></a>
+<FONT color="green">123</FONT>        double getNorm();<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>        /**<a name="line.125"></a>
+<FONT color="green">126</FONT>         * Return the condition number of the matrix.<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @return condition number of the matrix<a name="line.127"></a>
+<FONT color="green">128</FONT>         */<a name="line.128"></a>
+<FONT color="green">129</FONT>        double getConditionNumber();<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>        /**<a name="line.131"></a>
+<FONT color="green">132</FONT>         * Return the effective numerical matrix rank.<a name="line.132"></a>
+<FONT color="green">133</FONT>         * &lt;p&gt;The effective numerical rank is the number of non-negligible<a name="line.133"></a>
+<FONT color="green">134</FONT>         * singular values. The threshold used to identify non-negligible<a name="line.134"></a>
+<FONT color="green">135</FONT>         * terms is max(m,n) &amp;times; ulp(s&lt;sub&gt;1&lt;/sub&gt;) where ulp(s&lt;sub&gt;1&lt;/sub&gt;)<a name="line.135"></a>
+<FONT color="green">136</FONT>         * is the least significant bit of the largest singular value.&lt;/p&gt;<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @return effective numerical matrix rank<a name="line.137"></a>
+<FONT color="green">138</FONT>         */<a name="line.138"></a>
+<FONT color="green">139</FONT>        int getRank();<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>        /**<a name="line.141"></a>
+<FONT color="green">142</FONT>         * Get a solver for finding the A &amp;times; X = B solution in least square sense.<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @return a solver<a name="line.143"></a>
+<FONT color="green">144</FONT>         */<a name="line.144"></a>
+<FONT color="green">145</FONT>        DecompositionSolver getSolver();<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>    }<a name="line.147"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/SingularValueDecompositionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,444 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Calculates the compact Singular Value Decomposition of a matrix.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * The Singular Value Decomposition of matrix A is a set of three matrices: U,<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &amp;Sigma; and V such that A = U &amp;times; &amp;Sigma; &amp;times; V&lt;sup&gt;T&lt;/sup&gt;. Let A be<a name="line.26"></a>
+<FONT color="green">027</FONT>     * a m &amp;times; n matrix, then U is a m &amp;times; p orthogonal matrix, &amp;Sigma; is a<a name="line.27"></a>
+<FONT color="green">028</FONT>     * p &amp;times; p diagonal matrix with positive or null elements, V is a p &amp;times;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * n orthogonal matrix (hence V&lt;sup&gt;T&lt;/sup&gt; is also orthogonal) where<a name="line.29"></a>
+<FONT color="green">030</FONT>     * p=min(m,n).<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @version $Revision: 912413 $ $Date: 2010-02-21 16:46:12 -0500 (Sun, 21 Feb 2010) $<a name="line.32"></a>
+<FONT color="green">033</FONT>     * @since 2.0<a name="line.33"></a>
+<FONT color="green">034</FONT>     */<a name="line.34"></a>
+<FONT color="green">035</FONT>    public class SingularValueDecompositionImpl implements<a name="line.35"></a>
+<FONT color="green">036</FONT>            SingularValueDecomposition {<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Number of rows of the initial matrix. */<a name="line.38"></a>
+<FONT color="green">039</FONT>        private int m;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Number of columns of the initial matrix. */<a name="line.41"></a>
+<FONT color="green">042</FONT>        private int n;<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Eigen decomposition of the tridiagonal matrix. */<a name="line.44"></a>
+<FONT color="green">045</FONT>        private EigenDecomposition eigenDecomposition;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** Singular values. */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private double[] singularValues;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Cached value of U. */<a name="line.50"></a>
+<FONT color="green">051</FONT>        private RealMatrix cachedU;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** Cached value of U&lt;sup&gt;T&lt;/sup&gt;. */<a name="line.53"></a>
+<FONT color="green">054</FONT>        private RealMatrix cachedUt;<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** Cached value of S. */<a name="line.56"></a>
+<FONT color="green">057</FONT>        private RealMatrix cachedS;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** Cached value of V. */<a name="line.59"></a>
+<FONT color="green">060</FONT>        private RealMatrix cachedV;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** Cached value of V&lt;sup&gt;T&lt;/sup&gt;. */<a name="line.62"></a>
+<FONT color="green">063</FONT>        private RealMatrix cachedVt;<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /**<a name="line.65"></a>
+<FONT color="green">066</FONT>         * Calculates the compact Singular Value Decomposition of the given matrix.<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @param matrix<a name="line.67"></a>
+<FONT color="green">068</FONT>         *            The matrix to decompose.<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @exception InvalidMatrixException<a name="line.69"></a>
+<FONT color="green">070</FONT>         *                (wrapping a<a name="line.70"></a>
+<FONT color="green">071</FONT>         *                {@link org.apache.commons.math.ConvergenceException} if<a name="line.71"></a>
+<FONT color="green">072</FONT>         *                algorithm fails to converge<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        public SingularValueDecompositionImpl(final RealMatrix matrix)<a name="line.74"></a>
+<FONT color="green">075</FONT>                throws InvalidMatrixException {<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>            m = matrix.getRowDimension();<a name="line.77"></a>
+<FONT color="green">078</FONT>            n = matrix.getColumnDimension();<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>            cachedU = null;<a name="line.80"></a>
+<FONT color="green">081</FONT>            cachedS = null;<a name="line.81"></a>
+<FONT color="green">082</FONT>            cachedV = null;<a name="line.82"></a>
+<FONT color="green">083</FONT>            cachedVt = null;<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>            double[][] localcopy = matrix.getData();<a name="line.85"></a>
+<FONT color="green">086</FONT>            double[][] matATA = new double[n][n];<a name="line.86"></a>
+<FONT color="green">087</FONT>            //<a name="line.87"></a>
+<FONT color="green">088</FONT>            // create A^T*A<a name="line.88"></a>
+<FONT color="green">089</FONT>            //<a name="line.89"></a>
+<FONT color="green">090</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.90"></a>
+<FONT color="green">091</FONT>                for (int j = i; j &lt; n; j++) {<a name="line.91"></a>
+<FONT color="green">092</FONT>                    matATA[i][j] = 0.0;<a name="line.92"></a>
+<FONT color="green">093</FONT>                    for (int k = 0; k &lt; m; k++) {<a name="line.93"></a>
+<FONT color="green">094</FONT>                        matATA[i][j] += localcopy[k][i] * localcopy[k][j];<a name="line.94"></a>
+<FONT color="green">095</FONT>                    }<a name="line.95"></a>
+<FONT color="green">096</FONT>                    matATA[j][i]=matATA[i][j];<a name="line.96"></a>
+<FONT color="green">097</FONT>                }<a name="line.97"></a>
+<FONT color="green">098</FONT>            }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>            double[][] matAAT = new double[m][m];<a name="line.100"></a>
+<FONT color="green">101</FONT>            //<a name="line.101"></a>
+<FONT color="green">102</FONT>            // create A*A^T<a name="line.102"></a>
+<FONT color="green">103</FONT>            //<a name="line.103"></a>
+<FONT color="green">104</FONT>            for (int i = 0; i &lt; m; i++) {<a name="line.104"></a>
+<FONT color="green">105</FONT>                for (int j = i; j &lt; m; j++) {<a name="line.105"></a>
+<FONT color="green">106</FONT>                    matAAT[i][j] = 0.0;<a name="line.106"></a>
+<FONT color="green">107</FONT>                    for (int k = 0; k &lt; n; k++) {<a name="line.107"></a>
+<FONT color="green">108</FONT>                        matAAT[i][j] += localcopy[i][k] * localcopy[j][k];<a name="line.108"></a>
+<FONT color="green">109</FONT>                    }<a name="line.109"></a>
+<FONT color="green">110</FONT>                    matAAT[j][i]=matAAT[i][j];<a name="line.110"></a>
+<FONT color="green">111</FONT>                }<a name="line.111"></a>
+<FONT color="green">112</FONT>            }<a name="line.112"></a>
+<FONT color="green">113</FONT>            int p;<a name="line.113"></a>
+<FONT color="green">114</FONT>            if (m&gt;=n) {<a name="line.114"></a>
+<FONT color="green">115</FONT>                p=n;<a name="line.115"></a>
+<FONT color="green">116</FONT>                // compute eigen decomposition of A^T*A<a name="line.116"></a>
+<FONT color="green">117</FONT>                eigenDecomposition = new EigenDecompositionImpl(<a name="line.117"></a>
+<FONT color="green">118</FONT>                        new Array2DRowRealMatrix(matATA),1.0);<a name="line.118"></a>
+<FONT color="green">119</FONT>                singularValues = eigenDecomposition.getRealEigenvalues();<a name="line.119"></a>
+<FONT color="green">120</FONT>                cachedV = eigenDecomposition.getV();<a name="line.120"></a>
+<FONT color="green">121</FONT>    <a name="line.121"></a>
+<FONT color="green">122</FONT>                // compute eigen decomposition of A*A^T<a name="line.122"></a>
+<FONT color="green">123</FONT>                eigenDecomposition = new EigenDecompositionImpl(<a name="line.123"></a>
+<FONT color="green">124</FONT>                        new Array2DRowRealMatrix(matAAT),1.0);<a name="line.124"></a>
+<FONT color="green">125</FONT>                cachedU = eigenDecomposition.getV().getSubMatrix(0, m - 1, 0, p - 1);<a name="line.125"></a>
+<FONT color="green">126</FONT>            } else {<a name="line.126"></a>
+<FONT color="green">127</FONT>                p=m;<a name="line.127"></a>
+<FONT color="green">128</FONT>                // compute eigen decomposition of A*A^T<a name="line.128"></a>
+<FONT color="green">129</FONT>                eigenDecomposition = new EigenDecompositionImpl(<a name="line.129"></a>
+<FONT color="green">130</FONT>                        new Array2DRowRealMatrix(matAAT),1.0);<a name="line.130"></a>
+<FONT color="green">131</FONT>                singularValues = eigenDecomposition.getRealEigenvalues();<a name="line.131"></a>
+<FONT color="green">132</FONT>                cachedU = eigenDecomposition.getV();<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>                // compute eigen decomposition of A^T*A<a name="line.134"></a>
+<FONT color="green">135</FONT>                eigenDecomposition = new EigenDecompositionImpl(<a name="line.135"></a>
+<FONT color="green">136</FONT>                        new Array2DRowRealMatrix(matATA),1.0);<a name="line.136"></a>
+<FONT color="green">137</FONT>                cachedV = eigenDecomposition.getV().getSubMatrix(0,n-1,0,p-1);<a name="line.137"></a>
+<FONT color="green">138</FONT>            }<a name="line.138"></a>
+<FONT color="green">139</FONT>            for (int i = 0; i &lt; p; i++) {<a name="line.139"></a>
+<FONT color="green">140</FONT>                singularValues[i] = Math.sqrt(Math.abs(singularValues[i]));<a name="line.140"></a>
+<FONT color="green">141</FONT>            }<a name="line.141"></a>
+<FONT color="green">142</FONT>            // Up to this point, U and V are computed independently of each other.<a name="line.142"></a>
+<FONT color="green">143</FONT>            // There still an sign indetermination of each column of, say, U.<a name="line.143"></a>
+<FONT color="green">144</FONT>            // The sign is set such that A.V_i=sigma_i.U_i (i&lt;=p)<a name="line.144"></a>
+<FONT color="green">145</FONT>            // The right sign corresponds to a positive dot product of A.V_i and U_i<a name="line.145"></a>
+<FONT color="green">146</FONT>            for (int i = 0; i &lt; p; i++) {<a name="line.146"></a>
+<FONT color="green">147</FONT>              RealVector tmp = cachedU.getColumnVector(i);<a name="line.147"></a>
+<FONT color="green">148</FONT>              double product=matrix.operate(cachedV.getColumnVector(i)).dotProduct(tmp);<a name="line.148"></a>
+<FONT color="green">149</FONT>              if (product&lt;0) {<a name="line.149"></a>
+<FONT color="green">150</FONT>                cachedU.setColumnVector(i, tmp.mapMultiply(-1.0));<a name="line.150"></a>
+<FONT color="green">151</FONT>              }<a name="line.151"></a>
+<FONT color="green">152</FONT>            }<a name="line.152"></a>
+<FONT color="green">153</FONT>        }<a name="line.153"></a>
+<FONT color="green">154</FONT>    <a name="line.154"></a>
+<FONT color="green">155</FONT>        /** {@inheritDoc} */<a name="line.155"></a>
+<FONT color="green">156</FONT>        public RealMatrix getU() throws InvalidMatrixException {<a name="line.156"></a>
+<FONT color="green">157</FONT>            // return the cached matrix<a name="line.157"></a>
+<FONT color="green">158</FONT>            return cachedU;<a name="line.158"></a>
+<FONT color="green">159</FONT>    <a name="line.159"></a>
+<FONT color="green">160</FONT>        }<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>        /** {@inheritDoc} */<a name="line.162"></a>
+<FONT color="green">163</FONT>        public RealMatrix getUT() throws InvalidMatrixException {<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>            if (cachedUt == null) {<a name="line.165"></a>
+<FONT color="green">166</FONT>                cachedUt = getU().transpose();<a name="line.166"></a>
+<FONT color="green">167</FONT>            }<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>            // return the cached matrix<a name="line.169"></a>
+<FONT color="green">170</FONT>            return cachedUt;<a name="line.170"></a>
+<FONT color="green">171</FONT>    <a name="line.171"></a>
+<FONT color="green">172</FONT>        }<a name="line.172"></a>
+<FONT color="green">173</FONT>    <a name="line.173"></a>
+<FONT color="green">174</FONT>        /** {@inheritDoc} */<a name="line.174"></a>
+<FONT color="green">175</FONT>        public RealMatrix getS() throws InvalidMatrixException {<a name="line.175"></a>
+<FONT color="green">176</FONT>    <a name="line.176"></a>
+<FONT color="green">177</FONT>            if (cachedS == null) {<a name="line.177"></a>
+<FONT color="green">178</FONT>    <a name="line.178"></a>
+<FONT color="green">179</FONT>                // cache the matrix for subsequent calls<a name="line.179"></a>
+<FONT color="green">180</FONT>                cachedS = MatrixUtils.createRealDiagonalMatrix(singularValues);<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>            }<a name="line.182"></a>
+<FONT color="green">183</FONT>            return cachedS;<a name="line.183"></a>
+<FONT color="green">184</FONT>        }<a name="line.184"></a>
+<FONT color="green">185</FONT>    <a name="line.185"></a>
+<FONT color="green">186</FONT>        /** {@inheritDoc} */<a name="line.186"></a>
+<FONT color="green">187</FONT>        public double[] getSingularValues() throws InvalidMatrixException {<a name="line.187"></a>
+<FONT color="green">188</FONT>            return singularValues.clone();<a name="line.188"></a>
+<FONT color="green">189</FONT>        }<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>        /** {@inheritDoc} */<a name="line.191"></a>
+<FONT color="green">192</FONT>        public RealMatrix getV() throws InvalidMatrixException {<a name="line.192"></a>
+<FONT color="green">193</FONT>            // return the cached matrix<a name="line.193"></a>
+<FONT color="green">194</FONT>            return cachedV;<a name="line.194"></a>
+<FONT color="green">195</FONT>    <a name="line.195"></a>
+<FONT color="green">196</FONT>        }<a name="line.196"></a>
+<FONT color="green">197</FONT>    <a name="line.197"></a>
+<FONT color="green">198</FONT>        /** {@inheritDoc} */<a name="line.198"></a>
+<FONT color="green">199</FONT>        public RealMatrix getVT() throws InvalidMatrixException {<a name="line.199"></a>
+<FONT color="green">200</FONT>    <a name="line.200"></a>
+<FONT color="green">201</FONT>            if (cachedVt == null) {<a name="line.201"></a>
+<FONT color="green">202</FONT>                cachedVt = getV().transpose();<a name="line.202"></a>
+<FONT color="green">203</FONT>            }<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>            // return the cached matrix<a name="line.205"></a>
+<FONT color="green">206</FONT>            return cachedVt;<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>        }<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>        /** {@inheritDoc} */<a name="line.210"></a>
+<FONT color="green">211</FONT>        public RealMatrix getCovariance(final double minSingularValue) {<a name="line.211"></a>
+<FONT color="green">212</FONT>    <a name="line.212"></a>
+<FONT color="green">213</FONT>            // get the number of singular values to consider<a name="line.213"></a>
+<FONT color="green">214</FONT>            final int p = singularValues.length;<a name="line.214"></a>
+<FONT color="green">215</FONT>            int dimension = 0;<a name="line.215"></a>
+<FONT color="green">216</FONT>            while ((dimension &lt; p) &amp;&amp; (singularValues[dimension] &gt;= minSingularValue)) {<a name="line.216"></a>
+<FONT color="green">217</FONT>                ++dimension;<a name="line.217"></a>
+<FONT color="green">218</FONT>            }<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>            if (dimension == 0) {<a name="line.220"></a>
+<FONT color="green">221</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.221"></a>
+<FONT color="green">222</FONT>                        "cutoff singular value is {0}, should be at most {1}",<a name="line.222"></a>
+<FONT color="green">223</FONT>                        minSingularValue, singularValues[0]);<a name="line.223"></a>
+<FONT color="green">224</FONT>            }<a name="line.224"></a>
+<FONT color="green">225</FONT>    <a name="line.225"></a>
+<FONT color="green">226</FONT>            final double[][] data = new double[dimension][p];<a name="line.226"></a>
+<FONT color="green">227</FONT>            getVT().walkInOptimizedOrder(new DefaultRealMatrixPreservingVisitor() {<a name="line.227"></a>
+<FONT color="green">228</FONT>                /** {@inheritDoc} */<a name="line.228"></a>
+<FONT color="green">229</FONT>                @Override<a name="line.229"></a>
+<FONT color="green">230</FONT>                public void visit(final int row, final int column,<a name="line.230"></a>
+<FONT color="green">231</FONT>                        final double value) {<a name="line.231"></a>
+<FONT color="green">232</FONT>                    data[row][column] = value / singularValues[row];<a name="line.232"></a>
+<FONT color="green">233</FONT>                }<a name="line.233"></a>
+<FONT color="green">234</FONT>            }, 0, dimension - 1, 0, p - 1);<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>            RealMatrix jv = new Array2DRowRealMatrix(data, false);<a name="line.236"></a>
+<FONT color="green">237</FONT>            return jv.transpose().multiply(jv);<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>        }<a name="line.239"></a>
+<FONT color="green">240</FONT>    <a name="line.240"></a>
+<FONT color="green">241</FONT>        /** {@inheritDoc} */<a name="line.241"></a>
+<FONT color="green">242</FONT>        public double getNorm() throws InvalidMatrixException {<a name="line.242"></a>
+<FONT color="green">243</FONT>            return singularValues[0];<a name="line.243"></a>
+<FONT color="green">244</FONT>        }<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>        /** {@inheritDoc} */<a name="line.246"></a>
+<FONT color="green">247</FONT>        public double getConditionNumber() throws InvalidMatrixException {<a name="line.247"></a>
+<FONT color="green">248</FONT>            return singularValues[0] / singularValues[singularValues.length - 1];<a name="line.248"></a>
+<FONT color="green">249</FONT>        }<a name="line.249"></a>
+<FONT color="green">250</FONT>    <a name="line.250"></a>
+<FONT color="green">251</FONT>        /** {@inheritDoc} */<a name="line.251"></a>
+<FONT color="green">252</FONT>        public int getRank() throws IllegalStateException {<a name="line.252"></a>
+<FONT color="green">253</FONT>    <a name="line.253"></a>
+<FONT color="green">254</FONT>            final double threshold = Math.max(m, n) * Math.ulp(singularValues[0]);<a name="line.254"></a>
+<FONT color="green">255</FONT>    <a name="line.255"></a>
+<FONT color="green">256</FONT>            for (int i = singularValues.length - 1; i &gt;= 0; --i) {<a name="line.256"></a>
+<FONT color="green">257</FONT>                if (singularValues[i] &gt; threshold) {<a name="line.257"></a>
+<FONT color="green">258</FONT>                    return i + 1;<a name="line.258"></a>
+<FONT color="green">259</FONT>                }<a name="line.259"></a>
+<FONT color="green">260</FONT>            }<a name="line.260"></a>
+<FONT color="green">261</FONT>            return 0;<a name="line.261"></a>
+<FONT color="green">262</FONT>    <a name="line.262"></a>
+<FONT color="green">263</FONT>        }<a name="line.263"></a>
+<FONT color="green">264</FONT>    <a name="line.264"></a>
+<FONT color="green">265</FONT>        /** {@inheritDoc} */<a name="line.265"></a>
+<FONT color="green">266</FONT>        public DecompositionSolver getSolver() {<a name="line.266"></a>
+<FONT color="green">267</FONT>            return new Solver(singularValues, getUT(), getV(), getRank() == Math<a name="line.267"></a>
+<FONT color="green">268</FONT>                    .max(m, n));<a name="line.268"></a>
+<FONT color="green">269</FONT>        }<a name="line.269"></a>
+<FONT color="green">270</FONT>    <a name="line.270"></a>
+<FONT color="green">271</FONT>        /** Specialized solver. */<a name="line.271"></a>
+<FONT color="green">272</FONT>        private static class Solver implements DecompositionSolver {<a name="line.272"></a>
+<FONT color="green">273</FONT>    <a name="line.273"></a>
+<FONT color="green">274</FONT>            /** Pseudo-inverse of the initial matrix. */<a name="line.274"></a>
+<FONT color="green">275</FONT>            private final RealMatrix pseudoInverse;<a name="line.275"></a>
+<FONT color="green">276</FONT>    <a name="line.276"></a>
+<FONT color="green">277</FONT>            /** Singularity indicator. */<a name="line.277"></a>
+<FONT color="green">278</FONT>            private boolean nonSingular;<a name="line.278"></a>
+<FONT color="green">279</FONT>    <a name="line.279"></a>
+<FONT color="green">280</FONT>            /**<a name="line.280"></a>
+<FONT color="green">281</FONT>             * Build a solver from decomposed matrix.<a name="line.281"></a>
+<FONT color="green">282</FONT>             * @param singularValues<a name="line.282"></a>
+<FONT color="green">283</FONT>             *            singularValues<a name="line.283"></a>
+<FONT color="green">284</FONT>             * @param uT<a name="line.284"></a>
+<FONT color="green">285</FONT>             *            U&lt;sup&gt;T&lt;/sup&gt; matrix of the decomposition<a name="line.285"></a>
+<FONT color="green">286</FONT>             * @param v<a name="line.286"></a>
+<FONT color="green">287</FONT>             *            V matrix of the decomposition<a name="line.287"></a>
+<FONT color="green">288</FONT>             * @param nonSingular<a name="line.288"></a>
+<FONT color="green">289</FONT>             *            singularity indicator<a name="line.289"></a>
+<FONT color="green">290</FONT>             */<a name="line.290"></a>
+<FONT color="green">291</FONT>            private Solver(final double[] singularValues, final RealMatrix uT,<a name="line.291"></a>
+<FONT color="green">292</FONT>                    final RealMatrix v, final boolean nonSingular) {<a name="line.292"></a>
+<FONT color="green">293</FONT>                double[][] suT = uT.getData();<a name="line.293"></a>
+<FONT color="green">294</FONT>                for (int i = 0; i &lt; singularValues.length; ++i) {<a name="line.294"></a>
+<FONT color="green">295</FONT>                    final double a;<a name="line.295"></a>
+<FONT color="green">296</FONT>                    if (singularValues[i]&gt;0) {<a name="line.296"></a>
+<FONT color="green">297</FONT>                     a=1.0 / singularValues[i];<a name="line.297"></a>
+<FONT color="green">298</FONT>                    } else {<a name="line.298"></a>
+<FONT color="green">299</FONT>                     a=0.0;<a name="line.299"></a>
+<FONT color="green">300</FONT>                    }<a name="line.300"></a>
+<FONT color="green">301</FONT>                    final double[] suTi = suT[i];<a name="line.301"></a>
+<FONT color="green">302</FONT>                    for (int j = 0; j &lt; suTi.length; ++j) {<a name="line.302"></a>
+<FONT color="green">303</FONT>                        suTi[j] *= a;<a name="line.303"></a>
+<FONT color="green">304</FONT>                    }<a name="line.304"></a>
+<FONT color="green">305</FONT>                }<a name="line.305"></a>
+<FONT color="green">306</FONT>                pseudoInverse = v.multiply(new Array2DRowRealMatrix(suT, false));<a name="line.306"></a>
+<FONT color="green">307</FONT>                this.nonSingular = nonSingular;<a name="line.307"></a>
+<FONT color="green">308</FONT>            }<a name="line.308"></a>
+<FONT color="green">309</FONT>    <a name="line.309"></a>
+<FONT color="green">310</FONT>            /**<a name="line.310"></a>
+<FONT color="green">311</FONT>             * Solve the linear equation A &amp;times; X = B in least square sense.<a name="line.311"></a>
+<FONT color="green">312</FONT>             * &lt;p&gt;<a name="line.312"></a>
+<FONT color="green">313</FONT>             * The m&amp;times;n matrix A may not be square, the solution X is such that<a name="line.313"></a>
+<FONT color="green">314</FONT>             * ||A &amp;times; X - B|| is minimal.<a name="line.314"></a>
+<FONT color="green">315</FONT>             * &lt;/p&gt;<a name="line.315"></a>
+<FONT color="green">316</FONT>             * @param b<a name="line.316"></a>
+<FONT color="green">317</FONT>             *            right-hand side of the equation A &amp;times; X = B<a name="line.317"></a>
+<FONT color="green">318</FONT>             * @return a vector X that minimizes the two norm of A &amp;times; X - B<a name="line.318"></a>
+<FONT color="green">319</FONT>             * @exception IllegalArgumentException<a name="line.319"></a>
+<FONT color="green">320</FONT>             *                if matrices dimensions don't match<a name="line.320"></a>
+<FONT color="green">321</FONT>             */<a name="line.321"></a>
+<FONT color="green">322</FONT>            public double[] solve(final double[] b) throws IllegalArgumentException {<a name="line.322"></a>
+<FONT color="green">323</FONT>                return pseudoInverse.operate(b);<a name="line.323"></a>
+<FONT color="green">324</FONT>            }<a name="line.324"></a>
+<FONT color="green">325</FONT>    <a name="line.325"></a>
+<FONT color="green">326</FONT>            /**<a name="line.326"></a>
+<FONT color="green">327</FONT>             * Solve the linear equation A &amp;times; X = B in least square sense.<a name="line.327"></a>
+<FONT color="green">328</FONT>             * &lt;p&gt;<a name="line.328"></a>
+<FONT color="green">329</FONT>             * The m&amp;times;n matrix A may not be square, the solution X is such that<a name="line.329"></a>
+<FONT color="green">330</FONT>             * ||A &amp;times; X - B|| is minimal.<a name="line.330"></a>
+<FONT color="green">331</FONT>             * &lt;/p&gt;<a name="line.331"></a>
+<FONT color="green">332</FONT>             * @param b<a name="line.332"></a>
+<FONT color="green">333</FONT>             *            right-hand side of the equation A &amp;times; X = B<a name="line.333"></a>
+<FONT color="green">334</FONT>             * @return a vector X that minimizes the two norm of A &amp;times; X - B<a name="line.334"></a>
+<FONT color="green">335</FONT>             * @exception IllegalArgumentException<a name="line.335"></a>
+<FONT color="green">336</FONT>             *                if matrices dimensions don't match<a name="line.336"></a>
+<FONT color="green">337</FONT>             */<a name="line.337"></a>
+<FONT color="green">338</FONT>            public RealVector solve(final RealVector b)<a name="line.338"></a>
+<FONT color="green">339</FONT>                    throws IllegalArgumentException {<a name="line.339"></a>
+<FONT color="green">340</FONT>                return pseudoInverse.operate(b);<a name="line.340"></a>
+<FONT color="green">341</FONT>            }<a name="line.341"></a>
+<FONT color="green">342</FONT>    <a name="line.342"></a>
+<FONT color="green">343</FONT>            /**<a name="line.343"></a>
+<FONT color="green">344</FONT>             * Solve the linear equation A &amp;times; X = B in least square sense.<a name="line.344"></a>
+<FONT color="green">345</FONT>             * &lt;p&gt;<a name="line.345"></a>
+<FONT color="green">346</FONT>             * The m&amp;times;n matrix A may not be square, the solution X is such that<a name="line.346"></a>
+<FONT color="green">347</FONT>             * ||A &amp;times; X - B|| is minimal.<a name="line.347"></a>
+<FONT color="green">348</FONT>             * &lt;/p&gt;<a name="line.348"></a>
+<FONT color="green">349</FONT>             * @param b<a name="line.349"></a>
+<FONT color="green">350</FONT>             *            right-hand side of the equation A &amp;times; X = B<a name="line.350"></a>
+<FONT color="green">351</FONT>             * @return a matrix X that minimizes the two norm of A &amp;times; X - B<a name="line.351"></a>
+<FONT color="green">352</FONT>             * @exception IllegalArgumentException<a name="line.352"></a>
+<FONT color="green">353</FONT>             *                if matrices dimensions don't match<a name="line.353"></a>
+<FONT color="green">354</FONT>             */<a name="line.354"></a>
+<FONT color="green">355</FONT>            public RealMatrix solve(final RealMatrix b)<a name="line.355"></a>
+<FONT color="green">356</FONT>                    throws IllegalArgumentException {<a name="line.356"></a>
+<FONT color="green">357</FONT>                return pseudoInverse.multiply(b);<a name="line.357"></a>
+<FONT color="green">358</FONT>            }<a name="line.358"></a>
+<FONT color="green">359</FONT>    <a name="line.359"></a>
+<FONT color="green">360</FONT>            /**<a name="line.360"></a>
+<FONT color="green">361</FONT>             * Check if the decomposed matrix is non-singular.<a name="line.361"></a>
+<FONT color="green">362</FONT>             * @return true if the decomposed matrix is non-singular<a name="line.362"></a>
+<FONT color="green">363</FONT>             */<a name="line.363"></a>
+<FONT color="green">364</FONT>            public boolean isNonSingular() {<a name="line.364"></a>
+<FONT color="green">365</FONT>                return nonSingular;<a name="line.365"></a>
+<FONT color="green">366</FONT>            }<a name="line.366"></a>
+<FONT color="green">367</FONT>    <a name="line.367"></a>
+<FONT color="green">368</FONT>            /**<a name="line.368"></a>
+<FONT color="green">369</FONT>             * Get the pseudo-inverse of the decomposed matrix.<a name="line.369"></a>
+<FONT color="green">370</FONT>             * @return inverse matrix<a name="line.370"></a>
+<FONT color="green">371</FONT>             */<a name="line.371"></a>
+<FONT color="green">372</FONT>            public RealMatrix getInverse() {<a name="line.372"></a>
+<FONT color="green">373</FONT>                return pseudoInverse;<a name="line.373"></a>
+<FONT color="green">374</FONT>            }<a name="line.374"></a>
+<FONT color="green">375</FONT>    <a name="line.375"></a>
+<FONT color="green">376</FONT>        }<a name="line.376"></a>
+<FONT color="green">377</FONT>    <a name="line.377"></a>
+<FONT color="green">378</FONT>    }<a name="line.378"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/SparseFieldMatrix.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,256 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.linear;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.Field;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FieldElement;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.util.OpenIntToFieldHashMap;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Sparse matrix implementation based on an open addressed map.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @param &lt;T&gt; the type of the field elements<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @since 2.0<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public class SparseFieldMatrix&lt;T extends FieldElement&lt;T&gt;&gt; extends AbstractFieldMatrix&lt;T&gt; {<a name="line.30"></a>
+<FONT color="green">031</FONT>        /**<a name="line.31"></a>
+<FONT color="green">032</FONT>         *  Serial id<a name="line.32"></a>
+<FONT color="green">033</FONT>         */<a name="line.33"></a>
+<FONT color="green">034</FONT>        private static final long serialVersionUID = 9078068119297757342L;<a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Storage for (sparse) matrix elements. */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private final OpenIntToFieldHashMap&lt;T&gt; entries;<a name="line.36"></a>
+<FONT color="green">037</FONT>        /**<a name="line.37"></a>
+<FONT color="green">038</FONT>         * row dimension<a name="line.38"></a>
+<FONT color="green">039</FONT>         */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private final int rows;<a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * column dimension<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        private final int columns;<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Creates a matrix with no data.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @param field field to which the elements belong<a name="line.49"></a>
+<FONT color="green">050</FONT>         */<a name="line.50"></a>
+<FONT color="green">051</FONT>        public SparseFieldMatrix(final Field&lt;T&gt; field) {<a name="line.51"></a>
+<FONT color="green">052</FONT>            super(field);<a name="line.52"></a>
+<FONT color="green">053</FONT>            rows = 0;<a name="line.53"></a>
+<FONT color="green">054</FONT>            columns= 0;<a name="line.54"></a>
+<FONT color="green">055</FONT>            entries = new OpenIntToFieldHashMap&lt;T&gt;(field);<a name="line.55"></a>
+<FONT color="green">056</FONT>        }<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /**<a name="line.58"></a>
+<FONT color="green">059</FONT>         * Create a new SparseFieldMatrix&lt;T&gt; with the supplied row and column dimensions.<a name="line.59"></a>
+<FONT color="green">060</FONT>         *<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param field field to which the elements belong<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param rowDimension  the number of rows in the new matrix<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @param columnDimension  the number of columns in the new matrix<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @throws IllegalArgumentException if row or column dimension is not positive<a name="line.64"></a>
+<FONT color="green">065</FONT>         */<a name="line.65"></a>
+<FONT color="green">066</FONT>        public SparseFieldMatrix(final Field&lt;T&gt; field,<a name="line.66"></a>
+<FONT color="green">067</FONT>                                 final int rowDimension, final int columnDimension)<a name="line.67"></a>
+<FONT color="green">068</FONT>            throws IllegalArgumentException {<a name="line.68"></a>
+<FONT color="green">069</FONT>            super(field, rowDimension, columnDimension);<a name="line.69"></a>
+<FONT color="green">070</FONT>            this.rows = rowDimension;<a name="line.70"></a>
+<FONT color="green">071</FONT>            this.columns = columnDimension;<a name="line.71"></a>
+<FONT color="green">072</FONT>            entries = new OpenIntToFieldHashMap&lt;T&gt;(field);<a name="line.72"></a>
+<FONT color="green">073</FONT>        }<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /**<a name="line.75"></a>
+<FONT color="green">076</FONT>         * Copy constructor.<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @param other The instance to copy<a name="line.77"></a>
+<FONT color="green">078</FONT>         */<a name="line.78"></a>
+<FONT color="green">079</FONT>        public SparseFieldMatrix(SparseFieldMatrix&lt;T&gt; other) {<a name="line.79"></a>
+<FONT color="green">080</FONT>            super(other.getField(), other.getRowDimension(), other.getColumnDimension());<a name="line.80"></a>
+<FONT color="green">081</FONT>            rows = other.getRowDimension();<a name="line.81"></a>
+<FONT color="green">082</FONT>            columns = other.getColumnDimension();<a name="line.82"></a>
+<FONT color="green">083</FONT>            entries = new OpenIntToFieldHashMap&lt;T&gt;(other.entries);<a name="line.83"></a>
+<FONT color="green">084</FONT>        }<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /**<a name="line.86"></a>
+<FONT color="green">087</FONT>         * Generic copy constructor.<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @param other The instance to copy<a name="line.88"></a>
+<FONT color="green">089</FONT>         */<a name="line.89"></a>
+<FONT color="green">090</FONT>        public SparseFieldMatrix(FieldMatrix&lt;T&gt; other){<a name="line.90"></a>
+<FONT color="green">091</FONT>            super(other.getField(), other.getRowDimension(), other.getColumnDimension());<a name="line.91"></a>
+<FONT color="green">092</FONT>            rows = other.getRowDimension();<a name="line.92"></a>
+<FONT color="green">093</FONT>            columns = other.getColumnDimension();<a name="line.93"></a>
+<FONT color="green">094</FONT>            entries = new OpenIntToFieldHashMap&lt;T&gt;(getField());<a name="line.94"></a>
+<FONT color="green">095</FONT>            for (int i = 0; i &lt; rows; i++) {<a name="line.95"></a>
+<FONT color="green">096</FONT>                for (int j = 0; j &lt; columns; j++) {<a name="line.96"></a>
+<FONT color="green">097</FONT>                    setEntry(i, j, other.getEntry(i, j));<a name="line.97"></a>
+<FONT color="green">098</FONT>                }<a name="line.98"></a>
+<FONT color="green">099</FONT>            }<a name="line.99"></a>
+<FONT color="green">100</FONT>        }<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>        /** {@inheritDoc} */<a name="line.102"></a>
+<FONT color="green">103</FONT>        @Override<a name="line.103"></a>
+<FONT color="green">104</FONT>        public void addToEntry(int row, int column, T increment)<a name="line.104"></a>
+<FONT color="green">105</FONT>                throws MatrixIndexException {<a name="line.105"></a>
+<FONT color="green">106</FONT>            checkRowIndex(row);<a name="line.106"></a>
+<FONT color="green">107</FONT>            checkColumnIndex(column);<a name="line.107"></a>
+<FONT color="green">108</FONT>            final int key = computeKey(row, column);<a name="line.108"></a>
+<FONT color="green">109</FONT>            final T value = entries.get(key).add(increment);<a name="line.109"></a>
+<FONT color="green">110</FONT>            if (getField().getZero().equals(value)) {<a name="line.110"></a>
+<FONT color="green">111</FONT>                entries.remove(key);<a name="line.111"></a>
+<FONT color="green">112</FONT>            } else {<a name="line.112"></a>
+<FONT color="green">113</FONT>                entries.put(key, value);<a name="line.113"></a>
+<FONT color="green">114</FONT>            }<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>        }<a name="line.116"></a>
+<FONT color="green">117</FONT>    <a name="line.117"></a>
+<FONT color="green">118</FONT>        /** {@inheritDoc} */<a name="line.118"></a>
+<FONT color="green">119</FONT>        @Override<a name="line.119"></a>
+<FONT color="green">120</FONT>        public FieldMatrix&lt;T&gt; copy() {<a name="line.120"></a>
+<FONT color="green">121</FONT>            return new SparseFieldMatrix&lt;T&gt;(this);<a name="line.121"></a>
+<FONT color="green">122</FONT>        }<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>        /** {@inheritDoc} */<a name="line.124"></a>
+<FONT color="green">125</FONT>        @Override<a name="line.125"></a>
+<FONT color="green">126</FONT>        public FieldMatrix&lt;T&gt; createMatrix(int rowDimension, int columnDimension)<a name="line.126"></a>
+<FONT color="green">127</FONT>                throws IllegalArgumentException {<a name="line.127"></a>
+<FONT color="green">128</FONT>            return new SparseFieldMatrix&lt;T&gt;(getField(), rowDimension, columnDimension);<a name="line.128"></a>
+<FONT color="green">129</FONT>        }<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>        /** {@inheritDoc} */<a name="line.131"></a>
+<FONT color="green">132</FONT>        @Override<a name="line.132"></a>
+<FONT color="green">133</FONT>        public int getColumnDimension() {<a name="line.133"></a>
+<FONT color="green">134</FONT>            return columns;<a name="line.134"></a>
+<FONT color="green">135</FONT>        }<a name="line.135"></a>
+<FONT color="green">136</FONT>    <a name="line.136"></a>
+<FONT color="green">137</FONT>        /** {@inheritDoc} */<a name="line.137"></a>
+<FONT color="green">138</FONT>        @Override<a name="line.138"></a>
+<FONT color="green">139</FONT>        public T getEntry(int row, int column) throws MatrixIndexException {<a name="line.139"></a>
+<FONT color="green">140</FONT>            checkRowIndex(row);<a name="line.140"></a>
+<FONT color="green">141</FONT>            checkColumnIndex(column);<a name="line.141"></a>
+<FONT color="green">142</FONT>            return entries.get(computeKey(row, column));<a name="line.142"></a>
+<FONT color="green">143</FONT>        }<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>        /** {@inheritDoc} */<a name="line.145"></a>
+<FONT color="green">146</FONT>        @Override<a name="line.146"></a>
+<FONT color="green">147</FONT>        public int getRowDimension() {<a name="line.147"></a>
+<FONT color="green">148</FONT>            return rows;<a name="line.148"></a>
+<FONT color="green">149</FONT>        }<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>        /** {@inheritDoc} */<a name="line.151"></a>
+<FONT color="green">152</FONT>        @Override<a name="line.152"></a>
+<FONT color="green">153</FONT>        public void multiplyEntry(int row, int column, T factor)<a name="line.153"></a>
+<FONT color="green">154</FONT>                throws MatrixIndexException {<a name="line.154"></a>
+<FONT color="green">155</FONT>            checkRowIndex(row);<a name="line.155"></a>
+<FONT color="green">156</FONT>            checkColumnIndex(column);<a name="line.156"></a>
+<FONT color="green">157</FONT>            final int key = computeKey(row, column);<a name="line.157"></a>
+<FONT color="green">158</FONT>            final T value = entries.get(key).multiply(factor);<a name="line.158"></a>
+<FONT color="green">159</FONT>            if (getField().getZero().equals(value)) {<a name="line.159"></a>
+<FONT color="green">160</FONT>                entries.remove(key);<a name="line.160"></a>
+<FONT color="green">161</FONT>            } else {<a name="line.161"></a>
+<FONT color="green">162</FONT>                entries.put(key, value);<a name="line.162"></a>
+<FONT color="green">163</FONT>            }<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>        }<a name="line.165"></a>
+<FONT color="green">166</FONT>    <a name="line.166"></a>
+<FONT color="green">167</FONT>        /** {@inheritDoc} */<a name="line.167"></a>
+<FONT color="green">168</FONT>        @Override<a name="line.168"></a>
+<FONT color="green">169</FONT>        public void setEntry(int row, int column, T value)<a name="line.169"></a>
+<FONT color="green">170</FONT>                throws MatrixIndexException {<a name="line.170"></a>
+<FONT color="green">171</FONT>            checkRowIndex(row);<a name="line.171"></a>
+<FONT color="green">172</FONT>            checkColumnIndex(column);<a name="line.172"></a>
+<FONT color="green">173</FONT>            if (getField().getZero().equals(value)) {<a name="line.173"></a>
+<FONT color="green">174</FONT>                entries.remove(computeKey(row, column));<a name="line.174"></a>
+<FONT color="green">175</FONT>            } else {<a name="line.175"></a>
+<FONT color="green">176</FONT>                entries.put(computeKey(row, column), value);<a name="line.176"></a>
+<FONT color="green">177</FONT>            }<a name="line.177"></a>
+<FONT color="green">178</FONT>    <a name="line.178"></a>
+<FONT color="green">179</FONT>        }<a name="line.179"></a>
+<FONT color="green">180</FONT>        /**<a name="line.180"></a>
+<FONT color="green">181</FONT>         * Compute the key to access a matrix element<a name="line.181"></a>
+<FONT color="green">182</FONT>         * @param row row index of the matrix element<a name="line.182"></a>
+<FONT color="green">183</FONT>         * @param column column index of the matrix element<a name="line.183"></a>
+<FONT color="green">184</FONT>         * @return key within the map to access the matrix element<a name="line.184"></a>
+<FONT color="green">185</FONT>         */<a name="line.185"></a>
+<FONT color="green">186</FONT>        private int computeKey(int row, int column) {<a name="line.186"></a>
+<FONT color="green">187</FONT>            return row * columns + column;<a name="line.187"></a>
+<FONT color="green">188</FONT>        }<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>    }<a name="line.190"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/SparseFieldVector.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,723 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.linear;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.lang.reflect.Array;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.Field;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.FieldElement;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.util.OpenIntToFieldHashMap;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    /**<a name="line.27"></a>
+<FONT color="green">028</FONT>     * This class implements the {@link FieldVector} interface with a {@link OpenIntToFieldHashMap} backing store.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @param &lt;T&gt; the type of the field elements<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 922714 $ $Date: 2010-03-13 20:35:14 -0500 (Sat, 13 Mar 2010) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 2.0<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public class SparseFieldVector&lt;T extends FieldElement&lt;T&gt;&gt; implements FieldVector&lt;T&gt;, Serializable {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /**<a name="line.35"></a>
+<FONT color="green">036</FONT>         *  Serial version id<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        private static final long serialVersionUID = 7841233292190413362L;<a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Field to which the elements belong. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private final Field&lt;T&gt; field;<a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Entries of the vector. */<a name="line.41"></a>
+<FONT color="green">042</FONT>        private final OpenIntToFieldHashMap&lt;T&gt; entries;<a name="line.42"></a>
+<FONT color="green">043</FONT>        /** Dimension of the vector. */<a name="line.43"></a>
+<FONT color="green">044</FONT>        private final int virtualSize;<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /**<a name="line.46"></a>
+<FONT color="green">047</FONT>         * Build a 0-length vector.<a name="line.47"></a>
+<FONT color="green">048</FONT>         * &lt;p&gt;Zero-length vectors may be used to initialize construction of vectors<a name="line.48"></a>
+<FONT color="green">049</FONT>         * by data gathering. We start with zero-length and use either the {@link<a name="line.49"></a>
+<FONT color="green">050</FONT>         * #SparseFieldVector(SparseFieldVector, int)} constructor<a name="line.50"></a>
+<FONT color="green">051</FONT>         * or one of the &lt;code&gt;append&lt;/code&gt; method ({@link #append(FieldElement)},<a name="line.51"></a>
+<FONT color="green">052</FONT>         * {@link #append(FieldElement[])}, {@link #append(FieldVector)},<a name="line.52"></a>
+<FONT color="green">053</FONT>         * {@link #append(SparseFieldVector)}) to gather data into this vector.&lt;/p&gt;<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @param field field to which the elements belong<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public SparseFieldVector(Field&lt;T&gt; field) {<a name="line.56"></a>
+<FONT color="green">057</FONT>            this(field, 0);<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Construct a (dimension)-length vector of zeros.<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @param field field to which the elements belong<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @param dimension Size of the vector<a name="line.64"></a>
+<FONT color="green">065</FONT>         */<a name="line.65"></a>
+<FONT color="green">066</FONT>        public SparseFieldVector(Field&lt;T&gt; field, int dimension) {<a name="line.66"></a>
+<FONT color="green">067</FONT>            this.field = field;<a name="line.67"></a>
+<FONT color="green">068</FONT>            virtualSize = dimension;<a name="line.68"></a>
+<FONT color="green">069</FONT>            entries = new OpenIntToFieldHashMap&lt;T&gt;(field);<a name="line.69"></a>
+<FONT color="green">070</FONT>        }<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /**<a name="line.72"></a>
+<FONT color="green">073</FONT>         * Build a resized vector, for use with append.<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @param v The original vector<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @param resize The amount to resize it<a name="line.75"></a>
+<FONT color="green">076</FONT>         */<a name="line.76"></a>
+<FONT color="green">077</FONT>        protected SparseFieldVector(SparseFieldVector&lt;T&gt; v, int resize) {<a name="line.77"></a>
+<FONT color="green">078</FONT>            field = v.field;<a name="line.78"></a>
+<FONT color="green">079</FONT>            virtualSize = v.getDimension() + resize;<a name="line.79"></a>
+<FONT color="green">080</FONT>            entries = new OpenIntToFieldHashMap&lt;T&gt;(v.entries);<a name="line.80"></a>
+<FONT color="green">081</FONT>        }<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /**<a name="line.84"></a>
+<FONT color="green">085</FONT>         * Build a vector with known the sparseness (for advanced use only).<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @param field field to which the elements belong<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @param dimension The size of the vector<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @param expectedSize The expected number of non-zero entries<a name="line.88"></a>
+<FONT color="green">089</FONT>         */<a name="line.89"></a>
+<FONT color="green">090</FONT>        public SparseFieldVector(Field&lt;T&gt; field, int dimension, int expectedSize) {<a name="line.90"></a>
+<FONT color="green">091</FONT>            this.field = field;<a name="line.91"></a>
+<FONT color="green">092</FONT>            virtualSize = dimension;<a name="line.92"></a>
+<FONT color="green">093</FONT>            entries = new OpenIntToFieldHashMap&lt;T&gt;(field,expectedSize);<a name="line.93"></a>
+<FONT color="green">094</FONT>        }<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /**<a name="line.96"></a>
+<FONT color="green">097</FONT>         * Create from a Field array.<a name="line.97"></a>
+<FONT color="green">098</FONT>         * Only non-zero entries will be stored<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @param field field to which the elements belong<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @param values The set of values to create from<a name="line.100"></a>
+<FONT color="green">101</FONT>         */<a name="line.101"></a>
+<FONT color="green">102</FONT>        public SparseFieldVector(Field&lt;T&gt; field, T[] values) {<a name="line.102"></a>
+<FONT color="green">103</FONT>            this.field = field;<a name="line.103"></a>
+<FONT color="green">104</FONT>            virtualSize = values.length;<a name="line.104"></a>
+<FONT color="green">105</FONT>            entries = new OpenIntToFieldHashMap&lt;T&gt;(field);<a name="line.105"></a>
+<FONT color="green">106</FONT>            for (int key = 0; key &lt; values.length; key++) {<a name="line.106"></a>
+<FONT color="green">107</FONT>                T value = values[key];<a name="line.107"></a>
+<FONT color="green">108</FONT>                entries.put(key, value);<a name="line.108"></a>
+<FONT color="green">109</FONT>            }<a name="line.109"></a>
+<FONT color="green">110</FONT>        }<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /**<a name="line.114"></a>
+<FONT color="green">115</FONT>         * Copy constructor.<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @param v The instance to copy from<a name="line.116"></a>
+<FONT color="green">117</FONT>         */<a name="line.117"></a>
+<FONT color="green">118</FONT>        public SparseFieldVector(SparseFieldVector&lt;T&gt; v) {<a name="line.118"></a>
+<FONT color="green">119</FONT>            field = v.field;<a name="line.119"></a>
+<FONT color="green">120</FONT>            virtualSize = v.getDimension();<a name="line.120"></a>
+<FONT color="green">121</FONT>            entries = new OpenIntToFieldHashMap&lt;T&gt;(v.getEntries());<a name="line.121"></a>
+<FONT color="green">122</FONT>        }<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>        /**<a name="line.124"></a>
+<FONT color="green">125</FONT>         * Get the entries of this instance.<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @return entries of this instance<a name="line.126"></a>
+<FONT color="green">127</FONT>         */<a name="line.127"></a>
+<FONT color="green">128</FONT>        private OpenIntToFieldHashMap&lt;T&gt; getEntries() {<a name="line.128"></a>
+<FONT color="green">129</FONT>            return entries;<a name="line.129"></a>
+<FONT color="green">130</FONT>        }<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>        /**<a name="line.132"></a>
+<FONT color="green">133</FONT>         * Optimized method to add sparse vectors.<a name="line.133"></a>
+<FONT color="green">134</FONT>         * @param v vector to add<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @return The sum of &lt;code&gt;this&lt;/code&gt; and &lt;code&gt;v&lt;/code&gt;<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @throws IllegalArgumentException If the dimensions don't match<a name="line.136"></a>
+<FONT color="green">137</FONT>         */<a name="line.137"></a>
+<FONT color="green">138</FONT>        public FieldVector&lt;T&gt; add(SparseFieldVector&lt;T&gt; v) throws IllegalArgumentException {<a name="line.138"></a>
+<FONT color="green">139</FONT>            checkVectorDimensions(v.getDimension());<a name="line.139"></a>
+<FONT color="green">140</FONT>            SparseFieldVector&lt;T&gt; res = (SparseFieldVector&lt;T&gt;)copy();<a name="line.140"></a>
+<FONT color="green">141</FONT>            OpenIntToFieldHashMap&lt;T&gt;.Iterator iter = v.getEntries().iterator();<a name="line.141"></a>
+<FONT color="green">142</FONT>            while (iter.hasNext()) {<a name="line.142"></a>
+<FONT color="green">143</FONT>                iter.advance();<a name="line.143"></a>
+<FONT color="green">144</FONT>                int key = iter.key();<a name="line.144"></a>
+<FONT color="green">145</FONT>                T value = iter.value();<a name="line.145"></a>
+<FONT color="green">146</FONT>                if (entries.containsKey(key)) {<a name="line.146"></a>
+<FONT color="green">147</FONT>                    res.setEntry(key, entries.get(key).add(value));<a name="line.147"></a>
+<FONT color="green">148</FONT>                } else {<a name="line.148"></a>
+<FONT color="green">149</FONT>                    res.setEntry(key, value);<a name="line.149"></a>
+<FONT color="green">150</FONT>                }<a name="line.150"></a>
+<FONT color="green">151</FONT>            }<a name="line.151"></a>
+<FONT color="green">152</FONT>            return res;<a name="line.152"></a>
+<FONT color="green">153</FONT>    <a name="line.153"></a>
+<FONT color="green">154</FONT>        }<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>    <a name="line.156"></a>
+<FONT color="green">157</FONT>        /** {@inheritDoc} */<a name="line.157"></a>
+<FONT color="green">158</FONT>        public FieldVector&lt;T&gt; add(T[] v) throws IllegalArgumentException {<a name="line.158"></a>
+<FONT color="green">159</FONT>            checkVectorDimensions(v.length);<a name="line.159"></a>
+<FONT color="green">160</FONT>            SparseFieldVector&lt;T&gt; res = new SparseFieldVector&lt;T&gt;(field,getDimension());<a name="line.160"></a>
+<FONT color="green">161</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.161"></a>
+<FONT color="green">162</FONT>                res.setEntry(i, v[i].add(getEntry(i)));<a name="line.162"></a>
+<FONT color="green">163</FONT>            }<a name="line.163"></a>
+<FONT color="green">164</FONT>            return res;<a name="line.164"></a>
+<FONT color="green">165</FONT>        }<a name="line.165"></a>
+<FONT color="green">166</FONT>    <a name="line.166"></a>
+<FONT color="green">167</FONT>        /**<a name="line.167"></a>
+<FONT color="green">168</FONT>         * Construct a vector by appending a vector to this vector.<a name="line.168"></a>
+<FONT color="green">169</FONT>         * @param v vector to append to this one.<a name="line.169"></a>
+<FONT color="green">170</FONT>         * @return a new vector<a name="line.170"></a>
+<FONT color="green">171</FONT>         */<a name="line.171"></a>
+<FONT color="green">172</FONT>        public FieldVector&lt;T&gt; append(SparseFieldVector&lt;T&gt; v) {<a name="line.172"></a>
+<FONT color="green">173</FONT>            SparseFieldVector&lt;T&gt; res = new SparseFieldVector&lt;T&gt;(this, v.getDimension());<a name="line.173"></a>
+<FONT color="green">174</FONT>            OpenIntToFieldHashMap&lt;T&gt;.Iterator iter = v.entries.iterator();<a name="line.174"></a>
+<FONT color="green">175</FONT>            while (iter.hasNext()) {<a name="line.175"></a>
+<FONT color="green">176</FONT>                iter.advance();<a name="line.176"></a>
+<FONT color="green">177</FONT>                res.setEntry(iter.key() + virtualSize, iter.value());<a name="line.177"></a>
+<FONT color="green">178</FONT>            }<a name="line.178"></a>
+<FONT color="green">179</FONT>            return res;<a name="line.179"></a>
+<FONT color="green">180</FONT>        }<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>        /** {@inheritDoc} */<a name="line.182"></a>
+<FONT color="green">183</FONT>        public FieldVector&lt;T&gt; append(FieldVector&lt;T&gt; v) {<a name="line.183"></a>
+<FONT color="green">184</FONT>            if (v instanceof SparseFieldVector&lt;?&gt;) {<a name="line.184"></a>
+<FONT color="green">185</FONT>                return append((SparseFieldVector&lt;T&gt;) v);<a name="line.185"></a>
+<FONT color="green">186</FONT>            } else {<a name="line.186"></a>
+<FONT color="green">187</FONT>                return append(v.toArray());<a name="line.187"></a>
+<FONT color="green">188</FONT>            }<a name="line.188"></a>
+<FONT color="green">189</FONT>        }<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>        /** {@inheritDoc} */<a name="line.191"></a>
+<FONT color="green">192</FONT>        public FieldVector&lt;T&gt; append(T d) {<a name="line.192"></a>
+<FONT color="green">193</FONT>            FieldVector&lt;T&gt; res = new SparseFieldVector&lt;T&gt;(this, 1);<a name="line.193"></a>
+<FONT color="green">194</FONT>            res.setEntry(virtualSize, d);<a name="line.194"></a>
+<FONT color="green">195</FONT>            return res;<a name="line.195"></a>
+<FONT color="green">196</FONT>         }<a name="line.196"></a>
+<FONT color="green">197</FONT>    <a name="line.197"></a>
+<FONT color="green">198</FONT>        /** {@inheritDoc} */<a name="line.198"></a>
+<FONT color="green">199</FONT>        public FieldVector&lt;T&gt; append(T[] a) {<a name="line.199"></a>
+<FONT color="green">200</FONT>            FieldVector&lt;T&gt; res = new SparseFieldVector&lt;T&gt;(this, a.length);<a name="line.200"></a>
+<FONT color="green">201</FONT>            for (int i = 0; i &lt; a.length; i++) {<a name="line.201"></a>
+<FONT color="green">202</FONT>                res.setEntry(i + virtualSize, a[i]);<a name="line.202"></a>
+<FONT color="green">203</FONT>            }<a name="line.203"></a>
+<FONT color="green">204</FONT>            return res;<a name="line.204"></a>
+<FONT color="green">205</FONT>         }<a name="line.205"></a>
+<FONT color="green">206</FONT>    <a name="line.206"></a>
+<FONT color="green">207</FONT>        /** {@inheritDoc} */<a name="line.207"></a>
+<FONT color="green">208</FONT>        public FieldVector&lt;T&gt; copy() {<a name="line.208"></a>
+<FONT color="green">209</FONT>            return new SparseFieldVector&lt;T&gt;(this);<a name="line.209"></a>
+<FONT color="green">210</FONT>       }<a name="line.210"></a>
+<FONT color="green">211</FONT>    <a name="line.211"></a>
+<FONT color="green">212</FONT>        /** {@inheritDoc} */<a name="line.212"></a>
+<FONT color="green">213</FONT>        public T dotProduct(FieldVector&lt;T&gt; v) throws IllegalArgumentException {<a name="line.213"></a>
+<FONT color="green">214</FONT>            checkVectorDimensions(v.getDimension());<a name="line.214"></a>
+<FONT color="green">215</FONT>            T res = field.getZero();<a name="line.215"></a>
+<FONT color="green">216</FONT>            OpenIntToFieldHashMap&lt;T&gt;.Iterator iter = entries.iterator();<a name="line.216"></a>
+<FONT color="green">217</FONT>            while (iter.hasNext()) {<a name="line.217"></a>
+<FONT color="green">218</FONT>                iter.advance();<a name="line.218"></a>
+<FONT color="green">219</FONT>                res = res.add(v.getEntry(iter.key()).multiply(iter.value()));<a name="line.219"></a>
+<FONT color="green">220</FONT>            }<a name="line.220"></a>
+<FONT color="green">221</FONT>            return res;<a name="line.221"></a>
+<FONT color="green">222</FONT>        }<a name="line.222"></a>
+<FONT color="green">223</FONT>    <a name="line.223"></a>
+<FONT color="green">224</FONT>        /** {@inheritDoc} */<a name="line.224"></a>
+<FONT color="green">225</FONT>        public T dotProduct(T[] v) throws IllegalArgumentException {<a name="line.225"></a>
+<FONT color="green">226</FONT>            checkVectorDimensions(v.length);<a name="line.226"></a>
+<FONT color="green">227</FONT>            T res = field.getZero();<a name="line.227"></a>
+<FONT color="green">228</FONT>            OpenIntToFieldHashMap&lt;T&gt;.Iterator iter = entries.iterator();<a name="line.228"></a>
+<FONT color="green">229</FONT>            while (iter.hasNext()) {<a name="line.229"></a>
+<FONT color="green">230</FONT>                int idx = iter.key();<a name="line.230"></a>
+<FONT color="green">231</FONT>                T value = field.getZero();<a name="line.231"></a>
+<FONT color="green">232</FONT>                if (idx &lt; v.length) {<a name="line.232"></a>
+<FONT color="green">233</FONT>                    value = v[idx];<a name="line.233"></a>
+<FONT color="green">234</FONT>                }<a name="line.234"></a>
+<FONT color="green">235</FONT>                res = res.add(value.multiply(iter.value()));<a name="line.235"></a>
+<FONT color="green">236</FONT>            }<a name="line.236"></a>
+<FONT color="green">237</FONT>            return res;<a name="line.237"></a>
+<FONT color="green">238</FONT>         }<a name="line.238"></a>
+<FONT color="green">239</FONT>    <a name="line.239"></a>
+<FONT color="green">240</FONT>        /** {@inheritDoc} */<a name="line.240"></a>
+<FONT color="green">241</FONT>        public FieldVector&lt;T&gt; ebeDivide(FieldVector&lt;T&gt; v)<a name="line.241"></a>
+<FONT color="green">242</FONT>            throws IllegalArgumentException {<a name="line.242"></a>
+<FONT color="green">243</FONT>            checkVectorDimensions(v.getDimension());<a name="line.243"></a>
+<FONT color="green">244</FONT>            SparseFieldVector&lt;T&gt; res = new SparseFieldVector&lt;T&gt;(this);<a name="line.244"></a>
+<FONT color="green">245</FONT>            OpenIntToFieldHashMap&lt;T&gt;.Iterator iter = res.entries.iterator();<a name="line.245"></a>
+<FONT color="green">246</FONT>            while (iter.hasNext()) {<a name="line.246"></a>
+<FONT color="green">247</FONT>                iter.advance();<a name="line.247"></a>
+<FONT color="green">248</FONT>                res.setEntry(iter.key(), iter.value().divide(v.getEntry(iter.key())));<a name="line.248"></a>
+<FONT color="green">249</FONT>            }<a name="line.249"></a>
+<FONT color="green">250</FONT>            return res;<a name="line.250"></a>
+<FONT color="green">251</FONT>        }<a name="line.251"></a>
+<FONT color="green">252</FONT>    <a name="line.252"></a>
+<FONT color="green">253</FONT>        /** {@inheritDoc} */<a name="line.253"></a>
+<FONT color="green">254</FONT>        public FieldVector&lt;T&gt; ebeDivide(T[] v) throws IllegalArgumentException {<a name="line.254"></a>
+<FONT color="green">255</FONT>            checkVectorDimensions(v.length);<a name="line.255"></a>
+<FONT color="green">256</FONT>            SparseFieldVector&lt;T&gt; res = new SparseFieldVector&lt;T&gt;(this);<a name="line.256"></a>
+<FONT color="green">257</FONT>            OpenIntToFieldHashMap&lt;T&gt;.Iterator iter = res.entries.iterator();<a name="line.257"></a>
+<FONT color="green">258</FONT>            while (iter.hasNext()) {<a name="line.258"></a>
+<FONT color="green">259</FONT>                iter.advance();<a name="line.259"></a>
+<FONT color="green">260</FONT>                res.setEntry(iter.key(), iter.value().divide(v[iter.key()]));<a name="line.260"></a>
+<FONT color="green">261</FONT>            }<a name="line.261"></a>
+<FONT color="green">262</FONT>            return res;<a name="line.262"></a>
+<FONT color="green">263</FONT>        }<a name="line.263"></a>
+<FONT color="green">264</FONT>    <a name="line.264"></a>
+<FONT color="green">265</FONT>        /** {@inheritDoc} */<a name="line.265"></a>
+<FONT color="green">266</FONT>        public FieldVector&lt;T&gt; ebeMultiply(FieldVector&lt;T&gt; v)throws IllegalArgumentException {<a name="line.266"></a>
+<FONT color="green">267</FONT>            checkVectorDimensions(v.getDimension());<a name="line.267"></a>
+<FONT color="green">268</FONT>            SparseFieldVector&lt;T&gt; res = new SparseFieldVector&lt;T&gt;(this);<a name="line.268"></a>
+<FONT color="green">269</FONT>            OpenIntToFieldHashMap&lt;T&gt;.Iterator iter = res.entries.iterator();<a name="line.269"></a>
+<FONT color="green">270</FONT>            while (iter.hasNext()) {<a name="line.270"></a>
+<FONT color="green">271</FONT>                iter.advance();<a name="line.271"></a>
+<FONT color="green">272</FONT>                res.setEntry(iter.key(), iter.value().multiply(v.getEntry(iter.key())));<a name="line.272"></a>
+<FONT color="green">273</FONT>            }<a name="line.273"></a>
+<FONT color="green">274</FONT>            return res;<a name="line.274"></a>
+<FONT color="green">275</FONT>        }<a name="line.275"></a>
+<FONT color="green">276</FONT>    <a name="line.276"></a>
+<FONT color="green">277</FONT>        /** {@inheritDoc} */<a name="line.277"></a>
+<FONT color="green">278</FONT>         public FieldVector&lt;T&gt; ebeMultiply(T[] v) throws IllegalArgumentException {<a name="line.278"></a>
+<FONT color="green">279</FONT>            checkVectorDimensions(v.length);<a name="line.279"></a>
+<FONT color="green">280</FONT>            SparseFieldVector&lt;T&gt; res = new SparseFieldVector&lt;T&gt;(this);<a name="line.280"></a>
+<FONT color="green">281</FONT>            OpenIntToFieldHashMap&lt;T&gt;.Iterator iter = res.entries.iterator();<a name="line.281"></a>
+<FONT color="green">282</FONT>            while (iter.hasNext()) {<a name="line.282"></a>
+<FONT color="green">283</FONT>                iter.advance();<a name="line.283"></a>
+<FONT color="green">284</FONT>                res.setEntry(iter.key(), iter.value().multiply(v[iter.key()]));<a name="line.284"></a>
+<FONT color="green">285</FONT>            }<a name="line.285"></a>
+<FONT color="green">286</FONT>            return res;<a name="line.286"></a>
+<FONT color="green">287</FONT>        }<a name="line.287"></a>
+<FONT color="green">288</FONT>    <a name="line.288"></a>
+<FONT color="green">289</FONT>         /** {@inheritDoc} */<a name="line.289"></a>
+<FONT color="green">290</FONT>         public T[] getData() {<a name="line.290"></a>
+<FONT color="green">291</FONT>            T[] res = buildArray(virtualSize);<a name="line.291"></a>
+<FONT color="green">292</FONT>            OpenIntToFieldHashMap&lt;T&gt;.Iterator iter = entries.iterator();<a name="line.292"></a>
+<FONT color="green">293</FONT>            while (iter.hasNext()) {<a name="line.293"></a>
+<FONT color="green">294</FONT>                iter.advance();<a name="line.294"></a>
+<FONT color="green">295</FONT>                res[iter.key()] = iter.value();<a name="line.295"></a>
+<FONT color="green">296</FONT>            }<a name="line.296"></a>
+<FONT color="green">297</FONT>            return res;<a name="line.297"></a>
+<FONT color="green">298</FONT>         }<a name="line.298"></a>
+<FONT color="green">299</FONT>    <a name="line.299"></a>
+<FONT color="green">300</FONT>         /** {@inheritDoc} */<a name="line.300"></a>
+<FONT color="green">301</FONT>         public int getDimension() {<a name="line.301"></a>
+<FONT color="green">302</FONT>            return virtualSize;<a name="line.302"></a>
+<FONT color="green">303</FONT>        }<a name="line.303"></a>
+<FONT color="green">304</FONT>    <a name="line.304"></a>
+<FONT color="green">305</FONT>         /** {@inheritDoc} */<a name="line.305"></a>
+<FONT color="green">306</FONT>         public T getEntry(int index) throws MatrixIndexException {<a name="line.306"></a>
+<FONT color="green">307</FONT>            checkIndex(index);<a name="line.307"></a>
+<FONT color="green">308</FONT>            return entries.get(index);<a name="line.308"></a>
+<FONT color="green">309</FONT>       }<a name="line.309"></a>
+<FONT color="green">310</FONT>    <a name="line.310"></a>
+<FONT color="green">311</FONT>         /** {@inheritDoc} */<a name="line.311"></a>
+<FONT color="green">312</FONT>         public Field&lt;T&gt; getField() {<a name="line.312"></a>
+<FONT color="green">313</FONT>            return field;<a name="line.313"></a>
+<FONT color="green">314</FONT>        }<a name="line.314"></a>
+<FONT color="green">315</FONT>    <a name="line.315"></a>
+<FONT color="green">316</FONT>         /** {@inheritDoc} */<a name="line.316"></a>
+<FONT color="green">317</FONT>         public FieldVector&lt;T&gt; getSubVector(int index, int n)<a name="line.317"></a>
+<FONT color="green">318</FONT>                throws MatrixIndexException {<a name="line.318"></a>
+<FONT color="green">319</FONT>            checkIndex(index);<a name="line.319"></a>
+<FONT color="green">320</FONT>            checkIndex(index + n - 1);<a name="line.320"></a>
+<FONT color="green">321</FONT>            SparseFieldVector&lt;T&gt; res = new SparseFieldVector&lt;T&gt;(field,n);<a name="line.321"></a>
+<FONT color="green">322</FONT>            int end = index + n;<a name="line.322"></a>
+<FONT color="green">323</FONT>            OpenIntToFieldHashMap&lt;T&gt;.Iterator iter = entries.iterator();<a name="line.323"></a>
+<FONT color="green">324</FONT>            while (iter.hasNext()) {<a name="line.324"></a>
+<FONT color="green">325</FONT>                iter.advance();<a name="line.325"></a>
+<FONT color="green">326</FONT>                int key = iter.key();<a name="line.326"></a>
+<FONT color="green">327</FONT>                if (key &gt;= index &amp;&amp; key &lt; end) {<a name="line.327"></a>
+<FONT color="green">328</FONT>                    res.setEntry(key - index, iter.value());<a name="line.328"></a>
+<FONT color="green">329</FONT>                }<a name="line.329"></a>
+<FONT color="green">330</FONT>            }<a name="line.330"></a>
+<FONT color="green">331</FONT>            return res;<a name="line.331"></a>
+<FONT color="green">332</FONT>        }<a name="line.332"></a>
+<FONT color="green">333</FONT>    <a name="line.333"></a>
+<FONT color="green">334</FONT>         /** {@inheritDoc} */<a name="line.334"></a>
+<FONT color="green">335</FONT>         public FieldVector&lt;T&gt; mapAdd(T d) {<a name="line.335"></a>
+<FONT color="green">336</FONT>            return copy().mapAddToSelf(d);<a name="line.336"></a>
+<FONT color="green">337</FONT>       }<a name="line.337"></a>
+<FONT color="green">338</FONT>    <a name="line.338"></a>
+<FONT color="green">339</FONT>         /** {@inheritDoc} */<a name="line.339"></a>
+<FONT color="green">340</FONT>         public FieldVector&lt;T&gt; mapAddToSelf(T d) {<a name="line.340"></a>
+<FONT color="green">341</FONT>            for (int i = 0; i &lt; virtualSize; i++) {<a name="line.341"></a>
+<FONT color="green">342</FONT>                setEntry(i, getEntry(i).add(d));<a name="line.342"></a>
+<FONT color="green">343</FONT>            }<a name="line.343"></a>
+<FONT color="green">344</FONT>            return this;<a name="line.344"></a>
+<FONT color="green">345</FONT>        }<a name="line.345"></a>
+<FONT color="green">346</FONT>    <a name="line.346"></a>
+<FONT color="green">347</FONT>         /** {@inheritDoc} */<a name="line.347"></a>
+<FONT color="green">348</FONT>         public FieldVector&lt;T&gt; mapDivide(T d) {<a name="line.348"></a>
+<FONT color="green">349</FONT>            return copy().mapDivideToSelf(d);<a name="line.349"></a>
+<FONT color="green">350</FONT>        }<a name="line.350"></a>
+<FONT color="green">351</FONT>    <a name="line.351"></a>
+<FONT color="green">352</FONT>         /** {@inheritDoc} */<a name="line.352"></a>
+<FONT color="green">353</FONT>         public FieldVector&lt;T&gt; mapDivideToSelf(T d) {<a name="line.353"></a>
+<FONT color="green">354</FONT>            OpenIntToFieldHashMap&lt;T&gt;.Iterator iter = entries.iterator();<a name="line.354"></a>
+<FONT color="green">355</FONT>            while (iter.hasNext()) {<a name="line.355"></a>
+<FONT color="green">356</FONT>                iter.advance();<a name="line.356"></a>
+<FONT color="green">357</FONT>                entries.put(iter.key(), iter.value().divide(d));<a name="line.357"></a>
+<FONT color="green">358</FONT>            }<a name="line.358"></a>
+<FONT color="green">359</FONT>            return this;<a name="line.359"></a>
+<FONT color="green">360</FONT>       }<a name="line.360"></a>
+<FONT color="green">361</FONT>    <a name="line.361"></a>
+<FONT color="green">362</FONT>         /** {@inheritDoc} */<a name="line.362"></a>
+<FONT color="green">363</FONT>         public FieldVector&lt;T&gt; mapInv() {<a name="line.363"></a>
+<FONT color="green">364</FONT>            return copy().mapInvToSelf();<a name="line.364"></a>
+<FONT color="green">365</FONT>       }<a name="line.365"></a>
+<FONT color="green">366</FONT>    <a name="line.366"></a>
+<FONT color="green">367</FONT>         /** {@inheritDoc} */<a name="line.367"></a>
+<FONT color="green">368</FONT>         public FieldVector&lt;T&gt; mapInvToSelf() {<a name="line.368"></a>
+<FONT color="green">369</FONT>            for (int i = 0; i &lt; virtualSize; i++) {<a name="line.369"></a>
+<FONT color="green">370</FONT>                setEntry(i, field.getOne().divide(getEntry(i)));<a name="line.370"></a>
+<FONT color="green">371</FONT>            }<a name="line.371"></a>
+<FONT color="green">372</FONT>            return this;<a name="line.372"></a>
+<FONT color="green">373</FONT>       }<a name="line.373"></a>
+<FONT color="green">374</FONT>    <a name="line.374"></a>
+<FONT color="green">375</FONT>         /** {@inheritDoc} */<a name="line.375"></a>
+<FONT color="green">376</FONT>         public FieldVector&lt;T&gt; mapMultiply(T d) {<a name="line.376"></a>
+<FONT color="green">377</FONT>            return copy().mapMultiplyToSelf(d);<a name="line.377"></a>
+<FONT color="green">378</FONT>        }<a name="line.378"></a>
+<FONT color="green">379</FONT>    <a name="line.379"></a>
+<FONT color="green">380</FONT>         /** {@inheritDoc} */<a name="line.380"></a>
+<FONT color="green">381</FONT>         public FieldVector&lt;T&gt; mapMultiplyToSelf(T d) {<a name="line.381"></a>
+<FONT color="green">382</FONT>            OpenIntToFieldHashMap&lt;T&gt;.Iterator iter = entries.iterator();<a name="line.382"></a>
+<FONT color="green">383</FONT>            while (iter.hasNext()) {<a name="line.383"></a>
+<FONT color="green">384</FONT>                iter.advance();<a name="line.384"></a>
+<FONT color="green">385</FONT>                entries.put(iter.key(), iter.value().multiply(d));<a name="line.385"></a>
+<FONT color="green">386</FONT>            }<a name="line.386"></a>
+<FONT color="green">387</FONT>            return this;<a name="line.387"></a>
+<FONT color="green">388</FONT>       }<a name="line.388"></a>
+<FONT color="green">389</FONT>    <a name="line.389"></a>
+<FONT color="green">390</FONT>         /** {@inheritDoc} */<a name="line.390"></a>
+<FONT color="green">391</FONT>         public FieldVector&lt;T&gt; mapSubtract(T d) {<a name="line.391"></a>
+<FONT color="green">392</FONT>            return copy().mapSubtractToSelf(d);<a name="line.392"></a>
+<FONT color="green">393</FONT>        }<a name="line.393"></a>
+<FONT color="green">394</FONT>    <a name="line.394"></a>
+<FONT color="green">395</FONT>         /** {@inheritDoc} */<a name="line.395"></a>
+<FONT color="green">396</FONT>         public FieldVector&lt;T&gt; mapSubtractToSelf(T d) {<a name="line.396"></a>
+<FONT color="green">397</FONT>            return mapAddToSelf(field.getZero().subtract(d));<a name="line.397"></a>
+<FONT color="green">398</FONT>        }<a name="line.398"></a>
+<FONT color="green">399</FONT>    <a name="line.399"></a>
+<FONT color="green">400</FONT>         /**<a name="line.400"></a>
+<FONT color="green">401</FONT>          * Optimized method to compute outer product when both vectors are sparse.<a name="line.401"></a>
+<FONT color="green">402</FONT>          * @param v vector with which outer product should be computed<a name="line.402"></a>
+<FONT color="green">403</FONT>          * @return the square matrix outer product between instance and v<a name="line.403"></a>
+<FONT color="green">404</FONT>          * @throws IllegalArgumentException if v is not the same size as {@code this}<a name="line.404"></a>
+<FONT color="green">405</FONT>          */<a name="line.405"></a>
+<FONT color="green">406</FONT>        public FieldMatrix&lt;T&gt; outerProduct(SparseFieldVector&lt;T&gt; v)<a name="line.406"></a>
+<FONT color="green">407</FONT>                throws IllegalArgumentException {<a name="line.407"></a>
+<FONT color="green">408</FONT>            checkVectorDimensions(v.getDimension());<a name="line.408"></a>
+<FONT color="green">409</FONT>            SparseFieldMatrix&lt;T&gt; res = new SparseFieldMatrix&lt;T&gt;(field, virtualSize, virtualSize);<a name="line.409"></a>
+<FONT color="green">410</FONT>            OpenIntToFieldHashMap&lt;T&gt;.Iterator iter = entries.iterator();<a name="line.410"></a>
+<FONT color="green">411</FONT>            while (iter.hasNext()) {<a name="line.411"></a>
+<FONT color="green">412</FONT>                iter.advance();<a name="line.412"></a>
+<FONT color="green">413</FONT>                OpenIntToFieldHashMap&lt;T&gt;.Iterator iter2 = v.entries.iterator();<a name="line.413"></a>
+<FONT color="green">414</FONT>                while (iter2.hasNext()) {<a name="line.414"></a>
+<FONT color="green">415</FONT>                    iter2.advance();<a name="line.415"></a>
+<FONT color="green">416</FONT>                    res.setEntry(iter.key(), iter2.key(), iter.value().multiply(iter2.value()));<a name="line.416"></a>
+<FONT color="green">417</FONT>                }<a name="line.417"></a>
+<FONT color="green">418</FONT>            }<a name="line.418"></a>
+<FONT color="green">419</FONT>            return res;<a name="line.419"></a>
+<FONT color="green">420</FONT>        }<a name="line.420"></a>
+<FONT color="green">421</FONT>    <a name="line.421"></a>
+<FONT color="green">422</FONT>        /** {@inheritDoc} */<a name="line.422"></a>
+<FONT color="green">423</FONT>        public FieldMatrix&lt;T&gt; outerProduct(T[] v) throws IllegalArgumentException {<a name="line.423"></a>
+<FONT color="green">424</FONT>            checkVectorDimensions(v.length);<a name="line.424"></a>
+<FONT color="green">425</FONT>            FieldMatrix&lt;T&gt; res = new SparseFieldMatrix&lt;T&gt;(field, virtualSize, virtualSize);<a name="line.425"></a>
+<FONT color="green">426</FONT>            OpenIntToFieldHashMap&lt;T&gt;.Iterator iter = entries.iterator();<a name="line.426"></a>
+<FONT color="green">427</FONT>            while (iter.hasNext()) {<a name="line.427"></a>
+<FONT color="green">428</FONT>                iter.advance();<a name="line.428"></a>
+<FONT color="green">429</FONT>                int row = iter.key();<a name="line.429"></a>
+<FONT color="green">430</FONT>                FieldElement&lt;T&gt;value = iter.value();<a name="line.430"></a>
+<FONT color="green">431</FONT>                for (int col = 0; col &lt; virtualSize; col++) {<a name="line.431"></a>
+<FONT color="green">432</FONT>                    res.setEntry(row, col, value.multiply(v[col]));<a name="line.432"></a>
+<FONT color="green">433</FONT>                }<a name="line.433"></a>
+<FONT color="green">434</FONT>            }<a name="line.434"></a>
+<FONT color="green">435</FONT>            return res;<a name="line.435"></a>
+<FONT color="green">436</FONT>         }<a name="line.436"></a>
+<FONT color="green">437</FONT>    <a name="line.437"></a>
+<FONT color="green">438</FONT>        /** {@inheritDoc} */<a name="line.438"></a>
+<FONT color="green">439</FONT>        public FieldMatrix&lt;T&gt; outerProduct(FieldVector&lt;T&gt; v)<a name="line.439"></a>
+<FONT color="green">440</FONT>        throws IllegalArgumentException {<a name="line.440"></a>
+<FONT color="green">441</FONT>            if(v instanceof SparseFieldVector&lt;?&gt;)<a name="line.441"></a>
+<FONT color="green">442</FONT>                return outerProduct((SparseFieldVector&lt;T&gt;)v);<a name="line.442"></a>
+<FONT color="green">443</FONT>            else<a name="line.443"></a>
+<FONT color="green">444</FONT>                return outerProduct(v.toArray());<a name="line.444"></a>
+<FONT color="green">445</FONT>        }<a name="line.445"></a>
+<FONT color="green">446</FONT>    <a name="line.446"></a>
+<FONT color="green">447</FONT>        /** {@inheritDoc} */<a name="line.447"></a>
+<FONT color="green">448</FONT>        public FieldVector&lt;T&gt; projection(FieldVector&lt;T&gt; v)<a name="line.448"></a>
+<FONT color="green">449</FONT>        throws IllegalArgumentException {<a name="line.449"></a>
+<FONT color="green">450</FONT>            checkVectorDimensions(v.getDimension());<a name="line.450"></a>
+<FONT color="green">451</FONT>            return v.mapMultiply(dotProduct(v).divide(v.dotProduct(v)));<a name="line.451"></a>
+<FONT color="green">452</FONT>        }<a name="line.452"></a>
+<FONT color="green">453</FONT>    <a name="line.453"></a>
+<FONT color="green">454</FONT>        /** {@inheritDoc} */<a name="line.454"></a>
+<FONT color="green">455</FONT>        public FieldVector&lt;T&gt; projection(T[] v) throws IllegalArgumentException {<a name="line.455"></a>
+<FONT color="green">456</FONT>            checkVectorDimensions(v.length);<a name="line.456"></a>
+<FONT color="green">457</FONT>            return projection(new SparseFieldVector&lt;T&gt;(field,v));<a name="line.457"></a>
+<FONT color="green">458</FONT>        }<a name="line.458"></a>
+<FONT color="green">459</FONT>    <a name="line.459"></a>
+<FONT color="green">460</FONT>        /** {@inheritDoc} */<a name="line.460"></a>
+<FONT color="green">461</FONT>        public void set(T value) {<a name="line.461"></a>
+<FONT color="green">462</FONT>            for (int i = 0; i &lt; virtualSize; i++) {<a name="line.462"></a>
+<FONT color="green">463</FONT>                setEntry(i, value);<a name="line.463"></a>
+<FONT color="green">464</FONT>            }<a name="line.464"></a>
+<FONT color="green">465</FONT>        }<a name="line.465"></a>
+<FONT color="green">466</FONT>    <a name="line.466"></a>
+<FONT color="green">467</FONT>        /** {@inheritDoc} */<a name="line.467"></a>
+<FONT color="green">468</FONT>        public void setEntry(int index, T value) throws MatrixIndexException {<a name="line.468"></a>
+<FONT color="green">469</FONT>            checkIndex(index);<a name="line.469"></a>
+<FONT color="green">470</FONT>            entries.put(index, value);<a name="line.470"></a>
+<FONT color="green">471</FONT>       }<a name="line.471"></a>
+<FONT color="green">472</FONT>    <a name="line.472"></a>
+<FONT color="green">473</FONT>        /** {@inheritDoc} */<a name="line.473"></a>
+<FONT color="green">474</FONT>        public void setSubVector(int index, FieldVector&lt;T&gt; v)<a name="line.474"></a>
+<FONT color="green">475</FONT>                throws MatrixIndexException {<a name="line.475"></a>
+<FONT color="green">476</FONT>            checkIndex(index);<a name="line.476"></a>
+<FONT color="green">477</FONT>            checkIndex(index + v.getDimension() - 1);<a name="line.477"></a>
+<FONT color="green">478</FONT>            setSubVector(index, v.getData());<a name="line.478"></a>
+<FONT color="green">479</FONT>        }<a name="line.479"></a>
+<FONT color="green">480</FONT>    <a name="line.480"></a>
+<FONT color="green">481</FONT>        /** {@inheritDoc} */<a name="line.481"></a>
+<FONT color="green">482</FONT>        public void setSubVector(int index, T[] v) throws MatrixIndexException {<a name="line.482"></a>
+<FONT color="green">483</FONT>            checkIndex(index);<a name="line.483"></a>
+<FONT color="green">484</FONT>            checkIndex(index + v.length - 1);<a name="line.484"></a>
+<FONT color="green">485</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.485"></a>
+<FONT color="green">486</FONT>                setEntry(i + index, v[i]);<a name="line.486"></a>
+<FONT color="green">487</FONT>            }<a name="line.487"></a>
+<FONT color="green">488</FONT>    <a name="line.488"></a>
+<FONT color="green">489</FONT>        }<a name="line.489"></a>
+<FONT color="green">490</FONT>    <a name="line.490"></a>
+<FONT color="green">491</FONT>        /**<a name="line.491"></a>
+<FONT color="green">492</FONT>         * Optimized method to subtract SparseRealVectors.<a name="line.492"></a>
+<FONT color="green">493</FONT>         * @param v The vector to subtract from &lt;code&gt;this&lt;/code&gt;<a name="line.493"></a>
+<FONT color="green">494</FONT>         * @return The difference of &lt;code&gt;this&lt;/code&gt; and &lt;code&gt;v&lt;/code&gt;<a name="line.494"></a>
+<FONT color="green">495</FONT>         * @throws IllegalArgumentException If the dimensions don't match<a name="line.495"></a>
+<FONT color="green">496</FONT>         */<a name="line.496"></a>
+<FONT color="green">497</FONT>        public SparseFieldVector&lt;T&gt; subtract(SparseFieldVector&lt;T&gt; v) throws IllegalArgumentException{<a name="line.497"></a>
+<FONT color="green">498</FONT>            checkVectorDimensions(v.getDimension());<a name="line.498"></a>
+<FONT color="green">499</FONT>            SparseFieldVector&lt;T&gt; res = (SparseFieldVector&lt;T&gt;)copy();<a name="line.499"></a>
+<FONT color="green">500</FONT>            OpenIntToFieldHashMap&lt;T&gt;.Iterator iter = v.getEntries().iterator();<a name="line.500"></a>
+<FONT color="green">501</FONT>            while (iter.hasNext()) {<a name="line.501"></a>
+<FONT color="green">502</FONT>                iter.advance();<a name="line.502"></a>
+<FONT color="green">503</FONT>                int key = iter.key();<a name="line.503"></a>
+<FONT color="green">504</FONT>                if (entries.containsKey(key)) {<a name="line.504"></a>
+<FONT color="green">505</FONT>                    res.setEntry(key, entries.get(key).subtract(iter.value()));<a name="line.505"></a>
+<FONT color="green">506</FONT>                } else {<a name="line.506"></a>
+<FONT color="green">507</FONT>                    res.setEntry(key, field.getZero().subtract(iter.value()));<a name="line.507"></a>
+<FONT color="green">508</FONT>                }<a name="line.508"></a>
+<FONT color="green">509</FONT>            }<a name="line.509"></a>
+<FONT color="green">510</FONT>            return res;<a name="line.510"></a>
+<FONT color="green">511</FONT>        }<a name="line.511"></a>
+<FONT color="green">512</FONT>    <a name="line.512"></a>
+<FONT color="green">513</FONT>        /** {@inheritDoc} */<a name="line.513"></a>
+<FONT color="green">514</FONT>        public FieldVector&lt;T&gt; subtract(FieldVector&lt;T&gt; v)<a name="line.514"></a>
+<FONT color="green">515</FONT>               throws IllegalArgumentException {<a name="line.515"></a>
+<FONT color="green">516</FONT>            if(v instanceof SparseFieldVector&lt;?&gt;)<a name="line.516"></a>
+<FONT color="green">517</FONT>                return subtract((SparseFieldVector&lt;T&gt;)v);<a name="line.517"></a>
+<FONT color="green">518</FONT>            else<a name="line.518"></a>
+<FONT color="green">519</FONT>                return subtract(v.toArray());<a name="line.519"></a>
+<FONT color="green">520</FONT>        }<a name="line.520"></a>
+<FONT color="green">521</FONT>    <a name="line.521"></a>
+<FONT color="green">522</FONT>        /** {@inheritDoc} */<a name="line.522"></a>
+<FONT color="green">523</FONT>        public FieldVector&lt;T&gt; subtract(T[] v) throws IllegalArgumentException {<a name="line.523"></a>
+<FONT color="green">524</FONT>            checkVectorDimensions(v.length);<a name="line.524"></a>
+<FONT color="green">525</FONT>            SparseFieldVector&lt;T&gt; res = new SparseFieldVector&lt;T&gt;(this);<a name="line.525"></a>
+<FONT color="green">526</FONT>            for (int i = 0; i &lt; v.length; i++) {<a name="line.526"></a>
+<FONT color="green">527</FONT>                if (entries.containsKey(i)) {<a name="line.527"></a>
+<FONT color="green">528</FONT>                    res.setEntry(i, entries.get(i).subtract(v[i]));<a name="line.528"></a>
+<FONT color="green">529</FONT>                } else {<a name="line.529"></a>
+<FONT color="green">530</FONT>                    res.setEntry(i, field.getZero().subtract(v[i]));<a name="line.530"></a>
+<FONT color="green">531</FONT>                }<a name="line.531"></a>
+<FONT color="green">532</FONT>            }<a name="line.532"></a>
+<FONT color="green">533</FONT>            return res;<a name="line.533"></a>
+<FONT color="green">534</FONT>        }<a name="line.534"></a>
+<FONT color="green">535</FONT>    <a name="line.535"></a>
+<FONT color="green">536</FONT>        /** {@inheritDoc} */<a name="line.536"></a>
+<FONT color="green">537</FONT>        public T[] toArray() {<a name="line.537"></a>
+<FONT color="green">538</FONT>            return getData();<a name="line.538"></a>
+<FONT color="green">539</FONT>        }<a name="line.539"></a>
+<FONT color="green">540</FONT>    <a name="line.540"></a>
+<FONT color="green">541</FONT>        /**<a name="line.541"></a>
+<FONT color="green">542</FONT>         * Check if an index is valid.<a name="line.542"></a>
+<FONT color="green">543</FONT>         *<a name="line.543"></a>
+<FONT color="green">544</FONT>         * @param index<a name="line.544"></a>
+<FONT color="green">545</FONT>         *            index to check<a name="line.545"></a>
+<FONT color="green">546</FONT>         * @exception MatrixIndexException<a name="line.546"></a>
+<FONT color="green">547</FONT>         *                if index is not valid<a name="line.547"></a>
+<FONT color="green">548</FONT>         */<a name="line.548"></a>
+<FONT color="green">549</FONT>        private void checkIndex(final int index) throws MatrixIndexException {<a name="line.549"></a>
+<FONT color="green">550</FONT>            if (index &lt; 0 || index &gt;= getDimension()) {<a name="line.550"></a>
+<FONT color="green">551</FONT>                throw new MatrixIndexException(<a name="line.551"></a>
+<FONT color="green">552</FONT>                        "index {0} out of allowed range [{1}, {2}]",<a name="line.552"></a>
+<FONT color="green">553</FONT>                        index, 0, getDimension() - 1);<a name="line.553"></a>
+<FONT color="green">554</FONT>            }<a name="line.554"></a>
+<FONT color="green">555</FONT>        }<a name="line.555"></a>
+<FONT color="green">556</FONT>    <a name="line.556"></a>
+<FONT color="green">557</FONT>        /**<a name="line.557"></a>
+<FONT color="green">558</FONT>         * Check if instance dimension is equal to some expected value.<a name="line.558"></a>
+<FONT color="green">559</FONT>         *<a name="line.559"></a>
+<FONT color="green">560</FONT>         * @param n<a name="line.560"></a>
+<FONT color="green">561</FONT>         *            expected dimension.<a name="line.561"></a>
+<FONT color="green">562</FONT>         * @exception IllegalArgumentException<a name="line.562"></a>
+<FONT color="green">563</FONT>         *                if the dimension is inconsistent with vector size<a name="line.563"></a>
+<FONT color="green">564</FONT>         */<a name="line.564"></a>
+<FONT color="green">565</FONT>        protected void checkVectorDimensions(int n) throws IllegalArgumentException {<a name="line.565"></a>
+<FONT color="green">566</FONT>            if (getDimension() != n) {<a name="line.566"></a>
+<FONT color="green">567</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.567"></a>
+<FONT color="green">568</FONT>                        "vector length mismatch: got {0} but expected {1}",<a name="line.568"></a>
+<FONT color="green">569</FONT>                        getDimension(), n);<a name="line.569"></a>
+<FONT color="green">570</FONT>            }<a name="line.570"></a>
+<FONT color="green">571</FONT>        }<a name="line.571"></a>
+<FONT color="green">572</FONT>    <a name="line.572"></a>
+<FONT color="green">573</FONT>    <a name="line.573"></a>
+<FONT color="green">574</FONT>        /** {@inheritDoc} */<a name="line.574"></a>
+<FONT color="green">575</FONT>        public FieldVector&lt;T&gt; add(FieldVector&lt;T&gt; v) throws IllegalArgumentException {<a name="line.575"></a>
+<FONT color="green">576</FONT>            if (v instanceof SparseFieldVector&lt;?&gt;) {<a name="line.576"></a>
+<FONT color="green">577</FONT>                return add((SparseFieldVector&lt;T&gt;)v);<a name="line.577"></a>
+<FONT color="green">578</FONT>            } else {<a name="line.578"></a>
+<FONT color="green">579</FONT>                return add(v.toArray());<a name="line.579"></a>
+<FONT color="green">580</FONT>            }<a name="line.580"></a>
+<FONT color="green">581</FONT>        }<a name="line.581"></a>
+<FONT color="green">582</FONT>    <a name="line.582"></a>
+<FONT color="green">583</FONT>        /** Build an array of elements.<a name="line.583"></a>
+<FONT color="green">584</FONT>         * @param length size of the array to build<a name="line.584"></a>
+<FONT color="green">585</FONT>         * @return a new array<a name="line.585"></a>
+<FONT color="green">586</FONT>         */<a name="line.586"></a>
+<FONT color="green">587</FONT>        @SuppressWarnings("unchecked") // field is type T<a name="line.587"></a>
+<FONT color="green">588</FONT>        private T[] buildArray(final int length) {<a name="line.588"></a>
+<FONT color="green">589</FONT>            return (T[]) Array.newInstance(field.getZero().getClass(), length);<a name="line.589"></a>
+<FONT color="green">590</FONT>        }<a name="line.590"></a>
+<FONT color="green">591</FONT>    <a name="line.591"></a>
+<FONT color="green">592</FONT>    <a name="line.592"></a>
+<FONT color="green">593</FONT>        /** {@inheritDoc} */<a name="line.593"></a>
+<FONT color="green">594</FONT>        @Override<a name="line.594"></a>
+<FONT color="green">595</FONT>        public int hashCode() {<a name="line.595"></a>
+<FONT color="green">596</FONT>            final int prime = 31;<a name="line.596"></a>
+<FONT color="green">597</FONT>            int result = 1;<a name="line.597"></a>
+<FONT color="green">598</FONT>            result = prime * result + ((field == null) ? 0 : field.hashCode());<a name="line.598"></a>
+<FONT color="green">599</FONT>            result = prime * result + virtualSize;<a name="line.599"></a>
+<FONT color="green">600</FONT>            OpenIntToFieldHashMap&lt;T&gt;.Iterator iter = entries.iterator();<a name="line.600"></a>
+<FONT color="green">601</FONT>            while (iter.hasNext()) {<a name="line.601"></a>
+<FONT color="green">602</FONT>                iter.advance();<a name="line.602"></a>
+<FONT color="green">603</FONT>                int temp = iter.value().hashCode();<a name="line.603"></a>
+<FONT color="green">604</FONT>                result = prime * result + temp;<a name="line.604"></a>
+<FONT color="green">605</FONT>            }<a name="line.605"></a>
+<FONT color="green">606</FONT>            return result;<a name="line.606"></a>
+<FONT color="green">607</FONT>        }<a name="line.607"></a>
+<FONT color="green">608</FONT>    <a name="line.608"></a>
+<FONT color="green">609</FONT>    <a name="line.609"></a>
+<FONT color="green">610</FONT>        /** {@inheritDoc} */<a name="line.610"></a>
+<FONT color="green">611</FONT>        @Override<a name="line.611"></a>
+<FONT color="green">612</FONT>        public boolean equals(Object obj) {<a name="line.612"></a>
+<FONT color="green">613</FONT>    <a name="line.613"></a>
+<FONT color="green">614</FONT>            if (this == obj) {<a name="line.614"></a>
+<FONT color="green">615</FONT>                return true;<a name="line.615"></a>
+<FONT color="green">616</FONT>            }<a name="line.616"></a>
+<FONT color="green">617</FONT>    <a name="line.617"></a>
+<FONT color="green">618</FONT>            if (!(obj instanceof SparseFieldVector&lt;?&gt;)) {<a name="line.618"></a>
+<FONT color="green">619</FONT>                return false;<a name="line.619"></a>
+<FONT color="green">620</FONT>            }<a name="line.620"></a>
+<FONT color="green">621</FONT>    <a name="line.621"></a>
+<FONT color="green">622</FONT>            @SuppressWarnings("unchecked") // OK, because "else if" check below ensures that<a name="line.622"></a>
+<FONT color="green">623</FONT>                                           // other must be the same type as this<a name="line.623"></a>
+<FONT color="green">624</FONT>            SparseFieldVector&lt;T&gt; other = (SparseFieldVector&lt;T&gt;) obj;<a name="line.624"></a>
+<FONT color="green">625</FONT>            if (field == null) {<a name="line.625"></a>
+<FONT color="green">626</FONT>                if (other.field != null) {<a name="line.626"></a>
+<FONT color="green">627</FONT>                    return false;<a name="line.627"></a>
+<FONT color="green">628</FONT>                }<a name="line.628"></a>
+<FONT color="green">629</FONT>            } else if (!field.equals(other.field)) {<a name="line.629"></a>
+<FONT color="green">630</FONT>                return false;<a name="line.630"></a>
+<FONT color="green">631</FONT>            }<a name="line.631"></a>
+<FONT color="green">632</FONT>            if (virtualSize != other.virtualSize) {<a name="line.632"></a>
+<FONT color="green">633</FONT>                return false;<a name="line.633"></a>
+<FONT color="green">634</FONT>            }<a name="line.634"></a>
+<FONT color="green">635</FONT>    <a name="line.635"></a>
+<FONT color="green">636</FONT>            OpenIntToFieldHashMap&lt;T&gt;.Iterator iter = entries.iterator();<a name="line.636"></a>
+<FONT color="green">637</FONT>            while (iter.hasNext()) {<a name="line.637"></a>
+<FONT color="green">638</FONT>                iter.advance();<a name="line.638"></a>
+<FONT color="green">639</FONT>                T test = other.getEntry(iter.key());<a name="line.639"></a>
+<FONT color="green">640</FONT>                if (!test.equals(iter.value())) {<a name="line.640"></a>
+<FONT color="green">641</FONT>                    return false;<a name="line.641"></a>
+<FONT color="green">642</FONT>                }<a name="line.642"></a>
+<FONT color="green">643</FONT>            }<a name="line.643"></a>
+<FONT color="green">644</FONT>            iter = other.getEntries().iterator();<a name="line.644"></a>
+<FONT color="green">645</FONT>            while (iter.hasNext()) {<a name="line.645"></a>
+<FONT color="green">646</FONT>                iter.advance();<a name="line.646"></a>
+<FONT color="green">647</FONT>                T test = iter.value();<a name="line.647"></a>
+<FONT color="green">648</FONT>                if (!test.equals(getEntry(iter.key()))) {<a name="line.648"></a>
+<FONT color="green">649</FONT>                    return false;<a name="line.649"></a>
+<FONT color="green">650</FONT>                }<a name="line.650"></a>
+<FONT color="green">651</FONT>            }<a name="line.651"></a>
+<FONT color="green">652</FONT>            return true;<a name="line.652"></a>
+<FONT color="green">653</FONT>        }<a name="line.653"></a>
+<FONT color="green">654</FONT>    <a name="line.654"></a>
+<FONT color="green">655</FONT>    <a name="line.655"></a>
+<FONT color="green">656</FONT>    <a name="line.656"></a>
+<FONT color="green">657</FONT>    }<a name="line.657"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/SparseRealMatrix.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,95 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Marker interface for {@link RealMatrix} implementations that require sparse backing storage<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @since 2.0<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public interface SparseRealMatrix extends RealMatrix {<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>    }<a name="line.29"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/linear/SparseRealVector.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,93 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.linear;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Marker interface for RealVectors that require sparse backing storage<a name="line.20"></a>
+<FONT color="green">021</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.21"></a>
+<FONT color="green">022</FONT>     * @since 2.0<a name="line.22"></a>
+<FONT color="green">023</FONT>     *<a name="line.23"></a>
+<FONT color="green">024</FONT>     */<a name="line.24"></a>
+<FONT color="green">025</FONT>    public interface SparseRealVector extends RealVector {<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    }<a name="line.27"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/AbstractIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,342 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.ArrayList;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.Collection;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.util.Collections;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.MaxEvaluationsExceededException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.ode.events.CombinedEventsManager;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.ode.events.EventHandler;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.ode.events.EventState;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.ode.sampling.StepHandler;<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>    /**<a name="line.30"></a>
+<FONT color="green">031</FONT>     * Base class managing common boilerplate for all integrators.<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.32"></a>
+<FONT color="green">033</FONT>     * @since 2.0<a name="line.33"></a>
+<FONT color="green">034</FONT>     */<a name="line.34"></a>
+<FONT color="green">035</FONT>    public abstract class AbstractIntegrator implements FirstOrderIntegrator {<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /** Step handler. */<a name="line.37"></a>
+<FONT color="green">038</FONT>        protected Collection&lt;StepHandler&gt; stepHandlers;<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Current step start time. */<a name="line.40"></a>
+<FONT color="green">041</FONT>        protected double stepStart;<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** Current stepsize. */<a name="line.43"></a>
+<FONT color="green">044</FONT>        protected double stepSize;<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** Events handlers manager. */<a name="line.46"></a>
+<FONT color="green">047</FONT>        protected CombinedEventsManager eventsHandlersManager;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** Name of the method. */<a name="line.49"></a>
+<FONT color="green">050</FONT>        private final String name;<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /** Maximal number of evaluations allowed. */<a name="line.52"></a>
+<FONT color="green">053</FONT>        private int maxEvaluations;<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** Number of evaluations already performed. */<a name="line.55"></a>
+<FONT color="green">056</FONT>        private int evaluations;<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /** Differential equations to integrate. */<a name="line.58"></a>
+<FONT color="green">059</FONT>        private transient FirstOrderDifferentialEquations equations;<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /** Build an instance.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param name name of the method<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public AbstractIntegrator(final String name) {<a name="line.64"></a>
+<FONT color="green">065</FONT>            this.name = name;<a name="line.65"></a>
+<FONT color="green">066</FONT>            stepHandlers = new ArrayList&lt;StepHandler&gt;();<a name="line.66"></a>
+<FONT color="green">067</FONT>            stepStart = Double.NaN;<a name="line.67"></a>
+<FONT color="green">068</FONT>            stepSize  = Double.NaN;<a name="line.68"></a>
+<FONT color="green">069</FONT>            eventsHandlersManager = new CombinedEventsManager();<a name="line.69"></a>
+<FONT color="green">070</FONT>            setMaxEvaluations(-1);<a name="line.70"></a>
+<FONT color="green">071</FONT>            resetEvaluations();<a name="line.71"></a>
+<FONT color="green">072</FONT>        }<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /** Build an instance with a null name.<a name="line.74"></a>
+<FONT color="green">075</FONT>         */<a name="line.75"></a>
+<FONT color="green">076</FONT>        protected AbstractIntegrator() {<a name="line.76"></a>
+<FONT color="green">077</FONT>            this(null);<a name="line.77"></a>
+<FONT color="green">078</FONT>        }<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /** {@inheritDoc} */<a name="line.80"></a>
+<FONT color="green">081</FONT>        public String getName() {<a name="line.81"></a>
+<FONT color="green">082</FONT>            return name;<a name="line.82"></a>
+<FONT color="green">083</FONT>        }<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>        /** {@inheritDoc} */<a name="line.85"></a>
+<FONT color="green">086</FONT>        public void addStepHandler(final StepHandler handler) {<a name="line.86"></a>
+<FONT color="green">087</FONT>            stepHandlers.add(handler);<a name="line.87"></a>
+<FONT color="green">088</FONT>        }<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>        /** {@inheritDoc} */<a name="line.90"></a>
+<FONT color="green">091</FONT>        public Collection&lt;StepHandler&gt; getStepHandlers() {<a name="line.91"></a>
+<FONT color="green">092</FONT>            return Collections.unmodifiableCollection(stepHandlers);<a name="line.92"></a>
+<FONT color="green">093</FONT>        }<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /** {@inheritDoc} */<a name="line.95"></a>
+<FONT color="green">096</FONT>        public void clearStepHandlers() {<a name="line.96"></a>
+<FONT color="green">097</FONT>            stepHandlers.clear();<a name="line.97"></a>
+<FONT color="green">098</FONT>        }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>        /** {@inheritDoc} */<a name="line.100"></a>
+<FONT color="green">101</FONT>        public void addEventHandler(final EventHandler function,<a name="line.101"></a>
+<FONT color="green">102</FONT>                                    final double maxCheckInterval,<a name="line.102"></a>
+<FONT color="green">103</FONT>                                    final double convergence,<a name="line.103"></a>
+<FONT color="green">104</FONT>                                    final int maxIterationCount) {<a name="line.104"></a>
+<FONT color="green">105</FONT>            eventsHandlersManager.addEventHandler(function, maxCheckInterval,<a name="line.105"></a>
+<FONT color="green">106</FONT>                                                  convergence, maxIterationCount);<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /** {@inheritDoc} */<a name="line.109"></a>
+<FONT color="green">110</FONT>        public Collection&lt;EventHandler&gt; getEventHandlers() {<a name="line.110"></a>
+<FONT color="green">111</FONT>            return eventsHandlersManager.getEventsHandlers();<a name="line.111"></a>
+<FONT color="green">112</FONT>        }<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /** {@inheritDoc} */<a name="line.114"></a>
+<FONT color="green">115</FONT>        public void clearEventHandlers() {<a name="line.115"></a>
+<FONT color="green">116</FONT>            eventsHandlersManager.clearEventsHandlers();<a name="line.116"></a>
+<FONT color="green">117</FONT>        }<a name="line.117"></a>
+<FONT color="green">118</FONT>    <a name="line.118"></a>
+<FONT color="green">119</FONT>        /** Check if one of the step handlers requires dense output.<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @return true if one of the step handlers requires dense output<a name="line.120"></a>
+<FONT color="green">121</FONT>         */<a name="line.121"></a>
+<FONT color="green">122</FONT>        protected boolean requiresDenseOutput() {<a name="line.122"></a>
+<FONT color="green">123</FONT>            for (StepHandler handler : stepHandlers) {<a name="line.123"></a>
+<FONT color="green">124</FONT>                if (handler.requiresDenseOutput()) {<a name="line.124"></a>
+<FONT color="green">125</FONT>                    return true;<a name="line.125"></a>
+<FONT color="green">126</FONT>                }<a name="line.126"></a>
+<FONT color="green">127</FONT>            }<a name="line.127"></a>
+<FONT color="green">128</FONT>            return false;<a name="line.128"></a>
+<FONT color="green">129</FONT>        }<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>        /** {@inheritDoc} */<a name="line.131"></a>
+<FONT color="green">132</FONT>        public double getCurrentStepStart() {<a name="line.132"></a>
+<FONT color="green">133</FONT>            return stepStart;<a name="line.133"></a>
+<FONT color="green">134</FONT>        }<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>        /** {@inheritDoc} */<a name="line.136"></a>
+<FONT color="green">137</FONT>        public double getCurrentSignedStepsize() {<a name="line.137"></a>
+<FONT color="green">138</FONT>            return stepSize;<a name="line.138"></a>
+<FONT color="green">139</FONT>        }<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>        /** {@inheritDoc} */<a name="line.141"></a>
+<FONT color="green">142</FONT>        public void setMaxEvaluations(int maxEvaluations) {<a name="line.142"></a>
+<FONT color="green">143</FONT>            this.maxEvaluations = (maxEvaluations &lt; 0) ? Integer.MAX_VALUE : maxEvaluations;<a name="line.143"></a>
+<FONT color="green">144</FONT>        }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>        /** {@inheritDoc} */<a name="line.146"></a>
+<FONT color="green">147</FONT>        public int getMaxEvaluations() {<a name="line.147"></a>
+<FONT color="green">148</FONT>            return maxEvaluations;<a name="line.148"></a>
+<FONT color="green">149</FONT>        }<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>        /** {@inheritDoc} */<a name="line.151"></a>
+<FONT color="green">152</FONT>        public int getEvaluations() {<a name="line.152"></a>
+<FONT color="green">153</FONT>            return evaluations;<a name="line.153"></a>
+<FONT color="green">154</FONT>        }<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>        /** Reset the number of evaluations to zero.<a name="line.156"></a>
+<FONT color="green">157</FONT>         */<a name="line.157"></a>
+<FONT color="green">158</FONT>        protected void resetEvaluations() {<a name="line.158"></a>
+<FONT color="green">159</FONT>            evaluations = 0;<a name="line.159"></a>
+<FONT color="green">160</FONT>        }<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>        /** Set the differential equations.<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @param equations differential equations to integrate<a name="line.163"></a>
+<FONT color="green">164</FONT>         * @see #computeDerivatives(double, double[], double[])<a name="line.164"></a>
+<FONT color="green">165</FONT>         */<a name="line.165"></a>
+<FONT color="green">166</FONT>        protected void setEquations(final FirstOrderDifferentialEquations equations) {<a name="line.166"></a>
+<FONT color="green">167</FONT>            this.equations = equations;<a name="line.167"></a>
+<FONT color="green">168</FONT>        }<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>        /** Compute the derivatives and check the number of evaluations.<a name="line.170"></a>
+<FONT color="green">171</FONT>         * @param t current value of the independent &lt;I&gt;time&lt;/I&gt; variable<a name="line.171"></a>
+<FONT color="green">172</FONT>         * @param y array containing the current value of the state vector<a name="line.172"></a>
+<FONT color="green">173</FONT>         * @param yDot placeholder array where to put the time derivative of the state vector<a name="line.173"></a>
+<FONT color="green">174</FONT>         * @throws DerivativeException this exception is propagated to the caller if the<a name="line.174"></a>
+<FONT color="green">175</FONT>         * underlying user function triggers one<a name="line.175"></a>
+<FONT color="green">176</FONT>         */<a name="line.176"></a>
+<FONT color="green">177</FONT>        public void computeDerivatives(final double t, final double[] y, final double[] yDot)<a name="line.177"></a>
+<FONT color="green">178</FONT>            throws DerivativeException {<a name="line.178"></a>
+<FONT color="green">179</FONT>            if (++evaluations &gt; maxEvaluations) {<a name="line.179"></a>
+<FONT color="green">180</FONT>                throw new DerivativeException(new MaxEvaluationsExceededException(maxEvaluations));<a name="line.180"></a>
+<FONT color="green">181</FONT>            }<a name="line.181"></a>
+<FONT color="green">182</FONT>            equations.computeDerivatives(t, y, yDot);<a name="line.182"></a>
+<FONT color="green">183</FONT>        }<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>        /** Perform some sanity checks on the integration parameters.<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @param ode differential equations set<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @param t0 start time<a name="line.187"></a>
+<FONT color="green">188</FONT>         * @param y0 state vector at t0<a name="line.188"></a>
+<FONT color="green">189</FONT>         * @param t target time for the integration<a name="line.189"></a>
+<FONT color="green">190</FONT>         * @param y placeholder where to put the state vector<a name="line.190"></a>
+<FONT color="green">191</FONT>         * @exception IntegratorException if some inconsistency is detected<a name="line.191"></a>
+<FONT color="green">192</FONT>         */<a name="line.192"></a>
+<FONT color="green">193</FONT>        protected void sanityChecks(final FirstOrderDifferentialEquations ode,<a name="line.193"></a>
+<FONT color="green">194</FONT>                                    final double t0, final double[] y0,<a name="line.194"></a>
+<FONT color="green">195</FONT>                                    final double t, final double[] y)<a name="line.195"></a>
+<FONT color="green">196</FONT>            throws IntegratorException {<a name="line.196"></a>
+<FONT color="green">197</FONT>    <a name="line.197"></a>
+<FONT color="green">198</FONT>            if (ode.getDimension() != y0.length) {<a name="line.198"></a>
+<FONT color="green">199</FONT>                throw new IntegratorException(<a name="line.199"></a>
+<FONT color="green">200</FONT>                        "dimensions mismatch: ODE problem has dimension {0}," +<a name="line.200"></a>
+<FONT color="green">201</FONT>                        " initial state vector has dimension {1}",<a name="line.201"></a>
+<FONT color="green">202</FONT>                        ode.getDimension(), y0.length);<a name="line.202"></a>
+<FONT color="green">203</FONT>            }<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>            if (ode.getDimension() != y.length) {<a name="line.205"></a>
+<FONT color="green">206</FONT>                throw new IntegratorException(<a name="line.206"></a>
+<FONT color="green">207</FONT>                        "dimensions mismatch: ODE problem has dimension {0}," +<a name="line.207"></a>
+<FONT color="green">208</FONT>                        " final state vector has dimension {1}",<a name="line.208"></a>
+<FONT color="green">209</FONT>                        ode.getDimension(), y.length);<a name="line.209"></a>
+<FONT color="green">210</FONT>            }<a name="line.210"></a>
+<FONT color="green">211</FONT>    <a name="line.211"></a>
+<FONT color="green">212</FONT>            if (Math.abs(t - t0) &lt;= 1.0e-12 * Math.max(Math.abs(t0), Math.abs(t))) {<a name="line.212"></a>
+<FONT color="green">213</FONT>                throw new IntegratorException(<a name="line.213"></a>
+<FONT color="green">214</FONT>                        "too small integration interval: length = {0}",<a name="line.214"></a>
+<FONT color="green">215</FONT>                        Math.abs(t - t0));<a name="line.215"></a>
+<FONT color="green">216</FONT>            }<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>        }<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>        /** Add an event handler for end time checking.<a name="line.220"></a>
+<FONT color="green">221</FONT>         * &lt;p&gt;This method can be used to simplify handling of integration end time.<a name="line.221"></a>
+<FONT color="green">222</FONT>         * It leverages the nominal stop condition with the exceptional stop<a name="line.222"></a>
+<FONT color="green">223</FONT>         * conditions.&lt;/p&gt;<a name="line.223"></a>
+<FONT color="green">224</FONT>         * @param startTime integration start time<a name="line.224"></a>
+<FONT color="green">225</FONT>         * @param endTime desired end time<a name="line.225"></a>
+<FONT color="green">226</FONT>         * @param manager manager containing the user-defined handlers<a name="line.226"></a>
+<FONT color="green">227</FONT>         * @return a new manager containing all the user-defined handlers plus a<a name="line.227"></a>
+<FONT color="green">228</FONT>         * dedicated manager triggering a stop event at entTime<a name="line.228"></a>
+<FONT color="green">229</FONT>         */<a name="line.229"></a>
+<FONT color="green">230</FONT>        protected CombinedEventsManager addEndTimeChecker(final double startTime,<a name="line.230"></a>
+<FONT color="green">231</FONT>                                                          final double endTime,<a name="line.231"></a>
+<FONT color="green">232</FONT>                                                          final CombinedEventsManager manager) {<a name="line.232"></a>
+<FONT color="green">233</FONT>            CombinedEventsManager newManager = new CombinedEventsManager();<a name="line.233"></a>
+<FONT color="green">234</FONT>            for (final EventState state : manager.getEventsStates()) {<a name="line.234"></a>
+<FONT color="green">235</FONT>                newManager.addEventHandler(state.getEventHandler(),<a name="line.235"></a>
+<FONT color="green">236</FONT>                                           state.getMaxCheckInterval(),<a name="line.236"></a>
+<FONT color="green">237</FONT>                                           state.getConvergence(),<a name="line.237"></a>
+<FONT color="green">238</FONT>                                           state.getMaxIterationCount());<a name="line.238"></a>
+<FONT color="green">239</FONT>            }<a name="line.239"></a>
+<FONT color="green">240</FONT>            newManager.addEventHandler(new EndTimeChecker(endTime),<a name="line.240"></a>
+<FONT color="green">241</FONT>                                       Double.POSITIVE_INFINITY,<a name="line.241"></a>
+<FONT color="green">242</FONT>                                       Math.ulp(Math.max(Math.abs(startTime), Math.abs(endTime))),<a name="line.242"></a>
+<FONT color="green">243</FONT>                                       100);<a name="line.243"></a>
+<FONT color="green">244</FONT>            return newManager;<a name="line.244"></a>
+<FONT color="green">245</FONT>        }<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>        /** Specialized event handler to stop integration. */<a name="line.247"></a>
+<FONT color="green">248</FONT>        private static class EndTimeChecker implements EventHandler {<a name="line.248"></a>
+<FONT color="green">249</FONT>    <a name="line.249"></a>
+<FONT color="green">250</FONT>            /** Desired end time. */<a name="line.250"></a>
+<FONT color="green">251</FONT>            private final double endTime;<a name="line.251"></a>
+<FONT color="green">252</FONT>    <a name="line.252"></a>
+<FONT color="green">253</FONT>            /** Build an instance.<a name="line.253"></a>
+<FONT color="green">254</FONT>             * @param endTime desired time<a name="line.254"></a>
+<FONT color="green">255</FONT>             */<a name="line.255"></a>
+<FONT color="green">256</FONT>            public EndTimeChecker(final double endTime) {<a name="line.256"></a>
+<FONT color="green">257</FONT>                this.endTime = endTime;<a name="line.257"></a>
+<FONT color="green">258</FONT>            }<a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>            /** {@inheritDoc} */<a name="line.260"></a>
+<FONT color="green">261</FONT>            public int eventOccurred(double t, double[] y, boolean increasing) {<a name="line.261"></a>
+<FONT color="green">262</FONT>                return STOP;<a name="line.262"></a>
+<FONT color="green">263</FONT>            }<a name="line.263"></a>
+<FONT color="green">264</FONT>    <a name="line.264"></a>
+<FONT color="green">265</FONT>            /** {@inheritDoc} */<a name="line.265"></a>
+<FONT color="green">266</FONT>            public double g(double t, double[] y) {<a name="line.266"></a>
+<FONT color="green">267</FONT>                return t - endTime;<a name="line.267"></a>
+<FONT color="green">268</FONT>            }<a name="line.268"></a>
+<FONT color="green">269</FONT>    <a name="line.269"></a>
+<FONT color="green">270</FONT>            /** {@inheritDoc} */<a name="line.270"></a>
+<FONT color="green">271</FONT>            public void resetState(double t, double[] y) {<a name="line.271"></a>
+<FONT color="green">272</FONT>            }<a name="line.272"></a>
+<FONT color="green">273</FONT>    <a name="line.273"></a>
+<FONT color="green">274</FONT>        }<a name="line.274"></a>
+<FONT color="green">275</FONT>    <a name="line.275"></a>
+<FONT color="green">276</FONT>    }<a name="line.276"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/ContinuousOutputModel.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,442 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.ArrayList;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.List;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.io.Serializable;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.ode.sampling.StepHandler;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.ode.sampling.StepInterpolator;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    /**<a name="line.28"></a>
+<FONT color="green">029</FONT>     * This class stores all information provided by an ODE integrator<a name="line.29"></a>
+<FONT color="green">030</FONT>     * during the integration process and build a continuous model of the<a name="line.30"></a>
+<FONT color="green">031</FONT>     * solution from this.<a name="line.31"></a>
+<FONT color="green">032</FONT>     *<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;p&gt;This class act as a step handler from the integrator point of<a name="line.33"></a>
+<FONT color="green">034</FONT>     * view. It is called iteratively during the integration process and<a name="line.34"></a>
+<FONT color="green">035</FONT>     * stores a copy of all steps information in a sorted collection for<a name="line.35"></a>
+<FONT color="green">036</FONT>     * later use. Once the integration process is over, the user can use<a name="line.36"></a>
+<FONT color="green">037</FONT>     * the {@link #setInterpolatedTime setInterpolatedTime} and {@link<a name="line.37"></a>
+<FONT color="green">038</FONT>     * #getInterpolatedState getInterpolatedState} to retrieve this<a name="line.38"></a>
+<FONT color="green">039</FONT>     * information at any time. It is important to wait for the<a name="line.39"></a>
+<FONT color="green">040</FONT>     * integration to be over before attempting to call {@link<a name="line.40"></a>
+<FONT color="green">041</FONT>     * #setInterpolatedTime setInterpolatedTime} because some internal<a name="line.41"></a>
+<FONT color="green">042</FONT>     * variables are set only once the last step has been handled.&lt;/p&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     *<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;p&gt;This is useful for example if the main loop of the user<a name="line.44"></a>
+<FONT color="green">045</FONT>     * application should remain independent from the integration process<a name="line.45"></a>
+<FONT color="green">046</FONT>     * or if one needs to mimic the behaviour of an analytical model<a name="line.46"></a>
+<FONT color="green">047</FONT>     * despite a numerical model is used (i.e. one needs the ability to<a name="line.47"></a>
+<FONT color="green">048</FONT>     * get the model value at any time or to navigate through the<a name="line.48"></a>
+<FONT color="green">049</FONT>     * data).&lt;/p&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     *<a name="line.50"></a>
+<FONT color="green">051</FONT>     * &lt;p&gt;If problem modeling is done with several separate<a name="line.51"></a>
+<FONT color="green">052</FONT>     * integration phases for contiguous intervals, the same<a name="line.52"></a>
+<FONT color="green">053</FONT>     * ContinuousOutputModel can be used as step handler for all<a name="line.53"></a>
+<FONT color="green">054</FONT>     * integration phases as long as they are performed in order and in<a name="line.54"></a>
+<FONT color="green">055</FONT>     * the same direction. As an example, one can extrapolate the<a name="line.55"></a>
+<FONT color="green">056</FONT>     * trajectory of a satellite with one model (i.e. one set of<a name="line.56"></a>
+<FONT color="green">057</FONT>     * differential equations) up to the beginning of a maneuver, use<a name="line.57"></a>
+<FONT color="green">058</FONT>     * another more complex model including thrusters modeling and<a name="line.58"></a>
+<FONT color="green">059</FONT>     * accurate attitude control during the maneuver, and revert to the<a name="line.59"></a>
+<FONT color="green">060</FONT>     * first model after the end of the maneuver. If the same continuous<a name="line.60"></a>
+<FONT color="green">061</FONT>     * output model handles the steps of all integration phases, the user<a name="line.61"></a>
+<FONT color="green">062</FONT>     * do not need to bother when the maneuver begins or ends, he has all<a name="line.62"></a>
+<FONT color="green">063</FONT>     * the data available in a transparent manner.&lt;/p&gt;<a name="line.63"></a>
+<FONT color="green">064</FONT>     *<a name="line.64"></a>
+<FONT color="green">065</FONT>     * &lt;p&gt;An important feature of this class is that it implements the<a name="line.65"></a>
+<FONT color="green">066</FONT>     * &lt;code&gt;Serializable&lt;/code&gt; interface. This means that the result of<a name="line.66"></a>
+<FONT color="green">067</FONT>     * an integration can be serialized and reused later (if stored into a<a name="line.67"></a>
+<FONT color="green">068</FONT>     * persistent medium like a filesystem or a database) or elsewhere (if<a name="line.68"></a>
+<FONT color="green">069</FONT>     * sent to another application). Only the result of the integration is<a name="line.69"></a>
+<FONT color="green">070</FONT>     * stored, there is no reference to the integrated problem by<a name="line.70"></a>
+<FONT color="green">071</FONT>     * itself.&lt;/p&gt;<a name="line.71"></a>
+<FONT color="green">072</FONT>     *<a name="line.72"></a>
+<FONT color="green">073</FONT>     * &lt;p&gt;One should be aware that the amount of data stored in a<a name="line.73"></a>
+<FONT color="green">074</FONT>     * ContinuousOutputModel instance can be important if the state vector<a name="line.74"></a>
+<FONT color="green">075</FONT>     * is large, if the integration interval is long or if the steps are<a name="line.75"></a>
+<FONT color="green">076</FONT>     * small (which can result from small tolerance settings in {@link<a name="line.76"></a>
+<FONT color="green">077</FONT>     * org.apache.commons.math.ode.nonstiff.AdaptiveStepsizeIntegrator adaptive<a name="line.77"></a>
+<FONT color="green">078</FONT>     * step size integrators}).&lt;/p&gt;<a name="line.78"></a>
+<FONT color="green">079</FONT>     *<a name="line.79"></a>
+<FONT color="green">080</FONT>     * @see StepHandler<a name="line.80"></a>
+<FONT color="green">081</FONT>     * @see StepInterpolator<a name="line.81"></a>
+<FONT color="green">082</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.82"></a>
+<FONT color="green">083</FONT>     * @since 1.2<a name="line.83"></a>
+<FONT color="green">084</FONT>     */<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>    public class ContinuousOutputModel<a name="line.86"></a>
+<FONT color="green">087</FONT>      implements StepHandler, Serializable {<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /** Serializable version identifier */<a name="line.89"></a>
+<FONT color="green">090</FONT>        private static final long serialVersionUID = -1417964919405031606L;<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /** Initial integration time. */<a name="line.92"></a>
+<FONT color="green">093</FONT>        private double initialTime;<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /** Final integration time. */<a name="line.95"></a>
+<FONT color="green">096</FONT>        private double finalTime;<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /** Integration direction indicator. */<a name="line.98"></a>
+<FONT color="green">099</FONT>        private boolean forward;<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /** Current interpolator index. */<a name="line.101"></a>
+<FONT color="green">102</FONT>        private int index;<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /** Steps table. */<a name="line.104"></a>
+<FONT color="green">105</FONT>        private List&lt;StepInterpolator&gt; steps;<a name="line.105"></a>
+<FONT color="green">106</FONT>    <a name="line.106"></a>
+<FONT color="green">107</FONT>      /** Simple constructor.<a name="line.107"></a>
+<FONT color="green">108</FONT>       * Build an empty continuous output model.<a name="line.108"></a>
+<FONT color="green">109</FONT>       */<a name="line.109"></a>
+<FONT color="green">110</FONT>      public ContinuousOutputModel() {<a name="line.110"></a>
+<FONT color="green">111</FONT>        steps = new ArrayList&lt;StepInterpolator&gt;();<a name="line.111"></a>
+<FONT color="green">112</FONT>        reset();<a name="line.112"></a>
+<FONT color="green">113</FONT>      }<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>      /** Append another model at the end of the instance.<a name="line.115"></a>
+<FONT color="green">116</FONT>       * @param model model to add at the end of the instance<a name="line.116"></a>
+<FONT color="green">117</FONT>       * @exception DerivativeException if some step interpolators from<a name="line.117"></a>
+<FONT color="green">118</FONT>       * the appended model cannot be copied<a name="line.118"></a>
+<FONT color="green">119</FONT>       * @exception IllegalArgumentException if the model to append is not<a name="line.119"></a>
+<FONT color="green">120</FONT>       * compatible with the instance (dimension of the state vector,<a name="line.120"></a>
+<FONT color="green">121</FONT>       * propagation direction, hole between the dates)<a name="line.121"></a>
+<FONT color="green">122</FONT>       */<a name="line.122"></a>
+<FONT color="green">123</FONT>      public void append(final ContinuousOutputModel model)<a name="line.123"></a>
+<FONT color="green">124</FONT>        throws DerivativeException {<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>        if (model.steps.size() == 0) {<a name="line.126"></a>
+<FONT color="green">127</FONT>          return;<a name="line.127"></a>
+<FONT color="green">128</FONT>        }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        if (steps.size() == 0) {<a name="line.130"></a>
+<FONT color="green">131</FONT>          initialTime = model.initialTime;<a name="line.131"></a>
+<FONT color="green">132</FONT>          forward     = model.forward;<a name="line.132"></a>
+<FONT color="green">133</FONT>        } else {<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>          if (getInterpolatedState().length != model.getInterpolatedState().length) {<a name="line.135"></a>
+<FONT color="green">136</FONT>              throw MathRuntimeException.createIllegalArgumentException(<a name="line.136"></a>
+<FONT color="green">137</FONT>                    "dimension mismatch {0} != {1}",<a name="line.137"></a>
+<FONT color="green">138</FONT>                    getInterpolatedState().length, model.getInterpolatedState().length);<a name="line.138"></a>
+<FONT color="green">139</FONT>          }<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>          if (forward ^ model.forward) {<a name="line.141"></a>
+<FONT color="green">142</FONT>              throw MathRuntimeException.createIllegalArgumentException(<a name="line.142"></a>
+<FONT color="green">143</FONT>                    "propagation direction mismatch");<a name="line.143"></a>
+<FONT color="green">144</FONT>          }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>          final StepInterpolator lastInterpolator = steps.get(index);<a name="line.146"></a>
+<FONT color="green">147</FONT>          final double current  = lastInterpolator.getCurrentTime();<a name="line.147"></a>
+<FONT color="green">148</FONT>          final double previous = lastInterpolator.getPreviousTime();<a name="line.148"></a>
+<FONT color="green">149</FONT>          final double step = current - previous;<a name="line.149"></a>
+<FONT color="green">150</FONT>          final double gap = model.getInitialTime() - current;<a name="line.150"></a>
+<FONT color="green">151</FONT>          if (Math.abs(gap) &gt; 1.0e-3 * Math.abs(step)) {<a name="line.151"></a>
+<FONT color="green">152</FONT>            throw MathRuntimeException.createIllegalArgumentException(<a name="line.152"></a>
+<FONT color="green">153</FONT>                  "{0} wide hole between models time ranges", Math.abs(gap));<a name="line.153"></a>
+<FONT color="green">154</FONT>          }<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>        }<a name="line.156"></a>
+<FONT color="green">157</FONT>    <a name="line.157"></a>
+<FONT color="green">158</FONT>        for (StepInterpolator interpolator : model.steps) {<a name="line.158"></a>
+<FONT color="green">159</FONT>          steps.add(interpolator.copy());<a name="line.159"></a>
+<FONT color="green">160</FONT>        }<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>        index = steps.size() - 1;<a name="line.162"></a>
+<FONT color="green">163</FONT>        finalTime = (steps.get(index)).getCurrentTime();<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>      }<a name="line.165"></a>
+<FONT color="green">166</FONT>    <a name="line.166"></a>
+<FONT color="green">167</FONT>      /** Determines whether this handler needs dense output.<a name="line.167"></a>
+<FONT color="green">168</FONT>       * &lt;p&gt;The essence of this class is to provide dense output over all<a name="line.168"></a>
+<FONT color="green">169</FONT>       * steps, hence it requires the internal steps to provide themselves<a name="line.169"></a>
+<FONT color="green">170</FONT>       * dense output. The method therefore returns always true.&lt;/p&gt;<a name="line.170"></a>
+<FONT color="green">171</FONT>       * @return always true<a name="line.171"></a>
+<FONT color="green">172</FONT>       */<a name="line.172"></a>
+<FONT color="green">173</FONT>      public boolean requiresDenseOutput() {<a name="line.173"></a>
+<FONT color="green">174</FONT>        return true;<a name="line.174"></a>
+<FONT color="green">175</FONT>      }<a name="line.175"></a>
+<FONT color="green">176</FONT>    <a name="line.176"></a>
+<FONT color="green">177</FONT>      /** Reset the step handler.<a name="line.177"></a>
+<FONT color="green">178</FONT>       * Initialize the internal data as required before the first step is<a name="line.178"></a>
+<FONT color="green">179</FONT>       * handled.<a name="line.179"></a>
+<FONT color="green">180</FONT>       */<a name="line.180"></a>
+<FONT color="green">181</FONT>      public void reset() {<a name="line.181"></a>
+<FONT color="green">182</FONT>        initialTime = Double.NaN;<a name="line.182"></a>
+<FONT color="green">183</FONT>        finalTime   = Double.NaN;<a name="line.183"></a>
+<FONT color="green">184</FONT>        forward     = true;<a name="line.184"></a>
+<FONT color="green">185</FONT>        index       = 0;<a name="line.185"></a>
+<FONT color="green">186</FONT>        steps.clear();<a name="line.186"></a>
+<FONT color="green">187</FONT>       }<a name="line.187"></a>
+<FONT color="green">188</FONT>    <a name="line.188"></a>
+<FONT color="green">189</FONT>      /** Handle the last accepted step.<a name="line.189"></a>
+<FONT color="green">190</FONT>       * A copy of the information provided by the last step is stored in<a name="line.190"></a>
+<FONT color="green">191</FONT>       * the instance for later use.<a name="line.191"></a>
+<FONT color="green">192</FONT>       * @param interpolator interpolator for the last accepted step.<a name="line.192"></a>
+<FONT color="green">193</FONT>       * @param isLast true if the step is the last one<a name="line.193"></a>
+<FONT color="green">194</FONT>       * @throws DerivativeException this exception is propagated to the<a name="line.194"></a>
+<FONT color="green">195</FONT>       * caller if the underlying user function triggers one<a name="line.195"></a>
+<FONT color="green">196</FONT>       */<a name="line.196"></a>
+<FONT color="green">197</FONT>      public void handleStep(final StepInterpolator interpolator, final boolean isLast)<a name="line.197"></a>
+<FONT color="green">198</FONT>        throws DerivativeException {<a name="line.198"></a>
+<FONT color="green">199</FONT>    <a name="line.199"></a>
+<FONT color="green">200</FONT>        if (steps.size() == 0) {<a name="line.200"></a>
+<FONT color="green">201</FONT>          initialTime = interpolator.getPreviousTime();<a name="line.201"></a>
+<FONT color="green">202</FONT>          forward     = interpolator.isForward();<a name="line.202"></a>
+<FONT color="green">203</FONT>        }<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>        steps.add(interpolator.copy());<a name="line.205"></a>
+<FONT color="green">206</FONT>    <a name="line.206"></a>
+<FONT color="green">207</FONT>        if (isLast) {<a name="line.207"></a>
+<FONT color="green">208</FONT>          finalTime = interpolator.getCurrentTime();<a name="line.208"></a>
+<FONT color="green">209</FONT>          index     = steps.size() - 1;<a name="line.209"></a>
+<FONT color="green">210</FONT>        }<a name="line.210"></a>
+<FONT color="green">211</FONT>    <a name="line.211"></a>
+<FONT color="green">212</FONT>      }<a name="line.212"></a>
+<FONT color="green">213</FONT>    <a name="line.213"></a>
+<FONT color="green">214</FONT>      /**<a name="line.214"></a>
+<FONT color="green">215</FONT>       * Get the initial integration time.<a name="line.215"></a>
+<FONT color="green">216</FONT>       * @return initial integration time<a name="line.216"></a>
+<FONT color="green">217</FONT>       */<a name="line.217"></a>
+<FONT color="green">218</FONT>      public double getInitialTime() {<a name="line.218"></a>
+<FONT color="green">219</FONT>        return initialTime;<a name="line.219"></a>
+<FONT color="green">220</FONT>      }<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>      /**<a name="line.222"></a>
+<FONT color="green">223</FONT>       * Get the final integration time.<a name="line.223"></a>
+<FONT color="green">224</FONT>       * @return final integration time<a name="line.224"></a>
+<FONT color="green">225</FONT>       */<a name="line.225"></a>
+<FONT color="green">226</FONT>      public double getFinalTime() {<a name="line.226"></a>
+<FONT color="green">227</FONT>        return finalTime;<a name="line.227"></a>
+<FONT color="green">228</FONT>      }<a name="line.228"></a>
+<FONT color="green">229</FONT>    <a name="line.229"></a>
+<FONT color="green">230</FONT>      /**<a name="line.230"></a>
+<FONT color="green">231</FONT>       * Get the time of the interpolated point.<a name="line.231"></a>
+<FONT color="green">232</FONT>       * If {@link #setInterpolatedTime} has not been called, it returns<a name="line.232"></a>
+<FONT color="green">233</FONT>       * the final integration time.<a name="line.233"></a>
+<FONT color="green">234</FONT>       * @return interpolation point time<a name="line.234"></a>
+<FONT color="green">235</FONT>       */<a name="line.235"></a>
+<FONT color="green">236</FONT>      public double getInterpolatedTime() {<a name="line.236"></a>
+<FONT color="green">237</FONT>        return steps.get(index).getInterpolatedTime();<a name="line.237"></a>
+<FONT color="green">238</FONT>      }<a name="line.238"></a>
+<FONT color="green">239</FONT>    <a name="line.239"></a>
+<FONT color="green">240</FONT>      /** Set the time of the interpolated point.<a name="line.240"></a>
+<FONT color="green">241</FONT>       * &lt;p&gt;This method should &lt;strong&gt;not&lt;/strong&gt; be called before the<a name="line.241"></a>
+<FONT color="green">242</FONT>       * integration is over because some internal variables are set only<a name="line.242"></a>
+<FONT color="green">243</FONT>       * once the last step has been handled.&lt;/p&gt;<a name="line.243"></a>
+<FONT color="green">244</FONT>       * &lt;p&gt;Setting the time outside of the integration interval is now<a name="line.244"></a>
+<FONT color="green">245</FONT>       * allowed (it was not allowed up to version 5.9 of Mantissa), but<a name="line.245"></a>
+<FONT color="green">246</FONT>       * should be used with care since the accuracy of the interpolator<a name="line.246"></a>
+<FONT color="green">247</FONT>       * will probably be very poor far from this interval. This allowance<a name="line.247"></a>
+<FONT color="green">248</FONT>       * has been added to simplify implementation of search algorithms<a name="line.248"></a>
+<FONT color="green">249</FONT>       * near the interval endpoints.&lt;/p&gt;<a name="line.249"></a>
+<FONT color="green">250</FONT>       * @param time time of the interpolated point<a name="line.250"></a>
+<FONT color="green">251</FONT>       */<a name="line.251"></a>
+<FONT color="green">252</FONT>      public void setInterpolatedTime(final double time) {<a name="line.252"></a>
+<FONT color="green">253</FONT>    <a name="line.253"></a>
+<FONT color="green">254</FONT>          // initialize the search with the complete steps table<a name="line.254"></a>
+<FONT color="green">255</FONT>          int iMin = 0;<a name="line.255"></a>
+<FONT color="green">256</FONT>          final StepInterpolator sMin = steps.get(iMin);<a name="line.256"></a>
+<FONT color="green">257</FONT>          double tMin = 0.5 * (sMin.getPreviousTime() + sMin.getCurrentTime());<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>          int iMax = steps.size() - 1;<a name="line.259"></a>
+<FONT color="green">260</FONT>          final StepInterpolator sMax = steps.get(iMax);<a name="line.260"></a>
+<FONT color="green">261</FONT>          double tMax = 0.5 * (sMax.getPreviousTime() + sMax.getCurrentTime());<a name="line.261"></a>
+<FONT color="green">262</FONT>    <a name="line.262"></a>
+<FONT color="green">263</FONT>          // handle points outside of the integration interval<a name="line.263"></a>
+<FONT color="green">264</FONT>          // or in the first and last step<a name="line.264"></a>
+<FONT color="green">265</FONT>          if (locatePoint(time, sMin) &lt;= 0) {<a name="line.265"></a>
+<FONT color="green">266</FONT>            index = iMin;<a name="line.266"></a>
+<FONT color="green">267</FONT>            sMin.setInterpolatedTime(time);<a name="line.267"></a>
+<FONT color="green">268</FONT>            return;<a name="line.268"></a>
+<FONT color="green">269</FONT>          }<a name="line.269"></a>
+<FONT color="green">270</FONT>          if (locatePoint(time, sMax) &gt;= 0) {<a name="line.270"></a>
+<FONT color="green">271</FONT>            index = iMax;<a name="line.271"></a>
+<FONT color="green">272</FONT>            sMax.setInterpolatedTime(time);<a name="line.272"></a>
+<FONT color="green">273</FONT>            return;<a name="line.273"></a>
+<FONT color="green">274</FONT>          }<a name="line.274"></a>
+<FONT color="green">275</FONT>    <a name="line.275"></a>
+<FONT color="green">276</FONT>          // reduction of the table slice size<a name="line.276"></a>
+<FONT color="green">277</FONT>          while (iMax - iMin &gt; 5) {<a name="line.277"></a>
+<FONT color="green">278</FONT>    <a name="line.278"></a>
+<FONT color="green">279</FONT>            // use the last estimated index as the splitting index<a name="line.279"></a>
+<FONT color="green">280</FONT>            final StepInterpolator si = steps.get(index);<a name="line.280"></a>
+<FONT color="green">281</FONT>            final int location = locatePoint(time, si);<a name="line.281"></a>
+<FONT color="green">282</FONT>            if (location &lt; 0) {<a name="line.282"></a>
+<FONT color="green">283</FONT>              iMax = index;<a name="line.283"></a>
+<FONT color="green">284</FONT>              tMax = 0.5 * (si.getPreviousTime() + si.getCurrentTime());<a name="line.284"></a>
+<FONT color="green">285</FONT>            } else if (location &gt; 0) {<a name="line.285"></a>
+<FONT color="green">286</FONT>              iMin = index;<a name="line.286"></a>
+<FONT color="green">287</FONT>              tMin = 0.5 * (si.getPreviousTime() + si.getCurrentTime());<a name="line.287"></a>
+<FONT color="green">288</FONT>            } else {<a name="line.288"></a>
+<FONT color="green">289</FONT>              // we have found the target step, no need to continue searching<a name="line.289"></a>
+<FONT color="green">290</FONT>              si.setInterpolatedTime(time);<a name="line.290"></a>
+<FONT color="green">291</FONT>              return;<a name="line.291"></a>
+<FONT color="green">292</FONT>            }<a name="line.292"></a>
+<FONT color="green">293</FONT>    <a name="line.293"></a>
+<FONT color="green">294</FONT>            // compute a new estimate of the index in the reduced table slice<a name="line.294"></a>
+<FONT color="green">295</FONT>            final int iMed = (iMin + iMax) / 2;<a name="line.295"></a>
+<FONT color="green">296</FONT>            final StepInterpolator sMed = steps.get(iMed);<a name="line.296"></a>
+<FONT color="green">297</FONT>            final double tMed = 0.5 * (sMed.getPreviousTime() + sMed.getCurrentTime());<a name="line.297"></a>
+<FONT color="green">298</FONT>    <a name="line.298"></a>
+<FONT color="green">299</FONT>            if ((Math.abs(tMed - tMin) &lt; 1e-6) || (Math.abs(tMax - tMed) &lt; 1e-6)) {<a name="line.299"></a>
+<FONT color="green">300</FONT>              // too close to the bounds, we estimate using a simple dichotomy<a name="line.300"></a>
+<FONT color="green">301</FONT>              index = iMed;<a name="line.301"></a>
+<FONT color="green">302</FONT>            } else {<a name="line.302"></a>
+<FONT color="green">303</FONT>              // estimate the index using a reverse quadratic polynom<a name="line.303"></a>
+<FONT color="green">304</FONT>              // (reverse means we have i = P(t), thus allowing to simply<a name="line.304"></a>
+<FONT color="green">305</FONT>              // compute index = P(time) rather than solving a quadratic equation)<a name="line.305"></a>
+<FONT color="green">306</FONT>              final double d12 = tMax - tMed;<a name="line.306"></a>
+<FONT color="green">307</FONT>              final double d23 = tMed - tMin;<a name="line.307"></a>
+<FONT color="green">308</FONT>              final double d13 = tMax - tMin;<a name="line.308"></a>
+<FONT color="green">309</FONT>              final double dt1 = time - tMax;<a name="line.309"></a>
+<FONT color="green">310</FONT>              final double dt2 = time - tMed;<a name="line.310"></a>
+<FONT color="green">311</FONT>              final double dt3 = time - tMin;<a name="line.311"></a>
+<FONT color="green">312</FONT>              final double iLagrange = ((dt2 * dt3 * d23) * iMax -<a name="line.312"></a>
+<FONT color="green">313</FONT>                                        (dt1 * dt3 * d13) * iMed +<a name="line.313"></a>
+<FONT color="green">314</FONT>                                        (dt1 * dt2 * d12) * iMin) /<a name="line.314"></a>
+<FONT color="green">315</FONT>                                       (d12 * d23 * d13);<a name="line.315"></a>
+<FONT color="green">316</FONT>              index = (int) Math.rint(iLagrange);<a name="line.316"></a>
+<FONT color="green">317</FONT>            }<a name="line.317"></a>
+<FONT color="green">318</FONT>    <a name="line.318"></a>
+<FONT color="green">319</FONT>            // force the next size reduction to be at least one tenth<a name="line.319"></a>
+<FONT color="green">320</FONT>            final int low  = Math.max(iMin + 1, (9 * iMin + iMax) / 10);<a name="line.320"></a>
+<FONT color="green">321</FONT>            final int high = Math.min(iMax - 1, (iMin + 9 * iMax) / 10);<a name="line.321"></a>
+<FONT color="green">322</FONT>            if (index &lt; low) {<a name="line.322"></a>
+<FONT color="green">323</FONT>              index = low;<a name="line.323"></a>
+<FONT color="green">324</FONT>            } else if (index &gt; high) {<a name="line.324"></a>
+<FONT color="green">325</FONT>              index = high;<a name="line.325"></a>
+<FONT color="green">326</FONT>            }<a name="line.326"></a>
+<FONT color="green">327</FONT>    <a name="line.327"></a>
+<FONT color="green">328</FONT>          }<a name="line.328"></a>
+<FONT color="green">329</FONT>    <a name="line.329"></a>
+<FONT color="green">330</FONT>          // now the table slice is very small, we perform an iterative search<a name="line.330"></a>
+<FONT color="green">331</FONT>          index = iMin;<a name="line.331"></a>
+<FONT color="green">332</FONT>          while ((index &lt;= iMax) &amp;&amp; (locatePoint(time, steps.get(index)) &gt; 0)) {<a name="line.332"></a>
+<FONT color="green">333</FONT>            ++index;<a name="line.333"></a>
+<FONT color="green">334</FONT>          }<a name="line.334"></a>
+<FONT color="green">335</FONT>    <a name="line.335"></a>
+<FONT color="green">336</FONT>          steps.get(index).setInterpolatedTime(time);<a name="line.336"></a>
+<FONT color="green">337</FONT>    <a name="line.337"></a>
+<FONT color="green">338</FONT>      }<a name="line.338"></a>
+<FONT color="green">339</FONT>    <a name="line.339"></a>
+<FONT color="green">340</FONT>      /**<a name="line.340"></a>
+<FONT color="green">341</FONT>       * Get the state vector of the interpolated point.<a name="line.341"></a>
+<FONT color="green">342</FONT>       * @return state vector at time {@link #getInterpolatedTime}<a name="line.342"></a>
+<FONT color="green">343</FONT>       * @throws DerivativeException if this call induces an automatic<a name="line.343"></a>
+<FONT color="green">344</FONT>       * step finalization that throws one<a name="line.344"></a>
+<FONT color="green">345</FONT>       */<a name="line.345"></a>
+<FONT color="green">346</FONT>      public double[] getInterpolatedState() throws DerivativeException {<a name="line.346"></a>
+<FONT color="green">347</FONT>        return steps.get(index).getInterpolatedState();<a name="line.347"></a>
+<FONT color="green">348</FONT>      }<a name="line.348"></a>
+<FONT color="green">349</FONT>    <a name="line.349"></a>
+<FONT color="green">350</FONT>      /** Compare a step interval and a double.<a name="line.350"></a>
+<FONT color="green">351</FONT>       * @param time point to locate<a name="line.351"></a>
+<FONT color="green">352</FONT>       * @param interval step interval<a name="line.352"></a>
+<FONT color="green">353</FONT>       * @return -1 if the double is before the interval, 0 if it is in<a name="line.353"></a>
+<FONT color="green">354</FONT>       * the interval, and +1 if it is after the interval, according to<a name="line.354"></a>
+<FONT color="green">355</FONT>       * the interval direction<a name="line.355"></a>
+<FONT color="green">356</FONT>       */<a name="line.356"></a>
+<FONT color="green">357</FONT>      private int locatePoint(final double time, final StepInterpolator interval) {<a name="line.357"></a>
+<FONT color="green">358</FONT>        if (forward) {<a name="line.358"></a>
+<FONT color="green">359</FONT>          if (time &lt; interval.getPreviousTime()) {<a name="line.359"></a>
+<FONT color="green">360</FONT>            return -1;<a name="line.360"></a>
+<FONT color="green">361</FONT>          } else if (time &gt; interval.getCurrentTime()) {<a name="line.361"></a>
+<FONT color="green">362</FONT>            return +1;<a name="line.362"></a>
+<FONT color="green">363</FONT>          } else {<a name="line.363"></a>
+<FONT color="green">364</FONT>            return 0;<a name="line.364"></a>
+<FONT color="green">365</FONT>          }<a name="line.365"></a>
+<FONT color="green">366</FONT>        }<a name="line.366"></a>
+<FONT color="green">367</FONT>        if (time &gt; interval.getPreviousTime()) {<a name="line.367"></a>
+<FONT color="green">368</FONT>          return -1;<a name="line.368"></a>
+<FONT color="green">369</FONT>        } else if (time &lt; interval.getCurrentTime()) {<a name="line.369"></a>
+<FONT color="green">370</FONT>          return +1;<a name="line.370"></a>
+<FONT color="green">371</FONT>        } else {<a name="line.371"></a>
+<FONT color="green">372</FONT>          return 0;<a name="line.372"></a>
+<FONT color="green">373</FONT>        }<a name="line.373"></a>
+<FONT color="green">374</FONT>      }<a name="line.374"></a>
+<FONT color="green">375</FONT>    <a name="line.375"></a>
+<FONT color="green">376</FONT>    }<a name="line.376"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/DerivativeException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,117 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This exception is made available to users to report<a name="line.23"></a>
+<FONT color="green">024</FONT>     * the error conditions that are triggered while computing<a name="line.24"></a>
+<FONT color="green">025</FONT>     * the differential equations.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @since 1.2<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public class DerivativeException<a name="line.29"></a>
+<FONT color="green">030</FONT>      extends MathException {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>      /** Serializable version identifier */<a name="line.32"></a>
+<FONT color="green">033</FONT>      private static final long serialVersionUID = 5666710788967425123L;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>      /** Simple constructor.<a name="line.35"></a>
+<FONT color="green">036</FONT>       * Build an exception by translating and formating a message<a name="line.36"></a>
+<FONT color="green">037</FONT>       * @param specifier format specifier (to be translated)<a name="line.37"></a>
+<FONT color="green">038</FONT>       * @param parts to insert in the format (no translation)<a name="line.38"></a>
+<FONT color="green">039</FONT>       */<a name="line.39"></a>
+<FONT color="green">040</FONT>      public DerivativeException(final String specifier, final Object ... parts) {<a name="line.40"></a>
+<FONT color="green">041</FONT>        super(specifier, parts);<a name="line.41"></a>
+<FONT color="green">042</FONT>      }<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>      /** Build an instance from an underlying cause.<a name="line.44"></a>
+<FONT color="green">045</FONT>       * @param cause cause for the exception<a name="line.45"></a>
+<FONT color="green">046</FONT>       */<a name="line.46"></a>
+<FONT color="green">047</FONT>      public DerivativeException(final Throwable cause) {<a name="line.47"></a>
+<FONT color="green">048</FONT>        super(cause);<a name="line.48"></a>
+<FONT color="green">049</FONT>      }<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>    }<a name="line.51"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/FirstOrderConverter.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,183 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /** This class converts second order differential equations to first<a name="line.20"></a>
+<FONT color="green">021</FONT>     * order ones.<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;p&gt;This class is a wrapper around a {@link<a name="line.23"></a>
+<FONT color="green">024</FONT>     * SecondOrderDifferentialEquations} which allow to use a {@link<a name="line.24"></a>
+<FONT color="green">025</FONT>     * FirstOrderIntegrator} to integrate it.&lt;/p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;The transformation is done by changing the n dimension state<a name="line.27"></a>
+<FONT color="green">028</FONT>     * vector to a 2n dimension vector, where the first n components are<a name="line.28"></a>
+<FONT color="green">029</FONT>     * the initial state variables and the n last components are their<a name="line.29"></a>
+<FONT color="green">030</FONT>     * first time derivative. The first time derivative of this state<a name="line.30"></a>
+<FONT color="green">031</FONT>     * vector then really contains both the first and second time<a name="line.31"></a>
+<FONT color="green">032</FONT>     * derivative of the initial state vector, which can be handled by the<a name="line.32"></a>
+<FONT color="green">033</FONT>     * underlying second order equations set.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     *<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;p&gt;One should be aware that the data is duplicated during the<a name="line.35"></a>
+<FONT color="green">036</FONT>     * transformation process and that for each call to {@link<a name="line.36"></a>
+<FONT color="green">037</FONT>     * #computeDerivatives computeDerivatives}, this wrapper does copy 4n<a name="line.37"></a>
+<FONT color="green">038</FONT>     * scalars : 2n before the call to {@link<a name="line.38"></a>
+<FONT color="green">039</FONT>     * SecondOrderDifferentialEquations#computeSecondDerivatives<a name="line.39"></a>
+<FONT color="green">040</FONT>     * computeSecondDerivatives} in order to dispatch the y state vector<a name="line.40"></a>
+<FONT color="green">041</FONT>     * into z and zDot, and 2n after the call to gather zDot and zDDot<a name="line.41"></a>
+<FONT color="green">042</FONT>     * into yDot. Since the underlying problem by itself perhaps also<a name="line.42"></a>
+<FONT color="green">043</FONT>     * needs to copy data and dispatch the arrays into domain objects,<a name="line.43"></a>
+<FONT color="green">044</FONT>     * this has an impact on both memory and CPU usage. The only way to<a name="line.44"></a>
+<FONT color="green">045</FONT>     * avoid this duplication is to perform the transformation at the<a name="line.45"></a>
+<FONT color="green">046</FONT>     * problem level, i.e. to implement the problem as a first order one<a name="line.46"></a>
+<FONT color="green">047</FONT>     * and then avoid using this class.&lt;/p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     *<a name="line.48"></a>
+<FONT color="green">049</FONT>     * @see FirstOrderIntegrator<a name="line.49"></a>
+<FONT color="green">050</FONT>     * @see FirstOrderDifferentialEquations<a name="line.50"></a>
+<FONT color="green">051</FONT>     * @see SecondOrderDifferentialEquations<a name="line.51"></a>
+<FONT color="green">052</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.52"></a>
+<FONT color="green">053</FONT>     * @since 1.2<a name="line.53"></a>
+<FONT color="green">054</FONT>     */<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>    public class FirstOrderConverter implements FirstOrderDifferentialEquations {<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /** Underlying second order equations set. */<a name="line.58"></a>
+<FONT color="green">059</FONT>        private final SecondOrderDifferentialEquations equations;<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /** second order problem dimension. */<a name="line.61"></a>
+<FONT color="green">062</FONT>        private final int dimension;<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /** state vector. */<a name="line.64"></a>
+<FONT color="green">065</FONT>        private final double[] z;<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /** first time derivative of the state vector. */<a name="line.67"></a>
+<FONT color="green">068</FONT>        private final double[] zDot;<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /** second time derivative of the state vector. */<a name="line.70"></a>
+<FONT color="green">071</FONT>        private final double[] zDDot;<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>      /** Simple constructor.<a name="line.73"></a>
+<FONT color="green">074</FONT>       * Build a converter around a second order equations set.<a name="line.74"></a>
+<FONT color="green">075</FONT>       * @param equations second order equations set to convert<a name="line.75"></a>
+<FONT color="green">076</FONT>       */<a name="line.76"></a>
+<FONT color="green">077</FONT>      public FirstOrderConverter (final SecondOrderDifferentialEquations equations) {<a name="line.77"></a>
+<FONT color="green">078</FONT>          this.equations = equations;<a name="line.78"></a>
+<FONT color="green">079</FONT>          dimension      = equations.getDimension();<a name="line.79"></a>
+<FONT color="green">080</FONT>          z              = new double[dimension];<a name="line.80"></a>
+<FONT color="green">081</FONT>          zDot           = new double[dimension];<a name="line.81"></a>
+<FONT color="green">082</FONT>          zDDot          = new double[dimension];<a name="line.82"></a>
+<FONT color="green">083</FONT>      }<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>      /** Get the dimension of the problem.<a name="line.85"></a>
+<FONT color="green">086</FONT>       * &lt;p&gt;The dimension of the first order problem is twice the<a name="line.86"></a>
+<FONT color="green">087</FONT>       * dimension of the underlying second order problem.&lt;/p&gt;<a name="line.87"></a>
+<FONT color="green">088</FONT>       * @return dimension of the problem<a name="line.88"></a>
+<FONT color="green">089</FONT>       */<a name="line.89"></a>
+<FONT color="green">090</FONT>      public int getDimension() {<a name="line.90"></a>
+<FONT color="green">091</FONT>        return 2 * dimension;<a name="line.91"></a>
+<FONT color="green">092</FONT>      }<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>      /** Get the current time derivative of the state vector.<a name="line.94"></a>
+<FONT color="green">095</FONT>       * @param t current value of the independent &lt;I&gt;time&lt;/I&gt; variable<a name="line.95"></a>
+<FONT color="green">096</FONT>       * @param y array containing the current value of the state vector<a name="line.96"></a>
+<FONT color="green">097</FONT>       * @param yDot placeholder array where to put the time derivative of the state vector<a name="line.97"></a>
+<FONT color="green">098</FONT>       * @throws DerivativeException this exception is propagated to the caller if the<a name="line.98"></a>
+<FONT color="green">099</FONT>       * underlying user function triggers one<a name="line.99"></a>
+<FONT color="green">100</FONT>       */<a name="line.100"></a>
+<FONT color="green">101</FONT>      public void computeDerivatives(final double t, final double[] y, final double[] yDot)<a name="line.101"></a>
+<FONT color="green">102</FONT>          throws DerivativeException {<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        // split the state vector in two<a name="line.104"></a>
+<FONT color="green">105</FONT>        System.arraycopy(y, 0,         z,    0, dimension);<a name="line.105"></a>
+<FONT color="green">106</FONT>        System.arraycopy(y, dimension, zDot, 0, dimension);<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>        // apply the underlying equations set<a name="line.108"></a>
+<FONT color="green">109</FONT>        equations.computeSecondDerivatives(t, z, zDot, zDDot);<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        // build the result state derivative<a name="line.111"></a>
+<FONT color="green">112</FONT>        System.arraycopy(zDot,  0, yDot, 0,         dimension);<a name="line.112"></a>
+<FONT color="green">113</FONT>        System.arraycopy(zDDot, 0, yDot, dimension, dimension);<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>      }<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>    }<a name="line.117"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/FirstOrderDifferentialEquations.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,130 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /** This interface represents a first order differential equations set.<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;p&gt;This interface should be implemented by all real first order<a name="line.23"></a>
+<FONT color="green">024</FONT>     * differential equation problems before they can be handled by the<a name="line.24"></a>
+<FONT color="green">025</FONT>     * integrators {@link FirstOrderIntegrator#integrate} method.&lt;/p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;A first order differential equations problem, as seen by an<a name="line.27"></a>
+<FONT color="green">028</FONT>     * integrator is the time derivative &lt;code&gt;dY/dt&lt;/code&gt; of a state<a name="line.28"></a>
+<FONT color="green">029</FONT>     * vector &lt;code&gt;Y&lt;/code&gt;, both being one dimensional arrays. From the<a name="line.29"></a>
+<FONT color="green">030</FONT>     * integrator point of view, this derivative depends only on the<a name="line.30"></a>
+<FONT color="green">031</FONT>     * current time &lt;code&gt;t&lt;/code&gt; and on the state vector<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;code&gt;Y&lt;/code&gt;.&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;p&gt;For real problems, the derivative depends also on parameters<a name="line.34"></a>
+<FONT color="green">035</FONT>     * that do not belong to the state vector (dynamical model constants<a name="line.35"></a>
+<FONT color="green">036</FONT>     * for example). These constants are completely outside of the scope<a name="line.36"></a>
+<FONT color="green">037</FONT>     * of this interface, the classes that implement it are allowed to<a name="line.37"></a>
+<FONT color="green">038</FONT>     * handle them as they want.&lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     *<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @see FirstOrderIntegrator<a name="line.40"></a>
+<FONT color="green">041</FONT>     * @see FirstOrderConverter<a name="line.41"></a>
+<FONT color="green">042</FONT>     * @see SecondOrderDifferentialEquations<a name="line.42"></a>
+<FONT color="green">043</FONT>     *<a name="line.43"></a>
+<FONT color="green">044</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.44"></a>
+<FONT color="green">045</FONT>     * @since 1.2<a name="line.45"></a>
+<FONT color="green">046</FONT>     */<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>    public interface FirstOrderDifferentialEquations {<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Get the dimension of the problem.<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @return dimension of the problem<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        int getDimension();<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** Get the current time derivative of the state vector.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param t current value of the independent &lt;I&gt;time&lt;/I&gt; variable<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @param y array containing the current value of the state vector<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @param yDot placeholder array where to put the time derivative of the state vector<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @throws DerivativeException this exception is propagated to the caller if the<a name="line.59"></a>
+<FONT color="green">060</FONT>         * underlying user function triggers one<a name="line.60"></a>
+<FONT color="green">061</FONT>         */<a name="line.61"></a>
+<FONT color="green">062</FONT>        void computeDerivatives(double t, double[] y, double[] yDot) throws DerivativeException;<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>    }<a name="line.64"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/FirstOrderIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,126 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /** This interface represents a first order integrator for<a name="line.20"></a>
+<FONT color="green">021</FONT>     * differential equations.<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;p&gt;The classes which are devoted to solve first order differential<a name="line.23"></a>
+<FONT color="green">024</FONT>     * equations should implement this interface. The problems which can<a name="line.24"></a>
+<FONT color="green">025</FONT>     * be handled should implement the {@link<a name="line.25"></a>
+<FONT color="green">026</FONT>     * FirstOrderDifferentialEquations} interface.&lt;/p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @see FirstOrderDifferentialEquations<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @see org.apache.commons.math.ode.sampling.StepHandler<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @see org.apache.commons.math.ode.events.EventHandler<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 1.2<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>    public interface FirstOrderIntegrator extends ODEIntegrator {<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>      /** Integrate the differential equations up to the given time.<a name="line.37"></a>
+<FONT color="green">038</FONT>       * &lt;p&gt;This method solves an Initial Value Problem (IVP).&lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>       * &lt;p&gt;Since this method stores some internal state variables made<a name="line.39"></a>
+<FONT color="green">040</FONT>       * available in its public interface during integration ({@link<a name="line.40"></a>
+<FONT color="green">041</FONT>       * #getCurrentSignedStepsize()}), it is &lt;em&gt;not&lt;/em&gt; thread-safe.&lt;/p&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>       * @param equations differential equations to integrate<a name="line.42"></a>
+<FONT color="green">043</FONT>       * @param t0 initial time<a name="line.43"></a>
+<FONT color="green">044</FONT>       * @param y0 initial value of the state vector at t0<a name="line.44"></a>
+<FONT color="green">045</FONT>       * @param t target time for the integration<a name="line.45"></a>
+<FONT color="green">046</FONT>       * (can be set to a value smaller than &lt;code&gt;t0&lt;/code&gt; for backward integration)<a name="line.46"></a>
+<FONT color="green">047</FONT>       * @param y placeholder where to put the state vector at each successful<a name="line.47"></a>
+<FONT color="green">048</FONT>       *  step (and hence at the end of integration), can be the same object as y0<a name="line.48"></a>
+<FONT color="green">049</FONT>       * @return stop time, will be the same as target time if integration reached its<a name="line.49"></a>
+<FONT color="green">050</FONT>       * target, but may be different if some {@link<a name="line.50"></a>
+<FONT color="green">051</FONT>       * org.apache.commons.math.ode.events.EventHandler} stops it at some point.<a name="line.51"></a>
+<FONT color="green">052</FONT>       * @throws IntegratorException if the integrator cannot perform integration<a name="line.52"></a>
+<FONT color="green">053</FONT>       * @throws DerivativeException this exception is propagated to the caller if<a name="line.53"></a>
+<FONT color="green">054</FONT>       * the underlying user function triggers one<a name="line.54"></a>
+<FONT color="green">055</FONT>       */<a name="line.55"></a>
+<FONT color="green">056</FONT>      double integrate (FirstOrderDifferentialEquations equations,<a name="line.56"></a>
+<FONT color="green">057</FONT>                        double t0, double[] y0,<a name="line.57"></a>
+<FONT color="green">058</FONT>                        double t, double[] y) throws DerivativeException, IntegratorException;<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>    }<a name="line.60"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/IntegratorException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,117 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This exception is made available to users to report<a name="line.23"></a>
+<FONT color="green">024</FONT>     * the error conditions that are triggered during integration<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 746578 $ $Date: 2009-02-21 15:01:14 -0500 (Sat, 21 Feb 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 1.2<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public class IntegratorException<a name="line.28"></a>
+<FONT color="green">029</FONT>      extends MathException {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>      /** Serializable version identifier */<a name="line.31"></a>
+<FONT color="green">032</FONT>        private static final long serialVersionUID = -1607588949778036796L;<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>      /** Simple constructor.<a name="line.34"></a>
+<FONT color="green">035</FONT>       * Build an exception by translating and formating a message<a name="line.35"></a>
+<FONT color="green">036</FONT>       * @param specifier format specifier (to be translated)<a name="line.36"></a>
+<FONT color="green">037</FONT>       * @param parts to insert in the format (no translation)<a name="line.37"></a>
+<FONT color="green">038</FONT>       */<a name="line.38"></a>
+<FONT color="green">039</FONT>      public IntegratorException(final String specifier, final Object ... parts) {<a name="line.39"></a>
+<FONT color="green">040</FONT>        super(specifier, parts);<a name="line.40"></a>
+<FONT color="green">041</FONT>      }<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>      /**<a name="line.43"></a>
+<FONT color="green">044</FONT>       * Create an exception with a given root cause.<a name="line.44"></a>
+<FONT color="green">045</FONT>       * @param cause  the exception or error that caused this exception to be thrown<a name="line.45"></a>
+<FONT color="green">046</FONT>       */<a name="line.46"></a>
+<FONT color="green">047</FONT>      public IntegratorException(final Throwable cause) {<a name="line.47"></a>
+<FONT color="green">048</FONT>        super(cause);<a name="line.48"></a>
+<FONT color="green">049</FONT>      }<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>    }<a name="line.51"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/MultistepIntegrator.NordsieckTransformer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,470 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.linear.Array2DRowRealMatrix;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.linear.RealMatrix;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.ode.nonstiff.AdaptiveStepsizeIntegrator;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.ode.nonstiff.DormandPrince853Integrator;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.ode.sampling.StepHandler;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.ode.sampling.StepInterpolator;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    /**<a name="line.28"></a>
+<FONT color="green">029</FONT>     * This class is the base class for multistep integrators for Ordinary<a name="line.29"></a>
+<FONT color="green">030</FONT>     * Differential Equations.<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;We define scaled derivatives s&lt;sub&gt;i&lt;/sub&gt;(n) at step n as:<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;pre&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * s&lt;sub&gt;1&lt;/sub&gt;(n) = h y'&lt;sub&gt;n&lt;/sub&gt; for first derivative<a name="line.33"></a>
+<FONT color="green">034</FONT>     * s&lt;sub&gt;2&lt;/sub&gt;(n) = h&lt;sup&gt;2&lt;/sup&gt;/2 y''&lt;sub&gt;n&lt;/sub&gt; for second derivative<a name="line.34"></a>
+<FONT color="green">035</FONT>     * s&lt;sub&gt;3&lt;/sub&gt;(n) = h&lt;sup&gt;3&lt;/sup&gt;/6 y'''&lt;sub&gt;n&lt;/sub&gt; for third derivative<a name="line.35"></a>
+<FONT color="green">036</FONT>     * ...<a name="line.36"></a>
+<FONT color="green">037</FONT>     * s&lt;sub&gt;k&lt;/sub&gt;(n) = h&lt;sup&gt;k&lt;/sup&gt;/k! y(k)&lt;sub&gt;n&lt;/sub&gt; for k&lt;sup&gt;th&lt;/sup&gt; derivative<a name="line.37"></a>
+<FONT color="green">038</FONT>     * &lt;/pre&gt;&lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;p&gt;Rather than storing several previous steps separately, this implementation uses<a name="line.39"></a>
+<FONT color="green">040</FONT>     * the Nordsieck vector with higher degrees scaled derivatives all taken at the same<a name="line.40"></a>
+<FONT color="green">041</FONT>     * step (y&lt;sub&gt;n&lt;/sub&gt;, s&lt;sub&gt;1&lt;/sub&gt;(n) and r&lt;sub&gt;n&lt;/sub&gt;) where r&lt;sub&gt;n&lt;/sub&gt; is defined as:<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;pre&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     * r&lt;sub&gt;n&lt;/sub&gt; = [ s&lt;sub&gt;2&lt;/sub&gt;(n), s&lt;sub&gt;3&lt;/sub&gt;(n) ... s&lt;sub&gt;k&lt;/sub&gt;(n) ]&lt;sup&gt;T&lt;/sup&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;/pre&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     * (we omit the k index in the notation for clarity)&lt;/p&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     * &lt;p&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     * Multistep integrators with Nordsieck representation are highly sensitive to<a name="line.47"></a>
+<FONT color="green">048</FONT>     * large step changes because when the step is multiplied by a factor a, the<a name="line.48"></a>
+<FONT color="green">049</FONT>     * k&lt;sup&gt;th&lt;/sup&gt; component of the Nordsieck vector is multiplied by a&lt;sup&gt;k&lt;/sup&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     * and the last components are the least accurate ones. The default max growth<a name="line.50"></a>
+<FONT color="green">051</FONT>     * factor is therefore set to a quite low value: 2&lt;sup&gt;1/order&lt;/sup&gt;.<a name="line.51"></a>
+<FONT color="green">052</FONT>     * &lt;/p&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>     *<a name="line.53"></a>
+<FONT color="green">054</FONT>     * @see org.apache.commons.math.ode.nonstiff.AdamsBashforthIntegrator<a name="line.54"></a>
+<FONT color="green">055</FONT>     * @see org.apache.commons.math.ode.nonstiff.AdamsMoultonIntegrator<a name="line.55"></a>
+<FONT color="green">056</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.56"></a>
+<FONT color="green">057</FONT>     * @since 2.0<a name="line.57"></a>
+<FONT color="green">058</FONT>     */<a name="line.58"></a>
+<FONT color="green">059</FONT>    public abstract class MultistepIntegrator extends AdaptiveStepsizeIntegrator {<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /** First scaled derivative (h y'). */<a name="line.61"></a>
+<FONT color="green">062</FONT>        protected double[] scaled;<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /** Nordsieck matrix of the higher scaled derivatives.<a name="line.64"></a>
+<FONT color="green">065</FONT>         * &lt;p&gt;(h&lt;sup&gt;2&lt;/sup&gt;/2 y'', h&lt;sup&gt;3&lt;/sup&gt;/6 y''' ..., h&lt;sup&gt;k&lt;/sup&gt;/k! y(k))&lt;/p&gt;<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        protected Array2DRowRealMatrix nordsieck;<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /** Starter integrator. */<a name="line.69"></a>
+<FONT color="green">070</FONT>        private FirstOrderIntegrator starter;<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /** Number of steps of the multistep method (excluding the one being computed). */<a name="line.72"></a>
+<FONT color="green">073</FONT>        private final int nSteps;<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /** Stepsize control exponent. */<a name="line.75"></a>
+<FONT color="green">076</FONT>        private double exp;<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /** Safety factor for stepsize control. */<a name="line.78"></a>
+<FONT color="green">079</FONT>        private double safety;<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /** Minimal reduction factor for stepsize control. */<a name="line.81"></a>
+<FONT color="green">082</FONT>        private double minReduction;<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /** Maximal growth factor for stepsize control. */<a name="line.84"></a>
+<FONT color="green">085</FONT>        private double maxGrowth;<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>        /**<a name="line.87"></a>
+<FONT color="green">088</FONT>         * Build a multistep integrator with the given stepsize bounds.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * &lt;p&gt;The default starter integrator is set to the {@link<a name="line.89"></a>
+<FONT color="green">090</FONT>         * DormandPrince853Integrator Dormand-Prince 8(5,3)} integrator with<a name="line.90"></a>
+<FONT color="green">091</FONT>         * some defaults settings.&lt;/p&gt;<a name="line.91"></a>
+<FONT color="green">092</FONT>         * &lt;p&gt;<a name="line.92"></a>
+<FONT color="green">093</FONT>         * The default max growth factor is set to a quite low value: 2&lt;sup&gt;1/order&lt;/sup&gt;.<a name="line.93"></a>
+<FONT color="green">094</FONT>         * &lt;/p&gt;<a name="line.94"></a>
+<FONT color="green">095</FONT>         * @param name name of the method<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @param nSteps number of steps of the multistep method<a name="line.96"></a>
+<FONT color="green">097</FONT>         * (excluding the one being computed)<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @param order order of the method<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @param minStep minimal step (must be positive even for backward<a name="line.99"></a>
+<FONT color="green">100</FONT>         * integration), the last step can be smaller than this<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @param maxStep maximal step (must be positive even for backward<a name="line.101"></a>
+<FONT color="green">102</FONT>         * integration)<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @param scalAbsoluteTolerance allowed absolute error<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @param scalRelativeTolerance allowed relative error<a name="line.104"></a>
+<FONT color="green">105</FONT>         */<a name="line.105"></a>
+<FONT color="green">106</FONT>        protected MultistepIntegrator(final String name, final int nSteps,<a name="line.106"></a>
+<FONT color="green">107</FONT>                                      final int order,<a name="line.107"></a>
+<FONT color="green">108</FONT>                                      final double minStep, final double maxStep,<a name="line.108"></a>
+<FONT color="green">109</FONT>                                      final double scalAbsoluteTolerance,<a name="line.109"></a>
+<FONT color="green">110</FONT>                                      final double scalRelativeTolerance) {<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>            super(name, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance);<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>            if (nSteps &lt;= 0) {<a name="line.114"></a>
+<FONT color="green">115</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.115"></a>
+<FONT color="green">116</FONT>                      "{0} method needs at least one previous point",<a name="line.116"></a>
+<FONT color="green">117</FONT>                      name);<a name="line.117"></a>
+<FONT color="green">118</FONT>            }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>            starter = new DormandPrince853Integrator(minStep, maxStep,<a name="line.120"></a>
+<FONT color="green">121</FONT>                                                     scalAbsoluteTolerance,<a name="line.121"></a>
+<FONT color="green">122</FONT>                                                     scalRelativeTolerance);<a name="line.122"></a>
+<FONT color="green">123</FONT>            this.nSteps = nSteps;<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>            exp = -1.0 / order;<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>            // set the default values of the algorithm control parameters<a name="line.127"></a>
+<FONT color="green">128</FONT>            setSafety(0.9);<a name="line.128"></a>
+<FONT color="green">129</FONT>            setMinReduction(0.2);<a name="line.129"></a>
+<FONT color="green">130</FONT>            setMaxGrowth(Math.pow(2.0, -exp));<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>        }<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>        /**<a name="line.134"></a>
+<FONT color="green">135</FONT>         * Build a multistep integrator with the given stepsize bounds.<a name="line.135"></a>
+<FONT color="green">136</FONT>         * &lt;p&gt;The default starter integrator is set to the {@link<a name="line.136"></a>
+<FONT color="green">137</FONT>         * DormandPrince853Integrator Dormand-Prince 8(5,3)} integrator with<a name="line.137"></a>
+<FONT color="green">138</FONT>         * some defaults settings.&lt;/p&gt;<a name="line.138"></a>
+<FONT color="green">139</FONT>         * &lt;p&gt;<a name="line.139"></a>
+<FONT color="green">140</FONT>         * The default max growth factor is set to a quite low value: 2&lt;sup&gt;1/order&lt;/sup&gt;.<a name="line.140"></a>
+<FONT color="green">141</FONT>         * &lt;/p&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>         * @param name name of the method<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @param nSteps number of steps of the multistep method<a name="line.143"></a>
+<FONT color="green">144</FONT>         * (excluding the one being computed)<a name="line.144"></a>
+<FONT color="green">145</FONT>         * @param order order of the method<a name="line.145"></a>
+<FONT color="green">146</FONT>         * @param minStep minimal step (must be positive even for backward<a name="line.146"></a>
+<FONT color="green">147</FONT>         * integration), the last step can be smaller than this<a name="line.147"></a>
+<FONT color="green">148</FONT>         * @param maxStep maximal step (must be positive even for backward<a name="line.148"></a>
+<FONT color="green">149</FONT>         * integration)<a name="line.149"></a>
+<FONT color="green">150</FONT>         * @param vecAbsoluteTolerance allowed absolute error<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @param vecRelativeTolerance allowed relative error<a name="line.151"></a>
+<FONT color="green">152</FONT>         */<a name="line.152"></a>
+<FONT color="green">153</FONT>        protected MultistepIntegrator(final String name, final int nSteps,<a name="line.153"></a>
+<FONT color="green">154</FONT>                                      final int order,<a name="line.154"></a>
+<FONT color="green">155</FONT>                                      final double minStep, final double maxStep,<a name="line.155"></a>
+<FONT color="green">156</FONT>                                      final double[] vecAbsoluteTolerance,<a name="line.156"></a>
+<FONT color="green">157</FONT>                                      final double[] vecRelativeTolerance) {<a name="line.157"></a>
+<FONT color="green">158</FONT>            super(name, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance);<a name="line.158"></a>
+<FONT color="green">159</FONT>            starter = new DormandPrince853Integrator(minStep, maxStep,<a name="line.159"></a>
+<FONT color="green">160</FONT>                                                     vecAbsoluteTolerance,<a name="line.160"></a>
+<FONT color="green">161</FONT>                                                     vecRelativeTolerance);<a name="line.161"></a>
+<FONT color="green">162</FONT>            this.nSteps = nSteps;<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>            exp = -1.0 / order;<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>            // set the default values of the algorithm control parameters<a name="line.166"></a>
+<FONT color="green">167</FONT>            setSafety(0.9);<a name="line.167"></a>
+<FONT color="green">168</FONT>            setMinReduction(0.2);<a name="line.168"></a>
+<FONT color="green">169</FONT>            setMaxGrowth(Math.pow(2.0, -exp));<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>        }<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>        /**<a name="line.173"></a>
+<FONT color="green">174</FONT>         * Get the starter integrator.<a name="line.174"></a>
+<FONT color="green">175</FONT>         * @return starter integrator<a name="line.175"></a>
+<FONT color="green">176</FONT>         */<a name="line.176"></a>
+<FONT color="green">177</FONT>        public ODEIntegrator getStarterIntegrator() {<a name="line.177"></a>
+<FONT color="green">178</FONT>            return starter;<a name="line.178"></a>
+<FONT color="green">179</FONT>        }<a name="line.179"></a>
+<FONT color="green">180</FONT>    <a name="line.180"></a>
+<FONT color="green">181</FONT>        /**<a name="line.181"></a>
+<FONT color="green">182</FONT>         * Set the starter integrator.<a name="line.182"></a>
+<FONT color="green">183</FONT>         * &lt;p&gt;The various step and event handlers for this starter integrator<a name="line.183"></a>
+<FONT color="green">184</FONT>         * will be managed automatically by the multi-step integrator. Any<a name="line.184"></a>
+<FONT color="green">185</FONT>         * user configuration for these elements will be cleared before use.&lt;/p&gt;<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @param starterIntegrator starter integrator<a name="line.186"></a>
+<FONT color="green">187</FONT>         */<a name="line.187"></a>
+<FONT color="green">188</FONT>        public void setStarterIntegrator(FirstOrderIntegrator starterIntegrator) {<a name="line.188"></a>
+<FONT color="green">189</FONT>            this.starter = starterIntegrator;<a name="line.189"></a>
+<FONT color="green">190</FONT>        }<a name="line.190"></a>
+<FONT color="green">191</FONT>    <a name="line.191"></a>
+<FONT color="green">192</FONT>        /** Start the integration.<a name="line.192"></a>
+<FONT color="green">193</FONT>         * &lt;p&gt;This method computes one step using the underlying starter integrator,<a name="line.193"></a>
+<FONT color="green">194</FONT>         * and initializes the Nordsieck vector at step start. The starter integrator<a name="line.194"></a>
+<FONT color="green">195</FONT>         * purpose is only to establish initial conditions, it does not really change<a name="line.195"></a>
+<FONT color="green">196</FONT>         * time by itself. The top level multistep integrator remains in charge of<a name="line.196"></a>
+<FONT color="green">197</FONT>         * handling time propagation and events handling as it will starts its own<a name="line.197"></a>
+<FONT color="green">198</FONT>         * computation right from the beginning. In a sense, the starter integrator<a name="line.198"></a>
+<FONT color="green">199</FONT>         * can be seen as a dummy one and so it will never trigger any user event nor<a name="line.199"></a>
+<FONT color="green">200</FONT>         * call any user step handler.&lt;/p&gt;<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @param t0 initial time<a name="line.201"></a>
+<FONT color="green">202</FONT>         * @param y0 initial value of the state vector at t0<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @param t target time for the integration<a name="line.203"></a>
+<FONT color="green">204</FONT>         * (can be set to a value smaller than &lt;code&gt;t0&lt;/code&gt; for backward integration)<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @throws IntegratorException if the integrator cannot perform integration<a name="line.205"></a>
+<FONT color="green">206</FONT>         * @throws DerivativeException this exception is propagated to the caller if<a name="line.206"></a>
+<FONT color="green">207</FONT>         * the underlying user function triggers one<a name="line.207"></a>
+<FONT color="green">208</FONT>         */<a name="line.208"></a>
+<FONT color="green">209</FONT>        protected void start(final double t0, final double[] y0, final double t)<a name="line.209"></a>
+<FONT color="green">210</FONT>            throws DerivativeException, IntegratorException {<a name="line.210"></a>
+<FONT color="green">211</FONT>    <a name="line.211"></a>
+<FONT color="green">212</FONT>            // make sure NO user event nor user step handler is triggered,<a name="line.212"></a>
+<FONT color="green">213</FONT>            // this is the task of the top level integrator, not the task<a name="line.213"></a>
+<FONT color="green">214</FONT>            // of the starter integrator<a name="line.214"></a>
+<FONT color="green">215</FONT>            starter.clearEventHandlers();<a name="line.215"></a>
+<FONT color="green">216</FONT>            starter.clearStepHandlers();<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>            // set up one specific step handler to extract initial Nordsieck vector<a name="line.218"></a>
+<FONT color="green">219</FONT>            starter.addStepHandler(new NordsieckInitializer(y0.length));<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>            // start integration, expecting a InitializationCompletedMarkerException<a name="line.221"></a>
+<FONT color="green">222</FONT>            try {<a name="line.222"></a>
+<FONT color="green">223</FONT>                starter.integrate(new CountingDifferentialEquations(y0.length),<a name="line.223"></a>
+<FONT color="green">224</FONT>                                  t0, y0, t, new double[y0.length]);<a name="line.224"></a>
+<FONT color="green">225</FONT>            } catch (DerivativeException de) {<a name="line.225"></a>
+<FONT color="green">226</FONT>                if (!(de instanceof InitializationCompletedMarkerException)) {<a name="line.226"></a>
+<FONT color="green">227</FONT>                    // this is not the expected nominal interruption of the start integrator<a name="line.227"></a>
+<FONT color="green">228</FONT>                    throw de;<a name="line.228"></a>
+<FONT color="green">229</FONT>                }<a name="line.229"></a>
+<FONT color="green">230</FONT>            }<a name="line.230"></a>
+<FONT color="green">231</FONT>    <a name="line.231"></a>
+<FONT color="green">232</FONT>            // remove the specific step handler<a name="line.232"></a>
+<FONT color="green">233</FONT>            starter.clearStepHandlers();<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>        }<a name="line.235"></a>
+<FONT color="green">236</FONT>    <a name="line.236"></a>
+<FONT color="green">237</FONT>        /** Initialize the high order scaled derivatives at step start.<a name="line.237"></a>
+<FONT color="green">238</FONT>         * @param first first scaled derivative at step start<a name="line.238"></a>
+<FONT color="green">239</FONT>         * @param multistep scaled derivatives after step start (hy'1, ..., hy'k-1)<a name="line.239"></a>
+<FONT color="green">240</FONT>         * will be modified<a name="line.240"></a>
+<FONT color="green">241</FONT>         * @return high order scaled derivatives at step start<a name="line.241"></a>
+<FONT color="green">242</FONT>         */<a name="line.242"></a>
+<FONT color="green">243</FONT>        protected abstract Array2DRowRealMatrix initializeHighOrderDerivatives(final double[] first,<a name="line.243"></a>
+<FONT color="green">244</FONT>                                                                               final double[][] multistep);<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>        /** Get the minimal reduction factor for stepsize control.<a name="line.246"></a>
+<FONT color="green">247</FONT>         * @return minimal reduction factor<a name="line.247"></a>
+<FONT color="green">248</FONT>         */<a name="line.248"></a>
+<FONT color="green">249</FONT>        public double getMinReduction() {<a name="line.249"></a>
+<FONT color="green">250</FONT>            return minReduction;<a name="line.250"></a>
+<FONT color="green">251</FONT>        }<a name="line.251"></a>
+<FONT color="green">252</FONT>    <a name="line.252"></a>
+<FONT color="green">253</FONT>        /** Set the minimal reduction factor for stepsize control.<a name="line.253"></a>
+<FONT color="green">254</FONT>         * @param minReduction minimal reduction factor<a name="line.254"></a>
+<FONT color="green">255</FONT>         */<a name="line.255"></a>
+<FONT color="green">256</FONT>        public void setMinReduction(final double minReduction) {<a name="line.256"></a>
+<FONT color="green">257</FONT>            this.minReduction = minReduction;<a name="line.257"></a>
+<FONT color="green">258</FONT>        }<a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>        /** Get the maximal growth factor for stepsize control.<a name="line.260"></a>
+<FONT color="green">261</FONT>         * @return maximal growth factor<a name="line.261"></a>
+<FONT color="green">262</FONT>         */<a name="line.262"></a>
+<FONT color="green">263</FONT>        public double getMaxGrowth() {<a name="line.263"></a>
+<FONT color="green">264</FONT>            return maxGrowth;<a name="line.264"></a>
+<FONT color="green">265</FONT>        }<a name="line.265"></a>
+<FONT color="green">266</FONT>    <a name="line.266"></a>
+<FONT color="green">267</FONT>        /** Set the maximal growth factor for stepsize control.<a name="line.267"></a>
+<FONT color="green">268</FONT>         * @param maxGrowth maximal growth factor<a name="line.268"></a>
+<FONT color="green">269</FONT>         */<a name="line.269"></a>
+<FONT color="green">270</FONT>        public void setMaxGrowth(final double maxGrowth) {<a name="line.270"></a>
+<FONT color="green">271</FONT>            this.maxGrowth = maxGrowth;<a name="line.271"></a>
+<FONT color="green">272</FONT>        }<a name="line.272"></a>
+<FONT color="green">273</FONT>    <a name="line.273"></a>
+<FONT color="green">274</FONT>        /** Get the safety factor for stepsize control.<a name="line.274"></a>
+<FONT color="green">275</FONT>         * @return safety factor<a name="line.275"></a>
+<FONT color="green">276</FONT>         */<a name="line.276"></a>
+<FONT color="green">277</FONT>        public double getSafety() {<a name="line.277"></a>
+<FONT color="green">278</FONT>          return safety;<a name="line.278"></a>
+<FONT color="green">279</FONT>        }<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>        /** Set the safety factor for stepsize control.<a name="line.281"></a>
+<FONT color="green">282</FONT>         * @param safety safety factor<a name="line.282"></a>
+<FONT color="green">283</FONT>         */<a name="line.283"></a>
+<FONT color="green">284</FONT>        public void setSafety(final double safety) {<a name="line.284"></a>
+<FONT color="green">285</FONT>          this.safety = safety;<a name="line.285"></a>
+<FONT color="green">286</FONT>        }<a name="line.286"></a>
+<FONT color="green">287</FONT>    <a name="line.287"></a>
+<FONT color="green">288</FONT>        /** Compute step grow/shrink factor according to normalized error.<a name="line.288"></a>
+<FONT color="green">289</FONT>         * @param error normalized error of the current step<a name="line.289"></a>
+<FONT color="green">290</FONT>         * @return grow/shrink factor for next step<a name="line.290"></a>
+<FONT color="green">291</FONT>         */<a name="line.291"></a>
+<FONT color="green">292</FONT>        protected double computeStepGrowShrinkFactor(final double error) {<a name="line.292"></a>
+<FONT color="green">293</FONT>            return Math.min(maxGrowth, Math.max(minReduction, safety * Math.pow(error, exp)));<a name="line.293"></a>
+<FONT color="green">294</FONT>        }<a name="line.294"></a>
+<FONT color="green">295</FONT>    <a name="line.295"></a>
+<FONT color="green">296</FONT>        /** Transformer used to convert the first step to Nordsieck representation. */<a name="line.296"></a>
+<FONT color="green">297</FONT>        public static interface NordsieckTransformer {<a name="line.297"></a>
+<FONT color="green">298</FONT>            /** Initialize the high order scaled derivatives at step start.<a name="line.298"></a>
+<FONT color="green">299</FONT>             * @param first first scaled derivative at step start<a name="line.299"></a>
+<FONT color="green">300</FONT>             * @param multistep scaled derivatives after step start (hy'1, ..., hy'k-1)<a name="line.300"></a>
+<FONT color="green">301</FONT>             * will be modified<a name="line.301"></a>
+<FONT color="green">302</FONT>             * @return high order derivatives at step start<a name="line.302"></a>
+<FONT color="green">303</FONT>             */<a name="line.303"></a>
+<FONT color="green">304</FONT>            RealMatrix initializeHighOrderDerivatives(double[] first, double[][] multistep);<a name="line.304"></a>
+<FONT color="green">305</FONT>        }<a name="line.305"></a>
+<FONT color="green">306</FONT>    <a name="line.306"></a>
+<FONT color="green">307</FONT>        /** Specialized step handler storing the first step. */<a name="line.307"></a>
+<FONT color="green">308</FONT>        private class NordsieckInitializer implements StepHandler {<a name="line.308"></a>
+<FONT color="green">309</FONT>    <a name="line.309"></a>
+<FONT color="green">310</FONT>            /** Problem dimension. */<a name="line.310"></a>
+<FONT color="green">311</FONT>            private final int n;<a name="line.311"></a>
+<FONT color="green">312</FONT>    <a name="line.312"></a>
+<FONT color="green">313</FONT>            /** Simple constructor.<a name="line.313"></a>
+<FONT color="green">314</FONT>             * @param n problem dimension<a name="line.314"></a>
+<FONT color="green">315</FONT>             */<a name="line.315"></a>
+<FONT color="green">316</FONT>            public NordsieckInitializer(final int n) {<a name="line.316"></a>
+<FONT color="green">317</FONT>                this.n = n;<a name="line.317"></a>
+<FONT color="green">318</FONT>            }<a name="line.318"></a>
+<FONT color="green">319</FONT>    <a name="line.319"></a>
+<FONT color="green">320</FONT>            /** {@inheritDoc} */<a name="line.320"></a>
+<FONT color="green">321</FONT>            public void handleStep(StepInterpolator interpolator, boolean isLast)<a name="line.321"></a>
+<FONT color="green">322</FONT>                throws DerivativeException {<a name="line.322"></a>
+<FONT color="green">323</FONT>    <a name="line.323"></a>
+<FONT color="green">324</FONT>                final double prev = interpolator.getPreviousTime();<a name="line.324"></a>
+<FONT color="green">325</FONT>                final double curr = interpolator.getCurrentTime();<a name="line.325"></a>
+<FONT color="green">326</FONT>                stepStart = prev;<a name="line.326"></a>
+<FONT color="green">327</FONT>                stepSize  = (curr - prev) / (nSteps + 1);<a name="line.327"></a>
+<FONT color="green">328</FONT>    <a name="line.328"></a>
+<FONT color="green">329</FONT>                // compute the first scaled derivative<a name="line.329"></a>
+<FONT color="green">330</FONT>                interpolator.setInterpolatedTime(prev);<a name="line.330"></a>
+<FONT color="green">331</FONT>                scaled = interpolator.getInterpolatedDerivatives().clone();<a name="line.331"></a>
+<FONT color="green">332</FONT>                for (int j = 0; j &lt; n; ++j) {<a name="line.332"></a>
+<FONT color="green">333</FONT>                    scaled[j] *= stepSize;<a name="line.333"></a>
+<FONT color="green">334</FONT>                }<a name="line.334"></a>
+<FONT color="green">335</FONT>    <a name="line.335"></a>
+<FONT color="green">336</FONT>                // compute the high order scaled derivatives<a name="line.336"></a>
+<FONT color="green">337</FONT>                final double[][] multistep = new double[nSteps][];<a name="line.337"></a>
+<FONT color="green">338</FONT>                for (int i = 1; i &lt;= nSteps; ++i) {<a name="line.338"></a>
+<FONT color="green">339</FONT>                    interpolator.setInterpolatedTime(prev + stepSize * i);<a name="line.339"></a>
+<FONT color="green">340</FONT>                    final double[] msI = interpolator.getInterpolatedDerivatives().clone();<a name="line.340"></a>
+<FONT color="green">341</FONT>                    for (int j = 0; j &lt; n; ++j) {<a name="line.341"></a>
+<FONT color="green">342</FONT>                        msI[j] *= stepSize;<a name="line.342"></a>
+<FONT color="green">343</FONT>                    }<a name="line.343"></a>
+<FONT color="green">344</FONT>                    multistep[i - 1] = msI;<a name="line.344"></a>
+<FONT color="green">345</FONT>                }<a name="line.345"></a>
+<FONT color="green">346</FONT>                nordsieck = initializeHighOrderDerivatives(scaled, multistep);<a name="line.346"></a>
+<FONT color="green">347</FONT>    <a name="line.347"></a>
+<FONT color="green">348</FONT>                // stop the integrator after the first step has been handled<a name="line.348"></a>
+<FONT color="green">349</FONT>                throw new InitializationCompletedMarkerException();<a name="line.349"></a>
+<FONT color="green">350</FONT>    <a name="line.350"></a>
+<FONT color="green">351</FONT>            }<a name="line.351"></a>
+<FONT color="green">352</FONT>    <a name="line.352"></a>
+<FONT color="green">353</FONT>            /** {@inheritDoc} */<a name="line.353"></a>
+<FONT color="green">354</FONT>            public boolean requiresDenseOutput() {<a name="line.354"></a>
+<FONT color="green">355</FONT>                return true;<a name="line.355"></a>
+<FONT color="green">356</FONT>            }<a name="line.356"></a>
+<FONT color="green">357</FONT>    <a name="line.357"></a>
+<FONT color="green">358</FONT>            /** {@inheritDoc} */<a name="line.358"></a>
+<FONT color="green">359</FONT>            public void reset() {<a name="line.359"></a>
+<FONT color="green">360</FONT>                // nothing to do<a name="line.360"></a>
+<FONT color="green">361</FONT>            }<a name="line.361"></a>
+<FONT color="green">362</FONT>    <a name="line.362"></a>
+<FONT color="green">363</FONT>        }<a name="line.363"></a>
+<FONT color="green">364</FONT>    <a name="line.364"></a>
+<FONT color="green">365</FONT>        /** Marker exception used ONLY to stop the starter integrator after first step. */<a name="line.365"></a>
+<FONT color="green">366</FONT>        private static class InitializationCompletedMarkerException<a name="line.366"></a>
+<FONT color="green">367</FONT>            extends DerivativeException {<a name="line.367"></a>
+<FONT color="green">368</FONT>    <a name="line.368"></a>
+<FONT color="green">369</FONT>            /** Serializable version identifier. */<a name="line.369"></a>
+<FONT color="green">370</FONT>            private static final long serialVersionUID = -4105805787353488365L;<a name="line.370"></a>
+<FONT color="green">371</FONT>    <a name="line.371"></a>
+<FONT color="green">372</FONT>            /** Simple constructor. */<a name="line.372"></a>
+<FONT color="green">373</FONT>            public InitializationCompletedMarkerException() {<a name="line.373"></a>
+<FONT color="green">374</FONT>                super((Throwable) null);<a name="line.374"></a>
+<FONT color="green">375</FONT>            }<a name="line.375"></a>
+<FONT color="green">376</FONT>    <a name="line.376"></a>
+<FONT color="green">377</FONT>        }<a name="line.377"></a>
+<FONT color="green">378</FONT>    <a name="line.378"></a>
+<FONT color="green">379</FONT>        /** Wrapper for differential equations, ensuring start evaluations are counted. */<a name="line.379"></a>
+<FONT color="green">380</FONT>        private class CountingDifferentialEquations implements FirstOrderDifferentialEquations {<a name="line.380"></a>
+<FONT color="green">381</FONT>    <a name="line.381"></a>
+<FONT color="green">382</FONT>            /** Dimension of the problem. */<a name="line.382"></a>
+<FONT color="green">383</FONT>            private final int dimension;<a name="line.383"></a>
+<FONT color="green">384</FONT>    <a name="line.384"></a>
+<FONT color="green">385</FONT>            /** Simple constructor.<a name="line.385"></a>
+<FONT color="green">386</FONT>             * @param dimension dimension of the problem<a name="line.386"></a>
+<FONT color="green">387</FONT>             */<a name="line.387"></a>
+<FONT color="green">388</FONT>            public CountingDifferentialEquations(final int dimension) {<a name="line.388"></a>
+<FONT color="green">389</FONT>                this.dimension = dimension;<a name="line.389"></a>
+<FONT color="green">390</FONT>            }<a name="line.390"></a>
+<FONT color="green">391</FONT>    <a name="line.391"></a>
+<FONT color="green">392</FONT>            /** {@inheritDoc} */<a name="line.392"></a>
+<FONT color="green">393</FONT>            public void computeDerivatives(double t, double[] y, double[] dot)<a name="line.393"></a>
+<FONT color="green">394</FONT>                    throws DerivativeException {<a name="line.394"></a>
+<FONT color="green">395</FONT>                MultistepIntegrator.this.computeDerivatives(t, y, dot);<a name="line.395"></a>
+<FONT color="green">396</FONT>            }<a name="line.396"></a>
+<FONT color="green">397</FONT>    <a name="line.397"></a>
+<FONT color="green">398</FONT>            /** {@inheritDoc} */<a name="line.398"></a>
+<FONT color="green">399</FONT>            public int getDimension() {<a name="line.399"></a>
+<FONT color="green">400</FONT>                return dimension;<a name="line.400"></a>
+<FONT color="green">401</FONT>            }<a name="line.401"></a>
+<FONT color="green">402</FONT>        }<a name="line.402"></a>
+<FONT color="green">403</FONT>    <a name="line.403"></a>
+<FONT color="green">404</FONT>    }<a name="line.404"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/MultistepIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,470 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.linear.Array2DRowRealMatrix;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.linear.RealMatrix;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.ode.nonstiff.AdaptiveStepsizeIntegrator;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.ode.nonstiff.DormandPrince853Integrator;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.ode.sampling.StepHandler;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.ode.sampling.StepInterpolator;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    /**<a name="line.28"></a>
+<FONT color="green">029</FONT>     * This class is the base class for multistep integrators for Ordinary<a name="line.29"></a>
+<FONT color="green">030</FONT>     * Differential Equations.<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;We define scaled derivatives s&lt;sub&gt;i&lt;/sub&gt;(n) at step n as:<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;pre&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * s&lt;sub&gt;1&lt;/sub&gt;(n) = h y'&lt;sub&gt;n&lt;/sub&gt; for first derivative<a name="line.33"></a>
+<FONT color="green">034</FONT>     * s&lt;sub&gt;2&lt;/sub&gt;(n) = h&lt;sup&gt;2&lt;/sup&gt;/2 y''&lt;sub&gt;n&lt;/sub&gt; for second derivative<a name="line.34"></a>
+<FONT color="green">035</FONT>     * s&lt;sub&gt;3&lt;/sub&gt;(n) = h&lt;sup&gt;3&lt;/sup&gt;/6 y'''&lt;sub&gt;n&lt;/sub&gt; for third derivative<a name="line.35"></a>
+<FONT color="green">036</FONT>     * ...<a name="line.36"></a>
+<FONT color="green">037</FONT>     * s&lt;sub&gt;k&lt;/sub&gt;(n) = h&lt;sup&gt;k&lt;/sup&gt;/k! y(k)&lt;sub&gt;n&lt;/sub&gt; for k&lt;sup&gt;th&lt;/sup&gt; derivative<a name="line.37"></a>
+<FONT color="green">038</FONT>     * &lt;/pre&gt;&lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;p&gt;Rather than storing several previous steps separately, this implementation uses<a name="line.39"></a>
+<FONT color="green">040</FONT>     * the Nordsieck vector with higher degrees scaled derivatives all taken at the same<a name="line.40"></a>
+<FONT color="green">041</FONT>     * step (y&lt;sub&gt;n&lt;/sub&gt;, s&lt;sub&gt;1&lt;/sub&gt;(n) and r&lt;sub&gt;n&lt;/sub&gt;) where r&lt;sub&gt;n&lt;/sub&gt; is defined as:<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;pre&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     * r&lt;sub&gt;n&lt;/sub&gt; = [ s&lt;sub&gt;2&lt;/sub&gt;(n), s&lt;sub&gt;3&lt;/sub&gt;(n) ... s&lt;sub&gt;k&lt;/sub&gt;(n) ]&lt;sup&gt;T&lt;/sup&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;/pre&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     * (we omit the k index in the notation for clarity)&lt;/p&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     * &lt;p&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     * Multistep integrators with Nordsieck representation are highly sensitive to<a name="line.47"></a>
+<FONT color="green">048</FONT>     * large step changes because when the step is multiplied by a factor a, the<a name="line.48"></a>
+<FONT color="green">049</FONT>     * k&lt;sup&gt;th&lt;/sup&gt; component of the Nordsieck vector is multiplied by a&lt;sup&gt;k&lt;/sup&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     * and the last components are the least accurate ones. The default max growth<a name="line.50"></a>
+<FONT color="green">051</FONT>     * factor is therefore set to a quite low value: 2&lt;sup&gt;1/order&lt;/sup&gt;.<a name="line.51"></a>
+<FONT color="green">052</FONT>     * &lt;/p&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>     *<a name="line.53"></a>
+<FONT color="green">054</FONT>     * @see org.apache.commons.math.ode.nonstiff.AdamsBashforthIntegrator<a name="line.54"></a>
+<FONT color="green">055</FONT>     * @see org.apache.commons.math.ode.nonstiff.AdamsMoultonIntegrator<a name="line.55"></a>
+<FONT color="green">056</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.56"></a>
+<FONT color="green">057</FONT>     * @since 2.0<a name="line.57"></a>
+<FONT color="green">058</FONT>     */<a name="line.58"></a>
+<FONT color="green">059</FONT>    public abstract class MultistepIntegrator extends AdaptiveStepsizeIntegrator {<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /** First scaled derivative (h y'). */<a name="line.61"></a>
+<FONT color="green">062</FONT>        protected double[] scaled;<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /** Nordsieck matrix of the higher scaled derivatives.<a name="line.64"></a>
+<FONT color="green">065</FONT>         * &lt;p&gt;(h&lt;sup&gt;2&lt;/sup&gt;/2 y'', h&lt;sup&gt;3&lt;/sup&gt;/6 y''' ..., h&lt;sup&gt;k&lt;/sup&gt;/k! y(k))&lt;/p&gt;<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        protected Array2DRowRealMatrix nordsieck;<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /** Starter integrator. */<a name="line.69"></a>
+<FONT color="green">070</FONT>        private FirstOrderIntegrator starter;<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /** Number of steps of the multistep method (excluding the one being computed). */<a name="line.72"></a>
+<FONT color="green">073</FONT>        private final int nSteps;<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /** Stepsize control exponent. */<a name="line.75"></a>
+<FONT color="green">076</FONT>        private double exp;<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /** Safety factor for stepsize control. */<a name="line.78"></a>
+<FONT color="green">079</FONT>        private double safety;<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /** Minimal reduction factor for stepsize control. */<a name="line.81"></a>
+<FONT color="green">082</FONT>        private double minReduction;<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /** Maximal growth factor for stepsize control. */<a name="line.84"></a>
+<FONT color="green">085</FONT>        private double maxGrowth;<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>        /**<a name="line.87"></a>
+<FONT color="green">088</FONT>         * Build a multistep integrator with the given stepsize bounds.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * &lt;p&gt;The default starter integrator is set to the {@link<a name="line.89"></a>
+<FONT color="green">090</FONT>         * DormandPrince853Integrator Dormand-Prince 8(5,3)} integrator with<a name="line.90"></a>
+<FONT color="green">091</FONT>         * some defaults settings.&lt;/p&gt;<a name="line.91"></a>
+<FONT color="green">092</FONT>         * &lt;p&gt;<a name="line.92"></a>
+<FONT color="green">093</FONT>         * The default max growth factor is set to a quite low value: 2&lt;sup&gt;1/order&lt;/sup&gt;.<a name="line.93"></a>
+<FONT color="green">094</FONT>         * &lt;/p&gt;<a name="line.94"></a>
+<FONT color="green">095</FONT>         * @param name name of the method<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @param nSteps number of steps of the multistep method<a name="line.96"></a>
+<FONT color="green">097</FONT>         * (excluding the one being computed)<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @param order order of the method<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @param minStep minimal step (must be positive even for backward<a name="line.99"></a>
+<FONT color="green">100</FONT>         * integration), the last step can be smaller than this<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @param maxStep maximal step (must be positive even for backward<a name="line.101"></a>
+<FONT color="green">102</FONT>         * integration)<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @param scalAbsoluteTolerance allowed absolute error<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @param scalRelativeTolerance allowed relative error<a name="line.104"></a>
+<FONT color="green">105</FONT>         */<a name="line.105"></a>
+<FONT color="green">106</FONT>        protected MultistepIntegrator(final String name, final int nSteps,<a name="line.106"></a>
+<FONT color="green">107</FONT>                                      final int order,<a name="line.107"></a>
+<FONT color="green">108</FONT>                                      final double minStep, final double maxStep,<a name="line.108"></a>
+<FONT color="green">109</FONT>                                      final double scalAbsoluteTolerance,<a name="line.109"></a>
+<FONT color="green">110</FONT>                                      final double scalRelativeTolerance) {<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>            super(name, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance);<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>            if (nSteps &lt;= 0) {<a name="line.114"></a>
+<FONT color="green">115</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.115"></a>
+<FONT color="green">116</FONT>                      "{0} method needs at least one previous point",<a name="line.116"></a>
+<FONT color="green">117</FONT>                      name);<a name="line.117"></a>
+<FONT color="green">118</FONT>            }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>            starter = new DormandPrince853Integrator(minStep, maxStep,<a name="line.120"></a>
+<FONT color="green">121</FONT>                                                     scalAbsoluteTolerance,<a name="line.121"></a>
+<FONT color="green">122</FONT>                                                     scalRelativeTolerance);<a name="line.122"></a>
+<FONT color="green">123</FONT>            this.nSteps = nSteps;<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>            exp = -1.0 / order;<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>            // set the default values of the algorithm control parameters<a name="line.127"></a>
+<FONT color="green">128</FONT>            setSafety(0.9);<a name="line.128"></a>
+<FONT color="green">129</FONT>            setMinReduction(0.2);<a name="line.129"></a>
+<FONT color="green">130</FONT>            setMaxGrowth(Math.pow(2.0, -exp));<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>        }<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>        /**<a name="line.134"></a>
+<FONT color="green">135</FONT>         * Build a multistep integrator with the given stepsize bounds.<a name="line.135"></a>
+<FONT color="green">136</FONT>         * &lt;p&gt;The default starter integrator is set to the {@link<a name="line.136"></a>
+<FONT color="green">137</FONT>         * DormandPrince853Integrator Dormand-Prince 8(5,3)} integrator with<a name="line.137"></a>
+<FONT color="green">138</FONT>         * some defaults settings.&lt;/p&gt;<a name="line.138"></a>
+<FONT color="green">139</FONT>         * &lt;p&gt;<a name="line.139"></a>
+<FONT color="green">140</FONT>         * The default max growth factor is set to a quite low value: 2&lt;sup&gt;1/order&lt;/sup&gt;.<a name="line.140"></a>
+<FONT color="green">141</FONT>         * &lt;/p&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>         * @param name name of the method<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @param nSteps number of steps of the multistep method<a name="line.143"></a>
+<FONT color="green">144</FONT>         * (excluding the one being computed)<a name="line.144"></a>
+<FONT color="green">145</FONT>         * @param order order of the method<a name="line.145"></a>
+<FONT color="green">146</FONT>         * @param minStep minimal step (must be positive even for backward<a name="line.146"></a>
+<FONT color="green">147</FONT>         * integration), the last step can be smaller than this<a name="line.147"></a>
+<FONT color="green">148</FONT>         * @param maxStep maximal step (must be positive even for backward<a name="line.148"></a>
+<FONT color="green">149</FONT>         * integration)<a name="line.149"></a>
+<FONT color="green">150</FONT>         * @param vecAbsoluteTolerance allowed absolute error<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @param vecRelativeTolerance allowed relative error<a name="line.151"></a>
+<FONT color="green">152</FONT>         */<a name="line.152"></a>
+<FONT color="green">153</FONT>        protected MultistepIntegrator(final String name, final int nSteps,<a name="line.153"></a>
+<FONT color="green">154</FONT>                                      final int order,<a name="line.154"></a>
+<FONT color="green">155</FONT>                                      final double minStep, final double maxStep,<a name="line.155"></a>
+<FONT color="green">156</FONT>                                      final double[] vecAbsoluteTolerance,<a name="line.156"></a>
+<FONT color="green">157</FONT>                                      final double[] vecRelativeTolerance) {<a name="line.157"></a>
+<FONT color="green">158</FONT>            super(name, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance);<a name="line.158"></a>
+<FONT color="green">159</FONT>            starter = new DormandPrince853Integrator(minStep, maxStep,<a name="line.159"></a>
+<FONT color="green">160</FONT>                                                     vecAbsoluteTolerance,<a name="line.160"></a>
+<FONT color="green">161</FONT>                                                     vecRelativeTolerance);<a name="line.161"></a>
+<FONT color="green">162</FONT>            this.nSteps = nSteps;<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>            exp = -1.0 / order;<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>            // set the default values of the algorithm control parameters<a name="line.166"></a>
+<FONT color="green">167</FONT>            setSafety(0.9);<a name="line.167"></a>
+<FONT color="green">168</FONT>            setMinReduction(0.2);<a name="line.168"></a>
+<FONT color="green">169</FONT>            setMaxGrowth(Math.pow(2.0, -exp));<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>        }<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>        /**<a name="line.173"></a>
+<FONT color="green">174</FONT>         * Get the starter integrator.<a name="line.174"></a>
+<FONT color="green">175</FONT>         * @return starter integrator<a name="line.175"></a>
+<FONT color="green">176</FONT>         */<a name="line.176"></a>
+<FONT color="green">177</FONT>        public ODEIntegrator getStarterIntegrator() {<a name="line.177"></a>
+<FONT color="green">178</FONT>            return starter;<a name="line.178"></a>
+<FONT color="green">179</FONT>        }<a name="line.179"></a>
+<FONT color="green">180</FONT>    <a name="line.180"></a>
+<FONT color="green">181</FONT>        /**<a name="line.181"></a>
+<FONT color="green">182</FONT>         * Set the starter integrator.<a name="line.182"></a>
+<FONT color="green">183</FONT>         * &lt;p&gt;The various step and event handlers for this starter integrator<a name="line.183"></a>
+<FONT color="green">184</FONT>         * will be managed automatically by the multi-step integrator. Any<a name="line.184"></a>
+<FONT color="green">185</FONT>         * user configuration for these elements will be cleared before use.&lt;/p&gt;<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @param starterIntegrator starter integrator<a name="line.186"></a>
+<FONT color="green">187</FONT>         */<a name="line.187"></a>
+<FONT color="green">188</FONT>        public void setStarterIntegrator(FirstOrderIntegrator starterIntegrator) {<a name="line.188"></a>
+<FONT color="green">189</FONT>            this.starter = starterIntegrator;<a name="line.189"></a>
+<FONT color="green">190</FONT>        }<a name="line.190"></a>
+<FONT color="green">191</FONT>    <a name="line.191"></a>
+<FONT color="green">192</FONT>        /** Start the integration.<a name="line.192"></a>
+<FONT color="green">193</FONT>         * &lt;p&gt;This method computes one step using the underlying starter integrator,<a name="line.193"></a>
+<FONT color="green">194</FONT>         * and initializes the Nordsieck vector at step start. The starter integrator<a name="line.194"></a>
+<FONT color="green">195</FONT>         * purpose is only to establish initial conditions, it does not really change<a name="line.195"></a>
+<FONT color="green">196</FONT>         * time by itself. The top level multistep integrator remains in charge of<a name="line.196"></a>
+<FONT color="green">197</FONT>         * handling time propagation and events handling as it will starts its own<a name="line.197"></a>
+<FONT color="green">198</FONT>         * computation right from the beginning. In a sense, the starter integrator<a name="line.198"></a>
+<FONT color="green">199</FONT>         * can be seen as a dummy one and so it will never trigger any user event nor<a name="line.199"></a>
+<FONT color="green">200</FONT>         * call any user step handler.&lt;/p&gt;<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @param t0 initial time<a name="line.201"></a>
+<FONT color="green">202</FONT>         * @param y0 initial value of the state vector at t0<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @param t target time for the integration<a name="line.203"></a>
+<FONT color="green">204</FONT>         * (can be set to a value smaller than &lt;code&gt;t0&lt;/code&gt; for backward integration)<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @throws IntegratorException if the integrator cannot perform integration<a name="line.205"></a>
+<FONT color="green">206</FONT>         * @throws DerivativeException this exception is propagated to the caller if<a name="line.206"></a>
+<FONT color="green">207</FONT>         * the underlying user function triggers one<a name="line.207"></a>
+<FONT color="green">208</FONT>         */<a name="line.208"></a>
+<FONT color="green">209</FONT>        protected void start(final double t0, final double[] y0, final double t)<a name="line.209"></a>
+<FONT color="green">210</FONT>            throws DerivativeException, IntegratorException {<a name="line.210"></a>
+<FONT color="green">211</FONT>    <a name="line.211"></a>
+<FONT color="green">212</FONT>            // make sure NO user event nor user step handler is triggered,<a name="line.212"></a>
+<FONT color="green">213</FONT>            // this is the task of the top level integrator, not the task<a name="line.213"></a>
+<FONT color="green">214</FONT>            // of the starter integrator<a name="line.214"></a>
+<FONT color="green">215</FONT>            starter.clearEventHandlers();<a name="line.215"></a>
+<FONT color="green">216</FONT>            starter.clearStepHandlers();<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>            // set up one specific step handler to extract initial Nordsieck vector<a name="line.218"></a>
+<FONT color="green">219</FONT>            starter.addStepHandler(new NordsieckInitializer(y0.length));<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>            // start integration, expecting a InitializationCompletedMarkerException<a name="line.221"></a>
+<FONT color="green">222</FONT>            try {<a name="line.222"></a>
+<FONT color="green">223</FONT>                starter.integrate(new CountingDifferentialEquations(y0.length),<a name="line.223"></a>
+<FONT color="green">224</FONT>                                  t0, y0, t, new double[y0.length]);<a name="line.224"></a>
+<FONT color="green">225</FONT>            } catch (DerivativeException de) {<a name="line.225"></a>
+<FONT color="green">226</FONT>                if (!(de instanceof InitializationCompletedMarkerException)) {<a name="line.226"></a>
+<FONT color="green">227</FONT>                    // this is not the expected nominal interruption of the start integrator<a name="line.227"></a>
+<FONT color="green">228</FONT>                    throw de;<a name="line.228"></a>
+<FONT color="green">229</FONT>                }<a name="line.229"></a>
+<FONT color="green">230</FONT>            }<a name="line.230"></a>
+<FONT color="green">231</FONT>    <a name="line.231"></a>
+<FONT color="green">232</FONT>            // remove the specific step handler<a name="line.232"></a>
+<FONT color="green">233</FONT>            starter.clearStepHandlers();<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>        }<a name="line.235"></a>
+<FONT color="green">236</FONT>    <a name="line.236"></a>
+<FONT color="green">237</FONT>        /** Initialize the high order scaled derivatives at step start.<a name="line.237"></a>
+<FONT color="green">238</FONT>         * @param first first scaled derivative at step start<a name="line.238"></a>
+<FONT color="green">239</FONT>         * @param multistep scaled derivatives after step start (hy'1, ..., hy'k-1)<a name="line.239"></a>
+<FONT color="green">240</FONT>         * will be modified<a name="line.240"></a>
+<FONT color="green">241</FONT>         * @return high order scaled derivatives at step start<a name="line.241"></a>
+<FONT color="green">242</FONT>         */<a name="line.242"></a>
+<FONT color="green">243</FONT>        protected abstract Array2DRowRealMatrix initializeHighOrderDerivatives(final double[] first,<a name="line.243"></a>
+<FONT color="green">244</FONT>                                                                               final double[][] multistep);<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>        /** Get the minimal reduction factor for stepsize control.<a name="line.246"></a>
+<FONT color="green">247</FONT>         * @return minimal reduction factor<a name="line.247"></a>
+<FONT color="green">248</FONT>         */<a name="line.248"></a>
+<FONT color="green">249</FONT>        public double getMinReduction() {<a name="line.249"></a>
+<FONT color="green">250</FONT>            return minReduction;<a name="line.250"></a>
+<FONT color="green">251</FONT>        }<a name="line.251"></a>
+<FONT color="green">252</FONT>    <a name="line.252"></a>
+<FONT color="green">253</FONT>        /** Set the minimal reduction factor for stepsize control.<a name="line.253"></a>
+<FONT color="green">254</FONT>         * @param minReduction minimal reduction factor<a name="line.254"></a>
+<FONT color="green">255</FONT>         */<a name="line.255"></a>
+<FONT color="green">256</FONT>        public void setMinReduction(final double minReduction) {<a name="line.256"></a>
+<FONT color="green">257</FONT>            this.minReduction = minReduction;<a name="line.257"></a>
+<FONT color="green">258</FONT>        }<a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>        /** Get the maximal growth factor for stepsize control.<a name="line.260"></a>
+<FONT color="green">261</FONT>         * @return maximal growth factor<a name="line.261"></a>
+<FONT color="green">262</FONT>         */<a name="line.262"></a>
+<FONT color="green">263</FONT>        public double getMaxGrowth() {<a name="line.263"></a>
+<FONT color="green">264</FONT>            return maxGrowth;<a name="line.264"></a>
+<FONT color="green">265</FONT>        }<a name="line.265"></a>
+<FONT color="green">266</FONT>    <a name="line.266"></a>
+<FONT color="green">267</FONT>        /** Set the maximal growth factor for stepsize control.<a name="line.267"></a>
+<FONT color="green">268</FONT>         * @param maxGrowth maximal growth factor<a name="line.268"></a>
+<FONT color="green">269</FONT>         */<a name="line.269"></a>
+<FONT color="green">270</FONT>        public void setMaxGrowth(final double maxGrowth) {<a name="line.270"></a>
+<FONT color="green">271</FONT>            this.maxGrowth = maxGrowth;<a name="line.271"></a>
+<FONT color="green">272</FONT>        }<a name="line.272"></a>
+<FONT color="green">273</FONT>    <a name="line.273"></a>
+<FONT color="green">274</FONT>        /** Get the safety factor for stepsize control.<a name="line.274"></a>
+<FONT color="green">275</FONT>         * @return safety factor<a name="line.275"></a>
+<FONT color="green">276</FONT>         */<a name="line.276"></a>
+<FONT color="green">277</FONT>        public double getSafety() {<a name="line.277"></a>
+<FONT color="green">278</FONT>          return safety;<a name="line.278"></a>
+<FONT color="green">279</FONT>        }<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>        /** Set the safety factor for stepsize control.<a name="line.281"></a>
+<FONT color="green">282</FONT>         * @param safety safety factor<a name="line.282"></a>
+<FONT color="green">283</FONT>         */<a name="line.283"></a>
+<FONT color="green">284</FONT>        public void setSafety(final double safety) {<a name="line.284"></a>
+<FONT color="green">285</FONT>          this.safety = safety;<a name="line.285"></a>
+<FONT color="green">286</FONT>        }<a name="line.286"></a>
+<FONT color="green">287</FONT>    <a name="line.287"></a>
+<FONT color="green">288</FONT>        /** Compute step grow/shrink factor according to normalized error.<a name="line.288"></a>
+<FONT color="green">289</FONT>         * @param error normalized error of the current step<a name="line.289"></a>
+<FONT color="green">290</FONT>         * @return grow/shrink factor for next step<a name="line.290"></a>
+<FONT color="green">291</FONT>         */<a name="line.291"></a>
+<FONT color="green">292</FONT>        protected double computeStepGrowShrinkFactor(final double error) {<a name="line.292"></a>
+<FONT color="green">293</FONT>            return Math.min(maxGrowth, Math.max(minReduction, safety * Math.pow(error, exp)));<a name="line.293"></a>
+<FONT color="green">294</FONT>        }<a name="line.294"></a>
+<FONT color="green">295</FONT>    <a name="line.295"></a>
+<FONT color="green">296</FONT>        /** Transformer used to convert the first step to Nordsieck representation. */<a name="line.296"></a>
+<FONT color="green">297</FONT>        public static interface NordsieckTransformer {<a name="line.297"></a>
+<FONT color="green">298</FONT>            /** Initialize the high order scaled derivatives at step start.<a name="line.298"></a>
+<FONT color="green">299</FONT>             * @param first first scaled derivative at step start<a name="line.299"></a>
+<FONT color="green">300</FONT>             * @param multistep scaled derivatives after step start (hy'1, ..., hy'k-1)<a name="line.300"></a>
+<FONT color="green">301</FONT>             * will be modified<a name="line.301"></a>
+<FONT color="green">302</FONT>             * @return high order derivatives at step start<a name="line.302"></a>
+<FONT color="green">303</FONT>             */<a name="line.303"></a>
+<FONT color="green">304</FONT>            RealMatrix initializeHighOrderDerivatives(double[] first, double[][] multistep);<a name="line.304"></a>
+<FONT color="green">305</FONT>        }<a name="line.305"></a>
+<FONT color="green">306</FONT>    <a name="line.306"></a>
+<FONT color="green">307</FONT>        /** Specialized step handler storing the first step. */<a name="line.307"></a>
+<FONT color="green">308</FONT>        private class NordsieckInitializer implements StepHandler {<a name="line.308"></a>
+<FONT color="green">309</FONT>    <a name="line.309"></a>
+<FONT color="green">310</FONT>            /** Problem dimension. */<a name="line.310"></a>
+<FONT color="green">311</FONT>            private final int n;<a name="line.311"></a>
+<FONT color="green">312</FONT>    <a name="line.312"></a>
+<FONT color="green">313</FONT>            /** Simple constructor.<a name="line.313"></a>
+<FONT color="green">314</FONT>             * @param n problem dimension<a name="line.314"></a>
+<FONT color="green">315</FONT>             */<a name="line.315"></a>
+<FONT color="green">316</FONT>            public NordsieckInitializer(final int n) {<a name="line.316"></a>
+<FONT color="green">317</FONT>                this.n = n;<a name="line.317"></a>
+<FONT color="green">318</FONT>            }<a name="line.318"></a>
+<FONT color="green">319</FONT>    <a name="line.319"></a>
+<FONT color="green">320</FONT>            /** {@inheritDoc} */<a name="line.320"></a>
+<FONT color="green">321</FONT>            public void handleStep(StepInterpolator interpolator, boolean isLast)<a name="line.321"></a>
+<FONT color="green">322</FONT>                throws DerivativeException {<a name="line.322"></a>
+<FONT color="green">323</FONT>    <a name="line.323"></a>
+<FONT color="green">324</FONT>                final double prev = interpolator.getPreviousTime();<a name="line.324"></a>
+<FONT color="green">325</FONT>                final double curr = interpolator.getCurrentTime();<a name="line.325"></a>
+<FONT color="green">326</FONT>                stepStart = prev;<a name="line.326"></a>
+<FONT color="green">327</FONT>                stepSize  = (curr - prev) / (nSteps + 1);<a name="line.327"></a>
+<FONT color="green">328</FONT>    <a name="line.328"></a>
+<FONT color="green">329</FONT>                // compute the first scaled derivative<a name="line.329"></a>
+<FONT color="green">330</FONT>                interpolator.setInterpolatedTime(prev);<a name="line.330"></a>
+<FONT color="green">331</FONT>                scaled = interpolator.getInterpolatedDerivatives().clone();<a name="line.331"></a>
+<FONT color="green">332</FONT>                for (int j = 0; j &lt; n; ++j) {<a name="line.332"></a>
+<FONT color="green">333</FONT>                    scaled[j] *= stepSize;<a name="line.333"></a>
+<FONT color="green">334</FONT>                }<a name="line.334"></a>
+<FONT color="green">335</FONT>    <a name="line.335"></a>
+<FONT color="green">336</FONT>                // compute the high order scaled derivatives<a name="line.336"></a>
+<FONT color="green">337</FONT>                final double[][] multistep = new double[nSteps][];<a name="line.337"></a>
+<FONT color="green">338</FONT>                for (int i = 1; i &lt;= nSteps; ++i) {<a name="line.338"></a>
+<FONT color="green">339</FONT>                    interpolator.setInterpolatedTime(prev + stepSize * i);<a name="line.339"></a>
+<FONT color="green">340</FONT>                    final double[] msI = interpolator.getInterpolatedDerivatives().clone();<a name="line.340"></a>
+<FONT color="green">341</FONT>                    for (int j = 0; j &lt; n; ++j) {<a name="line.341"></a>
+<FONT color="green">342</FONT>                        msI[j] *= stepSize;<a name="line.342"></a>
+<FONT color="green">343</FONT>                    }<a name="line.343"></a>
+<FONT color="green">344</FONT>                    multistep[i - 1] = msI;<a name="line.344"></a>
+<FONT color="green">345</FONT>                }<a name="line.345"></a>
+<FONT color="green">346</FONT>                nordsieck = initializeHighOrderDerivatives(scaled, multistep);<a name="line.346"></a>
+<FONT color="green">347</FONT>    <a name="line.347"></a>
+<FONT color="green">348</FONT>                // stop the integrator after the first step has been handled<a name="line.348"></a>
+<FONT color="green">349</FONT>                throw new InitializationCompletedMarkerException();<a name="line.349"></a>
+<FONT color="green">350</FONT>    <a name="line.350"></a>
+<FONT color="green">351</FONT>            }<a name="line.351"></a>
+<FONT color="green">352</FONT>    <a name="line.352"></a>
+<FONT color="green">353</FONT>            /** {@inheritDoc} */<a name="line.353"></a>
+<FONT color="green">354</FONT>            public boolean requiresDenseOutput() {<a name="line.354"></a>
+<FONT color="green">355</FONT>                return true;<a name="line.355"></a>
+<FONT color="green">356</FONT>            }<a name="line.356"></a>
+<FONT color="green">357</FONT>    <a name="line.357"></a>
+<FONT color="green">358</FONT>            /** {@inheritDoc} */<a name="line.358"></a>
+<FONT color="green">359</FONT>            public void reset() {<a name="line.359"></a>
+<FONT color="green">360</FONT>                // nothing to do<a name="line.360"></a>
+<FONT color="green">361</FONT>            }<a name="line.361"></a>
+<FONT color="green">362</FONT>    <a name="line.362"></a>
+<FONT color="green">363</FONT>        }<a name="line.363"></a>
+<FONT color="green">364</FONT>    <a name="line.364"></a>
+<FONT color="green">365</FONT>        /** Marker exception used ONLY to stop the starter integrator after first step. */<a name="line.365"></a>
+<FONT color="green">366</FONT>        private static class InitializationCompletedMarkerException<a name="line.366"></a>
+<FONT color="green">367</FONT>            extends DerivativeException {<a name="line.367"></a>
+<FONT color="green">368</FONT>    <a name="line.368"></a>
+<FONT color="green">369</FONT>            /** Serializable version identifier. */<a name="line.369"></a>
+<FONT color="green">370</FONT>            private static final long serialVersionUID = -4105805787353488365L;<a name="line.370"></a>
+<FONT color="green">371</FONT>    <a name="line.371"></a>
+<FONT color="green">372</FONT>            /** Simple constructor. */<a name="line.372"></a>
+<FONT color="green">373</FONT>            public InitializationCompletedMarkerException() {<a name="line.373"></a>
+<FONT color="green">374</FONT>                super((Throwable) null);<a name="line.374"></a>
+<FONT color="green">375</FONT>            }<a name="line.375"></a>
+<FONT color="green">376</FONT>    <a name="line.376"></a>
+<FONT color="green">377</FONT>        }<a name="line.377"></a>
+<FONT color="green">378</FONT>    <a name="line.378"></a>
+<FONT color="green">379</FONT>        /** Wrapper for differential equations, ensuring start evaluations are counted. */<a name="line.379"></a>
+<FONT color="green">380</FONT>        private class CountingDifferentialEquations implements FirstOrderDifferentialEquations {<a name="line.380"></a>
+<FONT color="green">381</FONT>    <a name="line.381"></a>
+<FONT color="green">382</FONT>            /** Dimension of the problem. */<a name="line.382"></a>
+<FONT color="green">383</FONT>            private final int dimension;<a name="line.383"></a>
+<FONT color="green">384</FONT>    <a name="line.384"></a>
+<FONT color="green">385</FONT>            /** Simple constructor.<a name="line.385"></a>
+<FONT color="green">386</FONT>             * @param dimension dimension of the problem<a name="line.386"></a>
+<FONT color="green">387</FONT>             */<a name="line.387"></a>
+<FONT color="green">388</FONT>            public CountingDifferentialEquations(final int dimension) {<a name="line.388"></a>
+<FONT color="green">389</FONT>                this.dimension = dimension;<a name="line.389"></a>
+<FONT color="green">390</FONT>            }<a name="line.390"></a>
+<FONT color="green">391</FONT>    <a name="line.391"></a>
+<FONT color="green">392</FONT>            /** {@inheritDoc} */<a name="line.392"></a>
+<FONT color="green">393</FONT>            public void computeDerivatives(double t, double[] y, double[] dot)<a name="line.393"></a>
+<FONT color="green">394</FONT>                    throws DerivativeException {<a name="line.394"></a>
+<FONT color="green">395</FONT>                MultistepIntegrator.this.computeDerivatives(t, y, dot);<a name="line.395"></a>
+<FONT color="green">396</FONT>            }<a name="line.396"></a>
+<FONT color="green">397</FONT>    <a name="line.397"></a>
+<FONT color="green">398</FONT>            /** {@inheritDoc} */<a name="line.398"></a>
+<FONT color="green">399</FONT>            public int getDimension() {<a name="line.399"></a>
+<FONT color="green">400</FONT>                return dimension;<a name="line.400"></a>
+<FONT color="green">401</FONT>            }<a name="line.401"></a>
+<FONT color="green">402</FONT>        }<a name="line.402"></a>
+<FONT color="green">403</FONT>    <a name="line.403"></a>
+<FONT color="green">404</FONT>    }<a name="line.404"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/ODEIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,206 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Collection;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.ode.events.EventHandler;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.ode.sampling.StepHandler;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * This interface defines the common parts shared by integrators<a name="line.26"></a>
+<FONT color="green">027</FONT>     * for first and second order differential equations.<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @see FirstOrderIntegrator<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @see SecondOrderIntegrator<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 785473 $ $Date: 2009-06-17 00:02:35 -0400 (Wed, 17 Jun 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 2.0<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public interface ODEIntegrator  {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Get the name of the method.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @return name of the method<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        String getName();<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Add a step handler to this integrator.<a name="line.40"></a>
+<FONT color="green">041</FONT>         * &lt;p&gt;The handler will be called by the integrator for each accepted<a name="line.41"></a>
+<FONT color="green">042</FONT>         * step.&lt;/p&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @param handler handler for the accepted steps<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @see #getStepHandlers()<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @see #clearStepHandlers()<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @since 2.0<a name="line.46"></a>
+<FONT color="green">047</FONT>         */<a name="line.47"></a>
+<FONT color="green">048</FONT>        void addStepHandler(StepHandler handler);<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Get all the step handlers that have been added to the integrator.<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @return an unmodifiable collection of the added events handlers<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @see #addStepHandler(StepHandler)<a name="line.52"></a>
+<FONT color="green">053</FONT>         * @see #clearStepHandlers()<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @since 2.0<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        Collection&lt;StepHandler&gt; getStepHandlers();<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /** Remove all the step handlers that have been added to the integrator.<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @see #addStepHandler(StepHandler)<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @see #getStepHandlers()<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @since 2.0<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        void clearStepHandlers();<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Add an event handler to the integrator.<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @param handler event handler<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @param maxCheckInterval maximal time interval between switching<a name="line.67"></a>
+<FONT color="green">068</FONT>         * function checks (this interval prevents missing sign changes in<a name="line.68"></a>
+<FONT color="green">069</FONT>         * case the integration steps becomes very large)<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @param convergence convergence threshold in the event time search<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param maxIterationCount upper limit of the iteration count in<a name="line.71"></a>
+<FONT color="green">072</FONT>         * the event time search<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @see #getEventHandlers()<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @see #clearEventHandlers()<a name="line.74"></a>
+<FONT color="green">075</FONT>         */<a name="line.75"></a>
+<FONT color="green">076</FONT>        void addEventHandler(EventHandler handler,<a name="line.76"></a>
+<FONT color="green">077</FONT>                                             double maxCheckInterval,<a name="line.77"></a>
+<FONT color="green">078</FONT>                                             double convergence,<a name="line.78"></a>
+<FONT color="green">079</FONT>                                             int maxIterationCount);<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /** Get all the event handlers that have been added to the integrator.<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @return an unmodifiable collection of the added events handlers<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @see #addEventHandler(EventHandler, double, double, int)<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @see #clearEventHandlers()<a name="line.84"></a>
+<FONT color="green">085</FONT>         */<a name="line.85"></a>
+<FONT color="green">086</FONT>        Collection&lt;EventHandler&gt; getEventHandlers();<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>        /** Remove all the event handlers that have been added to the integrator.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @see #addEventHandler(EventHandler, double, double, int)<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @see #getEventHandlers()<a name="line.90"></a>
+<FONT color="green">091</FONT>         */<a name="line.91"></a>
+<FONT color="green">092</FONT>        void clearEventHandlers();<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>        /** Get the current value of the step start time t&lt;sub&gt;i&lt;/sub&gt;.<a name="line.94"></a>
+<FONT color="green">095</FONT>         * &lt;p&gt;This method can be called during integration (typically by<a name="line.95"></a>
+<FONT color="green">096</FONT>         * the object implementing the {@link FirstOrderDifferentialEquations<a name="line.96"></a>
+<FONT color="green">097</FONT>         * differential equations} problem) if the value of the current step that<a name="line.97"></a>
+<FONT color="green">098</FONT>         * is attempted is needed.&lt;/p&gt;<a name="line.98"></a>
+<FONT color="green">099</FONT>         * &lt;p&gt;The result is undefined if the method is called outside of<a name="line.99"></a>
+<FONT color="green">100</FONT>         * calls to &lt;code&gt;integrate&lt;/code&gt;.&lt;/p&gt;<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @return current value of the step start time t&lt;sub&gt;i&lt;/sub&gt;<a name="line.101"></a>
+<FONT color="green">102</FONT>         */<a name="line.102"></a>
+<FONT color="green">103</FONT>        double getCurrentStepStart();<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /** Get the current signed value of the integration stepsize.<a name="line.105"></a>
+<FONT color="green">106</FONT>         * &lt;p&gt;This method can be called during integration (typically by<a name="line.106"></a>
+<FONT color="green">107</FONT>         * the object implementing the {@link FirstOrderDifferentialEquations<a name="line.107"></a>
+<FONT color="green">108</FONT>         * differential equations} problem) if the signed value of the current stepsize<a name="line.108"></a>
+<FONT color="green">109</FONT>         * that is tried is needed.&lt;/p&gt;<a name="line.109"></a>
+<FONT color="green">110</FONT>         * &lt;p&gt;The result is undefined if the method is called outside of<a name="line.110"></a>
+<FONT color="green">111</FONT>         * calls to &lt;code&gt;integrate&lt;/code&gt;.&lt;/p&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @return current signed value of the stepsize<a name="line.112"></a>
+<FONT color="green">113</FONT>         */<a name="line.113"></a>
+<FONT color="green">114</FONT>        double getCurrentSignedStepsize();<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>        /** Set the maximal number of differential equations function evaluations.<a name="line.116"></a>
+<FONT color="green">117</FONT>         * &lt;p&gt;The purpose of this method is to avoid infinite loops which can occur<a name="line.117"></a>
+<FONT color="green">118</FONT>         * for example when stringent error constraints are set or when lots of<a name="line.118"></a>
+<FONT color="green">119</FONT>         * discrete events are triggered, thus leading to many rejected steps.&lt;/p&gt;<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @param maxEvaluations maximal number of function evaluations (negative<a name="line.120"></a>
+<FONT color="green">121</FONT>         * values are silently converted to maximal integer value, thus representing<a name="line.121"></a>
+<FONT color="green">122</FONT>         * almost unlimited evaluations)<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        void setMaxEvaluations(int maxEvaluations);<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>        /** Get the maximal number of functions evaluations.<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @return maximal number of functions evaluations<a name="line.127"></a>
+<FONT color="green">128</FONT>         */<a name="line.128"></a>
+<FONT color="green">129</FONT>        int getMaxEvaluations();<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>        /** Get the number of evaluations of the differential equations function.<a name="line.131"></a>
+<FONT color="green">132</FONT>         * &lt;p&gt;<a name="line.132"></a>
+<FONT color="green">133</FONT>         * The number of evaluations corresponds to the last call to the<a name="line.133"></a>
+<FONT color="green">134</FONT>         * &lt;code&gt;integrate&lt;/code&gt; method. It is 0 if the method has not been called yet.<a name="line.134"></a>
+<FONT color="green">135</FONT>         * &lt;/p&gt;<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @return number of evaluations of the differential equations function<a name="line.136"></a>
+<FONT color="green">137</FONT>         */<a name="line.137"></a>
+<FONT color="green">138</FONT>        int getEvaluations();<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>    }<a name="line.140"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/SecondOrderDifferentialEquations.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,133 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /** This interface represents a second order differential equations set.<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>     * &lt;p&gt;This interface should be implemented by all real second order<a name="line.22"></a>
+<FONT color="green">023</FONT>     * differential equation problems before they can be handled by the<a name="line.23"></a>
+<FONT color="green">024</FONT>     * integrators {@link SecondOrderIntegrator#integrate} method.&lt;/p&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;A second order differential equations problem, as seen by an<a name="line.26"></a>
+<FONT color="green">027</FONT>     * integrator is the second time derivative &lt;code&gt;d2Y/dt^2&lt;/code&gt; of a<a name="line.27"></a>
+<FONT color="green">028</FONT>     * state vector &lt;code&gt;Y&lt;/code&gt;, both being one dimensional<a name="line.28"></a>
+<FONT color="green">029</FONT>     * arrays. From the integrator point of view, this derivative depends<a name="line.29"></a>
+<FONT color="green">030</FONT>     * only on the current time &lt;code&gt;t&lt;/code&gt;, on the state vector<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;code&gt;Y&lt;/code&gt; and on the first time derivative of the state<a name="line.31"></a>
+<FONT color="green">032</FONT>     * vector.&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;p&gt;For real problems, the derivative depends also on parameters<a name="line.34"></a>
+<FONT color="green">035</FONT>     * that do not belong to the state vector (dynamical model constants<a name="line.35"></a>
+<FONT color="green">036</FONT>     * for example). These constants are completely outside of the scope<a name="line.36"></a>
+<FONT color="green">037</FONT>     * of this interface, the classes that implement it are allowed to<a name="line.37"></a>
+<FONT color="green">038</FONT>     * handle them as they want.&lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     *<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @see SecondOrderIntegrator<a name="line.40"></a>
+<FONT color="green">041</FONT>     * @see FirstOrderConverter<a name="line.41"></a>
+<FONT color="green">042</FONT>     * @see FirstOrderDifferentialEquations<a name="line.42"></a>
+<FONT color="green">043</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.43"></a>
+<FONT color="green">044</FONT>     * @since 1.2<a name="line.44"></a>
+<FONT color="green">045</FONT>     */<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>    public interface SecondOrderDifferentialEquations {<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** Get the dimension of the problem.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @return dimension of the problem<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        int getDimension();<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /** Get the current time derivative of the state vector.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param t current value of the independent &lt;I&gt;time&lt;/I&gt; variable<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param y array containing the current value of the state vector<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @param yDot array containing the current value of the first derivative<a name="line.57"></a>
+<FONT color="green">058</FONT>         * of the state vector<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @param yDDot placeholder array where to put the second time derivative<a name="line.59"></a>
+<FONT color="green">060</FONT>         * of the state vector<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @throws DerivativeException this exception is propagated to the caller if the<a name="line.61"></a>
+<FONT color="green">062</FONT>         * underlying user function triggers one<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        void computeSecondDerivatives(double t, double[] y, double[] yDot,<a name="line.64"></a>
+<FONT color="green">065</FONT>                                      double[] yDDot) throws DerivativeException;<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>    }<a name="line.67"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/SecondOrderIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,124 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /** This interface represents a second order integrator for<a name="line.21"></a>
+<FONT color="green">022</FONT>     * differential equations.<a name="line.22"></a>
+<FONT color="green">023</FONT>     *<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;The classes which are devoted to solve second order differential<a name="line.24"></a>
+<FONT color="green">025</FONT>     * equations should implement this interface. The problems which can<a name="line.25"></a>
+<FONT color="green">026</FONT>     * be handled should implement the {@link<a name="line.26"></a>
+<FONT color="green">027</FONT>     * SecondOrderDifferentialEquations} interface.&lt;/p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @see SecondOrderDifferentialEquations<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 1.2<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>    public interface SecondOrderIntegrator extends ODEIntegrator {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>      /** Integrate the differential equations up to the given time<a name="line.36"></a>
+<FONT color="green">037</FONT>       * @param equations differential equations to integrate<a name="line.37"></a>
+<FONT color="green">038</FONT>       * @param t0 initial time<a name="line.38"></a>
+<FONT color="green">039</FONT>       * @param y0 initial value of the state vector at t0<a name="line.39"></a>
+<FONT color="green">040</FONT>       * @param yDot0 initial value of the first derivative of the state<a name="line.40"></a>
+<FONT color="green">041</FONT>       * vector at t0<a name="line.41"></a>
+<FONT color="green">042</FONT>       * @param t target time for the integration<a name="line.42"></a>
+<FONT color="green">043</FONT>       * (can be set to a value smaller thant &lt;code&gt;t0&lt;/code&gt; for backward integration)<a name="line.43"></a>
+<FONT color="green">044</FONT>       * @param y placeholder where to put the state vector at each<a name="line.44"></a>
+<FONT color="green">045</FONT>       * successful step (and hence at the end of integration), can be the<a name="line.45"></a>
+<FONT color="green">046</FONT>       * same object as y0<a name="line.46"></a>
+<FONT color="green">047</FONT>       * @param yDot placeholder where to put the first derivative of<a name="line.47"></a>
+<FONT color="green">048</FONT>       * the state vector at time t, can be the same object as yDot0<a name="line.48"></a>
+<FONT color="green">049</FONT>       * @throws IntegratorException if the integrator cannot perform integration<a name="line.49"></a>
+<FONT color="green">050</FONT>       * @throws DerivativeException this exception is propagated to the caller if the<a name="line.50"></a>
+<FONT color="green">051</FONT>       * underlying user function triggers one<a name="line.51"></a>
+<FONT color="green">052</FONT>       */<a name="line.52"></a>
+<FONT color="green">053</FONT>      void integrate(SecondOrderDifferentialEquations equations,<a name="line.53"></a>
+<FONT color="green">054</FONT>                     double t0, double[] y0, double[] yDot0,<a name="line.54"></a>
+<FONT color="green">055</FONT>                     double t, double[] y, double[] yDot)<a name="line.55"></a>
+<FONT color="green">056</FONT>          throws DerivativeException, IntegratorException;<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>    }<a name="line.58"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/events/CombinedEventsManager.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,313 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.events;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.ArrayList;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.Collection;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.util.Collections;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.util.List;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.ode.IntegratorException;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.ode.sampling.StepInterpolator;<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>    /** This class manages several {@link EventHandler event handlers} during integration.<a name="line.30"></a>
+<FONT color="green">031</FONT>     *<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @see EventHandler<a name="line.32"></a>
+<FONT color="green">033</FONT>     * @see EventState<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @version $Revision: 786881 $ $Date: 2009-06-20 14:53:08 -0400 (Sat, 20 Jun 2009) $<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @since 1.2<a name="line.35"></a>
+<FONT color="green">036</FONT>     */<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>    public class CombinedEventsManager {<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Events states. */<a name="line.40"></a>
+<FONT color="green">041</FONT>        private final List&lt;EventState&gt; states;<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** First active event. */<a name="line.43"></a>
+<FONT color="green">044</FONT>        private EventState first;<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** Initialization indicator. */<a name="line.46"></a>
+<FONT color="green">047</FONT>        private boolean initialized;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** Simple constructor.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * Create an empty manager<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        public CombinedEventsManager() {<a name="line.52"></a>
+<FONT color="green">053</FONT>            states      = new ArrayList&lt;EventState&gt;();<a name="line.53"></a>
+<FONT color="green">054</FONT>            first       = null;<a name="line.54"></a>
+<FONT color="green">055</FONT>            initialized = false;<a name="line.55"></a>
+<FONT color="green">056</FONT>        }<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /** Add an events handler.<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @param handler event handler<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @param maxCheckInterval maximal time interval between events<a name="line.60"></a>
+<FONT color="green">061</FONT>         * checks (this interval prevents missing sign changes in<a name="line.61"></a>
+<FONT color="green">062</FONT>         * case the integration steps becomes very large)<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @param convergence convergence threshold in the event time search<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @param maxIterationCount upper limit of the iteration count in<a name="line.64"></a>
+<FONT color="green">065</FONT>         * the event time search<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @see #getEventsHandlers()<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @see #clearEventsHandlers()<a name="line.67"></a>
+<FONT color="green">068</FONT>         */<a name="line.68"></a>
+<FONT color="green">069</FONT>        public void addEventHandler(final EventHandler handler, final double maxCheckInterval,<a name="line.69"></a>
+<FONT color="green">070</FONT>                                    final double convergence, final int maxIterationCount) {<a name="line.70"></a>
+<FONT color="green">071</FONT>            states.add(new EventState(handler, maxCheckInterval,<a name="line.71"></a>
+<FONT color="green">072</FONT>                                      convergence, maxIterationCount));<a name="line.72"></a>
+<FONT color="green">073</FONT>        }<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /** Get all the events handlers that have been added to the manager.<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @return an unmodifiable collection of the added event handlers<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @see #addEventHandler(EventHandler, double, double, int)<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @see #clearEventsHandlers()<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @see #getEventsStates()<a name="line.79"></a>
+<FONT color="green">080</FONT>         */<a name="line.80"></a>
+<FONT color="green">081</FONT>        public Collection&lt;EventHandler&gt; getEventsHandlers() {<a name="line.81"></a>
+<FONT color="green">082</FONT>            final List&lt;EventHandler&gt; list = new ArrayList&lt;EventHandler&gt;();<a name="line.82"></a>
+<FONT color="green">083</FONT>            for (EventState state : states) {<a name="line.83"></a>
+<FONT color="green">084</FONT>                list.add(state.getEventHandler());<a name="line.84"></a>
+<FONT color="green">085</FONT>            }<a name="line.85"></a>
+<FONT color="green">086</FONT>            return Collections.unmodifiableCollection(list);<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /** Remove all the events handlers that have been added to the manager.<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @see #addEventHandler(EventHandler, double, double, int)<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @see #getEventsHandlers()<a name="line.91"></a>
+<FONT color="green">092</FONT>         */<a name="line.92"></a>
+<FONT color="green">093</FONT>        public void clearEventsHandlers() {<a name="line.93"></a>
+<FONT color="green">094</FONT>            states.clear();<a name="line.94"></a>
+<FONT color="green">095</FONT>        }<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /** Get all the events state wrapping the handlers that have been added to the manager.<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @return a collection of the events states<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @see #getEventsHandlers()<a name="line.99"></a>
+<FONT color="green">100</FONT>         */<a name="line.100"></a>
+<FONT color="green">101</FONT>        public Collection&lt;EventState&gt; getEventsStates() {<a name="line.101"></a>
+<FONT color="green">102</FONT>            return states;<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /** Check if the manager does not manage any event handlers.<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @return true if manager is empty<a name="line.106"></a>
+<FONT color="green">107</FONT>         */<a name="line.107"></a>
+<FONT color="green">108</FONT>        public boolean isEmpty() {<a name="line.108"></a>
+<FONT color="green">109</FONT>            return states.isEmpty();<a name="line.109"></a>
+<FONT color="green">110</FONT>        }<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>        /** Evaluate the impact of the proposed step on all managed<a name="line.112"></a>
+<FONT color="green">113</FONT>         * event handlers.<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param interpolator step interpolator for the proposed step<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @return true if at least one event handler triggers an event<a name="line.115"></a>
+<FONT color="green">116</FONT>         * before the end of the proposed step (this implies the step should<a name="line.116"></a>
+<FONT color="green">117</FONT>         * be rejected)<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @exception DerivativeException if the interpolator fails to<a name="line.118"></a>
+<FONT color="green">119</FONT>         * compute the function somewhere within the step<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @exception IntegratorException if an event cannot be located<a name="line.120"></a>
+<FONT color="green">121</FONT>         */<a name="line.121"></a>
+<FONT color="green">122</FONT>        public boolean evaluateStep(final StepInterpolator interpolator)<a name="line.122"></a>
+<FONT color="green">123</FONT>        throws DerivativeException, IntegratorException {<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>            try {<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>                first = null;<a name="line.127"></a>
+<FONT color="green">128</FONT>                if (states.isEmpty()) {<a name="line.128"></a>
+<FONT color="green">129</FONT>                    // there is nothing to do, return now to avoid setting the<a name="line.129"></a>
+<FONT color="green">130</FONT>                    // interpolator time (and hence avoid unneeded calls to the<a name="line.130"></a>
+<FONT color="green">131</FONT>                    // user function due to interpolator finalization)<a name="line.131"></a>
+<FONT color="green">132</FONT>                    return false;<a name="line.132"></a>
+<FONT color="green">133</FONT>                }<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>                if (! initialized) {<a name="line.135"></a>
+<FONT color="green">136</FONT>    <a name="line.136"></a>
+<FONT color="green">137</FONT>                    // initialize the events states<a name="line.137"></a>
+<FONT color="green">138</FONT>                    final double t0 = interpolator.getPreviousTime();<a name="line.138"></a>
+<FONT color="green">139</FONT>                    interpolator.setInterpolatedTime(t0);<a name="line.139"></a>
+<FONT color="green">140</FONT>                    final double [] y = interpolator.getInterpolatedState();<a name="line.140"></a>
+<FONT color="green">141</FONT>                    for (EventState state : states) {<a name="line.141"></a>
+<FONT color="green">142</FONT>                        state.reinitializeBegin(t0, y);<a name="line.142"></a>
+<FONT color="green">143</FONT>                    }<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>                    initialized = true;<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>                }<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>                // check events occurrence<a name="line.149"></a>
+<FONT color="green">150</FONT>                for (EventState state : states) {<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>                    if (state.evaluateStep(interpolator)) {<a name="line.152"></a>
+<FONT color="green">153</FONT>                        if (first == null) {<a name="line.153"></a>
+<FONT color="green">154</FONT>                            first = state;<a name="line.154"></a>
+<FONT color="green">155</FONT>                        } else {<a name="line.155"></a>
+<FONT color="green">156</FONT>                            if (interpolator.isForward()) {<a name="line.156"></a>
+<FONT color="green">157</FONT>                                if (state.getEventTime() &lt; first.getEventTime()) {<a name="line.157"></a>
+<FONT color="green">158</FONT>                                    first = state;<a name="line.158"></a>
+<FONT color="green">159</FONT>                                }<a name="line.159"></a>
+<FONT color="green">160</FONT>                            } else {<a name="line.160"></a>
+<FONT color="green">161</FONT>                                if (state.getEventTime() &gt; first.getEventTime()) {<a name="line.161"></a>
+<FONT color="green">162</FONT>                                    first = state;<a name="line.162"></a>
+<FONT color="green">163</FONT>                                }<a name="line.163"></a>
+<FONT color="green">164</FONT>                            }<a name="line.164"></a>
+<FONT color="green">165</FONT>                        }<a name="line.165"></a>
+<FONT color="green">166</FONT>                    }<a name="line.166"></a>
+<FONT color="green">167</FONT>    <a name="line.167"></a>
+<FONT color="green">168</FONT>                }<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>                return first != null;<a name="line.170"></a>
+<FONT color="green">171</FONT>    <a name="line.171"></a>
+<FONT color="green">172</FONT>            } catch (EventException se) {<a name="line.172"></a>
+<FONT color="green">173</FONT>                throw new IntegratorException(se);<a name="line.173"></a>
+<FONT color="green">174</FONT>            } catch (ConvergenceException ce) {<a name="line.174"></a>
+<FONT color="green">175</FONT>                throw new IntegratorException(ce);<a name="line.175"></a>
+<FONT color="green">176</FONT>            }<a name="line.176"></a>
+<FONT color="green">177</FONT>    <a name="line.177"></a>
+<FONT color="green">178</FONT>        }<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>        /** Get the occurrence time of the first event triggered in the<a name="line.180"></a>
+<FONT color="green">181</FONT>         * last evaluated step.<a name="line.181"></a>
+<FONT color="green">182</FONT>         * @return occurrence time of the first event triggered in the last<a name="line.182"></a>
+<FONT color="green">183</FONT>         * evaluated step, or &lt;/code&gt;Double.NaN&lt;/code&gt; if no event is<a name="line.183"></a>
+<FONT color="green">184</FONT>         * triggered<a name="line.184"></a>
+<FONT color="green">185</FONT>         */<a name="line.185"></a>
+<FONT color="green">186</FONT>        public double getEventTime() {<a name="line.186"></a>
+<FONT color="green">187</FONT>            return (first == null) ? Double.NaN : first.getEventTime();<a name="line.187"></a>
+<FONT color="green">188</FONT>        }<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>        /** Inform the event handlers that the step has been accepted<a name="line.190"></a>
+<FONT color="green">191</FONT>         * by the integrator.<a name="line.191"></a>
+<FONT color="green">192</FONT>         * @param t value of the independent &lt;i&gt;time&lt;/i&gt; variable at the<a name="line.192"></a>
+<FONT color="green">193</FONT>         * end of the step<a name="line.193"></a>
+<FONT color="green">194</FONT>         * @param y array containing the current value of the state vector<a name="line.194"></a>
+<FONT color="green">195</FONT>         * at the end of the step<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @exception IntegratorException if the value of one of the<a name="line.196"></a>
+<FONT color="green">197</FONT>         * events states cannot be evaluated<a name="line.197"></a>
+<FONT color="green">198</FONT>         */<a name="line.198"></a>
+<FONT color="green">199</FONT>        public void stepAccepted(final double t, final double[] y)<a name="line.199"></a>
+<FONT color="green">200</FONT>        throws IntegratorException {<a name="line.200"></a>
+<FONT color="green">201</FONT>            try {<a name="line.201"></a>
+<FONT color="green">202</FONT>                for (EventState state : states) {<a name="line.202"></a>
+<FONT color="green">203</FONT>                    state.stepAccepted(t, y);<a name="line.203"></a>
+<FONT color="green">204</FONT>                }<a name="line.204"></a>
+<FONT color="green">205</FONT>            } catch (EventException se) {<a name="line.205"></a>
+<FONT color="green">206</FONT>                throw new IntegratorException(se);<a name="line.206"></a>
+<FONT color="green">207</FONT>            }<a name="line.207"></a>
+<FONT color="green">208</FONT>        }<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>        /** Check if the integration should be stopped at the end of the<a name="line.210"></a>
+<FONT color="green">211</FONT>         * current step.<a name="line.211"></a>
+<FONT color="green">212</FONT>         * @return true if the integration should be stopped<a name="line.212"></a>
+<FONT color="green">213</FONT>         */<a name="line.213"></a>
+<FONT color="green">214</FONT>        public boolean stop() {<a name="line.214"></a>
+<FONT color="green">215</FONT>            for (EventState state : states) {<a name="line.215"></a>
+<FONT color="green">216</FONT>                if (state.stop()) {<a name="line.216"></a>
+<FONT color="green">217</FONT>                    return true;<a name="line.217"></a>
+<FONT color="green">218</FONT>                }<a name="line.218"></a>
+<FONT color="green">219</FONT>            }<a name="line.219"></a>
+<FONT color="green">220</FONT>            return false;<a name="line.220"></a>
+<FONT color="green">221</FONT>        }<a name="line.221"></a>
+<FONT color="green">222</FONT>    <a name="line.222"></a>
+<FONT color="green">223</FONT>        /** Let the event handlers reset the state if they want.<a name="line.223"></a>
+<FONT color="green">224</FONT>         * @param t value of the independent &lt;i&gt;time&lt;/i&gt; variable at the<a name="line.224"></a>
+<FONT color="green">225</FONT>         * beginning of the next step<a name="line.225"></a>
+<FONT color="green">226</FONT>         * @param y array were to put the desired state vector at the beginning<a name="line.226"></a>
+<FONT color="green">227</FONT>         * of the next step<a name="line.227"></a>
+<FONT color="green">228</FONT>         * @return true if the integrator should reset the derivatives too<a name="line.228"></a>
+<FONT color="green">229</FONT>         * @exception IntegratorException if one of the events states<a name="line.229"></a>
+<FONT color="green">230</FONT>         * that should reset the state fails to do it<a name="line.230"></a>
+<FONT color="green">231</FONT>         */<a name="line.231"></a>
+<FONT color="green">232</FONT>        public boolean reset(final double t, final double[] y)<a name="line.232"></a>
+<FONT color="green">233</FONT>            throws IntegratorException {<a name="line.233"></a>
+<FONT color="green">234</FONT>            try {<a name="line.234"></a>
+<FONT color="green">235</FONT>                boolean resetDerivatives = false;<a name="line.235"></a>
+<FONT color="green">236</FONT>                for (EventState state : states) {<a name="line.236"></a>
+<FONT color="green">237</FONT>                    if (state.reset(t, y)) {<a name="line.237"></a>
+<FONT color="green">238</FONT>                        resetDerivatives = true;<a name="line.238"></a>
+<FONT color="green">239</FONT>                    }<a name="line.239"></a>
+<FONT color="green">240</FONT>                }<a name="line.240"></a>
+<FONT color="green">241</FONT>                return resetDerivatives;<a name="line.241"></a>
+<FONT color="green">242</FONT>            } catch (EventException se) {<a name="line.242"></a>
+<FONT color="green">243</FONT>                throw new IntegratorException(se);<a name="line.243"></a>
+<FONT color="green">244</FONT>            }<a name="line.244"></a>
+<FONT color="green">245</FONT>        }<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>    }<a name="line.247"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/events/EventException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,116 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.events;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This exception is made available to users to report<a name="line.23"></a>
+<FONT color="green">024</FONT>     * the error conditions that are triggered by {@link EventHandler}<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 746578 $ $Date: 2009-02-21 15:01:14 -0500 (Sat, 21 Feb 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 2.0<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public class EventException extends MathException {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /** Serialization UID. */<a name="line.30"></a>
+<FONT color="green">031</FONT>        private static final long serialVersionUID = -898215297400035290L;<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** Simple constructor.<a name="line.33"></a>
+<FONT color="green">034</FONT>         * Build an exception by translating and formating a message<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @param specifier format specifier (to be translated)<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @param parts to insert in the format (no translation)<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        public EventException(final String specifier, final Object ... parts) {<a name="line.38"></a>
+<FONT color="green">039</FONT>            super(specifier, parts);<a name="line.39"></a>
+<FONT color="green">040</FONT>        }<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /**<a name="line.42"></a>
+<FONT color="green">043</FONT>         * Create an exception with a given root cause.<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @param cause  the exception or error that caused this exception to be thrown<a name="line.44"></a>
+<FONT color="green">045</FONT>         */<a name="line.45"></a>
+<FONT color="green">046</FONT>        public EventException(final Throwable cause) {<a name="line.46"></a>
+<FONT color="green">047</FONT>            super(cause);<a name="line.47"></a>
+<FONT color="green">048</FONT>        }<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>    }<a name="line.50"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/events/EventHandler.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,249 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.events;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /** This interface represents a handler for discrete events triggered<a name="line.20"></a>
+<FONT color="green">021</FONT>     * during ODE integration.<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;p&gt;Some events can be triggered at discrete times as an ODE problem<a name="line.23"></a>
+<FONT color="green">024</FONT>     * is solved. This occurs for example when the integration process<a name="line.24"></a>
+<FONT color="green">025</FONT>     * should be stopped as some state is reached (G-stop facility) when the<a name="line.25"></a>
+<FONT color="green">026</FONT>     * precise date is unknown a priori, or when the derivatives have<a name="line.26"></a>
+<FONT color="green">027</FONT>     * discontinuities, or simply when the user wants to monitor some<a name="line.27"></a>
+<FONT color="green">028</FONT>     * states boundaries crossings.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;These events are defined as occurring when a &lt;code&gt;g&lt;/code&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * switching function sign changes.&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;p&gt;Since events are only problem-dependent and are triggered by the<a name="line.34"></a>
+<FONT color="green">035</FONT>     * independent &lt;i&gt;time&lt;/i&gt; variable and the state vector, they can<a name="line.35"></a>
+<FONT color="green">036</FONT>     * occur at virtually any time, unknown in advance. The integrators will<a name="line.36"></a>
+<FONT color="green">037</FONT>     * take care to avoid sign changes inside the steps, they will reduce<a name="line.37"></a>
+<FONT color="green">038</FONT>     * the step size when such an event is detected in order to put this<a name="line.38"></a>
+<FONT color="green">039</FONT>     * event exactly at the end of the current step. This guarantees that<a name="line.39"></a>
+<FONT color="green">040</FONT>     * step interpolation (which always has a one step scope) is relevant<a name="line.40"></a>
+<FONT color="green">041</FONT>     * even in presence of discontinuities. This is independent from the<a name="line.41"></a>
+<FONT color="green">042</FONT>     * stepsize control provided by integrators that monitor the local<a name="line.42"></a>
+<FONT color="green">043</FONT>     * error (this event handling feature is available for all integrators,<a name="line.43"></a>
+<FONT color="green">044</FONT>     * including fixed step ones).&lt;/p&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     *<a name="line.45"></a>
+<FONT color="green">046</FONT>     * @version $Revision: 902214 $ $Date: 2010-01-22 13:40:28 -0500 (Fri, 22 Jan 2010) $<a name="line.46"></a>
+<FONT color="green">047</FONT>     * @since 1.2<a name="line.47"></a>
+<FONT color="green">048</FONT>     */<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>    public interface EventHandler  {<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>      /** Stop indicator.<a name="line.52"></a>
+<FONT color="green">053</FONT>       * &lt;p&gt;This value should be used as the return value of the {@link<a name="line.53"></a>
+<FONT color="green">054</FONT>       * #eventOccurred eventOccurred} method when the integration should be<a name="line.54"></a>
+<FONT color="green">055</FONT>       * stopped after the event ending the current step.&lt;/p&gt;<a name="line.55"></a>
+<FONT color="green">056</FONT>       */<a name="line.56"></a>
+<FONT color="green">057</FONT>      int STOP = 0;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>      /** Reset state indicator.<a name="line.59"></a>
+<FONT color="green">060</FONT>       * &lt;p&gt;This value should be used as the return value of the {@link<a name="line.60"></a>
+<FONT color="green">061</FONT>       * #eventOccurred eventOccurred} method when the integration should<a name="line.61"></a>
+<FONT color="green">062</FONT>       * go on after the event ending the current step, with a new state<a name="line.62"></a>
+<FONT color="green">063</FONT>       * vector (which will be retrieved thanks to the {@link #resetState<a name="line.63"></a>
+<FONT color="green">064</FONT>       * resetState} method).&lt;/p&gt;<a name="line.64"></a>
+<FONT color="green">065</FONT>       */<a name="line.65"></a>
+<FONT color="green">066</FONT>      int RESET_STATE = 1;<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>      /** Reset derivatives indicator.<a name="line.68"></a>
+<FONT color="green">069</FONT>       * &lt;p&gt;This value should be used as the return value of the {@link<a name="line.69"></a>
+<FONT color="green">070</FONT>       * #eventOccurred eventOccurred} method when the integration should<a name="line.70"></a>
+<FONT color="green">071</FONT>       * go on after the event ending the current step, with a new derivatives<a name="line.71"></a>
+<FONT color="green">072</FONT>       * vector (which will be retrieved thanks to the {@link<a name="line.72"></a>
+<FONT color="green">073</FONT>       * org.apache.commons.math.ode.FirstOrderDifferentialEquations#computeDerivatives}<a name="line.73"></a>
+<FONT color="green">074</FONT>       * method).&lt;/p&gt;<a name="line.74"></a>
+<FONT color="green">075</FONT>       */<a name="line.75"></a>
+<FONT color="green">076</FONT>      int RESET_DERIVATIVES = 2;<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>      /** Continue indicator.<a name="line.78"></a>
+<FONT color="green">079</FONT>       * &lt;p&gt;This value should be used as the return value of the {@link<a name="line.79"></a>
+<FONT color="green">080</FONT>       * #eventOccurred eventOccurred} method when the integration should go<a name="line.80"></a>
+<FONT color="green">081</FONT>       * on after the event ending the current step.&lt;/p&gt;<a name="line.81"></a>
+<FONT color="green">082</FONT>       */<a name="line.82"></a>
+<FONT color="green">083</FONT>      int CONTINUE = 3;<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>      /** Compute the value of the switching function.<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>       * &lt;p&gt;The discrete events are generated when the sign of this<a name="line.87"></a>
+<FONT color="green">088</FONT>       * switching function changes. The integrator will take care to change<a name="line.88"></a>
+<FONT color="green">089</FONT>       * the stepsize in such a way these events occur exactly at step boundaries.<a name="line.89"></a>
+<FONT color="green">090</FONT>       * The switching function must be continuous in its roots neighborhood<a name="line.90"></a>
+<FONT color="green">091</FONT>       * (but not necessarily smooth), as the integrator will need to find its<a name="line.91"></a>
+<FONT color="green">092</FONT>       * roots to locate precisely the events.&lt;/p&gt;<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>       * @param t current value of the independent &lt;i&gt;time&lt;/i&gt; variable<a name="line.94"></a>
+<FONT color="green">095</FONT>       * @param y array containing the current value of the state vector<a name="line.95"></a>
+<FONT color="green">096</FONT>       * @return value of the g switching function<a name="line.96"></a>
+<FONT color="green">097</FONT>       * @exception EventException if the switching function cannot be evaluated<a name="line.97"></a>
+<FONT color="green">098</FONT>       */<a name="line.98"></a>
+<FONT color="green">099</FONT>      double g(double t, double[] y) throws EventException;<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>      /** Handle an event and choose what to do next.<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>       * &lt;p&gt;This method is called when the integrator has accepted a step<a name="line.103"></a>
+<FONT color="green">104</FONT>       * ending exactly on a sign change of the function, just &lt;em&gt;before&lt;/em&gt;<a name="line.104"></a>
+<FONT color="green">105</FONT>       * the step handler itself is called (see below for scheduling). It<a name="line.105"></a>
+<FONT color="green">106</FONT>       * allows the user to update his internal data to acknowledge the fact<a name="line.106"></a>
+<FONT color="green">107</FONT>       * the event has been handled (for example setting a flag in the {@link<a name="line.107"></a>
+<FONT color="green">108</FONT>       * org.apache.commons.math.ode.FirstOrderDifferentialEquations<a name="line.108"></a>
+<FONT color="green">109</FONT>       * differential equations} to switch the derivatives computation in<a name="line.109"></a>
+<FONT color="green">110</FONT>       * case of discontinuity), or to direct the integrator to either stop<a name="line.110"></a>
+<FONT color="green">111</FONT>       * or continue integration, possibly with a reset state or derivatives.&lt;/p&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>       * &lt;ul&gt;<a name="line.113"></a>
+<FONT color="green">114</FONT>       *   &lt;li&gt;if {@link #STOP} is returned, the step handler will be called<a name="line.114"></a>
+<FONT color="green">115</FONT>       *   with the &lt;code&gt;isLast&lt;/code&gt; flag of the {@link<a name="line.115"></a>
+<FONT color="green">116</FONT>       *   org.apache.commons.math.ode.sampling.StepHandler#handleStep handleStep}<a name="line.116"></a>
+<FONT color="green">117</FONT>       *   method set to true and the integration will be stopped,&lt;/li&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>       *   &lt;li&gt;if {@link #RESET_STATE} is returned, the {@link #resetState<a name="line.118"></a>
+<FONT color="green">119</FONT>       *   resetState} method will be called once the step handler has<a name="line.119"></a>
+<FONT color="green">120</FONT>       *   finished its task, and the integrator will also recompute the<a name="line.120"></a>
+<FONT color="green">121</FONT>       *   derivatives,&lt;/li&gt;<a name="line.121"></a>
+<FONT color="green">122</FONT>       *   &lt;li&gt;if {@link #RESET_DERIVATIVES} is returned, the integrator<a name="line.122"></a>
+<FONT color="green">123</FONT>       *   will recompute the derivatives,<a name="line.123"></a>
+<FONT color="green">124</FONT>       *   &lt;li&gt;if {@link #CONTINUE} is returned, no specific action will<a name="line.124"></a>
+<FONT color="green">125</FONT>       *   be taken (apart from having called this method) and integration<a name="line.125"></a>
+<FONT color="green">126</FONT>       *   will continue.&lt;/li&gt;<a name="line.126"></a>
+<FONT color="green">127</FONT>       * &lt;/ul&gt;<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>       * &lt;p&gt;The scheduling between this method and the {@link<a name="line.129"></a>
+<FONT color="green">130</FONT>       * org.apache.commons.math.ode.sampling.StepHandler StepHandler} method {@link<a name="line.130"></a>
+<FONT color="green">131</FONT>       * org.apache.commons.math.ode.sampling.StepHandler#handleStep(<a name="line.131"></a>
+<FONT color="green">132</FONT>       * org.apache.commons.math.ode.sampling.StepInterpolator, boolean)<a name="line.132"></a>
+<FONT color="green">133</FONT>       * handleStep(interpolator, isLast)} is to call this method first and<a name="line.133"></a>
+<FONT color="green">134</FONT>       * &lt;code&gt;handleStep&lt;/code&gt; afterwards. This scheduling allows the integrator to<a name="line.134"></a>
+<FONT color="green">135</FONT>       * pass &lt;code&gt;true&lt;/code&gt; as the &lt;code&gt;isLast&lt;/code&gt; parameter to the step<a name="line.135"></a>
+<FONT color="green">136</FONT>       * handler to make it aware the step will be the last one if this method<a name="line.136"></a>
+<FONT color="green">137</FONT>       * returns {@link #STOP}. As the interpolator may be used to navigate back<a name="line.137"></a>
+<FONT color="green">138</FONT>       * throughout the last step (as {@link<a name="line.138"></a>
+<FONT color="green">139</FONT>       * org.apache.commons.math.ode.sampling.StepNormalizer StepNormalizer}<a name="line.139"></a>
+<FONT color="green">140</FONT>       * does for example), user code called by this method and user<a name="line.140"></a>
+<FONT color="green">141</FONT>       * code called by step handlers may experience apparently out of order values<a name="line.141"></a>
+<FONT color="green">142</FONT>       * of the independent time variable. As an example, if the same user object<a name="line.142"></a>
+<FONT color="green">143</FONT>       * implements both this {@link EventHandler EventHandler} interface and the<a name="line.143"></a>
+<FONT color="green">144</FONT>       * {@link org.apache.commons.math.ode.sampling.FixedStepHandler FixedStepHandler}<a name="line.144"></a>
+<FONT color="green">145</FONT>       * interface, a &lt;em&gt;forward&lt;/em&gt; integration may call its<a name="line.145"></a>
+<FONT color="green">146</FONT>       * &lt;code&gt;eventOccurred&lt;/code&gt; method with t = 10 first and call its<a name="line.146"></a>
+<FONT color="green">147</FONT>       * &lt;code&gt;handleStep&lt;/code&gt; method with t = 9 afterwards. Such out of order<a name="line.147"></a>
+<FONT color="green">148</FONT>       * calls are limited to the size of the integration step for {@link<a name="line.148"></a>
+<FONT color="green">149</FONT>       * org.apache.commons.math.ode.sampling.StepHandler variable step handlers} and<a name="line.149"></a>
+<FONT color="green">150</FONT>       * to the size of the fixed step for {@link<a name="line.150"></a>
+<FONT color="green">151</FONT>       * org.apache.commons.math.ode.sampling.FixedStepHandler fixed step handlers}.&lt;/p&gt;<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>       * @param t current value of the independent &lt;i&gt;time&lt;/i&gt; variable<a name="line.153"></a>
+<FONT color="green">154</FONT>       * @param y array containing the current value of the state vector<a name="line.154"></a>
+<FONT color="green">155</FONT>       * @param increasing if true, the value of the switching function increases<a name="line.155"></a>
+<FONT color="green">156</FONT>       * when times increases around event (note that increase is measured with respect<a name="line.156"></a>
+<FONT color="green">157</FONT>       * to physical time, not with respect to integration which may go backward in time)<a name="line.157"></a>
+<FONT color="green">158</FONT>       * @return indication of what the integrator should do next, this<a name="line.158"></a>
+<FONT color="green">159</FONT>       * value must be one of {@link #STOP}, {@link #RESET_STATE},<a name="line.159"></a>
+<FONT color="green">160</FONT>       * {@link #RESET_DERIVATIVES} or {@link #CONTINUE}<a name="line.160"></a>
+<FONT color="green">161</FONT>       * @exception EventException if the event occurrence triggers an error<a name="line.161"></a>
+<FONT color="green">162</FONT>       */<a name="line.162"></a>
+<FONT color="green">163</FONT>      int eventOccurred(double t, double[] y, boolean increasing) throws EventException;<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>      /** Reset the state prior to continue the integration.<a name="line.165"></a>
+<FONT color="green">166</FONT>    <a name="line.166"></a>
+<FONT color="green">167</FONT>       * &lt;p&gt;This method is called after the step handler has returned and<a name="line.167"></a>
+<FONT color="green">168</FONT>       * before the next step is started, but only when {@link<a name="line.168"></a>
+<FONT color="green">169</FONT>       * #eventOccurred} has itself returned the {@link #RESET_STATE}<a name="line.169"></a>
+<FONT color="green">170</FONT>       * indicator. It allows the user to reset the state vector for the<a name="line.170"></a>
+<FONT color="green">171</FONT>       * next step, without perturbing the step handler of the finishing<a name="line.171"></a>
+<FONT color="green">172</FONT>       * step. If the {@link #eventOccurred} never returns the {@link<a name="line.172"></a>
+<FONT color="green">173</FONT>       * #RESET_STATE} indicator, this function will never be called, and it is<a name="line.173"></a>
+<FONT color="green">174</FONT>       * safe to leave its body empty.&lt;/p&gt;<a name="line.174"></a>
+<FONT color="green">175</FONT>    <a name="line.175"></a>
+<FONT color="green">176</FONT>       * @param t current value of the independent &lt;i&gt;time&lt;/i&gt; variable<a name="line.176"></a>
+<FONT color="green">177</FONT>       * @param y array containing the current value of the state vector<a name="line.177"></a>
+<FONT color="green">178</FONT>       * the new state should be put in the same array<a name="line.178"></a>
+<FONT color="green">179</FONT>       * @exception EventException if the state cannot be reseted<a name="line.179"></a>
+<FONT color="green">180</FONT>       */<a name="line.180"></a>
+<FONT color="green">181</FONT>      void resetState(double t, double[] y) throws EventException;<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>    }<a name="line.183"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/events/EventState.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,411 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.events;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.analysis.solvers.BrentSolver;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.ode.sampling.StepInterpolator;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    /** This class handles the state for one {@link EventHandler<a name="line.28"></a>
+<FONT color="green">029</FONT>     * event handler} during integration steps.<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;Each time the integrator proposes a step, the event handler<a name="line.31"></a>
+<FONT color="green">032</FONT>     * switching function should be checked. This class handles the state<a name="line.32"></a>
+<FONT color="green">033</FONT>     * of one handler during one integration step, with references to the<a name="line.33"></a>
+<FONT color="green">034</FONT>     * state at the end of the preceding step. This information is used to<a name="line.34"></a>
+<FONT color="green">035</FONT>     * decide if the handler should trigger an event or not during the<a name="line.35"></a>
+<FONT color="green">036</FONT>     * proposed step (and hence the step should be reduced to ensure the<a name="line.36"></a>
+<FONT color="green">037</FONT>     * event occurs at a bound rather than inside the step).&lt;/p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     *<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @version $Revision: 889006 $ $Date: 2009-12-09 17:46:36 -0500 (Wed, 09 Dec 2009) $<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @since 1.2<a name="line.40"></a>
+<FONT color="green">041</FONT>     */<a name="line.41"></a>
+<FONT color="green">042</FONT>    public class EventState {<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Event handler. */<a name="line.44"></a>
+<FONT color="green">045</FONT>        private final EventHandler handler;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** Maximal time interval between events handler checks. */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private final double maxCheckInterval;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Convergence threshold for event localization. */<a name="line.50"></a>
+<FONT color="green">051</FONT>        private final double convergence;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** Upper limit in the iteration count for event localization. */<a name="line.53"></a>
+<FONT color="green">054</FONT>        private final int maxIterationCount;<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** Time at the beginning of the step. */<a name="line.56"></a>
+<FONT color="green">057</FONT>        private double t0;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** Value of the events handler at the beginning of the step. */<a name="line.59"></a>
+<FONT color="green">060</FONT>        private double g0;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** Simulated sign of g0 (we cheat when crossing events). */<a name="line.62"></a>
+<FONT color="green">063</FONT>        private boolean g0Positive;<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Indicator of event expected during the step. */<a name="line.65"></a>
+<FONT color="green">066</FONT>        private boolean pendingEvent;<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /** Occurrence time of the pending event. */<a name="line.68"></a>
+<FONT color="green">069</FONT>        private double pendingEventTime;<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** Occurrence time of the previous event. */<a name="line.71"></a>
+<FONT color="green">072</FONT>        private double previousEventTime;<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /** Integration direction. */<a name="line.74"></a>
+<FONT color="green">075</FONT>        private boolean forward;<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** Variation direction around pending event.<a name="line.77"></a>
+<FONT color="green">078</FONT>         *  (this is considered with respect to the integration direction)<a name="line.78"></a>
+<FONT color="green">079</FONT>         */<a name="line.79"></a>
+<FONT color="green">080</FONT>        private boolean increasing;<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>        /** Next action indicator. */<a name="line.82"></a>
+<FONT color="green">083</FONT>        private int nextAction;<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>        /** Simple constructor.<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @param handler event handler<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @param maxCheckInterval maximal time interval between switching<a name="line.87"></a>
+<FONT color="green">088</FONT>         * function checks (this interval prevents missing sign changes in<a name="line.88"></a>
+<FONT color="green">089</FONT>         * case the integration steps becomes very large)<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @param convergence convergence threshold in the event time search<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @param maxIterationCount upper limit of the iteration count in<a name="line.91"></a>
+<FONT color="green">092</FONT>         * the event time search<a name="line.92"></a>
+<FONT color="green">093</FONT>         */<a name="line.93"></a>
+<FONT color="green">094</FONT>        public EventState(final EventHandler handler, final double maxCheckInterval,<a name="line.94"></a>
+<FONT color="green">095</FONT>                          final double convergence, final int maxIterationCount) {<a name="line.95"></a>
+<FONT color="green">096</FONT>            this.handler           = handler;<a name="line.96"></a>
+<FONT color="green">097</FONT>            this.maxCheckInterval  = maxCheckInterval;<a name="line.97"></a>
+<FONT color="green">098</FONT>            this.convergence       = Math.abs(convergence);<a name="line.98"></a>
+<FONT color="green">099</FONT>            this.maxIterationCount = maxIterationCount;<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>            // some dummy values ...<a name="line.101"></a>
+<FONT color="green">102</FONT>            t0                = Double.NaN;<a name="line.102"></a>
+<FONT color="green">103</FONT>            g0                = Double.NaN;<a name="line.103"></a>
+<FONT color="green">104</FONT>            g0Positive        = true;<a name="line.104"></a>
+<FONT color="green">105</FONT>            pendingEvent      = false;<a name="line.105"></a>
+<FONT color="green">106</FONT>            pendingEventTime  = Double.NaN;<a name="line.106"></a>
+<FONT color="green">107</FONT>            previousEventTime = Double.NaN;<a name="line.107"></a>
+<FONT color="green">108</FONT>            increasing        = true;<a name="line.108"></a>
+<FONT color="green">109</FONT>            nextAction        = EventHandler.CONTINUE;<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        }<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>        /** Get the underlying event handler.<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @return underlying event handler<a name="line.114"></a>
+<FONT color="green">115</FONT>         */<a name="line.115"></a>
+<FONT color="green">116</FONT>        public EventHandler getEventHandler() {<a name="line.116"></a>
+<FONT color="green">117</FONT>            return handler;<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /** Get the maximal time interval between events handler checks.<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @return maximal time interval between events handler checks<a name="line.121"></a>
+<FONT color="green">122</FONT>         */<a name="line.122"></a>
+<FONT color="green">123</FONT>        public double getMaxCheckInterval() {<a name="line.123"></a>
+<FONT color="green">124</FONT>            return maxCheckInterval;<a name="line.124"></a>
+<FONT color="green">125</FONT>        }<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>        /** Get the convergence threshold for event localization.<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @return convergence threshold for event localization<a name="line.128"></a>
+<FONT color="green">129</FONT>         */<a name="line.129"></a>
+<FONT color="green">130</FONT>        public double getConvergence() {<a name="line.130"></a>
+<FONT color="green">131</FONT>            return convergence;<a name="line.131"></a>
+<FONT color="green">132</FONT>        }<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>        /** Get the upper limit in the iteration count for event localization.<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @return upper limit in the iteration count for event localization<a name="line.135"></a>
+<FONT color="green">136</FONT>         */<a name="line.136"></a>
+<FONT color="green">137</FONT>        public int getMaxIterationCount() {<a name="line.137"></a>
+<FONT color="green">138</FONT>            return maxIterationCount;<a name="line.138"></a>
+<FONT color="green">139</FONT>        }<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>        /** Reinitialize the beginning of the step.<a name="line.141"></a>
+<FONT color="green">142</FONT>         * @param tStart value of the independent &lt;i&gt;time&lt;/i&gt; variable at the<a name="line.142"></a>
+<FONT color="green">143</FONT>         * beginning of the step<a name="line.143"></a>
+<FONT color="green">144</FONT>         * @param yStart array containing the current value of the state vector<a name="line.144"></a>
+<FONT color="green">145</FONT>         * at the beginning of the step<a name="line.145"></a>
+<FONT color="green">146</FONT>         * @exception EventException if the event handler<a name="line.146"></a>
+<FONT color="green">147</FONT>         * value cannot be evaluated at the beginning of the step<a name="line.147"></a>
+<FONT color="green">148</FONT>         */<a name="line.148"></a>
+<FONT color="green">149</FONT>        public void reinitializeBegin(final double tStart, final double[] yStart)<a name="line.149"></a>
+<FONT color="green">150</FONT>            throws EventException {<a name="line.150"></a>
+<FONT color="green">151</FONT>            t0 = tStart;<a name="line.151"></a>
+<FONT color="green">152</FONT>            g0 = handler.g(tStart, yStart);<a name="line.152"></a>
+<FONT color="green">153</FONT>            g0Positive = g0 &gt;= 0;<a name="line.153"></a>
+<FONT color="green">154</FONT>        }<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>        /** Evaluate the impact of the proposed step on the event handler.<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @param interpolator step interpolator for the proposed step<a name="line.157"></a>
+<FONT color="green">158</FONT>         * @return true if the event handler triggers an event before<a name="line.158"></a>
+<FONT color="green">159</FONT>         * the end of the proposed step (this implies the step should be<a name="line.159"></a>
+<FONT color="green">160</FONT>         * rejected)<a name="line.160"></a>
+<FONT color="green">161</FONT>         * @exception DerivativeException if the interpolator fails to<a name="line.161"></a>
+<FONT color="green">162</FONT>         * compute the switching function somewhere within the step<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @exception EventException if the switching function<a name="line.163"></a>
+<FONT color="green">164</FONT>         * cannot be evaluated<a name="line.164"></a>
+<FONT color="green">165</FONT>         * @exception ConvergenceException if an event cannot be located<a name="line.165"></a>
+<FONT color="green">166</FONT>         */<a name="line.166"></a>
+<FONT color="green">167</FONT>        public boolean evaluateStep(final StepInterpolator interpolator)<a name="line.167"></a>
+<FONT color="green">168</FONT>            throws DerivativeException, EventException, ConvergenceException {<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>            try {<a name="line.170"></a>
+<FONT color="green">171</FONT>    <a name="line.171"></a>
+<FONT color="green">172</FONT>                forward = interpolator.isForward();<a name="line.172"></a>
+<FONT color="green">173</FONT>                final double t1 = interpolator.getCurrentTime();<a name="line.173"></a>
+<FONT color="green">174</FONT>                final int    n  = Math.max(1, (int) Math.ceil(Math.abs(t1 - t0) / maxCheckInterval));<a name="line.174"></a>
+<FONT color="green">175</FONT>                final double h  = (t1 - t0) / n;<a name="line.175"></a>
+<FONT color="green">176</FONT>    <a name="line.176"></a>
+<FONT color="green">177</FONT>                double ta = t0;<a name="line.177"></a>
+<FONT color="green">178</FONT>                double ga = g0;<a name="line.178"></a>
+<FONT color="green">179</FONT>                double tb = t0 + (interpolator.isForward() ? convergence : -convergence);<a name="line.179"></a>
+<FONT color="green">180</FONT>                for (int i = 0; i &lt; n; ++i) {<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>                    // evaluate handler value at the end of the substep<a name="line.182"></a>
+<FONT color="green">183</FONT>                    tb += h;<a name="line.183"></a>
+<FONT color="green">184</FONT>                    interpolator.setInterpolatedTime(tb);<a name="line.184"></a>
+<FONT color="green">185</FONT>                    final double gb = handler.g(tb, interpolator.getInterpolatedState());<a name="line.185"></a>
+<FONT color="green">186</FONT>    <a name="line.186"></a>
+<FONT color="green">187</FONT>                    // check events occurrence<a name="line.187"></a>
+<FONT color="green">188</FONT>                    if (g0Positive ^ (gb &gt;= 0)) {<a name="line.188"></a>
+<FONT color="green">189</FONT>                        // there is a sign change: an event is expected during this step<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>                        if (ga * gb &gt; 0) {<a name="line.191"></a>
+<FONT color="green">192</FONT>                            // this is a corner case:<a name="line.192"></a>
+<FONT color="green">193</FONT>                            // - there was an event near ta,<a name="line.193"></a>
+<FONT color="green">194</FONT>                            // - there is another event between ta and tb<a name="line.194"></a>
+<FONT color="green">195</FONT>                            // - when ta was computed, convergence was reached on the "wrong side" of the interval<a name="line.195"></a>
+<FONT color="green">196</FONT>                            // this implies that the real sign of ga is the same as gb, so we need to slightly<a name="line.196"></a>
+<FONT color="green">197</FONT>                            // shift ta to make sure ga and gb get opposite signs and the solver won't complain<a name="line.197"></a>
+<FONT color="green">198</FONT>                            // about bracketing<a name="line.198"></a>
+<FONT color="green">199</FONT>                            final double epsilon = (forward ? 0.25 : -0.25) * convergence;<a name="line.199"></a>
+<FONT color="green">200</FONT>                            for (int k = 0; (k &lt; 4) &amp;&amp; (ga * gb &gt; 0); ++k) {<a name="line.200"></a>
+<FONT color="green">201</FONT>                                ta += epsilon;<a name="line.201"></a>
+<FONT color="green">202</FONT>                                interpolator.setInterpolatedTime(ta);<a name="line.202"></a>
+<FONT color="green">203</FONT>                                ga = handler.g(ta, interpolator.getInterpolatedState());<a name="line.203"></a>
+<FONT color="green">204</FONT>                            }<a name="line.204"></a>
+<FONT color="green">205</FONT>                            if (ga * gb &gt; 0) {<a name="line.205"></a>
+<FONT color="green">206</FONT>                                // this should never happen<a name="line.206"></a>
+<FONT color="green">207</FONT>                                throw MathRuntimeException.createInternalError(null);<a name="line.207"></a>
+<FONT color="green">208</FONT>                            }<a name="line.208"></a>
+<FONT color="green">209</FONT>                        }<a name="line.209"></a>
+<FONT color="green">210</FONT>    <a name="line.210"></a>
+<FONT color="green">211</FONT>                        // variation direction, with respect to the integration direction<a name="line.211"></a>
+<FONT color="green">212</FONT>                        increasing = gb &gt;= ga;<a name="line.212"></a>
+<FONT color="green">213</FONT>    <a name="line.213"></a>
+<FONT color="green">214</FONT>                        final UnivariateRealFunction f = new UnivariateRealFunction() {<a name="line.214"></a>
+<FONT color="green">215</FONT>                            public double value(final double t) throws FunctionEvaluationException {<a name="line.215"></a>
+<FONT color="green">216</FONT>                                try {<a name="line.216"></a>
+<FONT color="green">217</FONT>                                    interpolator.setInterpolatedTime(t);<a name="line.217"></a>
+<FONT color="green">218</FONT>                                    return handler.g(t, interpolator.getInterpolatedState());<a name="line.218"></a>
+<FONT color="green">219</FONT>                                } catch (DerivativeException e) {<a name="line.219"></a>
+<FONT color="green">220</FONT>                                    throw new FunctionEvaluationException(e, t);<a name="line.220"></a>
+<FONT color="green">221</FONT>                                } catch (EventException e) {<a name="line.221"></a>
+<FONT color="green">222</FONT>                                    throw new FunctionEvaluationException(e, t);<a name="line.222"></a>
+<FONT color="green">223</FONT>                                }<a name="line.223"></a>
+<FONT color="green">224</FONT>                            }<a name="line.224"></a>
+<FONT color="green">225</FONT>                        };<a name="line.225"></a>
+<FONT color="green">226</FONT>                        final BrentSolver solver = new BrentSolver();<a name="line.226"></a>
+<FONT color="green">227</FONT>                        solver.setAbsoluteAccuracy(convergence);<a name="line.227"></a>
+<FONT color="green">228</FONT>                        solver.setMaximalIterationCount(maxIterationCount);<a name="line.228"></a>
+<FONT color="green">229</FONT>                        final double root = (ta &lt;= tb) ? solver.solve(f, ta, tb) : solver.solve(f, tb, ta);<a name="line.229"></a>
+<FONT color="green">230</FONT>                        if ((Math.abs(root - ta) &lt;= convergence) &amp;&amp;<a name="line.230"></a>
+<FONT color="green">231</FONT>                             (Math.abs(root - previousEventTime) &lt;= convergence)) {<a name="line.231"></a>
+<FONT color="green">232</FONT>                            // we have either found nothing or found (again ?) a past event, we simply ignore it<a name="line.232"></a>
+<FONT color="green">233</FONT>                            ta = tb;<a name="line.233"></a>
+<FONT color="green">234</FONT>                            ga = gb;<a name="line.234"></a>
+<FONT color="green">235</FONT>                        } else if (Double.isNaN(previousEventTime) ||<a name="line.235"></a>
+<FONT color="green">236</FONT>                                   (Math.abs(previousEventTime - root) &gt; convergence)) {<a name="line.236"></a>
+<FONT color="green">237</FONT>                            pendingEventTime = root;<a name="line.237"></a>
+<FONT color="green">238</FONT>                            if (pendingEvent &amp;&amp; (Math.abs(t1 - pendingEventTime) &lt;= convergence)) {<a name="line.238"></a>
+<FONT color="green">239</FONT>                                // we were already waiting for this event which was<a name="line.239"></a>
+<FONT color="green">240</FONT>                                // found during a previous call for a step that was<a name="line.240"></a>
+<FONT color="green">241</FONT>                                // rejected, this step must now be accepted since it<a name="line.241"></a>
+<FONT color="green">242</FONT>                                // properly ends exactly at the event occurrence<a name="line.242"></a>
+<FONT color="green">243</FONT>                                return false;<a name="line.243"></a>
+<FONT color="green">244</FONT>                            }<a name="line.244"></a>
+<FONT color="green">245</FONT>                            // either we were not waiting for the event or it has<a name="line.245"></a>
+<FONT color="green">246</FONT>                            // moved in such a way the step cannot be accepted<a name="line.246"></a>
+<FONT color="green">247</FONT>                            pendingEvent = true;<a name="line.247"></a>
+<FONT color="green">248</FONT>                            return true;<a name="line.248"></a>
+<FONT color="green">249</FONT>                        }<a name="line.249"></a>
+<FONT color="green">250</FONT>    <a name="line.250"></a>
+<FONT color="green">251</FONT>                    } else {<a name="line.251"></a>
+<FONT color="green">252</FONT>                        // no sign change: there is no event for now<a name="line.252"></a>
+<FONT color="green">253</FONT>                        ta = tb;<a name="line.253"></a>
+<FONT color="green">254</FONT>                        ga = gb;<a name="line.254"></a>
+<FONT color="green">255</FONT>                    }<a name="line.255"></a>
+<FONT color="green">256</FONT>    <a name="line.256"></a>
+<FONT color="green">257</FONT>                }<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>                // no event during the whole step<a name="line.259"></a>
+<FONT color="green">260</FONT>                pendingEvent     = false;<a name="line.260"></a>
+<FONT color="green">261</FONT>                pendingEventTime = Double.NaN;<a name="line.261"></a>
+<FONT color="green">262</FONT>                return false;<a name="line.262"></a>
+<FONT color="green">263</FONT>    <a name="line.263"></a>
+<FONT color="green">264</FONT>            } catch (FunctionEvaluationException e) {<a name="line.264"></a>
+<FONT color="green">265</FONT>                final Throwable cause = e.getCause();<a name="line.265"></a>
+<FONT color="green">266</FONT>                if ((cause != null) &amp;&amp; (cause instanceof DerivativeException)) {<a name="line.266"></a>
+<FONT color="green">267</FONT>                    throw (DerivativeException) cause;<a name="line.267"></a>
+<FONT color="green">268</FONT>                } else if ((cause != null) &amp;&amp; (cause instanceof EventException)) {<a name="line.268"></a>
+<FONT color="green">269</FONT>                    throw (EventException) cause;<a name="line.269"></a>
+<FONT color="green">270</FONT>                }<a name="line.270"></a>
+<FONT color="green">271</FONT>                throw new EventException(e);<a name="line.271"></a>
+<FONT color="green">272</FONT>            }<a name="line.272"></a>
+<FONT color="green">273</FONT>    <a name="line.273"></a>
+<FONT color="green">274</FONT>        }<a name="line.274"></a>
+<FONT color="green">275</FONT>    <a name="line.275"></a>
+<FONT color="green">276</FONT>        /** Get the occurrence time of the event triggered in the current<a name="line.276"></a>
+<FONT color="green">277</FONT>         * step.<a name="line.277"></a>
+<FONT color="green">278</FONT>         * @return occurrence time of the event triggered in the current<a name="line.278"></a>
+<FONT color="green">279</FONT>         * step.<a name="line.279"></a>
+<FONT color="green">280</FONT>         */<a name="line.280"></a>
+<FONT color="green">281</FONT>        public double getEventTime() {<a name="line.281"></a>
+<FONT color="green">282</FONT>            return pendingEventTime;<a name="line.282"></a>
+<FONT color="green">283</FONT>        }<a name="line.283"></a>
+<FONT color="green">284</FONT>    <a name="line.284"></a>
+<FONT color="green">285</FONT>        /** Acknowledge the fact the step has been accepted by the integrator.<a name="line.285"></a>
+<FONT color="green">286</FONT>         * @param t value of the independent &lt;i&gt;time&lt;/i&gt; variable at the<a name="line.286"></a>
+<FONT color="green">287</FONT>         * end of the step<a name="line.287"></a>
+<FONT color="green">288</FONT>         * @param y array containing the current value of the state vector<a name="line.288"></a>
+<FONT color="green">289</FONT>         * at the end of the step<a name="line.289"></a>
+<FONT color="green">290</FONT>         * @exception EventException if the value of the event<a name="line.290"></a>
+<FONT color="green">291</FONT>         * handler cannot be evaluated<a name="line.291"></a>
+<FONT color="green">292</FONT>         */<a name="line.292"></a>
+<FONT color="green">293</FONT>        public void stepAccepted(final double t, final double[] y)<a name="line.293"></a>
+<FONT color="green">294</FONT>            throws EventException {<a name="line.294"></a>
+<FONT color="green">295</FONT>    <a name="line.295"></a>
+<FONT color="green">296</FONT>            t0 = t;<a name="line.296"></a>
+<FONT color="green">297</FONT>            g0 = handler.g(t, y);<a name="line.297"></a>
+<FONT color="green">298</FONT>    <a name="line.298"></a>
+<FONT color="green">299</FONT>            if (pendingEvent) {<a name="line.299"></a>
+<FONT color="green">300</FONT>                // force the sign to its value "just after the event"<a name="line.300"></a>
+<FONT color="green">301</FONT>                previousEventTime = t;<a name="line.301"></a>
+<FONT color="green">302</FONT>                g0Positive        = increasing;<a name="line.302"></a>
+<FONT color="green">303</FONT>                nextAction        = handler.eventOccurred(t, y, !(increasing ^ forward));<a name="line.303"></a>
+<FONT color="green">304</FONT>            } else {<a name="line.304"></a>
+<FONT color="green">305</FONT>                g0Positive = g0 &gt;= 0;<a name="line.305"></a>
+<FONT color="green">306</FONT>                nextAction = EventHandler.CONTINUE;<a name="line.306"></a>
+<FONT color="green">307</FONT>            }<a name="line.307"></a>
+<FONT color="green">308</FONT>        }<a name="line.308"></a>
+<FONT color="green">309</FONT>    <a name="line.309"></a>
+<FONT color="green">310</FONT>        /** Check if the integration should be stopped at the end of the<a name="line.310"></a>
+<FONT color="green">311</FONT>         * current step.<a name="line.311"></a>
+<FONT color="green">312</FONT>         * @return true if the integration should be stopped<a name="line.312"></a>
+<FONT color="green">313</FONT>         */<a name="line.313"></a>
+<FONT color="green">314</FONT>        public boolean stop() {<a name="line.314"></a>
+<FONT color="green">315</FONT>            return nextAction == EventHandler.STOP;<a name="line.315"></a>
+<FONT color="green">316</FONT>        }<a name="line.316"></a>
+<FONT color="green">317</FONT>    <a name="line.317"></a>
+<FONT color="green">318</FONT>        /** Let the event handler reset the state if it wants.<a name="line.318"></a>
+<FONT color="green">319</FONT>         * @param t value of the independent &lt;i&gt;time&lt;/i&gt; variable at the<a name="line.319"></a>
+<FONT color="green">320</FONT>         * beginning of the next step<a name="line.320"></a>
+<FONT color="green">321</FONT>         * @param y array were to put the desired state vector at the beginning<a name="line.321"></a>
+<FONT color="green">322</FONT>         * of the next step<a name="line.322"></a>
+<FONT color="green">323</FONT>         * @return true if the integrator should reset the derivatives too<a name="line.323"></a>
+<FONT color="green">324</FONT>         * @exception EventException if the state cannot be reseted by the event<a name="line.324"></a>
+<FONT color="green">325</FONT>         * handler<a name="line.325"></a>
+<FONT color="green">326</FONT>         */<a name="line.326"></a>
+<FONT color="green">327</FONT>        public boolean reset(final double t, final double[] y)<a name="line.327"></a>
+<FONT color="green">328</FONT>            throws EventException {<a name="line.328"></a>
+<FONT color="green">329</FONT>    <a name="line.329"></a>
+<FONT color="green">330</FONT>            if (! pendingEvent) {<a name="line.330"></a>
+<FONT color="green">331</FONT>                return false;<a name="line.331"></a>
+<FONT color="green">332</FONT>            }<a name="line.332"></a>
+<FONT color="green">333</FONT>    <a name="line.333"></a>
+<FONT color="green">334</FONT>            if (nextAction == EventHandler.RESET_STATE) {<a name="line.334"></a>
+<FONT color="green">335</FONT>                handler.resetState(t, y);<a name="line.335"></a>
+<FONT color="green">336</FONT>            }<a name="line.336"></a>
+<FONT color="green">337</FONT>            pendingEvent      = false;<a name="line.337"></a>
+<FONT color="green">338</FONT>            pendingEventTime  = Double.NaN;<a name="line.338"></a>
+<FONT color="green">339</FONT>    <a name="line.339"></a>
+<FONT color="green">340</FONT>            return (nextAction == EventHandler.RESET_STATE) ||<a name="line.340"></a>
+<FONT color="green">341</FONT>                   (nextAction == EventHandler.RESET_DERIVATIVES);<a name="line.341"></a>
+<FONT color="green">342</FONT>    <a name="line.342"></a>
+<FONT color="green">343</FONT>        }<a name="line.343"></a>
+<FONT color="green">344</FONT>    <a name="line.344"></a>
+<FONT color="green">345</FONT>    }<a name="line.345"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/jacobians/EventHandlerWithJacobians.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,290 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.jacobians;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ode.events.EventException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /** This interface represents a handler for discrete events triggered<a name="line.22"></a>
+<FONT color="green">023</FONT>     * during ODE integration.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;Some events can be triggered at discrete times as an ODE problem<a name="line.25"></a>
+<FONT color="green">026</FONT>     * is solved. This occurs for example when the integration process<a name="line.26"></a>
+<FONT color="green">027</FONT>     * should be stopped as some state is reached (G-stop facility) when the<a name="line.27"></a>
+<FONT color="green">028</FONT>     * precise date is unknown a priori, or when the derivatives have<a name="line.28"></a>
+<FONT color="green">029</FONT>     * discontinuities, or simply when the user wants to monitor some<a name="line.29"></a>
+<FONT color="green">030</FONT>     * states boundaries crossings.<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     *<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;p&gt;These events are defined as occurring when a &lt;code&gt;g&lt;/code&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * switching function sign changes.&lt;/p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     *<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;p&gt;Since events are only problem-dependent and are triggered by the<a name="line.36"></a>
+<FONT color="green">037</FONT>     * independent &lt;i&gt;time&lt;/i&gt; variable and the state vector, they can<a name="line.37"></a>
+<FONT color="green">038</FONT>     * occur at virtually any time, unknown in advance. The integrators will<a name="line.38"></a>
+<FONT color="green">039</FONT>     * take care to avoid sign changes inside the steps, they will reduce<a name="line.39"></a>
+<FONT color="green">040</FONT>     * the step size when such an event is detected in order to put this<a name="line.40"></a>
+<FONT color="green">041</FONT>     * event exactly at the end of the current step. This guarantees that<a name="line.41"></a>
+<FONT color="green">042</FONT>     * step interpolation (which always has a one step scope) is relevant<a name="line.42"></a>
+<FONT color="green">043</FONT>     * even in presence of discontinuities. This is independent from the<a name="line.43"></a>
+<FONT color="green">044</FONT>     * stepsize control provided by integrators that monitor the local<a name="line.44"></a>
+<FONT color="green">045</FONT>     * error (this event handling feature is available for all integrators,<a name="line.45"></a>
+<FONT color="green">046</FONT>     * including fixed step ones).&lt;/p&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     *<a name="line.47"></a>
+<FONT color="green">048</FONT>     * &lt;p&gt;Note that is is possible to register a {@link<a name="line.48"></a>
+<FONT color="green">049</FONT>     * org.apache.commons.math.ode.events.EventHandler classical event handler}<a name="line.49"></a>
+<FONT color="green">050</FONT>     * in the low level integrator used to build a {@link FirstOrderIntegratorWithJacobians}<a name="line.50"></a>
+<FONT color="green">051</FONT>     * rather than implementing this class. The event handlers registered at low level<a name="line.51"></a>
+<FONT color="green">052</FONT>     * will see the big compound state whether the event handlers defined by this interface<a name="line.52"></a>
+<FONT color="green">053</FONT>     * see the original state, and its jacobians in separate arrays.&lt;/p&gt;<a name="line.53"></a>
+<FONT color="green">054</FONT>     *<a name="line.54"></a>
+<FONT color="green">055</FONT>     * &lt;p&gt;The compound state is guaranteed to contain the original state in the first<a name="line.55"></a>
+<FONT color="green">056</FONT>     * elements, followed by the jacobian with respect to initial state (in row order),<a name="line.56"></a>
+<FONT color="green">057</FONT>     * followed by the jacobian with respect to parameters (in row order). If for example<a name="line.57"></a>
+<FONT color="green">058</FONT>     * the original state dimension is 6 and there are 3 parameters, the compound state will<a name="line.58"></a>
+<FONT color="green">059</FONT>     * be a 60 elements array. The first 6 elements will be the original state, the next 36<a name="line.59"></a>
+<FONT color="green">060</FONT>     * elements will be the jacobian with respect to initial state, and the remaining 18 elements<a name="line.60"></a>
+<FONT color="green">061</FONT>     * will be the jacobian with respect to parameters.&lt;/p&gt;<a name="line.61"></a>
+<FONT color="green">062</FONT>     *<a name="line.62"></a>
+<FONT color="green">063</FONT>     * &lt;p&gt;Dealing with low level event handlers is cumbersome if one really needs the jacobians<a name="line.63"></a>
+<FONT color="green">064</FONT>     * in these methods, but it also prevents many data being copied back and forth between<a name="line.64"></a>
+<FONT color="green">065</FONT>     * state and jacobians on one side and compound state on the other side. So for performance<a name="line.65"></a>
+<FONT color="green">066</FONT>     * reasons, it is recommended to use this interface &lt;em&gt;only&lt;/em&gt; if jacobians are really<a name="line.66"></a>
+<FONT color="green">067</FONT>     * needed and to use lower level handlers if only state is needed.&lt;/p&gt;<a name="line.67"></a>
+<FONT color="green">068</FONT>     *<a name="line.68"></a>
+<FONT color="green">069</FONT>     * @version $Revision: 920131 $ $Date: 2010-03-07 17:19:18 -0500 (Sun, 07 Mar 2010) $<a name="line.69"></a>
+<FONT color="green">070</FONT>     * @since 2.1<a name="line.70"></a>
+<FONT color="green">071</FONT>     */<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>    public interface EventHandlerWithJacobians  {<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /** Stop indicator.<a name="line.75"></a>
+<FONT color="green">076</FONT>         * &lt;p&gt;This value should be used as the return value of the {@link<a name="line.76"></a>
+<FONT color="green">077</FONT>         * #eventOccurred eventOccurred} method when the integration should be<a name="line.77"></a>
+<FONT color="green">078</FONT>         * stopped after the event ending the current step.&lt;/p&gt;<a name="line.78"></a>
+<FONT color="green">079</FONT>         */<a name="line.79"></a>
+<FONT color="green">080</FONT>        int STOP = 0;<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>        /** Reset state indicator.<a name="line.82"></a>
+<FONT color="green">083</FONT>         * &lt;p&gt;This value should be used as the return value of the {@link<a name="line.83"></a>
+<FONT color="green">084</FONT>         * #eventOccurred eventOccurred} method when the integration should<a name="line.84"></a>
+<FONT color="green">085</FONT>         * go on after the event ending the current step, with a new state<a name="line.85"></a>
+<FONT color="green">086</FONT>         * vector (which will be retrieved thanks to the {@link #resetState<a name="line.86"></a>
+<FONT color="green">087</FONT>         * resetState} method).&lt;/p&gt;<a name="line.87"></a>
+<FONT color="green">088</FONT>         */<a name="line.88"></a>
+<FONT color="green">089</FONT>        int RESET_STATE = 1;<a name="line.89"></a>
+<FONT color="green">090</FONT>    <a name="line.90"></a>
+<FONT color="green">091</FONT>        /** Reset derivatives indicator.<a name="line.91"></a>
+<FONT color="green">092</FONT>         * &lt;p&gt;This value should be used as the return value of the {@link<a name="line.92"></a>
+<FONT color="green">093</FONT>         * #eventOccurred eventOccurred} method when the integration should<a name="line.93"></a>
+<FONT color="green">094</FONT>         * go on after the event ending the current step, with a new derivatives<a name="line.94"></a>
+<FONT color="green">095</FONT>         * vector (which will be retrieved thanks to the {@link<a name="line.95"></a>
+<FONT color="green">096</FONT>         * org.apache.commons.math.ode.FirstOrderDifferentialEquations#computeDerivatives}<a name="line.96"></a>
+<FONT color="green">097</FONT>         * method).&lt;/p&gt;<a name="line.97"></a>
+<FONT color="green">098</FONT>         */<a name="line.98"></a>
+<FONT color="green">099</FONT>        int RESET_DERIVATIVES = 2;<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /** Continue indicator.<a name="line.101"></a>
+<FONT color="green">102</FONT>         * &lt;p&gt;This value should be used as the return value of the {@link<a name="line.102"></a>
+<FONT color="green">103</FONT>         * #eventOccurred eventOccurred} method when the integration should go<a name="line.103"></a>
+<FONT color="green">104</FONT>         * on after the event ending the current step.&lt;/p&gt;<a name="line.104"></a>
+<FONT color="green">105</FONT>         */<a name="line.105"></a>
+<FONT color="green">106</FONT>        int CONTINUE = 3;<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>        /** Compute the value of the switching function.<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>         * &lt;p&gt;The discrete events are generated when the sign of this<a name="line.110"></a>
+<FONT color="green">111</FONT>         * switching function changes. The integrator will take care to change<a name="line.111"></a>
+<FONT color="green">112</FONT>         * the stepsize in such a way these events occur exactly at step boundaries.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * The switching function must be continuous in its roots neighborhood<a name="line.113"></a>
+<FONT color="green">114</FONT>         * (but not necessarily smooth), as the integrator will need to find its<a name="line.114"></a>
+<FONT color="green">115</FONT>         * roots to locate precisely the events.&lt;/p&gt;<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>         * @param t current value of the independent &lt;i&gt;time&lt;/i&gt; variable<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @param y array containing the current value of the state vector<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @param dydy0 array containing the current value of the jacobian of<a name="line.119"></a>
+<FONT color="green">120</FONT>         * the state vector with respect to initial state<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @param dydp array containing the current value of the jacobian of<a name="line.121"></a>
+<FONT color="green">122</FONT>         * the state vector with respect to parameters<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @return value of the g switching function<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @exception EventException if the switching function cannot be evaluated<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        double g(double t, double[] y, double[][] dydy0, double[][] dydp)<a name="line.126"></a>
+<FONT color="green">127</FONT>            throws EventException;<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>        /** Handle an event and choose what to do next.<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>         * &lt;p&gt;This method is called when the integrator has accepted a step<a name="line.131"></a>
+<FONT color="green">132</FONT>         * ending exactly on a sign change of the function, just &lt;em&gt;before&lt;/em&gt;<a name="line.132"></a>
+<FONT color="green">133</FONT>         * the step handler itself is called (see below for scheduling). It<a name="line.133"></a>
+<FONT color="green">134</FONT>         * allows the user to update his internal data to acknowledge the fact<a name="line.134"></a>
+<FONT color="green">135</FONT>         * the event has been handled (for example setting a flag in the {@link<a name="line.135"></a>
+<FONT color="green">136</FONT>         * org.apache.commons.math.ode.jacobians.ODEWithJacobians<a name="line.136"></a>
+<FONT color="green">137</FONT>         * differential equations} to switch the derivatives computation in<a name="line.137"></a>
+<FONT color="green">138</FONT>         * case of discontinuity), or to direct the integrator to either stop<a name="line.138"></a>
+<FONT color="green">139</FONT>         * or continue integration, possibly with a reset state or derivatives.&lt;/p&gt;<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>         * &lt;ul&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>         *   &lt;li&gt;if {@link #STOP} is returned, the step handler will be called<a name="line.142"></a>
+<FONT color="green">143</FONT>         *   with the &lt;code&gt;isLast&lt;/code&gt; flag of the {@link<a name="line.143"></a>
+<FONT color="green">144</FONT>         *   org.apache.commons.math.ode.jacobians.StepHandlerWithJacobians#handleStep(<a name="line.144"></a>
+<FONT color="green">145</FONT>         *   StepInterpolatorWithJacobians, boolean) handleStep} method set to true and<a name="line.145"></a>
+<FONT color="green">146</FONT>         *   the integration will be stopped,&lt;/li&gt;<a name="line.146"></a>
+<FONT color="green">147</FONT>         *   &lt;li&gt;if {@link #RESET_STATE} is returned, the {@link #resetState<a name="line.147"></a>
+<FONT color="green">148</FONT>         *   resetState} method will be called once the step handler has<a name="line.148"></a>
+<FONT color="green">149</FONT>         *   finished its task, and the integrator will also recompute the<a name="line.149"></a>
+<FONT color="green">150</FONT>         *   derivatives,&lt;/li&gt;<a name="line.150"></a>
+<FONT color="green">151</FONT>         *   &lt;li&gt;if {@link #RESET_DERIVATIVES} is returned, the integrator<a name="line.151"></a>
+<FONT color="green">152</FONT>         *   will recompute the derivatives,<a name="line.152"></a>
+<FONT color="green">153</FONT>         *   &lt;li&gt;if {@link #CONTINUE} is returned, no specific action will<a name="line.153"></a>
+<FONT color="green">154</FONT>         *   be taken (apart from having called this method) and integration<a name="line.154"></a>
+<FONT color="green">155</FONT>         *   will continue.&lt;/li&gt;<a name="line.155"></a>
+<FONT color="green">156</FONT>         * &lt;/ul&gt;<a name="line.156"></a>
+<FONT color="green">157</FONT>    <a name="line.157"></a>
+<FONT color="green">158</FONT>         * &lt;p&gt;The scheduling between this method and the {@link<a name="line.158"></a>
+<FONT color="green">159</FONT>         * org.apache.commons.math.ode.jacobians.StepHandlerWithJacobians<a name="line.159"></a>
+<FONT color="green">160</FONT>         * StepHandlerWithJacobians} method {@link<a name="line.160"></a>
+<FONT color="green">161</FONT>         * org.apache.commons.math.ode.jacobians.StepHandlerWithJacobians#handleStep(<a name="line.161"></a>
+<FONT color="green">162</FONT>         * StepInterpolatorWithJacobians, boolean) handleStep(interpolator, isLast)}<a name="line.162"></a>
+<FONT color="green">163</FONT>         * is to call this method first and &lt;code&gt;handleStep&lt;/code&gt; afterwards. This<a name="line.163"></a>
+<FONT color="green">164</FONT>         * scheduling allows the integrator to pass &lt;code&gt;true&lt;/code&gt; as the<a name="line.164"></a>
+<FONT color="green">165</FONT>         * &lt;code&gt;isLast&lt;/code&gt; parameter to the step handler to make it aware the step<a name="line.165"></a>
+<FONT color="green">166</FONT>         * will be the last one if this method returns {@link #STOP}. As the<a name="line.166"></a>
+<FONT color="green">167</FONT>         * interpolator may be used to navigate back throughout the last step (as {@link<a name="line.167"></a>
+<FONT color="green">168</FONT>         * org.apache.commons.math.ode.sampling.StepNormalizer StepNormalizer}<a name="line.168"></a>
+<FONT color="green">169</FONT>         * does for example), user code called by this method and user<a name="line.169"></a>
+<FONT color="green">170</FONT>         * code called by step handlers may experience apparently out of order values<a name="line.170"></a>
+<FONT color="green">171</FONT>         * of the independent time variable. As an example, if the same user object<a name="line.171"></a>
+<FONT color="green">172</FONT>         * implements both this {@link EventHandlerWithJacobians EventHandler} interface and the<a name="line.172"></a>
+<FONT color="green">173</FONT>         * {@link org.apache.commons.math.ode.sampling.FixedStepHandler FixedStepHandler}<a name="line.173"></a>
+<FONT color="green">174</FONT>         * interface, a &lt;em&gt;forward&lt;/em&gt; integration may call its<a name="line.174"></a>
+<FONT color="green">175</FONT>         * &lt;code&gt;eventOccurred&lt;/code&gt; method with t = 10 first and call its<a name="line.175"></a>
+<FONT color="green">176</FONT>         * &lt;code&gt;handleStep&lt;/code&gt; method with t = 9 afterwards. Such out of order<a name="line.176"></a>
+<FONT color="green">177</FONT>         * calls are limited to the size of the integration step for {@link<a name="line.177"></a>
+<FONT color="green">178</FONT>         * org.apache.commons.math.ode.sampling.StepHandler variable step handlers} and<a name="line.178"></a>
+<FONT color="green">179</FONT>         * to the size of the fixed step for {@link<a name="line.179"></a>
+<FONT color="green">180</FONT>         * org.apache.commons.math.ode.sampling.FixedStepHandler fixed step handlers}.&lt;/p&gt;<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>         * @param t current value of the independent &lt;i&gt;time&lt;/i&gt; variable<a name="line.182"></a>
+<FONT color="green">183</FONT>         * @param y array containing the current value of the state vector<a name="line.183"></a>
+<FONT color="green">184</FONT>         * @param dydy0 array containing the current value of the jacobian of<a name="line.184"></a>
+<FONT color="green">185</FONT>         * the state vector with respect to initial state<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @param dydp array containing the current value of the jacobian of<a name="line.186"></a>
+<FONT color="green">187</FONT>         * the state vector with respect to parameters<a name="line.187"></a>
+<FONT color="green">188</FONT>         * @param increasing if true, the value of the switching function increases<a name="line.188"></a>
+<FONT color="green">189</FONT>         * when times increases around event (note that increase is measured with respect<a name="line.189"></a>
+<FONT color="green">190</FONT>         * to physical time, not with respect to integration which may go backward in time)<a name="line.190"></a>
+<FONT color="green">191</FONT>         * @return indication of what the integrator should do next, this<a name="line.191"></a>
+<FONT color="green">192</FONT>         * value must be one of {@link #STOP}, {@link #RESET_STATE},<a name="line.192"></a>
+<FONT color="green">193</FONT>         * {@link #RESET_DERIVATIVES} or {@link #CONTINUE}<a name="line.193"></a>
+<FONT color="green">194</FONT>         * @exception EventException if the event occurrence triggers an error<a name="line.194"></a>
+<FONT color="green">195</FONT>         */<a name="line.195"></a>
+<FONT color="green">196</FONT>        int eventOccurred(double t, double[] y, double[][] dydy0, double[][] dydp,<a name="line.196"></a>
+<FONT color="green">197</FONT>                          boolean increasing) throws EventException;<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>        /** Reset the state prior to continue the integration.<a name="line.199"></a>
+<FONT color="green">200</FONT>    <a name="line.200"></a>
+<FONT color="green">201</FONT>         * &lt;p&gt;This method is called after the step handler has returned and<a name="line.201"></a>
+<FONT color="green">202</FONT>         * before the next step is started, but only when {@link<a name="line.202"></a>
+<FONT color="green">203</FONT>         * #eventOccurred} has itself returned the {@link #RESET_STATE}<a name="line.203"></a>
+<FONT color="green">204</FONT>         * indicator. It allows the user to reset the state vector for the<a name="line.204"></a>
+<FONT color="green">205</FONT>         * next step, without perturbing the step handler of the finishing<a name="line.205"></a>
+<FONT color="green">206</FONT>         * step. If the {@link #eventOccurred} never returns the {@link<a name="line.206"></a>
+<FONT color="green">207</FONT>         * #RESET_STATE} indicator, this function will never be called, and it is<a name="line.207"></a>
+<FONT color="green">208</FONT>         * safe to leave its body empty.&lt;/p&gt;<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>         * @param t current value of the independent &lt;i&gt;time&lt;/i&gt; variable<a name="line.210"></a>
+<FONT color="green">211</FONT>         * @param y array containing the current value of the state vector<a name="line.211"></a>
+<FONT color="green">212</FONT>         * the new state should be put in the same array<a name="line.212"></a>
+<FONT color="green">213</FONT>         * @param dydy0 array containing the current value of the jacobian of<a name="line.213"></a>
+<FONT color="green">214</FONT>         * the state vector with respect to initial state, the new jacobian<a name="line.214"></a>
+<FONT color="green">215</FONT>         * should be put in the same array<a name="line.215"></a>
+<FONT color="green">216</FONT>         * @param dydp array containing the current value of the jacobian of<a name="line.216"></a>
+<FONT color="green">217</FONT>         * the state vector with respect to parameters, the new jacobian<a name="line.217"></a>
+<FONT color="green">218</FONT>         * should be put in the same array<a name="line.218"></a>
+<FONT color="green">219</FONT>         * @exception EventException if the state cannot be reseted<a name="line.219"></a>
+<FONT color="green">220</FONT>         */<a name="line.220"></a>
+<FONT color="green">221</FONT>        void resetState(double t, double[] y, double[][] dydy0, double[][] dydp)<a name="line.221"></a>
+<FONT color="green">222</FONT>        throws EventException;<a name="line.222"></a>
+<FONT color="green">223</FONT>    <a name="line.223"></a>
+<FONT color="green">224</FONT>    }<a name="line.224"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/jacobians/FirstOrderIntegratorWithJacobians.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,957 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.jacobians;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.IOException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.io.ObjectInput;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.io.ObjectOutput;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.lang.reflect.Array;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import java.util.ArrayList;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import java.util.Collection;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.MaxEvaluationsExceededException;<a name="line.28"></a>
+<FONT color="green">029</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.29"></a>
+<FONT color="green">030</FONT>    import org.apache.commons.math.ode.FirstOrderDifferentialEquations;<a name="line.30"></a>
+<FONT color="green">031</FONT>    import org.apache.commons.math.ode.FirstOrderIntegrator;<a name="line.31"></a>
+<FONT color="green">032</FONT>    import org.apache.commons.math.ode.IntegratorException;<a name="line.32"></a>
+<FONT color="green">033</FONT>    import org.apache.commons.math.ode.events.EventException;<a name="line.33"></a>
+<FONT color="green">034</FONT>    import org.apache.commons.math.ode.events.EventHandler;<a name="line.34"></a>
+<FONT color="green">035</FONT>    import org.apache.commons.math.ode.sampling.StepHandler;<a name="line.35"></a>
+<FONT color="green">036</FONT>    import org.apache.commons.math.ode.sampling.StepInterpolator;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>    /** This class enhances a first order integrator for differential equations to<a name="line.38"></a>
+<FONT color="green">039</FONT>     * compute also partial derivatives of the solution with respect to initial state<a name="line.39"></a>
+<FONT color="green">040</FONT>     * and parameters.<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;p&gt;In order to compute both the state and its derivatives, the ODE problem<a name="line.41"></a>
+<FONT color="green">042</FONT>     * is extended with jacobians of the raw ODE and the variational equations are<a name="line.42"></a>
+<FONT color="green">043</FONT>     * added to form a new compound problem of higher dimension. If the original ODE<a name="line.43"></a>
+<FONT color="green">044</FONT>     * problem has dimension n and there are p parameters, the compound problem will<a name="line.44"></a>
+<FONT color="green">045</FONT>     * have dimension n &amp;times; (1 + n + p).&lt;/p&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     * @see ParameterizedODE<a name="line.46"></a>
+<FONT color="green">047</FONT>     * @see ODEWithJacobians<a name="line.47"></a>
+<FONT color="green">048</FONT>     * @version $Revision: 927342 $ $Date: 2010-03-25 06:55:55 -0400 (Thu, 25 Mar 2010) $<a name="line.48"></a>
+<FONT color="green">049</FONT>     * @since 2.1<a name="line.49"></a>
+<FONT color="green">050</FONT>     */<a name="line.50"></a>
+<FONT color="green">051</FONT>    public class FirstOrderIntegratorWithJacobians {<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** Underlying integrator for compound problem. */<a name="line.53"></a>
+<FONT color="green">054</FONT>        private final FirstOrderIntegrator integrator;<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** Raw equations to integrate. */<a name="line.56"></a>
+<FONT color="green">057</FONT>        private final ODEWithJacobians ode;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** Maximal number of evaluations allowed. */<a name="line.59"></a>
+<FONT color="green">060</FONT>        private int maxEvaluations;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** Number of evaluations already performed. */<a name="line.62"></a>
+<FONT color="green">063</FONT>        private int evaluations;<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Build an enhanced integrator using internal differentiation to compute jacobians.<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @param integrator underlying integrator to solve the compound problem<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @param ode original problem (f in the equation y' = f(t, y))<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param p parameters array (may be null if {@link<a name="line.68"></a>
+<FONT color="green">069</FONT>         * ParameterizedODE#getParametersDimension()<a name="line.69"></a>
+<FONT color="green">070</FONT>         * getParametersDimension()} from original problem is zero)<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param hY step sizes to use for computing the jacobian df/dy, must have the<a name="line.71"></a>
+<FONT color="green">072</FONT>         * same dimension as the original problem<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @param hP step sizes to use for computing the jacobian df/dp, must have the<a name="line.73"></a>
+<FONT color="green">074</FONT>         * same dimension as the original problem parameters dimension<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @see #FirstOrderIntegratorWithJacobians(FirstOrderIntegrator,<a name="line.75"></a>
+<FONT color="green">076</FONT>         * ODEWithJacobians)<a name="line.76"></a>
+<FONT color="green">077</FONT>         */<a name="line.77"></a>
+<FONT color="green">078</FONT>        public FirstOrderIntegratorWithJacobians(final FirstOrderIntegrator integrator,<a name="line.78"></a>
+<FONT color="green">079</FONT>                                                 final ParameterizedODE ode,<a name="line.79"></a>
+<FONT color="green">080</FONT>                                                 final double[] p, final double[] hY, final double[] hP) {<a name="line.80"></a>
+<FONT color="green">081</FONT>            checkDimension(ode.getDimension(), hY);<a name="line.81"></a>
+<FONT color="green">082</FONT>            checkDimension(ode.getParametersDimension(), p);<a name="line.82"></a>
+<FONT color="green">083</FONT>            checkDimension(ode.getParametersDimension(), hP);<a name="line.83"></a>
+<FONT color="green">084</FONT>            this.integrator = integrator;<a name="line.84"></a>
+<FONT color="green">085</FONT>            this.ode = new FiniteDifferencesWrapper(ode, p, hY, hP);<a name="line.85"></a>
+<FONT color="green">086</FONT>            setMaxEvaluations(-1);<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /** Build an enhanced integrator using ODE builtin jacobian computation features.<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @param integrator underlying integrator to solve the compound problem<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @param ode original problem, which can compute the jacobians by itself<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @see #FirstOrderIntegratorWithJacobians(FirstOrderIntegrator,<a name="line.92"></a>
+<FONT color="green">093</FONT>         * ParameterizedODE, double[], double[], double[])<a name="line.93"></a>
+<FONT color="green">094</FONT>         */<a name="line.94"></a>
+<FONT color="green">095</FONT>        public FirstOrderIntegratorWithJacobians(final FirstOrderIntegrator integrator,<a name="line.95"></a>
+<FONT color="green">096</FONT>                                                 final ODEWithJacobians ode) {<a name="line.96"></a>
+<FONT color="green">097</FONT>            this.integrator = integrator;<a name="line.97"></a>
+<FONT color="green">098</FONT>            this.ode = ode;<a name="line.98"></a>
+<FONT color="green">099</FONT>            setMaxEvaluations(-1);<a name="line.99"></a>
+<FONT color="green">100</FONT>        }<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>        /** Add a step handler to this integrator.<a name="line.102"></a>
+<FONT color="green">103</FONT>         * &lt;p&gt;The handler will be called by the integrator for each accepted<a name="line.103"></a>
+<FONT color="green">104</FONT>         * step.&lt;/p&gt;<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @param handler handler for the accepted steps<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @see #getStepHandlers()<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @see #clearStepHandlers()<a name="line.107"></a>
+<FONT color="green">108</FONT>         */<a name="line.108"></a>
+<FONT color="green">109</FONT>        public void addStepHandler(StepHandlerWithJacobians handler) {<a name="line.109"></a>
+<FONT color="green">110</FONT>            final int n = ode.getDimension();<a name="line.110"></a>
+<FONT color="green">111</FONT>            final int k = ode.getParametersDimension();<a name="line.111"></a>
+<FONT color="green">112</FONT>            integrator.addStepHandler(new StepHandlerWrapper(handler, n, k));<a name="line.112"></a>
+<FONT color="green">113</FONT>        }<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>        /** Get all the step handlers that have been added to the integrator.<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @return an unmodifiable collection of the added events handlers<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @see #addStepHandler(StepHandlerWithJacobians)<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @see #clearStepHandlers()<a name="line.118"></a>
+<FONT color="green">119</FONT>         */<a name="line.119"></a>
+<FONT color="green">120</FONT>        public Collection&lt;StepHandlerWithJacobians&gt; getStepHandlers() {<a name="line.120"></a>
+<FONT color="green">121</FONT>            final Collection&lt;StepHandlerWithJacobians&gt; handlers =<a name="line.121"></a>
+<FONT color="green">122</FONT>                new ArrayList&lt;StepHandlerWithJacobians&gt;();<a name="line.122"></a>
+<FONT color="green">123</FONT>            for (final StepHandler handler : integrator.getStepHandlers()) {<a name="line.123"></a>
+<FONT color="green">124</FONT>                if (handler instanceof StepHandlerWrapper) {<a name="line.124"></a>
+<FONT color="green">125</FONT>                    handlers.add(((StepHandlerWrapper) handler).getHandler());<a name="line.125"></a>
+<FONT color="green">126</FONT>                }<a name="line.126"></a>
+<FONT color="green">127</FONT>            }<a name="line.127"></a>
+<FONT color="green">128</FONT>            return handlers;<a name="line.128"></a>
+<FONT color="green">129</FONT>        }<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>        /** Remove all the step handlers that have been added to the integrator.<a name="line.131"></a>
+<FONT color="green">132</FONT>         * @see #addStepHandler(StepHandlerWithJacobians)<a name="line.132"></a>
+<FONT color="green">133</FONT>         * @see #getStepHandlers()<a name="line.133"></a>
+<FONT color="green">134</FONT>         */<a name="line.134"></a>
+<FONT color="green">135</FONT>        public void clearStepHandlers() {<a name="line.135"></a>
+<FONT color="green">136</FONT>            integrator.clearStepHandlers();<a name="line.136"></a>
+<FONT color="green">137</FONT>        }<a name="line.137"></a>
+<FONT color="green">138</FONT>    <a name="line.138"></a>
+<FONT color="green">139</FONT>        /** Add an event handler to the integrator.<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @param handler event handler<a name="line.140"></a>
+<FONT color="green">141</FONT>         * @param maxCheckInterval maximal time interval between switching<a name="line.141"></a>
+<FONT color="green">142</FONT>         * function checks (this interval prevents missing sign changes in<a name="line.142"></a>
+<FONT color="green">143</FONT>         * case the integration steps becomes very large)<a name="line.143"></a>
+<FONT color="green">144</FONT>         * @param convergence convergence threshold in the event time search<a name="line.144"></a>
+<FONT color="green">145</FONT>         * @param maxIterationCount upper limit of the iteration count in<a name="line.145"></a>
+<FONT color="green">146</FONT>         * the event time search<a name="line.146"></a>
+<FONT color="green">147</FONT>         * @see #getEventHandlers()<a name="line.147"></a>
+<FONT color="green">148</FONT>         * @see #clearEventHandlers()<a name="line.148"></a>
+<FONT color="green">149</FONT>         */<a name="line.149"></a>
+<FONT color="green">150</FONT>        public void addEventHandler(EventHandlerWithJacobians handler,<a name="line.150"></a>
+<FONT color="green">151</FONT>                                    double maxCheckInterval,<a name="line.151"></a>
+<FONT color="green">152</FONT>                                    double convergence,<a name="line.152"></a>
+<FONT color="green">153</FONT>                                    int maxIterationCount) {<a name="line.153"></a>
+<FONT color="green">154</FONT>            final int n = ode.getDimension();<a name="line.154"></a>
+<FONT color="green">155</FONT>            final int k = ode.getParametersDimension();<a name="line.155"></a>
+<FONT color="green">156</FONT>            integrator.addEventHandler(new EventHandlerWrapper(handler, n, k),<a name="line.156"></a>
+<FONT color="green">157</FONT>                                       maxCheckInterval, convergence, maxIterationCount);<a name="line.157"></a>
+<FONT color="green">158</FONT>        }<a name="line.158"></a>
+<FONT color="green">159</FONT>    <a name="line.159"></a>
+<FONT color="green">160</FONT>        /** Get all the event handlers that have been added to the integrator.<a name="line.160"></a>
+<FONT color="green">161</FONT>         * @return an unmodifiable collection of the added events handlers<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @see #addEventHandler(EventHandlerWithJacobians, double, double, int)<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @see #clearEventHandlers()<a name="line.163"></a>
+<FONT color="green">164</FONT>         */<a name="line.164"></a>
+<FONT color="green">165</FONT>        public Collection&lt;EventHandlerWithJacobians&gt; getEventHandlers() {<a name="line.165"></a>
+<FONT color="green">166</FONT>            final Collection&lt;EventHandlerWithJacobians&gt; handlers =<a name="line.166"></a>
+<FONT color="green">167</FONT>                new ArrayList&lt;EventHandlerWithJacobians&gt;();<a name="line.167"></a>
+<FONT color="green">168</FONT>            for (final EventHandler handler : integrator.getEventHandlers()) {<a name="line.168"></a>
+<FONT color="green">169</FONT>                if (handler instanceof EventHandlerWrapper) {<a name="line.169"></a>
+<FONT color="green">170</FONT>                    handlers.add(((EventHandlerWrapper) handler).getHandler());<a name="line.170"></a>
+<FONT color="green">171</FONT>                }<a name="line.171"></a>
+<FONT color="green">172</FONT>            }<a name="line.172"></a>
+<FONT color="green">173</FONT>            return handlers;<a name="line.173"></a>
+<FONT color="green">174</FONT>        }<a name="line.174"></a>
+<FONT color="green">175</FONT>    <a name="line.175"></a>
+<FONT color="green">176</FONT>        /** Remove all the event handlers that have been added to the integrator.<a name="line.176"></a>
+<FONT color="green">177</FONT>         * @see #addEventHandler(EventHandlerWithJacobians, double, double, int)<a name="line.177"></a>
+<FONT color="green">178</FONT>         * @see #getEventHandlers()<a name="line.178"></a>
+<FONT color="green">179</FONT>         */<a name="line.179"></a>
+<FONT color="green">180</FONT>        public void clearEventHandlers() {<a name="line.180"></a>
+<FONT color="green">181</FONT>            integrator.clearEventHandlers();<a name="line.181"></a>
+<FONT color="green">182</FONT>        }<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>        /** Integrate the differential equations and the variational equations up to the given time.<a name="line.184"></a>
+<FONT color="green">185</FONT>         * &lt;p&gt;This method solves an Initial Value Problem (IVP) and also computes the derivatives<a name="line.185"></a>
+<FONT color="green">186</FONT>         * of the solution with respect to initial state and parameters. This can be used as<a name="line.186"></a>
+<FONT color="green">187</FONT>         * a basis to solve Boundary Value Problems (BVP).&lt;/p&gt;<a name="line.187"></a>
+<FONT color="green">188</FONT>         * &lt;p&gt;Since this method stores some internal state variables made<a name="line.188"></a>
+<FONT color="green">189</FONT>         * available in its public interface during integration ({@link<a name="line.189"></a>
+<FONT color="green">190</FONT>         * #getCurrentSignedStepsize()}), it is &lt;em&gt;not&lt;/em&gt; thread-safe.&lt;/p&gt;<a name="line.190"></a>
+<FONT color="green">191</FONT>         * @param t0 initial time<a name="line.191"></a>
+<FONT color="green">192</FONT>         * @param y0 initial value of the state vector at t0<a name="line.192"></a>
+<FONT color="green">193</FONT>         * @param dY0dP initial value of the state vector derivative with respect to the<a name="line.193"></a>
+<FONT color="green">194</FONT>         * parameters at t0<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @param t target time for the integration<a name="line.195"></a>
+<FONT color="green">196</FONT>         * (can be set to a value smaller than &lt;code&gt;t0&lt;/code&gt; for backward integration)<a name="line.196"></a>
+<FONT color="green">197</FONT>         * @param y placeholder where to put the state vector at each successful<a name="line.197"></a>
+<FONT color="green">198</FONT>         *  step (and hence at the end of integration), can be the same object as y0<a name="line.198"></a>
+<FONT color="green">199</FONT>         * @param dYdY0 placeholder where to put the state vector derivative with respect<a name="line.199"></a>
+<FONT color="green">200</FONT>         * to the initial state (dy[i]/dy0[j] is in element array dYdY0[i][j]) at each successful<a name="line.200"></a>
+<FONT color="green">201</FONT>         *  step (and hence at the end of integration)<a name="line.201"></a>
+<FONT color="green">202</FONT>         * @param dYdP placeholder where to put the state vector derivative with respect<a name="line.202"></a>
+<FONT color="green">203</FONT>         * to the parameters (dy[i]/dp[j] is in element array dYdP[i][j]) at each successful<a name="line.203"></a>
+<FONT color="green">204</FONT>         *  step (and hence at the end of integration)<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @return stop time, will be the same as target time if integration reached its<a name="line.205"></a>
+<FONT color="green">206</FONT>         * target, but may be different if some event handler stops it at some point.<a name="line.206"></a>
+<FONT color="green">207</FONT>         * @throws IntegratorException if the integrator cannot perform integration<a name="line.207"></a>
+<FONT color="green">208</FONT>         * @throws DerivativeException this exception is propagated to the caller if<a name="line.208"></a>
+<FONT color="green">209</FONT>         * the underlying user function triggers one<a name="line.209"></a>
+<FONT color="green">210</FONT>         */<a name="line.210"></a>
+<FONT color="green">211</FONT>        public double integrate(final double t0, final double[] y0, final double[][] dY0dP,<a name="line.211"></a>
+<FONT color="green">212</FONT>                                final double t, final double[] y,<a name="line.212"></a>
+<FONT color="green">213</FONT>                                final double[][] dYdY0, final double[][] dYdP)<a name="line.213"></a>
+<FONT color="green">214</FONT>            throws DerivativeException, IntegratorException {<a name="line.214"></a>
+<FONT color="green">215</FONT>    <a name="line.215"></a>
+<FONT color="green">216</FONT>            final int n = ode.getDimension();<a name="line.216"></a>
+<FONT color="green">217</FONT>            final int k = ode.getParametersDimension();<a name="line.217"></a>
+<FONT color="green">218</FONT>            checkDimension(n, y0);<a name="line.218"></a>
+<FONT color="green">219</FONT>            checkDimension(n, y);<a name="line.219"></a>
+<FONT color="green">220</FONT>            checkDimension(n, dYdY0);<a name="line.220"></a>
+<FONT color="green">221</FONT>            checkDimension(n, dYdY0[0]);<a name="line.221"></a>
+<FONT color="green">222</FONT>            if (k != 0) {<a name="line.222"></a>
+<FONT color="green">223</FONT>                checkDimension(n, dY0dP);<a name="line.223"></a>
+<FONT color="green">224</FONT>                checkDimension(k, dY0dP[0]);<a name="line.224"></a>
+<FONT color="green">225</FONT>                checkDimension(n, dYdP);<a name="line.225"></a>
+<FONT color="green">226</FONT>                checkDimension(k, dYdP[0]);<a name="line.226"></a>
+<FONT color="green">227</FONT>            }<a name="line.227"></a>
+<FONT color="green">228</FONT>    <a name="line.228"></a>
+<FONT color="green">229</FONT>            // set up initial state, including partial derivatives<a name="line.229"></a>
+<FONT color="green">230</FONT>            // the compound state z contains the raw state y and its derivatives<a name="line.230"></a>
+<FONT color="green">231</FONT>            // with respect to initial state y0 and to parameters p<a name="line.231"></a>
+<FONT color="green">232</FONT>            //    y[i]         is stored in z[i]<a name="line.232"></a>
+<FONT color="green">233</FONT>            //    dy[i]/dy0[j] is stored in z[n + i * n + j]<a name="line.233"></a>
+<FONT color="green">234</FONT>            //    dy[i]/dp[j]  is stored in z[n * (n + 1) + i * k + j]<a name="line.234"></a>
+<FONT color="green">235</FONT>            final double[] z = new double[n * (1 + n + k)];<a name="line.235"></a>
+<FONT color="green">236</FONT>            System.arraycopy(y0, 0, z, 0, n);<a name="line.236"></a>
+<FONT color="green">237</FONT>            for (int i = 0; i &lt; n; ++i) {<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>                // set diagonal element of dy/dy0 to 1.0 at t = t0<a name="line.239"></a>
+<FONT color="green">240</FONT>                z[i * (1 + n) + n] = 1.0;<a name="line.240"></a>
+<FONT color="green">241</FONT>    <a name="line.241"></a>
+<FONT color="green">242</FONT>                // set initial derivatives with respect to parameters<a name="line.242"></a>
+<FONT color="green">243</FONT>                System.arraycopy(dY0dP[i], 0, z, n * (n + 1) + i * k, k);<a name="line.243"></a>
+<FONT color="green">244</FONT>    <a name="line.244"></a>
+<FONT color="green">245</FONT>            }<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>            // integrate the compound state variational equations<a name="line.247"></a>
+<FONT color="green">248</FONT>            evaluations = 0;<a name="line.248"></a>
+<FONT color="green">249</FONT>            final double stopTime = integrator.integrate(new MappingWrapper(), t0, z, t, z);<a name="line.249"></a>
+<FONT color="green">250</FONT>    <a name="line.250"></a>
+<FONT color="green">251</FONT>            // dispatch the final compound state into the state and partial derivatives arrays<a name="line.251"></a>
+<FONT color="green">252</FONT>            dispatchCompoundState(z, y, dYdY0, dYdP);<a name="line.252"></a>
+<FONT color="green">253</FONT>    <a name="line.253"></a>
+<FONT color="green">254</FONT>            return stopTime;<a name="line.254"></a>
+<FONT color="green">255</FONT>    <a name="line.255"></a>
+<FONT color="green">256</FONT>        }<a name="line.256"></a>
+<FONT color="green">257</FONT>    <a name="line.257"></a>
+<FONT color="green">258</FONT>        /** Dispatch a compound state array into state and jacobians arrays.<a name="line.258"></a>
+<FONT color="green">259</FONT>         * @param z compound state<a name="line.259"></a>
+<FONT color="green">260</FONT>         * @param y raw state array to fill<a name="line.260"></a>
+<FONT color="green">261</FONT>         * @param dydy0 jacobian array to fill<a name="line.261"></a>
+<FONT color="green">262</FONT>         * @param dydp jacobian array to fill<a name="line.262"></a>
+<FONT color="green">263</FONT>         */<a name="line.263"></a>
+<FONT color="green">264</FONT>        private static void dispatchCompoundState(final double[] z, final double[] y,<a name="line.264"></a>
+<FONT color="green">265</FONT>                                                  final double[][] dydy0, final double[][] dydp) {<a name="line.265"></a>
+<FONT color="green">266</FONT>    <a name="line.266"></a>
+<FONT color="green">267</FONT>            final int n = y.length;<a name="line.267"></a>
+<FONT color="green">268</FONT>            final int k = dydp[0].length;<a name="line.268"></a>
+<FONT color="green">269</FONT>    <a name="line.269"></a>
+<FONT color="green">270</FONT>            // state<a name="line.270"></a>
+<FONT color="green">271</FONT>            System.arraycopy(z, 0, y, 0, n);<a name="line.271"></a>
+<FONT color="green">272</FONT>    <a name="line.272"></a>
+<FONT color="green">273</FONT>            // jacobian with respect to initial state<a name="line.273"></a>
+<FONT color="green">274</FONT>            for (int i = 0; i &lt; n; ++i) {<a name="line.274"></a>
+<FONT color="green">275</FONT>                System.arraycopy(z, n * (i + 1), dydy0[i], 0, n);<a name="line.275"></a>
+<FONT color="green">276</FONT>            }<a name="line.276"></a>
+<FONT color="green">277</FONT>    <a name="line.277"></a>
+<FONT color="green">278</FONT>            // jacobian with respect to parameters<a name="line.278"></a>
+<FONT color="green">279</FONT>            for (int i = 0; i &lt; n; ++i) {<a name="line.279"></a>
+<FONT color="green">280</FONT>                System.arraycopy(z, n * (n + 1) + i * k, dydp[i], 0, k);<a name="line.280"></a>
+<FONT color="green">281</FONT>            }<a name="line.281"></a>
+<FONT color="green">282</FONT>    <a name="line.282"></a>
+<FONT color="green">283</FONT>        }<a name="line.283"></a>
+<FONT color="green">284</FONT>    <a name="line.284"></a>
+<FONT color="green">285</FONT>        /** Get the current value of the step start time t&lt;sub&gt;i&lt;/sub&gt;.<a name="line.285"></a>
+<FONT color="green">286</FONT>         * &lt;p&gt;This method can be called during integration (typically by<a name="line.286"></a>
+<FONT color="green">287</FONT>         * the object implementing the {@link FirstOrderDifferentialEquations<a name="line.287"></a>
+<FONT color="green">288</FONT>         * differential equations} problem) if the value of the current step that<a name="line.288"></a>
+<FONT color="green">289</FONT>         * is attempted is needed.&lt;/p&gt;<a name="line.289"></a>
+<FONT color="green">290</FONT>         * &lt;p&gt;The result is undefined if the method is called outside of<a name="line.290"></a>
+<FONT color="green">291</FONT>         * calls to &lt;code&gt;integrate&lt;/code&gt;.&lt;/p&gt;<a name="line.291"></a>
+<FONT color="green">292</FONT>         * @return current value of the step start time t&lt;sub&gt;i&lt;/sub&gt;<a name="line.292"></a>
+<FONT color="green">293</FONT>         */<a name="line.293"></a>
+<FONT color="green">294</FONT>        public double getCurrentStepStart() {<a name="line.294"></a>
+<FONT color="green">295</FONT>            return integrator.getCurrentStepStart();<a name="line.295"></a>
+<FONT color="green">296</FONT>        }<a name="line.296"></a>
+<FONT color="green">297</FONT>    <a name="line.297"></a>
+<FONT color="green">298</FONT>        /** Get the current signed value of the integration stepsize.<a name="line.298"></a>
+<FONT color="green">299</FONT>         * &lt;p&gt;This method can be called during integration (typically by<a name="line.299"></a>
+<FONT color="green">300</FONT>         * the object implementing the {@link FirstOrderDifferentialEquations<a name="line.300"></a>
+<FONT color="green">301</FONT>         * differential equations} problem) if the signed value of the current stepsize<a name="line.301"></a>
+<FONT color="green">302</FONT>         * that is tried is needed.&lt;/p&gt;<a name="line.302"></a>
+<FONT color="green">303</FONT>         * &lt;p&gt;The result is undefined if the method is called outside of<a name="line.303"></a>
+<FONT color="green">304</FONT>         * calls to &lt;code&gt;integrate&lt;/code&gt;.&lt;/p&gt;<a name="line.304"></a>
+<FONT color="green">305</FONT>         * @return current signed value of the stepsize<a name="line.305"></a>
+<FONT color="green">306</FONT>         */<a name="line.306"></a>
+<FONT color="green">307</FONT>        public double getCurrentSignedStepsize() {<a name="line.307"></a>
+<FONT color="green">308</FONT>            return integrator.getCurrentSignedStepsize();<a name="line.308"></a>
+<FONT color="green">309</FONT>        }<a name="line.309"></a>
+<FONT color="green">310</FONT>    <a name="line.310"></a>
+<FONT color="green">311</FONT>        /** Set the maximal number of differential equations function evaluations.<a name="line.311"></a>
+<FONT color="green">312</FONT>         * &lt;p&gt;The purpose of this method is to avoid infinite loops which can occur<a name="line.312"></a>
+<FONT color="green">313</FONT>         * for example when stringent error constraints are set or when lots of<a name="line.313"></a>
+<FONT color="green">314</FONT>         * discrete events are triggered, thus leading to many rejected steps.&lt;/p&gt;<a name="line.314"></a>
+<FONT color="green">315</FONT>         * @param maxEvaluations maximal number of function evaluations (negative<a name="line.315"></a>
+<FONT color="green">316</FONT>         * values are silently converted to maximal integer value, thus representing<a name="line.316"></a>
+<FONT color="green">317</FONT>         * almost unlimited evaluations)<a name="line.317"></a>
+<FONT color="green">318</FONT>         */<a name="line.318"></a>
+<FONT color="green">319</FONT>        public void setMaxEvaluations(int maxEvaluations) {<a name="line.319"></a>
+<FONT color="green">320</FONT>            this.maxEvaluations = (maxEvaluations &lt; 0) ? Integer.MAX_VALUE : maxEvaluations;<a name="line.320"></a>
+<FONT color="green">321</FONT>        }<a name="line.321"></a>
+<FONT color="green">322</FONT>    <a name="line.322"></a>
+<FONT color="green">323</FONT>        /** Get the maximal number of functions evaluations.<a name="line.323"></a>
+<FONT color="green">324</FONT>         * @return maximal number of functions evaluations<a name="line.324"></a>
+<FONT color="green">325</FONT>         */<a name="line.325"></a>
+<FONT color="green">326</FONT>        public int getMaxEvaluations() {<a name="line.326"></a>
+<FONT color="green">327</FONT>            return maxEvaluations;<a name="line.327"></a>
+<FONT color="green">328</FONT>        }<a name="line.328"></a>
+<FONT color="green">329</FONT>    <a name="line.329"></a>
+<FONT color="green">330</FONT>        /** Get the number of evaluations of the differential equations function.<a name="line.330"></a>
+<FONT color="green">331</FONT>         * &lt;p&gt;<a name="line.331"></a>
+<FONT color="green">332</FONT>         * The number of evaluations corresponds to the last call to the<a name="line.332"></a>
+<FONT color="green">333</FONT>         * &lt;code&gt;integrate&lt;/code&gt; method. It is 0 if the method has not been called yet.<a name="line.333"></a>
+<FONT color="green">334</FONT>         * &lt;/p&gt;<a name="line.334"></a>
+<FONT color="green">335</FONT>         * @return number of evaluations of the differential equations function<a name="line.335"></a>
+<FONT color="green">336</FONT>         */<a name="line.336"></a>
+<FONT color="green">337</FONT>        public int getEvaluations() {<a name="line.337"></a>
+<FONT color="green">338</FONT>            return evaluations;<a name="line.338"></a>
+<FONT color="green">339</FONT>        }<a name="line.339"></a>
+<FONT color="green">340</FONT>    <a name="line.340"></a>
+<FONT color="green">341</FONT>        /** Check array dimensions.<a name="line.341"></a>
+<FONT color="green">342</FONT>         * @param expected expected dimension<a name="line.342"></a>
+<FONT color="green">343</FONT>         * @param array (may be null if expected is 0)<a name="line.343"></a>
+<FONT color="green">344</FONT>         * @throws IllegalArgumentException if the array dimension does not match the expected one<a name="line.344"></a>
+<FONT color="green">345</FONT>         */<a name="line.345"></a>
+<FONT color="green">346</FONT>        private void checkDimension(final int expected, final Object array)<a name="line.346"></a>
+<FONT color="green">347</FONT>            throws IllegalArgumentException {<a name="line.347"></a>
+<FONT color="green">348</FONT>            int arrayDimension = (array == null) ? 0 : Array.getLength(array);<a name="line.348"></a>
+<FONT color="green">349</FONT>            if (arrayDimension != expected) {<a name="line.349"></a>
+<FONT color="green">350</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.350"></a>
+<FONT color="green">351</FONT>                      "dimension mismatch {0} != {1}", arrayDimension, expected);<a name="line.351"></a>
+<FONT color="green">352</FONT>            }<a name="line.352"></a>
+<FONT color="green">353</FONT>        }<a name="line.353"></a>
+<FONT color="green">354</FONT>    <a name="line.354"></a>
+<FONT color="green">355</FONT>        /** Wrapper class used to map state and jacobians into compound state. */<a name="line.355"></a>
+<FONT color="green">356</FONT>        private class MappingWrapper implements  FirstOrderDifferentialEquations {<a name="line.356"></a>
+<FONT color="green">357</FONT>    <a name="line.357"></a>
+<FONT color="green">358</FONT>            /** Current state. */<a name="line.358"></a>
+<FONT color="green">359</FONT>            private final double[]   y;<a name="line.359"></a>
+<FONT color="green">360</FONT>    <a name="line.360"></a>
+<FONT color="green">361</FONT>            /** Time derivative of the current state. */<a name="line.361"></a>
+<FONT color="green">362</FONT>            private final double[]   yDot;<a name="line.362"></a>
+<FONT color="green">363</FONT>    <a name="line.363"></a>
+<FONT color="green">364</FONT>            /** Derivatives of yDot with respect to state. */<a name="line.364"></a>
+<FONT color="green">365</FONT>            private final double[][] dFdY;<a name="line.365"></a>
+<FONT color="green">366</FONT>    <a name="line.366"></a>
+<FONT color="green">367</FONT>            /** Derivatives of yDot with respect to parameters. */<a name="line.367"></a>
+<FONT color="green">368</FONT>            private final double[][] dFdP;<a name="line.368"></a>
+<FONT color="green">369</FONT>    <a name="line.369"></a>
+<FONT color="green">370</FONT>            /** Simple constructor.<a name="line.370"></a>
+<FONT color="green">371</FONT>             */<a name="line.371"></a>
+<FONT color="green">372</FONT>            public MappingWrapper() {<a name="line.372"></a>
+<FONT color="green">373</FONT>    <a name="line.373"></a>
+<FONT color="green">374</FONT>                final int n = ode.getDimension();<a name="line.374"></a>
+<FONT color="green">375</FONT>                final int k = ode.getParametersDimension();<a name="line.375"></a>
+<FONT color="green">376</FONT>                y    = new double[n];<a name="line.376"></a>
+<FONT color="green">377</FONT>                yDot = new double[n];<a name="line.377"></a>
+<FONT color="green">378</FONT>                dFdY = new double[n][n];<a name="line.378"></a>
+<FONT color="green">379</FONT>                dFdP = new double[n][k];<a name="line.379"></a>
+<FONT color="green">380</FONT>    <a name="line.380"></a>
+<FONT color="green">381</FONT>            }<a name="line.381"></a>
+<FONT color="green">382</FONT>    <a name="line.382"></a>
+<FONT color="green">383</FONT>            /** {@inheritDoc} */<a name="line.383"></a>
+<FONT color="green">384</FONT>            public int getDimension() {<a name="line.384"></a>
+<FONT color="green">385</FONT>                final int n = y.length;<a name="line.385"></a>
+<FONT color="green">386</FONT>                final int k = dFdP[0].length;<a name="line.386"></a>
+<FONT color="green">387</FONT>                return n * (1 + n + k);<a name="line.387"></a>
+<FONT color="green">388</FONT>            }<a name="line.388"></a>
+<FONT color="green">389</FONT>    <a name="line.389"></a>
+<FONT color="green">390</FONT>            /** {@inheritDoc} */<a name="line.390"></a>
+<FONT color="green">391</FONT>            public void computeDerivatives(final double t, final double[] z, final double[] zDot)<a name="line.391"></a>
+<FONT color="green">392</FONT>                throws DerivativeException {<a name="line.392"></a>
+<FONT color="green">393</FONT>    <a name="line.393"></a>
+<FONT color="green">394</FONT>                final int n = y.length;<a name="line.394"></a>
+<FONT color="green">395</FONT>                final int k = dFdP[0].length;<a name="line.395"></a>
+<FONT color="green">396</FONT>    <a name="line.396"></a>
+<FONT color="green">397</FONT>                // compute raw ODE and its jacobians: dy/dt, d[dy/dt]/dy0 and d[dy/dt]/dp<a name="line.397"></a>
+<FONT color="green">398</FONT>                System.arraycopy(z,    0, y,    0, n);<a name="line.398"></a>
+<FONT color="green">399</FONT>                if (++evaluations &gt; maxEvaluations) {<a name="line.399"></a>
+<FONT color="green">400</FONT>                    throw new DerivativeException(new MaxEvaluationsExceededException(maxEvaluations));<a name="line.400"></a>
+<FONT color="green">401</FONT>                }<a name="line.401"></a>
+<FONT color="green">402</FONT>                ode.computeDerivatives(t, y, yDot);<a name="line.402"></a>
+<FONT color="green">403</FONT>                ode.computeJacobians(t, y, yDot, dFdY, dFdP);<a name="line.403"></a>
+<FONT color="green">404</FONT>    <a name="line.404"></a>
+<FONT color="green">405</FONT>                // state part of the compound equations<a name="line.405"></a>
+<FONT color="green">406</FONT>                System.arraycopy(yDot, 0, zDot, 0, n);<a name="line.406"></a>
+<FONT color="green">407</FONT>    <a name="line.407"></a>
+<FONT color="green">408</FONT>                // variational equations: from d[dy/dt]/dy0 to d[dy/dy0]/dt<a name="line.408"></a>
+<FONT color="green">409</FONT>                for (int i = 0; i &lt; n; ++i) {<a name="line.409"></a>
+<FONT color="green">410</FONT>                    final double[] dFdYi = dFdY[i];<a name="line.410"></a>
+<FONT color="green">411</FONT>                    for (int j = 0; j &lt; n; ++j) {<a name="line.411"></a>
+<FONT color="green">412</FONT>                        double s = 0;<a name="line.412"></a>
+<FONT color="green">413</FONT>                        final int startIndex = n + j;<a name="line.413"></a>
+<FONT color="green">414</FONT>                        int zIndex = startIndex;<a name="line.414"></a>
+<FONT color="green">415</FONT>                        for (int l = 0; l &lt; n; ++l) {<a name="line.415"></a>
+<FONT color="green">416</FONT>                            s += dFdYi[l] * z[zIndex];<a name="line.416"></a>
+<FONT color="green">417</FONT>                            zIndex += n;<a name="line.417"></a>
+<FONT color="green">418</FONT>                        }<a name="line.418"></a>
+<FONT color="green">419</FONT>                        zDot[startIndex + i * n] = s;<a name="line.419"></a>
+<FONT color="green">420</FONT>                    }<a name="line.420"></a>
+<FONT color="green">421</FONT>                }<a name="line.421"></a>
+<FONT color="green">422</FONT>    <a name="line.422"></a>
+<FONT color="green">423</FONT>                // variational equations: from d[dy/dt]/dy0 and d[dy/dt]/dp to d[dy/dp]/dt<a name="line.423"></a>
+<FONT color="green">424</FONT>                for (int i = 0; i &lt; n; ++i) {<a name="line.424"></a>
+<FONT color="green">425</FONT>                    final double[] dFdYi = dFdY[i];<a name="line.425"></a>
+<FONT color="green">426</FONT>                    final double[] dFdPi = dFdP[i];<a name="line.426"></a>
+<FONT color="green">427</FONT>                    for (int j = 0; j &lt; k; ++j) {<a name="line.427"></a>
+<FONT color="green">428</FONT>                        double s = dFdPi[j];<a name="line.428"></a>
+<FONT color="green">429</FONT>                        final int startIndex = n * (n + 1) + j;<a name="line.429"></a>
+<FONT color="green">430</FONT>                        int zIndex = startIndex;<a name="line.430"></a>
+<FONT color="green">431</FONT>                        for (int l = 0; l &lt; n; ++l) {<a name="line.431"></a>
+<FONT color="green">432</FONT>                            s += dFdYi[l] * z[zIndex];<a name="line.432"></a>
+<FONT color="green">433</FONT>                            zIndex += k;<a name="line.433"></a>
+<FONT color="green">434</FONT>                        }<a name="line.434"></a>
+<FONT color="green">435</FONT>                        zDot[startIndex + i * k] = s;<a name="line.435"></a>
+<FONT color="green">436</FONT>                    }<a name="line.436"></a>
+<FONT color="green">437</FONT>                }<a name="line.437"></a>
+<FONT color="green">438</FONT>    <a name="line.438"></a>
+<FONT color="green">439</FONT>            }<a name="line.439"></a>
+<FONT color="green">440</FONT>    <a name="line.440"></a>
+<FONT color="green">441</FONT>        }<a name="line.441"></a>
+<FONT color="green">442</FONT>    <a name="line.442"></a>
+<FONT color="green">443</FONT>        /** Wrapper class to compute jacobians by finite differences for ODE which do not compute them themselves. */<a name="line.443"></a>
+<FONT color="green">444</FONT>        private class FiniteDifferencesWrapper<a name="line.444"></a>
+<FONT color="green">445</FONT>            implements ODEWithJacobians {<a name="line.445"></a>
+<FONT color="green">446</FONT>    <a name="line.446"></a>
+<FONT color="green">447</FONT>            /** Raw ODE without jacobians computation. */<a name="line.447"></a>
+<FONT color="green">448</FONT>            private final ParameterizedODE ode;<a name="line.448"></a>
+<FONT color="green">449</FONT>    <a name="line.449"></a>
+<FONT color="green">450</FONT>            /** Parameters array (may be null if parameters dimension from original problem is zero) */<a name="line.450"></a>
+<FONT color="green">451</FONT>            private final double[] p;<a name="line.451"></a>
+<FONT color="green">452</FONT>    <a name="line.452"></a>
+<FONT color="green">453</FONT>            /** Step sizes to use for computing the jacobian df/dy. */<a name="line.453"></a>
+<FONT color="green">454</FONT>            private final double[] hY;<a name="line.454"></a>
+<FONT color="green">455</FONT>    <a name="line.455"></a>
+<FONT color="green">456</FONT>            /** Step sizes to use for computing the jacobian df/dp. */<a name="line.456"></a>
+<FONT color="green">457</FONT>            private final double[] hP;<a name="line.457"></a>
+<FONT color="green">458</FONT>    <a name="line.458"></a>
+<FONT color="green">459</FONT>            /** Temporary array for state derivatives used to compute jacobians. */<a name="line.459"></a>
+<FONT color="green">460</FONT>            private final double[] tmpDot;<a name="line.460"></a>
+<FONT color="green">461</FONT>    <a name="line.461"></a>
+<FONT color="green">462</FONT>            /** Simple constructor.<a name="line.462"></a>
+<FONT color="green">463</FONT>             * @param ode original ODE problem, without jacobians computations<a name="line.463"></a>
+<FONT color="green">464</FONT>             * @param p parameters array (may be null if parameters dimension from original problem is zero)<a name="line.464"></a>
+<FONT color="green">465</FONT>             * @param hY step sizes to use for computing the jacobian df/dy<a name="line.465"></a>
+<FONT color="green">466</FONT>             * @param hP step sizes to use for computing the jacobian df/dp<a name="line.466"></a>
+<FONT color="green">467</FONT>             */<a name="line.467"></a>
+<FONT color="green">468</FONT>            public FiniteDifferencesWrapper(final ParameterizedODE ode,<a name="line.468"></a>
+<FONT color="green">469</FONT>                                            final double[] p, final double[] hY, final double[] hP) {<a name="line.469"></a>
+<FONT color="green">470</FONT>                this.ode = ode;<a name="line.470"></a>
+<FONT color="green">471</FONT>                this.p  = p.clone();<a name="line.471"></a>
+<FONT color="green">472</FONT>                this.hY = hY.clone();<a name="line.472"></a>
+<FONT color="green">473</FONT>                this.hP = hP.clone();<a name="line.473"></a>
+<FONT color="green">474</FONT>                tmpDot = new double[ode.getDimension()];<a name="line.474"></a>
+<FONT color="green">475</FONT>            }<a name="line.475"></a>
+<FONT color="green">476</FONT>    <a name="line.476"></a>
+<FONT color="green">477</FONT>            /** {@inheritDoc} */<a name="line.477"></a>
+<FONT color="green">478</FONT>            public int getDimension() {<a name="line.478"></a>
+<FONT color="green">479</FONT>                return ode.getDimension();<a name="line.479"></a>
+<FONT color="green">480</FONT>            }<a name="line.480"></a>
+<FONT color="green">481</FONT>    <a name="line.481"></a>
+<FONT color="green">482</FONT>            /** {@inheritDoc} */<a name="line.482"></a>
+<FONT color="green">483</FONT>            public void computeDerivatives(double t, double[] y, double[] yDot) throws DerivativeException {<a name="line.483"></a>
+<FONT color="green">484</FONT>                // this call to computeDerivatives has already been counted,<a name="line.484"></a>
+<FONT color="green">485</FONT>                // we must not increment the counter again<a name="line.485"></a>
+<FONT color="green">486</FONT>                ode.computeDerivatives(t, y, yDot);<a name="line.486"></a>
+<FONT color="green">487</FONT>            }<a name="line.487"></a>
+<FONT color="green">488</FONT>    <a name="line.488"></a>
+<FONT color="green">489</FONT>            /** {@inheritDoc} */<a name="line.489"></a>
+<FONT color="green">490</FONT>            public int getParametersDimension() {<a name="line.490"></a>
+<FONT color="green">491</FONT>                return ode.getParametersDimension();<a name="line.491"></a>
+<FONT color="green">492</FONT>            }<a name="line.492"></a>
+<FONT color="green">493</FONT>    <a name="line.493"></a>
+<FONT color="green">494</FONT>            /** {@inheritDoc} */<a name="line.494"></a>
+<FONT color="green">495</FONT>            public void computeJacobians(double t, double[] y, double[] yDot,<a name="line.495"></a>
+<FONT color="green">496</FONT>                                         double[][] dFdY, double[][] dFdP)<a name="line.496"></a>
+<FONT color="green">497</FONT>                throws DerivativeException {<a name="line.497"></a>
+<FONT color="green">498</FONT>    <a name="line.498"></a>
+<FONT color="green">499</FONT>                final int n = hY.length;<a name="line.499"></a>
+<FONT color="green">500</FONT>                final int k = hP.length;<a name="line.500"></a>
+<FONT color="green">501</FONT>    <a name="line.501"></a>
+<FONT color="green">502</FONT>                evaluations += n + k;<a name="line.502"></a>
+<FONT color="green">503</FONT>                if (evaluations &gt; maxEvaluations) {<a name="line.503"></a>
+<FONT color="green">504</FONT>                    throw new DerivativeException(new MaxEvaluationsExceededException(maxEvaluations));<a name="line.504"></a>
+<FONT color="green">505</FONT>                }<a name="line.505"></a>
+<FONT color="green">506</FONT>    <a name="line.506"></a>
+<FONT color="green">507</FONT>                // compute df/dy where f is the ODE and y is the state array<a name="line.507"></a>
+<FONT color="green">508</FONT>                for (int j = 0; j &lt; n; ++j) {<a name="line.508"></a>
+<FONT color="green">509</FONT>                    final double savedYj = y[j];<a name="line.509"></a>
+<FONT color="green">510</FONT>                    y[j] += hY[j];<a name="line.510"></a>
+<FONT color="green">511</FONT>                    ode.computeDerivatives(t, y, tmpDot);<a name="line.511"></a>
+<FONT color="green">512</FONT>                    for (int i = 0; i &lt; n; ++i) {<a name="line.512"></a>
+<FONT color="green">513</FONT>                        dFdY[i][j] = (tmpDot[i] - yDot[i]) / hY[j];<a name="line.513"></a>
+<FONT color="green">514</FONT>                    }<a name="line.514"></a>
+<FONT color="green">515</FONT>                    y[j] = savedYj;<a name="line.515"></a>
+<FONT color="green">516</FONT>                }<a name="line.516"></a>
+<FONT color="green">517</FONT>    <a name="line.517"></a>
+<FONT color="green">518</FONT>                // compute df/dp where f is the ODE and p is the parameters array<a name="line.518"></a>
+<FONT color="green">519</FONT>                for (int j = 0; j &lt; k; ++j) {<a name="line.519"></a>
+<FONT color="green">520</FONT>                    ode.setParameter(j, p[j] +  hP[j]);<a name="line.520"></a>
+<FONT color="green">521</FONT>                    ode.computeDerivatives(t, y, tmpDot);<a name="line.521"></a>
+<FONT color="green">522</FONT>                    for (int i = 0; i &lt; n; ++i) {<a name="line.522"></a>
+<FONT color="green">523</FONT>                        dFdP[i][j] = (tmpDot[i] - yDot[i]) / hP[j];<a name="line.523"></a>
+<FONT color="green">524</FONT>                    }<a name="line.524"></a>
+<FONT color="green">525</FONT>                    ode.setParameter(j, p[j]);<a name="line.525"></a>
+<FONT color="green">526</FONT>                }<a name="line.526"></a>
+<FONT color="green">527</FONT>    <a name="line.527"></a>
+<FONT color="green">528</FONT>            }<a name="line.528"></a>
+<FONT color="green">529</FONT>    <a name="line.529"></a>
+<FONT color="green">530</FONT>        }<a name="line.530"></a>
+<FONT color="green">531</FONT>    <a name="line.531"></a>
+<FONT color="green">532</FONT>        /** Wrapper for step handlers. */<a name="line.532"></a>
+<FONT color="green">533</FONT>        private static class StepHandlerWrapper implements StepHandler {<a name="line.533"></a>
+<FONT color="green">534</FONT>    <a name="line.534"></a>
+<FONT color="green">535</FONT>            /** Underlying step handler with jacobians. */<a name="line.535"></a>
+<FONT color="green">536</FONT>            private final StepHandlerWithJacobians handler;<a name="line.536"></a>
+<FONT color="green">537</FONT>    <a name="line.537"></a>
+<FONT color="green">538</FONT>            /** Dimension of the original ODE. */<a name="line.538"></a>
+<FONT color="green">539</FONT>            private final int n;<a name="line.539"></a>
+<FONT color="green">540</FONT>    <a name="line.540"></a>
+<FONT color="green">541</FONT>            /** Number of parameters. */<a name="line.541"></a>
+<FONT color="green">542</FONT>            private final int k;<a name="line.542"></a>
+<FONT color="green">543</FONT>    <a name="line.543"></a>
+<FONT color="green">544</FONT>            /** Simple constructor.<a name="line.544"></a>
+<FONT color="green">545</FONT>             * @param handler underlying step handler with jacobians<a name="line.545"></a>
+<FONT color="green">546</FONT>             * @param n dimension of the original ODE<a name="line.546"></a>
+<FONT color="green">547</FONT>             * @param k number of parameters<a name="line.547"></a>
+<FONT color="green">548</FONT>             */<a name="line.548"></a>
+<FONT color="green">549</FONT>            public StepHandlerWrapper(final StepHandlerWithJacobians handler,<a name="line.549"></a>
+<FONT color="green">550</FONT>                                      final int n, final int k) {<a name="line.550"></a>
+<FONT color="green">551</FONT>                this.handler = handler;<a name="line.551"></a>
+<FONT color="green">552</FONT>                this.n       = n;<a name="line.552"></a>
+<FONT color="green">553</FONT>                this.k       = k;<a name="line.553"></a>
+<FONT color="green">554</FONT>            }<a name="line.554"></a>
+<FONT color="green">555</FONT>    <a name="line.555"></a>
+<FONT color="green">556</FONT>            /** Get the underlying step handler with jacobians.<a name="line.556"></a>
+<FONT color="green">557</FONT>             * @return underlying step handler with jacobians<a name="line.557"></a>
+<FONT color="green">558</FONT>             */<a name="line.558"></a>
+<FONT color="green">559</FONT>            public StepHandlerWithJacobians getHandler() {<a name="line.559"></a>
+<FONT color="green">560</FONT>                return handler;<a name="line.560"></a>
+<FONT color="green">561</FONT>            }<a name="line.561"></a>
+<FONT color="green">562</FONT>    <a name="line.562"></a>
+<FONT color="green">563</FONT>            /** {@inheritDoc} */<a name="line.563"></a>
+<FONT color="green">564</FONT>            public void handleStep(StepInterpolator interpolator, boolean isLast)<a name="line.564"></a>
+<FONT color="green">565</FONT>                throws DerivativeException {<a name="line.565"></a>
+<FONT color="green">566</FONT>                handler.handleStep(new StepInterpolatorWrapper(interpolator, n, k), isLast);<a name="line.566"></a>
+<FONT color="green">567</FONT>            }<a name="line.567"></a>
+<FONT color="green">568</FONT>    <a name="line.568"></a>
+<FONT color="green">569</FONT>            /** {@inheritDoc} */<a name="line.569"></a>
+<FONT color="green">570</FONT>            public boolean requiresDenseOutput() {<a name="line.570"></a>
+<FONT color="green">571</FONT>                return handler.requiresDenseOutput();<a name="line.571"></a>
+<FONT color="green">572</FONT>            }<a name="line.572"></a>
+<FONT color="green">573</FONT>    <a name="line.573"></a>
+<FONT color="green">574</FONT>            /** {@inheritDoc} */<a name="line.574"></a>
+<FONT color="green">575</FONT>            public void reset() {<a name="line.575"></a>
+<FONT color="green">576</FONT>                handler.reset();<a name="line.576"></a>
+<FONT color="green">577</FONT>            }<a name="line.577"></a>
+<FONT color="green">578</FONT>    <a name="line.578"></a>
+<FONT color="green">579</FONT>        }<a name="line.579"></a>
+<FONT color="green">580</FONT>    <a name="line.580"></a>
+<FONT color="green">581</FONT>        /** Wrapper for step interpolators. */<a name="line.581"></a>
+<FONT color="green">582</FONT>        private static class StepInterpolatorWrapper<a name="line.582"></a>
+<FONT color="green">583</FONT>            implements StepInterpolatorWithJacobians {<a name="line.583"></a>
+<FONT color="green">584</FONT>    <a name="line.584"></a>
+<FONT color="green">585</FONT>            /** Wrapped interpolator. */<a name="line.585"></a>
+<FONT color="green">586</FONT>            private StepInterpolator interpolator;<a name="line.586"></a>
+<FONT color="green">587</FONT>    <a name="line.587"></a>
+<FONT color="green">588</FONT>            /** State array. */<a name="line.588"></a>
+<FONT color="green">589</FONT>            private double[] y;<a name="line.589"></a>
+<FONT color="green">590</FONT>    <a name="line.590"></a>
+<FONT color="green">591</FONT>            /** Jacobian with respect to initial state dy/dy0. */<a name="line.591"></a>
+<FONT color="green">592</FONT>            private double[][] dydy0;<a name="line.592"></a>
+<FONT color="green">593</FONT>    <a name="line.593"></a>
+<FONT color="green">594</FONT>            /** Jacobian with respect to parameters dy/dp. */<a name="line.594"></a>
+<FONT color="green">595</FONT>            private double[][] dydp;<a name="line.595"></a>
+<FONT color="green">596</FONT>    <a name="line.596"></a>
+<FONT color="green">597</FONT>            /** Time derivative of the state array. */<a name="line.597"></a>
+<FONT color="green">598</FONT>            private double[] yDot;<a name="line.598"></a>
+<FONT color="green">599</FONT>    <a name="line.599"></a>
+<FONT color="green">600</FONT>            /** Time derivative of the sacobian with respect to initial state dy/dy0. */<a name="line.600"></a>
+<FONT color="green">601</FONT>            private double[][] dydy0Dot;<a name="line.601"></a>
+<FONT color="green">602</FONT>    <a name="line.602"></a>
+<FONT color="green">603</FONT>            /** Time derivative of the jacobian with respect to parameters dy/dp. */<a name="line.603"></a>
+<FONT color="green">604</FONT>            private double[][] dydpDot;<a name="line.604"></a>
+<FONT color="green">605</FONT>    <a name="line.605"></a>
+<FONT color="green">606</FONT>            /** Simple constructor.<a name="line.606"></a>
+<FONT color="green">607</FONT>             * &lt;p&gt;This constructor is used only for externalization. It does nothing.&lt;/p&gt;<a name="line.607"></a>
+<FONT color="green">608</FONT>             */<a name="line.608"></a>
+<FONT color="green">609</FONT>            @SuppressWarnings("unused")<a name="line.609"></a>
+<FONT color="green">610</FONT>            public StepInterpolatorWrapper() {<a name="line.610"></a>
+<FONT color="green">611</FONT>            }<a name="line.611"></a>
+<FONT color="green">612</FONT>    <a name="line.612"></a>
+<FONT color="green">613</FONT>            /** Simple constructor.<a name="line.613"></a>
+<FONT color="green">614</FONT>             * @param interpolator wrapped interpolator<a name="line.614"></a>
+<FONT color="green">615</FONT>             * @param n dimension of the original ODE<a name="line.615"></a>
+<FONT color="green">616</FONT>             * @param k number of parameters<a name="line.616"></a>
+<FONT color="green">617</FONT>             */<a name="line.617"></a>
+<FONT color="green">618</FONT>            public StepInterpolatorWrapper(final StepInterpolator interpolator,<a name="line.618"></a>
+<FONT color="green">619</FONT>                                           final int n, final int k) {<a name="line.619"></a>
+<FONT color="green">620</FONT>                this.interpolator = interpolator;<a name="line.620"></a>
+<FONT color="green">621</FONT>                y        = new double[n];<a name="line.621"></a>
+<FONT color="green">622</FONT>                dydy0    = new double[n][n];<a name="line.622"></a>
+<FONT color="green">623</FONT>                dydp     = new double[n][k];<a name="line.623"></a>
+<FONT color="green">624</FONT>                yDot     = new double[n];<a name="line.624"></a>
+<FONT color="green">625</FONT>                dydy0Dot = new double[n][n];<a name="line.625"></a>
+<FONT color="green">626</FONT>                dydpDot  = new double[n][k];<a name="line.626"></a>
+<FONT color="green">627</FONT>            }<a name="line.627"></a>
+<FONT color="green">628</FONT>    <a name="line.628"></a>
+<FONT color="green">629</FONT>            /** {@inheritDoc} */<a name="line.629"></a>
+<FONT color="green">630</FONT>            public void setInterpolatedTime(double time) {<a name="line.630"></a>
+<FONT color="green">631</FONT>                interpolator.setInterpolatedTime(time);<a name="line.631"></a>
+<FONT color="green">632</FONT>            }<a name="line.632"></a>
+<FONT color="green">633</FONT>    <a name="line.633"></a>
+<FONT color="green">634</FONT>            /** {@inheritDoc} */<a name="line.634"></a>
+<FONT color="green">635</FONT>            public boolean isForward() {<a name="line.635"></a>
+<FONT color="green">636</FONT>                return interpolator.isForward();<a name="line.636"></a>
+<FONT color="green">637</FONT>            }<a name="line.637"></a>
+<FONT color="green">638</FONT>    <a name="line.638"></a>
+<FONT color="green">639</FONT>            /** {@inheritDoc} */<a name="line.639"></a>
+<FONT color="green">640</FONT>            public double getPreviousTime() {<a name="line.640"></a>
+<FONT color="green">641</FONT>                return interpolator.getPreviousTime();<a name="line.641"></a>
+<FONT color="green">642</FONT>            }<a name="line.642"></a>
+<FONT color="green">643</FONT>    <a name="line.643"></a>
+<FONT color="green">644</FONT>            /** {@inheritDoc} */<a name="line.644"></a>
+<FONT color="green">645</FONT>            public double getInterpolatedTime() {<a name="line.645"></a>
+<FONT color="green">646</FONT>                return interpolator.getInterpolatedTime();<a name="line.646"></a>
+<FONT color="green">647</FONT>            }<a name="line.647"></a>
+<FONT color="green">648</FONT>    <a name="line.648"></a>
+<FONT color="green">649</FONT>            /** {@inheritDoc} */<a name="line.649"></a>
+<FONT color="green">650</FONT>            public double[] getInterpolatedY() throws DerivativeException {<a name="line.650"></a>
+<FONT color="green">651</FONT>                double[] extendedState = interpolator.getInterpolatedState();<a name="line.651"></a>
+<FONT color="green">652</FONT>                System.arraycopy(extendedState, 0, y, 0, y.length);<a name="line.652"></a>
+<FONT color="green">653</FONT>                return y;<a name="line.653"></a>
+<FONT color="green">654</FONT>            }<a name="line.654"></a>
+<FONT color="green">655</FONT>    <a name="line.655"></a>
+<FONT color="green">656</FONT>            /** {@inheritDoc} */<a name="line.656"></a>
+<FONT color="green">657</FONT>            public double[][] getInterpolatedDyDy0() throws DerivativeException {<a name="line.657"></a>
+<FONT color="green">658</FONT>                double[] extendedState = interpolator.getInterpolatedState();<a name="line.658"></a>
+<FONT color="green">659</FONT>                final int n = y.length;<a name="line.659"></a>
+<FONT color="green">660</FONT>                int start = n;<a name="line.660"></a>
+<FONT color="green">661</FONT>                for (int i = 0; i &lt; n; ++i) {<a name="line.661"></a>
+<FONT color="green">662</FONT>                    System.arraycopy(extendedState, start, dydy0[i], 0, n);<a name="line.662"></a>
+<FONT color="green">663</FONT>                    start += n;<a name="line.663"></a>
+<FONT color="green">664</FONT>                }<a name="line.664"></a>
+<FONT color="green">665</FONT>                return dydy0;<a name="line.665"></a>
+<FONT color="green">666</FONT>            }<a name="line.666"></a>
+<FONT color="green">667</FONT>    <a name="line.667"></a>
+<FONT color="green">668</FONT>            /** {@inheritDoc} */<a name="line.668"></a>
+<FONT color="green">669</FONT>            public double[][] getInterpolatedDyDp() throws DerivativeException {<a name="line.669"></a>
+<FONT color="green">670</FONT>                double[] extendedState = interpolator.getInterpolatedState();<a name="line.670"></a>
+<FONT color="green">671</FONT>                final int n = y.length;<a name="line.671"></a>
+<FONT color="green">672</FONT>                final int k = dydp[0].length;<a name="line.672"></a>
+<FONT color="green">673</FONT>                int start = n * (n + 1);<a name="line.673"></a>
+<FONT color="green">674</FONT>                for (int i = 0; i &lt; n; ++i) {<a name="line.674"></a>
+<FONT color="green">675</FONT>                    System.arraycopy(extendedState, start, dydp[i], 0, k);<a name="line.675"></a>
+<FONT color="green">676</FONT>                    start += k;<a name="line.676"></a>
+<FONT color="green">677</FONT>                }<a name="line.677"></a>
+<FONT color="green">678</FONT>                return dydp;<a name="line.678"></a>
+<FONT color="green">679</FONT>            }<a name="line.679"></a>
+<FONT color="green">680</FONT>    <a name="line.680"></a>
+<FONT color="green">681</FONT>            /** {@inheritDoc} */<a name="line.681"></a>
+<FONT color="green">682</FONT>            public double[] getInterpolatedYDot() throws DerivativeException {<a name="line.682"></a>
+<FONT color="green">683</FONT>                double[] extendedDerivatives = interpolator.getInterpolatedDerivatives();<a name="line.683"></a>
+<FONT color="green">684</FONT>                System.arraycopy(extendedDerivatives, 0, yDot, 0, yDot.length);<a name="line.684"></a>
+<FONT color="green">685</FONT>                return yDot;<a name="line.685"></a>
+<FONT color="green">686</FONT>            }<a name="line.686"></a>
+<FONT color="green">687</FONT>    <a name="line.687"></a>
+<FONT color="green">688</FONT>            /** {@inheritDoc} */<a name="line.688"></a>
+<FONT color="green">689</FONT>            public double[][] getInterpolatedDyDy0Dot() throws DerivativeException {<a name="line.689"></a>
+<FONT color="green">690</FONT>                double[] extendedDerivatives = interpolator.getInterpolatedDerivatives();<a name="line.690"></a>
+<FONT color="green">691</FONT>                final int n = y.length;<a name="line.691"></a>
+<FONT color="green">692</FONT>                int start = n;<a name="line.692"></a>
+<FONT color="green">693</FONT>                for (int i = 0; i &lt; n; ++i) {<a name="line.693"></a>
+<FONT color="green">694</FONT>                    System.arraycopy(extendedDerivatives, start, dydy0Dot[i], 0, n);<a name="line.694"></a>
+<FONT color="green">695</FONT>                    start += n;<a name="line.695"></a>
+<FONT color="green">696</FONT>                }<a name="line.696"></a>
+<FONT color="green">697</FONT>                return dydy0Dot;<a name="line.697"></a>
+<FONT color="green">698</FONT>            }<a name="line.698"></a>
+<FONT color="green">699</FONT>    <a name="line.699"></a>
+<FONT color="green">700</FONT>            /** {@inheritDoc} */<a name="line.700"></a>
+<FONT color="green">701</FONT>            public double[][] getInterpolatedDyDpDot() throws DerivativeException {<a name="line.701"></a>
+<FONT color="green">702</FONT>                double[] extendedDerivatives = interpolator.getInterpolatedDerivatives();<a name="line.702"></a>
+<FONT color="green">703</FONT>                final int n = y.length;<a name="line.703"></a>
+<FONT color="green">704</FONT>                final int k = dydpDot[0].length;<a name="line.704"></a>
+<FONT color="green">705</FONT>                int start = n * (n + 1);<a name="line.705"></a>
+<FONT color="green">706</FONT>                for (int i = 0; i &lt; n; ++i) {<a name="line.706"></a>
+<FONT color="green">707</FONT>                    System.arraycopy(extendedDerivatives, start, dydpDot[i], 0, k);<a name="line.707"></a>
+<FONT color="green">708</FONT>                    start += k;<a name="line.708"></a>
+<FONT color="green">709</FONT>                }<a name="line.709"></a>
+<FONT color="green">710</FONT>                return dydpDot;<a name="line.710"></a>
+<FONT color="green">711</FONT>            }<a name="line.711"></a>
+<FONT color="green">712</FONT>    <a name="line.712"></a>
+<FONT color="green">713</FONT>            /** {@inheritDoc} */<a name="line.713"></a>
+<FONT color="green">714</FONT>            public double getCurrentTime() {<a name="line.714"></a>
+<FONT color="green">715</FONT>                return interpolator.getCurrentTime();<a name="line.715"></a>
+<FONT color="green">716</FONT>            }<a name="line.716"></a>
+<FONT color="green">717</FONT>    <a name="line.717"></a>
+<FONT color="green">718</FONT>            /** {@inheritDoc} */<a name="line.718"></a>
+<FONT color="green">719</FONT>            public StepInterpolatorWithJacobians copy() throws DerivativeException {<a name="line.719"></a>
+<FONT color="green">720</FONT>                final int n = y.length;<a name="line.720"></a>
+<FONT color="green">721</FONT>                final int k = dydp[0].length;<a name="line.721"></a>
+<FONT color="green">722</FONT>                StepInterpolatorWrapper copied =<a name="line.722"></a>
+<FONT color="green">723</FONT>                    new StepInterpolatorWrapper(interpolator.copy(), n, k);<a name="line.723"></a>
+<FONT color="green">724</FONT>                copyArray(y,        copied.y);<a name="line.724"></a>
+<FONT color="green">725</FONT>                copyArray(dydy0,    copied.dydy0);<a name="line.725"></a>
+<FONT color="green">726</FONT>                copyArray(dydp,     copied.dydp);<a name="line.726"></a>
+<FONT color="green">727</FONT>                copyArray(yDot,     copied.yDot);<a name="line.727"></a>
+<FONT color="green">728</FONT>                copyArray(dydy0Dot, copied.dydy0Dot);<a name="line.728"></a>
+<FONT color="green">729</FONT>                copyArray(dydpDot,  copied.dydpDot);<a name="line.729"></a>
+<FONT color="green">730</FONT>                return copied;<a name="line.730"></a>
+<FONT color="green">731</FONT>            }<a name="line.731"></a>
+<FONT color="green">732</FONT>    <a name="line.732"></a>
+<FONT color="green">733</FONT>            /** {@inheritDoc} */<a name="line.733"></a>
+<FONT color="green">734</FONT>            public void writeExternal(ObjectOutput out) throws IOException {<a name="line.734"></a>
+<FONT color="green">735</FONT>                out.writeObject(interpolator);<a name="line.735"></a>
+<FONT color="green">736</FONT>                out.writeInt(y.length);<a name="line.736"></a>
+<FONT color="green">737</FONT>                out.writeInt(dydp[0].length);<a name="line.737"></a>
+<FONT color="green">738</FONT>                writeArray(out, y);<a name="line.738"></a>
+<FONT color="green">739</FONT>                writeArray(out, dydy0);<a name="line.739"></a>
+<FONT color="green">740</FONT>                writeArray(out, dydp);<a name="line.740"></a>
+<FONT color="green">741</FONT>                writeArray(out, yDot);<a name="line.741"></a>
+<FONT color="green">742</FONT>                writeArray(out, dydy0Dot);<a name="line.742"></a>
+<FONT color="green">743</FONT>                writeArray(out, dydpDot);<a name="line.743"></a>
+<FONT color="green">744</FONT>            }<a name="line.744"></a>
+<FONT color="green">745</FONT>    <a name="line.745"></a>
+<FONT color="green">746</FONT>            /** {@inheritDoc} */<a name="line.746"></a>
+<FONT color="green">747</FONT>            public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {<a name="line.747"></a>
+<FONT color="green">748</FONT>                interpolator = (StepInterpolator) in.readObject();<a name="line.748"></a>
+<FONT color="green">749</FONT>                final int n = in.readInt();<a name="line.749"></a>
+<FONT color="green">750</FONT>                final int k = in.readInt();<a name="line.750"></a>
+<FONT color="green">751</FONT>                y        = new double[n];<a name="line.751"></a>
+<FONT color="green">752</FONT>                dydy0    = new double[n][n];<a name="line.752"></a>
+<FONT color="green">753</FONT>                dydp     = new double[n][k];<a name="line.753"></a>
+<FONT color="green">754</FONT>                yDot     = new double[n];<a name="line.754"></a>
+<FONT color="green">755</FONT>                dydy0Dot = new double[n][n];<a name="line.755"></a>
+<FONT color="green">756</FONT>                dydpDot  = new double[n][k];<a name="line.756"></a>
+<FONT color="green">757</FONT>                readArray(in, y);<a name="line.757"></a>
+<FONT color="green">758</FONT>                readArray(in, dydy0);<a name="line.758"></a>
+<FONT color="green">759</FONT>                readArray(in, dydp);<a name="line.759"></a>
+<FONT color="green">760</FONT>                readArray(in, yDot);<a name="line.760"></a>
+<FONT color="green">761</FONT>                readArray(in, dydy0Dot);<a name="line.761"></a>
+<FONT color="green">762</FONT>                readArray(in, dydpDot);<a name="line.762"></a>
+<FONT color="green">763</FONT>            }<a name="line.763"></a>
+<FONT color="green">764</FONT>    <a name="line.764"></a>
+<FONT color="green">765</FONT>            /** Copy an array.<a name="line.765"></a>
+<FONT color="green">766</FONT>             * @param src source array<a name="line.766"></a>
+<FONT color="green">767</FONT>             * @param dest destination array<a name="line.767"></a>
+<FONT color="green">768</FONT>             */<a name="line.768"></a>
+<FONT color="green">769</FONT>            private static void copyArray(final double[] src, final double[] dest) {<a name="line.769"></a>
+<FONT color="green">770</FONT>                System.arraycopy(src, 0, dest, 0, src.length);<a name="line.770"></a>
+<FONT color="green">771</FONT>            }<a name="line.771"></a>
+<FONT color="green">772</FONT>    <a name="line.772"></a>
+<FONT color="green">773</FONT>            /** Copy an array.<a name="line.773"></a>
+<FONT color="green">774</FONT>             * @param src source array<a name="line.774"></a>
+<FONT color="green">775</FONT>             * @param dest destination array<a name="line.775"></a>
+<FONT color="green">776</FONT>             */<a name="line.776"></a>
+<FONT color="green">777</FONT>            private static void copyArray(final double[][] src, final double[][] dest) {<a name="line.777"></a>
+<FONT color="green">778</FONT>                for (int i = 0; i &lt; src.length; ++i) {<a name="line.778"></a>
+<FONT color="green">779</FONT>                    copyArray(src[i], dest[i]);<a name="line.779"></a>
+<FONT color="green">780</FONT>                }<a name="line.780"></a>
+<FONT color="green">781</FONT>            }<a name="line.781"></a>
+<FONT color="green">782</FONT>    <a name="line.782"></a>
+<FONT color="green">783</FONT>            /** Write an array.<a name="line.783"></a>
+<FONT color="green">784</FONT>             * @param out output stream<a name="line.784"></a>
+<FONT color="green">785</FONT>             * @param array array to write<a name="line.785"></a>
+<FONT color="green">786</FONT>             * @exception IOException if array cannot be read<a name="line.786"></a>
+<FONT color="green">787</FONT>             */<a name="line.787"></a>
+<FONT color="green">788</FONT>            private static void writeArray(final ObjectOutput out, final double[] array)<a name="line.788"></a>
+<FONT color="green">789</FONT>                throws IOException {<a name="line.789"></a>
+<FONT color="green">790</FONT>                for (int i = 0; i &lt; array.length; ++i) {<a name="line.790"></a>
+<FONT color="green">791</FONT>                    out.writeDouble(array[i]);<a name="line.791"></a>
+<FONT color="green">792</FONT>                }<a name="line.792"></a>
+<FONT color="green">793</FONT>            }<a name="line.793"></a>
+<FONT color="green">794</FONT>    <a name="line.794"></a>
+<FONT color="green">795</FONT>            /** Write an array.<a name="line.795"></a>
+<FONT color="green">796</FONT>             * @param out output stream<a name="line.796"></a>
+<FONT color="green">797</FONT>             * @param array array to write<a name="line.797"></a>
+<FONT color="green">798</FONT>             * @exception IOException if array cannot be read<a name="line.798"></a>
+<FONT color="green">799</FONT>             */<a name="line.799"></a>
+<FONT color="green">800</FONT>            private static void writeArray(final ObjectOutput out, final double[][] array)<a name="line.800"></a>
+<FONT color="green">801</FONT>                throws IOException {<a name="line.801"></a>
+<FONT color="green">802</FONT>                for (int i = 0; i &lt; array.length; ++i) {<a name="line.802"></a>
+<FONT color="green">803</FONT>                    writeArray(out, array[i]);<a name="line.803"></a>
+<FONT color="green">804</FONT>                }<a name="line.804"></a>
+<FONT color="green">805</FONT>            }<a name="line.805"></a>
+<FONT color="green">806</FONT>    <a name="line.806"></a>
+<FONT color="green">807</FONT>            /** Read an array.<a name="line.807"></a>
+<FONT color="green">808</FONT>             * @param in input stream<a name="line.808"></a>
+<FONT color="green">809</FONT>             * @param array array to read<a name="line.809"></a>
+<FONT color="green">810</FONT>             * @exception IOException if array cannot be read<a name="line.810"></a>
+<FONT color="green">811</FONT>             */<a name="line.811"></a>
+<FONT color="green">812</FONT>            private static void readArray(final ObjectInput in, final double[] array)<a name="line.812"></a>
+<FONT color="green">813</FONT>                throws IOException {<a name="line.813"></a>
+<FONT color="green">814</FONT>                for (int i = 0; i &lt; array.length; ++i) {<a name="line.814"></a>
+<FONT color="green">815</FONT>                    array[i] = in.readDouble();<a name="line.815"></a>
+<FONT color="green">816</FONT>                }<a name="line.816"></a>
+<FONT color="green">817</FONT>            }<a name="line.817"></a>
+<FONT color="green">818</FONT>    <a name="line.818"></a>
+<FONT color="green">819</FONT>            /** Read an array.<a name="line.819"></a>
+<FONT color="green">820</FONT>             * @param in input stream<a name="line.820"></a>
+<FONT color="green">821</FONT>             * @param array array to read<a name="line.821"></a>
+<FONT color="green">822</FONT>             * @exception IOException if array cannot be read<a name="line.822"></a>
+<FONT color="green">823</FONT>             */<a name="line.823"></a>
+<FONT color="green">824</FONT>            private static void readArray(final ObjectInput in, final double[][] array)<a name="line.824"></a>
+<FONT color="green">825</FONT>                throws IOException {<a name="line.825"></a>
+<FONT color="green">826</FONT>                for (int i = 0; i &lt; array.length; ++i) {<a name="line.826"></a>
+<FONT color="green">827</FONT>                    readArray(in, array[i]);<a name="line.827"></a>
+<FONT color="green">828</FONT>                }<a name="line.828"></a>
+<FONT color="green">829</FONT>            }<a name="line.829"></a>
+<FONT color="green">830</FONT>    <a name="line.830"></a>
+<FONT color="green">831</FONT>        }<a name="line.831"></a>
+<FONT color="green">832</FONT>    <a name="line.832"></a>
+<FONT color="green">833</FONT>        /** Wrapper for event handlers. */<a name="line.833"></a>
+<FONT color="green">834</FONT>        private static class EventHandlerWrapper implements EventHandler {<a name="line.834"></a>
+<FONT color="green">835</FONT>    <a name="line.835"></a>
+<FONT color="green">836</FONT>            /** Underlying event handler with jacobians. */<a name="line.836"></a>
+<FONT color="green">837</FONT>            private final EventHandlerWithJacobians handler;<a name="line.837"></a>
+<FONT color="green">838</FONT>    <a name="line.838"></a>
+<FONT color="green">839</FONT>            /** State array. */<a name="line.839"></a>
+<FONT color="green">840</FONT>            private double[] y;<a name="line.840"></a>
+<FONT color="green">841</FONT>    <a name="line.841"></a>
+<FONT color="green">842</FONT>            /** Jacobian with respect to initial state dy/dy0. */<a name="line.842"></a>
+<FONT color="green">843</FONT>            private double[][] dydy0;<a name="line.843"></a>
+<FONT color="green">844</FONT>    <a name="line.844"></a>
+<FONT color="green">845</FONT>            /** Jacobian with respect to parameters dy/dp. */<a name="line.845"></a>
+<FONT color="green">846</FONT>            private double[][] dydp;<a name="line.846"></a>
+<FONT color="green">847</FONT>    <a name="line.847"></a>
+<FONT color="green">848</FONT>            /** Simple constructor.<a name="line.848"></a>
+<FONT color="green">849</FONT>             * @param handler underlying event handler with jacobians<a name="line.849"></a>
+<FONT color="green">850</FONT>             * @param n dimension of the original ODE<a name="line.850"></a>
+<FONT color="green">851</FONT>             * @param k number of parameters<a name="line.851"></a>
+<FONT color="green">852</FONT>             */<a name="line.852"></a>
+<FONT color="green">853</FONT>            public EventHandlerWrapper(final EventHandlerWithJacobians handler,<a name="line.853"></a>
+<FONT color="green">854</FONT>                                       final int n, final int k) {<a name="line.854"></a>
+<FONT color="green">855</FONT>                this.handler = handler;<a name="line.855"></a>
+<FONT color="green">856</FONT>                y        = new double[n];<a name="line.856"></a>
+<FONT color="green">857</FONT>                dydy0    = new double[n][n];<a name="line.857"></a>
+<FONT color="green">858</FONT>                dydp     = new double[n][k];<a name="line.858"></a>
+<FONT color="green">859</FONT>            }<a name="line.859"></a>
+<FONT color="green">860</FONT>    <a name="line.860"></a>
+<FONT color="green">861</FONT>            /** Get the underlying event handler with jacobians.<a name="line.861"></a>
+<FONT color="green">862</FONT>             * @return underlying event handler with jacobians<a name="line.862"></a>
+<FONT color="green">863</FONT>             */<a name="line.863"></a>
+<FONT color="green">864</FONT>            public EventHandlerWithJacobians getHandler() {<a name="line.864"></a>
+<FONT color="green">865</FONT>                return handler;<a name="line.865"></a>
+<FONT color="green">866</FONT>            }<a name="line.866"></a>
+<FONT color="green">867</FONT>    <a name="line.867"></a>
+<FONT color="green">868</FONT>            /** {@inheritDoc} */<a name="line.868"></a>
+<FONT color="green">869</FONT>            public int eventOccurred(double t, double[] z, boolean increasing)<a name="line.869"></a>
+<FONT color="green">870</FONT>                throws EventException {<a name="line.870"></a>
+<FONT color="green">871</FONT>                dispatchCompoundState(z, y, dydy0, dydp);<a name="line.871"></a>
+<FONT color="green">872</FONT>                return handler.eventOccurred(t, y, dydy0, dydp, increasing);<a name="line.872"></a>
+<FONT color="green">873</FONT>            }<a name="line.873"></a>
+<FONT color="green">874</FONT>    <a name="line.874"></a>
+<FONT color="green">875</FONT>            /** {@inheritDoc} */<a name="line.875"></a>
+<FONT color="green">876</FONT>            public double g(double t, double[] z)<a name="line.876"></a>
+<FONT color="green">877</FONT>                throws EventException {<a name="line.877"></a>
+<FONT color="green">878</FONT>                dispatchCompoundState(z, y, dydy0, dydp);<a name="line.878"></a>
+<FONT color="green">879</FONT>                return handler.g(t, y, dydy0, dydp);<a name="line.879"></a>
+<FONT color="green">880</FONT>            }<a name="line.880"></a>
+<FONT color="green">881</FONT>    <a name="line.881"></a>
+<FONT color="green">882</FONT>            /** {@inheritDoc} */<a name="line.882"></a>
+<FONT color="green">883</FONT>            public void resetState(double t, double[] z)<a name="line.883"></a>
+<FONT color="green">884</FONT>                throws EventException {<a name="line.884"></a>
+<FONT color="green">885</FONT>                dispatchCompoundState(z, y, dydy0, dydp);<a name="line.885"></a>
+<FONT color="green">886</FONT>                handler.resetState(t, y, dydy0, dydp);<a name="line.886"></a>
+<FONT color="green">887</FONT>            }<a name="line.887"></a>
+<FONT color="green">888</FONT>    <a name="line.888"></a>
+<FONT color="green">889</FONT>        }<a name="line.889"></a>
+<FONT color="green">890</FONT>    <a name="line.890"></a>
+<FONT color="green">891</FONT>    }<a name="line.891"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/jacobians/ODEWithJacobians.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,118 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.jacobians;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.ode.FirstOrderDifferentialEquations;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /** This interface represents {@link ParameterizedODE<a name="line.24"></a>
+<FONT color="green">025</FONT>     * first order differential equations} with parameters and partial derivatives.<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @see FirstOrderIntegratorWithJacobians<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @version $Revision: 919963 $ $Date: 2010-03-07 05:59:33 -0500 (Sun, 07 Mar 2010) $<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @since 2.1<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>    public interface ODEWithJacobians extends FirstOrderDifferentialEquations {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Get the number of parameters.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @return number of parameters<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        int getParametersDimension();<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Compute the partial derivatives of ODE with respect to state.<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @param t current value of the independent &lt;I&gt;time&lt;/I&gt; variable<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @param y array containing the current value of the state vector<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @param yDot array containing the current value of the time derivative of the state vector<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @param dFdY placeholder array where to put the jacobian of the ODE with respect to the state vector<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @param dFdP placeholder array where to put the jacobian of the ODE with respect to the parameters<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @throws DerivativeException this exception is propagated to the caller if the<a name="line.46"></a>
+<FONT color="green">047</FONT>         * underlying user function triggers one<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        void computeJacobians(double t, double[] y, double[] yDot, double[][] dFdY, double[][] dFdP)<a name="line.49"></a>
+<FONT color="green">050</FONT>            throws DerivativeException;<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>    }<a name="line.52"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/jacobians/ParameterizedODE.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,113 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.jacobians;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ode.FirstOrderDifferentialEquations;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /** This interface represents {@link FirstOrderDifferentialEquations<a name="line.23"></a>
+<FONT color="green">024</FONT>     * first order differential equations} with parameters.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @see FirstOrderIntegratorWithJacobians<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @version $Revision: 918702 $ $Date: 2010-03-03 16:28:16 -0500 (Wed, 03 Mar 2010) $<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @since 2.1<a name="line.29"></a>
+<FONT color="green">030</FONT>     */<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>    public interface ParameterizedODE<a name="line.32"></a>
+<FONT color="green">033</FONT>        extends FirstOrderDifferentialEquations {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Get the number of parameters.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @return number of parameters<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        int getParametersDimension();<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Set a parameter.<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @param i index of the parameters (must be between 0<a name="line.41"></a>
+<FONT color="green">042</FONT>         * and {@link #getParametersDimension() getParametersDimension() - 1})<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @param value value for the parameter<a name="line.43"></a>
+<FONT color="green">044</FONT>         */<a name="line.44"></a>
+<FONT color="green">045</FONT>        void setParameter(int i, double value);<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>    }<a name="line.47"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/jacobians/StepHandlerWithJacobians.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,161 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.jacobians;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This interface represents a handler that should be called after<a name="line.23"></a>
+<FONT color="green">024</FONT>     * each successful step.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;The ODE integrators compute the evolution of the state vector at<a name="line.26"></a>
+<FONT color="green">027</FONT>     * some grid points that depend on their own internal algorithm. Once<a name="line.27"></a>
+<FONT color="green">028</FONT>     * they have found a new grid point (possibly after having computed<a name="line.28"></a>
+<FONT color="green">029</FONT>     * several evaluation of the derivative at intermediate points), they<a name="line.29"></a>
+<FONT color="green">030</FONT>     * provide it to objects implementing this interface. These objects<a name="line.30"></a>
+<FONT color="green">031</FONT>     * typically either ignore the intermediate steps and wait for the<a name="line.31"></a>
+<FONT color="green">032</FONT>     * last one, store the points in an ephemeris, or forward them to<a name="line.32"></a>
+<FONT color="green">033</FONT>     * specialized processing or output methods.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     *<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;p&gt;Note that is is possible to register a {@link<a name="line.35"></a>
+<FONT color="green">036</FONT>     * org.apache.commons.math.ode.sampling.StepHandler classical step handler}<a name="line.36"></a>
+<FONT color="green">037</FONT>     * in the low level integrator used to build a {@link FirstOrderIntegratorWithJacobians}<a name="line.37"></a>
+<FONT color="green">038</FONT>     * rather than implementing this class. The step handlers registered at low level<a name="line.38"></a>
+<FONT color="green">039</FONT>     * will see the big compound state whether the step handlers defined by this interface<a name="line.39"></a>
+<FONT color="green">040</FONT>     * see the original state, and its jacobians in separate arrays.&lt;/p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     *<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;p&gt;The compound state is guaranteed to contain the original state in the first<a name="line.42"></a>
+<FONT color="green">043</FONT>     * elements, followed by the jacobian with respect to initial state (in row order),<a name="line.43"></a>
+<FONT color="green">044</FONT>     * followed by the jacobian with respect to parameters (in row order). If for example<a name="line.44"></a>
+<FONT color="green">045</FONT>     * the original state dimension is 6 and there are 3 parameters, the compound state will<a name="line.45"></a>
+<FONT color="green">046</FONT>     * be a 60 elements array. The first 6 elements will be the original state, the next 36<a name="line.46"></a>
+<FONT color="green">047</FONT>     * elements will be the jacobian with respect to initial state, and the remaining 18 elements<a name="line.47"></a>
+<FONT color="green">048</FONT>     * will be the jacobian with respect to parameters.&lt;/p&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>     *<a name="line.49"></a>
+<FONT color="green">050</FONT>     * &lt;p&gt;Dealing with low level step handlers is cumbersome if one really needs the jacobians<a name="line.50"></a>
+<FONT color="green">051</FONT>     * in these methods, but it also prevents many data being copied back and forth between<a name="line.51"></a>
+<FONT color="green">052</FONT>     * state and jacobians on one side and compound state on the other side. So for performance<a name="line.52"></a>
+<FONT color="green">053</FONT>     * reasons, it is recommended to use this interface &lt;em&gt;only&lt;/em&gt; if jacobians are really<a name="line.53"></a>
+<FONT color="green">054</FONT>     * needed and to use lower level handlers if only state is needed.&lt;/p&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>     *<a name="line.55"></a>
+<FONT color="green">056</FONT>     * @see FirstOrderIntegratorWithJacobians<a name="line.56"></a>
+<FONT color="green">057</FONT>     * @see StepInterpolatorWithJacobians<a name="line.57"></a>
+<FONT color="green">058</FONT>     * @version $Revision: 920131 $ $Date: 2010-03-07 17:19:18 -0500 (Sun, 07 Mar 2010) $<a name="line.58"></a>
+<FONT color="green">059</FONT>     * @since 2.1<a name="line.59"></a>
+<FONT color="green">060</FONT>     */<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>    public interface StepHandlerWithJacobians {<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>      /** Determines whether this handler needs dense output.<a name="line.64"></a>
+<FONT color="green">065</FONT>       * &lt;p&gt;This method allows the integrator to avoid performing extra<a name="line.65"></a>
+<FONT color="green">066</FONT>       * computation if the handler does not need dense output.&lt;/p&gt;<a name="line.66"></a>
+<FONT color="green">067</FONT>       * @return true if the handler needs dense output<a name="line.67"></a>
+<FONT color="green">068</FONT>       */<a name="line.68"></a>
+<FONT color="green">069</FONT>      boolean requiresDenseOutput();<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>      /** Reset the step handler.<a name="line.71"></a>
+<FONT color="green">072</FONT>       * Initialize the internal data as required before the first step is<a name="line.72"></a>
+<FONT color="green">073</FONT>       * handled.<a name="line.73"></a>
+<FONT color="green">074</FONT>       */<a name="line.74"></a>
+<FONT color="green">075</FONT>      void reset();<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>      /**<a name="line.77"></a>
+<FONT color="green">078</FONT>       * Handle the last accepted step<a name="line.78"></a>
+<FONT color="green">079</FONT>       * @param interpolator interpolator for the last accepted step. For<a name="line.79"></a>
+<FONT color="green">080</FONT>       * efficiency purposes, the various integrators reuse the same<a name="line.80"></a>
+<FONT color="green">081</FONT>       * object on each call, so if the instance wants to keep it across<a name="line.81"></a>
+<FONT color="green">082</FONT>       * all calls (for example to provide at the end of the integration a<a name="line.82"></a>
+<FONT color="green">083</FONT>       * continuous model valid throughout the integration range, as the<a name="line.83"></a>
+<FONT color="green">084</FONT>       * {@link org.apache.commons.math.ode.ContinuousOutputModel<a name="line.84"></a>
+<FONT color="green">085</FONT>       * ContinuousOutputModel} class does), it should build a local copy<a name="line.85"></a>
+<FONT color="green">086</FONT>       * using the clone method of the interpolator and store this copy.<a name="line.86"></a>
+<FONT color="green">087</FONT>       * Keeping only a reference to the interpolator and reusing it will<a name="line.87"></a>
+<FONT color="green">088</FONT>       * result in unpredictable behavior (potentially crashing the application).<a name="line.88"></a>
+<FONT color="green">089</FONT>       * @param isLast true if the step is the last one<a name="line.89"></a>
+<FONT color="green">090</FONT>       * @throws DerivativeException this exception is propagated to the<a name="line.90"></a>
+<FONT color="green">091</FONT>       * caller if the underlying user function triggers one<a name="line.91"></a>
+<FONT color="green">092</FONT>       */<a name="line.92"></a>
+<FONT color="green">093</FONT>      void handleStep(StepInterpolatorWithJacobians interpolator, boolean isLast) throws DerivativeException;<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>    }<a name="line.95"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/jacobians/StepInterpolatorWithJacobians.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,252 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.jacobians;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Externalizable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /** This interface represents an interpolator over the last step<a name="line.24"></a>
+<FONT color="green">025</FONT>     * during an ODE integration.<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;The various ODE integrators provide objects implementing this<a name="line.27"></a>
+<FONT color="green">028</FONT>     * interface to the step handlers. These objects are often custom<a name="line.28"></a>
+<FONT color="green">029</FONT>     * objects tightly bound to the integrator internal algorithms. The<a name="line.29"></a>
+<FONT color="green">030</FONT>     * handlers can use these objects to retrieve the state vector at<a name="line.30"></a>
+<FONT color="green">031</FONT>     * intermediate times between the previous and the current grid points<a name="line.31"></a>
+<FONT color="green">032</FONT>     * (this feature is often called dense output).&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;p&gt;One important thing to note is that the step handlers may be so<a name="line.33"></a>
+<FONT color="green">034</FONT>     * tightly bound to the integrators that they often share some internal<a name="line.34"></a>
+<FONT color="green">035</FONT>     * state arrays. This imply that one should &lt;em&gt;never&lt;/em&gt; use a direct<a name="line.35"></a>
+<FONT color="green">036</FONT>     * reference to a step interpolator outside of the step handler, either<a name="line.36"></a>
+<FONT color="green">037</FONT>     * for future use or for use in another thread. If such a need arise, the<a name="line.37"></a>
+<FONT color="green">038</FONT>     * step interpolator &lt;em&gt;must&lt;/em&gt; be copied using the dedicated<a name="line.38"></a>
+<FONT color="green">039</FONT>     * {@link #copy()} method.<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;/p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     *<a name="line.41"></a>
+<FONT color="green">042</FONT>     * @see FirstOrderIntegratorWithJacobians<a name="line.42"></a>
+<FONT color="green">043</FONT>     * @see StepHandlerWithJacobians<a name="line.43"></a>
+<FONT color="green">044</FONT>     * @version $Revision: 918702 $ $Date: 2010-03-03 16:28:16 -0500 (Wed, 03 Mar 2010) $<a name="line.44"></a>
+<FONT color="green">045</FONT>     * @since 2.1<a name="line.45"></a>
+<FONT color="green">046</FONT>     */<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>    public interface StepInterpolatorWithJacobians extends Externalizable {<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>      /**<a name="line.50"></a>
+<FONT color="green">051</FONT>       * Get the previous grid point time.<a name="line.51"></a>
+<FONT color="green">052</FONT>       * @return previous grid point time<a name="line.52"></a>
+<FONT color="green">053</FONT>       */<a name="line.53"></a>
+<FONT color="green">054</FONT>      double getPreviousTime();<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>      /**<a name="line.56"></a>
+<FONT color="green">057</FONT>       * Get the current grid point time.<a name="line.57"></a>
+<FONT color="green">058</FONT>       * @return current grid point time<a name="line.58"></a>
+<FONT color="green">059</FONT>       */<a name="line.59"></a>
+<FONT color="green">060</FONT>      double getCurrentTime();<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>      /**<a name="line.62"></a>
+<FONT color="green">063</FONT>       * Get the time of the interpolated point.<a name="line.63"></a>
+<FONT color="green">064</FONT>       * If {@link #setInterpolatedTime} has not been called, it returns<a name="line.64"></a>
+<FONT color="green">065</FONT>       * the current grid point time.<a name="line.65"></a>
+<FONT color="green">066</FONT>       * @return interpolation point time<a name="line.66"></a>
+<FONT color="green">067</FONT>       */<a name="line.67"></a>
+<FONT color="green">068</FONT>      double getInterpolatedTime();<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>      /**<a name="line.70"></a>
+<FONT color="green">071</FONT>       * Set the time of the interpolated point.<a name="line.71"></a>
+<FONT color="green">072</FONT>       * &lt;p&gt;Setting the time outside of the current step is now allowed, but<a name="line.72"></a>
+<FONT color="green">073</FONT>       * should be used with care since the accuracy of the interpolator will<a name="line.73"></a>
+<FONT color="green">074</FONT>       * probably be very poor far from this step. This allowance has been<a name="line.74"></a>
+<FONT color="green">075</FONT>       * added to simplify implementation of search algorithms near the<a name="line.75"></a>
+<FONT color="green">076</FONT>       * step endpoints.&lt;/p&gt;<a name="line.76"></a>
+<FONT color="green">077</FONT>       * &lt;p&gt;Setting the time changes the instance internal state. If a<a name="line.77"></a>
+<FONT color="green">078</FONT>       * specific state must be preserved, a copy of the instance must be<a name="line.78"></a>
+<FONT color="green">079</FONT>       * created using {@link #copy()}.&lt;/p&gt;<a name="line.79"></a>
+<FONT color="green">080</FONT>       * @param time time of the interpolated point<a name="line.80"></a>
+<FONT color="green">081</FONT>       */<a name="line.81"></a>
+<FONT color="green">082</FONT>      void setInterpolatedTime(double time);<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>      /**<a name="line.84"></a>
+<FONT color="green">085</FONT>       * Get the state vector of the interpolated point.<a name="line.85"></a>
+<FONT color="green">086</FONT>       * &lt;p&gt;The returned vector is a reference to a reused array, so<a name="line.86"></a>
+<FONT color="green">087</FONT>       * it should not be modified and it should be copied if it needs<a name="line.87"></a>
+<FONT color="green">088</FONT>       * to be preserved across several calls.&lt;/p&gt;<a name="line.88"></a>
+<FONT color="green">089</FONT>       * @return state vector at time {@link #getInterpolatedTime}<a name="line.89"></a>
+<FONT color="green">090</FONT>       * @see #getInterpolatedYDot()<a name="line.90"></a>
+<FONT color="green">091</FONT>       * @throws DerivativeException if this call induces an automatic<a name="line.91"></a>
+<FONT color="green">092</FONT>       * step finalization that throws one<a name="line.92"></a>
+<FONT color="green">093</FONT>       */<a name="line.93"></a>
+<FONT color="green">094</FONT>      double[] getInterpolatedY() throws DerivativeException;<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>      /**<a name="line.96"></a>
+<FONT color="green">097</FONT>       * Get the partial derivatives of the state vector with respect to<a name="line.97"></a>
+<FONT color="green">098</FONT>       * the initial state of the interpolated point.<a name="line.98"></a>
+<FONT color="green">099</FONT>       * &lt;p&gt;The returned vector is a reference to a reused array, so<a name="line.99"></a>
+<FONT color="green">100</FONT>       * it should not be modified and it should be copied if it needs<a name="line.100"></a>
+<FONT color="green">101</FONT>       * to be preserved across several calls.&lt;/p&gt;<a name="line.101"></a>
+<FONT color="green">102</FONT>       * @return partial derivatives of the state vector with respect to<a name="line.102"></a>
+<FONT color="green">103</FONT>       * the initial state at time {@link #getInterpolatedTime}<a name="line.103"></a>
+<FONT color="green">104</FONT>       * @see #getInterpolatedY()<a name="line.104"></a>
+<FONT color="green">105</FONT>       * @throws DerivativeException if this call induces an automatic<a name="line.105"></a>
+<FONT color="green">106</FONT>       * step finalization that throws one<a name="line.106"></a>
+<FONT color="green">107</FONT>       */<a name="line.107"></a>
+<FONT color="green">108</FONT>      double[][] getInterpolatedDyDy0() throws DerivativeException;<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>      /**<a name="line.110"></a>
+<FONT color="green">111</FONT>       * Get the partial derivatives of the state vector with respect to<a name="line.111"></a>
+<FONT color="green">112</FONT>       * the ODE parameters of the interpolated point.<a name="line.112"></a>
+<FONT color="green">113</FONT>       * &lt;p&gt;The returned vector is a reference to a reused array, so<a name="line.113"></a>
+<FONT color="green">114</FONT>       * it should not be modified and it should be copied if it needs<a name="line.114"></a>
+<FONT color="green">115</FONT>       * to be preserved across several calls.&lt;/p&gt;<a name="line.115"></a>
+<FONT color="green">116</FONT>       * @return partial derivatives of the state vector with respect to<a name="line.116"></a>
+<FONT color="green">117</FONT>       * the ODE parameters at time {@link #getInterpolatedTime}<a name="line.117"></a>
+<FONT color="green">118</FONT>       * @see #getInterpolatedY()<a name="line.118"></a>
+<FONT color="green">119</FONT>       * @throws DerivativeException if this call induces an automatic<a name="line.119"></a>
+<FONT color="green">120</FONT>       * step finalization that throws one<a name="line.120"></a>
+<FONT color="green">121</FONT>       */<a name="line.121"></a>
+<FONT color="green">122</FONT>      double[][] getInterpolatedDyDp() throws DerivativeException;<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>      /**<a name="line.124"></a>
+<FONT color="green">125</FONT>       * Get the time derivatives of the state vector of the interpolated point.<a name="line.125"></a>
+<FONT color="green">126</FONT>       * &lt;p&gt;The returned vector is a reference to a reused array, so<a name="line.126"></a>
+<FONT color="green">127</FONT>       * it should not be modified and it should be copied if it needs<a name="line.127"></a>
+<FONT color="green">128</FONT>       * to be preserved across several calls.&lt;/p&gt;<a name="line.128"></a>
+<FONT color="green">129</FONT>       * @return derivatives of the state vector at time {@link #getInterpolatedTime}<a name="line.129"></a>
+<FONT color="green">130</FONT>       * @see #getInterpolatedY()<a name="line.130"></a>
+<FONT color="green">131</FONT>       * @throws DerivativeException if this call induces an automatic<a name="line.131"></a>
+<FONT color="green">132</FONT>       * step finalization that throws one<a name="line.132"></a>
+<FONT color="green">133</FONT>       */<a name="line.133"></a>
+<FONT color="green">134</FONT>      double[] getInterpolatedYDot() throws DerivativeException;<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>      /**<a name="line.136"></a>
+<FONT color="green">137</FONT>       * Get the time derivatives of the jacobian of the state vector<a name="line.137"></a>
+<FONT color="green">138</FONT>       * with respect to the initial state of the interpolated point.<a name="line.138"></a>
+<FONT color="green">139</FONT>       * &lt;p&gt;The returned vector is a reference to a reused array, so<a name="line.139"></a>
+<FONT color="green">140</FONT>       * it should not be modified and it should be copied if it needs<a name="line.140"></a>
+<FONT color="green">141</FONT>       * to be preserved across several calls.&lt;/p&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>       * @return time derivatives of the jacobian of the state vector<a name="line.142"></a>
+<FONT color="green">143</FONT>       * with respect to the initial state at time {@link #getInterpolatedTime}<a name="line.143"></a>
+<FONT color="green">144</FONT>       * @see #getInterpolatedY()<a name="line.144"></a>
+<FONT color="green">145</FONT>       * @throws DerivativeException if this call induces an automatic<a name="line.145"></a>
+<FONT color="green">146</FONT>       * step finalization that throws one<a name="line.146"></a>
+<FONT color="green">147</FONT>       */<a name="line.147"></a>
+<FONT color="green">148</FONT>      double[][] getInterpolatedDyDy0Dot() throws DerivativeException;<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>      /**<a name="line.150"></a>
+<FONT color="green">151</FONT>       * Get the time derivatives of the jacobian of the state vector<a name="line.151"></a>
+<FONT color="green">152</FONT>       * with respect to the ODE parameters of the interpolated point.<a name="line.152"></a>
+<FONT color="green">153</FONT>       * &lt;p&gt;The returned vector is a reference to a reused array, so<a name="line.153"></a>
+<FONT color="green">154</FONT>       * it should not be modified and it should be copied if it needs<a name="line.154"></a>
+<FONT color="green">155</FONT>       * to be preserved across several calls.&lt;/p&gt;<a name="line.155"></a>
+<FONT color="green">156</FONT>       * @return time derivatives of the jacobian of the state vector<a name="line.156"></a>
+<FONT color="green">157</FONT>       * with respect to the ODE parameters at time {@link #getInterpolatedTime}<a name="line.157"></a>
+<FONT color="green">158</FONT>       * @see #getInterpolatedY()<a name="line.158"></a>
+<FONT color="green">159</FONT>       * @throws DerivativeException if this call induces an automatic<a name="line.159"></a>
+<FONT color="green">160</FONT>       * step finalization that throws one<a name="line.160"></a>
+<FONT color="green">161</FONT>       */<a name="line.161"></a>
+<FONT color="green">162</FONT>      double[][] getInterpolatedDyDpDot() throws DerivativeException;<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>      /** Check if the natural integration direction is forward.<a name="line.164"></a>
+<FONT color="green">165</FONT>       * &lt;p&gt;This method provides the integration direction as specified by<a name="line.165"></a>
+<FONT color="green">166</FONT>       * the integrator itself, it avoid some nasty problems in<a name="line.166"></a>
+<FONT color="green">167</FONT>       * degenerated cases like null steps due to cancellation at step<a name="line.167"></a>
+<FONT color="green">168</FONT>       * initialization, step control or discrete events<a name="line.168"></a>
+<FONT color="green">169</FONT>       * triggering.&lt;/p&gt;<a name="line.169"></a>
+<FONT color="green">170</FONT>       * @return true if the integration variable (time) increases during<a name="line.170"></a>
+<FONT color="green">171</FONT>       * integration<a name="line.171"></a>
+<FONT color="green">172</FONT>       */<a name="line.172"></a>
+<FONT color="green">173</FONT>      boolean isForward();<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>      /** Copy the instance.<a name="line.175"></a>
+<FONT color="green">176</FONT>       * &lt;p&gt;The copied instance is guaranteed to be independent from the<a name="line.176"></a>
+<FONT color="green">177</FONT>       * original one. Both can be used with different settings for<a name="line.177"></a>
+<FONT color="green">178</FONT>       * interpolated time without any side effect.&lt;/p&gt;<a name="line.178"></a>
+<FONT color="green">179</FONT>       * @return a deep copy of the instance, which can be used independently.<a name="line.179"></a>
+<FONT color="green">180</FONT>       * @throws DerivativeException if this call induces an automatic<a name="line.180"></a>
+<FONT color="green">181</FONT>       * step finalization that throws one<a name="line.181"></a>
+<FONT color="green">182</FONT>       * @see #setInterpolatedTime(double)<a name="line.182"></a>
+<FONT color="green">183</FONT>       */<a name="line.183"></a>
+<FONT color="green">184</FONT>       StepInterpolatorWithJacobians copy() throws DerivativeException;<a name="line.184"></a>
+<FONT color="green">185</FONT>    <a name="line.185"></a>
+<FONT color="green">186</FONT>    }<a name="line.186"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,419 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.nonstiff;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.linear.Array2DRowRealMatrix;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.ode.FirstOrderDifferentialEquations;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.ode.IntegratorException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.ode.events.CombinedEventsManager;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.ode.sampling.NordsieckStepInterpolator;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.ode.sampling.StepHandler;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>    /**<a name="line.29"></a>
+<FONT color="green">030</FONT>     * This class implements explicit Adams-Bashforth integrators for Ordinary<a name="line.30"></a>
+<FONT color="green">031</FONT>     * Differential Equations.<a name="line.31"></a>
+<FONT color="green">032</FONT>     *<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;p&gt;Adams-Bashforth methods (in fact due to Adams alone) are explicit<a name="line.33"></a>
+<FONT color="green">034</FONT>     * multistep ODE solvers. This implementation is a variation of the classical<a name="line.34"></a>
+<FONT color="green">035</FONT>     * one: it uses adaptive stepsize to implement error control, whereas<a name="line.35"></a>
+<FONT color="green">036</FONT>     * classical implementations are fixed step size. The value of state vector<a name="line.36"></a>
+<FONT color="green">037</FONT>     * at step n+1 is a simple combination of the value at step n and of the<a name="line.37"></a>
+<FONT color="green">038</FONT>     * derivatives at steps n, n-1, n-2 ... Depending on the number k of previous<a name="line.38"></a>
+<FONT color="green">039</FONT>     * steps one wants to use for computing the next value, different formulas<a name="line.39"></a>
+<FONT color="green">040</FONT>     * are available:&lt;/p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;ul&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     *   &lt;li&gt;k = 1: y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + h y'&lt;sub&gt;n&lt;/sub&gt;&lt;/li&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     *   &lt;li&gt;k = 2: y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + h (3y'&lt;sub&gt;n&lt;/sub&gt;-y'&lt;sub&gt;n-1&lt;/sub&gt;)/2&lt;/li&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     *   &lt;li&gt;k = 3: y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + h (23y'&lt;sub&gt;n&lt;/sub&gt;-16y'&lt;sub&gt;n-1&lt;/sub&gt;+5y'&lt;sub&gt;n-2&lt;/sub&gt;)/12&lt;/li&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     *   &lt;li&gt;k = 4: y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + h (55y'&lt;sub&gt;n&lt;/sub&gt;-59y'&lt;sub&gt;n-1&lt;/sub&gt;+37y'&lt;sub&gt;n-2&lt;/sub&gt;-9y'&lt;sub&gt;n-3&lt;/sub&gt;)/24&lt;/li&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     *   &lt;li&gt;...&lt;/li&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     * &lt;/ul&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     *<a name="line.48"></a>
+<FONT color="green">049</FONT>     * &lt;p&gt;A k-steps Adams-Bashforth method is of order k.&lt;/p&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     *<a name="line.50"></a>
+<FONT color="green">051</FONT>     * &lt;h3&gt;Implementation details&lt;/h3&gt;<a name="line.51"></a>
+<FONT color="green">052</FONT>     *<a name="line.52"></a>
+<FONT color="green">053</FONT>     * &lt;p&gt;We define scaled derivatives s&lt;sub&gt;i&lt;/sub&gt;(n) at step n as:<a name="line.53"></a>
+<FONT color="green">054</FONT>     * &lt;pre&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>     * s&lt;sub&gt;1&lt;/sub&gt;(n) = h y'&lt;sub&gt;n&lt;/sub&gt; for first derivative<a name="line.55"></a>
+<FONT color="green">056</FONT>     * s&lt;sub&gt;2&lt;/sub&gt;(n) = h&lt;sup&gt;2&lt;/sup&gt;/2 y''&lt;sub&gt;n&lt;/sub&gt; for second derivative<a name="line.56"></a>
+<FONT color="green">057</FONT>     * s&lt;sub&gt;3&lt;/sub&gt;(n) = h&lt;sup&gt;3&lt;/sup&gt;/6 y'''&lt;sub&gt;n&lt;/sub&gt; for third derivative<a name="line.57"></a>
+<FONT color="green">058</FONT>     * ...<a name="line.58"></a>
+<FONT color="green">059</FONT>     * s&lt;sub&gt;k&lt;/sub&gt;(n) = h&lt;sup&gt;k&lt;/sup&gt;/k! y(k)&lt;sub&gt;n&lt;/sub&gt; for k&lt;sup&gt;th&lt;/sup&gt; derivative<a name="line.59"></a>
+<FONT color="green">060</FONT>     * &lt;/pre&gt;&lt;/p&gt;<a name="line.60"></a>
+<FONT color="green">061</FONT>     *<a name="line.61"></a>
+<FONT color="green">062</FONT>     * &lt;p&gt;The definitions above use the classical representation with several previous first<a name="line.62"></a>
+<FONT color="green">063</FONT>     * derivatives. Lets define<a name="line.63"></a>
+<FONT color="green">064</FONT>     * &lt;pre&gt;<a name="line.64"></a>
+<FONT color="green">065</FONT>     *   q&lt;sub&gt;n&lt;/sub&gt; = [ s&lt;sub&gt;1&lt;/sub&gt;(n-1) s&lt;sub&gt;1&lt;/sub&gt;(n-2) ... s&lt;sub&gt;1&lt;/sub&gt;(n-(k-1)) ]&lt;sup&gt;T&lt;/sup&gt;<a name="line.65"></a>
+<FONT color="green">066</FONT>     * &lt;/pre&gt;<a name="line.66"></a>
+<FONT color="green">067</FONT>     * (we omit the k index in the notation for clarity). With these definitions,<a name="line.67"></a>
+<FONT color="green">068</FONT>     * Adams-Bashforth methods can be written:<a name="line.68"></a>
+<FONT color="green">069</FONT>     * &lt;ul&gt;<a name="line.69"></a>
+<FONT color="green">070</FONT>     *   &lt;li&gt;k = 1: y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + s&lt;sub&gt;1&lt;/sub&gt;(n)&lt;/li&gt;<a name="line.70"></a>
+<FONT color="green">071</FONT>     *   &lt;li&gt;k = 2: y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + 3/2 s&lt;sub&gt;1&lt;/sub&gt;(n) + [ -1/2 ] q&lt;sub&gt;n&lt;/sub&gt;&lt;/li&gt;<a name="line.71"></a>
+<FONT color="green">072</FONT>     *   &lt;li&gt;k = 3: y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + 23/12 s&lt;sub&gt;1&lt;/sub&gt;(n) + [ -16/12 5/12 ] q&lt;sub&gt;n&lt;/sub&gt;&lt;/li&gt;<a name="line.72"></a>
+<FONT color="green">073</FONT>     *   &lt;li&gt;k = 4: y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + 55/24 s&lt;sub&gt;1&lt;/sub&gt;(n) + [ -59/24 37/24 -9/24 ] q&lt;sub&gt;n&lt;/sub&gt;&lt;/li&gt;<a name="line.73"></a>
+<FONT color="green">074</FONT>     *   &lt;li&gt;...&lt;/li&gt;<a name="line.74"></a>
+<FONT color="green">075</FONT>     * &lt;/ul&gt;&lt;/p&gt;<a name="line.75"></a>
+<FONT color="green">076</FONT>     *<a name="line.76"></a>
+<FONT color="green">077</FONT>     * &lt;p&gt;Instead of using the classical representation with first derivatives only (y&lt;sub&gt;n&lt;/sub&gt;,<a name="line.77"></a>
+<FONT color="green">078</FONT>     * s&lt;sub&gt;1&lt;/sub&gt;(n) and q&lt;sub&gt;n&lt;/sub&gt;), our implementation uses the Nordsieck vector with<a name="line.78"></a>
+<FONT color="green">079</FONT>     * higher degrees scaled derivatives all taken at the same step (y&lt;sub&gt;n&lt;/sub&gt;, s&lt;sub&gt;1&lt;/sub&gt;(n)<a name="line.79"></a>
+<FONT color="green">080</FONT>     * and r&lt;sub&gt;n&lt;/sub&gt;) where r&lt;sub&gt;n&lt;/sub&gt; is defined as:<a name="line.80"></a>
+<FONT color="green">081</FONT>     * &lt;pre&gt;<a name="line.81"></a>
+<FONT color="green">082</FONT>     * r&lt;sub&gt;n&lt;/sub&gt; = [ s&lt;sub&gt;2&lt;/sub&gt;(n), s&lt;sub&gt;3&lt;/sub&gt;(n) ... s&lt;sub&gt;k&lt;/sub&gt;(n) ]&lt;sup&gt;T&lt;/sup&gt;<a name="line.82"></a>
+<FONT color="green">083</FONT>     * &lt;/pre&gt;<a name="line.83"></a>
+<FONT color="green">084</FONT>     * (here again we omit the k index in the notation for clarity)<a name="line.84"></a>
+<FONT color="green">085</FONT>     * &lt;/p&gt;<a name="line.85"></a>
+<FONT color="green">086</FONT>     *<a name="line.86"></a>
+<FONT color="green">087</FONT>     * &lt;p&gt;Taylor series formulas show that for any index offset i, s&lt;sub&gt;1&lt;/sub&gt;(n-i) can be<a name="line.87"></a>
+<FONT color="green">088</FONT>     * computed from s&lt;sub&gt;1&lt;/sub&gt;(n), s&lt;sub&gt;2&lt;/sub&gt;(n) ... s&lt;sub&gt;k&lt;/sub&gt;(n), the formula being exact<a name="line.88"></a>
+<FONT color="green">089</FONT>     * for degree k polynomials.<a name="line.89"></a>
+<FONT color="green">090</FONT>     * &lt;pre&gt;<a name="line.90"></a>
+<FONT color="green">091</FONT>     * s&lt;sub&gt;1&lt;/sub&gt;(n-i) = s&lt;sub&gt;1&lt;/sub&gt;(n) + &amp;sum;&lt;sub&gt;j&lt;/sub&gt; j (-i)&lt;sup&gt;j-1&lt;/sup&gt; s&lt;sub&gt;j&lt;/sub&gt;(n)<a name="line.91"></a>
+<FONT color="green">092</FONT>     * &lt;/pre&gt;<a name="line.92"></a>
+<FONT color="green">093</FONT>     * The previous formula can be used with several values for i to compute the transform between<a name="line.93"></a>
+<FONT color="green">094</FONT>     * classical representation and Nordsieck vector. The transform between r&lt;sub&gt;n&lt;/sub&gt;<a name="line.94"></a>
+<FONT color="green">095</FONT>     * and q&lt;sub&gt;n&lt;/sub&gt; resulting from the Taylor series formulas above is:<a name="line.95"></a>
+<FONT color="green">096</FONT>     * &lt;pre&gt;<a name="line.96"></a>
+<FONT color="green">097</FONT>     * q&lt;sub&gt;n&lt;/sub&gt; = s&lt;sub&gt;1&lt;/sub&gt;(n) u + P r&lt;sub&gt;n&lt;/sub&gt;<a name="line.97"></a>
+<FONT color="green">098</FONT>     * &lt;/pre&gt;<a name="line.98"></a>
+<FONT color="green">099</FONT>     * where u is the [ 1 1 ... 1 ]&lt;sup&gt;T&lt;/sup&gt; vector and P is the (k-1)&amp;times;(k-1) matrix built<a name="line.99"></a>
+<FONT color="green">100</FONT>     * with the j (-i)&lt;sup&gt;j-1&lt;/sup&gt; terms:<a name="line.100"></a>
+<FONT color="green">101</FONT>     * &lt;pre&gt;<a name="line.101"></a>
+<FONT color="green">102</FONT>     *        [  -2   3   -4    5  ... ]<a name="line.102"></a>
+<FONT color="green">103</FONT>     *        [  -4  12  -32   80  ... ]<a name="line.103"></a>
+<FONT color="green">104</FONT>     *   P =  [  -6  27 -108  405  ... ]<a name="line.104"></a>
+<FONT color="green">105</FONT>     *        [  -8  48 -256 1280  ... ]<a name="line.105"></a>
+<FONT color="green">106</FONT>     *        [          ...           ]<a name="line.106"></a>
+<FONT color="green">107</FONT>     * &lt;/pre&gt;&lt;/p&gt;<a name="line.107"></a>
+<FONT color="green">108</FONT>     *<a name="line.108"></a>
+<FONT color="green">109</FONT>     * &lt;p&gt;Using the Nordsieck vector has several advantages:<a name="line.109"></a>
+<FONT color="green">110</FONT>     * &lt;ul&gt;<a name="line.110"></a>
+<FONT color="green">111</FONT>     *   &lt;li&gt;it greatly simplifies step interpolation as the interpolator mainly applies<a name="line.111"></a>
+<FONT color="green">112</FONT>     *   Taylor series formulas,&lt;/li&gt;<a name="line.112"></a>
+<FONT color="green">113</FONT>     *   &lt;li&gt;it simplifies step changes that occur when discrete events that truncate<a name="line.113"></a>
+<FONT color="green">114</FONT>     *   the step are triggered,&lt;/li&gt;<a name="line.114"></a>
+<FONT color="green">115</FONT>     *   &lt;li&gt;it allows to extend the methods in order to support adaptive stepsize.&lt;/li&gt;<a name="line.115"></a>
+<FONT color="green">116</FONT>     * &lt;/ul&gt;&lt;/p&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>     *<a name="line.117"></a>
+<FONT color="green">118</FONT>     * &lt;p&gt;The Nordsieck vector at step n+1 is computed from the Nordsieck vector at step n as follows:<a name="line.118"></a>
+<FONT color="green">119</FONT>     * &lt;ul&gt;<a name="line.119"></a>
+<FONT color="green">120</FONT>     *   &lt;li&gt;y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + s&lt;sub&gt;1&lt;/sub&gt;(n) + u&lt;sup&gt;T&lt;/sup&gt; r&lt;sub&gt;n&lt;/sub&gt;&lt;/li&gt;<a name="line.120"></a>
+<FONT color="green">121</FONT>     *   &lt;li&gt;s&lt;sub&gt;1&lt;/sub&gt;(n+1) = h f(t&lt;sub&gt;n+1&lt;/sub&gt;, y&lt;sub&gt;n+1&lt;/sub&gt;)&lt;/li&gt;<a name="line.121"></a>
+<FONT color="green">122</FONT>     *   &lt;li&gt;r&lt;sub&gt;n+1&lt;/sub&gt; = (s&lt;sub&gt;1&lt;/sub&gt;(n) - s&lt;sub&gt;1&lt;/sub&gt;(n+1)) P&lt;sup&gt;-1&lt;/sup&gt; u + P&lt;sup&gt;-1&lt;/sup&gt; A P r&lt;sub&gt;n&lt;/sub&gt;&lt;/li&gt;<a name="line.122"></a>
+<FONT color="green">123</FONT>     * &lt;/ul&gt;<a name="line.123"></a>
+<FONT color="green">124</FONT>     * where A is a rows shifting matrix (the lower left part is an identity matrix):<a name="line.124"></a>
+<FONT color="green">125</FONT>     * &lt;pre&gt;<a name="line.125"></a>
+<FONT color="green">126</FONT>     *        [ 0 0   ...  0 0 | 0 ]<a name="line.126"></a>
+<FONT color="green">127</FONT>     *        [ ---------------+---]<a name="line.127"></a>
+<FONT color="green">128</FONT>     *        [ 1 0   ...  0 0 | 0 ]<a name="line.128"></a>
+<FONT color="green">129</FONT>     *    A = [ 0 1   ...  0 0 | 0 ]<a name="line.129"></a>
+<FONT color="green">130</FONT>     *        [       ...      | 0 ]<a name="line.130"></a>
+<FONT color="green">131</FONT>     *        [ 0 0   ...  1 0 | 0 ]<a name="line.131"></a>
+<FONT color="green">132</FONT>     *        [ 0 0   ...  0 1 | 0 ]<a name="line.132"></a>
+<FONT color="green">133</FONT>     * &lt;/pre&gt;&lt;/p&gt;<a name="line.133"></a>
+<FONT color="green">134</FONT>     *<a name="line.134"></a>
+<FONT color="green">135</FONT>     * &lt;p&gt;The P&lt;sup&gt;-1&lt;/sup&gt;u vector and the P&lt;sup&gt;-1&lt;/sup&gt; A P matrix do not depend on the state,<a name="line.135"></a>
+<FONT color="green">136</FONT>     * they only depend on k and therefore are precomputed once for all.&lt;/p&gt;<a name="line.136"></a>
+<FONT color="green">137</FONT>     *<a name="line.137"></a>
+<FONT color="green">138</FONT>     * @version $Revision: 927202 $ $Date: 2010-03-24 18:11:51 -0400 (Wed, 24 Mar 2010) $<a name="line.138"></a>
+<FONT color="green">139</FONT>     * @since 2.0<a name="line.139"></a>
+<FONT color="green">140</FONT>     */<a name="line.140"></a>
+<FONT color="green">141</FONT>    public class AdamsBashforthIntegrator extends AdamsIntegrator {<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>        /**<a name="line.143"></a>
+<FONT color="green">144</FONT>         * Build an Adams-Bashforth integrator with the given order and step control parameters.<a name="line.144"></a>
+<FONT color="green">145</FONT>         * @param nSteps number of steps of the method excluding the one being computed<a name="line.145"></a>
+<FONT color="green">146</FONT>         * @param minStep minimal step (must be positive even for backward<a name="line.146"></a>
+<FONT color="green">147</FONT>         * integration), the last step can be smaller than this<a name="line.147"></a>
+<FONT color="green">148</FONT>         * @param maxStep maximal step (must be positive even for backward<a name="line.148"></a>
+<FONT color="green">149</FONT>         * integration)<a name="line.149"></a>
+<FONT color="green">150</FONT>         * @param scalAbsoluteTolerance allowed absolute error<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @param scalRelativeTolerance allowed relative error<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @exception IllegalArgumentException if order is 1 or less<a name="line.152"></a>
+<FONT color="green">153</FONT>         */<a name="line.153"></a>
+<FONT color="green">154</FONT>        public AdamsBashforthIntegrator(final int nSteps,<a name="line.154"></a>
+<FONT color="green">155</FONT>                                        final double minStep, final double maxStep,<a name="line.155"></a>
+<FONT color="green">156</FONT>                                        final double scalAbsoluteTolerance,<a name="line.156"></a>
+<FONT color="green">157</FONT>                                        final double scalRelativeTolerance)<a name="line.157"></a>
+<FONT color="green">158</FONT>            throws IllegalArgumentException {<a name="line.158"></a>
+<FONT color="green">159</FONT>            super("Adams-Bashforth", nSteps, nSteps, minStep, maxStep,<a name="line.159"></a>
+<FONT color="green">160</FONT>                  scalAbsoluteTolerance, scalRelativeTolerance);<a name="line.160"></a>
+<FONT color="green">161</FONT>        }<a name="line.161"></a>
+<FONT color="green">162</FONT>    <a name="line.162"></a>
+<FONT color="green">163</FONT>        /**<a name="line.163"></a>
+<FONT color="green">164</FONT>         * Build an Adams-Bashforth integrator with the given order and step control parameters.<a name="line.164"></a>
+<FONT color="green">165</FONT>         * @param nSteps number of steps of the method excluding the one being computed<a name="line.165"></a>
+<FONT color="green">166</FONT>         * @param minStep minimal step (must be positive even for backward<a name="line.166"></a>
+<FONT color="green">167</FONT>         * integration), the last step can be smaller than this<a name="line.167"></a>
+<FONT color="green">168</FONT>         * @param maxStep maximal step (must be positive even for backward<a name="line.168"></a>
+<FONT color="green">169</FONT>         * integration)<a name="line.169"></a>
+<FONT color="green">170</FONT>         * @param vecAbsoluteTolerance allowed absolute error<a name="line.170"></a>
+<FONT color="green">171</FONT>         * @param vecRelativeTolerance allowed relative error<a name="line.171"></a>
+<FONT color="green">172</FONT>         * @exception IllegalArgumentException if order is 1 or less<a name="line.172"></a>
+<FONT color="green">173</FONT>         */<a name="line.173"></a>
+<FONT color="green">174</FONT>        public AdamsBashforthIntegrator(final int nSteps,<a name="line.174"></a>
+<FONT color="green">175</FONT>                                        final double minStep, final double maxStep,<a name="line.175"></a>
+<FONT color="green">176</FONT>                                        final double[] vecAbsoluteTolerance,<a name="line.176"></a>
+<FONT color="green">177</FONT>                                        final double[] vecRelativeTolerance)<a name="line.177"></a>
+<FONT color="green">178</FONT>            throws IllegalArgumentException {<a name="line.178"></a>
+<FONT color="green">179</FONT>            super("Adams-Bashforth", nSteps, nSteps, minStep, maxStep,<a name="line.179"></a>
+<FONT color="green">180</FONT>                  vecAbsoluteTolerance, vecRelativeTolerance);<a name="line.180"></a>
+<FONT color="green">181</FONT>        }<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>        /** {@inheritDoc} */<a name="line.183"></a>
+<FONT color="green">184</FONT>        @Override<a name="line.184"></a>
+<FONT color="green">185</FONT>        public double integrate(final FirstOrderDifferentialEquations equations,<a name="line.185"></a>
+<FONT color="green">186</FONT>                                final double t0, final double[] y0,<a name="line.186"></a>
+<FONT color="green">187</FONT>                                final double t, final double[] y)<a name="line.187"></a>
+<FONT color="green">188</FONT>            throws DerivativeException, IntegratorException {<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>            final int n = y0.length;<a name="line.190"></a>
+<FONT color="green">191</FONT>            sanityChecks(equations, t0, y0, t, y);<a name="line.191"></a>
+<FONT color="green">192</FONT>            setEquations(equations);<a name="line.192"></a>
+<FONT color="green">193</FONT>            resetEvaluations();<a name="line.193"></a>
+<FONT color="green">194</FONT>            final boolean forward = t &gt; t0;<a name="line.194"></a>
+<FONT color="green">195</FONT>    <a name="line.195"></a>
+<FONT color="green">196</FONT>            // initialize working arrays<a name="line.196"></a>
+<FONT color="green">197</FONT>            if (y != y0) {<a name="line.197"></a>
+<FONT color="green">198</FONT>                System.arraycopy(y0, 0, y, 0, n);<a name="line.198"></a>
+<FONT color="green">199</FONT>            }<a name="line.199"></a>
+<FONT color="green">200</FONT>            final double[] yDot = new double[n];<a name="line.200"></a>
+<FONT color="green">201</FONT>            final double[] yTmp = new double[y0.length];<a name="line.201"></a>
+<FONT color="green">202</FONT>    <a name="line.202"></a>
+<FONT color="green">203</FONT>            // set up an interpolator sharing the integrator arrays<a name="line.203"></a>
+<FONT color="green">204</FONT>            final NordsieckStepInterpolator interpolator = new NordsieckStepInterpolator();<a name="line.204"></a>
+<FONT color="green">205</FONT>            interpolator.reinitialize(y, forward);<a name="line.205"></a>
+<FONT color="green">206</FONT>            final NordsieckStepInterpolator interpolatorTmp = new NordsieckStepInterpolator();<a name="line.206"></a>
+<FONT color="green">207</FONT>            interpolatorTmp.reinitialize(yTmp, forward);<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>            // set up integration control objects<a name="line.209"></a>
+<FONT color="green">210</FONT>            for (StepHandler handler : stepHandlers) {<a name="line.210"></a>
+<FONT color="green">211</FONT>                handler.reset();<a name="line.211"></a>
+<FONT color="green">212</FONT>            }<a name="line.212"></a>
+<FONT color="green">213</FONT>            CombinedEventsManager manager = addEndTimeChecker(t0, t, eventsHandlersManager);<a name="line.213"></a>
+<FONT color="green">214</FONT>    <a name="line.214"></a>
+<FONT color="green">215</FONT>            // compute the initial Nordsieck vector using the configured starter integrator<a name="line.215"></a>
+<FONT color="green">216</FONT>            start(t0, y, t);<a name="line.216"></a>
+<FONT color="green">217</FONT>            interpolator.reinitialize(stepStart, stepSize, scaled, nordsieck);<a name="line.217"></a>
+<FONT color="green">218</FONT>            interpolator.storeTime(stepStart);<a name="line.218"></a>
+<FONT color="green">219</FONT>            final int lastRow = nordsieck.getRowDimension() - 1;<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>            // reuse the step that was chosen by the starter integrator<a name="line.221"></a>
+<FONT color="green">222</FONT>            double hNew = stepSize;<a name="line.222"></a>
+<FONT color="green">223</FONT>            interpolator.rescale(hNew);<a name="line.223"></a>
+<FONT color="green">224</FONT>    <a name="line.224"></a>
+<FONT color="green">225</FONT>            boolean lastStep = false;<a name="line.225"></a>
+<FONT color="green">226</FONT>            while (!lastStep) {<a name="line.226"></a>
+<FONT color="green">227</FONT>    <a name="line.227"></a>
+<FONT color="green">228</FONT>                // shift all data<a name="line.228"></a>
+<FONT color="green">229</FONT>                interpolator.shift();<a name="line.229"></a>
+<FONT color="green">230</FONT>    <a name="line.230"></a>
+<FONT color="green">231</FONT>                double error = 0;<a name="line.231"></a>
+<FONT color="green">232</FONT>                for (boolean loop = true; loop;) {<a name="line.232"></a>
+<FONT color="green">233</FONT>    <a name="line.233"></a>
+<FONT color="green">234</FONT>                    stepSize = hNew;<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>                    // evaluate error using the last term of the Taylor expansion<a name="line.236"></a>
+<FONT color="green">237</FONT>                    error = 0;<a name="line.237"></a>
+<FONT color="green">238</FONT>                    for (int i = 0; i &lt; y0.length; ++i) {<a name="line.238"></a>
+<FONT color="green">239</FONT>                        final double yScale = Math.abs(y[i]);<a name="line.239"></a>
+<FONT color="green">240</FONT>                        final double tol = (vecAbsoluteTolerance == null) ?<a name="line.240"></a>
+<FONT color="green">241</FONT>                                           (scalAbsoluteTolerance + scalRelativeTolerance * yScale) :<a name="line.241"></a>
+<FONT color="green">242</FONT>                                           (vecAbsoluteTolerance[i] + vecRelativeTolerance[i] * yScale);<a name="line.242"></a>
+<FONT color="green">243</FONT>                        final double ratio  = nordsieck.getEntry(lastRow, i) / tol;<a name="line.243"></a>
+<FONT color="green">244</FONT>                        error += ratio * ratio;<a name="line.244"></a>
+<FONT color="green">245</FONT>                    }<a name="line.245"></a>
+<FONT color="green">246</FONT>                    error = Math.sqrt(error / y0.length);<a name="line.246"></a>
+<FONT color="green">247</FONT>    <a name="line.247"></a>
+<FONT color="green">248</FONT>                    if (error &lt;= 1.0) {<a name="line.248"></a>
+<FONT color="green">249</FONT>    <a name="line.249"></a>
+<FONT color="green">250</FONT>                        // predict a first estimate of the state at step end<a name="line.250"></a>
+<FONT color="green">251</FONT>                        final double stepEnd = stepStart + stepSize;<a name="line.251"></a>
+<FONT color="green">252</FONT>                        interpolator.setInterpolatedTime(stepEnd);<a name="line.252"></a>
+<FONT color="green">253</FONT>                        System.arraycopy(interpolator.getInterpolatedState(), 0, yTmp, 0, y0.length);<a name="line.253"></a>
+<FONT color="green">254</FONT>    <a name="line.254"></a>
+<FONT color="green">255</FONT>                        // evaluate the derivative<a name="line.255"></a>
+<FONT color="green">256</FONT>                        computeDerivatives(stepEnd, yTmp, yDot);<a name="line.256"></a>
+<FONT color="green">257</FONT>    <a name="line.257"></a>
+<FONT color="green">258</FONT>                        // update Nordsieck vector<a name="line.258"></a>
+<FONT color="green">259</FONT>                        final double[] predictedScaled = new double[y0.length];<a name="line.259"></a>
+<FONT color="green">260</FONT>                        for (int j = 0; j &lt; y0.length; ++j) {<a name="line.260"></a>
+<FONT color="green">261</FONT>                            predictedScaled[j] = stepSize * yDot[j];<a name="line.261"></a>
+<FONT color="green">262</FONT>                        }<a name="line.262"></a>
+<FONT color="green">263</FONT>                        final Array2DRowRealMatrix nordsieckTmp = updateHighOrderDerivativesPhase1(nordsieck);<a name="line.263"></a>
+<FONT color="green">264</FONT>                        updateHighOrderDerivativesPhase2(scaled, predictedScaled, nordsieckTmp);<a name="line.264"></a>
+<FONT color="green">265</FONT>    <a name="line.265"></a>
+<FONT color="green">266</FONT>                        // discrete events handling<a name="line.266"></a>
+<FONT color="green">267</FONT>                        interpolatorTmp.reinitialize(stepEnd, stepSize, predictedScaled, nordsieckTmp);<a name="line.267"></a>
+<FONT color="green">268</FONT>                        interpolatorTmp.storeTime(stepStart);<a name="line.268"></a>
+<FONT color="green">269</FONT>                        interpolatorTmp.shift();<a name="line.269"></a>
+<FONT color="green">270</FONT>                        interpolatorTmp.storeTime(stepEnd);<a name="line.270"></a>
+<FONT color="green">271</FONT>                        if (manager.evaluateStep(interpolatorTmp)) {<a name="line.271"></a>
+<FONT color="green">272</FONT>                            final double dt = manager.getEventTime() - stepStart;<a name="line.272"></a>
+<FONT color="green">273</FONT>                            if (Math.abs(dt) &lt;= Math.ulp(stepStart)) {<a name="line.273"></a>
+<FONT color="green">274</FONT>                                // we cannot simply truncate the step, reject the current computation<a name="line.274"></a>
+<FONT color="green">275</FONT>                                // and let the loop compute another state with the truncated step.<a name="line.275"></a>
+<FONT color="green">276</FONT>                                // it is so small (much probably exactly 0 due to limited accuracy)<a name="line.276"></a>
+<FONT color="green">277</FONT>                                // that the code above would fail handling it.<a name="line.277"></a>
+<FONT color="green">278</FONT>                                // So we set up an artificial 0 size step by copying states<a name="line.278"></a>
+<FONT color="green">279</FONT>                                interpolator.storeTime(stepStart);<a name="line.279"></a>
+<FONT color="green">280</FONT>                                System.arraycopy(y, 0, yTmp, 0, y0.length);<a name="line.280"></a>
+<FONT color="green">281</FONT>                                hNew     = 0;<a name="line.281"></a>
+<FONT color="green">282</FONT>                                stepSize = 0;<a name="line.282"></a>
+<FONT color="green">283</FONT>                                loop     = false;<a name="line.283"></a>
+<FONT color="green">284</FONT>                            } else {<a name="line.284"></a>
+<FONT color="green">285</FONT>                                // reject the step to match exactly the next switch time<a name="line.285"></a>
+<FONT color="green">286</FONT>                                hNew = dt;<a name="line.286"></a>
+<FONT color="green">287</FONT>                                interpolator.rescale(hNew);<a name="line.287"></a>
+<FONT color="green">288</FONT>                            }<a name="line.288"></a>
+<FONT color="green">289</FONT>                        } else {<a name="line.289"></a>
+<FONT color="green">290</FONT>                            // accept the step<a name="line.290"></a>
+<FONT color="green">291</FONT>                            scaled    = predictedScaled;<a name="line.291"></a>
+<FONT color="green">292</FONT>                            nordsieck = nordsieckTmp;<a name="line.292"></a>
+<FONT color="green">293</FONT>                            interpolator.reinitialize(stepEnd, stepSize, scaled, nordsieck);<a name="line.293"></a>
+<FONT color="green">294</FONT>                            loop = false;<a name="line.294"></a>
+<FONT color="green">295</FONT>                        }<a name="line.295"></a>
+<FONT color="green">296</FONT>    <a name="line.296"></a>
+<FONT color="green">297</FONT>                    } else {<a name="line.297"></a>
+<FONT color="green">298</FONT>                        // reject the step and attempt to reduce error by stepsize control<a name="line.298"></a>
+<FONT color="green">299</FONT>                        final double factor = computeStepGrowShrinkFactor(error);<a name="line.299"></a>
+<FONT color="green">300</FONT>                        hNew = filterStep(stepSize * factor, forward, false);<a name="line.300"></a>
+<FONT color="green">301</FONT>                        interpolator.rescale(hNew);<a name="line.301"></a>
+<FONT color="green">302</FONT>                    }<a name="line.302"></a>
+<FONT color="green">303</FONT>    <a name="line.303"></a>
+<FONT color="green">304</FONT>                }<a name="line.304"></a>
+<FONT color="green">305</FONT>    <a name="line.305"></a>
+<FONT color="green">306</FONT>                // the step has been accepted (may have been truncated)<a name="line.306"></a>
+<FONT color="green">307</FONT>                final double nextStep = stepStart + stepSize;<a name="line.307"></a>
+<FONT color="green">308</FONT>                System.arraycopy(yTmp, 0, y, 0, n);<a name="line.308"></a>
+<FONT color="green">309</FONT>                interpolator.storeTime(nextStep);<a name="line.309"></a>
+<FONT color="green">310</FONT>                manager.stepAccepted(nextStep, y);<a name="line.310"></a>
+<FONT color="green">311</FONT>                lastStep = manager.stop();<a name="line.311"></a>
+<FONT color="green">312</FONT>    <a name="line.312"></a>
+<FONT color="green">313</FONT>                // provide the step data to the step handler<a name="line.313"></a>
+<FONT color="green">314</FONT>                for (StepHandler handler : stepHandlers) {<a name="line.314"></a>
+<FONT color="green">315</FONT>                    interpolator.setInterpolatedTime(nextStep);<a name="line.315"></a>
+<FONT color="green">316</FONT>                    handler.handleStep(interpolator, lastStep);<a name="line.316"></a>
+<FONT color="green">317</FONT>                }<a name="line.317"></a>
+<FONT color="green">318</FONT>                stepStart = nextStep;<a name="line.318"></a>
+<FONT color="green">319</FONT>    <a name="line.319"></a>
+<FONT color="green">320</FONT>                if (!lastStep &amp;&amp; manager.reset(stepStart, y)) {<a name="line.320"></a>
+<FONT color="green">321</FONT>    <a name="line.321"></a>
+<FONT color="green">322</FONT>                    // some events handler has triggered changes that<a name="line.322"></a>
+<FONT color="green">323</FONT>                    // invalidate the derivatives, we need to restart from scratch<a name="line.323"></a>
+<FONT color="green">324</FONT>                    start(stepStart, y, t);<a name="line.324"></a>
+<FONT color="green">325</FONT>                    interpolator.reinitialize(stepStart, stepSize, scaled, nordsieck);<a name="line.325"></a>
+<FONT color="green">326</FONT>    <a name="line.326"></a>
+<FONT color="green">327</FONT>                }<a name="line.327"></a>
+<FONT color="green">328</FONT>    <a name="line.328"></a>
+<FONT color="green">329</FONT>                if (! lastStep) {<a name="line.329"></a>
+<FONT color="green">330</FONT>                    // in some rare cases we may get here with stepSize = 0, for example<a name="line.330"></a>
+<FONT color="green">331</FONT>                    // when an event occurs at integration start, reducing the first step<a name="line.331"></a>
+<FONT color="green">332</FONT>                    // to zero; we have to reset the step to some safe non zero value<a name="line.332"></a>
+<FONT color="green">333</FONT>                    stepSize = filterStep(stepSize, forward, true);<a name="line.333"></a>
+<FONT color="green">334</FONT>    <a name="line.334"></a>
+<FONT color="green">335</FONT>                    // stepsize control for next step<a name="line.335"></a>
+<FONT color="green">336</FONT>                    final double  factor     = computeStepGrowShrinkFactor(error);<a name="line.336"></a>
+<FONT color="green">337</FONT>                    final double  scaledH    = stepSize * factor;<a name="line.337"></a>
+<FONT color="green">338</FONT>                    final double  nextT      = stepStart + scaledH;<a name="line.338"></a>
+<FONT color="green">339</FONT>                    final boolean nextIsLast = forward ? (nextT &gt;= t) : (nextT &lt;= t);<a name="line.339"></a>
+<FONT color="green">340</FONT>                    hNew = filterStep(scaledH, forward, nextIsLast);<a name="line.340"></a>
+<FONT color="green">341</FONT>                    interpolator.rescale(hNew);<a name="line.341"></a>
+<FONT color="green">342</FONT>                }<a name="line.342"></a>
+<FONT color="green">343</FONT>    <a name="line.343"></a>
+<FONT color="green">344</FONT>            }<a name="line.344"></a>
+<FONT color="green">345</FONT>    <a name="line.345"></a>
+<FONT color="green">346</FONT>            final double stopTime  = stepStart;<a name="line.346"></a>
+<FONT color="green">347</FONT>            stepStart = Double.NaN;<a name="line.347"></a>
+<FONT color="green">348</FONT>            stepSize  = Double.NaN;<a name="line.348"></a>
+<FONT color="green">349</FONT>            return stopTime;<a name="line.349"></a>
+<FONT color="green">350</FONT>    <a name="line.350"></a>
+<FONT color="green">351</FONT>        }<a name="line.351"></a>
+<FONT color="green">352</FONT>    <a name="line.352"></a>
+<FONT color="green">353</FONT>    }<a name="line.353"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/AdamsIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,197 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.nonstiff;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.linear.Array2DRowRealMatrix;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.ode.FirstOrderDifferentialEquations;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.ode.IntegratorException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.ode.MultistepIntegrator;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    /** Base class for {@link AdamsBashforthIntegrator Adams-Bashforth} and<a name="line.27"></a>
+<FONT color="green">028</FONT>     * {@link AdamsMoultonIntegrator Adams-Moulton} integrators.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @version $Revision: 790368 $ $Date: 2009-07-01 16:31:50 -0400 (Wed, 01 Jul 2009) $<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @since 2.0<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    public abstract class AdamsIntegrator extends MultistepIntegrator {<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /** Transformer. */<a name="line.34"></a>
+<FONT color="green">035</FONT>        private final AdamsNordsieckTransformer transformer;<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /**<a name="line.37"></a>
+<FONT color="green">038</FONT>         * Build an Adams integrator with the given order and step control prameters.<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @param name name of the method<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @param nSteps number of steps of the method excluding the one being computed<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @param order order of the method<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @param minStep minimal step (must be positive even for backward<a name="line.42"></a>
+<FONT color="green">043</FONT>         * integration), the last step can be smaller than this<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @param maxStep maximal step (must be positive even for backward<a name="line.44"></a>
+<FONT color="green">045</FONT>         * integration)<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param scalAbsoluteTolerance allowed absolute error<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @param scalRelativeTolerance allowed relative error<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @exception IllegalArgumentException if order is 1 or less<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        public AdamsIntegrator(final String name, final int nSteps, final int order,<a name="line.50"></a>
+<FONT color="green">051</FONT>                               final double minStep, final double maxStep,<a name="line.51"></a>
+<FONT color="green">052</FONT>                               final double scalAbsoluteTolerance,<a name="line.52"></a>
+<FONT color="green">053</FONT>                               final double scalRelativeTolerance)<a name="line.53"></a>
+<FONT color="green">054</FONT>            throws IllegalArgumentException {<a name="line.54"></a>
+<FONT color="green">055</FONT>            super(name, nSteps, order, minStep, maxStep,<a name="line.55"></a>
+<FONT color="green">056</FONT>                  scalAbsoluteTolerance, scalRelativeTolerance);<a name="line.56"></a>
+<FONT color="green">057</FONT>            transformer = AdamsNordsieckTransformer.getInstance(nSteps);<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /**<a name="line.60"></a>
+<FONT color="green">061</FONT>         * Build an Adams integrator with the given order and step control parameters.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param name name of the method<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @param nSteps number of steps of the method excluding the one being computed<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @param order order of the method<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param minStep minimal step (must be positive even for backward<a name="line.65"></a>
+<FONT color="green">066</FONT>         * integration), the last step can be smaller than this<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @param maxStep maximal step (must be positive even for backward<a name="line.67"></a>
+<FONT color="green">068</FONT>         * integration)<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @param vecAbsoluteTolerance allowed absolute error<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @param vecRelativeTolerance allowed relative error<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @exception IllegalArgumentException if order is 1 or less<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        public AdamsIntegrator(final String name, final int nSteps, final int order,<a name="line.73"></a>
+<FONT color="green">074</FONT>                               final double minStep, final double maxStep,<a name="line.74"></a>
+<FONT color="green">075</FONT>                               final double[] vecAbsoluteTolerance,<a name="line.75"></a>
+<FONT color="green">076</FONT>                               final double[] vecRelativeTolerance)<a name="line.76"></a>
+<FONT color="green">077</FONT>            throws IllegalArgumentException {<a name="line.77"></a>
+<FONT color="green">078</FONT>            super(name, nSteps, order, minStep, maxStep,<a name="line.78"></a>
+<FONT color="green">079</FONT>                  vecAbsoluteTolerance, vecRelativeTolerance);<a name="line.79"></a>
+<FONT color="green">080</FONT>            transformer = AdamsNordsieckTransformer.getInstance(nSteps);<a name="line.80"></a>
+<FONT color="green">081</FONT>        }<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /** {@inheritDoc} */<a name="line.83"></a>
+<FONT color="green">084</FONT>        @Override<a name="line.84"></a>
+<FONT color="green">085</FONT>        public abstract double integrate(final FirstOrderDifferentialEquations equations,<a name="line.85"></a>
+<FONT color="green">086</FONT>                                         final double t0, final double[] y0,<a name="line.86"></a>
+<FONT color="green">087</FONT>                                         final double t, final double[] y)<a name="line.87"></a>
+<FONT color="green">088</FONT>            throws DerivativeException, IntegratorException;<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>        /** {@inheritDoc} */<a name="line.90"></a>
+<FONT color="green">091</FONT>        @Override<a name="line.91"></a>
+<FONT color="green">092</FONT>        protected Array2DRowRealMatrix initializeHighOrderDerivatives(final double[] first,<a name="line.92"></a>
+<FONT color="green">093</FONT>                                                            final double[][] multistep) {<a name="line.93"></a>
+<FONT color="green">094</FONT>            return transformer.initializeHighOrderDerivatives(first, multistep);<a name="line.94"></a>
+<FONT color="green">095</FONT>        }<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /** Update the high order scaled derivatives for Adams integrators (phase 1).<a name="line.97"></a>
+<FONT color="green">098</FONT>         * &lt;p&gt;The complete update of high order derivatives has a form similar to:<a name="line.98"></a>
+<FONT color="green">099</FONT>         * &lt;pre&gt;<a name="line.99"></a>
+<FONT color="green">100</FONT>         * r&lt;sub&gt;n+1&lt;/sub&gt; = (s&lt;sub&gt;1&lt;/sub&gt;(n) - s&lt;sub&gt;1&lt;/sub&gt;(n+1)) P&lt;sup&gt;-1&lt;/sup&gt; u + P&lt;sup&gt;-1&lt;/sup&gt; A P r&lt;sub&gt;n&lt;/sub&gt;<a name="line.100"></a>
+<FONT color="green">101</FONT>         * &lt;/pre&gt;<a name="line.101"></a>
+<FONT color="green">102</FONT>         * this method computes the P&lt;sup&gt;-1&lt;/sup&gt; A P r&lt;sub&gt;n&lt;/sub&gt; part.&lt;/p&gt;<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @param highOrder high order scaled derivatives<a name="line.103"></a>
+<FONT color="green">104</FONT>         * (h&lt;sup&gt;2&lt;/sup&gt;/2 y'', ... h&lt;sup&gt;k&lt;/sup&gt;/k! y(k))<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @return updated high order derivatives<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @see #updateHighOrderDerivativesPhase2(double[], double[], Array2DRowRealMatrix)<a name="line.106"></a>
+<FONT color="green">107</FONT>         */<a name="line.107"></a>
+<FONT color="green">108</FONT>        public Array2DRowRealMatrix updateHighOrderDerivativesPhase1(final Array2DRowRealMatrix highOrder) {<a name="line.108"></a>
+<FONT color="green">109</FONT>            return transformer.updateHighOrderDerivativesPhase1(highOrder);<a name="line.109"></a>
+<FONT color="green">110</FONT>        }<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>        /** Update the high order scaled derivatives Adams integrators (phase 2).<a name="line.112"></a>
+<FONT color="green">113</FONT>         * &lt;p&gt;The complete update of high order derivatives has a form similar to:<a name="line.113"></a>
+<FONT color="green">114</FONT>         * &lt;pre&gt;<a name="line.114"></a>
+<FONT color="green">115</FONT>         * r&lt;sub&gt;n+1&lt;/sub&gt; = (s&lt;sub&gt;1&lt;/sub&gt;(n) - s&lt;sub&gt;1&lt;/sub&gt;(n+1)) P&lt;sup&gt;-1&lt;/sup&gt; u + P&lt;sup&gt;-1&lt;/sup&gt; A P r&lt;sub&gt;n&lt;/sub&gt;<a name="line.115"></a>
+<FONT color="green">116</FONT>         * &lt;/pre&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * this method computes the (s&lt;sub&gt;1&lt;/sub&gt;(n) - s&lt;sub&gt;1&lt;/sub&gt;(n+1)) P&lt;sup&gt;-1&lt;/sup&gt; u part.&lt;/p&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>         * &lt;p&gt;Phase 1 of the update must already have been performed.&lt;/p&gt;<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @param start first order scaled derivatives at step start<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @param end first order scaled derivatives at step end<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @param highOrder high order scaled derivatives, will be modified<a name="line.121"></a>
+<FONT color="green">122</FONT>         * (h&lt;sup&gt;2&lt;/sup&gt;/2 y'', ... h&lt;sup&gt;k&lt;/sup&gt;/k! y(k))<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @see #updateHighOrderDerivativesPhase1(Array2DRowRealMatrix)<a name="line.123"></a>
+<FONT color="green">124</FONT>         */<a name="line.124"></a>
+<FONT color="green">125</FONT>        public void updateHighOrderDerivativesPhase2(final double[] start,<a name="line.125"></a>
+<FONT color="green">126</FONT>                                                     final double[] end,<a name="line.126"></a>
+<FONT color="green">127</FONT>                                                     final Array2DRowRealMatrix highOrder) {<a name="line.127"></a>
+<FONT color="green">128</FONT>            transformer.updateHighOrderDerivativesPhase2(start, end, highOrder);<a name="line.128"></a>
+<FONT color="green">129</FONT>        }<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>    }<a name="line.131"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,514 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.nonstiff;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.linear.Array2DRowRealMatrix;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.linear.MatrixVisitorException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.linear.RealMatrixPreservingVisitor;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.ode.FirstOrderDifferentialEquations;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.ode.IntegratorException;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.ode.events.CombinedEventsManager;<a name="line.28"></a>
+<FONT color="green">029</FONT>    import org.apache.commons.math.ode.sampling.NordsieckStepInterpolator;<a name="line.29"></a>
+<FONT color="green">030</FONT>    import org.apache.commons.math.ode.sampling.StepHandler;<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>    /**<a name="line.33"></a>
+<FONT color="green">034</FONT>     * This class implements implicit Adams-Moulton integrators for Ordinary<a name="line.34"></a>
+<FONT color="green">035</FONT>     * Differential Equations.<a name="line.35"></a>
+<FONT color="green">036</FONT>     *<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;p&gt;Adams-Moulton methods (in fact due to Adams alone) are implicit<a name="line.37"></a>
+<FONT color="green">038</FONT>     * multistep ODE solvers. This implementation is a variation of the classical<a name="line.38"></a>
+<FONT color="green">039</FONT>     * one: it uses adaptive stepsize to implement error control, whereas<a name="line.39"></a>
+<FONT color="green">040</FONT>     * classical implementations are fixed step size. The value of state vector<a name="line.40"></a>
+<FONT color="green">041</FONT>     * at step n+1 is a simple combination of the value at step n and of the<a name="line.41"></a>
+<FONT color="green">042</FONT>     * derivatives at steps n+1, n, n-1 ... Since y'&lt;sub&gt;n+1&lt;/sub&gt; is needed to<a name="line.42"></a>
+<FONT color="green">043</FONT>     * compute y&lt;sub&gt;n+1&lt;/sub&gt;,another method must be used to compute a first<a name="line.43"></a>
+<FONT color="green">044</FONT>     * estimate of y&lt;sub&gt;n+1&lt;/sub&gt;, then compute y'&lt;sub&gt;n+1&lt;/sub&gt;, then compute<a name="line.44"></a>
+<FONT color="green">045</FONT>     * a final estimate of y&lt;sub&gt;n+1&lt;/sub&gt; using the following formulas. Depending<a name="line.45"></a>
+<FONT color="green">046</FONT>     * on the number k of previous steps one wants to use for computing the next<a name="line.46"></a>
+<FONT color="green">047</FONT>     * value, different formulas are available for the final estimate:&lt;/p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     * &lt;ul&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>     *   &lt;li&gt;k = 1: y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + h y'&lt;sub&gt;n+1&lt;/sub&gt;&lt;/li&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     *   &lt;li&gt;k = 2: y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + h (y'&lt;sub&gt;n+1&lt;/sub&gt;+y'&lt;sub&gt;n&lt;/sub&gt;)/2&lt;/li&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>     *   &lt;li&gt;k = 3: y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + h (5y'&lt;sub&gt;n+1&lt;/sub&gt;+8y'&lt;sub&gt;n&lt;/sub&gt;-y'&lt;sub&gt;n-1&lt;/sub&gt;)/12&lt;/li&gt;<a name="line.51"></a>
+<FONT color="green">052</FONT>     *   &lt;li&gt;k = 4: y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + h (9y'&lt;sub&gt;n+1&lt;/sub&gt;+19y'&lt;sub&gt;n&lt;/sub&gt;-5y'&lt;sub&gt;n-1&lt;/sub&gt;+y'&lt;sub&gt;n-2&lt;/sub&gt;)/24&lt;/li&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>     *   &lt;li&gt;...&lt;/li&gt;<a name="line.53"></a>
+<FONT color="green">054</FONT>     * &lt;/ul&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>     *<a name="line.55"></a>
+<FONT color="green">056</FONT>     * &lt;p&gt;A k-steps Adams-Moulton method is of order k+1.&lt;/p&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>     *<a name="line.57"></a>
+<FONT color="green">058</FONT>     * &lt;h3&gt;Implementation details&lt;/h3&gt;<a name="line.58"></a>
+<FONT color="green">059</FONT>     *<a name="line.59"></a>
+<FONT color="green">060</FONT>     * &lt;p&gt;We define scaled derivatives s&lt;sub&gt;i&lt;/sub&gt;(n) at step n as:<a name="line.60"></a>
+<FONT color="green">061</FONT>     * &lt;pre&gt;<a name="line.61"></a>
+<FONT color="green">062</FONT>     * s&lt;sub&gt;1&lt;/sub&gt;(n) = h y'&lt;sub&gt;n&lt;/sub&gt; for first derivative<a name="line.62"></a>
+<FONT color="green">063</FONT>     * s&lt;sub&gt;2&lt;/sub&gt;(n) = h&lt;sup&gt;2&lt;/sup&gt;/2 y''&lt;sub&gt;n&lt;/sub&gt; for second derivative<a name="line.63"></a>
+<FONT color="green">064</FONT>     * s&lt;sub&gt;3&lt;/sub&gt;(n) = h&lt;sup&gt;3&lt;/sup&gt;/6 y'''&lt;sub&gt;n&lt;/sub&gt; for third derivative<a name="line.64"></a>
+<FONT color="green">065</FONT>     * ...<a name="line.65"></a>
+<FONT color="green">066</FONT>     * s&lt;sub&gt;k&lt;/sub&gt;(n) = h&lt;sup&gt;k&lt;/sup&gt;/k! y(k)&lt;sub&gt;n&lt;/sub&gt; for k&lt;sup&gt;th&lt;/sup&gt; derivative<a name="line.66"></a>
+<FONT color="green">067</FONT>     * &lt;/pre&gt;&lt;/p&gt;<a name="line.67"></a>
+<FONT color="green">068</FONT>     *<a name="line.68"></a>
+<FONT color="green">069</FONT>     * &lt;p&gt;The definitions above use the classical representation with several previous first<a name="line.69"></a>
+<FONT color="green">070</FONT>     * derivatives. Lets define<a name="line.70"></a>
+<FONT color="green">071</FONT>     * &lt;pre&gt;<a name="line.71"></a>
+<FONT color="green">072</FONT>     *   q&lt;sub&gt;n&lt;/sub&gt; = [ s&lt;sub&gt;1&lt;/sub&gt;(n-1) s&lt;sub&gt;1&lt;/sub&gt;(n-2) ... s&lt;sub&gt;1&lt;/sub&gt;(n-(k-1)) ]&lt;sup&gt;T&lt;/sup&gt;<a name="line.72"></a>
+<FONT color="green">073</FONT>     * &lt;/pre&gt;<a name="line.73"></a>
+<FONT color="green">074</FONT>     * (we omit the k index in the notation for clarity). With these definitions,<a name="line.74"></a>
+<FONT color="green">075</FONT>     * Adams-Moulton methods can be written:<a name="line.75"></a>
+<FONT color="green">076</FONT>     * &lt;ul&gt;<a name="line.76"></a>
+<FONT color="green">077</FONT>     *   &lt;li&gt;k = 1: y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + s&lt;sub&gt;1&lt;/sub&gt;(n+1)&lt;/li&gt;<a name="line.77"></a>
+<FONT color="green">078</FONT>     *   &lt;li&gt;k = 2: y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + 1/2 s&lt;sub&gt;1&lt;/sub&gt;(n+1) + [ 1/2 ] q&lt;sub&gt;n+1&lt;/sub&gt;&lt;/li&gt;<a name="line.78"></a>
+<FONT color="green">079</FONT>     *   &lt;li&gt;k = 3: y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + 5/12 s&lt;sub&gt;1&lt;/sub&gt;(n+1) + [ 8/12 -1/12 ] q&lt;sub&gt;n+1&lt;/sub&gt;&lt;/li&gt;<a name="line.79"></a>
+<FONT color="green">080</FONT>     *   &lt;li&gt;k = 4: y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + 9/24 s&lt;sub&gt;1&lt;/sub&gt;(n+1) + [ 19/24 -5/24 1/24 ] q&lt;sub&gt;n+1&lt;/sub&gt;&lt;/li&gt;<a name="line.80"></a>
+<FONT color="green">081</FONT>     *   &lt;li&gt;...&lt;/li&gt;<a name="line.81"></a>
+<FONT color="green">082</FONT>     * &lt;/ul&gt;&lt;/p&gt;<a name="line.82"></a>
+<FONT color="green">083</FONT>     *<a name="line.83"></a>
+<FONT color="green">084</FONT>     * &lt;p&gt;Instead of using the classical representation with first derivatives only (y&lt;sub&gt;n&lt;/sub&gt;,<a name="line.84"></a>
+<FONT color="green">085</FONT>     * s&lt;sub&gt;1&lt;/sub&gt;(n+1) and q&lt;sub&gt;n+1&lt;/sub&gt;), our implementation uses the Nordsieck vector with<a name="line.85"></a>
+<FONT color="green">086</FONT>     * higher degrees scaled derivatives all taken at the same step (y&lt;sub&gt;n&lt;/sub&gt;, s&lt;sub&gt;1&lt;/sub&gt;(n)<a name="line.86"></a>
+<FONT color="green">087</FONT>     * and r&lt;sub&gt;n&lt;/sub&gt;) where r&lt;sub&gt;n&lt;/sub&gt; is defined as:<a name="line.87"></a>
+<FONT color="green">088</FONT>     * &lt;pre&gt;<a name="line.88"></a>
+<FONT color="green">089</FONT>     * r&lt;sub&gt;n&lt;/sub&gt; = [ s&lt;sub&gt;2&lt;/sub&gt;(n), s&lt;sub&gt;3&lt;/sub&gt;(n) ... s&lt;sub&gt;k&lt;/sub&gt;(n) ]&lt;sup&gt;T&lt;/sup&gt;<a name="line.89"></a>
+<FONT color="green">090</FONT>     * &lt;/pre&gt;<a name="line.90"></a>
+<FONT color="green">091</FONT>     * (here again we omit the k index in the notation for clarity)<a name="line.91"></a>
+<FONT color="green">092</FONT>     * &lt;/p&gt;<a name="line.92"></a>
+<FONT color="green">093</FONT>     *<a name="line.93"></a>
+<FONT color="green">094</FONT>     * &lt;p&gt;Taylor series formulas show that for any index offset i, s&lt;sub&gt;1&lt;/sub&gt;(n-i) can be<a name="line.94"></a>
+<FONT color="green">095</FONT>     * computed from s&lt;sub&gt;1&lt;/sub&gt;(n), s&lt;sub&gt;2&lt;/sub&gt;(n) ... s&lt;sub&gt;k&lt;/sub&gt;(n), the formula being exact<a name="line.95"></a>
+<FONT color="green">096</FONT>     * for degree k polynomials.<a name="line.96"></a>
+<FONT color="green">097</FONT>     * &lt;pre&gt;<a name="line.97"></a>
+<FONT color="green">098</FONT>     * s&lt;sub&gt;1&lt;/sub&gt;(n-i) = s&lt;sub&gt;1&lt;/sub&gt;(n) + &amp;sum;&lt;sub&gt;j&lt;/sub&gt; j (-i)&lt;sup&gt;j-1&lt;/sup&gt; s&lt;sub&gt;j&lt;/sub&gt;(n)<a name="line.98"></a>
+<FONT color="green">099</FONT>     * &lt;/pre&gt;<a name="line.99"></a>
+<FONT color="green">100</FONT>     * The previous formula can be used with several values for i to compute the transform between<a name="line.100"></a>
+<FONT color="green">101</FONT>     * classical representation and Nordsieck vector. The transform between r&lt;sub&gt;n&lt;/sub&gt;<a name="line.101"></a>
+<FONT color="green">102</FONT>     * and q&lt;sub&gt;n&lt;/sub&gt; resulting from the Taylor series formulas above is:<a name="line.102"></a>
+<FONT color="green">103</FONT>     * &lt;pre&gt;<a name="line.103"></a>
+<FONT color="green">104</FONT>     * q&lt;sub&gt;n&lt;/sub&gt; = s&lt;sub&gt;1&lt;/sub&gt;(n) u + P r&lt;sub&gt;n&lt;/sub&gt;<a name="line.104"></a>
+<FONT color="green">105</FONT>     * &lt;/pre&gt;<a name="line.105"></a>
+<FONT color="green">106</FONT>     * where u is the [ 1 1 ... 1 ]&lt;sup&gt;T&lt;/sup&gt; vector and P is the (k-1)&amp;times;(k-1) matrix built<a name="line.106"></a>
+<FONT color="green">107</FONT>     * with the j (-i)&lt;sup&gt;j-1&lt;/sup&gt; terms:<a name="line.107"></a>
+<FONT color="green">108</FONT>     * &lt;pre&gt;<a name="line.108"></a>
+<FONT color="green">109</FONT>     *        [  -2   3   -4    5  ... ]<a name="line.109"></a>
+<FONT color="green">110</FONT>     *        [  -4  12  -32   80  ... ]<a name="line.110"></a>
+<FONT color="green">111</FONT>     *   P =  [  -6  27 -108  405  ... ]<a name="line.111"></a>
+<FONT color="green">112</FONT>     *        [  -8  48 -256 1280  ... ]<a name="line.112"></a>
+<FONT color="green">113</FONT>     *        [          ...           ]<a name="line.113"></a>
+<FONT color="green">114</FONT>     * &lt;/pre&gt;&lt;/p&gt;<a name="line.114"></a>
+<FONT color="green">115</FONT>     *<a name="line.115"></a>
+<FONT color="green">116</FONT>     * &lt;p&gt;Using the Nordsieck vector has several advantages:<a name="line.116"></a>
+<FONT color="green">117</FONT>     * &lt;ul&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>     *   &lt;li&gt;it greatly simplifies step interpolation as the interpolator mainly applies<a name="line.118"></a>
+<FONT color="green">119</FONT>     *   Taylor series formulas,&lt;/li&gt;<a name="line.119"></a>
+<FONT color="green">120</FONT>     *   &lt;li&gt;it simplifies step changes that occur when discrete events that truncate<a name="line.120"></a>
+<FONT color="green">121</FONT>     *   the step are triggered,&lt;/li&gt;<a name="line.121"></a>
+<FONT color="green">122</FONT>     *   &lt;li&gt;it allows to extend the methods in order to support adaptive stepsize.&lt;/li&gt;<a name="line.122"></a>
+<FONT color="green">123</FONT>     * &lt;/ul&gt;&lt;/p&gt;<a name="line.123"></a>
+<FONT color="green">124</FONT>     *<a name="line.124"></a>
+<FONT color="green">125</FONT>     * &lt;p&gt;The predicted Nordsieck vector at step n+1 is computed from the Nordsieck vector at step<a name="line.125"></a>
+<FONT color="green">126</FONT>     * n as follows:<a name="line.126"></a>
+<FONT color="green">127</FONT>     * &lt;ul&gt;<a name="line.127"></a>
+<FONT color="green">128</FONT>     *   &lt;li&gt;Y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + s&lt;sub&gt;1&lt;/sub&gt;(n) + u&lt;sup&gt;T&lt;/sup&gt; r&lt;sub&gt;n&lt;/sub&gt;&lt;/li&gt;<a name="line.128"></a>
+<FONT color="green">129</FONT>     *   &lt;li&gt;S&lt;sub&gt;1&lt;/sub&gt;(n+1) = h f(t&lt;sub&gt;n+1&lt;/sub&gt;, Y&lt;sub&gt;n+1&lt;/sub&gt;)&lt;/li&gt;<a name="line.129"></a>
+<FONT color="green">130</FONT>     *   &lt;li&gt;R&lt;sub&gt;n+1&lt;/sub&gt; = (s&lt;sub&gt;1&lt;/sub&gt;(n) - S&lt;sub&gt;1&lt;/sub&gt;(n+1)) P&lt;sup&gt;-1&lt;/sup&gt; u + P&lt;sup&gt;-1&lt;/sup&gt; A P r&lt;sub&gt;n&lt;/sub&gt;&lt;/li&gt;<a name="line.130"></a>
+<FONT color="green">131</FONT>     * &lt;/ul&gt;<a name="line.131"></a>
+<FONT color="green">132</FONT>     * where A is a rows shifting matrix (the lower left part is an identity matrix):<a name="line.132"></a>
+<FONT color="green">133</FONT>     * &lt;pre&gt;<a name="line.133"></a>
+<FONT color="green">134</FONT>     *        [ 0 0   ...  0 0 | 0 ]<a name="line.134"></a>
+<FONT color="green">135</FONT>     *        [ ---------------+---]<a name="line.135"></a>
+<FONT color="green">136</FONT>     *        [ 1 0   ...  0 0 | 0 ]<a name="line.136"></a>
+<FONT color="green">137</FONT>     *    A = [ 0 1   ...  0 0 | 0 ]<a name="line.137"></a>
+<FONT color="green">138</FONT>     *        [       ...      | 0 ]<a name="line.138"></a>
+<FONT color="green">139</FONT>     *        [ 0 0   ...  1 0 | 0 ]<a name="line.139"></a>
+<FONT color="green">140</FONT>     *        [ 0 0   ...  0 1 | 0 ]<a name="line.140"></a>
+<FONT color="green">141</FONT>     * &lt;/pre&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>     * From this predicted vector, the corrected vector is computed as follows:<a name="line.142"></a>
+<FONT color="green">143</FONT>     * &lt;ul&gt;<a name="line.143"></a>
+<FONT color="green">144</FONT>     *   &lt;li&gt;y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + S&lt;sub&gt;1&lt;/sub&gt;(n+1) + [ -1 +1 -1 +1 ... &amp;plusmn;1 ] r&lt;sub&gt;n+1&lt;/sub&gt;&lt;/li&gt;<a name="line.144"></a>
+<FONT color="green">145</FONT>     *   &lt;li&gt;s&lt;sub&gt;1&lt;/sub&gt;(n+1) = h f(t&lt;sub&gt;n+1&lt;/sub&gt;, y&lt;sub&gt;n+1&lt;/sub&gt;)&lt;/li&gt;<a name="line.145"></a>
+<FONT color="green">146</FONT>     *   &lt;li&gt;r&lt;sub&gt;n+1&lt;/sub&gt; = R&lt;sub&gt;n+1&lt;/sub&gt; + (s&lt;sub&gt;1&lt;/sub&gt;(n+1) - S&lt;sub&gt;1&lt;/sub&gt;(n+1)) P&lt;sup&gt;-1&lt;/sup&gt; u&lt;/li&gt;<a name="line.146"></a>
+<FONT color="green">147</FONT>     * &lt;/ul&gt;<a name="line.147"></a>
+<FONT color="green">148</FONT>     * where the upper case Y&lt;sub&gt;n+1&lt;/sub&gt;, S&lt;sub&gt;1&lt;/sub&gt;(n+1) and R&lt;sub&gt;n+1&lt;/sub&gt; represent the<a name="line.148"></a>
+<FONT color="green">149</FONT>     * predicted states whereas the lower case y&lt;sub&gt;n+1&lt;/sub&gt;, s&lt;sub&gt;n+1&lt;/sub&gt; and r&lt;sub&gt;n+1&lt;/sub&gt;<a name="line.149"></a>
+<FONT color="green">150</FONT>     * represent the corrected states.&lt;/p&gt;<a name="line.150"></a>
+<FONT color="green">151</FONT>     *<a name="line.151"></a>
+<FONT color="green">152</FONT>     * &lt;p&gt;The P&lt;sup&gt;-1&lt;/sup&gt;u vector and the P&lt;sup&gt;-1&lt;/sup&gt; A P matrix do not depend on the state,<a name="line.152"></a>
+<FONT color="green">153</FONT>     * they only depend on k and therefore are precomputed once for all.&lt;/p&gt;<a name="line.153"></a>
+<FONT color="green">154</FONT>     *<a name="line.154"></a>
+<FONT color="green">155</FONT>     * @version $Revision: 927202 $ $Date: 2010-03-24 18:11:51 -0400 (Wed, 24 Mar 2010) $<a name="line.155"></a>
+<FONT color="green">156</FONT>     * @since 2.0<a name="line.156"></a>
+<FONT color="green">157</FONT>     */<a name="line.157"></a>
+<FONT color="green">158</FONT>    public class AdamsMoultonIntegrator extends AdamsIntegrator {<a name="line.158"></a>
+<FONT color="green">159</FONT>    <a name="line.159"></a>
+<FONT color="green">160</FONT>        /**<a name="line.160"></a>
+<FONT color="green">161</FONT>         * Build an Adams-Moulton integrator with the given order and error control parameters.<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @param nSteps number of steps of the method excluding the one being computed<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @param minStep minimal step (must be positive even for backward<a name="line.163"></a>
+<FONT color="green">164</FONT>         * integration), the last step can be smaller than this<a name="line.164"></a>
+<FONT color="green">165</FONT>         * @param maxStep maximal step (must be positive even for backward<a name="line.165"></a>
+<FONT color="green">166</FONT>         * integration)<a name="line.166"></a>
+<FONT color="green">167</FONT>         * @param scalAbsoluteTolerance allowed absolute error<a name="line.167"></a>
+<FONT color="green">168</FONT>         * @param scalRelativeTolerance allowed relative error<a name="line.168"></a>
+<FONT color="green">169</FONT>         * @exception IllegalArgumentException if order is 1 or less<a name="line.169"></a>
+<FONT color="green">170</FONT>         */<a name="line.170"></a>
+<FONT color="green">171</FONT>        public AdamsMoultonIntegrator(final int nSteps,<a name="line.171"></a>
+<FONT color="green">172</FONT>                                      final double minStep, final double maxStep,<a name="line.172"></a>
+<FONT color="green">173</FONT>                                      final double scalAbsoluteTolerance,<a name="line.173"></a>
+<FONT color="green">174</FONT>                                      final double scalRelativeTolerance)<a name="line.174"></a>
+<FONT color="green">175</FONT>            throws IllegalArgumentException {<a name="line.175"></a>
+<FONT color="green">176</FONT>            super("Adams-Moulton", nSteps, nSteps + 1, minStep, maxStep,<a name="line.176"></a>
+<FONT color="green">177</FONT>                  scalAbsoluteTolerance, scalRelativeTolerance);<a name="line.177"></a>
+<FONT color="green">178</FONT>        }<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>        /**<a name="line.180"></a>
+<FONT color="green">181</FONT>         * Build an Adams-Moulton integrator with the given order and error control parameters.<a name="line.181"></a>
+<FONT color="green">182</FONT>         * @param nSteps number of steps of the method excluding the one being computed<a name="line.182"></a>
+<FONT color="green">183</FONT>         * @param minStep minimal step (must be positive even for backward<a name="line.183"></a>
+<FONT color="green">184</FONT>         * integration), the last step can be smaller than this<a name="line.184"></a>
+<FONT color="green">185</FONT>         * @param maxStep maximal step (must be positive even for backward<a name="line.185"></a>
+<FONT color="green">186</FONT>         * integration)<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @param vecAbsoluteTolerance allowed absolute error<a name="line.187"></a>
+<FONT color="green">188</FONT>         * @param vecRelativeTolerance allowed relative error<a name="line.188"></a>
+<FONT color="green">189</FONT>         * @exception IllegalArgumentException if order is 1 or less<a name="line.189"></a>
+<FONT color="green">190</FONT>         */<a name="line.190"></a>
+<FONT color="green">191</FONT>        public AdamsMoultonIntegrator(final int nSteps,<a name="line.191"></a>
+<FONT color="green">192</FONT>                                      final double minStep, final double maxStep,<a name="line.192"></a>
+<FONT color="green">193</FONT>                                      final double[] vecAbsoluteTolerance,<a name="line.193"></a>
+<FONT color="green">194</FONT>                                      final double[] vecRelativeTolerance)<a name="line.194"></a>
+<FONT color="green">195</FONT>            throws IllegalArgumentException {<a name="line.195"></a>
+<FONT color="green">196</FONT>            super("Adams-Moulton", nSteps, nSteps + 1, minStep, maxStep,<a name="line.196"></a>
+<FONT color="green">197</FONT>                  vecAbsoluteTolerance, vecRelativeTolerance);<a name="line.197"></a>
+<FONT color="green">198</FONT>        }<a name="line.198"></a>
+<FONT color="green">199</FONT>    <a name="line.199"></a>
+<FONT color="green">200</FONT>    <a name="line.200"></a>
+<FONT color="green">201</FONT>        /** {@inheritDoc} */<a name="line.201"></a>
+<FONT color="green">202</FONT>        @Override<a name="line.202"></a>
+<FONT color="green">203</FONT>        public double integrate(final FirstOrderDifferentialEquations equations,<a name="line.203"></a>
+<FONT color="green">204</FONT>                                final double t0, final double[] y0,<a name="line.204"></a>
+<FONT color="green">205</FONT>                                final double t, final double[] y)<a name="line.205"></a>
+<FONT color="green">206</FONT>            throws DerivativeException, IntegratorException {<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>            final int n = y0.length;<a name="line.208"></a>
+<FONT color="green">209</FONT>            sanityChecks(equations, t0, y0, t, y);<a name="line.209"></a>
+<FONT color="green">210</FONT>            setEquations(equations);<a name="line.210"></a>
+<FONT color="green">211</FONT>            resetEvaluations();<a name="line.211"></a>
+<FONT color="green">212</FONT>            final boolean forward = t &gt; t0;<a name="line.212"></a>
+<FONT color="green">213</FONT>    <a name="line.213"></a>
+<FONT color="green">214</FONT>            // initialize working arrays<a name="line.214"></a>
+<FONT color="green">215</FONT>            if (y != y0) {<a name="line.215"></a>
+<FONT color="green">216</FONT>                System.arraycopy(y0, 0, y, 0, n);<a name="line.216"></a>
+<FONT color="green">217</FONT>            }<a name="line.217"></a>
+<FONT color="green">218</FONT>            final double[] yDot = new double[y0.length];<a name="line.218"></a>
+<FONT color="green">219</FONT>            final double[] yTmp = new double[y0.length];<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>            // set up two interpolators sharing the integrator arrays<a name="line.221"></a>
+<FONT color="green">222</FONT>            final NordsieckStepInterpolator interpolator = new NordsieckStepInterpolator();<a name="line.222"></a>
+<FONT color="green">223</FONT>            interpolator.reinitialize(y, forward);<a name="line.223"></a>
+<FONT color="green">224</FONT>            final NordsieckStepInterpolator interpolatorTmp = new NordsieckStepInterpolator();<a name="line.224"></a>
+<FONT color="green">225</FONT>            interpolatorTmp.reinitialize(yTmp, forward);<a name="line.225"></a>
+<FONT color="green">226</FONT>    <a name="line.226"></a>
+<FONT color="green">227</FONT>            // set up integration control objects<a name="line.227"></a>
+<FONT color="green">228</FONT>            for (StepHandler handler : stepHandlers) {<a name="line.228"></a>
+<FONT color="green">229</FONT>                handler.reset();<a name="line.229"></a>
+<FONT color="green">230</FONT>            }<a name="line.230"></a>
+<FONT color="green">231</FONT>            CombinedEventsManager manager = addEndTimeChecker(t0, t, eventsHandlersManager);<a name="line.231"></a>
+<FONT color="green">232</FONT>    <a name="line.232"></a>
+<FONT color="green">233</FONT>    <a name="line.233"></a>
+<FONT color="green">234</FONT>            // compute the initial Nordsieck vector using the configured starter integrator<a name="line.234"></a>
+<FONT color="green">235</FONT>            start(t0, y, t);<a name="line.235"></a>
+<FONT color="green">236</FONT>            interpolator.reinitialize(stepStart, stepSize, scaled, nordsieck);<a name="line.236"></a>
+<FONT color="green">237</FONT>            interpolator.storeTime(stepStart);<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>            double hNew = stepSize;<a name="line.239"></a>
+<FONT color="green">240</FONT>            interpolator.rescale(hNew);<a name="line.240"></a>
+<FONT color="green">241</FONT>    <a name="line.241"></a>
+<FONT color="green">242</FONT>            boolean lastStep = false;<a name="line.242"></a>
+<FONT color="green">243</FONT>            while (!lastStep) {<a name="line.243"></a>
+<FONT color="green">244</FONT>    <a name="line.244"></a>
+<FONT color="green">245</FONT>                // shift all data<a name="line.245"></a>
+<FONT color="green">246</FONT>                interpolator.shift();<a name="line.246"></a>
+<FONT color="green">247</FONT>    <a name="line.247"></a>
+<FONT color="green">248</FONT>                double error = 0;<a name="line.248"></a>
+<FONT color="green">249</FONT>                for (boolean loop = true; loop;) {<a name="line.249"></a>
+<FONT color="green">250</FONT>    <a name="line.250"></a>
+<FONT color="green">251</FONT>                    stepSize = hNew;<a name="line.251"></a>
+<FONT color="green">252</FONT>    <a name="line.252"></a>
+<FONT color="green">253</FONT>                    // predict a first estimate of the state at step end (P in the PECE sequence)<a name="line.253"></a>
+<FONT color="green">254</FONT>                    final double stepEnd = stepStart + stepSize;<a name="line.254"></a>
+<FONT color="green">255</FONT>                    interpolator.setInterpolatedTime(stepEnd);<a name="line.255"></a>
+<FONT color="green">256</FONT>                    System.arraycopy(interpolator.getInterpolatedState(), 0, yTmp, 0, y0.length);<a name="line.256"></a>
+<FONT color="green">257</FONT>    <a name="line.257"></a>
+<FONT color="green">258</FONT>                    // evaluate a first estimate of the derivative (first E in the PECE sequence)<a name="line.258"></a>
+<FONT color="green">259</FONT>                    computeDerivatives(stepEnd, yTmp, yDot);<a name="line.259"></a>
+<FONT color="green">260</FONT>    <a name="line.260"></a>
+<FONT color="green">261</FONT>                    // update Nordsieck vector<a name="line.261"></a>
+<FONT color="green">262</FONT>                    final double[] predictedScaled = new double[y0.length];<a name="line.262"></a>
+<FONT color="green">263</FONT>                    for (int j = 0; j &lt; y0.length; ++j) {<a name="line.263"></a>
+<FONT color="green">264</FONT>                        predictedScaled[j] = stepSize * yDot[j];<a name="line.264"></a>
+<FONT color="green">265</FONT>                    }<a name="line.265"></a>
+<FONT color="green">266</FONT>                    final Array2DRowRealMatrix nordsieckTmp = updateHighOrderDerivativesPhase1(nordsieck);<a name="line.266"></a>
+<FONT color="green">267</FONT>                    updateHighOrderDerivativesPhase2(scaled, predictedScaled, nordsieckTmp);<a name="line.267"></a>
+<FONT color="green">268</FONT>    <a name="line.268"></a>
+<FONT color="green">269</FONT>                    // apply correction (C in the PECE sequence)<a name="line.269"></a>
+<FONT color="green">270</FONT>                    error = nordsieckTmp.walkInOptimizedOrder(new Corrector(y, predictedScaled, yTmp));<a name="line.270"></a>
+<FONT color="green">271</FONT>    <a name="line.271"></a>
+<FONT color="green">272</FONT>                    if (error &lt;= 1.0) {<a name="line.272"></a>
+<FONT color="green">273</FONT>    <a name="line.273"></a>
+<FONT color="green">274</FONT>                        // evaluate a final estimate of the derivative (second E in the PECE sequence)<a name="line.274"></a>
+<FONT color="green">275</FONT>                        computeDerivatives(stepEnd, yTmp, yDot);<a name="line.275"></a>
+<FONT color="green">276</FONT>    <a name="line.276"></a>
+<FONT color="green">277</FONT>                        // update Nordsieck vector<a name="line.277"></a>
+<FONT color="green">278</FONT>                        final double[] correctedScaled = new double[y0.length];<a name="line.278"></a>
+<FONT color="green">279</FONT>                        for (int j = 0; j &lt; y0.length; ++j) {<a name="line.279"></a>
+<FONT color="green">280</FONT>                            correctedScaled[j] = stepSize * yDot[j];<a name="line.280"></a>
+<FONT color="green">281</FONT>                        }<a name="line.281"></a>
+<FONT color="green">282</FONT>                        updateHighOrderDerivativesPhase2(predictedScaled, correctedScaled, nordsieckTmp);<a name="line.282"></a>
+<FONT color="green">283</FONT>    <a name="line.283"></a>
+<FONT color="green">284</FONT>                        // discrete events handling<a name="line.284"></a>
+<FONT color="green">285</FONT>                        interpolatorTmp.reinitialize(stepEnd, stepSize, correctedScaled, nordsieckTmp);<a name="line.285"></a>
+<FONT color="green">286</FONT>                        interpolatorTmp.storeTime(stepStart);<a name="line.286"></a>
+<FONT color="green">287</FONT>                        interpolatorTmp.shift();<a name="line.287"></a>
+<FONT color="green">288</FONT>                        interpolatorTmp.storeTime(stepEnd);<a name="line.288"></a>
+<FONT color="green">289</FONT>                        if (manager.evaluateStep(interpolatorTmp)) {<a name="line.289"></a>
+<FONT color="green">290</FONT>                            final double dt = manager.getEventTime() - stepStart;<a name="line.290"></a>
+<FONT color="green">291</FONT>                            if (Math.abs(dt) &lt;= Math.ulp(stepStart)) {<a name="line.291"></a>
+<FONT color="green">292</FONT>                                // we cannot simply truncate the step, reject the current computation<a name="line.292"></a>
+<FONT color="green">293</FONT>                                // and let the loop compute another state with the truncated step.<a name="line.293"></a>
+<FONT color="green">294</FONT>                                // it is so small (much probably exactly 0 due to limited accuracy)<a name="line.294"></a>
+<FONT color="green">295</FONT>                                // that the code above would fail handling it.<a name="line.295"></a>
+<FONT color="green">296</FONT>                                // So we set up an artificial 0 size step by copying states<a name="line.296"></a>
+<FONT color="green">297</FONT>                                interpolator.storeTime(stepStart);<a name="line.297"></a>
+<FONT color="green">298</FONT>                                System.arraycopy(y, 0, yTmp, 0, y0.length);<a name="line.298"></a>
+<FONT color="green">299</FONT>                                hNew     = 0;<a name="line.299"></a>
+<FONT color="green">300</FONT>                                stepSize = 0;<a name="line.300"></a>
+<FONT color="green">301</FONT>                                loop     = false;<a name="line.301"></a>
+<FONT color="green">302</FONT>                            } else {<a name="line.302"></a>
+<FONT color="green">303</FONT>                                // reject the step to match exactly the next switch time<a name="line.303"></a>
+<FONT color="green">304</FONT>                                hNew = dt;<a name="line.304"></a>
+<FONT color="green">305</FONT>                                interpolator.rescale(hNew);<a name="line.305"></a>
+<FONT color="green">306</FONT>                            }<a name="line.306"></a>
+<FONT color="green">307</FONT>                        } else {<a name="line.307"></a>
+<FONT color="green">308</FONT>                            // accept the step<a name="line.308"></a>
+<FONT color="green">309</FONT>                            scaled    = correctedScaled;<a name="line.309"></a>
+<FONT color="green">310</FONT>                            nordsieck = nordsieckTmp;<a name="line.310"></a>
+<FONT color="green">311</FONT>                            interpolator.reinitialize(stepEnd, stepSize, scaled, nordsieck);<a name="line.311"></a>
+<FONT color="green">312</FONT>                            loop = false;<a name="line.312"></a>
+<FONT color="green">313</FONT>                        }<a name="line.313"></a>
+<FONT color="green">314</FONT>    <a name="line.314"></a>
+<FONT color="green">315</FONT>                    } else {<a name="line.315"></a>
+<FONT color="green">316</FONT>                        // reject the step and attempt to reduce error by stepsize control<a name="line.316"></a>
+<FONT color="green">317</FONT>                        final double factor = computeStepGrowShrinkFactor(error);<a name="line.317"></a>
+<FONT color="green">318</FONT>                        hNew = filterStep(stepSize * factor, forward, false);<a name="line.318"></a>
+<FONT color="green">319</FONT>                        interpolator.rescale(hNew);<a name="line.319"></a>
+<FONT color="green">320</FONT>                    }<a name="line.320"></a>
+<FONT color="green">321</FONT>    <a name="line.321"></a>
+<FONT color="green">322</FONT>                }<a name="line.322"></a>
+<FONT color="green">323</FONT>    <a name="line.323"></a>
+<FONT color="green">324</FONT>                // the step has been accepted (may have been truncated)<a name="line.324"></a>
+<FONT color="green">325</FONT>                final double nextStep = stepStart + stepSize;<a name="line.325"></a>
+<FONT color="green">326</FONT>                System.arraycopy(yTmp, 0, y, 0, n);<a name="line.326"></a>
+<FONT color="green">327</FONT>                interpolator.storeTime(nextStep);<a name="line.327"></a>
+<FONT color="green">328</FONT>                manager.stepAccepted(nextStep, y);<a name="line.328"></a>
+<FONT color="green">329</FONT>                lastStep = manager.stop();<a name="line.329"></a>
+<FONT color="green">330</FONT>    <a name="line.330"></a>
+<FONT color="green">331</FONT>                // provide the step data to the step handler<a name="line.331"></a>
+<FONT color="green">332</FONT>                for (StepHandler handler : stepHandlers) {<a name="line.332"></a>
+<FONT color="green">333</FONT>                    interpolator.setInterpolatedTime(nextStep);<a name="line.333"></a>
+<FONT color="green">334</FONT>                    handler.handleStep(interpolator, lastStep);<a name="line.334"></a>
+<FONT color="green">335</FONT>                }<a name="line.335"></a>
+<FONT color="green">336</FONT>                stepStart = nextStep;<a name="line.336"></a>
+<FONT color="green">337</FONT>    <a name="line.337"></a>
+<FONT color="green">338</FONT>                if (!lastStep &amp;&amp; manager.reset(stepStart, y)) {<a name="line.338"></a>
+<FONT color="green">339</FONT>    <a name="line.339"></a>
+<FONT color="green">340</FONT>                    // some events handler has triggered changes that<a name="line.340"></a>
+<FONT color="green">341</FONT>                    // invalidate the derivatives, we need to restart from scratch<a name="line.341"></a>
+<FONT color="green">342</FONT>                    start(stepStart, y, t);<a name="line.342"></a>
+<FONT color="green">343</FONT>                    interpolator.reinitialize(stepStart, stepSize, scaled, nordsieck);<a name="line.343"></a>
+<FONT color="green">344</FONT>    <a name="line.344"></a>
+<FONT color="green">345</FONT>                }<a name="line.345"></a>
+<FONT color="green">346</FONT>    <a name="line.346"></a>
+<FONT color="green">347</FONT>                if (! lastStep) {<a name="line.347"></a>
+<FONT color="green">348</FONT>                    // in some rare cases we may get here with stepSize = 0, for example<a name="line.348"></a>
+<FONT color="green">349</FONT>                    // when an event occurs at integration start, reducing the first step<a name="line.349"></a>
+<FONT color="green">350</FONT>                    // to zero; we have to reset the step to some safe non zero value<a name="line.350"></a>
+<FONT color="green">351</FONT>                    stepSize = filterStep(stepSize, forward, true);<a name="line.351"></a>
+<FONT color="green">352</FONT>    <a name="line.352"></a>
+<FONT color="green">353</FONT>                    // stepsize control for next step<a name="line.353"></a>
+<FONT color="green">354</FONT>                    final double  factor     = computeStepGrowShrinkFactor(error);<a name="line.354"></a>
+<FONT color="green">355</FONT>                    final double  scaledH    = stepSize * factor;<a name="line.355"></a>
+<FONT color="green">356</FONT>                    final double  nextT      = stepStart + scaledH;<a name="line.356"></a>
+<FONT color="green">357</FONT>                    final boolean nextIsLast = forward ? (nextT &gt;= t) : (nextT &lt;= t);<a name="line.357"></a>
+<FONT color="green">358</FONT>                    hNew = filterStep(scaledH, forward, nextIsLast);<a name="line.358"></a>
+<FONT color="green">359</FONT>                    interpolator.rescale(hNew);<a name="line.359"></a>
+<FONT color="green">360</FONT>                }<a name="line.360"></a>
+<FONT color="green">361</FONT>    <a name="line.361"></a>
+<FONT color="green">362</FONT>            }<a name="line.362"></a>
+<FONT color="green">363</FONT>    <a name="line.363"></a>
+<FONT color="green">364</FONT>            final double stopTime  = stepStart;<a name="line.364"></a>
+<FONT color="green">365</FONT>            stepStart = Double.NaN;<a name="line.365"></a>
+<FONT color="green">366</FONT>            stepSize  = Double.NaN;<a name="line.366"></a>
+<FONT color="green">367</FONT>            return stopTime;<a name="line.367"></a>
+<FONT color="green">368</FONT>    <a name="line.368"></a>
+<FONT color="green">369</FONT>        }<a name="line.369"></a>
+<FONT color="green">370</FONT>    <a name="line.370"></a>
+<FONT color="green">371</FONT>        /** Corrector for current state in Adams-Moulton method.<a name="line.371"></a>
+<FONT color="green">372</FONT>         * &lt;p&gt;<a name="line.372"></a>
+<FONT color="green">373</FONT>         * This visitor implements the Taylor series formula:<a name="line.373"></a>
+<FONT color="green">374</FONT>         * &lt;pre&gt;<a name="line.374"></a>
+<FONT color="green">375</FONT>         * Y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + s&lt;sub&gt;1&lt;/sub&gt;(n+1) + [ -1 +1 -1 +1 ... &amp;plusmn;1 ] r&lt;sub&gt;n+1&lt;/sub&gt;<a name="line.375"></a>
+<FONT color="green">376</FONT>         * &lt;/pre&gt;<a name="line.376"></a>
+<FONT color="green">377</FONT>         * &lt;/p&gt;<a name="line.377"></a>
+<FONT color="green">378</FONT>         */<a name="line.378"></a>
+<FONT color="green">379</FONT>        private class Corrector implements RealMatrixPreservingVisitor {<a name="line.379"></a>
+<FONT color="green">380</FONT>    <a name="line.380"></a>
+<FONT color="green">381</FONT>            /** Previous state. */<a name="line.381"></a>
+<FONT color="green">382</FONT>            private final double[] previous;<a name="line.382"></a>
+<FONT color="green">383</FONT>    <a name="line.383"></a>
+<FONT color="green">384</FONT>            /** Current scaled first derivative. */<a name="line.384"></a>
+<FONT color="green">385</FONT>            private final double[] scaled;<a name="line.385"></a>
+<FONT color="green">386</FONT>    <a name="line.386"></a>
+<FONT color="green">387</FONT>            /** Current state before correction. */<a name="line.387"></a>
+<FONT color="green">388</FONT>            private final double[] before;<a name="line.388"></a>
+<FONT color="green">389</FONT>    <a name="line.389"></a>
+<FONT color="green">390</FONT>            /** Current state after correction. */<a name="line.390"></a>
+<FONT color="green">391</FONT>            private final double[] after;<a name="line.391"></a>
+<FONT color="green">392</FONT>    <a name="line.392"></a>
+<FONT color="green">393</FONT>            /** Simple constructor.<a name="line.393"></a>
+<FONT color="green">394</FONT>             * @param previous previous state<a name="line.394"></a>
+<FONT color="green">395</FONT>             * @param scaled current scaled first derivative<a name="line.395"></a>
+<FONT color="green">396</FONT>             * @param state state to correct (will be overwritten after visit)<a name="line.396"></a>
+<FONT color="green">397</FONT>             */<a name="line.397"></a>
+<FONT color="green">398</FONT>            public Corrector(final double[] previous, final double[] scaled, final double[] state) {<a name="line.398"></a>
+<FONT color="green">399</FONT>                this.previous = previous;<a name="line.399"></a>
+<FONT color="green">400</FONT>                this.scaled   = scaled;<a name="line.400"></a>
+<FONT color="green">401</FONT>                this.after    = state;<a name="line.401"></a>
+<FONT color="green">402</FONT>                this.before   = state.clone();<a name="line.402"></a>
+<FONT color="green">403</FONT>            }<a name="line.403"></a>
+<FONT color="green">404</FONT>    <a name="line.404"></a>
+<FONT color="green">405</FONT>            /** {@inheritDoc} */<a name="line.405"></a>
+<FONT color="green">406</FONT>            public void start(int rows, int columns,<a name="line.406"></a>
+<FONT color="green">407</FONT>                              int startRow, int endRow, int startColumn, int endColumn) {<a name="line.407"></a>
+<FONT color="green">408</FONT>                Arrays.fill(after, 0.0);<a name="line.408"></a>
+<FONT color="green">409</FONT>            }<a name="line.409"></a>
+<FONT color="green">410</FONT>    <a name="line.410"></a>
+<FONT color="green">411</FONT>            /** {@inheritDoc} */<a name="line.411"></a>
+<FONT color="green">412</FONT>            public void visit(int row, int column, double value)<a name="line.412"></a>
+<FONT color="green">413</FONT>                throws MatrixVisitorException {<a name="line.413"></a>
+<FONT color="green">414</FONT>                if ((row &amp; 0x1) == 0) {<a name="line.414"></a>
+<FONT color="green">415</FONT>                    after[column] -= value;<a name="line.415"></a>
+<FONT color="green">416</FONT>                } else {<a name="line.416"></a>
+<FONT color="green">417</FONT>                    after[column] += value;<a name="line.417"></a>
+<FONT color="green">418</FONT>                }<a name="line.418"></a>
+<FONT color="green">419</FONT>            }<a name="line.419"></a>
+<FONT color="green">420</FONT>    <a name="line.420"></a>
+<FONT color="green">421</FONT>            /**<a name="line.421"></a>
+<FONT color="green">422</FONT>             * End visiting te Nordsieck vector.<a name="line.422"></a>
+<FONT color="green">423</FONT>             * &lt;p&gt;The correction is used to control stepsize. So its amplitude is<a name="line.423"></a>
+<FONT color="green">424</FONT>             * considered to be an error, which must be normalized according to<a name="line.424"></a>
+<FONT color="green">425</FONT>             * error control settings. If the normalized value is greater than 1,<a name="line.425"></a>
+<FONT color="green">426</FONT>             * the correction was too large and the step must be rejected.&lt;/p&gt;<a name="line.426"></a>
+<FONT color="green">427</FONT>             * @return the normalized correction, if greater than 1, the step<a name="line.427"></a>
+<FONT color="green">428</FONT>             * must be rejected<a name="line.428"></a>
+<FONT color="green">429</FONT>             */<a name="line.429"></a>
+<FONT color="green">430</FONT>            public double end() {<a name="line.430"></a>
+<FONT color="green">431</FONT>    <a name="line.431"></a>
+<FONT color="green">432</FONT>                double error = 0;<a name="line.432"></a>
+<FONT color="green">433</FONT>                for (int i = 0; i &lt; after.length; ++i) {<a name="line.433"></a>
+<FONT color="green">434</FONT>                    after[i] += previous[i] + scaled[i];<a name="line.434"></a>
+<FONT color="green">435</FONT>                    final double yScale = Math.max(Math.abs(previous[i]), Math.abs(after[i]));<a name="line.435"></a>
+<FONT color="green">436</FONT>                    final double tol = (vecAbsoluteTolerance == null) ?<a name="line.436"></a>
+<FONT color="green">437</FONT>                                       (scalAbsoluteTolerance + scalRelativeTolerance * yScale) :<a name="line.437"></a>
+<FONT color="green">438</FONT>                                       (vecAbsoluteTolerance[i] + vecRelativeTolerance[i] * yScale);<a name="line.438"></a>
+<FONT color="green">439</FONT>                    final double ratio  = (after[i] - before[i]) / tol;<a name="line.439"></a>
+<FONT color="green">440</FONT>                    error += ratio * ratio;<a name="line.440"></a>
+<FONT color="green">441</FONT>                }<a name="line.441"></a>
+<FONT color="green">442</FONT>    <a name="line.442"></a>
+<FONT color="green">443</FONT>                return Math.sqrt(error / after.length);<a name="line.443"></a>
+<FONT color="green">444</FONT>    <a name="line.444"></a>
+<FONT color="green">445</FONT>            }<a name="line.445"></a>
+<FONT color="green">446</FONT>        }<a name="line.446"></a>
+<FONT color="green">447</FONT>    <a name="line.447"></a>
+<FONT color="green">448</FONT>    }<a name="line.448"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/AdamsNordsieckTransformer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,378 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.nonstiff;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.HashMap;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.util.Map;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.fraction.BigFraction;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.linear.Array2DRowFieldMatrix;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.linear.Array2DRowRealMatrix;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.linear.DefaultFieldMatrixChangingVisitor;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.linear.FieldDecompositionSolver;<a name="line.28"></a>
+<FONT color="green">029</FONT>    import org.apache.commons.math.linear.FieldLUDecompositionImpl;<a name="line.29"></a>
+<FONT color="green">030</FONT>    import org.apache.commons.math.linear.FieldMatrix;<a name="line.30"></a>
+<FONT color="green">031</FONT>    import org.apache.commons.math.linear.MatrixUtils;<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>    /** Transformer to Nordsieck vectors for Adams integrators.<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;p&gt;This class i used by {@link AdamsBashforthIntegrator Adams-Bashforth} and<a name="line.34"></a>
+<FONT color="green">035</FONT>     * {@link AdamsMoultonIntegrator Adams-Moulton} integrators to convert between<a name="line.35"></a>
+<FONT color="green">036</FONT>     * classical representation with several previous first derivatives and Nordsieck<a name="line.36"></a>
+<FONT color="green">037</FONT>     * representation with higher order scaled derivatives.&lt;/p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     *<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;p&gt;We define scaled derivatives s&lt;sub&gt;i&lt;/sub&gt;(n) at step n as:<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;pre&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * s&lt;sub&gt;1&lt;/sub&gt;(n) = h y'&lt;sub&gt;n&lt;/sub&gt; for first derivative<a name="line.41"></a>
+<FONT color="green">042</FONT>     * s&lt;sub&gt;2&lt;/sub&gt;(n) = h&lt;sup&gt;2&lt;/sup&gt;/2 y''&lt;sub&gt;n&lt;/sub&gt; for second derivative<a name="line.42"></a>
+<FONT color="green">043</FONT>     * s&lt;sub&gt;3&lt;/sub&gt;(n) = h&lt;sup&gt;3&lt;/sup&gt;/6 y'''&lt;sub&gt;n&lt;/sub&gt; for third derivative<a name="line.43"></a>
+<FONT color="green">044</FONT>     * ...<a name="line.44"></a>
+<FONT color="green">045</FONT>     * s&lt;sub&gt;k&lt;/sub&gt;(n) = h&lt;sup&gt;k&lt;/sup&gt;/k! y(k)&lt;sub&gt;n&lt;/sub&gt; for k&lt;sup&gt;th&lt;/sup&gt; derivative<a name="line.45"></a>
+<FONT color="green">046</FONT>     * &lt;/pre&gt;&lt;/p&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     *<a name="line.47"></a>
+<FONT color="green">048</FONT>     * &lt;p&gt;With the previous definition, the classical representation of multistep methods<a name="line.48"></a>
+<FONT color="green">049</FONT>     * uses first derivatives only, i.e. it handles y&lt;sub&gt;n&lt;/sub&gt;, s&lt;sub&gt;1&lt;/sub&gt;(n) and<a name="line.49"></a>
+<FONT color="green">050</FONT>     * q&lt;sub&gt;n&lt;/sub&gt; where q&lt;sub&gt;n&lt;/sub&gt; is defined as:<a name="line.50"></a>
+<FONT color="green">051</FONT>     * &lt;pre&gt;<a name="line.51"></a>
+<FONT color="green">052</FONT>     *   q&lt;sub&gt;n&lt;/sub&gt; = [ s&lt;sub&gt;1&lt;/sub&gt;(n-1) s&lt;sub&gt;1&lt;/sub&gt;(n-2) ... s&lt;sub&gt;1&lt;/sub&gt;(n-(k-1)) ]&lt;sup&gt;T&lt;/sup&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>     * &lt;/pre&gt;<a name="line.53"></a>
+<FONT color="green">054</FONT>     * (we omit the k index in the notation for clarity).&lt;/p&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>     *<a name="line.55"></a>
+<FONT color="green">056</FONT>     * &lt;p&gt;Another possible representation uses the Nordsieck vector with<a name="line.56"></a>
+<FONT color="green">057</FONT>     * higher degrees scaled derivatives all taken at the same step, i.e it handles y&lt;sub&gt;n&lt;/sub&gt;,<a name="line.57"></a>
+<FONT color="green">058</FONT>     * s&lt;sub&gt;1&lt;/sub&gt;(n) and r&lt;sub&gt;n&lt;/sub&gt;) where r&lt;sub&gt;n&lt;/sub&gt; is defined as:<a name="line.58"></a>
+<FONT color="green">059</FONT>     * &lt;pre&gt;<a name="line.59"></a>
+<FONT color="green">060</FONT>     * r&lt;sub&gt;n&lt;/sub&gt; = [ s&lt;sub&gt;2&lt;/sub&gt;(n), s&lt;sub&gt;3&lt;/sub&gt;(n) ... s&lt;sub&gt;k&lt;/sub&gt;(n) ]&lt;sup&gt;T&lt;/sup&gt;<a name="line.60"></a>
+<FONT color="green">061</FONT>     * &lt;/pre&gt;<a name="line.61"></a>
+<FONT color="green">062</FONT>     * (here again we omit the k index in the notation for clarity)<a name="line.62"></a>
+<FONT color="green">063</FONT>     * &lt;/p&gt;<a name="line.63"></a>
+<FONT color="green">064</FONT>     *<a name="line.64"></a>
+<FONT color="green">065</FONT>     * &lt;p&gt;Taylor series formulas show that for any index offset i, s&lt;sub&gt;1&lt;/sub&gt;(n-i) can be<a name="line.65"></a>
+<FONT color="green">066</FONT>     * computed from s&lt;sub&gt;1&lt;/sub&gt;(n), s&lt;sub&gt;2&lt;/sub&gt;(n) ... s&lt;sub&gt;k&lt;/sub&gt;(n), the formula being exact<a name="line.66"></a>
+<FONT color="green">067</FONT>     * for degree k polynomials.<a name="line.67"></a>
+<FONT color="green">068</FONT>     * &lt;pre&gt;<a name="line.68"></a>
+<FONT color="green">069</FONT>     * s&lt;sub&gt;1&lt;/sub&gt;(n-i) = s&lt;sub&gt;1&lt;/sub&gt;(n) + &amp;sum;&lt;sub&gt;j&lt;/sub&gt; j (-i)&lt;sup&gt;j-1&lt;/sup&gt; s&lt;sub&gt;j&lt;/sub&gt;(n)<a name="line.69"></a>
+<FONT color="green">070</FONT>     * &lt;/pre&gt;<a name="line.70"></a>
+<FONT color="green">071</FONT>     * The previous formula can be used with several values for i to compute the transform between<a name="line.71"></a>
+<FONT color="green">072</FONT>     * classical representation and Nordsieck vector at step end. The transform between r&lt;sub&gt;n&lt;/sub&gt;<a name="line.72"></a>
+<FONT color="green">073</FONT>     * and q&lt;sub&gt;n&lt;/sub&gt; resulting from the Taylor series formulas above is:<a name="line.73"></a>
+<FONT color="green">074</FONT>     * &lt;pre&gt;<a name="line.74"></a>
+<FONT color="green">075</FONT>     * q&lt;sub&gt;n&lt;/sub&gt; = s&lt;sub&gt;1&lt;/sub&gt;(n) u + P r&lt;sub&gt;n&lt;/sub&gt;<a name="line.75"></a>
+<FONT color="green">076</FONT>     * &lt;/pre&gt;<a name="line.76"></a>
+<FONT color="green">077</FONT>     * where u is the [ 1 1 ... 1 ]&lt;sup&gt;T&lt;/sup&gt; vector and P is the (k-1)&amp;times;(k-1) matrix built<a name="line.77"></a>
+<FONT color="green">078</FONT>     * with the j (-i)&lt;sup&gt;j-1&lt;/sup&gt; terms:<a name="line.78"></a>
+<FONT color="green">079</FONT>     * &lt;pre&gt;<a name="line.79"></a>
+<FONT color="green">080</FONT>     *        [  -2   3   -4    5  ... ]<a name="line.80"></a>
+<FONT color="green">081</FONT>     *        [  -4  12  -32   80  ... ]<a name="line.81"></a>
+<FONT color="green">082</FONT>     *   P =  [  -6  27 -108  405  ... ]<a name="line.82"></a>
+<FONT color="green">083</FONT>     *        [  -8  48 -256 1280  ... ]<a name="line.83"></a>
+<FONT color="green">084</FONT>     *        [          ...           ]<a name="line.84"></a>
+<FONT color="green">085</FONT>     * &lt;/pre&gt;&lt;/p&gt;<a name="line.85"></a>
+<FONT color="green">086</FONT>     *<a name="line.86"></a>
+<FONT color="green">087</FONT>     * &lt;p&gt;Changing -i into +i in the formula above can be used to compute a similar transform between<a name="line.87"></a>
+<FONT color="green">088</FONT>     * classical representation and Nordsieck vector at step start. The resulting matrix is simply<a name="line.88"></a>
+<FONT color="green">089</FONT>     * the absolute value of matrix P.&lt;/p&gt;<a name="line.89"></a>
+<FONT color="green">090</FONT>     *<a name="line.90"></a>
+<FONT color="green">091</FONT>     * &lt;p&gt;For {@link AdamsBashforthIntegrator Adams-Bashforth} method, the Nordsieck vector<a name="line.91"></a>
+<FONT color="green">092</FONT>     * at step n+1 is computed from the Nordsieck vector at step n as follows:<a name="line.92"></a>
+<FONT color="green">093</FONT>     * &lt;ul&gt;<a name="line.93"></a>
+<FONT color="green">094</FONT>     *   &lt;li&gt;y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + s&lt;sub&gt;1&lt;/sub&gt;(n) + u&lt;sup&gt;T&lt;/sup&gt; r&lt;sub&gt;n&lt;/sub&gt;&lt;/li&gt;<a name="line.94"></a>
+<FONT color="green">095</FONT>     *   &lt;li&gt;s&lt;sub&gt;1&lt;/sub&gt;(n+1) = h f(t&lt;sub&gt;n+1&lt;/sub&gt;, y&lt;sub&gt;n+1&lt;/sub&gt;)&lt;/li&gt;<a name="line.95"></a>
+<FONT color="green">096</FONT>     *   &lt;li&gt;r&lt;sub&gt;n+1&lt;/sub&gt; = (s&lt;sub&gt;1&lt;/sub&gt;(n) - s&lt;sub&gt;1&lt;/sub&gt;(n+1)) P&lt;sup&gt;-1&lt;/sup&gt; u + P&lt;sup&gt;-1&lt;/sup&gt; A P r&lt;sub&gt;n&lt;/sub&gt;&lt;/li&gt;<a name="line.96"></a>
+<FONT color="green">097</FONT>     * &lt;/ul&gt;<a name="line.97"></a>
+<FONT color="green">098</FONT>     * where A is a rows shifting matrix (the lower left part is an identity matrix):<a name="line.98"></a>
+<FONT color="green">099</FONT>     * &lt;pre&gt;<a name="line.99"></a>
+<FONT color="green">100</FONT>     *        [ 0 0   ...  0 0 | 0 ]<a name="line.100"></a>
+<FONT color="green">101</FONT>     *        [ ---------------+---]<a name="line.101"></a>
+<FONT color="green">102</FONT>     *        [ 1 0   ...  0 0 | 0 ]<a name="line.102"></a>
+<FONT color="green">103</FONT>     *    A = [ 0 1   ...  0 0 | 0 ]<a name="line.103"></a>
+<FONT color="green">104</FONT>     *        [       ...      | 0 ]<a name="line.104"></a>
+<FONT color="green">105</FONT>     *        [ 0 0   ...  1 0 | 0 ]<a name="line.105"></a>
+<FONT color="green">106</FONT>     *        [ 0 0   ...  0 1 | 0 ]<a name="line.106"></a>
+<FONT color="green">107</FONT>     * &lt;/pre&gt;&lt;/p&gt;<a name="line.107"></a>
+<FONT color="green">108</FONT>     *<a name="line.108"></a>
+<FONT color="green">109</FONT>     * &lt;p&gt;For {@link AdamsMoultonIntegrator Adams-Moulton} method, the predicted Nordsieck vector<a name="line.109"></a>
+<FONT color="green">110</FONT>     * at step n+1 is computed from the Nordsieck vector at step n as follows:<a name="line.110"></a>
+<FONT color="green">111</FONT>     * &lt;ul&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>     *   &lt;li&gt;Y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + s&lt;sub&gt;1&lt;/sub&gt;(n) + u&lt;sup&gt;T&lt;/sup&gt; r&lt;sub&gt;n&lt;/sub&gt;&lt;/li&gt;<a name="line.112"></a>
+<FONT color="green">113</FONT>     *   &lt;li&gt;S&lt;sub&gt;1&lt;/sub&gt;(n+1) = h f(t&lt;sub&gt;n+1&lt;/sub&gt;, Y&lt;sub&gt;n+1&lt;/sub&gt;)&lt;/li&gt;<a name="line.113"></a>
+<FONT color="green">114</FONT>     *   &lt;li&gt;R&lt;sub&gt;n+1&lt;/sub&gt; = (s&lt;sub&gt;1&lt;/sub&gt;(n) - s&lt;sub&gt;1&lt;/sub&gt;(n+1)) P&lt;sup&gt;-1&lt;/sup&gt; u + P&lt;sup&gt;-1&lt;/sup&gt; A P r&lt;sub&gt;n&lt;/sub&gt;&lt;/li&gt;<a name="line.114"></a>
+<FONT color="green">115</FONT>     * &lt;/ul&gt;<a name="line.115"></a>
+<FONT color="green">116</FONT>     * From this predicted vector, the corrected vector is computed as follows:<a name="line.116"></a>
+<FONT color="green">117</FONT>     * &lt;ul&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>     *   &lt;li&gt;y&lt;sub&gt;n+1&lt;/sub&gt; = y&lt;sub&gt;n&lt;/sub&gt; + S&lt;sub&gt;1&lt;/sub&gt;(n+1) + [ -1 +1 -1 +1 ... &amp;plusmn;1 ] r&lt;sub&gt;n+1&lt;/sub&gt;&lt;/li&gt;<a name="line.118"></a>
+<FONT color="green">119</FONT>     *   &lt;li&gt;s&lt;sub&gt;1&lt;/sub&gt;(n+1) = h f(t&lt;sub&gt;n+1&lt;/sub&gt;, y&lt;sub&gt;n+1&lt;/sub&gt;)&lt;/li&gt;<a name="line.119"></a>
+<FONT color="green">120</FONT>     *   &lt;li&gt;r&lt;sub&gt;n+1&lt;/sub&gt; = R&lt;sub&gt;n+1&lt;/sub&gt; + (s&lt;sub&gt;1&lt;/sub&gt;(n+1) - S&lt;sub&gt;1&lt;/sub&gt;(n+1)) P&lt;sup&gt;-1&lt;/sup&gt; u&lt;/li&gt;<a name="line.120"></a>
+<FONT color="green">121</FONT>     * &lt;/ul&gt;<a name="line.121"></a>
+<FONT color="green">122</FONT>     * where the upper case Y&lt;sub&gt;n+1&lt;/sub&gt;, S&lt;sub&gt;1&lt;/sub&gt;(n+1) and R&lt;sub&gt;n+1&lt;/sub&gt; represent the<a name="line.122"></a>
+<FONT color="green">123</FONT>     * predicted states whereas the lower case y&lt;sub&gt;n+1&lt;/sub&gt;, s&lt;sub&gt;n+1&lt;/sub&gt; and r&lt;sub&gt;n+1&lt;/sub&gt;<a name="line.123"></a>
+<FONT color="green">124</FONT>     * represent the corrected states.&lt;/p&gt;<a name="line.124"></a>
+<FONT color="green">125</FONT>     *<a name="line.125"></a>
+<FONT color="green">126</FONT>     * &lt;p&gt;We observe that both methods use similar update formulas. In both cases a P&lt;sup&gt;-1&lt;/sup&gt;u<a name="line.126"></a>
+<FONT color="green">127</FONT>     * vector and a P&lt;sup&gt;-1&lt;/sup&gt; A P matrix are used that do not depend on the state,<a name="line.127"></a>
+<FONT color="green">128</FONT>     * they only depend on k. This class handles these transformations.&lt;/p&gt;<a name="line.128"></a>
+<FONT color="green">129</FONT>     *<a name="line.129"></a>
+<FONT color="green">130</FONT>     * @version $Revision: 810196 $ $Date: 2009-09-01 15:47:46 -0400 (Tue, 01 Sep 2009) $<a name="line.130"></a>
+<FONT color="green">131</FONT>     * @since 2.0<a name="line.131"></a>
+<FONT color="green">132</FONT>     */<a name="line.132"></a>
+<FONT color="green">133</FONT>    public class AdamsNordsieckTransformer {<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>        /** Cache for already computed coefficients. */<a name="line.135"></a>
+<FONT color="green">136</FONT>        private static final Map&lt;Integer, AdamsNordsieckTransformer&gt; CACHE =<a name="line.136"></a>
+<FONT color="green">137</FONT>            new HashMap&lt;Integer, AdamsNordsieckTransformer&gt;();<a name="line.137"></a>
+<FONT color="green">138</FONT>    <a name="line.138"></a>
+<FONT color="green">139</FONT>        /** Initialization matrix for the higher order derivatives wrt y'', y''' ... */<a name="line.139"></a>
+<FONT color="green">140</FONT>        private final Array2DRowRealMatrix initialization;<a name="line.140"></a>
+<FONT color="green">141</FONT>    <a name="line.141"></a>
+<FONT color="green">142</FONT>        /** Update matrix for the higher order derivatives h&lt;sup&gt;2&lt;/sup&gt;/2y'', h&lt;sup&gt;3&lt;/sup&gt;/6 y''' ... */<a name="line.142"></a>
+<FONT color="green">143</FONT>        private final Array2DRowRealMatrix update;<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>        /** Update coefficients of the higher order derivatives wrt y'. */<a name="line.145"></a>
+<FONT color="green">146</FONT>        private final double[] c1;<a name="line.146"></a>
+<FONT color="green">147</FONT>    <a name="line.147"></a>
+<FONT color="green">148</FONT>        /** Simple constructor.<a name="line.148"></a>
+<FONT color="green">149</FONT>         * @param nSteps number of steps of the multistep method<a name="line.149"></a>
+<FONT color="green">150</FONT>         * (excluding the one being computed)<a name="line.150"></a>
+<FONT color="green">151</FONT>         */<a name="line.151"></a>
+<FONT color="green">152</FONT>        private AdamsNordsieckTransformer(final int nSteps) {<a name="line.152"></a>
+<FONT color="green">153</FONT>    <a name="line.153"></a>
+<FONT color="green">154</FONT>            // compute exact coefficients<a name="line.154"></a>
+<FONT color="green">155</FONT>            FieldMatrix&lt;BigFraction&gt; bigP = buildP(nSteps);<a name="line.155"></a>
+<FONT color="green">156</FONT>            FieldDecompositionSolver&lt;BigFraction&gt; pSolver =<a name="line.156"></a>
+<FONT color="green">157</FONT>                new FieldLUDecompositionImpl&lt;BigFraction&gt;(bigP).getSolver();<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>            BigFraction[] u = new BigFraction[nSteps];<a name="line.159"></a>
+<FONT color="green">160</FONT>            Arrays.fill(u, BigFraction.ONE);<a name="line.160"></a>
+<FONT color="green">161</FONT>            BigFraction[] bigC1 = pSolver.solve(u);<a name="line.161"></a>
+<FONT color="green">162</FONT>    <a name="line.162"></a>
+<FONT color="green">163</FONT>            // update coefficients are computed by combining transform from<a name="line.163"></a>
+<FONT color="green">164</FONT>            // Nordsieck to multistep, then shifting rows to represent step advance<a name="line.164"></a>
+<FONT color="green">165</FONT>            // then applying inverse transform<a name="line.165"></a>
+<FONT color="green">166</FONT>            BigFraction[][] shiftedP = bigP.getData();<a name="line.166"></a>
+<FONT color="green">167</FONT>            for (int i = shiftedP.length - 1; i &gt; 0; --i) {<a name="line.167"></a>
+<FONT color="green">168</FONT>                // shift rows<a name="line.168"></a>
+<FONT color="green">169</FONT>                shiftedP[i] = shiftedP[i - 1];<a name="line.169"></a>
+<FONT color="green">170</FONT>            }<a name="line.170"></a>
+<FONT color="green">171</FONT>            shiftedP[0] = new BigFraction[nSteps];<a name="line.171"></a>
+<FONT color="green">172</FONT>            Arrays.fill(shiftedP[0], BigFraction.ZERO);<a name="line.172"></a>
+<FONT color="green">173</FONT>            FieldMatrix&lt;BigFraction&gt; bigMSupdate =<a name="line.173"></a>
+<FONT color="green">174</FONT>                pSolver.solve(new Array2DRowFieldMatrix&lt;BigFraction&gt;(shiftedP, false));<a name="line.174"></a>
+<FONT color="green">175</FONT>    <a name="line.175"></a>
+<FONT color="green">176</FONT>            // initialization coefficients, computed from a R matrix = abs(P)<a name="line.176"></a>
+<FONT color="green">177</FONT>            bigP.walkInOptimizedOrder(new DefaultFieldMatrixChangingVisitor&lt;BigFraction&gt;(BigFraction.ZERO) {<a name="line.177"></a>
+<FONT color="green">178</FONT>                /** {@inheritDoc} */<a name="line.178"></a>
+<FONT color="green">179</FONT>                @Override<a name="line.179"></a>
+<FONT color="green">180</FONT>                public BigFraction visit(int row, int column, BigFraction value) {<a name="line.180"></a>
+<FONT color="green">181</FONT>                    return ((column &amp; 0x1) == 0x1) ? value : value.negate();<a name="line.181"></a>
+<FONT color="green">182</FONT>                }<a name="line.182"></a>
+<FONT color="green">183</FONT>            });<a name="line.183"></a>
+<FONT color="green">184</FONT>            FieldMatrix&lt;BigFraction&gt; bigRInverse =<a name="line.184"></a>
+<FONT color="green">185</FONT>                new FieldLUDecompositionImpl&lt;BigFraction&gt;(bigP).getSolver().getInverse();<a name="line.185"></a>
+<FONT color="green">186</FONT>    <a name="line.186"></a>
+<FONT color="green">187</FONT>            // convert coefficients to double<a name="line.187"></a>
+<FONT color="green">188</FONT>            initialization = MatrixUtils.bigFractionMatrixToRealMatrix(bigRInverse);<a name="line.188"></a>
+<FONT color="green">189</FONT>            update         = MatrixUtils.bigFractionMatrixToRealMatrix(bigMSupdate);<a name="line.189"></a>
+<FONT color="green">190</FONT>            c1             = new double[nSteps];<a name="line.190"></a>
+<FONT color="green">191</FONT>            for (int i = 0; i &lt; nSteps; ++i) {<a name="line.191"></a>
+<FONT color="green">192</FONT>                c1[i] = bigC1[i].doubleValue();<a name="line.192"></a>
+<FONT color="green">193</FONT>            }<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>        }<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>        /** Get the Nordsieck transformer for a given number of steps.<a name="line.197"></a>
+<FONT color="green">198</FONT>         * @param nSteps number of steps of the multistep method<a name="line.198"></a>
+<FONT color="green">199</FONT>         * (excluding the one being computed)<a name="line.199"></a>
+<FONT color="green">200</FONT>         * @return Nordsieck transformer for the specified number of steps<a name="line.200"></a>
+<FONT color="green">201</FONT>         */<a name="line.201"></a>
+<FONT color="green">202</FONT>        public static AdamsNordsieckTransformer getInstance(final int nSteps) {<a name="line.202"></a>
+<FONT color="green">203</FONT>            synchronized(CACHE) {<a name="line.203"></a>
+<FONT color="green">204</FONT>                AdamsNordsieckTransformer t = CACHE.get(nSteps);<a name="line.204"></a>
+<FONT color="green">205</FONT>                if (t == null) {<a name="line.205"></a>
+<FONT color="green">206</FONT>                    t = new AdamsNordsieckTransformer(nSteps);<a name="line.206"></a>
+<FONT color="green">207</FONT>                    CACHE.put(nSteps, t);<a name="line.207"></a>
+<FONT color="green">208</FONT>                }<a name="line.208"></a>
+<FONT color="green">209</FONT>                return t;<a name="line.209"></a>
+<FONT color="green">210</FONT>            }<a name="line.210"></a>
+<FONT color="green">211</FONT>        }<a name="line.211"></a>
+<FONT color="green">212</FONT>    <a name="line.212"></a>
+<FONT color="green">213</FONT>        /** Get the number of steps of the method<a name="line.213"></a>
+<FONT color="green">214</FONT>         * (excluding the one being computed).<a name="line.214"></a>
+<FONT color="green">215</FONT>         * @return number of steps of the method<a name="line.215"></a>
+<FONT color="green">216</FONT>         * (excluding the one being computed)<a name="line.216"></a>
+<FONT color="green">217</FONT>         */<a name="line.217"></a>
+<FONT color="green">218</FONT>        public int getNSteps() {<a name="line.218"></a>
+<FONT color="green">219</FONT>            return c1.length;<a name="line.219"></a>
+<FONT color="green">220</FONT>        }<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>        /** Build the P matrix.<a name="line.222"></a>
+<FONT color="green">223</FONT>         * &lt;p&gt;The P matrix general terms are shifted j (-i)&lt;sup&gt;j-1&lt;/sup&gt; terms:<a name="line.223"></a>
+<FONT color="green">224</FONT>         * &lt;pre&gt;<a name="line.224"></a>
+<FONT color="green">225</FONT>         *        [  -2   3   -4    5  ... ]<a name="line.225"></a>
+<FONT color="green">226</FONT>         *        [  -4  12  -32   80  ... ]<a name="line.226"></a>
+<FONT color="green">227</FONT>         *   P =  [  -6  27 -108  405  ... ]<a name="line.227"></a>
+<FONT color="green">228</FONT>         *        [  -8  48 -256 1280  ... ]<a name="line.228"></a>
+<FONT color="green">229</FONT>         *        [          ...           ]<a name="line.229"></a>
+<FONT color="green">230</FONT>         * &lt;/pre&gt;&lt;/p&gt;<a name="line.230"></a>
+<FONT color="green">231</FONT>         * @param nSteps number of steps of the multistep method<a name="line.231"></a>
+<FONT color="green">232</FONT>         * (excluding the one being computed)<a name="line.232"></a>
+<FONT color="green">233</FONT>         * @return P matrix<a name="line.233"></a>
+<FONT color="green">234</FONT>         */<a name="line.234"></a>
+<FONT color="green">235</FONT>        private FieldMatrix&lt;BigFraction&gt; buildP(final int nSteps) {<a name="line.235"></a>
+<FONT color="green">236</FONT>    <a name="line.236"></a>
+<FONT color="green">237</FONT>            final BigFraction[][] pData = new BigFraction[nSteps][nSteps];<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>            for (int i = 0; i &lt; pData.length; ++i) {<a name="line.239"></a>
+<FONT color="green">240</FONT>                // build the P matrix elements from Taylor series formulas<a name="line.240"></a>
+<FONT color="green">241</FONT>                final BigFraction[] pI = pData[i];<a name="line.241"></a>
+<FONT color="green">242</FONT>                final int factor = -(i + 1);<a name="line.242"></a>
+<FONT color="green">243</FONT>                int aj = factor;<a name="line.243"></a>
+<FONT color="green">244</FONT>                for (int j = 0; j &lt; pI.length; ++j) {<a name="line.244"></a>
+<FONT color="green">245</FONT>                    pI[j] = new BigFraction(aj * (j + 2));<a name="line.245"></a>
+<FONT color="green">246</FONT>                    aj *= factor;<a name="line.246"></a>
+<FONT color="green">247</FONT>                }<a name="line.247"></a>
+<FONT color="green">248</FONT>            }<a name="line.248"></a>
+<FONT color="green">249</FONT>    <a name="line.249"></a>
+<FONT color="green">250</FONT>            return new Array2DRowFieldMatrix&lt;BigFraction&gt;(pData, false);<a name="line.250"></a>
+<FONT color="green">251</FONT>    <a name="line.251"></a>
+<FONT color="green">252</FONT>        }<a name="line.252"></a>
+<FONT color="green">253</FONT>    <a name="line.253"></a>
+<FONT color="green">254</FONT>        /** Initialize the high order scaled derivatives at step start.<a name="line.254"></a>
+<FONT color="green">255</FONT>         * @param first first scaled derivative at step start<a name="line.255"></a>
+<FONT color="green">256</FONT>         * @param multistep scaled derivatives after step start (hy'1, ..., hy'k-1)<a name="line.256"></a>
+<FONT color="green">257</FONT>         * will be modified<a name="line.257"></a>
+<FONT color="green">258</FONT>         * @return high order derivatives at step start<a name="line.258"></a>
+<FONT color="green">259</FONT>         */<a name="line.259"></a>
+<FONT color="green">260</FONT>        public Array2DRowRealMatrix initializeHighOrderDerivatives(final double[] first,<a name="line.260"></a>
+<FONT color="green">261</FONT>                                                         final double[][] multistep) {<a name="line.261"></a>
+<FONT color="green">262</FONT>            for (int i = 0; i &lt; multistep.length; ++i) {<a name="line.262"></a>
+<FONT color="green">263</FONT>                final double[] msI = multistep[i];<a name="line.263"></a>
+<FONT color="green">264</FONT>                for (int j = 0; j &lt; first.length; ++j) {<a name="line.264"></a>
+<FONT color="green">265</FONT>                    msI[j] -= first[j];<a name="line.265"></a>
+<FONT color="green">266</FONT>                }<a name="line.266"></a>
+<FONT color="green">267</FONT>            }<a name="line.267"></a>
+<FONT color="green">268</FONT>            return initialization.multiply(new Array2DRowRealMatrix(multistep, false));<a name="line.268"></a>
+<FONT color="green">269</FONT>        }<a name="line.269"></a>
+<FONT color="green">270</FONT>    <a name="line.270"></a>
+<FONT color="green">271</FONT>        /** Update the high order scaled derivatives for Adams integrators (phase 1).<a name="line.271"></a>
+<FONT color="green">272</FONT>         * &lt;p&gt;The complete update of high order derivatives has a form similar to:<a name="line.272"></a>
+<FONT color="green">273</FONT>         * &lt;pre&gt;<a name="line.273"></a>
+<FONT color="green">274</FONT>         * r&lt;sub&gt;n+1&lt;/sub&gt; = (s&lt;sub&gt;1&lt;/sub&gt;(n) - s&lt;sub&gt;1&lt;/sub&gt;(n+1)) P&lt;sup&gt;-1&lt;/sup&gt; u + P&lt;sup&gt;-1&lt;/sup&gt; A P r&lt;sub&gt;n&lt;/sub&gt;<a name="line.274"></a>
+<FONT color="green">275</FONT>         * &lt;/pre&gt;<a name="line.275"></a>
+<FONT color="green">276</FONT>         * this method computes the P&lt;sup&gt;-1&lt;/sup&gt; A P r&lt;sub&gt;n&lt;/sub&gt; part.&lt;/p&gt;<a name="line.276"></a>
+<FONT color="green">277</FONT>         * @param highOrder high order scaled derivatives<a name="line.277"></a>
+<FONT color="green">278</FONT>         * (h&lt;sup&gt;2&lt;/sup&gt;/2 y'', ... h&lt;sup&gt;k&lt;/sup&gt;/k! y(k))<a name="line.278"></a>
+<FONT color="green">279</FONT>         * @return updated high order derivatives<a name="line.279"></a>
+<FONT color="green">280</FONT>         * @see #updateHighOrderDerivativesPhase2(double[], double[], Array2DRowRealMatrix)<a name="line.280"></a>
+<FONT color="green">281</FONT>         */<a name="line.281"></a>
+<FONT color="green">282</FONT>        public Array2DRowRealMatrix updateHighOrderDerivativesPhase1(final Array2DRowRealMatrix highOrder) {<a name="line.282"></a>
+<FONT color="green">283</FONT>            return update.multiply(highOrder);<a name="line.283"></a>
+<FONT color="green">284</FONT>        }<a name="line.284"></a>
+<FONT color="green">285</FONT>    <a name="line.285"></a>
+<FONT color="green">286</FONT>        /** Update the high order scaled derivatives Adams integrators (phase 2).<a name="line.286"></a>
+<FONT color="green">287</FONT>         * &lt;p&gt;The complete update of high order derivatives has a form similar to:<a name="line.287"></a>
+<FONT color="green">288</FONT>         * &lt;pre&gt;<a name="line.288"></a>
+<FONT color="green">289</FONT>         * r&lt;sub&gt;n+1&lt;/sub&gt; = (s&lt;sub&gt;1&lt;/sub&gt;(n) - s&lt;sub&gt;1&lt;/sub&gt;(n+1)) P&lt;sup&gt;-1&lt;/sup&gt; u + P&lt;sup&gt;-1&lt;/sup&gt; A P r&lt;sub&gt;n&lt;/sub&gt;<a name="line.289"></a>
+<FONT color="green">290</FONT>         * &lt;/pre&gt;<a name="line.290"></a>
+<FONT color="green">291</FONT>         * this method computes the (s&lt;sub&gt;1&lt;/sub&gt;(n) - s&lt;sub&gt;1&lt;/sub&gt;(n+1)) P&lt;sup&gt;-1&lt;/sup&gt; u part.&lt;/p&gt;<a name="line.291"></a>
+<FONT color="green">292</FONT>         * &lt;p&gt;Phase 1 of the update must already have been performed.&lt;/p&gt;<a name="line.292"></a>
+<FONT color="green">293</FONT>         * @param start first order scaled derivatives at step start<a name="line.293"></a>
+<FONT color="green">294</FONT>         * @param end first order scaled derivatives at step end<a name="line.294"></a>
+<FONT color="green">295</FONT>         * @param highOrder high order scaled derivatives, will be modified<a name="line.295"></a>
+<FONT color="green">296</FONT>         * (h&lt;sup&gt;2&lt;/sup&gt;/2 y'', ... h&lt;sup&gt;k&lt;/sup&gt;/k! y(k))<a name="line.296"></a>
+<FONT color="green">297</FONT>         * @see #updateHighOrderDerivativesPhase1(Array2DRowRealMatrix)<a name="line.297"></a>
+<FONT color="green">298</FONT>         */<a name="line.298"></a>
+<FONT color="green">299</FONT>        public void updateHighOrderDerivativesPhase2(final double[] start,<a name="line.299"></a>
+<FONT color="green">300</FONT>                                                     final double[] end,<a name="line.300"></a>
+<FONT color="green">301</FONT>                                                     final Array2DRowRealMatrix highOrder) {<a name="line.301"></a>
+<FONT color="green">302</FONT>            final double[][] data = highOrder.getDataRef();<a name="line.302"></a>
+<FONT color="green">303</FONT>            for (int i = 0; i &lt; data.length; ++i) {<a name="line.303"></a>
+<FONT color="green">304</FONT>                final double[] dataI = data[i];<a name="line.304"></a>
+<FONT color="green">305</FONT>                final double c1I = c1[i];<a name="line.305"></a>
+<FONT color="green">306</FONT>                for (int j = 0; j &lt; dataI.length; ++j) {<a name="line.306"></a>
+<FONT color="green">307</FONT>                    dataI[j] += c1I * (start[j] - end[j]);<a name="line.307"></a>
+<FONT color="green">308</FONT>                }<a name="line.308"></a>
+<FONT color="green">309</FONT>            }<a name="line.309"></a>
+<FONT color="green">310</FONT>        }<a name="line.310"></a>
+<FONT color="green">311</FONT>    <a name="line.311"></a>
+<FONT color="green">312</FONT>    }<a name="line.312"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,399 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.nonstiff;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ode.AbstractIntegrator;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.ode.FirstOrderDifferentialEquations;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.ode.IntegratorException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * This abstract class holds the common part of all adaptive<a name="line.26"></a>
+<FONT color="green">027</FONT>     * stepsize integrators for Ordinary Differential Equations.<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;These algorithms perform integration with stepsize control, which<a name="line.29"></a>
+<FONT color="green">030</FONT>     * means the user does not specify the integration step but rather a<a name="line.30"></a>
+<FONT color="green">031</FONT>     * tolerance on error. The error threshold is computed as<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;pre&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * threshold_i = absTol_i + relTol_i * max (abs (ym), abs (ym+1))<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;/pre&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * where absTol_i is the absolute tolerance for component i of the<a name="line.35"></a>
+<FONT color="green">036</FONT>     * state vector and relTol_i is the relative tolerance for the same<a name="line.36"></a>
+<FONT color="green">037</FONT>     * component. The user can also use only two scalar values absTol and<a name="line.37"></a>
+<FONT color="green">038</FONT>     * relTol which will be used for all components.&lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     *<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;p&gt;If the estimated error for ym+1 is such that<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;pre&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * sqrt((sum (errEst_i / threshold_i)^2 ) / n) &lt; 1<a name="line.42"></a>
+<FONT color="green">043</FONT>     * &lt;/pre&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     *<a name="line.44"></a>
+<FONT color="green">045</FONT>     * (where n is the state vector dimension) then the step is accepted,<a name="line.45"></a>
+<FONT color="green">046</FONT>     * otherwise the step is rejected and a new attempt is made with a new<a name="line.46"></a>
+<FONT color="green">047</FONT>     * stepsize.&lt;/p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     *<a name="line.48"></a>
+<FONT color="green">049</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.49"></a>
+<FONT color="green">050</FONT>     * @since 1.2<a name="line.50"></a>
+<FONT color="green">051</FONT>     *<a name="line.51"></a>
+<FONT color="green">052</FONT>     */<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>    public abstract class AdaptiveStepsizeIntegrator<a name="line.54"></a>
+<FONT color="green">055</FONT>      extends AbstractIntegrator {<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /** Allowed absolute scalar error. */<a name="line.57"></a>
+<FONT color="green">058</FONT>        protected final double scalAbsoluteTolerance;<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Allowed relative scalar error. */<a name="line.60"></a>
+<FONT color="green">061</FONT>        protected final double scalRelativeTolerance;<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /** Allowed absolute vectorial error. */<a name="line.63"></a>
+<FONT color="green">064</FONT>        protected final double[] vecAbsoluteTolerance;<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /** Allowed relative vectorial error. */<a name="line.66"></a>
+<FONT color="green">067</FONT>        protected final double[] vecRelativeTolerance;<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /** User supplied initial step. */<a name="line.69"></a>
+<FONT color="green">070</FONT>        private double initialStep;<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /** Minimal step. */<a name="line.72"></a>
+<FONT color="green">073</FONT>        private final double minStep;<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /** Maximal step. */<a name="line.75"></a>
+<FONT color="green">076</FONT>        private final double maxStep;<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>      /** Build an integrator with the given stepsize bounds.<a name="line.78"></a>
+<FONT color="green">079</FONT>       * The default step handler does nothing.<a name="line.79"></a>
+<FONT color="green">080</FONT>       * @param name name of the method<a name="line.80"></a>
+<FONT color="green">081</FONT>       * @param minStep minimal step (must be positive even for backward<a name="line.81"></a>
+<FONT color="green">082</FONT>       * integration), the last step can be smaller than this<a name="line.82"></a>
+<FONT color="green">083</FONT>       * @param maxStep maximal step (must be positive even for backward<a name="line.83"></a>
+<FONT color="green">084</FONT>       * integration)<a name="line.84"></a>
+<FONT color="green">085</FONT>       * @param scalAbsoluteTolerance allowed absolute error<a name="line.85"></a>
+<FONT color="green">086</FONT>       * @param scalRelativeTolerance allowed relative error<a name="line.86"></a>
+<FONT color="green">087</FONT>       */<a name="line.87"></a>
+<FONT color="green">088</FONT>      public AdaptiveStepsizeIntegrator(final String name,<a name="line.88"></a>
+<FONT color="green">089</FONT>                                        final double minStep, final double maxStep,<a name="line.89"></a>
+<FONT color="green">090</FONT>                                        final double scalAbsoluteTolerance,<a name="line.90"></a>
+<FONT color="green">091</FONT>                                        final double scalRelativeTolerance) {<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        super(name);<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        this.minStep     = Math.abs(minStep);<a name="line.95"></a>
+<FONT color="green">096</FONT>        this.maxStep     = Math.abs(maxStep);<a name="line.96"></a>
+<FONT color="green">097</FONT>        this.initialStep = -1.0;<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>        this.scalAbsoluteTolerance = scalAbsoluteTolerance;<a name="line.99"></a>
+<FONT color="green">100</FONT>        this.scalRelativeTolerance = scalRelativeTolerance;<a name="line.100"></a>
+<FONT color="green">101</FONT>        this.vecAbsoluteTolerance  = null;<a name="line.101"></a>
+<FONT color="green">102</FONT>        this.vecRelativeTolerance  = null;<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        resetInternalState();<a name="line.104"></a>
+<FONT color="green">105</FONT>    <a name="line.105"></a>
+<FONT color="green">106</FONT>      }<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>      /** Build an integrator with the given stepsize bounds.<a name="line.108"></a>
+<FONT color="green">109</FONT>       * The default step handler does nothing.<a name="line.109"></a>
+<FONT color="green">110</FONT>       * @param name name of the method<a name="line.110"></a>
+<FONT color="green">111</FONT>       * @param minStep minimal step (must be positive even for backward<a name="line.111"></a>
+<FONT color="green">112</FONT>       * integration), the last step can be smaller than this<a name="line.112"></a>
+<FONT color="green">113</FONT>       * @param maxStep maximal step (must be positive even for backward<a name="line.113"></a>
+<FONT color="green">114</FONT>       * integration)<a name="line.114"></a>
+<FONT color="green">115</FONT>       * @param vecAbsoluteTolerance allowed absolute error<a name="line.115"></a>
+<FONT color="green">116</FONT>       * @param vecRelativeTolerance allowed relative error<a name="line.116"></a>
+<FONT color="green">117</FONT>       */<a name="line.117"></a>
+<FONT color="green">118</FONT>      public AdaptiveStepsizeIntegrator(final String name,<a name="line.118"></a>
+<FONT color="green">119</FONT>                                        final double minStep, final double maxStep,<a name="line.119"></a>
+<FONT color="green">120</FONT>                                        final double[] vecAbsoluteTolerance,<a name="line.120"></a>
+<FONT color="green">121</FONT>                                        final double[] vecRelativeTolerance) {<a name="line.121"></a>
+<FONT color="green">122</FONT>    <a name="line.122"></a>
+<FONT color="green">123</FONT>        super(name);<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>        this.minStep     = minStep;<a name="line.125"></a>
+<FONT color="green">126</FONT>        this.maxStep     = maxStep;<a name="line.126"></a>
+<FONT color="green">127</FONT>        this.initialStep = -1.0;<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>        this.scalAbsoluteTolerance = 0;<a name="line.129"></a>
+<FONT color="green">130</FONT>        this.scalRelativeTolerance = 0;<a name="line.130"></a>
+<FONT color="green">131</FONT>        this.vecAbsoluteTolerance  = vecAbsoluteTolerance.clone();<a name="line.131"></a>
+<FONT color="green">132</FONT>        this.vecRelativeTolerance  = vecRelativeTolerance.clone();<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>        resetInternalState();<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>      }<a name="line.136"></a>
+<FONT color="green">137</FONT>    <a name="line.137"></a>
+<FONT color="green">138</FONT>      /** Set the initial step size.<a name="line.138"></a>
+<FONT color="green">139</FONT>       * &lt;p&gt;This method allows the user to specify an initial positive<a name="line.139"></a>
+<FONT color="green">140</FONT>       * step size instead of letting the integrator guess it by<a name="line.140"></a>
+<FONT color="green">141</FONT>       * itself. If this method is not called before integration is<a name="line.141"></a>
+<FONT color="green">142</FONT>       * started, the initial step size will be estimated by the<a name="line.142"></a>
+<FONT color="green">143</FONT>       * integrator.&lt;/p&gt;<a name="line.143"></a>
+<FONT color="green">144</FONT>       * @param initialStepSize initial step size to use (must be positive even<a name="line.144"></a>
+<FONT color="green">145</FONT>       * for backward integration ; providing a negative value or a value<a name="line.145"></a>
+<FONT color="green">146</FONT>       * outside of the min/max step interval will lead the integrator to<a name="line.146"></a>
+<FONT color="green">147</FONT>       * ignore the value and compute the initial step size by itself)<a name="line.147"></a>
+<FONT color="green">148</FONT>       */<a name="line.148"></a>
+<FONT color="green">149</FONT>      public void setInitialStepSize(final double initialStepSize) {<a name="line.149"></a>
+<FONT color="green">150</FONT>        if ((initialStepSize &lt; minStep) || (initialStepSize &gt; maxStep)) {<a name="line.150"></a>
+<FONT color="green">151</FONT>          initialStep = -1.0;<a name="line.151"></a>
+<FONT color="green">152</FONT>        } else {<a name="line.152"></a>
+<FONT color="green">153</FONT>          initialStep = initialStepSize;<a name="line.153"></a>
+<FONT color="green">154</FONT>        }<a name="line.154"></a>
+<FONT color="green">155</FONT>      }<a name="line.155"></a>
+<FONT color="green">156</FONT>    <a name="line.156"></a>
+<FONT color="green">157</FONT>      /** Perform some sanity checks on the integration parameters.<a name="line.157"></a>
+<FONT color="green">158</FONT>       * @param equations differential equations set<a name="line.158"></a>
+<FONT color="green">159</FONT>       * @param t0 start time<a name="line.159"></a>
+<FONT color="green">160</FONT>       * @param y0 state vector at t0<a name="line.160"></a>
+<FONT color="green">161</FONT>       * @param t target time for the integration<a name="line.161"></a>
+<FONT color="green">162</FONT>       * @param y placeholder where to put the state vector<a name="line.162"></a>
+<FONT color="green">163</FONT>       * @exception IntegratorException if some inconsistency is detected<a name="line.163"></a>
+<FONT color="green">164</FONT>       */<a name="line.164"></a>
+<FONT color="green">165</FONT>      @Override<a name="line.165"></a>
+<FONT color="green">166</FONT>      protected void sanityChecks(final FirstOrderDifferentialEquations equations,<a name="line.166"></a>
+<FONT color="green">167</FONT>                                  final double t0, final double[] y0,<a name="line.167"></a>
+<FONT color="green">168</FONT>                                  final double t, final double[] y)<a name="line.168"></a>
+<FONT color="green">169</FONT>          throws IntegratorException {<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>          super.sanityChecks(equations, t0, y0, t, y);<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>          if ((vecAbsoluteTolerance != null) &amp;&amp; (vecAbsoluteTolerance.length != y0.length)) {<a name="line.173"></a>
+<FONT color="green">174</FONT>              throw new IntegratorException(<a name="line.174"></a>
+<FONT color="green">175</FONT>                      "dimensions mismatch: state vector has dimension {0}," +<a name="line.175"></a>
+<FONT color="green">176</FONT>                      " absolute tolerance vector has dimension {1}",<a name="line.176"></a>
+<FONT color="green">177</FONT>                      y0.length, vecAbsoluteTolerance.length);<a name="line.177"></a>
+<FONT color="green">178</FONT>          }<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>          if ((vecRelativeTolerance != null) &amp;&amp; (vecRelativeTolerance.length != y0.length)) {<a name="line.180"></a>
+<FONT color="green">181</FONT>              throw new IntegratorException(<a name="line.181"></a>
+<FONT color="green">182</FONT>                      "dimensions mismatch: state vector has dimension {0}," +<a name="line.182"></a>
+<FONT color="green">183</FONT>                      " relative tolerance vector has dimension {1}",<a name="line.183"></a>
+<FONT color="green">184</FONT>                      y0.length, vecRelativeTolerance.length);<a name="line.184"></a>
+<FONT color="green">185</FONT>          }<a name="line.185"></a>
+<FONT color="green">186</FONT>    <a name="line.186"></a>
+<FONT color="green">187</FONT>      }<a name="line.187"></a>
+<FONT color="green">188</FONT>    <a name="line.188"></a>
+<FONT color="green">189</FONT>      /** Initialize the integration step.<a name="line.189"></a>
+<FONT color="green">190</FONT>       * @param equations differential equations set<a name="line.190"></a>
+<FONT color="green">191</FONT>       * @param forward forward integration indicator<a name="line.191"></a>
+<FONT color="green">192</FONT>       * @param order order of the method<a name="line.192"></a>
+<FONT color="green">193</FONT>       * @param scale scaling vector for the state vector<a name="line.193"></a>
+<FONT color="green">194</FONT>       * @param t0 start time<a name="line.194"></a>
+<FONT color="green">195</FONT>       * @param y0 state vector at t0<a name="line.195"></a>
+<FONT color="green">196</FONT>       * @param yDot0 first time derivative of y0<a name="line.196"></a>
+<FONT color="green">197</FONT>       * @param y1 work array for a state vector<a name="line.197"></a>
+<FONT color="green">198</FONT>       * @param yDot1 work array for the first time derivative of y1<a name="line.198"></a>
+<FONT color="green">199</FONT>       * @return first integration step<a name="line.199"></a>
+<FONT color="green">200</FONT>       * @exception DerivativeException this exception is propagated to<a name="line.200"></a>
+<FONT color="green">201</FONT>       * the caller if the underlying user function triggers one<a name="line.201"></a>
+<FONT color="green">202</FONT>       */<a name="line.202"></a>
+<FONT color="green">203</FONT>      public double initializeStep(final FirstOrderDifferentialEquations equations,<a name="line.203"></a>
+<FONT color="green">204</FONT>                                   final boolean forward, final int order, final double[] scale,<a name="line.204"></a>
+<FONT color="green">205</FONT>                                   final double t0, final double[] y0, final double[] yDot0,<a name="line.205"></a>
+<FONT color="green">206</FONT>                                   final double[] y1, final double[] yDot1)<a name="line.206"></a>
+<FONT color="green">207</FONT>          throws DerivativeException {<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>        if (initialStep &gt; 0) {<a name="line.209"></a>
+<FONT color="green">210</FONT>          // use the user provided value<a name="line.210"></a>
+<FONT color="green">211</FONT>          return forward ? initialStep : -initialStep;<a name="line.211"></a>
+<FONT color="green">212</FONT>        }<a name="line.212"></a>
+<FONT color="green">213</FONT>    <a name="line.213"></a>
+<FONT color="green">214</FONT>        // very rough first guess : h = 0.01 * ||y/scale|| / ||y'/scale||<a name="line.214"></a>
+<FONT color="green">215</FONT>        // this guess will be used to perform an Euler step<a name="line.215"></a>
+<FONT color="green">216</FONT>        double ratio;<a name="line.216"></a>
+<FONT color="green">217</FONT>        double yOnScale2 = 0;<a name="line.217"></a>
+<FONT color="green">218</FONT>        double yDotOnScale2 = 0;<a name="line.218"></a>
+<FONT color="green">219</FONT>        for (int j = 0; j &lt; y0.length; ++j) {<a name="line.219"></a>
+<FONT color="green">220</FONT>          ratio         = y0[j] / scale[j];<a name="line.220"></a>
+<FONT color="green">221</FONT>          yOnScale2    += ratio * ratio;<a name="line.221"></a>
+<FONT color="green">222</FONT>          ratio         = yDot0[j] / scale[j];<a name="line.222"></a>
+<FONT color="green">223</FONT>          yDotOnScale2 += ratio * ratio;<a name="line.223"></a>
+<FONT color="green">224</FONT>        }<a name="line.224"></a>
+<FONT color="green">225</FONT>    <a name="line.225"></a>
+<FONT color="green">226</FONT>        double h = ((yOnScale2 &lt; 1.0e-10) || (yDotOnScale2 &lt; 1.0e-10)) ?<a name="line.226"></a>
+<FONT color="green">227</FONT>                   1.0e-6 : (0.01 * Math.sqrt(yOnScale2 / yDotOnScale2));<a name="line.227"></a>
+<FONT color="green">228</FONT>        if (! forward) {<a name="line.228"></a>
+<FONT color="green">229</FONT>          h = -h;<a name="line.229"></a>
+<FONT color="green">230</FONT>        }<a name="line.230"></a>
+<FONT color="green">231</FONT>    <a name="line.231"></a>
+<FONT color="green">232</FONT>        // perform an Euler step using the preceding rough guess<a name="line.232"></a>
+<FONT color="green">233</FONT>        for (int j = 0; j &lt; y0.length; ++j) {<a name="line.233"></a>
+<FONT color="green">234</FONT>          y1[j] = y0[j] + h * yDot0[j];<a name="line.234"></a>
+<FONT color="green">235</FONT>        }<a name="line.235"></a>
+<FONT color="green">236</FONT>        computeDerivatives(t0 + h, y1, yDot1);<a name="line.236"></a>
+<FONT color="green">237</FONT>    <a name="line.237"></a>
+<FONT color="green">238</FONT>        // estimate the second derivative of the solution<a name="line.238"></a>
+<FONT color="green">239</FONT>        double yDDotOnScale = 0;<a name="line.239"></a>
+<FONT color="green">240</FONT>        for (int j = 0; j &lt; y0.length; ++j) {<a name="line.240"></a>
+<FONT color="green">241</FONT>          ratio         = (yDot1[j] - yDot0[j]) / scale[j];<a name="line.241"></a>
+<FONT color="green">242</FONT>          yDDotOnScale += ratio * ratio;<a name="line.242"></a>
+<FONT color="green">243</FONT>        }<a name="line.243"></a>
+<FONT color="green">244</FONT>        yDDotOnScale = Math.sqrt(yDDotOnScale) / h;<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>        // step size is computed such that<a name="line.246"></a>
+<FONT color="green">247</FONT>        // h^order * max (||y'/tol||, ||y''/tol||) = 0.01<a name="line.247"></a>
+<FONT color="green">248</FONT>        final double maxInv2 = Math.max(Math.sqrt(yDotOnScale2), yDDotOnScale);<a name="line.248"></a>
+<FONT color="green">249</FONT>        final double h1 = (maxInv2 &lt; 1.0e-15) ?<a name="line.249"></a>
+<FONT color="green">250</FONT>                          Math.max(1.0e-6, 0.001 * Math.abs(h)) :<a name="line.250"></a>
+<FONT color="green">251</FONT>                          Math.pow(0.01 / maxInv2, 1.0 / order);<a name="line.251"></a>
+<FONT color="green">252</FONT>        h = Math.min(100.0 * Math.abs(h), h1);<a name="line.252"></a>
+<FONT color="green">253</FONT>        h = Math.max(h, 1.0e-12 * Math.abs(t0));  // avoids cancellation when computing t1 - t0<a name="line.253"></a>
+<FONT color="green">254</FONT>        if (h &lt; getMinStep()) {<a name="line.254"></a>
+<FONT color="green">255</FONT>          h = getMinStep();<a name="line.255"></a>
+<FONT color="green">256</FONT>        }<a name="line.256"></a>
+<FONT color="green">257</FONT>        if (h &gt; getMaxStep()) {<a name="line.257"></a>
+<FONT color="green">258</FONT>          h = getMaxStep();<a name="line.258"></a>
+<FONT color="green">259</FONT>        }<a name="line.259"></a>
+<FONT color="green">260</FONT>        if (! forward) {<a name="line.260"></a>
+<FONT color="green">261</FONT>          h = -h;<a name="line.261"></a>
+<FONT color="green">262</FONT>        }<a name="line.262"></a>
+<FONT color="green">263</FONT>    <a name="line.263"></a>
+<FONT color="green">264</FONT>        return h;<a name="line.264"></a>
+<FONT color="green">265</FONT>    <a name="line.265"></a>
+<FONT color="green">266</FONT>      }<a name="line.266"></a>
+<FONT color="green">267</FONT>    <a name="line.267"></a>
+<FONT color="green">268</FONT>      /** Filter the integration step.<a name="line.268"></a>
+<FONT color="green">269</FONT>       * @param h signed step<a name="line.269"></a>
+<FONT color="green">270</FONT>       * @param forward forward integration indicator<a name="line.270"></a>
+<FONT color="green">271</FONT>       * @param acceptSmall if true, steps smaller than the minimal value<a name="line.271"></a>
+<FONT color="green">272</FONT>       * are silently increased up to this value, if false such small<a name="line.272"></a>
+<FONT color="green">273</FONT>       * steps generate an exception<a name="line.273"></a>
+<FONT color="green">274</FONT>       * @return a bounded integration step (h if no bound is reach, or a bounded value)<a name="line.274"></a>
+<FONT color="green">275</FONT>       * @exception IntegratorException if the step is too small and acceptSmall is false<a name="line.275"></a>
+<FONT color="green">276</FONT>       */<a name="line.276"></a>
+<FONT color="green">277</FONT>      protected double filterStep(final double h, final boolean forward, final boolean acceptSmall)<a name="line.277"></a>
+<FONT color="green">278</FONT>        throws IntegratorException {<a name="line.278"></a>
+<FONT color="green">279</FONT>    <a name="line.279"></a>
+<FONT color="green">280</FONT>          double filteredH = h;<a name="line.280"></a>
+<FONT color="green">281</FONT>          if (Math.abs(h) &lt; minStep) {<a name="line.281"></a>
+<FONT color="green">282</FONT>              if (acceptSmall) {<a name="line.282"></a>
+<FONT color="green">283</FONT>                  filteredH = forward ? minStep : -minStep;<a name="line.283"></a>
+<FONT color="green">284</FONT>              } else {<a name="line.284"></a>
+<FONT color="green">285</FONT>                  throw new IntegratorException(<a name="line.285"></a>
+<FONT color="green">286</FONT>                          "minimal step size ({0,number,0.00E00}) reached, integration needs {1,number,0.00E00}",<a name="line.286"></a>
+<FONT color="green">287</FONT>                          minStep, Math.abs(h));<a name="line.287"></a>
+<FONT color="green">288</FONT>              }<a name="line.288"></a>
+<FONT color="green">289</FONT>          }<a name="line.289"></a>
+<FONT color="green">290</FONT>    <a name="line.290"></a>
+<FONT color="green">291</FONT>          if (filteredH &gt; maxStep) {<a name="line.291"></a>
+<FONT color="green">292</FONT>              filteredH = maxStep;<a name="line.292"></a>
+<FONT color="green">293</FONT>          } else if (filteredH &lt; -maxStep) {<a name="line.293"></a>
+<FONT color="green">294</FONT>              filteredH = -maxStep;<a name="line.294"></a>
+<FONT color="green">295</FONT>          }<a name="line.295"></a>
+<FONT color="green">296</FONT>    <a name="line.296"></a>
+<FONT color="green">297</FONT>          return filteredH;<a name="line.297"></a>
+<FONT color="green">298</FONT>    <a name="line.298"></a>
+<FONT color="green">299</FONT>      }<a name="line.299"></a>
+<FONT color="green">300</FONT>    <a name="line.300"></a>
+<FONT color="green">301</FONT>      /** {@inheritDoc} */<a name="line.301"></a>
+<FONT color="green">302</FONT>      public abstract double integrate (FirstOrderDifferentialEquations equations,<a name="line.302"></a>
+<FONT color="green">303</FONT>                                        double t0, double[] y0,<a name="line.303"></a>
+<FONT color="green">304</FONT>                                        double t, double[] y)<a name="line.304"></a>
+<FONT color="green">305</FONT>        throws DerivativeException, IntegratorException;<a name="line.305"></a>
+<FONT color="green">306</FONT>    <a name="line.306"></a>
+<FONT color="green">307</FONT>      /** {@inheritDoc} */<a name="line.307"></a>
+<FONT color="green">308</FONT>      @Override<a name="line.308"></a>
+<FONT color="green">309</FONT>      public double getCurrentStepStart() {<a name="line.309"></a>
+<FONT color="green">310</FONT>        return stepStart;<a name="line.310"></a>
+<FONT color="green">311</FONT>      }<a name="line.311"></a>
+<FONT color="green">312</FONT>    <a name="line.312"></a>
+<FONT color="green">313</FONT>      /** Reset internal state to dummy values. */<a name="line.313"></a>
+<FONT color="green">314</FONT>      protected void resetInternalState() {<a name="line.314"></a>
+<FONT color="green">315</FONT>        stepStart = Double.NaN;<a name="line.315"></a>
+<FONT color="green">316</FONT>        stepSize  = Math.sqrt(minStep * maxStep);<a name="line.316"></a>
+<FONT color="green">317</FONT>      }<a name="line.317"></a>
+<FONT color="green">318</FONT>    <a name="line.318"></a>
+<FONT color="green">319</FONT>      /** Get the minimal step.<a name="line.319"></a>
+<FONT color="green">320</FONT>       * @return minimal step<a name="line.320"></a>
+<FONT color="green">321</FONT>       */<a name="line.321"></a>
+<FONT color="green">322</FONT>      public double getMinStep() {<a name="line.322"></a>
+<FONT color="green">323</FONT>        return minStep;<a name="line.323"></a>
+<FONT color="green">324</FONT>      }<a name="line.324"></a>
+<FONT color="green">325</FONT>    <a name="line.325"></a>
+<FONT color="green">326</FONT>      /** Get the maximal step.<a name="line.326"></a>
+<FONT color="green">327</FONT>       * @return maximal step<a name="line.327"></a>
+<FONT color="green">328</FONT>       */<a name="line.328"></a>
+<FONT color="green">329</FONT>      public double getMaxStep() {<a name="line.329"></a>
+<FONT color="green">330</FONT>        return maxStep;<a name="line.330"></a>
+<FONT color="green">331</FONT>      }<a name="line.331"></a>
+<FONT color="green">332</FONT>    <a name="line.332"></a>
+<FONT color="green">333</FONT>    }<a name="line.333"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,141 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.nonstiff;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * This class implements the classical fourth order Runge-Kutta<a name="line.22"></a>
+<FONT color="green">023</FONT>     * integrator for Ordinary Differential Equations (it is the most<a name="line.23"></a>
+<FONT color="green">024</FONT>     * often used Runge-Kutta method).<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;This method is an explicit Runge-Kutta method, its Butcher-array<a name="line.26"></a>
+<FONT color="green">027</FONT>     * is the following one :<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;pre&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     *    0  |  0    0    0    0<a name="line.29"></a>
+<FONT color="green">030</FONT>     *   1/2 | 1/2   0    0    0<a name="line.30"></a>
+<FONT color="green">031</FONT>     *   1/2 |  0   1/2   0    0<a name="line.31"></a>
+<FONT color="green">032</FONT>     *    1  |  0    0    1    0<a name="line.32"></a>
+<FONT color="green">033</FONT>     *       |--------------------<a name="line.33"></a>
+<FONT color="green">034</FONT>     *       | 1/6  1/3  1/3  1/6<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;/pre&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @see EulerIntegrator<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @see GillIntegrator<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @see MidpointIntegrator<a name="line.40"></a>
+<FONT color="green">041</FONT>     * @see ThreeEighthesIntegrator<a name="line.41"></a>
+<FONT color="green">042</FONT>     * @version $Revision: 810196 $ $Date: 2009-09-01 15:47:46 -0400 (Tue, 01 Sep 2009) $<a name="line.42"></a>
+<FONT color="green">043</FONT>     * @since 1.2<a name="line.43"></a>
+<FONT color="green">044</FONT>     */<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>    public class ClassicalRungeKuttaIntegrator extends RungeKuttaIntegrator {<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>      /** Time steps Butcher array. */<a name="line.48"></a>
+<FONT color="green">049</FONT>      private static final double[] STATIC_C = {<a name="line.49"></a>
+<FONT color="green">050</FONT>        1.0 / 2.0, 1.0 / 2.0, 1.0<a name="line.50"></a>
+<FONT color="green">051</FONT>      };<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>      /** Internal weights Butcher array. */<a name="line.53"></a>
+<FONT color="green">054</FONT>      private static final double[][] STATIC_A = {<a name="line.54"></a>
+<FONT color="green">055</FONT>        { 1.0 / 2.0 },<a name="line.55"></a>
+<FONT color="green">056</FONT>        { 0.0, 1.0 / 2.0 },<a name="line.56"></a>
+<FONT color="green">057</FONT>        { 0.0, 0.0, 1.0 }<a name="line.57"></a>
+<FONT color="green">058</FONT>      };<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>      /** Propagation weights Butcher array. */<a name="line.60"></a>
+<FONT color="green">061</FONT>      private static final double[] STATIC_B = {<a name="line.61"></a>
+<FONT color="green">062</FONT>        1.0 / 6.0, 1.0 / 3.0, 1.0 / 3.0, 1.0 / 6.0<a name="line.62"></a>
+<FONT color="green">063</FONT>      };<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>      /** Simple constructor.<a name="line.65"></a>
+<FONT color="green">066</FONT>       * Build a fourth-order Runge-Kutta integrator with the given<a name="line.66"></a>
+<FONT color="green">067</FONT>       * step.<a name="line.67"></a>
+<FONT color="green">068</FONT>       * @param step integration step<a name="line.68"></a>
+<FONT color="green">069</FONT>       */<a name="line.69"></a>
+<FONT color="green">070</FONT>      public ClassicalRungeKuttaIntegrator(final double step) {<a name="line.70"></a>
+<FONT color="green">071</FONT>        super("classical Runge-Kutta", STATIC_C, STATIC_A, STATIC_B,<a name="line.71"></a>
+<FONT color="green">072</FONT>              new ClassicalRungeKuttaStepInterpolator(), step);<a name="line.72"></a>
+<FONT color="green">073</FONT>      }<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>    }<a name="line.75"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/DormandPrince54Integrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,222 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.nonstiff;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * This class implements the 5(4) Dormand-Prince integrator for Ordinary<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Differential Equations.<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;This integrator is an embedded Runge-Kutta integrator<a name="line.25"></a>
+<FONT color="green">026</FONT>     * of order 5(4) used in local extrapolation mode (i.e. the solution<a name="line.26"></a>
+<FONT color="green">027</FONT>     * is computed using the high order formula) with stepsize control<a name="line.27"></a>
+<FONT color="green">028</FONT>     * (and automatic step initialization) and continuous output. This<a name="line.28"></a>
+<FONT color="green">029</FONT>     * method uses 7 functions evaluations per step. However, since this<a name="line.29"></a>
+<FONT color="green">030</FONT>     * is an &lt;i&gt;fsal&lt;/i&gt;, the last evaluation of one step is the same as<a name="line.30"></a>
+<FONT color="green">031</FONT>     * the first evaluation of the next step and hence can be avoided. So<a name="line.31"></a>
+<FONT color="green">032</FONT>     * the cost is really 6 functions evaluations per step.&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;p&gt;This method has been published (whithout the continuous output<a name="line.34"></a>
+<FONT color="green">035</FONT>     * that was added by Shampine in 1986) in the following article :<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;pre&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *  A family of embedded Runge-Kutta formulae<a name="line.37"></a>
+<FONT color="green">038</FONT>     *  J. R. Dormand and P. J. Prince<a name="line.38"></a>
+<FONT color="green">039</FONT>     *  Journal of Computational and Applied Mathematics<a name="line.39"></a>
+<FONT color="green">040</FONT>     *  volume 6, no 1, 1980, pp. 19-26<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;/pre&gt;&lt;/p&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     *<a name="line.42"></a>
+<FONT color="green">043</FONT>     * @version $Revision: 810196 $ $Date: 2009-09-01 15:47:46 -0400 (Tue, 01 Sep 2009) $<a name="line.43"></a>
+<FONT color="green">044</FONT>     * @since 1.2<a name="line.44"></a>
+<FONT color="green">045</FONT>     */<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>    public class DormandPrince54Integrator extends EmbeddedRungeKuttaIntegrator {<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>      /** Integrator method name. */<a name="line.49"></a>
+<FONT color="green">050</FONT>      private static final String METHOD_NAME = "Dormand-Prince 5(4)";<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>      /** Time steps Butcher array. */<a name="line.52"></a>
+<FONT color="green">053</FONT>      private static final double[] STATIC_C = {<a name="line.53"></a>
+<FONT color="green">054</FONT>        1.0/5.0, 3.0/10.0, 4.0/5.0, 8.0/9.0, 1.0, 1.0<a name="line.54"></a>
+<FONT color="green">055</FONT>      };<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>      /** Internal weights Butcher array. */<a name="line.57"></a>
+<FONT color="green">058</FONT>      private static final double[][] STATIC_A = {<a name="line.58"></a>
+<FONT color="green">059</FONT>        {1.0/5.0},<a name="line.59"></a>
+<FONT color="green">060</FONT>        {3.0/40.0, 9.0/40.0},<a name="line.60"></a>
+<FONT color="green">061</FONT>        {44.0/45.0, -56.0/15.0, 32.0/9.0},<a name="line.61"></a>
+<FONT color="green">062</FONT>        {19372.0/6561.0, -25360.0/2187.0, 64448.0/6561.0,  -212.0/729.0},<a name="line.62"></a>
+<FONT color="green">063</FONT>        {9017.0/3168.0, -355.0/33.0, 46732.0/5247.0, 49.0/176.0, -5103.0/18656.0},<a name="line.63"></a>
+<FONT color="green">064</FONT>        {35.0/384.0, 0.0, 500.0/1113.0, 125.0/192.0, -2187.0/6784.0, 11.0/84.0}<a name="line.64"></a>
+<FONT color="green">065</FONT>      };<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>      /** Propagation weights Butcher array. */<a name="line.67"></a>
+<FONT color="green">068</FONT>      private static final double[] STATIC_B = {<a name="line.68"></a>
+<FONT color="green">069</FONT>        35.0/384.0, 0.0, 500.0/1113.0, 125.0/192.0, -2187.0/6784.0, 11.0/84.0, 0.0<a name="line.69"></a>
+<FONT color="green">070</FONT>      };<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>      /** Error array, element 1. */<a name="line.72"></a>
+<FONT color="green">073</FONT>      private static final double E1 =     71.0 / 57600.0;<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>      // element 2 is zero, so it is neither stored nor used<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>      /** Error array, element 3. */<a name="line.77"></a>
+<FONT color="green">078</FONT>      private static final double E3 =    -71.0 / 16695.0;<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>      /** Error array, element 4. */<a name="line.80"></a>
+<FONT color="green">081</FONT>      private static final double E4 =     71.0 / 1920.0;<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>      /** Error array, element 5. */<a name="line.83"></a>
+<FONT color="green">084</FONT>      private static final double E5 = -17253.0 / 339200.0;<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>      /** Error array, element 6. */<a name="line.86"></a>
+<FONT color="green">087</FONT>      private static final double E6 =     22.0 / 525.0;<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>      /** Error array, element 7. */<a name="line.89"></a>
+<FONT color="green">090</FONT>      private static final double E7 =     -1.0 / 40.0;<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>      /** Simple constructor.<a name="line.92"></a>
+<FONT color="green">093</FONT>       * Build a fifth order Dormand-Prince integrator with the given step bounds<a name="line.93"></a>
+<FONT color="green">094</FONT>       * @param minStep minimal step (must be positive even for backward<a name="line.94"></a>
+<FONT color="green">095</FONT>       * integration), the last step can be smaller than this<a name="line.95"></a>
+<FONT color="green">096</FONT>       * @param maxStep maximal step (must be positive even for backward<a name="line.96"></a>
+<FONT color="green">097</FONT>       * integration)<a name="line.97"></a>
+<FONT color="green">098</FONT>       * @param scalAbsoluteTolerance allowed absolute error<a name="line.98"></a>
+<FONT color="green">099</FONT>       * @param scalRelativeTolerance allowed relative error<a name="line.99"></a>
+<FONT color="green">100</FONT>       */<a name="line.100"></a>
+<FONT color="green">101</FONT>      public DormandPrince54Integrator(final double minStep, final double maxStep,<a name="line.101"></a>
+<FONT color="green">102</FONT>                                       final double scalAbsoluteTolerance,<a name="line.102"></a>
+<FONT color="green">103</FONT>                                       final double scalRelativeTolerance) {<a name="line.103"></a>
+<FONT color="green">104</FONT>        super(METHOD_NAME, true, STATIC_C, STATIC_A, STATIC_B, new DormandPrince54StepInterpolator(),<a name="line.104"></a>
+<FONT color="green">105</FONT>              minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance);<a name="line.105"></a>
+<FONT color="green">106</FONT>      }<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>      /** Simple constructor.<a name="line.108"></a>
+<FONT color="green">109</FONT>       * Build a fifth order Dormand-Prince integrator with the given step bounds<a name="line.109"></a>
+<FONT color="green">110</FONT>       * @param minStep minimal step (must be positive even for backward<a name="line.110"></a>
+<FONT color="green">111</FONT>       * integration), the last step can be smaller than this<a name="line.111"></a>
+<FONT color="green">112</FONT>       * @param maxStep maximal step (must be positive even for backward<a name="line.112"></a>
+<FONT color="green">113</FONT>       * integration)<a name="line.113"></a>
+<FONT color="green">114</FONT>       * @param vecAbsoluteTolerance allowed absolute error<a name="line.114"></a>
+<FONT color="green">115</FONT>       * @param vecRelativeTolerance allowed relative error<a name="line.115"></a>
+<FONT color="green">116</FONT>       */<a name="line.116"></a>
+<FONT color="green">117</FONT>      public DormandPrince54Integrator(final double minStep, final double maxStep,<a name="line.117"></a>
+<FONT color="green">118</FONT>                                       final double[] vecAbsoluteTolerance,<a name="line.118"></a>
+<FONT color="green">119</FONT>                                       final double[] vecRelativeTolerance) {<a name="line.119"></a>
+<FONT color="green">120</FONT>        super(METHOD_NAME, true, STATIC_C, STATIC_A, STATIC_B, new DormandPrince54StepInterpolator(),<a name="line.120"></a>
+<FONT color="green">121</FONT>              minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance);<a name="line.121"></a>
+<FONT color="green">122</FONT>      }<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>      /** {@inheritDoc} */<a name="line.124"></a>
+<FONT color="green">125</FONT>      @Override<a name="line.125"></a>
+<FONT color="green">126</FONT>      public int getOrder() {<a name="line.126"></a>
+<FONT color="green">127</FONT>        return 5;<a name="line.127"></a>
+<FONT color="green">128</FONT>      }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>      /** {@inheritDoc} */<a name="line.130"></a>
+<FONT color="green">131</FONT>      @Override<a name="line.131"></a>
+<FONT color="green">132</FONT>      protected double estimateError(final double[][] yDotK,<a name="line.132"></a>
+<FONT color="green">133</FONT>                                     final double[] y0, final double[] y1,<a name="line.133"></a>
+<FONT color="green">134</FONT>                                     final double h) {<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>        double error = 0;<a name="line.136"></a>
+<FONT color="green">137</FONT>    <a name="line.137"></a>
+<FONT color="green">138</FONT>        for (int j = 0; j &lt; y0.length; ++j) {<a name="line.138"></a>
+<FONT color="green">139</FONT>            final double errSum = E1 * yDotK[0][j] +  E3 * yDotK[2][j] +<a name="line.139"></a>
+<FONT color="green">140</FONT>                                  E4 * yDotK[3][j] +  E5 * yDotK[4][j] +<a name="line.140"></a>
+<FONT color="green">141</FONT>                                  E6 * yDotK[5][j] +  E7 * yDotK[6][j];<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>            final double yScale = Math.max(Math.abs(y0[j]), Math.abs(y1[j]));<a name="line.143"></a>
+<FONT color="green">144</FONT>            final double tol = (vecAbsoluteTolerance == null) ?<a name="line.144"></a>
+<FONT color="green">145</FONT>                               (scalAbsoluteTolerance + scalRelativeTolerance * yScale) :<a name="line.145"></a>
+<FONT color="green">146</FONT>                                   (vecAbsoluteTolerance[j] + vecRelativeTolerance[j] * yScale);<a name="line.146"></a>
+<FONT color="green">147</FONT>            final double ratio  = h * errSum / tol;<a name="line.147"></a>
+<FONT color="green">148</FONT>            error += ratio * ratio;<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>        }<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>        return Math.sqrt(error / y0.length);<a name="line.152"></a>
+<FONT color="green">153</FONT>    <a name="line.153"></a>
+<FONT color="green">154</FONT>      }<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>    }<a name="line.156"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/DormandPrince853Integrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,347 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.nonstiff;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * This class implements the 8(5,3) Dormand-Prince integrator for Ordinary<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Differential Equations.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;This integrator is an embedded Runge-Kutta integrator<a name="line.25"></a>
+<FONT color="green">026</FONT>     * of order 8(5,3) used in local extrapolation mode (i.e. the solution<a name="line.26"></a>
+<FONT color="green">027</FONT>     * is computed using the high order formula) with stepsize control<a name="line.27"></a>
+<FONT color="green">028</FONT>     * (and automatic step initialization) and continuous output. This<a name="line.28"></a>
+<FONT color="green">029</FONT>     * method uses 12 functions evaluations per step for integration and 4<a name="line.29"></a>
+<FONT color="green">030</FONT>     * evaluations for interpolation. However, since the first<a name="line.30"></a>
+<FONT color="green">031</FONT>     * interpolation evaluation is the same as the first integration<a name="line.31"></a>
+<FONT color="green">032</FONT>     * evaluation of the next step, we have included it in the integrator<a name="line.32"></a>
+<FONT color="green">033</FONT>     * rather than in the interpolator and specified the method was an<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;i&gt;fsal&lt;/i&gt;. Hence, despite we have 13 stages here, the cost is<a name="line.34"></a>
+<FONT color="green">035</FONT>     * really 12 evaluations per step even if no interpolation is done,<a name="line.35"></a>
+<FONT color="green">036</FONT>     * and the overcost of interpolation is only 3 evaluations.&lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *<a name="line.37"></a>
+<FONT color="green">038</FONT>     * &lt;p&gt;This method is based on an 8(6) method by Dormand and Prince<a name="line.38"></a>
+<FONT color="green">039</FONT>     * (i.e. order 8 for the integration and order 6 for error estimation)<a name="line.39"></a>
+<FONT color="green">040</FONT>     * modified by Hairer and Wanner to use a 5th order error estimator<a name="line.40"></a>
+<FONT color="green">041</FONT>     * with 3rd order correction. This modification was introduced because<a name="line.41"></a>
+<FONT color="green">042</FONT>     * the original method failed in some cases (wrong steps can be<a name="line.42"></a>
+<FONT color="green">043</FONT>     * accepted when step size is too large, for example in the<a name="line.43"></a>
+<FONT color="green">044</FONT>     * Brusselator problem) and also had &lt;i&gt;severe difficulties when<a name="line.44"></a>
+<FONT color="green">045</FONT>     * applied to problems with discontinuities&lt;/i&gt;. This modification is<a name="line.45"></a>
+<FONT color="green">046</FONT>     * explained in the second edition of the first volume (Nonstiff<a name="line.46"></a>
+<FONT color="green">047</FONT>     * Problems) of the reference book by Hairer, Norsett and Wanner:<a name="line.47"></a>
+<FONT color="green">048</FONT>     * &lt;i&gt;Solving Ordinary Differential Equations&lt;/i&gt; (Springer-Verlag,<a name="line.48"></a>
+<FONT color="green">049</FONT>     * ISBN 3-540-56670-8).&lt;/p&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     *<a name="line.50"></a>
+<FONT color="green">051</FONT>     * @version $Revision: 810196 $ $Date: 2009-09-01 15:47:46 -0400 (Tue, 01 Sep 2009) $<a name="line.51"></a>
+<FONT color="green">052</FONT>     * @since 1.2<a name="line.52"></a>
+<FONT color="green">053</FONT>     */<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>    public class DormandPrince853Integrator extends EmbeddedRungeKuttaIntegrator {<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>      /** Integrator method name. */<a name="line.57"></a>
+<FONT color="green">058</FONT>      private static final String METHOD_NAME = "Dormand-Prince 8 (5, 3)";<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>      /** Time steps Butcher array. */<a name="line.60"></a>
+<FONT color="green">061</FONT>      private static final double[] STATIC_C = {<a name="line.61"></a>
+<FONT color="green">062</FONT>        (12.0 - 2.0 * Math.sqrt(6.0)) / 135.0, (6.0 - Math.sqrt(6.0)) / 45.0, (6.0 - Math.sqrt(6.0)) / 30.0,<a name="line.62"></a>
+<FONT color="green">063</FONT>        (6.0 + Math.sqrt(6.0)) / 30.0, 1.0/3.0, 1.0/4.0, 4.0/13.0, 127.0/195.0, 3.0/5.0,<a name="line.63"></a>
+<FONT color="green">064</FONT>        6.0/7.0, 1.0, 1.0<a name="line.64"></a>
+<FONT color="green">065</FONT>      };<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>      /** Internal weights Butcher array. */<a name="line.67"></a>
+<FONT color="green">068</FONT>      private static final double[][] STATIC_A = {<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        // k2<a name="line.70"></a>
+<FONT color="green">071</FONT>        {(12.0 - 2.0 * Math.sqrt(6.0)) / 135.0},<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        // k3<a name="line.73"></a>
+<FONT color="green">074</FONT>        {(6.0 - Math.sqrt(6.0)) / 180.0, (6.0 - Math.sqrt(6.0)) / 60.0},<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        // k4<a name="line.76"></a>
+<FONT color="green">077</FONT>        {(6.0 - Math.sqrt(6.0)) / 120.0, 0.0, (6.0 - Math.sqrt(6.0)) / 40.0},<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        // k5<a name="line.79"></a>
+<FONT color="green">080</FONT>        {(462.0 + 107.0 * Math.sqrt(6.0)) / 3000.0, 0.0,<a name="line.80"></a>
+<FONT color="green">081</FONT>         (-402.0 - 197.0 * Math.sqrt(6.0)) / 1000.0, (168.0 + 73.0 * Math.sqrt(6.0)) / 375.0},<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        // k6<a name="line.83"></a>
+<FONT color="green">084</FONT>        {1.0 / 27.0, 0.0, 0.0, (16.0 + Math.sqrt(6.0)) / 108.0, (16.0 - Math.sqrt(6.0)) / 108.0},<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        // k7<a name="line.86"></a>
+<FONT color="green">087</FONT>        {19.0 / 512.0, 0.0, 0.0, (118.0 + 23.0 * Math.sqrt(6.0)) / 1024.0,<a name="line.87"></a>
+<FONT color="green">088</FONT>         (118.0 - 23.0 * Math.sqrt(6.0)) / 1024.0, -9.0 / 512.0},<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>        // k8<a name="line.90"></a>
+<FONT color="green">091</FONT>        {13772.0 / 371293.0, 0.0, 0.0, (51544.0 + 4784.0 * Math.sqrt(6.0)) / 371293.0,<a name="line.91"></a>
+<FONT color="green">092</FONT>         (51544.0 - 4784.0 * Math.sqrt(6.0)) / 371293.0, -5688.0 / 371293.0, 3072.0 / 371293.0},<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>        // k9<a name="line.94"></a>
+<FONT color="green">095</FONT>        {58656157643.0 / 93983540625.0, 0.0, 0.0,<a name="line.95"></a>
+<FONT color="green">096</FONT>         (-1324889724104.0 - 318801444819.0 * Math.sqrt(6.0)) / 626556937500.0,<a name="line.96"></a>
+<FONT color="green">097</FONT>         (-1324889724104.0 + 318801444819.0 * Math.sqrt(6.0)) / 626556937500.0,<a name="line.97"></a>
+<FONT color="green">098</FONT>         96044563816.0 / 3480871875.0, 5682451879168.0 / 281950621875.0,<a name="line.98"></a>
+<FONT color="green">099</FONT>         -165125654.0 / 3796875.0},<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        // k10<a name="line.101"></a>
+<FONT color="green">102</FONT>        {8909899.0 / 18653125.0, 0.0, 0.0,<a name="line.102"></a>
+<FONT color="green">103</FONT>         (-4521408.0 - 1137963.0 * Math.sqrt(6.0)) / 2937500.0,<a name="line.103"></a>
+<FONT color="green">104</FONT>         (-4521408.0 + 1137963.0 * Math.sqrt(6.0)) / 2937500.0,<a name="line.104"></a>
+<FONT color="green">105</FONT>         96663078.0 / 4553125.0, 2107245056.0 / 137915625.0,<a name="line.105"></a>
+<FONT color="green">106</FONT>         -4913652016.0 / 147609375.0, -78894270.0 / 3880452869.0},<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>        // k11<a name="line.108"></a>
+<FONT color="green">109</FONT>        {-20401265806.0 / 21769653311.0, 0.0, 0.0,<a name="line.109"></a>
+<FONT color="green">110</FONT>         (354216.0 + 94326.0 * Math.sqrt(6.0)) / 112847.0,<a name="line.110"></a>
+<FONT color="green">111</FONT>         (354216.0 - 94326.0 * Math.sqrt(6.0)) / 112847.0,<a name="line.111"></a>
+<FONT color="green">112</FONT>         -43306765128.0 / 5313852383.0, -20866708358144.0 / 1126708119789.0,<a name="line.112"></a>
+<FONT color="green">113</FONT>         14886003438020.0 / 654632330667.0, 35290686222309375.0 / 14152473387134411.0,<a name="line.113"></a>
+<FONT color="green">114</FONT>         -1477884375.0 / 485066827.0},<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>        // k12<a name="line.116"></a>
+<FONT color="green">117</FONT>        {39815761.0 / 17514443.0, 0.0, 0.0,<a name="line.117"></a>
+<FONT color="green">118</FONT>         (-3457480.0 - 960905.0 * Math.sqrt(6.0)) / 551636.0,<a name="line.118"></a>
+<FONT color="green">119</FONT>         (-3457480.0 + 960905.0 * Math.sqrt(6.0)) / 551636.0,<a name="line.119"></a>
+<FONT color="green">120</FONT>         -844554132.0 / 47026969.0, 8444996352.0 / 302158619.0,<a name="line.120"></a>
+<FONT color="green">121</FONT>         -2509602342.0 / 877790785.0, -28388795297996250.0 / 3199510091356783.0,<a name="line.121"></a>
+<FONT color="green">122</FONT>         226716250.0 / 18341897.0, 1371316744.0 / 2131383595.0},<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>        // k13 should be for interpolation only, but since it is the same<a name="line.124"></a>
+<FONT color="green">125</FONT>        // stage as the first evaluation of the next step, we perform it<a name="line.125"></a>
+<FONT color="green">126</FONT>        // here at no cost by specifying this is an fsal method<a name="line.126"></a>
+<FONT color="green">127</FONT>        {104257.0/1920240.0, 0.0, 0.0, 0.0, 0.0, 3399327.0/763840.0,<a name="line.127"></a>
+<FONT color="green">128</FONT>         66578432.0/35198415.0, -1674902723.0/288716400.0,<a name="line.128"></a>
+<FONT color="green">129</FONT>         54980371265625.0/176692375811392.0, -734375.0/4826304.0,<a name="line.129"></a>
+<FONT color="green">130</FONT>         171414593.0/851261400.0, 137909.0/3084480.0}<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>      };<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>      /** Propagation weights Butcher array. */<a name="line.134"></a>
+<FONT color="green">135</FONT>      private static final double[] STATIC_B = {<a name="line.135"></a>
+<FONT color="green">136</FONT>          104257.0/1920240.0,<a name="line.136"></a>
+<FONT color="green">137</FONT>          0.0,<a name="line.137"></a>
+<FONT color="green">138</FONT>          0.0,<a name="line.138"></a>
+<FONT color="green">139</FONT>          0.0,<a name="line.139"></a>
+<FONT color="green">140</FONT>          0.0,<a name="line.140"></a>
+<FONT color="green">141</FONT>          3399327.0/763840.0,<a name="line.141"></a>
+<FONT color="green">142</FONT>          66578432.0/35198415.0,<a name="line.142"></a>
+<FONT color="green">143</FONT>          -1674902723.0/288716400.0,<a name="line.143"></a>
+<FONT color="green">144</FONT>          54980371265625.0/176692375811392.0,<a name="line.144"></a>
+<FONT color="green">145</FONT>          -734375.0/4826304.0,<a name="line.145"></a>
+<FONT color="green">146</FONT>          171414593.0/851261400.0,<a name="line.146"></a>
+<FONT color="green">147</FONT>          137909.0/3084480.0,<a name="line.147"></a>
+<FONT color="green">148</FONT>          0.0<a name="line.148"></a>
+<FONT color="green">149</FONT>      };<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>      /** First error weights array, element 1. */<a name="line.151"></a>
+<FONT color="green">152</FONT>      private static final double E1_01 =         116092271.0 / 8848465920.0;<a name="line.152"></a>
+<FONT color="green">153</FONT>    <a name="line.153"></a>
+<FONT color="green">154</FONT>      // elements 2 to 5 are zero, so they are neither stored nor used<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>      /** First error weights array, element 6. */<a name="line.156"></a>
+<FONT color="green">157</FONT>      private static final double E1_06 =          -1871647.0 / 1527680.0;<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>      /** First error weights array, element 7. */<a name="line.159"></a>
+<FONT color="green">160</FONT>      private static final double E1_07 =         -69799717.0 / 140793660.0;<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>      /** First error weights array, element 8. */<a name="line.162"></a>
+<FONT color="green">163</FONT>      private static final double E1_08 =     1230164450203.0 / 739113984000.0;<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>      /** First error weights array, element 9. */<a name="line.165"></a>
+<FONT color="green">166</FONT>      private static final double E1_09 = -1980813971228885.0 / 5654156025964544.0;<a name="line.166"></a>
+<FONT color="green">167</FONT>    <a name="line.167"></a>
+<FONT color="green">168</FONT>      /** First error weights array, element 10. */<a name="line.168"></a>
+<FONT color="green">169</FONT>      private static final double E1_10 =         464500805.0 / 1389975552.0;<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>      /** First error weights array, element 11. */<a name="line.171"></a>
+<FONT color="green">172</FONT>      private static final double E1_11 =     1606764981773.0 / 19613062656000.0;<a name="line.172"></a>
+<FONT color="green">173</FONT>    <a name="line.173"></a>
+<FONT color="green">174</FONT>      /** First error weights array, element 12. */<a name="line.174"></a>
+<FONT color="green">175</FONT>      private static final double E1_12 =           -137909.0 / 6168960.0;<a name="line.175"></a>
+<FONT color="green">176</FONT>    <a name="line.176"></a>
+<FONT color="green">177</FONT>    <a name="line.177"></a>
+<FONT color="green">178</FONT>      /** Second error weights array, element 1. */<a name="line.178"></a>
+<FONT color="green">179</FONT>      private static final double E2_01 =           -364463.0 / 1920240.0;<a name="line.179"></a>
+<FONT color="green">180</FONT>    <a name="line.180"></a>
+<FONT color="green">181</FONT>      // elements 2 to 5 are zero, so they are neither stored nor used<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>      /** Second error weights array, element 6. */<a name="line.183"></a>
+<FONT color="green">184</FONT>      private static final double E2_06 =           3399327.0 / 763840.0;<a name="line.184"></a>
+<FONT color="green">185</FONT>    <a name="line.185"></a>
+<FONT color="green">186</FONT>      /** Second error weights array, element 7. */<a name="line.186"></a>
+<FONT color="green">187</FONT>      private static final double E2_07 =          66578432.0 / 35198415.0;<a name="line.187"></a>
+<FONT color="green">188</FONT>    <a name="line.188"></a>
+<FONT color="green">189</FONT>      /** Second error weights array, element 8. */<a name="line.189"></a>
+<FONT color="green">190</FONT>      private static final double E2_08 =       -1674902723.0 / 288716400.0;<a name="line.190"></a>
+<FONT color="green">191</FONT>    <a name="line.191"></a>
+<FONT color="green">192</FONT>      /** Second error weights array, element 9. */<a name="line.192"></a>
+<FONT color="green">193</FONT>      private static final double E2_09 =   -74684743568175.0 / 176692375811392.0;<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>      /** Second error weights array, element 10. */<a name="line.195"></a>
+<FONT color="green">196</FONT>      private static final double E2_10 =           -734375.0 / 4826304.0;<a name="line.196"></a>
+<FONT color="green">197</FONT>    <a name="line.197"></a>
+<FONT color="green">198</FONT>      /** Second error weights array, element 11. */<a name="line.198"></a>
+<FONT color="green">199</FONT>      private static final double E2_11 =         171414593.0 / 851261400.0;<a name="line.199"></a>
+<FONT color="green">200</FONT>    <a name="line.200"></a>
+<FONT color="green">201</FONT>      /** Second error weights array, element 12. */<a name="line.201"></a>
+<FONT color="green">202</FONT>      private static final double E2_12 =             69869.0 / 3084480.0;<a name="line.202"></a>
+<FONT color="green">203</FONT>    <a name="line.203"></a>
+<FONT color="green">204</FONT>      /** Simple constructor.<a name="line.204"></a>
+<FONT color="green">205</FONT>       * Build an eighth order Dormand-Prince integrator with the given step bounds<a name="line.205"></a>
+<FONT color="green">206</FONT>       * @param minStep minimal step (must be positive even for backward<a name="line.206"></a>
+<FONT color="green">207</FONT>       * integration), the last step can be smaller than this<a name="line.207"></a>
+<FONT color="green">208</FONT>       * @param maxStep maximal step (must be positive even for backward<a name="line.208"></a>
+<FONT color="green">209</FONT>       * integration)<a name="line.209"></a>
+<FONT color="green">210</FONT>       * @param scalAbsoluteTolerance allowed absolute error<a name="line.210"></a>
+<FONT color="green">211</FONT>       * @param scalRelativeTolerance allowed relative error<a name="line.211"></a>
+<FONT color="green">212</FONT>       */<a name="line.212"></a>
+<FONT color="green">213</FONT>      public DormandPrince853Integrator(final double minStep, final double maxStep,<a name="line.213"></a>
+<FONT color="green">214</FONT>                                        final double scalAbsoluteTolerance,<a name="line.214"></a>
+<FONT color="green">215</FONT>                                        final double scalRelativeTolerance) {<a name="line.215"></a>
+<FONT color="green">216</FONT>        super(METHOD_NAME, true, STATIC_C, STATIC_A, STATIC_B,<a name="line.216"></a>
+<FONT color="green">217</FONT>              new DormandPrince853StepInterpolator(),<a name="line.217"></a>
+<FONT color="green">218</FONT>              minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance);<a name="line.218"></a>
+<FONT color="green">219</FONT>      }<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>      /** Simple constructor.<a name="line.221"></a>
+<FONT color="green">222</FONT>       * Build an eighth order Dormand-Prince integrator with the given step bounds<a name="line.222"></a>
+<FONT color="green">223</FONT>       * @param minStep minimal step (must be positive even for backward<a name="line.223"></a>
+<FONT color="green">224</FONT>       * integration), the last step can be smaller than this<a name="line.224"></a>
+<FONT color="green">225</FONT>       * @param maxStep maximal step (must be positive even for backward<a name="line.225"></a>
+<FONT color="green">226</FONT>       * integration)<a name="line.226"></a>
+<FONT color="green">227</FONT>       * @param vecAbsoluteTolerance allowed absolute error<a name="line.227"></a>
+<FONT color="green">228</FONT>       * @param vecRelativeTolerance allowed relative error<a name="line.228"></a>
+<FONT color="green">229</FONT>       */<a name="line.229"></a>
+<FONT color="green">230</FONT>      public DormandPrince853Integrator(final double minStep, final double maxStep,<a name="line.230"></a>
+<FONT color="green">231</FONT>                                        final double[] vecAbsoluteTolerance,<a name="line.231"></a>
+<FONT color="green">232</FONT>                                        final double[] vecRelativeTolerance) {<a name="line.232"></a>
+<FONT color="green">233</FONT>        super(METHOD_NAME, true, STATIC_C, STATIC_A, STATIC_B,<a name="line.233"></a>
+<FONT color="green">234</FONT>              new DormandPrince853StepInterpolator(),<a name="line.234"></a>
+<FONT color="green">235</FONT>              minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance);<a name="line.235"></a>
+<FONT color="green">236</FONT>      }<a name="line.236"></a>
+<FONT color="green">237</FONT>    <a name="line.237"></a>
+<FONT color="green">238</FONT>      /** {@inheritDoc} */<a name="line.238"></a>
+<FONT color="green">239</FONT>      @Override<a name="line.239"></a>
+<FONT color="green">240</FONT>      public int getOrder() {<a name="line.240"></a>
+<FONT color="green">241</FONT>        return 8;<a name="line.241"></a>
+<FONT color="green">242</FONT>      }<a name="line.242"></a>
+<FONT color="green">243</FONT>    <a name="line.243"></a>
+<FONT color="green">244</FONT>      /** {@inheritDoc} */<a name="line.244"></a>
+<FONT color="green">245</FONT>      @Override<a name="line.245"></a>
+<FONT color="green">246</FONT>      protected double estimateError(final double[][] yDotK,<a name="line.246"></a>
+<FONT color="green">247</FONT>                                     final double[] y0, final double[] y1,<a name="line.247"></a>
+<FONT color="green">248</FONT>                                     final double h) {<a name="line.248"></a>
+<FONT color="green">249</FONT>        double error1 = 0;<a name="line.249"></a>
+<FONT color="green">250</FONT>        double error2 = 0;<a name="line.250"></a>
+<FONT color="green">251</FONT>    <a name="line.251"></a>
+<FONT color="green">252</FONT>        for (int j = 0; j &lt; y0.length; ++j) {<a name="line.252"></a>
+<FONT color="green">253</FONT>          final double errSum1 = E1_01 * yDotK[0][j]  + E1_06 * yDotK[5][j] +<a name="line.253"></a>
+<FONT color="green">254</FONT>                                 E1_07 * yDotK[6][j]  + E1_08 * yDotK[7][j] +<a name="line.254"></a>
+<FONT color="green">255</FONT>                                 E1_09 * yDotK[8][j]  + E1_10 * yDotK[9][j] +<a name="line.255"></a>
+<FONT color="green">256</FONT>                                 E1_11 * yDotK[10][j] + E1_12 * yDotK[11][j];<a name="line.256"></a>
+<FONT color="green">257</FONT>          final double errSum2 = E2_01 * yDotK[0][j]  + E2_06 * yDotK[5][j] +<a name="line.257"></a>
+<FONT color="green">258</FONT>                                 E2_07 * yDotK[6][j]  + E2_08 * yDotK[7][j] +<a name="line.258"></a>
+<FONT color="green">259</FONT>                                 E2_09 * yDotK[8][j]  + E2_10 * yDotK[9][j] +<a name="line.259"></a>
+<FONT color="green">260</FONT>                                 E2_11 * yDotK[10][j] + E2_12 * yDotK[11][j];<a name="line.260"></a>
+<FONT color="green">261</FONT>    <a name="line.261"></a>
+<FONT color="green">262</FONT>          final double yScale = Math.max(Math.abs(y0[j]), Math.abs(y1[j]));<a name="line.262"></a>
+<FONT color="green">263</FONT>          final double tol = (vecAbsoluteTolerance == null) ?<a name="line.263"></a>
+<FONT color="green">264</FONT>                             (scalAbsoluteTolerance + scalRelativeTolerance * yScale) :<a name="line.264"></a>
+<FONT color="green">265</FONT>                             (vecAbsoluteTolerance[j] + vecRelativeTolerance[j] * yScale);<a name="line.265"></a>
+<FONT color="green">266</FONT>          final double ratio1  = errSum1 / tol;<a name="line.266"></a>
+<FONT color="green">267</FONT>          error1        += ratio1 * ratio1;<a name="line.267"></a>
+<FONT color="green">268</FONT>          final double ratio2  = errSum2 / tol;<a name="line.268"></a>
+<FONT color="green">269</FONT>          error2        += ratio2 * ratio2;<a name="line.269"></a>
+<FONT color="green">270</FONT>        }<a name="line.270"></a>
+<FONT color="green">271</FONT>    <a name="line.271"></a>
+<FONT color="green">272</FONT>        double den = error1 + 0.01 * error2;<a name="line.272"></a>
+<FONT color="green">273</FONT>        if (den &lt;= 0.0) {<a name="line.273"></a>
+<FONT color="green">274</FONT>          den = 1.0;<a name="line.274"></a>
+<FONT color="green">275</FONT>        }<a name="line.275"></a>
+<FONT color="green">276</FONT>    <a name="line.276"></a>
+<FONT color="green">277</FONT>        return Math.abs(h) * error1 / Math.sqrt(y0.length * den);<a name="line.277"></a>
+<FONT color="green">278</FONT>    <a name="line.278"></a>
+<FONT color="green">279</FONT>      }<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>    }<a name="line.281"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,477 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.nonstiff;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.ode.FirstOrderDifferentialEquations;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.ode.IntegratorException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.ode.events.CombinedEventsManager;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.ode.sampling.AbstractStepInterpolator;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.ode.sampling.DummyStepInterpolator;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.ode.sampling.StepHandler;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    /**<a name="line.28"></a>
+<FONT color="green">029</FONT>     * This class implements the common part of all embedded Runge-Kutta<a name="line.29"></a>
+<FONT color="green">030</FONT>     * integrators for Ordinary Differential Equations.<a name="line.30"></a>
+<FONT color="green">031</FONT>     *<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;These methods are embedded explicit Runge-Kutta methods with two<a name="line.32"></a>
+<FONT color="green">033</FONT>     * sets of coefficients allowing to estimate the error, their Butcher<a name="line.33"></a>
+<FONT color="green">034</FONT>     * arrays are as follows :<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;pre&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     *    0  |<a name="line.36"></a>
+<FONT color="green">037</FONT>     *   c2  | a21<a name="line.37"></a>
+<FONT color="green">038</FONT>     *   c3  | a31  a32<a name="line.38"></a>
+<FONT color="green">039</FONT>     *   ... |        ...<a name="line.39"></a>
+<FONT color="green">040</FONT>     *   cs  | as1  as2  ...  ass-1<a name="line.40"></a>
+<FONT color="green">041</FONT>     *       |--------------------------<a name="line.41"></a>
+<FONT color="green">042</FONT>     *       |  b1   b2  ...   bs-1  bs<a name="line.42"></a>
+<FONT color="green">043</FONT>     *       |  b'1  b'2 ...   b's-1 b's<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;/pre&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     * &lt;/p&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     *<a name="line.46"></a>
+<FONT color="green">047</FONT>     * &lt;p&gt;In fact, we rather use the array defined by ej = bj - b'j to<a name="line.47"></a>
+<FONT color="green">048</FONT>     * compute directly the error rather than computing two estimates and<a name="line.48"></a>
+<FONT color="green">049</FONT>     * then comparing them.&lt;/p&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     *<a name="line.50"></a>
+<FONT color="green">051</FONT>     * &lt;p&gt;Some methods are qualified as &lt;i&gt;fsal&lt;/i&gt; (first same as last)<a name="line.51"></a>
+<FONT color="green">052</FONT>     * methods. This means the last evaluation of the derivatives in one<a name="line.52"></a>
+<FONT color="green">053</FONT>     * step is the same as the first in the next step. Then, this<a name="line.53"></a>
+<FONT color="green">054</FONT>     * evaluation can be reused from one step to the next one and the cost<a name="line.54"></a>
+<FONT color="green">055</FONT>     * of such a method is really s-1 evaluations despite the method still<a name="line.55"></a>
+<FONT color="green">056</FONT>     * has s stages. This behaviour is true only for successful steps, if<a name="line.56"></a>
+<FONT color="green">057</FONT>     * the step is rejected after the error estimation phase, no<a name="line.57"></a>
+<FONT color="green">058</FONT>     * evaluation is saved. For an &lt;i&gt;fsal&lt;/i&gt; method, we have cs = 1 and<a name="line.58"></a>
+<FONT color="green">059</FONT>     * asi = bi for all i.&lt;/p&gt;<a name="line.59"></a>
+<FONT color="green">060</FONT>     *<a name="line.60"></a>
+<FONT color="green">061</FONT>     * @version $Revision: 927202 $ $Date: 2010-03-24 18:11:51 -0400 (Wed, 24 Mar 2010) $<a name="line.61"></a>
+<FONT color="green">062</FONT>     * @since 1.2<a name="line.62"></a>
+<FONT color="green">063</FONT>     */<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>    public abstract class EmbeddedRungeKuttaIntegrator<a name="line.65"></a>
+<FONT color="green">066</FONT>      extends AdaptiveStepsizeIntegrator {<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /** Indicator for &lt;i&gt;fsal&lt;/i&gt; methods. */<a name="line.68"></a>
+<FONT color="green">069</FONT>        private final boolean fsal;<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** Time steps from Butcher array (without the first zero). */<a name="line.71"></a>
+<FONT color="green">072</FONT>        private final double[] c;<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /** Internal weights from Butcher array (without the first empty row). */<a name="line.74"></a>
+<FONT color="green">075</FONT>        private final double[][] a;<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** External weights for the high order method from Butcher array. */<a name="line.77"></a>
+<FONT color="green">078</FONT>        private final double[] b;<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /** Prototype of the step interpolator. */<a name="line.80"></a>
+<FONT color="green">081</FONT>        private final RungeKuttaStepInterpolator prototype;<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /** Stepsize control exponent. */<a name="line.83"></a>
+<FONT color="green">084</FONT>        private final double exp;<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /** Safety factor for stepsize control. */<a name="line.86"></a>
+<FONT color="green">087</FONT>        private double safety;<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /** Minimal reduction factor for stepsize control. */<a name="line.89"></a>
+<FONT color="green">090</FONT>        private double minReduction;<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /** Maximal growth factor for stepsize control. */<a name="line.92"></a>
+<FONT color="green">093</FONT>        private double maxGrowth;<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>      /** Build a Runge-Kutta integrator with the given Butcher array.<a name="line.95"></a>
+<FONT color="green">096</FONT>       * @param name name of the method<a name="line.96"></a>
+<FONT color="green">097</FONT>       * @param fsal indicate that the method is an &lt;i&gt;fsal&lt;/i&gt;<a name="line.97"></a>
+<FONT color="green">098</FONT>       * @param c time steps from Butcher array (without the first zero)<a name="line.98"></a>
+<FONT color="green">099</FONT>       * @param a internal weights from Butcher array (without the first empty row)<a name="line.99"></a>
+<FONT color="green">100</FONT>       * @param b propagation weights for the high order method from Butcher array<a name="line.100"></a>
+<FONT color="green">101</FONT>       * @param prototype prototype of the step interpolator to use<a name="line.101"></a>
+<FONT color="green">102</FONT>       * @param minStep minimal step (must be positive even for backward<a name="line.102"></a>
+<FONT color="green">103</FONT>       * integration), the last step can be smaller than this<a name="line.103"></a>
+<FONT color="green">104</FONT>       * @param maxStep maximal step (must be positive even for backward<a name="line.104"></a>
+<FONT color="green">105</FONT>       * integration)<a name="line.105"></a>
+<FONT color="green">106</FONT>       * @param scalAbsoluteTolerance allowed absolute error<a name="line.106"></a>
+<FONT color="green">107</FONT>       * @param scalRelativeTolerance allowed relative error<a name="line.107"></a>
+<FONT color="green">108</FONT>       */<a name="line.108"></a>
+<FONT color="green">109</FONT>      protected EmbeddedRungeKuttaIntegrator(final String name, final boolean fsal,<a name="line.109"></a>
+<FONT color="green">110</FONT>                                             final double[] c, final double[][] a, final double[] b,<a name="line.110"></a>
+<FONT color="green">111</FONT>                                             final RungeKuttaStepInterpolator prototype,<a name="line.111"></a>
+<FONT color="green">112</FONT>                                             final double minStep, final double maxStep,<a name="line.112"></a>
+<FONT color="green">113</FONT>                                             final double scalAbsoluteTolerance,<a name="line.113"></a>
+<FONT color="green">114</FONT>                                             final double scalRelativeTolerance) {<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>        super(name, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance);<a name="line.116"></a>
+<FONT color="green">117</FONT>    <a name="line.117"></a>
+<FONT color="green">118</FONT>        this.fsal      = fsal;<a name="line.118"></a>
+<FONT color="green">119</FONT>        this.c         = c;<a name="line.119"></a>
+<FONT color="green">120</FONT>        this.a         = a;<a name="line.120"></a>
+<FONT color="green">121</FONT>        this.b         = b;<a name="line.121"></a>
+<FONT color="green">122</FONT>        this.prototype = prototype;<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>        exp = -1.0 / getOrder();<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>        // set the default values of the algorithm control parameters<a name="line.126"></a>
+<FONT color="green">127</FONT>        setSafety(0.9);<a name="line.127"></a>
+<FONT color="green">128</FONT>        setMinReduction(0.2);<a name="line.128"></a>
+<FONT color="green">129</FONT>        setMaxGrowth(10.0);<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>      }<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>      /** Build a Runge-Kutta integrator with the given Butcher array.<a name="line.133"></a>
+<FONT color="green">134</FONT>       * @param name name of the method<a name="line.134"></a>
+<FONT color="green">135</FONT>       * @param fsal indicate that the method is an &lt;i&gt;fsal&lt;/i&gt;<a name="line.135"></a>
+<FONT color="green">136</FONT>       * @param c time steps from Butcher array (without the first zero)<a name="line.136"></a>
+<FONT color="green">137</FONT>       * @param a internal weights from Butcher array (without the first empty row)<a name="line.137"></a>
+<FONT color="green">138</FONT>       * @param b propagation weights for the high order method from Butcher array<a name="line.138"></a>
+<FONT color="green">139</FONT>       * @param prototype prototype of the step interpolator to use<a name="line.139"></a>
+<FONT color="green">140</FONT>       * @param minStep minimal step (must be positive even for backward<a name="line.140"></a>
+<FONT color="green">141</FONT>       * integration), the last step can be smaller than this<a name="line.141"></a>
+<FONT color="green">142</FONT>       * @param maxStep maximal step (must be positive even for backward<a name="line.142"></a>
+<FONT color="green">143</FONT>       * integration)<a name="line.143"></a>
+<FONT color="green">144</FONT>       * @param vecAbsoluteTolerance allowed absolute error<a name="line.144"></a>
+<FONT color="green">145</FONT>       * @param vecRelativeTolerance allowed relative error<a name="line.145"></a>
+<FONT color="green">146</FONT>       */<a name="line.146"></a>
+<FONT color="green">147</FONT>      protected EmbeddedRungeKuttaIntegrator(final String name, final boolean fsal,<a name="line.147"></a>
+<FONT color="green">148</FONT>                                             final double[] c, final double[][] a, final double[] b,<a name="line.148"></a>
+<FONT color="green">149</FONT>                                             final RungeKuttaStepInterpolator prototype,<a name="line.149"></a>
+<FONT color="green">150</FONT>                                             final double   minStep, final double maxStep,<a name="line.150"></a>
+<FONT color="green">151</FONT>                                             final double[] vecAbsoluteTolerance,<a name="line.151"></a>
+<FONT color="green">152</FONT>                                             final double[] vecRelativeTolerance) {<a name="line.152"></a>
+<FONT color="green">153</FONT>    <a name="line.153"></a>
+<FONT color="green">154</FONT>        super(name, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance);<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>        this.fsal      = fsal;<a name="line.156"></a>
+<FONT color="green">157</FONT>        this.c         = c;<a name="line.157"></a>
+<FONT color="green">158</FONT>        this.a         = a;<a name="line.158"></a>
+<FONT color="green">159</FONT>        this.b         = b;<a name="line.159"></a>
+<FONT color="green">160</FONT>        this.prototype = prototype;<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>        exp = -1.0 / getOrder();<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>        // set the default values of the algorithm control parameters<a name="line.164"></a>
+<FONT color="green">165</FONT>        setSafety(0.9);<a name="line.165"></a>
+<FONT color="green">166</FONT>        setMinReduction(0.2);<a name="line.166"></a>
+<FONT color="green">167</FONT>        setMaxGrowth(10.0);<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>      }<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>      /** Get the order of the method.<a name="line.171"></a>
+<FONT color="green">172</FONT>       * @return order of the method<a name="line.172"></a>
+<FONT color="green">173</FONT>       */<a name="line.173"></a>
+<FONT color="green">174</FONT>      public abstract int getOrder();<a name="line.174"></a>
+<FONT color="green">175</FONT>    <a name="line.175"></a>
+<FONT color="green">176</FONT>      /** Get the safety factor for stepsize control.<a name="line.176"></a>
+<FONT color="green">177</FONT>       * @return safety factor<a name="line.177"></a>
+<FONT color="green">178</FONT>       */<a name="line.178"></a>
+<FONT color="green">179</FONT>      public double getSafety() {<a name="line.179"></a>
+<FONT color="green">180</FONT>        return safety;<a name="line.180"></a>
+<FONT color="green">181</FONT>      }<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>      /** Set the safety factor for stepsize control.<a name="line.183"></a>
+<FONT color="green">184</FONT>       * @param safety safety factor<a name="line.184"></a>
+<FONT color="green">185</FONT>       */<a name="line.185"></a>
+<FONT color="green">186</FONT>      public void setSafety(final double safety) {<a name="line.186"></a>
+<FONT color="green">187</FONT>        this.safety = safety;<a name="line.187"></a>
+<FONT color="green">188</FONT>      }<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>      /** {@inheritDoc} */<a name="line.190"></a>
+<FONT color="green">191</FONT>      @Override<a name="line.191"></a>
+<FONT color="green">192</FONT>      public double integrate(final FirstOrderDifferentialEquations equations,<a name="line.192"></a>
+<FONT color="green">193</FONT>                              final double t0, final double[] y0,<a name="line.193"></a>
+<FONT color="green">194</FONT>                              final double t, final double[] y)<a name="line.194"></a>
+<FONT color="green">195</FONT>      throws DerivativeException, IntegratorException {<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>        sanityChecks(equations, t0, y0, t, y);<a name="line.197"></a>
+<FONT color="green">198</FONT>        setEquations(equations);<a name="line.198"></a>
+<FONT color="green">199</FONT>        resetEvaluations();<a name="line.199"></a>
+<FONT color="green">200</FONT>        final boolean forward = t &gt; t0;<a name="line.200"></a>
+<FONT color="green">201</FONT>    <a name="line.201"></a>
+<FONT color="green">202</FONT>        // create some internal working arrays<a name="line.202"></a>
+<FONT color="green">203</FONT>        final int stages = c.length + 1;<a name="line.203"></a>
+<FONT color="green">204</FONT>        if (y != y0) {<a name="line.204"></a>
+<FONT color="green">205</FONT>          System.arraycopy(y0, 0, y, 0, y0.length);<a name="line.205"></a>
+<FONT color="green">206</FONT>        }<a name="line.206"></a>
+<FONT color="green">207</FONT>        final double[][] yDotK = new double[stages][y0.length];<a name="line.207"></a>
+<FONT color="green">208</FONT>        final double[] yTmp = new double[y0.length];<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>        // set up an interpolator sharing the integrator arrays<a name="line.210"></a>
+<FONT color="green">211</FONT>        AbstractStepInterpolator interpolator;<a name="line.211"></a>
+<FONT color="green">212</FONT>        if (requiresDenseOutput() || (! eventsHandlersManager.isEmpty())) {<a name="line.212"></a>
+<FONT color="green">213</FONT>          final RungeKuttaStepInterpolator rki = (RungeKuttaStepInterpolator) prototype.copy();<a name="line.213"></a>
+<FONT color="green">214</FONT>          rki.reinitialize(this, yTmp, yDotK, forward);<a name="line.214"></a>
+<FONT color="green">215</FONT>          interpolator = rki;<a name="line.215"></a>
+<FONT color="green">216</FONT>        } else {<a name="line.216"></a>
+<FONT color="green">217</FONT>          interpolator = new DummyStepInterpolator(yTmp, yDotK[stages - 1], forward);<a name="line.217"></a>
+<FONT color="green">218</FONT>        }<a name="line.218"></a>
+<FONT color="green">219</FONT>        interpolator.storeTime(t0);<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>        // set up integration control objects<a name="line.221"></a>
+<FONT color="green">222</FONT>        stepStart         = t0;<a name="line.222"></a>
+<FONT color="green">223</FONT>        double  hNew      = 0;<a name="line.223"></a>
+<FONT color="green">224</FONT>        boolean firstTime = true;<a name="line.224"></a>
+<FONT color="green">225</FONT>        for (StepHandler handler : stepHandlers) {<a name="line.225"></a>
+<FONT color="green">226</FONT>            handler.reset();<a name="line.226"></a>
+<FONT color="green">227</FONT>        }<a name="line.227"></a>
+<FONT color="green">228</FONT>        CombinedEventsManager manager = addEndTimeChecker(t0, t, eventsHandlersManager);<a name="line.228"></a>
+<FONT color="green">229</FONT>        boolean lastStep = false;<a name="line.229"></a>
+<FONT color="green">230</FONT>    <a name="line.230"></a>
+<FONT color="green">231</FONT>        // main integration loop<a name="line.231"></a>
+<FONT color="green">232</FONT>        while (!lastStep) {<a name="line.232"></a>
+<FONT color="green">233</FONT>    <a name="line.233"></a>
+<FONT color="green">234</FONT>          interpolator.shift();<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>          double error = 0;<a name="line.236"></a>
+<FONT color="green">237</FONT>          for (boolean loop = true; loop;) {<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>            if (firstTime || !fsal) {<a name="line.239"></a>
+<FONT color="green">240</FONT>              // first stage<a name="line.240"></a>
+<FONT color="green">241</FONT>              computeDerivatives(stepStart, y, yDotK[0]);<a name="line.241"></a>
+<FONT color="green">242</FONT>            }<a name="line.242"></a>
+<FONT color="green">243</FONT>    <a name="line.243"></a>
+<FONT color="green">244</FONT>            if (firstTime) {<a name="line.244"></a>
+<FONT color="green">245</FONT>              final double[] scale = new double[y0.length];<a name="line.245"></a>
+<FONT color="green">246</FONT>              if (vecAbsoluteTolerance == null) {<a name="line.246"></a>
+<FONT color="green">247</FONT>                  for (int i = 0; i &lt; scale.length; ++i) {<a name="line.247"></a>
+<FONT color="green">248</FONT>                    scale[i] = scalAbsoluteTolerance + scalRelativeTolerance * Math.abs(y[i]);<a name="line.248"></a>
+<FONT color="green">249</FONT>                  }<a name="line.249"></a>
+<FONT color="green">250</FONT>                } else {<a name="line.250"></a>
+<FONT color="green">251</FONT>                  for (int i = 0; i &lt; scale.length; ++i) {<a name="line.251"></a>
+<FONT color="green">252</FONT>                    scale[i] = vecAbsoluteTolerance[i] + vecRelativeTolerance[i] * Math.abs(y[i]);<a name="line.252"></a>
+<FONT color="green">253</FONT>                  }<a name="line.253"></a>
+<FONT color="green">254</FONT>                }<a name="line.254"></a>
+<FONT color="green">255</FONT>              hNew = initializeStep(equations, forward, getOrder(), scale,<a name="line.255"></a>
+<FONT color="green">256</FONT>                                    stepStart, y, yDotK[0], yTmp, yDotK[1]);<a name="line.256"></a>
+<FONT color="green">257</FONT>              firstTime = false;<a name="line.257"></a>
+<FONT color="green">258</FONT>            }<a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>            stepSize = hNew;<a name="line.260"></a>
+<FONT color="green">261</FONT>    <a name="line.261"></a>
+<FONT color="green">262</FONT>            // next stages<a name="line.262"></a>
+<FONT color="green">263</FONT>            for (int k = 1; k &lt; stages; ++k) {<a name="line.263"></a>
+<FONT color="green">264</FONT>    <a name="line.264"></a>
+<FONT color="green">265</FONT>              for (int j = 0; j &lt; y0.length; ++j) {<a name="line.265"></a>
+<FONT color="green">266</FONT>                double sum = a[k-1][0] * yDotK[0][j];<a name="line.266"></a>
+<FONT color="green">267</FONT>                for (int l = 1; l &lt; k; ++l) {<a name="line.267"></a>
+<FONT color="green">268</FONT>                  sum += a[k-1][l] * yDotK[l][j];<a name="line.268"></a>
+<FONT color="green">269</FONT>                }<a name="line.269"></a>
+<FONT color="green">270</FONT>                yTmp[j] = y[j] + stepSize * sum;<a name="line.270"></a>
+<FONT color="green">271</FONT>              }<a name="line.271"></a>
+<FONT color="green">272</FONT>    <a name="line.272"></a>
+<FONT color="green">273</FONT>              computeDerivatives(stepStart + c[k-1] * stepSize, yTmp, yDotK[k]);<a name="line.273"></a>
+<FONT color="green">274</FONT>    <a name="line.274"></a>
+<FONT color="green">275</FONT>            }<a name="line.275"></a>
+<FONT color="green">276</FONT>    <a name="line.276"></a>
+<FONT color="green">277</FONT>            // estimate the state at the end of the step<a name="line.277"></a>
+<FONT color="green">278</FONT>            for (int j = 0; j &lt; y0.length; ++j) {<a name="line.278"></a>
+<FONT color="green">279</FONT>              double sum    = b[0] * yDotK[0][j];<a name="line.279"></a>
+<FONT color="green">280</FONT>              for (int l = 1; l &lt; stages; ++l) {<a name="line.280"></a>
+<FONT color="green">281</FONT>                sum    += b[l] * yDotK[l][j];<a name="line.281"></a>
+<FONT color="green">282</FONT>              }<a name="line.282"></a>
+<FONT color="green">283</FONT>              yTmp[j] = y[j] + stepSize * sum;<a name="line.283"></a>
+<FONT color="green">284</FONT>            }<a name="line.284"></a>
+<FONT color="green">285</FONT>    <a name="line.285"></a>
+<FONT color="green">286</FONT>            // estimate the error at the end of the step<a name="line.286"></a>
+<FONT color="green">287</FONT>            error = estimateError(yDotK, y, yTmp, stepSize);<a name="line.287"></a>
+<FONT color="green">288</FONT>            if (error &lt;= 1.0) {<a name="line.288"></a>
+<FONT color="green">289</FONT>    <a name="line.289"></a>
+<FONT color="green">290</FONT>              // discrete events handling<a name="line.290"></a>
+<FONT color="green">291</FONT>              interpolator.storeTime(stepStart + stepSize);<a name="line.291"></a>
+<FONT color="green">292</FONT>              if (manager.evaluateStep(interpolator)) {<a name="line.292"></a>
+<FONT color="green">293</FONT>                  final double dt = manager.getEventTime() - stepStart;<a name="line.293"></a>
+<FONT color="green">294</FONT>                  if (Math.abs(dt) &lt;= Math.ulp(stepStart)) {<a name="line.294"></a>
+<FONT color="green">295</FONT>                      // we cannot simply truncate the step, reject the current computation<a name="line.295"></a>
+<FONT color="green">296</FONT>                      // and let the loop compute another state with the truncated step.<a name="line.296"></a>
+<FONT color="green">297</FONT>                      // it is so small (much probably exactly 0 due to limited accuracy)<a name="line.297"></a>
+<FONT color="green">298</FONT>                      // that the code above would fail handling it.<a name="line.298"></a>
+<FONT color="green">299</FONT>                      // So we set up an artificial 0 size step by copying states<a name="line.299"></a>
+<FONT color="green">300</FONT>                      interpolator.storeTime(stepStart);<a name="line.300"></a>
+<FONT color="green">301</FONT>                      System.arraycopy(y, 0, yTmp, 0, y0.length);<a name="line.301"></a>
+<FONT color="green">302</FONT>                      hNew     = 0;<a name="line.302"></a>
+<FONT color="green">303</FONT>                      stepSize = 0;<a name="line.303"></a>
+<FONT color="green">304</FONT>                      loop     = false;<a name="line.304"></a>
+<FONT color="green">305</FONT>                  } else {<a name="line.305"></a>
+<FONT color="green">306</FONT>                      // reject the step to match exactly the next switch time<a name="line.306"></a>
+<FONT color="green">307</FONT>                      hNew = dt;<a name="line.307"></a>
+<FONT color="green">308</FONT>                  }<a name="line.308"></a>
+<FONT color="green">309</FONT>              } else {<a name="line.309"></a>
+<FONT color="green">310</FONT>                // accept the step<a name="line.310"></a>
+<FONT color="green">311</FONT>                loop = false;<a name="line.311"></a>
+<FONT color="green">312</FONT>              }<a name="line.312"></a>
+<FONT color="green">313</FONT>    <a name="line.313"></a>
+<FONT color="green">314</FONT>            } else {<a name="line.314"></a>
+<FONT color="green">315</FONT>              // reject the step and attempt to reduce error by stepsize control<a name="line.315"></a>
+<FONT color="green">316</FONT>              final double factor =<a name="line.316"></a>
+<FONT color="green">317</FONT>                  Math.min(maxGrowth,<a name="line.317"></a>
+<FONT color="green">318</FONT>                           Math.max(minReduction, safety * Math.pow(error, exp)));<a name="line.318"></a>
+<FONT color="green">319</FONT>              hNew = filterStep(stepSize * factor, forward, false);<a name="line.319"></a>
+<FONT color="green">320</FONT>            }<a name="line.320"></a>
+<FONT color="green">321</FONT>    <a name="line.321"></a>
+<FONT color="green">322</FONT>          }<a name="line.322"></a>
+<FONT color="green">323</FONT>    <a name="line.323"></a>
+<FONT color="green">324</FONT>          // the step has been accepted<a name="line.324"></a>
+<FONT color="green">325</FONT>          final double nextStep = stepStart + stepSize;<a name="line.325"></a>
+<FONT color="green">326</FONT>          System.arraycopy(yTmp, 0, y, 0, y0.length);<a name="line.326"></a>
+<FONT color="green">327</FONT>          manager.stepAccepted(nextStep, y);<a name="line.327"></a>
+<FONT color="green">328</FONT>          lastStep = manager.stop();<a name="line.328"></a>
+<FONT color="green">329</FONT>    <a name="line.329"></a>
+<FONT color="green">330</FONT>          // provide the step data to the step handler<a name="line.330"></a>
+<FONT color="green">331</FONT>          interpolator.storeTime(nextStep);<a name="line.331"></a>
+<FONT color="green">332</FONT>          for (StepHandler handler : stepHandlers) {<a name="line.332"></a>
+<FONT color="green">333</FONT>              handler.handleStep(interpolator, lastStep);<a name="line.333"></a>
+<FONT color="green">334</FONT>          }<a name="line.334"></a>
+<FONT color="green">335</FONT>          stepStart = nextStep;<a name="line.335"></a>
+<FONT color="green">336</FONT>    <a name="line.336"></a>
+<FONT color="green">337</FONT>          if (fsal) {<a name="line.337"></a>
+<FONT color="green">338</FONT>            // save the last evaluation for the next step<a name="line.338"></a>
+<FONT color="green">339</FONT>            System.arraycopy(yDotK[stages - 1], 0, yDotK[0], 0, y0.length);<a name="line.339"></a>
+<FONT color="green">340</FONT>          }<a name="line.340"></a>
+<FONT color="green">341</FONT>    <a name="line.341"></a>
+<FONT color="green">342</FONT>          if (manager.reset(stepStart, y) &amp;&amp; ! lastStep) {<a name="line.342"></a>
+<FONT color="green">343</FONT>            // some event handler has triggered changes that<a name="line.343"></a>
+<FONT color="green">344</FONT>            // invalidate the derivatives, we need to recompute them<a name="line.344"></a>
+<FONT color="green">345</FONT>            computeDerivatives(stepStart, y, yDotK[0]);<a name="line.345"></a>
+<FONT color="green">346</FONT>          }<a name="line.346"></a>
+<FONT color="green">347</FONT>    <a name="line.347"></a>
+<FONT color="green">348</FONT>          if (! lastStep) {<a name="line.348"></a>
+<FONT color="green">349</FONT>            // in some rare cases we may get here with stepSize = 0, for example<a name="line.349"></a>
+<FONT color="green">350</FONT>            // when an event occurs at integration start, reducing the first step<a name="line.350"></a>
+<FONT color="green">351</FONT>            // to zero; we have to reset the step to some safe non zero value<a name="line.351"></a>
+<FONT color="green">352</FONT>              stepSize = filterStep(stepSize, forward, true);<a name="line.352"></a>
+<FONT color="green">353</FONT>    <a name="line.353"></a>
+<FONT color="green">354</FONT>            // stepsize control for next step<a name="line.354"></a>
+<FONT color="green">355</FONT>            final double factor = Math.min(maxGrowth,<a name="line.355"></a>
+<FONT color="green">356</FONT>                                           Math.max(minReduction,<a name="line.356"></a>
+<FONT color="green">357</FONT>                                                    safety * Math.pow(error, exp)));<a name="line.357"></a>
+<FONT color="green">358</FONT>            final double  scaledH    = stepSize * factor;<a name="line.358"></a>
+<FONT color="green">359</FONT>            final double  nextT      = stepStart + scaledH;<a name="line.359"></a>
+<FONT color="green">360</FONT>            final boolean nextIsLast = forward ? (nextT &gt;= t) : (nextT &lt;= t);<a name="line.360"></a>
+<FONT color="green">361</FONT>            hNew = filterStep(scaledH, forward, nextIsLast);<a name="line.361"></a>
+<FONT color="green">362</FONT>          }<a name="line.362"></a>
+<FONT color="green">363</FONT>    <a name="line.363"></a>
+<FONT color="green">364</FONT>        }<a name="line.364"></a>
+<FONT color="green">365</FONT>    <a name="line.365"></a>
+<FONT color="green">366</FONT>        final double stopTime = stepStart;<a name="line.366"></a>
+<FONT color="green">367</FONT>        resetInternalState();<a name="line.367"></a>
+<FONT color="green">368</FONT>        return stopTime;<a name="line.368"></a>
+<FONT color="green">369</FONT>    <a name="line.369"></a>
+<FONT color="green">370</FONT>      }<a name="line.370"></a>
+<FONT color="green">371</FONT>    <a name="line.371"></a>
+<FONT color="green">372</FONT>      /** Get the minimal reduction factor for stepsize control.<a name="line.372"></a>
+<FONT color="green">373</FONT>       * @return minimal reduction factor<a name="line.373"></a>
+<FONT color="green">374</FONT>       */<a name="line.374"></a>
+<FONT color="green">375</FONT>      public double getMinReduction() {<a name="line.375"></a>
+<FONT color="green">376</FONT>        return minReduction;<a name="line.376"></a>
+<FONT color="green">377</FONT>      }<a name="line.377"></a>
+<FONT color="green">378</FONT>    <a name="line.378"></a>
+<FONT color="green">379</FONT>      /** Set the minimal reduction factor for stepsize control.<a name="line.379"></a>
+<FONT color="green">380</FONT>       * @param minReduction minimal reduction factor<a name="line.380"></a>
+<FONT color="green">381</FONT>       */<a name="line.381"></a>
+<FONT color="green">382</FONT>      public void setMinReduction(final double minReduction) {<a name="line.382"></a>
+<FONT color="green">383</FONT>        this.minReduction = minReduction;<a name="line.383"></a>
+<FONT color="green">384</FONT>      }<a name="line.384"></a>
+<FONT color="green">385</FONT>    <a name="line.385"></a>
+<FONT color="green">386</FONT>      /** Get the maximal growth factor for stepsize control.<a name="line.386"></a>
+<FONT color="green">387</FONT>       * @return maximal growth factor<a name="line.387"></a>
+<FONT color="green">388</FONT>       */<a name="line.388"></a>
+<FONT color="green">389</FONT>      public double getMaxGrowth() {<a name="line.389"></a>
+<FONT color="green">390</FONT>        return maxGrowth;<a name="line.390"></a>
+<FONT color="green">391</FONT>      }<a name="line.391"></a>
+<FONT color="green">392</FONT>    <a name="line.392"></a>
+<FONT color="green">393</FONT>      /** Set the maximal growth factor for stepsize control.<a name="line.393"></a>
+<FONT color="green">394</FONT>       * @param maxGrowth maximal growth factor<a name="line.394"></a>
+<FONT color="green">395</FONT>       */<a name="line.395"></a>
+<FONT color="green">396</FONT>      public void setMaxGrowth(final double maxGrowth) {<a name="line.396"></a>
+<FONT color="green">397</FONT>        this.maxGrowth = maxGrowth;<a name="line.397"></a>
+<FONT color="green">398</FONT>      }<a name="line.398"></a>
+<FONT color="green">399</FONT>    <a name="line.399"></a>
+<FONT color="green">400</FONT>      /** Compute the error ratio.<a name="line.400"></a>
+<FONT color="green">401</FONT>       * @param yDotK derivatives computed during the first stages<a name="line.401"></a>
+<FONT color="green">402</FONT>       * @param y0 estimate of the step at the start of the step<a name="line.402"></a>
+<FONT color="green">403</FONT>       * @param y1 estimate of the step at the end of the step<a name="line.403"></a>
+<FONT color="green">404</FONT>       * @param h  current step<a name="line.404"></a>
+<FONT color="green">405</FONT>       * @return error ratio, greater than 1 if step should be rejected<a name="line.405"></a>
+<FONT color="green">406</FONT>       */<a name="line.406"></a>
+<FONT color="green">407</FONT>      protected abstract double estimateError(double[][] yDotK,<a name="line.407"></a>
+<FONT color="green">408</FONT>                                              double[] y0, double[] y1,<a name="line.408"></a>
+<FONT color="green">409</FONT>                                              double h);<a name="line.409"></a>
+<FONT color="green">410</FONT>    <a name="line.410"></a>
+<FONT color="green">411</FONT>    }<a name="line.411"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/EulerIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,138 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.nonstiff;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * This class implements a simple Euler integrator for Ordinary<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Differential Equations.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;The Euler algorithm is the simplest one that can be used to<a name="line.25"></a>
+<FONT color="green">026</FONT>     * integrate ordinary differential equations. It is a simple inversion<a name="line.26"></a>
+<FONT color="green">027</FONT>     * of the forward difference expression :<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;code&gt;f'=(f(t+h)-f(t))/h&lt;/code&gt; which leads to<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;code&gt;f(t+h)=f(t)+hf'&lt;/code&gt;. The interpolation scheme used for<a name="line.29"></a>
+<FONT color="green">030</FONT>     * dense output is the linear scheme already used for integration.&lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     *<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;This algorithm looks cheap because it needs only one function<a name="line.32"></a>
+<FONT color="green">033</FONT>     * evaluation per step. However, as it uses linear estimates, it needs<a name="line.33"></a>
+<FONT color="green">034</FONT>     * very small steps to achieve high accuracy, and small steps lead to<a name="line.34"></a>
+<FONT color="green">035</FONT>     * numerical errors and instabilities.&lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     *<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;p&gt;This algorithm is almost never used and has been included in<a name="line.37"></a>
+<FONT color="green">038</FONT>     * this package only as a comparison reference for more useful<a name="line.38"></a>
+<FONT color="green">039</FONT>     * integrators.&lt;/p&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     *<a name="line.40"></a>
+<FONT color="green">041</FONT>     * @see MidpointIntegrator<a name="line.41"></a>
+<FONT color="green">042</FONT>     * @see ClassicalRungeKuttaIntegrator<a name="line.42"></a>
+<FONT color="green">043</FONT>     * @see GillIntegrator<a name="line.43"></a>
+<FONT color="green">044</FONT>     * @see ThreeEighthesIntegrator<a name="line.44"></a>
+<FONT color="green">045</FONT>     * @version $Revision: 810196 $ $Date: 2009-09-01 15:47:46 -0400 (Tue, 01 Sep 2009) $<a name="line.45"></a>
+<FONT color="green">046</FONT>     * @since 1.2<a name="line.46"></a>
+<FONT color="green">047</FONT>     */<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>    public class EulerIntegrator extends RungeKuttaIntegrator {<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>      /** Time steps Butcher array. */<a name="line.51"></a>
+<FONT color="green">052</FONT>      private static final double[] STATIC_C = {<a name="line.52"></a>
+<FONT color="green">053</FONT>      };<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>      /** Internal weights Butcher array. */<a name="line.55"></a>
+<FONT color="green">056</FONT>      private static final double[][] STATIC_A = {<a name="line.56"></a>
+<FONT color="green">057</FONT>      };<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>      /** Propagation weights Butcher array. */<a name="line.59"></a>
+<FONT color="green">060</FONT>      private static final double[] STATIC_B = {<a name="line.60"></a>
+<FONT color="green">061</FONT>        1.0<a name="line.61"></a>
+<FONT color="green">062</FONT>      };<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>      /** Simple constructor.<a name="line.64"></a>
+<FONT color="green">065</FONT>       * Build an Euler integrator with the given step.<a name="line.65"></a>
+<FONT color="green">066</FONT>       * @param step integration step<a name="line.66"></a>
+<FONT color="green">067</FONT>       */<a name="line.67"></a>
+<FONT color="green">068</FONT>      public EulerIntegrator(final double step) {<a name="line.68"></a>
+<FONT color="green">069</FONT>        super("Euler", STATIC_C, STATIC_A, STATIC_B, new EulerStepInterpolator(), step);<a name="line.69"></a>
+<FONT color="green">070</FONT>      }<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>    }<a name="line.72"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/GillIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,138 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.nonstiff;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * This class implements the Gill fourth order Runge-Kutta<a name="line.22"></a>
+<FONT color="green">023</FONT>     * integrator for Ordinary Differential Equations .<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;This method is an explicit Runge-Kutta method, its Butcher-array<a name="line.25"></a>
+<FONT color="green">026</FONT>     * is the following one :<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;pre&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     *    0  |    0        0       0      0<a name="line.28"></a>
+<FONT color="green">029</FONT>     *   1/2 |   1/2       0       0      0<a name="line.29"></a>
+<FONT color="green">030</FONT>     *   1/2 | (q-1)/2  (2-q)/2    0      0<a name="line.30"></a>
+<FONT color="green">031</FONT>     *    1  |    0       -q/2  (2+q)/2   0<a name="line.31"></a>
+<FONT color="green">032</FONT>     *       |-------------------------------<a name="line.32"></a>
+<FONT color="green">033</FONT>     *       |   1/6    (2-q)/6 (2+q)/6  1/6<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;/pre&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * where q = sqrt(2)&lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     *<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @see EulerIntegrator<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @see ClassicalRungeKuttaIntegrator<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @see MidpointIntegrator<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @see ThreeEighthesIntegrator<a name="line.40"></a>
+<FONT color="green">041</FONT>     * @version $Revision: 810196 $ $Date: 2009-09-01 15:47:46 -0400 (Tue, 01 Sep 2009) $<a name="line.41"></a>
+<FONT color="green">042</FONT>     * @since 1.2<a name="line.42"></a>
+<FONT color="green">043</FONT>     */<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>    public class GillIntegrator extends RungeKuttaIntegrator {<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>      /** Time steps Butcher array. */<a name="line.47"></a>
+<FONT color="green">048</FONT>      private static final double[] STATIC_C = {<a name="line.48"></a>
+<FONT color="green">049</FONT>        1.0 / 2.0, 1.0 / 2.0, 1.0<a name="line.49"></a>
+<FONT color="green">050</FONT>      };<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>      /** Internal weights Butcher array. */<a name="line.52"></a>
+<FONT color="green">053</FONT>      private static final double[][] STATIC_A = {<a name="line.53"></a>
+<FONT color="green">054</FONT>        { 1.0 / 2.0 },<a name="line.54"></a>
+<FONT color="green">055</FONT>        { (Math.sqrt(2.0) - 1.0) / 2.0, (2.0 - Math.sqrt(2.0)) / 2.0 },<a name="line.55"></a>
+<FONT color="green">056</FONT>        { 0.0, -Math.sqrt(2.0) / 2.0, (2.0 + Math.sqrt(2.0)) / 2.0 }<a name="line.56"></a>
+<FONT color="green">057</FONT>      };<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>      /** Propagation weights Butcher array. */<a name="line.59"></a>
+<FONT color="green">060</FONT>      private static final double[] STATIC_B = {<a name="line.60"></a>
+<FONT color="green">061</FONT>        1.0 / 6.0, (2.0 - Math.sqrt(2.0)) / 6.0, (2.0 + Math.sqrt(2.0)) / 6.0, 1.0 / 6.0<a name="line.61"></a>
+<FONT color="green">062</FONT>      };<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>      /** Simple constructor.<a name="line.64"></a>
+<FONT color="green">065</FONT>       * Build a fourth-order Gill integrator with the given step.<a name="line.65"></a>
+<FONT color="green">066</FONT>       * @param step integration step<a name="line.66"></a>
+<FONT color="green">067</FONT>       */<a name="line.67"></a>
+<FONT color="green">068</FONT>      public GillIntegrator(final double step) {<a name="line.68"></a>
+<FONT color="green">069</FONT>        super("Gill", STATIC_C, STATIC_A, STATIC_B, new GillStepInterpolator(), step);<a name="line.69"></a>
+<FONT color="green">070</FONT>      }<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>    }<a name="line.72"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,1067 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.nonstiff;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.ode.FirstOrderDifferentialEquations;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.ode.IntegratorException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.ode.events.EventHandler;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.ode.sampling.AbstractStepInterpolator;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.ode.sampling.DummyStepInterpolator;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.ode.sampling.StepHandler;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    /**<a name="line.28"></a>
+<FONT color="green">029</FONT>     * This class implements a Gragg-Bulirsch-Stoer integrator for<a name="line.29"></a>
+<FONT color="green">030</FONT>     * Ordinary Differential Equations.<a name="line.30"></a>
+<FONT color="green">031</FONT>     *<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;The Gragg-Bulirsch-Stoer algorithm is one of the most efficient<a name="line.32"></a>
+<FONT color="green">033</FONT>     * ones currently available for smooth problems. It uses Richardson<a name="line.33"></a>
+<FONT color="green">034</FONT>     * extrapolation to estimate what would be the solution if the step<a name="line.34"></a>
+<FONT color="green">035</FONT>     * size could be decreased down to zero.&lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     *<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * This method changes both the step size and the order during<a name="line.38"></a>
+<FONT color="green">039</FONT>     * integration, in order to minimize computation cost. It is<a name="line.39"></a>
+<FONT color="green">040</FONT>     * particularly well suited when a very high precision is needed. The<a name="line.40"></a>
+<FONT color="green">041</FONT>     * limit where this method becomes more efficient than high-order<a name="line.41"></a>
+<FONT color="green">042</FONT>     * embedded Runge-Kutta methods like {@link DormandPrince853Integrator<a name="line.42"></a>
+<FONT color="green">043</FONT>     * Dormand-Prince 8(5,3)} depends on the problem. Results given in the<a name="line.43"></a>
+<FONT color="green">044</FONT>     * Hairer, Norsett and Wanner book show for example that this limit<a name="line.44"></a>
+<FONT color="green">045</FONT>     * occurs for accuracy around 1e-6 when integrating Saltzam-Lorenz<a name="line.45"></a>
+<FONT color="green">046</FONT>     * equations (the authors note this problem is &lt;i&gt;extremely sensitive<a name="line.46"></a>
+<FONT color="green">047</FONT>     * to the errors in the first integration steps&lt;/i&gt;), and around 1e-11<a name="line.47"></a>
+<FONT color="green">048</FONT>     * for a two dimensional celestial mechanics problems with seven<a name="line.48"></a>
+<FONT color="green">049</FONT>     * bodies (pleiades problem, involving quasi-collisions for which<a name="line.49"></a>
+<FONT color="green">050</FONT>     * &lt;i&gt;automatic step size control is essential&lt;/i&gt;).<a name="line.50"></a>
+<FONT color="green">051</FONT>     * &lt;/p&gt;<a name="line.51"></a>
+<FONT color="green">052</FONT>     *<a name="line.52"></a>
+<FONT color="green">053</FONT>     * &lt;p&gt;<a name="line.53"></a>
+<FONT color="green">054</FONT>     * This implementation is basically a reimplementation in Java of the<a name="line.54"></a>
+<FONT color="green">055</FONT>     * &lt;a<a name="line.55"></a>
+<FONT color="green">056</FONT>     * href="http://www.unige.ch/math/folks/hairer/prog/nonstiff/odex.f"&gt;odex&lt;/a&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>     * fortran code by E. Hairer and G. Wanner. The redistribution policy<a name="line.57"></a>
+<FONT color="green">058</FONT>     * for this code is available &lt;a<a name="line.58"></a>
+<FONT color="green">059</FONT>     * href="http://www.unige.ch/~hairer/prog/licence.txt"&gt;here&lt;/a&gt;, for<a name="line.59"></a>
+<FONT color="green">060</FONT>     * convenience, it is reproduced below.&lt;/p&gt;<a name="line.60"></a>
+<FONT color="green">061</FONT>     * &lt;/p&gt;<a name="line.61"></a>
+<FONT color="green">062</FONT>     *<a name="line.62"></a>
+<FONT color="green">063</FONT>     * &lt;table border="0" width="80%" cellpadding="10" align="center" bgcolor="#E0E0E0"&gt;<a name="line.63"></a>
+<FONT color="green">064</FONT>     * &lt;tr&gt;&lt;td&gt;Copyright (c) 2004, Ernst Hairer&lt;/td&gt;&lt;/tr&gt;<a name="line.64"></a>
+<FONT color="green">065</FONT>     *<a name="line.65"></a>
+<FONT color="green">066</FONT>     * &lt;tr&gt;&lt;td&gt;Redistribution and use in source and binary forms, with or<a name="line.66"></a>
+<FONT color="green">067</FONT>     * without modification, are permitted provided that the following<a name="line.67"></a>
+<FONT color="green">068</FONT>     * conditions are met:<a name="line.68"></a>
+<FONT color="green">069</FONT>     * &lt;ul&gt;<a name="line.69"></a>
+<FONT color="green">070</FONT>     *  &lt;li&gt;Redistributions of source code must retain the above copyright<a name="line.70"></a>
+<FONT color="green">071</FONT>     *      notice, this list of conditions and the following disclaimer.&lt;/li&gt;<a name="line.71"></a>
+<FONT color="green">072</FONT>     *  &lt;li&gt;Redistributions in binary form must reproduce the above copyright<a name="line.72"></a>
+<FONT color="green">073</FONT>     *      notice, this list of conditions and the following disclaimer in the<a name="line.73"></a>
+<FONT color="green">074</FONT>     *      documentation and/or other materials provided with the distribution.&lt;/li&gt;<a name="line.74"></a>
+<FONT color="green">075</FONT>     * &lt;/ul&gt;&lt;/td&gt;&lt;/tr&gt;<a name="line.75"></a>
+<FONT color="green">076</FONT>     *<a name="line.76"></a>
+<FONT color="green">077</FONT>     * &lt;tr&gt;&lt;td&gt;&lt;strong&gt;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND<a name="line.77"></a>
+<FONT color="green">078</FONT>     * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,<a name="line.78"></a>
+<FONT color="green">079</FONT>     * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS<a name="line.79"></a>
+<FONT color="green">080</FONT>     * FOR A  PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR<a name="line.80"></a>
+<FONT color="green">081</FONT>     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,<a name="line.81"></a>
+<FONT color="green">082</FONT>     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,<a name="line.82"></a>
+<FONT color="green">083</FONT>     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR<a name="line.83"></a>
+<FONT color="green">084</FONT>     * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF<a name="line.84"></a>
+<FONT color="green">085</FONT>     * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING<a name="line.85"></a>
+<FONT color="green">086</FONT>     * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS<a name="line.86"></a>
+<FONT color="green">087</FONT>     * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;<a name="line.87"></a>
+<FONT color="green">088</FONT>     * &lt;/table&gt;<a name="line.88"></a>
+<FONT color="green">089</FONT>     *<a name="line.89"></a>
+<FONT color="green">090</FONT>     * @version $Revision: 919479 $ $Date: 2010-03-05 11:35:56 -0500 (Fri, 05 Mar 2010) $<a name="line.90"></a>
+<FONT color="green">091</FONT>     * @since 1.2<a name="line.91"></a>
+<FONT color="green">092</FONT>     */<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>    public class GraggBulirschStoerIntegrator extends AdaptiveStepsizeIntegrator {<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /** Integrator method name. */<a name="line.96"></a>
+<FONT color="green">097</FONT>        private static final String METHOD_NAME = "Gragg-Bulirsch-Stoer";<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>        /** maximal order. */<a name="line.99"></a>
+<FONT color="green">100</FONT>        private int maxOrder;<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>        /** step size sequence. */<a name="line.102"></a>
+<FONT color="green">103</FONT>        private int[] sequence;<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /** overall cost of applying step reduction up to iteration k+1, in number of calls. */<a name="line.105"></a>
+<FONT color="green">106</FONT>        private int[] costPerStep;<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>        /** cost per unit step. */<a name="line.108"></a>
+<FONT color="green">109</FONT>        private double[] costPerTimeUnit;<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /** optimal steps for each order. */<a name="line.111"></a>
+<FONT color="green">112</FONT>        private double[] optimalStep;<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /** extrapolation coefficients. */<a name="line.114"></a>
+<FONT color="green">115</FONT>        private double[][] coeff;<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>        /** stability check enabling parameter. */<a name="line.117"></a>
+<FONT color="green">118</FONT>        private boolean performTest;<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /** maximal number of checks for each iteration. */<a name="line.120"></a>
+<FONT color="green">121</FONT>        private int maxChecks;<a name="line.121"></a>
+<FONT color="green">122</FONT>    <a name="line.122"></a>
+<FONT color="green">123</FONT>        /** maximal number of iterations for which checks are performed. */<a name="line.123"></a>
+<FONT color="green">124</FONT>        private int maxIter;<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>        /** stepsize reduction factor in case of stability check failure. */<a name="line.126"></a>
+<FONT color="green">127</FONT>        private double stabilityReduction;<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>        /** first stepsize control factor. */<a name="line.129"></a>
+<FONT color="green">130</FONT>        private double stepControl1;<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>        /** second stepsize control factor. */<a name="line.132"></a>
+<FONT color="green">133</FONT>        private double stepControl2;<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>        /** third stepsize control factor. */<a name="line.135"></a>
+<FONT color="green">136</FONT>        private double stepControl3;<a name="line.136"></a>
+<FONT color="green">137</FONT>    <a name="line.137"></a>
+<FONT color="green">138</FONT>        /** fourth stepsize control factor. */<a name="line.138"></a>
+<FONT color="green">139</FONT>        private double stepControl4;<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>        /** first order control factor. */<a name="line.141"></a>
+<FONT color="green">142</FONT>        private double orderControl1;<a name="line.142"></a>
+<FONT color="green">143</FONT>    <a name="line.143"></a>
+<FONT color="green">144</FONT>        /** second order control factor. */<a name="line.144"></a>
+<FONT color="green">145</FONT>        private double orderControl2;<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>        /** dense outpute required. */<a name="line.147"></a>
+<FONT color="green">148</FONT>        private boolean denseOutput;<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>        /** use interpolation error in stepsize control. */<a name="line.150"></a>
+<FONT color="green">151</FONT>        private boolean useInterpolationError;<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>        /** interpolation order control parameter. */<a name="line.153"></a>
+<FONT color="green">154</FONT>        private int mudif;<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>      /** Simple constructor.<a name="line.156"></a>
+<FONT color="green">157</FONT>       * Build a Gragg-Bulirsch-Stoer integrator with the given step<a name="line.157"></a>
+<FONT color="green">158</FONT>       * bounds. All tuning parameters are set to their default<a name="line.158"></a>
+<FONT color="green">159</FONT>       * values. The default step handler does nothing.<a name="line.159"></a>
+<FONT color="green">160</FONT>       * @param minStep minimal step (must be positive even for backward<a name="line.160"></a>
+<FONT color="green">161</FONT>       * integration), the last step can be smaller than this<a name="line.161"></a>
+<FONT color="green">162</FONT>       * @param maxStep maximal step (must be positive even for backward<a name="line.162"></a>
+<FONT color="green">163</FONT>       * integration)<a name="line.163"></a>
+<FONT color="green">164</FONT>       * @param scalAbsoluteTolerance allowed absolute error<a name="line.164"></a>
+<FONT color="green">165</FONT>       * @param scalRelativeTolerance allowed relative error<a name="line.165"></a>
+<FONT color="green">166</FONT>       */<a name="line.166"></a>
+<FONT color="green">167</FONT>      public GraggBulirschStoerIntegrator(final double minStep, final double maxStep,<a name="line.167"></a>
+<FONT color="green">168</FONT>                                          final double scalAbsoluteTolerance,<a name="line.168"></a>
+<FONT color="green">169</FONT>                                          final double scalRelativeTolerance) {<a name="line.169"></a>
+<FONT color="green">170</FONT>        super(METHOD_NAME, minStep, maxStep,<a name="line.170"></a>
+<FONT color="green">171</FONT>              scalAbsoluteTolerance, scalRelativeTolerance);<a name="line.171"></a>
+<FONT color="green">172</FONT>        denseOutput = requiresDenseOutput() || (! eventsHandlersManager.isEmpty());<a name="line.172"></a>
+<FONT color="green">173</FONT>        setStabilityCheck(true, -1, -1, -1);<a name="line.173"></a>
+<FONT color="green">174</FONT>        setStepsizeControl(-1, -1, -1, -1);<a name="line.174"></a>
+<FONT color="green">175</FONT>        setOrderControl(-1, -1, -1);<a name="line.175"></a>
+<FONT color="green">176</FONT>        setInterpolationControl(true, -1);<a name="line.176"></a>
+<FONT color="green">177</FONT>      }<a name="line.177"></a>
+<FONT color="green">178</FONT>    <a name="line.178"></a>
+<FONT color="green">179</FONT>      /** Simple constructor.<a name="line.179"></a>
+<FONT color="green">180</FONT>       * Build a Gragg-Bulirsch-Stoer integrator with the given step<a name="line.180"></a>
+<FONT color="green">181</FONT>       * bounds. All tuning parameters are set to their default<a name="line.181"></a>
+<FONT color="green">182</FONT>       * values. The default step handler does nothing.<a name="line.182"></a>
+<FONT color="green">183</FONT>       * @param minStep minimal step (must be positive even for backward<a name="line.183"></a>
+<FONT color="green">184</FONT>       * integration), the last step can be smaller than this<a name="line.184"></a>
+<FONT color="green">185</FONT>       * @param maxStep maximal step (must be positive even for backward<a name="line.185"></a>
+<FONT color="green">186</FONT>       * integration)<a name="line.186"></a>
+<FONT color="green">187</FONT>       * @param vecAbsoluteTolerance allowed absolute error<a name="line.187"></a>
+<FONT color="green">188</FONT>       * @param vecRelativeTolerance allowed relative error<a name="line.188"></a>
+<FONT color="green">189</FONT>       */<a name="line.189"></a>
+<FONT color="green">190</FONT>      public GraggBulirschStoerIntegrator(final double minStep, final double maxStep,<a name="line.190"></a>
+<FONT color="green">191</FONT>                                          final double[] vecAbsoluteTolerance,<a name="line.191"></a>
+<FONT color="green">192</FONT>                                          final double[] vecRelativeTolerance) {<a name="line.192"></a>
+<FONT color="green">193</FONT>        super(METHOD_NAME, minStep, maxStep,<a name="line.193"></a>
+<FONT color="green">194</FONT>              vecAbsoluteTolerance, vecRelativeTolerance);<a name="line.194"></a>
+<FONT color="green">195</FONT>        denseOutput = requiresDenseOutput() || (! eventsHandlersManager.isEmpty());<a name="line.195"></a>
+<FONT color="green">196</FONT>        setStabilityCheck(true, -1, -1, -1);<a name="line.196"></a>
+<FONT color="green">197</FONT>        setStepsizeControl(-1, -1, -1, -1);<a name="line.197"></a>
+<FONT color="green">198</FONT>        setOrderControl(-1, -1, -1);<a name="line.198"></a>
+<FONT color="green">199</FONT>        setInterpolationControl(true, -1);<a name="line.199"></a>
+<FONT color="green">200</FONT>      }<a name="line.200"></a>
+<FONT color="green">201</FONT>    <a name="line.201"></a>
+<FONT color="green">202</FONT>      /** Set the stability check controls.<a name="line.202"></a>
+<FONT color="green">203</FONT>       * &lt;p&gt;The stability check is performed on the first few iterations of<a name="line.203"></a>
+<FONT color="green">204</FONT>       * the extrapolation scheme. If this test fails, the step is rejected<a name="line.204"></a>
+<FONT color="green">205</FONT>       * and the stepsize is reduced.&lt;/p&gt;<a name="line.205"></a>
+<FONT color="green">206</FONT>       * &lt;p&gt;By default, the test is performed, at most during two<a name="line.206"></a>
+<FONT color="green">207</FONT>       * iterations at each step, and at most once for each of these<a name="line.207"></a>
+<FONT color="green">208</FONT>       * iterations. The default stepsize reduction factor is 0.5.&lt;/p&gt;<a name="line.208"></a>
+<FONT color="green">209</FONT>       * @param performStabilityCheck if true, stability check will be performed,<a name="line.209"></a>
+<FONT color="green">210</FONT>         if false, the check will be skipped<a name="line.210"></a>
+<FONT color="green">211</FONT>       * @param maxNumIter maximal number of iterations for which checks are<a name="line.211"></a>
+<FONT color="green">212</FONT>       * performed (the number of iterations is reset to default if negative<a name="line.212"></a>
+<FONT color="green">213</FONT>       * or null)<a name="line.213"></a>
+<FONT color="green">214</FONT>       * @param maxNumChecks maximal number of checks for each iteration<a name="line.214"></a>
+<FONT color="green">215</FONT>       * (the number of checks is reset to default if negative or null)<a name="line.215"></a>
+<FONT color="green">216</FONT>       * @param stepsizeReductionFactor stepsize reduction factor in case of<a name="line.216"></a>
+<FONT color="green">217</FONT>       * failure (the factor is reset to default if lower than 0.0001 or<a name="line.217"></a>
+<FONT color="green">218</FONT>       * greater than 0.9999)<a name="line.218"></a>
+<FONT color="green">219</FONT>       */<a name="line.219"></a>
+<FONT color="green">220</FONT>      public void setStabilityCheck(final boolean performStabilityCheck,<a name="line.220"></a>
+<FONT color="green">221</FONT>                                    final int maxNumIter, final int maxNumChecks,<a name="line.221"></a>
+<FONT color="green">222</FONT>                                    final double stepsizeReductionFactor) {<a name="line.222"></a>
+<FONT color="green">223</FONT>    <a name="line.223"></a>
+<FONT color="green">224</FONT>        this.performTest = performStabilityCheck;<a name="line.224"></a>
+<FONT color="green">225</FONT>        this.maxIter     = (maxNumIter   &lt;= 0) ? 2 : maxNumIter;<a name="line.225"></a>
+<FONT color="green">226</FONT>        this.maxChecks   = (maxNumChecks &lt;= 0) ? 1 : maxNumChecks;<a name="line.226"></a>
+<FONT color="green">227</FONT>    <a name="line.227"></a>
+<FONT color="green">228</FONT>        if ((stepsizeReductionFactor &lt; 0.0001) || (stepsizeReductionFactor &gt; 0.9999)) {<a name="line.228"></a>
+<FONT color="green">229</FONT>          this.stabilityReduction = 0.5;<a name="line.229"></a>
+<FONT color="green">230</FONT>        } else {<a name="line.230"></a>
+<FONT color="green">231</FONT>          this.stabilityReduction = stepsizeReductionFactor;<a name="line.231"></a>
+<FONT color="green">232</FONT>        }<a name="line.232"></a>
+<FONT color="green">233</FONT>    <a name="line.233"></a>
+<FONT color="green">234</FONT>      }<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>      /** Set the step size control factors.<a name="line.236"></a>
+<FONT color="green">237</FONT>    <a name="line.237"></a>
+<FONT color="green">238</FONT>       * &lt;p&gt;The new step size hNew is computed from the old one h by:<a name="line.238"></a>
+<FONT color="green">239</FONT>       * &lt;pre&gt;<a name="line.239"></a>
+<FONT color="green">240</FONT>       * hNew = h * stepControl2 / (err/stepControl1)^(1/(2k+1))<a name="line.240"></a>
+<FONT color="green">241</FONT>       * &lt;/pre&gt;<a name="line.241"></a>
+<FONT color="green">242</FONT>       * where err is the scaled error and k the iteration number of the<a name="line.242"></a>
+<FONT color="green">243</FONT>       * extrapolation scheme (counting from 0). The default values are<a name="line.243"></a>
+<FONT color="green">244</FONT>       * 0.65 for stepControl1 and 0.94 for stepControl2.&lt;/p&gt;<a name="line.244"></a>
+<FONT color="green">245</FONT>       * &lt;p&gt;The step size is subject to the restriction:<a name="line.245"></a>
+<FONT color="green">246</FONT>       * &lt;pre&gt;<a name="line.246"></a>
+<FONT color="green">247</FONT>       * stepControl3^(1/(2k+1))/stepControl4 &lt;= hNew/h &lt;= 1/stepControl3^(1/(2k+1))<a name="line.247"></a>
+<FONT color="green">248</FONT>       * &lt;/pre&gt;<a name="line.248"></a>
+<FONT color="green">249</FONT>       * The default values are 0.02 for stepControl3 and 4.0 for<a name="line.249"></a>
+<FONT color="green">250</FONT>       * stepControl4.&lt;/p&gt;<a name="line.250"></a>
+<FONT color="green">251</FONT>       * @param control1 first stepsize control factor (the factor is<a name="line.251"></a>
+<FONT color="green">252</FONT>       * reset to default if lower than 0.0001 or greater than 0.9999)<a name="line.252"></a>
+<FONT color="green">253</FONT>       * @param control2 second stepsize control factor (the factor<a name="line.253"></a>
+<FONT color="green">254</FONT>       * is reset to default if lower than 0.0001 or greater than 0.9999)<a name="line.254"></a>
+<FONT color="green">255</FONT>       * @param control3 third stepsize control factor (the factor is<a name="line.255"></a>
+<FONT color="green">256</FONT>       * reset to default if lower than 0.0001 or greater than 0.9999)<a name="line.256"></a>
+<FONT color="green">257</FONT>       * @param control4 fourth stepsize control factor (the factor<a name="line.257"></a>
+<FONT color="green">258</FONT>       * is reset to default if lower than 1.0001 or greater than 999.9)<a name="line.258"></a>
+<FONT color="green">259</FONT>       */<a name="line.259"></a>
+<FONT color="green">260</FONT>      public void setStepsizeControl(final double control1, final double control2,<a name="line.260"></a>
+<FONT color="green">261</FONT>                                     final double control3, final double control4) {<a name="line.261"></a>
+<FONT color="green">262</FONT>    <a name="line.262"></a>
+<FONT color="green">263</FONT>        if ((control1 &lt; 0.0001) || (control1 &gt; 0.9999)) {<a name="line.263"></a>
+<FONT color="green">264</FONT>          this.stepControl1 = 0.65;<a name="line.264"></a>
+<FONT color="green">265</FONT>        } else {<a name="line.265"></a>
+<FONT color="green">266</FONT>          this.stepControl1 = control1;<a name="line.266"></a>
+<FONT color="green">267</FONT>        }<a name="line.267"></a>
+<FONT color="green">268</FONT>    <a name="line.268"></a>
+<FONT color="green">269</FONT>        if ((control2 &lt; 0.0001) || (control2 &gt; 0.9999)) {<a name="line.269"></a>
+<FONT color="green">270</FONT>          this.stepControl2 = 0.94;<a name="line.270"></a>
+<FONT color="green">271</FONT>        } else {<a name="line.271"></a>
+<FONT color="green">272</FONT>          this.stepControl2 = control2;<a name="line.272"></a>
+<FONT color="green">273</FONT>        }<a name="line.273"></a>
+<FONT color="green">274</FONT>    <a name="line.274"></a>
+<FONT color="green">275</FONT>        if ((control3 &lt; 0.0001) || (control3 &gt; 0.9999)) {<a name="line.275"></a>
+<FONT color="green">276</FONT>          this.stepControl3 = 0.02;<a name="line.276"></a>
+<FONT color="green">277</FONT>        } else {<a name="line.277"></a>
+<FONT color="green">278</FONT>          this.stepControl3 = control3;<a name="line.278"></a>
+<FONT color="green">279</FONT>        }<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>        if ((control4 &lt; 1.0001) || (control4 &gt; 999.9)) {<a name="line.281"></a>
+<FONT color="green">282</FONT>          this.stepControl4 = 4.0;<a name="line.282"></a>
+<FONT color="green">283</FONT>        } else {<a name="line.283"></a>
+<FONT color="green">284</FONT>          this.stepControl4 = control4;<a name="line.284"></a>
+<FONT color="green">285</FONT>        }<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>      }<a name="line.287"></a>
+<FONT color="green">288</FONT>    <a name="line.288"></a>
+<FONT color="green">289</FONT>      /** Set the order control parameters.<a name="line.289"></a>
+<FONT color="green">290</FONT>       * &lt;p&gt;The Gragg-Bulirsch-Stoer method changes both the step size and<a name="line.290"></a>
+<FONT color="green">291</FONT>       * the order during integration, in order to minimize computation<a name="line.291"></a>
+<FONT color="green">292</FONT>       * cost. Each extrapolation step increases the order by 2, so the<a name="line.292"></a>
+<FONT color="green">293</FONT>       * maximal order that will be used is always even, it is twice the<a name="line.293"></a>
+<FONT color="green">294</FONT>       * maximal number of columns in the extrapolation table.&lt;/p&gt;<a name="line.294"></a>
+<FONT color="green">295</FONT>       * &lt;pre&gt;<a name="line.295"></a>
+<FONT color="green">296</FONT>       * order is decreased if w(k-1) &lt;= w(k)   * orderControl1<a name="line.296"></a>
+<FONT color="green">297</FONT>       * order is increased if w(k)   &lt;= w(k-1) * orderControl2<a name="line.297"></a>
+<FONT color="green">298</FONT>       * &lt;/pre&gt;<a name="line.298"></a>
+<FONT color="green">299</FONT>       * &lt;p&gt;where w is the table of work per unit step for each order<a name="line.299"></a>
+<FONT color="green">300</FONT>       * (number of function calls divided by the step length), and k is<a name="line.300"></a>
+<FONT color="green">301</FONT>       * the current order.&lt;/p&gt;<a name="line.301"></a>
+<FONT color="green">302</FONT>       * &lt;p&gt;The default maximal order after construction is 18 (i.e. the<a name="line.302"></a>
+<FONT color="green">303</FONT>       * maximal number of columns is 9). The default values are 0.8 for<a name="line.303"></a>
+<FONT color="green">304</FONT>       * orderControl1 and 0.9 for orderControl2.&lt;/p&gt;<a name="line.304"></a>
+<FONT color="green">305</FONT>       * @param maximalOrder maximal order in the extrapolation table (the<a name="line.305"></a>
+<FONT color="green">306</FONT>       * maximal order is reset to default if order &lt;= 6 or odd)<a name="line.306"></a>
+<FONT color="green">307</FONT>       * @param control1 first order control factor (the factor is<a name="line.307"></a>
+<FONT color="green">308</FONT>       * reset to default if lower than 0.0001 or greater than 0.9999)<a name="line.308"></a>
+<FONT color="green">309</FONT>       * @param control2 second order control factor (the factor<a name="line.309"></a>
+<FONT color="green">310</FONT>       * is reset to default if lower than 0.0001 or greater than 0.9999)<a name="line.310"></a>
+<FONT color="green">311</FONT>       */<a name="line.311"></a>
+<FONT color="green">312</FONT>      public void setOrderControl(final int maximalOrder,<a name="line.312"></a>
+<FONT color="green">313</FONT>                                  final double control1, final double control2) {<a name="line.313"></a>
+<FONT color="green">314</FONT>    <a name="line.314"></a>
+<FONT color="green">315</FONT>        if ((maximalOrder &lt;= 6) || (maximalOrder % 2 != 0)) {<a name="line.315"></a>
+<FONT color="green">316</FONT>          this.maxOrder = 18;<a name="line.316"></a>
+<FONT color="green">317</FONT>        }<a name="line.317"></a>
+<FONT color="green">318</FONT>    <a name="line.318"></a>
+<FONT color="green">319</FONT>        if ((control1 &lt; 0.0001) || (control1 &gt; 0.9999)) {<a name="line.319"></a>
+<FONT color="green">320</FONT>          this.orderControl1 = 0.8;<a name="line.320"></a>
+<FONT color="green">321</FONT>        } else {<a name="line.321"></a>
+<FONT color="green">322</FONT>          this.orderControl1 = control1;<a name="line.322"></a>
+<FONT color="green">323</FONT>        }<a name="line.323"></a>
+<FONT color="green">324</FONT>    <a name="line.324"></a>
+<FONT color="green">325</FONT>        if ((control2 &lt; 0.0001) || (control2 &gt; 0.9999)) {<a name="line.325"></a>
+<FONT color="green">326</FONT>          this.orderControl2 = 0.9;<a name="line.326"></a>
+<FONT color="green">327</FONT>        } else {<a name="line.327"></a>
+<FONT color="green">328</FONT>          this.orderControl2 = control2;<a name="line.328"></a>
+<FONT color="green">329</FONT>        }<a name="line.329"></a>
+<FONT color="green">330</FONT>    <a name="line.330"></a>
+<FONT color="green">331</FONT>        // reinitialize the arrays<a name="line.331"></a>
+<FONT color="green">332</FONT>        initializeArrays();<a name="line.332"></a>
+<FONT color="green">333</FONT>    <a name="line.333"></a>
+<FONT color="green">334</FONT>      }<a name="line.334"></a>
+<FONT color="green">335</FONT>    <a name="line.335"></a>
+<FONT color="green">336</FONT>      /** {@inheritDoc} */<a name="line.336"></a>
+<FONT color="green">337</FONT>      @Override<a name="line.337"></a>
+<FONT color="green">338</FONT>      public void addStepHandler (final StepHandler handler) {<a name="line.338"></a>
+<FONT color="green">339</FONT>    <a name="line.339"></a>
+<FONT color="green">340</FONT>        super.addStepHandler(handler);<a name="line.340"></a>
+<FONT color="green">341</FONT>        denseOutput = requiresDenseOutput() || (! eventsHandlersManager.isEmpty());<a name="line.341"></a>
+<FONT color="green">342</FONT>    <a name="line.342"></a>
+<FONT color="green">343</FONT>        // reinitialize the arrays<a name="line.343"></a>
+<FONT color="green">344</FONT>        initializeArrays();<a name="line.344"></a>
+<FONT color="green">345</FONT>    <a name="line.345"></a>
+<FONT color="green">346</FONT>      }<a name="line.346"></a>
+<FONT color="green">347</FONT>    <a name="line.347"></a>
+<FONT color="green">348</FONT>      /** {@inheritDoc} */<a name="line.348"></a>
+<FONT color="green">349</FONT>      @Override<a name="line.349"></a>
+<FONT color="green">350</FONT>      public void addEventHandler(final EventHandler function,<a name="line.350"></a>
+<FONT color="green">351</FONT>                                  final double maxCheckInterval,<a name="line.351"></a>
+<FONT color="green">352</FONT>                                  final double convergence,<a name="line.352"></a>
+<FONT color="green">353</FONT>                                  final int maxIterationCount) {<a name="line.353"></a>
+<FONT color="green">354</FONT>        super.addEventHandler(function, maxCheckInterval, convergence, maxIterationCount);<a name="line.354"></a>
+<FONT color="green">355</FONT>        denseOutput = requiresDenseOutput() || (! eventsHandlersManager.isEmpty());<a name="line.355"></a>
+<FONT color="green">356</FONT>    <a name="line.356"></a>
+<FONT color="green">357</FONT>        // reinitialize the arrays<a name="line.357"></a>
+<FONT color="green">358</FONT>        initializeArrays();<a name="line.358"></a>
+<FONT color="green">359</FONT>    <a name="line.359"></a>
+<FONT color="green">360</FONT>      }<a name="line.360"></a>
+<FONT color="green">361</FONT>    <a name="line.361"></a>
+<FONT color="green">362</FONT>      /** Initialize the integrator internal arrays. */<a name="line.362"></a>
+<FONT color="green">363</FONT>      private void initializeArrays() {<a name="line.363"></a>
+<FONT color="green">364</FONT>    <a name="line.364"></a>
+<FONT color="green">365</FONT>        final int size = maxOrder / 2;<a name="line.365"></a>
+<FONT color="green">366</FONT>    <a name="line.366"></a>
+<FONT color="green">367</FONT>        if ((sequence == null) || (sequence.length != size)) {<a name="line.367"></a>
+<FONT color="green">368</FONT>          // all arrays should be reallocated with the right size<a name="line.368"></a>
+<FONT color="green">369</FONT>          sequence        = new int[size];<a name="line.369"></a>
+<FONT color="green">370</FONT>          costPerStep     = new int[size];<a name="line.370"></a>
+<FONT color="green">371</FONT>          coeff           = new double[size][];<a name="line.371"></a>
+<FONT color="green">372</FONT>          costPerTimeUnit = new double[size];<a name="line.372"></a>
+<FONT color="green">373</FONT>          optimalStep     = new double[size];<a name="line.373"></a>
+<FONT color="green">374</FONT>        }<a name="line.374"></a>
+<FONT color="green">375</FONT>    <a name="line.375"></a>
+<FONT color="green">376</FONT>        if (denseOutput) {<a name="line.376"></a>
+<FONT color="green">377</FONT>          // step size sequence: 2, 6, 10, 14, ...<a name="line.377"></a>
+<FONT color="green">378</FONT>          for (int k = 0; k &lt; size; ++k) {<a name="line.378"></a>
+<FONT color="green">379</FONT>            sequence[k] = 4 * k + 2;<a name="line.379"></a>
+<FONT color="green">380</FONT>          }<a name="line.380"></a>
+<FONT color="green">381</FONT>        } else {<a name="line.381"></a>
+<FONT color="green">382</FONT>          // step size sequence: 2, 4, 6, 8, ...<a name="line.382"></a>
+<FONT color="green">383</FONT>          for (int k = 0; k &lt; size; ++k) {<a name="line.383"></a>
+<FONT color="green">384</FONT>            sequence[k] = 2 * (k + 1);<a name="line.384"></a>
+<FONT color="green">385</FONT>          }<a name="line.385"></a>
+<FONT color="green">386</FONT>        }<a name="line.386"></a>
+<FONT color="green">387</FONT>    <a name="line.387"></a>
+<FONT color="green">388</FONT>        // initialize the order selection cost array<a name="line.388"></a>
+<FONT color="green">389</FONT>        // (number of function calls for each column of the extrapolation table)<a name="line.389"></a>
+<FONT color="green">390</FONT>        costPerStep[0] = sequence[0] + 1;<a name="line.390"></a>
+<FONT color="green">391</FONT>        for (int k = 1; k &lt; size; ++k) {<a name="line.391"></a>
+<FONT color="green">392</FONT>          costPerStep[k] = costPerStep[k-1] + sequence[k];<a name="line.392"></a>
+<FONT color="green">393</FONT>        }<a name="line.393"></a>
+<FONT color="green">394</FONT>    <a name="line.394"></a>
+<FONT color="green">395</FONT>        // initialize the extrapolation tables<a name="line.395"></a>
+<FONT color="green">396</FONT>        for (int k = 0; k &lt; size; ++k) {<a name="line.396"></a>
+<FONT color="green">397</FONT>          coeff[k] = (k &gt; 0) ? new double[k] : null;<a name="line.397"></a>
+<FONT color="green">398</FONT>          for (int l = 0; l &lt; k; ++l) {<a name="line.398"></a>
+<FONT color="green">399</FONT>            final double ratio = ((double) sequence[k]) / sequence[k-l-1];<a name="line.399"></a>
+<FONT color="green">400</FONT>            coeff[k][l] = 1.0 / (ratio * ratio - 1.0);<a name="line.400"></a>
+<FONT color="green">401</FONT>          }<a name="line.401"></a>
+<FONT color="green">402</FONT>        }<a name="line.402"></a>
+<FONT color="green">403</FONT>    <a name="line.403"></a>
+<FONT color="green">404</FONT>      }<a name="line.404"></a>
+<FONT color="green">405</FONT>    <a name="line.405"></a>
+<FONT color="green">406</FONT>      /** Set the interpolation order control parameter.<a name="line.406"></a>
+<FONT color="green">407</FONT>       * The interpolation order for dense output is 2k - mudif + 1. The<a name="line.407"></a>
+<FONT color="green">408</FONT>       * default value for mudif is 4 and the interpolation error is used<a name="line.408"></a>
+<FONT color="green">409</FONT>       * in stepsize control by default.<a name="line.409"></a>
+<FONT color="green">410</FONT>    <a name="line.410"></a>
+<FONT color="green">411</FONT>       * @param useInterpolationErrorForControl if true, interpolation error is used<a name="line.411"></a>
+<FONT color="green">412</FONT>       * for stepsize control<a name="line.412"></a>
+<FONT color="green">413</FONT>       * @param mudifControlParameter interpolation order control parameter (the parameter<a name="line.413"></a>
+<FONT color="green">414</FONT>       * is reset to default if &lt;= 0 or &gt;= 7)<a name="line.414"></a>
+<FONT color="green">415</FONT>       */<a name="line.415"></a>
+<FONT color="green">416</FONT>      public void setInterpolationControl(final boolean useInterpolationErrorForControl,<a name="line.416"></a>
+<FONT color="green">417</FONT>                                          final int mudifControlParameter) {<a name="line.417"></a>
+<FONT color="green">418</FONT>    <a name="line.418"></a>
+<FONT color="green">419</FONT>        this.useInterpolationError = useInterpolationErrorForControl;<a name="line.419"></a>
+<FONT color="green">420</FONT>    <a name="line.420"></a>
+<FONT color="green">421</FONT>        if ((mudifControlParameter &lt;= 0) || (mudifControlParameter &gt;= 7)) {<a name="line.421"></a>
+<FONT color="green">422</FONT>          this.mudif = 4;<a name="line.422"></a>
+<FONT color="green">423</FONT>        } else {<a name="line.423"></a>
+<FONT color="green">424</FONT>          this.mudif = mudifControlParameter;<a name="line.424"></a>
+<FONT color="green">425</FONT>        }<a name="line.425"></a>
+<FONT color="green">426</FONT>    <a name="line.426"></a>
+<FONT color="green">427</FONT>      }<a name="line.427"></a>
+<FONT color="green">428</FONT>    <a name="line.428"></a>
+<FONT color="green">429</FONT>      /** Update scaling array.<a name="line.429"></a>
+<FONT color="green">430</FONT>       * @param y1 first state vector to use for scaling<a name="line.430"></a>
+<FONT color="green">431</FONT>       * @param y2 second state vector to use for scaling<a name="line.431"></a>
+<FONT color="green">432</FONT>       * @param scale scaling array to update<a name="line.432"></a>
+<FONT color="green">433</FONT>       */<a name="line.433"></a>
+<FONT color="green">434</FONT>      private void rescale(final double[] y1, final double[] y2, final double[] scale) {<a name="line.434"></a>
+<FONT color="green">435</FONT>        if (vecAbsoluteTolerance == null) {<a name="line.435"></a>
+<FONT color="green">436</FONT>          for (int i = 0; i &lt; scale.length; ++i) {<a name="line.436"></a>
+<FONT color="green">437</FONT>            final double yi = Math.max(Math.abs(y1[i]), Math.abs(y2[i]));<a name="line.437"></a>
+<FONT color="green">438</FONT>            scale[i] = scalAbsoluteTolerance + scalRelativeTolerance * yi;<a name="line.438"></a>
+<FONT color="green">439</FONT>          }<a name="line.439"></a>
+<FONT color="green">440</FONT>        } else {<a name="line.440"></a>
+<FONT color="green">441</FONT>          for (int i = 0; i &lt; scale.length; ++i) {<a name="line.441"></a>
+<FONT color="green">442</FONT>            final double yi = Math.max(Math.abs(y1[i]), Math.abs(y2[i]));<a name="line.442"></a>
+<FONT color="green">443</FONT>            scale[i] = vecAbsoluteTolerance[i] + vecRelativeTolerance[i] * yi;<a name="line.443"></a>
+<FONT color="green">444</FONT>          }<a name="line.444"></a>
+<FONT color="green">445</FONT>        }<a name="line.445"></a>
+<FONT color="green">446</FONT>      }<a name="line.446"></a>
+<FONT color="green">447</FONT>    <a name="line.447"></a>
+<FONT color="green">448</FONT>      /** Perform integration over one step using substeps of a modified<a name="line.448"></a>
+<FONT color="green">449</FONT>       * midpoint method.<a name="line.449"></a>
+<FONT color="green">450</FONT>       * @param t0 initial time<a name="line.450"></a>
+<FONT color="green">451</FONT>       * @param y0 initial value of the state vector at t0<a name="line.451"></a>
+<FONT color="green">452</FONT>       * @param step global step<a name="line.452"></a>
+<FONT color="green">453</FONT>       * @param k iteration number (from 0 to sequence.length - 1)<a name="line.453"></a>
+<FONT color="green">454</FONT>       * @param scale scaling array<a name="line.454"></a>
+<FONT color="green">455</FONT>       * @param f placeholder where to put the state vector derivatives at each substep<a name="line.455"></a>
+<FONT color="green">456</FONT>       *          (element 0 already contains initial derivative)<a name="line.456"></a>
+<FONT color="green">457</FONT>       * @param yMiddle placeholder where to put the state vector at the middle of the step<a name="line.457"></a>
+<FONT color="green">458</FONT>       * @param yEnd placeholder where to put the state vector at the end<a name="line.458"></a>
+<FONT color="green">459</FONT>       * @param yTmp placeholder for one state vector<a name="line.459"></a>
+<FONT color="green">460</FONT>       * @return true if computation was done properly,<a name="line.460"></a>
+<FONT color="green">461</FONT>       *         false if stability check failed before end of computation<a name="line.461"></a>
+<FONT color="green">462</FONT>       * @throws DerivativeException this exception is propagated to the caller if the<a name="line.462"></a>
+<FONT color="green">463</FONT>       * underlying user function triggers one<a name="line.463"></a>
+<FONT color="green">464</FONT>       */<a name="line.464"></a>
+<FONT color="green">465</FONT>      private boolean tryStep(final double t0, final double[] y0, final double step, final int k,<a name="line.465"></a>
+<FONT color="green">466</FONT>                              final double[] scale, final double[][] f,<a name="line.466"></a>
+<FONT color="green">467</FONT>                              final double[] yMiddle, final double[] yEnd,<a name="line.467"></a>
+<FONT color="green">468</FONT>                              final double[] yTmp)<a name="line.468"></a>
+<FONT color="green">469</FONT>        throws DerivativeException {<a name="line.469"></a>
+<FONT color="green">470</FONT>    <a name="line.470"></a>
+<FONT color="green">471</FONT>        final int    n        = sequence[k];<a name="line.471"></a>
+<FONT color="green">472</FONT>        final double subStep  = step / n;<a name="line.472"></a>
+<FONT color="green">473</FONT>        final double subStep2 = 2 * subStep;<a name="line.473"></a>
+<FONT color="green">474</FONT>    <a name="line.474"></a>
+<FONT color="green">475</FONT>        // first substep<a name="line.475"></a>
+<FONT color="green">476</FONT>        double t = t0 + subStep;<a name="line.476"></a>
+<FONT color="green">477</FONT>        for (int i = 0; i &lt; y0.length; ++i) {<a name="line.477"></a>
+<FONT color="green">478</FONT>          yTmp[i] = y0[i];<a name="line.478"></a>
+<FONT color="green">479</FONT>          yEnd[i] = y0[i] + subStep * f[0][i];<a name="line.479"></a>
+<FONT color="green">480</FONT>        }<a name="line.480"></a>
+<FONT color="green">481</FONT>        computeDerivatives(t, yEnd, f[1]);<a name="line.481"></a>
+<FONT color="green">482</FONT>    <a name="line.482"></a>
+<FONT color="green">483</FONT>        // other substeps<a name="line.483"></a>
+<FONT color="green">484</FONT>        for (int j = 1; j &lt; n; ++j) {<a name="line.484"></a>
+<FONT color="green">485</FONT>    <a name="line.485"></a>
+<FONT color="green">486</FONT>          if (2 * j == n) {<a name="line.486"></a>
+<FONT color="green">487</FONT>            // save the point at the middle of the step<a name="line.487"></a>
+<FONT color="green">488</FONT>            System.arraycopy(yEnd, 0, yMiddle, 0, y0.length);<a name="line.488"></a>
+<FONT color="green">489</FONT>          }<a name="line.489"></a>
+<FONT color="green">490</FONT>    <a name="line.490"></a>
+<FONT color="green">491</FONT>          t += subStep;<a name="line.491"></a>
+<FONT color="green">492</FONT>          for (int i = 0; i &lt; y0.length; ++i) {<a name="line.492"></a>
+<FONT color="green">493</FONT>            final double middle = yEnd[i];<a name="line.493"></a>
+<FONT color="green">494</FONT>            yEnd[i]       = yTmp[i] + subStep2 * f[j][i];<a name="line.494"></a>
+<FONT color="green">495</FONT>            yTmp[i]       = middle;<a name="line.495"></a>
+<FONT color="green">496</FONT>          }<a name="line.496"></a>
+<FONT color="green">497</FONT>    <a name="line.497"></a>
+<FONT color="green">498</FONT>          computeDerivatives(t, yEnd, f[j+1]);<a name="line.498"></a>
+<FONT color="green">499</FONT>    <a name="line.499"></a>
+<FONT color="green">500</FONT>          // stability check<a name="line.500"></a>
+<FONT color="green">501</FONT>          if (performTest &amp;&amp; (j &lt;= maxChecks) &amp;&amp; (k &lt; maxIter)) {<a name="line.501"></a>
+<FONT color="green">502</FONT>            double initialNorm = 0.0;<a name="line.502"></a>
+<FONT color="green">503</FONT>            for (int l = 0; l &lt; y0.length; ++l) {<a name="line.503"></a>
+<FONT color="green">504</FONT>              final double ratio = f[0][l] / scale[l];<a name="line.504"></a>
+<FONT color="green">505</FONT>              initialNorm += ratio * ratio;<a name="line.505"></a>
+<FONT color="green">506</FONT>            }<a name="line.506"></a>
+<FONT color="green">507</FONT>            double deltaNorm = 0.0;<a name="line.507"></a>
+<FONT color="green">508</FONT>            for (int l = 0; l &lt; y0.length; ++l) {<a name="line.508"></a>
+<FONT color="green">509</FONT>              final double ratio = (f[j+1][l] - f[0][l]) / scale[l];<a name="line.509"></a>
+<FONT color="green">510</FONT>              deltaNorm += ratio * ratio;<a name="line.510"></a>
+<FONT color="green">511</FONT>            }<a name="line.511"></a>
+<FONT color="green">512</FONT>            if (deltaNorm &gt; 4 * Math.max(1.0e-15, initialNorm)) {<a name="line.512"></a>
+<FONT color="green">513</FONT>              return false;<a name="line.513"></a>
+<FONT color="green">514</FONT>            }<a name="line.514"></a>
+<FONT color="green">515</FONT>          }<a name="line.515"></a>
+<FONT color="green">516</FONT>    <a name="line.516"></a>
+<FONT color="green">517</FONT>        }<a name="line.517"></a>
+<FONT color="green">518</FONT>    <a name="line.518"></a>
+<FONT color="green">519</FONT>        // correction of the last substep (at t0 + step)<a name="line.519"></a>
+<FONT color="green">520</FONT>        for (int i = 0; i &lt; y0.length; ++i) {<a name="line.520"></a>
+<FONT color="green">521</FONT>          yEnd[i] = 0.5 * (yTmp[i] + yEnd[i] + subStep * f[n][i]);<a name="line.521"></a>
+<FONT color="green">522</FONT>        }<a name="line.522"></a>
+<FONT color="green">523</FONT>    <a name="line.523"></a>
+<FONT color="green">524</FONT>        return true;<a name="line.524"></a>
+<FONT color="green">525</FONT>    <a name="line.525"></a>
+<FONT color="green">526</FONT>      }<a name="line.526"></a>
+<FONT color="green">527</FONT>    <a name="line.527"></a>
+<FONT color="green">528</FONT>      /** Extrapolate a vector.<a name="line.528"></a>
+<FONT color="green">529</FONT>       * @param offset offset to use in the coefficients table<a name="line.529"></a>
+<FONT color="green">530</FONT>       * @param k index of the last updated point<a name="line.530"></a>
+<FONT color="green">531</FONT>       * @param diag working diagonal of the Aitken-Neville's<a name="line.531"></a>
+<FONT color="green">532</FONT>       * triangle, without the last element<a name="line.532"></a>
+<FONT color="green">533</FONT>       * @param last last element<a name="line.533"></a>
+<FONT color="green">534</FONT>       */<a name="line.534"></a>
+<FONT color="green">535</FONT>      private void extrapolate(final int offset, final int k,<a name="line.535"></a>
+<FONT color="green">536</FONT>                               final double[][] diag, final double[] last) {<a name="line.536"></a>
+<FONT color="green">537</FONT>    <a name="line.537"></a>
+<FONT color="green">538</FONT>        // update the diagonal<a name="line.538"></a>
+<FONT color="green">539</FONT>        for (int j = 1; j &lt; k; ++j) {<a name="line.539"></a>
+<FONT color="green">540</FONT>          for (int i = 0; i &lt; last.length; ++i) {<a name="line.540"></a>
+<FONT color="green">541</FONT>            // Aitken-Neville's recursive formula<a name="line.541"></a>
+<FONT color="green">542</FONT>            diag[k-j-1][i] = diag[k-j][i] +<a name="line.542"></a>
+<FONT color="green">543</FONT>                             coeff[k+offset][j-1] * (diag[k-j][i] - diag[k-j-1][i]);<a name="line.543"></a>
+<FONT color="green">544</FONT>          }<a name="line.544"></a>
+<FONT color="green">545</FONT>        }<a name="line.545"></a>
+<FONT color="green">546</FONT>    <a name="line.546"></a>
+<FONT color="green">547</FONT>        // update the last element<a name="line.547"></a>
+<FONT color="green">548</FONT>        for (int i = 0; i &lt; last.length; ++i) {<a name="line.548"></a>
+<FONT color="green">549</FONT>          // Aitken-Neville's recursive formula<a name="line.549"></a>
+<FONT color="green">550</FONT>          last[i] = diag[0][i] + coeff[k+offset][k-1] * (diag[0][i] - last[i]);<a name="line.550"></a>
+<FONT color="green">551</FONT>        }<a name="line.551"></a>
+<FONT color="green">552</FONT>      }<a name="line.552"></a>
+<FONT color="green">553</FONT>    <a name="line.553"></a>
+<FONT color="green">554</FONT>      /** {@inheritDoc} */<a name="line.554"></a>
+<FONT color="green">555</FONT>      @Override<a name="line.555"></a>
+<FONT color="green">556</FONT>      public double integrate(final FirstOrderDifferentialEquations equations,<a name="line.556"></a>
+<FONT color="green">557</FONT>                              final double t0, final double[] y0, final double t, final double[] y)<a name="line.557"></a>
+<FONT color="green">558</FONT>      throws DerivativeException, IntegratorException {<a name="line.558"></a>
+<FONT color="green">559</FONT>    <a name="line.559"></a>
+<FONT color="green">560</FONT>        sanityChecks(equations, t0, y0, t, y);<a name="line.560"></a>
+<FONT color="green">561</FONT>        setEquations(equations);<a name="line.561"></a>
+<FONT color="green">562</FONT>        resetEvaluations();<a name="line.562"></a>
+<FONT color="green">563</FONT>        final boolean forward = t &gt; t0;<a name="line.563"></a>
+<FONT color="green">564</FONT>    <a name="line.564"></a>
+<FONT color="green">565</FONT>        // create some internal working arrays<a name="line.565"></a>
+<FONT color="green">566</FONT>        final double[] yDot0   = new double[y0.length];<a name="line.566"></a>
+<FONT color="green">567</FONT>        final double[] y1      = new double[y0.length];<a name="line.567"></a>
+<FONT color="green">568</FONT>        final double[] yTmp    = new double[y0.length];<a name="line.568"></a>
+<FONT color="green">569</FONT>        final double[] yTmpDot = new double[y0.length];<a name="line.569"></a>
+<FONT color="green">570</FONT>    <a name="line.570"></a>
+<FONT color="green">571</FONT>        final double[][] diagonal = new double[sequence.length-1][];<a name="line.571"></a>
+<FONT color="green">572</FONT>        final double[][] y1Diag = new double[sequence.length-1][];<a name="line.572"></a>
+<FONT color="green">573</FONT>        for (int k = 0; k &lt; sequence.length-1; ++k) {<a name="line.573"></a>
+<FONT color="green">574</FONT>          diagonal[k] = new double[y0.length];<a name="line.574"></a>
+<FONT color="green">575</FONT>          y1Diag[k] = new double[y0.length];<a name="line.575"></a>
+<FONT color="green">576</FONT>        }<a name="line.576"></a>
+<FONT color="green">577</FONT>    <a name="line.577"></a>
+<FONT color="green">578</FONT>        final double[][][] fk  = new double[sequence.length][][];<a name="line.578"></a>
+<FONT color="green">579</FONT>        for (int k = 0; k &lt; sequence.length; ++k) {<a name="line.579"></a>
+<FONT color="green">580</FONT>    <a name="line.580"></a>
+<FONT color="green">581</FONT>          fk[k]    = new double[sequence[k] + 1][];<a name="line.581"></a>
+<FONT color="green">582</FONT>    <a name="line.582"></a>
+<FONT color="green">583</FONT>          // all substeps start at the same point, so share the first array<a name="line.583"></a>
+<FONT color="green">584</FONT>          fk[k][0] = yDot0;<a name="line.584"></a>
+<FONT color="green">585</FONT>    <a name="line.585"></a>
+<FONT color="green">586</FONT>          for (int l = 0; l &lt; sequence[k]; ++l) {<a name="line.586"></a>
+<FONT color="green">587</FONT>            fk[k][l+1] = new double[y0.length];<a name="line.587"></a>
+<FONT color="green">588</FONT>          }<a name="line.588"></a>
+<FONT color="green">589</FONT>    <a name="line.589"></a>
+<FONT color="green">590</FONT>        }<a name="line.590"></a>
+<FONT color="green">591</FONT>    <a name="line.591"></a>
+<FONT color="green">592</FONT>        if (y != y0) {<a name="line.592"></a>
+<FONT color="green">593</FONT>          System.arraycopy(y0, 0, y, 0, y0.length);<a name="line.593"></a>
+<FONT color="green">594</FONT>        }<a name="line.594"></a>
+<FONT color="green">595</FONT>    <a name="line.595"></a>
+<FONT color="green">596</FONT>        double[] yDot1      = null;<a name="line.596"></a>
+<FONT color="green">597</FONT>        double[][] yMidDots = null;<a name="line.597"></a>
+<FONT color="green">598</FONT>        if (denseOutput) {<a name="line.598"></a>
+<FONT color="green">599</FONT>          yDot1    = new double[y0.length];<a name="line.599"></a>
+<FONT color="green">600</FONT>          yMidDots = new double[1 + 2 * sequence.length][];<a name="line.600"></a>
+<FONT color="green">601</FONT>          for (int j = 0; j &lt; yMidDots.length; ++j) {<a name="line.601"></a>
+<FONT color="green">602</FONT>            yMidDots[j] = new double[y0.length];<a name="line.602"></a>
+<FONT color="green">603</FONT>          }<a name="line.603"></a>
+<FONT color="green">604</FONT>        } else {<a name="line.604"></a>
+<FONT color="green">605</FONT>          yMidDots    = new double[1][];<a name="line.605"></a>
+<FONT color="green">606</FONT>          yMidDots[0] = new double[y0.length];<a name="line.606"></a>
+<FONT color="green">607</FONT>        }<a name="line.607"></a>
+<FONT color="green">608</FONT>    <a name="line.608"></a>
+<FONT color="green">609</FONT>        // initial scaling<a name="line.609"></a>
+<FONT color="green">610</FONT>        final double[] scale = new double[y0.length];<a name="line.610"></a>
+<FONT color="green">611</FONT>        rescale(y, y, scale);<a name="line.611"></a>
+<FONT color="green">612</FONT>    <a name="line.612"></a>
+<FONT color="green">613</FONT>        // initial order selection<a name="line.613"></a>
+<FONT color="green">614</FONT>        final double tol =<a name="line.614"></a>
+<FONT color="green">615</FONT>            (vecRelativeTolerance == null) ? scalRelativeTolerance : vecRelativeTolerance[0];<a name="line.615"></a>
+<FONT color="green">616</FONT>        final double log10R = Math.log(Math.max(1.0e-10, tol)) / Math.log(10.0);<a name="line.616"></a>
+<FONT color="green">617</FONT>        int targetIter = Math.max(1,<a name="line.617"></a>
+<FONT color="green">618</FONT>                                  Math.min(sequence.length - 2,<a name="line.618"></a>
+<FONT color="green">619</FONT>                                           (int) Math.floor(0.5 - 0.6 * log10R)));<a name="line.619"></a>
+<FONT color="green">620</FONT>        // set up an interpolator sharing the integrator arrays<a name="line.620"></a>
+<FONT color="green">621</FONT>        AbstractStepInterpolator interpolator = null;<a name="line.621"></a>
+<FONT color="green">622</FONT>        if (denseOutput || (! eventsHandlersManager.isEmpty())) {<a name="line.622"></a>
+<FONT color="green">623</FONT>          interpolator = new GraggBulirschStoerStepInterpolator(y, yDot0,<a name="line.623"></a>
+<FONT color="green">624</FONT>                                                                y1, yDot1,<a name="line.624"></a>
+<FONT color="green">625</FONT>                                                                yMidDots, forward);<a name="line.625"></a>
+<FONT color="green">626</FONT>        } else {<a name="line.626"></a>
+<FONT color="green">627</FONT>          interpolator = new DummyStepInterpolator(y, yDot1, forward);<a name="line.627"></a>
+<FONT color="green">628</FONT>        }<a name="line.628"></a>
+<FONT color="green">629</FONT>        interpolator.storeTime(t0);<a name="line.629"></a>
+<FONT color="green">630</FONT>    <a name="line.630"></a>
+<FONT color="green">631</FONT>        stepStart = t0;<a name="line.631"></a>
+<FONT color="green">632</FONT>        double  hNew             = 0;<a name="line.632"></a>
+<FONT color="green">633</FONT>        double  maxError         = Double.MAX_VALUE;<a name="line.633"></a>
+<FONT color="green">634</FONT>        boolean previousRejected = false;<a name="line.634"></a>
+<FONT color="green">635</FONT>        boolean firstTime        = true;<a name="line.635"></a>
+<FONT color="green">636</FONT>        boolean newStep          = true;<a name="line.636"></a>
+<FONT color="green">637</FONT>        boolean lastStep         = false;<a name="line.637"></a>
+<FONT color="green">638</FONT>        boolean firstStepAlreadyComputed = false;<a name="line.638"></a>
+<FONT color="green">639</FONT>        for (StepHandler handler : stepHandlers) {<a name="line.639"></a>
+<FONT color="green">640</FONT>            handler.reset();<a name="line.640"></a>
+<FONT color="green">641</FONT>        }<a name="line.641"></a>
+<FONT color="green">642</FONT>        costPerTimeUnit[0] = 0;<a name="line.642"></a>
+<FONT color="green">643</FONT>        while (! lastStep) {<a name="line.643"></a>
+<FONT color="green">644</FONT>    <a name="line.644"></a>
+<FONT color="green">645</FONT>          double error;<a name="line.645"></a>
+<FONT color="green">646</FONT>          boolean reject = false;<a name="line.646"></a>
+<FONT color="green">647</FONT>    <a name="line.647"></a>
+<FONT color="green">648</FONT>          if (newStep) {<a name="line.648"></a>
+<FONT color="green">649</FONT>    <a name="line.649"></a>
+<FONT color="green">650</FONT>            interpolator.shift();<a name="line.650"></a>
+<FONT color="green">651</FONT>    <a name="line.651"></a>
+<FONT color="green">652</FONT>            // first evaluation, at the beginning of the step<a name="line.652"></a>
+<FONT color="green">653</FONT>            if (! firstStepAlreadyComputed) {<a name="line.653"></a>
+<FONT color="green">654</FONT>              computeDerivatives(stepStart, y, yDot0);<a name="line.654"></a>
+<FONT color="green">655</FONT>            }<a name="line.655"></a>
+<FONT color="green">656</FONT>    <a name="line.656"></a>
+<FONT color="green">657</FONT>            if (firstTime) {<a name="line.657"></a>
+<FONT color="green">658</FONT>    <a name="line.658"></a>
+<FONT color="green">659</FONT>              hNew = initializeStep(equations, forward,<a name="line.659"></a>
+<FONT color="green">660</FONT>                                    2 * targetIter + 1, scale,<a name="line.660"></a>
+<FONT color="green">661</FONT>                                    stepStart, y, yDot0, yTmp, yTmpDot);<a name="line.661"></a>
+<FONT color="green">662</FONT>    <a name="line.662"></a>
+<FONT color="green">663</FONT>              if (! forward) {<a name="line.663"></a>
+<FONT color="green">664</FONT>                hNew = -hNew;<a name="line.664"></a>
+<FONT color="green">665</FONT>              }<a name="line.665"></a>
+<FONT color="green">666</FONT>    <a name="line.666"></a>
+<FONT color="green">667</FONT>            }<a name="line.667"></a>
+<FONT color="green">668</FONT>    <a name="line.668"></a>
+<FONT color="green">669</FONT>            newStep = false;<a name="line.669"></a>
+<FONT color="green">670</FONT>    <a name="line.670"></a>
+<FONT color="green">671</FONT>          }<a name="line.671"></a>
+<FONT color="green">672</FONT>    <a name="line.672"></a>
+<FONT color="green">673</FONT>          stepSize = hNew;<a name="line.673"></a>
+<FONT color="green">674</FONT>    <a name="line.674"></a>
+<FONT color="green">675</FONT>          // step adjustment near bounds<a name="line.675"></a>
+<FONT color="green">676</FONT>          if ((forward &amp;&amp; (stepStart + stepSize &gt; t)) ||<a name="line.676"></a>
+<FONT color="green">677</FONT>              ((! forward) &amp;&amp; (stepStart + stepSize &lt; t))) {<a name="line.677"></a>
+<FONT color="green">678</FONT>            stepSize = t - stepStart;<a name="line.678"></a>
+<FONT color="green">679</FONT>          }<a name="line.679"></a>
+<FONT color="green">680</FONT>          final double nextT = stepStart + stepSize;<a name="line.680"></a>
+<FONT color="green">681</FONT>          lastStep = forward ? (nextT &gt;= t) : (nextT &lt;= t);<a name="line.681"></a>
+<FONT color="green">682</FONT>    <a name="line.682"></a>
+<FONT color="green">683</FONT>          // iterate over several substep sizes<a name="line.683"></a>
+<FONT color="green">684</FONT>          int k = -1;<a name="line.684"></a>
+<FONT color="green">685</FONT>          for (boolean loop = true; loop; ) {<a name="line.685"></a>
+<FONT color="green">686</FONT>    <a name="line.686"></a>
+<FONT color="green">687</FONT>            ++k;<a name="line.687"></a>
+<FONT color="green">688</FONT>    <a name="line.688"></a>
+<FONT color="green">689</FONT>            // modified midpoint integration with the current substep<a name="line.689"></a>
+<FONT color="green">690</FONT>            if ( ! tryStep(stepStart, y, stepSize, k, scale, fk[k],<a name="line.690"></a>
+<FONT color="green">691</FONT>                           (k == 0) ? yMidDots[0] : diagonal[k-1],<a name="line.691"></a>
+<FONT color="green">692</FONT>                           (k == 0) ? y1 : y1Diag[k-1],<a name="line.692"></a>
+<FONT color="green">693</FONT>                           yTmp)) {<a name="line.693"></a>
+<FONT color="green">694</FONT>    <a name="line.694"></a>
+<FONT color="green">695</FONT>              // the stability check failed, we reduce the global step<a name="line.695"></a>
+<FONT color="green">696</FONT>              hNew   = Math.abs(filterStep(stepSize * stabilityReduction, forward, false));<a name="line.696"></a>
+<FONT color="green">697</FONT>              reject = true;<a name="line.697"></a>
+<FONT color="green">698</FONT>              loop   = false;<a name="line.698"></a>
+<FONT color="green">699</FONT>    <a name="line.699"></a>
+<FONT color="green">700</FONT>            } else {<a name="line.700"></a>
+<FONT color="green">701</FONT>    <a name="line.701"></a>
+<FONT color="green">702</FONT>              // the substep was computed successfully<a name="line.702"></a>
+<FONT color="green">703</FONT>              if (k &gt; 0) {<a name="line.703"></a>
+<FONT color="green">704</FONT>    <a name="line.704"></a>
+<FONT color="green">705</FONT>                // extrapolate the state at the end of the step<a name="line.705"></a>
+<FONT color="green">706</FONT>                // using last iteration data<a name="line.706"></a>
+<FONT color="green">707</FONT>                extrapolate(0, k, y1Diag, y1);<a name="line.707"></a>
+<FONT color="green">708</FONT>                rescale(y, y1, scale);<a name="line.708"></a>
+<FONT color="green">709</FONT>    <a name="line.709"></a>
+<FONT color="green">710</FONT>                // estimate the error at the end of the step.<a name="line.710"></a>
+<FONT color="green">711</FONT>                error = 0;<a name="line.711"></a>
+<FONT color="green">712</FONT>                for (int j = 0; j &lt; y0.length; ++j) {<a name="line.712"></a>
+<FONT color="green">713</FONT>                  final double e = Math.abs(y1[j] - y1Diag[0][j]) / scale[j];<a name="line.713"></a>
+<FONT color="green">714</FONT>                  error += e * e;<a name="line.714"></a>
+<FONT color="green">715</FONT>                }<a name="line.715"></a>
+<FONT color="green">716</FONT>                error = Math.sqrt(error / y0.length);<a name="line.716"></a>
+<FONT color="green">717</FONT>    <a name="line.717"></a>
+<FONT color="green">718</FONT>                if ((error &gt; 1.0e15) || ((k &gt; 1) &amp;&amp; (error &gt; maxError))) {<a name="line.718"></a>
+<FONT color="green">719</FONT>                  // error is too big, we reduce the global step<a name="line.719"></a>
+<FONT color="green">720</FONT>                  hNew   = Math.abs(filterStep(stepSize * stabilityReduction, forward, false));<a name="line.720"></a>
+<FONT color="green">721</FONT>                  reject = true;<a name="line.721"></a>
+<FONT color="green">722</FONT>                  loop   = false;<a name="line.722"></a>
+<FONT color="green">723</FONT>                } else {<a name="line.723"></a>
+<FONT color="green">724</FONT>    <a name="line.724"></a>
+<FONT color="green">725</FONT>                  maxError = Math.max(4 * error, 1.0);<a name="line.725"></a>
+<FONT color="green">726</FONT>    <a name="line.726"></a>
+<FONT color="green">727</FONT>                  // compute optimal stepsize for this order<a name="line.727"></a>
+<FONT color="green">728</FONT>                  final double exp = 1.0 / (2 * k + 1);<a name="line.728"></a>
+<FONT color="green">729</FONT>                  double fac = stepControl2 / Math.pow(error / stepControl1, exp);<a name="line.729"></a>
+<FONT color="green">730</FONT>                  final double pow = Math.pow(stepControl3, exp);<a name="line.730"></a>
+<FONT color="green">731</FONT>                  fac = Math.max(pow / stepControl4, Math.min(1 / pow, fac));<a name="line.731"></a>
+<FONT color="green">732</FONT>                  optimalStep[k]     = Math.abs(filterStep(stepSize * fac, forward, true));<a name="line.732"></a>
+<FONT color="green">733</FONT>                  costPerTimeUnit[k] = costPerStep[k] / optimalStep[k];<a name="line.733"></a>
+<FONT color="green">734</FONT>    <a name="line.734"></a>
+<FONT color="green">735</FONT>                  // check convergence<a name="line.735"></a>
+<FONT color="green">736</FONT>                  switch (k - targetIter) {<a name="line.736"></a>
+<FONT color="green">737</FONT>    <a name="line.737"></a>
+<FONT color="green">738</FONT>                  case -1 :<a name="line.738"></a>
+<FONT color="green">739</FONT>                    if ((targetIter &gt; 1) &amp;&amp; ! previousRejected) {<a name="line.739"></a>
+<FONT color="green">740</FONT>    <a name="line.740"></a>
+<FONT color="green">741</FONT>                      // check if we can stop iterations now<a name="line.741"></a>
+<FONT color="green">742</FONT>                      if (error &lt;= 1.0) {<a name="line.742"></a>
+<FONT color="green">743</FONT>                        // convergence have been reached just before targetIter<a name="line.743"></a>
+<FONT color="green">744</FONT>                        loop = false;<a name="line.744"></a>
+<FONT color="green">745</FONT>                      } else {<a name="line.745"></a>
+<FONT color="green">746</FONT>                        // estimate if there is a chance convergence will<a name="line.746"></a>
+<FONT color="green">747</FONT>                        // be reached on next iteration, using the<a name="line.747"></a>
+<FONT color="green">748</FONT>                        // asymptotic evolution of error<a name="line.748"></a>
+<FONT color="green">749</FONT>                        final double ratio = ((double) sequence [targetIter] * sequence[targetIter + 1]) /<a name="line.749"></a>
+<FONT color="green">750</FONT>                                             (sequence[0] * sequence[0]);<a name="line.750"></a>
+<FONT color="green">751</FONT>                        if (error &gt; ratio * ratio) {<a name="line.751"></a>
+<FONT color="green">752</FONT>                          // we don't expect to converge on next iteration<a name="line.752"></a>
+<FONT color="green">753</FONT>                          // we reject the step immediately and reduce order<a name="line.753"></a>
+<FONT color="green">754</FONT>                          reject = true;<a name="line.754"></a>
+<FONT color="green">755</FONT>                          loop   = false;<a name="line.755"></a>
+<FONT color="green">756</FONT>                          targetIter = k;<a name="line.756"></a>
+<FONT color="green">757</FONT>                          if ((targetIter &gt; 1) &amp;&amp;<a name="line.757"></a>
+<FONT color="green">758</FONT>                              (costPerTimeUnit[targetIter-1] &lt;<a name="line.758"></a>
+<FONT color="green">759</FONT>                               orderControl1 * costPerTimeUnit[targetIter])) {<a name="line.759"></a>
+<FONT color="green">760</FONT>                            --targetIter;<a name="line.760"></a>
+<FONT color="green">761</FONT>                          }<a name="line.761"></a>
+<FONT color="green">762</FONT>                          hNew = optimalStep[targetIter];<a name="line.762"></a>
+<FONT color="green">763</FONT>                        }<a name="line.763"></a>
+<FONT color="green">764</FONT>                      }<a name="line.764"></a>
+<FONT color="green">765</FONT>                    }<a name="line.765"></a>
+<FONT color="green">766</FONT>                    break;<a name="line.766"></a>
+<FONT color="green">767</FONT>    <a name="line.767"></a>
+<FONT color="green">768</FONT>                  case 0:<a name="line.768"></a>
+<FONT color="green">769</FONT>                    if (error &lt;= 1.0) {<a name="line.769"></a>
+<FONT color="green">770</FONT>                      // convergence has been reached exactly at targetIter<a name="line.770"></a>
+<FONT color="green">771</FONT>                      loop = false;<a name="line.771"></a>
+<FONT color="green">772</FONT>                    } else {<a name="line.772"></a>
+<FONT color="green">773</FONT>                      // estimate if there is a chance convergence will<a name="line.773"></a>
+<FONT color="green">774</FONT>                      // be reached on next iteration, using the<a name="line.774"></a>
+<FONT color="green">775</FONT>                      // asymptotic evolution of error<a name="line.775"></a>
+<FONT color="green">776</FONT>                      final double ratio = ((double) sequence[k+1]) / sequence[0];<a name="line.776"></a>
+<FONT color="green">777</FONT>                      if (error &gt; ratio * ratio) {<a name="line.777"></a>
+<FONT color="green">778</FONT>                        // we don't expect to converge on next iteration<a name="line.778"></a>
+<FONT color="green">779</FONT>                        // we reject the step immediately<a name="line.779"></a>
+<FONT color="green">780</FONT>                        reject = true;<a name="line.780"></a>
+<FONT color="green">781</FONT>                        loop = false;<a name="line.781"></a>
+<FONT color="green">782</FONT>                        if ((targetIter &gt; 1) &amp;&amp;<a name="line.782"></a>
+<FONT color="green">783</FONT>                            (costPerTimeUnit[targetIter-1] &lt;<a name="line.783"></a>
+<FONT color="green">784</FONT>                             orderControl1 * costPerTimeUnit[targetIter])) {<a name="line.784"></a>
+<FONT color="green">785</FONT>                          --targetIter;<a name="line.785"></a>
+<FONT color="green">786</FONT>                        }<a name="line.786"></a>
+<FONT color="green">787</FONT>                        hNew = optimalStep[targetIter];<a name="line.787"></a>
+<FONT color="green">788</FONT>                      }<a name="line.788"></a>
+<FONT color="green">789</FONT>                    }<a name="line.789"></a>
+<FONT color="green">790</FONT>                    break;<a name="line.790"></a>
+<FONT color="green">791</FONT>    <a name="line.791"></a>
+<FONT color="green">792</FONT>                  case 1 :<a name="line.792"></a>
+<FONT color="green">793</FONT>                    if (error &gt; 1.0) {<a name="line.793"></a>
+<FONT color="green">794</FONT>                      reject = true;<a name="line.794"></a>
+<FONT color="green">795</FONT>                      if ((targetIter &gt; 1) &amp;&amp;<a name="line.795"></a>
+<FONT color="green">796</FONT>                          (costPerTimeUnit[targetIter-1] &lt;<a name="line.796"></a>
+<FONT color="green">797</FONT>                           orderControl1 * costPerTimeUnit[targetIter])) {<a name="line.797"></a>
+<FONT color="green">798</FONT>                        --targetIter;<a name="line.798"></a>
+<FONT color="green">799</FONT>                      }<a name="line.799"></a>
+<FONT color="green">800</FONT>                      hNew = optimalStep[targetIter];<a name="line.800"></a>
+<FONT color="green">801</FONT>                    }<a name="line.801"></a>
+<FONT color="green">802</FONT>                    loop = false;<a name="line.802"></a>
+<FONT color="green">803</FONT>                    break;<a name="line.803"></a>
+<FONT color="green">804</FONT>    <a name="line.804"></a>
+<FONT color="green">805</FONT>                  default :<a name="line.805"></a>
+<FONT color="green">806</FONT>                    if ((firstTime || lastStep) &amp;&amp; (error &lt;= 1.0)) {<a name="line.806"></a>
+<FONT color="green">807</FONT>                      loop = false;<a name="line.807"></a>
+<FONT color="green">808</FONT>                    }<a name="line.808"></a>
+<FONT color="green">809</FONT>                    break;<a name="line.809"></a>
+<FONT color="green">810</FONT>    <a name="line.810"></a>
+<FONT color="green">811</FONT>                  }<a name="line.811"></a>
+<FONT color="green">812</FONT>    <a name="line.812"></a>
+<FONT color="green">813</FONT>                }<a name="line.813"></a>
+<FONT color="green">814</FONT>              }<a name="line.814"></a>
+<FONT color="green">815</FONT>            }<a name="line.815"></a>
+<FONT color="green">816</FONT>          }<a name="line.816"></a>
+<FONT color="green">817</FONT>    <a name="line.817"></a>
+<FONT color="green">818</FONT>          // dense output handling<a name="line.818"></a>
+<FONT color="green">819</FONT>          double hInt = getMaxStep();<a name="line.819"></a>
+<FONT color="green">820</FONT>          if (denseOutput &amp;&amp; ! reject) {<a name="line.820"></a>
+<FONT color="green">821</FONT>    <a name="line.821"></a>
+<FONT color="green">822</FONT>            // extrapolate state at middle point of the step<a name="line.822"></a>
+<FONT color="green">823</FONT>            for (int j = 1; j &lt;= k; ++j) {<a name="line.823"></a>
+<FONT color="green">824</FONT>              extrapolate(0, j, diagonal, yMidDots[0]);<a name="line.824"></a>
+<FONT color="green">825</FONT>            }<a name="line.825"></a>
+<FONT color="green">826</FONT>    <a name="line.826"></a>
+<FONT color="green">827</FONT>            // derivative at end of step<a name="line.827"></a>
+<FONT color="green">828</FONT>            computeDerivatives(stepStart + stepSize, y1, yDot1);<a name="line.828"></a>
+<FONT color="green">829</FONT>    <a name="line.829"></a>
+<FONT color="green">830</FONT>            final int mu = 2 * k - mudif + 3;<a name="line.830"></a>
+<FONT color="green">831</FONT>    <a name="line.831"></a>
+<FONT color="green">832</FONT>            for (int l = 0; l &lt; mu; ++l) {<a name="line.832"></a>
+<FONT color="green">833</FONT>    <a name="line.833"></a>
+<FONT color="green">834</FONT>              // derivative at middle point of the step<a name="line.834"></a>
+<FONT color="green">835</FONT>              final int l2 = l / 2;<a name="line.835"></a>
+<FONT color="green">836</FONT>              double factor = Math.pow(0.5 * sequence[l2], l);<a name="line.836"></a>
+<FONT color="green">837</FONT>              int middleIndex = fk[l2].length / 2;<a name="line.837"></a>
+<FONT color="green">838</FONT>              for (int i = 0; i &lt; y0.length; ++i) {<a name="line.838"></a>
+<FONT color="green">839</FONT>                yMidDots[l+1][i] = factor * fk[l2][middleIndex + l][i];<a name="line.839"></a>
+<FONT color="green">840</FONT>              }<a name="line.840"></a>
+<FONT color="green">841</FONT>              for (int j = 1; j &lt;= k - l2; ++j) {<a name="line.841"></a>
+<FONT color="green">842</FONT>                factor = Math.pow(0.5 * sequence[j + l2], l);<a name="line.842"></a>
+<FONT color="green">843</FONT>                middleIndex = fk[l2+j].length / 2;<a name="line.843"></a>
+<FONT color="green">844</FONT>                for (int i = 0; i &lt; y0.length; ++i) {<a name="line.844"></a>
+<FONT color="green">845</FONT>                  diagonal[j-1][i] = factor * fk[l2+j][middleIndex+l][i];<a name="line.845"></a>
+<FONT color="green">846</FONT>                }<a name="line.846"></a>
+<FONT color="green">847</FONT>                extrapolate(l2, j, diagonal, yMidDots[l+1]);<a name="line.847"></a>
+<FONT color="green">848</FONT>              }<a name="line.848"></a>
+<FONT color="green">849</FONT>              for (int i = 0; i &lt; y0.length; ++i) {<a name="line.849"></a>
+<FONT color="green">850</FONT>                yMidDots[l+1][i] *= stepSize;<a name="line.850"></a>
+<FONT color="green">851</FONT>              }<a name="line.851"></a>
+<FONT color="green">852</FONT>    <a name="line.852"></a>
+<FONT color="green">853</FONT>              // compute centered differences to evaluate next derivatives<a name="line.853"></a>
+<FONT color="green">854</FONT>              for (int j = (l + 1) / 2; j &lt;= k; ++j) {<a name="line.854"></a>
+<FONT color="green">855</FONT>                for (int m = fk[j].length - 1; m &gt;= 2 * (l + 1); --m) {<a name="line.855"></a>
+<FONT color="green">856</FONT>                  for (int i = 0; i &lt; y0.length; ++i) {<a name="line.856"></a>
+<FONT color="green">857</FONT>                    fk[j][m][i] -= fk[j][m-2][i];<a name="line.857"></a>
+<FONT color="green">858</FONT>                  }<a name="line.858"></a>
+<FONT color="green">859</FONT>                }<a name="line.859"></a>
+<FONT color="green">860</FONT>              }<a name="line.860"></a>
+<FONT color="green">861</FONT>    <a name="line.861"></a>
+<FONT color="green">862</FONT>            }<a name="line.862"></a>
+<FONT color="green">863</FONT>    <a name="line.863"></a>
+<FONT color="green">864</FONT>            if (mu &gt;= 0) {<a name="line.864"></a>
+<FONT color="green">865</FONT>    <a name="line.865"></a>
+<FONT color="green">866</FONT>              // estimate the dense output coefficients<a name="line.866"></a>
+<FONT color="green">867</FONT>              final GraggBulirschStoerStepInterpolator gbsInterpolator<a name="line.867"></a>
+<FONT color="green">868</FONT>                = (GraggBulirschStoerStepInterpolator) interpolator;<a name="line.868"></a>
+<FONT color="green">869</FONT>              gbsInterpolator.computeCoefficients(mu, stepSize);<a name="line.869"></a>
+<FONT color="green">870</FONT>    <a name="line.870"></a>
+<FONT color="green">871</FONT>              if (useInterpolationError) {<a name="line.871"></a>
+<FONT color="green">872</FONT>                // use the interpolation error to limit stepsize<a name="line.872"></a>
+<FONT color="green">873</FONT>                final double interpError = gbsInterpolator.estimateError(scale);<a name="line.873"></a>
+<FONT color="green">874</FONT>                hInt = Math.abs(stepSize / Math.max(Math.pow(interpError, 1.0 / (mu+4)),<a name="line.874"></a>
+<FONT color="green">875</FONT>                                                    0.01));<a name="line.875"></a>
+<FONT color="green">876</FONT>                if (interpError &gt; 10.0) {<a name="line.876"></a>
+<FONT color="green">877</FONT>                  hNew = hInt;<a name="line.877"></a>
+<FONT color="green">878</FONT>                  reject = true;<a name="line.878"></a>
+<FONT color="green">879</FONT>                }<a name="line.879"></a>
+<FONT color="green">880</FONT>              }<a name="line.880"></a>
+<FONT color="green">881</FONT>    <a name="line.881"></a>
+<FONT color="green">882</FONT>              // Discrete events handling<a name="line.882"></a>
+<FONT color="green">883</FONT>              if (!reject) {<a name="line.883"></a>
+<FONT color="green">884</FONT>                interpolator.storeTime(stepStart + stepSize);<a name="line.884"></a>
+<FONT color="green">885</FONT>                if (eventsHandlersManager.evaluateStep(interpolator)) {<a name="line.885"></a>
+<FONT color="green">886</FONT>                    final double dt = eventsHandlersManager.getEventTime() - stepStart;<a name="line.886"></a>
+<FONT color="green">887</FONT>                    if (Math.abs(dt) &gt; Math.ulp(stepStart)) {<a name="line.887"></a>
+<FONT color="green">888</FONT>                        // reject the step to match exactly the next switch time<a name="line.888"></a>
+<FONT color="green">889</FONT>                        hNew = Math.abs(dt);<a name="line.889"></a>
+<FONT color="green">890</FONT>                        reject = true;<a name="line.890"></a>
+<FONT color="green">891</FONT>                    }<a name="line.891"></a>
+<FONT color="green">892</FONT>                }<a name="line.892"></a>
+<FONT color="green">893</FONT>              }<a name="line.893"></a>
+<FONT color="green">894</FONT>    <a name="line.894"></a>
+<FONT color="green">895</FONT>            }<a name="line.895"></a>
+<FONT color="green">896</FONT>    <a name="line.896"></a>
+<FONT color="green">897</FONT>            if (!reject) {<a name="line.897"></a>
+<FONT color="green">898</FONT>              // we will reuse the slope for the beginning of next step<a name="line.898"></a>
+<FONT color="green">899</FONT>              firstStepAlreadyComputed = true;<a name="line.899"></a>
+<FONT color="green">900</FONT>              System.arraycopy(yDot1, 0, yDot0, 0, y0.length);<a name="line.900"></a>
+<FONT color="green">901</FONT>            }<a name="line.901"></a>
+<FONT color="green">902</FONT>    <a name="line.902"></a>
+<FONT color="green">903</FONT>          }<a name="line.903"></a>
+<FONT color="green">904</FONT>    <a name="line.904"></a>
+<FONT color="green">905</FONT>          if (! reject) {<a name="line.905"></a>
+<FONT color="green">906</FONT>    <a name="line.906"></a>
+<FONT color="green">907</FONT>            // store end of step state<a name="line.907"></a>
+<FONT color="green">908</FONT>            final double nextStep = stepStart + stepSize;<a name="line.908"></a>
+<FONT color="green">909</FONT>            System.arraycopy(y1, 0, y, 0, y0.length);<a name="line.909"></a>
+<FONT color="green">910</FONT>    <a name="line.910"></a>
+<FONT color="green">911</FONT>            eventsHandlersManager.stepAccepted(nextStep, y);<a name="line.911"></a>
+<FONT color="green">912</FONT>            if (eventsHandlersManager.stop()) {<a name="line.912"></a>
+<FONT color="green">913</FONT>              lastStep = true;<a name="line.913"></a>
+<FONT color="green">914</FONT>            }<a name="line.914"></a>
+<FONT color="green">915</FONT>    <a name="line.915"></a>
+<FONT color="green">916</FONT>            // provide the step data to the step handler<a name="line.916"></a>
+<FONT color="green">917</FONT>            interpolator.storeTime(nextStep);<a name="line.917"></a>
+<FONT color="green">918</FONT>            for (StepHandler handler : stepHandlers) {<a name="line.918"></a>
+<FONT color="green">919</FONT>                handler.handleStep(interpolator, lastStep);<a name="line.919"></a>
+<FONT color="green">920</FONT>            }<a name="line.920"></a>
+<FONT color="green">921</FONT>            stepStart = nextStep;<a name="line.921"></a>
+<FONT color="green">922</FONT>    <a name="line.922"></a>
+<FONT color="green">923</FONT>            if (eventsHandlersManager.reset(stepStart, y) &amp;&amp; ! lastStep) {<a name="line.923"></a>
+<FONT color="green">924</FONT>              // some switching function has triggered changes that<a name="line.924"></a>
+<FONT color="green">925</FONT>              // invalidate the derivatives, we need to recompute them<a name="line.925"></a>
+<FONT color="green">926</FONT>              firstStepAlreadyComputed = false;<a name="line.926"></a>
+<FONT color="green">927</FONT>            }<a name="line.927"></a>
+<FONT color="green">928</FONT>    <a name="line.928"></a>
+<FONT color="green">929</FONT>            int optimalIter;<a name="line.929"></a>
+<FONT color="green">930</FONT>            if (k == 1) {<a name="line.930"></a>
+<FONT color="green">931</FONT>              optimalIter = 2;<a name="line.931"></a>
+<FONT color="green">932</FONT>              if (previousRejected) {<a name="line.932"></a>
+<FONT color="green">933</FONT>                optimalIter = 1;<a name="line.933"></a>
+<FONT color="green">934</FONT>              }<a name="line.934"></a>
+<FONT color="green">935</FONT>            } else if (k &lt;= targetIter) {<a name="line.935"></a>
+<FONT color="green">936</FONT>              optimalIter = k;<a name="line.936"></a>
+<FONT color="green">937</FONT>              if (costPerTimeUnit[k-1] &lt; orderControl1 * costPerTimeUnit[k]) {<a name="line.937"></a>
+<FONT color="green">938</FONT>                optimalIter = k-1;<a name="line.938"></a>
+<FONT color="green">939</FONT>              } else if (costPerTimeUnit[k] &lt; orderControl2 * costPerTimeUnit[k-1]) {<a name="line.939"></a>
+<FONT color="green">940</FONT>                optimalIter = Math.min(k+1, sequence.length - 2);<a name="line.940"></a>
+<FONT color="green">941</FONT>              }<a name="line.941"></a>
+<FONT color="green">942</FONT>            } else {<a name="line.942"></a>
+<FONT color="green">943</FONT>              optimalIter = k - 1;<a name="line.943"></a>
+<FONT color="green">944</FONT>              if ((k &gt; 2) &amp;&amp;<a name="line.944"></a>
+<FONT color="green">945</FONT>                  (costPerTimeUnit[k-2] &lt; orderControl1 * costPerTimeUnit[k-1])) {<a name="line.945"></a>
+<FONT color="green">946</FONT>                optimalIter = k - 2;<a name="line.946"></a>
+<FONT color="green">947</FONT>              }<a name="line.947"></a>
+<FONT color="green">948</FONT>              if (costPerTimeUnit[k] &lt; orderControl2 * costPerTimeUnit[optimalIter]) {<a name="line.948"></a>
+<FONT color="green">949</FONT>                optimalIter = Math.min(k, sequence.length - 2);<a name="line.949"></a>
+<FONT color="green">950</FONT>              }<a name="line.950"></a>
+<FONT color="green">951</FONT>            }<a name="line.951"></a>
+<FONT color="green">952</FONT>    <a name="line.952"></a>
+<FONT color="green">953</FONT>            if (previousRejected) {<a name="line.953"></a>
+<FONT color="green">954</FONT>              // after a rejected step neither order nor stepsize<a name="line.954"></a>
+<FONT color="green">955</FONT>              // should increase<a name="line.955"></a>
+<FONT color="green">956</FONT>              targetIter = Math.min(optimalIter, k);<a name="line.956"></a>
+<FONT color="green">957</FONT>              hNew = Math.min(Math.abs(stepSize), optimalStep[targetIter]);<a name="line.957"></a>
+<FONT color="green">958</FONT>            } else {<a name="line.958"></a>
+<FONT color="green">959</FONT>              // stepsize control<a name="line.959"></a>
+<FONT color="green">960</FONT>              if (optimalIter &lt;= k) {<a name="line.960"></a>
+<FONT color="green">961</FONT>                hNew = optimalStep[optimalIter];<a name="line.961"></a>
+<FONT color="green">962</FONT>              } else {<a name="line.962"></a>
+<FONT color="green">963</FONT>                if ((k &lt; targetIter) &amp;&amp;<a name="line.963"></a>
+<FONT color="green">964</FONT>                    (costPerTimeUnit[k] &lt; orderControl2 * costPerTimeUnit[k-1])) {<a name="line.964"></a>
+<FONT color="green">965</FONT>                  hNew = filterStep(optimalStep[k] * costPerStep[optimalIter+1] / costPerStep[k],<a name="line.965"></a>
+<FONT color="green">966</FONT>                                   forward, false);<a name="line.966"></a>
+<FONT color="green">967</FONT>                } else {<a name="line.967"></a>
+<FONT color="green">968</FONT>                  hNew = filterStep(optimalStep[k] * costPerStep[optimalIter] / costPerStep[k],<a name="line.968"></a>
+<FONT color="green">969</FONT>                                    forward, false);<a name="line.969"></a>
+<FONT color="green">970</FONT>                }<a name="line.970"></a>
+<FONT color="green">971</FONT>              }<a name="line.971"></a>
+<FONT color="green">972</FONT>    <a name="line.972"></a>
+<FONT color="green">973</FONT>              targetIter = optimalIter;<a name="line.973"></a>
+<FONT color="green">974</FONT>    <a name="line.974"></a>
+<FONT color="green">975</FONT>            }<a name="line.975"></a>
+<FONT color="green">976</FONT>    <a name="line.976"></a>
+<FONT color="green">977</FONT>            newStep = true;<a name="line.977"></a>
+<FONT color="green">978</FONT>    <a name="line.978"></a>
+<FONT color="green">979</FONT>          }<a name="line.979"></a>
+<FONT color="green">980</FONT>    <a name="line.980"></a>
+<FONT color="green">981</FONT>          hNew = Math.min(hNew, hInt);<a name="line.981"></a>
+<FONT color="green">982</FONT>          if (! forward) {<a name="line.982"></a>
+<FONT color="green">983</FONT>            hNew = -hNew;<a name="line.983"></a>
+<FONT color="green">984</FONT>          }<a name="line.984"></a>
+<FONT color="green">985</FONT>    <a name="line.985"></a>
+<FONT color="green">986</FONT>          firstTime = false;<a name="line.986"></a>
+<FONT color="green">987</FONT>    <a name="line.987"></a>
+<FONT color="green">988</FONT>          if (reject) {<a name="line.988"></a>
+<FONT color="green">989</FONT>            lastStep = false;<a name="line.989"></a>
+<FONT color="green">990</FONT>            previousRejected = true;<a name="line.990"></a>
+<FONT color="green">991</FONT>          } else {<a name="line.991"></a>
+<FONT color="green">992</FONT>            previousRejected = false;<a name="line.992"></a>
+<FONT color="green">993</FONT>          }<a name="line.993"></a>
+<FONT color="green">994</FONT>    <a name="line.994"></a>
+<FONT color="green">995</FONT>        }<a name="line.995"></a>
+<FONT color="green">996</FONT>    <a name="line.996"></a>
+<FONT color="green">997</FONT>        return stepStart;<a name="line.997"></a>
+<FONT color="green">998</FONT>    <a name="line.998"></a>
+<FONT color="green">999</FONT>      }<a name="line.999"></a>
+<FONT color="green">1000</FONT>    <a name="line.1000"></a>
+<FONT color="green">1001</FONT>    }<a name="line.1001"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/HighamHall54Integrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,196 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.nonstiff;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * This class implements the 5(4) Higham and Hall integrator for<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Ordinary Differential Equations.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;This integrator is an embedded Runge-Kutta integrator<a name="line.25"></a>
+<FONT color="green">026</FONT>     * of order 5(4) used in local extrapolation mode (i.e. the solution<a name="line.26"></a>
+<FONT color="green">027</FONT>     * is computed using the high order formula) with stepsize control<a name="line.27"></a>
+<FONT color="green">028</FONT>     * (and automatic step initialization) and continuous output. This<a name="line.28"></a>
+<FONT color="green">029</FONT>     * method uses 7 functions evaluations per step.&lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 810196 $ $Date: 2009-09-01 15:47:46 -0400 (Tue, 01 Sep 2009) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 1.2<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>    public class HighamHall54Integrator extends EmbeddedRungeKuttaIntegrator {<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>      /** Integrator method name. */<a name="line.37"></a>
+<FONT color="green">038</FONT>      private static final String METHOD_NAME = "Higham-Hall 5(4)";<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>      /** Time steps Butcher array. */<a name="line.40"></a>
+<FONT color="green">041</FONT>      private static final double[] STATIC_C = {<a name="line.41"></a>
+<FONT color="green">042</FONT>        2.0/9.0, 1.0/3.0, 1.0/2.0, 3.0/5.0, 1.0, 1.0<a name="line.42"></a>
+<FONT color="green">043</FONT>      };<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>      /** Internal weights Butcher array. */<a name="line.45"></a>
+<FONT color="green">046</FONT>      private static final double[][] STATIC_A = {<a name="line.46"></a>
+<FONT color="green">047</FONT>        {2.0/9.0},<a name="line.47"></a>
+<FONT color="green">048</FONT>        {1.0/12.0, 1.0/4.0},<a name="line.48"></a>
+<FONT color="green">049</FONT>        {1.0/8.0, 0.0, 3.0/8.0},<a name="line.49"></a>
+<FONT color="green">050</FONT>        {91.0/500.0, -27.0/100.0, 78.0/125.0, 8.0/125.0},<a name="line.50"></a>
+<FONT color="green">051</FONT>        {-11.0/20.0, 27.0/20.0, 12.0/5.0, -36.0/5.0, 5.0},<a name="line.51"></a>
+<FONT color="green">052</FONT>        {1.0/12.0, 0.0, 27.0/32.0, -4.0/3.0, 125.0/96.0, 5.0/48.0}<a name="line.52"></a>
+<FONT color="green">053</FONT>      };<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>      /** Propagation weights Butcher array. */<a name="line.55"></a>
+<FONT color="green">056</FONT>      private static final double[] STATIC_B = {<a name="line.56"></a>
+<FONT color="green">057</FONT>        1.0/12.0, 0.0, 27.0/32.0, -4.0/3.0, 125.0/96.0, 5.0/48.0, 0.0<a name="line.57"></a>
+<FONT color="green">058</FONT>      };<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>      /** Error weights Butcher array. */<a name="line.60"></a>
+<FONT color="green">061</FONT>      private static final double[] STATIC_E = {<a name="line.61"></a>
+<FONT color="green">062</FONT>        -1.0/20.0, 0.0, 81.0/160.0, -6.0/5.0, 25.0/32.0, 1.0/16.0, -1.0/10.0<a name="line.62"></a>
+<FONT color="green">063</FONT>      };<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>      /** Simple constructor.<a name="line.65"></a>
+<FONT color="green">066</FONT>       * Build a fifth order Higham and Hall integrator with the given step bounds<a name="line.66"></a>
+<FONT color="green">067</FONT>       * @param minStep minimal step (must be positive even for backward<a name="line.67"></a>
+<FONT color="green">068</FONT>       * integration), the last step can be smaller than this<a name="line.68"></a>
+<FONT color="green">069</FONT>       * @param maxStep maximal step (must be positive even for backward<a name="line.69"></a>
+<FONT color="green">070</FONT>       * integration)<a name="line.70"></a>
+<FONT color="green">071</FONT>       * @param scalAbsoluteTolerance allowed absolute error<a name="line.71"></a>
+<FONT color="green">072</FONT>       * @param scalRelativeTolerance allowed relative error<a name="line.72"></a>
+<FONT color="green">073</FONT>       */<a name="line.73"></a>
+<FONT color="green">074</FONT>      public HighamHall54Integrator(final double minStep, final double maxStep,<a name="line.74"></a>
+<FONT color="green">075</FONT>                                    final double scalAbsoluteTolerance,<a name="line.75"></a>
+<FONT color="green">076</FONT>                                    final double scalRelativeTolerance) {<a name="line.76"></a>
+<FONT color="green">077</FONT>        super(METHOD_NAME, false, STATIC_C, STATIC_A, STATIC_B, new HighamHall54StepInterpolator(),<a name="line.77"></a>
+<FONT color="green">078</FONT>              minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance);<a name="line.78"></a>
+<FONT color="green">079</FONT>      }<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>      /** Simple constructor.<a name="line.81"></a>
+<FONT color="green">082</FONT>       * Build a fifth order Higham and Hall integrator with the given step bounds<a name="line.82"></a>
+<FONT color="green">083</FONT>       * @param minStep minimal step (must be positive even for backward<a name="line.83"></a>
+<FONT color="green">084</FONT>       * integration), the last step can be smaller than this<a name="line.84"></a>
+<FONT color="green">085</FONT>       * @param maxStep maximal step (must be positive even for backward<a name="line.85"></a>
+<FONT color="green">086</FONT>       * integration)<a name="line.86"></a>
+<FONT color="green">087</FONT>       * @param vecAbsoluteTolerance allowed absolute error<a name="line.87"></a>
+<FONT color="green">088</FONT>       * @param vecRelativeTolerance allowed relative error<a name="line.88"></a>
+<FONT color="green">089</FONT>       */<a name="line.89"></a>
+<FONT color="green">090</FONT>      public HighamHall54Integrator(final double minStep, final double maxStep,<a name="line.90"></a>
+<FONT color="green">091</FONT>                                    final double[] vecAbsoluteTolerance,<a name="line.91"></a>
+<FONT color="green">092</FONT>                                    final double[] vecRelativeTolerance) {<a name="line.92"></a>
+<FONT color="green">093</FONT>        super(METHOD_NAME, false, STATIC_C, STATIC_A, STATIC_B, new HighamHall54StepInterpolator(),<a name="line.93"></a>
+<FONT color="green">094</FONT>              minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance);<a name="line.94"></a>
+<FONT color="green">095</FONT>      }<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>      /** {@inheritDoc} */<a name="line.97"></a>
+<FONT color="green">098</FONT>      @Override<a name="line.98"></a>
+<FONT color="green">099</FONT>      public int getOrder() {<a name="line.99"></a>
+<FONT color="green">100</FONT>        return 5;<a name="line.100"></a>
+<FONT color="green">101</FONT>      }<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>      /** {@inheritDoc} */<a name="line.103"></a>
+<FONT color="green">104</FONT>      @Override<a name="line.104"></a>
+<FONT color="green">105</FONT>      protected double estimateError(final double[][] yDotK,<a name="line.105"></a>
+<FONT color="green">106</FONT>                                     final double[] y0, final double[] y1,<a name="line.106"></a>
+<FONT color="green">107</FONT>                                     final double h) {<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        double error = 0;<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        for (int j = 0; j &lt; y0.length; ++j) {<a name="line.111"></a>
+<FONT color="green">112</FONT>          double errSum = STATIC_E[0] * yDotK[0][j];<a name="line.112"></a>
+<FONT color="green">113</FONT>          for (int l = 1; l &lt; STATIC_E.length; ++l) {<a name="line.113"></a>
+<FONT color="green">114</FONT>            errSum += STATIC_E[l] * yDotK[l][j];<a name="line.114"></a>
+<FONT color="green">115</FONT>          }<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>          final double yScale = Math.max(Math.abs(y0[j]), Math.abs(y1[j]));<a name="line.117"></a>
+<FONT color="green">118</FONT>          final double tol = (vecAbsoluteTolerance == null) ?<a name="line.118"></a>
+<FONT color="green">119</FONT>                             (scalAbsoluteTolerance + scalRelativeTolerance * yScale) :<a name="line.119"></a>
+<FONT color="green">120</FONT>                             (vecAbsoluteTolerance[j] + vecRelativeTolerance[j] * yScale);<a name="line.120"></a>
+<FONT color="green">121</FONT>          final double ratio  = h * errSum / tol;<a name="line.121"></a>
+<FONT color="green">122</FONT>          error += ratio * ratio;<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>        }<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>        return Math.sqrt(error / y0.length);<a name="line.126"></a>
+<FONT color="green">127</FONT>    <a name="line.127"></a>
+<FONT color="green">128</FONT>      }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>    }<a name="line.130"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/MidpointIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,134 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.nonstiff;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * This class implements a second order Runge-Kutta integrator for<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Ordinary Differential Equations.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;This method is an explicit Runge-Kutta method, its Butcher-array<a name="line.25"></a>
+<FONT color="green">026</FONT>     * is the following one :<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;pre&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     *    0  |  0    0<a name="line.28"></a>
+<FONT color="green">029</FONT>     *   1/2 | 1/2   0<a name="line.29"></a>
+<FONT color="green">030</FONT>     *       |----------<a name="line.30"></a>
+<FONT color="green">031</FONT>     *       |  0    1<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;/pre&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     *<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @see EulerIntegrator<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @see ClassicalRungeKuttaIntegrator<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @see GillIntegrator<a name="line.37"></a>
+<FONT color="green">038</FONT>     *<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @version $Revision: 810196 $ $Date: 2009-09-01 15:47:46 -0400 (Tue, 01 Sep 2009) $<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @since 1.2<a name="line.40"></a>
+<FONT color="green">041</FONT>     */<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>    public class MidpointIntegrator extends RungeKuttaIntegrator {<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>      /** Time steps Butcher array. */<a name="line.45"></a>
+<FONT color="green">046</FONT>      private static final double[] STATIC_C = {<a name="line.46"></a>
+<FONT color="green">047</FONT>        1.0 / 2.0<a name="line.47"></a>
+<FONT color="green">048</FONT>      };<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>      /** Internal weights Butcher array. */<a name="line.50"></a>
+<FONT color="green">051</FONT>      private static final double[][] STATIC_A = {<a name="line.51"></a>
+<FONT color="green">052</FONT>        { 1.0 / 2.0 }<a name="line.52"></a>
+<FONT color="green">053</FONT>      };<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>      /** Propagation weights Butcher array. */<a name="line.55"></a>
+<FONT color="green">056</FONT>      private static final double[] STATIC_B = {<a name="line.56"></a>
+<FONT color="green">057</FONT>        0.0, 1.0<a name="line.57"></a>
+<FONT color="green">058</FONT>      };<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>      /** Simple constructor.<a name="line.60"></a>
+<FONT color="green">061</FONT>       * Build a midpoint integrator with the given step.<a name="line.61"></a>
+<FONT color="green">062</FONT>       * @param step integration step<a name="line.62"></a>
+<FONT color="green">063</FONT>       */<a name="line.63"></a>
+<FONT color="green">064</FONT>      public MidpointIntegrator(final double step) {<a name="line.64"></a>
+<FONT color="green">065</FONT>        super("midpoint", STATIC_C, STATIC_A, STATIC_B, new MidpointStepInterpolator(), step);<a name="line.65"></a>
+<FONT color="green">066</FONT>      }<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>    }<a name="line.68"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,291 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.nonstiff;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.ode.AbstractIntegrator;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.ode.FirstOrderDifferentialEquations;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.ode.IntegratorException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.ode.events.CombinedEventsManager;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.ode.sampling.AbstractStepInterpolator;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.ode.sampling.DummyStepInterpolator;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.ode.sampling.StepHandler;<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>    /**<a name="line.30"></a>
+<FONT color="green">031</FONT>     * This class implements the common part of all fixed step Runge-Kutta<a name="line.31"></a>
+<FONT color="green">032</FONT>     * integrators for Ordinary Differential Equations.<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;p&gt;These methods are explicit Runge-Kutta methods, their Butcher<a name="line.34"></a>
+<FONT color="green">035</FONT>     * arrays are as follows :<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;pre&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *    0  |<a name="line.37"></a>
+<FONT color="green">038</FONT>     *   c2  | a21<a name="line.38"></a>
+<FONT color="green">039</FONT>     *   c3  | a31  a32<a name="line.39"></a>
+<FONT color="green">040</FONT>     *   ... |        ...<a name="line.40"></a>
+<FONT color="green">041</FONT>     *   cs  | as1  as2  ...  ass-1<a name="line.41"></a>
+<FONT color="green">042</FONT>     *       |--------------------------<a name="line.42"></a>
+<FONT color="green">043</FONT>     *       |  b1   b2  ...   bs-1  bs<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;/pre&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     * &lt;/p&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     *<a name="line.46"></a>
+<FONT color="green">047</FONT>     * @see EulerIntegrator<a name="line.47"></a>
+<FONT color="green">048</FONT>     * @see ClassicalRungeKuttaIntegrator<a name="line.48"></a>
+<FONT color="green">049</FONT>     * @see GillIntegrator<a name="line.49"></a>
+<FONT color="green">050</FONT>     * @see MidpointIntegrator<a name="line.50"></a>
+<FONT color="green">051</FONT>     * @version $Revision: 927202 $ $Date: 2010-03-24 18:11:51 -0400 (Wed, 24 Mar 2010) $<a name="line.51"></a>
+<FONT color="green">052</FONT>     * @since 1.2<a name="line.52"></a>
+<FONT color="green">053</FONT>     */<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>    public abstract class RungeKuttaIntegrator extends AbstractIntegrator {<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /** Time steps from Butcher array (without the first zero). */<a name="line.57"></a>
+<FONT color="green">058</FONT>        private final double[] c;<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Internal weights from Butcher array (without the first empty row). */<a name="line.60"></a>
+<FONT color="green">061</FONT>        private final double[][] a;<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /** External weights for the high order method from Butcher array. */<a name="line.63"></a>
+<FONT color="green">064</FONT>        private final double[] b;<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /** Prototype of the step interpolator. */<a name="line.66"></a>
+<FONT color="green">067</FONT>        private final RungeKuttaStepInterpolator prototype;<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /** Integration step. */<a name="line.69"></a>
+<FONT color="green">070</FONT>        private final double step;<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>      /** Simple constructor.<a name="line.72"></a>
+<FONT color="green">073</FONT>       * Build a Runge-Kutta integrator with the given<a name="line.73"></a>
+<FONT color="green">074</FONT>       * step. The default step handler does nothing.<a name="line.74"></a>
+<FONT color="green">075</FONT>       * @param name name of the method<a name="line.75"></a>
+<FONT color="green">076</FONT>       * @param c time steps from Butcher array (without the first zero)<a name="line.76"></a>
+<FONT color="green">077</FONT>       * @param a internal weights from Butcher array (without the first empty row)<a name="line.77"></a>
+<FONT color="green">078</FONT>       * @param b propagation weights for the high order method from Butcher array<a name="line.78"></a>
+<FONT color="green">079</FONT>       * @param prototype prototype of the step interpolator to use<a name="line.79"></a>
+<FONT color="green">080</FONT>       * @param step integration step<a name="line.80"></a>
+<FONT color="green">081</FONT>       */<a name="line.81"></a>
+<FONT color="green">082</FONT>      protected RungeKuttaIntegrator(final String name,<a name="line.82"></a>
+<FONT color="green">083</FONT>                                     final double[] c, final double[][] a, final double[] b,<a name="line.83"></a>
+<FONT color="green">084</FONT>                                     final RungeKuttaStepInterpolator prototype,<a name="line.84"></a>
+<FONT color="green">085</FONT>                                     final double step) {<a name="line.85"></a>
+<FONT color="green">086</FONT>        super(name);<a name="line.86"></a>
+<FONT color="green">087</FONT>        this.c          = c;<a name="line.87"></a>
+<FONT color="green">088</FONT>        this.a          = a;<a name="line.88"></a>
+<FONT color="green">089</FONT>        this.b          = b;<a name="line.89"></a>
+<FONT color="green">090</FONT>        this.prototype  = prototype;<a name="line.90"></a>
+<FONT color="green">091</FONT>        this.step       = Math.abs(step);<a name="line.91"></a>
+<FONT color="green">092</FONT>      }<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>      /** {@inheritDoc} */<a name="line.94"></a>
+<FONT color="green">095</FONT>      public double integrate(final FirstOrderDifferentialEquations equations,<a name="line.95"></a>
+<FONT color="green">096</FONT>                              final double t0, final double[] y0,<a name="line.96"></a>
+<FONT color="green">097</FONT>                              final double t, final double[] y)<a name="line.97"></a>
+<FONT color="green">098</FONT>      throws DerivativeException, IntegratorException {<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>        sanityChecks(equations, t0, y0, t, y);<a name="line.100"></a>
+<FONT color="green">101</FONT>        setEquations(equations);<a name="line.101"></a>
+<FONT color="green">102</FONT>        resetEvaluations();<a name="line.102"></a>
+<FONT color="green">103</FONT>        final boolean forward = t &gt; t0;<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        // create some internal working arrays<a name="line.105"></a>
+<FONT color="green">106</FONT>        final int stages = c.length + 1;<a name="line.106"></a>
+<FONT color="green">107</FONT>        if (y != y0) {<a name="line.107"></a>
+<FONT color="green">108</FONT>          System.arraycopy(y0, 0, y, 0, y0.length);<a name="line.108"></a>
+<FONT color="green">109</FONT>        }<a name="line.109"></a>
+<FONT color="green">110</FONT>        final double[][] yDotK = new double[stages][];<a name="line.110"></a>
+<FONT color="green">111</FONT>        for (int i = 0; i &lt; stages; ++i) {<a name="line.111"></a>
+<FONT color="green">112</FONT>          yDotK [i] = new double[y0.length];<a name="line.112"></a>
+<FONT color="green">113</FONT>        }<a name="line.113"></a>
+<FONT color="green">114</FONT>        final double[] yTmp = new double[y0.length];<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>        // set up an interpolator sharing the integrator arrays<a name="line.116"></a>
+<FONT color="green">117</FONT>        AbstractStepInterpolator interpolator;<a name="line.117"></a>
+<FONT color="green">118</FONT>        if (requiresDenseOutput() || (! eventsHandlersManager.isEmpty())) {<a name="line.118"></a>
+<FONT color="green">119</FONT>          final RungeKuttaStepInterpolator rki = (RungeKuttaStepInterpolator) prototype.copy();<a name="line.119"></a>
+<FONT color="green">120</FONT>          rki.reinitialize(this, yTmp, yDotK, forward);<a name="line.120"></a>
+<FONT color="green">121</FONT>          interpolator = rki;<a name="line.121"></a>
+<FONT color="green">122</FONT>        } else {<a name="line.122"></a>
+<FONT color="green">123</FONT>          interpolator = new DummyStepInterpolator(yTmp, yDotK[stages - 1], forward);<a name="line.123"></a>
+<FONT color="green">124</FONT>        }<a name="line.124"></a>
+<FONT color="green">125</FONT>        interpolator.storeTime(t0);<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>        // set up integration control objects<a name="line.127"></a>
+<FONT color="green">128</FONT>        stepStart = t0;<a name="line.128"></a>
+<FONT color="green">129</FONT>        stepSize  = forward ? step : -step;<a name="line.129"></a>
+<FONT color="green">130</FONT>        for (StepHandler handler : stepHandlers) {<a name="line.130"></a>
+<FONT color="green">131</FONT>            handler.reset();<a name="line.131"></a>
+<FONT color="green">132</FONT>        }<a name="line.132"></a>
+<FONT color="green">133</FONT>        CombinedEventsManager manager = addEndTimeChecker(t0, t, eventsHandlersManager);<a name="line.133"></a>
+<FONT color="green">134</FONT>        boolean lastStep = false;<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>        // main integration loop<a name="line.136"></a>
+<FONT color="green">137</FONT>        while (!lastStep) {<a name="line.137"></a>
+<FONT color="green">138</FONT>    <a name="line.138"></a>
+<FONT color="green">139</FONT>          interpolator.shift();<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>          for (boolean loop = true; loop;) {<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>            // first stage<a name="line.143"></a>
+<FONT color="green">144</FONT>            computeDerivatives(stepStart, y, yDotK[0]);<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>            // next stages<a name="line.146"></a>
+<FONT color="green">147</FONT>            for (int k = 1; k &lt; stages; ++k) {<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>              for (int j = 0; j &lt; y0.length; ++j) {<a name="line.149"></a>
+<FONT color="green">150</FONT>                double sum = a[k-1][0] * yDotK[0][j];<a name="line.150"></a>
+<FONT color="green">151</FONT>                for (int l = 1; l &lt; k; ++l) {<a name="line.151"></a>
+<FONT color="green">152</FONT>                  sum += a[k-1][l] * yDotK[l][j];<a name="line.152"></a>
+<FONT color="green">153</FONT>                }<a name="line.153"></a>
+<FONT color="green">154</FONT>                yTmp[j] = y[j] + stepSize * sum;<a name="line.154"></a>
+<FONT color="green">155</FONT>              }<a name="line.155"></a>
+<FONT color="green">156</FONT>    <a name="line.156"></a>
+<FONT color="green">157</FONT>              computeDerivatives(stepStart + c[k-1] * stepSize, yTmp, yDotK[k]);<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>            }<a name="line.159"></a>
+<FONT color="green">160</FONT>    <a name="line.160"></a>
+<FONT color="green">161</FONT>            // estimate the state at the end of the step<a name="line.161"></a>
+<FONT color="green">162</FONT>            for (int j = 0; j &lt; y0.length; ++j) {<a name="line.162"></a>
+<FONT color="green">163</FONT>              double sum    = b[0] * yDotK[0][j];<a name="line.163"></a>
+<FONT color="green">164</FONT>              for (int l = 1; l &lt; stages; ++l) {<a name="line.164"></a>
+<FONT color="green">165</FONT>                sum    += b[l] * yDotK[l][j];<a name="line.165"></a>
+<FONT color="green">166</FONT>              }<a name="line.166"></a>
+<FONT color="green">167</FONT>              yTmp[j] = y[j] + stepSize * sum;<a name="line.167"></a>
+<FONT color="green">168</FONT>            }<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>            // discrete events handling<a name="line.170"></a>
+<FONT color="green">171</FONT>            interpolator.storeTime(stepStart + stepSize);<a name="line.171"></a>
+<FONT color="green">172</FONT>            if (manager.evaluateStep(interpolator)) {<a name="line.172"></a>
+<FONT color="green">173</FONT>                final double dt = manager.getEventTime() - stepStart;<a name="line.173"></a>
+<FONT color="green">174</FONT>                if (Math.abs(dt) &lt;= Math.ulp(stepStart)) {<a name="line.174"></a>
+<FONT color="green">175</FONT>                    // we cannot simply truncate the step, reject the current computation<a name="line.175"></a>
+<FONT color="green">176</FONT>                    // and let the loop compute another state with the truncated step.<a name="line.176"></a>
+<FONT color="green">177</FONT>                    // it is so small (much probably exactly 0 due to limited accuracy)<a name="line.177"></a>
+<FONT color="green">178</FONT>                    // that the code above would fail handling it.<a name="line.178"></a>
+<FONT color="green">179</FONT>                    // So we set up an artificial 0 size step by copying states<a name="line.179"></a>
+<FONT color="green">180</FONT>                    interpolator.storeTime(stepStart);<a name="line.180"></a>
+<FONT color="green">181</FONT>                    System.arraycopy(y, 0, yTmp, 0, y0.length);<a name="line.181"></a>
+<FONT color="green">182</FONT>                    stepSize = 0;<a name="line.182"></a>
+<FONT color="green">183</FONT>                    loop     = false;<a name="line.183"></a>
+<FONT color="green">184</FONT>                } else {<a name="line.184"></a>
+<FONT color="green">185</FONT>                    // reject the step to match exactly the next switch time<a name="line.185"></a>
+<FONT color="green">186</FONT>                    stepSize = dt;<a name="line.186"></a>
+<FONT color="green">187</FONT>                }<a name="line.187"></a>
+<FONT color="green">188</FONT>            } else {<a name="line.188"></a>
+<FONT color="green">189</FONT>              loop = false;<a name="line.189"></a>
+<FONT color="green">190</FONT>            }<a name="line.190"></a>
+<FONT color="green">191</FONT>    <a name="line.191"></a>
+<FONT color="green">192</FONT>          }<a name="line.192"></a>
+<FONT color="green">193</FONT>    <a name="line.193"></a>
+<FONT color="green">194</FONT>          // the step has been accepted<a name="line.194"></a>
+<FONT color="green">195</FONT>          final double nextStep = stepStart + stepSize;<a name="line.195"></a>
+<FONT color="green">196</FONT>          System.arraycopy(yTmp, 0, y, 0, y0.length);<a name="line.196"></a>
+<FONT color="green">197</FONT>          manager.stepAccepted(nextStep, y);<a name="line.197"></a>
+<FONT color="green">198</FONT>          lastStep = manager.stop();<a name="line.198"></a>
+<FONT color="green">199</FONT>    <a name="line.199"></a>
+<FONT color="green">200</FONT>          // provide the step data to the step handler<a name="line.200"></a>
+<FONT color="green">201</FONT>          interpolator.storeTime(nextStep);<a name="line.201"></a>
+<FONT color="green">202</FONT>          for (StepHandler handler : stepHandlers) {<a name="line.202"></a>
+<FONT color="green">203</FONT>              handler.handleStep(interpolator, lastStep);<a name="line.203"></a>
+<FONT color="green">204</FONT>          }<a name="line.204"></a>
+<FONT color="green">205</FONT>          stepStart = nextStep;<a name="line.205"></a>
+<FONT color="green">206</FONT>    <a name="line.206"></a>
+<FONT color="green">207</FONT>          if (manager.reset(stepStart, y) &amp;&amp; ! lastStep) {<a name="line.207"></a>
+<FONT color="green">208</FONT>            // some events handler has triggered changes that<a name="line.208"></a>
+<FONT color="green">209</FONT>            // invalidate the derivatives, we need to recompute them<a name="line.209"></a>
+<FONT color="green">210</FONT>            computeDerivatives(stepStart, y, yDotK[0]);<a name="line.210"></a>
+<FONT color="green">211</FONT>          }<a name="line.211"></a>
+<FONT color="green">212</FONT>    <a name="line.212"></a>
+<FONT color="green">213</FONT>          // make sure step size is set to default before next step<a name="line.213"></a>
+<FONT color="green">214</FONT>          stepSize = forward ? step : -step;<a name="line.214"></a>
+<FONT color="green">215</FONT>    <a name="line.215"></a>
+<FONT color="green">216</FONT>        }<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>        final double stopTime = stepStart;<a name="line.218"></a>
+<FONT color="green">219</FONT>        stepStart = Double.NaN;<a name="line.219"></a>
+<FONT color="green">220</FONT>        stepSize  = Double.NaN;<a name="line.220"></a>
+<FONT color="green">221</FONT>        return stopTime;<a name="line.221"></a>
+<FONT color="green">222</FONT>    <a name="line.222"></a>
+<FONT color="green">223</FONT>      }<a name="line.223"></a>
+<FONT color="green">224</FONT>    <a name="line.224"></a>
+<FONT color="green">225</FONT>    }<a name="line.225"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegrator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,138 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.nonstiff;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * This class implements the 3/8 fourth order Runge-Kutta<a name="line.22"></a>
+<FONT color="green">023</FONT>     * integrator for Ordinary Differential Equations.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;This method is an explicit Runge-Kutta method, its Butcher-array<a name="line.25"></a>
+<FONT color="green">026</FONT>     * is the following one :<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;pre&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     *    0  |  0    0    0    0<a name="line.28"></a>
+<FONT color="green">029</FONT>     *   1/3 | 1/3   0    0    0<a name="line.29"></a>
+<FONT color="green">030</FONT>     *   2/3 |-1/3   1    0    0<a name="line.30"></a>
+<FONT color="green">031</FONT>     *    1  |  1   -1    1    0<a name="line.31"></a>
+<FONT color="green">032</FONT>     *       |--------------------<a name="line.32"></a>
+<FONT color="green">033</FONT>     *       | 1/8  3/8  3/8  1/8<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;/pre&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     *<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @see EulerIntegrator<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @see ClassicalRungeKuttaIntegrator<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @see GillIntegrator<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @see MidpointIntegrator<a name="line.40"></a>
+<FONT color="green">041</FONT>     * @version $Revision: 810196 $ $Date: 2009-09-01 15:47:46 -0400 (Tue, 01 Sep 2009) $<a name="line.41"></a>
+<FONT color="green">042</FONT>     * @since 1.2<a name="line.42"></a>
+<FONT color="green">043</FONT>     */<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>    public class ThreeEighthesIntegrator extends RungeKuttaIntegrator {<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>      /** Time steps Butcher array. */<a name="line.47"></a>
+<FONT color="green">048</FONT>      private static final double[] STATIC_C = {<a name="line.48"></a>
+<FONT color="green">049</FONT>        1.0 / 3.0, 2.0 / 3.0, 1.0<a name="line.49"></a>
+<FONT color="green">050</FONT>      };<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>      /** Internal weights Butcher array. */<a name="line.52"></a>
+<FONT color="green">053</FONT>      private static final double[][] STATIC_A = {<a name="line.53"></a>
+<FONT color="green">054</FONT>        {  1.0 / 3.0 },<a name="line.54"></a>
+<FONT color="green">055</FONT>        { -1.0 / 3.0, 1.0 },<a name="line.55"></a>
+<FONT color="green">056</FONT>        {  1.0, -1.0, 1.0 }<a name="line.56"></a>
+<FONT color="green">057</FONT>      };<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>      /** Propagation weights Butcher array. */<a name="line.59"></a>
+<FONT color="green">060</FONT>      private static final double[] STATIC_B = {<a name="line.60"></a>
+<FONT color="green">061</FONT>        1.0 / 8.0, 3.0 / 8.0, 3.0 / 8.0, 1.0 / 8.0<a name="line.61"></a>
+<FONT color="green">062</FONT>      };<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>      /** Simple constructor.<a name="line.64"></a>
+<FONT color="green">065</FONT>       * Build a 3/8 integrator with the given step.<a name="line.65"></a>
+<FONT color="green">066</FONT>       * @param step integration step<a name="line.66"></a>
+<FONT color="green">067</FONT>       */<a name="line.67"></a>
+<FONT color="green">068</FONT>      public ThreeEighthesIntegrator(final double step) {<a name="line.68"></a>
+<FONT color="green">069</FONT>        super("3/8", STATIC_C, STATIC_A, STATIC_B, new ThreeEighthesStepInterpolator(), step);<a name="line.69"></a>
+<FONT color="green">070</FONT>      }<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>    }<a name="line.72"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/sampling/AbstractStepInterpolator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,509 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.sampling;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.IOException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.io.ObjectInput;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.io.ObjectOutput;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    /** This abstract class represents an interpolator over the last step<a name="line.27"></a>
+<FONT color="green">028</FONT>     * during an ODE integration.<a name="line.28"></a>
+<FONT color="green">029</FONT>     *<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;p&gt;The various ODE integrators provide objects extending this class<a name="line.30"></a>
+<FONT color="green">031</FONT>     * to the step handlers. The handlers can use these objects to<a name="line.31"></a>
+<FONT color="green">032</FONT>     * retrieve the state vector at intermediate times between the<a name="line.32"></a>
+<FONT color="green">033</FONT>     * previous and the current grid points (dense output).&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     *<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @see org.apache.commons.math.ode.FirstOrderIntegrator<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @see org.apache.commons.math.ode.SecondOrderIntegrator<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @see StepHandler<a name="line.37"></a>
+<FONT color="green">038</FONT>     *<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @since 1.2<a name="line.40"></a>
+<FONT color="green">041</FONT>     *<a name="line.41"></a>
+<FONT color="green">042</FONT>     */<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>    public abstract class AbstractStepInterpolator<a name="line.44"></a>
+<FONT color="green">045</FONT>      implements StepInterpolator {<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>      /** previous time */<a name="line.47"></a>
+<FONT color="green">048</FONT>      protected double previousTime;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>      /** current time */<a name="line.50"></a>
+<FONT color="green">051</FONT>      protected double currentTime;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>      /** current time step */<a name="line.53"></a>
+<FONT color="green">054</FONT>      protected double h;<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>      /** current state */<a name="line.56"></a>
+<FONT color="green">057</FONT>      protected double[] currentState;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>      /** interpolated time */<a name="line.59"></a>
+<FONT color="green">060</FONT>      protected double interpolatedTime;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>      /** interpolated state */<a name="line.62"></a>
+<FONT color="green">063</FONT>      protected double[] interpolatedState;<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>      /** interpolated derivatives */<a name="line.65"></a>
+<FONT color="green">066</FONT>      protected double[] interpolatedDerivatives;<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>      /** indicate if the step has been finalized or not. */<a name="line.68"></a>
+<FONT color="green">069</FONT>      private boolean finalized;<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>      /** integration direction. */<a name="line.71"></a>
+<FONT color="green">072</FONT>      private boolean forward;<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>      /** indicator for dirty state. */<a name="line.74"></a>
+<FONT color="green">075</FONT>      private boolean dirtyState;<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>      /** Simple constructor.<a name="line.78"></a>
+<FONT color="green">079</FONT>       * This constructor builds an instance that is not usable yet, the<a name="line.79"></a>
+<FONT color="green">080</FONT>       * {@link #reinitialize} method should be called before using the<a name="line.80"></a>
+<FONT color="green">081</FONT>       * instance in order to initialize the internal arrays. This<a name="line.81"></a>
+<FONT color="green">082</FONT>       * constructor is used only in order to delay the initialization in<a name="line.82"></a>
+<FONT color="green">083</FONT>       * some cases. As an example, the {@link<a name="line.83"></a>
+<FONT color="green">084</FONT>       * org.apache.commons.math.ode.nonstiff.EmbeddedRungeKuttaIntegrator}<a name="line.84"></a>
+<FONT color="green">085</FONT>       * class uses the prototyping design pattern to create the step<a name="line.85"></a>
+<FONT color="green">086</FONT>       * interpolators by cloning an uninitialized model and latter<a name="line.86"></a>
+<FONT color="green">087</FONT>       * initializing the copy.<a name="line.87"></a>
+<FONT color="green">088</FONT>       */<a name="line.88"></a>
+<FONT color="green">089</FONT>      protected AbstractStepInterpolator() {<a name="line.89"></a>
+<FONT color="green">090</FONT>        previousTime            = Double.NaN;<a name="line.90"></a>
+<FONT color="green">091</FONT>        currentTime             = Double.NaN;<a name="line.91"></a>
+<FONT color="green">092</FONT>        h                       = Double.NaN;<a name="line.92"></a>
+<FONT color="green">093</FONT>        interpolatedTime        = Double.NaN;<a name="line.93"></a>
+<FONT color="green">094</FONT>        currentState            = null;<a name="line.94"></a>
+<FONT color="green">095</FONT>        interpolatedState       = null;<a name="line.95"></a>
+<FONT color="green">096</FONT>        interpolatedDerivatives = null;<a name="line.96"></a>
+<FONT color="green">097</FONT>        finalized               = false;<a name="line.97"></a>
+<FONT color="green">098</FONT>        this.forward            = true;<a name="line.98"></a>
+<FONT color="green">099</FONT>        this.dirtyState         = true;<a name="line.99"></a>
+<FONT color="green">100</FONT>      }<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>      /** Simple constructor.<a name="line.102"></a>
+<FONT color="green">103</FONT>       * @param y reference to the integrator array holding the state at<a name="line.103"></a>
+<FONT color="green">104</FONT>       * the end of the step<a name="line.104"></a>
+<FONT color="green">105</FONT>       * @param forward integration direction indicator<a name="line.105"></a>
+<FONT color="green">106</FONT>       */<a name="line.106"></a>
+<FONT color="green">107</FONT>      protected AbstractStepInterpolator(final double[] y, final boolean forward) {<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        previousTime      = Double.NaN;<a name="line.109"></a>
+<FONT color="green">110</FONT>        currentTime       = Double.NaN;<a name="line.110"></a>
+<FONT color="green">111</FONT>        h                 = Double.NaN;<a name="line.111"></a>
+<FONT color="green">112</FONT>        interpolatedTime  = Double.NaN;<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        currentState            = y;<a name="line.114"></a>
+<FONT color="green">115</FONT>        interpolatedState       = new double[y.length];<a name="line.115"></a>
+<FONT color="green">116</FONT>        interpolatedDerivatives = new double[y.length];<a name="line.116"></a>
+<FONT color="green">117</FONT>    <a name="line.117"></a>
+<FONT color="green">118</FONT>        finalized         = false;<a name="line.118"></a>
+<FONT color="green">119</FONT>        this.forward      = forward;<a name="line.119"></a>
+<FONT color="green">120</FONT>        this.dirtyState   = true;<a name="line.120"></a>
+<FONT color="green">121</FONT>    <a name="line.121"></a>
+<FONT color="green">122</FONT>      }<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>      /** Copy constructor.<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>       * &lt;p&gt;The copied interpolator should have been finalized before the<a name="line.126"></a>
+<FONT color="green">127</FONT>       * copy, otherwise the copy will not be able to perform correctly<a name="line.127"></a>
+<FONT color="green">128</FONT>       * any derivative computation and will throw a {@link<a name="line.128"></a>
+<FONT color="green">129</FONT>       * NullPointerException} later. Since we don't want this constructor<a name="line.129"></a>
+<FONT color="green">130</FONT>       * to throw the exceptions finalization may involve and since we<a name="line.130"></a>
+<FONT color="green">131</FONT>       * don't want this method to modify the state of the copied<a name="line.131"></a>
+<FONT color="green">132</FONT>       * interpolator, finalization is &lt;strong&gt;not&lt;/strong&gt; done<a name="line.132"></a>
+<FONT color="green">133</FONT>       * automatically, it remains under user control.&lt;/p&gt;<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>       * &lt;p&gt;The copy is a deep copy: its arrays are separated from the<a name="line.135"></a>
+<FONT color="green">136</FONT>       * original arrays of the instance.&lt;/p&gt;<a name="line.136"></a>
+<FONT color="green">137</FONT>    <a name="line.137"></a>
+<FONT color="green">138</FONT>       * @param interpolator interpolator to copy from.<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>       */<a name="line.140"></a>
+<FONT color="green">141</FONT>      protected AbstractStepInterpolator(final AbstractStepInterpolator interpolator) {<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>        previousTime      = interpolator.previousTime;<a name="line.143"></a>
+<FONT color="green">144</FONT>        currentTime       = interpolator.currentTime;<a name="line.144"></a>
+<FONT color="green">145</FONT>        h                 = interpolator.h;<a name="line.145"></a>
+<FONT color="green">146</FONT>        interpolatedTime  = interpolator.interpolatedTime;<a name="line.146"></a>
+<FONT color="green">147</FONT>    <a name="line.147"></a>
+<FONT color="green">148</FONT>        if (interpolator.currentState != null) {<a name="line.148"></a>
+<FONT color="green">149</FONT>          currentState            = interpolator.currentState.clone();<a name="line.149"></a>
+<FONT color="green">150</FONT>          interpolatedState       = interpolator.interpolatedState.clone();<a name="line.150"></a>
+<FONT color="green">151</FONT>          interpolatedDerivatives = interpolator.interpolatedDerivatives.clone();<a name="line.151"></a>
+<FONT color="green">152</FONT>        } else {<a name="line.152"></a>
+<FONT color="green">153</FONT>          currentState            = null;<a name="line.153"></a>
+<FONT color="green">154</FONT>          interpolatedState       = null;<a name="line.154"></a>
+<FONT color="green">155</FONT>          interpolatedDerivatives = null;<a name="line.155"></a>
+<FONT color="green">156</FONT>        }<a name="line.156"></a>
+<FONT color="green">157</FONT>    <a name="line.157"></a>
+<FONT color="green">158</FONT>        finalized  = interpolator.finalized;<a name="line.158"></a>
+<FONT color="green">159</FONT>        forward    = interpolator.forward;<a name="line.159"></a>
+<FONT color="green">160</FONT>        dirtyState = interpolator.dirtyState;<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>      }<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>      /** Reinitialize the instance<a name="line.164"></a>
+<FONT color="green">165</FONT>       * @param y reference to the integrator array holding the state at<a name="line.165"></a>
+<FONT color="green">166</FONT>       * the end of the step<a name="line.166"></a>
+<FONT color="green">167</FONT>       * @param isForward integration direction indicator<a name="line.167"></a>
+<FONT color="green">168</FONT>       */<a name="line.168"></a>
+<FONT color="green">169</FONT>      protected void reinitialize(final double[] y, final boolean isForward) {<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>        previousTime      = Double.NaN;<a name="line.171"></a>
+<FONT color="green">172</FONT>        currentTime       = Double.NaN;<a name="line.172"></a>
+<FONT color="green">173</FONT>        h                 = Double.NaN;<a name="line.173"></a>
+<FONT color="green">174</FONT>        interpolatedTime  = Double.NaN;<a name="line.174"></a>
+<FONT color="green">175</FONT>    <a name="line.175"></a>
+<FONT color="green">176</FONT>        currentState            = y;<a name="line.176"></a>
+<FONT color="green">177</FONT>        interpolatedState       = new double[y.length];<a name="line.177"></a>
+<FONT color="green">178</FONT>        interpolatedDerivatives = new double[y.length];<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>        finalized         = false;<a name="line.180"></a>
+<FONT color="green">181</FONT>        this.forward      = isForward;<a name="line.181"></a>
+<FONT color="green">182</FONT>        this.dirtyState   = true;<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>      }<a name="line.184"></a>
+<FONT color="green">185</FONT>    <a name="line.185"></a>
+<FONT color="green">186</FONT>      /** {@inheritDoc} */<a name="line.186"></a>
+<FONT color="green">187</FONT>       public StepInterpolator copy() throws DerivativeException {<a name="line.187"></a>
+<FONT color="green">188</FONT>    <a name="line.188"></a>
+<FONT color="green">189</FONT>         // finalize the step before performing copy<a name="line.189"></a>
+<FONT color="green">190</FONT>         finalizeStep();<a name="line.190"></a>
+<FONT color="green">191</FONT>    <a name="line.191"></a>
+<FONT color="green">192</FONT>         // create the new independent instance<a name="line.192"></a>
+<FONT color="green">193</FONT>         return doCopy();<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>       }<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>       /** Really copy the finalized instance.<a name="line.197"></a>
+<FONT color="green">198</FONT>        * &lt;p&gt;This method is called by {@link #copy()} after the<a name="line.198"></a>
+<FONT color="green">199</FONT>        * step has been finalized. It must perform a deep copy<a name="line.199"></a>
+<FONT color="green">200</FONT>        * to have an new instance completely independent for the<a name="line.200"></a>
+<FONT color="green">201</FONT>        * original instance.<a name="line.201"></a>
+<FONT color="green">202</FONT>        * @return a copy of the finalized instance<a name="line.202"></a>
+<FONT color="green">203</FONT>        */<a name="line.203"></a>
+<FONT color="green">204</FONT>       protected abstract StepInterpolator doCopy();<a name="line.204"></a>
+<FONT color="green">205</FONT>    <a name="line.205"></a>
+<FONT color="green">206</FONT>      /** Shift one step forward.<a name="line.206"></a>
+<FONT color="green">207</FONT>       * Copy the current time into the previous time, hence preparing the<a name="line.207"></a>
+<FONT color="green">208</FONT>       * interpolator for future calls to {@link #storeTime storeTime}<a name="line.208"></a>
+<FONT color="green">209</FONT>       */<a name="line.209"></a>
+<FONT color="green">210</FONT>      public void shift() {<a name="line.210"></a>
+<FONT color="green">211</FONT>        previousTime = currentTime;<a name="line.211"></a>
+<FONT color="green">212</FONT>      }<a name="line.212"></a>
+<FONT color="green">213</FONT>    <a name="line.213"></a>
+<FONT color="green">214</FONT>      /** Store the current step time.<a name="line.214"></a>
+<FONT color="green">215</FONT>       * @param t current time<a name="line.215"></a>
+<FONT color="green">216</FONT>       */<a name="line.216"></a>
+<FONT color="green">217</FONT>      public void storeTime(final double t) {<a name="line.217"></a>
+<FONT color="green">218</FONT>    <a name="line.218"></a>
+<FONT color="green">219</FONT>        currentTime = t;<a name="line.219"></a>
+<FONT color="green">220</FONT>        h           = currentTime - previousTime;<a name="line.220"></a>
+<FONT color="green">221</FONT>        setInterpolatedTime(t);<a name="line.221"></a>
+<FONT color="green">222</FONT>    <a name="line.222"></a>
+<FONT color="green">223</FONT>        // the step is not finalized anymore<a name="line.223"></a>
+<FONT color="green">224</FONT>        finalized  = false;<a name="line.224"></a>
+<FONT color="green">225</FONT>    <a name="line.225"></a>
+<FONT color="green">226</FONT>      }<a name="line.226"></a>
+<FONT color="green">227</FONT>    <a name="line.227"></a>
+<FONT color="green">228</FONT>      /** {@inheritDoc} */<a name="line.228"></a>
+<FONT color="green">229</FONT>      public double getPreviousTime() {<a name="line.229"></a>
+<FONT color="green">230</FONT>        return previousTime;<a name="line.230"></a>
+<FONT color="green">231</FONT>      }<a name="line.231"></a>
+<FONT color="green">232</FONT>    <a name="line.232"></a>
+<FONT color="green">233</FONT>      /** {@inheritDoc} */<a name="line.233"></a>
+<FONT color="green">234</FONT>      public double getCurrentTime() {<a name="line.234"></a>
+<FONT color="green">235</FONT>        return currentTime;<a name="line.235"></a>
+<FONT color="green">236</FONT>      }<a name="line.236"></a>
+<FONT color="green">237</FONT>    <a name="line.237"></a>
+<FONT color="green">238</FONT>      /** {@inheritDoc} */<a name="line.238"></a>
+<FONT color="green">239</FONT>      public double getInterpolatedTime() {<a name="line.239"></a>
+<FONT color="green">240</FONT>        return interpolatedTime;<a name="line.240"></a>
+<FONT color="green">241</FONT>      }<a name="line.241"></a>
+<FONT color="green">242</FONT>    <a name="line.242"></a>
+<FONT color="green">243</FONT>      /** {@inheritDoc} */<a name="line.243"></a>
+<FONT color="green">244</FONT>      public void setInterpolatedTime(final double time) {<a name="line.244"></a>
+<FONT color="green">245</FONT>          interpolatedTime = time;<a name="line.245"></a>
+<FONT color="green">246</FONT>          dirtyState       = true;<a name="line.246"></a>
+<FONT color="green">247</FONT>      }<a name="line.247"></a>
+<FONT color="green">248</FONT>    <a name="line.248"></a>
+<FONT color="green">249</FONT>      /** {@inheritDoc} */<a name="line.249"></a>
+<FONT color="green">250</FONT>      public boolean isForward() {<a name="line.250"></a>
+<FONT color="green">251</FONT>        return forward;<a name="line.251"></a>
+<FONT color="green">252</FONT>      }<a name="line.252"></a>
+<FONT color="green">253</FONT>    <a name="line.253"></a>
+<FONT color="green">254</FONT>      /** Compute the state and derivatives at the interpolated time.<a name="line.254"></a>
+<FONT color="green">255</FONT>       * This is the main processing method that should be implemented by<a name="line.255"></a>
+<FONT color="green">256</FONT>       * the derived classes to perform the interpolation.<a name="line.256"></a>
+<FONT color="green">257</FONT>       * @param theta normalized interpolation abscissa within the step<a name="line.257"></a>
+<FONT color="green">258</FONT>       * (theta is zero at the previous time step and one at the current time step)<a name="line.258"></a>
+<FONT color="green">259</FONT>       * @param oneMinusThetaH time gap between the interpolated time and<a name="line.259"></a>
+<FONT color="green">260</FONT>       * the current time<a name="line.260"></a>
+<FONT color="green">261</FONT>       * @throws DerivativeException this exception is propagated to the caller if the<a name="line.261"></a>
+<FONT color="green">262</FONT>       * underlying user function triggers one<a name="line.262"></a>
+<FONT color="green">263</FONT>       */<a name="line.263"></a>
+<FONT color="green">264</FONT>      protected abstract void computeInterpolatedStateAndDerivatives(double theta,<a name="line.264"></a>
+<FONT color="green">265</FONT>                                                                     double oneMinusThetaH)<a name="line.265"></a>
+<FONT color="green">266</FONT>        throws DerivativeException;<a name="line.266"></a>
+<FONT color="green">267</FONT>    <a name="line.267"></a>
+<FONT color="green">268</FONT>      /** {@inheritDoc} */<a name="line.268"></a>
+<FONT color="green">269</FONT>      public double[] getInterpolatedState() throws DerivativeException {<a name="line.269"></a>
+<FONT color="green">270</FONT>    <a name="line.270"></a>
+<FONT color="green">271</FONT>          // lazy evaluation of the state<a name="line.271"></a>
+<FONT color="green">272</FONT>          if (dirtyState) {<a name="line.272"></a>
+<FONT color="green">273</FONT>              final double oneMinusThetaH = currentTime - interpolatedTime;<a name="line.273"></a>
+<FONT color="green">274</FONT>              final double theta = (h == 0) ? 0 : (h - oneMinusThetaH) / h;<a name="line.274"></a>
+<FONT color="green">275</FONT>              computeInterpolatedStateAndDerivatives(theta, oneMinusThetaH);<a name="line.275"></a>
+<FONT color="green">276</FONT>              dirtyState = false;<a name="line.276"></a>
+<FONT color="green">277</FONT>          }<a name="line.277"></a>
+<FONT color="green">278</FONT>    <a name="line.278"></a>
+<FONT color="green">279</FONT>          return interpolatedState;<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>      }<a name="line.281"></a>
+<FONT color="green">282</FONT>    <a name="line.282"></a>
+<FONT color="green">283</FONT>      /** {@inheritDoc} */<a name="line.283"></a>
+<FONT color="green">284</FONT>      public double[] getInterpolatedDerivatives() throws DerivativeException {<a name="line.284"></a>
+<FONT color="green">285</FONT>    <a name="line.285"></a>
+<FONT color="green">286</FONT>          // lazy evaluation of the state<a name="line.286"></a>
+<FONT color="green">287</FONT>          if (dirtyState) {<a name="line.287"></a>
+<FONT color="green">288</FONT>              final double oneMinusThetaH = currentTime - interpolatedTime;<a name="line.288"></a>
+<FONT color="green">289</FONT>              final double theta = (h == 0) ? 0 : (h - oneMinusThetaH) / h;<a name="line.289"></a>
+<FONT color="green">290</FONT>              computeInterpolatedStateAndDerivatives(theta, oneMinusThetaH);<a name="line.290"></a>
+<FONT color="green">291</FONT>              dirtyState = false;<a name="line.291"></a>
+<FONT color="green">292</FONT>          }<a name="line.292"></a>
+<FONT color="green">293</FONT>    <a name="line.293"></a>
+<FONT color="green">294</FONT>          return interpolatedDerivatives;<a name="line.294"></a>
+<FONT color="green">295</FONT>    <a name="line.295"></a>
+<FONT color="green">296</FONT>      }<a name="line.296"></a>
+<FONT color="green">297</FONT>    <a name="line.297"></a>
+<FONT color="green">298</FONT>      /**<a name="line.298"></a>
+<FONT color="green">299</FONT>       * Finalize the step.<a name="line.299"></a>
+<FONT color="green">300</FONT>    <a name="line.300"></a>
+<FONT color="green">301</FONT>       * &lt;p&gt;Some embedded Runge-Kutta integrators need fewer functions<a name="line.301"></a>
+<FONT color="green">302</FONT>       * evaluations than their counterpart step interpolators. These<a name="line.302"></a>
+<FONT color="green">303</FONT>       * interpolators should perform the last evaluations they need by<a name="line.303"></a>
+<FONT color="green">304</FONT>       * themselves only if they need them. This method triggers these<a name="line.304"></a>
+<FONT color="green">305</FONT>       * extra evaluations. It can be called directly by the user step<a name="line.305"></a>
+<FONT color="green">306</FONT>       * handler and it is called automatically if {@link<a name="line.306"></a>
+<FONT color="green">307</FONT>       * #setInterpolatedTime} is called.&lt;/p&gt;<a name="line.307"></a>
+<FONT color="green">308</FONT>    <a name="line.308"></a>
+<FONT color="green">309</FONT>       * &lt;p&gt;Once this method has been called, &lt;strong&gt;no&lt;/strong&gt; other<a name="line.309"></a>
+<FONT color="green">310</FONT>       * evaluation will be performed on this step. If there is a need to<a name="line.310"></a>
+<FONT color="green">311</FONT>       * have some side effects between the step handler and the<a name="line.311"></a>
+<FONT color="green">312</FONT>       * differential equations (for example update some data in the<a name="line.312"></a>
+<FONT color="green">313</FONT>       * equations once the step has been done), it is advised to call<a name="line.313"></a>
+<FONT color="green">314</FONT>       * this method explicitly from the step handler before these side<a name="line.314"></a>
+<FONT color="green">315</FONT>       * effects are set up. If the step handler induces no side effect,<a name="line.315"></a>
+<FONT color="green">316</FONT>       * then this method can safely be ignored, it will be called<a name="line.316"></a>
+<FONT color="green">317</FONT>       * transparently as needed.&lt;/p&gt;<a name="line.317"></a>
+<FONT color="green">318</FONT>    <a name="line.318"></a>
+<FONT color="green">319</FONT>       * &lt;p&gt;&lt;strong&gt;Warning&lt;/strong&gt;: since the step interpolator provided<a name="line.319"></a>
+<FONT color="green">320</FONT>       * to the step handler as a parameter of the {@link<a name="line.320"></a>
+<FONT color="green">321</FONT>       * StepHandler#handleStep handleStep} is valid only for the duration<a name="line.321"></a>
+<FONT color="green">322</FONT>       * of the {@link StepHandler#handleStep handleStep} call, one cannot<a name="line.322"></a>
+<FONT color="green">323</FONT>       * simply store a reference and reuse it later. One should first<a name="line.323"></a>
+<FONT color="green">324</FONT>       * finalize the instance, then copy this finalized instance into a<a name="line.324"></a>
+<FONT color="green">325</FONT>       * new object that can be kept.&lt;/p&gt;<a name="line.325"></a>
+<FONT color="green">326</FONT>    <a name="line.326"></a>
+<FONT color="green">327</FONT>       * &lt;p&gt;This method calls the protected &lt;code&gt;doFinalize&lt;/code&gt; method<a name="line.327"></a>
+<FONT color="green">328</FONT>       * if it has never been called during this step and set a flag<a name="line.328"></a>
+<FONT color="green">329</FONT>       * indicating that it has been called once. It is the &lt;code&gt;<a name="line.329"></a>
+<FONT color="green">330</FONT>       * doFinalize&lt;/code&gt; method which should perform the evaluations.<a name="line.330"></a>
+<FONT color="green">331</FONT>       * This wrapping prevents from calling &lt;code&gt;doFinalize&lt;/code&gt; several<a name="line.331"></a>
+<FONT color="green">332</FONT>       * times and hence evaluating the differential equations too often.<a name="line.332"></a>
+<FONT color="green">333</FONT>       * Therefore, subclasses are not allowed not reimplement it, they<a name="line.333"></a>
+<FONT color="green">334</FONT>       * should rather reimplement &lt;code&gt;doFinalize&lt;/code&gt;.&lt;/p&gt;<a name="line.334"></a>
+<FONT color="green">335</FONT>    <a name="line.335"></a>
+<FONT color="green">336</FONT>       * @throws DerivativeException this exception is propagated to the<a name="line.336"></a>
+<FONT color="green">337</FONT>       * caller if the underlying user function triggers one<a name="line.337"></a>
+<FONT color="green">338</FONT>       */<a name="line.338"></a>
+<FONT color="green">339</FONT>      public final void finalizeStep()<a name="line.339"></a>
+<FONT color="green">340</FONT>        throws DerivativeException {<a name="line.340"></a>
+<FONT color="green">341</FONT>        if (! finalized) {<a name="line.341"></a>
+<FONT color="green">342</FONT>          doFinalize();<a name="line.342"></a>
+<FONT color="green">343</FONT>          finalized = true;<a name="line.343"></a>
+<FONT color="green">344</FONT>        }<a name="line.344"></a>
+<FONT color="green">345</FONT>      }<a name="line.345"></a>
+<FONT color="green">346</FONT>    <a name="line.346"></a>
+<FONT color="green">347</FONT>      /**<a name="line.347"></a>
+<FONT color="green">348</FONT>       * Really finalize the step.<a name="line.348"></a>
+<FONT color="green">349</FONT>       * The default implementation of this method does nothing.<a name="line.349"></a>
+<FONT color="green">350</FONT>       * @throws DerivativeException this exception is propagated to the<a name="line.350"></a>
+<FONT color="green">351</FONT>       * caller if the underlying user function triggers one<a name="line.351"></a>
+<FONT color="green">352</FONT>       */<a name="line.352"></a>
+<FONT color="green">353</FONT>      protected void doFinalize()<a name="line.353"></a>
+<FONT color="green">354</FONT>        throws DerivativeException {<a name="line.354"></a>
+<FONT color="green">355</FONT>      }<a name="line.355"></a>
+<FONT color="green">356</FONT>    <a name="line.356"></a>
+<FONT color="green">357</FONT>      /** {@inheritDoc} */<a name="line.357"></a>
+<FONT color="green">358</FONT>      public abstract void writeExternal(ObjectOutput out)<a name="line.358"></a>
+<FONT color="green">359</FONT>        throws IOException;<a name="line.359"></a>
+<FONT color="green">360</FONT>    <a name="line.360"></a>
+<FONT color="green">361</FONT>      /** {@inheritDoc} */<a name="line.361"></a>
+<FONT color="green">362</FONT>      public abstract void readExternal(ObjectInput in)<a name="line.362"></a>
+<FONT color="green">363</FONT>        throws IOException, ClassNotFoundException;<a name="line.363"></a>
+<FONT color="green">364</FONT>    <a name="line.364"></a>
+<FONT color="green">365</FONT>      /** Save the base state of the instance.<a name="line.365"></a>
+<FONT color="green">366</FONT>       * This method performs step finalization if it has not been done<a name="line.366"></a>
+<FONT color="green">367</FONT>       * before.<a name="line.367"></a>
+<FONT color="green">368</FONT>       * @param out stream where to save the state<a name="line.368"></a>
+<FONT color="green">369</FONT>       * @exception IOException in case of write error<a name="line.369"></a>
+<FONT color="green">370</FONT>       */<a name="line.370"></a>
+<FONT color="green">371</FONT>      protected void writeBaseExternal(final ObjectOutput out)<a name="line.371"></a>
+<FONT color="green">372</FONT>        throws IOException {<a name="line.372"></a>
+<FONT color="green">373</FONT>    <a name="line.373"></a>
+<FONT color="green">374</FONT>        if (currentState == null) {<a name="line.374"></a>
+<FONT color="green">375</FONT>            out.writeInt(-1);<a name="line.375"></a>
+<FONT color="green">376</FONT>        } else {<a name="line.376"></a>
+<FONT color="green">377</FONT>            out.writeInt(currentState.length);<a name="line.377"></a>
+<FONT color="green">378</FONT>        }<a name="line.378"></a>
+<FONT color="green">379</FONT>        out.writeDouble(previousTime);<a name="line.379"></a>
+<FONT color="green">380</FONT>        out.writeDouble(currentTime);<a name="line.380"></a>
+<FONT color="green">381</FONT>        out.writeDouble(h);<a name="line.381"></a>
+<FONT color="green">382</FONT>        out.writeBoolean(forward);<a name="line.382"></a>
+<FONT color="green">383</FONT>    <a name="line.383"></a>
+<FONT color="green">384</FONT>        if (currentState != null) {<a name="line.384"></a>
+<FONT color="green">385</FONT>            for (int i = 0; i &lt; currentState.length; ++i) {<a name="line.385"></a>
+<FONT color="green">386</FONT>                out.writeDouble(currentState[i]);<a name="line.386"></a>
+<FONT color="green">387</FONT>            }<a name="line.387"></a>
+<FONT color="green">388</FONT>        }<a name="line.388"></a>
+<FONT color="green">389</FONT>    <a name="line.389"></a>
+<FONT color="green">390</FONT>        out.writeDouble(interpolatedTime);<a name="line.390"></a>
+<FONT color="green">391</FONT>    <a name="line.391"></a>
+<FONT color="green">392</FONT>        // we do not store the interpolated state,<a name="line.392"></a>
+<FONT color="green">393</FONT>        // it will be recomputed as needed after reading<a name="line.393"></a>
+<FONT color="green">394</FONT>    <a name="line.394"></a>
+<FONT color="green">395</FONT>        // finalize the step (and don't bother saving the now true flag)<a name="line.395"></a>
+<FONT color="green">396</FONT>        try {<a name="line.396"></a>
+<FONT color="green">397</FONT>          finalizeStep();<a name="line.397"></a>
+<FONT color="green">398</FONT>        } catch (DerivativeException e) {<a name="line.398"></a>
+<FONT color="green">399</FONT>          throw MathRuntimeException.createIOException(e);<a name="line.399"></a>
+<FONT color="green">400</FONT>        }<a name="line.400"></a>
+<FONT color="green">401</FONT>    <a name="line.401"></a>
+<FONT color="green">402</FONT>      }<a name="line.402"></a>
+<FONT color="green">403</FONT>    <a name="line.403"></a>
+<FONT color="green">404</FONT>      /** Read the base state of the instance.<a name="line.404"></a>
+<FONT color="green">405</FONT>       * This method does &lt;strong&gt;neither&lt;/strong&gt; set the interpolated<a name="line.405"></a>
+<FONT color="green">406</FONT>       * time nor state. It is up to the derived class to reset it<a name="line.406"></a>
+<FONT color="green">407</FONT>       * properly calling the {@link #setInterpolatedTime} method later,<a name="line.407"></a>
+<FONT color="green">408</FONT>       * once all rest of the object state has been set up properly.<a name="line.408"></a>
+<FONT color="green">409</FONT>       * @param in stream where to read the state from<a name="line.409"></a>
+<FONT color="green">410</FONT>       * @return interpolated time be set later by the caller<a name="line.410"></a>
+<FONT color="green">411</FONT>       * @exception IOException in case of read error<a name="line.411"></a>
+<FONT color="green">412</FONT>       */<a name="line.412"></a>
+<FONT color="green">413</FONT>      protected double readBaseExternal(final ObjectInput in)<a name="line.413"></a>
+<FONT color="green">414</FONT>        throws IOException {<a name="line.414"></a>
+<FONT color="green">415</FONT>    <a name="line.415"></a>
+<FONT color="green">416</FONT>        final int dimension = in.readInt();<a name="line.416"></a>
+<FONT color="green">417</FONT>        previousTime  = in.readDouble();<a name="line.417"></a>
+<FONT color="green">418</FONT>        currentTime   = in.readDouble();<a name="line.418"></a>
+<FONT color="green">419</FONT>        h             = in.readDouble();<a name="line.419"></a>
+<FONT color="green">420</FONT>        forward       = in.readBoolean();<a name="line.420"></a>
+<FONT color="green">421</FONT>        dirtyState    = true;<a name="line.421"></a>
+<FONT color="green">422</FONT>    <a name="line.422"></a>
+<FONT color="green">423</FONT>        if (dimension &lt; 0) {<a name="line.423"></a>
+<FONT color="green">424</FONT>            currentState = null;<a name="line.424"></a>
+<FONT color="green">425</FONT>        } else {<a name="line.425"></a>
+<FONT color="green">426</FONT>            currentState  = new double[dimension];<a name="line.426"></a>
+<FONT color="green">427</FONT>            for (int i = 0; i &lt; currentState.length; ++i) {<a name="line.427"></a>
+<FONT color="green">428</FONT>                currentState[i] = in.readDouble();<a name="line.428"></a>
+<FONT color="green">429</FONT>            }<a name="line.429"></a>
+<FONT color="green">430</FONT>        }<a name="line.430"></a>
+<FONT color="green">431</FONT>    <a name="line.431"></a>
+<FONT color="green">432</FONT>        // we do NOT handle the interpolated time and state here<a name="line.432"></a>
+<FONT color="green">433</FONT>        interpolatedTime        = Double.NaN;<a name="line.433"></a>
+<FONT color="green">434</FONT>        interpolatedState       = (dimension &lt; 0) ? null : new double[dimension];<a name="line.434"></a>
+<FONT color="green">435</FONT>        interpolatedDerivatives = (dimension &lt; 0) ? null : new double[dimension];<a name="line.435"></a>
+<FONT color="green">436</FONT>    <a name="line.436"></a>
+<FONT color="green">437</FONT>        finalized = true;<a name="line.437"></a>
+<FONT color="green">438</FONT>    <a name="line.438"></a>
+<FONT color="green">439</FONT>        return in.readDouble();<a name="line.439"></a>
+<FONT color="green">440</FONT>    <a name="line.440"></a>
+<FONT color="green">441</FONT>      }<a name="line.441"></a>
+<FONT color="green">442</FONT>    <a name="line.442"></a>
+<FONT color="green">443</FONT>    }<a name="line.443"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/sampling/DummyStepHandler.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,167 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.sampling;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * This class is a step handler that does nothing.<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;p&gt;This class is provided as a convenience for users who are only<a name="line.23"></a>
+<FONT color="green">024</FONT>     * interested in the final state of an integration and not in the<a name="line.24"></a>
+<FONT color="green">025</FONT>     * intermediate steps. Its handleStep method does nothing.&lt;/p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;Since this class has no internal state, it is implemented using<a name="line.27"></a>
+<FONT color="green">028</FONT>     * the Singleton design pattern. This means that only one instance is<a name="line.28"></a>
+<FONT color="green">029</FONT>     * ever created, which can be retrieved using the getInstance<a name="line.29"></a>
+<FONT color="green">030</FONT>     * method. This explains why there is no public constructor.&lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     *<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @see StepHandler<a name="line.32"></a>
+<FONT color="green">033</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @since 1.2<a name="line.34"></a>
+<FONT color="green">035</FONT>     */<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>    public class DummyStepHandler implements StepHandler {<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Private constructor.<a name="line.39"></a>
+<FONT color="green">040</FONT>         * The constructor is private to prevent users from creating<a name="line.40"></a>
+<FONT color="green">041</FONT>         * instances (Singleton design-pattern).<a name="line.41"></a>
+<FONT color="green">042</FONT>         */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private DummyStepHandler() {<a name="line.43"></a>
+<FONT color="green">044</FONT>        }<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** Get the only instance.<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @return the only instance<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        public static DummyStepHandler getInstance() {<a name="line.49"></a>
+<FONT color="green">050</FONT>            return LazyHolder.INSTANCE;<a name="line.50"></a>
+<FONT color="green">051</FONT>        }<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** Determines whether this handler needs dense output.<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Since this handler does nothing, it does not require dense output.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @return always false<a name="line.55"></a>
+<FONT color="green">056</FONT>         */<a name="line.56"></a>
+<FONT color="green">057</FONT>        public boolean requiresDenseOutput() {<a name="line.57"></a>
+<FONT color="green">058</FONT>            return false;<a name="line.58"></a>
+<FONT color="green">059</FONT>        }<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /** Reset the step handler.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Initialize the internal data as required before the first step is<a name="line.62"></a>
+<FONT color="green">063</FONT>         * handled.<a name="line.63"></a>
+<FONT color="green">064</FONT>         */<a name="line.64"></a>
+<FONT color="green">065</FONT>        public void reset() {<a name="line.65"></a>
+<FONT color="green">066</FONT>        }<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /**<a name="line.68"></a>
+<FONT color="green">069</FONT>         * Handle the last accepted step.<a name="line.69"></a>
+<FONT color="green">070</FONT>         * This method does nothing in this class.<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param interpolator interpolator for the last accepted step. For<a name="line.71"></a>
+<FONT color="green">072</FONT>         * efficiency purposes, the various integrators reuse the same<a name="line.72"></a>
+<FONT color="green">073</FONT>         * object on each call, so if the instance wants to keep it across<a name="line.73"></a>
+<FONT color="green">074</FONT>         * all calls (for example to provide at the end of the integration a<a name="line.74"></a>
+<FONT color="green">075</FONT>         * continuous model valid throughout the integration range), it<a name="line.75"></a>
+<FONT color="green">076</FONT>         * should build a local copy using the clone method and store this<a name="line.76"></a>
+<FONT color="green">077</FONT>         * copy.<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @param isLast true if the step is the last one<a name="line.78"></a>
+<FONT color="green">079</FONT>         */<a name="line.79"></a>
+<FONT color="green">080</FONT>        public void handleStep(final StepInterpolator interpolator, final boolean isLast) {<a name="line.80"></a>
+<FONT color="green">081</FONT>        }<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        // CHECKSTYLE: stop HideUtilityClassConstructor<a name="line.83"></a>
+<FONT color="green">084</FONT>        /** Holder for the instance.<a name="line.84"></a>
+<FONT color="green">085</FONT>         * &lt;p&gt;We use here the Initialization On Demand Holder Idiom.&lt;/p&gt;<a name="line.85"></a>
+<FONT color="green">086</FONT>         */<a name="line.86"></a>
+<FONT color="green">087</FONT>        private static class LazyHolder {<a name="line.87"></a>
+<FONT color="green">088</FONT>            /** Cached field instance. */<a name="line.88"></a>
+<FONT color="green">089</FONT>            private static final DummyStepHandler INSTANCE = new DummyStepHandler();<a name="line.89"></a>
+<FONT color="green">090</FONT>        }<a name="line.90"></a>
+<FONT color="green">091</FONT>        // CHECKSTYLE: resume HideUtilityClassConstructor<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /** Handle deserialization of the singleton.<a name="line.93"></a>
+<FONT color="green">094</FONT>         * @return the singleton instance<a name="line.94"></a>
+<FONT color="green">095</FONT>         */<a name="line.95"></a>
+<FONT color="green">096</FONT>        private Object readResolve() {<a name="line.96"></a>
+<FONT color="green">097</FONT>            // return the singleton instance<a name="line.97"></a>
+<FONT color="green">098</FONT>            return LazyHolder.INSTANCE;<a name="line.98"></a>
+<FONT color="green">099</FONT>        }<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>    }<a name="line.101"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/sampling/DummyStepInterpolator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,221 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.sampling;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.IOException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.io.ObjectInput;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.io.ObjectOutput;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /** This class is a step interpolator that does nothing.<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;This class is used when the {@link StepHandler "step handler"}<a name="line.28"></a>
+<FONT color="green">029</FONT>     * set up by the user does not need step interpolation. It does not<a name="line.29"></a>
+<FONT color="green">030</FONT>     * recompute the state when {@link AbstractStepInterpolator#setInterpolatedTime<a name="line.30"></a>
+<FONT color="green">031</FONT>     * setInterpolatedTime} is called. This implies the interpolated state<a name="line.31"></a>
+<FONT color="green">032</FONT>     * is always the state at the end of the current step.&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @see StepHandler<a name="line.34"></a>
+<FONT color="green">035</FONT>     *<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @version $Revision: 919479 $ $Date: 2010-03-05 11:35:56 -0500 (Fri, 05 Mar 2010) $<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @since 1.2<a name="line.37"></a>
+<FONT color="green">038</FONT>     */<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>    public class DummyStepInterpolator<a name="line.40"></a>
+<FONT color="green">041</FONT>      extends AbstractStepInterpolator {<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>      /** Serializable version identifier. */<a name="line.43"></a>
+<FONT color="green">044</FONT>      private static final long serialVersionUID = 1708010296707839488L;<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>      /** Current derivative. */<a name="line.46"></a>
+<FONT color="green">047</FONT>      private double[] currentDerivative;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>      /** Simple constructor.<a name="line.49"></a>
+<FONT color="green">050</FONT>       * This constructor builds an instance that is not usable yet, the<a name="line.50"></a>
+<FONT color="green">051</FONT>       * &lt;code&gt;AbstractStepInterpolator.reinitialize&lt;/code&gt; protected method<a name="line.51"></a>
+<FONT color="green">052</FONT>       * should be called before using the instance in order to initialize<a name="line.52"></a>
+<FONT color="green">053</FONT>       * the internal arrays. This constructor is used only in order to delay<a name="line.53"></a>
+<FONT color="green">054</FONT>       * the initialization in some cases. As an example, the {@link<a name="line.54"></a>
+<FONT color="green">055</FONT>       * org.apache.commons.math.ode.nonstiff.EmbeddedRungeKuttaIntegrator} uses<a name="line.55"></a>
+<FONT color="green">056</FONT>       * the prototyping design pattern to create the step interpolators by<a name="line.56"></a>
+<FONT color="green">057</FONT>       * cloning an uninitialized model and latter initializing the copy.<a name="line.57"></a>
+<FONT color="green">058</FONT>       */<a name="line.58"></a>
+<FONT color="green">059</FONT>      public DummyStepInterpolator() {<a name="line.59"></a>
+<FONT color="green">060</FONT>        super();<a name="line.60"></a>
+<FONT color="green">061</FONT>        currentDerivative = null;<a name="line.61"></a>
+<FONT color="green">062</FONT>      }<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>      /** Simple constructor.<a name="line.64"></a>
+<FONT color="green">065</FONT>       * @param y reference to the integrator array holding the state at<a name="line.65"></a>
+<FONT color="green">066</FONT>       * the end of the step<a name="line.66"></a>
+<FONT color="green">067</FONT>       * @param yDot reference to the integrator array holding the state<a name="line.67"></a>
+<FONT color="green">068</FONT>       * derivative at some arbitrary point within the step<a name="line.68"></a>
+<FONT color="green">069</FONT>       * @param forward integration direction indicator<a name="line.69"></a>
+<FONT color="green">070</FONT>       */<a name="line.70"></a>
+<FONT color="green">071</FONT>      public DummyStepInterpolator(final double[] y, final double[] yDot, final boolean forward) {<a name="line.71"></a>
+<FONT color="green">072</FONT>        super(y, forward);<a name="line.72"></a>
+<FONT color="green">073</FONT>        currentDerivative = yDot;<a name="line.73"></a>
+<FONT color="green">074</FONT>      }<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>      /** Copy constructor.<a name="line.76"></a>
+<FONT color="green">077</FONT>       * @param interpolator interpolator to copy from. The copy is a deep<a name="line.77"></a>
+<FONT color="green">078</FONT>       * copy: its arrays are separated from the original arrays of the<a name="line.78"></a>
+<FONT color="green">079</FONT>       * instance<a name="line.79"></a>
+<FONT color="green">080</FONT>       */<a name="line.80"></a>
+<FONT color="green">081</FONT>      public DummyStepInterpolator(final DummyStepInterpolator interpolator) {<a name="line.81"></a>
+<FONT color="green">082</FONT>        super(interpolator);<a name="line.82"></a>
+<FONT color="green">083</FONT>        currentDerivative = interpolator.currentDerivative.clone();<a name="line.83"></a>
+<FONT color="green">084</FONT>      }<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>      /** Really copy the finalized instance.<a name="line.86"></a>
+<FONT color="green">087</FONT>       * @return a copy of the finalized instance<a name="line.87"></a>
+<FONT color="green">088</FONT>       */<a name="line.88"></a>
+<FONT color="green">089</FONT>      @Override<a name="line.89"></a>
+<FONT color="green">090</FONT>      protected StepInterpolator doCopy() {<a name="line.90"></a>
+<FONT color="green">091</FONT>        return new DummyStepInterpolator(this);<a name="line.91"></a>
+<FONT color="green">092</FONT>      }<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>      /** Compute the state at the interpolated time.<a name="line.94"></a>
+<FONT color="green">095</FONT>       * In this class, this method does nothing: the interpolated state<a name="line.95"></a>
+<FONT color="green">096</FONT>       * is always the state at the end of the current step.<a name="line.96"></a>
+<FONT color="green">097</FONT>       * @param theta normalized interpolation abscissa within the step<a name="line.97"></a>
+<FONT color="green">098</FONT>       * (theta is zero at the previous time step and one at the current time step)<a name="line.98"></a>
+<FONT color="green">099</FONT>       * @param oneMinusThetaH time gap between the interpolated time and<a name="line.99"></a>
+<FONT color="green">100</FONT>       * the current time<a name="line.100"></a>
+<FONT color="green">101</FONT>       * @throws DerivativeException this exception is propagated to the caller if the<a name="line.101"></a>
+<FONT color="green">102</FONT>       * underlying user function triggers one<a name="line.102"></a>
+<FONT color="green">103</FONT>       */<a name="line.103"></a>
+<FONT color="green">104</FONT>      @Override<a name="line.104"></a>
+<FONT color="green">105</FONT>      protected void computeInterpolatedStateAndDerivatives(final double theta, final double oneMinusThetaH)<a name="line.105"></a>
+<FONT color="green">106</FONT>        throws DerivativeException {<a name="line.106"></a>
+<FONT color="green">107</FONT>          System.arraycopy(currentState,      0, interpolatedState,       0, currentState.length);<a name="line.107"></a>
+<FONT color="green">108</FONT>          System.arraycopy(currentDerivative, 0, interpolatedDerivatives, 0, currentDerivative.length);<a name="line.108"></a>
+<FONT color="green">109</FONT>      }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>      /** Write the instance to an output channel.<a name="line.111"></a>
+<FONT color="green">112</FONT>       * @param out output channel<a name="line.112"></a>
+<FONT color="green">113</FONT>       * @exception IOException if the instance cannot be written<a name="line.113"></a>
+<FONT color="green">114</FONT>       */<a name="line.114"></a>
+<FONT color="green">115</FONT>      @Override<a name="line.115"></a>
+<FONT color="green">116</FONT>      public void writeExternal(final ObjectOutput out)<a name="line.116"></a>
+<FONT color="green">117</FONT>        throws IOException {<a name="line.117"></a>
+<FONT color="green">118</FONT>    <a name="line.118"></a>
+<FONT color="green">119</FONT>          // save the state of the base class<a name="line.119"></a>
+<FONT color="green">120</FONT>        writeBaseExternal(out);<a name="line.120"></a>
+<FONT color="green">121</FONT>    <a name="line.121"></a>
+<FONT color="green">122</FONT>        if (currentDerivative != null) {<a name="line.122"></a>
+<FONT color="green">123</FONT>            for (int i = 0; i &lt; currentDerivative.length; ++i) {<a name="line.123"></a>
+<FONT color="green">124</FONT>                out.writeDouble(currentDerivative[i]);<a name="line.124"></a>
+<FONT color="green">125</FONT>            }<a name="line.125"></a>
+<FONT color="green">126</FONT>        }<a name="line.126"></a>
+<FONT color="green">127</FONT>    <a name="line.127"></a>
+<FONT color="green">128</FONT>      }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>      /** Read the instance from an input channel.<a name="line.130"></a>
+<FONT color="green">131</FONT>       * @param in input channel<a name="line.131"></a>
+<FONT color="green">132</FONT>       * @exception IOException if the instance cannot be read<a name="line.132"></a>
+<FONT color="green">133</FONT>       */<a name="line.133"></a>
+<FONT color="green">134</FONT>      @Override<a name="line.134"></a>
+<FONT color="green">135</FONT>      public void readExternal(final ObjectInput in)<a name="line.135"></a>
+<FONT color="green">136</FONT>        throws IOException {<a name="line.136"></a>
+<FONT color="green">137</FONT>    <a name="line.137"></a>
+<FONT color="green">138</FONT>        // read the base class<a name="line.138"></a>
+<FONT color="green">139</FONT>        final double t = readBaseExternal(in);<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>        if (currentState == null) {<a name="line.141"></a>
+<FONT color="green">142</FONT>            currentDerivative = null;<a name="line.142"></a>
+<FONT color="green">143</FONT>        } else {<a name="line.143"></a>
+<FONT color="green">144</FONT>            currentDerivative  = new double[currentState.length];<a name="line.144"></a>
+<FONT color="green">145</FONT>            for (int i = 0; i &lt; currentDerivative.length; ++i) {<a name="line.145"></a>
+<FONT color="green">146</FONT>                currentDerivative[i] = in.readDouble();<a name="line.146"></a>
+<FONT color="green">147</FONT>            }<a name="line.147"></a>
+<FONT color="green">148</FONT>        }<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>        // we can now set the interpolated time and state<a name="line.150"></a>
+<FONT color="green">151</FONT>        setInterpolatedTime(t);<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>      }<a name="line.153"></a>
+<FONT color="green">154</FONT>    <a name="line.154"></a>
+<FONT color="green">155</FONT>    }<a name="line.155"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/sampling/FixedStepHandler.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,128 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.sampling;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This interface represents a handler that should be called after<a name="line.23"></a>
+<FONT color="green">024</FONT>     * each successful fixed step.<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;This interface should be implemented by anyone who is interested<a name="line.26"></a>
+<FONT color="green">027</FONT>     * in getting the solution of an ordinary differential equation at<a name="line.27"></a>
+<FONT color="green">028</FONT>     * fixed time steps. Objects implementing this interface should be<a name="line.28"></a>
+<FONT color="green">029</FONT>     * wrapped within an instance of {@link StepNormalizer} that itself<a name="line.29"></a>
+<FONT color="green">030</FONT>     * is used as the general {@link StepHandler} by the integrator. The<a name="line.30"></a>
+<FONT color="green">031</FONT>     * {@link StepNormalizer} object is called according to the integrator<a name="line.31"></a>
+<FONT color="green">032</FONT>     * internal algorithms and it calls objects implementing this<a name="line.32"></a>
+<FONT color="green">033</FONT>     * interface as necessary at fixed time steps.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     *<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @see StepHandler<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @see StepNormalizer<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @since 1.2<a name="line.38"></a>
+<FONT color="green">039</FONT>     */<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>    public interface FixedStepHandler  {<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>      /**<a name="line.43"></a>
+<FONT color="green">044</FONT>       * Handle the last accepted step<a name="line.44"></a>
+<FONT color="green">045</FONT>       * @param t time of the current step<a name="line.45"></a>
+<FONT color="green">046</FONT>       * @param y state vector at t. For efficiency purposes, the {@link<a name="line.46"></a>
+<FONT color="green">047</FONT>       * StepNormalizer} class reuses the same array on each call, so if<a name="line.47"></a>
+<FONT color="green">048</FONT>       * the instance wants to keep it across all calls (for example to<a name="line.48"></a>
+<FONT color="green">049</FONT>       * provide at the end of the integration a complete array of all<a name="line.49"></a>
+<FONT color="green">050</FONT>       * steps), it should build a local copy store this copy.<a name="line.50"></a>
+<FONT color="green">051</FONT>       * @param yDot derivatives of the state vector state vector at t.<a name="line.51"></a>
+<FONT color="green">052</FONT>       * For efficiency purposes, the {@link StepNormalizer} class reuses<a name="line.52"></a>
+<FONT color="green">053</FONT>       * the same array on each call, so if<a name="line.53"></a>
+<FONT color="green">054</FONT>       * the instance wants to keep it across all calls (for example to<a name="line.54"></a>
+<FONT color="green">055</FONT>       * provide at the end of the integration a complete array of all<a name="line.55"></a>
+<FONT color="green">056</FONT>       * steps), it should build a local copy store this copy.<a name="line.56"></a>
+<FONT color="green">057</FONT>       * @param isLast true if the step is the last one<a name="line.57"></a>
+<FONT color="green">058</FONT>       * @throws DerivativeException if some error condition is encountered<a name="line.58"></a>
+<FONT color="green">059</FONT>       */<a name="line.59"></a>
+<FONT color="green">060</FONT>      void handleStep(double t, double[] y, double[] yDot, boolean isLast) throws DerivativeException;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>    }<a name="line.62"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/sampling/NordsieckStepInterpolator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,356 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.sampling;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.IOException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.io.ObjectInput;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.io.ObjectOutput;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.util.Arrays;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.linear.Array2DRowRealMatrix;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    /**<a name="line.28"></a>
+<FONT color="green">029</FONT>     * This class implements an interpolator for integrators using Nordsieck representation.<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;This interpolator computes dense output around the current point.<a name="line.31"></a>
+<FONT color="green">032</FONT>     * The interpolation equation is based on Taylor series formulas.<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @see org.apache.commons.math.ode.nonstiff.AdamsBashforthIntegrator<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @see org.apache.commons.math.ode.nonstiff.AdamsMoultonIntegrator<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @since 2.0<a name="line.37"></a>
+<FONT color="green">038</FONT>     */<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>    public class NordsieckStepInterpolator extends AbstractStepInterpolator {<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Serializable version identifier */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private static final long serialVersionUID = -7179861704951334960L;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** State variation. */<a name="line.45"></a>
+<FONT color="green">046</FONT>        protected double[] stateVariation;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** Step size used in the first scaled derivative and Nordsieck vector. */<a name="line.48"></a>
+<FONT color="green">049</FONT>        private double scalingH;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /** Reference time for all arrays.<a name="line.51"></a>
+<FONT color="green">052</FONT>         * &lt;p&gt;Sometimes, the reference time is the same as previousTime,<a name="line.52"></a>
+<FONT color="green">053</FONT>         * sometimes it is the same as currentTime, so we use a separate<a name="line.53"></a>
+<FONT color="green">054</FONT>         * field to avoid any confusion.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * &lt;/p&gt;<a name="line.55"></a>
+<FONT color="green">056</FONT>         */<a name="line.56"></a>
+<FONT color="green">057</FONT>        private double referenceTime;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** First scaled derivative. */<a name="line.59"></a>
+<FONT color="green">060</FONT>        private double[] scaled;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** Nordsieck vector. */<a name="line.62"></a>
+<FONT color="green">063</FONT>        private Array2DRowRealMatrix nordsieck;<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Simple constructor.<a name="line.65"></a>
+<FONT color="green">066</FONT>         * This constructor builds an instance that is not usable yet, the<a name="line.66"></a>
+<FONT color="green">067</FONT>         * {@link AbstractStepInterpolator#reinitialize} method should be called<a name="line.67"></a>
+<FONT color="green">068</FONT>         * before using the instance in order to initialize the internal arrays. This<a name="line.68"></a>
+<FONT color="green">069</FONT>         * constructor is used only in order to delay the initialization in<a name="line.69"></a>
+<FONT color="green">070</FONT>         * some cases.<a name="line.70"></a>
+<FONT color="green">071</FONT>         */<a name="line.71"></a>
+<FONT color="green">072</FONT>        public NordsieckStepInterpolator() {<a name="line.72"></a>
+<FONT color="green">073</FONT>        }<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /** Copy constructor.<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @param interpolator interpolator to copy from. The copy is a deep<a name="line.76"></a>
+<FONT color="green">077</FONT>         * copy: its arrays are separated from the original arrays of the<a name="line.77"></a>
+<FONT color="green">078</FONT>         * instance<a name="line.78"></a>
+<FONT color="green">079</FONT>         */<a name="line.79"></a>
+<FONT color="green">080</FONT>        public NordsieckStepInterpolator(final NordsieckStepInterpolator interpolator) {<a name="line.80"></a>
+<FONT color="green">081</FONT>            super(interpolator);<a name="line.81"></a>
+<FONT color="green">082</FONT>            scalingH      = interpolator.scalingH;<a name="line.82"></a>
+<FONT color="green">083</FONT>            referenceTime = interpolator.referenceTime;<a name="line.83"></a>
+<FONT color="green">084</FONT>            if (interpolator.scaled != null) {<a name="line.84"></a>
+<FONT color="green">085</FONT>                scaled = interpolator.scaled.clone();<a name="line.85"></a>
+<FONT color="green">086</FONT>            }<a name="line.86"></a>
+<FONT color="green">087</FONT>            if (interpolator.nordsieck != null) {<a name="line.87"></a>
+<FONT color="green">088</FONT>                nordsieck = new Array2DRowRealMatrix(interpolator.nordsieck.getDataRef(), true);<a name="line.88"></a>
+<FONT color="green">089</FONT>            }<a name="line.89"></a>
+<FONT color="green">090</FONT>            if (interpolator.stateVariation != null) {<a name="line.90"></a>
+<FONT color="green">091</FONT>                stateVariation = interpolator.stateVariation.clone();<a name="line.91"></a>
+<FONT color="green">092</FONT>            }<a name="line.92"></a>
+<FONT color="green">093</FONT>        }<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /** {@inheritDoc} */<a name="line.95"></a>
+<FONT color="green">096</FONT>        @Override<a name="line.96"></a>
+<FONT color="green">097</FONT>        protected StepInterpolator doCopy() {<a name="line.97"></a>
+<FONT color="green">098</FONT>            return new NordsieckStepInterpolator(this);<a name="line.98"></a>
+<FONT color="green">099</FONT>        }<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /** Reinitialize the instance.<a name="line.101"></a>
+<FONT color="green">102</FONT>         * &lt;p&gt;Beware that all arrays &lt;em&gt;must&lt;/em&gt; be references to integrator<a name="line.102"></a>
+<FONT color="green">103</FONT>         * arrays, in order to ensure proper update without copy.&lt;/p&gt;<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @param y reference to the integrator array holding the state at<a name="line.104"></a>
+<FONT color="green">105</FONT>         * the end of the step<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @param forward integration direction indicator<a name="line.106"></a>
+<FONT color="green">107</FONT>         */<a name="line.107"></a>
+<FONT color="green">108</FONT>        @Override<a name="line.108"></a>
+<FONT color="green">109</FONT>        public void reinitialize(final double[] y, final boolean forward) {<a name="line.109"></a>
+<FONT color="green">110</FONT>            super.reinitialize(y, forward);<a name="line.110"></a>
+<FONT color="green">111</FONT>            stateVariation = new double[y.length];<a name="line.111"></a>
+<FONT color="green">112</FONT>        }<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /** Reinitialize the instance.<a name="line.114"></a>
+<FONT color="green">115</FONT>         * &lt;p&gt;Beware that all arrays &lt;em&gt;must&lt;/em&gt; be references to integrator<a name="line.115"></a>
+<FONT color="green">116</FONT>         * arrays, in order to ensure proper update without copy.&lt;/p&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @param time time at which all arrays are defined<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @param stepSize step size used in the scaled and nordsieck arrays<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @param scaledDerivative reference to the integrator array holding the first<a name="line.119"></a>
+<FONT color="green">120</FONT>         * scaled derivative<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @param nordsieckVector reference to the integrator matrix holding the<a name="line.121"></a>
+<FONT color="green">122</FONT>         * nordsieck vector<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        public void reinitialize(final double time, final double stepSize,<a name="line.124"></a>
+<FONT color="green">125</FONT>                                 final double[] scaledDerivative,<a name="line.125"></a>
+<FONT color="green">126</FONT>                                 final Array2DRowRealMatrix nordsieckVector) {<a name="line.126"></a>
+<FONT color="green">127</FONT>            this.referenceTime = time;<a name="line.127"></a>
+<FONT color="green">128</FONT>            this.scalingH      = stepSize;<a name="line.128"></a>
+<FONT color="green">129</FONT>            this.scaled        = scaledDerivative;<a name="line.129"></a>
+<FONT color="green">130</FONT>            this.nordsieck     = nordsieckVector;<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>            // make sure the state and derivatives will depend on the new arrays<a name="line.132"></a>
+<FONT color="green">133</FONT>            setInterpolatedTime(getInterpolatedTime());<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>        }<a name="line.135"></a>
+<FONT color="green">136</FONT>    <a name="line.136"></a>
+<FONT color="green">137</FONT>        /** Rescale the instance.<a name="line.137"></a>
+<FONT color="green">138</FONT>         * &lt;p&gt;Since the scaled and Nordiseck arrays are shared with the caller,<a name="line.138"></a>
+<FONT color="green">139</FONT>         * this method has the side effect of rescaling this arrays in the caller too.&lt;/p&gt;<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @param stepSize new step size to use in the scaled and nordsieck arrays<a name="line.140"></a>
+<FONT color="green">141</FONT>         */<a name="line.141"></a>
+<FONT color="green">142</FONT>        public void rescale(final double stepSize) {<a name="line.142"></a>
+<FONT color="green">143</FONT>    <a name="line.143"></a>
+<FONT color="green">144</FONT>            final double ratio = stepSize / scalingH;<a name="line.144"></a>
+<FONT color="green">145</FONT>            for (int i = 0; i &lt; scaled.length; ++i) {<a name="line.145"></a>
+<FONT color="green">146</FONT>                scaled[i] *= ratio;<a name="line.146"></a>
+<FONT color="green">147</FONT>            }<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>            final double[][] nData = nordsieck.getDataRef();<a name="line.149"></a>
+<FONT color="green">150</FONT>            double power = ratio;<a name="line.150"></a>
+<FONT color="green">151</FONT>            for (int i = 0; i &lt; nData.length; ++i) {<a name="line.151"></a>
+<FONT color="green">152</FONT>                power *= ratio;<a name="line.152"></a>
+<FONT color="green">153</FONT>                final double[] nDataI = nData[i];<a name="line.153"></a>
+<FONT color="green">154</FONT>                for (int j = 0; j &lt; nDataI.length; ++j) {<a name="line.154"></a>
+<FONT color="green">155</FONT>                    nDataI[j] *= power;<a name="line.155"></a>
+<FONT color="green">156</FONT>                }<a name="line.156"></a>
+<FONT color="green">157</FONT>            }<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>            scalingH = stepSize;<a name="line.159"></a>
+<FONT color="green">160</FONT>    <a name="line.160"></a>
+<FONT color="green">161</FONT>        }<a name="line.161"></a>
+<FONT color="green">162</FONT>    <a name="line.162"></a>
+<FONT color="green">163</FONT>        /**<a name="line.163"></a>
+<FONT color="green">164</FONT>         * Get the state vector variation from current to interpolated state.<a name="line.164"></a>
+<FONT color="green">165</FONT>         * &lt;p&gt;This method is aimed at computing y(t&lt;sub&gt;interpolation&lt;/sub&gt;)<a name="line.165"></a>
+<FONT color="green">166</FONT>         * -y(t&lt;sub&gt;current&lt;/sub&gt;) accurately by avoiding the cancellation errors<a name="line.166"></a>
+<FONT color="green">167</FONT>         * that would occur if the subtraction were performed explicitly.&lt;/p&gt;<a name="line.167"></a>
+<FONT color="green">168</FONT>         * &lt;p&gt;The returned vector is a reference to a reused array, so<a name="line.168"></a>
+<FONT color="green">169</FONT>         * it should not be modified and it should be copied if it needs<a name="line.169"></a>
+<FONT color="green">170</FONT>         * to be preserved across several calls.&lt;/p&gt;<a name="line.170"></a>
+<FONT color="green">171</FONT>         * @return state vector at time {@link #getInterpolatedTime}<a name="line.171"></a>
+<FONT color="green">172</FONT>         * @see #getInterpolatedDerivatives()<a name="line.172"></a>
+<FONT color="green">173</FONT>         * @throws DerivativeException if this call induces an automatic<a name="line.173"></a>
+<FONT color="green">174</FONT>         * step finalization that throws one<a name="line.174"></a>
+<FONT color="green">175</FONT>         */<a name="line.175"></a>
+<FONT color="green">176</FONT>        public double[] getInterpolatedStateVariation()<a name="line.176"></a>
+<FONT color="green">177</FONT>            throws DerivativeException {<a name="line.177"></a>
+<FONT color="green">178</FONT>            // compute and ignore interpolated state<a name="line.178"></a>
+<FONT color="green">179</FONT>            // to make sure state variation is computed as a side effect<a name="line.179"></a>
+<FONT color="green">180</FONT>            getInterpolatedState();<a name="line.180"></a>
+<FONT color="green">181</FONT>            return stateVariation;<a name="line.181"></a>
+<FONT color="green">182</FONT>        }<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>        /** {@inheritDoc} */<a name="line.184"></a>
+<FONT color="green">185</FONT>        @Override<a name="line.185"></a>
+<FONT color="green">186</FONT>        protected void computeInterpolatedStateAndDerivatives(final double theta, final double oneMinusThetaH) {<a name="line.186"></a>
+<FONT color="green">187</FONT>    <a name="line.187"></a>
+<FONT color="green">188</FONT>            final double x = interpolatedTime - referenceTime;<a name="line.188"></a>
+<FONT color="green">189</FONT>            final double normalizedAbscissa = x / scalingH;<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>            Arrays.fill(stateVariation, 0.0);<a name="line.191"></a>
+<FONT color="green">192</FONT>            Arrays.fill(interpolatedDerivatives, 0.0);<a name="line.192"></a>
+<FONT color="green">193</FONT>    <a name="line.193"></a>
+<FONT color="green">194</FONT>            // apply Taylor formula from high order to low order,<a name="line.194"></a>
+<FONT color="green">195</FONT>            // for the sake of numerical accuracy<a name="line.195"></a>
+<FONT color="green">196</FONT>            final double[][] nData = nordsieck.getDataRef();<a name="line.196"></a>
+<FONT color="green">197</FONT>            for (int i = nData.length - 1; i &gt;= 0; --i) {<a name="line.197"></a>
+<FONT color="green">198</FONT>                final int order = i + 2;<a name="line.198"></a>
+<FONT color="green">199</FONT>                final double[] nDataI = nData[i];<a name="line.199"></a>
+<FONT color="green">200</FONT>                final double power = Math.pow(normalizedAbscissa, order);<a name="line.200"></a>
+<FONT color="green">201</FONT>                for (int j = 0; j &lt; nDataI.length; ++j) {<a name="line.201"></a>
+<FONT color="green">202</FONT>                    final double d = nDataI[j] * power;<a name="line.202"></a>
+<FONT color="green">203</FONT>                    stateVariation[j]          += d;<a name="line.203"></a>
+<FONT color="green">204</FONT>                    interpolatedDerivatives[j] += order * d;<a name="line.204"></a>
+<FONT color="green">205</FONT>                }<a name="line.205"></a>
+<FONT color="green">206</FONT>            }<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>            for (int j = 0; j &lt; currentState.length; ++j) {<a name="line.208"></a>
+<FONT color="green">209</FONT>                stateVariation[j] += scaled[j] * normalizedAbscissa;<a name="line.209"></a>
+<FONT color="green">210</FONT>                interpolatedState[j] = currentState[j] + stateVariation[j];<a name="line.210"></a>
+<FONT color="green">211</FONT>                interpolatedDerivatives[j] =<a name="line.211"></a>
+<FONT color="green">212</FONT>                    (interpolatedDerivatives[j] + scaled[j] * normalizedAbscissa) / x;<a name="line.212"></a>
+<FONT color="green">213</FONT>            }<a name="line.213"></a>
+<FONT color="green">214</FONT>    <a name="line.214"></a>
+<FONT color="green">215</FONT>        }<a name="line.215"></a>
+<FONT color="green">216</FONT>    <a name="line.216"></a>
+<FONT color="green">217</FONT>        /** {@inheritDoc} */<a name="line.217"></a>
+<FONT color="green">218</FONT>        @Override<a name="line.218"></a>
+<FONT color="green">219</FONT>        public void writeExternal(final ObjectOutput out)<a name="line.219"></a>
+<FONT color="green">220</FONT>            throws IOException {<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>            // save the state of the base class<a name="line.222"></a>
+<FONT color="green">223</FONT>            writeBaseExternal(out);<a name="line.223"></a>
+<FONT color="green">224</FONT>    <a name="line.224"></a>
+<FONT color="green">225</FONT>            // save the local attributes<a name="line.225"></a>
+<FONT color="green">226</FONT>            out.writeDouble(scalingH);<a name="line.226"></a>
+<FONT color="green">227</FONT>            out.writeDouble(referenceTime);<a name="line.227"></a>
+<FONT color="green">228</FONT>    <a name="line.228"></a>
+<FONT color="green">229</FONT>            final int n = (currentState == null) ? -1 : currentState.length;<a name="line.229"></a>
+<FONT color="green">230</FONT>            if (scaled == null) {<a name="line.230"></a>
+<FONT color="green">231</FONT>                out.writeBoolean(false);<a name="line.231"></a>
+<FONT color="green">232</FONT>            } else {<a name="line.232"></a>
+<FONT color="green">233</FONT>                out.writeBoolean(true);<a name="line.233"></a>
+<FONT color="green">234</FONT>                for (int j = 0; j &lt; n; ++j) {<a name="line.234"></a>
+<FONT color="green">235</FONT>                    out.writeDouble(scaled[j]);<a name="line.235"></a>
+<FONT color="green">236</FONT>                }<a name="line.236"></a>
+<FONT color="green">237</FONT>            }<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>            if (nordsieck == null) {<a name="line.239"></a>
+<FONT color="green">240</FONT>                out.writeBoolean(false);<a name="line.240"></a>
+<FONT color="green">241</FONT>            } else {<a name="line.241"></a>
+<FONT color="green">242</FONT>                out.writeBoolean(true);<a name="line.242"></a>
+<FONT color="green">243</FONT>                out.writeObject(nordsieck);<a name="line.243"></a>
+<FONT color="green">244</FONT>            }<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>            // we don't save state variation, it will be recomputed<a name="line.246"></a>
+<FONT color="green">247</FONT>    <a name="line.247"></a>
+<FONT color="green">248</FONT>        }<a name="line.248"></a>
+<FONT color="green">249</FONT>    <a name="line.249"></a>
+<FONT color="green">250</FONT>        /** {@inheritDoc} */<a name="line.250"></a>
+<FONT color="green">251</FONT>        @Override<a name="line.251"></a>
+<FONT color="green">252</FONT>        public void readExternal(final ObjectInput in)<a name="line.252"></a>
+<FONT color="green">253</FONT>            throws IOException, ClassNotFoundException {<a name="line.253"></a>
+<FONT color="green">254</FONT>    <a name="line.254"></a>
+<FONT color="green">255</FONT>            // read the base class<a name="line.255"></a>
+<FONT color="green">256</FONT>            final double t = readBaseExternal(in);<a name="line.256"></a>
+<FONT color="green">257</FONT>    <a name="line.257"></a>
+<FONT color="green">258</FONT>            // read the local attributes<a name="line.258"></a>
+<FONT color="green">259</FONT>            scalingH      = in.readDouble();<a name="line.259"></a>
+<FONT color="green">260</FONT>            referenceTime = in.readDouble();<a name="line.260"></a>
+<FONT color="green">261</FONT>    <a name="line.261"></a>
+<FONT color="green">262</FONT>            final int n = (currentState == null) ? -1 : currentState.length;<a name="line.262"></a>
+<FONT color="green">263</FONT>            final boolean hasScaled = in.readBoolean();<a name="line.263"></a>
+<FONT color="green">264</FONT>            if (hasScaled) {<a name="line.264"></a>
+<FONT color="green">265</FONT>                scaled = new double[n];<a name="line.265"></a>
+<FONT color="green">266</FONT>                for (int j = 0; j &lt; n; ++j) {<a name="line.266"></a>
+<FONT color="green">267</FONT>                    scaled[j] = in.readDouble();<a name="line.267"></a>
+<FONT color="green">268</FONT>                }<a name="line.268"></a>
+<FONT color="green">269</FONT>            } else {<a name="line.269"></a>
+<FONT color="green">270</FONT>                scaled = null;<a name="line.270"></a>
+<FONT color="green">271</FONT>            }<a name="line.271"></a>
+<FONT color="green">272</FONT>    <a name="line.272"></a>
+<FONT color="green">273</FONT>            final boolean hasNordsieck = in.readBoolean();<a name="line.273"></a>
+<FONT color="green">274</FONT>            if (hasNordsieck) {<a name="line.274"></a>
+<FONT color="green">275</FONT>                nordsieck = (Array2DRowRealMatrix) in.readObject();<a name="line.275"></a>
+<FONT color="green">276</FONT>            } else {<a name="line.276"></a>
+<FONT color="green">277</FONT>                nordsieck = null;<a name="line.277"></a>
+<FONT color="green">278</FONT>            }<a name="line.278"></a>
+<FONT color="green">279</FONT>    <a name="line.279"></a>
+<FONT color="green">280</FONT>            if (hasScaled &amp;&amp; hasNordsieck) {<a name="line.280"></a>
+<FONT color="green">281</FONT>                // we can now set the interpolated time and state<a name="line.281"></a>
+<FONT color="green">282</FONT>                stateVariation = new double[n];<a name="line.282"></a>
+<FONT color="green">283</FONT>                setInterpolatedTime(t);<a name="line.283"></a>
+<FONT color="green">284</FONT>            } else {<a name="line.284"></a>
+<FONT color="green">285</FONT>                stateVariation = null;<a name="line.285"></a>
+<FONT color="green">286</FONT>            }<a name="line.286"></a>
+<FONT color="green">287</FONT>    <a name="line.287"></a>
+<FONT color="green">288</FONT>        }<a name="line.288"></a>
+<FONT color="green">289</FONT>    <a name="line.289"></a>
+<FONT color="green">290</FONT>    }<a name="line.290"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/sampling/StepHandler.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,144 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.sampling;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This interface represents a handler that should be called after<a name="line.23"></a>
+<FONT color="green">024</FONT>     * each successful step.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;The ODE integrators compute the evolution of the state vector at<a name="line.26"></a>
+<FONT color="green">027</FONT>     * some grid points that depend on their own internal algorithm. Once<a name="line.27"></a>
+<FONT color="green">028</FONT>     * they have found a new grid point (possibly after having computed<a name="line.28"></a>
+<FONT color="green">029</FONT>     * several evaluation of the derivative at intermediate points), they<a name="line.29"></a>
+<FONT color="green">030</FONT>     * provide it to objects implementing this interface. These objects<a name="line.30"></a>
+<FONT color="green">031</FONT>     * typically either ignore the intermediate steps and wait for the<a name="line.31"></a>
+<FONT color="green">032</FONT>     * last one, store the points in an ephemeris, or forward them to<a name="line.32"></a>
+<FONT color="green">033</FONT>     * specialized processing or output methods.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     *<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @see org.apache.commons.math.ode.FirstOrderIntegrator<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @see org.apache.commons.math.ode.SecondOrderIntegrator<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @see StepInterpolator<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @since 1.2<a name="line.39"></a>
+<FONT color="green">040</FONT>     */<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>    public interface StepHandler {<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>      /** Determines whether this handler needs dense output.<a name="line.44"></a>
+<FONT color="green">045</FONT>       * &lt;p&gt;This method allows the integrator to avoid performing extra<a name="line.45"></a>
+<FONT color="green">046</FONT>       * computation if the handler does not need dense output. If this<a name="line.46"></a>
+<FONT color="green">047</FONT>       * method returns false, the integrator will call the {@link<a name="line.47"></a>
+<FONT color="green">048</FONT>       * #handleStep} method with a {@link DummyStepInterpolator} rather<a name="line.48"></a>
+<FONT color="green">049</FONT>       * than a custom interpolator.&lt;/p&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>       * @return true if the handler needs dense output<a name="line.50"></a>
+<FONT color="green">051</FONT>       */<a name="line.51"></a>
+<FONT color="green">052</FONT>      boolean requiresDenseOutput();<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>      /** Reset the step handler.<a name="line.54"></a>
+<FONT color="green">055</FONT>       * Initialize the internal data as required before the first step is<a name="line.55"></a>
+<FONT color="green">056</FONT>       * handled.<a name="line.56"></a>
+<FONT color="green">057</FONT>       */<a name="line.57"></a>
+<FONT color="green">058</FONT>      void reset();<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>      /**<a name="line.60"></a>
+<FONT color="green">061</FONT>       * Handle the last accepted step<a name="line.61"></a>
+<FONT color="green">062</FONT>       * @param interpolator interpolator for the last accepted step. For<a name="line.62"></a>
+<FONT color="green">063</FONT>       * efficiency purposes, the various integrators reuse the same<a name="line.63"></a>
+<FONT color="green">064</FONT>       * object on each call, so if the instance wants to keep it across<a name="line.64"></a>
+<FONT color="green">065</FONT>       * all calls (for example to provide at the end of the integration a<a name="line.65"></a>
+<FONT color="green">066</FONT>       * continuous model valid throughout the integration range, as the<a name="line.66"></a>
+<FONT color="green">067</FONT>       * {@link org.apache.commons.math.ode.ContinuousOutputModel<a name="line.67"></a>
+<FONT color="green">068</FONT>       * ContinuousOutputModel} class does), it should build a local copy<a name="line.68"></a>
+<FONT color="green">069</FONT>       * using the clone method of the interpolator and store this copy.<a name="line.69"></a>
+<FONT color="green">070</FONT>       * Keeping only a reference to the interpolator and reusing it will<a name="line.70"></a>
+<FONT color="green">071</FONT>       * result in unpredictable behavior (potentially crashing the application).<a name="line.71"></a>
+<FONT color="green">072</FONT>       * @param isLast true if the step is the last one<a name="line.72"></a>
+<FONT color="green">073</FONT>       * @throws DerivativeException this exception is propagated to the<a name="line.73"></a>
+<FONT color="green">074</FONT>       * caller if the underlying user function triggers one<a name="line.74"></a>
+<FONT color="green">075</FONT>       */<a name="line.75"></a>
+<FONT color="green">076</FONT>      void handleStep(StepInterpolator interpolator, boolean isLast) throws DerivativeException;<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>    }<a name="line.78"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/sampling/StepInterpolator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,198 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.sampling;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Externalizable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /** This interface represents an interpolator over the last step<a name="line.24"></a>
+<FONT color="green">025</FONT>     * during an ODE integration.<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;The various ODE integrators provide objects implementing this<a name="line.27"></a>
+<FONT color="green">028</FONT>     * interface to the step handlers. These objects are often custom<a name="line.28"></a>
+<FONT color="green">029</FONT>     * objects tightly bound to the integrator internal algorithms. The<a name="line.29"></a>
+<FONT color="green">030</FONT>     * handlers can use these objects to retrieve the state vector at<a name="line.30"></a>
+<FONT color="green">031</FONT>     * intermediate times between the previous and the current grid points<a name="line.31"></a>
+<FONT color="green">032</FONT>     * (this feature is often called dense output).&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;p&gt;One important thing to note is that the step handlers may be so<a name="line.33"></a>
+<FONT color="green">034</FONT>     * tightly bound to the integrators that they often share some internal<a name="line.34"></a>
+<FONT color="green">035</FONT>     * state arrays. This imply that one should &lt;em&gt;never&lt;/em&gt; use a direct<a name="line.35"></a>
+<FONT color="green">036</FONT>     * reference to a step interpolator outside of the step handler, either<a name="line.36"></a>
+<FONT color="green">037</FONT>     * for future use or for use in another thread. If such a need arise, the<a name="line.37"></a>
+<FONT color="green">038</FONT>     * step interpolator &lt;em&gt;must&lt;/em&gt; be copied using the dedicated<a name="line.38"></a>
+<FONT color="green">039</FONT>     * {@link #copy()} method.<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;/p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     *<a name="line.41"></a>
+<FONT color="green">042</FONT>     * @see org.apache.commons.math.ode.FirstOrderIntegrator<a name="line.42"></a>
+<FONT color="green">043</FONT>     * @see org.apache.commons.math.ode.SecondOrderIntegrator<a name="line.43"></a>
+<FONT color="green">044</FONT>     * @see StepHandler<a name="line.44"></a>
+<FONT color="green">045</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.45"></a>
+<FONT color="green">046</FONT>     * @since 1.2<a name="line.46"></a>
+<FONT color="green">047</FONT>     */<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>    public interface StepInterpolator extends Externalizable {<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>      /**<a name="line.51"></a>
+<FONT color="green">052</FONT>       * Get the previous grid point time.<a name="line.52"></a>
+<FONT color="green">053</FONT>       * @return previous grid point time<a name="line.53"></a>
+<FONT color="green">054</FONT>       */<a name="line.54"></a>
+<FONT color="green">055</FONT>      double getPreviousTime();<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>      /**<a name="line.57"></a>
+<FONT color="green">058</FONT>       * Get the current grid point time.<a name="line.58"></a>
+<FONT color="green">059</FONT>       * @return current grid point time<a name="line.59"></a>
+<FONT color="green">060</FONT>       */<a name="line.60"></a>
+<FONT color="green">061</FONT>      double getCurrentTime();<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>      /**<a name="line.63"></a>
+<FONT color="green">064</FONT>       * Get the time of the interpolated point.<a name="line.64"></a>
+<FONT color="green">065</FONT>       * If {@link #setInterpolatedTime} has not been called, it returns<a name="line.65"></a>
+<FONT color="green">066</FONT>       * the current grid point time.<a name="line.66"></a>
+<FONT color="green">067</FONT>       * @return interpolation point time<a name="line.67"></a>
+<FONT color="green">068</FONT>       */<a name="line.68"></a>
+<FONT color="green">069</FONT>      double getInterpolatedTime();<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>      /**<a name="line.71"></a>
+<FONT color="green">072</FONT>       * Set the time of the interpolated point.<a name="line.72"></a>
+<FONT color="green">073</FONT>       * &lt;p&gt;Setting the time outside of the current step is now allowed, but<a name="line.73"></a>
+<FONT color="green">074</FONT>       * should be used with care since the accuracy of the interpolator will<a name="line.74"></a>
+<FONT color="green">075</FONT>       * probably be very poor far from this step. This allowance has been<a name="line.75"></a>
+<FONT color="green">076</FONT>       * added to simplify implementation of search algorithms near the<a name="line.76"></a>
+<FONT color="green">077</FONT>       * step endpoints.&lt;/p&gt;<a name="line.77"></a>
+<FONT color="green">078</FONT>       * &lt;p&gt;Setting the time changes the instance internal state. If a<a name="line.78"></a>
+<FONT color="green">079</FONT>       * specific state must be preserved, a copy of the instance must be<a name="line.79"></a>
+<FONT color="green">080</FONT>       * created using {@link #copy()}.&lt;/p&gt;<a name="line.80"></a>
+<FONT color="green">081</FONT>       * @param time time of the interpolated point<a name="line.81"></a>
+<FONT color="green">082</FONT>       */<a name="line.82"></a>
+<FONT color="green">083</FONT>      void setInterpolatedTime(double time);<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>      /**<a name="line.85"></a>
+<FONT color="green">086</FONT>       * Get the state vector of the interpolated point.<a name="line.86"></a>
+<FONT color="green">087</FONT>       * &lt;p&gt;The returned vector is a reference to a reused array, so<a name="line.87"></a>
+<FONT color="green">088</FONT>       * it should not be modified and it should be copied if it needs<a name="line.88"></a>
+<FONT color="green">089</FONT>       * to be preserved across several calls.&lt;/p&gt;<a name="line.89"></a>
+<FONT color="green">090</FONT>       * @return state vector at time {@link #getInterpolatedTime}<a name="line.90"></a>
+<FONT color="green">091</FONT>       * @see #getInterpolatedDerivatives()<a name="line.91"></a>
+<FONT color="green">092</FONT>       * @throws DerivativeException if this call induces an automatic<a name="line.92"></a>
+<FONT color="green">093</FONT>       * step finalization that throws one<a name="line.93"></a>
+<FONT color="green">094</FONT>       */<a name="line.94"></a>
+<FONT color="green">095</FONT>      double[] getInterpolatedState() throws DerivativeException;<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>      /**<a name="line.97"></a>
+<FONT color="green">098</FONT>       * Get the derivatives of the state vector of the interpolated point.<a name="line.98"></a>
+<FONT color="green">099</FONT>       * &lt;p&gt;The returned vector is a reference to a reused array, so<a name="line.99"></a>
+<FONT color="green">100</FONT>       * it should not be modified and it should be copied if it needs<a name="line.100"></a>
+<FONT color="green">101</FONT>       * to be preserved across several calls.&lt;/p&gt;<a name="line.101"></a>
+<FONT color="green">102</FONT>       * @return derivatives of the state vector at time {@link #getInterpolatedTime}<a name="line.102"></a>
+<FONT color="green">103</FONT>       * @see #getInterpolatedState()<a name="line.103"></a>
+<FONT color="green">104</FONT>       * @throws DerivativeException if this call induces an automatic<a name="line.104"></a>
+<FONT color="green">105</FONT>       * step finalization that throws one<a name="line.105"></a>
+<FONT color="green">106</FONT>       * @since 2.0<a name="line.106"></a>
+<FONT color="green">107</FONT>       */<a name="line.107"></a>
+<FONT color="green">108</FONT>      double[] getInterpolatedDerivatives() throws DerivativeException;<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>      /** Check if the natural integration direction is forward.<a name="line.110"></a>
+<FONT color="green">111</FONT>       * &lt;p&gt;This method provides the integration direction as specified by<a name="line.111"></a>
+<FONT color="green">112</FONT>       * the integrator itself, it avoid some nasty problems in<a name="line.112"></a>
+<FONT color="green">113</FONT>       * degenerated cases like null steps due to cancellation at step<a name="line.113"></a>
+<FONT color="green">114</FONT>       * initialization, step control or discrete events<a name="line.114"></a>
+<FONT color="green">115</FONT>       * triggering.&lt;/p&gt;<a name="line.115"></a>
+<FONT color="green">116</FONT>       * @return true if the integration variable (time) increases during<a name="line.116"></a>
+<FONT color="green">117</FONT>       * integration<a name="line.117"></a>
+<FONT color="green">118</FONT>       */<a name="line.118"></a>
+<FONT color="green">119</FONT>      boolean isForward();<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>      /** Copy the instance.<a name="line.121"></a>
+<FONT color="green">122</FONT>       * &lt;p&gt;The copied instance is guaranteed to be independent from the<a name="line.122"></a>
+<FONT color="green">123</FONT>       * original one. Both can be used with different settings for<a name="line.123"></a>
+<FONT color="green">124</FONT>       * interpolated time without any side effect.&lt;/p&gt;<a name="line.124"></a>
+<FONT color="green">125</FONT>       * @return a deep copy of the instance, which can be used independently.<a name="line.125"></a>
+<FONT color="green">126</FONT>       * @throws DerivativeException if this call induces an automatic<a name="line.126"></a>
+<FONT color="green">127</FONT>       * step finalization that throws one<a name="line.127"></a>
+<FONT color="green">128</FONT>       * @see #setInterpolatedTime(double)<a name="line.128"></a>
+<FONT color="green">129</FONT>       */<a name="line.129"></a>
+<FONT color="green">130</FONT>       StepInterpolator copy() throws DerivativeException;<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>    }<a name="line.132"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/ode/sampling/StepNormalizer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,226 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.ode.sampling;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ode.DerivativeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This class wraps an object implementing {@link FixedStepHandler}<a name="line.23"></a>
+<FONT color="green">024</FONT>     * into a {@link StepHandler}.<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;This wrapper allows to use fixed step handlers with general<a name="line.26"></a>
+<FONT color="green">027</FONT>     * integrators which cannot guaranty their integration steps will<a name="line.27"></a>
+<FONT color="green">028</FONT>     * remain constant and therefore only accept general step<a name="line.28"></a>
+<FONT color="green">029</FONT>     * handlers.&lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;The stepsize used is selected at construction time. The {@link<a name="line.31"></a>
+<FONT color="green">032</FONT>     * FixedStepHandler#handleStep handleStep} method of the underlying<a name="line.32"></a>
+<FONT color="green">033</FONT>     * {@link FixedStepHandler} object is called at the beginning time of<a name="line.33"></a>
+<FONT color="green">034</FONT>     * the integration t0 and also at times t0+h, t0+2h, ... If the<a name="line.34"></a>
+<FONT color="green">035</FONT>     * integration range is an integer multiple of the stepsize, then the<a name="line.35"></a>
+<FONT color="green">036</FONT>     * last point handled will be the endpoint of the integration tend, if<a name="line.36"></a>
+<FONT color="green">037</FONT>     * not, the last point will belong to the interval [tend - h ;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * tend].&lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     *<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;p&gt;There is no constraint on the integrator, it can use any<a name="line.40"></a>
+<FONT color="green">041</FONT>     * timestep it needs (time steps longer or shorter than the fixed time<a name="line.41"></a>
+<FONT color="green">042</FONT>     * step and non-integer ratios are all allowed).&lt;/p&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     *<a name="line.43"></a>
+<FONT color="green">044</FONT>     * @see StepHandler<a name="line.44"></a>
+<FONT color="green">045</FONT>     * @see FixedStepHandler<a name="line.45"></a>
+<FONT color="green">046</FONT>     * @version $Revision: 811833 $ $Date: 2009-09-06 12:27:50 -0400 (Sun, 06 Sep 2009) $<a name="line.46"></a>
+<FONT color="green">047</FONT>     * @since 1.2<a name="line.47"></a>
+<FONT color="green">048</FONT>     */<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>    public class StepNormalizer implements StepHandler {<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /** Fixed time step. */<a name="line.52"></a>
+<FONT color="green">053</FONT>        private double h;<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** Underlying step handler. */<a name="line.55"></a>
+<FONT color="green">056</FONT>        private final FixedStepHandler handler;<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /** Last step time. */<a name="line.58"></a>
+<FONT color="green">059</FONT>        private double lastTime;<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /** Last State vector. */<a name="line.61"></a>
+<FONT color="green">062</FONT>        private double[] lastState;<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /** Last Derivatives vector. */<a name="line.64"></a>
+<FONT color="green">065</FONT>        private double[] lastDerivatives;<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /** Integration direction indicator. */<a name="line.67"></a>
+<FONT color="green">068</FONT>        private boolean forward;<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /** Simple constructor.<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param h fixed time step (sign is not used)<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param handler fixed time step handler to wrap<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        public StepNormalizer(final double h, final FixedStepHandler handler) {<a name="line.74"></a>
+<FONT color="green">075</FONT>            this.h       = Math.abs(h);<a name="line.75"></a>
+<FONT color="green">076</FONT>            this.handler = handler;<a name="line.76"></a>
+<FONT color="green">077</FONT>            reset();<a name="line.77"></a>
+<FONT color="green">078</FONT>        }<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /** Determines whether this handler needs dense output.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * This handler needs dense output in order to provide data at<a name="line.81"></a>
+<FONT color="green">082</FONT>         * regularly spaced steps regardless of the steps the integrator<a name="line.82"></a>
+<FONT color="green">083</FONT>         * uses, so this method always returns true.<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @return always true<a name="line.84"></a>
+<FONT color="green">085</FONT>         */<a name="line.85"></a>
+<FONT color="green">086</FONT>        public boolean requiresDenseOutput() {<a name="line.86"></a>
+<FONT color="green">087</FONT>            return true;<a name="line.87"></a>
+<FONT color="green">088</FONT>        }<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>        /** Reset the step handler.<a name="line.90"></a>
+<FONT color="green">091</FONT>         * Initialize the internal data as required before the first step is<a name="line.91"></a>
+<FONT color="green">092</FONT>         * handled.<a name="line.92"></a>
+<FONT color="green">093</FONT>         */<a name="line.93"></a>
+<FONT color="green">094</FONT>        public void reset() {<a name="line.94"></a>
+<FONT color="green">095</FONT>            lastTime        = Double.NaN;<a name="line.95"></a>
+<FONT color="green">096</FONT>            lastState       = null;<a name="line.96"></a>
+<FONT color="green">097</FONT>            lastDerivatives = null;<a name="line.97"></a>
+<FONT color="green">098</FONT>            forward         = true;<a name="line.98"></a>
+<FONT color="green">099</FONT>        }<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /**<a name="line.101"></a>
+<FONT color="green">102</FONT>         * Handle the last accepted step<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @param interpolator interpolator for the last accepted step. For<a name="line.103"></a>
+<FONT color="green">104</FONT>         * efficiency purposes, the various integrators reuse the same<a name="line.104"></a>
+<FONT color="green">105</FONT>         * object on each call, so if the instance wants to keep it across<a name="line.105"></a>
+<FONT color="green">106</FONT>         * all calls (for example to provide at the end of the integration a<a name="line.106"></a>
+<FONT color="green">107</FONT>         * continuous model valid throughout the integration range), it<a name="line.107"></a>
+<FONT color="green">108</FONT>         * should build a local copy using the clone method and store this<a name="line.108"></a>
+<FONT color="green">109</FONT>         * copy.<a name="line.109"></a>
+<FONT color="green">110</FONT>         * @param isLast true if the step is the last one<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @throws DerivativeException this exception is propagated to the<a name="line.111"></a>
+<FONT color="green">112</FONT>         * caller if the underlying user function triggers one<a name="line.112"></a>
+<FONT color="green">113</FONT>         */<a name="line.113"></a>
+<FONT color="green">114</FONT>        public void handleStep(final StepInterpolator interpolator, final boolean isLast)<a name="line.114"></a>
+<FONT color="green">115</FONT>            throws DerivativeException {<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>            if (lastState == null) {<a name="line.117"></a>
+<FONT color="green">118</FONT>    <a name="line.118"></a>
+<FONT color="green">119</FONT>                lastTime = interpolator.getPreviousTime();<a name="line.119"></a>
+<FONT color="green">120</FONT>                interpolator.setInterpolatedTime(lastTime);<a name="line.120"></a>
+<FONT color="green">121</FONT>                lastState = interpolator.getInterpolatedState().clone();<a name="line.121"></a>
+<FONT color="green">122</FONT>                lastDerivatives = interpolator.getInterpolatedDerivatives().clone();<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>                // take the integration direction into account<a name="line.124"></a>
+<FONT color="green">125</FONT>                forward = interpolator.getCurrentTime() &gt;= lastTime;<a name="line.125"></a>
+<FONT color="green">126</FONT>                if (! forward) {<a name="line.126"></a>
+<FONT color="green">127</FONT>                    h = -h;<a name="line.127"></a>
+<FONT color="green">128</FONT>                }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>            }<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>            double nextTime = lastTime + h;<a name="line.132"></a>
+<FONT color="green">133</FONT>            boolean nextInStep = forward ^ (nextTime &gt; interpolator.getCurrentTime());<a name="line.133"></a>
+<FONT color="green">134</FONT>            while (nextInStep) {<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>                // output the stored previous step<a name="line.136"></a>
+<FONT color="green">137</FONT>                handler.handleStep(lastTime, lastState, lastDerivatives, false);<a name="line.137"></a>
+<FONT color="green">138</FONT>    <a name="line.138"></a>
+<FONT color="green">139</FONT>                // store the next step<a name="line.139"></a>
+<FONT color="green">140</FONT>                lastTime = nextTime;<a name="line.140"></a>
+<FONT color="green">141</FONT>                interpolator.setInterpolatedTime(lastTime);<a name="line.141"></a>
+<FONT color="green">142</FONT>                System.arraycopy(interpolator.getInterpolatedState(), 0,<a name="line.142"></a>
+<FONT color="green">143</FONT>                                 lastState, 0, lastState.length);<a name="line.143"></a>
+<FONT color="green">144</FONT>                System.arraycopy(interpolator.getInterpolatedDerivatives(), 0,<a name="line.144"></a>
+<FONT color="green">145</FONT>                                 lastDerivatives, 0, lastDerivatives.length);<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>                nextTime  += h;<a name="line.147"></a>
+<FONT color="green">148</FONT>                nextInStep = forward ^ (nextTime &gt; interpolator.getCurrentTime());<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>            }<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>            if (isLast) {<a name="line.152"></a>
+<FONT color="green">153</FONT>                // there will be no more steps,<a name="line.153"></a>
+<FONT color="green">154</FONT>                // the stored one should be flagged as being the last<a name="line.154"></a>
+<FONT color="green">155</FONT>                handler.handleStep(lastTime, lastState, lastDerivatives, true);<a name="line.155"></a>
+<FONT color="green">156</FONT>            }<a name="line.156"></a>
+<FONT color="green">157</FONT>    <a name="line.157"></a>
+<FONT color="green">158</FONT>        }<a name="line.158"></a>
+<FONT color="green">159</FONT>    <a name="line.159"></a>
+<FONT color="green">160</FONT>    }<a name="line.160"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/DifferentiableMultivariateRealOptimizer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,177 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.analysis.DifferentiableMultivariateRealFunction;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * This interface represents an optimization algorithm for {@link DifferentiableMultivariateRealFunction<a name="line.24"></a>
+<FONT color="green">025</FONT>     * scalar differentiable objective functions}.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;Optimization algorithms find the input point set that either {@link GoalType<a name="line.26"></a>
+<FONT color="green">027</FONT>     * maximize or minimize} an objective function.&lt;/p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @see MultivariateRealOptimizer<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @see DifferentiableMultivariateVectorialOptimizer<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 2.0<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public interface DifferentiableMultivariateRealOptimizer {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Set the maximal number of iterations of the algorithm.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @param maxIterations maximal number of function calls<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        void setMaxIterations(int maxIterations);<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Get the maximal number of iterations of the algorithm.<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @return maximal number of iterations<a name="line.41"></a>
+<FONT color="green">042</FONT>         */<a name="line.42"></a>
+<FONT color="green">043</FONT>        int getMaxIterations();<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Get the number of iterations realized by the algorithm.<a name="line.45"></a>
+<FONT color="green">046</FONT>         * &lt;p&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>         * The number of evaluations corresponds to the last call to the<a name="line.47"></a>
+<FONT color="green">048</FONT>         * {@link #optimize(DifferentiableMultivariateRealFunction, GoalType, double[]) optimize}<a name="line.48"></a>
+<FONT color="green">049</FONT>         * method. It is 0 if the method has not been called yet.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * &lt;/p&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @return number of iterations<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        int getIterations();<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** Set the maximal number of functions evaluations.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param maxEvaluations maximal number of function evaluations<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        void setMaxEvaluations(int maxEvaluations);<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Get the maximal number of functions evaluations.<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @return maximal number of functions evaluations<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        int getMaxEvaluations();<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Get the number of evaluations of the objective function.<a name="line.65"></a>
+<FONT color="green">066</FONT>         * &lt;p&gt;<a name="line.66"></a>
+<FONT color="green">067</FONT>         * The number of evaluations corresponds to the last call to the<a name="line.67"></a>
+<FONT color="green">068</FONT>         * {@link #optimize(DifferentiableMultivariateRealFunction, GoalType, double[]) optimize}<a name="line.68"></a>
+<FONT color="green">069</FONT>         * method. It is 0 if the method has not been called yet.<a name="line.69"></a>
+<FONT color="green">070</FONT>         * &lt;/p&gt;<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @return number of evaluations of the objective function<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        int getEvaluations();<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /** Get the number of evaluations of the objective function gradient.<a name="line.75"></a>
+<FONT color="green">076</FONT>         * &lt;p&gt;<a name="line.76"></a>
+<FONT color="green">077</FONT>         * The number of evaluations corresponds to the last call to the<a name="line.77"></a>
+<FONT color="green">078</FONT>         * {@link #optimize(DifferentiableMultivariateRealFunction, GoalType, double[]) optimize}<a name="line.78"></a>
+<FONT color="green">079</FONT>         * method. It is 0 if the method has not been called yet.<a name="line.79"></a>
+<FONT color="green">080</FONT>         * &lt;/p&gt;<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @return number of evaluations of the objective function gradient<a name="line.81"></a>
+<FONT color="green">082</FONT>         */<a name="line.82"></a>
+<FONT color="green">083</FONT>        int getGradientEvaluations();<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>        /** Set the convergence checker.<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @param checker object to use to check for convergence<a name="line.86"></a>
+<FONT color="green">087</FONT>         */<a name="line.87"></a>
+<FONT color="green">088</FONT>        void setConvergenceChecker(RealConvergenceChecker checker);<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>        /** Get the convergence checker.<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @return object used to check for convergence<a name="line.91"></a>
+<FONT color="green">092</FONT>         */<a name="line.92"></a>
+<FONT color="green">093</FONT>        RealConvergenceChecker getConvergenceChecker();<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /** Optimizes an objective function.<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @param f objective function<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @param goalType type of optimization goal: either {@link GoalType#MAXIMIZE}<a name="line.97"></a>
+<FONT color="green">098</FONT>         * or {@link GoalType#MINIMIZE}<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @param startPoint the start point for optimization<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @return the point/value pair giving the optimal value for objective function<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @exception FunctionEvaluationException if the objective function throws one during<a name="line.101"></a>
+<FONT color="green">102</FONT>         * the search<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @exception OptimizationException if the algorithm failed to converge<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @exception IllegalArgumentException if the start point dimension is wrong<a name="line.104"></a>
+<FONT color="green">105</FONT>         */<a name="line.105"></a>
+<FONT color="green">106</FONT>        RealPointValuePair optimize(DifferentiableMultivariateRealFunction f,<a name="line.106"></a>
+<FONT color="green">107</FONT>                                      GoalType goalType,<a name="line.107"></a>
+<FONT color="green">108</FONT>                                      double[] startPoint)<a name="line.108"></a>
+<FONT color="green">109</FONT>            throws FunctionEvaluationException, OptimizationException, IllegalArgumentException;<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>    }<a name="line.111"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/DifferentiableMultivariateVectorialOptimizer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,180 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.analysis.DifferentiableMultivariateVectorialFunction;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * This interface represents an optimization algorithm for {@link DifferentiableMultivariateVectorialFunction<a name="line.24"></a>
+<FONT color="green">025</FONT>     * vectorial differentiable objective functions}.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;Optimization algorithms find the input point set that either {@link GoalType<a name="line.26"></a>
+<FONT color="green">027</FONT>     * maximize or minimize} an objective function.&lt;/p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @see MultivariateRealOptimizer<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @see DifferentiableMultivariateRealOptimizer<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 2.0<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public interface DifferentiableMultivariateVectorialOptimizer {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Set the maximal number of iterations of the algorithm.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @param maxIterations maximal number of function calls<a name="line.36"></a>
+<FONT color="green">037</FONT>         * .<a name="line.37"></a>
+<FONT color="green">038</FONT>         */<a name="line.38"></a>
+<FONT color="green">039</FONT>        void setMaxIterations(int maxIterations);<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Get the maximal number of iterations of the algorithm.<a name="line.41"></a>
+<FONT color="green">042</FONT>          * @return maximal number of iterations<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        int getMaxIterations();<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** Get the number of iterations realized by the algorithm.<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @return number of iterations<a name="line.47"></a>
+<FONT color="green">048</FONT>        */<a name="line.48"></a>
+<FONT color="green">049</FONT>       int getIterations();<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>       /** Set the maximal number of functions evaluations.<a name="line.51"></a>
+<FONT color="green">052</FONT>        * @param maxEvaluations maximal number of function evaluations<a name="line.52"></a>
+<FONT color="green">053</FONT>        */<a name="line.53"></a>
+<FONT color="green">054</FONT>       void setMaxEvaluations(int maxEvaluations);<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>       /** Get the maximal number of functions evaluations.<a name="line.56"></a>
+<FONT color="green">057</FONT>        * @return maximal number of functions evaluations<a name="line.57"></a>
+<FONT color="green">058</FONT>        */<a name="line.58"></a>
+<FONT color="green">059</FONT>       int getMaxEvaluations();<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /** Get the number of evaluations of the objective function.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * &lt;p&gt;<a name="line.62"></a>
+<FONT color="green">063</FONT>         * The number of evaluation correspond to the last call to the<a name="line.63"></a>
+<FONT color="green">064</FONT>         * {@link #optimize(DifferentiableMultivariateVectorialFunction,<a name="line.64"></a>
+<FONT color="green">065</FONT>         * double[], double[], double[]) optimize} method. It is 0 if<a name="line.65"></a>
+<FONT color="green">066</FONT>         * the method has not been called yet.<a name="line.66"></a>
+<FONT color="green">067</FONT>         * &lt;/p&gt;<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @return number of evaluations of the objective function<a name="line.68"></a>
+<FONT color="green">069</FONT>         */<a name="line.69"></a>
+<FONT color="green">070</FONT>        int getEvaluations();<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /** Get the number of evaluations of the objective function jacobian .<a name="line.72"></a>
+<FONT color="green">073</FONT>         * &lt;p&gt;<a name="line.73"></a>
+<FONT color="green">074</FONT>         * The number of evaluation correspond to the last call to the<a name="line.74"></a>
+<FONT color="green">075</FONT>         * {@link #optimize(DifferentiableMultivariateVectorialFunction,<a name="line.75"></a>
+<FONT color="green">076</FONT>         * double[], double[], double[]) optimize} method. It is 0 if<a name="line.76"></a>
+<FONT color="green">077</FONT>         * the method has not been called yet.<a name="line.77"></a>
+<FONT color="green">078</FONT>         * &lt;/p&gt;<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @return number of evaluations of the objective function jacobian<a name="line.79"></a>
+<FONT color="green">080</FONT>         */<a name="line.80"></a>
+<FONT color="green">081</FONT>        int getJacobianEvaluations();<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /** Set the convergence checker.<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @param checker object to use to check for convergence<a name="line.84"></a>
+<FONT color="green">085</FONT>         */<a name="line.85"></a>
+<FONT color="green">086</FONT>        void setConvergenceChecker(VectorialConvergenceChecker checker);<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>        /** Get the convergence checker.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @return object used to check for convergence<a name="line.89"></a>
+<FONT color="green">090</FONT>         */<a name="line.90"></a>
+<FONT color="green">091</FONT>        VectorialConvergenceChecker getConvergenceChecker();<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /** Optimizes an objective function.<a name="line.93"></a>
+<FONT color="green">094</FONT>         * &lt;p&gt;<a name="line.94"></a>
+<FONT color="green">095</FONT>         * Optimization is considered to be a weighted least-squares minimization.<a name="line.95"></a>
+<FONT color="green">096</FONT>         * The cost function to be minimized is<a name="line.96"></a>
+<FONT color="green">097</FONT>         * &amp;sum;weight&lt;sub&gt;i&lt;/sub&gt;(objective&lt;sub&gt;i&lt;/sub&gt;-target&lt;sub&gt;i&lt;/sub&gt;)&lt;sup&gt;2&lt;/sup&gt;<a name="line.97"></a>
+<FONT color="green">098</FONT>         * &lt;/p&gt;<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @param f objective function<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @param target target value for the objective functions at optimum<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @param weights weight for the least squares cost computation<a name="line.101"></a>
+<FONT color="green">102</FONT>         * @param startPoint the start point for optimization<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @return the point/value pair giving the optimal value for objective function<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @exception FunctionEvaluationException if the objective function throws one during<a name="line.104"></a>
+<FONT color="green">105</FONT>         * the search<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @exception OptimizationException if the algorithm failed to converge<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @exception IllegalArgumentException if the start point dimension is wrong<a name="line.107"></a>
+<FONT color="green">108</FONT>         */<a name="line.108"></a>
+<FONT color="green">109</FONT>        VectorialPointValuePair optimize(DifferentiableMultivariateVectorialFunction f,<a name="line.109"></a>
+<FONT color="green">110</FONT>                                         double[] target, double[] weights,<a name="line.110"></a>
+<FONT color="green">111</FONT>                                         double[] startPoint)<a name="line.111"></a>
+<FONT color="green">112</FONT>            throws FunctionEvaluationException, OptimizationException, IllegalArgumentException;<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>    }<a name="line.114"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/GoalType.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,101 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Goal type for an optimization problem.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @since 2.0<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public enum GoalType implements Serializable {<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>        /** Maximization goal. */<a name="line.29"></a>
+<FONT color="green">030</FONT>        MAXIMIZE,<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** Minimization goal. */<a name="line.32"></a>
+<FONT color="green">033</FONT>        MINIMIZE<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>    }<a name="line.35"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/LeastSquaresConverter.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,258 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.analysis.MultivariateRealFunction;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.analysis.MultivariateVectorialFunction;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.linear.RealMatrix;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /** This class converts {@link MultivariateVectorialFunction vectorial<a name="line.26"></a>
+<FONT color="green">027</FONT>     * objective functions} to {@link MultivariateRealFunction scalar objective functions}<a name="line.27"></a>
+<FONT color="green">028</FONT>     * when the goal is to minimize them.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * This class is mostly used when the vectorial objective function represents<a name="line.30"></a>
+<FONT color="green">031</FONT>     * a theoretical result computed from a point set applied to a model and<a name="line.31"></a>
+<FONT color="green">032</FONT>     * the models point must be adjusted to fit the theoretical result to some<a name="line.32"></a>
+<FONT color="green">033</FONT>     * reference observations. The observations may be obtained for example from<a name="line.33"></a>
+<FONT color="green">034</FONT>     * physical measurements whether the model is built from theoretical<a name="line.34"></a>
+<FONT color="green">035</FONT>     * considerations.<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * This class computes a possibly weighted squared sum of the residuals, which is<a name="line.38"></a>
+<FONT color="green">039</FONT>     * a scalar value. The residuals are the difference between the theoretical model<a name="line.39"></a>
+<FONT color="green">040</FONT>     * (i.e. the output of the vectorial objective function) and the observations. The<a name="line.40"></a>
+<FONT color="green">041</FONT>     * class implements the {@link MultivariateRealFunction} interface and can therefore be<a name="line.41"></a>
+<FONT color="green">042</FONT>     * minimized by any optimizer supporting scalar objectives functions.This is one way<a name="line.42"></a>
+<FONT color="green">043</FONT>     * to perform a least square estimation. There are other ways to do this without using<a name="line.43"></a>
+<FONT color="green">044</FONT>     * this converter, as some optimization algorithms directly support vectorial objective<a name="line.44"></a>
+<FONT color="green">045</FONT>     * functions.<a name="line.45"></a>
+<FONT color="green">046</FONT>     * &lt;/p&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     * &lt;p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     * This class support combination of residuals with or without weights and correlations.<a name="line.48"></a>
+<FONT color="green">049</FONT>     * &lt;/p&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>      *<a name="line.50"></a>
+<FONT color="green">051</FONT>     * @see MultivariateRealFunction<a name="line.51"></a>
+<FONT color="green">052</FONT>     * @see MultivariateVectorialFunction<a name="line.52"></a>
+<FONT color="green">053</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.53"></a>
+<FONT color="green">054</FONT>     * @since 2.0<a name="line.54"></a>
+<FONT color="green">055</FONT>     */<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>    public class LeastSquaresConverter implements MultivariateRealFunction {<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** Underlying vectorial function. */<a name="line.59"></a>
+<FONT color="green">060</FONT>        private final MultivariateVectorialFunction function;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** Observations to be compared to objective function to compute residuals. */<a name="line.62"></a>
+<FONT color="green">063</FONT>        private final double[] observations;<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Optional weights for the residuals. */<a name="line.65"></a>
+<FONT color="green">066</FONT>        private final double[] weights;<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /** Optional scaling matrix (weight and correlations) for the residuals. */<a name="line.68"></a>
+<FONT color="green">069</FONT>        private final RealMatrix scale;<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** Build a simple converter for uncorrelated residuals with the same weight.<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param function vectorial residuals function to wrap<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @param observations observations to be compared to objective function to compute residuals<a name="line.73"></a>
+<FONT color="green">074</FONT>         */<a name="line.74"></a>
+<FONT color="green">075</FONT>        public LeastSquaresConverter(final MultivariateVectorialFunction function,<a name="line.75"></a>
+<FONT color="green">076</FONT>                                     final double[] observations) {<a name="line.76"></a>
+<FONT color="green">077</FONT>            this.function     = function;<a name="line.77"></a>
+<FONT color="green">078</FONT>            this.observations = observations.clone();<a name="line.78"></a>
+<FONT color="green">079</FONT>            this.weights      = null;<a name="line.79"></a>
+<FONT color="green">080</FONT>            this.scale        = null;<a name="line.80"></a>
+<FONT color="green">081</FONT>        }<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /** Build a simple converter for uncorrelated residuals with the specific weights.<a name="line.83"></a>
+<FONT color="green">084</FONT>         * &lt;p&gt;<a name="line.84"></a>
+<FONT color="green">085</FONT>         * The scalar objective function value is computed as:<a name="line.85"></a>
+<FONT color="green">086</FONT>         * &lt;pre&gt;<a name="line.86"></a>
+<FONT color="green">087</FONT>         * objective = &amp;sum;weight&lt;sub&gt;i&lt;/sub&gt;(observation&lt;sub&gt;i&lt;/sub&gt;-objective&lt;sub&gt;i&lt;/sub&gt;)&lt;sup&gt;2&lt;/sup&gt;<a name="line.87"></a>
+<FONT color="green">088</FONT>         * &lt;/pre&gt;<a name="line.88"></a>
+<FONT color="green">089</FONT>         * &lt;/p&gt;<a name="line.89"></a>
+<FONT color="green">090</FONT>         * &lt;p&gt;<a name="line.90"></a>
+<FONT color="green">091</FONT>         * Weights can be used for example to combine residuals with different standard<a name="line.91"></a>
+<FONT color="green">092</FONT>         * deviations. As an example, consider a residuals array in which even elements<a name="line.92"></a>
+<FONT color="green">093</FONT>         * are angular measurements in degrees with a 0.01&amp;deg; standard deviation and<a name="line.93"></a>
+<FONT color="green">094</FONT>         * odd elements are distance measurements in meters with a 15m standard deviation.<a name="line.94"></a>
+<FONT color="green">095</FONT>         * In this case, the weights array should be initialized with value<a name="line.95"></a>
+<FONT color="green">096</FONT>         * 1.0/(0.01&lt;sup&gt;2&lt;/sup&gt;) in the even elements and 1.0/(15.0&lt;sup&gt;2&lt;/sup&gt;) in the<a name="line.96"></a>
+<FONT color="green">097</FONT>         * odd elements (i.e. reciprocals of variances).<a name="line.97"></a>
+<FONT color="green">098</FONT>         * &lt;/p&gt;<a name="line.98"></a>
+<FONT color="green">099</FONT>         * &lt;p&gt;<a name="line.99"></a>
+<FONT color="green">100</FONT>         * The array computed by the objective function, the observations array and the<a name="line.100"></a>
+<FONT color="green">101</FONT>         * weights array must have consistent sizes or a {@link FunctionEvaluationException} will be<a name="line.101"></a>
+<FONT color="green">102</FONT>         * triggered while computing the scalar objective.<a name="line.102"></a>
+<FONT color="green">103</FONT>         * &lt;/p&gt;<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @param function vectorial residuals function to wrap<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @param observations observations to be compared to objective function to compute residuals<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @param weights weights to apply to the residuals<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @exception IllegalArgumentException if the observations vector and the weights<a name="line.107"></a>
+<FONT color="green">108</FONT>         * vector dimensions don't match (objective function dimension is checked only when<a name="line.108"></a>
+<FONT color="green">109</FONT>         * the {@link #value(double[])} method is called)<a name="line.109"></a>
+<FONT color="green">110</FONT>         */<a name="line.110"></a>
+<FONT color="green">111</FONT>        public LeastSquaresConverter(final MultivariateVectorialFunction function,<a name="line.111"></a>
+<FONT color="green">112</FONT>                                     final double[] observations, final double[] weights)<a name="line.112"></a>
+<FONT color="green">113</FONT>            throws IllegalArgumentException {<a name="line.113"></a>
+<FONT color="green">114</FONT>            if (observations.length != weights.length) {<a name="line.114"></a>
+<FONT color="green">115</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.115"></a>
+<FONT color="green">116</FONT>                        "dimension mismatch {0} != {1}",<a name="line.116"></a>
+<FONT color="green">117</FONT>                        observations.length, weights.length);<a name="line.117"></a>
+<FONT color="green">118</FONT>            }<a name="line.118"></a>
+<FONT color="green">119</FONT>            this.function     = function;<a name="line.119"></a>
+<FONT color="green">120</FONT>            this.observations = observations.clone();<a name="line.120"></a>
+<FONT color="green">121</FONT>            this.weights      = weights.clone();<a name="line.121"></a>
+<FONT color="green">122</FONT>            this.scale        = null;<a name="line.122"></a>
+<FONT color="green">123</FONT>        }<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>        /** Build a simple converter for correlated residuals with the specific weights.<a name="line.125"></a>
+<FONT color="green">126</FONT>         * &lt;p&gt;<a name="line.126"></a>
+<FONT color="green">127</FONT>         * The scalar objective function value is computed as:<a name="line.127"></a>
+<FONT color="green">128</FONT>         * &lt;pre&gt;<a name="line.128"></a>
+<FONT color="green">129</FONT>         * objective = y&lt;sup&gt;T&lt;/sup&gt;y with y = scale&amp;times;(observation-objective)<a name="line.129"></a>
+<FONT color="green">130</FONT>         * &lt;/pre&gt;<a name="line.130"></a>
+<FONT color="green">131</FONT>         * &lt;/p&gt;<a name="line.131"></a>
+<FONT color="green">132</FONT>         * &lt;p&gt;<a name="line.132"></a>
+<FONT color="green">133</FONT>         * The array computed by the objective function, the observations array and the<a name="line.133"></a>
+<FONT color="green">134</FONT>         * the scaling matrix must have consistent sizes or a {@link FunctionEvaluationException}<a name="line.134"></a>
+<FONT color="green">135</FONT>         * will be triggered while computing the scalar objective.<a name="line.135"></a>
+<FONT color="green">136</FONT>         * &lt;/p&gt;<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @param function vectorial residuals function to wrap<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @param observations observations to be compared to objective function to compute residuals<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @param scale scaling matrix<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @exception IllegalArgumentException if the observations vector and the scale<a name="line.140"></a>
+<FONT color="green">141</FONT>         * matrix dimensions don't match (objective function dimension is checked only when<a name="line.141"></a>
+<FONT color="green">142</FONT>         * the {@link #value(double[])} method is called)<a name="line.142"></a>
+<FONT color="green">143</FONT>         */<a name="line.143"></a>
+<FONT color="green">144</FONT>        public LeastSquaresConverter(final MultivariateVectorialFunction function,<a name="line.144"></a>
+<FONT color="green">145</FONT>                                     final double[] observations, final RealMatrix scale)<a name="line.145"></a>
+<FONT color="green">146</FONT>            throws IllegalArgumentException {<a name="line.146"></a>
+<FONT color="green">147</FONT>            if (observations.length != scale.getColumnDimension()) {<a name="line.147"></a>
+<FONT color="green">148</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.148"></a>
+<FONT color="green">149</FONT>                        "dimension mismatch {0} != {1}",<a name="line.149"></a>
+<FONT color="green">150</FONT>                        observations.length, scale.getColumnDimension());<a name="line.150"></a>
+<FONT color="green">151</FONT>            }<a name="line.151"></a>
+<FONT color="green">152</FONT>            this.function     = function;<a name="line.152"></a>
+<FONT color="green">153</FONT>            this.observations = observations.clone();<a name="line.153"></a>
+<FONT color="green">154</FONT>            this.weights      = null;<a name="line.154"></a>
+<FONT color="green">155</FONT>            this.scale        = scale.copy();<a name="line.155"></a>
+<FONT color="green">156</FONT>        }<a name="line.156"></a>
+<FONT color="green">157</FONT>    <a name="line.157"></a>
+<FONT color="green">158</FONT>        /** {@inheritDoc} */<a name="line.158"></a>
+<FONT color="green">159</FONT>        public double value(final double[] point) throws FunctionEvaluationException {<a name="line.159"></a>
+<FONT color="green">160</FONT>    <a name="line.160"></a>
+<FONT color="green">161</FONT>            // compute residuals<a name="line.161"></a>
+<FONT color="green">162</FONT>            final double[] residuals = function.value(point);<a name="line.162"></a>
+<FONT color="green">163</FONT>            if (residuals.length != observations.length) {<a name="line.163"></a>
+<FONT color="green">164</FONT>                throw new FunctionEvaluationException(point, "dimension mismatch {0} != {1}",<a name="line.164"></a>
+<FONT color="green">165</FONT>                                                      residuals.length, observations.length);<a name="line.165"></a>
+<FONT color="green">166</FONT>            }<a name="line.166"></a>
+<FONT color="green">167</FONT>            for (int i = 0; i &lt; residuals.length; ++i) {<a name="line.167"></a>
+<FONT color="green">168</FONT>                residuals[i] -= observations[i];<a name="line.168"></a>
+<FONT color="green">169</FONT>            }<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>            // compute sum of squares<a name="line.171"></a>
+<FONT color="green">172</FONT>            double sumSquares = 0;<a name="line.172"></a>
+<FONT color="green">173</FONT>            if (weights != null) {<a name="line.173"></a>
+<FONT color="green">174</FONT>                for (int i = 0; i &lt; residuals.length; ++i) {<a name="line.174"></a>
+<FONT color="green">175</FONT>                    final double ri = residuals[i];<a name="line.175"></a>
+<FONT color="green">176</FONT>                    sumSquares +=  weights[i] * ri * ri;<a name="line.176"></a>
+<FONT color="green">177</FONT>                }<a name="line.177"></a>
+<FONT color="green">178</FONT>            } else if (scale != null) {<a name="line.178"></a>
+<FONT color="green">179</FONT>                for (final double yi : scale.operate(residuals)) {<a name="line.179"></a>
+<FONT color="green">180</FONT>                    sumSquares += yi * yi;<a name="line.180"></a>
+<FONT color="green">181</FONT>                }<a name="line.181"></a>
+<FONT color="green">182</FONT>            } else {<a name="line.182"></a>
+<FONT color="green">183</FONT>                for (final double ri : residuals) {<a name="line.183"></a>
+<FONT color="green">184</FONT>                    sumSquares += ri * ri;<a name="line.184"></a>
+<FONT color="green">185</FONT>                }<a name="line.185"></a>
+<FONT color="green">186</FONT>            }<a name="line.186"></a>
+<FONT color="green">187</FONT>    <a name="line.187"></a>
+<FONT color="green">188</FONT>            return sumSquares;<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>        }<a name="line.190"></a>
+<FONT color="green">191</FONT>    <a name="line.191"></a>
+<FONT color="green">192</FONT>    }<a name="line.192"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateRealOptimizer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,293 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.Comparator;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.analysis.DifferentiableMultivariateRealFunction;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.random.RandomVectorGenerator;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    /**<a name="line.28"></a>
+<FONT color="green">029</FONT>     * Special implementation of the {@link DifferentiableMultivariateRealOptimizer} interface adding<a name="line.29"></a>
+<FONT color="green">030</FONT>     * multi-start features to an existing optimizer.<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * This class wraps a classical optimizer to use it several times in<a name="line.32"></a>
+<FONT color="green">033</FONT>     * turn with different starting points in order to avoid being trapped<a name="line.33"></a>
+<FONT color="green">034</FONT>     * into a local extremum when looking for a global one.<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @since 2.0<a name="line.37"></a>
+<FONT color="green">038</FONT>     */<a name="line.38"></a>
+<FONT color="green">039</FONT>    public class MultiStartDifferentiableMultivariateRealOptimizer<a name="line.39"></a>
+<FONT color="green">040</FONT>        implements DifferentiableMultivariateRealOptimizer {<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Underlying classical optimizer. */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private final DifferentiableMultivariateRealOptimizer optimizer;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Maximal number of iterations allowed. */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private int maxIterations;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** Number of iterations already performed for all starts. */<a name="line.48"></a>
+<FONT color="green">049</FONT>        private int totalIterations;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /** Maximal number of evaluations allowed. */<a name="line.51"></a>
+<FONT color="green">052</FONT>        private int maxEvaluations;<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /** Number of evaluations already performed for all starts. */<a name="line.54"></a>
+<FONT color="green">055</FONT>        private int totalEvaluations;<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /** Number of gradient evaluations already performed for all starts. */<a name="line.57"></a>
+<FONT color="green">058</FONT>        private int totalGradientEvaluations;<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Number of starts to go. */<a name="line.60"></a>
+<FONT color="green">061</FONT>        private int starts;<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /** Random generator for multi-start. */<a name="line.63"></a>
+<FONT color="green">064</FONT>        private RandomVectorGenerator generator;<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /** Found optima. */<a name="line.66"></a>
+<FONT color="green">067</FONT>        private RealPointValuePair[] optima;<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * Create a multi-start optimizer from a single-start optimizer<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param optimizer single-start optimizer to wrap<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param starts number of starts to perform (including the<a name="line.72"></a>
+<FONT color="green">073</FONT>         * first one), multi-start is disabled if value is less than or<a name="line.73"></a>
+<FONT color="green">074</FONT>         * equal to 1<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @param generator random vector generator to use for restarts<a name="line.75"></a>
+<FONT color="green">076</FONT>         */<a name="line.76"></a>
+<FONT color="green">077</FONT>        public MultiStartDifferentiableMultivariateRealOptimizer(final DifferentiableMultivariateRealOptimizer optimizer,<a name="line.77"></a>
+<FONT color="green">078</FONT>                                                                 final int starts,<a name="line.78"></a>
+<FONT color="green">079</FONT>                                                                 final RandomVectorGenerator generator) {<a name="line.79"></a>
+<FONT color="green">080</FONT>            this.optimizer                = optimizer;<a name="line.80"></a>
+<FONT color="green">081</FONT>            this.totalIterations          = 0;<a name="line.81"></a>
+<FONT color="green">082</FONT>            this.totalEvaluations         = 0;<a name="line.82"></a>
+<FONT color="green">083</FONT>            this.totalGradientEvaluations = 0;<a name="line.83"></a>
+<FONT color="green">084</FONT>            this.starts                   = starts;<a name="line.84"></a>
+<FONT color="green">085</FONT>            this.generator                = generator;<a name="line.85"></a>
+<FONT color="green">086</FONT>            this.optima                   = null;<a name="line.86"></a>
+<FONT color="green">087</FONT>            setMaxIterations(Integer.MAX_VALUE);<a name="line.87"></a>
+<FONT color="green">088</FONT>            setMaxEvaluations(Integer.MAX_VALUE);<a name="line.88"></a>
+<FONT color="green">089</FONT>        }<a name="line.89"></a>
+<FONT color="green">090</FONT>    <a name="line.90"></a>
+<FONT color="green">091</FONT>        /** Get all the optima found during the last call to {@link<a name="line.91"></a>
+<FONT color="green">092</FONT>         * #optimize(DifferentiableMultivariateRealFunction, GoalType, double[])<a name="line.92"></a>
+<FONT color="green">093</FONT>         * optimize}.<a name="line.93"></a>
+<FONT color="green">094</FONT>         * &lt;p&gt;The optimizer stores all the optima found during a set of<a name="line.94"></a>
+<FONT color="green">095</FONT>         * restarts. The {@link #optimize(DifferentiableMultivariateRealFunction,<a name="line.95"></a>
+<FONT color="green">096</FONT>         * GoalType, double[]) optimize} method returns the best point only. This<a name="line.96"></a>
+<FONT color="green">097</FONT>         * method returns all the points found at the end of each starts,<a name="line.97"></a>
+<FONT color="green">098</FONT>         * including the best one already returned by the {@link<a name="line.98"></a>
+<FONT color="green">099</FONT>         * #optimize(DifferentiableMultivariateRealFunction, GoalType, double[])<a name="line.99"></a>
+<FONT color="green">100</FONT>         * optimize} method.<a name="line.100"></a>
+<FONT color="green">101</FONT>         * &lt;/p&gt;<a name="line.101"></a>
+<FONT color="green">102</FONT>         * &lt;p&gt;<a name="line.102"></a>
+<FONT color="green">103</FONT>         * The returned array as one element for each start as specified<a name="line.103"></a>
+<FONT color="green">104</FONT>         * in the constructor. It is ordered with the results from the<a name="line.104"></a>
+<FONT color="green">105</FONT>         * runs that did converge first, sorted from best to worst<a name="line.105"></a>
+<FONT color="green">106</FONT>         * objective value (i.e in ascending order if minimizing and in<a name="line.106"></a>
+<FONT color="green">107</FONT>         * descending order if maximizing), followed by and null elements<a name="line.107"></a>
+<FONT color="green">108</FONT>         * corresponding to the runs that did not converge. This means all<a name="line.108"></a>
+<FONT color="green">109</FONT>         * elements will be null if the {@link #optimize(DifferentiableMultivariateRealFunction,<a name="line.109"></a>
+<FONT color="green">110</FONT>         * GoalType, double[]) optimize} method did throw a {@link<a name="line.110"></a>
+<FONT color="green">111</FONT>         * org.apache.commons.math.ConvergenceException ConvergenceException}).<a name="line.111"></a>
+<FONT color="green">112</FONT>         * This also means that if the first element is non null, it is the best<a name="line.112"></a>
+<FONT color="green">113</FONT>         * point found across all starts.&lt;/p&gt;<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @return array containing the optima<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @exception IllegalStateException if {@link #optimize(DifferentiableMultivariateRealFunction,<a name="line.115"></a>
+<FONT color="green">116</FONT>         * GoalType, double[]) optimize} has not been called<a name="line.116"></a>
+<FONT color="green">117</FONT>         */<a name="line.117"></a>
+<FONT color="green">118</FONT>        public RealPointValuePair[] getOptima() throws IllegalStateException {<a name="line.118"></a>
+<FONT color="green">119</FONT>            if (optima == null) {<a name="line.119"></a>
+<FONT color="green">120</FONT>                throw MathRuntimeException.createIllegalStateException("no optimum computed yet");<a name="line.120"></a>
+<FONT color="green">121</FONT>            }<a name="line.121"></a>
+<FONT color="green">122</FONT>            return optima.clone();<a name="line.122"></a>
+<FONT color="green">123</FONT>        }<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>        /** {@inheritDoc} */<a name="line.125"></a>
+<FONT color="green">126</FONT>        public void setMaxIterations(int maxIterations) {<a name="line.126"></a>
+<FONT color="green">127</FONT>            this.maxIterations = maxIterations;<a name="line.127"></a>
+<FONT color="green">128</FONT>        }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /** {@inheritDoc} */<a name="line.130"></a>
+<FONT color="green">131</FONT>        public int getMaxIterations() {<a name="line.131"></a>
+<FONT color="green">132</FONT>            return maxIterations;<a name="line.132"></a>
+<FONT color="green">133</FONT>        }<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>        /** {@inheritDoc} */<a name="line.135"></a>
+<FONT color="green">136</FONT>        public int getIterations() {<a name="line.136"></a>
+<FONT color="green">137</FONT>            return totalIterations;<a name="line.137"></a>
+<FONT color="green">138</FONT>        }<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>        /** {@inheritDoc} */<a name="line.140"></a>
+<FONT color="green">141</FONT>        public void setMaxEvaluations(int maxEvaluations) {<a name="line.141"></a>
+<FONT color="green">142</FONT>            this.maxEvaluations = maxEvaluations;<a name="line.142"></a>
+<FONT color="green">143</FONT>        }<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>        /** {@inheritDoc} */<a name="line.145"></a>
+<FONT color="green">146</FONT>        public int getMaxEvaluations() {<a name="line.146"></a>
+<FONT color="green">147</FONT>            return maxEvaluations;<a name="line.147"></a>
+<FONT color="green">148</FONT>        }<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>        /** {@inheritDoc} */<a name="line.150"></a>
+<FONT color="green">151</FONT>        public int getEvaluations() {<a name="line.151"></a>
+<FONT color="green">152</FONT>            return totalEvaluations;<a name="line.152"></a>
+<FONT color="green">153</FONT>        }<a name="line.153"></a>
+<FONT color="green">154</FONT>    <a name="line.154"></a>
+<FONT color="green">155</FONT>        /** {@inheritDoc} */<a name="line.155"></a>
+<FONT color="green">156</FONT>        public int getGradientEvaluations() {<a name="line.156"></a>
+<FONT color="green">157</FONT>            return totalGradientEvaluations;<a name="line.157"></a>
+<FONT color="green">158</FONT>        }<a name="line.158"></a>
+<FONT color="green">159</FONT>    <a name="line.159"></a>
+<FONT color="green">160</FONT>        /** {@inheritDoc} */<a name="line.160"></a>
+<FONT color="green">161</FONT>        public void setConvergenceChecker(RealConvergenceChecker checker) {<a name="line.161"></a>
+<FONT color="green">162</FONT>            optimizer.setConvergenceChecker(checker);<a name="line.162"></a>
+<FONT color="green">163</FONT>        }<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>        /** {@inheritDoc} */<a name="line.165"></a>
+<FONT color="green">166</FONT>        public RealConvergenceChecker getConvergenceChecker() {<a name="line.166"></a>
+<FONT color="green">167</FONT>            return optimizer.getConvergenceChecker();<a name="line.167"></a>
+<FONT color="green">168</FONT>        }<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>        /** {@inheritDoc} */<a name="line.170"></a>
+<FONT color="green">171</FONT>        public RealPointValuePair optimize(final DifferentiableMultivariateRealFunction f,<a name="line.171"></a>
+<FONT color="green">172</FONT>                                             final GoalType goalType,<a name="line.172"></a>
+<FONT color="green">173</FONT>                                             double[] startPoint)<a name="line.173"></a>
+<FONT color="green">174</FONT>            throws FunctionEvaluationException, OptimizationException {<a name="line.174"></a>
+<FONT color="green">175</FONT>    <a name="line.175"></a>
+<FONT color="green">176</FONT>            optima                   = new RealPointValuePair[starts];<a name="line.176"></a>
+<FONT color="green">177</FONT>            totalIterations          = 0;<a name="line.177"></a>
+<FONT color="green">178</FONT>            totalEvaluations         = 0;<a name="line.178"></a>
+<FONT color="green">179</FONT>            totalGradientEvaluations = 0;<a name="line.179"></a>
+<FONT color="green">180</FONT>    <a name="line.180"></a>
+<FONT color="green">181</FONT>            // multi-start loop<a name="line.181"></a>
+<FONT color="green">182</FONT>            for (int i = 0; i &lt; starts; ++i) {<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>                try {<a name="line.184"></a>
+<FONT color="green">185</FONT>                    optimizer.setMaxIterations(maxIterations - totalIterations);<a name="line.185"></a>
+<FONT color="green">186</FONT>                    optimizer.setMaxEvaluations(maxEvaluations - totalEvaluations);<a name="line.186"></a>
+<FONT color="green">187</FONT>                    optima[i] = optimizer.optimize(f, goalType,<a name="line.187"></a>
+<FONT color="green">188</FONT>                                                   (i == 0) ? startPoint : generator.nextVector());<a name="line.188"></a>
+<FONT color="green">189</FONT>                } catch (FunctionEvaluationException fee) {<a name="line.189"></a>
+<FONT color="green">190</FONT>                    optima[i] = null;<a name="line.190"></a>
+<FONT color="green">191</FONT>                } catch (OptimizationException oe) {<a name="line.191"></a>
+<FONT color="green">192</FONT>                    optima[i] = null;<a name="line.192"></a>
+<FONT color="green">193</FONT>                }<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>                totalIterations          += optimizer.getIterations();<a name="line.195"></a>
+<FONT color="green">196</FONT>                totalEvaluations         += optimizer.getEvaluations();<a name="line.196"></a>
+<FONT color="green">197</FONT>                totalGradientEvaluations += optimizer.getGradientEvaluations();<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>            }<a name="line.199"></a>
+<FONT color="green">200</FONT>    <a name="line.200"></a>
+<FONT color="green">201</FONT>            // sort the optima from best to worst, followed by null elements<a name="line.201"></a>
+<FONT color="green">202</FONT>            Arrays.sort(optima, new Comparator&lt;RealPointValuePair&gt;() {<a name="line.202"></a>
+<FONT color="green">203</FONT>                public int compare(final RealPointValuePair o1, final RealPointValuePair o2) {<a name="line.203"></a>
+<FONT color="green">204</FONT>                    if (o1 == null) {<a name="line.204"></a>
+<FONT color="green">205</FONT>                        return (o2 == null) ? 0 : +1;<a name="line.205"></a>
+<FONT color="green">206</FONT>                    } else if (o2 == null) {<a name="line.206"></a>
+<FONT color="green">207</FONT>                        return -1;<a name="line.207"></a>
+<FONT color="green">208</FONT>                    }<a name="line.208"></a>
+<FONT color="green">209</FONT>                    final double v1 = o1.getValue();<a name="line.209"></a>
+<FONT color="green">210</FONT>                    final double v2 = o2.getValue();<a name="line.210"></a>
+<FONT color="green">211</FONT>                    return (goalType == GoalType.MINIMIZE) ?<a name="line.211"></a>
+<FONT color="green">212</FONT>                            Double.compare(v1, v2) : Double.compare(v2, v1);<a name="line.212"></a>
+<FONT color="green">213</FONT>                }<a name="line.213"></a>
+<FONT color="green">214</FONT>            });<a name="line.214"></a>
+<FONT color="green">215</FONT>    <a name="line.215"></a>
+<FONT color="green">216</FONT>            if (optima[0] == null) {<a name="line.216"></a>
+<FONT color="green">217</FONT>                throw new OptimizationException(<a name="line.217"></a>
+<FONT color="green">218</FONT>                        "none of the {0} start points lead to convergence",<a name="line.218"></a>
+<FONT color="green">219</FONT>                        starts);<a name="line.219"></a>
+<FONT color="green">220</FONT>            }<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>            // return the found point given the best objective function value<a name="line.222"></a>
+<FONT color="green">223</FONT>            return optima[0];<a name="line.223"></a>
+<FONT color="green">224</FONT>    <a name="line.224"></a>
+<FONT color="green">225</FONT>        }<a name="line.225"></a>
+<FONT color="green">226</FONT>    <a name="line.226"></a>
+<FONT color="green">227</FONT>    }<a name="line.227"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateVectorialOptimizer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,303 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.Comparator;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.analysis.DifferentiableMultivariateVectorialFunction;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.random.RandomVectorGenerator;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    /**<a name="line.28"></a>
+<FONT color="green">029</FONT>     * Special implementation of the {@link DifferentiableMultivariateVectorialOptimizer} interface adding<a name="line.29"></a>
+<FONT color="green">030</FONT>     * multi-start features to an existing optimizer.<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * This class wraps a classical optimizer to use it several times in<a name="line.32"></a>
+<FONT color="green">033</FONT>     * turn with different starting points in order to avoid being trapped<a name="line.33"></a>
+<FONT color="green">034</FONT>     * into a local extremum when looking for a global one.<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @since 2.0<a name="line.37"></a>
+<FONT color="green">038</FONT>     */<a name="line.38"></a>
+<FONT color="green">039</FONT>    public class MultiStartDifferentiableMultivariateVectorialOptimizer<a name="line.39"></a>
+<FONT color="green">040</FONT>        implements DifferentiableMultivariateVectorialOptimizer {<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Serializable version identifier. */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private static final long serialVersionUID = 9206382258980561530L;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Underlying classical optimizer. */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private final DifferentiableMultivariateVectorialOptimizer optimizer;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** Maximal number of iterations allowed. */<a name="line.48"></a>
+<FONT color="green">049</FONT>        private int maxIterations;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /** Number of iterations already performed for all starts. */<a name="line.51"></a>
+<FONT color="green">052</FONT>        private int totalIterations;<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /** Maximal number of evaluations allowed. */<a name="line.54"></a>
+<FONT color="green">055</FONT>        private int maxEvaluations;<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /** Number of evaluations already performed for all starts. */<a name="line.57"></a>
+<FONT color="green">058</FONT>        private int totalEvaluations;<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Number of jacobian evaluations already performed for all starts. */<a name="line.60"></a>
+<FONT color="green">061</FONT>        private int totalJacobianEvaluations;<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /** Number of starts to go. */<a name="line.63"></a>
+<FONT color="green">064</FONT>        private int starts;<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /** Random generator for multi-start. */<a name="line.66"></a>
+<FONT color="green">067</FONT>        private RandomVectorGenerator generator;<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /** Found optima. */<a name="line.69"></a>
+<FONT color="green">070</FONT>        private VectorialPointValuePair[] optima;<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /**<a name="line.72"></a>
+<FONT color="green">073</FONT>         * Create a multi-start optimizer from a single-start optimizer<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @param optimizer single-start optimizer to wrap<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @param starts number of starts to perform (including the<a name="line.75"></a>
+<FONT color="green">076</FONT>         * first one), multi-start is disabled if value is less than or<a name="line.76"></a>
+<FONT color="green">077</FONT>         * equal to 1<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @param generator random vector generator to use for restarts<a name="line.78"></a>
+<FONT color="green">079</FONT>         */<a name="line.79"></a>
+<FONT color="green">080</FONT>        public MultiStartDifferentiableMultivariateVectorialOptimizer(<a name="line.80"></a>
+<FONT color="green">081</FONT>                    final DifferentiableMultivariateVectorialOptimizer optimizer,<a name="line.81"></a>
+<FONT color="green">082</FONT>                    final int starts,<a name="line.82"></a>
+<FONT color="green">083</FONT>                    final RandomVectorGenerator generator) {<a name="line.83"></a>
+<FONT color="green">084</FONT>            this.optimizer                = optimizer;<a name="line.84"></a>
+<FONT color="green">085</FONT>            this.totalIterations          = 0;<a name="line.85"></a>
+<FONT color="green">086</FONT>            this.totalEvaluations         = 0;<a name="line.86"></a>
+<FONT color="green">087</FONT>            this.totalJacobianEvaluations = 0;<a name="line.87"></a>
+<FONT color="green">088</FONT>            this.starts                   = starts;<a name="line.88"></a>
+<FONT color="green">089</FONT>            this.generator                = generator;<a name="line.89"></a>
+<FONT color="green">090</FONT>            this.optima                   = null;<a name="line.90"></a>
+<FONT color="green">091</FONT>            setMaxIterations(Integer.MAX_VALUE);<a name="line.91"></a>
+<FONT color="green">092</FONT>            setMaxEvaluations(Integer.MAX_VALUE);<a name="line.92"></a>
+<FONT color="green">093</FONT>        }<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /** Get all the optima found during the last call to {@link<a name="line.95"></a>
+<FONT color="green">096</FONT>         * #optimize(DifferentiableMultivariateVectorialFunction,<a name="line.96"></a>
+<FONT color="green">097</FONT>         * double[], double[], double[]) optimize}.<a name="line.97"></a>
+<FONT color="green">098</FONT>         * &lt;p&gt;The optimizer stores all the optima found during a set of<a name="line.98"></a>
+<FONT color="green">099</FONT>         * restarts. The {@link #optimize(DifferentiableMultivariateVectorialFunction,<a name="line.99"></a>
+<FONT color="green">100</FONT>         * double[], double[], double[]) optimize} method returns the<a name="line.100"></a>
+<FONT color="green">101</FONT>         * best point only. This method returns all the points found at the<a name="line.101"></a>
+<FONT color="green">102</FONT>         * end of each starts, including the best one already returned by the {@link<a name="line.102"></a>
+<FONT color="green">103</FONT>         * #optimize(DifferentiableMultivariateVectorialFunction, double[],<a name="line.103"></a>
+<FONT color="green">104</FONT>         * double[], double[]) optimize} method.<a name="line.104"></a>
+<FONT color="green">105</FONT>         * &lt;/p&gt;<a name="line.105"></a>
+<FONT color="green">106</FONT>         * &lt;p&gt;<a name="line.106"></a>
+<FONT color="green">107</FONT>         * The returned array as one element for each start as specified<a name="line.107"></a>
+<FONT color="green">108</FONT>         * in the constructor. It is ordered with the results from the<a name="line.108"></a>
+<FONT color="green">109</FONT>         * runs that did converge first, sorted from best to worst<a name="line.109"></a>
+<FONT color="green">110</FONT>         * objective value (i.e in ascending order if minimizing and in<a name="line.110"></a>
+<FONT color="green">111</FONT>         * descending order if maximizing), followed by and null elements<a name="line.111"></a>
+<FONT color="green">112</FONT>         * corresponding to the runs that did not converge. This means all<a name="line.112"></a>
+<FONT color="green">113</FONT>         * elements will be null if the {@link #optimize(DifferentiableMultivariateVectorialFunction,<a name="line.113"></a>
+<FONT color="green">114</FONT>         * double[], double[], double[]) optimize} method did throw a {@link<a name="line.114"></a>
+<FONT color="green">115</FONT>         * org.apache.commons.math.ConvergenceException ConvergenceException}).<a name="line.115"></a>
+<FONT color="green">116</FONT>         * This also means that if the first element is non null, it is the best<a name="line.116"></a>
+<FONT color="green">117</FONT>         * point found across all starts.&lt;/p&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @return array containing the optima<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @exception IllegalStateException if {@link #optimize(DifferentiableMultivariateVectorialFunction,<a name="line.119"></a>
+<FONT color="green">120</FONT>         * double[], double[], double[]) optimize} has not been called<a name="line.120"></a>
+<FONT color="green">121</FONT>         */<a name="line.121"></a>
+<FONT color="green">122</FONT>        public VectorialPointValuePair[] getOptima() throws IllegalStateException {<a name="line.122"></a>
+<FONT color="green">123</FONT>            if (optima == null) {<a name="line.123"></a>
+<FONT color="green">124</FONT>                throw MathRuntimeException.createIllegalStateException("no optimum computed yet");<a name="line.124"></a>
+<FONT color="green">125</FONT>            }<a name="line.125"></a>
+<FONT color="green">126</FONT>            return optima.clone();<a name="line.126"></a>
+<FONT color="green">127</FONT>        }<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>        /** {@inheritDoc} */<a name="line.129"></a>
+<FONT color="green">130</FONT>        public void setMaxIterations(int maxIterations) {<a name="line.130"></a>
+<FONT color="green">131</FONT>            this.maxIterations = maxIterations;<a name="line.131"></a>
+<FONT color="green">132</FONT>        }<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>        /** {@inheritDoc} */<a name="line.134"></a>
+<FONT color="green">135</FONT>        public int getMaxIterations() {<a name="line.135"></a>
+<FONT color="green">136</FONT>            return maxIterations;<a name="line.136"></a>
+<FONT color="green">137</FONT>        }<a name="line.137"></a>
+<FONT color="green">138</FONT>    <a name="line.138"></a>
+<FONT color="green">139</FONT>        /** {@inheritDoc} */<a name="line.139"></a>
+<FONT color="green">140</FONT>        public int getIterations() {<a name="line.140"></a>
+<FONT color="green">141</FONT>            return totalIterations;<a name="line.141"></a>
+<FONT color="green">142</FONT>        }<a name="line.142"></a>
+<FONT color="green">143</FONT>    <a name="line.143"></a>
+<FONT color="green">144</FONT>        /** {@inheritDoc} */<a name="line.144"></a>
+<FONT color="green">145</FONT>        public void setMaxEvaluations(int maxEvaluations) {<a name="line.145"></a>
+<FONT color="green">146</FONT>            this.maxEvaluations = maxEvaluations;<a name="line.146"></a>
+<FONT color="green">147</FONT>        }<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>        /** {@inheritDoc} */<a name="line.149"></a>
+<FONT color="green">150</FONT>        public int getMaxEvaluations() {<a name="line.150"></a>
+<FONT color="green">151</FONT>            return maxEvaluations;<a name="line.151"></a>
+<FONT color="green">152</FONT>        }<a name="line.152"></a>
+<FONT color="green">153</FONT>    <a name="line.153"></a>
+<FONT color="green">154</FONT>        /** {@inheritDoc} */<a name="line.154"></a>
+<FONT color="green">155</FONT>        public int getEvaluations() {<a name="line.155"></a>
+<FONT color="green">156</FONT>            return totalEvaluations;<a name="line.156"></a>
+<FONT color="green">157</FONT>        }<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>        /** {@inheritDoc} */<a name="line.159"></a>
+<FONT color="green">160</FONT>        public int getJacobianEvaluations() {<a name="line.160"></a>
+<FONT color="green">161</FONT>            return totalJacobianEvaluations;<a name="line.161"></a>
+<FONT color="green">162</FONT>        }<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>        /** {@inheritDoc} */<a name="line.164"></a>
+<FONT color="green">165</FONT>        public void setConvergenceChecker(VectorialConvergenceChecker checker) {<a name="line.165"></a>
+<FONT color="green">166</FONT>            optimizer.setConvergenceChecker(checker);<a name="line.166"></a>
+<FONT color="green">167</FONT>        }<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>        /** {@inheritDoc} */<a name="line.169"></a>
+<FONT color="green">170</FONT>        public VectorialConvergenceChecker getConvergenceChecker() {<a name="line.170"></a>
+<FONT color="green">171</FONT>            return optimizer.getConvergenceChecker();<a name="line.171"></a>
+<FONT color="green">172</FONT>        }<a name="line.172"></a>
+<FONT color="green">173</FONT>    <a name="line.173"></a>
+<FONT color="green">174</FONT>        /** {@inheritDoc} */<a name="line.174"></a>
+<FONT color="green">175</FONT>        public VectorialPointValuePair optimize(final DifferentiableMultivariateVectorialFunction f,<a name="line.175"></a>
+<FONT color="green">176</FONT>                                                final double[] target, final double[] weights,<a name="line.176"></a>
+<FONT color="green">177</FONT>                                                final double[] startPoint)<a name="line.177"></a>
+<FONT color="green">178</FONT>            throws FunctionEvaluationException, OptimizationException, IllegalArgumentException {<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>            optima                   = new VectorialPointValuePair[starts];<a name="line.180"></a>
+<FONT color="green">181</FONT>            totalIterations          = 0;<a name="line.181"></a>
+<FONT color="green">182</FONT>            totalEvaluations         = 0;<a name="line.182"></a>
+<FONT color="green">183</FONT>            totalJacobianEvaluations = 0;<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>            // multi-start loop<a name="line.185"></a>
+<FONT color="green">186</FONT>            for (int i = 0; i &lt; starts; ++i) {<a name="line.186"></a>
+<FONT color="green">187</FONT>    <a name="line.187"></a>
+<FONT color="green">188</FONT>                try {<a name="line.188"></a>
+<FONT color="green">189</FONT>                    optimizer.setMaxIterations(maxIterations - totalIterations);<a name="line.189"></a>
+<FONT color="green">190</FONT>                    optimizer.setMaxEvaluations(maxEvaluations - totalEvaluations);<a name="line.190"></a>
+<FONT color="green">191</FONT>                    optima[i] = optimizer.optimize(f, target, weights,<a name="line.191"></a>
+<FONT color="green">192</FONT>                                                   (i == 0) ? startPoint : generator.nextVector());<a name="line.192"></a>
+<FONT color="green">193</FONT>                } catch (FunctionEvaluationException fee) {<a name="line.193"></a>
+<FONT color="green">194</FONT>                    optima[i] = null;<a name="line.194"></a>
+<FONT color="green">195</FONT>                } catch (OptimizationException oe) {<a name="line.195"></a>
+<FONT color="green">196</FONT>                    optima[i] = null;<a name="line.196"></a>
+<FONT color="green">197</FONT>                }<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>                totalIterations          += optimizer.getIterations();<a name="line.199"></a>
+<FONT color="green">200</FONT>                totalEvaluations         += optimizer.getEvaluations();<a name="line.200"></a>
+<FONT color="green">201</FONT>                totalJacobianEvaluations += optimizer.getJacobianEvaluations();<a name="line.201"></a>
+<FONT color="green">202</FONT>    <a name="line.202"></a>
+<FONT color="green">203</FONT>            }<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>            // sort the optima from best to worst, followed by null elements<a name="line.205"></a>
+<FONT color="green">206</FONT>            Arrays.sort(optima, new Comparator&lt;VectorialPointValuePair&gt;() {<a name="line.206"></a>
+<FONT color="green">207</FONT>                public int compare(final VectorialPointValuePair o1, final VectorialPointValuePair o2) {<a name="line.207"></a>
+<FONT color="green">208</FONT>                    if (o1 == null) {<a name="line.208"></a>
+<FONT color="green">209</FONT>                        return (o2 == null) ? 0 : +1;<a name="line.209"></a>
+<FONT color="green">210</FONT>                    } else if (o2 == null) {<a name="line.210"></a>
+<FONT color="green">211</FONT>                        return -1;<a name="line.211"></a>
+<FONT color="green">212</FONT>                    }<a name="line.212"></a>
+<FONT color="green">213</FONT>                    return Double.compare(weightedResidual(o1), weightedResidual(o2));<a name="line.213"></a>
+<FONT color="green">214</FONT>                }<a name="line.214"></a>
+<FONT color="green">215</FONT>                private double weightedResidual(final VectorialPointValuePair pv) {<a name="line.215"></a>
+<FONT color="green">216</FONT>                    final double[] value = pv.getValueRef();<a name="line.216"></a>
+<FONT color="green">217</FONT>                    double sum = 0;<a name="line.217"></a>
+<FONT color="green">218</FONT>                    for (int i = 0; i &lt; value.length; ++i) {<a name="line.218"></a>
+<FONT color="green">219</FONT>                        final double ri = value[i] - target[i];<a name="line.219"></a>
+<FONT color="green">220</FONT>                        sum += weights[i] * ri * ri;<a name="line.220"></a>
+<FONT color="green">221</FONT>                    }<a name="line.221"></a>
+<FONT color="green">222</FONT>                    return sum;<a name="line.222"></a>
+<FONT color="green">223</FONT>                }<a name="line.223"></a>
+<FONT color="green">224</FONT>            });<a name="line.224"></a>
+<FONT color="green">225</FONT>    <a name="line.225"></a>
+<FONT color="green">226</FONT>            if (optima[0] == null) {<a name="line.226"></a>
+<FONT color="green">227</FONT>                throw new OptimizationException(<a name="line.227"></a>
+<FONT color="green">228</FONT>                        "none of the {0} start points lead to convergence",<a name="line.228"></a>
+<FONT color="green">229</FONT>                        starts);<a name="line.229"></a>
+<FONT color="green">230</FONT>            }<a name="line.230"></a>
+<FONT color="green">231</FONT>    <a name="line.231"></a>
+<FONT color="green">232</FONT>            // return the found point given the best objective function value<a name="line.232"></a>
+<FONT color="green">233</FONT>            return optima[0];<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>        }<a name="line.235"></a>
+<FONT color="green">236</FONT>    <a name="line.236"></a>
+<FONT color="green">237</FONT>    }<a name="line.237"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/MultiStartMultivariateRealOptimizer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,281 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.Comparator;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.analysis.MultivariateRealFunction;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.random.RandomVectorGenerator;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    /**<a name="line.28"></a>
+<FONT color="green">029</FONT>     * Special implementation of the {@link MultivariateRealOptimizer} interface adding<a name="line.29"></a>
+<FONT color="green">030</FONT>     * multi-start features to an existing optimizer.<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * This class wraps a classical optimizer to use it several times in<a name="line.32"></a>
+<FONT color="green">033</FONT>     * turn with different starting points in order to avoid being trapped<a name="line.33"></a>
+<FONT color="green">034</FONT>     * into a local extremum when looking for a global one.<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @since 2.0<a name="line.37"></a>
+<FONT color="green">038</FONT>     */<a name="line.38"></a>
+<FONT color="green">039</FONT>    public class MultiStartMultivariateRealOptimizer<a name="line.39"></a>
+<FONT color="green">040</FONT>        implements MultivariateRealOptimizer {<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Underlying classical optimizer. */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private final MultivariateRealOptimizer optimizer;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Maximal number of iterations allowed. */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private int maxIterations;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** Maximal number of evaluations allowed. */<a name="line.48"></a>
+<FONT color="green">049</FONT>        private int maxEvaluations;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /** Number of iterations already performed for all starts. */<a name="line.51"></a>
+<FONT color="green">052</FONT>        private int totalIterations;<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /** Number of evaluations already performed for all starts. */<a name="line.54"></a>
+<FONT color="green">055</FONT>        private int totalEvaluations;<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /** Number of starts to go. */<a name="line.57"></a>
+<FONT color="green">058</FONT>        private int starts;<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Random generator for multi-start. */<a name="line.60"></a>
+<FONT color="green">061</FONT>        private RandomVectorGenerator generator;<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /** Found optima. */<a name="line.63"></a>
+<FONT color="green">064</FONT>        private RealPointValuePair[] optima;<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /**<a name="line.66"></a>
+<FONT color="green">067</FONT>         * Create a multi-start optimizer from a single-start optimizer<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param optimizer single-start optimizer to wrap<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @param starts number of starts to perform (including the<a name="line.69"></a>
+<FONT color="green">070</FONT>         * first one), multi-start is disabled if value is less than or<a name="line.70"></a>
+<FONT color="green">071</FONT>         * equal to 1<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param generator random vector generator to use for restarts<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        public MultiStartMultivariateRealOptimizer(final MultivariateRealOptimizer optimizer,<a name="line.74"></a>
+<FONT color="green">075</FONT>                                                   final int starts,<a name="line.75"></a>
+<FONT color="green">076</FONT>                                                   final RandomVectorGenerator generator) {<a name="line.76"></a>
+<FONT color="green">077</FONT>            this.optimizer        = optimizer;<a name="line.77"></a>
+<FONT color="green">078</FONT>            this.totalIterations  = 0;<a name="line.78"></a>
+<FONT color="green">079</FONT>            this.totalEvaluations = 0;<a name="line.79"></a>
+<FONT color="green">080</FONT>            this.starts           = starts;<a name="line.80"></a>
+<FONT color="green">081</FONT>            this.generator        = generator;<a name="line.81"></a>
+<FONT color="green">082</FONT>            this.optima           = null;<a name="line.82"></a>
+<FONT color="green">083</FONT>            setMaxIterations(Integer.MAX_VALUE);<a name="line.83"></a>
+<FONT color="green">084</FONT>            setMaxEvaluations(Integer.MAX_VALUE);<a name="line.84"></a>
+<FONT color="green">085</FONT>        }<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>        /** Get all the optima found during the last call to {@link<a name="line.87"></a>
+<FONT color="green">088</FONT>         * #optimize(MultivariateRealFunction, GoalType, double[]) optimize}.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * &lt;p&gt;The optimizer stores all the optima found during a set of<a name="line.89"></a>
+<FONT color="green">090</FONT>         * restarts. The {@link #optimize(MultivariateRealFunction, GoalType,<a name="line.90"></a>
+<FONT color="green">091</FONT>         * double[]) optimize} method returns the best point only. This<a name="line.91"></a>
+<FONT color="green">092</FONT>         * method returns all the points found at the end of each starts,<a name="line.92"></a>
+<FONT color="green">093</FONT>         * including the best one already returned by the {@link<a name="line.93"></a>
+<FONT color="green">094</FONT>         * #optimize(MultivariateRealFunction, GoalType, double[]) optimize}<a name="line.94"></a>
+<FONT color="green">095</FONT>         * method.<a name="line.95"></a>
+<FONT color="green">096</FONT>         * &lt;/p&gt;<a name="line.96"></a>
+<FONT color="green">097</FONT>         * &lt;p&gt;<a name="line.97"></a>
+<FONT color="green">098</FONT>         * The returned array as one element for each start as specified<a name="line.98"></a>
+<FONT color="green">099</FONT>         * in the constructor. It is ordered with the results from the<a name="line.99"></a>
+<FONT color="green">100</FONT>         * runs that did converge first, sorted from best to worst<a name="line.100"></a>
+<FONT color="green">101</FONT>         * objective value (i.e in ascending order if minimizing and in<a name="line.101"></a>
+<FONT color="green">102</FONT>         * descending order if maximizing), followed by and null elements<a name="line.102"></a>
+<FONT color="green">103</FONT>         * corresponding to the runs that did not converge. This means all<a name="line.103"></a>
+<FONT color="green">104</FONT>         * elements will be null if the {@link #optimize(MultivariateRealFunction,<a name="line.104"></a>
+<FONT color="green">105</FONT>         * GoalType, double[]) optimize} method did throw a {@link<a name="line.105"></a>
+<FONT color="green">106</FONT>         * org.apache.commons.math.ConvergenceException ConvergenceException}).<a name="line.106"></a>
+<FONT color="green">107</FONT>         * This also means that if the first element is non null, it is the best<a name="line.107"></a>
+<FONT color="green">108</FONT>         * point found across all starts.&lt;/p&gt;<a name="line.108"></a>
+<FONT color="green">109</FONT>         * @return array containing the optima<a name="line.109"></a>
+<FONT color="green">110</FONT>         * @exception IllegalStateException if {@link #optimize(MultivariateRealFunction,<a name="line.110"></a>
+<FONT color="green">111</FONT>         * GoalType, double[]) optimize} has not been called<a name="line.111"></a>
+<FONT color="green">112</FONT>         */<a name="line.112"></a>
+<FONT color="green">113</FONT>        public RealPointValuePair[] getOptima() throws IllegalStateException {<a name="line.113"></a>
+<FONT color="green">114</FONT>            if (optima == null) {<a name="line.114"></a>
+<FONT color="green">115</FONT>                throw MathRuntimeException.createIllegalStateException("no optimum computed yet");<a name="line.115"></a>
+<FONT color="green">116</FONT>            }<a name="line.116"></a>
+<FONT color="green">117</FONT>            return optima.clone();<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /** {@inheritDoc} */<a name="line.120"></a>
+<FONT color="green">121</FONT>        public void setMaxIterations(int maxIterations) {<a name="line.121"></a>
+<FONT color="green">122</FONT>            this.maxIterations = maxIterations;<a name="line.122"></a>
+<FONT color="green">123</FONT>        }<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>        /** {@inheritDoc} */<a name="line.125"></a>
+<FONT color="green">126</FONT>        public int getMaxIterations() {<a name="line.126"></a>
+<FONT color="green">127</FONT>            return maxIterations;<a name="line.127"></a>
+<FONT color="green">128</FONT>        }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /** {@inheritDoc} */<a name="line.130"></a>
+<FONT color="green">131</FONT>        public void setMaxEvaluations(int maxEvaluations) {<a name="line.131"></a>
+<FONT color="green">132</FONT>            this.maxEvaluations = maxEvaluations;<a name="line.132"></a>
+<FONT color="green">133</FONT>        }<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>        /** {@inheritDoc} */<a name="line.135"></a>
+<FONT color="green">136</FONT>        public int getMaxEvaluations() {<a name="line.136"></a>
+<FONT color="green">137</FONT>            return maxEvaluations;<a name="line.137"></a>
+<FONT color="green">138</FONT>        }<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>        /** {@inheritDoc} */<a name="line.140"></a>
+<FONT color="green">141</FONT>        public int getIterations() {<a name="line.141"></a>
+<FONT color="green">142</FONT>            return totalIterations;<a name="line.142"></a>
+<FONT color="green">143</FONT>        }<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>        /** {@inheritDoc} */<a name="line.145"></a>
+<FONT color="green">146</FONT>        public int getEvaluations() {<a name="line.146"></a>
+<FONT color="green">147</FONT>            return totalEvaluations;<a name="line.147"></a>
+<FONT color="green">148</FONT>        }<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>        /** {@inheritDoc} */<a name="line.150"></a>
+<FONT color="green">151</FONT>        public void setConvergenceChecker(RealConvergenceChecker checker) {<a name="line.151"></a>
+<FONT color="green">152</FONT>            optimizer.setConvergenceChecker(checker);<a name="line.152"></a>
+<FONT color="green">153</FONT>        }<a name="line.153"></a>
+<FONT color="green">154</FONT>    <a name="line.154"></a>
+<FONT color="green">155</FONT>        /** {@inheritDoc} */<a name="line.155"></a>
+<FONT color="green">156</FONT>        public RealConvergenceChecker getConvergenceChecker() {<a name="line.156"></a>
+<FONT color="green">157</FONT>            return optimizer.getConvergenceChecker();<a name="line.157"></a>
+<FONT color="green">158</FONT>        }<a name="line.158"></a>
+<FONT color="green">159</FONT>    <a name="line.159"></a>
+<FONT color="green">160</FONT>        /** {@inheritDoc} */<a name="line.160"></a>
+<FONT color="green">161</FONT>        public RealPointValuePair optimize(final MultivariateRealFunction f,<a name="line.161"></a>
+<FONT color="green">162</FONT>                                             final GoalType goalType,<a name="line.162"></a>
+<FONT color="green">163</FONT>                                             double[] startPoint)<a name="line.163"></a>
+<FONT color="green">164</FONT>            throws FunctionEvaluationException, OptimizationException {<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>            optima           = new RealPointValuePair[starts];<a name="line.166"></a>
+<FONT color="green">167</FONT>            totalIterations  = 0;<a name="line.167"></a>
+<FONT color="green">168</FONT>            totalEvaluations = 0;<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>            // multi-start loop<a name="line.170"></a>
+<FONT color="green">171</FONT>            for (int i = 0; i &lt; starts; ++i) {<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>                try {<a name="line.173"></a>
+<FONT color="green">174</FONT>                    optimizer.setMaxIterations(maxIterations - totalIterations);<a name="line.174"></a>
+<FONT color="green">175</FONT>                    optimizer.setMaxEvaluations(maxEvaluations - totalEvaluations);<a name="line.175"></a>
+<FONT color="green">176</FONT>                    optima[i] = optimizer.optimize(f, goalType,<a name="line.176"></a>
+<FONT color="green">177</FONT>                                                   (i == 0) ? startPoint : generator.nextVector());<a name="line.177"></a>
+<FONT color="green">178</FONT>                } catch (FunctionEvaluationException fee) {<a name="line.178"></a>
+<FONT color="green">179</FONT>                    optima[i] = null;<a name="line.179"></a>
+<FONT color="green">180</FONT>                } catch (OptimizationException oe) {<a name="line.180"></a>
+<FONT color="green">181</FONT>                    optima[i] = null;<a name="line.181"></a>
+<FONT color="green">182</FONT>                }<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>                totalIterations  += optimizer.getIterations();<a name="line.184"></a>
+<FONT color="green">185</FONT>                totalEvaluations += optimizer.getEvaluations();<a name="line.185"></a>
+<FONT color="green">186</FONT>    <a name="line.186"></a>
+<FONT color="green">187</FONT>            }<a name="line.187"></a>
+<FONT color="green">188</FONT>    <a name="line.188"></a>
+<FONT color="green">189</FONT>            // sort the optima from best to worst, followed by null elements<a name="line.189"></a>
+<FONT color="green">190</FONT>            Arrays.sort(optima, new Comparator&lt;RealPointValuePair&gt;() {<a name="line.190"></a>
+<FONT color="green">191</FONT>                public int compare(final RealPointValuePair o1, final RealPointValuePair o2) {<a name="line.191"></a>
+<FONT color="green">192</FONT>                    if (o1 == null) {<a name="line.192"></a>
+<FONT color="green">193</FONT>                        return (o2 == null) ? 0 : +1;<a name="line.193"></a>
+<FONT color="green">194</FONT>                    } else if (o2 == null) {<a name="line.194"></a>
+<FONT color="green">195</FONT>                        return -1;<a name="line.195"></a>
+<FONT color="green">196</FONT>                    }<a name="line.196"></a>
+<FONT color="green">197</FONT>                    final double v1 = o1.getValue();<a name="line.197"></a>
+<FONT color="green">198</FONT>                    final double v2 = o2.getValue();<a name="line.198"></a>
+<FONT color="green">199</FONT>                    return (goalType == GoalType.MINIMIZE) ?<a name="line.199"></a>
+<FONT color="green">200</FONT>                            Double.compare(v1, v2) : Double.compare(v2, v1);<a name="line.200"></a>
+<FONT color="green">201</FONT>                }<a name="line.201"></a>
+<FONT color="green">202</FONT>            });<a name="line.202"></a>
+<FONT color="green">203</FONT>    <a name="line.203"></a>
+<FONT color="green">204</FONT>            if (optima[0] == null) {<a name="line.204"></a>
+<FONT color="green">205</FONT>                throw new OptimizationException(<a name="line.205"></a>
+<FONT color="green">206</FONT>                        "none of the {0} start points lead to convergence",<a name="line.206"></a>
+<FONT color="green">207</FONT>                        starts);<a name="line.207"></a>
+<FONT color="green">208</FONT>            }<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>            // return the found point given the best objective function value<a name="line.210"></a>
+<FONT color="green">211</FONT>            return optima[0];<a name="line.211"></a>
+<FONT color="green">212</FONT>    <a name="line.212"></a>
+<FONT color="green">213</FONT>        }<a name="line.213"></a>
+<FONT color="green">214</FONT>    <a name="line.214"></a>
+<FONT color="green">215</FONT>    }<a name="line.215"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/MultiStartUnivariateRealOptimizer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,384 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.random.RandomGenerator;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Special implementation of the {@link UnivariateRealOptimizer} interface adding<a name="line.27"></a>
+<FONT color="green">028</FONT>     * multi-start features to an existing optimizer.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * This class wraps a classical optimizer to use it several times in<a name="line.30"></a>
+<FONT color="green">031</FONT>     * turn with different starting points in order to avoid being trapped<a name="line.31"></a>
+<FONT color="green">032</FONT>     * into a local extremum when looking for a global one.<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @since 2.0<a name="line.35"></a>
+<FONT color="green">036</FONT>     */<a name="line.36"></a>
+<FONT color="green">037</FONT>    public class MultiStartUnivariateRealOptimizer implements UnivariateRealOptimizer {<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Serializable version identifier. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private static final long serialVersionUID = 5983375963110961019L;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Underlying classical optimizer. */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private final UnivariateRealOptimizer optimizer;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Maximal number of iterations allowed. */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private int maxIterations;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** Maximal number of evaluations allowed. */<a name="line.48"></a>
+<FONT color="green">049</FONT>        private int maxEvaluations;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /** Number of iterations already performed for all starts. */<a name="line.51"></a>
+<FONT color="green">052</FONT>        private int totalIterations;<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /** Number of evaluations already performed for all starts. */<a name="line.54"></a>
+<FONT color="green">055</FONT>        private int totalEvaluations;<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /** Number of starts to go. */<a name="line.57"></a>
+<FONT color="green">058</FONT>        private int starts;<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Random generator for multi-start. */<a name="line.60"></a>
+<FONT color="green">061</FONT>        private RandomGenerator generator;<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /** Found optima. */<a name="line.63"></a>
+<FONT color="green">064</FONT>        private double[] optima;<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /** Found function values at optima. */<a name="line.66"></a>
+<FONT color="green">067</FONT>        private double[] optimaValues;<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * Create a multi-start optimizer from a single-start optimizer<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param optimizer single-start optimizer to wrap<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param starts number of starts to perform (including the<a name="line.72"></a>
+<FONT color="green">073</FONT>         * first one), multi-start is disabled if value is less than or<a name="line.73"></a>
+<FONT color="green">074</FONT>         * equal to 1<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @param generator random generator to use for restarts<a name="line.75"></a>
+<FONT color="green">076</FONT>         */<a name="line.76"></a>
+<FONT color="green">077</FONT>        public MultiStartUnivariateRealOptimizer(final UnivariateRealOptimizer optimizer,<a name="line.77"></a>
+<FONT color="green">078</FONT>                                                 final int starts,<a name="line.78"></a>
+<FONT color="green">079</FONT>                                                 final RandomGenerator generator) {<a name="line.79"></a>
+<FONT color="green">080</FONT>            this.optimizer        = optimizer;<a name="line.80"></a>
+<FONT color="green">081</FONT>            this.totalIterations  = 0;<a name="line.81"></a>
+<FONT color="green">082</FONT>            this.starts           = starts;<a name="line.82"></a>
+<FONT color="green">083</FONT>            this.generator        = generator;<a name="line.83"></a>
+<FONT color="green">084</FONT>            this.optima           = null;<a name="line.84"></a>
+<FONT color="green">085</FONT>            setMaximalIterationCount(Integer.MAX_VALUE);<a name="line.85"></a>
+<FONT color="green">086</FONT>            setMaxEvaluations(Integer.MAX_VALUE);<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /** {@inheritDoc} */<a name="line.89"></a>
+<FONT color="green">090</FONT>        public double getFunctionValue() {<a name="line.90"></a>
+<FONT color="green">091</FONT>            return optimizer.getFunctionValue();<a name="line.91"></a>
+<FONT color="green">092</FONT>        }<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>        /** {@inheritDoc} */<a name="line.94"></a>
+<FONT color="green">095</FONT>        public double getResult() {<a name="line.95"></a>
+<FONT color="green">096</FONT>            return optimizer.getResult();<a name="line.96"></a>
+<FONT color="green">097</FONT>        }<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>        /** {@inheritDoc} */<a name="line.99"></a>
+<FONT color="green">100</FONT>        public double getAbsoluteAccuracy() {<a name="line.100"></a>
+<FONT color="green">101</FONT>            return optimizer.getAbsoluteAccuracy();<a name="line.101"></a>
+<FONT color="green">102</FONT>        }<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /** {@inheritDoc} */<a name="line.104"></a>
+<FONT color="green">105</FONT>        public int getIterationCount() {<a name="line.105"></a>
+<FONT color="green">106</FONT>            return totalIterations;<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /** {@inheritDoc} */<a name="line.109"></a>
+<FONT color="green">110</FONT>        public int getMaximalIterationCount() {<a name="line.110"></a>
+<FONT color="green">111</FONT>            return maxIterations;<a name="line.111"></a>
+<FONT color="green">112</FONT>        }<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /** {@inheritDoc} */<a name="line.114"></a>
+<FONT color="green">115</FONT>        public int getMaxEvaluations() {<a name="line.115"></a>
+<FONT color="green">116</FONT>            return maxEvaluations;<a name="line.116"></a>
+<FONT color="green">117</FONT>        }<a name="line.117"></a>
+<FONT color="green">118</FONT>    <a name="line.118"></a>
+<FONT color="green">119</FONT>        /** {@inheritDoc} */<a name="line.119"></a>
+<FONT color="green">120</FONT>        public int getEvaluations() {<a name="line.120"></a>
+<FONT color="green">121</FONT>            return totalEvaluations;<a name="line.121"></a>
+<FONT color="green">122</FONT>        }<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>        /** {@inheritDoc} */<a name="line.124"></a>
+<FONT color="green">125</FONT>        public double getRelativeAccuracy() {<a name="line.125"></a>
+<FONT color="green">126</FONT>            return optimizer.getRelativeAccuracy();<a name="line.126"></a>
+<FONT color="green">127</FONT>        }<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>        /** {@inheritDoc} */<a name="line.129"></a>
+<FONT color="green">130</FONT>        public void resetAbsoluteAccuracy() {<a name="line.130"></a>
+<FONT color="green">131</FONT>            optimizer.resetAbsoluteAccuracy();<a name="line.131"></a>
+<FONT color="green">132</FONT>        }<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>        /** {@inheritDoc} */<a name="line.134"></a>
+<FONT color="green">135</FONT>        public void resetMaximalIterationCount() {<a name="line.135"></a>
+<FONT color="green">136</FONT>            optimizer.resetMaximalIterationCount();<a name="line.136"></a>
+<FONT color="green">137</FONT>        }<a name="line.137"></a>
+<FONT color="green">138</FONT>    <a name="line.138"></a>
+<FONT color="green">139</FONT>        /** {@inheritDoc} */<a name="line.139"></a>
+<FONT color="green">140</FONT>        public void resetRelativeAccuracy() {<a name="line.140"></a>
+<FONT color="green">141</FONT>            optimizer.resetRelativeAccuracy();<a name="line.141"></a>
+<FONT color="green">142</FONT>        }<a name="line.142"></a>
+<FONT color="green">143</FONT>    <a name="line.143"></a>
+<FONT color="green">144</FONT>        /** {@inheritDoc} */<a name="line.144"></a>
+<FONT color="green">145</FONT>        public void setAbsoluteAccuracy(double accuracy) {<a name="line.145"></a>
+<FONT color="green">146</FONT>            optimizer.setAbsoluteAccuracy(accuracy);<a name="line.146"></a>
+<FONT color="green">147</FONT>        }<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>        /** {@inheritDoc} */<a name="line.149"></a>
+<FONT color="green">150</FONT>        public void setMaximalIterationCount(int count) {<a name="line.150"></a>
+<FONT color="green">151</FONT>            this.maxIterations = count;<a name="line.151"></a>
+<FONT color="green">152</FONT>        }<a name="line.152"></a>
+<FONT color="green">153</FONT>    <a name="line.153"></a>
+<FONT color="green">154</FONT>        /** {@inheritDoc} */<a name="line.154"></a>
+<FONT color="green">155</FONT>        public void setMaxEvaluations(int maxEvaluations) {<a name="line.155"></a>
+<FONT color="green">156</FONT>            this.maxEvaluations = maxEvaluations;<a name="line.156"></a>
+<FONT color="green">157</FONT>        }<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>        /** {@inheritDoc} */<a name="line.159"></a>
+<FONT color="green">160</FONT>        public void setRelativeAccuracy(double accuracy) {<a name="line.160"></a>
+<FONT color="green">161</FONT>            optimizer.setRelativeAccuracy(accuracy);<a name="line.161"></a>
+<FONT color="green">162</FONT>        }<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>        /** Get all the optima found during the last call to {@link<a name="line.164"></a>
+<FONT color="green">165</FONT>         * #optimize(UnivariateRealFunction, GoalType, double, double) optimize}.<a name="line.165"></a>
+<FONT color="green">166</FONT>         * &lt;p&gt;The optimizer stores all the optima found during a set of<a name="line.166"></a>
+<FONT color="green">167</FONT>         * restarts. The {@link #optimize(UnivariateRealFunction, GoalType,<a name="line.167"></a>
+<FONT color="green">168</FONT>         * double, double) optimize} method returns the best point only. This<a name="line.168"></a>
+<FONT color="green">169</FONT>         * method returns all the points found at the end of each starts,<a name="line.169"></a>
+<FONT color="green">170</FONT>         * including the best one already returned by the {@link<a name="line.170"></a>
+<FONT color="green">171</FONT>         * #optimize(UnivariateRealFunction, GoalType, double, double) optimize}<a name="line.171"></a>
+<FONT color="green">172</FONT>         * method.<a name="line.172"></a>
+<FONT color="green">173</FONT>         * &lt;/p&gt;<a name="line.173"></a>
+<FONT color="green">174</FONT>         * &lt;p&gt;<a name="line.174"></a>
+<FONT color="green">175</FONT>         * The returned array as one element for each start as specified<a name="line.175"></a>
+<FONT color="green">176</FONT>         * in the constructor. It is ordered with the results from the<a name="line.176"></a>
+<FONT color="green">177</FONT>         * runs that did converge first, sorted from best to worst<a name="line.177"></a>
+<FONT color="green">178</FONT>         * objective value (i.e in ascending order if minimizing and in<a name="line.178"></a>
+<FONT color="green">179</FONT>         * descending order if maximizing), followed by Double.NaN elements<a name="line.179"></a>
+<FONT color="green">180</FONT>         * corresponding to the runs that did not converge. This means all<a name="line.180"></a>
+<FONT color="green">181</FONT>         * elements will be NaN if the {@link #optimize(UnivariateRealFunction,<a name="line.181"></a>
+<FONT color="green">182</FONT>         * GoalType, double, double) optimize} method did throw a {@link<a name="line.182"></a>
+<FONT color="green">183</FONT>         * ConvergenceException ConvergenceException}). This also means that<a name="line.183"></a>
+<FONT color="green">184</FONT>         * if the first element is not NaN, it is the best point found across<a name="line.184"></a>
+<FONT color="green">185</FONT>         * all starts.&lt;/p&gt;<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @return array containing the optima<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @exception IllegalStateException if {@link #optimize(UnivariateRealFunction,<a name="line.187"></a>
+<FONT color="green">188</FONT>         * GoalType, double, double) optimize} has not been called<a name="line.188"></a>
+<FONT color="green">189</FONT>         * @see #getOptimaValues()<a name="line.189"></a>
+<FONT color="green">190</FONT>         */<a name="line.190"></a>
+<FONT color="green">191</FONT>        public double[] getOptima() throws IllegalStateException {<a name="line.191"></a>
+<FONT color="green">192</FONT>            if (optima == null) {<a name="line.192"></a>
+<FONT color="green">193</FONT>                throw MathRuntimeException.createIllegalStateException("no optimum computed yet");<a name="line.193"></a>
+<FONT color="green">194</FONT>            }<a name="line.194"></a>
+<FONT color="green">195</FONT>            return optima.clone();<a name="line.195"></a>
+<FONT color="green">196</FONT>        }<a name="line.196"></a>
+<FONT color="green">197</FONT>    <a name="line.197"></a>
+<FONT color="green">198</FONT>        /** Get all the function values at optima found during the last call to {@link<a name="line.198"></a>
+<FONT color="green">199</FONT>         * #optimize(UnivariateRealFunction, GoalType, double, double) optimize}.<a name="line.199"></a>
+<FONT color="green">200</FONT>         * &lt;p&gt;<a name="line.200"></a>
+<FONT color="green">201</FONT>         * The returned array as one element for each start as specified<a name="line.201"></a>
+<FONT color="green">202</FONT>         * in the constructor. It is ordered with the results from the<a name="line.202"></a>
+<FONT color="green">203</FONT>         * runs that did converge first, sorted from best to worst<a name="line.203"></a>
+<FONT color="green">204</FONT>         * objective value (i.e in ascending order if minimizing and in<a name="line.204"></a>
+<FONT color="green">205</FONT>         * descending order if maximizing), followed by Double.NaN elements<a name="line.205"></a>
+<FONT color="green">206</FONT>         * corresponding to the runs that did not converge. This means all<a name="line.206"></a>
+<FONT color="green">207</FONT>         * elements will be NaN if the {@link #optimize(UnivariateRealFunction,<a name="line.207"></a>
+<FONT color="green">208</FONT>         * GoalType, double, double) optimize} method did throw a {@link<a name="line.208"></a>
+<FONT color="green">209</FONT>         * ConvergenceException ConvergenceException}). This also means that<a name="line.209"></a>
+<FONT color="green">210</FONT>         * if the first element is not NaN, it is the best point found across<a name="line.210"></a>
+<FONT color="green">211</FONT>         * all starts.&lt;/p&gt;<a name="line.211"></a>
+<FONT color="green">212</FONT>         * @return array containing the optima<a name="line.212"></a>
+<FONT color="green">213</FONT>         * @exception IllegalStateException if {@link #optimize(UnivariateRealFunction,<a name="line.213"></a>
+<FONT color="green">214</FONT>         * GoalType, double, double) optimize} has not been called<a name="line.214"></a>
+<FONT color="green">215</FONT>         * @see #getOptima()<a name="line.215"></a>
+<FONT color="green">216</FONT>         */<a name="line.216"></a>
+<FONT color="green">217</FONT>        public double[] getOptimaValues() throws IllegalStateException {<a name="line.217"></a>
+<FONT color="green">218</FONT>            if (optimaValues == null) {<a name="line.218"></a>
+<FONT color="green">219</FONT>                throw MathRuntimeException.createIllegalStateException("no optimum computed yet");<a name="line.219"></a>
+<FONT color="green">220</FONT>            }<a name="line.220"></a>
+<FONT color="green">221</FONT>            return optimaValues.clone();<a name="line.221"></a>
+<FONT color="green">222</FONT>        }<a name="line.222"></a>
+<FONT color="green">223</FONT>    <a name="line.223"></a>
+<FONT color="green">224</FONT>        /** {@inheritDoc} */<a name="line.224"></a>
+<FONT color="green">225</FONT>        public double optimize(final UnivariateRealFunction f, final GoalType goalType,<a name="line.225"></a>
+<FONT color="green">226</FONT>                               final double min, final double max)<a name="line.226"></a>
+<FONT color="green">227</FONT>            throws ConvergenceException,<a name="line.227"></a>
+<FONT color="green">228</FONT>                FunctionEvaluationException {<a name="line.228"></a>
+<FONT color="green">229</FONT>    <a name="line.229"></a>
+<FONT color="green">230</FONT>            optima           = new double[starts];<a name="line.230"></a>
+<FONT color="green">231</FONT>            optimaValues     = new double[starts];<a name="line.231"></a>
+<FONT color="green">232</FONT>            totalIterations  = 0;<a name="line.232"></a>
+<FONT color="green">233</FONT>            totalEvaluations = 0;<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>            // multi-start loop<a name="line.235"></a>
+<FONT color="green">236</FONT>            for (int i = 0; i &lt; starts; ++i) {<a name="line.236"></a>
+<FONT color="green">237</FONT>    <a name="line.237"></a>
+<FONT color="green">238</FONT>                try {<a name="line.238"></a>
+<FONT color="green">239</FONT>                    optimizer.setMaximalIterationCount(maxIterations - totalIterations);<a name="line.239"></a>
+<FONT color="green">240</FONT>                    optimizer.setMaxEvaluations(maxEvaluations - totalEvaluations);<a name="line.240"></a>
+<FONT color="green">241</FONT>                    final double bound1 = (i == 0) ? min : min + generator.nextDouble() * (max - min);<a name="line.241"></a>
+<FONT color="green">242</FONT>                    final double bound2 = (i == 0) ? max : min + generator.nextDouble() * (max - min);<a name="line.242"></a>
+<FONT color="green">243</FONT>                    optima[i]       = optimizer.optimize(f, goalType,<a name="line.243"></a>
+<FONT color="green">244</FONT>                                                         Math.min(bound1, bound2),<a name="line.244"></a>
+<FONT color="green">245</FONT>                                                         Math.max(bound1, bound2));<a name="line.245"></a>
+<FONT color="green">246</FONT>                    optimaValues[i] = optimizer.getFunctionValue();<a name="line.246"></a>
+<FONT color="green">247</FONT>                } catch (FunctionEvaluationException fee) {<a name="line.247"></a>
+<FONT color="green">248</FONT>                    optima[i]       = Double.NaN;<a name="line.248"></a>
+<FONT color="green">249</FONT>                    optimaValues[i] = Double.NaN;<a name="line.249"></a>
+<FONT color="green">250</FONT>                } catch (ConvergenceException ce) {<a name="line.250"></a>
+<FONT color="green">251</FONT>                    optima[i]       = Double.NaN;<a name="line.251"></a>
+<FONT color="green">252</FONT>                    optimaValues[i] = Double.NaN;<a name="line.252"></a>
+<FONT color="green">253</FONT>                }<a name="line.253"></a>
+<FONT color="green">254</FONT>    <a name="line.254"></a>
+<FONT color="green">255</FONT>                totalIterations  += optimizer.getIterationCount();<a name="line.255"></a>
+<FONT color="green">256</FONT>                totalEvaluations += optimizer.getEvaluations();<a name="line.256"></a>
+<FONT color="green">257</FONT>    <a name="line.257"></a>
+<FONT color="green">258</FONT>            }<a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>            // sort the optima from best to worst, followed by NaN elements<a name="line.260"></a>
+<FONT color="green">261</FONT>            int lastNaN = optima.length;<a name="line.261"></a>
+<FONT color="green">262</FONT>            for (int i = 0; i &lt; lastNaN; ++i) {<a name="line.262"></a>
+<FONT color="green">263</FONT>                if (Double.isNaN(optima[i])) {<a name="line.263"></a>
+<FONT color="green">264</FONT>                    optima[i] = optima[--lastNaN];<a name="line.264"></a>
+<FONT color="green">265</FONT>                    optima[lastNaN + 1] = Double.NaN;<a name="line.265"></a>
+<FONT color="green">266</FONT>                    optimaValues[i] = optimaValues[--lastNaN];<a name="line.266"></a>
+<FONT color="green">267</FONT>                    optimaValues[lastNaN + 1] = Double.NaN;<a name="line.267"></a>
+<FONT color="green">268</FONT>                }<a name="line.268"></a>
+<FONT color="green">269</FONT>            }<a name="line.269"></a>
+<FONT color="green">270</FONT>    <a name="line.270"></a>
+<FONT color="green">271</FONT>            double currX = optima[0];<a name="line.271"></a>
+<FONT color="green">272</FONT>            double currY = optimaValues[0];<a name="line.272"></a>
+<FONT color="green">273</FONT>            for (int j = 1; j &lt; lastNaN; ++j) {<a name="line.273"></a>
+<FONT color="green">274</FONT>                final double prevY = currY;<a name="line.274"></a>
+<FONT color="green">275</FONT>                currX = optima[j];<a name="line.275"></a>
+<FONT color="green">276</FONT>                currY = optimaValues[j];<a name="line.276"></a>
+<FONT color="green">277</FONT>                if ((goalType == GoalType.MAXIMIZE) ^ (currY &lt; prevY)) {<a name="line.277"></a>
+<FONT color="green">278</FONT>                    // the current element should be inserted closer to the beginning<a name="line.278"></a>
+<FONT color="green">279</FONT>                    int i = j - 1;<a name="line.279"></a>
+<FONT color="green">280</FONT>                    double mIX = optima[i];<a name="line.280"></a>
+<FONT color="green">281</FONT>                    double mIY = optimaValues[i];<a name="line.281"></a>
+<FONT color="green">282</FONT>                    while ((i &gt;= 0) &amp;&amp; ((goalType == GoalType.MAXIMIZE) ^ (currY &lt; mIY))) {<a name="line.282"></a>
+<FONT color="green">283</FONT>                        optima[i + 1]       = mIX;<a name="line.283"></a>
+<FONT color="green">284</FONT>                        optimaValues[i + 1] = mIY;<a name="line.284"></a>
+<FONT color="green">285</FONT>                        if (i-- != 0) {<a name="line.285"></a>
+<FONT color="green">286</FONT>                            mIX = optima[i];<a name="line.286"></a>
+<FONT color="green">287</FONT>                            mIY = optimaValues[i];<a name="line.287"></a>
+<FONT color="green">288</FONT>                        } else {<a name="line.288"></a>
+<FONT color="green">289</FONT>                            mIX = Double.NaN;<a name="line.289"></a>
+<FONT color="green">290</FONT>                            mIY = Double.NaN;<a name="line.290"></a>
+<FONT color="green">291</FONT>                        }<a name="line.291"></a>
+<FONT color="green">292</FONT>                    }<a name="line.292"></a>
+<FONT color="green">293</FONT>                    optima[i + 1]       = currX;<a name="line.293"></a>
+<FONT color="green">294</FONT>                    optimaValues[i + 1] = currY;<a name="line.294"></a>
+<FONT color="green">295</FONT>                    currX = optima[j];<a name="line.295"></a>
+<FONT color="green">296</FONT>                    currY = optimaValues[j];<a name="line.296"></a>
+<FONT color="green">297</FONT>                }<a name="line.297"></a>
+<FONT color="green">298</FONT>            }<a name="line.298"></a>
+<FONT color="green">299</FONT>    <a name="line.299"></a>
+<FONT color="green">300</FONT>            if (Double.isNaN(optima[0])) {<a name="line.300"></a>
+<FONT color="green">301</FONT>                throw new OptimizationException(<a name="line.301"></a>
+<FONT color="green">302</FONT>                        "none of the {0} start points lead to convergence",<a name="line.302"></a>
+<FONT color="green">303</FONT>                        starts);<a name="line.303"></a>
+<FONT color="green">304</FONT>            }<a name="line.304"></a>
+<FONT color="green">305</FONT>    <a name="line.305"></a>
+<FONT color="green">306</FONT>            // return the found point given the best objective function value<a name="line.306"></a>
+<FONT color="green">307</FONT>            return optima[0];<a name="line.307"></a>
+<FONT color="green">308</FONT>    <a name="line.308"></a>
+<FONT color="green">309</FONT>        }<a name="line.309"></a>
+<FONT color="green">310</FONT>    <a name="line.310"></a>
+<FONT color="green">311</FONT>        /** {@inheritDoc} */<a name="line.311"></a>
+<FONT color="green">312</FONT>        public double optimize(final UnivariateRealFunction f, final GoalType goalType,<a name="line.312"></a>
+<FONT color="green">313</FONT>                               final double min, final double max, final double startValue)<a name="line.313"></a>
+<FONT color="green">314</FONT>                throws ConvergenceException, FunctionEvaluationException {<a name="line.314"></a>
+<FONT color="green">315</FONT>            return optimize(f, goalType, min, max);<a name="line.315"></a>
+<FONT color="green">316</FONT>        }<a name="line.316"></a>
+<FONT color="green">317</FONT>    <a name="line.317"></a>
+<FONT color="green">318</FONT>    }<a name="line.318"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/MultivariateRealOptimizer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,167 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.analysis.MultivariateRealFunction;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * This interface represents an optimization algorithm for {@link MultivariateRealFunction<a name="line.24"></a>
+<FONT color="green">025</FONT>     * scalar objective functions}.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;Optimization algorithms find the input point set that either {@link GoalType<a name="line.26"></a>
+<FONT color="green">027</FONT>     * maximize or minimize} an objective function.&lt;/p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @see DifferentiableMultivariateRealOptimizer<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @see DifferentiableMultivariateVectorialOptimizer<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 2.0<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public interface MultivariateRealOptimizer {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Set the maximal number of iterations of the algorithm.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @param maxIterations maximal number of algorithm iterations<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        void setMaxIterations(int maxIterations);<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Get the maximal number of iterations of the algorithm.<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @return maximal number of iterations<a name="line.41"></a>
+<FONT color="green">042</FONT>         */<a name="line.42"></a>
+<FONT color="green">043</FONT>        int getMaxIterations();<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Set the maximal number of functions evaluations.<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param maxEvaluations maximal number of function evaluations<a name="line.46"></a>
+<FONT color="green">047</FONT>         */<a name="line.47"></a>
+<FONT color="green">048</FONT>        void setMaxEvaluations(int maxEvaluations);<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Get the maximal number of functions evaluations.<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @return maximal number of functions evaluations<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        int getMaxEvaluations();<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** Get the number of iterations realized by the algorithm.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * &lt;p&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>         * The number of evaluations corresponds to the last call to the<a name="line.57"></a>
+<FONT color="green">058</FONT>         * {@link #optimize(MultivariateRealFunction, GoalType, double[]) optimize}<a name="line.58"></a>
+<FONT color="green">059</FONT>         * method. It is 0 if the method has not been called yet.<a name="line.59"></a>
+<FONT color="green">060</FONT>         * &lt;/p&gt;<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @return number of iterations<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        int getIterations();<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Get the number of evaluations of the objective function.<a name="line.65"></a>
+<FONT color="green">066</FONT>         * &lt;p&gt;<a name="line.66"></a>
+<FONT color="green">067</FONT>         * The number of evaluations corresponds to the last call to the<a name="line.67"></a>
+<FONT color="green">068</FONT>         * {@link #optimize(MultivariateRealFunction, GoalType, double[]) optimize}<a name="line.68"></a>
+<FONT color="green">069</FONT>         * method. It is 0 if the method has not been called yet.<a name="line.69"></a>
+<FONT color="green">070</FONT>         * &lt;/p&gt;<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @return number of evaluations of the objective function<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        int getEvaluations();<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /** Set the convergence checker.<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @param checker object to use to check for convergence<a name="line.76"></a>
+<FONT color="green">077</FONT>         */<a name="line.77"></a>
+<FONT color="green">078</FONT>        void setConvergenceChecker(RealConvergenceChecker checker);<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /** Get the convergence checker.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @return object used to check for convergence<a name="line.81"></a>
+<FONT color="green">082</FONT>         */<a name="line.82"></a>
+<FONT color="green">083</FONT>        RealConvergenceChecker getConvergenceChecker();<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>        /** Optimizes an objective function.<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @param f objective function<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @param goalType type of optimization goal: either {@link GoalType#MAXIMIZE}<a name="line.87"></a>
+<FONT color="green">088</FONT>         * or {@link GoalType#MINIMIZE}<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @param startPoint the start point for optimization<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @return the point/value pair giving the optimal value for objective function<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @exception FunctionEvaluationException if the objective function throws one during<a name="line.91"></a>
+<FONT color="green">092</FONT>         * the search<a name="line.92"></a>
+<FONT color="green">093</FONT>         * @exception OptimizationException if the algorithm failed to converge<a name="line.93"></a>
+<FONT color="green">094</FONT>         * @exception IllegalArgumentException if the start point dimension is wrong<a name="line.94"></a>
+<FONT color="green">095</FONT>         */<a name="line.95"></a>
+<FONT color="green">096</FONT>        RealPointValuePair optimize(MultivariateRealFunction f,<a name="line.96"></a>
+<FONT color="green">097</FONT>                                      GoalType goalType,<a name="line.97"></a>
+<FONT color="green">098</FONT>                                      double[] startPoint)<a name="line.98"></a>
+<FONT color="green">099</FONT>            throws FunctionEvaluationException, OptimizationException, IllegalArgumentException;<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>    }<a name="line.101"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/OptimizationException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,119 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This class represents exceptions thrown by optimizers.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 1.2<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>    public class OptimizationException extends ConvergenceException {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** Serializable version identifier. */<a name="line.32"></a>
+<FONT color="green">033</FONT>        private static final long serialVersionUID = -357696069587075016L;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /**<a name="line.35"></a>
+<FONT color="green">036</FONT>         * Simple constructor.<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Build an exception by translating and formating a message<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @param specifier format specifier (to be translated)<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @param parts to insert in the format (no translation)<a name="line.39"></a>
+<FONT color="green">040</FONT>         */<a name="line.40"></a>
+<FONT color="green">041</FONT>        public OptimizationException(String specifier, Object ... parts) {<a name="line.41"></a>
+<FONT color="green">042</FONT>            super(specifier, parts);<a name="line.42"></a>
+<FONT color="green">043</FONT>        }<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**<a name="line.45"></a>
+<FONT color="green">046</FONT>         * Create an exception with a given root cause.<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @param cause  the exception or error that caused this exception to be thrown<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        public OptimizationException(Throwable cause) {<a name="line.49"></a>
+<FONT color="green">050</FONT>            super(cause);<a name="line.50"></a>
+<FONT color="green">051</FONT>        }<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>    }<a name="line.53"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/RealConvergenceChecker.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,121 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /** This interface specifies how to check if an {@link MultivariateRealOptimizer optimization<a name="line.20"></a>
+<FONT color="green">021</FONT>     * algorithm} has converged.<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;p&gt;Deciding if convergence has been reached is a problem-dependent issue. The<a name="line.23"></a>
+<FONT color="green">024</FONT>     * user should provide a class implementing this interface to allow the optimization<a name="line.24"></a>
+<FONT color="green">025</FONT>     * algorithm to stop its search according to the problem at hand.&lt;/p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;For convenience, two implementations that fit simple needs are already provided:<a name="line.26"></a>
+<FONT color="green">027</FONT>     * {@link SimpleScalarValueChecker} and {@link SimpleRealPointChecker}. The first<a name="line.27"></a>
+<FONT color="green">028</FONT>     * one considers convergence is reached when the objective function value does not<a name="line.28"></a>
+<FONT color="green">029</FONT>     * change much anymore, it does not use the point set at all. The second one<a name="line.29"></a>
+<FONT color="green">030</FONT>     * considers convergence is reached when the input point set does not change<a name="line.30"></a>
+<FONT color="green">031</FONT>     * much anymore, it does not use objective function value at all.&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     *<a name="line.32"></a>
+<FONT color="green">033</FONT>     * @version $Revision: 799857 $ $Date: 2009-08-01 09:07:12 -0400 (Sat, 01 Aug 2009) $<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @since 2.0<a name="line.34"></a>
+<FONT color="green">035</FONT>     */<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>    public interface RealConvergenceChecker {<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>      /** Check if the optimization algorithm has converged considering the last points.<a name="line.39"></a>
+<FONT color="green">040</FONT>       * &lt;p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>       * This method may be called several time from the same algorithm iteration with<a name="line.41"></a>
+<FONT color="green">042</FONT>       * different points. This can be detected by checking the iteration number at each<a name="line.42"></a>
+<FONT color="green">043</FONT>       * call if needed. Each time this method is called, the previous and current point<a name="line.43"></a>
+<FONT color="green">044</FONT>       * correspond to points with the same role at each iteration, so they can be<a name="line.44"></a>
+<FONT color="green">045</FONT>       * compared. As an example, simplex-based algorithms call this method for all<a name="line.45"></a>
+<FONT color="green">046</FONT>       * points of the simplex, not only for the best or worst ones.<a name="line.46"></a>
+<FONT color="green">047</FONT>       * &lt;/p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>       * @param iteration index of current iteration<a name="line.48"></a>
+<FONT color="green">049</FONT>       * @param previous point from previous iteration<a name="line.49"></a>
+<FONT color="green">050</FONT>       * @param current point from current iteration<a name="line.50"></a>
+<FONT color="green">051</FONT>       * @return true if the algorithm is considered to have converged<a name="line.51"></a>
+<FONT color="green">052</FONT>       */<a name="line.52"></a>
+<FONT color="green">053</FONT>      boolean converged(int iteration, RealPointValuePair previous, RealPointValuePair current);<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>    }<a name="line.55"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/RealPointValuePair.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,154 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * This class holds a point and the value of an objective function at this point.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;This is a simple immutable container.&lt;/p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @see VectorialPointValuePair<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @see org.apache.commons.math.analysis.MultivariateRealFunction<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @since 2.0<a name="line.29"></a>
+<FONT color="green">030</FONT>     */<a name="line.30"></a>
+<FONT color="green">031</FONT>    public class RealPointValuePair implements Serializable {<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** Serializable version identifier. */<a name="line.33"></a>
+<FONT color="green">034</FONT>        private static final long serialVersionUID = 1003888396256744753L;<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Point coordinates. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private final double[] point;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Value of the objective function at the point. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private final double value;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Build a point/objective function value pair.<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @param point point coordinates (the built instance will store<a name="line.43"></a>
+<FONT color="green">044</FONT>         * a copy of the array, not the array passed as argument)<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @param value value of an objective function at the point<a name="line.45"></a>
+<FONT color="green">046</FONT>         */<a name="line.46"></a>
+<FONT color="green">047</FONT>        public RealPointValuePair(final double[] point, final double value) {<a name="line.47"></a>
+<FONT color="green">048</FONT>            this.point = point.clone();<a name="line.48"></a>
+<FONT color="green">049</FONT>            this.value  = value;<a name="line.49"></a>
+<FONT color="green">050</FONT>        }<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /** Build a point/objective function value pair.<a name="line.52"></a>
+<FONT color="green">053</FONT>         * @param point point coordinates (the built instance will store<a name="line.53"></a>
+<FONT color="green">054</FONT>         * a copy of the array, not the array passed as argument)<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param value value of an objective function at the point<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param copyArray if true, the input array will be copied, otherwise<a name="line.56"></a>
+<FONT color="green">057</FONT>         * it will be referenced<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public RealPointValuePair(final double[] point, final double value,<a name="line.59"></a>
+<FONT color="green">060</FONT>                                    final boolean copyArray) {<a name="line.60"></a>
+<FONT color="green">061</FONT>            this.point = copyArray ? point.clone() : point;<a name="line.61"></a>
+<FONT color="green">062</FONT>            this.value  = value;<a name="line.62"></a>
+<FONT color="green">063</FONT>        }<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Get the point.<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @return a copy of the stored point<a name="line.66"></a>
+<FONT color="green">067</FONT>         */<a name="line.67"></a>
+<FONT color="green">068</FONT>        public double[] getPoint() {<a name="line.68"></a>
+<FONT color="green">069</FONT>            return point.clone();<a name="line.69"></a>
+<FONT color="green">070</FONT>        }<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /** Get a reference to the point.<a name="line.72"></a>
+<FONT color="green">073</FONT>         * &lt;p&gt;This method is provided as a convenience to avoid copying<a name="line.73"></a>
+<FONT color="green">074</FONT>         * the array, the elements of the array should &lt;em&gt;not&lt;/em&gt; be modified.&lt;/p&gt;<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @return a reference to the internal array storing the point<a name="line.75"></a>
+<FONT color="green">076</FONT>         */<a name="line.76"></a>
+<FONT color="green">077</FONT>        public double[] getPointRef() {<a name="line.77"></a>
+<FONT color="green">078</FONT>            return point;<a name="line.78"></a>
+<FONT color="green">079</FONT>        }<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /** Get the value of the objective function.<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @return the stored value of the objective function<a name="line.82"></a>
+<FONT color="green">083</FONT>         */<a name="line.83"></a>
+<FONT color="green">084</FONT>        public double getValue() {<a name="line.84"></a>
+<FONT color="green">085</FONT>            return value;<a name="line.85"></a>
+<FONT color="green">086</FONT>        }<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>    }<a name="line.88"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/SimpleRealPointChecker.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,152 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Simple implementation of the {@link RealConvergenceChecker} interface using<a name="line.23"></a>
+<FONT color="green">024</FONT>     * only point coordinates.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Convergence is considered to have been reached if either the relative<a name="line.26"></a>
+<FONT color="green">027</FONT>     * difference between each point coordinate are smaller than a threshold<a name="line.27"></a>
+<FONT color="green">028</FONT>     * or if either the absolute difference between the point coordinates are<a name="line.28"></a>
+<FONT color="green">029</FONT>     * smaller than another threshold.<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 2.0<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public class SimpleRealPointChecker implements RealConvergenceChecker {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Default relative threshold. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private static final double DEFAULT_RELATIVE_THRESHOLD = 100 * MathUtils.EPSILON;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Default absolute threshold. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private static final double DEFAULT_ABSOLUTE_THRESHOLD = 100 * MathUtils.SAFE_MIN;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Relative tolerance threshold. */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private final double relativeThreshold;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Absolute tolerance threshold. */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private final double absoluteThreshold;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>       /** Build an instance with default threshold.<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        public SimpleRealPointChecker() {<a name="line.50"></a>
+<FONT color="green">051</FONT>            this.relativeThreshold = DEFAULT_RELATIVE_THRESHOLD;<a name="line.51"></a>
+<FONT color="green">052</FONT>            this.absoluteThreshold = DEFAULT_ABSOLUTE_THRESHOLD;<a name="line.52"></a>
+<FONT color="green">053</FONT>        }<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** Build an instance with a specified threshold.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * &lt;p&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>         * In order to perform only relative checks, the absolute tolerance<a name="line.57"></a>
+<FONT color="green">058</FONT>         * must be set to a negative value. In order to perform only absolute<a name="line.58"></a>
+<FONT color="green">059</FONT>         * checks, the relative tolerance must be set to a negative value.<a name="line.59"></a>
+<FONT color="green">060</FONT>         * &lt;/p&gt;<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param relativeThreshold relative tolerance threshold<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param absoluteThreshold absolute tolerance threshold<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public SimpleRealPointChecker(final double relativeThreshold,<a name="line.64"></a>
+<FONT color="green">065</FONT>                                     final double absoluteThreshold) {<a name="line.65"></a>
+<FONT color="green">066</FONT>            this.relativeThreshold = relativeThreshold;<a name="line.66"></a>
+<FONT color="green">067</FONT>            this.absoluteThreshold = absoluteThreshold;<a name="line.67"></a>
+<FONT color="green">068</FONT>        }<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /** {@inheritDoc} */<a name="line.70"></a>
+<FONT color="green">071</FONT>        public boolean converged(final int iteration,<a name="line.71"></a>
+<FONT color="green">072</FONT>                                 final RealPointValuePair previous,<a name="line.72"></a>
+<FONT color="green">073</FONT>                                 final RealPointValuePair current) {<a name="line.73"></a>
+<FONT color="green">074</FONT>            final double[] p        = previous.getPoint();<a name="line.74"></a>
+<FONT color="green">075</FONT>            final double[] c        = current.getPoint();<a name="line.75"></a>
+<FONT color="green">076</FONT>            for (int i = 0; i &lt; p.length; ++i) {<a name="line.76"></a>
+<FONT color="green">077</FONT>                final double difference = Math.abs(p[i] - c[i]);<a name="line.77"></a>
+<FONT color="green">078</FONT>                final double size       = Math.max(Math.abs(p[i]), Math.abs(c[i]));<a name="line.78"></a>
+<FONT color="green">079</FONT>                if ((difference &gt; (size * relativeThreshold)) &amp;&amp; (difference &gt; absoluteThreshold)) {<a name="line.79"></a>
+<FONT color="green">080</FONT>                    return false;<a name="line.80"></a>
+<FONT color="green">081</FONT>                }<a name="line.81"></a>
+<FONT color="green">082</FONT>            }<a name="line.82"></a>
+<FONT color="green">083</FONT>            return true;<a name="line.83"></a>
+<FONT color="green">084</FONT>        }<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>    }<a name="line.86"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/SimpleScalarValueChecker.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,147 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Simple implementation of the {@link RealConvergenceChecker} interface using<a name="line.23"></a>
+<FONT color="green">024</FONT>     * only objective function values.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Convergence is considered to have been reached if either the relative<a name="line.26"></a>
+<FONT color="green">027</FONT>     * difference between the objective function values is smaller than a<a name="line.27"></a>
+<FONT color="green">028</FONT>     * threshold or if either the absolute difference between the objective<a name="line.28"></a>
+<FONT color="green">029</FONT>     * function values is smaller than another threshold.<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 2.0<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public class SimpleScalarValueChecker implements RealConvergenceChecker {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Default relative threshold. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private static final double DEFAULT_RELATIVE_THRESHOLD = 100 * MathUtils.EPSILON;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Default absolute threshold. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private static final double DEFAULT_ABSOLUTE_THRESHOLD = 100 * MathUtils.SAFE_MIN;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Relative tolerance threshold. */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private final double relativeThreshold;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Absolute tolerance threshold. */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private final double absoluteThreshold;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>       /** Build an instance with default threshold.<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        public SimpleScalarValueChecker() {<a name="line.50"></a>
+<FONT color="green">051</FONT>            this.relativeThreshold = DEFAULT_RELATIVE_THRESHOLD;<a name="line.51"></a>
+<FONT color="green">052</FONT>            this.absoluteThreshold = DEFAULT_ABSOLUTE_THRESHOLD;<a name="line.52"></a>
+<FONT color="green">053</FONT>        }<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** Build an instance with a specified threshold.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * &lt;p&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>         * In order to perform only relative checks, the absolute tolerance<a name="line.57"></a>
+<FONT color="green">058</FONT>         * must be set to a negative value. In order to perform only absolute<a name="line.58"></a>
+<FONT color="green">059</FONT>         * checks, the relative tolerance must be set to a negative value.<a name="line.59"></a>
+<FONT color="green">060</FONT>         * &lt;/p&gt;<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param relativeThreshold relative tolerance threshold<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param absoluteThreshold absolute tolerance threshold<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public SimpleScalarValueChecker(final double relativeThreshold,<a name="line.64"></a>
+<FONT color="green">065</FONT>                                     final double absoluteThreshold) {<a name="line.65"></a>
+<FONT color="green">066</FONT>            this.relativeThreshold = relativeThreshold;<a name="line.66"></a>
+<FONT color="green">067</FONT>            this.absoluteThreshold = absoluteThreshold;<a name="line.67"></a>
+<FONT color="green">068</FONT>        }<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /** {@inheritDoc} */<a name="line.70"></a>
+<FONT color="green">071</FONT>        public boolean converged(final int iteration,<a name="line.71"></a>
+<FONT color="green">072</FONT>                                 final RealPointValuePair previous,<a name="line.72"></a>
+<FONT color="green">073</FONT>                                 final RealPointValuePair current) {<a name="line.73"></a>
+<FONT color="green">074</FONT>            final double p          = previous.getValue();<a name="line.74"></a>
+<FONT color="green">075</FONT>            final double c          = current.getValue();<a name="line.75"></a>
+<FONT color="green">076</FONT>            final double difference = Math.abs(p - c);<a name="line.76"></a>
+<FONT color="green">077</FONT>            final double size       = Math.max(Math.abs(p), Math.abs(c));<a name="line.77"></a>
+<FONT color="green">078</FONT>            return (difference &lt;= (size * relativeThreshold)) || (difference &lt;= absoluteThreshold);<a name="line.78"></a>
+<FONT color="green">079</FONT>        }<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>    }<a name="line.81"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/SimpleVectorialPointChecker.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,155 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Simple implementation of the {@link VectorialConvergenceChecker} interface using<a name="line.23"></a>
+<FONT color="green">024</FONT>     * only point coordinates.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Convergence is considered to have been reached if either the relative<a name="line.26"></a>
+<FONT color="green">027</FONT>     * difference between each point coordinate are smaller than a threshold<a name="line.27"></a>
+<FONT color="green">028</FONT>     * or if either the absolute difference between the point coordinates are<a name="line.28"></a>
+<FONT color="green">029</FONT>     * smaller than another threshold.<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 2.0<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public class SimpleVectorialPointChecker implements VectorialConvergenceChecker {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Default relative threshold. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private static final double DEFAULT_RELATIVE_THRESHOLD = 100 * MathUtils.EPSILON;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Default absolute threshold. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private static final double DEFAULT_ABSOLUTE_THRESHOLD = 100 * MathUtils.SAFE_MIN;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Relative tolerance threshold. */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private final double relativeThreshold;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Absolute tolerance threshold. */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private final double absoluteThreshold;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>       /** Build an instance with default threshold.<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        public SimpleVectorialPointChecker() {<a name="line.50"></a>
+<FONT color="green">051</FONT>            this.relativeThreshold = DEFAULT_RELATIVE_THRESHOLD;<a name="line.51"></a>
+<FONT color="green">052</FONT>            this.absoluteThreshold = DEFAULT_ABSOLUTE_THRESHOLD;<a name="line.52"></a>
+<FONT color="green">053</FONT>        }<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** Build an instance with a specified threshold.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * &lt;p&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>         * In order to perform only relative checks, the absolute tolerance<a name="line.57"></a>
+<FONT color="green">058</FONT>         * must be set to a negative value. In order to perform only absolute<a name="line.58"></a>
+<FONT color="green">059</FONT>         * checks, the relative tolerance must be set to a negative value.<a name="line.59"></a>
+<FONT color="green">060</FONT>         * &lt;/p&gt;<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param relativeThreshold relative tolerance threshold<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param absoluteThreshold absolute tolerance threshold<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public SimpleVectorialPointChecker(final double relativeThreshold,<a name="line.64"></a>
+<FONT color="green">065</FONT>                                           final double absoluteThreshold) {<a name="line.65"></a>
+<FONT color="green">066</FONT>            this.relativeThreshold = relativeThreshold;<a name="line.66"></a>
+<FONT color="green">067</FONT>            this.absoluteThreshold = absoluteThreshold;<a name="line.67"></a>
+<FONT color="green">068</FONT>        }<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /** {@inheritDoc} */<a name="line.70"></a>
+<FONT color="green">071</FONT>        public boolean converged(final int iteration,<a name="line.71"></a>
+<FONT color="green">072</FONT>                                 final VectorialPointValuePair previous,<a name="line.72"></a>
+<FONT color="green">073</FONT>                                 final VectorialPointValuePair current) {<a name="line.73"></a>
+<FONT color="green">074</FONT>            final double[] p = previous.getPointRef();<a name="line.74"></a>
+<FONT color="green">075</FONT>            final double[] c = current.getPointRef();<a name="line.75"></a>
+<FONT color="green">076</FONT>            for (int i = 0; i &lt; p.length; ++i) {<a name="line.76"></a>
+<FONT color="green">077</FONT>                final double pi         = p[i];<a name="line.77"></a>
+<FONT color="green">078</FONT>                final double ci         = c[i];<a name="line.78"></a>
+<FONT color="green">079</FONT>                final double difference = Math.abs(pi - ci);<a name="line.79"></a>
+<FONT color="green">080</FONT>                final double size       = Math.max(Math.abs(pi), Math.abs(ci));<a name="line.80"></a>
+<FONT color="green">081</FONT>                if ((difference &gt; (size * relativeThreshold)) &amp;&amp;<a name="line.81"></a>
+<FONT color="green">082</FONT>                    (difference &gt; absoluteThreshold)) {<a name="line.82"></a>
+<FONT color="green">083</FONT>                    return false;<a name="line.83"></a>
+<FONT color="green">084</FONT>                }<a name="line.84"></a>
+<FONT color="green">085</FONT>            }<a name="line.85"></a>
+<FONT color="green">086</FONT>            return true;<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>    }<a name="line.89"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/SimpleVectorialValueChecker.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,155 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Simple implementation of the {@link VectorialConvergenceChecker} interface using<a name="line.23"></a>
+<FONT color="green">024</FONT>     * only objective function values.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Convergence is considered to have been reached if either the relative<a name="line.26"></a>
+<FONT color="green">027</FONT>     * difference between the objective function values is smaller than a<a name="line.27"></a>
+<FONT color="green">028</FONT>     * threshold or if either the absolute difference between the objective<a name="line.28"></a>
+<FONT color="green">029</FONT>     * function values is smaller than another threshold for all vectors elements.<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 2.0<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public class SimpleVectorialValueChecker implements VectorialConvergenceChecker {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Default relative threshold. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private static final double DEFAULT_RELATIVE_THRESHOLD = 100 * MathUtils.EPSILON;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Default absolute threshold. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private static final double DEFAULT_ABSOLUTE_THRESHOLD = 100 * MathUtils.SAFE_MIN;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Relative tolerance threshold. */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private final double relativeThreshold;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Absolute tolerance threshold. */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private final double absoluteThreshold;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>       /** Build an instance with default threshold.<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        public SimpleVectorialValueChecker() {<a name="line.50"></a>
+<FONT color="green">051</FONT>            this.relativeThreshold = DEFAULT_RELATIVE_THRESHOLD;<a name="line.51"></a>
+<FONT color="green">052</FONT>            this.absoluteThreshold = DEFAULT_ABSOLUTE_THRESHOLD;<a name="line.52"></a>
+<FONT color="green">053</FONT>        }<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** Build an instance with a specified threshold.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * &lt;p&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>         * In order to perform only relative checks, the absolute tolerance<a name="line.57"></a>
+<FONT color="green">058</FONT>         * must be set to a negative value. In order to perform only absolute<a name="line.58"></a>
+<FONT color="green">059</FONT>         * checks, the relative tolerance must be set to a negative value.<a name="line.59"></a>
+<FONT color="green">060</FONT>         * &lt;/p&gt;<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param relativeThreshold relative tolerance threshold<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param absoluteThreshold absolute tolerance threshold<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public SimpleVectorialValueChecker(final double relativeThreshold,<a name="line.64"></a>
+<FONT color="green">065</FONT>                                           final double absoluteThreshold) {<a name="line.65"></a>
+<FONT color="green">066</FONT>            this.relativeThreshold = relativeThreshold;<a name="line.66"></a>
+<FONT color="green">067</FONT>            this.absoluteThreshold = absoluteThreshold;<a name="line.67"></a>
+<FONT color="green">068</FONT>        }<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /** {@inheritDoc} */<a name="line.70"></a>
+<FONT color="green">071</FONT>        public boolean converged(final int iteration,<a name="line.71"></a>
+<FONT color="green">072</FONT>                                 final VectorialPointValuePair previous,<a name="line.72"></a>
+<FONT color="green">073</FONT>                                 final VectorialPointValuePair current) {<a name="line.73"></a>
+<FONT color="green">074</FONT>            final double[] p        = previous.getValueRef();<a name="line.74"></a>
+<FONT color="green">075</FONT>            final double[] c        = current.getValueRef();<a name="line.75"></a>
+<FONT color="green">076</FONT>            for (int i = 0; i &lt; p.length; ++i) {<a name="line.76"></a>
+<FONT color="green">077</FONT>                final double pi         = p[i];<a name="line.77"></a>
+<FONT color="green">078</FONT>                final double ci         = c[i];<a name="line.78"></a>
+<FONT color="green">079</FONT>                final double difference = Math.abs(pi - ci);<a name="line.79"></a>
+<FONT color="green">080</FONT>                final double size       = Math.max(Math.abs(pi), Math.abs(ci));<a name="line.80"></a>
+<FONT color="green">081</FONT>                if ((difference &gt; (size * relativeThreshold)) &amp;&amp;<a name="line.81"></a>
+<FONT color="green">082</FONT>                    (difference &gt; absoluteThreshold)) {<a name="line.82"></a>
+<FONT color="green">083</FONT>                    return false;<a name="line.83"></a>
+<FONT color="green">084</FONT>                }<a name="line.84"></a>
+<FONT color="green">085</FONT>            }<a name="line.85"></a>
+<FONT color="green">086</FONT>            return true;<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>    }<a name="line.89"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/UnivariateRealOptimizer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,182 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.optimization;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ConvergingAlgorithm;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Interface for (univariate real) optimization algorithms.<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @since 2.0<a name="line.29"></a>
+<FONT color="green">030</FONT>     */<a name="line.30"></a>
+<FONT color="green">031</FONT>    public interface UnivariateRealOptimizer extends ConvergingAlgorithm {<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** Set the maximal number of functions evaluations.<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @param maxEvaluations maximal number of function evaluations<a name="line.34"></a>
+<FONT color="green">035</FONT>         */<a name="line.35"></a>
+<FONT color="green">036</FONT>        void setMaxEvaluations(int maxEvaluations);<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Get the maximal number of functions evaluations.<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @return maximal number of functions evaluations<a name="line.39"></a>
+<FONT color="green">040</FONT>         */<a name="line.40"></a>
+<FONT color="green">041</FONT>        int getMaxEvaluations();<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** Get the number of evaluations of the objective function.<a name="line.43"></a>
+<FONT color="green">044</FONT>         * &lt;p&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>         * The number of evaluations corresponds to the last call to the<a name="line.45"></a>
+<FONT color="green">046</FONT>         * {@link #optimize(UnivariateRealFunction, GoalType, double, double) optimize}<a name="line.46"></a>
+<FONT color="green">047</FONT>         * method. It is 0 if the method has not been called yet.<a name="line.47"></a>
+<FONT color="green">048</FONT>         * &lt;/p&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @return number of evaluations of the objective function<a name="line.49"></a>
+<FONT color="green">050</FONT>         */<a name="line.50"></a>
+<FONT color="green">051</FONT>        int getEvaluations();<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Find an optimum in the given interval.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * &lt;p&gt;<a name="line.55"></a>
+<FONT color="green">056</FONT>         * An optimizer may require that the interval brackets a single optimum.<a name="line.56"></a>
+<FONT color="green">057</FONT>         * &lt;/p&gt;<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @param f the function to optimize.<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @param goalType type of optimization goal: either {@link GoalType#MAXIMIZE}<a name="line.59"></a>
+<FONT color="green">060</FONT>         * or {@link GoalType#MINIMIZE}<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param min the lower bound for the interval.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param max the upper bound for the interval.<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @return a value where the function is optimum<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @throws ConvergenceException if the maximum iteration count is exceeded<a name="line.64"></a>
+<FONT color="green">065</FONT>         * or the optimizer detects convergence problems otherwise.<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.66"></a>
+<FONT color="green">067</FONT>         * function<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @throws IllegalArgumentException if min &gt; max or the endpoints do not<a name="line.68"></a>
+<FONT color="green">069</FONT>         * satisfy the requirements specified by the optimizer<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        double optimize(UnivariateRealFunction f, GoalType goalType,<a name="line.71"></a>
+<FONT color="green">072</FONT>                        double min, double max)<a name="line.72"></a>
+<FONT color="green">073</FONT>            throws ConvergenceException, FunctionEvaluationException;<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /**<a name="line.75"></a>
+<FONT color="green">076</FONT>         * Find an optimum in the given interval, start at startValue.<a name="line.76"></a>
+<FONT color="green">077</FONT>         * &lt;p&gt;<a name="line.77"></a>
+<FONT color="green">078</FONT>         * An optimizer may require that the interval brackets a single optimum.<a name="line.78"></a>
+<FONT color="green">079</FONT>         * &lt;/p&gt;<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @param f the function to optimize.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @param goalType type of optimization goal: either {@link GoalType#MAXIMIZE}<a name="line.81"></a>
+<FONT color="green">082</FONT>         * or {@link GoalType#MINIMIZE}<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param min the lower bound for the interval.<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @param max the upper bound for the interval.<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @param startValue the start value to use<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @return a value where the function is optimum<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @throws ConvergenceException if the maximum iteration count is exceeded<a name="line.87"></a>
+<FONT color="green">088</FONT>         * or the optimizer detects convergence problems otherwise.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating the<a name="line.89"></a>
+<FONT color="green">090</FONT>         * function<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @throws IllegalArgumentException if min &gt; max or the arguments do not<a name="line.91"></a>
+<FONT color="green">092</FONT>         * satisfy the requirements specified by the optimizer<a name="line.92"></a>
+<FONT color="green">093</FONT>         */<a name="line.93"></a>
+<FONT color="green">094</FONT>        double optimize(UnivariateRealFunction f, GoalType goalType,<a name="line.94"></a>
+<FONT color="green">095</FONT>                        double min, double max, double startValue)<a name="line.95"></a>
+<FONT color="green">096</FONT>            throws ConvergenceException, FunctionEvaluationException;<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /**<a name="line.98"></a>
+<FONT color="green">099</FONT>         * Get the result of the last run of the optimizer.<a name="line.99"></a>
+<FONT color="green">100</FONT>         *<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @return the last result.<a name="line.101"></a>
+<FONT color="green">102</FONT>         * @throws IllegalStateException if there is no result available, either<a name="line.102"></a>
+<FONT color="green">103</FONT>         * because no result was yet computed or the last attempt failed.<a name="line.103"></a>
+<FONT color="green">104</FONT>         */<a name="line.104"></a>
+<FONT color="green">105</FONT>        double getResult();<a name="line.105"></a>
+<FONT color="green">106</FONT>    <a name="line.106"></a>
+<FONT color="green">107</FONT>        /**<a name="line.107"></a>
+<FONT color="green">108</FONT>         * Get the result of the last run of the optimizer.<a name="line.108"></a>
+<FONT color="green">109</FONT>         *<a name="line.109"></a>
+<FONT color="green">110</FONT>         * @return the value of the function at the last result.<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @throws IllegalStateException if there is no result available, either<a name="line.111"></a>
+<FONT color="green">112</FONT>         * because no result was yet computed or the last attempt failed.<a name="line.112"></a>
+<FONT color="green">113</FONT>         */<a name="line.113"></a>
+<FONT color="green">114</FONT>        double getFunctionValue();<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>    }<a name="line.116"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/VectorialConvergenceChecker.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,121 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /** This interface specifies how to check if a {@link<a name="line.20"></a>
+<FONT color="green">021</FONT>     * DifferentiableMultivariateVectorialOptimizer optimization algorithm} has converged.<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;p&gt;Deciding if convergence has been reached is a problem-dependent issue. The<a name="line.23"></a>
+<FONT color="green">024</FONT>     * user should provide a class implementing this interface to allow the optimization<a name="line.24"></a>
+<FONT color="green">025</FONT>     * algorithm to stop its search according to the problem at hand.&lt;/p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;For convenience, two implementations that fit simple needs are already provided:<a name="line.26"></a>
+<FONT color="green">027</FONT>     * {@link SimpleVectorialValueChecker} and {@link SimpleVectorialPointChecker}. The first<a name="line.27"></a>
+<FONT color="green">028</FONT>     * one considers convergence is reached when the objective function value does not<a name="line.28"></a>
+<FONT color="green">029</FONT>     * change much anymore, it does not use the point set at all. The second one<a name="line.29"></a>
+<FONT color="green">030</FONT>     * considers convergence is reached when the input point set does not change<a name="line.30"></a>
+<FONT color="green">031</FONT>     * much anymore, it does not use objective function value at all.&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     *<a name="line.32"></a>
+<FONT color="green">033</FONT>     * @version $Revision: 780674 $ $Date: 2009-06-01 11:10:55 -0400 (Mon, 01 Jun 2009) $<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @since 2.0<a name="line.34"></a>
+<FONT color="green">035</FONT>     */<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>    public interface VectorialConvergenceChecker {<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>      /** Check if the optimization algorithm has converged considering the last points.<a name="line.39"></a>
+<FONT color="green">040</FONT>       * &lt;p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>       * This method may be called several time from the same algorithm iteration with<a name="line.41"></a>
+<FONT color="green">042</FONT>       * different points. This can be detected by checking the iteration number at each<a name="line.42"></a>
+<FONT color="green">043</FONT>       * call if needed. Each time this method is called, the previous and current point<a name="line.43"></a>
+<FONT color="green">044</FONT>       * correspond to points with the same role at each iteration, so they can be<a name="line.44"></a>
+<FONT color="green">045</FONT>       * compared. As an example, simplex-based algorithms call this method for all<a name="line.45"></a>
+<FONT color="green">046</FONT>       * points of the simplex, not only for the best or worst ones.<a name="line.46"></a>
+<FONT color="green">047</FONT>       * &lt;/p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>       * @param iteration index of current iteration<a name="line.48"></a>
+<FONT color="green">049</FONT>       * @param previous point from previous iteration<a name="line.49"></a>
+<FONT color="green">050</FONT>       * @param current point from current iteration<a name="line.50"></a>
+<FONT color="green">051</FONT>       * @return true if the algorithm is considered to have converged<a name="line.51"></a>
+<FONT color="green">052</FONT>       */<a name="line.52"></a>
+<FONT color="green">053</FONT>      boolean converged(int iteration, VectorialPointValuePair previous, VectorialPointValuePair current);<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>    }<a name="line.55"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/VectorialPointValuePair.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,162 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This class holds a point and the vectorial value of an objective function at this point.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;This is a simple immutable container.&lt;/p&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @see RealPointValuePair<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @see org.apache.commons.math.analysis.MultivariateVectorialFunction<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @since 2.0<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public class VectorialPointValuePair implements Serializable {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** Serializable version identifier. */<a name="line.32"></a>
+<FONT color="green">033</FONT>        private static final long serialVersionUID = 1003888396256744753L;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Point coordinates. */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private final double[] point;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Vectorial value of the objective function at the point. */<a name="line.38"></a>
+<FONT color="green">039</FONT>        private final double[] value;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Build a point/objective function value pair.<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @param point point coordinates (the built instance will store<a name="line.42"></a>
+<FONT color="green">043</FONT>         * a copy of the array, not the array passed as argument)<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @param value value of an objective function at the point<a name="line.44"></a>
+<FONT color="green">045</FONT>         */<a name="line.45"></a>
+<FONT color="green">046</FONT>        public VectorialPointValuePair(final double[] point, final double[] value) {<a name="line.46"></a>
+<FONT color="green">047</FONT>            this.point = point.clone();<a name="line.47"></a>
+<FONT color="green">048</FONT>            this.value = value.clone();<a name="line.48"></a>
+<FONT color="green">049</FONT>        }<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /** Build a point/objective function value pair.<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @param point point coordinates (the built instance will store<a name="line.52"></a>
+<FONT color="green">053</FONT>         * a copy of the array, not the array passed as argument)<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @param value value of an objective function at the point<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param copyArray if true, the input arrays will be copied, otherwise<a name="line.55"></a>
+<FONT color="green">056</FONT>         * they will be referenced<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        public VectorialPointValuePair(final double[] point, final double[] value,<a name="line.58"></a>
+<FONT color="green">059</FONT>                                       final boolean copyArray) {<a name="line.59"></a>
+<FONT color="green">060</FONT>            this.point = copyArray ? point.clone() : point;<a name="line.60"></a>
+<FONT color="green">061</FONT>            this.value = copyArray ? value.clone() : value;<a name="line.61"></a>
+<FONT color="green">062</FONT>        }<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /** Get the point.<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @return a copy of the stored point<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        public double[] getPoint() {<a name="line.67"></a>
+<FONT color="green">068</FONT>            return point.clone();<a name="line.68"></a>
+<FONT color="green">069</FONT>        }<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** Get a reference to the point.<a name="line.71"></a>
+<FONT color="green">072</FONT>         * &lt;p&gt;This method is provided as a convenience to avoid copying<a name="line.72"></a>
+<FONT color="green">073</FONT>         * the array, the elements of the array should &lt;em&gt;not&lt;/em&gt; be modified.&lt;/p&gt;<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @return a reference to the internal array storing the point<a name="line.74"></a>
+<FONT color="green">075</FONT>         */<a name="line.75"></a>
+<FONT color="green">076</FONT>        public double[] getPointRef() {<a name="line.76"></a>
+<FONT color="green">077</FONT>            return point;<a name="line.77"></a>
+<FONT color="green">078</FONT>        }<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /** Get the value of the objective function.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @return a copy of the stored value of the objective function<a name="line.81"></a>
+<FONT color="green">082</FONT>         */<a name="line.82"></a>
+<FONT color="green">083</FONT>        public double[] getValue() {<a name="line.83"></a>
+<FONT color="green">084</FONT>            return value.clone();<a name="line.84"></a>
+<FONT color="green">085</FONT>        }<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>        /** Get a reference to the value of the objective function.<a name="line.87"></a>
+<FONT color="green">088</FONT>         * &lt;p&gt;This method is provided as a convenience to avoid copying<a name="line.88"></a>
+<FONT color="green">089</FONT>         * the array, the elements of the array should &lt;em&gt;not&lt;/em&gt; be modified.&lt;/p&gt;<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @return a reference to the internal array storing the value of the objective function<a name="line.90"></a>
+<FONT color="green">091</FONT>         */<a name="line.91"></a>
+<FONT color="green">092</FONT>        public double[] getValueRef() {<a name="line.92"></a>
+<FONT color="green">093</FONT>            return value;<a name="line.93"></a>
+<FONT color="green">094</FONT>        }<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>    }<a name="line.96"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,492 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.direct;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.Comparator;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.MaxEvaluationsExceededException;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.analysis.MultivariateRealFunction;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.optimization.GoalType;<a name="line.28"></a>
+<FONT color="green">029</FONT>    import org.apache.commons.math.optimization.MultivariateRealOptimizer;<a name="line.29"></a>
+<FONT color="green">030</FONT>    import org.apache.commons.math.optimization.OptimizationException;<a name="line.30"></a>
+<FONT color="green">031</FONT>    import org.apache.commons.math.optimization.RealConvergenceChecker;<a name="line.31"></a>
+<FONT color="green">032</FONT>    import org.apache.commons.math.optimization.RealPointValuePair;<a name="line.32"></a>
+<FONT color="green">033</FONT>    import org.apache.commons.math.optimization.SimpleScalarValueChecker;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>    /**<a name="line.35"></a>
+<FONT color="green">036</FONT>     * This class implements simplex-based direct search optimization<a name="line.36"></a>
+<FONT color="green">037</FONT>     * algorithms.<a name="line.37"></a>
+<FONT color="green">038</FONT>     *<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;p&gt;Direct search methods only use objective function values, they don't<a name="line.39"></a>
+<FONT color="green">040</FONT>     * need derivatives and don't either try to compute approximation of<a name="line.40"></a>
+<FONT color="green">041</FONT>     * the derivatives. According to a 1996 paper by Margaret H. Wright<a name="line.41"></a>
+<FONT color="green">042</FONT>     * (&lt;a href="http://cm.bell-labs.com/cm/cs/doc/96/4-02.ps.gz"&gt;Direct<a name="line.42"></a>
+<FONT color="green">043</FONT>     * Search Methods: Once Scorned, Now Respectable&lt;/a&gt;), they are used<a name="line.43"></a>
+<FONT color="green">044</FONT>     * when either the computation of the derivative is impossible (noisy<a name="line.44"></a>
+<FONT color="green">045</FONT>     * functions, unpredictable discontinuities) or difficult (complexity,<a name="line.45"></a>
+<FONT color="green">046</FONT>     * computation cost). In the first cases, rather than an optimum, a<a name="line.46"></a>
+<FONT color="green">047</FONT>     * &lt;em&gt;not too bad&lt;/em&gt; point is desired. In the latter cases, an<a name="line.47"></a>
+<FONT color="green">048</FONT>     * optimum is desired but cannot be reasonably found. In all cases<a name="line.48"></a>
+<FONT color="green">049</FONT>     * direct search methods can be useful.&lt;/p&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     *<a name="line.50"></a>
+<FONT color="green">051</FONT>     * &lt;p&gt;Simplex-based direct search methods are based on comparison of<a name="line.51"></a>
+<FONT color="green">052</FONT>     * the objective function values at the vertices of a simplex (which is a<a name="line.52"></a>
+<FONT color="green">053</FONT>     * set of n+1 points in dimension n) that is updated by the algorithms<a name="line.53"></a>
+<FONT color="green">054</FONT>     * steps.&lt;p&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>     *<a name="line.55"></a>
+<FONT color="green">056</FONT>     * &lt;p&gt;The initial configuration of the simplex can be set using either<a name="line.56"></a>
+<FONT color="green">057</FONT>     * {@link #setStartConfiguration(double[])} or {@link<a name="line.57"></a>
+<FONT color="green">058</FONT>     * #setStartConfiguration(double[][])}. If neither method has been called<a name="line.58"></a>
+<FONT color="green">059</FONT>     * before optimization is attempted, an explicit call to the first method<a name="line.59"></a>
+<FONT color="green">060</FONT>     * with all steps set to +1 is triggered, thus building a default<a name="line.60"></a>
+<FONT color="green">061</FONT>     * configuration from a unit hypercube. Each call to {@link<a name="line.61"></a>
+<FONT color="green">062</FONT>     * #optimize(MultivariateRealFunction, GoalType, double[]) optimize} will reuse<a name="line.62"></a>
+<FONT color="green">063</FONT>     * the current start configuration and move it such that its first vertex<a name="line.63"></a>
+<FONT color="green">064</FONT>     * is at the provided start point of the optimization. If the same optimizer<a name="line.64"></a>
+<FONT color="green">065</FONT>     * is used to solve different problems and the number of parameters change,<a name="line.65"></a>
+<FONT color="green">066</FONT>     * the start configuration &lt;em&gt;must&lt;/em&gt; be reset or a dimension mismatch<a name="line.66"></a>
+<FONT color="green">067</FONT>     * will occur.&lt;/p&gt;<a name="line.67"></a>
+<FONT color="green">068</FONT>     *<a name="line.68"></a>
+<FONT color="green">069</FONT>     * &lt;p&gt;If {@link #setConvergenceChecker(RealConvergenceChecker)} is not called,<a name="line.69"></a>
+<FONT color="green">070</FONT>     * a default {@link SimpleScalarValueChecker} is used.&lt;/p&gt;<a name="line.70"></a>
+<FONT color="green">071</FONT>     *<a name="line.71"></a>
+<FONT color="green">072</FONT>     * &lt;p&gt;Convergence is checked by providing the &lt;em&gt;worst&lt;/em&gt; points of<a name="line.72"></a>
+<FONT color="green">073</FONT>     * previous and current simplex to the convergence checker, not the best ones.&lt;/p&gt;<a name="line.73"></a>
+<FONT color="green">074</FONT>     *<a name="line.74"></a>
+<FONT color="green">075</FONT>     * &lt;p&gt;This class is the base class performing the boilerplate simplex<a name="line.75"></a>
+<FONT color="green">076</FONT>     * initialization and handling. The simplex update by itself is<a name="line.76"></a>
+<FONT color="green">077</FONT>     * performed by the derived classes according to the implemented<a name="line.77"></a>
+<FONT color="green">078</FONT>     * algorithms.&lt;/p&gt;<a name="line.78"></a>
+<FONT color="green">079</FONT>     *<a name="line.79"></a>
+<FONT color="green">080</FONT>     * implements MultivariateRealOptimizer since 2.0<a name="line.80"></a>
+<FONT color="green">081</FONT>     *<a name="line.81"></a>
+<FONT color="green">082</FONT>     * @see MultivariateRealFunction<a name="line.82"></a>
+<FONT color="green">083</FONT>     * @see NelderMead<a name="line.83"></a>
+<FONT color="green">084</FONT>     * @see MultiDirectional<a name="line.84"></a>
+<FONT color="green">085</FONT>     * @version $Revision: 885278 $ $Date: 2009-11-29 16:47:51 -0500 (Sun, 29 Nov 2009) $<a name="line.85"></a>
+<FONT color="green">086</FONT>     * @since 1.2<a name="line.86"></a>
+<FONT color="green">087</FONT>     */<a name="line.87"></a>
+<FONT color="green">088</FONT>    public abstract class DirectSearchOptimizer implements MultivariateRealOptimizer {<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>        /** Message for equal vertices. */<a name="line.90"></a>
+<FONT color="green">091</FONT>        private static final String EQUAL_VERTICES_MESSAGE =<a name="line.91"></a>
+<FONT color="green">092</FONT>            "equal vertices {0} and {1} in simplex configuration";<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>        /** Message for dimension mismatch. */<a name="line.94"></a>
+<FONT color="green">095</FONT>        private static final String DIMENSION_MISMATCH_MESSAGE =<a name="line.95"></a>
+<FONT color="green">096</FONT>            "dimension mismatch {0} != {1}";<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /** Simplex. */<a name="line.98"></a>
+<FONT color="green">099</FONT>        protected RealPointValuePair[] simplex;<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /** Objective function. */<a name="line.101"></a>
+<FONT color="green">102</FONT>        private MultivariateRealFunction f;<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /** Convergence checker. */<a name="line.104"></a>
+<FONT color="green">105</FONT>        private RealConvergenceChecker checker;<a name="line.105"></a>
+<FONT color="green">106</FONT>    <a name="line.106"></a>
+<FONT color="green">107</FONT>        /** Maximal number of iterations allowed. */<a name="line.107"></a>
+<FONT color="green">108</FONT>        private int maxIterations;<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>        /** Number of iterations already performed. */<a name="line.110"></a>
+<FONT color="green">111</FONT>        private int iterations;<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>        /** Maximal number of evaluations allowed. */<a name="line.113"></a>
+<FONT color="green">114</FONT>        private int maxEvaluations;<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>        /** Number of evaluations already performed. */<a name="line.116"></a>
+<FONT color="green">117</FONT>        private int evaluations;<a name="line.117"></a>
+<FONT color="green">118</FONT>    <a name="line.118"></a>
+<FONT color="green">119</FONT>        /** Start simplex configuration. */<a name="line.119"></a>
+<FONT color="green">120</FONT>        private double[][] startConfiguration;<a name="line.120"></a>
+<FONT color="green">121</FONT>    <a name="line.121"></a>
+<FONT color="green">122</FONT>        /** Simple constructor.<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        protected DirectSearchOptimizer() {<a name="line.124"></a>
+<FONT color="green">125</FONT>            setConvergenceChecker(new SimpleScalarValueChecker());<a name="line.125"></a>
+<FONT color="green">126</FONT>            setMaxIterations(Integer.MAX_VALUE);<a name="line.126"></a>
+<FONT color="green">127</FONT>            setMaxEvaluations(Integer.MAX_VALUE);<a name="line.127"></a>
+<FONT color="green">128</FONT>        }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /** Set start configuration for simplex.<a name="line.130"></a>
+<FONT color="green">131</FONT>         * &lt;p&gt;The start configuration for simplex is built from a box parallel to<a name="line.131"></a>
+<FONT color="green">132</FONT>         * the canonical axes of the space. The simplex is the subset of vertices<a name="line.132"></a>
+<FONT color="green">133</FONT>         * of a box parallel to the canonical axes. It is built as the path followed<a name="line.133"></a>
+<FONT color="green">134</FONT>         * while traveling from one vertex of the box to the diagonally opposite<a name="line.134"></a>
+<FONT color="green">135</FONT>         * vertex moving only along the box edges. The first vertex of the box will<a name="line.135"></a>
+<FONT color="green">136</FONT>         * be located at the start point of the optimization.&lt;/p&gt;<a name="line.136"></a>
+<FONT color="green">137</FONT>         * &lt;p&gt;As an example, in dimension 3 a simplex has 4 vertices. Setting the<a name="line.137"></a>
+<FONT color="green">138</FONT>         * steps to (1, 10, 2) and the start point to (1, 1, 1) would imply the<a name="line.138"></a>
+<FONT color="green">139</FONT>         * start simplex would be: { (1, 1, 1), (2, 1, 1), (2, 11, 1), (2, 11, 3) }.<a name="line.139"></a>
+<FONT color="green">140</FONT>         * The first vertex would be set to the start point at (1, 1, 1) and the<a name="line.140"></a>
+<FONT color="green">141</FONT>         * last vertex would be set to the diagonally opposite vertex at (2, 11, 3).&lt;/p&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>         * @param steps steps along the canonical axes representing box edges,<a name="line.142"></a>
+<FONT color="green">143</FONT>         * they may be negative but not null<a name="line.143"></a>
+<FONT color="green">144</FONT>         * @exception IllegalArgumentException if one step is null<a name="line.144"></a>
+<FONT color="green">145</FONT>         */<a name="line.145"></a>
+<FONT color="green">146</FONT>        public void setStartConfiguration(final double[] steps)<a name="line.146"></a>
+<FONT color="green">147</FONT>            throws IllegalArgumentException {<a name="line.147"></a>
+<FONT color="green">148</FONT>            // only the relative position of the n final vertices with respect<a name="line.148"></a>
+<FONT color="green">149</FONT>            // to the first one are stored<a name="line.149"></a>
+<FONT color="green">150</FONT>            final int n = steps.length;<a name="line.150"></a>
+<FONT color="green">151</FONT>            startConfiguration = new double[n][n];<a name="line.151"></a>
+<FONT color="green">152</FONT>            for (int i = 0; i &lt; n; ++i) {<a name="line.152"></a>
+<FONT color="green">153</FONT>                final double[] vertexI = startConfiguration[i];<a name="line.153"></a>
+<FONT color="green">154</FONT>                for (int j = 0; j &lt; i + 1; ++j) {<a name="line.154"></a>
+<FONT color="green">155</FONT>                    if (steps[j] == 0.0) {<a name="line.155"></a>
+<FONT color="green">156</FONT>                        throw MathRuntimeException.createIllegalArgumentException(<a name="line.156"></a>
+<FONT color="green">157</FONT>                              EQUAL_VERTICES_MESSAGE, j, j + 1);<a name="line.157"></a>
+<FONT color="green">158</FONT>                    }<a name="line.158"></a>
+<FONT color="green">159</FONT>                    System.arraycopy(steps, 0, vertexI, 0, j + 1);<a name="line.159"></a>
+<FONT color="green">160</FONT>                }<a name="line.160"></a>
+<FONT color="green">161</FONT>            }<a name="line.161"></a>
+<FONT color="green">162</FONT>        }<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>        /** Set start configuration for simplex.<a name="line.164"></a>
+<FONT color="green">165</FONT>         * &lt;p&gt;The real initial simplex will be set up by moving the reference<a name="line.165"></a>
+<FONT color="green">166</FONT>         * simplex such that its first point is located at the start point of the<a name="line.166"></a>
+<FONT color="green">167</FONT>         * optimization.&lt;/p&gt;<a name="line.167"></a>
+<FONT color="green">168</FONT>         * @param referenceSimplex reference simplex<a name="line.168"></a>
+<FONT color="green">169</FONT>         * @exception IllegalArgumentException if the reference simplex does not<a name="line.169"></a>
+<FONT color="green">170</FONT>         * contain at least one point, or if there is a dimension mismatch<a name="line.170"></a>
+<FONT color="green">171</FONT>         * in the reference simplex or if one of its vertices is duplicated<a name="line.171"></a>
+<FONT color="green">172</FONT>         */<a name="line.172"></a>
+<FONT color="green">173</FONT>        public void setStartConfiguration(final double[][] referenceSimplex)<a name="line.173"></a>
+<FONT color="green">174</FONT>            throws IllegalArgumentException {<a name="line.174"></a>
+<FONT color="green">175</FONT>    <a name="line.175"></a>
+<FONT color="green">176</FONT>            // only the relative position of the n final vertices with respect<a name="line.176"></a>
+<FONT color="green">177</FONT>            // to the first one are stored<a name="line.177"></a>
+<FONT color="green">178</FONT>            final int n = referenceSimplex.length - 1;<a name="line.178"></a>
+<FONT color="green">179</FONT>            if (n &lt; 0) {<a name="line.179"></a>
+<FONT color="green">180</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.180"></a>
+<FONT color="green">181</FONT>                        "simplex must contain at least one point");<a name="line.181"></a>
+<FONT color="green">182</FONT>            }<a name="line.182"></a>
+<FONT color="green">183</FONT>            startConfiguration = new double[n][n];<a name="line.183"></a>
+<FONT color="green">184</FONT>            final double[] ref0 = referenceSimplex[0];<a name="line.184"></a>
+<FONT color="green">185</FONT>    <a name="line.185"></a>
+<FONT color="green">186</FONT>            // vertices loop<a name="line.186"></a>
+<FONT color="green">187</FONT>            for (int i = 0; i &lt; n + 1; ++i) {<a name="line.187"></a>
+<FONT color="green">188</FONT>    <a name="line.188"></a>
+<FONT color="green">189</FONT>                final double[] refI = referenceSimplex[i];<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>                // safety checks<a name="line.191"></a>
+<FONT color="green">192</FONT>                if (refI.length != n) {<a name="line.192"></a>
+<FONT color="green">193</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.193"></a>
+<FONT color="green">194</FONT>                          DIMENSION_MISMATCH_MESSAGE, refI.length, n);<a name="line.194"></a>
+<FONT color="green">195</FONT>                }<a name="line.195"></a>
+<FONT color="green">196</FONT>                for (int j = 0; j &lt; i; ++j) {<a name="line.196"></a>
+<FONT color="green">197</FONT>                    final double[] refJ = referenceSimplex[j];<a name="line.197"></a>
+<FONT color="green">198</FONT>                    boolean allEquals = true;<a name="line.198"></a>
+<FONT color="green">199</FONT>                    for (int k = 0; k &lt; n; ++k) {<a name="line.199"></a>
+<FONT color="green">200</FONT>                        if (refI[k] != refJ[k]) {<a name="line.200"></a>
+<FONT color="green">201</FONT>                            allEquals = false;<a name="line.201"></a>
+<FONT color="green">202</FONT>                            break;<a name="line.202"></a>
+<FONT color="green">203</FONT>                        }<a name="line.203"></a>
+<FONT color="green">204</FONT>                    }<a name="line.204"></a>
+<FONT color="green">205</FONT>                    if (allEquals) {<a name="line.205"></a>
+<FONT color="green">206</FONT>                        throw MathRuntimeException.createIllegalArgumentException(<a name="line.206"></a>
+<FONT color="green">207</FONT>                              EQUAL_VERTICES_MESSAGE, i, j);<a name="line.207"></a>
+<FONT color="green">208</FONT>                    }<a name="line.208"></a>
+<FONT color="green">209</FONT>                }<a name="line.209"></a>
+<FONT color="green">210</FONT>    <a name="line.210"></a>
+<FONT color="green">211</FONT>                // store vertex i position relative to vertex 0 position<a name="line.211"></a>
+<FONT color="green">212</FONT>                if (i &gt; 0) {<a name="line.212"></a>
+<FONT color="green">213</FONT>                    final double[] confI = startConfiguration[i - 1];<a name="line.213"></a>
+<FONT color="green">214</FONT>                    for (int k = 0; k &lt; n; ++k) {<a name="line.214"></a>
+<FONT color="green">215</FONT>                        confI[k] = refI[k] - ref0[k];<a name="line.215"></a>
+<FONT color="green">216</FONT>                    }<a name="line.216"></a>
+<FONT color="green">217</FONT>                }<a name="line.217"></a>
+<FONT color="green">218</FONT>    <a name="line.218"></a>
+<FONT color="green">219</FONT>            }<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>        }<a name="line.221"></a>
+<FONT color="green">222</FONT>    <a name="line.222"></a>
+<FONT color="green">223</FONT>        /** {@inheritDoc} */<a name="line.223"></a>
+<FONT color="green">224</FONT>        public void setMaxIterations(int maxIterations) {<a name="line.224"></a>
+<FONT color="green">225</FONT>            this.maxIterations = maxIterations;<a name="line.225"></a>
+<FONT color="green">226</FONT>        }<a name="line.226"></a>
+<FONT color="green">227</FONT>    <a name="line.227"></a>
+<FONT color="green">228</FONT>        /** {@inheritDoc} */<a name="line.228"></a>
+<FONT color="green">229</FONT>        public int getMaxIterations() {<a name="line.229"></a>
+<FONT color="green">230</FONT>            return maxIterations;<a name="line.230"></a>
+<FONT color="green">231</FONT>        }<a name="line.231"></a>
+<FONT color="green">232</FONT>    <a name="line.232"></a>
+<FONT color="green">233</FONT>        /** {@inheritDoc} */<a name="line.233"></a>
+<FONT color="green">234</FONT>        public void setMaxEvaluations(int maxEvaluations) {<a name="line.234"></a>
+<FONT color="green">235</FONT>            this.maxEvaluations = maxEvaluations;<a name="line.235"></a>
+<FONT color="green">236</FONT>        }<a name="line.236"></a>
+<FONT color="green">237</FONT>    <a name="line.237"></a>
+<FONT color="green">238</FONT>        /** {@inheritDoc} */<a name="line.238"></a>
+<FONT color="green">239</FONT>        public int getMaxEvaluations() {<a name="line.239"></a>
+<FONT color="green">240</FONT>            return maxEvaluations;<a name="line.240"></a>
+<FONT color="green">241</FONT>        }<a name="line.241"></a>
+<FONT color="green">242</FONT>    <a name="line.242"></a>
+<FONT color="green">243</FONT>        /** {@inheritDoc} */<a name="line.243"></a>
+<FONT color="green">244</FONT>        public int getIterations() {<a name="line.244"></a>
+<FONT color="green">245</FONT>            return iterations;<a name="line.245"></a>
+<FONT color="green">246</FONT>        }<a name="line.246"></a>
+<FONT color="green">247</FONT>    <a name="line.247"></a>
+<FONT color="green">248</FONT>        /** {@inheritDoc} */<a name="line.248"></a>
+<FONT color="green">249</FONT>        public int getEvaluations() {<a name="line.249"></a>
+<FONT color="green">250</FONT>            return evaluations;<a name="line.250"></a>
+<FONT color="green">251</FONT>        }<a name="line.251"></a>
+<FONT color="green">252</FONT>    <a name="line.252"></a>
+<FONT color="green">253</FONT>        /** {@inheritDoc} */<a name="line.253"></a>
+<FONT color="green">254</FONT>        public void setConvergenceChecker(RealConvergenceChecker convergenceChecker) {<a name="line.254"></a>
+<FONT color="green">255</FONT>            this.checker = convergenceChecker;<a name="line.255"></a>
+<FONT color="green">256</FONT>        }<a name="line.256"></a>
+<FONT color="green">257</FONT>    <a name="line.257"></a>
+<FONT color="green">258</FONT>        /** {@inheritDoc} */<a name="line.258"></a>
+<FONT color="green">259</FONT>        public RealConvergenceChecker getConvergenceChecker() {<a name="line.259"></a>
+<FONT color="green">260</FONT>            return checker;<a name="line.260"></a>
+<FONT color="green">261</FONT>        }<a name="line.261"></a>
+<FONT color="green">262</FONT>    <a name="line.262"></a>
+<FONT color="green">263</FONT>        /** {@inheritDoc} */<a name="line.263"></a>
+<FONT color="green">264</FONT>        public RealPointValuePair optimize(final MultivariateRealFunction function,<a name="line.264"></a>
+<FONT color="green">265</FONT>                                           final GoalType goalType,<a name="line.265"></a>
+<FONT color="green">266</FONT>                                           final double[] startPoint)<a name="line.266"></a>
+<FONT color="green">267</FONT>            throws FunctionEvaluationException, OptimizationException,<a name="line.267"></a>
+<FONT color="green">268</FONT>            IllegalArgumentException {<a name="line.268"></a>
+<FONT color="green">269</FONT>    <a name="line.269"></a>
+<FONT color="green">270</FONT>            if (startConfiguration == null) {<a name="line.270"></a>
+<FONT color="green">271</FONT>                // no initial configuration has been set up for simplex<a name="line.271"></a>
+<FONT color="green">272</FONT>                // build a default one from a unit hypercube<a name="line.272"></a>
+<FONT color="green">273</FONT>                final double[] unit = new double[startPoint.length];<a name="line.273"></a>
+<FONT color="green">274</FONT>                Arrays.fill(unit, 1.0);<a name="line.274"></a>
+<FONT color="green">275</FONT>                setStartConfiguration(unit);<a name="line.275"></a>
+<FONT color="green">276</FONT>            }<a name="line.276"></a>
+<FONT color="green">277</FONT>    <a name="line.277"></a>
+<FONT color="green">278</FONT>            this.f = function;<a name="line.278"></a>
+<FONT color="green">279</FONT>            final Comparator&lt;RealPointValuePair&gt; comparator =<a name="line.279"></a>
+<FONT color="green">280</FONT>                new Comparator&lt;RealPointValuePair&gt;() {<a name="line.280"></a>
+<FONT color="green">281</FONT>                    public int compare(final RealPointValuePair o1,<a name="line.281"></a>
+<FONT color="green">282</FONT>                                       final RealPointValuePair o2) {<a name="line.282"></a>
+<FONT color="green">283</FONT>                        final double v1 = o1.getValue();<a name="line.283"></a>
+<FONT color="green">284</FONT>                        final double v2 = o2.getValue();<a name="line.284"></a>
+<FONT color="green">285</FONT>                        return (goalType == GoalType.MINIMIZE) ?<a name="line.285"></a>
+<FONT color="green">286</FONT>                                Double.compare(v1, v2) : Double.compare(v2, v1);<a name="line.286"></a>
+<FONT color="green">287</FONT>                    }<a name="line.287"></a>
+<FONT color="green">288</FONT>                };<a name="line.288"></a>
+<FONT color="green">289</FONT>    <a name="line.289"></a>
+<FONT color="green">290</FONT>            // initialize search<a name="line.290"></a>
+<FONT color="green">291</FONT>            iterations  = 0;<a name="line.291"></a>
+<FONT color="green">292</FONT>            evaluations = 0;<a name="line.292"></a>
+<FONT color="green">293</FONT>            buildSimplex(startPoint);<a name="line.293"></a>
+<FONT color="green">294</FONT>            evaluateSimplex(comparator);<a name="line.294"></a>
+<FONT color="green">295</FONT>    <a name="line.295"></a>
+<FONT color="green">296</FONT>            RealPointValuePair[] previous = new RealPointValuePair[simplex.length];<a name="line.296"></a>
+<FONT color="green">297</FONT>            while (true) {<a name="line.297"></a>
+<FONT color="green">298</FONT>    <a name="line.298"></a>
+<FONT color="green">299</FONT>                if (iterations &gt; 0) {<a name="line.299"></a>
+<FONT color="green">300</FONT>                    boolean converged = true;<a name="line.300"></a>
+<FONT color="green">301</FONT>                    for (int i = 0; i &lt; simplex.length; ++i) {<a name="line.301"></a>
+<FONT color="green">302</FONT>                        converged &amp;= checker.converged(iterations, previous[i], simplex[i]);<a name="line.302"></a>
+<FONT color="green">303</FONT>                    }<a name="line.303"></a>
+<FONT color="green">304</FONT>                    if (converged) {<a name="line.304"></a>
+<FONT color="green">305</FONT>                        // we have found an optimum<a name="line.305"></a>
+<FONT color="green">306</FONT>                        return simplex[0];<a name="line.306"></a>
+<FONT color="green">307</FONT>                    }<a name="line.307"></a>
+<FONT color="green">308</FONT>                }<a name="line.308"></a>
+<FONT color="green">309</FONT>    <a name="line.309"></a>
+<FONT color="green">310</FONT>                // we still need to search<a name="line.310"></a>
+<FONT color="green">311</FONT>                System.arraycopy(simplex, 0, previous, 0, simplex.length);<a name="line.311"></a>
+<FONT color="green">312</FONT>                iterateSimplex(comparator);<a name="line.312"></a>
+<FONT color="green">313</FONT>    <a name="line.313"></a>
+<FONT color="green">314</FONT>            }<a name="line.314"></a>
+<FONT color="green">315</FONT>    <a name="line.315"></a>
+<FONT color="green">316</FONT>        }<a name="line.316"></a>
+<FONT color="green">317</FONT>    <a name="line.317"></a>
+<FONT color="green">318</FONT>        /** Increment the iterations counter by 1.<a name="line.318"></a>
+<FONT color="green">319</FONT>         * @exception OptimizationException if the maximal number<a name="line.319"></a>
+<FONT color="green">320</FONT>         * of iterations is exceeded<a name="line.320"></a>
+<FONT color="green">321</FONT>         */<a name="line.321"></a>
+<FONT color="green">322</FONT>        protected void incrementIterationsCounter()<a name="line.322"></a>
+<FONT color="green">323</FONT>            throws OptimizationException {<a name="line.323"></a>
+<FONT color="green">324</FONT>            if (++iterations &gt; maxIterations) {<a name="line.324"></a>
+<FONT color="green">325</FONT>                throw new OptimizationException(new MaxIterationsExceededException(maxIterations));<a name="line.325"></a>
+<FONT color="green">326</FONT>            }<a name="line.326"></a>
+<FONT color="green">327</FONT>        }<a name="line.327"></a>
+<FONT color="green">328</FONT>    <a name="line.328"></a>
+<FONT color="green">329</FONT>        /** Compute the next simplex of the algorithm.<a name="line.329"></a>
+<FONT color="green">330</FONT>         * @param comparator comparator to use to sort simplex vertices from best to worst<a name="line.330"></a>
+<FONT color="green">331</FONT>         * @exception FunctionEvaluationException if the function cannot be evaluated at<a name="line.331"></a>
+<FONT color="green">332</FONT>         * some point<a name="line.332"></a>
+<FONT color="green">333</FONT>         * @exception OptimizationException if the algorithm fails to converge<a name="line.333"></a>
+<FONT color="green">334</FONT>         * @exception IllegalArgumentException if the start point dimension is wrong<a name="line.334"></a>
+<FONT color="green">335</FONT>         */<a name="line.335"></a>
+<FONT color="green">336</FONT>        protected abstract void iterateSimplex(final Comparator&lt;RealPointValuePair&gt; comparator)<a name="line.336"></a>
+<FONT color="green">337</FONT>            throws FunctionEvaluationException, OptimizationException, IllegalArgumentException;<a name="line.337"></a>
+<FONT color="green">338</FONT>    <a name="line.338"></a>
+<FONT color="green">339</FONT>        /** Evaluate the objective function on one point.<a name="line.339"></a>
+<FONT color="green">340</FONT>         * &lt;p&gt;A side effect of this method is to count the number of<a name="line.340"></a>
+<FONT color="green">341</FONT>         * function evaluations&lt;/p&gt;<a name="line.341"></a>
+<FONT color="green">342</FONT>         * @param x point on which the objective function should be evaluated<a name="line.342"></a>
+<FONT color="green">343</FONT>         * @return objective function value at the given point<a name="line.343"></a>
+<FONT color="green">344</FONT>         * @exception FunctionEvaluationException if no value can be computed for the<a name="line.344"></a>
+<FONT color="green">345</FONT>         * parameters or if the maximal number of evaluations is exceeded<a name="line.345"></a>
+<FONT color="green">346</FONT>         * @exception IllegalArgumentException if the start point dimension is wrong<a name="line.346"></a>
+<FONT color="green">347</FONT>         */<a name="line.347"></a>
+<FONT color="green">348</FONT>        protected double evaluate(final double[] x)<a name="line.348"></a>
+<FONT color="green">349</FONT>            throws FunctionEvaluationException, IllegalArgumentException {<a name="line.349"></a>
+<FONT color="green">350</FONT>            if (++evaluations &gt; maxEvaluations) {<a name="line.350"></a>
+<FONT color="green">351</FONT>                throw new FunctionEvaluationException(new MaxEvaluationsExceededException(maxEvaluations),<a name="line.351"></a>
+<FONT color="green">352</FONT>                                                      x);<a name="line.352"></a>
+<FONT color="green">353</FONT>            }<a name="line.353"></a>
+<FONT color="green">354</FONT>            return f.value(x);<a name="line.354"></a>
+<FONT color="green">355</FONT>        }<a name="line.355"></a>
+<FONT color="green">356</FONT>    <a name="line.356"></a>
+<FONT color="green">357</FONT>        /** Build an initial simplex.<a name="line.357"></a>
+<FONT color="green">358</FONT>         * @param startPoint the start point for optimization<a name="line.358"></a>
+<FONT color="green">359</FONT>         * @exception IllegalArgumentException if the start point does not match<a name="line.359"></a>
+<FONT color="green">360</FONT>         * simplex dimension<a name="line.360"></a>
+<FONT color="green">361</FONT>         */<a name="line.361"></a>
+<FONT color="green">362</FONT>        private void buildSimplex(final double[] startPoint)<a name="line.362"></a>
+<FONT color="green">363</FONT>            throws IllegalArgumentException {<a name="line.363"></a>
+<FONT color="green">364</FONT>    <a name="line.364"></a>
+<FONT color="green">365</FONT>            final int n = startPoint.length;<a name="line.365"></a>
+<FONT color="green">366</FONT>            if (n != startConfiguration.length) {<a name="line.366"></a>
+<FONT color="green">367</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.367"></a>
+<FONT color="green">368</FONT>                      DIMENSION_MISMATCH_MESSAGE, n, startConfiguration.length);<a name="line.368"></a>
+<FONT color="green">369</FONT>            }<a name="line.369"></a>
+<FONT color="green">370</FONT>    <a name="line.370"></a>
+<FONT color="green">371</FONT>            // set first vertex<a name="line.371"></a>
+<FONT color="green">372</FONT>            simplex = new RealPointValuePair[n + 1];<a name="line.372"></a>
+<FONT color="green">373</FONT>            simplex[0] = new RealPointValuePair(startPoint, Double.NaN);<a name="line.373"></a>
+<FONT color="green">374</FONT>    <a name="line.374"></a>
+<FONT color="green">375</FONT>            // set remaining vertices<a name="line.375"></a>
+<FONT color="green">376</FONT>            for (int i = 0; i &lt; n; ++i) {<a name="line.376"></a>
+<FONT color="green">377</FONT>                final double[] confI   = startConfiguration[i];<a name="line.377"></a>
+<FONT color="green">378</FONT>                final double[] vertexI = new double[n];<a name="line.378"></a>
+<FONT color="green">379</FONT>                for (int k = 0; k &lt; n; ++k) {<a name="line.379"></a>
+<FONT color="green">380</FONT>                    vertexI[k] = startPoint[k] + confI[k];<a name="line.380"></a>
+<FONT color="green">381</FONT>                }<a name="line.381"></a>
+<FONT color="green">382</FONT>                simplex[i + 1] = new RealPointValuePair(vertexI, Double.NaN);<a name="line.382"></a>
+<FONT color="green">383</FONT>            }<a name="line.383"></a>
+<FONT color="green">384</FONT>    <a name="line.384"></a>
+<FONT color="green">385</FONT>        }<a name="line.385"></a>
+<FONT color="green">386</FONT>    <a name="line.386"></a>
+<FONT color="green">387</FONT>        /** Evaluate all the non-evaluated points of the simplex.<a name="line.387"></a>
+<FONT color="green">388</FONT>         * @param comparator comparator to use to sort simplex vertices from best to worst<a name="line.388"></a>
+<FONT color="green">389</FONT>         * @exception FunctionEvaluationException if no value can be computed for the parameters<a name="line.389"></a>
+<FONT color="green">390</FONT>         * @exception OptimizationException if the maximal number of evaluations is exceeded<a name="line.390"></a>
+<FONT color="green">391</FONT>         */<a name="line.391"></a>
+<FONT color="green">392</FONT>        protected void evaluateSimplex(final Comparator&lt;RealPointValuePair&gt; comparator)<a name="line.392"></a>
+<FONT color="green">393</FONT>            throws FunctionEvaluationException, OptimizationException {<a name="line.393"></a>
+<FONT color="green">394</FONT>    <a name="line.394"></a>
+<FONT color="green">395</FONT>            // evaluate the objective function at all non-evaluated simplex points<a name="line.395"></a>
+<FONT color="green">396</FONT>            for (int i = 0; i &lt; simplex.length; ++i) {<a name="line.396"></a>
+<FONT color="green">397</FONT>                final RealPointValuePair vertex = simplex[i];<a name="line.397"></a>
+<FONT color="green">398</FONT>                final double[] point = vertex.getPointRef();<a name="line.398"></a>
+<FONT color="green">399</FONT>                if (Double.isNaN(vertex.getValue())) {<a name="line.399"></a>
+<FONT color="green">400</FONT>                    simplex[i] = new RealPointValuePair(point, evaluate(point), false);<a name="line.400"></a>
+<FONT color="green">401</FONT>                }<a name="line.401"></a>
+<FONT color="green">402</FONT>            }<a name="line.402"></a>
+<FONT color="green">403</FONT>    <a name="line.403"></a>
+<FONT color="green">404</FONT>            // sort the simplex from best to worst<a name="line.404"></a>
+<FONT color="green">405</FONT>            Arrays.sort(simplex, comparator);<a name="line.405"></a>
+<FONT color="green">406</FONT>    <a name="line.406"></a>
+<FONT color="green">407</FONT>        }<a name="line.407"></a>
+<FONT color="green">408</FONT>    <a name="line.408"></a>
+<FONT color="green">409</FONT>        /** Replace the worst point of the simplex by a new point.<a name="line.409"></a>
+<FONT color="green">410</FONT>         * @param pointValuePair point to insert<a name="line.410"></a>
+<FONT color="green">411</FONT>         * @param comparator comparator to use to sort simplex vertices from best to worst<a name="line.411"></a>
+<FONT color="green">412</FONT>         */<a name="line.412"></a>
+<FONT color="green">413</FONT>        protected void replaceWorstPoint(RealPointValuePair pointValuePair,<a name="line.413"></a>
+<FONT color="green">414</FONT>                                         final Comparator&lt;RealPointValuePair&gt; comparator) {<a name="line.414"></a>
+<FONT color="green">415</FONT>            int n = simplex.length - 1;<a name="line.415"></a>
+<FONT color="green">416</FONT>            for (int i = 0; i &lt; n; ++i) {<a name="line.416"></a>
+<FONT color="green">417</FONT>                if (comparator.compare(simplex[i], pointValuePair) &gt; 0) {<a name="line.417"></a>
+<FONT color="green">418</FONT>                    RealPointValuePair tmp = simplex[i];<a name="line.418"></a>
+<FONT color="green">419</FONT>                    simplex[i]         = pointValuePair;<a name="line.419"></a>
+<FONT color="green">420</FONT>                    pointValuePair     = tmp;<a name="line.420"></a>
+<FONT color="green">421</FONT>                }<a name="line.421"></a>
+<FONT color="green">422</FONT>            }<a name="line.422"></a>
+<FONT color="green">423</FONT>            simplex[n] = pointValuePair;<a name="line.423"></a>
+<FONT color="green">424</FONT>        }<a name="line.424"></a>
+<FONT color="green">425</FONT>    <a name="line.425"></a>
+<FONT color="green">426</FONT>    }<a name="line.426"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/direct/MultiDirectional.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,211 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.direct;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Comparator;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.optimization.OptimizationException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.optimization.RealConvergenceChecker;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.optimization.RealPointValuePair;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    /**<a name="line.27"></a>
+<FONT color="green">028</FONT>     * This class implements the multi-directional direct search method.<a name="line.28"></a>
+<FONT color="green">029</FONT>     *<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @see NelderMead<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 1.2<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public class MultiDirectional extends DirectSearchOptimizer {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Expansion coefficient. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private final double khi;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Contraction coefficient. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private final double gamma;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Build a multi-directional optimizer with default coefficients.<a name="line.42"></a>
+<FONT color="green">043</FONT>         * &lt;p&gt;The default values are 2.0 for khi and 0.5 for gamma.&lt;/p&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>         */<a name="line.44"></a>
+<FONT color="green">045</FONT>        public MultiDirectional() {<a name="line.45"></a>
+<FONT color="green">046</FONT>            this.khi   = 2.0;<a name="line.46"></a>
+<FONT color="green">047</FONT>            this.gamma = 0.5;<a name="line.47"></a>
+<FONT color="green">048</FONT>        }<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Build a multi-directional optimizer with specified coefficients.<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @param khi expansion coefficient<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @param gamma contraction coefficient<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        public MultiDirectional(final double khi, final double gamma) {<a name="line.54"></a>
+<FONT color="green">055</FONT>            this.khi   = khi;<a name="line.55"></a>
+<FONT color="green">056</FONT>            this.gamma = gamma;<a name="line.56"></a>
+<FONT color="green">057</FONT>        }<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** {@inheritDoc} */<a name="line.59"></a>
+<FONT color="green">060</FONT>        @Override<a name="line.60"></a>
+<FONT color="green">061</FONT>        protected void iterateSimplex(final Comparator&lt;RealPointValuePair&gt; comparator)<a name="line.61"></a>
+<FONT color="green">062</FONT>            throws FunctionEvaluationException, OptimizationException, IllegalArgumentException {<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>            final RealConvergenceChecker checker = getConvergenceChecker();<a name="line.64"></a>
+<FONT color="green">065</FONT>            while (true) {<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>                incrementIterationsCounter();<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>                // save the original vertex<a name="line.69"></a>
+<FONT color="green">070</FONT>                final RealPointValuePair[] original = simplex;<a name="line.70"></a>
+<FONT color="green">071</FONT>                final RealPointValuePair best = original[0];<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>                // perform a reflection step<a name="line.73"></a>
+<FONT color="green">074</FONT>                final RealPointValuePair reflected = evaluateNewSimplex(original, 1.0, comparator);<a name="line.74"></a>
+<FONT color="green">075</FONT>                if (comparator.compare(reflected, best) &lt; 0) {<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>                    // compute the expanded simplex<a name="line.77"></a>
+<FONT color="green">078</FONT>                    final RealPointValuePair[] reflectedSimplex = simplex;<a name="line.78"></a>
+<FONT color="green">079</FONT>                    final RealPointValuePair expanded = evaluateNewSimplex(original, khi, comparator);<a name="line.79"></a>
+<FONT color="green">080</FONT>                    if (comparator.compare(reflected, expanded) &lt;= 0) {<a name="line.80"></a>
+<FONT color="green">081</FONT>                        // accept the reflected simplex<a name="line.81"></a>
+<FONT color="green">082</FONT>                        simplex = reflectedSimplex;<a name="line.82"></a>
+<FONT color="green">083</FONT>                    }<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>                    return;<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>                }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>                // compute the contracted simplex<a name="line.89"></a>
+<FONT color="green">090</FONT>                final RealPointValuePair contracted = evaluateNewSimplex(original, gamma, comparator);<a name="line.90"></a>
+<FONT color="green">091</FONT>                if (comparator.compare(contracted, best) &lt; 0) {<a name="line.91"></a>
+<FONT color="green">092</FONT>                    // accept the contracted simplex<a name="line.92"></a>
+<FONT color="green">093</FONT>                    return;<a name="line.93"></a>
+<FONT color="green">094</FONT>                }<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>                // check convergence<a name="line.96"></a>
+<FONT color="green">097</FONT>                final int iter = getIterations();<a name="line.97"></a>
+<FONT color="green">098</FONT>                boolean converged = true;<a name="line.98"></a>
+<FONT color="green">099</FONT>                for (int i = 0; i &lt; simplex.length; ++i) {<a name="line.99"></a>
+<FONT color="green">100</FONT>                    converged &amp;= checker.converged(iter, original[i], simplex[i]);<a name="line.100"></a>
+<FONT color="green">101</FONT>                }<a name="line.101"></a>
+<FONT color="green">102</FONT>                if (converged) {<a name="line.102"></a>
+<FONT color="green">103</FONT>                    return;<a name="line.103"></a>
+<FONT color="green">104</FONT>                }<a name="line.104"></a>
+<FONT color="green">105</FONT>    <a name="line.105"></a>
+<FONT color="green">106</FONT>            }<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>        }<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>        /** Compute and evaluate a new simplex.<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @param original original simplex (to be preserved)<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @param coeff linear coefficient<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param comparator comparator to use to sort simplex vertices from best to poorest<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @return best point in the transformed simplex<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @exception FunctionEvaluationException if the function cannot be evaluated at<a name="line.115"></a>
+<FONT color="green">116</FONT>         * some point<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @exception OptimizationException if the maximal number of evaluations is exceeded<a name="line.117"></a>
+<FONT color="green">118</FONT>         */<a name="line.118"></a>
+<FONT color="green">119</FONT>        private RealPointValuePair evaluateNewSimplex(final RealPointValuePair[] original,<a name="line.119"></a>
+<FONT color="green">120</FONT>                                                  final double coeff,<a name="line.120"></a>
+<FONT color="green">121</FONT>                                                  final Comparator&lt;RealPointValuePair&gt; comparator)<a name="line.121"></a>
+<FONT color="green">122</FONT>            throws FunctionEvaluationException, OptimizationException {<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>            final double[] xSmallest = original[0].getPointRef();<a name="line.124"></a>
+<FONT color="green">125</FONT>            final int n = xSmallest.length;<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>            // create the linearly transformed simplex<a name="line.127"></a>
+<FONT color="green">128</FONT>            simplex = new RealPointValuePair[n + 1];<a name="line.128"></a>
+<FONT color="green">129</FONT>            simplex[0] = original[0];<a name="line.129"></a>
+<FONT color="green">130</FONT>            for (int i = 1; i &lt;= n; ++i) {<a name="line.130"></a>
+<FONT color="green">131</FONT>                final double[] xOriginal    = original[i].getPointRef();<a name="line.131"></a>
+<FONT color="green">132</FONT>                final double[] xTransformed = new double[n];<a name="line.132"></a>
+<FONT color="green">133</FONT>                for (int j = 0; j &lt; n; ++j) {<a name="line.133"></a>
+<FONT color="green">134</FONT>                    xTransformed[j] = xSmallest[j] + coeff * (xSmallest[j] - xOriginal[j]);<a name="line.134"></a>
+<FONT color="green">135</FONT>                }<a name="line.135"></a>
+<FONT color="green">136</FONT>                simplex[i] = new RealPointValuePair(xTransformed, Double.NaN, false);<a name="line.136"></a>
+<FONT color="green">137</FONT>            }<a name="line.137"></a>
+<FONT color="green">138</FONT>    <a name="line.138"></a>
+<FONT color="green">139</FONT>            // evaluate it<a name="line.139"></a>
+<FONT color="green">140</FONT>            evaluateSimplex(comparator);<a name="line.140"></a>
+<FONT color="green">141</FONT>            return simplex[0];<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>        }<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>    }<a name="line.145"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/direct/NelderMead.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,247 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.direct;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Comparator;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.optimization.OptimizationException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.optimization.RealPointValuePair;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * This class implements the Nelder-Mead direct search method.<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @see MultiDirectional<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 1.2<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public class NelderMead extends DirectSearchOptimizer {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Reflection coefficient. */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private final double rho;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Expansion coefficient. */<a name="line.38"></a>
+<FONT color="green">039</FONT>        private final double khi;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Contraction coefficient. */<a name="line.41"></a>
+<FONT color="green">042</FONT>        private final double gamma;<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Shrinkage coefficient. */<a name="line.44"></a>
+<FONT color="green">045</FONT>        private final double sigma;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** Build a Nelder-Mead optimizer with default coefficients.<a name="line.47"></a>
+<FONT color="green">048</FONT>         * &lt;p&gt;The default coefficients are 1.0 for rho, 2.0 for khi and 0.5<a name="line.48"></a>
+<FONT color="green">049</FONT>         * for both gamma and sigma.&lt;/p&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>         */<a name="line.50"></a>
+<FONT color="green">051</FONT>        public NelderMead() {<a name="line.51"></a>
+<FONT color="green">052</FONT>            this.rho   = 1.0;<a name="line.52"></a>
+<FONT color="green">053</FONT>            this.khi   = 2.0;<a name="line.53"></a>
+<FONT color="green">054</FONT>            this.gamma = 0.5;<a name="line.54"></a>
+<FONT color="green">055</FONT>            this.sigma = 0.5;<a name="line.55"></a>
+<FONT color="green">056</FONT>        }<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /** Build a Nelder-Mead optimizer with specified coefficients.<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @param rho reflection coefficient<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @param khi expansion coefficient<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param gamma contraction coefficient<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param sigma shrinkage coefficient<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public NelderMead(final double rho, final double khi,<a name="line.64"></a>
+<FONT color="green">065</FONT>                          final double gamma, final double sigma) {<a name="line.65"></a>
+<FONT color="green">066</FONT>            this.rho   = rho;<a name="line.66"></a>
+<FONT color="green">067</FONT>            this.khi   = khi;<a name="line.67"></a>
+<FONT color="green">068</FONT>            this.gamma = gamma;<a name="line.68"></a>
+<FONT color="green">069</FONT>            this.sigma = sigma;<a name="line.69"></a>
+<FONT color="green">070</FONT>        }<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /** {@inheritDoc} */<a name="line.72"></a>
+<FONT color="green">073</FONT>        @Override<a name="line.73"></a>
+<FONT color="green">074</FONT>        protected void iterateSimplex(final Comparator&lt;RealPointValuePair&gt; comparator)<a name="line.74"></a>
+<FONT color="green">075</FONT>            throws FunctionEvaluationException, OptimizationException {<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>            incrementIterationsCounter();<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>            // the simplex has n+1 point if dimension is n<a name="line.79"></a>
+<FONT color="green">080</FONT>            final int n = simplex.length - 1;<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>            // interesting values<a name="line.82"></a>
+<FONT color="green">083</FONT>            final RealPointValuePair best       = simplex[0];<a name="line.83"></a>
+<FONT color="green">084</FONT>            final RealPointValuePair secondBest = simplex[n-1];<a name="line.84"></a>
+<FONT color="green">085</FONT>            final RealPointValuePair worst      = simplex[n];<a name="line.85"></a>
+<FONT color="green">086</FONT>            final double[] xWorst = worst.getPointRef();<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>            // compute the centroid of the best vertices<a name="line.88"></a>
+<FONT color="green">089</FONT>            // (dismissing the worst point at index n)<a name="line.89"></a>
+<FONT color="green">090</FONT>            final double[] centroid = new double[n];<a name="line.90"></a>
+<FONT color="green">091</FONT>            for (int i = 0; i &lt; n; ++i) {<a name="line.91"></a>
+<FONT color="green">092</FONT>                final double[] x = simplex[i].getPointRef();<a name="line.92"></a>
+<FONT color="green">093</FONT>                for (int j = 0; j &lt; n; ++j) {<a name="line.93"></a>
+<FONT color="green">094</FONT>                    centroid[j] += x[j];<a name="line.94"></a>
+<FONT color="green">095</FONT>                }<a name="line.95"></a>
+<FONT color="green">096</FONT>            }<a name="line.96"></a>
+<FONT color="green">097</FONT>            final double scaling = 1.0 / n;<a name="line.97"></a>
+<FONT color="green">098</FONT>            for (int j = 0; j &lt; n; ++j) {<a name="line.98"></a>
+<FONT color="green">099</FONT>                centroid[j] *= scaling;<a name="line.99"></a>
+<FONT color="green">100</FONT>            }<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>            // compute the reflection point<a name="line.102"></a>
+<FONT color="green">103</FONT>            final double[] xR = new double[n];<a name="line.103"></a>
+<FONT color="green">104</FONT>            for (int j = 0; j &lt; n; ++j) {<a name="line.104"></a>
+<FONT color="green">105</FONT>                xR[j] = centroid[j] + rho * (centroid[j] - xWorst[j]);<a name="line.105"></a>
+<FONT color="green">106</FONT>            }<a name="line.106"></a>
+<FONT color="green">107</FONT>            final RealPointValuePair reflected = new RealPointValuePair(xR, evaluate(xR), false);<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>            if ((comparator.compare(best, reflected) &lt;= 0) &amp;&amp;<a name="line.109"></a>
+<FONT color="green">110</FONT>                (comparator.compare(reflected, secondBest) &lt; 0)) {<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>                // accept the reflected point<a name="line.112"></a>
+<FONT color="green">113</FONT>                replaceWorstPoint(reflected, comparator);<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>            } else if (comparator.compare(reflected, best) &lt; 0) {<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>                // compute the expansion point<a name="line.117"></a>
+<FONT color="green">118</FONT>                final double[] xE = new double[n];<a name="line.118"></a>
+<FONT color="green">119</FONT>                for (int j = 0; j &lt; n; ++j) {<a name="line.119"></a>
+<FONT color="green">120</FONT>                    xE[j] = centroid[j] + khi * (xR[j] - centroid[j]);<a name="line.120"></a>
+<FONT color="green">121</FONT>                }<a name="line.121"></a>
+<FONT color="green">122</FONT>                final RealPointValuePair expanded = new RealPointValuePair(xE, evaluate(xE), false);<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>                if (comparator.compare(expanded, reflected) &lt; 0) {<a name="line.124"></a>
+<FONT color="green">125</FONT>                    // accept the expansion point<a name="line.125"></a>
+<FONT color="green">126</FONT>                    replaceWorstPoint(expanded, comparator);<a name="line.126"></a>
+<FONT color="green">127</FONT>                } else {<a name="line.127"></a>
+<FONT color="green">128</FONT>                    // accept the reflected point<a name="line.128"></a>
+<FONT color="green">129</FONT>                    replaceWorstPoint(reflected, comparator);<a name="line.129"></a>
+<FONT color="green">130</FONT>                }<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>            } else {<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>                if (comparator.compare(reflected, worst) &lt; 0) {<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>                    // perform an outside contraction<a name="line.136"></a>
+<FONT color="green">137</FONT>                    final double[] xC = new double[n];<a name="line.137"></a>
+<FONT color="green">138</FONT>                    for (int j = 0; j &lt; n; ++j) {<a name="line.138"></a>
+<FONT color="green">139</FONT>                        xC[j] = centroid[j] + gamma * (xR[j] - centroid[j]);<a name="line.139"></a>
+<FONT color="green">140</FONT>                    }<a name="line.140"></a>
+<FONT color="green">141</FONT>                    final RealPointValuePair outContracted = new RealPointValuePair(xC, evaluate(xC), false);<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>                    if (comparator.compare(outContracted, reflected) &lt;= 0) {<a name="line.143"></a>
+<FONT color="green">144</FONT>                        // accept the contraction point<a name="line.144"></a>
+<FONT color="green">145</FONT>                        replaceWorstPoint(outContracted, comparator);<a name="line.145"></a>
+<FONT color="green">146</FONT>                        return;<a name="line.146"></a>
+<FONT color="green">147</FONT>                    }<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>                } else {<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>                    // perform an inside contraction<a name="line.151"></a>
+<FONT color="green">152</FONT>                    final double[] xC = new double[n];<a name="line.152"></a>
+<FONT color="green">153</FONT>                    for (int j = 0; j &lt; n; ++j) {<a name="line.153"></a>
+<FONT color="green">154</FONT>                        xC[j] = centroid[j] - gamma * (centroid[j] - xWorst[j]);<a name="line.154"></a>
+<FONT color="green">155</FONT>                    }<a name="line.155"></a>
+<FONT color="green">156</FONT>                    final RealPointValuePair inContracted = new RealPointValuePair(xC, evaluate(xC), false);<a name="line.156"></a>
+<FONT color="green">157</FONT>    <a name="line.157"></a>
+<FONT color="green">158</FONT>                    if (comparator.compare(inContracted, worst) &lt; 0) {<a name="line.158"></a>
+<FONT color="green">159</FONT>                        // accept the contraction point<a name="line.159"></a>
+<FONT color="green">160</FONT>                        replaceWorstPoint(inContracted, comparator);<a name="line.160"></a>
+<FONT color="green">161</FONT>                        return;<a name="line.161"></a>
+<FONT color="green">162</FONT>                    }<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>                }<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>                // perform a shrink<a name="line.166"></a>
+<FONT color="green">167</FONT>                final double[] xSmallest = simplex[0].getPointRef();<a name="line.167"></a>
+<FONT color="green">168</FONT>                for (int i = 1; i &lt; simplex.length; ++i) {<a name="line.168"></a>
+<FONT color="green">169</FONT>                    final double[] x = simplex[i].getPoint();<a name="line.169"></a>
+<FONT color="green">170</FONT>                    for (int j = 0; j &lt; n; ++j) {<a name="line.170"></a>
+<FONT color="green">171</FONT>                        x[j] = xSmallest[j] + sigma * (x[j] - xSmallest[j]);<a name="line.171"></a>
+<FONT color="green">172</FONT>                    }<a name="line.172"></a>
+<FONT color="green">173</FONT>                    simplex[i] = new RealPointValuePair(x, Double.NaN, false);<a name="line.173"></a>
+<FONT color="green">174</FONT>                }<a name="line.174"></a>
+<FONT color="green">175</FONT>                evaluateSimplex(comparator);<a name="line.175"></a>
+<FONT color="green">176</FONT>    <a name="line.176"></a>
+<FONT color="green">177</FONT>            }<a name="line.177"></a>
+<FONT color="green">178</FONT>    <a name="line.178"></a>
+<FONT color="green">179</FONT>        }<a name="line.179"></a>
+<FONT color="green">180</FONT>    <a name="line.180"></a>
+<FONT color="green">181</FONT>    }<a name="line.181"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/fitting/CurveFitter.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,265 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.fitting;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.ArrayList;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.List;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.analysis.DifferentiableMultivariateVectorialFunction;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.analysis.MultivariateMatrixFunction;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.optimization.DifferentiableMultivariateVectorialOptimizer;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.optimization.OptimizationException;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.optimization.VectorialPointValuePair;<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>    /** Fitter for parametric univariate real functions y = f(x).<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;When a univariate real function y = f(x) does depend on some<a name="line.31"></a>
+<FONT color="green">032</FONT>     * unknown parameters p&lt;sub&gt;0&lt;/sub&gt;, p&lt;sub&gt;1&lt;/sub&gt; ... p&lt;sub&gt;n-1&lt;/sub&gt;,<a name="line.32"></a>
+<FONT color="green">033</FONT>     * this class can be used to find these parameters. It does this<a name="line.33"></a>
+<FONT color="green">034</FONT>     * by &lt;em&gt;fitting&lt;/em&gt; the curve so it remains very close to a set of<a name="line.34"></a>
+<FONT color="green">035</FONT>     * observed points (x&lt;sub&gt;0&lt;/sub&gt;, y&lt;sub&gt;0&lt;/sub&gt;), (x&lt;sub&gt;1&lt;/sub&gt;,<a name="line.35"></a>
+<FONT color="green">036</FONT>     * y&lt;sub&gt;1&lt;/sub&gt;) ... (x&lt;sub&gt;k-1&lt;/sub&gt;, y&lt;sub&gt;k-1&lt;/sub&gt;). This fitting<a name="line.36"></a>
+<FONT color="green">037</FONT>     * is done by finding the parameters values that minimizes the objective<a name="line.37"></a>
+<FONT color="green">038</FONT>     * function &amp;sum;(y&lt;sub&gt;i&lt;/sub&gt;-f(x&lt;sub&gt;i&lt;/sub&gt;))&lt;sup&gt;2&lt;/sup&gt;. This is<a name="line.38"></a>
+<FONT color="green">039</FONT>     * really a least squares problem.&lt;/p&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @version $Revision: 927009 $ $Date: 2010-03-24 07:14:07 -0400 (Wed, 24 Mar 2010) $<a name="line.40"></a>
+<FONT color="green">041</FONT>     * @since 2.0<a name="line.41"></a>
+<FONT color="green">042</FONT>     */<a name="line.42"></a>
+<FONT color="green">043</FONT>    public class CurveFitter {<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Optimizer to use for the fitting. */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private final DifferentiableMultivariateVectorialOptimizer optimizer;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** Observed points. */<a name="line.48"></a>
+<FONT color="green">049</FONT>        private final List&lt;WeightedObservedPoint&gt; observations;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /** Simple constructor.<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @param optimizer optimizer to use for the fitting<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        public CurveFitter(final DifferentiableMultivariateVectorialOptimizer optimizer) {<a name="line.54"></a>
+<FONT color="green">055</FONT>            this.optimizer = optimizer;<a name="line.55"></a>
+<FONT color="green">056</FONT>            observations = new ArrayList&lt;WeightedObservedPoint&gt;();<a name="line.56"></a>
+<FONT color="green">057</FONT>        }<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** Add an observed (x,y) point to the sample with unit weight.<a name="line.59"></a>
+<FONT color="green">060</FONT>         * &lt;p&gt;Calling this method is equivalent to call<a name="line.60"></a>
+<FONT color="green">061</FONT>         * &lt;code&gt;addObservedPoint(1.0, x, y)&lt;/code&gt;.&lt;/p&gt;<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param x abscissa of the point<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @param y observed value of the point at x, after fitting we should<a name="line.63"></a>
+<FONT color="green">064</FONT>         * have f(x) as close as possible to this value<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @see #addObservedPoint(double, double, double)<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @see #addObservedPoint(WeightedObservedPoint)<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @see #getObservations()<a name="line.67"></a>
+<FONT color="green">068</FONT>         */<a name="line.68"></a>
+<FONT color="green">069</FONT>        public void addObservedPoint(double x, double y) {<a name="line.69"></a>
+<FONT color="green">070</FONT>            addObservedPoint(1.0, x, y);<a name="line.70"></a>
+<FONT color="green">071</FONT>        }<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /** Add an observed weighted (x,y) point to the sample.<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @param weight weight of the observed point in the fit<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @param x abscissa of the point<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @param y observed value of the point at x, after fitting we should<a name="line.76"></a>
+<FONT color="green">077</FONT>         * have f(x) as close as possible to this value<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @see #addObservedPoint(double, double)<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @see #addObservedPoint(WeightedObservedPoint)<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @see #getObservations()<a name="line.80"></a>
+<FONT color="green">081</FONT>         */<a name="line.81"></a>
+<FONT color="green">082</FONT>        public void addObservedPoint(double weight, double x, double y) {<a name="line.82"></a>
+<FONT color="green">083</FONT>            observations.add(new WeightedObservedPoint(weight, x, y));<a name="line.83"></a>
+<FONT color="green">084</FONT>        }<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /** Add an observed weighted (x,y) point to the sample.<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @param observed observed point to add<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @see #addObservedPoint(double, double)<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @see #addObservedPoint(double, double, double)<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @see #getObservations()<a name="line.90"></a>
+<FONT color="green">091</FONT>         */<a name="line.91"></a>
+<FONT color="green">092</FONT>        public void addObservedPoint(WeightedObservedPoint observed) {<a name="line.92"></a>
+<FONT color="green">093</FONT>            observations.add(observed);<a name="line.93"></a>
+<FONT color="green">094</FONT>        }<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /** Get the observed points.<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @return observed points<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @see #addObservedPoint(double, double)<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @see #addObservedPoint(double, double, double)<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @see #addObservedPoint(WeightedObservedPoint)<a name="line.100"></a>
+<FONT color="green">101</FONT>         */<a name="line.101"></a>
+<FONT color="green">102</FONT>        public WeightedObservedPoint[] getObservations() {<a name="line.102"></a>
+<FONT color="green">103</FONT>            return observations.toArray(new WeightedObservedPoint[observations.size()]);<a name="line.103"></a>
+<FONT color="green">104</FONT>        }<a name="line.104"></a>
+<FONT color="green">105</FONT>    <a name="line.105"></a>
+<FONT color="green">106</FONT>        /**<a name="line.106"></a>
+<FONT color="green">107</FONT>         * Remove all observations.<a name="line.107"></a>
+<FONT color="green">108</FONT>         */<a name="line.108"></a>
+<FONT color="green">109</FONT>        public void clearObservations() {<a name="line.109"></a>
+<FONT color="green">110</FONT>            observations.clear();<a name="line.110"></a>
+<FONT color="green">111</FONT>        }<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>        /** Fit a curve.<a name="line.113"></a>
+<FONT color="green">114</FONT>         * &lt;p&gt;This method compute the coefficients of the curve that best<a name="line.114"></a>
+<FONT color="green">115</FONT>         * fit the sample of observed points previously given through calls<a name="line.115"></a>
+<FONT color="green">116</FONT>         * to the {@link #addObservedPoint(WeightedObservedPoint)<a name="line.116"></a>
+<FONT color="green">117</FONT>         * addObservedPoint} method.&lt;/p&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @param f parametric function to fit<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @param initialGuess first guess of the function parameters<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @return fitted parameters<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @exception FunctionEvaluationException if the objective function throws one during<a name="line.121"></a>
+<FONT color="green">122</FONT>         * the search<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @exception OptimizationException if the algorithm failed to converge<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @exception IllegalArgumentException if the start point dimension is wrong<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        public double[] fit(final ParametricRealFunction f,<a name="line.126"></a>
+<FONT color="green">127</FONT>                            final double[] initialGuess)<a name="line.127"></a>
+<FONT color="green">128</FONT>            throws FunctionEvaluationException, OptimizationException, IllegalArgumentException {<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>            // prepare least squares problem<a name="line.130"></a>
+<FONT color="green">131</FONT>            double[] target  = new double[observations.size()];<a name="line.131"></a>
+<FONT color="green">132</FONT>            double[] weights = new double[observations.size()];<a name="line.132"></a>
+<FONT color="green">133</FONT>            int i = 0;<a name="line.133"></a>
+<FONT color="green">134</FONT>            for (WeightedObservedPoint point : observations) {<a name="line.134"></a>
+<FONT color="green">135</FONT>                target[i]  = point.getY();<a name="line.135"></a>
+<FONT color="green">136</FONT>                weights[i] = point.getWeight();<a name="line.136"></a>
+<FONT color="green">137</FONT>                ++i;<a name="line.137"></a>
+<FONT color="green">138</FONT>            }<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>            // perform the fit<a name="line.140"></a>
+<FONT color="green">141</FONT>            VectorialPointValuePair optimum =<a name="line.141"></a>
+<FONT color="green">142</FONT>                optimizer.optimize(new TheoreticalValuesFunction(f), target, weights, initialGuess);<a name="line.142"></a>
+<FONT color="green">143</FONT>    <a name="line.143"></a>
+<FONT color="green">144</FONT>            // extract the coefficients<a name="line.144"></a>
+<FONT color="green">145</FONT>            return optimum.getPointRef();<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>        }<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>        /** Vectorial function computing function theoretical values. */<a name="line.149"></a>
+<FONT color="green">150</FONT>        private class TheoreticalValuesFunction<a name="line.150"></a>
+<FONT color="green">151</FONT>            implements DifferentiableMultivariateVectorialFunction {<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>            /** Function to fit. */<a name="line.153"></a>
+<FONT color="green">154</FONT>            private final ParametricRealFunction f;<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>            /** Simple constructor.<a name="line.156"></a>
+<FONT color="green">157</FONT>             * @param f function to fit.<a name="line.157"></a>
+<FONT color="green">158</FONT>             */<a name="line.158"></a>
+<FONT color="green">159</FONT>            public TheoreticalValuesFunction(final ParametricRealFunction f) {<a name="line.159"></a>
+<FONT color="green">160</FONT>                this.f = f;<a name="line.160"></a>
+<FONT color="green">161</FONT>            }<a name="line.161"></a>
+<FONT color="green">162</FONT>    <a name="line.162"></a>
+<FONT color="green">163</FONT>            /** {@inheritDoc} */<a name="line.163"></a>
+<FONT color="green">164</FONT>            public MultivariateMatrixFunction jacobian() {<a name="line.164"></a>
+<FONT color="green">165</FONT>                return new MultivariateMatrixFunction() {<a name="line.165"></a>
+<FONT color="green">166</FONT>                    public double[][] value(double[] point)<a name="line.166"></a>
+<FONT color="green">167</FONT>                        throws FunctionEvaluationException, IllegalArgumentException {<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>                        final double[][] jacobian = new double[observations.size()][];<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>                        int i = 0;<a name="line.171"></a>
+<FONT color="green">172</FONT>                        for (WeightedObservedPoint observed : observations) {<a name="line.172"></a>
+<FONT color="green">173</FONT>                            jacobian[i++] = f.gradient(observed.getX(), point);<a name="line.173"></a>
+<FONT color="green">174</FONT>                        }<a name="line.174"></a>
+<FONT color="green">175</FONT>    <a name="line.175"></a>
+<FONT color="green">176</FONT>                        return jacobian;<a name="line.176"></a>
+<FONT color="green">177</FONT>    <a name="line.177"></a>
+<FONT color="green">178</FONT>                    }<a name="line.178"></a>
+<FONT color="green">179</FONT>                };<a name="line.179"></a>
+<FONT color="green">180</FONT>            }<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>            /** {@inheritDoc} */<a name="line.182"></a>
+<FONT color="green">183</FONT>            public double[] value(double[] point)<a name="line.183"></a>
+<FONT color="green">184</FONT>                    throws FunctionEvaluationException, IllegalArgumentException {<a name="line.184"></a>
+<FONT color="green">185</FONT>    <a name="line.185"></a>
+<FONT color="green">186</FONT>                // compute the residuals<a name="line.186"></a>
+<FONT color="green">187</FONT>                final double[] values = new double[observations.size()];<a name="line.187"></a>
+<FONT color="green">188</FONT>                int i = 0;<a name="line.188"></a>
+<FONT color="green">189</FONT>                for (WeightedObservedPoint observed : observations) {<a name="line.189"></a>
+<FONT color="green">190</FONT>                    values[i++] = f.value(observed.getX(), point);<a name="line.190"></a>
+<FONT color="green">191</FONT>                }<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>                return values;<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>            }<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>        }<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>    }<a name="line.199"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/fitting/HarmonicCoefficientsGuesser.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,366 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.fitting;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.optimization.OptimizationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /** This class guesses harmonic coefficients from a sample.<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;The algorithm used to guess the coefficients is as follows:&lt;/p&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;We know f (t) at some sampling points t&lt;sub&gt;i&lt;/sub&gt; and want to find a,<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &amp;omega; and &amp;phi; such that f (t) = a cos (&amp;omega; t + &amp;phi;).<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     *<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;p&gt;From the analytical expression, we can compute two primitives :<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;pre&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     *     If2  (t) = &amp;int; f&lt;sup&gt;2&lt;/sup&gt;  = a&lt;sup&gt;2&lt;/sup&gt; &amp;times; [t + S (t)] / 2<a name="line.32"></a>
+<FONT color="green">033</FONT>     *     If'2 (t) = &amp;int; f'&lt;sup&gt;2&lt;/sup&gt; = a&lt;sup&gt;2&lt;/sup&gt; &amp;omega;&lt;sup&gt;2&lt;/sup&gt; &amp;times; [t - S (t)] / 2<a name="line.33"></a>
+<FONT color="green">034</FONT>     *     where S (t) = sin (2 (&amp;omega; t + &amp;phi;)) / (2 &amp;omega;)<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;/pre&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *<a name="line.37"></a>
+<FONT color="green">038</FONT>     * &lt;p&gt;We can remove S between these expressions :<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;pre&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     *     If'2 (t) = a&lt;sup&gt;2&lt;/sup&gt; &amp;omega;&lt;sup&gt;2&lt;/sup&gt; t - &amp;omega;&lt;sup&gt;2&lt;/sup&gt; If2 (t)<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;/pre&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;/p&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     *<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;p&gt;The preceding expression shows that If'2 (t) is a linear<a name="line.44"></a>
+<FONT color="green">045</FONT>     * combination of both t and If2 (t): If'2 (t) = A &amp;times; t + B &amp;times; If2 (t)<a name="line.45"></a>
+<FONT color="green">046</FONT>     * &lt;/p&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     *<a name="line.47"></a>
+<FONT color="green">048</FONT>     * &lt;p&gt;From the primitive, we can deduce the same form for definite<a name="line.48"></a>
+<FONT color="green">049</FONT>     * integrals between t&lt;sub&gt;1&lt;/sub&gt; and t&lt;sub&gt;i&lt;/sub&gt; for each t&lt;sub&gt;i&lt;/sub&gt; :<a name="line.49"></a>
+<FONT color="green">050</FONT>     * &lt;pre&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>     *   If2 (t&lt;sub&gt;i&lt;/sub&gt;) - If2 (t&lt;sub&gt;1&lt;/sub&gt;) = A &amp;times; (t&lt;sub&gt;i&lt;/sub&gt; - t&lt;sub&gt;1&lt;/sub&gt;) + B &amp;times; (If2 (t&lt;sub&gt;i&lt;/sub&gt;) - If2 (t&lt;sub&gt;1&lt;/sub&gt;))<a name="line.51"></a>
+<FONT color="green">052</FONT>     * &lt;/pre&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>     * &lt;/p&gt;<a name="line.53"></a>
+<FONT color="green">054</FONT>     *<a name="line.54"></a>
+<FONT color="green">055</FONT>     * &lt;p&gt;We can find the coefficients A and B that best fit the sample<a name="line.55"></a>
+<FONT color="green">056</FONT>     * to this linear expression by computing the definite integrals for<a name="line.56"></a>
+<FONT color="green">057</FONT>     * each sample points.<a name="line.57"></a>
+<FONT color="green">058</FONT>     * &lt;/p&gt;<a name="line.58"></a>
+<FONT color="green">059</FONT>     *<a name="line.59"></a>
+<FONT color="green">060</FONT>     * &lt;p&gt;For a bilinear expression z (x&lt;sub&gt;i&lt;/sub&gt;, y&lt;sub&gt;i&lt;/sub&gt;) = A &amp;times; x&lt;sub&gt;i&lt;/sub&gt; + B &amp;times; y&lt;sub&gt;i&lt;/sub&gt;, the<a name="line.60"></a>
+<FONT color="green">061</FONT>     * coefficients A and B that minimize a least square criterion<a name="line.61"></a>
+<FONT color="green">062</FONT>     * &amp;sum; (z&lt;sub&gt;i&lt;/sub&gt; - z (x&lt;sub&gt;i&lt;/sub&gt;, y&lt;sub&gt;i&lt;/sub&gt;))&lt;sup&gt;2&lt;/sup&gt; are given by these expressions:&lt;/p&gt;<a name="line.62"></a>
+<FONT color="green">063</FONT>     * &lt;pre&gt;<a name="line.63"></a>
+<FONT color="green">064</FONT>     *<a name="line.64"></a>
+<FONT color="green">065</FONT>     *         &amp;sum;y&lt;sub&gt;i&lt;/sub&gt;y&lt;sub&gt;i&lt;/sub&gt; &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;z&lt;sub&gt;i&lt;/sub&gt; - &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;y&lt;sub&gt;i&lt;/sub&gt; &amp;sum;y&lt;sub&gt;i&lt;/sub&gt;z&lt;sub&gt;i&lt;/sub&gt;<a name="line.65"></a>
+<FONT color="green">066</FONT>     *     A = ------------------------<a name="line.66"></a>
+<FONT color="green">067</FONT>     *         &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;x&lt;sub&gt;i&lt;/sub&gt; &amp;sum;y&lt;sub&gt;i&lt;/sub&gt;y&lt;sub&gt;i&lt;/sub&gt; - &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;y&lt;sub&gt;i&lt;/sub&gt; &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;y&lt;sub&gt;i&lt;/sub&gt;<a name="line.67"></a>
+<FONT color="green">068</FONT>     *<a name="line.68"></a>
+<FONT color="green">069</FONT>     *         &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;x&lt;sub&gt;i&lt;/sub&gt; &amp;sum;y&lt;sub&gt;i&lt;/sub&gt;z&lt;sub&gt;i&lt;/sub&gt; - &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;y&lt;sub&gt;i&lt;/sub&gt; &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;z&lt;sub&gt;i&lt;/sub&gt;<a name="line.69"></a>
+<FONT color="green">070</FONT>     *     B = ------------------------<a name="line.70"></a>
+<FONT color="green">071</FONT>     *         &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;x&lt;sub&gt;i&lt;/sub&gt; &amp;sum;y&lt;sub&gt;i&lt;/sub&gt;y&lt;sub&gt;i&lt;/sub&gt; - &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;y&lt;sub&gt;i&lt;/sub&gt; &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;y&lt;sub&gt;i&lt;/sub&gt;<a name="line.71"></a>
+<FONT color="green">072</FONT>     * &lt;/pre&gt;<a name="line.72"></a>
+<FONT color="green">073</FONT>     * &lt;/p&gt;<a name="line.73"></a>
+<FONT color="green">074</FONT>     *<a name="line.74"></a>
+<FONT color="green">075</FONT>     *<a name="line.75"></a>
+<FONT color="green">076</FONT>     * &lt;p&gt;In fact, we can assume both a and &amp;omega; are positive and<a name="line.76"></a>
+<FONT color="green">077</FONT>     * compute them directly, knowing that A = a&lt;sup&gt;2&lt;/sup&gt; &amp;omega;&lt;sup&gt;2&lt;/sup&gt; and that<a name="line.77"></a>
+<FONT color="green">078</FONT>     * B = - &amp;omega;&lt;sup&gt;2&lt;/sup&gt;. The complete algorithm is therefore:&lt;/p&gt;<a name="line.78"></a>
+<FONT color="green">079</FONT>     * &lt;pre&gt;<a name="line.79"></a>
+<FONT color="green">080</FONT>     *<a name="line.80"></a>
+<FONT color="green">081</FONT>     * for each t&lt;sub&gt;i&lt;/sub&gt; from t&lt;sub&gt;1&lt;/sub&gt; to t&lt;sub&gt;n-1&lt;/sub&gt;, compute:<a name="line.81"></a>
+<FONT color="green">082</FONT>     *   f  (t&lt;sub&gt;i&lt;/sub&gt;)<a name="line.82"></a>
+<FONT color="green">083</FONT>     *   f' (t&lt;sub&gt;i&lt;/sub&gt;) = (f (t&lt;sub&gt;i+1&lt;/sub&gt;) - f(t&lt;sub&gt;i-1&lt;/sub&gt;)) / (t&lt;sub&gt;i+1&lt;/sub&gt; - t&lt;sub&gt;i-1&lt;/sub&gt;)<a name="line.83"></a>
+<FONT color="green">084</FONT>     *   x&lt;sub&gt;i&lt;/sub&gt; = t&lt;sub&gt;i&lt;/sub&gt; - t&lt;sub&gt;1&lt;/sub&gt;<a name="line.84"></a>
+<FONT color="green">085</FONT>     *   y&lt;sub&gt;i&lt;/sub&gt; = &amp;int; f&lt;sup&gt;2&lt;/sup&gt; from t&lt;sub&gt;1&lt;/sub&gt; to t&lt;sub&gt;i&lt;/sub&gt;<a name="line.85"></a>
+<FONT color="green">086</FONT>     *   z&lt;sub&gt;i&lt;/sub&gt; = &amp;int; f'&lt;sup&gt;2&lt;/sup&gt; from t&lt;sub&gt;1&lt;/sub&gt; to t&lt;sub&gt;i&lt;/sub&gt;<a name="line.86"></a>
+<FONT color="green">087</FONT>     *   update the sums &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;x&lt;sub&gt;i&lt;/sub&gt;, &amp;sum;y&lt;sub&gt;i&lt;/sub&gt;y&lt;sub&gt;i&lt;/sub&gt;, &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;y&lt;sub&gt;i&lt;/sub&gt;, &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;z&lt;sub&gt;i&lt;/sub&gt; and &amp;sum;y&lt;sub&gt;i&lt;/sub&gt;z&lt;sub&gt;i&lt;/sub&gt;<a name="line.87"></a>
+<FONT color="green">088</FONT>     * end for<a name="line.88"></a>
+<FONT color="green">089</FONT>     *<a name="line.89"></a>
+<FONT color="green">090</FONT>     *            |--------------------------<a name="line.90"></a>
+<FONT color="green">091</FONT>     *         \  | &amp;sum;y&lt;sub&gt;i&lt;/sub&gt;y&lt;sub&gt;i&lt;/sub&gt; &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;z&lt;sub&gt;i&lt;/sub&gt; - &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;y&lt;sub&gt;i&lt;/sub&gt; &amp;sum;y&lt;sub&gt;i&lt;/sub&gt;z&lt;sub&gt;i&lt;/sub&gt;<a name="line.91"></a>
+<FONT color="green">092</FONT>     * a     =  \ | ------------------------<a name="line.92"></a>
+<FONT color="green">093</FONT>     *           \| &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;y&lt;sub&gt;i&lt;/sub&gt; &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;z&lt;sub&gt;i&lt;/sub&gt; - &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;x&lt;sub&gt;i&lt;/sub&gt; &amp;sum;y&lt;sub&gt;i&lt;/sub&gt;z&lt;sub&gt;i&lt;/sub&gt;<a name="line.93"></a>
+<FONT color="green">094</FONT>     *<a name="line.94"></a>
+<FONT color="green">095</FONT>     *<a name="line.95"></a>
+<FONT color="green">096</FONT>     *            |--------------------------<a name="line.96"></a>
+<FONT color="green">097</FONT>     *         \  | &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;y&lt;sub&gt;i&lt;/sub&gt; &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;z&lt;sub&gt;i&lt;/sub&gt; - &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;x&lt;sub&gt;i&lt;/sub&gt; &amp;sum;y&lt;sub&gt;i&lt;/sub&gt;z&lt;sub&gt;i&lt;/sub&gt;<a name="line.97"></a>
+<FONT color="green">098</FONT>     * &amp;omega;     =  \ | ------------------------<a name="line.98"></a>
+<FONT color="green">099</FONT>     *           \| &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;x&lt;sub&gt;i&lt;/sub&gt; &amp;sum;y&lt;sub&gt;i&lt;/sub&gt;y&lt;sub&gt;i&lt;/sub&gt; - &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;y&lt;sub&gt;i&lt;/sub&gt; &amp;sum;x&lt;sub&gt;i&lt;/sub&gt;y&lt;sub&gt;i&lt;/sub&gt;<a name="line.99"></a>
+<FONT color="green">100</FONT>     *<a name="line.100"></a>
+<FONT color="green">101</FONT>     * &lt;/pre&gt;<a name="line.101"></a>
+<FONT color="green">102</FONT>     * &lt;/p&gt;<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>     * &lt;p&gt;Once we know &amp;omega;, we can compute:<a name="line.104"></a>
+<FONT color="green">105</FONT>     * &lt;pre&gt;<a name="line.105"></a>
+<FONT color="green">106</FONT>     *    fc = &amp;omega; f (t) cos (&amp;omega; t) - f' (t) sin (&amp;omega; t)<a name="line.106"></a>
+<FONT color="green">107</FONT>     *    fs = &amp;omega; f (t) sin (&amp;omega; t) + f' (t) cos (&amp;omega; t)<a name="line.107"></a>
+<FONT color="green">108</FONT>     * &lt;/pre&gt;<a name="line.108"></a>
+<FONT color="green">109</FONT>     * &lt;/p&gt;<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>     * &lt;p&gt;It appears that &lt;code&gt;fc = a &amp;omega; cos (&amp;phi;)&lt;/code&gt; and<a name="line.111"></a>
+<FONT color="green">112</FONT>     * &lt;code&gt;fs = -a &amp;omega; sin (&amp;phi;)&lt;/code&gt;, so we can use these<a name="line.112"></a>
+<FONT color="green">113</FONT>     * expressions to compute &amp;phi;. The best estimate over the sample is<a name="line.113"></a>
+<FONT color="green">114</FONT>     * given by averaging these expressions.<a name="line.114"></a>
+<FONT color="green">115</FONT>     * &lt;/p&gt;<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>     * &lt;p&gt;Since integrals and means are involved in the preceding<a name="line.117"></a>
+<FONT color="green">118</FONT>     * estimations, these operations run in O(n) time, where n is the<a name="line.118"></a>
+<FONT color="green">119</FONT>     * number of measurements.&lt;/p&gt;<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>     * @version $Revision: 786479 $ $Date: 2009-06-19 08:36:16 -0400 (Fri, 19 Jun 2009) $<a name="line.121"></a>
+<FONT color="green">122</FONT>     * @since 2.0<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>     */<a name="line.124"></a>
+<FONT color="green">125</FONT>    public class HarmonicCoefficientsGuesser {<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>        /** Sampled observations. */<a name="line.127"></a>
+<FONT color="green">128</FONT>        private final WeightedObservedPoint[] observations;<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /** Guessed amplitude. */<a name="line.130"></a>
+<FONT color="green">131</FONT>        private double a;<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>        /** Guessed pulsation &amp;omega;. */<a name="line.133"></a>
+<FONT color="green">134</FONT>        private double omega;<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>        /** Guessed phase &amp;phi;. */<a name="line.136"></a>
+<FONT color="green">137</FONT>        private double phi;<a name="line.137"></a>
+<FONT color="green">138</FONT>    <a name="line.138"></a>
+<FONT color="green">139</FONT>        /** Simple constructor.<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @param observations sampled observations<a name="line.140"></a>
+<FONT color="green">141</FONT>         */<a name="line.141"></a>
+<FONT color="green">142</FONT>        public HarmonicCoefficientsGuesser(WeightedObservedPoint[] observations) {<a name="line.142"></a>
+<FONT color="green">143</FONT>            this.observations = observations.clone();<a name="line.143"></a>
+<FONT color="green">144</FONT>            a                 = Double.NaN;<a name="line.144"></a>
+<FONT color="green">145</FONT>            omega             = Double.NaN;<a name="line.145"></a>
+<FONT color="green">146</FONT>        }<a name="line.146"></a>
+<FONT color="green">147</FONT>    <a name="line.147"></a>
+<FONT color="green">148</FONT>        /** Estimate a first guess of the coefficients.<a name="line.148"></a>
+<FONT color="green">149</FONT>         * @exception OptimizationException if the sample is too short or if<a name="line.149"></a>
+<FONT color="green">150</FONT>         * the first guess cannot be computed (when the elements under the<a name="line.150"></a>
+<FONT color="green">151</FONT>         * square roots are negative).<a name="line.151"></a>
+<FONT color="green">152</FONT>         * */<a name="line.152"></a>
+<FONT color="green">153</FONT>        public void guess() throws OptimizationException {<a name="line.153"></a>
+<FONT color="green">154</FONT>            sortObservations();<a name="line.154"></a>
+<FONT color="green">155</FONT>            guessAOmega();<a name="line.155"></a>
+<FONT color="green">156</FONT>            guessPhi();<a name="line.156"></a>
+<FONT color="green">157</FONT>        }<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>        /** Sort the observations with respect to the abscissa.<a name="line.159"></a>
+<FONT color="green">160</FONT>         */<a name="line.160"></a>
+<FONT color="green">161</FONT>        private void sortObservations() {<a name="line.161"></a>
+<FONT color="green">162</FONT>    <a name="line.162"></a>
+<FONT color="green">163</FONT>            // Since the samples are almost always already sorted, this<a name="line.163"></a>
+<FONT color="green">164</FONT>            // method is implemented as an insertion sort that reorders the<a name="line.164"></a>
+<FONT color="green">165</FONT>            // elements in place. Insertion sort is very efficient in this case.<a name="line.165"></a>
+<FONT color="green">166</FONT>            WeightedObservedPoint curr = observations[0];<a name="line.166"></a>
+<FONT color="green">167</FONT>            for (int j = 1; j &lt; observations.length; ++j) {<a name="line.167"></a>
+<FONT color="green">168</FONT>                WeightedObservedPoint prec = curr;<a name="line.168"></a>
+<FONT color="green">169</FONT>                curr = observations[j];<a name="line.169"></a>
+<FONT color="green">170</FONT>                if (curr.getX() &lt; prec.getX()) {<a name="line.170"></a>
+<FONT color="green">171</FONT>                    // the current element should be inserted closer to the beginning<a name="line.171"></a>
+<FONT color="green">172</FONT>                    int i = j - 1;<a name="line.172"></a>
+<FONT color="green">173</FONT>                    WeightedObservedPoint mI = observations[i];<a name="line.173"></a>
+<FONT color="green">174</FONT>                    while ((i &gt;= 0) &amp;&amp; (curr.getX() &lt; mI.getX())) {<a name="line.174"></a>
+<FONT color="green">175</FONT>                        observations[i + 1] = mI;<a name="line.175"></a>
+<FONT color="green">176</FONT>                        if (i-- != 0) {<a name="line.176"></a>
+<FONT color="green">177</FONT>                            mI = observations[i];<a name="line.177"></a>
+<FONT color="green">178</FONT>                        } else {<a name="line.178"></a>
+<FONT color="green">179</FONT>                            mI = null;<a name="line.179"></a>
+<FONT color="green">180</FONT>                        }<a name="line.180"></a>
+<FONT color="green">181</FONT>                    }<a name="line.181"></a>
+<FONT color="green">182</FONT>                    observations[i + 1] = curr;<a name="line.182"></a>
+<FONT color="green">183</FONT>                    curr = observations[j];<a name="line.183"></a>
+<FONT color="green">184</FONT>                }<a name="line.184"></a>
+<FONT color="green">185</FONT>            }<a name="line.185"></a>
+<FONT color="green">186</FONT>    <a name="line.186"></a>
+<FONT color="green">187</FONT>        }<a name="line.187"></a>
+<FONT color="green">188</FONT>    <a name="line.188"></a>
+<FONT color="green">189</FONT>        /** Estimate a first guess of the a and &amp;omega; coefficients.<a name="line.189"></a>
+<FONT color="green">190</FONT>         * @exception OptimizationException if the sample is too short or if<a name="line.190"></a>
+<FONT color="green">191</FONT>         * the first guess cannot be computed (when the elements under the<a name="line.191"></a>
+<FONT color="green">192</FONT>         * square roots are negative).<a name="line.192"></a>
+<FONT color="green">193</FONT>         */<a name="line.193"></a>
+<FONT color="green">194</FONT>        private void guessAOmega() throws OptimizationException {<a name="line.194"></a>
+<FONT color="green">195</FONT>    <a name="line.195"></a>
+<FONT color="green">196</FONT>            // initialize the sums for the linear model between the two integrals<a name="line.196"></a>
+<FONT color="green">197</FONT>            double sx2 = 0.0;<a name="line.197"></a>
+<FONT color="green">198</FONT>            double sy2 = 0.0;<a name="line.198"></a>
+<FONT color="green">199</FONT>            double sxy = 0.0;<a name="line.199"></a>
+<FONT color="green">200</FONT>            double sxz = 0.0;<a name="line.200"></a>
+<FONT color="green">201</FONT>            double syz = 0.0;<a name="line.201"></a>
+<FONT color="green">202</FONT>    <a name="line.202"></a>
+<FONT color="green">203</FONT>            double currentX        = observations[0].getX();<a name="line.203"></a>
+<FONT color="green">204</FONT>            double currentY        = observations[0].getY();<a name="line.204"></a>
+<FONT color="green">205</FONT>            double f2Integral      = 0;<a name="line.205"></a>
+<FONT color="green">206</FONT>            double fPrime2Integral = 0;<a name="line.206"></a>
+<FONT color="green">207</FONT>            final double startX = currentX;<a name="line.207"></a>
+<FONT color="green">208</FONT>            for (int i = 1; i &lt; observations.length; ++i) {<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>                // one step forward<a name="line.210"></a>
+<FONT color="green">211</FONT>                final double previousX = currentX;<a name="line.211"></a>
+<FONT color="green">212</FONT>                final double previousY = currentY;<a name="line.212"></a>
+<FONT color="green">213</FONT>                currentX = observations[i].getX();<a name="line.213"></a>
+<FONT color="green">214</FONT>                currentY = observations[i].getY();<a name="line.214"></a>
+<FONT color="green">215</FONT>    <a name="line.215"></a>
+<FONT color="green">216</FONT>                // update the integrals of f&lt;sup&gt;2&lt;/sup&gt; and f'&lt;sup&gt;2&lt;/sup&gt;<a name="line.216"></a>
+<FONT color="green">217</FONT>                // considering a linear model for f (and therefore constant f')<a name="line.217"></a>
+<FONT color="green">218</FONT>                final double dx = currentX - previousX;<a name="line.218"></a>
+<FONT color="green">219</FONT>                final double dy = currentY - previousY;<a name="line.219"></a>
+<FONT color="green">220</FONT>                final double f2StepIntegral =<a name="line.220"></a>
+<FONT color="green">221</FONT>                    dx * (previousY * previousY + previousY * currentY + currentY * currentY) / 3;<a name="line.221"></a>
+<FONT color="green">222</FONT>                final double fPrime2StepIntegral = dy * dy / dx;<a name="line.222"></a>
+<FONT color="green">223</FONT>    <a name="line.223"></a>
+<FONT color="green">224</FONT>                final double x   = currentX - startX;<a name="line.224"></a>
+<FONT color="green">225</FONT>                f2Integral      += f2StepIntegral;<a name="line.225"></a>
+<FONT color="green">226</FONT>                fPrime2Integral += fPrime2StepIntegral;<a name="line.226"></a>
+<FONT color="green">227</FONT>    <a name="line.227"></a>
+<FONT color="green">228</FONT>                sx2 += x * x;<a name="line.228"></a>
+<FONT color="green">229</FONT>                sy2 += f2Integral * f2Integral;<a name="line.229"></a>
+<FONT color="green">230</FONT>                sxy += x * f2Integral;<a name="line.230"></a>
+<FONT color="green">231</FONT>                sxz += x * fPrime2Integral;<a name="line.231"></a>
+<FONT color="green">232</FONT>                syz += f2Integral * fPrime2Integral;<a name="line.232"></a>
+<FONT color="green">233</FONT>    <a name="line.233"></a>
+<FONT color="green">234</FONT>            }<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>            // compute the amplitude and pulsation coefficients<a name="line.236"></a>
+<FONT color="green">237</FONT>            double c1 = sy2 * sxz - sxy * syz;<a name="line.237"></a>
+<FONT color="green">238</FONT>            double c2 = sxy * sxz - sx2 * syz;<a name="line.238"></a>
+<FONT color="green">239</FONT>            double c3 = sx2 * sy2 - sxy * sxy;<a name="line.239"></a>
+<FONT color="green">240</FONT>            if ((c1 / c2 &lt; 0.0) || (c2 / c3 &lt; 0.0)) {<a name="line.240"></a>
+<FONT color="green">241</FONT>                throw new OptimizationException("unable to first guess the harmonic coefficients");<a name="line.241"></a>
+<FONT color="green">242</FONT>            }<a name="line.242"></a>
+<FONT color="green">243</FONT>            a     = Math.sqrt(c1 / c2);<a name="line.243"></a>
+<FONT color="green">244</FONT>            omega = Math.sqrt(c2 / c3);<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>        }<a name="line.246"></a>
+<FONT color="green">247</FONT>    <a name="line.247"></a>
+<FONT color="green">248</FONT>        /** Estimate a first guess of the &amp;phi; coefficient.<a name="line.248"></a>
+<FONT color="green">249</FONT>         */<a name="line.249"></a>
+<FONT color="green">250</FONT>        private void guessPhi() {<a name="line.250"></a>
+<FONT color="green">251</FONT>    <a name="line.251"></a>
+<FONT color="green">252</FONT>            // initialize the means<a name="line.252"></a>
+<FONT color="green">253</FONT>            double fcMean = 0.0;<a name="line.253"></a>
+<FONT color="green">254</FONT>            double fsMean = 0.0;<a name="line.254"></a>
+<FONT color="green">255</FONT>    <a name="line.255"></a>
+<FONT color="green">256</FONT>            double currentX = observations[0].getX();<a name="line.256"></a>
+<FONT color="green">257</FONT>            double currentY = observations[0].getY();<a name="line.257"></a>
+<FONT color="green">258</FONT>            for (int i = 1; i &lt; observations.length; ++i) {<a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>                // one step forward<a name="line.260"></a>
+<FONT color="green">261</FONT>                final double previousX = currentX;<a name="line.261"></a>
+<FONT color="green">262</FONT>                final double previousY = currentY;<a name="line.262"></a>
+<FONT color="green">263</FONT>                currentX = observations[i].getX();<a name="line.263"></a>
+<FONT color="green">264</FONT>                currentY = observations[i].getY();<a name="line.264"></a>
+<FONT color="green">265</FONT>                final double currentYPrime = (currentY - previousY) / (currentX - previousX);<a name="line.265"></a>
+<FONT color="green">266</FONT>    <a name="line.266"></a>
+<FONT color="green">267</FONT>                double   omegaX = omega * currentX;<a name="line.267"></a>
+<FONT color="green">268</FONT>                double   cosine = Math.cos(omegaX);<a name="line.268"></a>
+<FONT color="green">269</FONT>                double   sine   = Math.sin(omegaX);<a name="line.269"></a>
+<FONT color="green">270</FONT>                fcMean += omega * currentY * cosine - currentYPrime *   sine;<a name="line.270"></a>
+<FONT color="green">271</FONT>                fsMean += omega * currentY *   sine + currentYPrime * cosine;<a name="line.271"></a>
+<FONT color="green">272</FONT>    <a name="line.272"></a>
+<FONT color="green">273</FONT>            }<a name="line.273"></a>
+<FONT color="green">274</FONT>    <a name="line.274"></a>
+<FONT color="green">275</FONT>            phi = Math.atan2(-fsMean, fcMean);<a name="line.275"></a>
+<FONT color="green">276</FONT>    <a name="line.276"></a>
+<FONT color="green">277</FONT>        }<a name="line.277"></a>
+<FONT color="green">278</FONT>    <a name="line.278"></a>
+<FONT color="green">279</FONT>        /** Get the guessed amplitude a.<a name="line.279"></a>
+<FONT color="green">280</FONT>         * @return guessed amplitude a;<a name="line.280"></a>
+<FONT color="green">281</FONT>         */<a name="line.281"></a>
+<FONT color="green">282</FONT>        public double getGuessedAmplitude() {<a name="line.282"></a>
+<FONT color="green">283</FONT>            return a;<a name="line.283"></a>
+<FONT color="green">284</FONT>        }<a name="line.284"></a>
+<FONT color="green">285</FONT>    <a name="line.285"></a>
+<FONT color="green">286</FONT>        /** Get the guessed pulsation &amp;omega;.<a name="line.286"></a>
+<FONT color="green">287</FONT>         * @return guessed pulsation &amp;omega;<a name="line.287"></a>
+<FONT color="green">288</FONT>         */<a name="line.288"></a>
+<FONT color="green">289</FONT>        public double getGuessedPulsation() {<a name="line.289"></a>
+<FONT color="green">290</FONT>            return omega;<a name="line.290"></a>
+<FONT color="green">291</FONT>        }<a name="line.291"></a>
+<FONT color="green">292</FONT>    <a name="line.292"></a>
+<FONT color="green">293</FONT>        /** Get the guessed phase &amp;phi;.<a name="line.293"></a>
+<FONT color="green">294</FONT>         * @return guessed phase &amp;phi;<a name="line.294"></a>
+<FONT color="green">295</FONT>         */<a name="line.295"></a>
+<FONT color="green">296</FONT>        public double getGuessedPhase() {<a name="line.296"></a>
+<FONT color="green">297</FONT>            return phi;<a name="line.297"></a>
+<FONT color="green">298</FONT>        }<a name="line.298"></a>
+<FONT color="green">299</FONT>    <a name="line.299"></a>
+<FONT color="green">300</FONT>    }<a name="line.300"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/fitting/HarmonicFitter.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,198 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.fitting;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.optimization.DifferentiableMultivariateVectorialOptimizer;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.optimization.OptimizationException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /** This class implements a curve fitting specialized for sinusoids.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;Harmonic fitting is a very simple case of curve fitting. The<a name="line.26"></a>
+<FONT color="green">027</FONT>     * estimated coefficients are the amplitude a, the pulsation &amp;omega; and<a name="line.27"></a>
+<FONT color="green">028</FONT>     * the phase &amp;phi;: &lt;code&gt;f (t) = a cos (&amp;omega; t + &amp;phi;)&lt;/code&gt;. They are<a name="line.28"></a>
+<FONT color="green">029</FONT>     * searched by a least square estimator initialized with a rough guess<a name="line.29"></a>
+<FONT color="green">030</FONT>     * based on integrals.&lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 786479 $ $Date: 2009-06-19 08:36:16 -0400 (Fri, 19 Jun 2009) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 2.0<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public class HarmonicFitter {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Fitter for the coefficients. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private final CurveFitter fitter;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Values for amplitude, pulsation &amp;omega; and phase &amp;phi;. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private double[] parameters;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Simple constructor.<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @param optimizer optimizer to use for the fitting<a name="line.43"></a>
+<FONT color="green">044</FONT>         */<a name="line.44"></a>
+<FONT color="green">045</FONT>        public HarmonicFitter(final DifferentiableMultivariateVectorialOptimizer optimizer) {<a name="line.45"></a>
+<FONT color="green">046</FONT>            this.fitter = new CurveFitter(optimizer);<a name="line.46"></a>
+<FONT color="green">047</FONT>            parameters  = null;<a name="line.47"></a>
+<FONT color="green">048</FONT>        }<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Simple constructor.<a name="line.50"></a>
+<FONT color="green">051</FONT>         * &lt;p&gt;This constructor can be used when a first guess of the<a name="line.51"></a>
+<FONT color="green">052</FONT>         * coefficients is already known.&lt;/p&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>         * @param optimizer optimizer to use for the fitting<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @param initialGuess guessed values for amplitude (index 0),<a name="line.54"></a>
+<FONT color="green">055</FONT>         * pulsation &amp;omega; (index 1) and phase &amp;phi; (index 2)<a name="line.55"></a>
+<FONT color="green">056</FONT>         */<a name="line.56"></a>
+<FONT color="green">057</FONT>        public HarmonicFitter(final DifferentiableMultivariateVectorialOptimizer optimizer,<a name="line.57"></a>
+<FONT color="green">058</FONT>                              final double[] initialGuess) {<a name="line.58"></a>
+<FONT color="green">059</FONT>            this.fitter     = new CurveFitter(optimizer);<a name="line.59"></a>
+<FONT color="green">060</FONT>            this.parameters = initialGuess.clone();<a name="line.60"></a>
+<FONT color="green">061</FONT>        }<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /** Add an observed weighted (x,y) point to the sample.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @param weight weight of the observed point in the fit<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param x abscissa of the point<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @param y observed value of the point at x, after fitting we should<a name="line.66"></a>
+<FONT color="green">067</FONT>         * have P(x) as close as possible to this value<a name="line.67"></a>
+<FONT color="green">068</FONT>         */<a name="line.68"></a>
+<FONT color="green">069</FONT>        public void addObservedPoint(double weight, double x, double y) {<a name="line.69"></a>
+<FONT color="green">070</FONT>            fitter.addObservedPoint(weight, x, y);<a name="line.70"></a>
+<FONT color="green">071</FONT>        }<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /** Fit an harmonic function to the observed points.<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @return harmonic function best fitting the observed points<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @throws OptimizationException if the sample is too short or if<a name="line.75"></a>
+<FONT color="green">076</FONT>         * the first guess cannot be computed<a name="line.76"></a>
+<FONT color="green">077</FONT>         */<a name="line.77"></a>
+<FONT color="green">078</FONT>        public HarmonicFunction fit() throws OptimizationException {<a name="line.78"></a>
+<FONT color="green">079</FONT>            try {<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>                // shall we compute the first guess of the parameters ourselves ?<a name="line.81"></a>
+<FONT color="green">082</FONT>                if (parameters == null) {<a name="line.82"></a>
+<FONT color="green">083</FONT>                    final WeightedObservedPoint[] observations = fitter.getObservations();<a name="line.83"></a>
+<FONT color="green">084</FONT>                    if (observations.length &lt; 4) {<a name="line.84"></a>
+<FONT color="green">085</FONT>                        throw new OptimizationException("sample contains {0} observed points, at least {1} are required",<a name="line.85"></a>
+<FONT color="green">086</FONT>                                                        observations.length, 4);<a name="line.86"></a>
+<FONT color="green">087</FONT>                    }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>                    HarmonicCoefficientsGuesser guesser = new HarmonicCoefficientsGuesser(observations);<a name="line.89"></a>
+<FONT color="green">090</FONT>                    guesser.guess();<a name="line.90"></a>
+<FONT color="green">091</FONT>                    parameters = new double[] {<a name="line.91"></a>
+<FONT color="green">092</FONT>                                     guesser.getGuessedAmplitude(),<a name="line.92"></a>
+<FONT color="green">093</FONT>                                     guesser.getGuessedPulsation(),<a name="line.93"></a>
+<FONT color="green">094</FONT>                                     guesser.getGuessedPhase()<a name="line.94"></a>
+<FONT color="green">095</FONT>                                };<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>                }<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>                double[] fitted = fitter.fit(new ParametricHarmonicFunction(), parameters);<a name="line.99"></a>
+<FONT color="green">100</FONT>                return new HarmonicFunction(fitted[0], fitted[1], fitted[2]);<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>            } catch (FunctionEvaluationException fee) {<a name="line.102"></a>
+<FONT color="green">103</FONT>                // this should never happen<a name="line.103"></a>
+<FONT color="green">104</FONT>                throw MathRuntimeException.createInternalError(fee);<a name="line.104"></a>
+<FONT color="green">105</FONT>            }<a name="line.105"></a>
+<FONT color="green">106</FONT>        }<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>        /** Parametric harmonic function. */<a name="line.108"></a>
+<FONT color="green">109</FONT>        private static class ParametricHarmonicFunction implements ParametricRealFunction {<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>            /** {@inheritDoc} */<a name="line.111"></a>
+<FONT color="green">112</FONT>            public double value(double x, double[] parameters) {<a name="line.112"></a>
+<FONT color="green">113</FONT>                final double a     = parameters[0];<a name="line.113"></a>
+<FONT color="green">114</FONT>                final double omega = parameters[1];<a name="line.114"></a>
+<FONT color="green">115</FONT>                final double phi   = parameters[2];<a name="line.115"></a>
+<FONT color="green">116</FONT>                return a * Math.cos(omega * x + phi);<a name="line.116"></a>
+<FONT color="green">117</FONT>            }<a name="line.117"></a>
+<FONT color="green">118</FONT>    <a name="line.118"></a>
+<FONT color="green">119</FONT>            /** {@inheritDoc} */<a name="line.119"></a>
+<FONT color="green">120</FONT>            public double[] gradient(double x, double[] parameters) {<a name="line.120"></a>
+<FONT color="green">121</FONT>                final double a     = parameters[0];<a name="line.121"></a>
+<FONT color="green">122</FONT>                final double omega = parameters[1];<a name="line.122"></a>
+<FONT color="green">123</FONT>                final double phi   = parameters[2];<a name="line.123"></a>
+<FONT color="green">124</FONT>                final double alpha = omega * x + phi;<a name="line.124"></a>
+<FONT color="green">125</FONT>                final double cosAlpha = Math.cos(alpha);<a name="line.125"></a>
+<FONT color="green">126</FONT>                final double sinAlpha = Math.sin(alpha);<a name="line.126"></a>
+<FONT color="green">127</FONT>                return new double[] { cosAlpha, -a * x * sinAlpha, -a * sinAlpha };<a name="line.127"></a>
+<FONT color="green">128</FONT>            }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        }<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>    }<a name="line.132"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/fitting/HarmonicFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,145 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.fitting;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.analysis.DifferentiableUnivariateRealFunction;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /** Harmonic function of the form &lt;code&gt;f (t) = a cos (&amp;omega; t + &amp;phi;)&lt;/code&gt;.<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 786479 $ $Date: 2009-06-19 08:36:16 -0400 (Fri, 19 Jun 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @since 2.0<a name="line.24"></a>
+<FONT color="green">025</FONT>     */<a name="line.25"></a>
+<FONT color="green">026</FONT>    public class HarmonicFunction implements DifferentiableUnivariateRealFunction {<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>        /** Amplitude a. */<a name="line.28"></a>
+<FONT color="green">029</FONT>        private final double a;<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /** Pulsation &amp;omega;. */<a name="line.31"></a>
+<FONT color="green">032</FONT>        private final double omega;<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /** Phase &amp;phi;. */<a name="line.34"></a>
+<FONT color="green">035</FONT>        private final double phi;<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /** Simple constructor.<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @param a amplitude<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @param omega pulsation<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @param phi phase<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        public HarmonicFunction(double a, double omega, double phi) {<a name="line.42"></a>
+<FONT color="green">043</FONT>            this.a     = a;<a name="line.43"></a>
+<FONT color="green">044</FONT>            this.omega = omega;<a name="line.44"></a>
+<FONT color="green">045</FONT>            this.phi   = phi;<a name="line.45"></a>
+<FONT color="green">046</FONT>        }<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** {@inheritDoc} */<a name="line.48"></a>
+<FONT color="green">049</FONT>        public double value(double x) {<a name="line.49"></a>
+<FONT color="green">050</FONT>            return a * Math.cos(omega * x + phi);<a name="line.50"></a>
+<FONT color="green">051</FONT>        }<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** {@inheritDoc} */<a name="line.53"></a>
+<FONT color="green">054</FONT>        public HarmonicFunction derivative() {<a name="line.54"></a>
+<FONT color="green">055</FONT>            return new HarmonicFunction(a * omega, omega, phi + Math.PI / 2);<a name="line.55"></a>
+<FONT color="green">056</FONT>        }<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /** Get the amplitude a.<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @return amplitude a;<a name="line.59"></a>
+<FONT color="green">060</FONT>         */<a name="line.60"></a>
+<FONT color="green">061</FONT>        public double getAmplitude() {<a name="line.61"></a>
+<FONT color="green">062</FONT>            return a;<a name="line.62"></a>
+<FONT color="green">063</FONT>        }<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Get the pulsation &amp;omega;.<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @return pulsation &amp;omega;<a name="line.66"></a>
+<FONT color="green">067</FONT>         */<a name="line.67"></a>
+<FONT color="green">068</FONT>        public double getPulsation() {<a name="line.68"></a>
+<FONT color="green">069</FONT>            return omega;<a name="line.69"></a>
+<FONT color="green">070</FONT>        }<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /** Get the phase &amp;phi;.<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @return phase &amp;phi;<a name="line.73"></a>
+<FONT color="green">074</FONT>         */<a name="line.74"></a>
+<FONT color="green">075</FONT>        public double getPhase() {<a name="line.75"></a>
+<FONT color="green">076</FONT>            return phi;<a name="line.76"></a>
+<FONT color="green">077</FONT>        }<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>    }<a name="line.79"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/fitting/ParametricRealFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,116 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.fitting;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * An interface representing a real function that depends on one independent<a name="line.23"></a>
+<FONT color="green">024</FONT>     * variable plus some extra parameters.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public interface ParametricRealFunction {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /**<a name="line.30"></a>
+<FONT color="green">031</FONT>         * Compute the value of the function.<a name="line.31"></a>
+<FONT color="green">032</FONT>         * @param x the point for which the function value should be computed<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @param parameters function parameters<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @return the value<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @throws FunctionEvaluationException if the function evaluation fails<a name="line.35"></a>
+<FONT color="green">036</FONT>         */<a name="line.36"></a>
+<FONT color="green">037</FONT>        double value(double x, double[] parameters)<a name="line.37"></a>
+<FONT color="green">038</FONT>            throws FunctionEvaluationException;<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /**<a name="line.40"></a>
+<FONT color="green">041</FONT>         * Compute the gradient of the function with respect to its parameters.<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @param x the point for which the function value should be computed<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @param parameters function parameters<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @return the value<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @throws FunctionEvaluationException if the function evaluation fails<a name="line.45"></a>
+<FONT color="green">046</FONT>         */<a name="line.46"></a>
+<FONT color="green">047</FONT>        double[] gradient(double x, double[] parameters)<a name="line.47"></a>
+<FONT color="green">048</FONT>            throws FunctionEvaluationException;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>    }<a name="line.50"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/fitting/PolynomialFitter.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,169 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.fitting;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.analysis.polynomials.PolynomialFunction;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.optimization.DifferentiableMultivariateVectorialOptimizer;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.optimization.OptimizationException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /** This class implements a curve fitting specialized for polynomials.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;Polynomial fitting is a very simple case of curve fitting. The<a name="line.27"></a>
+<FONT color="green">028</FONT>     * estimated coefficients are the polynomial coefficients. They are<a name="line.28"></a>
+<FONT color="green">029</FONT>     * searched by a least square estimator.&lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 2.0<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>    public class PolynomialFitter {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Fitter for the coefficients. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private final CurveFitter fitter;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Polynomial degree. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private final int degree;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Simple constructor.<a name="line.42"></a>
+<FONT color="green">043</FONT>         * &lt;p&gt;The polynomial fitter built this way are complete polynomials,<a name="line.43"></a>
+<FONT color="green">044</FONT>         * ie. a n-degree polynomial has n+1 coefficients.&lt;/p&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @param degree maximal degree of the polynomial<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param optimizer optimizer to use for the fitting<a name="line.46"></a>
+<FONT color="green">047</FONT>         */<a name="line.47"></a>
+<FONT color="green">048</FONT>        public PolynomialFitter(int degree, final DifferentiableMultivariateVectorialOptimizer optimizer) {<a name="line.48"></a>
+<FONT color="green">049</FONT>            this.fitter = new CurveFitter(optimizer);<a name="line.49"></a>
+<FONT color="green">050</FONT>            this.degree = degree;<a name="line.50"></a>
+<FONT color="green">051</FONT>        }<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** Add an observed weighted (x,y) point to the sample.<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @param weight weight of the observed point in the fit<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param x abscissa of the point<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param y observed value of the point at x, after fitting we should<a name="line.56"></a>
+<FONT color="green">057</FONT>         * have P(x) as close as possible to this value<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public void addObservedPoint(double weight, double x, double y) {<a name="line.59"></a>
+<FONT color="green">060</FONT>            fitter.addObservedPoint(weight, x, y);<a name="line.60"></a>
+<FONT color="green">061</FONT>        }<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /** Get the polynomial fitting the weighted (x, y) points.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @return polynomial function best fitting the observed points<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @exception OptimizationException if the algorithm failed to converge<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        public PolynomialFunction fit()<a name="line.67"></a>
+<FONT color="green">068</FONT>            throws OptimizationException {<a name="line.68"></a>
+<FONT color="green">069</FONT>            try {<a name="line.69"></a>
+<FONT color="green">070</FONT>                return new PolynomialFunction(fitter.fit(new ParametricPolynomial(), new double[degree + 1]));<a name="line.70"></a>
+<FONT color="green">071</FONT>            } catch (FunctionEvaluationException fee) {<a name="line.71"></a>
+<FONT color="green">072</FONT>                // this should never happen<a name="line.72"></a>
+<FONT color="green">073</FONT>                throw MathRuntimeException.createInternalError(fee);<a name="line.73"></a>
+<FONT color="green">074</FONT>            }<a name="line.74"></a>
+<FONT color="green">075</FONT>        }<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** Dedicated parametric polynomial class. */<a name="line.77"></a>
+<FONT color="green">078</FONT>        private static class ParametricPolynomial implements ParametricRealFunction {<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>            /** {@inheritDoc} */<a name="line.80"></a>
+<FONT color="green">081</FONT>            public double[] gradient(double x, double[] parameters)<a name="line.81"></a>
+<FONT color="green">082</FONT>                    throws FunctionEvaluationException {<a name="line.82"></a>
+<FONT color="green">083</FONT>                final double[] gradient = new double[parameters.length];<a name="line.83"></a>
+<FONT color="green">084</FONT>                double xn = 1.0;<a name="line.84"></a>
+<FONT color="green">085</FONT>                for (int i = 0; i &lt; parameters.length; ++i) {<a name="line.85"></a>
+<FONT color="green">086</FONT>                    gradient[i] = xn;<a name="line.86"></a>
+<FONT color="green">087</FONT>                    xn *= x;<a name="line.87"></a>
+<FONT color="green">088</FONT>                }<a name="line.88"></a>
+<FONT color="green">089</FONT>                return gradient;<a name="line.89"></a>
+<FONT color="green">090</FONT>            }<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>            /** {@inheritDoc} */<a name="line.92"></a>
+<FONT color="green">093</FONT>            public double value(final double x, final double[] parameters) {<a name="line.93"></a>
+<FONT color="green">094</FONT>                double y = 0;<a name="line.94"></a>
+<FONT color="green">095</FONT>                for (int i = parameters.length - 1; i &gt;= 0; --i) {<a name="line.95"></a>
+<FONT color="green">096</FONT>                    y = y * x + parameters[i];<a name="line.96"></a>
+<FONT color="green">097</FONT>                }<a name="line.97"></a>
+<FONT color="green">098</FONT>                return y;<a name="line.98"></a>
+<FONT color="green">099</FONT>            }<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        }<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>    }<a name="line.103"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/fitting/WeightedObservedPoint.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,141 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.fitting;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /** This class is a simple container for weighted observed point in<a name="line.22"></a>
+<FONT color="green">023</FONT>     * {@link CurveFitter curve fitting}.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;Instances of this class are guaranteed to be immutable.&lt;/p&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 786479 $ $Date: 2009-06-19 08:36:16 -0400 (Fri, 19 Jun 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 2.0<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public class WeightedObservedPoint implements Serializable {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /** Serializable version id. */<a name="line.30"></a>
+<FONT color="green">031</FONT>        private static final long serialVersionUID = 5306874947404636157L;<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** Weight of the measurement in the fitting process. */<a name="line.33"></a>
+<FONT color="green">034</FONT>        private final double weight;<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Abscissa of the point. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private final double x;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Observed value of the function at x. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private final double y;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Simple constructor.<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @param weight weight of the measurement in the fitting process<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @param x abscissa of the measurement<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @param y ordinate of the measurement<a name="line.45"></a>
+<FONT color="green">046</FONT>         */<a name="line.46"></a>
+<FONT color="green">047</FONT>        public WeightedObservedPoint(final double weight, final double x, final double y) {<a name="line.47"></a>
+<FONT color="green">048</FONT>            this.weight = weight;<a name="line.48"></a>
+<FONT color="green">049</FONT>            this.x      = x;<a name="line.49"></a>
+<FONT color="green">050</FONT>            this.y      = y;<a name="line.50"></a>
+<FONT color="green">051</FONT>        }<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** Get the weight of the measurement in the fitting process.<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @return weight of the measurement in the fitting process<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public double getWeight() {<a name="line.56"></a>
+<FONT color="green">057</FONT>            return weight;<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Get the abscissa of the point.<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @return abscissa of the point<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        public double getX() {<a name="line.63"></a>
+<FONT color="green">064</FONT>            return x;<a name="line.64"></a>
+<FONT color="green">065</FONT>        }<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /** Get the observed value of the function at x.<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @return observed value of the function at x<a name="line.68"></a>
+<FONT color="green">069</FONT>         */<a name="line.69"></a>
+<FONT color="green">070</FONT>        public double getY() {<a name="line.70"></a>
+<FONT color="green">071</FONT>            return y;<a name="line.71"></a>
+<FONT color="green">072</FONT>        }<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>    }<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,434 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.general;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MaxEvaluationsExceededException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.analysis.DifferentiableMultivariateVectorialFunction;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.analysis.MultivariateMatrixFunction;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.linear.InvalidMatrixException;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.linear.LUDecompositionImpl;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.linear.MatrixUtils;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.linear.RealMatrix;<a name="line.28"></a>
+<FONT color="green">029</FONT>    import org.apache.commons.math.optimization.OptimizationException;<a name="line.29"></a>
+<FONT color="green">030</FONT>    import org.apache.commons.math.optimization.SimpleVectorialValueChecker;<a name="line.30"></a>
+<FONT color="green">031</FONT>    import org.apache.commons.math.optimization.VectorialConvergenceChecker;<a name="line.31"></a>
+<FONT color="green">032</FONT>    import org.apache.commons.math.optimization.DifferentiableMultivariateVectorialOptimizer;<a name="line.32"></a>
+<FONT color="green">033</FONT>    import org.apache.commons.math.optimization.VectorialPointValuePair;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>    /**<a name="line.35"></a>
+<FONT color="green">036</FONT>     * Base class for implementing least squares optimizers.<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;p&gt;This base class handles the boilerplate methods associated to thresholds<a name="line.37"></a>
+<FONT color="green">038</FONT>     * settings, jacobian and error estimation.&lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @version $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @since 1.2<a name="line.40"></a>
+<FONT color="green">041</FONT>     *<a name="line.41"></a>
+<FONT color="green">042</FONT>     */<a name="line.42"></a>
+<FONT color="green">043</FONT>    public abstract class AbstractLeastSquaresOptimizer implements DifferentiableMultivariateVectorialOptimizer {<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Default maximal number of iterations allowed. */<a name="line.45"></a>
+<FONT color="green">046</FONT>        public static final int DEFAULT_MAX_ITERATIONS = 100;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** Convergence checker. */<a name="line.48"></a>
+<FONT color="green">049</FONT>        protected VectorialConvergenceChecker checker;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /**<a name="line.51"></a>
+<FONT color="green">052</FONT>         * Jacobian matrix.<a name="line.52"></a>
+<FONT color="green">053</FONT>         * &lt;p&gt;This matrix is in canonical form just after the calls to<a name="line.53"></a>
+<FONT color="green">054</FONT>         * {@link #updateJacobian()}, but may be modified by the solver<a name="line.54"></a>
+<FONT color="green">055</FONT>         * in the derived class (the {@link LevenbergMarquardtOptimizer<a name="line.55"></a>
+<FONT color="green">056</FONT>         * Levenberg-Marquardt optimizer} does this).&lt;/p&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        protected double[][] jacobian;<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Number of columns of the jacobian matrix. */<a name="line.60"></a>
+<FONT color="green">061</FONT>        protected int cols;<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /** Number of rows of the jacobian matrix. */<a name="line.63"></a>
+<FONT color="green">064</FONT>        protected int rows;<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /**<a name="line.66"></a>
+<FONT color="green">067</FONT>         * Target value for the objective functions at optimum.<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @since 2.1<a name="line.68"></a>
+<FONT color="green">069</FONT>         */<a name="line.69"></a>
+<FONT color="green">070</FONT>        protected double[] targetValues;<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /**<a name="line.72"></a>
+<FONT color="green">073</FONT>         * Weight for the least squares cost computation.<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @since 2.1<a name="line.74"></a>
+<FONT color="green">075</FONT>         */<a name="line.75"></a>
+<FONT color="green">076</FONT>        protected double[] residualsWeights;<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /** Current point. */<a name="line.78"></a>
+<FONT color="green">079</FONT>        protected double[] point;<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /** Current objective function value. */<a name="line.81"></a>
+<FONT color="green">082</FONT>        protected double[] objective;<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /** Current residuals. */<a name="line.84"></a>
+<FONT color="green">085</FONT>        protected double[] residuals;<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>        /** Cost value (square root of the sum of the residuals). */<a name="line.87"></a>
+<FONT color="green">088</FONT>        protected double cost;<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>        /** Maximal number of iterations allowed. */<a name="line.90"></a>
+<FONT color="green">091</FONT>        private int maxIterations;<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /** Number of iterations already performed. */<a name="line.93"></a>
+<FONT color="green">094</FONT>        private int iterations;<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /** Maximal number of evaluations allowed. */<a name="line.96"></a>
+<FONT color="green">097</FONT>        private int maxEvaluations;<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>        /** Number of evaluations already performed. */<a name="line.99"></a>
+<FONT color="green">100</FONT>        private int objectiveEvaluations;<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>        /** Number of jacobian evaluations. */<a name="line.102"></a>
+<FONT color="green">103</FONT>        private int jacobianEvaluations;<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /** Objective function. */<a name="line.105"></a>
+<FONT color="green">106</FONT>        private DifferentiableMultivariateVectorialFunction function;<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>        /** Objective function derivatives. */<a name="line.108"></a>
+<FONT color="green">109</FONT>        private MultivariateMatrixFunction jF;<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /** Simple constructor with default settings.<a name="line.111"></a>
+<FONT color="green">112</FONT>         * &lt;p&gt;The convergence check is set to a {@link SimpleVectorialValueChecker}<a name="line.112"></a>
+<FONT color="green">113</FONT>         * and the maximal number of evaluation is set to its default value.&lt;/p&gt;<a name="line.113"></a>
+<FONT color="green">114</FONT>         */<a name="line.114"></a>
+<FONT color="green">115</FONT>        protected AbstractLeastSquaresOptimizer() {<a name="line.115"></a>
+<FONT color="green">116</FONT>            setConvergenceChecker(new SimpleVectorialValueChecker());<a name="line.116"></a>
+<FONT color="green">117</FONT>            setMaxIterations(DEFAULT_MAX_ITERATIONS);<a name="line.117"></a>
+<FONT color="green">118</FONT>            setMaxEvaluations(Integer.MAX_VALUE);<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /** {@inheritDoc} */<a name="line.121"></a>
+<FONT color="green">122</FONT>        public void setMaxIterations(int maxIterations) {<a name="line.122"></a>
+<FONT color="green">123</FONT>            this.maxIterations = maxIterations;<a name="line.123"></a>
+<FONT color="green">124</FONT>        }<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>        /** {@inheritDoc} */<a name="line.126"></a>
+<FONT color="green">127</FONT>        public int getMaxIterations() {<a name="line.127"></a>
+<FONT color="green">128</FONT>            return maxIterations;<a name="line.128"></a>
+<FONT color="green">129</FONT>        }<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>        /** {@inheritDoc} */<a name="line.131"></a>
+<FONT color="green">132</FONT>        public int getIterations() {<a name="line.132"></a>
+<FONT color="green">133</FONT>            return iterations;<a name="line.133"></a>
+<FONT color="green">134</FONT>        }<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>        /** {@inheritDoc} */<a name="line.136"></a>
+<FONT color="green">137</FONT>        public void setMaxEvaluations(int maxEvaluations) {<a name="line.137"></a>
+<FONT color="green">138</FONT>            this.maxEvaluations = maxEvaluations;<a name="line.138"></a>
+<FONT color="green">139</FONT>        }<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>        /** {@inheritDoc} */<a name="line.141"></a>
+<FONT color="green">142</FONT>        public int getMaxEvaluations() {<a name="line.142"></a>
+<FONT color="green">143</FONT>            return maxEvaluations;<a name="line.143"></a>
+<FONT color="green">144</FONT>        }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>        /** {@inheritDoc} */<a name="line.146"></a>
+<FONT color="green">147</FONT>        public int getEvaluations() {<a name="line.147"></a>
+<FONT color="green">148</FONT>            return objectiveEvaluations;<a name="line.148"></a>
+<FONT color="green">149</FONT>        }<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>        /** {@inheritDoc} */<a name="line.151"></a>
+<FONT color="green">152</FONT>        public int getJacobianEvaluations() {<a name="line.152"></a>
+<FONT color="green">153</FONT>            return jacobianEvaluations;<a name="line.153"></a>
+<FONT color="green">154</FONT>        }<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>        /** {@inheritDoc} */<a name="line.156"></a>
+<FONT color="green">157</FONT>        public void setConvergenceChecker(VectorialConvergenceChecker convergenceChecker) {<a name="line.157"></a>
+<FONT color="green">158</FONT>            this.checker = convergenceChecker;<a name="line.158"></a>
+<FONT color="green">159</FONT>        }<a name="line.159"></a>
+<FONT color="green">160</FONT>    <a name="line.160"></a>
+<FONT color="green">161</FONT>        /** {@inheritDoc} */<a name="line.161"></a>
+<FONT color="green">162</FONT>        public VectorialConvergenceChecker getConvergenceChecker() {<a name="line.162"></a>
+<FONT color="green">163</FONT>            return checker;<a name="line.163"></a>
+<FONT color="green">164</FONT>        }<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>        /** Increment the iterations counter by 1.<a name="line.166"></a>
+<FONT color="green">167</FONT>         * @exception OptimizationException if the maximal number<a name="line.167"></a>
+<FONT color="green">168</FONT>         * of iterations is exceeded<a name="line.168"></a>
+<FONT color="green">169</FONT>         */<a name="line.169"></a>
+<FONT color="green">170</FONT>        protected void incrementIterationsCounter()<a name="line.170"></a>
+<FONT color="green">171</FONT>            throws OptimizationException {<a name="line.171"></a>
+<FONT color="green">172</FONT>            if (++iterations &gt; maxIterations) {<a name="line.172"></a>
+<FONT color="green">173</FONT>                throw new OptimizationException(new MaxIterationsExceededException(maxIterations));<a name="line.173"></a>
+<FONT color="green">174</FONT>            }<a name="line.174"></a>
+<FONT color="green">175</FONT>        }<a name="line.175"></a>
+<FONT color="green">176</FONT>    <a name="line.176"></a>
+<FONT color="green">177</FONT>        /**<a name="line.177"></a>
+<FONT color="green">178</FONT>         * Update the jacobian matrix.<a name="line.178"></a>
+<FONT color="green">179</FONT>         * @exception FunctionEvaluationException if the function jacobian<a name="line.179"></a>
+<FONT color="green">180</FONT>         * cannot be evaluated or its dimension doesn't match problem dimension<a name="line.180"></a>
+<FONT color="green">181</FONT>         */<a name="line.181"></a>
+<FONT color="green">182</FONT>        protected void updateJacobian() throws FunctionEvaluationException {<a name="line.182"></a>
+<FONT color="green">183</FONT>            ++jacobianEvaluations;<a name="line.183"></a>
+<FONT color="green">184</FONT>            jacobian = jF.value(point);<a name="line.184"></a>
+<FONT color="green">185</FONT>            if (jacobian.length != rows) {<a name="line.185"></a>
+<FONT color="green">186</FONT>                throw new FunctionEvaluationException(point, "dimension mismatch {0} != {1}",<a name="line.186"></a>
+<FONT color="green">187</FONT>                                                      jacobian.length, rows);<a name="line.187"></a>
+<FONT color="green">188</FONT>            }<a name="line.188"></a>
+<FONT color="green">189</FONT>            for (int i = 0; i &lt; rows; i++) {<a name="line.189"></a>
+<FONT color="green">190</FONT>                final double[] ji = jacobian[i];<a name="line.190"></a>
+<FONT color="green">191</FONT>                final double factor = -Math.sqrt(residualsWeights[i]);<a name="line.191"></a>
+<FONT color="green">192</FONT>                for (int j = 0; j &lt; cols; ++j) {<a name="line.192"></a>
+<FONT color="green">193</FONT>                    ji[j] *= factor;<a name="line.193"></a>
+<FONT color="green">194</FONT>                }<a name="line.194"></a>
+<FONT color="green">195</FONT>            }<a name="line.195"></a>
+<FONT color="green">196</FONT>        }<a name="line.196"></a>
+<FONT color="green">197</FONT>    <a name="line.197"></a>
+<FONT color="green">198</FONT>        /**<a name="line.198"></a>
+<FONT color="green">199</FONT>         * Update the residuals array and cost function value.<a name="line.199"></a>
+<FONT color="green">200</FONT>         * @exception FunctionEvaluationException if the function cannot be evaluated<a name="line.200"></a>
+<FONT color="green">201</FONT>         * or its dimension doesn't match problem dimension or maximal number of<a name="line.201"></a>
+<FONT color="green">202</FONT>         * of evaluations is exceeded<a name="line.202"></a>
+<FONT color="green">203</FONT>         */<a name="line.203"></a>
+<FONT color="green">204</FONT>        protected void updateResidualsAndCost()<a name="line.204"></a>
+<FONT color="green">205</FONT>            throws FunctionEvaluationException {<a name="line.205"></a>
+<FONT color="green">206</FONT>    <a name="line.206"></a>
+<FONT color="green">207</FONT>            if (++objectiveEvaluations &gt; maxEvaluations) {<a name="line.207"></a>
+<FONT color="green">208</FONT>                throw new FunctionEvaluationException(new MaxEvaluationsExceededException(maxEvaluations),<a name="line.208"></a>
+<FONT color="green">209</FONT>                                                      point);<a name="line.209"></a>
+<FONT color="green">210</FONT>            }<a name="line.210"></a>
+<FONT color="green">211</FONT>            objective = function.value(point);<a name="line.211"></a>
+<FONT color="green">212</FONT>            if (objective.length != rows) {<a name="line.212"></a>
+<FONT color="green">213</FONT>                throw new FunctionEvaluationException(point, "dimension mismatch {0} != {1}",<a name="line.213"></a>
+<FONT color="green">214</FONT>                                                      objective.length, rows);<a name="line.214"></a>
+<FONT color="green">215</FONT>            }<a name="line.215"></a>
+<FONT color="green">216</FONT>            cost = 0;<a name="line.216"></a>
+<FONT color="green">217</FONT>            int index = 0;<a name="line.217"></a>
+<FONT color="green">218</FONT>            for (int i = 0; i &lt; rows; i++) {<a name="line.218"></a>
+<FONT color="green">219</FONT>                final double residual = targetValues[i] - objective[i];<a name="line.219"></a>
+<FONT color="green">220</FONT>                residuals[i] = residual;<a name="line.220"></a>
+<FONT color="green">221</FONT>                cost += residualsWeights[i] * residual * residual;<a name="line.221"></a>
+<FONT color="green">222</FONT>                index += cols;<a name="line.222"></a>
+<FONT color="green">223</FONT>            }<a name="line.223"></a>
+<FONT color="green">224</FONT>            cost = Math.sqrt(cost);<a name="line.224"></a>
+<FONT color="green">225</FONT>    <a name="line.225"></a>
+<FONT color="green">226</FONT>        }<a name="line.226"></a>
+<FONT color="green">227</FONT>    <a name="line.227"></a>
+<FONT color="green">228</FONT>        /**<a name="line.228"></a>
+<FONT color="green">229</FONT>         * Get the Root Mean Square value.<a name="line.229"></a>
+<FONT color="green">230</FONT>         * Get the Root Mean Square value, i.e. the root of the arithmetic<a name="line.230"></a>
+<FONT color="green">231</FONT>         * mean of the square of all weighted residuals. This is related to the<a name="line.231"></a>
+<FONT color="green">232</FONT>         * criterion that is minimized by the optimizer as follows: if<a name="line.232"></a>
+<FONT color="green">233</FONT>         * &lt;em&gt;c&lt;/em&gt; if the criterion, and &lt;em&gt;n&lt;/em&gt; is the number of<a name="line.233"></a>
+<FONT color="green">234</FONT>         * measurements, then the RMS is &lt;em&gt;sqrt (c/n)&lt;/em&gt;.<a name="line.234"></a>
+<FONT color="green">235</FONT>         *<a name="line.235"></a>
+<FONT color="green">236</FONT>         * @return RMS value<a name="line.236"></a>
+<FONT color="green">237</FONT>         */<a name="line.237"></a>
+<FONT color="green">238</FONT>        public double getRMS() {<a name="line.238"></a>
+<FONT color="green">239</FONT>            double criterion = 0;<a name="line.239"></a>
+<FONT color="green">240</FONT>            for (int i = 0; i &lt; rows; ++i) {<a name="line.240"></a>
+<FONT color="green">241</FONT>                final double residual = residuals[i];<a name="line.241"></a>
+<FONT color="green">242</FONT>                criterion += residualsWeights[i] * residual * residual;<a name="line.242"></a>
+<FONT color="green">243</FONT>            }<a name="line.243"></a>
+<FONT color="green">244</FONT>            return Math.sqrt(criterion / rows);<a name="line.244"></a>
+<FONT color="green">245</FONT>        }<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>        /**<a name="line.247"></a>
+<FONT color="green">248</FONT>         * Get the Chi-Square value.<a name="line.248"></a>
+<FONT color="green">249</FONT>         * @return chi-square value<a name="line.249"></a>
+<FONT color="green">250</FONT>         */<a name="line.250"></a>
+<FONT color="green">251</FONT>        public double getChiSquare() {<a name="line.251"></a>
+<FONT color="green">252</FONT>            double chiSquare = 0;<a name="line.252"></a>
+<FONT color="green">253</FONT>            for (int i = 0; i &lt; rows; ++i) {<a name="line.253"></a>
+<FONT color="green">254</FONT>                final double residual = residuals[i];<a name="line.254"></a>
+<FONT color="green">255</FONT>                chiSquare += residual * residual / residualsWeights[i];<a name="line.255"></a>
+<FONT color="green">256</FONT>            }<a name="line.256"></a>
+<FONT color="green">257</FONT>            return chiSquare;<a name="line.257"></a>
+<FONT color="green">258</FONT>        }<a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>        /**<a name="line.260"></a>
+<FONT color="green">261</FONT>         * Get the covariance matrix of optimized parameters.<a name="line.261"></a>
+<FONT color="green">262</FONT>         * @return covariance matrix<a name="line.262"></a>
+<FONT color="green">263</FONT>         * @exception FunctionEvaluationException if the function jacobian cannot<a name="line.263"></a>
+<FONT color="green">264</FONT>         * be evaluated<a name="line.264"></a>
+<FONT color="green">265</FONT>         * @exception OptimizationException if the covariance matrix<a name="line.265"></a>
+<FONT color="green">266</FONT>         * cannot be computed (singular problem)<a name="line.266"></a>
+<FONT color="green">267</FONT>         */<a name="line.267"></a>
+<FONT color="green">268</FONT>        public double[][] getCovariances()<a name="line.268"></a>
+<FONT color="green">269</FONT>            throws FunctionEvaluationException, OptimizationException {<a name="line.269"></a>
+<FONT color="green">270</FONT>    <a name="line.270"></a>
+<FONT color="green">271</FONT>            // set up the jacobian<a name="line.271"></a>
+<FONT color="green">272</FONT>            updateJacobian();<a name="line.272"></a>
+<FONT color="green">273</FONT>    <a name="line.273"></a>
+<FONT color="green">274</FONT>            // compute transpose(J).J, avoiding building big intermediate matrices<a name="line.274"></a>
+<FONT color="green">275</FONT>            double[][] jTj = new double[cols][cols];<a name="line.275"></a>
+<FONT color="green">276</FONT>            for (int i = 0; i &lt; cols; ++i) {<a name="line.276"></a>
+<FONT color="green">277</FONT>                for (int j = i; j &lt; cols; ++j) {<a name="line.277"></a>
+<FONT color="green">278</FONT>                    double sum = 0;<a name="line.278"></a>
+<FONT color="green">279</FONT>                    for (int k = 0; k &lt; rows; ++k) {<a name="line.279"></a>
+<FONT color="green">280</FONT>                        sum += jacobian[k][i] * jacobian[k][j];<a name="line.280"></a>
+<FONT color="green">281</FONT>                    }<a name="line.281"></a>
+<FONT color="green">282</FONT>                    jTj[i][j] = sum;<a name="line.282"></a>
+<FONT color="green">283</FONT>                    jTj[j][i] = sum;<a name="line.283"></a>
+<FONT color="green">284</FONT>                }<a name="line.284"></a>
+<FONT color="green">285</FONT>            }<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>            try {<a name="line.287"></a>
+<FONT color="green">288</FONT>                // compute the covariances matrix<a name="line.288"></a>
+<FONT color="green">289</FONT>                RealMatrix inverse =<a name="line.289"></a>
+<FONT color="green">290</FONT>                    new LUDecompositionImpl(MatrixUtils.createRealMatrix(jTj)).getSolver().getInverse();<a name="line.290"></a>
+<FONT color="green">291</FONT>                return inverse.getData();<a name="line.291"></a>
+<FONT color="green">292</FONT>            } catch (InvalidMatrixException ime) {<a name="line.292"></a>
+<FONT color="green">293</FONT>                throw new OptimizationException("unable to compute covariances: singular problem");<a name="line.293"></a>
+<FONT color="green">294</FONT>            }<a name="line.294"></a>
+<FONT color="green">295</FONT>    <a name="line.295"></a>
+<FONT color="green">296</FONT>        }<a name="line.296"></a>
+<FONT color="green">297</FONT>    <a name="line.297"></a>
+<FONT color="green">298</FONT>        /**<a name="line.298"></a>
+<FONT color="green">299</FONT>         * Guess the errors in optimized parameters.<a name="line.299"></a>
+<FONT color="green">300</FONT>         * &lt;p&gt;Guessing is covariance-based, it only gives rough order of magnitude.&lt;/p&gt;<a name="line.300"></a>
+<FONT color="green">301</FONT>         * @return errors in optimized parameters<a name="line.301"></a>
+<FONT color="green">302</FONT>         * @exception FunctionEvaluationException if the function jacobian cannot b evaluated<a name="line.302"></a>
+<FONT color="green">303</FONT>         * @exception OptimizationException if the covariances matrix cannot be computed<a name="line.303"></a>
+<FONT color="green">304</FONT>         * or the number of degrees of freedom is not positive (number of measurements<a name="line.304"></a>
+<FONT color="green">305</FONT>         * lesser or equal to number of parameters)<a name="line.305"></a>
+<FONT color="green">306</FONT>         */<a name="line.306"></a>
+<FONT color="green">307</FONT>        public double[] guessParametersErrors()<a name="line.307"></a>
+<FONT color="green">308</FONT>            throws FunctionEvaluationException, OptimizationException {<a name="line.308"></a>
+<FONT color="green">309</FONT>            if (rows &lt;= cols) {<a name="line.309"></a>
+<FONT color="green">310</FONT>                throw new OptimizationException(<a name="line.310"></a>
+<FONT color="green">311</FONT>                        "no degrees of freedom ({0} measurements, {1} parameters)",<a name="line.311"></a>
+<FONT color="green">312</FONT>                        rows, cols);<a name="line.312"></a>
+<FONT color="green">313</FONT>            }<a name="line.313"></a>
+<FONT color="green">314</FONT>            double[] errors = new double[cols];<a name="line.314"></a>
+<FONT color="green">315</FONT>            final double c = Math.sqrt(getChiSquare() / (rows - cols));<a name="line.315"></a>
+<FONT color="green">316</FONT>            double[][] covar = getCovariances();<a name="line.316"></a>
+<FONT color="green">317</FONT>            for (int i = 0; i &lt; errors.length; ++i) {<a name="line.317"></a>
+<FONT color="green">318</FONT>                errors[i] = Math.sqrt(covar[i][i]) * c;<a name="line.318"></a>
+<FONT color="green">319</FONT>            }<a name="line.319"></a>
+<FONT color="green">320</FONT>            return errors;<a name="line.320"></a>
+<FONT color="green">321</FONT>        }<a name="line.321"></a>
+<FONT color="green">322</FONT>    <a name="line.322"></a>
+<FONT color="green">323</FONT>        /** {@inheritDoc} */<a name="line.323"></a>
+<FONT color="green">324</FONT>        public VectorialPointValuePair optimize(final DifferentiableMultivariateVectorialFunction f,<a name="line.324"></a>
+<FONT color="green">325</FONT>                                                final double[] target, final double[] weights,<a name="line.325"></a>
+<FONT color="green">326</FONT>                                                final double[] startPoint)<a name="line.326"></a>
+<FONT color="green">327</FONT>            throws FunctionEvaluationException, OptimizationException, IllegalArgumentException {<a name="line.327"></a>
+<FONT color="green">328</FONT>    <a name="line.328"></a>
+<FONT color="green">329</FONT>            if (target.length != weights.length) {<a name="line.329"></a>
+<FONT color="green">330</FONT>                throw new OptimizationException("dimension mismatch {0} != {1}",<a name="line.330"></a>
+<FONT color="green">331</FONT>                                                target.length, weights.length);<a name="line.331"></a>
+<FONT color="green">332</FONT>            }<a name="line.332"></a>
+<FONT color="green">333</FONT>    <a name="line.333"></a>
+<FONT color="green">334</FONT>            // reset counters<a name="line.334"></a>
+<FONT color="green">335</FONT>            iterations           = 0;<a name="line.335"></a>
+<FONT color="green">336</FONT>            objectiveEvaluations = 0;<a name="line.336"></a>
+<FONT color="green">337</FONT>            jacobianEvaluations  = 0;<a name="line.337"></a>
+<FONT color="green">338</FONT>    <a name="line.338"></a>
+<FONT color="green">339</FONT>            // store least squares problem characteristics<a name="line.339"></a>
+<FONT color="green">340</FONT>            function         = f;<a name="line.340"></a>
+<FONT color="green">341</FONT>            jF               = f.jacobian();<a name="line.341"></a>
+<FONT color="green">342</FONT>            targetValues     = target.clone();<a name="line.342"></a>
+<FONT color="green">343</FONT>            residualsWeights = weights.clone();<a name="line.343"></a>
+<FONT color="green">344</FONT>            this.point       = startPoint.clone();<a name="line.344"></a>
+<FONT color="green">345</FONT>            this.residuals   = new double[target.length];<a name="line.345"></a>
+<FONT color="green">346</FONT>    <a name="line.346"></a>
+<FONT color="green">347</FONT>            // arrays shared with the other private methods<a name="line.347"></a>
+<FONT color="green">348</FONT>            rows      = target.length;<a name="line.348"></a>
+<FONT color="green">349</FONT>            cols      = point.length;<a name="line.349"></a>
+<FONT color="green">350</FONT>            jacobian  = new double[rows][cols];<a name="line.350"></a>
+<FONT color="green">351</FONT>    <a name="line.351"></a>
+<FONT color="green">352</FONT>            cost = Double.POSITIVE_INFINITY;<a name="line.352"></a>
+<FONT color="green">353</FONT>    <a name="line.353"></a>
+<FONT color="green">354</FONT>            return doOptimize();<a name="line.354"></a>
+<FONT color="green">355</FONT>    <a name="line.355"></a>
+<FONT color="green">356</FONT>        }<a name="line.356"></a>
+<FONT color="green">357</FONT>    <a name="line.357"></a>
+<FONT color="green">358</FONT>        /** Perform the bulk of optimization algorithm.<a name="line.358"></a>
+<FONT color="green">359</FONT>         * @return the point/value pair giving the optimal value for objective function<a name="line.359"></a>
+<FONT color="green">360</FONT>         * @exception FunctionEvaluationException if the objective function throws one during<a name="line.360"></a>
+<FONT color="green">361</FONT>         * the search<a name="line.361"></a>
+<FONT color="green">362</FONT>         * @exception OptimizationException if the algorithm failed to converge<a name="line.362"></a>
+<FONT color="green">363</FONT>         * @exception IllegalArgumentException if the start point dimension is wrong<a name="line.363"></a>
+<FONT color="green">364</FONT>         */<a name="line.364"></a>
+<FONT color="green">365</FONT>        protected abstract VectorialPointValuePair doOptimize()<a name="line.365"></a>
+<FONT color="green">366</FONT>            throws FunctionEvaluationException, OptimizationException, IllegalArgumentException;<a name="line.366"></a>
+<FONT color="green">367</FONT>    <a name="line.367"></a>
+<FONT color="green">368</FONT>    }<a name="line.368"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/general/AbstractScalarDifferentiableOptimizer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,270 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.general;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MaxEvaluationsExceededException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.analysis.DifferentiableMultivariateRealFunction;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.analysis.MultivariateVectorialFunction;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.optimization.GoalType;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.optimization.OptimizationException;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.optimization.RealConvergenceChecker;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.optimization.DifferentiableMultivariateRealOptimizer;<a name="line.28"></a>
+<FONT color="green">029</FONT>    import org.apache.commons.math.optimization.RealPointValuePair;<a name="line.29"></a>
+<FONT color="green">030</FONT>    import org.apache.commons.math.optimization.SimpleScalarValueChecker;<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>    /**<a name="line.32"></a>
+<FONT color="green">033</FONT>     * Base class for implementing optimizers for multivariate scalar functions.<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;p&gt;This base class handles the boilerplate methods associated to thresholds<a name="line.34"></a>
+<FONT color="green">035</FONT>     * settings, iterations and evaluations counting.&lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @version $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @since 2.0<a name="line.37"></a>
+<FONT color="green">038</FONT>     */<a name="line.38"></a>
+<FONT color="green">039</FONT>    public abstract class AbstractScalarDifferentiableOptimizer<a name="line.39"></a>
+<FONT color="green">040</FONT>        implements DifferentiableMultivariateRealOptimizer {<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Default maximal number of iterations allowed. */<a name="line.42"></a>
+<FONT color="green">043</FONT>        public static final int DEFAULT_MAX_ITERATIONS = 100;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Convergence checker. */<a name="line.45"></a>
+<FONT color="green">046</FONT>        protected RealConvergenceChecker checker;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /**<a name="line.48"></a>
+<FONT color="green">049</FONT>         * Type of optimization.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @since 2.1<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        protected GoalType goal;<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /** Current point set. */<a name="line.54"></a>
+<FONT color="green">055</FONT>        protected double[] point;<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /** Maximal number of iterations allowed. */<a name="line.57"></a>
+<FONT color="green">058</FONT>        private int maxIterations;<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Number of iterations already performed. */<a name="line.60"></a>
+<FONT color="green">061</FONT>        private int iterations;<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /** Maximal number of evaluations allowed. */<a name="line.63"></a>
+<FONT color="green">064</FONT>        private int maxEvaluations;<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /** Number of evaluations already performed. */<a name="line.66"></a>
+<FONT color="green">067</FONT>        private int evaluations;<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /** Number of gradient evaluations. */<a name="line.69"></a>
+<FONT color="green">070</FONT>        private int gradientEvaluations;<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /** Objective function. */<a name="line.72"></a>
+<FONT color="green">073</FONT>        private DifferentiableMultivariateRealFunction function;<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /** Objective function gradient. */<a name="line.75"></a>
+<FONT color="green">076</FONT>        private MultivariateVectorialFunction gradient;<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /** Simple constructor with default settings.<a name="line.78"></a>
+<FONT color="green">079</FONT>         * &lt;p&gt;The convergence check is set to a {@link SimpleScalarValueChecker}<a name="line.79"></a>
+<FONT color="green">080</FONT>         * and the maximal number of evaluation is set to its default value.&lt;/p&gt;<a name="line.80"></a>
+<FONT color="green">081</FONT>         */<a name="line.81"></a>
+<FONT color="green">082</FONT>        protected AbstractScalarDifferentiableOptimizer() {<a name="line.82"></a>
+<FONT color="green">083</FONT>            setConvergenceChecker(new SimpleScalarValueChecker());<a name="line.83"></a>
+<FONT color="green">084</FONT>            setMaxIterations(DEFAULT_MAX_ITERATIONS);<a name="line.84"></a>
+<FONT color="green">085</FONT>            setMaxEvaluations(Integer.MAX_VALUE);<a name="line.85"></a>
+<FONT color="green">086</FONT>        }<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>        /** {@inheritDoc} */<a name="line.88"></a>
+<FONT color="green">089</FONT>        public void setMaxIterations(int maxIterations) {<a name="line.89"></a>
+<FONT color="green">090</FONT>            this.maxIterations = maxIterations;<a name="line.90"></a>
+<FONT color="green">091</FONT>        }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /** {@inheritDoc} */<a name="line.93"></a>
+<FONT color="green">094</FONT>        public int getMaxIterations() {<a name="line.94"></a>
+<FONT color="green">095</FONT>            return maxIterations;<a name="line.95"></a>
+<FONT color="green">096</FONT>        }<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /** {@inheritDoc} */<a name="line.98"></a>
+<FONT color="green">099</FONT>        public int getIterations() {<a name="line.99"></a>
+<FONT color="green">100</FONT>            return iterations;<a name="line.100"></a>
+<FONT color="green">101</FONT>        }<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        /** {@inheritDoc} */<a name="line.103"></a>
+<FONT color="green">104</FONT>        public void setMaxEvaluations(int maxEvaluations) {<a name="line.104"></a>
+<FONT color="green">105</FONT>            this.maxEvaluations = maxEvaluations;<a name="line.105"></a>
+<FONT color="green">106</FONT>        }<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>        /** {@inheritDoc} */<a name="line.108"></a>
+<FONT color="green">109</FONT>        public int getMaxEvaluations() {<a name="line.109"></a>
+<FONT color="green">110</FONT>            return maxEvaluations;<a name="line.110"></a>
+<FONT color="green">111</FONT>        }<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>        /** {@inheritDoc} */<a name="line.113"></a>
+<FONT color="green">114</FONT>        public int getEvaluations() {<a name="line.114"></a>
+<FONT color="green">115</FONT>            return evaluations;<a name="line.115"></a>
+<FONT color="green">116</FONT>        }<a name="line.116"></a>
+<FONT color="green">117</FONT>    <a name="line.117"></a>
+<FONT color="green">118</FONT>        /** {@inheritDoc} */<a name="line.118"></a>
+<FONT color="green">119</FONT>        public int getGradientEvaluations() {<a name="line.119"></a>
+<FONT color="green">120</FONT>            return gradientEvaluations;<a name="line.120"></a>
+<FONT color="green">121</FONT>        }<a name="line.121"></a>
+<FONT color="green">122</FONT>    <a name="line.122"></a>
+<FONT color="green">123</FONT>        /** {@inheritDoc} */<a name="line.123"></a>
+<FONT color="green">124</FONT>        public void setConvergenceChecker(RealConvergenceChecker convergenceChecker) {<a name="line.124"></a>
+<FONT color="green">125</FONT>            this.checker = convergenceChecker;<a name="line.125"></a>
+<FONT color="green">126</FONT>        }<a name="line.126"></a>
+<FONT color="green">127</FONT>    <a name="line.127"></a>
+<FONT color="green">128</FONT>        /** {@inheritDoc} */<a name="line.128"></a>
+<FONT color="green">129</FONT>        public RealConvergenceChecker getConvergenceChecker() {<a name="line.129"></a>
+<FONT color="green">130</FONT>            return checker;<a name="line.130"></a>
+<FONT color="green">131</FONT>        }<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>        /** Increment the iterations counter by 1.<a name="line.133"></a>
+<FONT color="green">134</FONT>         * @exception OptimizationException if the maximal number<a name="line.134"></a>
+<FONT color="green">135</FONT>         * of iterations is exceeded<a name="line.135"></a>
+<FONT color="green">136</FONT>         */<a name="line.136"></a>
+<FONT color="green">137</FONT>        protected void incrementIterationsCounter()<a name="line.137"></a>
+<FONT color="green">138</FONT>            throws OptimizationException {<a name="line.138"></a>
+<FONT color="green">139</FONT>            if (++iterations &gt; maxIterations) {<a name="line.139"></a>
+<FONT color="green">140</FONT>                throw new OptimizationException(new MaxIterationsExceededException(maxIterations));<a name="line.140"></a>
+<FONT color="green">141</FONT>            }<a name="line.141"></a>
+<FONT color="green">142</FONT>        }<a name="line.142"></a>
+<FONT color="green">143</FONT>    <a name="line.143"></a>
+<FONT color="green">144</FONT>        /**<a name="line.144"></a>
+<FONT color="green">145</FONT>         * Compute the gradient vector.<a name="line.145"></a>
+<FONT color="green">146</FONT>         * @param evaluationPoint point at which the gradient must be evaluated<a name="line.146"></a>
+<FONT color="green">147</FONT>         * @return gradient at the specified point<a name="line.147"></a>
+<FONT color="green">148</FONT>         * @exception FunctionEvaluationException if the function gradient<a name="line.148"></a>
+<FONT color="green">149</FONT>         */<a name="line.149"></a>
+<FONT color="green">150</FONT>        protected double[] computeObjectiveGradient(final double[] evaluationPoint)<a name="line.150"></a>
+<FONT color="green">151</FONT>            throws FunctionEvaluationException {<a name="line.151"></a>
+<FONT color="green">152</FONT>            ++gradientEvaluations;<a name="line.152"></a>
+<FONT color="green">153</FONT>            return gradient.value(evaluationPoint);<a name="line.153"></a>
+<FONT color="green">154</FONT>        }<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>        /**<a name="line.156"></a>
+<FONT color="green">157</FONT>         * Compute the objective function value.<a name="line.157"></a>
+<FONT color="green">158</FONT>         * @param evaluationPoint point at which the objective function must be evaluated<a name="line.158"></a>
+<FONT color="green">159</FONT>         * @return objective function value at specified point<a name="line.159"></a>
+<FONT color="green">160</FONT>         * @exception FunctionEvaluationException if the function cannot be evaluated<a name="line.160"></a>
+<FONT color="green">161</FONT>         * or its dimension doesn't match problem dimension or the maximal number<a name="line.161"></a>
+<FONT color="green">162</FONT>         * of iterations is exceeded<a name="line.162"></a>
+<FONT color="green">163</FONT>         */<a name="line.163"></a>
+<FONT color="green">164</FONT>        protected double computeObjectiveValue(final double[] evaluationPoint)<a name="line.164"></a>
+<FONT color="green">165</FONT>            throws FunctionEvaluationException {<a name="line.165"></a>
+<FONT color="green">166</FONT>            if (++evaluations &gt; maxEvaluations) {<a name="line.166"></a>
+<FONT color="green">167</FONT>                throw new FunctionEvaluationException(new MaxEvaluationsExceededException(maxEvaluations),<a name="line.167"></a>
+<FONT color="green">168</FONT>                                                      evaluationPoint);<a name="line.168"></a>
+<FONT color="green">169</FONT>            }<a name="line.169"></a>
+<FONT color="green">170</FONT>            return function.value(evaluationPoint);<a name="line.170"></a>
+<FONT color="green">171</FONT>        }<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>        /** {@inheritDoc} */<a name="line.173"></a>
+<FONT color="green">174</FONT>        public RealPointValuePair optimize(final DifferentiableMultivariateRealFunction f,<a name="line.174"></a>
+<FONT color="green">175</FONT>                                             final GoalType goalType,<a name="line.175"></a>
+<FONT color="green">176</FONT>                                             final double[] startPoint)<a name="line.176"></a>
+<FONT color="green">177</FONT>            throws FunctionEvaluationException, OptimizationException, IllegalArgumentException {<a name="line.177"></a>
+<FONT color="green">178</FONT>    <a name="line.178"></a>
+<FONT color="green">179</FONT>            // reset counters<a name="line.179"></a>
+<FONT color="green">180</FONT>            iterations          = 0;<a name="line.180"></a>
+<FONT color="green">181</FONT>            evaluations         = 0;<a name="line.181"></a>
+<FONT color="green">182</FONT>            gradientEvaluations = 0;<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>            // store optimization problem characteristics<a name="line.184"></a>
+<FONT color="green">185</FONT>            function = f;<a name="line.185"></a>
+<FONT color="green">186</FONT>            gradient = f.gradient();<a name="line.186"></a>
+<FONT color="green">187</FONT>            goal     = goalType;<a name="line.187"></a>
+<FONT color="green">188</FONT>            point    = startPoint.clone();<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>            return doOptimize();<a name="line.190"></a>
+<FONT color="green">191</FONT>    <a name="line.191"></a>
+<FONT color="green">192</FONT>        }<a name="line.192"></a>
+<FONT color="green">193</FONT>    <a name="line.193"></a>
+<FONT color="green">194</FONT>        /** Perform the bulk of optimization algorithm.<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @return the point/value pair giving the optimal value for objective function<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @exception FunctionEvaluationException if the objective function throws one during<a name="line.196"></a>
+<FONT color="green">197</FONT>         * the search<a name="line.197"></a>
+<FONT color="green">198</FONT>         * @exception OptimizationException if the algorithm failed to converge<a name="line.198"></a>
+<FONT color="green">199</FONT>         * @exception IllegalArgumentException if the start point dimension is wrong<a name="line.199"></a>
+<FONT color="green">200</FONT>         */<a name="line.200"></a>
+<FONT color="green">201</FONT>        protected abstract RealPointValuePair doOptimize()<a name="line.201"></a>
+<FONT color="green">202</FONT>            throws FunctionEvaluationException, OptimizationException, IllegalArgumentException;<a name="line.202"></a>
+<FONT color="green">203</FONT>    <a name="line.203"></a>
+<FONT color="green">204</FONT>    }<a name="line.204"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/general/ConjugateGradientFormula.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,115 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.general;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Available choices of update formulas for the &amp;beta; parameter<a name="line.21"></a>
+<FONT color="green">022</FONT>     * in {@link NonLinearConjugateGradientOptimizer}.<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;p&gt;<a name="line.23"></a>
+<FONT color="green">024</FONT>     * The &amp;beta; parameter is used to compute the successive conjugate<a name="line.24"></a>
+<FONT color="green">025</FONT>     * search directions. For non-linear conjugate gradients, there are<a name="line.25"></a>
+<FONT color="green">026</FONT>     * two formulas to compute &amp;beta;:<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;ul&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     *   &lt;li&gt;Fletcher-Reeves formula&lt;/li&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     *   &lt;li&gt;Polak-Ribi&amp;egrave;re formula&lt;/li&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;/ul&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * On the one hand, the Fletcher-Reeves formula is guaranteed to converge<a name="line.31"></a>
+<FONT color="green">032</FONT>     * if the start point is close enough of the optimum whether the<a name="line.32"></a>
+<FONT color="green">033</FONT>     * Polak-Ribi&amp;egrave;re formula may not converge in rare cases. On the<a name="line.33"></a>
+<FONT color="green">034</FONT>     * other hand, the Polak-Ribi&amp;egrave;re formula is often faster when it<a name="line.34"></a>
+<FONT color="green">035</FONT>     * does converge. Polak-Ribi&amp;egrave;re is often used.<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @see NonLinearConjugateGradientOptimizer<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @version $Revision: 758059 $ $Date: 2009-03-24 18:16:21 -0400 (Tue, 24 Mar 2009) $<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @since 2.0<a name="line.39"></a>
+<FONT color="green">040</FONT>     */<a name="line.40"></a>
+<FONT color="green">041</FONT>    public enum ConjugateGradientFormula {<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** Fletcher-Reeves formula. */<a name="line.43"></a>
+<FONT color="green">044</FONT>        FLETCHER_REEVES,<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** Polak-Ribi&amp;egrave;re formula. */<a name="line.46"></a>
+<FONT color="green">047</FONT>        POLAK_RIBIERE<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>    }<a name="line.49"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,200 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.general;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.linear.BlockRealMatrix;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.linear.DecompositionSolver;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.linear.InvalidMatrixException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.linear.LUDecompositionImpl;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.linear.QRDecompositionImpl;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.linear.RealMatrix;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.optimization.OptimizationException;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.optimization.VectorialPointValuePair;<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>    /**<a name="line.30"></a>
+<FONT color="green">031</FONT>     * Gauss-Newton least-squares solver.<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * This class solve a least-square problem by solving the normal equations<a name="line.33"></a>
+<FONT color="green">034</FONT>     * of the linearized problem at each iteration. Either LU decomposition or<a name="line.34"></a>
+<FONT color="green">035</FONT>     * QR decomposition can be used to solve the normal equations. LU decomposition<a name="line.35"></a>
+<FONT color="green">036</FONT>     * is faster but QR decomposition is more robust for difficult problems.<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;/p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     *<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @since 2.0<a name="line.40"></a>
+<FONT color="green">041</FONT>     *<a name="line.41"></a>
+<FONT color="green">042</FONT>     */<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>    public class GaussNewtonOptimizer extends AbstractLeastSquaresOptimizer {<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** Indicator for using LU decomposition. */<a name="line.46"></a>
+<FONT color="green">047</FONT>        private final boolean useLU;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** Simple constructor with default settings.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * &lt;p&gt;The convergence check is set to a {@link<a name="line.50"></a>
+<FONT color="green">051</FONT>         * org.apache.commons.math.optimization.SimpleVectorialValueChecker}<a name="line.51"></a>
+<FONT color="green">052</FONT>         * and the maximal number of evaluation is set to<a name="line.52"></a>
+<FONT color="green">053</FONT>         * {@link AbstractLeastSquaresOptimizer#DEFAULT_MAX_ITERATIONS}.<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @param useLU if true, the normal equations will be solved using LU<a name="line.54"></a>
+<FONT color="green">055</FONT>         * decomposition, otherwise they will be solved using QR decomposition<a name="line.55"></a>
+<FONT color="green">056</FONT>         */<a name="line.56"></a>
+<FONT color="green">057</FONT>        public GaussNewtonOptimizer(final boolean useLU) {<a name="line.57"></a>
+<FONT color="green">058</FONT>            this.useLU = useLU;<a name="line.58"></a>
+<FONT color="green">059</FONT>        }<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /** {@inheritDoc} */<a name="line.61"></a>
+<FONT color="green">062</FONT>        @Override<a name="line.62"></a>
+<FONT color="green">063</FONT>        public VectorialPointValuePair doOptimize()<a name="line.63"></a>
+<FONT color="green">064</FONT>            throws FunctionEvaluationException, OptimizationException, IllegalArgumentException {<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>            // iterate until convergence is reached<a name="line.66"></a>
+<FONT color="green">067</FONT>            VectorialPointValuePair current = null;<a name="line.67"></a>
+<FONT color="green">068</FONT>            for (boolean converged = false; !converged;) {<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>                incrementIterationsCounter();<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>                // evaluate the objective function and its jacobian<a name="line.72"></a>
+<FONT color="green">073</FONT>                VectorialPointValuePair previous = current;<a name="line.73"></a>
+<FONT color="green">074</FONT>                updateResidualsAndCost();<a name="line.74"></a>
+<FONT color="green">075</FONT>                updateJacobian();<a name="line.75"></a>
+<FONT color="green">076</FONT>                current = new VectorialPointValuePair(point, objective);<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>                // build the linear problem<a name="line.78"></a>
+<FONT color="green">079</FONT>                final double[]   b = new double[cols];<a name="line.79"></a>
+<FONT color="green">080</FONT>                final double[][] a = new double[cols][cols];<a name="line.80"></a>
+<FONT color="green">081</FONT>                for (int i = 0; i &lt; rows; ++i) {<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>                    final double[] grad   = jacobian[i];<a name="line.83"></a>
+<FONT color="green">084</FONT>                    final double weight   = residualsWeights[i];<a name="line.84"></a>
+<FONT color="green">085</FONT>                    final double residual = objective[i] - targetValues[i];<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>                    // compute the normal equation<a name="line.87"></a>
+<FONT color="green">088</FONT>                    final double wr = weight * residual;<a name="line.88"></a>
+<FONT color="green">089</FONT>                    for (int j = 0; j &lt; cols; ++j) {<a name="line.89"></a>
+<FONT color="green">090</FONT>                        b[j] += wr * grad[j];<a name="line.90"></a>
+<FONT color="green">091</FONT>                    }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>                    // build the contribution matrix for measurement i<a name="line.93"></a>
+<FONT color="green">094</FONT>                    for (int k = 0; k &lt; cols; ++k) {<a name="line.94"></a>
+<FONT color="green">095</FONT>                        double[] ak = a[k];<a name="line.95"></a>
+<FONT color="green">096</FONT>                        double wgk = weight * grad[k];<a name="line.96"></a>
+<FONT color="green">097</FONT>                        for (int l = 0; l &lt; cols; ++l) {<a name="line.97"></a>
+<FONT color="green">098</FONT>                            ak[l] += wgk * grad[l];<a name="line.98"></a>
+<FONT color="green">099</FONT>                        }<a name="line.99"></a>
+<FONT color="green">100</FONT>                    }<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>                }<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>                try {<a name="line.104"></a>
+<FONT color="green">105</FONT>    <a name="line.105"></a>
+<FONT color="green">106</FONT>                    // solve the linearized least squares problem<a name="line.106"></a>
+<FONT color="green">107</FONT>                    RealMatrix mA = new BlockRealMatrix(a);<a name="line.107"></a>
+<FONT color="green">108</FONT>                    DecompositionSolver solver = useLU ?<a name="line.108"></a>
+<FONT color="green">109</FONT>                            new LUDecompositionImpl(mA).getSolver() :<a name="line.109"></a>
+<FONT color="green">110</FONT>                            new QRDecompositionImpl(mA).getSolver();<a name="line.110"></a>
+<FONT color="green">111</FONT>                    final double[] dX = solver.solve(b);<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>                    // update the estimated parameters<a name="line.113"></a>
+<FONT color="green">114</FONT>                    for (int i = 0; i &lt; cols; ++i) {<a name="line.114"></a>
+<FONT color="green">115</FONT>                        point[i] += dX[i];<a name="line.115"></a>
+<FONT color="green">116</FONT>                    }<a name="line.116"></a>
+<FONT color="green">117</FONT>    <a name="line.117"></a>
+<FONT color="green">118</FONT>                } catch(InvalidMatrixException e) {<a name="line.118"></a>
+<FONT color="green">119</FONT>                    throw new OptimizationException("unable to solve: singular problem");<a name="line.119"></a>
+<FONT color="green">120</FONT>                }<a name="line.120"></a>
+<FONT color="green">121</FONT>    <a name="line.121"></a>
+<FONT color="green">122</FONT>                // check convergence<a name="line.122"></a>
+<FONT color="green">123</FONT>                if (previous != null) {<a name="line.123"></a>
+<FONT color="green">124</FONT>                    converged = checker.converged(getIterations(), previous, current);<a name="line.124"></a>
+<FONT color="green">125</FONT>                }<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>            }<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>            // we have converged<a name="line.129"></a>
+<FONT color="green">130</FONT>            return current;<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>        }<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>    }<a name="line.134"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,908 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.optimization.general;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.Arrays;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.optimization.OptimizationException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.optimization.VectorialPointValuePair;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * This class solves a least squares problem using the Levenberg-Marquardt algorithm.<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;This implementation &lt;em&gt;should&lt;/em&gt; work even for over-determined systems<a name="line.29"></a>
+<FONT color="green">030</FONT>     * (i.e. systems having more point than equations). Over-determined systems<a name="line.30"></a>
+<FONT color="green">031</FONT>     * are solved by ignoring the point which have the smallest impact according<a name="line.31"></a>
+<FONT color="green">032</FONT>     * to their jacobian column norm. Only the rank of the matrix and some loop bounds<a name="line.32"></a>
+<FONT color="green">033</FONT>     * are changed to implement this.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     *<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;p&gt;The resolution engine is a simple translation of the MINPACK &lt;a<a name="line.35"></a>
+<FONT color="green">036</FONT>     * href="http://www.netlib.org/minpack/lmder.f"&gt;lmder&lt;/a&gt; routine with minor<a name="line.36"></a>
+<FONT color="green">037</FONT>     * changes. The changes include the over-determined resolution and the Q.R.<a name="line.37"></a>
+<FONT color="green">038</FONT>     * decomposition which has been rewritten following the algorithm described in the<a name="line.38"></a>
+<FONT color="green">039</FONT>     * P. Lascaux and R. Theodor book &lt;i&gt;Analyse num&amp;eacute;rique matricielle<a name="line.39"></a>
+<FONT color="green">040</FONT>     * appliqu&amp;eacute;e &amp;agrave; l'art de l'ing&amp;eacute;nieur&lt;/i&gt;, Masson 1986.&lt;/p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;p&gt;The authors of the original fortran version are:<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;ul&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     * &lt;li&gt;Argonne National Laboratory. MINPACK project. March 1980&lt;/li&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;li&gt;Burton S. Garbow&lt;/li&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     * &lt;li&gt;Kenneth E. Hillstrom&lt;/li&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     * &lt;li&gt;Jorge J. More&lt;/li&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     * &lt;/ul&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     * The redistribution policy for MINPACK is available &lt;a<a name="line.48"></a>
+<FONT color="green">049</FONT>     * href="http://www.netlib.org/minpack/disclaimer"&gt;here&lt;/a&gt;, for convenience, it<a name="line.49"></a>
+<FONT color="green">050</FONT>     * is reproduced below.&lt;/p&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>     *<a name="line.51"></a>
+<FONT color="green">052</FONT>     * &lt;table border="0" width="80%" cellpadding="10" align="center" bgcolor="#E0E0E0"&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>     * &lt;tr&gt;&lt;td&gt;<a name="line.53"></a>
+<FONT color="green">054</FONT>     *    Minpack Copyright Notice (1999) University of Chicago.<a name="line.54"></a>
+<FONT color="green">055</FONT>     *    All rights reserved<a name="line.55"></a>
+<FONT color="green">056</FONT>     * &lt;/td&gt;&lt;/tr&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>     * &lt;tr&gt;&lt;td&gt;<a name="line.57"></a>
+<FONT color="green">058</FONT>     * Redistribution and use in source and binary forms, with or without<a name="line.58"></a>
+<FONT color="green">059</FONT>     * modification, are permitted provided that the following conditions<a name="line.59"></a>
+<FONT color="green">060</FONT>     * are met:<a name="line.60"></a>
+<FONT color="green">061</FONT>     * &lt;ol&gt;<a name="line.61"></a>
+<FONT color="green">062</FONT>     *  &lt;li&gt;Redistributions of source code must retain the above copyright<a name="line.62"></a>
+<FONT color="green">063</FONT>     *      notice, this list of conditions and the following disclaimer.&lt;/li&gt;<a name="line.63"></a>
+<FONT color="green">064</FONT>     * &lt;li&gt;Redistributions in binary form must reproduce the above<a name="line.64"></a>
+<FONT color="green">065</FONT>     *     copyright notice, this list of conditions and the following<a name="line.65"></a>
+<FONT color="green">066</FONT>     *     disclaimer in the documentation and/or other materials provided<a name="line.66"></a>
+<FONT color="green">067</FONT>     *     with the distribution.&lt;/li&gt;<a name="line.67"></a>
+<FONT color="green">068</FONT>     * &lt;li&gt;The end-user documentation included with the redistribution, if any,<a name="line.68"></a>
+<FONT color="green">069</FONT>     *     must include the following acknowledgment:<a name="line.69"></a>
+<FONT color="green">070</FONT>     *     &lt;code&gt;This product includes software developed by the University of<a name="line.70"></a>
+<FONT color="green">071</FONT>     *           Chicago, as Operator of Argonne National Laboratory.&lt;/code&gt;<a name="line.71"></a>
+<FONT color="green">072</FONT>     *     Alternately, this acknowledgment may appear in the software itself,<a name="line.72"></a>
+<FONT color="green">073</FONT>     *     if and wherever such third-party acknowledgments normally appear.&lt;/li&gt;<a name="line.73"></a>
+<FONT color="green">074</FONT>     * &lt;li&gt;&lt;strong&gt;WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"<a name="line.74"></a>
+<FONT color="green">075</FONT>     *     WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE<a name="line.75"></a>
+<FONT color="green">076</FONT>     *     UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND<a name="line.76"></a>
+<FONT color="green">077</FONT>     *     THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR<a name="line.77"></a>
+<FONT color="green">078</FONT>     *     IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES<a name="line.78"></a>
+<FONT color="green">079</FONT>     *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE<a name="line.79"></a>
+<FONT color="green">080</FONT>     *     OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY<a name="line.80"></a>
+<FONT color="green">081</FONT>     *     OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR<a name="line.81"></a>
+<FONT color="green">082</FONT>     *     USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF<a name="line.82"></a>
+<FONT color="green">083</FONT>     *     THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)<a name="line.83"></a>
+<FONT color="green">084</FONT>     *     DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION<a name="line.84"></a>
+<FONT color="green">085</FONT>     *     UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL<a name="line.85"></a>
+<FONT color="green">086</FONT>     *     BE CORRECTED.&lt;/strong&gt;&lt;/li&gt;<a name="line.86"></a>
+<FONT color="green">087</FONT>     * &lt;li&gt;&lt;strong&gt;LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT<a name="line.87"></a>
+<FONT color="green">088</FONT>     *     HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF<a name="line.88"></a>
+<FONT color="green">089</FONT>     *     ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,<a name="line.89"></a>
+<FONT color="green">090</FONT>     *     INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF<a name="line.90"></a>
+<FONT color="green">091</FONT>     *     ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF<a name="line.91"></a>
+<FONT color="green">092</FONT>     *     PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER<a name="line.92"></a>
+<FONT color="green">093</FONT>     *     SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT<a name="line.93"></a>
+<FONT color="green">094</FONT>     *     (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,<a name="line.94"></a>
+<FONT color="green">095</FONT>     *     EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE<a name="line.95"></a>
+<FONT color="green">096</FONT>     *     POSSIBILITY OF SUCH LOSS OR DAMAGES.&lt;/strong&gt;&lt;/li&gt;<a name="line.96"></a>
+<FONT color="green">097</FONT>     * &lt;ol&gt;&lt;/td&gt;&lt;/tr&gt;<a name="line.97"></a>
+<FONT color="green">098</FONT>     * &lt;/table&gt;<a name="line.98"></a>
+<FONT color="green">099</FONT>     * @version $Revision: 825919 $ $Date: 2009-10-16 10:51:55 -0400 (Fri, 16 Oct 2009) $<a name="line.99"></a>
+<FONT color="green">100</FONT>     * @since 2.0<a name="line.100"></a>
+<FONT color="green">101</FONT>     *<a name="line.101"></a>
+<FONT color="green">102</FONT>     */<a name="line.102"></a>
+<FONT color="green">103</FONT>    public class LevenbergMarquardtOptimizer extends AbstractLeastSquaresOptimizer {<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /** Number of solved point. */<a name="line.105"></a>
+<FONT color="green">106</FONT>        private int solvedCols;<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>        /** Diagonal elements of the R matrix in the Q.R. decomposition. */<a name="line.108"></a>
+<FONT color="green">109</FONT>        private double[] diagR;<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /** Norms of the columns of the jacobian matrix. */<a name="line.111"></a>
+<FONT color="green">112</FONT>        private double[] jacNorm;<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /** Coefficients of the Householder transforms vectors. */<a name="line.114"></a>
+<FONT color="green">115</FONT>        private double[] beta;<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>        /** Columns permutation array. */<a name="line.117"></a>
+<FONT color="green">118</FONT>        private int[] permutation;<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /** Rank of the jacobian matrix. */<a name="line.120"></a>
+<FONT color="green">121</FONT>        private int rank;<a name="line.121"></a>
+<FONT color="green">122</FONT>    <a name="line.122"></a>
+<FONT color="green">123</FONT>        /** Levenberg-Marquardt parameter. */<a name="line.123"></a>
+<FONT color="green">124</FONT>        private double lmPar;<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>        /** Parameters evolution direction associated with lmPar. */<a name="line.126"></a>
+<FONT color="green">127</FONT>        private double[] lmDir;<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>        /** Positive input variable used in determining the initial step bound. */<a name="line.129"></a>
+<FONT color="green">130</FONT>        private double initialStepBoundFactor;<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>        /** Desired relative error in the sum of squares. */<a name="line.132"></a>
+<FONT color="green">133</FONT>        private double costRelativeTolerance;<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>        /**  Desired relative error in the approximate solution parameters. */<a name="line.135"></a>
+<FONT color="green">136</FONT>        private double parRelativeTolerance;<a name="line.136"></a>
+<FONT color="green">137</FONT>    <a name="line.137"></a>
+<FONT color="green">138</FONT>        /** Desired max cosine on the orthogonality between the function vector<a name="line.138"></a>
+<FONT color="green">139</FONT>         * and the columns of the jacobian. */<a name="line.139"></a>
+<FONT color="green">140</FONT>        private double orthoTolerance;<a name="line.140"></a>
+<FONT color="green">141</FONT>    <a name="line.141"></a>
+<FONT color="green">142</FONT>        /**<a name="line.142"></a>
+<FONT color="green">143</FONT>         * Build an optimizer for least squares problems.<a name="line.143"></a>
+<FONT color="green">144</FONT>         * &lt;p&gt;The default values for the algorithm settings are:<a name="line.144"></a>
+<FONT color="green">145</FONT>         *   &lt;ul&gt;<a name="line.145"></a>
+<FONT color="green">146</FONT>         *    &lt;li&gt;{@link #setInitialStepBoundFactor initial step bound factor}: 100.0&lt;/li&gt;<a name="line.146"></a>
+<FONT color="green">147</FONT>         *    &lt;li&gt;{@link #setMaxIterations maximal iterations}: 1000&lt;/li&gt;<a name="line.147"></a>
+<FONT color="green">148</FONT>         *    &lt;li&gt;{@link #setCostRelativeTolerance cost relative tolerance}: 1.0e-10&lt;/li&gt;<a name="line.148"></a>
+<FONT color="green">149</FONT>         *    &lt;li&gt;{@link #setParRelativeTolerance parameters relative tolerance}: 1.0e-10&lt;/li&gt;<a name="line.149"></a>
+<FONT color="green">150</FONT>         *    &lt;li&gt;{@link #setOrthoTolerance orthogonality tolerance}: 1.0e-10&lt;/li&gt;<a name="line.150"></a>
+<FONT color="green">151</FONT>         *   &lt;/ul&gt;<a name="line.151"></a>
+<FONT color="green">152</FONT>         * &lt;/p&gt;<a name="line.152"></a>
+<FONT color="green">153</FONT>         */<a name="line.153"></a>
+<FONT color="green">154</FONT>        public LevenbergMarquardtOptimizer() {<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>            // set up the superclass with a default  max cost evaluations setting<a name="line.156"></a>
+<FONT color="green">157</FONT>            setMaxIterations(1000);<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>            // default values for the tuning parameters<a name="line.159"></a>
+<FONT color="green">160</FONT>            setInitialStepBoundFactor(100.0);<a name="line.160"></a>
+<FONT color="green">161</FONT>            setCostRelativeTolerance(1.0e-10);<a name="line.161"></a>
+<FONT color="green">162</FONT>            setParRelativeTolerance(1.0e-10);<a name="line.162"></a>
+<FONT color="green">163</FONT>            setOrthoTolerance(1.0e-10);<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>        }<a name="line.165"></a>
+<FONT color="green">166</FONT>    <a name="line.166"></a>
+<FONT color="green">167</FONT>        /**<a name="line.167"></a>
+<FONT color="green">168</FONT>         * Set the positive input variable used in determining the initial step bound.<a name="line.168"></a>
+<FONT color="green">169</FONT>         * This bound is set to the product of initialStepBoundFactor and the euclidean<a name="line.169"></a>
+<FONT color="green">170</FONT>         * norm of diag*x if nonzero, or else to initialStepBoundFactor itself. In most<a name="line.170"></a>
+<FONT color="green">171</FONT>         * cases factor should lie in the interval (0.1, 100.0). 100.0 is a generally<a name="line.171"></a>
+<FONT color="green">172</FONT>         * recommended value.<a name="line.172"></a>
+<FONT color="green">173</FONT>         *<a name="line.173"></a>
+<FONT color="green">174</FONT>         * @param initialStepBoundFactor initial step bound factor<a name="line.174"></a>
+<FONT color="green">175</FONT>         */<a name="line.175"></a>
+<FONT color="green">176</FONT>        public void setInitialStepBoundFactor(double initialStepBoundFactor) {<a name="line.176"></a>
+<FONT color="green">177</FONT>            this.initialStepBoundFactor = initialStepBoundFactor;<a name="line.177"></a>
+<FONT color="green">178</FONT>        }<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>        /**<a name="line.180"></a>
+<FONT color="green">181</FONT>         * Set the desired relative error in the sum of squares.<a name="line.181"></a>
+<FONT color="green">182</FONT>         *<a name="line.182"></a>
+<FONT color="green">183</FONT>         * @param costRelativeTolerance desired relative error in the sum of squares<a name="line.183"></a>
+<FONT color="green">184</FONT>         */<a name="line.184"></a>
+<FONT color="green">185</FONT>        public void setCostRelativeTolerance(double costRelativeTolerance) {<a name="line.185"></a>
+<FONT color="green">186</FONT>            this.costRelativeTolerance = costRelativeTolerance;<a name="line.186"></a>
+<FONT color="green">187</FONT>        }<a name="line.187"></a>
+<FONT color="green">188</FONT>    <a name="line.188"></a>
+<FONT color="green">189</FONT>        /**<a name="line.189"></a>
+<FONT color="green">190</FONT>         * Set the desired relative error in the approximate solution parameters.<a name="line.190"></a>
+<FONT color="green">191</FONT>         *<a name="line.191"></a>
+<FONT color="green">192</FONT>         * @param parRelativeTolerance desired relative error<a name="line.192"></a>
+<FONT color="green">193</FONT>         * in the approximate solution parameters<a name="line.193"></a>
+<FONT color="green">194</FONT>         */<a name="line.194"></a>
+<FONT color="green">195</FONT>        public void setParRelativeTolerance(double parRelativeTolerance) {<a name="line.195"></a>
+<FONT color="green">196</FONT>            this.parRelativeTolerance = parRelativeTolerance;<a name="line.196"></a>
+<FONT color="green">197</FONT>        }<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>        /**<a name="line.199"></a>
+<FONT color="green">200</FONT>         * Set the desired max cosine on the orthogonality.<a name="line.200"></a>
+<FONT color="green">201</FONT>         *<a name="line.201"></a>
+<FONT color="green">202</FONT>         * @param orthoTolerance desired max cosine on the orthogonality<a name="line.202"></a>
+<FONT color="green">203</FONT>         * between the function vector and the columns of the jacobian<a name="line.203"></a>
+<FONT color="green">204</FONT>         */<a name="line.204"></a>
+<FONT color="green">205</FONT>        public void setOrthoTolerance(double orthoTolerance) {<a name="line.205"></a>
+<FONT color="green">206</FONT>            this.orthoTolerance = orthoTolerance;<a name="line.206"></a>
+<FONT color="green">207</FONT>        }<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>        /** {@inheritDoc} */<a name="line.209"></a>
+<FONT color="green">210</FONT>        @Override<a name="line.210"></a>
+<FONT color="green">211</FONT>        protected VectorialPointValuePair doOptimize()<a name="line.211"></a>
+<FONT color="green">212</FONT>            throws FunctionEvaluationException, OptimizationException, IllegalArgumentException {<a name="line.212"></a>
+<FONT color="green">213</FONT>    <a name="line.213"></a>
+<FONT color="green">214</FONT>            // arrays shared with the other private methods<a name="line.214"></a>
+<FONT color="green">215</FONT>            solvedCols  = Math.min(rows, cols);<a name="line.215"></a>
+<FONT color="green">216</FONT>            diagR       = new double[cols];<a name="line.216"></a>
+<FONT color="green">217</FONT>            jacNorm     = new double[cols];<a name="line.217"></a>
+<FONT color="green">218</FONT>            beta        = new double[cols];<a name="line.218"></a>
+<FONT color="green">219</FONT>            permutation = new int[cols];<a name="line.219"></a>
+<FONT color="green">220</FONT>            lmDir       = new double[cols];<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>            // local point<a name="line.222"></a>
+<FONT color="green">223</FONT>            double   delta   = 0;<a name="line.223"></a>
+<FONT color="green">224</FONT>            double   xNorm   = 0;<a name="line.224"></a>
+<FONT color="green">225</FONT>            double[] diag    = new double[cols];<a name="line.225"></a>
+<FONT color="green">226</FONT>            double[] oldX    = new double[cols];<a name="line.226"></a>
+<FONT color="green">227</FONT>            double[] oldRes  = new double[rows];<a name="line.227"></a>
+<FONT color="green">228</FONT>            double[] work1   = new double[cols];<a name="line.228"></a>
+<FONT color="green">229</FONT>            double[] work2   = new double[cols];<a name="line.229"></a>
+<FONT color="green">230</FONT>            double[] work3   = new double[cols];<a name="line.230"></a>
+<FONT color="green">231</FONT>    <a name="line.231"></a>
+<FONT color="green">232</FONT>            // evaluate the function at the starting point and calculate its norm<a name="line.232"></a>
+<FONT color="green">233</FONT>            updateResidualsAndCost();<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>            // outer loop<a name="line.235"></a>
+<FONT color="green">236</FONT>            lmPar = 0;<a name="line.236"></a>
+<FONT color="green">237</FONT>            boolean firstIteration = true;<a name="line.237"></a>
+<FONT color="green">238</FONT>            while (true) {<a name="line.238"></a>
+<FONT color="green">239</FONT>    <a name="line.239"></a>
+<FONT color="green">240</FONT>                incrementIterationsCounter();<a name="line.240"></a>
+<FONT color="green">241</FONT>    <a name="line.241"></a>
+<FONT color="green">242</FONT>                // compute the Q.R. decomposition of the jacobian matrix<a name="line.242"></a>
+<FONT color="green">243</FONT>                updateJacobian();<a name="line.243"></a>
+<FONT color="green">244</FONT>                qrDecomposition();<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>                // compute Qt.res<a name="line.246"></a>
+<FONT color="green">247</FONT>                qTy(residuals);<a name="line.247"></a>
+<FONT color="green">248</FONT>    <a name="line.248"></a>
+<FONT color="green">249</FONT>                // now we don't need Q anymore,<a name="line.249"></a>
+<FONT color="green">250</FONT>                // so let jacobian contain the R matrix with its diagonal elements<a name="line.250"></a>
+<FONT color="green">251</FONT>                for (int k = 0; k &lt; solvedCols; ++k) {<a name="line.251"></a>
+<FONT color="green">252</FONT>                    int pk = permutation[k];<a name="line.252"></a>
+<FONT color="green">253</FONT>                    jacobian[k][pk] = diagR[pk];<a name="line.253"></a>
+<FONT color="green">254</FONT>                }<a name="line.254"></a>
+<FONT color="green">255</FONT>    <a name="line.255"></a>
+<FONT color="green">256</FONT>                if (firstIteration) {<a name="line.256"></a>
+<FONT color="green">257</FONT>    <a name="line.257"></a>
+<FONT color="green">258</FONT>                    // scale the point according to the norms of the columns<a name="line.258"></a>
+<FONT color="green">259</FONT>                    // of the initial jacobian<a name="line.259"></a>
+<FONT color="green">260</FONT>                    xNorm = 0;<a name="line.260"></a>
+<FONT color="green">261</FONT>                    for (int k = 0; k &lt; cols; ++k) {<a name="line.261"></a>
+<FONT color="green">262</FONT>                        double dk = jacNorm[k];<a name="line.262"></a>
+<FONT color="green">263</FONT>                        if (dk == 0) {<a name="line.263"></a>
+<FONT color="green">264</FONT>                            dk = 1.0;<a name="line.264"></a>
+<FONT color="green">265</FONT>                        }<a name="line.265"></a>
+<FONT color="green">266</FONT>                        double xk = dk * point[k];<a name="line.266"></a>
+<FONT color="green">267</FONT>                        xNorm  += xk * xk;<a name="line.267"></a>
+<FONT color="green">268</FONT>                        diag[k] = dk;<a name="line.268"></a>
+<FONT color="green">269</FONT>                    }<a name="line.269"></a>
+<FONT color="green">270</FONT>                    xNorm = Math.sqrt(xNorm);<a name="line.270"></a>
+<FONT color="green">271</FONT>    <a name="line.271"></a>
+<FONT color="green">272</FONT>                    // initialize the step bound delta<a name="line.272"></a>
+<FONT color="green">273</FONT>                    delta = (xNorm == 0) ? initialStepBoundFactor : (initialStepBoundFactor * xNorm);<a name="line.273"></a>
+<FONT color="green">274</FONT>    <a name="line.274"></a>
+<FONT color="green">275</FONT>                }<a name="line.275"></a>
+<FONT color="green">276</FONT>    <a name="line.276"></a>
+<FONT color="green">277</FONT>                // check orthogonality between function vector and jacobian columns<a name="line.277"></a>
+<FONT color="green">278</FONT>                double maxCosine = 0;<a name="line.278"></a>
+<FONT color="green">279</FONT>                if (cost != 0) {<a name="line.279"></a>
+<FONT color="green">280</FONT>                    for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.280"></a>
+<FONT color="green">281</FONT>                        int    pj = permutation[j];<a name="line.281"></a>
+<FONT color="green">282</FONT>                        double s  = jacNorm[pj];<a name="line.282"></a>
+<FONT color="green">283</FONT>                        if (s != 0) {<a name="line.283"></a>
+<FONT color="green">284</FONT>                            double sum = 0;<a name="line.284"></a>
+<FONT color="green">285</FONT>                            for (int i = 0; i &lt;= j; ++i) {<a name="line.285"></a>
+<FONT color="green">286</FONT>                                sum += jacobian[i][pj] * residuals[i];<a name="line.286"></a>
+<FONT color="green">287</FONT>                            }<a name="line.287"></a>
+<FONT color="green">288</FONT>                            maxCosine = Math.max(maxCosine, Math.abs(sum) / (s * cost));<a name="line.288"></a>
+<FONT color="green">289</FONT>                        }<a name="line.289"></a>
+<FONT color="green">290</FONT>                    }<a name="line.290"></a>
+<FONT color="green">291</FONT>                }<a name="line.291"></a>
+<FONT color="green">292</FONT>                if (maxCosine &lt;= orthoTolerance) {<a name="line.292"></a>
+<FONT color="green">293</FONT>                    // convergence has been reached<a name="line.293"></a>
+<FONT color="green">294</FONT>                    return new VectorialPointValuePair(point, objective);<a name="line.294"></a>
+<FONT color="green">295</FONT>                }<a name="line.295"></a>
+<FONT color="green">296</FONT>    <a name="line.296"></a>
+<FONT color="green">297</FONT>                // rescale if necessary<a name="line.297"></a>
+<FONT color="green">298</FONT>                for (int j = 0; j &lt; cols; ++j) {<a name="line.298"></a>
+<FONT color="green">299</FONT>                    diag[j] = Math.max(diag[j], jacNorm[j]);<a name="line.299"></a>
+<FONT color="green">300</FONT>                }<a name="line.300"></a>
+<FONT color="green">301</FONT>    <a name="line.301"></a>
+<FONT color="green">302</FONT>                // inner loop<a name="line.302"></a>
+<FONT color="green">303</FONT>                for (double ratio = 0; ratio &lt; 1.0e-4;) {<a name="line.303"></a>
+<FONT color="green">304</FONT>    <a name="line.304"></a>
+<FONT color="green">305</FONT>                    // save the state<a name="line.305"></a>
+<FONT color="green">306</FONT>                    for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.306"></a>
+<FONT color="green">307</FONT>                        int pj = permutation[j];<a name="line.307"></a>
+<FONT color="green">308</FONT>                        oldX[pj] = point[pj];<a name="line.308"></a>
+<FONT color="green">309</FONT>                    }<a name="line.309"></a>
+<FONT color="green">310</FONT>                    double previousCost = cost;<a name="line.310"></a>
+<FONT color="green">311</FONT>                    double[] tmpVec = residuals;<a name="line.311"></a>
+<FONT color="green">312</FONT>                    residuals = oldRes;<a name="line.312"></a>
+<FONT color="green">313</FONT>                    oldRes    = tmpVec;<a name="line.313"></a>
+<FONT color="green">314</FONT>    <a name="line.314"></a>
+<FONT color="green">315</FONT>                    // determine the Levenberg-Marquardt parameter<a name="line.315"></a>
+<FONT color="green">316</FONT>                    determineLMParameter(oldRes, delta, diag, work1, work2, work3);<a name="line.316"></a>
+<FONT color="green">317</FONT>    <a name="line.317"></a>
+<FONT color="green">318</FONT>                    // compute the new point and the norm of the evolution direction<a name="line.318"></a>
+<FONT color="green">319</FONT>                    double lmNorm = 0;<a name="line.319"></a>
+<FONT color="green">320</FONT>                    for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.320"></a>
+<FONT color="green">321</FONT>                        int pj = permutation[j];<a name="line.321"></a>
+<FONT color="green">322</FONT>                        lmDir[pj] = -lmDir[pj];<a name="line.322"></a>
+<FONT color="green">323</FONT>                        point[pj] = oldX[pj] + lmDir[pj];<a name="line.323"></a>
+<FONT color="green">324</FONT>                        double s = diag[pj] * lmDir[pj];<a name="line.324"></a>
+<FONT color="green">325</FONT>                        lmNorm  += s * s;<a name="line.325"></a>
+<FONT color="green">326</FONT>                    }<a name="line.326"></a>
+<FONT color="green">327</FONT>                    lmNorm = Math.sqrt(lmNorm);<a name="line.327"></a>
+<FONT color="green">328</FONT>    <a name="line.328"></a>
+<FONT color="green">329</FONT>                    // on the first iteration, adjust the initial step bound.<a name="line.329"></a>
+<FONT color="green">330</FONT>                    if (firstIteration) {<a name="line.330"></a>
+<FONT color="green">331</FONT>                        delta = Math.min(delta, lmNorm);<a name="line.331"></a>
+<FONT color="green">332</FONT>                    }<a name="line.332"></a>
+<FONT color="green">333</FONT>    <a name="line.333"></a>
+<FONT color="green">334</FONT>                    // evaluate the function at x + p and calculate its norm<a name="line.334"></a>
+<FONT color="green">335</FONT>                    updateResidualsAndCost();<a name="line.335"></a>
+<FONT color="green">336</FONT>    <a name="line.336"></a>
+<FONT color="green">337</FONT>                    // compute the scaled actual reduction<a name="line.337"></a>
+<FONT color="green">338</FONT>                    double actRed = -1.0;<a name="line.338"></a>
+<FONT color="green">339</FONT>                    if (0.1 * cost &lt; previousCost) {<a name="line.339"></a>
+<FONT color="green">340</FONT>                        double r = cost / previousCost;<a name="line.340"></a>
+<FONT color="green">341</FONT>                        actRed = 1.0 - r * r;<a name="line.341"></a>
+<FONT color="green">342</FONT>                    }<a name="line.342"></a>
+<FONT color="green">343</FONT>    <a name="line.343"></a>
+<FONT color="green">344</FONT>                    // compute the scaled predicted reduction<a name="line.344"></a>
+<FONT color="green">345</FONT>                    // and the scaled directional derivative<a name="line.345"></a>
+<FONT color="green">346</FONT>                    for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.346"></a>
+<FONT color="green">347</FONT>                        int pj = permutation[j];<a name="line.347"></a>
+<FONT color="green">348</FONT>                        double dirJ = lmDir[pj];<a name="line.348"></a>
+<FONT color="green">349</FONT>                        work1[j] = 0;<a name="line.349"></a>
+<FONT color="green">350</FONT>                        for (int i = 0; i &lt;= j; ++i) {<a name="line.350"></a>
+<FONT color="green">351</FONT>                            work1[i] += jacobian[i][pj] * dirJ;<a name="line.351"></a>
+<FONT color="green">352</FONT>                        }<a name="line.352"></a>
+<FONT color="green">353</FONT>                    }<a name="line.353"></a>
+<FONT color="green">354</FONT>                    double coeff1 = 0;<a name="line.354"></a>
+<FONT color="green">355</FONT>                    for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.355"></a>
+<FONT color="green">356</FONT>                        coeff1 += work1[j] * work1[j];<a name="line.356"></a>
+<FONT color="green">357</FONT>                    }<a name="line.357"></a>
+<FONT color="green">358</FONT>                    double pc2 = previousCost * previousCost;<a name="line.358"></a>
+<FONT color="green">359</FONT>                    coeff1 = coeff1 / pc2;<a name="line.359"></a>
+<FONT color="green">360</FONT>                    double coeff2 = lmPar * lmNorm * lmNorm / pc2;<a name="line.360"></a>
+<FONT color="green">361</FONT>                    double preRed = coeff1 + 2 * coeff2;<a name="line.361"></a>
+<FONT color="green">362</FONT>                    double dirDer = -(coeff1 + coeff2);<a name="line.362"></a>
+<FONT color="green">363</FONT>    <a name="line.363"></a>
+<FONT color="green">364</FONT>                    // ratio of the actual to the predicted reduction<a name="line.364"></a>
+<FONT color="green">365</FONT>                    ratio = (preRed == 0) ? 0 : (actRed / preRed);<a name="line.365"></a>
+<FONT color="green">366</FONT>    <a name="line.366"></a>
+<FONT color="green">367</FONT>                    // update the step bound<a name="line.367"></a>
+<FONT color="green">368</FONT>                    if (ratio &lt;= 0.25) {<a name="line.368"></a>
+<FONT color="green">369</FONT>                        double tmp =<a name="line.369"></a>
+<FONT color="green">370</FONT>                            (actRed &lt; 0) ? (0.5 * dirDer / (dirDer + 0.5 * actRed)) : 0.5;<a name="line.370"></a>
+<FONT color="green">371</FONT>                            if ((0.1 * cost &gt;= previousCost) || (tmp &lt; 0.1)) {<a name="line.371"></a>
+<FONT color="green">372</FONT>                                tmp = 0.1;<a name="line.372"></a>
+<FONT color="green">373</FONT>                            }<a name="line.373"></a>
+<FONT color="green">374</FONT>                            delta = tmp * Math.min(delta, 10.0 * lmNorm);<a name="line.374"></a>
+<FONT color="green">375</FONT>                            lmPar /= tmp;<a name="line.375"></a>
+<FONT color="green">376</FONT>                    } else if ((lmPar == 0) || (ratio &gt;= 0.75)) {<a name="line.376"></a>
+<FONT color="green">377</FONT>                        delta = 2 * lmNorm;<a name="line.377"></a>
+<FONT color="green">378</FONT>                        lmPar *= 0.5;<a name="line.378"></a>
+<FONT color="green">379</FONT>                    }<a name="line.379"></a>
+<FONT color="green">380</FONT>    <a name="line.380"></a>
+<FONT color="green">381</FONT>                    // test for successful iteration.<a name="line.381"></a>
+<FONT color="green">382</FONT>                    if (ratio &gt;= 1.0e-4) {<a name="line.382"></a>
+<FONT color="green">383</FONT>                        // successful iteration, update the norm<a name="line.383"></a>
+<FONT color="green">384</FONT>                        firstIteration = false;<a name="line.384"></a>
+<FONT color="green">385</FONT>                        xNorm = 0;<a name="line.385"></a>
+<FONT color="green">386</FONT>                        for (int k = 0; k &lt; cols; ++k) {<a name="line.386"></a>
+<FONT color="green">387</FONT>                            double xK = diag[k] * point[k];<a name="line.387"></a>
+<FONT color="green">388</FONT>                            xNorm    += xK * xK;<a name="line.388"></a>
+<FONT color="green">389</FONT>                        }<a name="line.389"></a>
+<FONT color="green">390</FONT>                        xNorm = Math.sqrt(xNorm);<a name="line.390"></a>
+<FONT color="green">391</FONT>                    } else {<a name="line.391"></a>
+<FONT color="green">392</FONT>                        // failed iteration, reset the previous values<a name="line.392"></a>
+<FONT color="green">393</FONT>                        cost = previousCost;<a name="line.393"></a>
+<FONT color="green">394</FONT>                        for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.394"></a>
+<FONT color="green">395</FONT>                            int pj = permutation[j];<a name="line.395"></a>
+<FONT color="green">396</FONT>                            point[pj] = oldX[pj];<a name="line.396"></a>
+<FONT color="green">397</FONT>                        }<a name="line.397"></a>
+<FONT color="green">398</FONT>                        tmpVec    = residuals;<a name="line.398"></a>
+<FONT color="green">399</FONT>                        residuals = oldRes;<a name="line.399"></a>
+<FONT color="green">400</FONT>                        oldRes    = tmpVec;<a name="line.400"></a>
+<FONT color="green">401</FONT>                    }<a name="line.401"></a>
+<FONT color="green">402</FONT>    <a name="line.402"></a>
+<FONT color="green">403</FONT>                    // tests for convergence.<a name="line.403"></a>
+<FONT color="green">404</FONT>                    if (((Math.abs(actRed) &lt;= costRelativeTolerance) &amp;&amp;<a name="line.404"></a>
+<FONT color="green">405</FONT>                            (preRed &lt;= costRelativeTolerance) &amp;&amp;<a name="line.405"></a>
+<FONT color="green">406</FONT>                            (ratio &lt;= 2.0)) ||<a name="line.406"></a>
+<FONT color="green">407</FONT>                            (delta &lt;= parRelativeTolerance * xNorm)) {<a name="line.407"></a>
+<FONT color="green">408</FONT>                        return new VectorialPointValuePair(point, objective);<a name="line.408"></a>
+<FONT color="green">409</FONT>                    }<a name="line.409"></a>
+<FONT color="green">410</FONT>    <a name="line.410"></a>
+<FONT color="green">411</FONT>                    // tests for termination and stringent tolerances<a name="line.411"></a>
+<FONT color="green">412</FONT>                    // (2.2204e-16 is the machine epsilon for IEEE754)<a name="line.412"></a>
+<FONT color="green">413</FONT>                    if ((Math.abs(actRed) &lt;= 2.2204e-16) &amp;&amp; (preRed &lt;= 2.2204e-16) &amp;&amp; (ratio &lt;= 2.0)) {<a name="line.413"></a>
+<FONT color="green">414</FONT>                        throw new OptimizationException("cost relative tolerance is too small ({0})," +<a name="line.414"></a>
+<FONT color="green">415</FONT>                                " no further reduction in the" +<a name="line.415"></a>
+<FONT color="green">416</FONT>                                " sum of squares is possible",<a name="line.416"></a>
+<FONT color="green">417</FONT>                                costRelativeTolerance);<a name="line.417"></a>
+<FONT color="green">418</FONT>                    } else if (delta &lt;= 2.2204e-16 * xNorm) {<a name="line.418"></a>
+<FONT color="green">419</FONT>                        throw new OptimizationException("parameters relative tolerance is too small" +<a name="line.419"></a>
+<FONT color="green">420</FONT>                                " ({0}), no further improvement in" +<a name="line.420"></a>
+<FONT color="green">421</FONT>                                " the approximate solution is possible",<a name="line.421"></a>
+<FONT color="green">422</FONT>                                parRelativeTolerance);<a name="line.422"></a>
+<FONT color="green">423</FONT>                    } else if (maxCosine &lt;= 2.2204e-16)  {<a name="line.423"></a>
+<FONT color="green">424</FONT>                        throw new OptimizationException("orthogonality tolerance is too small ({0})," +<a name="line.424"></a>
+<FONT color="green">425</FONT>                                " solution is orthogonal to the jacobian",<a name="line.425"></a>
+<FONT color="green">426</FONT>                                orthoTolerance);<a name="line.426"></a>
+<FONT color="green">427</FONT>                    }<a name="line.427"></a>
+<FONT color="green">428</FONT>    <a name="line.428"></a>
+<FONT color="green">429</FONT>                }<a name="line.429"></a>
+<FONT color="green">430</FONT>    <a name="line.430"></a>
+<FONT color="green">431</FONT>            }<a name="line.431"></a>
+<FONT color="green">432</FONT>    <a name="line.432"></a>
+<FONT color="green">433</FONT>        }<a name="line.433"></a>
+<FONT color="green">434</FONT>    <a name="line.434"></a>
+<FONT color="green">435</FONT>        /**<a name="line.435"></a>
+<FONT color="green">436</FONT>         * Determine the Levenberg-Marquardt parameter.<a name="line.436"></a>
+<FONT color="green">437</FONT>         * &lt;p&gt;This implementation is a translation in Java of the MINPACK<a name="line.437"></a>
+<FONT color="green">438</FONT>         * &lt;a href="http://www.netlib.org/minpack/lmpar.f"&gt;lmpar&lt;/a&gt;<a name="line.438"></a>
+<FONT color="green">439</FONT>         * routine.&lt;/p&gt;<a name="line.439"></a>
+<FONT color="green">440</FONT>         * &lt;p&gt;This method sets the lmPar and lmDir attributes.&lt;/p&gt;<a name="line.440"></a>
+<FONT color="green">441</FONT>         * &lt;p&gt;The authors of the original fortran function are:&lt;/p&gt;<a name="line.441"></a>
+<FONT color="green">442</FONT>         * &lt;ul&gt;<a name="line.442"></a>
+<FONT color="green">443</FONT>         *   &lt;li&gt;Argonne National Laboratory. MINPACK project. March 1980&lt;/li&gt;<a name="line.443"></a>
+<FONT color="green">444</FONT>         *   &lt;li&gt;Burton  S. Garbow&lt;/li&gt;<a name="line.444"></a>
+<FONT color="green">445</FONT>         *   &lt;li&gt;Kenneth E. Hillstrom&lt;/li&gt;<a name="line.445"></a>
+<FONT color="green">446</FONT>         *   &lt;li&gt;Jorge   J. More&lt;/li&gt;<a name="line.446"></a>
+<FONT color="green">447</FONT>         * &lt;/ul&gt;<a name="line.447"></a>
+<FONT color="green">448</FONT>         * &lt;p&gt;Luc Maisonobe did the Java translation.&lt;/p&gt;<a name="line.448"></a>
+<FONT color="green">449</FONT>         *<a name="line.449"></a>
+<FONT color="green">450</FONT>         * @param qy array containing qTy<a name="line.450"></a>
+<FONT color="green">451</FONT>         * @param delta upper bound on the euclidean norm of diagR * lmDir<a name="line.451"></a>
+<FONT color="green">452</FONT>         * @param diag diagonal matrix<a name="line.452"></a>
+<FONT color="green">453</FONT>         * @param work1 work array<a name="line.453"></a>
+<FONT color="green">454</FONT>         * @param work2 work array<a name="line.454"></a>
+<FONT color="green">455</FONT>         * @param work3 work array<a name="line.455"></a>
+<FONT color="green">456</FONT>         */<a name="line.456"></a>
+<FONT color="green">457</FONT>        private void determineLMParameter(double[] qy, double delta, double[] diag,<a name="line.457"></a>
+<FONT color="green">458</FONT>                double[] work1, double[] work2, double[] work3) {<a name="line.458"></a>
+<FONT color="green">459</FONT>    <a name="line.459"></a>
+<FONT color="green">460</FONT>            // compute and store in x the gauss-newton direction, if the<a name="line.460"></a>
+<FONT color="green">461</FONT>            // jacobian is rank-deficient, obtain a least squares solution<a name="line.461"></a>
+<FONT color="green">462</FONT>            for (int j = 0; j &lt; rank; ++j) {<a name="line.462"></a>
+<FONT color="green">463</FONT>                lmDir[permutation[j]] = qy[j];<a name="line.463"></a>
+<FONT color="green">464</FONT>            }<a name="line.464"></a>
+<FONT color="green">465</FONT>            for (int j = rank; j &lt; cols; ++j) {<a name="line.465"></a>
+<FONT color="green">466</FONT>                lmDir[permutation[j]] = 0;<a name="line.466"></a>
+<FONT color="green">467</FONT>            }<a name="line.467"></a>
+<FONT color="green">468</FONT>            for (int k = rank - 1; k &gt;= 0; --k) {<a name="line.468"></a>
+<FONT color="green">469</FONT>                int pk = permutation[k];<a name="line.469"></a>
+<FONT color="green">470</FONT>                double ypk = lmDir[pk] / diagR[pk];<a name="line.470"></a>
+<FONT color="green">471</FONT>                for (int i = 0; i &lt; k; ++i) {<a name="line.471"></a>
+<FONT color="green">472</FONT>                    lmDir[permutation[i]] -= ypk * jacobian[i][pk];<a name="line.472"></a>
+<FONT color="green">473</FONT>                }<a name="line.473"></a>
+<FONT color="green">474</FONT>                lmDir[pk] = ypk;<a name="line.474"></a>
+<FONT color="green">475</FONT>            }<a name="line.475"></a>
+<FONT color="green">476</FONT>    <a name="line.476"></a>
+<FONT color="green">477</FONT>            // evaluate the function at the origin, and test<a name="line.477"></a>
+<FONT color="green">478</FONT>            // for acceptance of the Gauss-Newton direction<a name="line.478"></a>
+<FONT color="green">479</FONT>            double dxNorm = 0;<a name="line.479"></a>
+<FONT color="green">480</FONT>            for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.480"></a>
+<FONT color="green">481</FONT>                int pj = permutation[j];<a name="line.481"></a>
+<FONT color="green">482</FONT>                double s = diag[pj] * lmDir[pj];<a name="line.482"></a>
+<FONT color="green">483</FONT>                work1[pj] = s;<a name="line.483"></a>
+<FONT color="green">484</FONT>                dxNorm += s * s;<a name="line.484"></a>
+<FONT color="green">485</FONT>            }<a name="line.485"></a>
+<FONT color="green">486</FONT>            dxNorm = Math.sqrt(dxNorm);<a name="line.486"></a>
+<FONT color="green">487</FONT>            double fp = dxNorm - delta;<a name="line.487"></a>
+<FONT color="green">488</FONT>            if (fp &lt;= 0.1 * delta) {<a name="line.488"></a>
+<FONT color="green">489</FONT>                lmPar = 0;<a name="line.489"></a>
+<FONT color="green">490</FONT>                return;<a name="line.490"></a>
+<FONT color="green">491</FONT>            }<a name="line.491"></a>
+<FONT color="green">492</FONT>    <a name="line.492"></a>
+<FONT color="green">493</FONT>            // if the jacobian is not rank deficient, the Newton step provides<a name="line.493"></a>
+<FONT color="green">494</FONT>            // a lower bound, parl, for the zero of the function,<a name="line.494"></a>
+<FONT color="green">495</FONT>            // otherwise set this bound to zero<a name="line.495"></a>
+<FONT color="green">496</FONT>            double sum2;<a name="line.496"></a>
+<FONT color="green">497</FONT>            double parl = 0;<a name="line.497"></a>
+<FONT color="green">498</FONT>            if (rank == solvedCols) {<a name="line.498"></a>
+<FONT color="green">499</FONT>                for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.499"></a>
+<FONT color="green">500</FONT>                    int pj = permutation[j];<a name="line.500"></a>
+<FONT color="green">501</FONT>                    work1[pj] *= diag[pj] / dxNorm;<a name="line.501"></a>
+<FONT color="green">502</FONT>                }<a name="line.502"></a>
+<FONT color="green">503</FONT>                sum2 = 0;<a name="line.503"></a>
+<FONT color="green">504</FONT>                for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.504"></a>
+<FONT color="green">505</FONT>                    int pj = permutation[j];<a name="line.505"></a>
+<FONT color="green">506</FONT>                    double sum = 0;<a name="line.506"></a>
+<FONT color="green">507</FONT>                    for (int i = 0; i &lt; j; ++i) {<a name="line.507"></a>
+<FONT color="green">508</FONT>                        sum += jacobian[i][pj] * work1[permutation[i]];<a name="line.508"></a>
+<FONT color="green">509</FONT>                    }<a name="line.509"></a>
+<FONT color="green">510</FONT>                    double s = (work1[pj] - sum) / diagR[pj];<a name="line.510"></a>
+<FONT color="green">511</FONT>                    work1[pj] = s;<a name="line.511"></a>
+<FONT color="green">512</FONT>                    sum2 += s * s;<a name="line.512"></a>
+<FONT color="green">513</FONT>                }<a name="line.513"></a>
+<FONT color="green">514</FONT>                parl = fp / (delta * sum2);<a name="line.514"></a>
+<FONT color="green">515</FONT>            }<a name="line.515"></a>
+<FONT color="green">516</FONT>    <a name="line.516"></a>
+<FONT color="green">517</FONT>            // calculate an upper bound, paru, for the zero of the function<a name="line.517"></a>
+<FONT color="green">518</FONT>            sum2 = 0;<a name="line.518"></a>
+<FONT color="green">519</FONT>            for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.519"></a>
+<FONT color="green">520</FONT>                int pj = permutation[j];<a name="line.520"></a>
+<FONT color="green">521</FONT>                double sum = 0;<a name="line.521"></a>
+<FONT color="green">522</FONT>                for (int i = 0; i &lt;= j; ++i) {<a name="line.522"></a>
+<FONT color="green">523</FONT>                    sum += jacobian[i][pj] * qy[i];<a name="line.523"></a>
+<FONT color="green">524</FONT>                }<a name="line.524"></a>
+<FONT color="green">525</FONT>                sum /= diag[pj];<a name="line.525"></a>
+<FONT color="green">526</FONT>                sum2 += sum * sum;<a name="line.526"></a>
+<FONT color="green">527</FONT>            }<a name="line.527"></a>
+<FONT color="green">528</FONT>            double gNorm = Math.sqrt(sum2);<a name="line.528"></a>
+<FONT color="green">529</FONT>            double paru = gNorm / delta;<a name="line.529"></a>
+<FONT color="green">530</FONT>            if (paru == 0) {<a name="line.530"></a>
+<FONT color="green">531</FONT>                // 2.2251e-308 is the smallest positive real for IEE754<a name="line.531"></a>
+<FONT color="green">532</FONT>                paru = 2.2251e-308 / Math.min(delta, 0.1);<a name="line.532"></a>
+<FONT color="green">533</FONT>            }<a name="line.533"></a>
+<FONT color="green">534</FONT>    <a name="line.534"></a>
+<FONT color="green">535</FONT>            // if the input par lies outside of the interval (parl,paru),<a name="line.535"></a>
+<FONT color="green">536</FONT>            // set par to the closer endpoint<a name="line.536"></a>
+<FONT color="green">537</FONT>            lmPar = Math.min(paru, Math.max(lmPar, parl));<a name="line.537"></a>
+<FONT color="green">538</FONT>            if (lmPar == 0) {<a name="line.538"></a>
+<FONT color="green">539</FONT>                lmPar = gNorm / dxNorm;<a name="line.539"></a>
+<FONT color="green">540</FONT>            }<a name="line.540"></a>
+<FONT color="green">541</FONT>    <a name="line.541"></a>
+<FONT color="green">542</FONT>            for (int countdown = 10; countdown &gt;= 0; --countdown) {<a name="line.542"></a>
+<FONT color="green">543</FONT>    <a name="line.543"></a>
+<FONT color="green">544</FONT>                // evaluate the function at the current value of lmPar<a name="line.544"></a>
+<FONT color="green">545</FONT>                if (lmPar == 0) {<a name="line.545"></a>
+<FONT color="green">546</FONT>                    lmPar = Math.max(2.2251e-308, 0.001 * paru);<a name="line.546"></a>
+<FONT color="green">547</FONT>                }<a name="line.547"></a>
+<FONT color="green">548</FONT>                double sPar = Math.sqrt(lmPar);<a name="line.548"></a>
+<FONT color="green">549</FONT>                for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.549"></a>
+<FONT color="green">550</FONT>                    int pj = permutation[j];<a name="line.550"></a>
+<FONT color="green">551</FONT>                    work1[pj] = sPar * diag[pj];<a name="line.551"></a>
+<FONT color="green">552</FONT>                }<a name="line.552"></a>
+<FONT color="green">553</FONT>                determineLMDirection(qy, work1, work2, work3);<a name="line.553"></a>
+<FONT color="green">554</FONT>    <a name="line.554"></a>
+<FONT color="green">555</FONT>                dxNorm = 0;<a name="line.555"></a>
+<FONT color="green">556</FONT>                for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.556"></a>
+<FONT color="green">557</FONT>                    int pj = permutation[j];<a name="line.557"></a>
+<FONT color="green">558</FONT>                    double s = diag[pj] * lmDir[pj];<a name="line.558"></a>
+<FONT color="green">559</FONT>                    work3[pj] = s;<a name="line.559"></a>
+<FONT color="green">560</FONT>                    dxNorm += s * s;<a name="line.560"></a>
+<FONT color="green">561</FONT>                }<a name="line.561"></a>
+<FONT color="green">562</FONT>                dxNorm = Math.sqrt(dxNorm);<a name="line.562"></a>
+<FONT color="green">563</FONT>                double previousFP = fp;<a name="line.563"></a>
+<FONT color="green">564</FONT>                fp = dxNorm - delta;<a name="line.564"></a>
+<FONT color="green">565</FONT>    <a name="line.565"></a>
+<FONT color="green">566</FONT>                // if the function is small enough, accept the current value<a name="line.566"></a>
+<FONT color="green">567</FONT>                // of lmPar, also test for the exceptional cases where parl is zero<a name="line.567"></a>
+<FONT color="green">568</FONT>                if ((Math.abs(fp) &lt;= 0.1 * delta) ||<a name="line.568"></a>
+<FONT color="green">569</FONT>                        ((parl == 0) &amp;&amp; (fp &lt;= previousFP) &amp;&amp; (previousFP &lt; 0))) {<a name="line.569"></a>
+<FONT color="green">570</FONT>                    return;<a name="line.570"></a>
+<FONT color="green">571</FONT>                }<a name="line.571"></a>
+<FONT color="green">572</FONT>    <a name="line.572"></a>
+<FONT color="green">573</FONT>                // compute the Newton correction<a name="line.573"></a>
+<FONT color="green">574</FONT>                for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.574"></a>
+<FONT color="green">575</FONT>                    int pj = permutation[j];<a name="line.575"></a>
+<FONT color="green">576</FONT>                    work1[pj] = work3[pj] * diag[pj] / dxNorm;<a name="line.576"></a>
+<FONT color="green">577</FONT>                }<a name="line.577"></a>
+<FONT color="green">578</FONT>                for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.578"></a>
+<FONT color="green">579</FONT>                    int pj = permutation[j];<a name="line.579"></a>
+<FONT color="green">580</FONT>                    work1[pj] /= work2[j];<a name="line.580"></a>
+<FONT color="green">581</FONT>                    double tmp = work1[pj];<a name="line.581"></a>
+<FONT color="green">582</FONT>                    for (int i = j + 1; i &lt; solvedCols; ++i) {<a name="line.582"></a>
+<FONT color="green">583</FONT>                        work1[permutation[i]] -= jacobian[i][pj] * tmp;<a name="line.583"></a>
+<FONT color="green">584</FONT>                    }<a name="line.584"></a>
+<FONT color="green">585</FONT>                }<a name="line.585"></a>
+<FONT color="green">586</FONT>                sum2 = 0;<a name="line.586"></a>
+<FONT color="green">587</FONT>                for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.587"></a>
+<FONT color="green">588</FONT>                    double s = work1[permutation[j]];<a name="line.588"></a>
+<FONT color="green">589</FONT>                    sum2 += s * s;<a name="line.589"></a>
+<FONT color="green">590</FONT>                }<a name="line.590"></a>
+<FONT color="green">591</FONT>                double correction = fp / (delta * sum2);<a name="line.591"></a>
+<FONT color="green">592</FONT>    <a name="line.592"></a>
+<FONT color="green">593</FONT>                // depending on the sign of the function, update parl or paru.<a name="line.593"></a>
+<FONT color="green">594</FONT>                if (fp &gt; 0) {<a name="line.594"></a>
+<FONT color="green">595</FONT>                    parl = Math.max(parl, lmPar);<a name="line.595"></a>
+<FONT color="green">596</FONT>                } else if (fp &lt; 0) {<a name="line.596"></a>
+<FONT color="green">597</FONT>                    paru = Math.min(paru, lmPar);<a name="line.597"></a>
+<FONT color="green">598</FONT>                }<a name="line.598"></a>
+<FONT color="green">599</FONT>    <a name="line.599"></a>
+<FONT color="green">600</FONT>                // compute an improved estimate for lmPar<a name="line.600"></a>
+<FONT color="green">601</FONT>                lmPar = Math.max(parl, lmPar + correction);<a name="line.601"></a>
+<FONT color="green">602</FONT>    <a name="line.602"></a>
+<FONT color="green">603</FONT>            }<a name="line.603"></a>
+<FONT color="green">604</FONT>        }<a name="line.604"></a>
+<FONT color="green">605</FONT>    <a name="line.605"></a>
+<FONT color="green">606</FONT>        /**<a name="line.606"></a>
+<FONT color="green">607</FONT>         * Solve a*x = b and d*x = 0 in the least squares sense.<a name="line.607"></a>
+<FONT color="green">608</FONT>         * &lt;p&gt;This implementation is a translation in Java of the MINPACK<a name="line.608"></a>
+<FONT color="green">609</FONT>         * &lt;a href="http://www.netlib.org/minpack/qrsolv.f"&gt;qrsolv&lt;/a&gt;<a name="line.609"></a>
+<FONT color="green">610</FONT>         * routine.&lt;/p&gt;<a name="line.610"></a>
+<FONT color="green">611</FONT>         * &lt;p&gt;This method sets the lmDir and lmDiag attributes.&lt;/p&gt;<a name="line.611"></a>
+<FONT color="green">612</FONT>         * &lt;p&gt;The authors of the original fortran function are:&lt;/p&gt;<a name="line.612"></a>
+<FONT color="green">613</FONT>         * &lt;ul&gt;<a name="line.613"></a>
+<FONT color="green">614</FONT>         *   &lt;li&gt;Argonne National Laboratory. MINPACK project. March 1980&lt;/li&gt;<a name="line.614"></a>
+<FONT color="green">615</FONT>         *   &lt;li&gt;Burton  S. Garbow&lt;/li&gt;<a name="line.615"></a>
+<FONT color="green">616</FONT>         *   &lt;li&gt;Kenneth E. Hillstrom&lt;/li&gt;<a name="line.616"></a>
+<FONT color="green">617</FONT>         *   &lt;li&gt;Jorge   J. More&lt;/li&gt;<a name="line.617"></a>
+<FONT color="green">618</FONT>         * &lt;/ul&gt;<a name="line.618"></a>
+<FONT color="green">619</FONT>         * &lt;p&gt;Luc Maisonobe did the Java translation.&lt;/p&gt;<a name="line.619"></a>
+<FONT color="green">620</FONT>         *<a name="line.620"></a>
+<FONT color="green">621</FONT>         * @param qy array containing qTy<a name="line.621"></a>
+<FONT color="green">622</FONT>         * @param diag diagonal matrix<a name="line.622"></a>
+<FONT color="green">623</FONT>         * @param lmDiag diagonal elements associated with lmDir<a name="line.623"></a>
+<FONT color="green">624</FONT>         * @param work work array<a name="line.624"></a>
+<FONT color="green">625</FONT>         */<a name="line.625"></a>
+<FONT color="green">626</FONT>        private void determineLMDirection(double[] qy, double[] diag,<a name="line.626"></a>
+<FONT color="green">627</FONT>                double[] lmDiag, double[] work) {<a name="line.627"></a>
+<FONT color="green">628</FONT>    <a name="line.628"></a>
+<FONT color="green">629</FONT>            // copy R and Qty to preserve input and initialize s<a name="line.629"></a>
+<FONT color="green">630</FONT>            //  in particular, save the diagonal elements of R in lmDir<a name="line.630"></a>
+<FONT color="green">631</FONT>            for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.631"></a>
+<FONT color="green">632</FONT>                int pj = permutation[j];<a name="line.632"></a>
+<FONT color="green">633</FONT>                for (int i = j + 1; i &lt; solvedCols; ++i) {<a name="line.633"></a>
+<FONT color="green">634</FONT>                    jacobian[i][pj] = jacobian[j][permutation[i]];<a name="line.634"></a>
+<FONT color="green">635</FONT>                }<a name="line.635"></a>
+<FONT color="green">636</FONT>                lmDir[j] = diagR[pj];<a name="line.636"></a>
+<FONT color="green">637</FONT>                work[j]  = qy[j];<a name="line.637"></a>
+<FONT color="green">638</FONT>            }<a name="line.638"></a>
+<FONT color="green">639</FONT>    <a name="line.639"></a>
+<FONT color="green">640</FONT>            // eliminate the diagonal matrix d using a Givens rotation<a name="line.640"></a>
+<FONT color="green">641</FONT>            for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.641"></a>
+<FONT color="green">642</FONT>    <a name="line.642"></a>
+<FONT color="green">643</FONT>                // prepare the row of d to be eliminated, locating the<a name="line.643"></a>
+<FONT color="green">644</FONT>                // diagonal element using p from the Q.R. factorization<a name="line.644"></a>
+<FONT color="green">645</FONT>                int pj = permutation[j];<a name="line.645"></a>
+<FONT color="green">646</FONT>                double dpj = diag[pj];<a name="line.646"></a>
+<FONT color="green">647</FONT>                if (dpj != 0) {<a name="line.647"></a>
+<FONT color="green">648</FONT>                    Arrays.fill(lmDiag, j + 1, lmDiag.length, 0);<a name="line.648"></a>
+<FONT color="green">649</FONT>                }<a name="line.649"></a>
+<FONT color="green">650</FONT>                lmDiag[j] = dpj;<a name="line.650"></a>
+<FONT color="green">651</FONT>    <a name="line.651"></a>
+<FONT color="green">652</FONT>                //  the transformations to eliminate the row of d<a name="line.652"></a>
+<FONT color="green">653</FONT>                // modify only a single element of Qty<a name="line.653"></a>
+<FONT color="green">654</FONT>                // beyond the first n, which is initially zero.<a name="line.654"></a>
+<FONT color="green">655</FONT>                double qtbpj = 0;<a name="line.655"></a>
+<FONT color="green">656</FONT>                for (int k = j; k &lt; solvedCols; ++k) {<a name="line.656"></a>
+<FONT color="green">657</FONT>                    int pk = permutation[k];<a name="line.657"></a>
+<FONT color="green">658</FONT>    <a name="line.658"></a>
+<FONT color="green">659</FONT>                    // determine a Givens rotation which eliminates the<a name="line.659"></a>
+<FONT color="green">660</FONT>                    // appropriate element in the current row of d<a name="line.660"></a>
+<FONT color="green">661</FONT>                    if (lmDiag[k] != 0) {<a name="line.661"></a>
+<FONT color="green">662</FONT>    <a name="line.662"></a>
+<FONT color="green">663</FONT>                        final double sin;<a name="line.663"></a>
+<FONT color="green">664</FONT>                        final double cos;<a name="line.664"></a>
+<FONT color="green">665</FONT>                        double rkk = jacobian[k][pk];<a name="line.665"></a>
+<FONT color="green">666</FONT>                        if (Math.abs(rkk) &lt; Math.abs(lmDiag[k])) {<a name="line.666"></a>
+<FONT color="green">667</FONT>                            final double cotan = rkk / lmDiag[k];<a name="line.667"></a>
+<FONT color="green">668</FONT>                            sin   = 1.0 / Math.sqrt(1.0 + cotan * cotan);<a name="line.668"></a>
+<FONT color="green">669</FONT>                            cos   = sin * cotan;<a name="line.669"></a>
+<FONT color="green">670</FONT>                        } else {<a name="line.670"></a>
+<FONT color="green">671</FONT>                            final double tan = lmDiag[k] / rkk;<a name="line.671"></a>
+<FONT color="green">672</FONT>                            cos = 1.0 / Math.sqrt(1.0 + tan * tan);<a name="line.672"></a>
+<FONT color="green">673</FONT>                            sin = cos * tan;<a name="line.673"></a>
+<FONT color="green">674</FONT>                        }<a name="line.674"></a>
+<FONT color="green">675</FONT>    <a name="line.675"></a>
+<FONT color="green">676</FONT>                        // compute the modified diagonal element of R and<a name="line.676"></a>
+<FONT color="green">677</FONT>                        // the modified element of (Qty,0)<a name="line.677"></a>
+<FONT color="green">678</FONT>                        jacobian[k][pk] = cos * rkk + sin * lmDiag[k];<a name="line.678"></a>
+<FONT color="green">679</FONT>                        final double temp = cos * work[k] + sin * qtbpj;<a name="line.679"></a>
+<FONT color="green">680</FONT>                        qtbpj = -sin * work[k] + cos * qtbpj;<a name="line.680"></a>
+<FONT color="green">681</FONT>                        work[k] = temp;<a name="line.681"></a>
+<FONT color="green">682</FONT>    <a name="line.682"></a>
+<FONT color="green">683</FONT>                        // accumulate the tranformation in the row of s<a name="line.683"></a>
+<FONT color="green">684</FONT>                        for (int i = k + 1; i &lt; solvedCols; ++i) {<a name="line.684"></a>
+<FONT color="green">685</FONT>                            double rik = jacobian[i][pk];<a name="line.685"></a>
+<FONT color="green">686</FONT>                            final double temp2 = cos * rik + sin * lmDiag[i];<a name="line.686"></a>
+<FONT color="green">687</FONT>                            lmDiag[i] = -sin * rik + cos * lmDiag[i];<a name="line.687"></a>
+<FONT color="green">688</FONT>                            jacobian[i][pk] = temp2;<a name="line.688"></a>
+<FONT color="green">689</FONT>                        }<a name="line.689"></a>
+<FONT color="green">690</FONT>    <a name="line.690"></a>
+<FONT color="green">691</FONT>                    }<a name="line.691"></a>
+<FONT color="green">692</FONT>                }<a name="line.692"></a>
+<FONT color="green">693</FONT>    <a name="line.693"></a>
+<FONT color="green">694</FONT>                // store the diagonal element of s and restore<a name="line.694"></a>
+<FONT color="green">695</FONT>                // the corresponding diagonal element of R<a name="line.695"></a>
+<FONT color="green">696</FONT>                lmDiag[j] = jacobian[j][permutation[j]];<a name="line.696"></a>
+<FONT color="green">697</FONT>                jacobian[j][permutation[j]] = lmDir[j];<a name="line.697"></a>
+<FONT color="green">698</FONT>    <a name="line.698"></a>
+<FONT color="green">699</FONT>            }<a name="line.699"></a>
+<FONT color="green">700</FONT>    <a name="line.700"></a>
+<FONT color="green">701</FONT>            // solve the triangular system for z, if the system is<a name="line.701"></a>
+<FONT color="green">702</FONT>            // singular, then obtain a least squares solution<a name="line.702"></a>
+<FONT color="green">703</FONT>            int nSing = solvedCols;<a name="line.703"></a>
+<FONT color="green">704</FONT>            for (int j = 0; j &lt; solvedCols; ++j) {<a name="line.704"></a>
+<FONT color="green">705</FONT>                if ((lmDiag[j] == 0) &amp;&amp; (nSing == solvedCols)) {<a name="line.705"></a>
+<FONT color="green">706</FONT>                    nSing = j;<a name="line.706"></a>
+<FONT color="green">707</FONT>                }<a name="line.707"></a>
+<FONT color="green">708</FONT>                if (nSing &lt; solvedCols) {<a name="line.708"></a>
+<FONT color="green">709</FONT>                    work[j] = 0;<a name="line.709"></a>
+<FONT color="green">710</FONT>                }<a name="line.710"></a>
+<FONT color="green">711</FONT>            }<a name="line.711"></a>
+<FONT color="green">712</FONT>            if (nSing &gt; 0) {<a name="line.712"></a>
+<FONT color="green">713</FONT>                for (int j = nSing - 1; j &gt;= 0; --j) {<a name="line.713"></a>
+<FONT color="green">714</FONT>                    int pj = permutation[j];<a name="line.714"></a>
+<FONT color="green">715</FONT>                    double sum = 0;<a name="line.715"></a>
+<FONT color="green">716</FONT>                    for (int i = j + 1; i &lt; nSing; ++i) {<a name="line.716"></a>
+<FONT color="green">717</FONT>                        sum += jacobian[i][pj] * work[i];<a name="line.717"></a>
+<FONT color="green">718</FONT>                    }<a name="line.718"></a>
+<FONT color="green">719</FONT>                    work[j] = (work[j] - sum) / lmDiag[j];<a name="line.719"></a>
+<FONT color="green">720</FONT>                }<a name="line.720"></a>
+<FONT color="green">721</FONT>            }<a name="line.721"></a>
+<FONT color="green">722</FONT>    <a name="line.722"></a>
+<FONT color="green">723</FONT>            // permute the components of z back to components of lmDir<a name="line.723"></a>
+<FONT color="green">724</FONT>            for (int j = 0; j &lt; lmDir.length; ++j) {<a name="line.724"></a>
+<FONT color="green">725</FONT>                lmDir[permutation[j]] = work[j];<a name="line.725"></a>
+<FONT color="green">726</FONT>            }<a name="line.726"></a>
+<FONT color="green">727</FONT>    <a name="line.727"></a>
+<FONT color="green">728</FONT>        }<a name="line.728"></a>
+<FONT color="green">729</FONT>    <a name="line.729"></a>
+<FONT color="green">730</FONT>        /**<a name="line.730"></a>
+<FONT color="green">731</FONT>         * Decompose a matrix A as A.P = Q.R using Householder transforms.<a name="line.731"></a>
+<FONT color="green">732</FONT>         * &lt;p&gt;As suggested in the P. Lascaux and R. Theodor book<a name="line.732"></a>
+<FONT color="green">733</FONT>         * &lt;i&gt;Analyse num&amp;eacute;rique matricielle appliqu&amp;eacute;e &amp;agrave;<a name="line.733"></a>
+<FONT color="green">734</FONT>         * l'art de l'ing&amp;eacute;nieur&lt;/i&gt; (Masson, 1986), instead of representing<a name="line.734"></a>
+<FONT color="green">735</FONT>         * the Householder transforms with u&lt;sub&gt;k&lt;/sub&gt; unit vectors such that:<a name="line.735"></a>
+<FONT color="green">736</FONT>         * &lt;pre&gt;<a name="line.736"></a>
+<FONT color="green">737</FONT>         * H&lt;sub&gt;k&lt;/sub&gt; = I - 2u&lt;sub&gt;k&lt;/sub&gt;.u&lt;sub&gt;k&lt;/sub&gt;&lt;sup&gt;t&lt;/sup&gt;<a name="line.737"></a>
+<FONT color="green">738</FONT>         * &lt;/pre&gt;<a name="line.738"></a>
+<FONT color="green">739</FONT>         * we use &lt;sub&gt;k&lt;/sub&gt; non-unit vectors such that:<a name="line.739"></a>
+<FONT color="green">740</FONT>         * &lt;pre&gt;<a name="line.740"></a>
+<FONT color="green">741</FONT>         * H&lt;sub&gt;k&lt;/sub&gt; = I - beta&lt;sub&gt;k&lt;/sub&gt;v&lt;sub&gt;k&lt;/sub&gt;.v&lt;sub&gt;k&lt;/sub&gt;&lt;sup&gt;t&lt;/sup&gt;<a name="line.741"></a>
+<FONT color="green">742</FONT>         * &lt;/pre&gt;<a name="line.742"></a>
+<FONT color="green">743</FONT>         * where v&lt;sub&gt;k&lt;/sub&gt; = a&lt;sub&gt;k&lt;/sub&gt; - alpha&lt;sub&gt;k&lt;/sub&gt; e&lt;sub&gt;k&lt;/sub&gt;.<a name="line.743"></a>
+<FONT color="green">744</FONT>         * The beta&lt;sub&gt;k&lt;/sub&gt; coefficients are provided upon exit as recomputing<a name="line.744"></a>
+<FONT color="green">745</FONT>         * them from the v&lt;sub&gt;k&lt;/sub&gt; vectors would be costly.&lt;/p&gt;<a name="line.745"></a>
+<FONT color="green">746</FONT>         * &lt;p&gt;This decomposition handles rank deficient cases since the tranformations<a name="line.746"></a>
+<FONT color="green">747</FONT>         * are performed in non-increasing columns norms order thanks to columns<a name="line.747"></a>
+<FONT color="green">748</FONT>         * pivoting. The diagonal elements of the R matrix are therefore also in<a name="line.748"></a>
+<FONT color="green">749</FONT>         * non-increasing absolute values order.&lt;/p&gt;<a name="line.749"></a>
+<FONT color="green">750</FONT>         * @exception OptimizationException if the decomposition cannot be performed<a name="line.750"></a>
+<FONT color="green">751</FONT>         */<a name="line.751"></a>
+<FONT color="green">752</FONT>        private void qrDecomposition() throws OptimizationException {<a name="line.752"></a>
+<FONT color="green">753</FONT>    <a name="line.753"></a>
+<FONT color="green">754</FONT>            // initializations<a name="line.754"></a>
+<FONT color="green">755</FONT>            for (int k = 0; k &lt; cols; ++k) {<a name="line.755"></a>
+<FONT color="green">756</FONT>                permutation[k] = k;<a name="line.756"></a>
+<FONT color="green">757</FONT>                double norm2 = 0;<a name="line.757"></a>
+<FONT color="green">758</FONT>                for (int i = 0; i &lt; jacobian.length; ++i) {<a name="line.758"></a>
+<FONT color="green">759</FONT>                    double akk = jacobian[i][k];<a name="line.759"></a>
+<FONT color="green">760</FONT>                    norm2 += akk * akk;<a name="line.760"></a>
+<FONT color="green">761</FONT>                }<a name="line.761"></a>
+<FONT color="green">762</FONT>                jacNorm[k] = Math.sqrt(norm2);<a name="line.762"></a>
+<FONT color="green">763</FONT>            }<a name="line.763"></a>
+<FONT color="green">764</FONT>    <a name="line.764"></a>
+<FONT color="green">765</FONT>            // transform the matrix column after column<a name="line.765"></a>
+<FONT color="green">766</FONT>            for (int k = 0; k &lt; cols; ++k) {<a name="line.766"></a>
+<FONT color="green">767</FONT>    <a name="line.767"></a>
+<FONT color="green">768</FONT>                // select the column with the greatest norm on active components<a name="line.768"></a>
+<FONT color="green">769</FONT>                int nextColumn = -1;<a name="line.769"></a>
+<FONT color="green">770</FONT>                double ak2 = Double.NEGATIVE_INFINITY;<a name="line.770"></a>
+<FONT color="green">771</FONT>                for (int i = k; i &lt; cols; ++i) {<a name="line.771"></a>
+<FONT color="green">772</FONT>                    double norm2 = 0;<a name="line.772"></a>
+<FONT color="green">773</FONT>                    for (int j = k; j &lt; jacobian.length; ++j) {<a name="line.773"></a>
+<FONT color="green">774</FONT>                        double aki = jacobian[j][permutation[i]];<a name="line.774"></a>
+<FONT color="green">775</FONT>                        norm2 += aki * aki;<a name="line.775"></a>
+<FONT color="green">776</FONT>                    }<a name="line.776"></a>
+<FONT color="green">777</FONT>                    if (Double.isInfinite(norm2) || Double.isNaN(norm2)) {<a name="line.777"></a>
+<FONT color="green">778</FONT>                        throw new OptimizationException(<a name="line.778"></a>
+<FONT color="green">779</FONT>                                "unable to perform Q.R decomposition on the {0}x{1} jacobian matrix",<a name="line.779"></a>
+<FONT color="green">780</FONT>                                rows, cols);<a name="line.780"></a>
+<FONT color="green">781</FONT>                    }<a name="line.781"></a>
+<FONT color="green">782</FONT>                    if (norm2 &gt; ak2) {<a name="line.782"></a>
+<FONT color="green">783</FONT>                        nextColumn = i;<a name="line.783"></a>
+<FONT color="green">784</FONT>                        ak2        = norm2;<a name="line.784"></a>
+<FONT color="green">785</FONT>                    }<a name="line.785"></a>
+<FONT color="green">786</FONT>                }<a name="line.786"></a>
+<FONT color="green">787</FONT>                if (ak2 == 0) {<a name="line.787"></a>
+<FONT color="green">788</FONT>                    rank = k;<a name="line.788"></a>
+<FONT color="green">789</FONT>                    return;<a name="line.789"></a>
+<FONT color="green">790</FONT>                }<a name="line.790"></a>
+<FONT color="green">791</FONT>                int pk                  = permutation[nextColumn];<a name="line.791"></a>
+<FONT color="green">792</FONT>                permutation[nextColumn] = permutation[k];<a name="line.792"></a>
+<FONT color="green">793</FONT>                permutation[k]          = pk;<a name="line.793"></a>
+<FONT color="green">794</FONT>    <a name="line.794"></a>
+<FONT color="green">795</FONT>                // choose alpha such that Hk.u = alpha ek<a name="line.795"></a>
+<FONT color="green">796</FONT>                double akk   = jacobian[k][pk];<a name="line.796"></a>
+<FONT color="green">797</FONT>                double alpha = (akk &gt; 0) ? -Math.sqrt(ak2) : Math.sqrt(ak2);<a name="line.797"></a>
+<FONT color="green">798</FONT>                double betak = 1.0 / (ak2 - akk * alpha);<a name="line.798"></a>
+<FONT color="green">799</FONT>                beta[pk]     = betak;<a name="line.799"></a>
+<FONT color="green">800</FONT>    <a name="line.800"></a>
+<FONT color="green">801</FONT>                // transform the current column<a name="line.801"></a>
+<FONT color="green">802</FONT>                diagR[pk]        = alpha;<a name="line.802"></a>
+<FONT color="green">803</FONT>                jacobian[k][pk] -= alpha;<a name="line.803"></a>
+<FONT color="green">804</FONT>    <a name="line.804"></a>
+<FONT color="green">805</FONT>                // transform the remaining columns<a name="line.805"></a>
+<FONT color="green">806</FONT>                for (int dk = cols - 1 - k; dk &gt; 0; --dk) {<a name="line.806"></a>
+<FONT color="green">807</FONT>                    double gamma = 0;<a name="line.807"></a>
+<FONT color="green">808</FONT>                    for (int j = k; j &lt; jacobian.length; ++j) {<a name="line.808"></a>
+<FONT color="green">809</FONT>                        gamma += jacobian[j][pk] * jacobian[j][permutation[k + dk]];<a name="line.809"></a>
+<FONT color="green">810</FONT>                    }<a name="line.810"></a>
+<FONT color="green">811</FONT>                    gamma *= betak;<a name="line.811"></a>
+<FONT color="green">812</FONT>                    for (int j = k; j &lt; jacobian.length; ++j) {<a name="line.812"></a>
+<FONT color="green">813</FONT>                        jacobian[j][permutation[k + dk]] -= gamma * jacobian[j][pk];<a name="line.813"></a>
+<FONT color="green">814</FONT>                    }<a name="line.814"></a>
+<FONT color="green">815</FONT>                }<a name="line.815"></a>
+<FONT color="green">816</FONT>    <a name="line.816"></a>
+<FONT color="green">817</FONT>            }<a name="line.817"></a>
+<FONT color="green">818</FONT>    <a name="line.818"></a>
+<FONT color="green">819</FONT>            rank = solvedCols;<a name="line.819"></a>
+<FONT color="green">820</FONT>    <a name="line.820"></a>
+<FONT color="green">821</FONT>        }<a name="line.821"></a>
+<FONT color="green">822</FONT>    <a name="line.822"></a>
+<FONT color="green">823</FONT>        /**<a name="line.823"></a>
+<FONT color="green">824</FONT>         * Compute the product Qt.y for some Q.R. decomposition.<a name="line.824"></a>
+<FONT color="green">825</FONT>         *<a name="line.825"></a>
+<FONT color="green">826</FONT>         * @param y vector to multiply (will be overwritten with the result)<a name="line.826"></a>
+<FONT color="green">827</FONT>         */<a name="line.827"></a>
+<FONT color="green">828</FONT>        private void qTy(double[] y) {<a name="line.828"></a>
+<FONT color="green">829</FONT>            for (int k = 0; k &lt; cols; ++k) {<a name="line.829"></a>
+<FONT color="green">830</FONT>                int pk = permutation[k];<a name="line.830"></a>
+<FONT color="green">831</FONT>                double gamma = 0;<a name="line.831"></a>
+<FONT color="green">832</FONT>                for (int i = k; i &lt; rows; ++i) {<a name="line.832"></a>
+<FONT color="green">833</FONT>                    gamma += jacobian[i][pk] * y[i];<a name="line.833"></a>
+<FONT color="green">834</FONT>                }<a name="line.834"></a>
+<FONT color="green">835</FONT>                gamma *= beta[pk];<a name="line.835"></a>
+<FONT color="green">836</FONT>                for (int i = k; i &lt; rows; ++i) {<a name="line.836"></a>
+<FONT color="green">837</FONT>                    y[i] -= gamma * jacobian[i][pk];<a name="line.837"></a>
+<FONT color="green">838</FONT>                }<a name="line.838"></a>
+<FONT color="green">839</FONT>            }<a name="line.839"></a>
+<FONT color="green">840</FONT>        }<a name="line.840"></a>
+<FONT color="green">841</FONT>    <a name="line.841"></a>
+<FONT color="green">842</FONT>    }<a name="line.842"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,359 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.general;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.analysis.solvers.BrentSolver;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.analysis.solvers.UnivariateRealSolver;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.optimization.GoalType;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.optimization.OptimizationException;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.optimization.DifferentiableMultivariateRealOptimizer;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.optimization.RealPointValuePair;<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>    /**<a name="line.30"></a>
+<FONT color="green">031</FONT>     * Non-linear conjugate gradient optimizer.<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * This class supports both the Fletcher-Reeves and the Polak-Ribi&amp;egrave;re<a name="line.33"></a>
+<FONT color="green">034</FONT>     * update formulas for the conjugate search directions. It also supports<a name="line.34"></a>
+<FONT color="green">035</FONT>     * optional preconditioning.<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @since 2.0<a name="line.39"></a>
+<FONT color="green">040</FONT>     *<a name="line.40"></a>
+<FONT color="green">041</FONT>     */<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>    public class NonLinearConjugateGradientOptimizer<a name="line.43"></a>
+<FONT color="green">044</FONT>        extends AbstractScalarDifferentiableOptimizer<a name="line.44"></a>
+<FONT color="green">045</FONT>        implements DifferentiableMultivariateRealOptimizer {<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** Update formula for the beta parameter. */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private final ConjugateGradientFormula updateFormula;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Preconditioner (may be null). */<a name="line.50"></a>
+<FONT color="green">051</FONT>        private Preconditioner preconditioner;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** solver to use in the line search (may be null). */<a name="line.53"></a>
+<FONT color="green">054</FONT>        private UnivariateRealSolver solver;<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** Initial step used to bracket the optimum in line search. */<a name="line.56"></a>
+<FONT color="green">057</FONT>        private double initialStep;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** Simple constructor with default settings.<a name="line.59"></a>
+<FONT color="green">060</FONT>         * &lt;p&gt;The convergence check is set to a {@link<a name="line.60"></a>
+<FONT color="green">061</FONT>         * org.apache.commons.math.optimization.SimpleVectorialValueChecker}<a name="line.61"></a>
+<FONT color="green">062</FONT>         * and the maximal number of iterations is set to<a name="line.62"></a>
+<FONT color="green">063</FONT>         * {@link AbstractScalarDifferentiableOptimizer#DEFAULT_MAX_ITERATIONS}.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @param updateFormula formula to use for updating the &amp;beta; parameter,<a name="line.64"></a>
+<FONT color="green">065</FONT>         * must be one of {@link ConjugateGradientFormula#FLETCHER_REEVES} or {@link<a name="line.65"></a>
+<FONT color="green">066</FONT>         * ConjugateGradientFormula#POLAK_RIBIERE}<a name="line.66"></a>
+<FONT color="green">067</FONT>         */<a name="line.67"></a>
+<FONT color="green">068</FONT>        public NonLinearConjugateGradientOptimizer(final ConjugateGradientFormula updateFormula) {<a name="line.68"></a>
+<FONT color="green">069</FONT>            this.updateFormula = updateFormula;<a name="line.69"></a>
+<FONT color="green">070</FONT>            preconditioner     = null;<a name="line.70"></a>
+<FONT color="green">071</FONT>            solver             = null;<a name="line.71"></a>
+<FONT color="green">072</FONT>            initialStep        = 1.0;<a name="line.72"></a>
+<FONT color="green">073</FONT>        }<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /**<a name="line.75"></a>
+<FONT color="green">076</FONT>         * Set the preconditioner.<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @param preconditioner preconditioner to use for next optimization,<a name="line.77"></a>
+<FONT color="green">078</FONT>         * may be null to remove an already registered preconditioner<a name="line.78"></a>
+<FONT color="green">079</FONT>         */<a name="line.79"></a>
+<FONT color="green">080</FONT>        public void setPreconditioner(final Preconditioner preconditioner) {<a name="line.80"></a>
+<FONT color="green">081</FONT>            this.preconditioner = preconditioner;<a name="line.81"></a>
+<FONT color="green">082</FONT>        }<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /**<a name="line.84"></a>
+<FONT color="green">085</FONT>         * Set the solver to use during line search.<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @param lineSearchSolver solver to use during line search, may be null<a name="line.86"></a>
+<FONT color="green">087</FONT>         * to remove an already registered solver and fall back to the<a name="line.87"></a>
+<FONT color="green">088</FONT>         * default {@link BrentSolver Brent solver}.<a name="line.88"></a>
+<FONT color="green">089</FONT>         */<a name="line.89"></a>
+<FONT color="green">090</FONT>        public void setLineSearchSolver(final UnivariateRealSolver lineSearchSolver) {<a name="line.90"></a>
+<FONT color="green">091</FONT>            this.solver = lineSearchSolver;<a name="line.91"></a>
+<FONT color="green">092</FONT>        }<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>        /**<a name="line.94"></a>
+<FONT color="green">095</FONT>         * Set the initial step used to bracket the optimum in line search.<a name="line.95"></a>
+<FONT color="green">096</FONT>         * &lt;p&gt;<a name="line.96"></a>
+<FONT color="green">097</FONT>         * The initial step is a factor with respect to the search direction,<a name="line.97"></a>
+<FONT color="green">098</FONT>         * which itself is roughly related to the gradient of the function<a name="line.98"></a>
+<FONT color="green">099</FONT>         * &lt;/p&gt;<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @param initialStep initial step used to bracket the optimum in line search,<a name="line.100"></a>
+<FONT color="green">101</FONT>         * if a non-positive value is used, the initial step is reset to its<a name="line.101"></a>
+<FONT color="green">102</FONT>         * default value of 1.0<a name="line.102"></a>
+<FONT color="green">103</FONT>         */<a name="line.103"></a>
+<FONT color="green">104</FONT>        public void setInitialStep(final double initialStep) {<a name="line.104"></a>
+<FONT color="green">105</FONT>            if (initialStep &lt;= 0) {<a name="line.105"></a>
+<FONT color="green">106</FONT>                this.initialStep = 1.0;<a name="line.106"></a>
+<FONT color="green">107</FONT>            } else {<a name="line.107"></a>
+<FONT color="green">108</FONT>                this.initialStep = initialStep;<a name="line.108"></a>
+<FONT color="green">109</FONT>            }<a name="line.109"></a>
+<FONT color="green">110</FONT>        }<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>        /** {@inheritDoc} */<a name="line.112"></a>
+<FONT color="green">113</FONT>        @Override<a name="line.113"></a>
+<FONT color="green">114</FONT>        protected RealPointValuePair doOptimize()<a name="line.114"></a>
+<FONT color="green">115</FONT>            throws FunctionEvaluationException, OptimizationException, IllegalArgumentException {<a name="line.115"></a>
+<FONT color="green">116</FONT>            try {<a name="line.116"></a>
+<FONT color="green">117</FONT>    <a name="line.117"></a>
+<FONT color="green">118</FONT>                // initialization<a name="line.118"></a>
+<FONT color="green">119</FONT>                if (preconditioner == null) {<a name="line.119"></a>
+<FONT color="green">120</FONT>                    preconditioner = new IdentityPreconditioner();<a name="line.120"></a>
+<FONT color="green">121</FONT>                }<a name="line.121"></a>
+<FONT color="green">122</FONT>                if (solver == null) {<a name="line.122"></a>
+<FONT color="green">123</FONT>                    solver = new BrentSolver();<a name="line.123"></a>
+<FONT color="green">124</FONT>                }<a name="line.124"></a>
+<FONT color="green">125</FONT>                final int n = point.length;<a name="line.125"></a>
+<FONT color="green">126</FONT>                double[] r = computeObjectiveGradient(point);<a name="line.126"></a>
+<FONT color="green">127</FONT>                if (goal == GoalType.MINIMIZE) {<a name="line.127"></a>
+<FONT color="green">128</FONT>                    for (int i = 0; i &lt; n; ++i) {<a name="line.128"></a>
+<FONT color="green">129</FONT>                        r[i] = -r[i];<a name="line.129"></a>
+<FONT color="green">130</FONT>                    }<a name="line.130"></a>
+<FONT color="green">131</FONT>                }<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>                // initial search direction<a name="line.133"></a>
+<FONT color="green">134</FONT>                double[] steepestDescent = preconditioner.precondition(point, r);<a name="line.134"></a>
+<FONT color="green">135</FONT>                double[] searchDirection = steepestDescent.clone();<a name="line.135"></a>
+<FONT color="green">136</FONT>    <a name="line.136"></a>
+<FONT color="green">137</FONT>                double delta = 0;<a name="line.137"></a>
+<FONT color="green">138</FONT>                for (int i = 0; i &lt; n; ++i) {<a name="line.138"></a>
+<FONT color="green">139</FONT>                    delta += r[i] * searchDirection[i];<a name="line.139"></a>
+<FONT color="green">140</FONT>                }<a name="line.140"></a>
+<FONT color="green">141</FONT>    <a name="line.141"></a>
+<FONT color="green">142</FONT>                RealPointValuePair current = null;<a name="line.142"></a>
+<FONT color="green">143</FONT>                while (true) {<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>                    final double objective = computeObjectiveValue(point);<a name="line.145"></a>
+<FONT color="green">146</FONT>                    RealPointValuePair previous = current;<a name="line.146"></a>
+<FONT color="green">147</FONT>                    current = new RealPointValuePair(point, objective);<a name="line.147"></a>
+<FONT color="green">148</FONT>                    if (previous != null) {<a name="line.148"></a>
+<FONT color="green">149</FONT>                        if (checker.converged(getIterations(), previous, current)) {<a name="line.149"></a>
+<FONT color="green">150</FONT>                            // we have found an optimum<a name="line.150"></a>
+<FONT color="green">151</FONT>                            return current;<a name="line.151"></a>
+<FONT color="green">152</FONT>                        }<a name="line.152"></a>
+<FONT color="green">153</FONT>                    }<a name="line.153"></a>
+<FONT color="green">154</FONT>    <a name="line.154"></a>
+<FONT color="green">155</FONT>                    incrementIterationsCounter();<a name="line.155"></a>
+<FONT color="green">156</FONT>    <a name="line.156"></a>
+<FONT color="green">157</FONT>                    double dTd = 0;<a name="line.157"></a>
+<FONT color="green">158</FONT>                    for (final double di : searchDirection) {<a name="line.158"></a>
+<FONT color="green">159</FONT>                        dTd += di * di;<a name="line.159"></a>
+<FONT color="green">160</FONT>                    }<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>                    // find the optimal step in the search direction<a name="line.162"></a>
+<FONT color="green">163</FONT>                    final UnivariateRealFunction lsf = new LineSearchFunction(searchDirection);<a name="line.163"></a>
+<FONT color="green">164</FONT>                    final double step = solver.solve(lsf, 0, findUpperBound(lsf, 0, initialStep));<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>                    // validate new point<a name="line.166"></a>
+<FONT color="green">167</FONT>                    for (int i = 0; i &lt; point.length; ++i) {<a name="line.167"></a>
+<FONT color="green">168</FONT>                        point[i] += step * searchDirection[i];<a name="line.168"></a>
+<FONT color="green">169</FONT>                    }<a name="line.169"></a>
+<FONT color="green">170</FONT>                    r = computeObjectiveGradient(point);<a name="line.170"></a>
+<FONT color="green">171</FONT>                    if (goal == GoalType.MINIMIZE) {<a name="line.171"></a>
+<FONT color="green">172</FONT>                        for (int i = 0; i &lt; n; ++i) {<a name="line.172"></a>
+<FONT color="green">173</FONT>                            r[i] = -r[i];<a name="line.173"></a>
+<FONT color="green">174</FONT>                        }<a name="line.174"></a>
+<FONT color="green">175</FONT>                    }<a name="line.175"></a>
+<FONT color="green">176</FONT>    <a name="line.176"></a>
+<FONT color="green">177</FONT>                    // compute beta<a name="line.177"></a>
+<FONT color="green">178</FONT>                    final double deltaOld = delta;<a name="line.178"></a>
+<FONT color="green">179</FONT>                    final double[] newSteepestDescent = preconditioner.precondition(point, r);<a name="line.179"></a>
+<FONT color="green">180</FONT>                    delta = 0;<a name="line.180"></a>
+<FONT color="green">181</FONT>                    for (int i = 0; i &lt; n; ++i) {<a name="line.181"></a>
+<FONT color="green">182</FONT>                        delta += r[i] * newSteepestDescent[i];<a name="line.182"></a>
+<FONT color="green">183</FONT>                    }<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>                    final double beta;<a name="line.185"></a>
+<FONT color="green">186</FONT>                    if (updateFormula == ConjugateGradientFormula.FLETCHER_REEVES) {<a name="line.186"></a>
+<FONT color="green">187</FONT>                        beta = delta / deltaOld;<a name="line.187"></a>
+<FONT color="green">188</FONT>                    } else {<a name="line.188"></a>
+<FONT color="green">189</FONT>                        double deltaMid = 0;<a name="line.189"></a>
+<FONT color="green">190</FONT>                        for (int i = 0; i &lt; r.length; ++i) {<a name="line.190"></a>
+<FONT color="green">191</FONT>                            deltaMid += r[i] * steepestDescent[i];<a name="line.191"></a>
+<FONT color="green">192</FONT>                        }<a name="line.192"></a>
+<FONT color="green">193</FONT>                        beta = (delta - deltaMid) / deltaOld;<a name="line.193"></a>
+<FONT color="green">194</FONT>                    }<a name="line.194"></a>
+<FONT color="green">195</FONT>                    steepestDescent = newSteepestDescent;<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>                    // compute conjugate search direction<a name="line.197"></a>
+<FONT color="green">198</FONT>                    if ((getIterations() % n == 0) || (beta &lt; 0)) {<a name="line.198"></a>
+<FONT color="green">199</FONT>                        // break conjugation: reset search direction<a name="line.199"></a>
+<FONT color="green">200</FONT>                        searchDirection = steepestDescent.clone();<a name="line.200"></a>
+<FONT color="green">201</FONT>                    } else {<a name="line.201"></a>
+<FONT color="green">202</FONT>                        // compute new conjugate search direction<a name="line.202"></a>
+<FONT color="green">203</FONT>                        for (int i = 0; i &lt; n; ++i) {<a name="line.203"></a>
+<FONT color="green">204</FONT>                            searchDirection[i] = steepestDescent[i] + beta * searchDirection[i];<a name="line.204"></a>
+<FONT color="green">205</FONT>                        }<a name="line.205"></a>
+<FONT color="green">206</FONT>                    }<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>                }<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>            } catch (ConvergenceException ce) {<a name="line.210"></a>
+<FONT color="green">211</FONT>                throw new OptimizationException(ce);<a name="line.211"></a>
+<FONT color="green">212</FONT>            }<a name="line.212"></a>
+<FONT color="green">213</FONT>        }<a name="line.213"></a>
+<FONT color="green">214</FONT>    <a name="line.214"></a>
+<FONT color="green">215</FONT>        /**<a name="line.215"></a>
+<FONT color="green">216</FONT>         * Find the upper bound b ensuring bracketing of a root between a and b<a name="line.216"></a>
+<FONT color="green">217</FONT>         * @param f function whose root must be bracketed<a name="line.217"></a>
+<FONT color="green">218</FONT>         * @param a lower bound of the interval<a name="line.218"></a>
+<FONT color="green">219</FONT>         * @param h initial step to try<a name="line.219"></a>
+<FONT color="green">220</FONT>         * @return b such that f(a) and f(b) have opposite signs<a name="line.220"></a>
+<FONT color="green">221</FONT>         * @exception FunctionEvaluationException if the function cannot be computed<a name="line.221"></a>
+<FONT color="green">222</FONT>         * @exception OptimizationException if no bracket can be found<a name="line.222"></a>
+<FONT color="green">223</FONT>         */<a name="line.223"></a>
+<FONT color="green">224</FONT>        private double findUpperBound(final UnivariateRealFunction f,<a name="line.224"></a>
+<FONT color="green">225</FONT>                                      final double a, final double h)<a name="line.225"></a>
+<FONT color="green">226</FONT>            throws FunctionEvaluationException, OptimizationException {<a name="line.226"></a>
+<FONT color="green">227</FONT>            final double yA = f.value(a);<a name="line.227"></a>
+<FONT color="green">228</FONT>            double yB = yA;<a name="line.228"></a>
+<FONT color="green">229</FONT>            for (double step = h; step &lt; Double.MAX_VALUE; step *= Math.max(2, yA / yB)) {<a name="line.229"></a>
+<FONT color="green">230</FONT>                final double b = a + step;<a name="line.230"></a>
+<FONT color="green">231</FONT>                yB = f.value(b);<a name="line.231"></a>
+<FONT color="green">232</FONT>                if (yA * yB &lt;= 0) {<a name="line.232"></a>
+<FONT color="green">233</FONT>                    return b;<a name="line.233"></a>
+<FONT color="green">234</FONT>                }<a name="line.234"></a>
+<FONT color="green">235</FONT>            }<a name="line.235"></a>
+<FONT color="green">236</FONT>            throw new OptimizationException("unable to bracket optimum in line search");<a name="line.236"></a>
+<FONT color="green">237</FONT>        }<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>        /** Default identity preconditioner. */<a name="line.239"></a>
+<FONT color="green">240</FONT>        private static class IdentityPreconditioner implements Preconditioner {<a name="line.240"></a>
+<FONT color="green">241</FONT>    <a name="line.241"></a>
+<FONT color="green">242</FONT>            /** {@inheritDoc} */<a name="line.242"></a>
+<FONT color="green">243</FONT>            public double[] precondition(double[] variables, double[] r) {<a name="line.243"></a>
+<FONT color="green">244</FONT>                return r.clone();<a name="line.244"></a>
+<FONT color="green">245</FONT>            }<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>        }<a name="line.247"></a>
+<FONT color="green">248</FONT>    <a name="line.248"></a>
+<FONT color="green">249</FONT>        /** Internal class for line search.<a name="line.249"></a>
+<FONT color="green">250</FONT>         * &lt;p&gt;<a name="line.250"></a>
+<FONT color="green">251</FONT>         * The function represented by this class is the dot product of<a name="line.251"></a>
+<FONT color="green">252</FONT>         * the objective function gradient and the search direction. Its<a name="line.252"></a>
+<FONT color="green">253</FONT>         * value is zero when the gradient is orthogonal to the search<a name="line.253"></a>
+<FONT color="green">254</FONT>         * direction, i.e. when the objective function value is a local<a name="line.254"></a>
+<FONT color="green">255</FONT>         * extremum along the search direction.<a name="line.255"></a>
+<FONT color="green">256</FONT>         * &lt;/p&gt;<a name="line.256"></a>
+<FONT color="green">257</FONT>         */<a name="line.257"></a>
+<FONT color="green">258</FONT>        private class LineSearchFunction implements UnivariateRealFunction {<a name="line.258"></a>
+<FONT color="green">259</FONT>            /** Search direction. */<a name="line.259"></a>
+<FONT color="green">260</FONT>            private final double[] searchDirection;<a name="line.260"></a>
+<FONT color="green">261</FONT>    <a name="line.261"></a>
+<FONT color="green">262</FONT>            /** Simple constructor.<a name="line.262"></a>
+<FONT color="green">263</FONT>             * @param searchDirection search direction<a name="line.263"></a>
+<FONT color="green">264</FONT>             */<a name="line.264"></a>
+<FONT color="green">265</FONT>            public LineSearchFunction(final double[] searchDirection) {<a name="line.265"></a>
+<FONT color="green">266</FONT>                this.searchDirection = searchDirection;<a name="line.266"></a>
+<FONT color="green">267</FONT>            }<a name="line.267"></a>
+<FONT color="green">268</FONT>    <a name="line.268"></a>
+<FONT color="green">269</FONT>            /** {@inheritDoc} */<a name="line.269"></a>
+<FONT color="green">270</FONT>            public double value(double x) throws FunctionEvaluationException {<a name="line.270"></a>
+<FONT color="green">271</FONT>    <a name="line.271"></a>
+<FONT color="green">272</FONT>                // current point in the search direction<a name="line.272"></a>
+<FONT color="green">273</FONT>                final double[] shiftedPoint = point.clone();<a name="line.273"></a>
+<FONT color="green">274</FONT>                for (int i = 0; i &lt; shiftedPoint.length; ++i) {<a name="line.274"></a>
+<FONT color="green">275</FONT>                    shiftedPoint[i] += x * searchDirection[i];<a name="line.275"></a>
+<FONT color="green">276</FONT>                }<a name="line.276"></a>
+<FONT color="green">277</FONT>    <a name="line.277"></a>
+<FONT color="green">278</FONT>                // gradient of the objective function<a name="line.278"></a>
+<FONT color="green">279</FONT>                final double[] gradient = computeObjectiveGradient(shiftedPoint);<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>                // dot product with the search direction<a name="line.281"></a>
+<FONT color="green">282</FONT>                double dotProduct = 0;<a name="line.282"></a>
+<FONT color="green">283</FONT>                for (int i = 0; i &lt; gradient.length; ++i) {<a name="line.283"></a>
+<FONT color="green">284</FONT>                    dotProduct += gradient[i] * searchDirection[i];<a name="line.284"></a>
+<FONT color="green">285</FONT>                }<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>                return dotProduct;<a name="line.287"></a>
+<FONT color="green">288</FONT>    <a name="line.288"></a>
+<FONT color="green">289</FONT>            }<a name="line.289"></a>
+<FONT color="green">290</FONT>    <a name="line.290"></a>
+<FONT color="green">291</FONT>        }<a name="line.291"></a>
+<FONT color="green">292</FONT>    <a name="line.292"></a>
+<FONT color="green">293</FONT>    }<a name="line.293"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/general/Preconditioner.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,118 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.general;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This interface represents a preconditioner for differentiable scalar<a name="line.23"></a>
+<FONT color="green">024</FONT>     * objective function optimizers.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 2.0<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public interface Preconditioner {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /**<a name="line.30"></a>
+<FONT color="green">031</FONT>         * Precondition a search direction.<a name="line.31"></a>
+<FONT color="green">032</FONT>         * &lt;p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>         * The returned preconditioned search direction must be computed fast or<a name="line.33"></a>
+<FONT color="green">034</FONT>         * the algorithm performances will drop drastically. A classical approach<a name="line.34"></a>
+<FONT color="green">035</FONT>         * is to compute only the diagonal elements of the hessian and to divide<a name="line.35"></a>
+<FONT color="green">036</FONT>         * the raw search direction by these elements if they are all positive.<a name="line.36"></a>
+<FONT color="green">037</FONT>         * If at least one of them is negative, it is safer to return a clone of<a name="line.37"></a>
+<FONT color="green">038</FONT>         * the raw search direction as if the hessian was the identity matrix. The<a name="line.38"></a>
+<FONT color="green">039</FONT>         * rationale for this simplified choice is that a negative diagonal element<a name="line.39"></a>
+<FONT color="green">040</FONT>         * means the current point is far from the optimum and preconditioning will<a name="line.40"></a>
+<FONT color="green">041</FONT>         * not be efficient anyway in this case.<a name="line.41"></a>
+<FONT color="green">042</FONT>         * &lt;/p&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @param point current point at which the search direction was computed<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @param r raw search direction (i.e. opposite of the gradient)<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @return approximation of H&lt;sup&gt;-1&lt;/sup&gt;r where H is the objective function hessian<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @exception FunctionEvaluationException if no cost can be computed for the parameters<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @exception IllegalArgumentException if point dimension is wrong<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        double[] precondition(double[] point, double[] r)<a name="line.49"></a>
+<FONT color="green">050</FONT>            throws FunctionEvaluationException, IllegalArgumentException;<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>    }<a name="line.52"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/linear/AbstractLinearOptimizer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,196 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Collection;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.optimization.GoalType;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.optimization.OptimizationException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.optimization.RealPointValuePair;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    /**<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Base class for implementing linear optimizers.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;This base class handles the boilerplate methods associated to thresholds<a name="line.29"></a>
+<FONT color="green">030</FONT>     * settings and iterations counters.&lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 2.0<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     */<a name="line.34"></a>
+<FONT color="green">035</FONT>    public abstract class AbstractLinearOptimizer implements LinearOptimizer {<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /** Default maximal number of iterations allowed. */<a name="line.37"></a>
+<FONT color="green">038</FONT>        public static final int DEFAULT_MAX_ITERATIONS = 100;<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /**<a name="line.40"></a>
+<FONT color="green">041</FONT>         * Linear objective function.<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @since 2.1<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        protected LinearObjectiveFunction function;<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /**<a name="line.46"></a>
+<FONT color="green">047</FONT>         * Linear constraints.<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @since 2.1<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        protected Collection&lt;LinearConstraint&gt; linearConstraints;<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * Type of optimization goal: either {@link GoalType#MAXIMIZE} or {@link GoalType#MINIMIZE}.<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @since 2.1<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        protected GoalType goal;<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /**<a name="line.58"></a>
+<FONT color="green">059</FONT>         * Whether to restrict the variables to non-negative values.<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @since 2.1<a name="line.60"></a>
+<FONT color="green">061</FONT>         */<a name="line.61"></a>
+<FONT color="green">062</FONT>        protected boolean nonNegative;<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /** Maximal number of iterations allowed. */<a name="line.64"></a>
+<FONT color="green">065</FONT>        private int maxIterations;<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /** Number of iterations already performed. */<a name="line.67"></a>
+<FONT color="green">068</FONT>        private int iterations;<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /** Simple constructor with default settings.<a name="line.70"></a>
+<FONT color="green">071</FONT>         * &lt;p&gt;The maximal number of evaluation is set to its default value.&lt;/p&gt;<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        protected AbstractLinearOptimizer() {<a name="line.73"></a>
+<FONT color="green">074</FONT>            setMaxIterations(DEFAULT_MAX_ITERATIONS);<a name="line.74"></a>
+<FONT color="green">075</FONT>        }<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** {@inheritDoc} */<a name="line.77"></a>
+<FONT color="green">078</FONT>        public void setMaxIterations(int maxIterations) {<a name="line.78"></a>
+<FONT color="green">079</FONT>            this.maxIterations = maxIterations;<a name="line.79"></a>
+<FONT color="green">080</FONT>        }<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>        /** {@inheritDoc} */<a name="line.82"></a>
+<FONT color="green">083</FONT>        public int getMaxIterations() {<a name="line.83"></a>
+<FONT color="green">084</FONT>            return maxIterations;<a name="line.84"></a>
+<FONT color="green">085</FONT>        }<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>        /** {@inheritDoc} */<a name="line.87"></a>
+<FONT color="green">088</FONT>        public int getIterations() {<a name="line.88"></a>
+<FONT color="green">089</FONT>            return iterations;<a name="line.89"></a>
+<FONT color="green">090</FONT>        }<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /** Increment the iterations counter by 1.<a name="line.92"></a>
+<FONT color="green">093</FONT>         * @exception OptimizationException if the maximal number<a name="line.93"></a>
+<FONT color="green">094</FONT>         * of iterations is exceeded<a name="line.94"></a>
+<FONT color="green">095</FONT>         */<a name="line.95"></a>
+<FONT color="green">096</FONT>        protected void incrementIterationsCounter()<a name="line.96"></a>
+<FONT color="green">097</FONT>            throws OptimizationException {<a name="line.97"></a>
+<FONT color="green">098</FONT>            if (++iterations &gt; maxIterations) {<a name="line.98"></a>
+<FONT color="green">099</FONT>                throw new OptimizationException(new MaxIterationsExceededException(maxIterations));<a name="line.99"></a>
+<FONT color="green">100</FONT>            }<a name="line.100"></a>
+<FONT color="green">101</FONT>        }<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        /** {@inheritDoc} */<a name="line.103"></a>
+<FONT color="green">104</FONT>        public RealPointValuePair optimize(final LinearObjectiveFunction f,<a name="line.104"></a>
+<FONT color="green">105</FONT>                                           final Collection&lt;LinearConstraint&gt; constraints,<a name="line.105"></a>
+<FONT color="green">106</FONT>                                           final GoalType goalType, final boolean restrictToNonNegative)<a name="line.106"></a>
+<FONT color="green">107</FONT>             throws OptimizationException {<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>            // store linear problem characteristics<a name="line.109"></a>
+<FONT color="green">110</FONT>            this.function          = f;<a name="line.110"></a>
+<FONT color="green">111</FONT>            this.linearConstraints = constraints;<a name="line.111"></a>
+<FONT color="green">112</FONT>            this.goal              = goalType;<a name="line.112"></a>
+<FONT color="green">113</FONT>            this.nonNegative       = restrictToNonNegative;<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>            iterations  = 0;<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>            // solve the problem<a name="line.117"></a>
+<FONT color="green">118</FONT>            return doOptimize();<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        }<a name="line.120"></a>
+<FONT color="green">121</FONT>    <a name="line.121"></a>
+<FONT color="green">122</FONT>        /** Perform the bulk of optimization algorithm.<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @return the point/value pair giving the optimal value for objective function<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @exception OptimizationException if no solution fulfilling the constraints<a name="line.124"></a>
+<FONT color="green">125</FONT>         * can be found in the allowed number of iterations<a name="line.125"></a>
+<FONT color="green">126</FONT>         */<a name="line.126"></a>
+<FONT color="green">127</FONT>        protected abstract RealPointValuePair doOptimize()<a name="line.127"></a>
+<FONT color="green">128</FONT>            throws OptimizationException;<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>    }<a name="line.130"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/linear/LinearConstraint.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,299 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.IOException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.io.ObjectInputStream;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.io.ObjectOutputStream;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.io.Serializable;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.linear.MatrixUtils;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.linear.RealVector;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.linear.ArrayRealVector;<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>    /**<a name="line.30"></a>
+<FONT color="green">031</FONT>     * A linear constraint for a linear optimization problem.<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * A linear constraint has one of the forms:<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;ul&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     *   &lt;li&gt;c&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... c&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; = v&lt;/li&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     *   &lt;li&gt;c&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... c&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; &amp;lt;= v&lt;/li&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *   &lt;li&gt;c&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... c&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; &gt;= v&lt;/li&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     *   &lt;li&gt;l&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... l&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + l&lt;sub&gt;cst&lt;/sub&gt; =<a name="line.38"></a>
+<FONT color="green">039</FONT>     *       r&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... r&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + r&lt;sub&gt;cst&lt;/sub&gt;&lt;/li&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     *   &lt;li&gt;l&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... l&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + l&lt;sub&gt;cst&lt;/sub&gt; &amp;lt;=<a name="line.40"></a>
+<FONT color="green">041</FONT>     *       r&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... r&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + r&lt;sub&gt;cst&lt;/sub&gt;&lt;/li&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     *   &lt;li&gt;l&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... l&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + l&lt;sub&gt;cst&lt;/sub&gt; &gt;=<a name="line.42"></a>
+<FONT color="green">043</FONT>     *       r&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... r&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + r&lt;sub&gt;cst&lt;/sub&gt;&lt;/li&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;/ul&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     * The c&lt;sub&gt;i&lt;/sub&gt;, l&lt;sub&gt;i&lt;/sub&gt; or r&lt;sub&gt;i&lt;/sub&gt; are the coefficients of the constraints, the x&lt;sub&gt;i&lt;/sub&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     * are the coordinates of the current point and v is the value of the constraint.<a name="line.46"></a>
+<FONT color="green">047</FONT>     * &lt;/p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     * @version $Revision: 922713 $ $Date: 2010-03-13 20:26:13 -0500 (Sat, 13 Mar 2010) $<a name="line.48"></a>
+<FONT color="green">049</FONT>     * @since 2.0<a name="line.49"></a>
+<FONT color="green">050</FONT>     */<a name="line.50"></a>
+<FONT color="green">051</FONT>    public class LinearConstraint implements Serializable {<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** Serializable version identifier. */<a name="line.53"></a>
+<FONT color="green">054</FONT>        private static final long serialVersionUID = -764632794033034092L;<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** Coefficients of the constraint (left hand side). */<a name="line.56"></a>
+<FONT color="green">057</FONT>        private final transient RealVector coefficients;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** Relationship between left and right hand sides (=, &amp;lt;=, &gt;=). */<a name="line.59"></a>
+<FONT color="green">060</FONT>        private final Relationship relationship;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** Value of the constraint (right hand side). */<a name="line.62"></a>
+<FONT color="green">063</FONT>        private final double value;<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /**<a name="line.65"></a>
+<FONT color="green">066</FONT>         * Build a constraint involving a single linear equation.<a name="line.66"></a>
+<FONT color="green">067</FONT>         * &lt;p&gt;<a name="line.67"></a>
+<FONT color="green">068</FONT>         * A linear constraint with a single linear equation has one of the forms:<a name="line.68"></a>
+<FONT color="green">069</FONT>         * &lt;ul&gt;<a name="line.69"></a>
+<FONT color="green">070</FONT>         *   &lt;li&gt;c&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... c&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; = v&lt;/li&gt;<a name="line.70"></a>
+<FONT color="green">071</FONT>         *   &lt;li&gt;c&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... c&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; &amp;lt;= v&lt;/li&gt;<a name="line.71"></a>
+<FONT color="green">072</FONT>         *   &lt;li&gt;c&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... c&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; &gt;= v&lt;/li&gt;<a name="line.72"></a>
+<FONT color="green">073</FONT>         * &lt;/ul&gt;<a name="line.73"></a>
+<FONT color="green">074</FONT>         * &lt;/p&gt;<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @param coefficients The coefficients of the constraint (left hand side)<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @param relationship The type of (in)equality used in the constraint<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @param value The value of the constraint (right hand side)<a name="line.77"></a>
+<FONT color="green">078</FONT>         */<a name="line.78"></a>
+<FONT color="green">079</FONT>        public LinearConstraint(final double[] coefficients, final Relationship relationship,<a name="line.79"></a>
+<FONT color="green">080</FONT>                                final double value) {<a name="line.80"></a>
+<FONT color="green">081</FONT>            this(new ArrayRealVector(coefficients), relationship, value);<a name="line.81"></a>
+<FONT color="green">082</FONT>        }<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /**<a name="line.84"></a>
+<FONT color="green">085</FONT>         * Build a constraint involving a single linear equation.<a name="line.85"></a>
+<FONT color="green">086</FONT>         * &lt;p&gt;<a name="line.86"></a>
+<FONT color="green">087</FONT>         * A linear constraint with a single linear equation has one of the forms:<a name="line.87"></a>
+<FONT color="green">088</FONT>         * &lt;ul&gt;<a name="line.88"></a>
+<FONT color="green">089</FONT>         *   &lt;li&gt;c&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... c&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; = v&lt;/li&gt;<a name="line.89"></a>
+<FONT color="green">090</FONT>         *   &lt;li&gt;c&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... c&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; &amp;lt;= v&lt;/li&gt;<a name="line.90"></a>
+<FONT color="green">091</FONT>         *   &lt;li&gt;c&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... c&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; &gt;= v&lt;/li&gt;<a name="line.91"></a>
+<FONT color="green">092</FONT>         * &lt;/ul&gt;<a name="line.92"></a>
+<FONT color="green">093</FONT>         * &lt;/p&gt;<a name="line.93"></a>
+<FONT color="green">094</FONT>         * @param coefficients The coefficients of the constraint (left hand side)<a name="line.94"></a>
+<FONT color="green">095</FONT>         * @param relationship The type of (in)equality used in the constraint<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @param value The value of the constraint (right hand side)<a name="line.96"></a>
+<FONT color="green">097</FONT>         */<a name="line.97"></a>
+<FONT color="green">098</FONT>        public LinearConstraint(final RealVector coefficients, final Relationship relationship,<a name="line.98"></a>
+<FONT color="green">099</FONT>                                final double value) {<a name="line.99"></a>
+<FONT color="green">100</FONT>            this.coefficients = coefficients;<a name="line.100"></a>
+<FONT color="green">101</FONT>            this.relationship = relationship;<a name="line.101"></a>
+<FONT color="green">102</FONT>            this.value        = value;<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /**<a name="line.105"></a>
+<FONT color="green">106</FONT>         * Build a constraint involving two linear equations.<a name="line.106"></a>
+<FONT color="green">107</FONT>         * &lt;p&gt;<a name="line.107"></a>
+<FONT color="green">108</FONT>         * A linear constraint with two linear equation has one of the forms:<a name="line.108"></a>
+<FONT color="green">109</FONT>         * &lt;ul&gt;<a name="line.109"></a>
+<FONT color="green">110</FONT>         *   &lt;li&gt;l&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... l&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + l&lt;sub&gt;cst&lt;/sub&gt; =<a name="line.110"></a>
+<FONT color="green">111</FONT>         *       r&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... r&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + r&lt;sub&gt;cst&lt;/sub&gt;&lt;/li&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>         *   &lt;li&gt;l&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... l&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + l&lt;sub&gt;cst&lt;/sub&gt; &amp;lt;=<a name="line.112"></a>
+<FONT color="green">113</FONT>         *       r&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... r&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + r&lt;sub&gt;cst&lt;/sub&gt;&lt;/li&gt;<a name="line.113"></a>
+<FONT color="green">114</FONT>         *   &lt;li&gt;l&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... l&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + l&lt;sub&gt;cst&lt;/sub&gt; &gt;=<a name="line.114"></a>
+<FONT color="green">115</FONT>         *       r&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... r&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + r&lt;sub&gt;cst&lt;/sub&gt;&lt;/li&gt;<a name="line.115"></a>
+<FONT color="green">116</FONT>         * &lt;/ul&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * &lt;/p&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @param lhsCoefficients The coefficients of the linear expression on the left hand side of the constraint<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @param lhsConstant The constant term of the linear expression on the left hand side of the constraint<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @param relationship The type of (in)equality used in the constraint<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @param rhsCoefficients The coefficients of the linear expression on the right hand side of the constraint<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @param rhsConstant The constant term of the linear expression on the right hand side of the constraint<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        public LinearConstraint(final double[] lhsCoefficients, final double lhsConstant,<a name="line.124"></a>
+<FONT color="green">125</FONT>                                final Relationship relationship,<a name="line.125"></a>
+<FONT color="green">126</FONT>                                final double[] rhsCoefficients, final double rhsConstant) {<a name="line.126"></a>
+<FONT color="green">127</FONT>            double[] sub = new double[lhsCoefficients.length];<a name="line.127"></a>
+<FONT color="green">128</FONT>            for (int i = 0; i &lt; sub.length; ++i) {<a name="line.128"></a>
+<FONT color="green">129</FONT>                sub[i] = lhsCoefficients[i] - rhsCoefficients[i];<a name="line.129"></a>
+<FONT color="green">130</FONT>            }<a name="line.130"></a>
+<FONT color="green">131</FONT>            this.coefficients = new ArrayRealVector(sub, false);<a name="line.131"></a>
+<FONT color="green">132</FONT>            this.relationship = relationship;<a name="line.132"></a>
+<FONT color="green">133</FONT>            this.value        = rhsConstant - lhsConstant;<a name="line.133"></a>
+<FONT color="green">134</FONT>        }<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>        /**<a name="line.136"></a>
+<FONT color="green">137</FONT>         * Build a constraint involving two linear equations.<a name="line.137"></a>
+<FONT color="green">138</FONT>         * &lt;p&gt;<a name="line.138"></a>
+<FONT color="green">139</FONT>         * A linear constraint with two linear equation has one of the forms:<a name="line.139"></a>
+<FONT color="green">140</FONT>         * &lt;ul&gt;<a name="line.140"></a>
+<FONT color="green">141</FONT>         *   &lt;li&gt;l&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... l&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + l&lt;sub&gt;cst&lt;/sub&gt; =<a name="line.141"></a>
+<FONT color="green">142</FONT>         *       r&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... r&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + r&lt;sub&gt;cst&lt;/sub&gt;&lt;/li&gt;<a name="line.142"></a>
+<FONT color="green">143</FONT>         *   &lt;li&gt;l&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... l&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + l&lt;sub&gt;cst&lt;/sub&gt; &amp;lt;=<a name="line.143"></a>
+<FONT color="green">144</FONT>         *       r&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... r&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + r&lt;sub&gt;cst&lt;/sub&gt;&lt;/li&gt;<a name="line.144"></a>
+<FONT color="green">145</FONT>         *   &lt;li&gt;l&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... l&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + l&lt;sub&gt;cst&lt;/sub&gt; &gt;=<a name="line.145"></a>
+<FONT color="green">146</FONT>         *       r&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... r&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + r&lt;sub&gt;cst&lt;/sub&gt;&lt;/li&gt;<a name="line.146"></a>
+<FONT color="green">147</FONT>         * &lt;/ul&gt;<a name="line.147"></a>
+<FONT color="green">148</FONT>         * &lt;/p&gt;<a name="line.148"></a>
+<FONT color="green">149</FONT>         * @param lhsCoefficients The coefficients of the linear expression on the left hand side of the constraint<a name="line.149"></a>
+<FONT color="green">150</FONT>         * @param lhsConstant The constant term of the linear expression on the left hand side of the constraint<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @param relationship The type of (in)equality used in the constraint<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @param rhsCoefficients The coefficients of the linear expression on the right hand side of the constraint<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @param rhsConstant The constant term of the linear expression on the right hand side of the constraint<a name="line.153"></a>
+<FONT color="green">154</FONT>         */<a name="line.154"></a>
+<FONT color="green">155</FONT>        public LinearConstraint(final RealVector lhsCoefficients, final double lhsConstant,<a name="line.155"></a>
+<FONT color="green">156</FONT>                                final Relationship relationship,<a name="line.156"></a>
+<FONT color="green">157</FONT>                                final RealVector rhsCoefficients, final double rhsConstant) {<a name="line.157"></a>
+<FONT color="green">158</FONT>            this.coefficients = lhsCoefficients.subtract(rhsCoefficients);<a name="line.158"></a>
+<FONT color="green">159</FONT>            this.relationship = relationship;<a name="line.159"></a>
+<FONT color="green">160</FONT>            this.value        = rhsConstant - lhsConstant;<a name="line.160"></a>
+<FONT color="green">161</FONT>        }<a name="line.161"></a>
+<FONT color="green">162</FONT>    <a name="line.162"></a>
+<FONT color="green">163</FONT>        /**<a name="line.163"></a>
+<FONT color="green">164</FONT>         * Get the coefficients of the constraint (left hand side).<a name="line.164"></a>
+<FONT color="green">165</FONT>         * @return coefficients of the constraint (left hand side)<a name="line.165"></a>
+<FONT color="green">166</FONT>         */<a name="line.166"></a>
+<FONT color="green">167</FONT>        public RealVector getCoefficients() {<a name="line.167"></a>
+<FONT color="green">168</FONT>            return coefficients;<a name="line.168"></a>
+<FONT color="green">169</FONT>        }<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>        /**<a name="line.171"></a>
+<FONT color="green">172</FONT>         * Get the relationship between left and right hand sides.<a name="line.172"></a>
+<FONT color="green">173</FONT>         * @return relationship between left and right hand sides<a name="line.173"></a>
+<FONT color="green">174</FONT>         */<a name="line.174"></a>
+<FONT color="green">175</FONT>        public Relationship getRelationship() {<a name="line.175"></a>
+<FONT color="green">176</FONT>            return relationship;<a name="line.176"></a>
+<FONT color="green">177</FONT>        }<a name="line.177"></a>
+<FONT color="green">178</FONT>    <a name="line.178"></a>
+<FONT color="green">179</FONT>        /**<a name="line.179"></a>
+<FONT color="green">180</FONT>         * Get the value of the constraint (right hand side).<a name="line.180"></a>
+<FONT color="green">181</FONT>         * @return value of the constraint (right hand side)<a name="line.181"></a>
+<FONT color="green">182</FONT>         */<a name="line.182"></a>
+<FONT color="green">183</FONT>        public double getValue() {<a name="line.183"></a>
+<FONT color="green">184</FONT>            return value;<a name="line.184"></a>
+<FONT color="green">185</FONT>        }<a name="line.185"></a>
+<FONT color="green">186</FONT>    <a name="line.186"></a>
+<FONT color="green">187</FONT>        /** {@inheritDoc} */<a name="line.187"></a>
+<FONT color="green">188</FONT>        @Override<a name="line.188"></a>
+<FONT color="green">189</FONT>        public boolean equals(Object other) {<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>          if (this == other) {<a name="line.191"></a>
+<FONT color="green">192</FONT>            return true;<a name="line.192"></a>
+<FONT color="green">193</FONT>          }<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>          if (other instanceof LinearConstraint) {<a name="line.195"></a>
+<FONT color="green">196</FONT>              LinearConstraint rhs = (LinearConstraint) other;<a name="line.196"></a>
+<FONT color="green">197</FONT>              return (relationship == rhs.relationship) &amp;&amp;<a name="line.197"></a>
+<FONT color="green">198</FONT>                     (value        == rhs.value) &amp;&amp;<a name="line.198"></a>
+<FONT color="green">199</FONT>                     coefficients.equals(rhs.coefficients);<a name="line.199"></a>
+<FONT color="green">200</FONT>          }<a name="line.200"></a>
+<FONT color="green">201</FONT>          return false;<a name="line.201"></a>
+<FONT color="green">202</FONT>        }<a name="line.202"></a>
+<FONT color="green">203</FONT>    <a name="line.203"></a>
+<FONT color="green">204</FONT>        /** {@inheritDoc} */<a name="line.204"></a>
+<FONT color="green">205</FONT>        @Override<a name="line.205"></a>
+<FONT color="green">206</FONT>        public int hashCode() {<a name="line.206"></a>
+<FONT color="green">207</FONT>            return relationship.hashCode() ^<a name="line.207"></a>
+<FONT color="green">208</FONT>                   Double.valueOf(value).hashCode() ^<a name="line.208"></a>
+<FONT color="green">209</FONT>                   coefficients.hashCode();<a name="line.209"></a>
+<FONT color="green">210</FONT>        }<a name="line.210"></a>
+<FONT color="green">211</FONT>    <a name="line.211"></a>
+<FONT color="green">212</FONT>        /** Serialize the instance.<a name="line.212"></a>
+<FONT color="green">213</FONT>         * @param oos stream where object should be written<a name="line.213"></a>
+<FONT color="green">214</FONT>         * @throws IOException if object cannot be written to stream<a name="line.214"></a>
+<FONT color="green">215</FONT>         */<a name="line.215"></a>
+<FONT color="green">216</FONT>        private void writeObject(ObjectOutputStream oos)<a name="line.216"></a>
+<FONT color="green">217</FONT>            throws IOException {<a name="line.217"></a>
+<FONT color="green">218</FONT>            oos.defaultWriteObject();<a name="line.218"></a>
+<FONT color="green">219</FONT>            MatrixUtils.serializeRealVector(coefficients, oos);<a name="line.219"></a>
+<FONT color="green">220</FONT>        }<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>        /** Deserialize the instance.<a name="line.222"></a>
+<FONT color="green">223</FONT>         * @param ois stream from which the object should be read<a name="line.223"></a>
+<FONT color="green">224</FONT>         * @throws ClassNotFoundException if a class in the stream cannot be found<a name="line.224"></a>
+<FONT color="green">225</FONT>         * @throws IOException if object cannot be read from the stream<a name="line.225"></a>
+<FONT color="green">226</FONT>         */<a name="line.226"></a>
+<FONT color="green">227</FONT>        private void readObject(ObjectInputStream ois)<a name="line.227"></a>
+<FONT color="green">228</FONT>          throws ClassNotFoundException, IOException {<a name="line.228"></a>
+<FONT color="green">229</FONT>            ois.defaultReadObject();<a name="line.229"></a>
+<FONT color="green">230</FONT>            MatrixUtils.deserializeRealVector(this, "coefficients", ois);<a name="line.230"></a>
+<FONT color="green">231</FONT>        }<a name="line.231"></a>
+<FONT color="green">232</FONT>    <a name="line.232"></a>
+<FONT color="green">233</FONT>    }<a name="line.233"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/linear/LinearObjectiveFunction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,213 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.IOException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.io.ObjectInputStream;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.io.ObjectOutputStream;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.io.Serializable;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.linear.MatrixUtils;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.linear.RealVector;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.linear.ArrayRealVector;<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>    /**<a name="line.29"></a>
+<FONT color="green">030</FONT>     * An objective function for a linear optimization problem.<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * A linear objective function has one the form:<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;pre&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * c&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... c&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + d<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;/pre&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * The c&lt;sub&gt;i&lt;/sub&gt; and d are the coefficients of the equation,<a name="line.36"></a>
+<FONT color="green">037</FONT>     * the x&lt;sub&gt;i&lt;/sub&gt; are the coordinates of the current point.<a name="line.37"></a>
+<FONT color="green">038</FONT>     * &lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @version $Revision: 922713 $ $Date: 2010-03-13 20:26:13 -0500 (Sat, 13 Mar 2010) $<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @since 2.0<a name="line.40"></a>
+<FONT color="green">041</FONT>     */<a name="line.41"></a>
+<FONT color="green">042</FONT>    public class LinearObjectiveFunction implements Serializable {<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Serializable version identifier. */<a name="line.44"></a>
+<FONT color="green">045</FONT>        private static final long serialVersionUID = -4531815507568396090L;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** Coefficients of the constraint (c&lt;sub&gt;i&lt;/sub&gt;). */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private final transient RealVector coefficients;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Constant term of the linear equation. */<a name="line.50"></a>
+<FONT color="green">051</FONT>        private final double constantTerm;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @param coefficients The coefficients for the linear equation being optimized<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param constantTerm The constant term of the linear equation<a name="line.55"></a>
+<FONT color="green">056</FONT>         */<a name="line.56"></a>
+<FONT color="green">057</FONT>        public LinearObjectiveFunction(double[] coefficients, double constantTerm) {<a name="line.57"></a>
+<FONT color="green">058</FONT>            this(new ArrayRealVector(coefficients), constantTerm);<a name="line.58"></a>
+<FONT color="green">059</FONT>        }<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param coefficients The coefficients for the linear equation being optimized<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @param constantTerm The constant term of the linear equation<a name="line.63"></a>
+<FONT color="green">064</FONT>         */<a name="line.64"></a>
+<FONT color="green">065</FONT>        public LinearObjectiveFunction(RealVector coefficients, double constantTerm) {<a name="line.65"></a>
+<FONT color="green">066</FONT>            this.coefficients = coefficients;<a name="line.66"></a>
+<FONT color="green">067</FONT>            this.constantTerm = constantTerm;<a name="line.67"></a>
+<FONT color="green">068</FONT>        }<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /**<a name="line.70"></a>
+<FONT color="green">071</FONT>         * Get the coefficients of the linear equation being optimized.<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @return coefficients of the linear equation being optimized<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        public RealVector getCoefficients() {<a name="line.74"></a>
+<FONT color="green">075</FONT>            return coefficients;<a name="line.75"></a>
+<FONT color="green">076</FONT>        }<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /**<a name="line.78"></a>
+<FONT color="green">079</FONT>         * Get the constant of the linear equation being optimized.<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @return constant of the linear equation being optimized<a name="line.80"></a>
+<FONT color="green">081</FONT>         */<a name="line.81"></a>
+<FONT color="green">082</FONT>        public double getConstantTerm() {<a name="line.82"></a>
+<FONT color="green">083</FONT>            return constantTerm;<a name="line.83"></a>
+<FONT color="green">084</FONT>        }<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /**<a name="line.86"></a>
+<FONT color="green">087</FONT>         * Compute the value of the linear equation at the current point<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @param point point at which linear equation must be evaluated<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @return value of the linear equation at the current point<a name="line.89"></a>
+<FONT color="green">090</FONT>         */<a name="line.90"></a>
+<FONT color="green">091</FONT>        public double getValue(final double[] point) {<a name="line.91"></a>
+<FONT color="green">092</FONT>            return coefficients.dotProduct(point) + constantTerm;<a name="line.92"></a>
+<FONT color="green">093</FONT>        }<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /**<a name="line.95"></a>
+<FONT color="green">096</FONT>         * Compute the value of the linear equation at the current point<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @param point point at which linear equation must be evaluated<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @return value of the linear equation at the current point<a name="line.98"></a>
+<FONT color="green">099</FONT>         */<a name="line.99"></a>
+<FONT color="green">100</FONT>        public double getValue(final RealVector point) {<a name="line.100"></a>
+<FONT color="green">101</FONT>            return coefficients.dotProduct(point) + constantTerm;<a name="line.101"></a>
+<FONT color="green">102</FONT>        }<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /** {@inheritDoc} */<a name="line.104"></a>
+<FONT color="green">105</FONT>        @Override<a name="line.105"></a>
+<FONT color="green">106</FONT>        public boolean equals(Object other) {<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>          if (this == other) {<a name="line.108"></a>
+<FONT color="green">109</FONT>            return true;<a name="line.109"></a>
+<FONT color="green">110</FONT>          }<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>          if (other instanceof LinearObjectiveFunction) {<a name="line.112"></a>
+<FONT color="green">113</FONT>              LinearObjectiveFunction rhs = (LinearObjectiveFunction) other;<a name="line.113"></a>
+<FONT color="green">114</FONT>              return (constantTerm == rhs.constantTerm) &amp;&amp; coefficients.equals(rhs.coefficients);<a name="line.114"></a>
+<FONT color="green">115</FONT>          }<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>          return false;<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /** {@inheritDoc} */<a name="line.120"></a>
+<FONT color="green">121</FONT>        @Override<a name="line.121"></a>
+<FONT color="green">122</FONT>        public int hashCode() {<a name="line.122"></a>
+<FONT color="green">123</FONT>            return Double.valueOf(constantTerm).hashCode() ^ coefficients.hashCode();<a name="line.123"></a>
+<FONT color="green">124</FONT>        }<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>        /** Serialize the instance.<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @param oos stream where object should be written<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @throws IOException if object cannot be written to stream<a name="line.128"></a>
+<FONT color="green">129</FONT>         */<a name="line.129"></a>
+<FONT color="green">130</FONT>        private void writeObject(ObjectOutputStream oos)<a name="line.130"></a>
+<FONT color="green">131</FONT>            throws IOException {<a name="line.131"></a>
+<FONT color="green">132</FONT>            oos.defaultWriteObject();<a name="line.132"></a>
+<FONT color="green">133</FONT>            MatrixUtils.serializeRealVector(coefficients, oos);<a name="line.133"></a>
+<FONT color="green">134</FONT>        }<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>        /** Deserialize the instance.<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @param ois stream from which the object should be read<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @throws ClassNotFoundException if a class in the stream cannot be found<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @throws IOException if object cannot be read from the stream<a name="line.139"></a>
+<FONT color="green">140</FONT>         */<a name="line.140"></a>
+<FONT color="green">141</FONT>        private void readObject(ObjectInputStream ois)<a name="line.141"></a>
+<FONT color="green">142</FONT>          throws ClassNotFoundException, IOException {<a name="line.142"></a>
+<FONT color="green">143</FONT>            ois.defaultReadObject();<a name="line.143"></a>
+<FONT color="green">144</FONT>            MatrixUtils.deserializeRealVector(this, "coefficients", ois);<a name="line.144"></a>
+<FONT color="green">145</FONT>        }<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>    }<a name="line.147"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/linear/LinearOptimizer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,155 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Collection;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.optimization.GoalType;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.optimization.OptimizationException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.optimization.RealPointValuePair;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * This interface represents an optimization algorithm for linear problems.<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;Optimization algorithms find the input point set that either {@link GoalType<a name="line.28"></a>
+<FONT color="green">029</FONT>     * maximize or minimize} an objective function. In the linear case the form of<a name="line.29"></a>
+<FONT color="green">030</FONT>     * the function is restricted to<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;pre&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * c&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... c&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; = v<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;/pre&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * and there may be linear constraints too, of one of the forms:<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;ul&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     *   &lt;li&gt;c&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... c&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; = v&lt;/li&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *   &lt;li&gt;c&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... c&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; &amp;lt;= v&lt;/li&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     *   &lt;li&gt;c&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... c&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; &gt;= v&lt;/li&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     *   &lt;li&gt;l&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... l&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + l&lt;sub&gt;cst&lt;/sub&gt; =<a name="line.39"></a>
+<FONT color="green">040</FONT>     *       r&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... r&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + r&lt;sub&gt;cst&lt;/sub&gt;&lt;/li&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     *   &lt;li&gt;l&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... l&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + l&lt;sub&gt;cst&lt;/sub&gt; &amp;lt;=<a name="line.41"></a>
+<FONT color="green">042</FONT>     *       r&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... r&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + r&lt;sub&gt;cst&lt;/sub&gt;&lt;/li&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     *   &lt;li&gt;l&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... l&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + l&lt;sub&gt;cst&lt;/sub&gt; &gt;=<a name="line.43"></a>
+<FONT color="green">044</FONT>     *       r&lt;sub&gt;1&lt;/sub&gt;x&lt;sub&gt;1&lt;/sub&gt; + ... r&lt;sub&gt;n&lt;/sub&gt;x&lt;sub&gt;n&lt;/sub&gt; + r&lt;sub&gt;cst&lt;/sub&gt;&lt;/li&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     * &lt;/ul&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     * where the c&lt;sub&gt;i&lt;/sub&gt;, l&lt;sub&gt;i&lt;/sub&gt; or r&lt;sub&gt;i&lt;/sub&gt; are the coefficients of<a name="line.46"></a>
+<FONT color="green">047</FONT>     * the constraints, the x&lt;sub&gt;i&lt;/sub&gt; are the coordinates of the current point and<a name="line.47"></a>
+<FONT color="green">048</FONT>     * v is the value of the constraint.<a name="line.48"></a>
+<FONT color="green">049</FONT>     * &lt;/p&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.50"></a>
+<FONT color="green">051</FONT>     * @since 2.0<a name="line.51"></a>
+<FONT color="green">052</FONT>     */<a name="line.52"></a>
+<FONT color="green">053</FONT>    public interface LinearOptimizer {<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** Set the maximal number of iterations of the algorithm.<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param maxIterations maximal number of function calls<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        void setMaxIterations(int maxIterations);<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Get the maximal number of iterations of the algorithm.<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @return maximal number of iterations<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        int getMaxIterations();<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Get the number of iterations realized by the algorithm.<a name="line.65"></a>
+<FONT color="green">066</FONT>         * &lt;p&gt;<a name="line.66"></a>
+<FONT color="green">067</FONT>         * The number of evaluations corresponds to the last call to the<a name="line.67"></a>
+<FONT color="green">068</FONT>         * {@link #optimize(LinearObjectiveFunction, Collection, GoalType, boolean) optimize}<a name="line.68"></a>
+<FONT color="green">069</FONT>         * method. It is 0 if the method has not been called yet.<a name="line.69"></a>
+<FONT color="green">070</FONT>         * &lt;/p&gt;<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @return number of iterations<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        int getIterations();<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /** Optimizes an objective function.<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @param f linear objective function<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @param constraints linear constraints<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @param goalType type of optimization goal: either {@link GoalType#MAXIMIZE}<a name="line.78"></a>
+<FONT color="green">079</FONT>         * or {@link GoalType#MINIMIZE}<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @param restrictToNonNegative whether to restrict the variables to non-negative values<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @return point/value pair giving the optimal value for objective function<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @exception OptimizationException if no solution fulfilling the constraints<a name="line.82"></a>
+<FONT color="green">083</FONT>         * can be found in the allowed number of iterations<a name="line.83"></a>
+<FONT color="green">084</FONT>         */<a name="line.84"></a>
+<FONT color="green">085</FONT>       RealPointValuePair optimize(LinearObjectiveFunction f, Collection&lt;LinearConstraint&gt; constraints,<a name="line.85"></a>
+<FONT color="green">086</FONT>                                   GoalType goalType, boolean restrictToNonNegative)<a name="line.86"></a>
+<FONT color="green">087</FONT>            throws OptimizationException;<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>    }<a name="line.89"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/linear/NoFeasibleSolutionException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,106 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.optimization.OptimizationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This class represents exceptions thrown by optimizers when no solution<a name="line.23"></a>
+<FONT color="green">024</FONT>     * fulfills the constraints.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 2.0<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public class NoFeasibleSolutionException extends OptimizationException {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /** Serializable version identifier. */<a name="line.30"></a>
+<FONT color="green">031</FONT>        private static final long serialVersionUID = -3044253632189082760L;<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /**<a name="line.33"></a>
+<FONT color="green">034</FONT>         * Simple constructor using a default message.<a name="line.34"></a>
+<FONT color="green">035</FONT>         */<a name="line.35"></a>
+<FONT color="green">036</FONT>        public NoFeasibleSolutionException() {<a name="line.36"></a>
+<FONT color="green">037</FONT>            super("no feasible solution");<a name="line.37"></a>
+<FONT color="green">038</FONT>        }<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>    }<a name="line.40"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/linear/Relationship.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,133 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Types of relationships between two cells in a Solver {@link LinearConstraint}.<a name="line.21"></a>
+<FONT color="green">022</FONT>     * @version $Revision: 758920 $ $Date: 2009-03-26 19:25:30 -0400 (Thu, 26 Mar 2009) $<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @since 2.0<a name="line.23"></a>
+<FONT color="green">024</FONT>     */<a name="line.24"></a>
+<FONT color="green">025</FONT>    public enum Relationship {<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>        /** Equality relationship. */<a name="line.27"></a>
+<FONT color="green">028</FONT>        EQ("="),<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /** Lesser than or equal relationship. */<a name="line.30"></a>
+<FONT color="green">031</FONT>        LEQ("&lt;="),<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** Greater than or equal relationship. */<a name="line.33"></a>
+<FONT color="green">034</FONT>        GEQ("&gt;=");<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Display string for the relationship. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private String stringValue;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Simple constructor.<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @param stringValue display string for the relationship<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        private Relationship(String stringValue) {<a name="line.42"></a>
+<FONT color="green">043</FONT>            this.stringValue = stringValue;<a name="line.43"></a>
+<FONT color="green">044</FONT>        }<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** {@inheritDoc} */<a name="line.46"></a>
+<FONT color="green">047</FONT>        @Override<a name="line.47"></a>
+<FONT color="green">048</FONT>        public String toString() {<a name="line.48"></a>
+<FONT color="green">049</FONT>            return stringValue;<a name="line.49"></a>
+<FONT color="green">050</FONT>        }<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * Get the relationship obtained when multiplying all coefficients by -1.<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @return relationship obtained when multiplying all coefficients by -1<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public Relationship oppositeRelationship() {<a name="line.56"></a>
+<FONT color="green">057</FONT>            switch (this) {<a name="line.57"></a>
+<FONT color="green">058</FONT>            case LEQ :<a name="line.58"></a>
+<FONT color="green">059</FONT>                return GEQ;<a name="line.59"></a>
+<FONT color="green">060</FONT>            case GEQ :<a name="line.60"></a>
+<FONT color="green">061</FONT>                return LEQ;<a name="line.61"></a>
+<FONT color="green">062</FONT>            default :<a name="line.62"></a>
+<FONT color="green">063</FONT>                return EQ;<a name="line.63"></a>
+<FONT color="green">064</FONT>            }<a name="line.64"></a>
+<FONT color="green">065</FONT>        }<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>    }<a name="line.67"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/linear/SimplexSolver.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,251 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.ArrayList;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.List;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.optimization.OptimizationException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.optimization.RealPointValuePair;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    /**<a name="line.28"></a>
+<FONT color="green">029</FONT>     * Solves a linear problem using the Two-Phase Simplex Method.<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 812831 $ $Date: 2009-09-09 04:48:03 -0400 (Wed, 09 Sep 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 2.0<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public class SimplexSolver extends AbstractLinearOptimizer {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Default amount of error to accept in floating point comparisons. */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private static final double DEFAULT_EPSILON = 1.0e-6;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Amount of error to accept in floating point comparisons. */<a name="line.38"></a>
+<FONT color="green">039</FONT>        protected final double epsilon;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * Build a simplex solver with default settings.<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        public SimplexSolver() {<a name="line.44"></a>
+<FONT color="green">045</FONT>            this(DEFAULT_EPSILON);<a name="line.45"></a>
+<FONT color="green">046</FONT>        }<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /**<a name="line.48"></a>
+<FONT color="green">049</FONT>         * Build a simplex solver with a specified accepted amount of error<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @param epsilon the amount of error to accept in floating point comparisons<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        public SimplexSolver(final double epsilon) {<a name="line.52"></a>
+<FONT color="green">053</FONT>            this.epsilon = epsilon;<a name="line.53"></a>
+<FONT color="green">054</FONT>        }<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /**<a name="line.56"></a>
+<FONT color="green">057</FONT>         * Returns the column with the most negative coefficient in the objective function row.<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @param tableau simple tableau for the problem<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @return column with the most negative coefficient<a name="line.59"></a>
+<FONT color="green">060</FONT>         */<a name="line.60"></a>
+<FONT color="green">061</FONT>        private Integer getPivotColumn(SimplexTableau tableau) {<a name="line.61"></a>
+<FONT color="green">062</FONT>            double minValue = 0;<a name="line.62"></a>
+<FONT color="green">063</FONT>            Integer minPos = null;<a name="line.63"></a>
+<FONT color="green">064</FONT>            for (int i = tableau.getNumObjectiveFunctions(); i &lt; tableau.getWidth() - 1; i++) {<a name="line.64"></a>
+<FONT color="green">065</FONT>                if (MathUtils.compareTo(tableau.getEntry(0, i), minValue, epsilon) &lt; 0) {<a name="line.65"></a>
+<FONT color="green">066</FONT>                    minValue = tableau.getEntry(0, i);<a name="line.66"></a>
+<FONT color="green">067</FONT>                    minPos = i;<a name="line.67"></a>
+<FONT color="green">068</FONT>                }<a name="line.68"></a>
+<FONT color="green">069</FONT>            }<a name="line.69"></a>
+<FONT color="green">070</FONT>            return minPos;<a name="line.70"></a>
+<FONT color="green">071</FONT>        }<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /**<a name="line.73"></a>
+<FONT color="green">074</FONT>         * Returns the row with the minimum ratio as given by the minimum ratio test (MRT).<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @param tableau simple tableau for the problem<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @param col the column to test the ratio of.  See {@link #getPivotColumn(SimplexTableau)}<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @return row with the minimum ratio<a name="line.77"></a>
+<FONT color="green">078</FONT>         */<a name="line.78"></a>
+<FONT color="green">079</FONT>        private Integer getPivotRow(SimplexTableau tableau, final int col) {<a name="line.79"></a>
+<FONT color="green">080</FONT>            // create a list of all the rows that tie for the lowest score in the minimum ratio test<a name="line.80"></a>
+<FONT color="green">081</FONT>            List&lt;Integer&gt; minRatioPositions = new ArrayList&lt;Integer&gt;();<a name="line.81"></a>
+<FONT color="green">082</FONT>            double minRatio = Double.MAX_VALUE;<a name="line.82"></a>
+<FONT color="green">083</FONT>            for (int i = tableau.getNumObjectiveFunctions(); i &lt; tableau.getHeight(); i++) {<a name="line.83"></a>
+<FONT color="green">084</FONT>                final double rhs = tableau.getEntry(i, tableau.getWidth() - 1);<a name="line.84"></a>
+<FONT color="green">085</FONT>                final double entry = tableau.getEntry(i, col);<a name="line.85"></a>
+<FONT color="green">086</FONT>                if (MathUtils.compareTo(entry, 0, epsilon) &gt; 0) {<a name="line.86"></a>
+<FONT color="green">087</FONT>                    final double ratio = rhs / entry;<a name="line.87"></a>
+<FONT color="green">088</FONT>                    if (MathUtils.equals(ratio, minRatio, epsilon)) {<a name="line.88"></a>
+<FONT color="green">089</FONT>                        minRatioPositions.add(i);<a name="line.89"></a>
+<FONT color="green">090</FONT>                    } else if (ratio &lt; minRatio) {<a name="line.90"></a>
+<FONT color="green">091</FONT>                        minRatio = ratio;<a name="line.91"></a>
+<FONT color="green">092</FONT>                        minRatioPositions = new ArrayList&lt;Integer&gt;();<a name="line.92"></a>
+<FONT color="green">093</FONT>                        minRatioPositions.add(i);<a name="line.93"></a>
+<FONT color="green">094</FONT>                    }<a name="line.94"></a>
+<FONT color="green">095</FONT>                }<a name="line.95"></a>
+<FONT color="green">096</FONT>            }<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>            if (minRatioPositions.size() == 0) {<a name="line.98"></a>
+<FONT color="green">099</FONT>              return null;<a name="line.99"></a>
+<FONT color="green">100</FONT>            } else if (minRatioPositions.size() &gt; 1) {<a name="line.100"></a>
+<FONT color="green">101</FONT>              // there's a degeneracy as indicated by a tie in the minimum ratio test<a name="line.101"></a>
+<FONT color="green">102</FONT>              // check if there's an artificial variable that can be forced out of the basis<a name="line.102"></a>
+<FONT color="green">103</FONT>              for (Integer row : minRatioPositions) {<a name="line.103"></a>
+<FONT color="green">104</FONT>                for (int i = 0; i &lt; tableau.getNumArtificialVariables(); i++) {<a name="line.104"></a>
+<FONT color="green">105</FONT>                  int column = i + tableau.getArtificialVariableOffset();<a name="line.105"></a>
+<FONT color="green">106</FONT>                  if (MathUtils.equals(tableau.getEntry(row, column), 1, epsilon) &amp;&amp;<a name="line.106"></a>
+<FONT color="green">107</FONT>                      row.equals(tableau.getBasicRow(column))) {<a name="line.107"></a>
+<FONT color="green">108</FONT>                    return row;<a name="line.108"></a>
+<FONT color="green">109</FONT>                  }<a name="line.109"></a>
+<FONT color="green">110</FONT>                }<a name="line.110"></a>
+<FONT color="green">111</FONT>              }<a name="line.111"></a>
+<FONT color="green">112</FONT>            }<a name="line.112"></a>
+<FONT color="green">113</FONT>            return minRatioPositions.get(0);<a name="line.113"></a>
+<FONT color="green">114</FONT>        }<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>        /**<a name="line.116"></a>
+<FONT color="green">117</FONT>         * Runs one iteration of the Simplex method on the given model.<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @param tableau simple tableau for the problem<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @throws OptimizationException if the maximal iteration count has been<a name="line.119"></a>
+<FONT color="green">120</FONT>         * exceeded or if the model is found not to have a bounded solution<a name="line.120"></a>
+<FONT color="green">121</FONT>         */<a name="line.121"></a>
+<FONT color="green">122</FONT>        protected void doIteration(final SimplexTableau tableau)<a name="line.122"></a>
+<FONT color="green">123</FONT>            throws OptimizationException {<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>            incrementIterationsCounter();<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>            Integer pivotCol = getPivotColumn(tableau);<a name="line.127"></a>
+<FONT color="green">128</FONT>            Integer pivotRow = getPivotRow(tableau, pivotCol);<a name="line.128"></a>
+<FONT color="green">129</FONT>            if (pivotRow == null) {<a name="line.129"></a>
+<FONT color="green">130</FONT>                throw new UnboundedSolutionException();<a name="line.130"></a>
+<FONT color="green">131</FONT>            }<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>            // set the pivot element to 1<a name="line.133"></a>
+<FONT color="green">134</FONT>            double pivotVal = tableau.getEntry(pivotRow, pivotCol);<a name="line.134"></a>
+<FONT color="green">135</FONT>            tableau.divideRow(pivotRow, pivotVal);<a name="line.135"></a>
+<FONT color="green">136</FONT>    <a name="line.136"></a>
+<FONT color="green">137</FONT>            // set the rest of the pivot column to 0<a name="line.137"></a>
+<FONT color="green">138</FONT>            for (int i = 0; i &lt; tableau.getHeight(); i++) {<a name="line.138"></a>
+<FONT color="green">139</FONT>                if (i != pivotRow) {<a name="line.139"></a>
+<FONT color="green">140</FONT>                    double multiplier = tableau.getEntry(i, pivotCol);<a name="line.140"></a>
+<FONT color="green">141</FONT>                    tableau.subtractRow(i, pivotRow, multiplier);<a name="line.141"></a>
+<FONT color="green">142</FONT>                }<a name="line.142"></a>
+<FONT color="green">143</FONT>            }<a name="line.143"></a>
+<FONT color="green">144</FONT>        }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>        /**<a name="line.146"></a>
+<FONT color="green">147</FONT>         * Solves Phase 1 of the Simplex method.<a name="line.147"></a>
+<FONT color="green">148</FONT>         * @param tableau simple tableau for the problem<a name="line.148"></a>
+<FONT color="green">149</FONT>         * @exception OptimizationException if the maximal number of iterations is<a name="line.149"></a>
+<FONT color="green">150</FONT>         * exceeded, or if the problem is found not to have a bounded solution, or<a name="line.150"></a>
+<FONT color="green">151</FONT>         * if there is no feasible solution<a name="line.151"></a>
+<FONT color="green">152</FONT>         */<a name="line.152"></a>
+<FONT color="green">153</FONT>        protected void solvePhase1(final SimplexTableau tableau) throws OptimizationException {<a name="line.153"></a>
+<FONT color="green">154</FONT>    <a name="line.154"></a>
+<FONT color="green">155</FONT>            // make sure we're in Phase 1<a name="line.155"></a>
+<FONT color="green">156</FONT>            if (tableau.getNumArtificialVariables() == 0) {<a name="line.156"></a>
+<FONT color="green">157</FONT>                return;<a name="line.157"></a>
+<FONT color="green">158</FONT>            }<a name="line.158"></a>
+<FONT color="green">159</FONT>    <a name="line.159"></a>
+<FONT color="green">160</FONT>            while (!tableau.isOptimal()) {<a name="line.160"></a>
+<FONT color="green">161</FONT>                doIteration(tableau);<a name="line.161"></a>
+<FONT color="green">162</FONT>            }<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>            // if W is not zero then we have no feasible solution<a name="line.164"></a>
+<FONT color="green">165</FONT>            if (!MathUtils.equals(tableau.getEntry(0, tableau.getRhsOffset()), 0, epsilon)) {<a name="line.165"></a>
+<FONT color="green">166</FONT>                throw new NoFeasibleSolutionException();<a name="line.166"></a>
+<FONT color="green">167</FONT>            }<a name="line.167"></a>
+<FONT color="green">168</FONT>        }<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>        /** {@inheritDoc} */<a name="line.170"></a>
+<FONT color="green">171</FONT>        @Override<a name="line.171"></a>
+<FONT color="green">172</FONT>        public RealPointValuePair doOptimize() throws OptimizationException {<a name="line.172"></a>
+<FONT color="green">173</FONT>            final SimplexTableau tableau =<a name="line.173"></a>
+<FONT color="green">174</FONT>                new SimplexTableau(function, linearConstraints, goal, nonNegative, epsilon);<a name="line.174"></a>
+<FONT color="green">175</FONT>    <a name="line.175"></a>
+<FONT color="green">176</FONT>            solvePhase1(tableau);<a name="line.176"></a>
+<FONT color="green">177</FONT>            tableau.dropPhase1Objective();<a name="line.177"></a>
+<FONT color="green">178</FONT>    <a name="line.178"></a>
+<FONT color="green">179</FONT>            while (!tableau.isOptimal()) {<a name="line.179"></a>
+<FONT color="green">180</FONT>                doIteration(tableau);<a name="line.180"></a>
+<FONT color="green">181</FONT>            }<a name="line.181"></a>
+<FONT color="green">182</FONT>            return tableau.getSolution();<a name="line.182"></a>
+<FONT color="green">183</FONT>        }<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>    }<a name="line.185"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/linear/UnboundedSolutionException.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,106 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.linear;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.optimization.OptimizationException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This class represents exceptions thrown by optimizers when a solution<a name="line.23"></a>
+<FONT color="green">024</FONT>     * escapes to infinity.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 2.0<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public class UnboundedSolutionException extends OptimizationException {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /** Serializable version identifier. */<a name="line.30"></a>
+<FONT color="green">031</FONT>        private static final long serialVersionUID = 940539497277290619L;<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /**<a name="line.33"></a>
+<FONT color="green">034</FONT>         * Simple constructor using a default message.<a name="line.34"></a>
+<FONT color="green">035</FONT>         */<a name="line.35"></a>
+<FONT color="green">036</FONT>        public UnboundedSolutionException() {<a name="line.36"></a>
+<FONT color="green">037</FONT>            super("unbounded solution");<a name="line.37"></a>
+<FONT color="green">038</FONT>        }<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>    }<a name="line.40"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,209 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.optimization.univariate;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.ConvergingAlgorithmImpl;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.MaxEvaluationsExceededException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.optimization.UnivariateRealOptimizer;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    /**<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Provide a default implementation for several functions useful to generic<a name="line.28"></a>
+<FONT color="green">029</FONT>     * optimizers.<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 2.0<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public abstract class AbstractUnivariateRealOptimizer<a name="line.34"></a>
+<FONT color="green">035</FONT>        extends ConvergingAlgorithmImpl implements UnivariateRealOptimizer {<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /** Indicates where a root has been computed. */<a name="line.37"></a>
+<FONT color="green">038</FONT>        protected boolean resultComputed;<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** The last computed root. */<a name="line.40"></a>
+<FONT color="green">041</FONT>        protected double result;<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** Value of the function at the last computed result. */<a name="line.43"></a>
+<FONT color="green">044</FONT>        protected double functionValue;<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** Maximal number of evaluations allowed. */<a name="line.46"></a>
+<FONT color="green">047</FONT>        private int maxEvaluations;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** Number of evaluations already performed. */<a name="line.49"></a>
+<FONT color="green">050</FONT>        private int evaluations;<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * Construct a solver with given iteration count and accuracy.<a name="line.53"></a>
+<FONT color="green">054</FONT>         * FunctionEvaluationExceptionFunctionEvaluationException<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param defaultAbsoluteAccuracy maximum absolute error<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param defaultMaximalIterationCount maximum number of iterations<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @throws IllegalArgumentException if f is null or the<a name="line.57"></a>
+<FONT color="green">058</FONT>         * defaultAbsoluteAccuracy is not valid<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        protected AbstractUnivariateRealOptimizer(final int defaultMaximalIterationCount,<a name="line.60"></a>
+<FONT color="green">061</FONT>                                                  final double defaultAbsoluteAccuracy) {<a name="line.61"></a>
+<FONT color="green">062</FONT>            super(defaultMaximalIterationCount, defaultAbsoluteAccuracy);<a name="line.62"></a>
+<FONT color="green">063</FONT>            resultComputed = false;<a name="line.63"></a>
+<FONT color="green">064</FONT>            setMaxEvaluations(Integer.MAX_VALUE);<a name="line.64"></a>
+<FONT color="green">065</FONT>        }<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /** Check if a result has been computed.<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @exception IllegalStateException if no result has been computed<a name="line.68"></a>
+<FONT color="green">069</FONT>         */<a name="line.69"></a>
+<FONT color="green">070</FONT>        protected void checkResultComputed() throws IllegalStateException {<a name="line.70"></a>
+<FONT color="green">071</FONT>            if (!resultComputed) {<a name="line.71"></a>
+<FONT color="green">072</FONT>                throw MathRuntimeException.createIllegalStateException("no result available");<a name="line.72"></a>
+<FONT color="green">073</FONT>            }<a name="line.73"></a>
+<FONT color="green">074</FONT>        }<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        /** {@inheritDoc} */<a name="line.76"></a>
+<FONT color="green">077</FONT>        public double getResult() {<a name="line.77"></a>
+<FONT color="green">078</FONT>            checkResultComputed();<a name="line.78"></a>
+<FONT color="green">079</FONT>            return result;<a name="line.79"></a>
+<FONT color="green">080</FONT>        }<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>        /** {@inheritDoc} */<a name="line.82"></a>
+<FONT color="green">083</FONT>        public double getFunctionValue() {<a name="line.83"></a>
+<FONT color="green">084</FONT>            checkResultComputed();<a name="line.84"></a>
+<FONT color="green">085</FONT>            return functionValue;<a name="line.85"></a>
+<FONT color="green">086</FONT>        }<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>        /**<a name="line.88"></a>
+<FONT color="green">089</FONT>         * Convenience function for implementations.<a name="line.89"></a>
+<FONT color="green">090</FONT>         *<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @param x the result to set<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @param fx the result to set<a name="line.92"></a>
+<FONT color="green">093</FONT>         * @param iterationCount the iteration count to set<a name="line.93"></a>
+<FONT color="green">094</FONT>         */<a name="line.94"></a>
+<FONT color="green">095</FONT>        protected final void setResult(final double x, final double fx,<a name="line.95"></a>
+<FONT color="green">096</FONT>                                       final int iterationCount) {<a name="line.96"></a>
+<FONT color="green">097</FONT>            this.result         = x;<a name="line.97"></a>
+<FONT color="green">098</FONT>            this.functionValue  = fx;<a name="line.98"></a>
+<FONT color="green">099</FONT>            this.iterationCount = iterationCount;<a name="line.99"></a>
+<FONT color="green">100</FONT>            this.resultComputed = true;<a name="line.100"></a>
+<FONT color="green">101</FONT>        }<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        /**<a name="line.103"></a>
+<FONT color="green">104</FONT>         * Convenience function for implementations.<a name="line.104"></a>
+<FONT color="green">105</FONT>         */<a name="line.105"></a>
+<FONT color="green">106</FONT>        protected final void clearResult() {<a name="line.106"></a>
+<FONT color="green">107</FONT>            this.resultComputed = false;<a name="line.107"></a>
+<FONT color="green">108</FONT>        }<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>        /** {@inheritDoc} */<a name="line.110"></a>
+<FONT color="green">111</FONT>        public void setMaxEvaluations(int maxEvaluations) {<a name="line.111"></a>
+<FONT color="green">112</FONT>            this.maxEvaluations = maxEvaluations;<a name="line.112"></a>
+<FONT color="green">113</FONT>        }<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>        /** {@inheritDoc} */<a name="line.115"></a>
+<FONT color="green">116</FONT>        public int getMaxEvaluations() {<a name="line.116"></a>
+<FONT color="green">117</FONT>            return maxEvaluations;<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /** {@inheritDoc} */<a name="line.120"></a>
+<FONT color="green">121</FONT>        public int getEvaluations() {<a name="line.121"></a>
+<FONT color="green">122</FONT>            return evaluations;<a name="line.122"></a>
+<FONT color="green">123</FONT>        }<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>        /**<a name="line.125"></a>
+<FONT color="green">126</FONT>         * Compute the objective function value.<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @param f objective function<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @param point point at which the objective function must be evaluated<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @return objective function value at specified point<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @exception FunctionEvaluationException if the function cannot be evaluated<a name="line.130"></a>
+<FONT color="green">131</FONT>         * or the maximal number of iterations is exceeded<a name="line.131"></a>
+<FONT color="green">132</FONT>         */<a name="line.132"></a>
+<FONT color="green">133</FONT>        protected double computeObjectiveValue(final UnivariateRealFunction f,<a name="line.133"></a>
+<FONT color="green">134</FONT>                                               final double point)<a name="line.134"></a>
+<FONT color="green">135</FONT>            throws FunctionEvaluationException {<a name="line.135"></a>
+<FONT color="green">136</FONT>            if (++evaluations &gt; maxEvaluations) {<a name="line.136"></a>
+<FONT color="green">137</FONT>                throw new FunctionEvaluationException(new MaxEvaluationsExceededException(maxEvaluations),<a name="line.137"></a>
+<FONT color="green">138</FONT>                                                      point);<a name="line.138"></a>
+<FONT color="green">139</FONT>            }<a name="line.139"></a>
+<FONT color="green">140</FONT>            return f.value(point);<a name="line.140"></a>
+<FONT color="green">141</FONT>        }<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>    }<a name="line.143"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/optimization/univariate/BrentOptimizer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,257 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.optimization.univariate;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.optimization.GoalType;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Implements Richard Brent's algorithm (from his book "Algorithms for<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Minimization without Derivatives", p. 79) for finding minima of real<a name="line.26"></a>
+<FONT color="green">027</FONT>     * univariate functions.<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @since 2.0<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    public class BrentOptimizer extends AbstractUnivariateRealOptimizer {<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /**<a name="line.34"></a>
+<FONT color="green">035</FONT>         * Golden section.<a name="line.35"></a>
+<FONT color="green">036</FONT>         */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private static final double GOLDEN_SECTION = 0.5 * (3 - Math.sqrt(5));<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /**<a name="line.39"></a>
+<FONT color="green">040</FONT>         * Construct a solver.<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        public BrentOptimizer() {<a name="line.42"></a>
+<FONT color="green">043</FONT>            super(100, 1E-10);<a name="line.43"></a>
+<FONT color="green">044</FONT>        }<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** {@inheritDoc} */<a name="line.46"></a>
+<FONT color="green">047</FONT>        public double optimize(final UnivariateRealFunction f, final GoalType goalType,<a name="line.47"></a>
+<FONT color="green">048</FONT>                               final double min, final double max, final double startValue)<a name="line.48"></a>
+<FONT color="green">049</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.49"></a>
+<FONT color="green">050</FONT>            return optimize(f, goalType, min, max);<a name="line.50"></a>
+<FONT color="green">051</FONT>        }<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** {@inheritDoc} */<a name="line.53"></a>
+<FONT color="green">054</FONT>        public double optimize(final UnivariateRealFunction f, final GoalType goalType,<a name="line.54"></a>
+<FONT color="green">055</FONT>                               final double min, final double max)<a name="line.55"></a>
+<FONT color="green">056</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.56"></a>
+<FONT color="green">057</FONT>            clearResult();<a name="line.57"></a>
+<FONT color="green">058</FONT>            return localMin(f, goalType, min, max, relativeAccuracy, absoluteAccuracy);<a name="line.58"></a>
+<FONT color="green">059</FONT>        }<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Find the minimum of the function {@code f} within the interval {@code (a, b)}.<a name="line.62"></a>
+<FONT color="green">063</FONT>         *<a name="line.63"></a>
+<FONT color="green">064</FONT>         * If the function {@code f} is defined on the interval {@code (a, b)}, then<a name="line.64"></a>
+<FONT color="green">065</FONT>         * this method finds an approximation {@code x} to the point at which {@code f}<a name="line.65"></a>
+<FONT color="green">066</FONT>         * attains its minimum.&lt;br/&gt;<a name="line.66"></a>
+<FONT color="green">067</FONT>         * {@code t} and {@code eps} define a tolerance {@code tol = eps |x| + t} and<a name="line.67"></a>
+<FONT color="green">068</FONT>         * {@code f} is never evaluated at two points closer together than {@code tol}.<a name="line.68"></a>
+<FONT color="green">069</FONT>         * {@code eps} should be no smaller than &lt;em&gt;2 macheps&lt;/em&gt; and preferable not<a name="line.69"></a>
+<FONT color="green">070</FONT>         * much less than &lt;em&gt;sqrt(macheps)&lt;/em&gt;, where &lt;em&gt;macheps&lt;/em&gt; is the relative<a name="line.70"></a>
+<FONT color="green">071</FONT>         * machine precision. {@code t} should be positive.<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param f the function to solve<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @param goalType type of optimization goal: either {@link GoalType#MAXIMIZE}<a name="line.73"></a>
+<FONT color="green">074</FONT>         * or {@link GoalType#MINIMIZE}<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @param a Lower bound of the interval<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @param b Higher bound of the interval<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @param eps Relative accuracy<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @param t Absolute accuracy<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @return the point at which the function is minimal.<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @throws MaxIterationsExceededException if the maximum iteration count<a name="line.80"></a>
+<FONT color="green">081</FONT>         * is exceeded.<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @throws FunctionEvaluationException if an error occurs evaluating<a name="line.82"></a>
+<FONT color="green">083</FONT>         * the function.<a name="line.83"></a>
+<FONT color="green">084</FONT>         */<a name="line.84"></a>
+<FONT color="green">085</FONT>        private double localMin(final UnivariateRealFunction f, final GoalType goalType,<a name="line.85"></a>
+<FONT color="green">086</FONT>                                double a, double b, final double eps, final double t)<a name="line.86"></a>
+<FONT color="green">087</FONT>            throws MaxIterationsExceededException, FunctionEvaluationException {<a name="line.87"></a>
+<FONT color="green">088</FONT>            double x = a + GOLDEN_SECTION * (b - a);<a name="line.88"></a>
+<FONT color="green">089</FONT>            double v = x;<a name="line.89"></a>
+<FONT color="green">090</FONT>            double w = x;<a name="line.90"></a>
+<FONT color="green">091</FONT>            double e = 0;<a name="line.91"></a>
+<FONT color="green">092</FONT>            double fx = computeObjectiveValue(f, x);<a name="line.92"></a>
+<FONT color="green">093</FONT>            if (goalType == GoalType.MAXIMIZE) {<a name="line.93"></a>
+<FONT color="green">094</FONT>                fx = -fx;<a name="line.94"></a>
+<FONT color="green">095</FONT>            }<a name="line.95"></a>
+<FONT color="green">096</FONT>            double fv = fx;<a name="line.96"></a>
+<FONT color="green">097</FONT>            double fw = fx;<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>            int count = 0;<a name="line.99"></a>
+<FONT color="green">100</FONT>            while (count &lt; maximalIterationCount) {<a name="line.100"></a>
+<FONT color="green">101</FONT>                double m = 0.5 * (a + b);<a name="line.101"></a>
+<FONT color="green">102</FONT>                double tol = eps * Math.abs(x) + t;<a name="line.102"></a>
+<FONT color="green">103</FONT>                double t2 = 2 * tol;<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>                // Check stopping criterion.<a name="line.105"></a>
+<FONT color="green">106</FONT>                if (Math.abs(x - m) &gt; t2 - 0.5 * (b - a)) {<a name="line.106"></a>
+<FONT color="green">107</FONT>                    double p = 0;<a name="line.107"></a>
+<FONT color="green">108</FONT>                    double q = 0;<a name="line.108"></a>
+<FONT color="green">109</FONT>                    double r = 0;<a name="line.109"></a>
+<FONT color="green">110</FONT>                    double d = 0;<a name="line.110"></a>
+<FONT color="green">111</FONT>                    double u = 0;<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>                    if (Math.abs(e) &gt; tol) { // Fit parabola.<a name="line.113"></a>
+<FONT color="green">114</FONT>                        r = (x - w) * (fx - fv);<a name="line.114"></a>
+<FONT color="green">115</FONT>                        q = (x - v) * (fx - fw);<a name="line.115"></a>
+<FONT color="green">116</FONT>                        p = (x - v) * q - (x - w) * r;<a name="line.116"></a>
+<FONT color="green">117</FONT>                        q = 2 * (q - r);<a name="line.117"></a>
+<FONT color="green">118</FONT>    <a name="line.118"></a>
+<FONT color="green">119</FONT>                        if (q &gt; 0) {<a name="line.119"></a>
+<FONT color="green">120</FONT>                            p = -p;<a name="line.120"></a>
+<FONT color="green">121</FONT>                        } else {<a name="line.121"></a>
+<FONT color="green">122</FONT>                            q = -q;<a name="line.122"></a>
+<FONT color="green">123</FONT>                        }<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>                        r = e;<a name="line.125"></a>
+<FONT color="green">126</FONT>                        e = d;<a name="line.126"></a>
+<FONT color="green">127</FONT>                    }<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>                    if (Math.abs(p) &lt; Math.abs(0.5 * q * r) &amp;&amp;<a name="line.129"></a>
+<FONT color="green">130</FONT>                        (p &lt; q * (a - x)) &amp;&amp; (p &lt; q * (b - x))) { // Parabolic interpolation step.<a name="line.130"></a>
+<FONT color="green">131</FONT>                        d = p / q;<a name="line.131"></a>
+<FONT color="green">132</FONT>                        u = x + d;<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>                        // f must not be evaluated too close to a or b.<a name="line.134"></a>
+<FONT color="green">135</FONT>                        if (((u - a) &lt; t2) || ((b - u) &lt; t2)) {<a name="line.135"></a>
+<FONT color="green">136</FONT>                            d = (x &lt; m) ? tol : -tol;<a name="line.136"></a>
+<FONT color="green">137</FONT>                        }<a name="line.137"></a>
+<FONT color="green">138</FONT>                    } else { // Golden section step.<a name="line.138"></a>
+<FONT color="green">139</FONT>                        e = ((x &lt; m) ? b : a) - x;<a name="line.139"></a>
+<FONT color="green">140</FONT>                        d = GOLDEN_SECTION * e;<a name="line.140"></a>
+<FONT color="green">141</FONT>                    }<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>                    // f must not be evaluated too close to a or b.<a name="line.143"></a>
+<FONT color="green">144</FONT>                    u = x + ((Math.abs(d) &gt; tol) ? d : ((d &gt; 0) ? tol : -tol));<a name="line.144"></a>
+<FONT color="green">145</FONT>                    double fu = computeObjectiveValue(f, u);<a name="line.145"></a>
+<FONT color="green">146</FONT>                    if (goalType == GoalType.MAXIMIZE) {<a name="line.146"></a>
+<FONT color="green">147</FONT>                        fu = -fu;<a name="line.147"></a>
+<FONT color="green">148</FONT>                    }<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>                    // Update a, b, v, w and x.<a name="line.150"></a>
+<FONT color="green">151</FONT>                    if (fu &lt;= fx) {<a name="line.151"></a>
+<FONT color="green">152</FONT>                        if (u &lt; x) {<a name="line.152"></a>
+<FONT color="green">153</FONT>                            b = x;<a name="line.153"></a>
+<FONT color="green">154</FONT>                        } else {<a name="line.154"></a>
+<FONT color="green">155</FONT>                            a = x;<a name="line.155"></a>
+<FONT color="green">156</FONT>                        }<a name="line.156"></a>
+<FONT color="green">157</FONT>                        v = w;<a name="line.157"></a>
+<FONT color="green">158</FONT>                        fv = fw;<a name="line.158"></a>
+<FONT color="green">159</FONT>                        w = x;<a name="line.159"></a>
+<FONT color="green">160</FONT>                        fw = fx;<a name="line.160"></a>
+<FONT color="green">161</FONT>                        x = u;<a name="line.161"></a>
+<FONT color="green">162</FONT>                        fx = fu;<a name="line.162"></a>
+<FONT color="green">163</FONT>                    } else {<a name="line.163"></a>
+<FONT color="green">164</FONT>                        if (u &lt; x) {<a name="line.164"></a>
+<FONT color="green">165</FONT>                            a = u;<a name="line.165"></a>
+<FONT color="green">166</FONT>                        } else {<a name="line.166"></a>
+<FONT color="green">167</FONT>                            b = u;<a name="line.167"></a>
+<FONT color="green">168</FONT>                        }<a name="line.168"></a>
+<FONT color="green">169</FONT>                        if ((fu &lt;= fw) || (w == x)) {<a name="line.169"></a>
+<FONT color="green">170</FONT>                            v = w;<a name="line.170"></a>
+<FONT color="green">171</FONT>                            fv = fw;<a name="line.171"></a>
+<FONT color="green">172</FONT>                            w = u;<a name="line.172"></a>
+<FONT color="green">173</FONT>                            fw = fu;<a name="line.173"></a>
+<FONT color="green">174</FONT>                        } else if ((fu &lt;= fv) || (v == x) || (v == w)) {<a name="line.174"></a>
+<FONT color="green">175</FONT>                            v = u;<a name="line.175"></a>
+<FONT color="green">176</FONT>                            fv = fu;<a name="line.176"></a>
+<FONT color="green">177</FONT>                        }<a name="line.177"></a>
+<FONT color="green">178</FONT>                    }<a name="line.178"></a>
+<FONT color="green">179</FONT>                } else { // termination<a name="line.179"></a>
+<FONT color="green">180</FONT>                    setResult(x, (goalType == GoalType.MAXIMIZE) ? -fx : fx, count);<a name="line.180"></a>
+<FONT color="green">181</FONT>                    return x;<a name="line.181"></a>
+<FONT color="green">182</FONT>                }<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>                ++count;<a name="line.184"></a>
+<FONT color="green">185</FONT>            }<a name="line.185"></a>
+<FONT color="green">186</FONT>    <a name="line.186"></a>
+<FONT color="green">187</FONT>            throw new MaxIterationsExceededException(maximalIterationCount);<a name="line.187"></a>
+<FONT color="green">188</FONT>    <a name="line.188"></a>
+<FONT color="green">189</FONT>        }<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>    }<a name="line.191"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/AbstractRandomGenerator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,338 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.random;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Abstract class implementing the {@link  RandomGenerator} interface.<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Default implementations for all methods other than {@link #nextDouble()} and<a name="line.23"></a>
+<FONT color="green">024</FONT>     * {@link #setSeed(long)} are provided.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * All data generation methods are based on &lt;code&gt;nextDouble().&lt;/code&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Concrete implementations &lt;strong&gt;must&lt;/strong&gt; override<a name="line.27"></a>
+<FONT color="green">028</FONT>     * this method and &lt;strong&gt;should&lt;/strong&gt; provide better / more<a name="line.28"></a>
+<FONT color="green">029</FONT>     * performant implementations of the other methods if the underlying PRNG<a name="line.29"></a>
+<FONT color="green">030</FONT>     * supplies them.&lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     *<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 1.1<a name="line.32"></a>
+<FONT color="green">033</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.33"></a>
+<FONT color="green">034</FONT>     */<a name="line.34"></a>
+<FONT color="green">035</FONT>    public abstract class AbstractRandomGenerator implements RandomGenerator {<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /**<a name="line.37"></a>
+<FONT color="green">038</FONT>         * Cached random normal value.  The default implementation for<a name="line.38"></a>
+<FONT color="green">039</FONT>         * {@link #nextGaussian} generates pairs of values and this field caches the<a name="line.39"></a>
+<FONT color="green">040</FONT>         * second value so that the full algorithm is not executed for every<a name="line.40"></a>
+<FONT color="green">041</FONT>         * activation.  The value &lt;code&gt;Double.NaN&lt;/code&gt; signals that there is<a name="line.41"></a>
+<FONT color="green">042</FONT>         * no cached value.  Use {@link #clear} to clear the cached value.<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        private double cachedNormalDeviate = Double.NaN;<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /**<a name="line.46"></a>
+<FONT color="green">047</FONT>         * Construct a RandomGenerator.<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        public AbstractRandomGenerator() {<a name="line.49"></a>
+<FONT color="green">050</FONT>            super();<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        }<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /**<a name="line.54"></a>
+<FONT color="green">055</FONT>         * Clears the cache used by the default implementation of<a name="line.55"></a>
+<FONT color="green">056</FONT>         * {@link #nextGaussian}. Implemementations that do not override the<a name="line.56"></a>
+<FONT color="green">057</FONT>         * default implementation of &lt;code&gt;nextGaussian&lt;/code&gt; should call this<a name="line.57"></a>
+<FONT color="green">058</FONT>         * method in the implementation of {@link #setSeed(long)}<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        public void clear() {<a name="line.60"></a>
+<FONT color="green">061</FONT>            cachedNormalDeviate = Double.NaN;<a name="line.61"></a>
+<FONT color="green">062</FONT>        }<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /** {@inheritDoc} */<a name="line.64"></a>
+<FONT color="green">065</FONT>        public void setSeed(int seed) {<a name="line.65"></a>
+<FONT color="green">066</FONT>            setSeed((long) seed);<a name="line.66"></a>
+<FONT color="green">067</FONT>        }<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /** {@inheritDoc} */<a name="line.69"></a>
+<FONT color="green">070</FONT>        public void setSeed(int[] seed) {<a name="line.70"></a>
+<FONT color="green">071</FONT>            // the following number is the largest prime that fits in 32 bits (it is 2^32 - 5)<a name="line.71"></a>
+<FONT color="green">072</FONT>            final long prime = 4294967291l;<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>            long combined = 0l;<a name="line.74"></a>
+<FONT color="green">075</FONT>            for (int s : seed) {<a name="line.75"></a>
+<FONT color="green">076</FONT>                combined = combined * prime + s;<a name="line.76"></a>
+<FONT color="green">077</FONT>            }<a name="line.77"></a>
+<FONT color="green">078</FONT>            setSeed(combined);<a name="line.78"></a>
+<FONT color="green">079</FONT>        }<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /**<a name="line.81"></a>
+<FONT color="green">082</FONT>         * Sets the seed of the underyling random number generator using a<a name="line.82"></a>
+<FONT color="green">083</FONT>         * &lt;code&gt;long&lt;/code&gt; seed.  Sequences of values generated starting with the<a name="line.83"></a>
+<FONT color="green">084</FONT>         * same seeds should be identical.<a name="line.84"></a>
+<FONT color="green">085</FONT>         * &lt;p&gt;<a name="line.85"></a>
+<FONT color="green">086</FONT>         * Implementations that do not override the default implementation of<a name="line.86"></a>
+<FONT color="green">087</FONT>         * &lt;code&gt;nextGaussian&lt;/code&gt; should include a call to {@link #clear} in the<a name="line.87"></a>
+<FONT color="green">088</FONT>         * implementation of this method.&lt;/p&gt;<a name="line.88"></a>
+<FONT color="green">089</FONT>         *<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @param seed the seed value<a name="line.90"></a>
+<FONT color="green">091</FONT>         */<a name="line.91"></a>
+<FONT color="green">092</FONT>        public abstract void setSeed(long seed);<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>        /**<a name="line.94"></a>
+<FONT color="green">095</FONT>         * Generates random bytes and places them into a user-supplied<a name="line.95"></a>
+<FONT color="green">096</FONT>         * byte array.  The number of random bytes produced is equal to<a name="line.96"></a>
+<FONT color="green">097</FONT>         * the length of the byte array.<a name="line.97"></a>
+<FONT color="green">098</FONT>         * &lt;p&gt;<a name="line.98"></a>
+<FONT color="green">099</FONT>         * The default implementation fills the array with bytes extracted from<a name="line.99"></a>
+<FONT color="green">100</FONT>         * random integers generated using {@link #nextInt}.&lt;/p&gt;<a name="line.100"></a>
+<FONT color="green">101</FONT>         *<a name="line.101"></a>
+<FONT color="green">102</FONT>         * @param bytes the non-null byte array in which to put the<a name="line.102"></a>
+<FONT color="green">103</FONT>         * random bytes<a name="line.103"></a>
+<FONT color="green">104</FONT>         */<a name="line.104"></a>
+<FONT color="green">105</FONT>        public void nextBytes(byte[] bytes) {<a name="line.105"></a>
+<FONT color="green">106</FONT>            int bytesOut = 0;<a name="line.106"></a>
+<FONT color="green">107</FONT>            while (bytesOut &lt; bytes.length) {<a name="line.107"></a>
+<FONT color="green">108</FONT>              int randInt = nextInt();<a name="line.108"></a>
+<FONT color="green">109</FONT>              for (int i = 0; i &lt; 3; i++) {<a name="line.109"></a>
+<FONT color="green">110</FONT>                  if ( i &gt; 0) {<a name="line.110"></a>
+<FONT color="green">111</FONT>                      randInt = randInt &gt;&gt; 8;<a name="line.111"></a>
+<FONT color="green">112</FONT>                  }<a name="line.112"></a>
+<FONT color="green">113</FONT>                  bytes[bytesOut++] = (byte) randInt;<a name="line.113"></a>
+<FONT color="green">114</FONT>                  if (bytesOut == bytes.length) {<a name="line.114"></a>
+<FONT color="green">115</FONT>                      return;<a name="line.115"></a>
+<FONT color="green">116</FONT>                  }<a name="line.116"></a>
+<FONT color="green">117</FONT>              }<a name="line.117"></a>
+<FONT color="green">118</FONT>            }<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>         /**<a name="line.121"></a>
+<FONT color="green">122</FONT>         * Returns the next pseudorandom, uniformly distributed &lt;code&gt;int&lt;/code&gt;<a name="line.122"></a>
+<FONT color="green">123</FONT>         * value from this random number generator's sequence.<a name="line.123"></a>
+<FONT color="green">124</FONT>         * All 2&lt;font size="-1"&gt;&lt;sup&gt;32&lt;/sup&gt;&lt;/font&gt; possible &lt;tt&gt;int&lt;/tt&gt; values<a name="line.124"></a>
+<FONT color="green">125</FONT>         * should be produced with  (approximately) equal probability.<a name="line.125"></a>
+<FONT color="green">126</FONT>         * &lt;p&gt;<a name="line.126"></a>
+<FONT color="green">127</FONT>         * The default implementation provided here returns<a name="line.127"></a>
+<FONT color="green">128</FONT>         * &lt;pre&gt;<a name="line.128"></a>
+<FONT color="green">129</FONT>         * &lt;code&gt;(int) (nextDouble() * Integer.MAX_VALUE)&lt;/code&gt;<a name="line.129"></a>
+<FONT color="green">130</FONT>         * &lt;/pre&gt;&lt;/p&gt;<a name="line.130"></a>
+<FONT color="green">131</FONT>         *<a name="line.131"></a>
+<FONT color="green">132</FONT>         * @return the next pseudorandom, uniformly distributed &lt;code&gt;int&lt;/code&gt;<a name="line.132"></a>
+<FONT color="green">133</FONT>         *  value from this random number generator's sequence<a name="line.133"></a>
+<FONT color="green">134</FONT>         */<a name="line.134"></a>
+<FONT color="green">135</FONT>        public int nextInt() {<a name="line.135"></a>
+<FONT color="green">136</FONT>            return (int) (nextDouble() * Integer.MAX_VALUE);<a name="line.136"></a>
+<FONT color="green">137</FONT>        }<a name="line.137"></a>
+<FONT color="green">138</FONT>    <a name="line.138"></a>
+<FONT color="green">139</FONT>        /**<a name="line.139"></a>
+<FONT color="green">140</FONT>         * Returns a pseudorandom, uniformly distributed &lt;tt&gt;int&lt;/tt&gt; value<a name="line.140"></a>
+<FONT color="green">141</FONT>         * between 0 (inclusive) and the specified value (exclusive), drawn from<a name="line.141"></a>
+<FONT color="green">142</FONT>         * this random number generator's sequence.<a name="line.142"></a>
+<FONT color="green">143</FONT>         * &lt;p&gt;<a name="line.143"></a>
+<FONT color="green">144</FONT>         * The default implementation returns<a name="line.144"></a>
+<FONT color="green">145</FONT>         * &lt;pre&gt;<a name="line.145"></a>
+<FONT color="green">146</FONT>         * &lt;code&gt;(int) (nextDouble() * n&lt;/code&gt;<a name="line.146"></a>
+<FONT color="green">147</FONT>         * &lt;/pre&gt;&lt;/p&gt;<a name="line.147"></a>
+<FONT color="green">148</FONT>         *<a name="line.148"></a>
+<FONT color="green">149</FONT>         * @param n the bound on the random number to be returned.  Must be<a name="line.149"></a>
+<FONT color="green">150</FONT>         * positive.<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @return  a pseudorandom, uniformly distributed &lt;tt&gt;int&lt;/tt&gt;<a name="line.151"></a>
+<FONT color="green">152</FONT>         * value between 0 (inclusive) and n (exclusive).<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @throws IllegalArgumentException if n is not positive.<a name="line.153"></a>
+<FONT color="green">154</FONT>         */<a name="line.154"></a>
+<FONT color="green">155</FONT>        public int nextInt(int n) {<a name="line.155"></a>
+<FONT color="green">156</FONT>            if (n &lt;= 0 ) {<a name="line.156"></a>
+<FONT color="green">157</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.157"></a>
+<FONT color="green">158</FONT>                      "upper bound must be positive ({0})", n);<a name="line.158"></a>
+<FONT color="green">159</FONT>            }<a name="line.159"></a>
+<FONT color="green">160</FONT>            int result = (int) (nextDouble() * n);<a name="line.160"></a>
+<FONT color="green">161</FONT>            return result &lt; n ? result : n - 1;<a name="line.161"></a>
+<FONT color="green">162</FONT>        }<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>         /**<a name="line.164"></a>
+<FONT color="green">165</FONT>         * Returns the next pseudorandom, uniformly distributed &lt;code&gt;long&lt;/code&gt;<a name="line.165"></a>
+<FONT color="green">166</FONT>         * value from this random number generator's sequence.  All<a name="line.166"></a>
+<FONT color="green">167</FONT>         * 2&lt;font size="-1"&gt;&lt;sup&gt;64&lt;/sup&gt;&lt;/font&gt; possible &lt;tt&gt;long&lt;/tt&gt; values<a name="line.167"></a>
+<FONT color="green">168</FONT>         * should be produced with (approximately) equal probability.<a name="line.168"></a>
+<FONT color="green">169</FONT>         * &lt;p&gt;<a name="line.169"></a>
+<FONT color="green">170</FONT>         * The default implementation returns<a name="line.170"></a>
+<FONT color="green">171</FONT>         * &lt;pre&gt;<a name="line.171"></a>
+<FONT color="green">172</FONT>         * &lt;code&gt;(long) (nextDouble() * Long.MAX_VALUE)&lt;/code&gt;<a name="line.172"></a>
+<FONT color="green">173</FONT>         * &lt;/pre&gt;&lt;/p&gt;<a name="line.173"></a>
+<FONT color="green">174</FONT>         *<a name="line.174"></a>
+<FONT color="green">175</FONT>         * @return  the next pseudorandom, uniformly distributed &lt;code&gt;long&lt;/code&gt;<a name="line.175"></a>
+<FONT color="green">176</FONT>         *value from this random number generator's sequence<a name="line.176"></a>
+<FONT color="green">177</FONT>         */<a name="line.177"></a>
+<FONT color="green">178</FONT>        public long nextLong() {<a name="line.178"></a>
+<FONT color="green">179</FONT>            return (long) (nextDouble() * Long.MAX_VALUE);<a name="line.179"></a>
+<FONT color="green">180</FONT>        }<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>        /**<a name="line.182"></a>
+<FONT color="green">183</FONT>         * Returns the next pseudorandom, uniformly distributed<a name="line.183"></a>
+<FONT color="green">184</FONT>         * &lt;code&gt;boolean&lt;/code&gt; value from this random number generator's<a name="line.184"></a>
+<FONT color="green">185</FONT>         * sequence.<a name="line.185"></a>
+<FONT color="green">186</FONT>         * &lt;p&gt;<a name="line.186"></a>
+<FONT color="green">187</FONT>         * The default implementation returns<a name="line.187"></a>
+<FONT color="green">188</FONT>         * &lt;pre&gt;<a name="line.188"></a>
+<FONT color="green">189</FONT>         * &lt;code&gt;nextDouble() &lt;= 0.5&lt;/code&gt;<a name="line.189"></a>
+<FONT color="green">190</FONT>         * &lt;/pre&gt;&lt;/p&gt;<a name="line.190"></a>
+<FONT color="green">191</FONT>         *<a name="line.191"></a>
+<FONT color="green">192</FONT>         * @return  the next pseudorandom, uniformly distributed<a name="line.192"></a>
+<FONT color="green">193</FONT>         * &lt;code&gt;boolean&lt;/code&gt; value from this random number generator's<a name="line.193"></a>
+<FONT color="green">194</FONT>         * sequence<a name="line.194"></a>
+<FONT color="green">195</FONT>         */<a name="line.195"></a>
+<FONT color="green">196</FONT>        public boolean nextBoolean() {<a name="line.196"></a>
+<FONT color="green">197</FONT>            return nextDouble() &lt;= 0.5;<a name="line.197"></a>
+<FONT color="green">198</FONT>        }<a name="line.198"></a>
+<FONT color="green">199</FONT>    <a name="line.199"></a>
+<FONT color="green">200</FONT>         /**<a name="line.200"></a>
+<FONT color="green">201</FONT>         * Returns the next pseudorandom, uniformly distributed &lt;code&gt;float&lt;/code&gt;<a name="line.201"></a>
+<FONT color="green">202</FONT>         * value between &lt;code&gt;0.0&lt;/code&gt; and &lt;code&gt;1.0&lt;/code&gt; from this random<a name="line.202"></a>
+<FONT color="green">203</FONT>         * number generator's sequence.<a name="line.203"></a>
+<FONT color="green">204</FONT>         * &lt;p&gt;<a name="line.204"></a>
+<FONT color="green">205</FONT>         * The default implementation returns<a name="line.205"></a>
+<FONT color="green">206</FONT>         * &lt;pre&gt;<a name="line.206"></a>
+<FONT color="green">207</FONT>         * &lt;code&gt;(float) nextDouble() &lt;/code&gt;<a name="line.207"></a>
+<FONT color="green">208</FONT>         * &lt;/pre&gt;&lt;/p&gt;<a name="line.208"></a>
+<FONT color="green">209</FONT>         *<a name="line.209"></a>
+<FONT color="green">210</FONT>         * @return  the next pseudorandom, uniformly distributed &lt;code&gt;float&lt;/code&gt;<a name="line.210"></a>
+<FONT color="green">211</FONT>         * value between &lt;code&gt;0.0&lt;/code&gt; and &lt;code&gt;1.0&lt;/code&gt; from this<a name="line.211"></a>
+<FONT color="green">212</FONT>         * random number generator's sequence<a name="line.212"></a>
+<FONT color="green">213</FONT>         */<a name="line.213"></a>
+<FONT color="green">214</FONT>        public float nextFloat() {<a name="line.214"></a>
+<FONT color="green">215</FONT>            return (float) nextDouble();<a name="line.215"></a>
+<FONT color="green">216</FONT>        }<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>        /**<a name="line.218"></a>
+<FONT color="green">219</FONT>         * Returns the next pseudorandom, uniformly distributed<a name="line.219"></a>
+<FONT color="green">220</FONT>         * &lt;code&gt;double&lt;/code&gt; value between &lt;code&gt;0.0&lt;/code&gt; and<a name="line.220"></a>
+<FONT color="green">221</FONT>         * &lt;code&gt;1.0&lt;/code&gt; from this random number generator's sequence.<a name="line.221"></a>
+<FONT color="green">222</FONT>         * &lt;p&gt;<a name="line.222"></a>
+<FONT color="green">223</FONT>         * This method provides the underlying source of random data used by the<a name="line.223"></a>
+<FONT color="green">224</FONT>         * other methods.&lt;/p&gt;<a name="line.224"></a>
+<FONT color="green">225</FONT>         *<a name="line.225"></a>
+<FONT color="green">226</FONT>         * @return  the next pseudorandom, uniformly distributed<a name="line.226"></a>
+<FONT color="green">227</FONT>         *  &lt;code&gt;double&lt;/code&gt; value between &lt;code&gt;0.0&lt;/code&gt; and<a name="line.227"></a>
+<FONT color="green">228</FONT>         *  &lt;code&gt;1.0&lt;/code&gt; from this random number generator's sequence<a name="line.228"></a>
+<FONT color="green">229</FONT>         */<a name="line.229"></a>
+<FONT color="green">230</FONT>        public abstract double nextDouble();<a name="line.230"></a>
+<FONT color="green">231</FONT>    <a name="line.231"></a>
+<FONT color="green">232</FONT>        /**<a name="line.232"></a>
+<FONT color="green">233</FONT>         * Returns the next pseudorandom, Gaussian ("normally") distributed<a name="line.233"></a>
+<FONT color="green">234</FONT>         * &lt;code&gt;double&lt;/code&gt; value with mean &lt;code&gt;0.0&lt;/code&gt; and standard<a name="line.234"></a>
+<FONT color="green">235</FONT>         * deviation &lt;code&gt;1.0&lt;/code&gt; from this random number generator's sequence.<a name="line.235"></a>
+<FONT color="green">236</FONT>         * &lt;p&gt;<a name="line.236"></a>
+<FONT color="green">237</FONT>         * The default implementation uses the &lt;em&gt;Polar Method&lt;/em&gt;<a name="line.237"></a>
+<FONT color="green">238</FONT>         * due to G.E.P. Box, M.E. Muller and G. Marsaglia, as described in<a name="line.238"></a>
+<FONT color="green">239</FONT>         * D. Knuth, &lt;u&gt;The Art of Computer Programming&lt;/u&gt;, 3.4.1C.&lt;/p&gt;<a name="line.239"></a>
+<FONT color="green">240</FONT>         * &lt;p&gt;<a name="line.240"></a>
+<FONT color="green">241</FONT>         * The algorithm generates a pair of independent random values.  One of<a name="line.241"></a>
+<FONT color="green">242</FONT>         * these is cached for reuse, so the full algorithm is not executed on each<a name="line.242"></a>
+<FONT color="green">243</FONT>         * activation.  Implementations that do not override this method should<a name="line.243"></a>
+<FONT color="green">244</FONT>         * make sure to call {@link #clear} to clear the cached value in the<a name="line.244"></a>
+<FONT color="green">245</FONT>         * implementation of {@link #setSeed(long)}.&lt;/p&gt;<a name="line.245"></a>
+<FONT color="green">246</FONT>         *<a name="line.246"></a>
+<FONT color="green">247</FONT>         * @return  the next pseudorandom, Gaussian ("normally") distributed<a name="line.247"></a>
+<FONT color="green">248</FONT>         * &lt;code&gt;double&lt;/code&gt; value with mean &lt;code&gt;0.0&lt;/code&gt; and<a name="line.248"></a>
+<FONT color="green">249</FONT>         * standard deviation &lt;code&gt;1.0&lt;/code&gt; from this random number<a name="line.249"></a>
+<FONT color="green">250</FONT>         *  generator's sequence<a name="line.250"></a>
+<FONT color="green">251</FONT>         */<a name="line.251"></a>
+<FONT color="green">252</FONT>        public double nextGaussian() {<a name="line.252"></a>
+<FONT color="green">253</FONT>            if (!Double.isNaN(cachedNormalDeviate)) {<a name="line.253"></a>
+<FONT color="green">254</FONT>                double dev = cachedNormalDeviate;<a name="line.254"></a>
+<FONT color="green">255</FONT>                cachedNormalDeviate = Double.NaN;<a name="line.255"></a>
+<FONT color="green">256</FONT>                return dev;<a name="line.256"></a>
+<FONT color="green">257</FONT>            }<a name="line.257"></a>
+<FONT color="green">258</FONT>            double v1 = 0;<a name="line.258"></a>
+<FONT color="green">259</FONT>            double v2 = 0;<a name="line.259"></a>
+<FONT color="green">260</FONT>            double s = 1;<a name="line.260"></a>
+<FONT color="green">261</FONT>            while (s &gt;=1 ) {<a name="line.261"></a>
+<FONT color="green">262</FONT>                v1 = 2 * nextDouble() - 1;<a name="line.262"></a>
+<FONT color="green">263</FONT>                v2 = 2 * nextDouble() - 1;<a name="line.263"></a>
+<FONT color="green">264</FONT>                s = v1 * v1 + v2 * v2;<a name="line.264"></a>
+<FONT color="green">265</FONT>            }<a name="line.265"></a>
+<FONT color="green">266</FONT>            if (s != 0) {<a name="line.266"></a>
+<FONT color="green">267</FONT>                s = Math.sqrt(-2 * Math.log(s) / s);<a name="line.267"></a>
+<FONT color="green">268</FONT>            }<a name="line.268"></a>
+<FONT color="green">269</FONT>            cachedNormalDeviate = v2 * s;<a name="line.269"></a>
+<FONT color="green">270</FONT>            return v1 * s;<a name="line.270"></a>
+<FONT color="green">271</FONT>        }<a name="line.271"></a>
+<FONT color="green">272</FONT>    }<a name="line.272"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/BitsStreamGenerator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,219 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.random;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /** Base class for random number generators that generates bits streams.<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @since 2.0<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public abstract class BitsStreamGenerator implements RandomGenerator {<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>        /** Next gaussian. */<a name="line.29"></a>
+<FONT color="green">030</FONT>        private double nextGaussian;<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** Creates a new random number generator.<a name="line.32"></a>
+<FONT color="green">033</FONT>         */<a name="line.33"></a>
+<FONT color="green">034</FONT>        public BitsStreamGenerator() {<a name="line.34"></a>
+<FONT color="green">035</FONT>            nextGaussian = Double.NaN;<a name="line.35"></a>
+<FONT color="green">036</FONT>        }<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** {@inheritDoc} */<a name="line.38"></a>
+<FONT color="green">039</FONT>        public abstract void setSeed(int seed);<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** {@inheritDoc} */<a name="line.41"></a>
+<FONT color="green">042</FONT>        public abstract void setSeed(int[] seed);<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** {@inheritDoc} */<a name="line.44"></a>
+<FONT color="green">045</FONT>        public abstract void setSeed(long seed);<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** Generate next pseudorandom number.<a name="line.47"></a>
+<FONT color="green">048</FONT>         * &lt;p&gt;This method is the core generation algorithm. It is used by all the<a name="line.48"></a>
+<FONT color="green">049</FONT>         * public generation methods for the various primitive types {@link<a name="line.49"></a>
+<FONT color="green">050</FONT>         * #nextBoolean()}, {@link #nextBytes(byte[])}, {@link #nextDouble()},<a name="line.50"></a>
+<FONT color="green">051</FONT>         * {@link #nextFloat()}, {@link #nextGaussian()}, {@link #nextInt()},<a name="line.51"></a>
+<FONT color="green">052</FONT>         * {@link #next(int)} and {@link #nextLong()}.&lt;/p&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>         * @param bits number of random bits to produce<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @return random bits generated<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        protected abstract int next(int bits);<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /** {@inheritDoc} */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public boolean nextBoolean() {<a name="line.59"></a>
+<FONT color="green">060</FONT>            return next(1) != 0;<a name="line.60"></a>
+<FONT color="green">061</FONT>        }<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /** {@inheritDoc} */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public void nextBytes(byte[] bytes) {<a name="line.64"></a>
+<FONT color="green">065</FONT>            int i = 0;<a name="line.65"></a>
+<FONT color="green">066</FONT>            final int iEnd = bytes.length - 3;<a name="line.66"></a>
+<FONT color="green">067</FONT>            while (i &lt; iEnd) {<a name="line.67"></a>
+<FONT color="green">068</FONT>                final int random = next(32);<a name="line.68"></a>
+<FONT color="green">069</FONT>                bytes[i]     = (byte) (random &amp; 0xff);<a name="line.69"></a>
+<FONT color="green">070</FONT>                bytes[i + 1] = (byte) ((random &gt;&gt;  8) &amp; 0xff);<a name="line.70"></a>
+<FONT color="green">071</FONT>                bytes[i + 2] = (byte) ((random &gt;&gt; 16) &amp; 0xff);<a name="line.71"></a>
+<FONT color="green">072</FONT>                bytes[i + 3] = (byte) ((random &gt;&gt; 24) &amp; 0xff);<a name="line.72"></a>
+<FONT color="green">073</FONT>                i += 4;<a name="line.73"></a>
+<FONT color="green">074</FONT>            }<a name="line.74"></a>
+<FONT color="green">075</FONT>            int random = next(32);<a name="line.75"></a>
+<FONT color="green">076</FONT>            while (i &lt; bytes.length) {<a name="line.76"></a>
+<FONT color="green">077</FONT>                bytes[i++] = (byte) (random &amp; 0xff);<a name="line.77"></a>
+<FONT color="green">078</FONT>                random     = random &gt;&gt; 8;<a name="line.78"></a>
+<FONT color="green">079</FONT>            }<a name="line.79"></a>
+<FONT color="green">080</FONT>        }<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>        /** {@inheritDoc} */<a name="line.82"></a>
+<FONT color="green">083</FONT>        public double nextDouble() {<a name="line.83"></a>
+<FONT color="green">084</FONT>            final long high = ((long) next(26)) &lt;&lt; 26;<a name="line.84"></a>
+<FONT color="green">085</FONT>            final int  low  = next(26);<a name="line.85"></a>
+<FONT color="green">086</FONT>            return (high | low) * 0x1.0p-52d;<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /** {@inheritDoc} */<a name="line.89"></a>
+<FONT color="green">090</FONT>        public float nextFloat() {<a name="line.90"></a>
+<FONT color="green">091</FONT>            return next(23) * 0x1.0p-23f;<a name="line.91"></a>
+<FONT color="green">092</FONT>        }<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>        /** {@inheritDoc} */<a name="line.94"></a>
+<FONT color="green">095</FONT>        public double nextGaussian() {<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>            final double random;<a name="line.97"></a>
+<FONT color="green">098</FONT>            if (Double.isNaN(nextGaussian)) {<a name="line.98"></a>
+<FONT color="green">099</FONT>                // generate a new pair of gaussian numbers<a name="line.99"></a>
+<FONT color="green">100</FONT>                final double x = nextDouble();<a name="line.100"></a>
+<FONT color="green">101</FONT>                final double y = nextDouble();<a name="line.101"></a>
+<FONT color="green">102</FONT>                final double alpha = 2 * Math.PI * x;<a name="line.102"></a>
+<FONT color="green">103</FONT>                final double r      = Math.sqrt(-2 * Math.log(y));<a name="line.103"></a>
+<FONT color="green">104</FONT>                random       = r * Math.cos(alpha);<a name="line.104"></a>
+<FONT color="green">105</FONT>                nextGaussian = r * Math.sin(alpha);<a name="line.105"></a>
+<FONT color="green">106</FONT>            } else {<a name="line.106"></a>
+<FONT color="green">107</FONT>                // use the second element of the pair already generated<a name="line.107"></a>
+<FONT color="green">108</FONT>                random = nextGaussian;<a name="line.108"></a>
+<FONT color="green">109</FONT>                nextGaussian = Double.NaN;<a name="line.109"></a>
+<FONT color="green">110</FONT>            }<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>            return random;<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        }<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>        /** {@inheritDoc} */<a name="line.116"></a>
+<FONT color="green">117</FONT>        public int nextInt() {<a name="line.117"></a>
+<FONT color="green">118</FONT>            return next(32);<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /** {@inheritDoc} */<a name="line.121"></a>
+<FONT color="green">122</FONT>        public int nextInt(int n) throws IllegalArgumentException {<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>            if (n &lt; 1) {<a name="line.124"></a>
+<FONT color="green">125</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.125"></a>
+<FONT color="green">126</FONT>                      "upper bound must be positive ({0})", n);<a name="line.126"></a>
+<FONT color="green">127</FONT>            }<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>            // find bit mask for n<a name="line.129"></a>
+<FONT color="green">130</FONT>            int mask = n;<a name="line.130"></a>
+<FONT color="green">131</FONT>            mask |= mask &gt;&gt; 1;<a name="line.131"></a>
+<FONT color="green">132</FONT>            mask |= mask &gt;&gt; 2;<a name="line.132"></a>
+<FONT color="green">133</FONT>            mask |= mask &gt;&gt; 4;<a name="line.133"></a>
+<FONT color="green">134</FONT>            mask |= mask &gt;&gt; 8;<a name="line.134"></a>
+<FONT color="green">135</FONT>            mask |= mask &gt;&gt; 16;<a name="line.135"></a>
+<FONT color="green">136</FONT>    <a name="line.136"></a>
+<FONT color="green">137</FONT>            while (true) {<a name="line.137"></a>
+<FONT color="green">138</FONT>                final int random = next(32) &amp; mask;<a name="line.138"></a>
+<FONT color="green">139</FONT>                if (random &lt; n) {<a name="line.139"></a>
+<FONT color="green">140</FONT>                    return random;<a name="line.140"></a>
+<FONT color="green">141</FONT>                }<a name="line.141"></a>
+<FONT color="green">142</FONT>            }<a name="line.142"></a>
+<FONT color="green">143</FONT>    <a name="line.143"></a>
+<FONT color="green">144</FONT>        }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>        /** {@inheritDoc} */<a name="line.146"></a>
+<FONT color="green">147</FONT>        public long nextLong() {<a name="line.147"></a>
+<FONT color="green">148</FONT>            final long high  = ((long) next(32)) &lt;&lt; 32;<a name="line.148"></a>
+<FONT color="green">149</FONT>            final long  low  = ((long) next(32)) &amp; 0xffffffffL;<a name="line.149"></a>
+<FONT color="green">150</FONT>            return high | low;<a name="line.150"></a>
+<FONT color="green">151</FONT>        }<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>    }<a name="line.153"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/CorrelatedRandomVectorGenerator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,369 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.random;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.DimensionMismatchException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.linear.MatrixUtils;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.linear.NotPositiveDefiniteMatrixException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.linear.RealMatrix;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * A {@link RandomVectorGenerator} that generates vectors with with<a name="line.26"></a>
+<FONT color="green">027</FONT>     * correlated components.<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;Random vectors with correlated components are built by combining<a name="line.28"></a>
+<FONT color="green">029</FONT>     * the uncorrelated components of another random vector in such a way that<a name="line.29"></a>
+<FONT color="green">030</FONT>     * the resulting correlations are the ones specified by a positive<a name="line.30"></a>
+<FONT color="green">031</FONT>     * definite covariance matrix.&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;The main use for correlated random vector generation is for Monte-Carlo<a name="line.32"></a>
+<FONT color="green">033</FONT>     * simulation of physical problems with several variables, for example to<a name="line.33"></a>
+<FONT color="green">034</FONT>     * generate error vectors to be added to a nominal vector. A particularly<a name="line.34"></a>
+<FONT color="green">035</FONT>     * interesting case is when the generated vector should be drawn from a &lt;a<a name="line.35"></a>
+<FONT color="green">036</FONT>     * href="http://en.wikipedia.org/wiki/Multivariate_normal_distribution"&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * Multivariate Normal Distribution&lt;/a&gt;. The approach using a Cholesky<a name="line.37"></a>
+<FONT color="green">038</FONT>     * decomposition is quite usual in this case. However, it cas be extended<a name="line.38"></a>
+<FONT color="green">039</FONT>     * to other cases as long as the underlying random generator provides<a name="line.39"></a>
+<FONT color="green">040</FONT>     * {@link NormalizedRandomGenerator normalized values} like {@link<a name="line.40"></a>
+<FONT color="green">041</FONT>     * GaussianRandomGenerator} or {@link UniformRandomGenerator}.&lt;/p&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;p&gt;Sometimes, the covariance matrix for a given simulation is not<a name="line.42"></a>
+<FONT color="green">043</FONT>     * strictly positive definite. This means that the correlations are<a name="line.43"></a>
+<FONT color="green">044</FONT>     * not all independent from each other. In this case, however, the non<a name="line.44"></a>
+<FONT color="green">045</FONT>     * strictly positive elements found during the Cholesky decomposition<a name="line.45"></a>
+<FONT color="green">046</FONT>     * of the covariance matrix should not be negative either, they<a name="line.46"></a>
+<FONT color="green">047</FONT>     * should be null. Another non-conventional extension handling this case<a name="line.47"></a>
+<FONT color="green">048</FONT>     * is used here. Rather than computing &lt;code&gt;C = U&lt;sup&gt;T&lt;/sup&gt;.U&lt;/code&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>     * where &lt;code&gt;C&lt;/code&gt; is the covariance matrix and &lt;code&gt;U&lt;/code&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     * is an uppertriangular matrix, we compute &lt;code&gt;C = B.B&lt;sup&gt;T&lt;/sup&gt;&lt;/code&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>     * where &lt;code&gt;B&lt;/code&gt; is a rectangular matrix having<a name="line.51"></a>
+<FONT color="green">052</FONT>     * more rows than columns. The number of columns of &lt;code&gt;B&lt;/code&gt; is<a name="line.52"></a>
+<FONT color="green">053</FONT>     * the rank of the covariance matrix, and it is the dimension of the<a name="line.53"></a>
+<FONT color="green">054</FONT>     * uncorrelated random vector that is needed to compute the component<a name="line.54"></a>
+<FONT color="green">055</FONT>     * of the correlated vector. This class handles this situation<a name="line.55"></a>
+<FONT color="green">056</FONT>     * automatically.&lt;/p&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>     *<a name="line.57"></a>
+<FONT color="green">058</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.58"></a>
+<FONT color="green">059</FONT>     * @since 1.2<a name="line.59"></a>
+<FONT color="green">060</FONT>     */<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>    public class CorrelatedRandomVectorGenerator<a name="line.62"></a>
+<FONT color="green">063</FONT>        implements RandomVectorGenerator {<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Mean vector. */<a name="line.65"></a>
+<FONT color="green">066</FONT>        private final double[] mean;<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /** Underlying generator. */<a name="line.68"></a>
+<FONT color="green">069</FONT>        private final NormalizedRandomGenerator generator;<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** Storage for the normalized vector. */<a name="line.71"></a>
+<FONT color="green">072</FONT>        private final double[] normalized;<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /** Permutated Cholesky root of the covariance matrix. */<a name="line.74"></a>
+<FONT color="green">075</FONT>        private RealMatrix root;<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** Rank of the covariance matrix. */<a name="line.77"></a>
+<FONT color="green">078</FONT>        private int rank;<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /** Simple constructor.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * &lt;p&gt;Build a correlated random vector generator from its mean<a name="line.81"></a>
+<FONT color="green">082</FONT>         * vector and covariance matrix.&lt;/p&gt;<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param mean expected mean values for all components<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @param covariance covariance matrix<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @param small diagonal elements threshold under which  column are<a name="line.85"></a>
+<FONT color="green">086</FONT>         * considered to be dependent on previous ones and are discarded<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @param generator underlying generator for uncorrelated normalized<a name="line.87"></a>
+<FONT color="green">088</FONT>         * components<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @exception IllegalArgumentException if there is a dimension<a name="line.89"></a>
+<FONT color="green">090</FONT>         * mismatch between the mean vector and the covariance matrix<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @exception NotPositiveDefiniteMatrixException if the<a name="line.91"></a>
+<FONT color="green">092</FONT>         * covariance matrix is not strictly positive definite<a name="line.92"></a>
+<FONT color="green">093</FONT>         * @exception DimensionMismatchException if the mean and covariance<a name="line.93"></a>
+<FONT color="green">094</FONT>         * arrays dimensions don't match<a name="line.94"></a>
+<FONT color="green">095</FONT>         */<a name="line.95"></a>
+<FONT color="green">096</FONT>        public CorrelatedRandomVectorGenerator(double[] mean,<a name="line.96"></a>
+<FONT color="green">097</FONT>                                               RealMatrix covariance, double small,<a name="line.97"></a>
+<FONT color="green">098</FONT>                                               NormalizedRandomGenerator generator)<a name="line.98"></a>
+<FONT color="green">099</FONT>        throws NotPositiveDefiniteMatrixException, DimensionMismatchException {<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>            int order = covariance.getRowDimension();<a name="line.101"></a>
+<FONT color="green">102</FONT>            if (mean.length != order) {<a name="line.102"></a>
+<FONT color="green">103</FONT>                throw new DimensionMismatchException(mean.length, order);<a name="line.103"></a>
+<FONT color="green">104</FONT>            }<a name="line.104"></a>
+<FONT color="green">105</FONT>            this.mean = mean.clone();<a name="line.105"></a>
+<FONT color="green">106</FONT>    <a name="line.106"></a>
+<FONT color="green">107</FONT>            decompose(covariance, small);<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>            this.generator = generator;<a name="line.109"></a>
+<FONT color="green">110</FONT>            normalized = new double[rank];<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>        }<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /** Simple constructor.<a name="line.114"></a>
+<FONT color="green">115</FONT>         * &lt;p&gt;Build a null mean random correlated vector generator from its<a name="line.115"></a>
+<FONT color="green">116</FONT>         * covariance matrix.&lt;/p&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @param covariance covariance matrix<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @param small diagonal elements threshold under which  column are<a name="line.118"></a>
+<FONT color="green">119</FONT>         * considered to be dependent on previous ones and are discarded<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @param generator underlying generator for uncorrelated normalized<a name="line.120"></a>
+<FONT color="green">121</FONT>         * components<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @exception NotPositiveDefiniteMatrixException if the<a name="line.122"></a>
+<FONT color="green">123</FONT>         * covariance matrix is not strictly positive definite<a name="line.123"></a>
+<FONT color="green">124</FONT>         */<a name="line.124"></a>
+<FONT color="green">125</FONT>        public CorrelatedRandomVectorGenerator(RealMatrix covariance, double small,<a name="line.125"></a>
+<FONT color="green">126</FONT>                                               NormalizedRandomGenerator generator)<a name="line.126"></a>
+<FONT color="green">127</FONT>        throws NotPositiveDefiniteMatrixException {<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>            int order = covariance.getRowDimension();<a name="line.129"></a>
+<FONT color="green">130</FONT>            mean = new double[order];<a name="line.130"></a>
+<FONT color="green">131</FONT>            for (int i = 0; i &lt; order; ++i) {<a name="line.131"></a>
+<FONT color="green">132</FONT>                mean[i] = 0;<a name="line.132"></a>
+<FONT color="green">133</FONT>            }<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>            decompose(covariance, small);<a name="line.135"></a>
+<FONT color="green">136</FONT>    <a name="line.136"></a>
+<FONT color="green">137</FONT>            this.generator = generator;<a name="line.137"></a>
+<FONT color="green">138</FONT>            normalized = new double[rank];<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>        }<a name="line.140"></a>
+<FONT color="green">141</FONT>    <a name="line.141"></a>
+<FONT color="green">142</FONT>        /** Get the underlying normalized components generator.<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @return underlying uncorrelated components generator<a name="line.143"></a>
+<FONT color="green">144</FONT>         */<a name="line.144"></a>
+<FONT color="green">145</FONT>        public NormalizedRandomGenerator getGenerator() {<a name="line.145"></a>
+<FONT color="green">146</FONT>            return generator;<a name="line.146"></a>
+<FONT color="green">147</FONT>        }<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>        /** Get the root of the covariance matrix.<a name="line.149"></a>
+<FONT color="green">150</FONT>         * The root is the rectangular matrix &lt;code&gt;B&lt;/code&gt; such that<a name="line.150"></a>
+<FONT color="green">151</FONT>         * the covariance matrix is equal to &lt;code&gt;B.B&lt;sup&gt;T&lt;/sup&gt;&lt;/code&gt;<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @return root of the square matrix<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @see #getRank()<a name="line.153"></a>
+<FONT color="green">154</FONT>         */<a name="line.154"></a>
+<FONT color="green">155</FONT>        public RealMatrix getRootMatrix() {<a name="line.155"></a>
+<FONT color="green">156</FONT>            return root;<a name="line.156"></a>
+<FONT color="green">157</FONT>        }<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>        /** Get the rank of the covariance matrix.<a name="line.159"></a>
+<FONT color="green">160</FONT>         * The rank is the number of independent rows in the covariance<a name="line.160"></a>
+<FONT color="green">161</FONT>         * matrix, it is also the number of columns of the rectangular<a name="line.161"></a>
+<FONT color="green">162</FONT>         * matrix of the decomposition.<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @return rank of the square matrix.<a name="line.163"></a>
+<FONT color="green">164</FONT>         * @see #getRootMatrix()<a name="line.164"></a>
+<FONT color="green">165</FONT>         */<a name="line.165"></a>
+<FONT color="green">166</FONT>        public int getRank() {<a name="line.166"></a>
+<FONT color="green">167</FONT>            return rank;<a name="line.167"></a>
+<FONT color="green">168</FONT>        }<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>        /** Decompose the original square matrix.<a name="line.170"></a>
+<FONT color="green">171</FONT>         * &lt;p&gt;The decomposition is based on a Choleski decomposition<a name="line.171"></a>
+<FONT color="green">172</FONT>         * where additional transforms are performed:<a name="line.172"></a>
+<FONT color="green">173</FONT>         * &lt;ul&gt;<a name="line.173"></a>
+<FONT color="green">174</FONT>         *   &lt;li&gt;the rows of the decomposed matrix are permuted&lt;/li&gt;<a name="line.174"></a>
+<FONT color="green">175</FONT>         *   &lt;li&gt;columns with the too small diagonal element are discarded&lt;/li&gt;<a name="line.175"></a>
+<FONT color="green">176</FONT>         *   &lt;li&gt;the matrix is permuted&lt;/li&gt;<a name="line.176"></a>
+<FONT color="green">177</FONT>         * &lt;/ul&gt;<a name="line.177"></a>
+<FONT color="green">178</FONT>         * This means that rather than computing M = U&lt;sup&gt;T&lt;/sup&gt;.U where U<a name="line.178"></a>
+<FONT color="green">179</FONT>         * is an upper triangular matrix, this method computed M=B.B&lt;sup&gt;T&lt;/sup&gt;<a name="line.179"></a>
+<FONT color="green">180</FONT>         * where B is a rectangular matrix.<a name="line.180"></a>
+<FONT color="green">181</FONT>         * @param covariance covariance matrix<a name="line.181"></a>
+<FONT color="green">182</FONT>         * @param small diagonal elements threshold under which  column are<a name="line.182"></a>
+<FONT color="green">183</FONT>         * considered to be dependent on previous ones and are discarded<a name="line.183"></a>
+<FONT color="green">184</FONT>         * @exception NotPositiveDefiniteMatrixException if the<a name="line.184"></a>
+<FONT color="green">185</FONT>         * covariance matrix is not strictly positive definite<a name="line.185"></a>
+<FONT color="green">186</FONT>         */<a name="line.186"></a>
+<FONT color="green">187</FONT>        private void decompose(RealMatrix covariance, double small)<a name="line.187"></a>
+<FONT color="green">188</FONT>        throws NotPositiveDefiniteMatrixException {<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>            int order = covariance.getRowDimension();<a name="line.190"></a>
+<FONT color="green">191</FONT>            double[][] c = covariance.getData();<a name="line.191"></a>
+<FONT color="green">192</FONT>            double[][] b = new double[order][order];<a name="line.192"></a>
+<FONT color="green">193</FONT>    <a name="line.193"></a>
+<FONT color="green">194</FONT>            int[] swap  = new int[order];<a name="line.194"></a>
+<FONT color="green">195</FONT>            int[] index = new int[order];<a name="line.195"></a>
+<FONT color="green">196</FONT>            for (int i = 0; i &lt; order; ++i) {<a name="line.196"></a>
+<FONT color="green">197</FONT>                index[i] = i;<a name="line.197"></a>
+<FONT color="green">198</FONT>            }<a name="line.198"></a>
+<FONT color="green">199</FONT>    <a name="line.199"></a>
+<FONT color="green">200</FONT>            rank = 0;<a name="line.200"></a>
+<FONT color="green">201</FONT>            for (boolean loop = true; loop;) {<a name="line.201"></a>
+<FONT color="green">202</FONT>    <a name="line.202"></a>
+<FONT color="green">203</FONT>                // find maximal diagonal element<a name="line.203"></a>
+<FONT color="green">204</FONT>                swap[rank] = rank;<a name="line.204"></a>
+<FONT color="green">205</FONT>                for (int i = rank + 1; i &lt; order; ++i) {<a name="line.205"></a>
+<FONT color="green">206</FONT>                    int ii  = index[i];<a name="line.206"></a>
+<FONT color="green">207</FONT>                    int isi = index[swap[i]];<a name="line.207"></a>
+<FONT color="green">208</FONT>                    if (c[ii][ii] &gt; c[isi][isi]) {<a name="line.208"></a>
+<FONT color="green">209</FONT>                        swap[rank] = i;<a name="line.209"></a>
+<FONT color="green">210</FONT>                    }<a name="line.210"></a>
+<FONT color="green">211</FONT>                }<a name="line.211"></a>
+<FONT color="green">212</FONT>    <a name="line.212"></a>
+<FONT color="green">213</FONT>    <a name="line.213"></a>
+<FONT color="green">214</FONT>                // swap elements<a name="line.214"></a>
+<FONT color="green">215</FONT>                if (swap[rank] != rank) {<a name="line.215"></a>
+<FONT color="green">216</FONT>                    int tmp = index[rank];<a name="line.216"></a>
+<FONT color="green">217</FONT>                    index[rank] = index[swap[rank]];<a name="line.217"></a>
+<FONT color="green">218</FONT>                    index[swap[rank]] = tmp;<a name="line.218"></a>
+<FONT color="green">219</FONT>                }<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>                // check diagonal element<a name="line.221"></a>
+<FONT color="green">222</FONT>                int ir = index[rank];<a name="line.222"></a>
+<FONT color="green">223</FONT>                if (c[ir][ir] &lt; small) {<a name="line.223"></a>
+<FONT color="green">224</FONT>    <a name="line.224"></a>
+<FONT color="green">225</FONT>                    if (rank == 0) {<a name="line.225"></a>
+<FONT color="green">226</FONT>                        throw new NotPositiveDefiniteMatrixException();<a name="line.226"></a>
+<FONT color="green">227</FONT>                    }<a name="line.227"></a>
+<FONT color="green">228</FONT>    <a name="line.228"></a>
+<FONT color="green">229</FONT>                    // check remaining diagonal elements<a name="line.229"></a>
+<FONT color="green">230</FONT>                    for (int i = rank; i &lt; order; ++i) {<a name="line.230"></a>
+<FONT color="green">231</FONT>                        if (c[index[i]][index[i]] &lt; -small) {<a name="line.231"></a>
+<FONT color="green">232</FONT>                            // there is at least one sufficiently negative diagonal element,<a name="line.232"></a>
+<FONT color="green">233</FONT>                            // the covariance matrix is wrong<a name="line.233"></a>
+<FONT color="green">234</FONT>                            throw new NotPositiveDefiniteMatrixException();<a name="line.234"></a>
+<FONT color="green">235</FONT>                        }<a name="line.235"></a>
+<FONT color="green">236</FONT>                    }<a name="line.236"></a>
+<FONT color="green">237</FONT>    <a name="line.237"></a>
+<FONT color="green">238</FONT>                    // all remaining diagonal elements are close to zero,<a name="line.238"></a>
+<FONT color="green">239</FONT>                    // we consider we have found the rank of the covariance matrix<a name="line.239"></a>
+<FONT color="green">240</FONT>                    ++rank;<a name="line.240"></a>
+<FONT color="green">241</FONT>                    loop = false;<a name="line.241"></a>
+<FONT color="green">242</FONT>    <a name="line.242"></a>
+<FONT color="green">243</FONT>                } else {<a name="line.243"></a>
+<FONT color="green">244</FONT>    <a name="line.244"></a>
+<FONT color="green">245</FONT>                    // transform the matrix<a name="line.245"></a>
+<FONT color="green">246</FONT>                    double sqrt = Math.sqrt(c[ir][ir]);<a name="line.246"></a>
+<FONT color="green">247</FONT>                    b[rank][rank] = sqrt;<a name="line.247"></a>
+<FONT color="green">248</FONT>                    double inverse = 1 / sqrt;<a name="line.248"></a>
+<FONT color="green">249</FONT>                    for (int i = rank + 1; i &lt; order; ++i) {<a name="line.249"></a>
+<FONT color="green">250</FONT>                        int ii = index[i];<a name="line.250"></a>
+<FONT color="green">251</FONT>                        double e = inverse * c[ii][ir];<a name="line.251"></a>
+<FONT color="green">252</FONT>                        b[i][rank] = e;<a name="line.252"></a>
+<FONT color="green">253</FONT>                        c[ii][ii] -= e * e;<a name="line.253"></a>
+<FONT color="green">254</FONT>                        for (int j = rank + 1; j &lt; i; ++j) {<a name="line.254"></a>
+<FONT color="green">255</FONT>                            int ij = index[j];<a name="line.255"></a>
+<FONT color="green">256</FONT>                            double f = c[ii][ij] - e * b[j][rank];<a name="line.256"></a>
+<FONT color="green">257</FONT>                            c[ii][ij] = f;<a name="line.257"></a>
+<FONT color="green">258</FONT>                            c[ij][ii] = f;<a name="line.258"></a>
+<FONT color="green">259</FONT>                        }<a name="line.259"></a>
+<FONT color="green">260</FONT>                    }<a name="line.260"></a>
+<FONT color="green">261</FONT>    <a name="line.261"></a>
+<FONT color="green">262</FONT>                    // prepare next iteration<a name="line.262"></a>
+<FONT color="green">263</FONT>                    loop = ++rank &lt; order;<a name="line.263"></a>
+<FONT color="green">264</FONT>    <a name="line.264"></a>
+<FONT color="green">265</FONT>                }<a name="line.265"></a>
+<FONT color="green">266</FONT>    <a name="line.266"></a>
+<FONT color="green">267</FONT>            }<a name="line.267"></a>
+<FONT color="green">268</FONT>    <a name="line.268"></a>
+<FONT color="green">269</FONT>            // build the root matrix<a name="line.269"></a>
+<FONT color="green">270</FONT>            root = MatrixUtils.createRealMatrix(order, rank);<a name="line.270"></a>
+<FONT color="green">271</FONT>            for (int i = 0; i &lt; order; ++i) {<a name="line.271"></a>
+<FONT color="green">272</FONT>                for (int j = 0; j &lt; rank; ++j) {<a name="line.272"></a>
+<FONT color="green">273</FONT>                    root.setEntry(index[i], j, b[i][j]);<a name="line.273"></a>
+<FONT color="green">274</FONT>                }<a name="line.274"></a>
+<FONT color="green">275</FONT>            }<a name="line.275"></a>
+<FONT color="green">276</FONT>    <a name="line.276"></a>
+<FONT color="green">277</FONT>        }<a name="line.277"></a>
+<FONT color="green">278</FONT>    <a name="line.278"></a>
+<FONT color="green">279</FONT>        /** Generate a correlated random vector.<a name="line.279"></a>
+<FONT color="green">280</FONT>         * @return a random vector as an array of double. The returned array<a name="line.280"></a>
+<FONT color="green">281</FONT>         * is created at each call, the caller can do what it wants with it.<a name="line.281"></a>
+<FONT color="green">282</FONT>         */<a name="line.282"></a>
+<FONT color="green">283</FONT>        public double[] nextVector() {<a name="line.283"></a>
+<FONT color="green">284</FONT>    <a name="line.284"></a>
+<FONT color="green">285</FONT>            // generate uncorrelated vector<a name="line.285"></a>
+<FONT color="green">286</FONT>            for (int i = 0; i &lt; rank; ++i) {<a name="line.286"></a>
+<FONT color="green">287</FONT>                normalized[i] = generator.nextNormalizedDouble();<a name="line.287"></a>
+<FONT color="green">288</FONT>            }<a name="line.288"></a>
+<FONT color="green">289</FONT>    <a name="line.289"></a>
+<FONT color="green">290</FONT>            // compute correlated vector<a name="line.290"></a>
+<FONT color="green">291</FONT>            double[] correlated = new double[mean.length];<a name="line.291"></a>
+<FONT color="green">292</FONT>            for (int i = 0; i &lt; correlated.length; ++i) {<a name="line.292"></a>
+<FONT color="green">293</FONT>                correlated[i] = mean[i];<a name="line.293"></a>
+<FONT color="green">294</FONT>                for (int j = 0; j &lt; rank; ++j) {<a name="line.294"></a>
+<FONT color="green">295</FONT>                    correlated[i] += root.getEntry(i, j) * normalized[j];<a name="line.295"></a>
+<FONT color="green">296</FONT>                }<a name="line.296"></a>
+<FONT color="green">297</FONT>            }<a name="line.297"></a>
+<FONT color="green">298</FONT>    <a name="line.298"></a>
+<FONT color="green">299</FONT>            return correlated;<a name="line.299"></a>
+<FONT color="green">300</FONT>    <a name="line.300"></a>
+<FONT color="green">301</FONT>        }<a name="line.301"></a>
+<FONT color="green">302</FONT>    <a name="line.302"></a>
+<FONT color="green">303</FONT>    }<a name="line.303"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/EmpiricalDistribution.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,199 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.random;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.IOException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.io.File;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.net.URL;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.util.List;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.stat.descriptive.StatisticalSummary;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.stat.descriptive.SummaryStatistics;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    /**<a name="line.28"></a>
+<FONT color="green">029</FONT>     * Represents an &lt;a href="http://random.mat.sbg.ac.at/~ste/dipl/node11.html"&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * empirical probability distribution&lt;/a&gt; -- a probability distribution derived<a name="line.30"></a>
+<FONT color="green">031</FONT>     * from observed data without making any assumptions about the functional form<a name="line.31"></a>
+<FONT color="green">032</FONT>     * of the population distribution that the data come from.&lt;p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * Implementations of this interface maintain data structures, called<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;i&gt;distribution digests&lt;/i&gt;, that describe empirical distributions and<a name="line.34"></a>
+<FONT color="green">035</FONT>     * support the following operations: &lt;ul&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;li&gt;loading the distribution from a file of observed data values&lt;/li&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;li&gt;dividing the input data into "bin ranges" and reporting bin frequency<a name="line.37"></a>
+<FONT color="green">038</FONT>     *     counts (data for histogram)&lt;/li&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;li&gt;reporting univariate statistics describing the full set of data values<a name="line.39"></a>
+<FONT color="green">040</FONT>     *     as well as the observations within each bin&lt;/li&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;li&gt;generating random values from the distribution&lt;/li&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;/ul&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     * Applications can use &lt;code&gt;EmpiricalDistribution&lt;/code&gt; implementations to<a name="line.43"></a>
+<FONT color="green">044</FONT>     * build grouped frequency histograms representing the input data or to<a name="line.44"></a>
+<FONT color="green">045</FONT>     * generate random values "like" those in the input file -- i.e., the values<a name="line.45"></a>
+<FONT color="green">046</FONT>     * generated will follow the distribution of the values in the file.&lt;/p&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     *<a name="line.47"></a>
+<FONT color="green">048</FONT>     * @version $Revision: 817128 $ $Date: 2009-09-20 21:30:53 -0400 (Sun, 20 Sep 2009) $<a name="line.48"></a>
+<FONT color="green">049</FONT>     */<a name="line.49"></a>
+<FONT color="green">050</FONT>    public interface EmpiricalDistribution {<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * Computes the empirical distribution from the provided<a name="line.53"></a>
+<FONT color="green">054</FONT>         * array of numbers.<a name="line.54"></a>
+<FONT color="green">055</FONT>         *<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param dataArray the data array<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        void load(double[] dataArray);<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /**<a name="line.60"></a>
+<FONT color="green">061</FONT>         * Computes the empirical distribution from the input file.<a name="line.61"></a>
+<FONT color="green">062</FONT>         *<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @param file the input file<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @throws IOException if an IO error occurs<a name="line.64"></a>
+<FONT color="green">065</FONT>         */<a name="line.65"></a>
+<FONT color="green">066</FONT>        void load(File file) throws IOException;<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /**<a name="line.68"></a>
+<FONT color="green">069</FONT>         * Computes the empirical distribution using data read from a URL.<a name="line.69"></a>
+<FONT color="green">070</FONT>         *<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param url url of the input file<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @throws IOException if an IO error occurs<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        void load(URL url) throws IOException;<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        /**<a name="line.76"></a>
+<FONT color="green">077</FONT>         * Generates a random value from this distribution.<a name="line.77"></a>
+<FONT color="green">078</FONT>         * &lt;strong&gt;Preconditions:&lt;/strong&gt;&lt;ul&gt;<a name="line.78"></a>
+<FONT color="green">079</FONT>         * &lt;li&gt;the distribution must be loaded before invoking this method&lt;/li&gt;&lt;/ul&gt;<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @return the random value.<a name="line.80"></a>
+<FONT color="green">081</FONT>         *<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @throws IllegalStateException if the distribution has not been loaded<a name="line.82"></a>
+<FONT color="green">083</FONT>         */<a name="line.83"></a>
+<FONT color="green">084</FONT>        double getNextValue() throws IllegalStateException;<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>        /**<a name="line.87"></a>
+<FONT color="green">088</FONT>         * Returns a<a name="line.88"></a>
+<FONT color="green">089</FONT>         * {@link org.apache.commons.math.stat.descriptive.StatisticalSummary}<a name="line.89"></a>
+<FONT color="green">090</FONT>         * describing this distribution.<a name="line.90"></a>
+<FONT color="green">091</FONT>         * &lt;strong&gt;Preconditions:&lt;/strong&gt;&lt;ul&gt;<a name="line.91"></a>
+<FONT color="green">092</FONT>         * &lt;li&gt;the distribution must be loaded before invoking this method&lt;/li&gt;<a name="line.92"></a>
+<FONT color="green">093</FONT>         * &lt;/ul&gt;<a name="line.93"></a>
+<FONT color="green">094</FONT>         *<a name="line.94"></a>
+<FONT color="green">095</FONT>         * @return the sample statistics<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @throws IllegalStateException if the distribution has not been loaded<a name="line.96"></a>
+<FONT color="green">097</FONT>         */<a name="line.97"></a>
+<FONT color="green">098</FONT>        StatisticalSummary getSampleStats() throws IllegalStateException;<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>        /**<a name="line.100"></a>
+<FONT color="green">101</FONT>         * Property indicating whether or not the distribution has been loaded.<a name="line.101"></a>
+<FONT color="green">102</FONT>         *<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @return true if the distribution has been loaded<a name="line.103"></a>
+<FONT color="green">104</FONT>         */<a name="line.104"></a>
+<FONT color="green">105</FONT>        boolean isLoaded();<a name="line.105"></a>
+<FONT color="green">106</FONT>    <a name="line.106"></a>
+<FONT color="green">107</FONT>         /**<a name="line.107"></a>
+<FONT color="green">108</FONT>         * Returns the number of bins.<a name="line.108"></a>
+<FONT color="green">109</FONT>         *<a name="line.109"></a>
+<FONT color="green">110</FONT>         * @return the number of bins<a name="line.110"></a>
+<FONT color="green">111</FONT>         */<a name="line.111"></a>
+<FONT color="green">112</FONT>        int getBinCount();<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /**<a name="line.114"></a>
+<FONT color="green">115</FONT>         * Returns a list of<a name="line.115"></a>
+<FONT color="green">116</FONT>         * {@link org.apache.commons.math.stat.descriptive.SummaryStatistics}<a name="line.116"></a>
+<FONT color="green">117</FONT>         * containing statistics describing the values in each of the bins.  The<a name="line.117"></a>
+<FONT color="green">118</FONT>         * List is indexed on the bin number.<a name="line.118"></a>
+<FONT color="green">119</FONT>         *<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @return List of bin statistics<a name="line.120"></a>
+<FONT color="green">121</FONT>         */<a name="line.121"></a>
+<FONT color="green">122</FONT>        List&lt;SummaryStatistics&gt; getBinStats();<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>        /**<a name="line.124"></a>
+<FONT color="green">125</FONT>         * Returns the array of upper bounds for the bins.  Bins are: &lt;br/&gt;<a name="line.125"></a>
+<FONT color="green">126</FONT>         * [min,upperBounds[0]],(upperBounds[0],upperBounds[1]],...,<a name="line.126"></a>
+<FONT color="green">127</FONT>         *  (upperBounds[binCount-2], upperBounds[binCount-1] = max].<a name="line.127"></a>
+<FONT color="green">128</FONT>         *<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @return array of bin upper bounds<a name="line.129"></a>
+<FONT color="green">130</FONT>         */<a name="line.130"></a>
+<FONT color="green">131</FONT>        double[] getUpperBounds();<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>    }<a name="line.133"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/EmpiricalDistributionImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,543 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.random;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.BufferedReader;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.io.File;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.io.FileReader;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.io.IOException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import java.io.InputStreamReader;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import java.io.Serializable;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import java.net.URL;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import java.util.ArrayList;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import java.util.List;<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.30"></a>
+<FONT color="green">031</FONT>    import org.apache.commons.math.stat.descriptive.StatisticalSummary;<a name="line.31"></a>
+<FONT color="green">032</FONT>    import org.apache.commons.math.stat.descriptive.SummaryStatistics;<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>    /**<a name="line.34"></a>
+<FONT color="green">035</FONT>     * Implements &lt;code&gt;EmpiricalDistribution&lt;/code&gt; interface.  This implementation<a name="line.35"></a>
+<FONT color="green">036</FONT>     * uses what amounts to the<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;a href="http://nedwww.ipac.caltech.edu/level5/March02/Silverman/Silver2_6.html"&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * Variable Kernel Method&lt;/a&gt; with Gaussian smoothing:&lt;p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;strong&gt;Digesting the input file&lt;/strong&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;ol&gt;&lt;li&gt;Pass the file once to compute min and max.&lt;/li&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;li&gt;Divide the range from min-max into &lt;code&gt;binCount&lt;/code&gt; "bins."&lt;/li&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;li&gt;Pass the data file again, computing bin counts and univariate<a name="line.42"></a>
+<FONT color="green">043</FONT>     *     statistics (mean, std dev.) for each of the bins &lt;/li&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;li&gt;Divide the interval (0,1) into subintervals associated with the bins,<a name="line.44"></a>
+<FONT color="green">045</FONT>     *     with the length of a bin's subinterval proportional to its count.&lt;/li&gt;&lt;/ol&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     * &lt;strong&gt;Generating random values from the distribution&lt;/strong&gt;&lt;ol&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     * &lt;li&gt;Generate a uniformly distributed value in (0,1) &lt;/li&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     * &lt;li&gt;Select the subinterval to which the value belongs.<a name="line.48"></a>
+<FONT color="green">049</FONT>     * &lt;li&gt;Generate a random Gaussian value with mean = mean of the associated<a name="line.49"></a>
+<FONT color="green">050</FONT>     *     bin and std dev = std dev of associated bin.&lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;&lt;p&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>     *&lt;strong&gt;USAGE NOTES:&lt;/strong&gt;&lt;ul&gt;<a name="line.51"></a>
+<FONT color="green">052</FONT>     *&lt;li&gt;The &lt;code&gt;binCount&lt;/code&gt; is set by default to 1000.  A good rule of thumb<a name="line.52"></a>
+<FONT color="green">053</FONT>     *    is to set the bin count to approximately the length of the input file divided<a name="line.53"></a>
+<FONT color="green">054</FONT>     *    by 10. &lt;/li&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>     *&lt;li&gt;The input file &lt;i&gt;must&lt;/i&gt; be a plain text file containing one valid numeric<a name="line.55"></a>
+<FONT color="green">056</FONT>     *    entry per line.&lt;/li&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>     * &lt;/ul&gt;&lt;/p&gt;<a name="line.57"></a>
+<FONT color="green">058</FONT>     *<a name="line.58"></a>
+<FONT color="green">059</FONT>     * @version $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $<a name="line.59"></a>
+<FONT color="green">060</FONT>     */<a name="line.60"></a>
+<FONT color="green">061</FONT>    public class EmpiricalDistributionImpl implements Serializable, EmpiricalDistribution {<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /** Serializable version identifier */<a name="line.63"></a>
+<FONT color="green">064</FONT>        private static final long serialVersionUID = 5729073523949762654L;<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /** List of SummaryStatistics objects characterizing the bins */<a name="line.66"></a>
+<FONT color="green">067</FONT>        private List&lt;SummaryStatistics&gt; binStats = null;<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /** Sample statistics */<a name="line.69"></a>
+<FONT color="green">070</FONT>        private SummaryStatistics sampleStats = null;<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /** Max loaded value */<a name="line.72"></a>
+<FONT color="green">073</FONT>        private double max = Double.NEGATIVE_INFINITY;<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /** Min loaded value */<a name="line.75"></a>
+<FONT color="green">076</FONT>        private double min = Double.POSITIVE_INFINITY;<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /** Grid size */<a name="line.78"></a>
+<FONT color="green">079</FONT>        private double delta = 0d;<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /** number of bins */<a name="line.81"></a>
+<FONT color="green">082</FONT>        private int binCount = 1000;<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /** is the distribution loaded? */<a name="line.84"></a>
+<FONT color="green">085</FONT>        private boolean loaded = false;<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>        /** upper bounds of subintervals in (0,1) "belonging" to the bins */<a name="line.87"></a>
+<FONT color="green">088</FONT>        private double[] upperBounds = null;<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>        /** RandomData instance to use in repeated calls to getNext() */<a name="line.90"></a>
+<FONT color="green">091</FONT>        private RandomData randomData = new RandomDataImpl();<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /**<a name="line.93"></a>
+<FONT color="green">094</FONT>         * Creates a new EmpiricalDistribution with the default bin count.<a name="line.94"></a>
+<FONT color="green">095</FONT>         */<a name="line.95"></a>
+<FONT color="green">096</FONT>        public EmpiricalDistributionImpl() {<a name="line.96"></a>
+<FONT color="green">097</FONT>            binStats = new ArrayList&lt;SummaryStatistics&gt;();<a name="line.97"></a>
+<FONT color="green">098</FONT>        }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>        /**<a name="line.100"></a>
+<FONT color="green">101</FONT>         * Creates a new EmpiricalDistribution  with the specified bin count.<a name="line.101"></a>
+<FONT color="green">102</FONT>         *<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @param binCount number of bins<a name="line.103"></a>
+<FONT color="green">104</FONT>         */<a name="line.104"></a>
+<FONT color="green">105</FONT>        public EmpiricalDistributionImpl(int binCount) {<a name="line.105"></a>
+<FONT color="green">106</FONT>            this.binCount = binCount;<a name="line.106"></a>
+<FONT color="green">107</FONT>            binStats = new ArrayList&lt;SummaryStatistics&gt;();<a name="line.107"></a>
+<FONT color="green">108</FONT>        }<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>         /**<a name="line.110"></a>
+<FONT color="green">111</FONT>         * Computes the empirical distribution from the provided<a name="line.111"></a>
+<FONT color="green">112</FONT>         * array of numbers.<a name="line.112"></a>
+<FONT color="green">113</FONT>         *<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param in the input data array<a name="line.114"></a>
+<FONT color="green">115</FONT>         */<a name="line.115"></a>
+<FONT color="green">116</FONT>        public void load(double[] in) {<a name="line.116"></a>
+<FONT color="green">117</FONT>            DataAdapter da = new ArrayDataAdapter(in);<a name="line.117"></a>
+<FONT color="green">118</FONT>            try {<a name="line.118"></a>
+<FONT color="green">119</FONT>                da.computeStats();<a name="line.119"></a>
+<FONT color="green">120</FONT>                fillBinStats(in);<a name="line.120"></a>
+<FONT color="green">121</FONT>            } catch (IOException e) {<a name="line.121"></a>
+<FONT color="green">122</FONT>                throw new MathRuntimeException(e);<a name="line.122"></a>
+<FONT color="green">123</FONT>            }<a name="line.123"></a>
+<FONT color="green">124</FONT>            loaded = true;<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>        }<a name="line.126"></a>
+<FONT color="green">127</FONT>    <a name="line.127"></a>
+<FONT color="green">128</FONT>        /**<a name="line.128"></a>
+<FONT color="green">129</FONT>         * Computes the empirical distribution using data read from a URL.<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @param url  url of the input file<a name="line.130"></a>
+<FONT color="green">131</FONT>         *<a name="line.131"></a>
+<FONT color="green">132</FONT>         * @throws IOException if an IO error occurs<a name="line.132"></a>
+<FONT color="green">133</FONT>         */<a name="line.133"></a>
+<FONT color="green">134</FONT>        public void load(URL url) throws IOException {<a name="line.134"></a>
+<FONT color="green">135</FONT>            BufferedReader in =<a name="line.135"></a>
+<FONT color="green">136</FONT>                new BufferedReader(new InputStreamReader(url.openStream()));<a name="line.136"></a>
+<FONT color="green">137</FONT>            try {<a name="line.137"></a>
+<FONT color="green">138</FONT>                DataAdapter da = new StreamDataAdapter(in);<a name="line.138"></a>
+<FONT color="green">139</FONT>                da.computeStats();<a name="line.139"></a>
+<FONT color="green">140</FONT>                if (sampleStats.getN() == 0) {<a name="line.140"></a>
+<FONT color="green">141</FONT>                    throw MathRuntimeException.createEOFException("URL {0} contains no data",<a name="line.141"></a>
+<FONT color="green">142</FONT>                                                                  url);<a name="line.142"></a>
+<FONT color="green">143</FONT>                }<a name="line.143"></a>
+<FONT color="green">144</FONT>                in = new BufferedReader(new InputStreamReader(url.openStream()));<a name="line.144"></a>
+<FONT color="green">145</FONT>                fillBinStats(in);<a name="line.145"></a>
+<FONT color="green">146</FONT>                loaded = true;<a name="line.146"></a>
+<FONT color="green">147</FONT>            } finally {<a name="line.147"></a>
+<FONT color="green">148</FONT>               try {<a name="line.148"></a>
+<FONT color="green">149</FONT>                   in.close();<a name="line.149"></a>
+<FONT color="green">150</FONT>               } catch (IOException ex) {<a name="line.150"></a>
+<FONT color="green">151</FONT>                   // ignore<a name="line.151"></a>
+<FONT color="green">152</FONT>               }<a name="line.152"></a>
+<FONT color="green">153</FONT>            }<a name="line.153"></a>
+<FONT color="green">154</FONT>        }<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>        /**<a name="line.156"></a>
+<FONT color="green">157</FONT>         * Computes the empirical distribution from the input file.<a name="line.157"></a>
+<FONT color="green">158</FONT>         *<a name="line.158"></a>
+<FONT color="green">159</FONT>         * @param file the input file<a name="line.159"></a>
+<FONT color="green">160</FONT>         * @throws IOException if an IO error occurs<a name="line.160"></a>
+<FONT color="green">161</FONT>         */<a name="line.161"></a>
+<FONT color="green">162</FONT>        public void load(File file) throws IOException {<a name="line.162"></a>
+<FONT color="green">163</FONT>            BufferedReader in = new BufferedReader(new FileReader(file));<a name="line.163"></a>
+<FONT color="green">164</FONT>            try {<a name="line.164"></a>
+<FONT color="green">165</FONT>                DataAdapter da = new StreamDataAdapter(in);<a name="line.165"></a>
+<FONT color="green">166</FONT>                da.computeStats();<a name="line.166"></a>
+<FONT color="green">167</FONT>                in = new BufferedReader(new FileReader(file));<a name="line.167"></a>
+<FONT color="green">168</FONT>                fillBinStats(in);<a name="line.168"></a>
+<FONT color="green">169</FONT>                loaded = true;<a name="line.169"></a>
+<FONT color="green">170</FONT>            } finally {<a name="line.170"></a>
+<FONT color="green">171</FONT>                try {<a name="line.171"></a>
+<FONT color="green">172</FONT>                    in.close();<a name="line.172"></a>
+<FONT color="green">173</FONT>                } catch (IOException ex) {<a name="line.173"></a>
+<FONT color="green">174</FONT>                    // ignore<a name="line.174"></a>
+<FONT color="green">175</FONT>                }<a name="line.175"></a>
+<FONT color="green">176</FONT>            }<a name="line.176"></a>
+<FONT color="green">177</FONT>        }<a name="line.177"></a>
+<FONT color="green">178</FONT>    <a name="line.178"></a>
+<FONT color="green">179</FONT>        /**<a name="line.179"></a>
+<FONT color="green">180</FONT>         * Provides methods for computing &lt;code&gt;sampleStats&lt;/code&gt; and<a name="line.180"></a>
+<FONT color="green">181</FONT>         * &lt;code&gt;beanStats&lt;/code&gt; abstracting the source of data.<a name="line.181"></a>
+<FONT color="green">182</FONT>         */<a name="line.182"></a>
+<FONT color="green">183</FONT>        private abstract class DataAdapter{<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>            /**<a name="line.185"></a>
+<FONT color="green">186</FONT>             * Compute bin stats.<a name="line.186"></a>
+<FONT color="green">187</FONT>             *<a name="line.187"></a>
+<FONT color="green">188</FONT>             * @throws IOException  if an error occurs computing bin stats<a name="line.188"></a>
+<FONT color="green">189</FONT>             */<a name="line.189"></a>
+<FONT color="green">190</FONT>            public abstract void computeBinStats() throws IOException;<a name="line.190"></a>
+<FONT color="green">191</FONT>    <a name="line.191"></a>
+<FONT color="green">192</FONT>            /**<a name="line.192"></a>
+<FONT color="green">193</FONT>             * Compute sample statistics.<a name="line.193"></a>
+<FONT color="green">194</FONT>             *<a name="line.194"></a>
+<FONT color="green">195</FONT>             * @throws IOException if an error occurs computing sample stats<a name="line.195"></a>
+<FONT color="green">196</FONT>             */<a name="line.196"></a>
+<FONT color="green">197</FONT>            public abstract void computeStats() throws IOException;<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>        }<a name="line.199"></a>
+<FONT color="green">200</FONT>    <a name="line.200"></a>
+<FONT color="green">201</FONT>        /**<a name="line.201"></a>
+<FONT color="green">202</FONT>         * Factory of &lt;code&gt;DataAdapter&lt;/code&gt; objects. For every supported source<a name="line.202"></a>
+<FONT color="green">203</FONT>         * of data (array of doubles, file, etc.) an instance of the proper object<a name="line.203"></a>
+<FONT color="green">204</FONT>         * is returned.<a name="line.204"></a>
+<FONT color="green">205</FONT>         */<a name="line.205"></a>
+<FONT color="green">206</FONT>        private class DataAdapterFactory{<a name="line.206"></a>
+<FONT color="green">207</FONT>            /**<a name="line.207"></a>
+<FONT color="green">208</FONT>             * Creates a DataAdapter from a data object<a name="line.208"></a>
+<FONT color="green">209</FONT>             *<a name="line.209"></a>
+<FONT color="green">210</FONT>             * @param in object providing access to the data<a name="line.210"></a>
+<FONT color="green">211</FONT>             * @return DataAdapter instance<a name="line.211"></a>
+<FONT color="green">212</FONT>             */<a name="line.212"></a>
+<FONT color="green">213</FONT>            public DataAdapter getAdapter(Object in) {<a name="line.213"></a>
+<FONT color="green">214</FONT>                if (in instanceof BufferedReader) {<a name="line.214"></a>
+<FONT color="green">215</FONT>                    BufferedReader inputStream = (BufferedReader) in;<a name="line.215"></a>
+<FONT color="green">216</FONT>                    return new StreamDataAdapter(inputStream);<a name="line.216"></a>
+<FONT color="green">217</FONT>                } else if (in instanceof double[]) {<a name="line.217"></a>
+<FONT color="green">218</FONT>                    double[] inputArray = (double[]) in;<a name="line.218"></a>
+<FONT color="green">219</FONT>                    return new ArrayDataAdapter(inputArray);<a name="line.219"></a>
+<FONT color="green">220</FONT>                } else {<a name="line.220"></a>
+<FONT color="green">221</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.221"></a>
+<FONT color="green">222</FONT>                          "input data comes from unsupported datasource: {0}, " +<a name="line.222"></a>
+<FONT color="green">223</FONT>                          "supported sources: {1}, {2}",<a name="line.223"></a>
+<FONT color="green">224</FONT>                          in.getClass().getName(),<a name="line.224"></a>
+<FONT color="green">225</FONT>                          BufferedReader.class.getName(), double[].class.getName());<a name="line.225"></a>
+<FONT color="green">226</FONT>                }<a name="line.226"></a>
+<FONT color="green">227</FONT>            }<a name="line.227"></a>
+<FONT color="green">228</FONT>        }<a name="line.228"></a>
+<FONT color="green">229</FONT>        /**<a name="line.229"></a>
+<FONT color="green">230</FONT>         * &lt;code&gt;DataAdapter&lt;/code&gt; for data provided through some input stream<a name="line.230"></a>
+<FONT color="green">231</FONT>         */<a name="line.231"></a>
+<FONT color="green">232</FONT>        private class StreamDataAdapter extends DataAdapter{<a name="line.232"></a>
+<FONT color="green">233</FONT>    <a name="line.233"></a>
+<FONT color="green">234</FONT>            /** Input stream providing access to the data */<a name="line.234"></a>
+<FONT color="green">235</FONT>            private BufferedReader inputStream;<a name="line.235"></a>
+<FONT color="green">236</FONT>    <a name="line.236"></a>
+<FONT color="green">237</FONT>            /**<a name="line.237"></a>
+<FONT color="green">238</FONT>             * Create a StreamDataAdapter from a BufferedReader<a name="line.238"></a>
+<FONT color="green">239</FONT>             *<a name="line.239"></a>
+<FONT color="green">240</FONT>             * @param in BufferedReader input stream<a name="line.240"></a>
+<FONT color="green">241</FONT>             */<a name="line.241"></a>
+<FONT color="green">242</FONT>            public StreamDataAdapter(BufferedReader in){<a name="line.242"></a>
+<FONT color="green">243</FONT>                super();<a name="line.243"></a>
+<FONT color="green">244</FONT>                inputStream = in;<a name="line.244"></a>
+<FONT color="green">245</FONT>            }<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>            /** {@inheritDoc} */<a name="line.247"></a>
+<FONT color="green">248</FONT>            @Override<a name="line.248"></a>
+<FONT color="green">249</FONT>            public void computeBinStats() throws IOException {<a name="line.249"></a>
+<FONT color="green">250</FONT>                String str = null;<a name="line.250"></a>
+<FONT color="green">251</FONT>                double val = 0.0d;<a name="line.251"></a>
+<FONT color="green">252</FONT>                while ((str = inputStream.readLine()) != null) {<a name="line.252"></a>
+<FONT color="green">253</FONT>                    val = Double.parseDouble(str);<a name="line.253"></a>
+<FONT color="green">254</FONT>                    SummaryStatistics stats = binStats.get(findBin(val));<a name="line.254"></a>
+<FONT color="green">255</FONT>                    stats.addValue(val);<a name="line.255"></a>
+<FONT color="green">256</FONT>                }<a name="line.256"></a>
+<FONT color="green">257</FONT>    <a name="line.257"></a>
+<FONT color="green">258</FONT>                inputStream.close();<a name="line.258"></a>
+<FONT color="green">259</FONT>                inputStream = null;<a name="line.259"></a>
+<FONT color="green">260</FONT>            }<a name="line.260"></a>
+<FONT color="green">261</FONT>    <a name="line.261"></a>
+<FONT color="green">262</FONT>            /** {@inheritDoc} */<a name="line.262"></a>
+<FONT color="green">263</FONT>            @Override<a name="line.263"></a>
+<FONT color="green">264</FONT>            public void computeStats() throws IOException {<a name="line.264"></a>
+<FONT color="green">265</FONT>                String str = null;<a name="line.265"></a>
+<FONT color="green">266</FONT>                double val = 0.0;<a name="line.266"></a>
+<FONT color="green">267</FONT>                sampleStats = new SummaryStatistics();<a name="line.267"></a>
+<FONT color="green">268</FONT>                while ((str = inputStream.readLine()) != null) {<a name="line.268"></a>
+<FONT color="green">269</FONT>                    val = Double.valueOf(str).doubleValue();<a name="line.269"></a>
+<FONT color="green">270</FONT>                    sampleStats.addValue(val);<a name="line.270"></a>
+<FONT color="green">271</FONT>                }<a name="line.271"></a>
+<FONT color="green">272</FONT>                inputStream.close();<a name="line.272"></a>
+<FONT color="green">273</FONT>                inputStream = null;<a name="line.273"></a>
+<FONT color="green">274</FONT>            }<a name="line.274"></a>
+<FONT color="green">275</FONT>        }<a name="line.275"></a>
+<FONT color="green">276</FONT>    <a name="line.276"></a>
+<FONT color="green">277</FONT>        /**<a name="line.277"></a>
+<FONT color="green">278</FONT>         * &lt;code&gt;DataAdapter&lt;/code&gt; for data provided as array of doubles.<a name="line.278"></a>
+<FONT color="green">279</FONT>         */<a name="line.279"></a>
+<FONT color="green">280</FONT>        private class ArrayDataAdapter extends DataAdapter {<a name="line.280"></a>
+<FONT color="green">281</FONT>    <a name="line.281"></a>
+<FONT color="green">282</FONT>            /** Array of input  data values */<a name="line.282"></a>
+<FONT color="green">283</FONT>            private double[] inputArray;<a name="line.283"></a>
+<FONT color="green">284</FONT>    <a name="line.284"></a>
+<FONT color="green">285</FONT>            /**<a name="line.285"></a>
+<FONT color="green">286</FONT>             * Construct an ArrayDataAdapter from a double[] array<a name="line.286"></a>
+<FONT color="green">287</FONT>             *<a name="line.287"></a>
+<FONT color="green">288</FONT>             * @param in double[] array holding the data<a name="line.288"></a>
+<FONT color="green">289</FONT>             */<a name="line.289"></a>
+<FONT color="green">290</FONT>            public ArrayDataAdapter(double[] in){<a name="line.290"></a>
+<FONT color="green">291</FONT>                super();<a name="line.291"></a>
+<FONT color="green">292</FONT>                inputArray = in;<a name="line.292"></a>
+<FONT color="green">293</FONT>            }<a name="line.293"></a>
+<FONT color="green">294</FONT>    <a name="line.294"></a>
+<FONT color="green">295</FONT>            /** {@inheritDoc} */<a name="line.295"></a>
+<FONT color="green">296</FONT>            @Override<a name="line.296"></a>
+<FONT color="green">297</FONT>            public void computeStats() throws IOException {<a name="line.297"></a>
+<FONT color="green">298</FONT>                sampleStats = new SummaryStatistics();<a name="line.298"></a>
+<FONT color="green">299</FONT>                for (int i = 0; i &lt; inputArray.length; i++) {<a name="line.299"></a>
+<FONT color="green">300</FONT>                    sampleStats.addValue(inputArray[i]);<a name="line.300"></a>
+<FONT color="green">301</FONT>                }<a name="line.301"></a>
+<FONT color="green">302</FONT>            }<a name="line.302"></a>
+<FONT color="green">303</FONT>    <a name="line.303"></a>
+<FONT color="green">304</FONT>            /** {@inheritDoc} */<a name="line.304"></a>
+<FONT color="green">305</FONT>            @Override<a name="line.305"></a>
+<FONT color="green">306</FONT>            public void computeBinStats() throws IOException {<a name="line.306"></a>
+<FONT color="green">307</FONT>                for (int i = 0; i &lt; inputArray.length; i++) {<a name="line.307"></a>
+<FONT color="green">308</FONT>                    SummaryStatistics stats =<a name="line.308"></a>
+<FONT color="green">309</FONT>                        binStats.get(findBin(inputArray[i]));<a name="line.309"></a>
+<FONT color="green">310</FONT>                    stats.addValue(inputArray[i]);<a name="line.310"></a>
+<FONT color="green">311</FONT>                }<a name="line.311"></a>
+<FONT color="green">312</FONT>            }<a name="line.312"></a>
+<FONT color="green">313</FONT>        }<a name="line.313"></a>
+<FONT color="green">314</FONT>    <a name="line.314"></a>
+<FONT color="green">315</FONT>        /**<a name="line.315"></a>
+<FONT color="green">316</FONT>         * Fills binStats array (second pass through data file).<a name="line.316"></a>
+<FONT color="green">317</FONT>         *<a name="line.317"></a>
+<FONT color="green">318</FONT>         * @param in object providing access to the data<a name="line.318"></a>
+<FONT color="green">319</FONT>         * @throws IOException  if an IO error occurs<a name="line.319"></a>
+<FONT color="green">320</FONT>         */<a name="line.320"></a>
+<FONT color="green">321</FONT>        private void fillBinStats(Object in) throws IOException {<a name="line.321"></a>
+<FONT color="green">322</FONT>            // Set up grid<a name="line.322"></a>
+<FONT color="green">323</FONT>            min = sampleStats.getMin();<a name="line.323"></a>
+<FONT color="green">324</FONT>            max = sampleStats.getMax();<a name="line.324"></a>
+<FONT color="green">325</FONT>            delta = (max - min)/(Double.valueOf(binCount)).doubleValue();<a name="line.325"></a>
+<FONT color="green">326</FONT>    <a name="line.326"></a>
+<FONT color="green">327</FONT>            // Initialize binStats ArrayList<a name="line.327"></a>
+<FONT color="green">328</FONT>            if (!binStats.isEmpty()) {<a name="line.328"></a>
+<FONT color="green">329</FONT>                binStats.clear();<a name="line.329"></a>
+<FONT color="green">330</FONT>            }<a name="line.330"></a>
+<FONT color="green">331</FONT>            for (int i = 0; i &lt; binCount; i++) {<a name="line.331"></a>
+<FONT color="green">332</FONT>                SummaryStatistics stats = new SummaryStatistics();<a name="line.332"></a>
+<FONT color="green">333</FONT>                binStats.add(i,stats);<a name="line.333"></a>
+<FONT color="green">334</FONT>            }<a name="line.334"></a>
+<FONT color="green">335</FONT>    <a name="line.335"></a>
+<FONT color="green">336</FONT>            // Filling data in binStats Array<a name="line.336"></a>
+<FONT color="green">337</FONT>            DataAdapterFactory aFactory = new DataAdapterFactory();<a name="line.337"></a>
+<FONT color="green">338</FONT>            DataAdapter da = aFactory.getAdapter(in);<a name="line.338"></a>
+<FONT color="green">339</FONT>            da.computeBinStats();<a name="line.339"></a>
+<FONT color="green">340</FONT>    <a name="line.340"></a>
+<FONT color="green">341</FONT>            // Assign upperBounds based on bin counts<a name="line.341"></a>
+<FONT color="green">342</FONT>            upperBounds = new double[binCount];<a name="line.342"></a>
+<FONT color="green">343</FONT>            upperBounds[0] =<a name="line.343"></a>
+<FONT color="green">344</FONT>            ((double) binStats.get(0).getN()) / (double) sampleStats.getN();<a name="line.344"></a>
+<FONT color="green">345</FONT>            for (int i = 1; i &lt; binCount-1; i++) {<a name="line.345"></a>
+<FONT color="green">346</FONT>                upperBounds[i] = upperBounds[i-1] +<a name="line.346"></a>
+<FONT color="green">347</FONT>                ((double) binStats.get(i).getN()) / (double) sampleStats.getN();<a name="line.347"></a>
+<FONT color="green">348</FONT>            }<a name="line.348"></a>
+<FONT color="green">349</FONT>            upperBounds[binCount-1] = 1.0d;<a name="line.349"></a>
+<FONT color="green">350</FONT>        }<a name="line.350"></a>
+<FONT color="green">351</FONT>    <a name="line.351"></a>
+<FONT color="green">352</FONT>        /**<a name="line.352"></a>
+<FONT color="green">353</FONT>         * Returns the index of the bin to which the given value belongs<a name="line.353"></a>
+<FONT color="green">354</FONT>         *<a name="line.354"></a>
+<FONT color="green">355</FONT>         * @param value  the value whose bin we are trying to find<a name="line.355"></a>
+<FONT color="green">356</FONT>         * @return the index of the bin containing the value<a name="line.356"></a>
+<FONT color="green">357</FONT>         */<a name="line.357"></a>
+<FONT color="green">358</FONT>        private int findBin(double value) {<a name="line.358"></a>
+<FONT color="green">359</FONT>            return Math.min(<a name="line.359"></a>
+<FONT color="green">360</FONT>                    Math.max((int) Math.ceil((value- min) / delta) - 1, 0),<a name="line.360"></a>
+<FONT color="green">361</FONT>                    binCount - 1);<a name="line.361"></a>
+<FONT color="green">362</FONT>            }<a name="line.362"></a>
+<FONT color="green">363</FONT>    <a name="line.363"></a>
+<FONT color="green">364</FONT>        /**<a name="line.364"></a>
+<FONT color="green">365</FONT>         * Generates a random value from this distribution.<a name="line.365"></a>
+<FONT color="green">366</FONT>         *<a name="line.366"></a>
+<FONT color="green">367</FONT>         * @return the random value.<a name="line.367"></a>
+<FONT color="green">368</FONT>         * @throws IllegalStateException if the distribution has not been loaded<a name="line.368"></a>
+<FONT color="green">369</FONT>         */<a name="line.369"></a>
+<FONT color="green">370</FONT>        public double getNextValue() throws IllegalStateException {<a name="line.370"></a>
+<FONT color="green">371</FONT>    <a name="line.371"></a>
+<FONT color="green">372</FONT>            if (!loaded) {<a name="line.372"></a>
+<FONT color="green">373</FONT>                throw MathRuntimeException.createIllegalStateException("distribution not loaded");<a name="line.373"></a>
+<FONT color="green">374</FONT>            }<a name="line.374"></a>
+<FONT color="green">375</FONT>    <a name="line.375"></a>
+<FONT color="green">376</FONT>            // Start with a uniformly distributed random number in (0,1)<a name="line.376"></a>
+<FONT color="green">377</FONT>            double x = Math.random();<a name="line.377"></a>
+<FONT color="green">378</FONT>    <a name="line.378"></a>
+<FONT color="green">379</FONT>            // Use this to select the bin and generate a Gaussian within the bin<a name="line.379"></a>
+<FONT color="green">380</FONT>            for (int i = 0; i &lt; binCount; i++) {<a name="line.380"></a>
+<FONT color="green">381</FONT>               if (x &lt;= upperBounds[i]) {<a name="line.381"></a>
+<FONT color="green">382</FONT>                   SummaryStatistics stats = binStats.get(i);<a name="line.382"></a>
+<FONT color="green">383</FONT>                   if (stats.getN() &gt; 0) {<a name="line.383"></a>
+<FONT color="green">384</FONT>                       if (stats.getStandardDeviation() &gt; 0) {  // more than one obs<a name="line.384"></a>
+<FONT color="green">385</FONT>                            return randomData.nextGaussian<a name="line.385"></a>
+<FONT color="green">386</FONT>                                (stats.getMean(),stats.getStandardDeviation());<a name="line.386"></a>
+<FONT color="green">387</FONT>                       } else {<a name="line.387"></a>
+<FONT color="green">388</FONT>                           return stats.getMean(); // only one obs in bin<a name="line.388"></a>
+<FONT color="green">389</FONT>                       }<a name="line.389"></a>
+<FONT color="green">390</FONT>                   }<a name="line.390"></a>
+<FONT color="green">391</FONT>               }<a name="line.391"></a>
+<FONT color="green">392</FONT>            }<a name="line.392"></a>
+<FONT color="green">393</FONT>            throw new MathRuntimeException("no bin selected");<a name="line.393"></a>
+<FONT color="green">394</FONT>        }<a name="line.394"></a>
+<FONT color="green">395</FONT>    <a name="line.395"></a>
+<FONT color="green">396</FONT>        /**<a name="line.396"></a>
+<FONT color="green">397</FONT>         * Returns a {@link StatisticalSummary} describing this distribution.<a name="line.397"></a>
+<FONT color="green">398</FONT>         * &lt;strong&gt;Preconditions:&lt;/strong&gt;&lt;ul&gt;<a name="line.398"></a>
+<FONT color="green">399</FONT>         * &lt;li&gt;the distribution must be loaded before invoking this method&lt;/li&gt;&lt;/ul&gt;<a name="line.399"></a>
+<FONT color="green">400</FONT>         *<a name="line.400"></a>
+<FONT color="green">401</FONT>         * @return the sample statistics<a name="line.401"></a>
+<FONT color="green">402</FONT>         * @throws IllegalStateException if the distribution has not been loaded<a name="line.402"></a>
+<FONT color="green">403</FONT>         */<a name="line.403"></a>
+<FONT color="green">404</FONT>        public StatisticalSummary getSampleStats() {<a name="line.404"></a>
+<FONT color="green">405</FONT>            return sampleStats;<a name="line.405"></a>
+<FONT color="green">406</FONT>        }<a name="line.406"></a>
+<FONT color="green">407</FONT>    <a name="line.407"></a>
+<FONT color="green">408</FONT>        /**<a name="line.408"></a>
+<FONT color="green">409</FONT>         * Returns the number of bins.<a name="line.409"></a>
+<FONT color="green">410</FONT>         *<a name="line.410"></a>
+<FONT color="green">411</FONT>         * @return the number of bins.<a name="line.411"></a>
+<FONT color="green">412</FONT>         */<a name="line.412"></a>
+<FONT color="green">413</FONT>        public int getBinCount() {<a name="line.413"></a>
+<FONT color="green">414</FONT>            return binCount;<a name="line.414"></a>
+<FONT color="green">415</FONT>        }<a name="line.415"></a>
+<FONT color="green">416</FONT>    <a name="line.416"></a>
+<FONT color="green">417</FONT>        /**<a name="line.417"></a>
+<FONT color="green">418</FONT>         * Returns a List of {@link SummaryStatistics} instances containing<a name="line.418"></a>
+<FONT color="green">419</FONT>         * statistics describing the values in each of the bins.  The list is<a name="line.419"></a>
+<FONT color="green">420</FONT>         * indexed on the bin number.<a name="line.420"></a>
+<FONT color="green">421</FONT>         *<a name="line.421"></a>
+<FONT color="green">422</FONT>         * @return List of bin statistics.<a name="line.422"></a>
+<FONT color="green">423</FONT>         */<a name="line.423"></a>
+<FONT color="green">424</FONT>        public List&lt;SummaryStatistics&gt; getBinStats() {<a name="line.424"></a>
+<FONT color="green">425</FONT>            return binStats;<a name="line.425"></a>
+<FONT color="green">426</FONT>        }<a name="line.426"></a>
+<FONT color="green">427</FONT>    <a name="line.427"></a>
+<FONT color="green">428</FONT>        /**<a name="line.428"></a>
+<FONT color="green">429</FONT>         * &lt;p&gt;Returns a fresh copy of the array of upper bounds for the bins.<a name="line.429"></a>
+<FONT color="green">430</FONT>         * Bins are: &lt;br/&gt;<a name="line.430"></a>
+<FONT color="green">431</FONT>         * [min,upperBounds[0]],(upperBounds[0],upperBounds[1]],...,<a name="line.431"></a>
+<FONT color="green">432</FONT>         *  (upperBounds[binCount-2], upperBounds[binCount-1] = max].&lt;/p&gt;<a name="line.432"></a>
+<FONT color="green">433</FONT>         *<a name="line.433"></a>
+<FONT color="green">434</FONT>         * &lt;p&gt;Note: In versions 1.0-2.0 of commons-math, this method<a name="line.434"></a>
+<FONT color="green">435</FONT>         * incorrectly returned the array of probability generator upper<a name="line.435"></a>
+<FONT color="green">436</FONT>         * bounds now returned by {@link #getGeneratorUpperBounds()}.&lt;/p&gt;<a name="line.436"></a>
+<FONT color="green">437</FONT>         *<a name="line.437"></a>
+<FONT color="green">438</FONT>         * @return array of bin upper bounds<a name="line.438"></a>
+<FONT color="green">439</FONT>         * @since 2.1<a name="line.439"></a>
+<FONT color="green">440</FONT>         */<a name="line.440"></a>
+<FONT color="green">441</FONT>        public double[] getUpperBounds() {<a name="line.441"></a>
+<FONT color="green">442</FONT>            double[] binUpperBounds = new double[binCount];<a name="line.442"></a>
+<FONT color="green">443</FONT>            binUpperBounds[0] = min + delta;<a name="line.443"></a>
+<FONT color="green">444</FONT>            for (int i = 1; i &lt; binCount - 1; i++) {<a name="line.444"></a>
+<FONT color="green">445</FONT>                binUpperBounds[i] = binUpperBounds[i-1] + delta;<a name="line.445"></a>
+<FONT color="green">446</FONT>            }<a name="line.446"></a>
+<FONT color="green">447</FONT>            binUpperBounds[binCount - 1] = max;<a name="line.447"></a>
+<FONT color="green">448</FONT>            return binUpperBounds;<a name="line.448"></a>
+<FONT color="green">449</FONT>        }<a name="line.449"></a>
+<FONT color="green">450</FONT>    <a name="line.450"></a>
+<FONT color="green">451</FONT>        /**<a name="line.451"></a>
+<FONT color="green">452</FONT>         * &lt;p&gt;Returns a fresh copy of the array of upper bounds of the subintervals<a name="line.452"></a>
+<FONT color="green">453</FONT>         * of [0,1] used in generating data from the empirical distribution.<a name="line.453"></a>
+<FONT color="green">454</FONT>         * Subintervals correspond to bins with lengths proportional to bin counts.&lt;/p&gt;<a name="line.454"></a>
+<FONT color="green">455</FONT>         *<a name="line.455"></a>
+<FONT color="green">456</FONT>         * &lt;p&gt;In versions 1.0-2.0 of commons-math, this array was (incorrectly) returned<a name="line.456"></a>
+<FONT color="green">457</FONT>         * by {@link #getUpperBounds()}.&lt;/p&gt;<a name="line.457"></a>
+<FONT color="green">458</FONT>         *<a name="line.458"></a>
+<FONT color="green">459</FONT>         * @since 2.1<a name="line.459"></a>
+<FONT color="green">460</FONT>         * @return array of upper bounds of subintervals used in data generation<a name="line.460"></a>
+<FONT color="green">461</FONT>         */<a name="line.461"></a>
+<FONT color="green">462</FONT>        public double[] getGeneratorUpperBounds() {<a name="line.462"></a>
+<FONT color="green">463</FONT>            int len = upperBounds.length;<a name="line.463"></a>
+<FONT color="green">464</FONT>            double[] out = new double[len];<a name="line.464"></a>
+<FONT color="green">465</FONT>            System.arraycopy(upperBounds, 0, out, 0, len);<a name="line.465"></a>
+<FONT color="green">466</FONT>            return out;<a name="line.466"></a>
+<FONT color="green">467</FONT>        }<a name="line.467"></a>
+<FONT color="green">468</FONT>    <a name="line.468"></a>
+<FONT color="green">469</FONT>        /**<a name="line.469"></a>
+<FONT color="green">470</FONT>         * Property indicating whether or not the distribution has been loaded.<a name="line.470"></a>
+<FONT color="green">471</FONT>         *<a name="line.471"></a>
+<FONT color="green">472</FONT>         * @return true if the distribution has been loaded<a name="line.472"></a>
+<FONT color="green">473</FONT>         */<a name="line.473"></a>
+<FONT color="green">474</FONT>        public boolean isLoaded() {<a name="line.474"></a>
+<FONT color="green">475</FONT>            return loaded;<a name="line.475"></a>
+<FONT color="green">476</FONT>        }<a name="line.476"></a>
+<FONT color="green">477</FONT>    }<a name="line.477"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/GaussianRandomGenerator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,113 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.random;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * This class is a gaussian normalized random generator for scalars.<a name="line.21"></a>
+<FONT color="green">022</FONT>     * &lt;p&gt;This class is a simple wrapper around the {@link<a name="line.22"></a>
+<FONT color="green">023</FONT>     * RandomGenerator#nextGaussian} method.&lt;/p&gt;<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @since 1.2<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    public class GaussianRandomGenerator implements NormalizedRandomGenerator {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /** Underlying generator. */<a name="line.30"></a>
+<FONT color="green">031</FONT>        private final RandomGenerator generator;<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** Create a new generator.<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @param generator underlying random generator to use<a name="line.34"></a>
+<FONT color="green">035</FONT>         */<a name="line.35"></a>
+<FONT color="green">036</FONT>        public GaussianRandomGenerator(final RandomGenerator generator) {<a name="line.36"></a>
+<FONT color="green">037</FONT>            this.generator = generator;<a name="line.37"></a>
+<FONT color="green">038</FONT>        }<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Generate a random scalar with null mean and unit standard deviation.<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @return a random scalar with null mean and unit standard deviation<a name="line.41"></a>
+<FONT color="green">042</FONT>         */<a name="line.42"></a>
+<FONT color="green">043</FONT>        public double nextNormalizedDouble() {<a name="line.43"></a>
+<FONT color="green">044</FONT>            return generator.nextGaussian();<a name="line.44"></a>
+<FONT color="green">045</FONT>        }<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>    }<a name="line.47"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/JDKRandomGenerator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,116 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.random;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.Random;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Extension of &lt;code&gt;java.util.Random&lt;/code&gt; to implement<a name="line.22"></a>
+<FONT color="green">023</FONT>     * {@link RandomGenerator}.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @since 1.1<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public class JDKRandomGenerator extends Random implements RandomGenerator {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /** Serializable version identifier. */<a name="line.30"></a>
+<FONT color="green">031</FONT>        private static final long serialVersionUID = -7745277476784028798L;<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** {@inheritDoc} */<a name="line.33"></a>
+<FONT color="green">034</FONT>        public void setSeed(int seed) {<a name="line.34"></a>
+<FONT color="green">035</FONT>            setSeed((long) seed);<a name="line.35"></a>
+<FONT color="green">036</FONT>        }<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** {@inheritDoc} */<a name="line.38"></a>
+<FONT color="green">039</FONT>        public void setSeed(int[] seed) {<a name="line.39"></a>
+<FONT color="green">040</FONT>            // the following number is the largest prime that fits in 32 bits (it is 2^32 - 5)<a name="line.40"></a>
+<FONT color="green">041</FONT>            final long prime = 4294967291l;<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>            long combined = 0l;<a name="line.43"></a>
+<FONT color="green">044</FONT>            for (int s : seed) {<a name="line.44"></a>
+<FONT color="green">045</FONT>                combined = combined * prime + s;<a name="line.45"></a>
+<FONT color="green">046</FONT>            }<a name="line.46"></a>
+<FONT color="green">047</FONT>            setSeed(combined);<a name="line.47"></a>
+<FONT color="green">048</FONT>        }<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>    }<a name="line.50"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/MersenneTwister.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,323 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.random;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /** This class implements a powerful pseudo-random number generator<a name="line.22"></a>
+<FONT color="green">023</FONT>     * developed by Makoto Matsumoto and Takuji Nishimura during<a name="line.23"></a>
+<FONT color="green">024</FONT>     * 1996-1997.<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;This generator features an extremely long period<a name="line.26"></a>
+<FONT color="green">027</FONT>     * (2&lt;sup&gt;19937&lt;/sup&gt;-1) and 623-dimensional equidistribution up to 32<a name="line.27"></a>
+<FONT color="green">028</FONT>     * bits accuracy. The home page for this generator is located at &lt;a<a name="line.28"></a>
+<FONT color="green">029</FONT>     * href="http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html"&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html&lt;/a&gt;.&lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;This generator is described in a paper by Makoto Matsumoto and<a name="line.32"></a>
+<FONT color="green">033</FONT>     * Takuji Nishimura in 1998: &lt;a<a name="line.33"></a>
+<FONT color="green">034</FONT>     * href="http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/ARTICLES/mt.pdf"&gt;Mersenne<a name="line.34"></a>
+<FONT color="green">035</FONT>     * Twister: A 623-Dimensionally Equidistributed Uniform Pseudo-Random<a name="line.35"></a>
+<FONT color="green">036</FONT>     * Number Generator&lt;/a&gt;, ACM Transactions on Modeling and Computer<a name="line.36"></a>
+<FONT color="green">037</FONT>     * Simulation, Vol. 8, No. 1, January 1998, pp 3--30&lt;/p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;p&gt;This class is mainly a Java port of the 2002-01-26 version of<a name="line.39"></a>
+<FONT color="green">040</FONT>     * the generator written in C by Makoto Matsumoto and Takuji<a name="line.40"></a>
+<FONT color="green">041</FONT>     * Nishimura. Here is their original copyright:&lt;/p&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>     * &lt;table border="0" width="80%" cellpadding="10" align="center" bgcolor="#E0E0E0"&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;tr&gt;&lt;td&gt;Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,<a name="line.44"></a>
+<FONT color="green">045</FONT>     *     All rights reserved.&lt;/td&gt;&lt;/tr&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>     * &lt;tr&gt;&lt;td&gt;Redistribution and use in source and binary forms, with or without<a name="line.47"></a>
+<FONT color="green">048</FONT>     * modification, are permitted provided that the following conditions<a name="line.48"></a>
+<FONT color="green">049</FONT>     * are met:<a name="line.49"></a>
+<FONT color="green">050</FONT>     * &lt;ol&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>     *   &lt;li&gt;Redistributions of source code must retain the above copyright<a name="line.51"></a>
+<FONT color="green">052</FONT>     *       notice, this list of conditions and the following disclaimer.&lt;/li&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>     *   &lt;li&gt;Redistributions in binary form must reproduce the above copyright<a name="line.53"></a>
+<FONT color="green">054</FONT>     *       notice, this list of conditions and the following disclaimer in the<a name="line.54"></a>
+<FONT color="green">055</FONT>     *       documentation and/or other materials provided with the distribution.&lt;/li&gt;<a name="line.55"></a>
+<FONT color="green">056</FONT>     *   &lt;li&gt;The names of its contributors may not be used to endorse or promote<a name="line.56"></a>
+<FONT color="green">057</FONT>     *       products derived from this software without specific prior written<a name="line.57"></a>
+<FONT color="green">058</FONT>     *       permission.&lt;/li&gt;<a name="line.58"></a>
+<FONT color="green">059</FONT>     * &lt;/ol&gt;&lt;/td&gt;&lt;/tr&gt;<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>     * &lt;tr&gt;&lt;td&gt;&lt;strong&gt;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND<a name="line.61"></a>
+<FONT color="green">062</FONT>     * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,<a name="line.62"></a>
+<FONT color="green">063</FONT>     * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF<a name="line.63"></a>
+<FONT color="green">064</FONT>     * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE<a name="line.64"></a>
+<FONT color="green">065</FONT>     * DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS<a name="line.65"></a>
+<FONT color="green">066</FONT>     * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,<a name="line.66"></a>
+<FONT color="green">067</FONT>     * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,<a name="line.67"></a>
+<FONT color="green">068</FONT>     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR<a name="line.68"></a>
+<FONT color="green">069</FONT>     * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY<a name="line.69"></a>
+<FONT color="green">070</FONT>     * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT<a name="line.70"></a>
+<FONT color="green">071</FONT>     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE<a name="line.71"></a>
+<FONT color="green">072</FONT>     * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH<a name="line.72"></a>
+<FONT color="green">073</FONT>     * DAMAGE.&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;<a name="line.73"></a>
+<FONT color="green">074</FONT>     * &lt;/table&gt;<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>     * @version $Revision: 902203 $ $Date: 2010-01-22 13:27:41 -0500 (Fri, 22 Jan 2010) $<a name="line.76"></a>
+<FONT color="green">077</FONT>     * @since 2.0<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>     */<a name="line.79"></a>
+<FONT color="green">080</FONT>    public class MersenneTwister extends BitsStreamGenerator implements Serializable {<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>        /** Serializable version identifier. */<a name="line.82"></a>
+<FONT color="green">083</FONT>        private static final long serialVersionUID = 8661194735290153518L;<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>        /** Size of the bytes pool. */<a name="line.85"></a>
+<FONT color="green">086</FONT>        private static final int   N     = 624;<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>        /** Period second parameter. */<a name="line.88"></a>
+<FONT color="green">089</FONT>        private static final int   M     = 397;<a name="line.89"></a>
+<FONT color="green">090</FONT>    <a name="line.90"></a>
+<FONT color="green">091</FONT>        /** X * MATRIX_A for X = {0, 1}. */<a name="line.91"></a>
+<FONT color="green">092</FONT>        private static final int[] MAG01 = { 0x0, 0x9908b0df };<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>        /** Bytes pool. */<a name="line.94"></a>
+<FONT color="green">095</FONT>        private int[] mt;<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /** Current index in the bytes pool. */<a name="line.97"></a>
+<FONT color="green">098</FONT>        private int   mti;<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>        /** Creates a new random number generator.<a name="line.100"></a>
+<FONT color="green">101</FONT>         * &lt;p&gt;The instance is initialized using the current time as the<a name="line.101"></a>
+<FONT color="green">102</FONT>         * seed.&lt;/p&gt;<a name="line.102"></a>
+<FONT color="green">103</FONT>         */<a name="line.103"></a>
+<FONT color="green">104</FONT>        public MersenneTwister() {<a name="line.104"></a>
+<FONT color="green">105</FONT>            mt = new int[N];<a name="line.105"></a>
+<FONT color="green">106</FONT>            setSeed(System.currentTimeMillis());<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /** Creates a new random number generator using a single int seed.<a name="line.109"></a>
+<FONT color="green">110</FONT>         * @param seed the initial seed (32 bits integer)<a name="line.110"></a>
+<FONT color="green">111</FONT>         */<a name="line.111"></a>
+<FONT color="green">112</FONT>        public MersenneTwister(int seed) {<a name="line.112"></a>
+<FONT color="green">113</FONT>            mt = new int[N];<a name="line.113"></a>
+<FONT color="green">114</FONT>            setSeed(seed);<a name="line.114"></a>
+<FONT color="green">115</FONT>        }<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>        /** Creates a new random number generator using an int array seed.<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @param seed the initial seed (32 bits integers array), if null<a name="line.118"></a>
+<FONT color="green">119</FONT>         * the seed of the generator will be related to the current time<a name="line.119"></a>
+<FONT color="green">120</FONT>         */<a name="line.120"></a>
+<FONT color="green">121</FONT>        public MersenneTwister(int[] seed) {<a name="line.121"></a>
+<FONT color="green">122</FONT>            mt = new int[N];<a name="line.122"></a>
+<FONT color="green">123</FONT>            setSeed(seed);<a name="line.123"></a>
+<FONT color="green">124</FONT>        }<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>        /** Creates a new random number generator using a single long seed.<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @param seed the initial seed (64 bits integer)<a name="line.127"></a>
+<FONT color="green">128</FONT>         */<a name="line.128"></a>
+<FONT color="green">129</FONT>        public MersenneTwister(long seed) {<a name="line.129"></a>
+<FONT color="green">130</FONT>            mt = new int[N];<a name="line.130"></a>
+<FONT color="green">131</FONT>            setSeed(seed);<a name="line.131"></a>
+<FONT color="green">132</FONT>        }<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>        /** Reinitialize the generator as if just built with the given int seed.<a name="line.134"></a>
+<FONT color="green">135</FONT>         * &lt;p&gt;The state of the generator is exactly the same as a new<a name="line.135"></a>
+<FONT color="green">136</FONT>         * generator built with the same seed.&lt;/p&gt;<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @param seed the initial seed (32 bits integer)<a name="line.137"></a>
+<FONT color="green">138</FONT>         */<a name="line.138"></a>
+<FONT color="green">139</FONT>        @Override<a name="line.139"></a>
+<FONT color="green">140</FONT>        public void setSeed(int seed) {<a name="line.140"></a>
+<FONT color="green">141</FONT>            // we use a long masked by 0xffffffffL as a poor man unsigned int<a name="line.141"></a>
+<FONT color="green">142</FONT>            long longMT = seed;<a name="line.142"></a>
+<FONT color="green">143</FONT>            mt[0]= (int) longMT;<a name="line.143"></a>
+<FONT color="green">144</FONT>            for (mti = 1; mti &lt; N; ++mti) {<a name="line.144"></a>
+<FONT color="green">145</FONT>                // See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier.<a name="line.145"></a>
+<FONT color="green">146</FONT>                // initializer from the 2002-01-09 C version by Makoto Matsumoto<a name="line.146"></a>
+<FONT color="green">147</FONT>                longMT = (1812433253l * (longMT ^ (longMT &gt;&gt; 30)) + mti) &amp; 0xffffffffL;<a name="line.147"></a>
+<FONT color="green">148</FONT>                mt[mti]= (int) longMT;<a name="line.148"></a>
+<FONT color="green">149</FONT>            }<a name="line.149"></a>
+<FONT color="green">150</FONT>        }<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>        /** Reinitialize the generator as if just built with the given int array seed.<a name="line.152"></a>
+<FONT color="green">153</FONT>         * &lt;p&gt;The state of the generator is exactly the same as a new<a name="line.153"></a>
+<FONT color="green">154</FONT>         * generator built with the same seed.&lt;/p&gt;<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @param seed the initial seed (32 bits integers array), if null<a name="line.155"></a>
+<FONT color="green">156</FONT>         * the seed of the generator will be related to the current time<a name="line.156"></a>
+<FONT color="green">157</FONT>         */<a name="line.157"></a>
+<FONT color="green">158</FONT>        @Override<a name="line.158"></a>
+<FONT color="green">159</FONT>        public void setSeed(int[] seed) {<a name="line.159"></a>
+<FONT color="green">160</FONT>    <a name="line.160"></a>
+<FONT color="green">161</FONT>            if (seed == null) {<a name="line.161"></a>
+<FONT color="green">162</FONT>                setSeed(System.currentTimeMillis());<a name="line.162"></a>
+<FONT color="green">163</FONT>                return;<a name="line.163"></a>
+<FONT color="green">164</FONT>            }<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>            setSeed(19650218);<a name="line.166"></a>
+<FONT color="green">167</FONT>            int i = 1;<a name="line.167"></a>
+<FONT color="green">168</FONT>            int j = 0;<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>            for (int k = Math.max(N, seed.length); k != 0; k--) {<a name="line.170"></a>
+<FONT color="green">171</FONT>                long l0 = (mt[i] &amp; 0x7fffffffl)   | ((mt[i]   &lt; 0) ? 0x80000000l : 0x0l);<a name="line.171"></a>
+<FONT color="green">172</FONT>                long l1 = (mt[i-1] &amp; 0x7fffffffl) | ((mt[i-1] &lt; 0) ? 0x80000000l : 0x0l);<a name="line.172"></a>
+<FONT color="green">173</FONT>                long l  = (l0 ^ ((l1 ^ (l1 &gt;&gt; 30)) * 1664525l)) + seed[j] + j; // non linear<a name="line.173"></a>
+<FONT color="green">174</FONT>                mt[i]   = (int) (l &amp; 0xffffffffl);<a name="line.174"></a>
+<FONT color="green">175</FONT>                i++; j++;<a name="line.175"></a>
+<FONT color="green">176</FONT>                if (i &gt;= N) {<a name="line.176"></a>
+<FONT color="green">177</FONT>                    mt[0] = mt[N - 1];<a name="line.177"></a>
+<FONT color="green">178</FONT>                    i = 1;<a name="line.178"></a>
+<FONT color="green">179</FONT>                }<a name="line.179"></a>
+<FONT color="green">180</FONT>                if (j &gt;= seed.length) {<a name="line.180"></a>
+<FONT color="green">181</FONT>                    j = 0;<a name="line.181"></a>
+<FONT color="green">182</FONT>                }<a name="line.182"></a>
+<FONT color="green">183</FONT>            }<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>            for (int k = N - 1; k != 0; k--) {<a name="line.185"></a>
+<FONT color="green">186</FONT>                long l0 = (mt[i] &amp; 0x7fffffffl)   | ((mt[i]   &lt; 0) ? 0x80000000l : 0x0l);<a name="line.186"></a>
+<FONT color="green">187</FONT>                long l1 = (mt[i-1] &amp; 0x7fffffffl) | ((mt[i-1] &lt; 0) ? 0x80000000l : 0x0l);<a name="line.187"></a>
+<FONT color="green">188</FONT>                long l  = (l0 ^ ((l1 ^ (l1 &gt;&gt; 30)) * 1566083941l)) - i; // non linear<a name="line.188"></a>
+<FONT color="green">189</FONT>                mt[i]   = (int) (l &amp; 0xffffffffL);<a name="line.189"></a>
+<FONT color="green">190</FONT>                i++;<a name="line.190"></a>
+<FONT color="green">191</FONT>                if (i &gt;= N) {<a name="line.191"></a>
+<FONT color="green">192</FONT>                    mt[0] = mt[N - 1];<a name="line.192"></a>
+<FONT color="green">193</FONT>                    i = 1;<a name="line.193"></a>
+<FONT color="green">194</FONT>                }<a name="line.194"></a>
+<FONT color="green">195</FONT>            }<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>            mt[0] = 0x80000000; // MSB is 1; assuring non-zero initial array<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>        }<a name="line.199"></a>
+<FONT color="green">200</FONT>    <a name="line.200"></a>
+<FONT color="green">201</FONT>        /** Reinitialize the generator as if just built with the given long seed.<a name="line.201"></a>
+<FONT color="green">202</FONT>         * &lt;p&gt;The state of the generator is exactly the same as a new<a name="line.202"></a>
+<FONT color="green">203</FONT>         * generator built with the same seed.&lt;/p&gt;<a name="line.203"></a>
+<FONT color="green">204</FONT>         * @param seed the initial seed (64 bits integer)<a name="line.204"></a>
+<FONT color="green">205</FONT>         */<a name="line.205"></a>
+<FONT color="green">206</FONT>        @Override<a name="line.206"></a>
+<FONT color="green">207</FONT>        public void setSeed(long seed) {<a name="line.207"></a>
+<FONT color="green">208</FONT>            setSeed(new int[] { (int) (seed &gt;&gt;&gt; 32), (int) (seed &amp; 0xffffffffl) });<a name="line.208"></a>
+<FONT color="green">209</FONT>        }<a name="line.209"></a>
+<FONT color="green">210</FONT>    <a name="line.210"></a>
+<FONT color="green">211</FONT>        /** Generate next pseudorandom number.<a name="line.211"></a>
+<FONT color="green">212</FONT>         * &lt;p&gt;This method is the core generation algorithm. It is used by all the<a name="line.212"></a>
+<FONT color="green">213</FONT>         * public generation methods for the various primitive types {@link<a name="line.213"></a>
+<FONT color="green">214</FONT>         * #nextBoolean()}, {@link #nextBytes(byte[])}, {@link #nextDouble()},<a name="line.214"></a>
+<FONT color="green">215</FONT>         * {@link #nextFloat()}, {@link #nextGaussian()}, {@link #nextInt()},<a name="line.215"></a>
+<FONT color="green">216</FONT>         * {@link #next(int)} and {@link #nextLong()}.&lt;/p&gt;<a name="line.216"></a>
+<FONT color="green">217</FONT>         * @param bits number of random bits to produce<a name="line.217"></a>
+<FONT color="green">218</FONT>         * @return random bits generated<a name="line.218"></a>
+<FONT color="green">219</FONT>         */<a name="line.219"></a>
+<FONT color="green">220</FONT>        @Override<a name="line.220"></a>
+<FONT color="green">221</FONT>        protected int next(int bits) {<a name="line.221"></a>
+<FONT color="green">222</FONT>    <a name="line.222"></a>
+<FONT color="green">223</FONT>            int y;<a name="line.223"></a>
+<FONT color="green">224</FONT>    <a name="line.224"></a>
+<FONT color="green">225</FONT>            if (mti &gt;= N) { // generate N words at one time<a name="line.225"></a>
+<FONT color="green">226</FONT>                int mtNext = mt[0];<a name="line.226"></a>
+<FONT color="green">227</FONT>                for (int k = 0; k &lt; N - M; ++k) {<a name="line.227"></a>
+<FONT color="green">228</FONT>                    int mtCurr = mtNext;<a name="line.228"></a>
+<FONT color="green">229</FONT>                    mtNext = mt[k + 1];<a name="line.229"></a>
+<FONT color="green">230</FONT>                    y = (mtCurr &amp; 0x80000000) | (mtNext &amp; 0x7fffffff);<a name="line.230"></a>
+<FONT color="green">231</FONT>                    mt[k] = mt[k + M] ^ (y &gt;&gt;&gt; 1) ^ MAG01[y &amp; 0x1];<a name="line.231"></a>
+<FONT color="green">232</FONT>                }<a name="line.232"></a>
+<FONT color="green">233</FONT>                for (int k = N - M; k &lt; N - 1; ++k) {<a name="line.233"></a>
+<FONT color="green">234</FONT>                    int mtCurr = mtNext;<a name="line.234"></a>
+<FONT color="green">235</FONT>                    mtNext = mt[k + 1];<a name="line.235"></a>
+<FONT color="green">236</FONT>                    y = (mtCurr &amp; 0x80000000) | (mtNext &amp; 0x7fffffff);<a name="line.236"></a>
+<FONT color="green">237</FONT>                    mt[k] = mt[k + (M - N)] ^ (y &gt;&gt;&gt; 1) ^ MAG01[y &amp; 0x1];<a name="line.237"></a>
+<FONT color="green">238</FONT>                }<a name="line.238"></a>
+<FONT color="green">239</FONT>                y = (mtNext &amp; 0x80000000) | (mt[0] &amp; 0x7fffffff);<a name="line.239"></a>
+<FONT color="green">240</FONT>                mt[N - 1] = mt[M - 1] ^ (y &gt;&gt;&gt; 1) ^ MAG01[y &amp; 0x1];<a name="line.240"></a>
+<FONT color="green">241</FONT>    <a name="line.241"></a>
+<FONT color="green">242</FONT>                mti = 0;<a name="line.242"></a>
+<FONT color="green">243</FONT>            }<a name="line.243"></a>
+<FONT color="green">244</FONT>    <a name="line.244"></a>
+<FONT color="green">245</FONT>            y = mt[mti++];<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>            // tempering<a name="line.247"></a>
+<FONT color="green">248</FONT>            y ^=  y &gt;&gt;&gt; 11;<a name="line.248"></a>
+<FONT color="green">249</FONT>            y ^= (y &lt;&lt;   7) &amp; 0x9d2c5680;<a name="line.249"></a>
+<FONT color="green">250</FONT>            y ^= (y &lt;&lt;  15) &amp; 0xefc60000;<a name="line.250"></a>
+<FONT color="green">251</FONT>            y ^=  y &gt;&gt;&gt; 18;<a name="line.251"></a>
+<FONT color="green">252</FONT>    <a name="line.252"></a>
+<FONT color="green">253</FONT>            return y &gt;&gt;&gt; (32 - bits);<a name="line.253"></a>
+<FONT color="green">254</FONT>    <a name="line.254"></a>
+<FONT color="green">255</FONT>        }<a name="line.255"></a>
+<FONT color="green">256</FONT>    <a name="line.256"></a>
+<FONT color="green">257</FONT>    }<a name="line.257"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/NormalizedRandomGenerator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,104 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.random;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * This interface represent a normalized random generator for<a name="line.21"></a>
+<FONT color="green">022</FONT>     * scalars.<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Normalized generator provide null mean and unit standard deviation scalars.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @since 1.2<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public interface NormalizedRandomGenerator {<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>      /** Generate a random scalar with null mean and unit standard deviation.<a name="line.29"></a>
+<FONT color="green">030</FONT>       * &lt;p&gt;This method does &lt;strong&gt;not&lt;/strong&gt; specify the shape of the<a name="line.30"></a>
+<FONT color="green">031</FONT>       * distribution, it is the implementing class that provides it. The<a name="line.31"></a>
+<FONT color="green">032</FONT>       * only contract here is to generate numbers with null mean and unit<a name="line.32"></a>
+<FONT color="green">033</FONT>       * standard deviation.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>       * @return a random scalar with null mean and unit standard deviation<a name="line.34"></a>
+<FONT color="green">035</FONT>       */<a name="line.35"></a>
+<FONT color="green">036</FONT>      double nextNormalizedDouble();<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>    }<a name="line.38"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/RandomAdaptor.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,264 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.random;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.Random;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Extension of &lt;code&gt;java.util.Random&lt;/code&gt; wrapping a<a name="line.22"></a>
+<FONT color="green">023</FONT>     * {@link RandomGenerator}.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @since 1.1<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public class RandomAdaptor extends Random implements RandomGenerator {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /** Serializable version identifier. */<a name="line.30"></a>
+<FONT color="green">031</FONT>        private static final long serialVersionUID = 2306581345647615033L;<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** Wrapped randomGenerator instance */<a name="line.33"></a>
+<FONT color="green">034</FONT>        private RandomGenerator randomGenerator = null;<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /**<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Prevent instantiation without a generator argument<a name="line.37"></a>
+<FONT color="green">038</FONT>         */<a name="line.38"></a>
+<FONT color="green">039</FONT>        @SuppressWarnings("unused")<a name="line.39"></a>
+<FONT color="green">040</FONT>        private RandomAdaptor() { }<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /**<a name="line.42"></a>
+<FONT color="green">043</FONT>         * Construct a RandomAdaptor wrapping the supplied RandomGenerator.<a name="line.43"></a>
+<FONT color="green">044</FONT>         *<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @param randomGenerator  the wrapped generator<a name="line.45"></a>
+<FONT color="green">046</FONT>         */<a name="line.46"></a>
+<FONT color="green">047</FONT>        public RandomAdaptor(RandomGenerator randomGenerator) {<a name="line.47"></a>
+<FONT color="green">048</FONT>            this.randomGenerator = randomGenerator;<a name="line.48"></a>
+<FONT color="green">049</FONT>        }<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /**<a name="line.51"></a>
+<FONT color="green">052</FONT>         * Factory method to create a &lt;code&gt;Random&lt;/code&gt; using the supplied<a name="line.52"></a>
+<FONT color="green">053</FONT>         * &lt;code&gt;RandomGenerator&lt;/code&gt;.<a name="line.53"></a>
+<FONT color="green">054</FONT>         *<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param randomGenerator  wrapped RandomGenerator instance<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @return a Random instance wrapping the RandomGenerator<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        public static Random createAdaptor(RandomGenerator randomGenerator) {<a name="line.58"></a>
+<FONT color="green">059</FONT>            return new RandomAdaptor(randomGenerator);<a name="line.59"></a>
+<FONT color="green">060</FONT>        }<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /**<a name="line.62"></a>
+<FONT color="green">063</FONT>         * Returns the next pseudorandom, uniformly distributed<a name="line.63"></a>
+<FONT color="green">064</FONT>         * &lt;code&gt;boolean&lt;/code&gt; value from this random number generator's<a name="line.64"></a>
+<FONT color="green">065</FONT>         * sequence.<a name="line.65"></a>
+<FONT color="green">066</FONT>         *<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @return  the next pseudorandom, uniformly distributed<a name="line.67"></a>
+<FONT color="green">068</FONT>         * &lt;code&gt;boolean&lt;/code&gt; value from this random number generator's<a name="line.68"></a>
+<FONT color="green">069</FONT>         * sequence<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        @Override<a name="line.71"></a>
+<FONT color="green">072</FONT>        public boolean nextBoolean() {<a name="line.72"></a>
+<FONT color="green">073</FONT>            return randomGenerator.nextBoolean();<a name="line.73"></a>
+<FONT color="green">074</FONT>        }<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>         /**<a name="line.76"></a>
+<FONT color="green">077</FONT>         * Generates random bytes and places them into a user-supplied<a name="line.77"></a>
+<FONT color="green">078</FONT>         * byte array.  The number of random bytes produced is equal to<a name="line.78"></a>
+<FONT color="green">079</FONT>         * the length of the byte array.<a name="line.79"></a>
+<FONT color="green">080</FONT>         *<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @param bytes the non-null byte array in which to put the<a name="line.81"></a>
+<FONT color="green">082</FONT>         * random bytes<a name="line.82"></a>
+<FONT color="green">083</FONT>         */<a name="line.83"></a>
+<FONT color="green">084</FONT>        @Override<a name="line.84"></a>
+<FONT color="green">085</FONT>        public void nextBytes(byte[] bytes) {<a name="line.85"></a>
+<FONT color="green">086</FONT>            randomGenerator.nextBytes(bytes);<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>         /**<a name="line.89"></a>
+<FONT color="green">090</FONT>         * Returns the next pseudorandom, uniformly distributed<a name="line.90"></a>
+<FONT color="green">091</FONT>         * &lt;code&gt;double&lt;/code&gt; value between &lt;code&gt;0.0&lt;/code&gt; and<a name="line.91"></a>
+<FONT color="green">092</FONT>         * &lt;code&gt;1.0&lt;/code&gt; from this random number generator's sequence.<a name="line.92"></a>
+<FONT color="green">093</FONT>         *<a name="line.93"></a>
+<FONT color="green">094</FONT>         * @return  the next pseudorandom, uniformly distributed<a name="line.94"></a>
+<FONT color="green">095</FONT>         *  &lt;code&gt;double&lt;/code&gt; value between &lt;code&gt;0.0&lt;/code&gt; and<a name="line.95"></a>
+<FONT color="green">096</FONT>         *  &lt;code&gt;1.0&lt;/code&gt; from this random number generator's sequence<a name="line.96"></a>
+<FONT color="green">097</FONT>         */<a name="line.97"></a>
+<FONT color="green">098</FONT>        @Override<a name="line.98"></a>
+<FONT color="green">099</FONT>        public double nextDouble() {<a name="line.99"></a>
+<FONT color="green">100</FONT>            return randomGenerator.nextDouble();<a name="line.100"></a>
+<FONT color="green">101</FONT>        }<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        /**<a name="line.103"></a>
+<FONT color="green">104</FONT>         * Returns the next pseudorandom, uniformly distributed &lt;code&gt;float&lt;/code&gt;<a name="line.104"></a>
+<FONT color="green">105</FONT>         * value between &lt;code&gt;0.0&lt;/code&gt; and &lt;code&gt;1.0&lt;/code&gt; from this random<a name="line.105"></a>
+<FONT color="green">106</FONT>         * number generator's sequence.<a name="line.106"></a>
+<FONT color="green">107</FONT>         *<a name="line.107"></a>
+<FONT color="green">108</FONT>         * @return  the next pseudorandom, uniformly distributed &lt;code&gt;float&lt;/code&gt;<a name="line.108"></a>
+<FONT color="green">109</FONT>         * value between &lt;code&gt;0.0&lt;/code&gt; and &lt;code&gt;1.0&lt;/code&gt; from this<a name="line.109"></a>
+<FONT color="green">110</FONT>         * random number generator's sequence<a name="line.110"></a>
+<FONT color="green">111</FONT>         */<a name="line.111"></a>
+<FONT color="green">112</FONT>        @Override<a name="line.112"></a>
+<FONT color="green">113</FONT>        public float nextFloat() {<a name="line.113"></a>
+<FONT color="green">114</FONT>            return randomGenerator.nextFloat();<a name="line.114"></a>
+<FONT color="green">115</FONT>        }<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>        /**<a name="line.117"></a>
+<FONT color="green">118</FONT>         * Returns the next pseudorandom, Gaussian ("normally") distributed<a name="line.118"></a>
+<FONT color="green">119</FONT>         * &lt;code&gt;double&lt;/code&gt; value with mean &lt;code&gt;0.0&lt;/code&gt; and standard<a name="line.119"></a>
+<FONT color="green">120</FONT>         * deviation &lt;code&gt;1.0&lt;/code&gt; from this random number generator's sequence.<a name="line.120"></a>
+<FONT color="green">121</FONT>         *<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @return  the next pseudorandom, Gaussian ("normally") distributed<a name="line.122"></a>
+<FONT color="green">123</FONT>         * &lt;code&gt;double&lt;/code&gt; value with mean &lt;code&gt;0.0&lt;/code&gt; and<a name="line.123"></a>
+<FONT color="green">124</FONT>         * standard deviation &lt;code&gt;1.0&lt;/code&gt; from this random number<a name="line.124"></a>
+<FONT color="green">125</FONT>         *  generator's sequence<a name="line.125"></a>
+<FONT color="green">126</FONT>         */<a name="line.126"></a>
+<FONT color="green">127</FONT>        @Override<a name="line.127"></a>
+<FONT color="green">128</FONT>        public double nextGaussian() {<a name="line.128"></a>
+<FONT color="green">129</FONT>            return randomGenerator.nextGaussian();<a name="line.129"></a>
+<FONT color="green">130</FONT>        }<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>         /**<a name="line.132"></a>
+<FONT color="green">133</FONT>         * Returns the next pseudorandom, uniformly distributed &lt;code&gt;int&lt;/code&gt;<a name="line.133"></a>
+<FONT color="green">134</FONT>         * value from this random number generator's sequence.<a name="line.134"></a>
+<FONT color="green">135</FONT>         * All 2&lt;font size="-1"&gt;&lt;sup&gt;32&lt;/sup&gt;&lt;/font&gt; possible &lt;tt&gt;int&lt;/tt&gt; values<a name="line.135"></a>
+<FONT color="green">136</FONT>         * should be produced with  (approximately) equal probability.<a name="line.136"></a>
+<FONT color="green">137</FONT>         *<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @return the next pseudorandom, uniformly distributed &lt;code&gt;int&lt;/code&gt;<a name="line.138"></a>
+<FONT color="green">139</FONT>         *  value from this random number generator's sequence<a name="line.139"></a>
+<FONT color="green">140</FONT>         */<a name="line.140"></a>
+<FONT color="green">141</FONT>        @Override<a name="line.141"></a>
+<FONT color="green">142</FONT>        public int nextInt() {<a name="line.142"></a>
+<FONT color="green">143</FONT>            return randomGenerator.nextInt();<a name="line.143"></a>
+<FONT color="green">144</FONT>        }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>        /**<a name="line.146"></a>
+<FONT color="green">147</FONT>         * Returns a pseudorandom, uniformly distributed &lt;tt&gt;int&lt;/tt&gt; value<a name="line.147"></a>
+<FONT color="green">148</FONT>         * between 0 (inclusive) and the specified value (exclusive), drawn from<a name="line.148"></a>
+<FONT color="green">149</FONT>         * this random number generator's sequence.<a name="line.149"></a>
+<FONT color="green">150</FONT>         *<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @param n the bound on the random number to be returned.  Must be<a name="line.151"></a>
+<FONT color="green">152</FONT>         * positive.<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @return  a pseudorandom, uniformly distributed &lt;tt&gt;int&lt;/tt&gt;<a name="line.153"></a>
+<FONT color="green">154</FONT>         * value between 0 (inclusive) and n (exclusive).<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @throws IllegalArgumentException  if n is not positive.<a name="line.155"></a>
+<FONT color="green">156</FONT>         */<a name="line.156"></a>
+<FONT color="green">157</FONT>        @Override<a name="line.157"></a>
+<FONT color="green">158</FONT>        public int nextInt(int n) {<a name="line.158"></a>
+<FONT color="green">159</FONT>            return randomGenerator.nextInt(n);<a name="line.159"></a>
+<FONT color="green">160</FONT>        }<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>        /**<a name="line.162"></a>
+<FONT color="green">163</FONT>         * Returns the next pseudorandom, uniformly distributed &lt;code&gt;long&lt;/code&gt;<a name="line.163"></a>
+<FONT color="green">164</FONT>         * value from this random number generator's sequence.  All<a name="line.164"></a>
+<FONT color="green">165</FONT>         * 2&lt;font size="-1"&gt;&lt;sup&gt;64&lt;/sup&gt;&lt;/font&gt; possible &lt;tt&gt;long&lt;/tt&gt; values<a name="line.165"></a>
+<FONT color="green">166</FONT>         * should be produced with (approximately) equal probability.<a name="line.166"></a>
+<FONT color="green">167</FONT>         *<a name="line.167"></a>
+<FONT color="green">168</FONT>         * @return  the next pseudorandom, uniformly distributed &lt;code&gt;long&lt;/code&gt;<a name="line.168"></a>
+<FONT color="green">169</FONT>         *value from this random number generator's sequence<a name="line.169"></a>
+<FONT color="green">170</FONT>         */<a name="line.170"></a>
+<FONT color="green">171</FONT>        @Override<a name="line.171"></a>
+<FONT color="green">172</FONT>        public long nextLong() {<a name="line.172"></a>
+<FONT color="green">173</FONT>            return randomGenerator.nextLong();<a name="line.173"></a>
+<FONT color="green">174</FONT>        }<a name="line.174"></a>
+<FONT color="green">175</FONT>    <a name="line.175"></a>
+<FONT color="green">176</FONT>        /** {@inheritDoc} */<a name="line.176"></a>
+<FONT color="green">177</FONT>        public void setSeed(int seed) {<a name="line.177"></a>
+<FONT color="green">178</FONT>            if (randomGenerator != null) {  // required to avoid NPE in constructor<a name="line.178"></a>
+<FONT color="green">179</FONT>                randomGenerator.setSeed(seed);<a name="line.179"></a>
+<FONT color="green">180</FONT>            }<a name="line.180"></a>
+<FONT color="green">181</FONT>        }<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>        /** {@inheritDoc} */<a name="line.183"></a>
+<FONT color="green">184</FONT>        public void setSeed(int[] seed) {<a name="line.184"></a>
+<FONT color="green">185</FONT>            if (randomGenerator != null) {  // required to avoid NPE in constructor<a name="line.185"></a>
+<FONT color="green">186</FONT>                randomGenerator.setSeed(seed);<a name="line.186"></a>
+<FONT color="green">187</FONT>            }<a name="line.187"></a>
+<FONT color="green">188</FONT>        }<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>        /** {@inheritDoc} */<a name="line.190"></a>
+<FONT color="green">191</FONT>        @Override<a name="line.191"></a>
+<FONT color="green">192</FONT>        public void setSeed(long seed) {<a name="line.192"></a>
+<FONT color="green">193</FONT>            if (randomGenerator != null) {  // required to avoid NPE in constructor<a name="line.193"></a>
+<FONT color="green">194</FONT>                randomGenerator.setSeed(seed);<a name="line.194"></a>
+<FONT color="green">195</FONT>            }<a name="line.195"></a>
+<FONT color="green">196</FONT>        }<a name="line.196"></a>
+<FONT color="green">197</FONT>    <a name="line.197"></a>
+<FONT color="green">198</FONT>    }<a name="line.198"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/RandomData.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,338 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.random;<a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.Collection;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Random data generation utilities.<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 780975 $ $Date: 2009-06-02 05:05:37 -0400 (Tue, 02 Jun 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     */<a name="line.24"></a>
+<FONT color="green">025</FONT>    public interface RandomData {<a name="line.25"></a>
+<FONT color="green">026</FONT>        /**<a name="line.26"></a>
+<FONT color="green">027</FONT>         * Generates a random string of hex characters of length<a name="line.27"></a>
+<FONT color="green">028</FONT>         * &lt;code&gt;len&lt;/code&gt;.<a name="line.28"></a>
+<FONT color="green">029</FONT>         * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>         * The generated string will be random, but not cryptographically<a name="line.30"></a>
+<FONT color="green">031</FONT>         * secure. To generate cryptographically secure strings, use<a name="line.31"></a>
+<FONT color="green">032</FONT>         * &lt;code&gt;nextSecureHexString&lt;/code&gt;&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>         * &lt;p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;:&lt;ul&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>         * &lt;li&gt;&lt;code&gt;len &gt; 0&lt;/code&gt; (otherwise an IllegalArgumentException<a name="line.35"></a>
+<FONT color="green">036</FONT>         *     is thrown.)&lt;/li&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>         *<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @param len the length of the string to be generated<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @return random string of hex characters of length &lt;code&gt;len&lt;/code&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        String nextHexString(int len);<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /**<a name="line.44"></a>
+<FONT color="green">045</FONT>         * Generates a uniformly distributed random integer between<a name="line.45"></a>
+<FONT color="green">046</FONT>         * &lt;code&gt;lower&lt;/code&gt; and &lt;code&gt;upper&lt;/code&gt; (endpoints included).<a name="line.46"></a>
+<FONT color="green">047</FONT>         * &lt;p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>         * The generated integer will be random, but not cryptographically secure.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * To generate cryptographically secure integer sequences, use<a name="line.49"></a>
+<FONT color="green">050</FONT>         * &lt;code&gt;nextSecureInt&lt;/code&gt;.&lt;/p&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>         * &lt;p&gt;<a name="line.51"></a>
+<FONT color="green">052</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;:&lt;ul&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>         * &lt;li&gt;&lt;code&gt;lower &lt; upper&lt;/code&gt; (otherwise an IllegalArgumentException<a name="line.53"></a>
+<FONT color="green">054</FONT>         *     is thrown.)&lt;/li&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.55"></a>
+<FONT color="green">056</FONT>         *<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @param lower lower bound for generated integer<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @param upper upper bound for generated integer<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @return a random integer greater than or equal to &lt;code&gt;lower&lt;/code&gt;<a name="line.59"></a>
+<FONT color="green">060</FONT>         * and less than or equal to &lt;code&gt;upper&lt;/code&gt;.<a name="line.60"></a>
+<FONT color="green">061</FONT>         */<a name="line.61"></a>
+<FONT color="green">062</FONT>        int nextInt(int lower, int upper);<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /**<a name="line.64"></a>
+<FONT color="green">065</FONT>         * Generates a uniformly distributed random long integer between<a name="line.65"></a>
+<FONT color="green">066</FONT>         * &lt;code&gt;lower&lt;/code&gt; and &lt;code&gt;upper&lt;/code&gt; (endpoints included).<a name="line.66"></a>
+<FONT color="green">067</FONT>         * &lt;p&gt;<a name="line.67"></a>
+<FONT color="green">068</FONT>         * The generated long integer values will be random, but not<a name="line.68"></a>
+<FONT color="green">069</FONT>         * cryptographically secure.<a name="line.69"></a>
+<FONT color="green">070</FONT>         * To generate cryptographically secure sequences of longs, use<a name="line.70"></a>
+<FONT color="green">071</FONT>         * &lt;code&gt;nextSecureLong&lt;/code&gt;&lt;/p&gt;<a name="line.71"></a>
+<FONT color="green">072</FONT>         * &lt;p&gt;<a name="line.72"></a>
+<FONT color="green">073</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;:&lt;ul&gt;<a name="line.73"></a>
+<FONT color="green">074</FONT>         * &lt;li&gt;&lt;code&gt;lower &lt; upper&lt;/code&gt; (otherwise an IllegalArgumentException<a name="line.74"></a>
+<FONT color="green">075</FONT>         *     is thrown.)&lt;/li&gt;<a name="line.75"></a>
+<FONT color="green">076</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.76"></a>
+<FONT color="green">077</FONT>         *<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @param lower lower bound for generated integer<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @param upper upper bound for generated integer<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @return a random integer greater than or equal to &lt;code&gt;lower&lt;/code&gt;<a name="line.80"></a>
+<FONT color="green">081</FONT>         * and less than or equal to &lt;code&gt;upper&lt;/code&gt;.<a name="line.81"></a>
+<FONT color="green">082</FONT>         */<a name="line.82"></a>
+<FONT color="green">083</FONT>        long nextLong(long lower, long upper);<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>        /**<a name="line.85"></a>
+<FONT color="green">086</FONT>         * Generates a random string of hex characters from a secure random<a name="line.86"></a>
+<FONT color="green">087</FONT>         * sequence.<a name="line.87"></a>
+<FONT color="green">088</FONT>         * &lt;p&gt;<a name="line.88"></a>
+<FONT color="green">089</FONT>         * If cryptographic security is not required,<a name="line.89"></a>
+<FONT color="green">090</FONT>         * use &lt;code&gt;nextHexString()&lt;/code&gt;.&lt;/p&gt;<a name="line.90"></a>
+<FONT color="green">091</FONT>         * &lt;p&gt;<a name="line.91"></a>
+<FONT color="green">092</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;:&lt;ul&gt;<a name="line.92"></a>
+<FONT color="green">093</FONT>         * &lt;li&gt;&lt;code&gt;len &gt; 0&lt;/code&gt; (otherwise an IllegalArgumentException<a name="line.93"></a>
+<FONT color="green">094</FONT>         *     is thrown.)&lt;/li&gt;<a name="line.94"></a>
+<FONT color="green">095</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @param len length of return string<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @return the random hex string<a name="line.97"></a>
+<FONT color="green">098</FONT>         */<a name="line.98"></a>
+<FONT color="green">099</FONT>        String nextSecureHexString(int len);<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /**<a name="line.101"></a>
+<FONT color="green">102</FONT>         * Generates a uniformly distributed random integer between<a name="line.102"></a>
+<FONT color="green">103</FONT>         * &lt;code&gt;lower&lt;/code&gt; and &lt;code&gt;upper&lt;/code&gt; (endpoints included)<a name="line.103"></a>
+<FONT color="green">104</FONT>         * from a secure random sequence.<a name="line.104"></a>
+<FONT color="green">105</FONT>         * &lt;p&gt;<a name="line.105"></a>
+<FONT color="green">106</FONT>         * Sequences of integers generated using this method will be<a name="line.106"></a>
+<FONT color="green">107</FONT>         * cryptographically secure. If cryptographic security is not required,<a name="line.107"></a>
+<FONT color="green">108</FONT>         * &lt;code&gt;nextInt&lt;/code&gt; should be used instead of this method.&lt;/p&gt;<a name="line.108"></a>
+<FONT color="green">109</FONT>         * &lt;p&gt;<a name="line.109"></a>
+<FONT color="green">110</FONT>         * &lt;strong&gt;Definition&lt;/strong&gt;:<a name="line.110"></a>
+<FONT color="green">111</FONT>         * &lt;a href="http://en.wikipedia.org/wiki/Cryptographically_secure_pseudo-random_number_generator"&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>         * Secure Random Sequence&lt;/a&gt;&lt;/p&gt;<a name="line.112"></a>
+<FONT color="green">113</FONT>         * &lt;p&gt;<a name="line.113"></a>
+<FONT color="green">114</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;:&lt;ul&gt;<a name="line.114"></a>
+<FONT color="green">115</FONT>         * &lt;li&gt;&lt;code&gt;lower &lt; upper&lt;/code&gt; (otherwise an IllegalArgumentException<a name="line.115"></a>
+<FONT color="green">116</FONT>         *     is thrown.)&lt;/li&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>         *<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @param lower lower bound for generated integer<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @param upper upper bound for generated integer<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @return a random integer greater than or equal to &lt;code&gt;lower&lt;/code&gt;<a name="line.121"></a>
+<FONT color="green">122</FONT>         * and less than or equal to &lt;code&gt;upper&lt;/code&gt;.<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        int nextSecureInt(int lower, int upper);<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>        /**<a name="line.126"></a>
+<FONT color="green">127</FONT>         * Generates a random long integer between &lt;code&gt;lower&lt;/code&gt;<a name="line.127"></a>
+<FONT color="green">128</FONT>         * and &lt;code&gt;upper&lt;/code&gt; (endpoints included).<a name="line.128"></a>
+<FONT color="green">129</FONT>         * &lt;p&gt;<a name="line.129"></a>
+<FONT color="green">130</FONT>         * Sequences of long values generated using this method will be<a name="line.130"></a>
+<FONT color="green">131</FONT>         * cryptographically secure. If cryptographic security is not required,<a name="line.131"></a>
+<FONT color="green">132</FONT>         * &lt;code&gt;nextLong&lt;/code&gt; should be used instead of this method.&lt;/p&gt;<a name="line.132"></a>
+<FONT color="green">133</FONT>         * &lt;p&gt;<a name="line.133"></a>
+<FONT color="green">134</FONT>         * &lt;strong&gt;Definition&lt;/strong&gt;:<a name="line.134"></a>
+<FONT color="green">135</FONT>         * &lt;a href="http://en.wikipedia.org/wiki/Cryptographically_secure_pseudo-random_number_generator"&gt;<a name="line.135"></a>
+<FONT color="green">136</FONT>         * Secure Random Sequence&lt;/a&gt;&lt;/p&gt;<a name="line.136"></a>
+<FONT color="green">137</FONT>         * &lt;p&gt;<a name="line.137"></a>
+<FONT color="green">138</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;:&lt;ul&gt;<a name="line.138"></a>
+<FONT color="green">139</FONT>         * &lt;li&gt;&lt;code&gt;lower &lt; upper&lt;/code&gt; (otherwise an IllegalArgumentException<a name="line.139"></a>
+<FONT color="green">140</FONT>         *     is thrown.)&lt;/li&gt;<a name="line.140"></a>
+<FONT color="green">141</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>         *<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @param lower lower bound for generated integer<a name="line.143"></a>
+<FONT color="green">144</FONT>         * @param upper upper bound for generated integer<a name="line.144"></a>
+<FONT color="green">145</FONT>         * @return a long integer greater than or equal to &lt;code&gt;lower&lt;/code&gt;<a name="line.145"></a>
+<FONT color="green">146</FONT>         * and less than or equal to &lt;code&gt;upper&lt;/code&gt;.<a name="line.146"></a>
+<FONT color="green">147</FONT>         */<a name="line.147"></a>
+<FONT color="green">148</FONT>        long nextSecureLong(long lower, long upper);<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>        /**<a name="line.150"></a>
+<FONT color="green">151</FONT>         * Generates a random value from the Poisson distribution with<a name="line.151"></a>
+<FONT color="green">152</FONT>         * the given mean.<a name="line.152"></a>
+<FONT color="green">153</FONT>         * &lt;p&gt;<a name="line.153"></a>
+<FONT color="green">154</FONT>         * &lt;strong&gt;Definition&lt;/strong&gt;:<a name="line.154"></a>
+<FONT color="green">155</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda366j.htm"&gt;<a name="line.155"></a>
+<FONT color="green">156</FONT>         * Poisson Distribution&lt;/a&gt;&lt;/p&gt;<a name="line.156"></a>
+<FONT color="green">157</FONT>         * &lt;p&gt;<a name="line.157"></a>
+<FONT color="green">158</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.158"></a>
+<FONT color="green">159</FONT>         * &lt;li&gt;The specified mean &lt;i&gt;must&lt;/i&gt; be positive (otherwise an<a name="line.159"></a>
+<FONT color="green">160</FONT>         *     IllegalArgumentException is thrown.)&lt;/li&gt;<a name="line.160"></a>
+<FONT color="green">161</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @param mean Mean of the distribution<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @return poisson deviate with the specified mean<a name="line.163"></a>
+<FONT color="green">164</FONT>         */<a name="line.164"></a>
+<FONT color="green">165</FONT>        long nextPoisson(double mean);<a name="line.165"></a>
+<FONT color="green">166</FONT>    <a name="line.166"></a>
+<FONT color="green">167</FONT>        /**<a name="line.167"></a>
+<FONT color="green">168</FONT>         * Generates a random value from the<a name="line.168"></a>
+<FONT color="green">169</FONT>         * Normal (or Gaussian) distribution with the given mean<a name="line.169"></a>
+<FONT color="green">170</FONT>         * and standard deviation.<a name="line.170"></a>
+<FONT color="green">171</FONT>         * &lt;p&gt;<a name="line.171"></a>
+<FONT color="green">172</FONT>         * &lt;strong&gt;Definition&lt;/strong&gt;:<a name="line.172"></a>
+<FONT color="green">173</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda3661.htm"&gt;<a name="line.173"></a>
+<FONT color="green">174</FONT>         * Normal Distribution&lt;/a&gt;&lt;/p&gt;<a name="line.174"></a>
+<FONT color="green">175</FONT>         * &lt;p&gt;<a name="line.175"></a>
+<FONT color="green">176</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.176"></a>
+<FONT color="green">177</FONT>         * &lt;li&gt;&lt;code&gt;sigma &gt; 0&lt;/code&gt; (otherwise an IllegalArgumentException<a name="line.177"></a>
+<FONT color="green">178</FONT>         *     is thrown.)&lt;/li&gt;<a name="line.178"></a>
+<FONT color="green">179</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.179"></a>
+<FONT color="green">180</FONT>         * @param mu Mean of the distribution<a name="line.180"></a>
+<FONT color="green">181</FONT>         * @param sigma Standard deviation of the distribution<a name="line.181"></a>
+<FONT color="green">182</FONT>         * @return random value from Gaussian distribution with mean = mu,<a name="line.182"></a>
+<FONT color="green">183</FONT>         * standard deviation = sigma<a name="line.183"></a>
+<FONT color="green">184</FONT>         */<a name="line.184"></a>
+<FONT color="green">185</FONT>        double nextGaussian(double mu, double sigma);<a name="line.185"></a>
+<FONT color="green">186</FONT>    <a name="line.186"></a>
+<FONT color="green">187</FONT>        /**<a name="line.187"></a>
+<FONT color="green">188</FONT>         * Generates a random value from the exponential distribution<a name="line.188"></a>
+<FONT color="green">189</FONT>         * with expected value = &lt;code&gt;mean&lt;/code&gt;.<a name="line.189"></a>
+<FONT color="green">190</FONT>         * &lt;p&gt;<a name="line.190"></a>
+<FONT color="green">191</FONT>         * &lt;strong&gt;Definition&lt;/strong&gt;:<a name="line.191"></a>
+<FONT color="green">192</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda3667.htm"&gt;<a name="line.192"></a>
+<FONT color="green">193</FONT>         * Exponential Distribution&lt;/a&gt;&lt;/p&gt;<a name="line.193"></a>
+<FONT color="green">194</FONT>         * &lt;p&gt;<a name="line.194"></a>
+<FONT color="green">195</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.195"></a>
+<FONT color="green">196</FONT>         * &lt;li&gt;&lt;code&gt;mu &gt;= 0&lt;/code&gt; (otherwise an IllegalArgumentException<a name="line.196"></a>
+<FONT color="green">197</FONT>         *     is thrown.)&lt;/li&gt;<a name="line.197"></a>
+<FONT color="green">198</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.198"></a>
+<FONT color="green">199</FONT>         * @param mean Mean of the distribution<a name="line.199"></a>
+<FONT color="green">200</FONT>         * @return random value from exponential distribution<a name="line.200"></a>
+<FONT color="green">201</FONT>         */<a name="line.201"></a>
+<FONT color="green">202</FONT>        double nextExponential(double mean);<a name="line.202"></a>
+<FONT color="green">203</FONT>    <a name="line.203"></a>
+<FONT color="green">204</FONT>        /**<a name="line.204"></a>
+<FONT color="green">205</FONT>         * Generates a uniformly distributed random value from the open interval<a name="line.205"></a>
+<FONT color="green">206</FONT>         * (&lt;code&gt;lower&lt;/code&gt;,&lt;code&gt;upper&lt;/code&gt;) (i.e., endpoints excluded).<a name="line.206"></a>
+<FONT color="green">207</FONT>         * &lt;p&gt;<a name="line.207"></a>
+<FONT color="green">208</FONT>         * &lt;strong&gt;Definition&lt;/strong&gt;:<a name="line.208"></a>
+<FONT color="green">209</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda3662.htm"&gt;<a name="line.209"></a>
+<FONT color="green">210</FONT>         * Uniform Distribution&lt;/a&gt; &lt;code&gt;lower&lt;/code&gt; and<a name="line.210"></a>
+<FONT color="green">211</FONT>         * &lt;code&gt;upper - lower&lt;/code&gt; are the<a name="line.211"></a>
+<FONT color="green">212</FONT>         * &lt;a href = "http://www.itl.nist.gov/div898/handbook/eda/section3/eda364.htm"&gt;<a name="line.212"></a>
+<FONT color="green">213</FONT>         * location and scale parameters&lt;/a&gt;, respectively.&lt;/p&gt;<a name="line.213"></a>
+<FONT color="green">214</FONT>         * &lt;p&gt;<a name="line.214"></a>
+<FONT color="green">215</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;:&lt;ul&gt;<a name="line.215"></a>
+<FONT color="green">216</FONT>         * &lt;li&gt;&lt;code&gt;lower &lt; upper&lt;/code&gt; (otherwise an IllegalArgumentException<a name="line.216"></a>
+<FONT color="green">217</FONT>         *     is thrown.)&lt;/li&gt;<a name="line.217"></a>
+<FONT color="green">218</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.218"></a>
+<FONT color="green">219</FONT>         *<a name="line.219"></a>
+<FONT color="green">220</FONT>         * @param lower lower endpoint of the interval of support<a name="line.220"></a>
+<FONT color="green">221</FONT>         * @param upper upper endpoint of the interval of support<a name="line.221"></a>
+<FONT color="green">222</FONT>         * @return uniformly distributed random value between lower<a name="line.222"></a>
+<FONT color="green">223</FONT>         * and upper (exclusive)<a name="line.223"></a>
+<FONT color="green">224</FONT>         */<a name="line.224"></a>
+<FONT color="green">225</FONT>        double nextUniform(double lower, double upper);<a name="line.225"></a>
+<FONT color="green">226</FONT>    <a name="line.226"></a>
+<FONT color="green">227</FONT>        /**<a name="line.227"></a>
+<FONT color="green">228</FONT>         * Generates an integer array of length &lt;code&gt;k&lt;/code&gt; whose entries<a name="line.228"></a>
+<FONT color="green">229</FONT>         * are selected randomly, without repetition, from the integers &lt;code&gt;<a name="line.229"></a>
+<FONT color="green">230</FONT>         * 0 through n-1&lt;/code&gt; (inclusive).<a name="line.230"></a>
+<FONT color="green">231</FONT>         * &lt;p&gt;<a name="line.231"></a>
+<FONT color="green">232</FONT>         * Generated arrays represent permutations<a name="line.232"></a>
+<FONT color="green">233</FONT>         * of &lt;code&gt;n&lt;/code&gt; taken &lt;code&gt;k&lt;/code&gt; at a time.&lt;/p&gt;<a name="line.233"></a>
+<FONT color="green">234</FONT>         * &lt;p&gt;<a name="line.234"></a>
+<FONT color="green">235</FONT>         * &lt;strong&gt;Preconditions:&lt;/strong&gt;&lt;ul&gt;<a name="line.235"></a>
+<FONT color="green">236</FONT>         * &lt;li&gt; &lt;code&gt;k &lt;= n&lt;/code&gt;&lt;/li&gt;<a name="line.236"></a>
+<FONT color="green">237</FONT>         * &lt;li&gt; &lt;code&gt;n &gt; 0&lt;/code&gt; &lt;/li&gt;<a name="line.237"></a>
+<FONT color="green">238</FONT>         * &lt;/ul&gt;<a name="line.238"></a>
+<FONT color="green">239</FONT>         * If the preconditions are not met, an IllegalArgumentException is<a name="line.239"></a>
+<FONT color="green">240</FONT>         * thrown.&lt;/p&gt;<a name="line.240"></a>
+<FONT color="green">241</FONT>         *<a name="line.241"></a>
+<FONT color="green">242</FONT>         * @param n domain of the permutation<a name="line.242"></a>
+<FONT color="green">243</FONT>         * @param k size of the permutation<a name="line.243"></a>
+<FONT color="green">244</FONT>         * @return random k-permutation of n<a name="line.244"></a>
+<FONT color="green">245</FONT>         */<a name="line.245"></a>
+<FONT color="green">246</FONT>        int[] nextPermutation(int n, int k);<a name="line.246"></a>
+<FONT color="green">247</FONT>    <a name="line.247"></a>
+<FONT color="green">248</FONT>        /**<a name="line.248"></a>
+<FONT color="green">249</FONT>         * Returns an array of &lt;code&gt;k&lt;/code&gt; objects selected randomly<a name="line.249"></a>
+<FONT color="green">250</FONT>         * from the Collection &lt;code&gt;c&lt;/code&gt;.<a name="line.250"></a>
+<FONT color="green">251</FONT>         * &lt;p&gt;<a name="line.251"></a>
+<FONT color="green">252</FONT>         * Sampling from &lt;code&gt;c&lt;/code&gt;<a name="line.252"></a>
+<FONT color="green">253</FONT>         * is without replacement; but if &lt;code&gt;c&lt;/code&gt; contains identical<a name="line.253"></a>
+<FONT color="green">254</FONT>         * objects, the sample may include repeats.  If all elements of &lt;code&gt;<a name="line.254"></a>
+<FONT color="green">255</FONT>         * c&lt;/code&gt; are distinct, the resulting object array represents a<a name="line.255"></a>
+<FONT color="green">256</FONT>         * &lt;a href="http://rkb.home.cern.ch/rkb/AN16pp/node250.html#SECTION0002500000000000000000"&gt;<a name="line.256"></a>
+<FONT color="green">257</FONT>         * Simple Random Sample&lt;/a&gt; of size<a name="line.257"></a>
+<FONT color="green">258</FONT>         * &lt;code&gt;k&lt;/code&gt; from the elements of &lt;code&gt;c&lt;/code&gt;.&lt;/p&gt;<a name="line.258"></a>
+<FONT color="green">259</FONT>         * &lt;p&gt;<a name="line.259"></a>
+<FONT color="green">260</FONT>         * &lt;strong&gt;Preconditions:&lt;/strong&gt;&lt;ul&gt;<a name="line.260"></a>
+<FONT color="green">261</FONT>         * &lt;li&gt; k must be less than or equal to the size of c &lt;/li&gt;<a name="line.261"></a>
+<FONT color="green">262</FONT>         * &lt;li&gt; c must not be empty &lt;/li&gt;<a name="line.262"></a>
+<FONT color="green">263</FONT>         * &lt;/ul&gt;<a name="line.263"></a>
+<FONT color="green">264</FONT>         * If the preconditions are not met, an IllegalArgumentException is<a name="line.264"></a>
+<FONT color="green">265</FONT>         * thrown.&lt;/p&gt;<a name="line.265"></a>
+<FONT color="green">266</FONT>         *<a name="line.266"></a>
+<FONT color="green">267</FONT>         * @param c collection to be sampled<a name="line.267"></a>
+<FONT color="green">268</FONT>         * @param k size of the sample<a name="line.268"></a>
+<FONT color="green">269</FONT>         * @return random sample of k elements from c<a name="line.269"></a>
+<FONT color="green">270</FONT>         */<a name="line.270"></a>
+<FONT color="green">271</FONT>        Object[] nextSample(Collection&lt;?&gt; c, int k);<a name="line.271"></a>
+<FONT color="green">272</FONT>    }<a name="line.272"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/RandomDataImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,814 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.random;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.security.MessageDigest;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.security.SecureRandom;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.security.NoSuchAlgorithmException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import java.security.NoSuchProviderException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import java.util.Collection;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>    /**<a name="line.30"></a>
+<FONT color="green">031</FONT>     * Implements the {@link RandomData} interface using a {@link RandomGenerator}<a name="line.31"></a>
+<FONT color="green">032</FONT>     * instance to generate non-secure data and a {@link java.security.SecureRandom}<a name="line.32"></a>
+<FONT color="green">033</FONT>     * instance to provide data for the &lt;code&gt;nextSecureXxx&lt;/code&gt; methods. If no<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;code&gt;RandomGenerator&lt;/code&gt; is provided in the constructor, the default is<a name="line.34"></a>
+<FONT color="green">035</FONT>     * to use a generator based on {@link java.util.Random}. To plug in a different<a name="line.35"></a>
+<FONT color="green">036</FONT>     * implementation, either implement &lt;code&gt;RandomGenerator&lt;/code&gt; directly or<a name="line.36"></a>
+<FONT color="green">037</FONT>     * extend {@link AbstractRandomGenerator}.<a name="line.37"></a>
+<FONT color="green">038</FONT>     * &lt;p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * Supports reseeding the underlying pseudo-random number generator (PRNG). The<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;code&gt;SecurityProvider&lt;/code&gt; and &lt;code&gt;Algorithm&lt;/code&gt; used by the<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;code&gt;SecureRandom&lt;/code&gt; instance can also be reset.<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;/p&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     * &lt;p&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     * For details on the default PRNGs, see {@link java.util.Random} and<a name="line.44"></a>
+<FONT color="green">045</FONT>     * {@link java.security.SecureRandom}.<a name="line.45"></a>
+<FONT color="green">046</FONT>     * &lt;/p&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     * &lt;p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     * &lt;strong&gt;Usage Notes&lt;/strong&gt;:<a name="line.48"></a>
+<FONT color="green">049</FONT>     * &lt;ul&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     * &lt;li&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>     * Instance variables are used to maintain &lt;code&gt;RandomGenerator&lt;/code&gt; and<a name="line.51"></a>
+<FONT color="green">052</FONT>     * &lt;code&gt;SecureRandom&lt;/code&gt; instances used in data generation. Therefore, to<a name="line.52"></a>
+<FONT color="green">053</FONT>     * generate a random sequence of values or strings, you should use just<a name="line.53"></a>
+<FONT color="green">054</FONT>     * &lt;strong&gt;one&lt;/strong&gt; &lt;code&gt;RandomDataImpl&lt;/code&gt; instance repeatedly.&lt;/li&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>     * &lt;li&gt;<a name="line.55"></a>
+<FONT color="green">056</FONT>     * The "secure" methods are *much* slower. These should be used only when a<a name="line.56"></a>
+<FONT color="green">057</FONT>     * cryptographically secure random sequence is required. A secure random<a name="line.57"></a>
+<FONT color="green">058</FONT>     * sequence is a sequence of pseudo-random values which, in addition to being<a name="line.58"></a>
+<FONT color="green">059</FONT>     * well-dispersed (so no subsequence of values is an any more likely than other<a name="line.59"></a>
+<FONT color="green">060</FONT>     * subsequence of the the same length), also has the additional property that<a name="line.60"></a>
+<FONT color="green">061</FONT>     * knowledge of values generated up to any point in the sequence does not make<a name="line.61"></a>
+<FONT color="green">062</FONT>     * it any easier to predict subsequent values.&lt;/li&gt;<a name="line.62"></a>
+<FONT color="green">063</FONT>     * &lt;li&gt;<a name="line.63"></a>
+<FONT color="green">064</FONT>     * When a new &lt;code&gt;RandomDataImpl&lt;/code&gt; is created, the underlying random<a name="line.64"></a>
+<FONT color="green">065</FONT>     * number generators are &lt;strong&gt;not&lt;/strong&gt; intialized. If you do not<a name="line.65"></a>
+<FONT color="green">066</FONT>     * explicitly seed the default non-secure generator, it is seeded with the<a name="line.66"></a>
+<FONT color="green">067</FONT>     * current time in milliseconds on first use. The same holds for the secure<a name="line.67"></a>
+<FONT color="green">068</FONT>     * generator. If you provide a &lt;code&gt;RandomGenerator&lt;/code&gt; to the constructor,<a name="line.68"></a>
+<FONT color="green">069</FONT>     * however, this generator is not reseeded by the constructor nor is it reseeded<a name="line.69"></a>
+<FONT color="green">070</FONT>     * on first use.&lt;/li&gt;<a name="line.70"></a>
+<FONT color="green">071</FONT>     * &lt;li&gt;<a name="line.71"></a>
+<FONT color="green">072</FONT>     * The &lt;code&gt;reSeed&lt;/code&gt; and &lt;code&gt;reSeedSecure&lt;/code&gt; methods delegate to the<a name="line.72"></a>
+<FONT color="green">073</FONT>     * corresponding methods on the underlying &lt;code&gt;RandomGenerator&lt;/code&gt; and<a name="line.73"></a>
+<FONT color="green">074</FONT>     * &lt;code&gt;SecureRandom&lt;/code&gt; instances. Therefore, &lt;code&gt;reSeed(long)&lt;/code&gt;<a name="line.74"></a>
+<FONT color="green">075</FONT>     * fully resets the initial state of the non-secure random number generator (so<a name="line.75"></a>
+<FONT color="green">076</FONT>     * that reseeding with a specific value always results in the same subsequent<a name="line.76"></a>
+<FONT color="green">077</FONT>     * random sequence); whereas reSeedSecure(long) does &lt;strong&gt;not&lt;/strong&gt;<a name="line.77"></a>
+<FONT color="green">078</FONT>     * reinitialize the secure random number generator (so secure sequences started<a name="line.78"></a>
+<FONT color="green">079</FONT>     * with calls to reseedSecure(long) won't be identical).&lt;/li&gt;<a name="line.79"></a>
+<FONT color="green">080</FONT>     * &lt;li&gt;<a name="line.80"></a>
+<FONT color="green">081</FONT>     * This implementation is not synchronized.<a name="line.81"></a>
+<FONT color="green">082</FONT>     * &lt;/ul&gt;<a name="line.82"></a>
+<FONT color="green">083</FONT>     * &lt;/p&gt;<a name="line.83"></a>
+<FONT color="green">084</FONT>     *<a name="line.84"></a>
+<FONT color="green">085</FONT>     * @version $Revision: 831510 $ $Date: 2009-10-30 22:30:18 -0400 (Fri, 30 Oct 2009) $<a name="line.85"></a>
+<FONT color="green">086</FONT>     */<a name="line.86"></a>
+<FONT color="green">087</FONT>    public class RandomDataImpl implements RandomData, Serializable {<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /** Serializable version identifier */<a name="line.89"></a>
+<FONT color="green">090</FONT>        private static final long serialVersionUID = -626730818244969716L;<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /** underlying random number generator */<a name="line.92"></a>
+<FONT color="green">093</FONT>        private RandomGenerator rand = null;<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /** underlying secure random number generator */<a name="line.95"></a>
+<FONT color="green">096</FONT>        private SecureRandom secRand = null;<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /**<a name="line.98"></a>
+<FONT color="green">099</FONT>         * Construct a RandomDataImpl.<a name="line.99"></a>
+<FONT color="green">100</FONT>         */<a name="line.100"></a>
+<FONT color="green">101</FONT>        public RandomDataImpl() {<a name="line.101"></a>
+<FONT color="green">102</FONT>        }<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /**<a name="line.104"></a>
+<FONT color="green">105</FONT>         * Construct a RandomDataImpl using the supplied {@link RandomGenerator} as<a name="line.105"></a>
+<FONT color="green">106</FONT>         * the source of (non-secure) random data.<a name="line.106"></a>
+<FONT color="green">107</FONT>         *<a name="line.107"></a>
+<FONT color="green">108</FONT>         * @param rand<a name="line.108"></a>
+<FONT color="green">109</FONT>         *            the source of (non-secure) random data<a name="line.109"></a>
+<FONT color="green">110</FONT>         * @since 1.1<a name="line.110"></a>
+<FONT color="green">111</FONT>         */<a name="line.111"></a>
+<FONT color="green">112</FONT>        public RandomDataImpl(RandomGenerator rand) {<a name="line.112"></a>
+<FONT color="green">113</FONT>            super();<a name="line.113"></a>
+<FONT color="green">114</FONT>            this.rand = rand;<a name="line.114"></a>
+<FONT color="green">115</FONT>        }<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>        /**<a name="line.117"></a>
+<FONT color="green">118</FONT>         * {@inheritDoc}<a name="line.118"></a>
+<FONT color="green">119</FONT>         * &lt;p&gt;<a name="line.119"></a>
+<FONT color="green">120</FONT>         * &lt;strong&gt;Algorithm Description:&lt;/strong&gt; hex strings are generated using a<a name="line.120"></a>
+<FONT color="green">121</FONT>         * 2-step process.<a name="line.121"></a>
+<FONT color="green">122</FONT>         * &lt;ol&gt;<a name="line.122"></a>
+<FONT color="green">123</FONT>         * &lt;li&gt;<a name="line.123"></a>
+<FONT color="green">124</FONT>         * len/2+1 binary bytes are generated using the underlying Random&lt;/li&gt;<a name="line.124"></a>
+<FONT color="green">125</FONT>         * &lt;li&gt;<a name="line.125"></a>
+<FONT color="green">126</FONT>         * Each binary byte is translated into 2 hex digits&lt;/li&gt;<a name="line.126"></a>
+<FONT color="green">127</FONT>         * &lt;/ol&gt;<a name="line.127"></a>
+<FONT color="green">128</FONT>         * &lt;/p&gt;<a name="line.128"></a>
+<FONT color="green">129</FONT>         *<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @param len<a name="line.130"></a>
+<FONT color="green">131</FONT>         *            the desired string length.<a name="line.131"></a>
+<FONT color="green">132</FONT>         * @return the random string.<a name="line.132"></a>
+<FONT color="green">133</FONT>         */<a name="line.133"></a>
+<FONT color="green">134</FONT>        public String nextHexString(int len) {<a name="line.134"></a>
+<FONT color="green">135</FONT>            if (len &lt;= 0) {<a name="line.135"></a>
+<FONT color="green">136</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.136"></a>
+<FONT color="green">137</FONT>                      "length must be positive ({0})", len);<a name="line.137"></a>
+<FONT color="green">138</FONT>            }<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>            // Get a random number generator<a name="line.140"></a>
+<FONT color="green">141</FONT>            RandomGenerator ran = getRan();<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>            // Initialize output buffer<a name="line.143"></a>
+<FONT color="green">144</FONT>            StringBuffer outBuffer = new StringBuffer();<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>            // Get int(len/2)+1 random bytes<a name="line.146"></a>
+<FONT color="green">147</FONT>            byte[] randomBytes = new byte[(len / 2) + 1];<a name="line.147"></a>
+<FONT color="green">148</FONT>            ran.nextBytes(randomBytes);<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>            // Convert each byte to 2 hex digits<a name="line.150"></a>
+<FONT color="green">151</FONT>            for (int i = 0; i &lt; randomBytes.length; i++) {<a name="line.151"></a>
+<FONT color="green">152</FONT>                Integer c = Integer.valueOf(randomBytes[i]);<a name="line.152"></a>
+<FONT color="green">153</FONT>    <a name="line.153"></a>
+<FONT color="green">154</FONT>                /*<a name="line.154"></a>
+<FONT color="green">155</FONT>                 * Add 128 to byte value to make interval 0-255 before doing hex<a name="line.155"></a>
+<FONT color="green">156</FONT>                 * conversion. This guarantees &lt;= 2 hex digits from toHexString()<a name="line.156"></a>
+<FONT color="green">157</FONT>                 * toHexString would otherwise add 2^32 to negative arguments.<a name="line.157"></a>
+<FONT color="green">158</FONT>                 */<a name="line.158"></a>
+<FONT color="green">159</FONT>                String hex = Integer.toHexString(c.intValue() + 128);<a name="line.159"></a>
+<FONT color="green">160</FONT>    <a name="line.160"></a>
+<FONT color="green">161</FONT>                // Make sure we add 2 hex digits for each byte<a name="line.161"></a>
+<FONT color="green">162</FONT>                if (hex.length() == 1) {<a name="line.162"></a>
+<FONT color="green">163</FONT>                    hex = "0" + hex;<a name="line.163"></a>
+<FONT color="green">164</FONT>                }<a name="line.164"></a>
+<FONT color="green">165</FONT>                outBuffer.append(hex);<a name="line.165"></a>
+<FONT color="green">166</FONT>            }<a name="line.166"></a>
+<FONT color="green">167</FONT>            return outBuffer.toString().substring(0, len);<a name="line.167"></a>
+<FONT color="green">168</FONT>        }<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>        /**<a name="line.170"></a>
+<FONT color="green">171</FONT>         * Generate a random int value uniformly distributed between<a name="line.171"></a>
+<FONT color="green">172</FONT>         * &lt;code&gt;lower&lt;/code&gt; and &lt;code&gt;upper&lt;/code&gt;, inclusive.<a name="line.172"></a>
+<FONT color="green">173</FONT>         *<a name="line.173"></a>
+<FONT color="green">174</FONT>         * @param lower<a name="line.174"></a>
+<FONT color="green">175</FONT>         *            the lower bound.<a name="line.175"></a>
+<FONT color="green">176</FONT>         * @param upper<a name="line.176"></a>
+<FONT color="green">177</FONT>         *            the upper bound.<a name="line.177"></a>
+<FONT color="green">178</FONT>         * @return the random integer.<a name="line.178"></a>
+<FONT color="green">179</FONT>         */<a name="line.179"></a>
+<FONT color="green">180</FONT>        public int nextInt(int lower, int upper) {<a name="line.180"></a>
+<FONT color="green">181</FONT>            if (lower &gt;= upper) {<a name="line.181"></a>
+<FONT color="green">182</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.182"></a>
+<FONT color="green">183</FONT>                        "upper bound ({0}) must be greater than lower bound ({1})",<a name="line.183"></a>
+<FONT color="green">184</FONT>                        upper, lower);<a name="line.184"></a>
+<FONT color="green">185</FONT>            }<a name="line.185"></a>
+<FONT color="green">186</FONT>            double r = getRan().nextDouble();<a name="line.186"></a>
+<FONT color="green">187</FONT>            return (int) ((r * upper) + ((1.0 - r) * lower) + r);<a name="line.187"></a>
+<FONT color="green">188</FONT>        }<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>        /**<a name="line.190"></a>
+<FONT color="green">191</FONT>         * Generate a random long value uniformly distributed between<a name="line.191"></a>
+<FONT color="green">192</FONT>         * &lt;code&gt;lower&lt;/code&gt; and &lt;code&gt;upper&lt;/code&gt;, inclusive.<a name="line.192"></a>
+<FONT color="green">193</FONT>         *<a name="line.193"></a>
+<FONT color="green">194</FONT>         * @param lower<a name="line.194"></a>
+<FONT color="green">195</FONT>         *            the lower bound.<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @param upper<a name="line.196"></a>
+<FONT color="green">197</FONT>         *            the upper bound.<a name="line.197"></a>
+<FONT color="green">198</FONT>         * @return the random integer.<a name="line.198"></a>
+<FONT color="green">199</FONT>         */<a name="line.199"></a>
+<FONT color="green">200</FONT>        public long nextLong(long lower, long upper) {<a name="line.200"></a>
+<FONT color="green">201</FONT>            if (lower &gt;= upper) {<a name="line.201"></a>
+<FONT color="green">202</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.202"></a>
+<FONT color="green">203</FONT>                      "upper bound ({0}) must be greater than lower bound ({1})",<a name="line.203"></a>
+<FONT color="green">204</FONT>                      upper, lower);<a name="line.204"></a>
+<FONT color="green">205</FONT>            }<a name="line.205"></a>
+<FONT color="green">206</FONT>            double r = getRan().nextDouble();<a name="line.206"></a>
+<FONT color="green">207</FONT>            return (long) ((r * upper) + ((1.0 - r) * lower) + r);<a name="line.207"></a>
+<FONT color="green">208</FONT>        }<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>        /**<a name="line.210"></a>
+<FONT color="green">211</FONT>         * {@inheritDoc}<a name="line.211"></a>
+<FONT color="green">212</FONT>         * &lt;p&gt;<a name="line.212"></a>
+<FONT color="green">213</FONT>         * &lt;strong&gt;Algorithm Description:&lt;/strong&gt; hex strings are generated in<a name="line.213"></a>
+<FONT color="green">214</FONT>         * 40-byte segments using a 3-step process.<a name="line.214"></a>
+<FONT color="green">215</FONT>         * &lt;ol&gt;<a name="line.215"></a>
+<FONT color="green">216</FONT>         * &lt;li&gt;<a name="line.216"></a>
+<FONT color="green">217</FONT>         * 20 random bytes are generated using the underlying<a name="line.217"></a>
+<FONT color="green">218</FONT>         * &lt;code&gt;SecureRandom&lt;/code&gt;.&lt;/li&gt;<a name="line.218"></a>
+<FONT color="green">219</FONT>         * &lt;li&gt;<a name="line.219"></a>
+<FONT color="green">220</FONT>         * SHA-1 hash is applied to yield a 20-byte binary digest.&lt;/li&gt;<a name="line.220"></a>
+<FONT color="green">221</FONT>         * &lt;li&gt;<a name="line.221"></a>
+<FONT color="green">222</FONT>         * Each byte of the binary digest is converted to 2 hex digits.&lt;/li&gt;<a name="line.222"></a>
+<FONT color="green">223</FONT>         * &lt;/ol&gt;<a name="line.223"></a>
+<FONT color="green">224</FONT>         * &lt;/p&gt;<a name="line.224"></a>
+<FONT color="green">225</FONT>         *<a name="line.225"></a>
+<FONT color="green">226</FONT>         * @param len<a name="line.226"></a>
+<FONT color="green">227</FONT>         *            the length of the generated string<a name="line.227"></a>
+<FONT color="green">228</FONT>         * @return the random string<a name="line.228"></a>
+<FONT color="green">229</FONT>         */<a name="line.229"></a>
+<FONT color="green">230</FONT>        public String nextSecureHexString(int len) {<a name="line.230"></a>
+<FONT color="green">231</FONT>            if (len &lt;= 0) {<a name="line.231"></a>
+<FONT color="green">232</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.232"></a>
+<FONT color="green">233</FONT>                      "length must be positive ({0})", len);<a name="line.233"></a>
+<FONT color="green">234</FONT>            }<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>            // Get SecureRandom and setup Digest provider<a name="line.236"></a>
+<FONT color="green">237</FONT>            SecureRandom secRan = getSecRan();<a name="line.237"></a>
+<FONT color="green">238</FONT>            MessageDigest alg = null;<a name="line.238"></a>
+<FONT color="green">239</FONT>            try {<a name="line.239"></a>
+<FONT color="green">240</FONT>                alg = MessageDigest.getInstance("SHA-1");<a name="line.240"></a>
+<FONT color="green">241</FONT>            } catch (NoSuchAlgorithmException ex) {<a name="line.241"></a>
+<FONT color="green">242</FONT>                // this should never happen<a name="line.242"></a>
+<FONT color="green">243</FONT>                throw MathRuntimeException.createInternalError(ex);<a name="line.243"></a>
+<FONT color="green">244</FONT>            }<a name="line.244"></a>
+<FONT color="green">245</FONT>            alg.reset();<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>            // Compute number of iterations required (40 bytes each)<a name="line.247"></a>
+<FONT color="green">248</FONT>            int numIter = (len / 40) + 1;<a name="line.248"></a>
+<FONT color="green">249</FONT>    <a name="line.249"></a>
+<FONT color="green">250</FONT>            StringBuffer outBuffer = new StringBuffer();<a name="line.250"></a>
+<FONT color="green">251</FONT>            for (int iter = 1; iter &lt; numIter + 1; iter++) {<a name="line.251"></a>
+<FONT color="green">252</FONT>                byte[] randomBytes = new byte[40];<a name="line.252"></a>
+<FONT color="green">253</FONT>                secRan.nextBytes(randomBytes);<a name="line.253"></a>
+<FONT color="green">254</FONT>                alg.update(randomBytes);<a name="line.254"></a>
+<FONT color="green">255</FONT>    <a name="line.255"></a>
+<FONT color="green">256</FONT>                // Compute hash -- will create 20-byte binary hash<a name="line.256"></a>
+<FONT color="green">257</FONT>                byte hash[] = alg.digest();<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>                // Loop over the hash, converting each byte to 2 hex digits<a name="line.259"></a>
+<FONT color="green">260</FONT>                for (int i = 0; i &lt; hash.length; i++) {<a name="line.260"></a>
+<FONT color="green">261</FONT>                    Integer c = Integer.valueOf(hash[i]);<a name="line.261"></a>
+<FONT color="green">262</FONT>    <a name="line.262"></a>
+<FONT color="green">263</FONT>                    /*<a name="line.263"></a>
+<FONT color="green">264</FONT>                     * Add 128 to byte value to make interval 0-255 This guarantees<a name="line.264"></a>
+<FONT color="green">265</FONT>                     * &lt;= 2 hex digits from toHexString() toHexString would<a name="line.265"></a>
+<FONT color="green">266</FONT>                     * otherwise add 2^32 to negative arguments<a name="line.266"></a>
+<FONT color="green">267</FONT>                     */<a name="line.267"></a>
+<FONT color="green">268</FONT>                    String hex = Integer.toHexString(c.intValue() + 128);<a name="line.268"></a>
+<FONT color="green">269</FONT>    <a name="line.269"></a>
+<FONT color="green">270</FONT>                    // Keep strings uniform length -- guarantees 40 bytes<a name="line.270"></a>
+<FONT color="green">271</FONT>                    if (hex.length() == 1) {<a name="line.271"></a>
+<FONT color="green">272</FONT>                        hex = "0" + hex;<a name="line.272"></a>
+<FONT color="green">273</FONT>                    }<a name="line.273"></a>
+<FONT color="green">274</FONT>                    outBuffer.append(hex);<a name="line.274"></a>
+<FONT color="green">275</FONT>                }<a name="line.275"></a>
+<FONT color="green">276</FONT>            }<a name="line.276"></a>
+<FONT color="green">277</FONT>            return outBuffer.toString().substring(0, len);<a name="line.277"></a>
+<FONT color="green">278</FONT>        }<a name="line.278"></a>
+<FONT color="green">279</FONT>    <a name="line.279"></a>
+<FONT color="green">280</FONT>        /**<a name="line.280"></a>
+<FONT color="green">281</FONT>         * Generate a random int value uniformly distributed between<a name="line.281"></a>
+<FONT color="green">282</FONT>         * &lt;code&gt;lower&lt;/code&gt; and &lt;code&gt;upper&lt;/code&gt;, inclusive. This algorithm uses<a name="line.282"></a>
+<FONT color="green">283</FONT>         * a secure random number generator.<a name="line.283"></a>
+<FONT color="green">284</FONT>         *<a name="line.284"></a>
+<FONT color="green">285</FONT>         * @param lower<a name="line.285"></a>
+<FONT color="green">286</FONT>         *            the lower bound.<a name="line.286"></a>
+<FONT color="green">287</FONT>         * @param upper<a name="line.287"></a>
+<FONT color="green">288</FONT>         *            the upper bound.<a name="line.288"></a>
+<FONT color="green">289</FONT>         * @return the random integer.<a name="line.289"></a>
+<FONT color="green">290</FONT>         */<a name="line.290"></a>
+<FONT color="green">291</FONT>        public int nextSecureInt(int lower, int upper) {<a name="line.291"></a>
+<FONT color="green">292</FONT>            if (lower &gt;= upper) {<a name="line.292"></a>
+<FONT color="green">293</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.293"></a>
+<FONT color="green">294</FONT>                      "upper bound ({0}) must be greater than lower bound ({1})",<a name="line.294"></a>
+<FONT color="green">295</FONT>                      upper, lower);<a name="line.295"></a>
+<FONT color="green">296</FONT>            }<a name="line.296"></a>
+<FONT color="green">297</FONT>            SecureRandom sec = getSecRan();<a name="line.297"></a>
+<FONT color="green">298</FONT>            return lower + (int) (sec.nextDouble() * (upper - lower + 1));<a name="line.298"></a>
+<FONT color="green">299</FONT>        }<a name="line.299"></a>
+<FONT color="green">300</FONT>    <a name="line.300"></a>
+<FONT color="green">301</FONT>        /**<a name="line.301"></a>
+<FONT color="green">302</FONT>         * Generate a random long value uniformly distributed between<a name="line.302"></a>
+<FONT color="green">303</FONT>         * &lt;code&gt;lower&lt;/code&gt; and &lt;code&gt;upper&lt;/code&gt;, inclusive. This algorithm uses<a name="line.303"></a>
+<FONT color="green">304</FONT>         * a secure random number generator.<a name="line.304"></a>
+<FONT color="green">305</FONT>         *<a name="line.305"></a>
+<FONT color="green">306</FONT>         * @param lower<a name="line.306"></a>
+<FONT color="green">307</FONT>         *            the lower bound.<a name="line.307"></a>
+<FONT color="green">308</FONT>         * @param upper<a name="line.308"></a>
+<FONT color="green">309</FONT>         *            the upper bound.<a name="line.309"></a>
+<FONT color="green">310</FONT>         * @return the random integer.<a name="line.310"></a>
+<FONT color="green">311</FONT>         */<a name="line.311"></a>
+<FONT color="green">312</FONT>        public long nextSecureLong(long lower, long upper) {<a name="line.312"></a>
+<FONT color="green">313</FONT>            if (lower &gt;= upper) {<a name="line.313"></a>
+<FONT color="green">314</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.314"></a>
+<FONT color="green">315</FONT>                      "upper bound ({0}) must be greater than lower bound ({1})",<a name="line.315"></a>
+<FONT color="green">316</FONT>                      upper, lower);<a name="line.316"></a>
+<FONT color="green">317</FONT>            }<a name="line.317"></a>
+<FONT color="green">318</FONT>            SecureRandom sec = getSecRan();<a name="line.318"></a>
+<FONT color="green">319</FONT>            return lower + (long) (sec.nextDouble() * (upper - lower + 1));<a name="line.319"></a>
+<FONT color="green">320</FONT>        }<a name="line.320"></a>
+<FONT color="green">321</FONT>    <a name="line.321"></a>
+<FONT color="green">322</FONT>        /**<a name="line.322"></a>
+<FONT color="green">323</FONT>         * {@inheritDoc}<a name="line.323"></a>
+<FONT color="green">324</FONT>         * &lt;p&gt;<a name="line.324"></a>
+<FONT color="green">325</FONT>         * &lt;strong&gt;Algorithm Description&lt;/strong&gt;:<a name="line.325"></a>
+<FONT color="green">326</FONT>         * &lt;ul&gt;&lt;li&gt; For small means, uses simulation of a Poisson process<a name="line.326"></a>
+<FONT color="green">327</FONT>         * using Uniform deviates, as described<a name="line.327"></a>
+<FONT color="green">328</FONT>         * &lt;a href="http://irmi.epfl.ch/cmos/Pmmi/interactive/rng7.htm"&gt; here.&lt;/a&gt;<a name="line.328"></a>
+<FONT color="green">329</FONT>         * The Poisson process (and hence value returned) is bounded by 1000 * mean.&lt;/li&gt;<a name="line.329"></a>
+<FONT color="green">330</FONT>         *<a name="line.330"></a>
+<FONT color="green">331</FONT>         * &lt;li&gt; For large means, uses the rejection algorithm described in &lt;br/&gt;<a name="line.331"></a>
+<FONT color="green">332</FONT>         * Devroye, Luc. (1981).&lt;i&gt;The Computer Generation of Poisson Random Variables&lt;/i&gt;<a name="line.332"></a>
+<FONT color="green">333</FONT>         * &lt;strong&gt;Computing&lt;/strong&gt; vol. 26 pp. 197-207.&lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.333"></a>
+<FONT color="green">334</FONT>         *<a name="line.334"></a>
+<FONT color="green">335</FONT>         * @param mean mean of the Poisson distribution.<a name="line.335"></a>
+<FONT color="green">336</FONT>         * @return the random Poisson value.<a name="line.336"></a>
+<FONT color="green">337</FONT>         */<a name="line.337"></a>
+<FONT color="green">338</FONT>        public long nextPoisson(double mean) {<a name="line.338"></a>
+<FONT color="green">339</FONT>            if (mean &lt;= 0) {<a name="line.339"></a>
+<FONT color="green">340</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.340"></a>
+<FONT color="green">341</FONT>                      "the Poisson mean must be positive ({0})", mean);<a name="line.341"></a>
+<FONT color="green">342</FONT>            }<a name="line.342"></a>
+<FONT color="green">343</FONT>    <a name="line.343"></a>
+<FONT color="green">344</FONT>            final RandomGenerator generator = getRan();<a name="line.344"></a>
+<FONT color="green">345</FONT>    <a name="line.345"></a>
+<FONT color="green">346</FONT>            final double pivot = 40.0d;<a name="line.346"></a>
+<FONT color="green">347</FONT>            if (mean &lt; pivot) {<a name="line.347"></a>
+<FONT color="green">348</FONT>                double p = Math.exp(-mean);<a name="line.348"></a>
+<FONT color="green">349</FONT>                long n = 0;<a name="line.349"></a>
+<FONT color="green">350</FONT>                double r = 1.0d;<a name="line.350"></a>
+<FONT color="green">351</FONT>                double rnd = 1.0d;<a name="line.351"></a>
+<FONT color="green">352</FONT>    <a name="line.352"></a>
+<FONT color="green">353</FONT>                while (n &lt; 1000 * mean) {<a name="line.353"></a>
+<FONT color="green">354</FONT>                    rnd = generator.nextDouble();<a name="line.354"></a>
+<FONT color="green">355</FONT>                    r = r * rnd;<a name="line.355"></a>
+<FONT color="green">356</FONT>                    if (r &gt;= p) {<a name="line.356"></a>
+<FONT color="green">357</FONT>                        n++;<a name="line.357"></a>
+<FONT color="green">358</FONT>                    } else {<a name="line.358"></a>
+<FONT color="green">359</FONT>                        return n;<a name="line.359"></a>
+<FONT color="green">360</FONT>                    }<a name="line.360"></a>
+<FONT color="green">361</FONT>                }<a name="line.361"></a>
+<FONT color="green">362</FONT>                return n;<a name="line.362"></a>
+<FONT color="green">363</FONT>            } else {<a name="line.363"></a>
+<FONT color="green">364</FONT>                final double lambda = Math.floor(mean);<a name="line.364"></a>
+<FONT color="green">365</FONT>                final double lambdaFractional = mean - lambda;<a name="line.365"></a>
+<FONT color="green">366</FONT>                final double logLambda = Math.log(lambda);<a name="line.366"></a>
+<FONT color="green">367</FONT>                final double logLambdaFactorial = MathUtils.factorialLog((int) lambda);<a name="line.367"></a>
+<FONT color="green">368</FONT>                final long y2 = lambdaFractional &lt; Double.MIN_VALUE ? 0 : nextPoisson(lambdaFractional);<a name="line.368"></a>
+<FONT color="green">369</FONT>                final double delta = Math.sqrt(lambda * Math.log(32 * lambda / Math.PI + 1));<a name="line.369"></a>
+<FONT color="green">370</FONT>                final double halfDelta = delta / 2;<a name="line.370"></a>
+<FONT color="green">371</FONT>                final double twolpd = 2 * lambda + delta;<a name="line.371"></a>
+<FONT color="green">372</FONT>                final double a1 = Math.sqrt(Math.PI * twolpd) * Math.exp(1 / 8 * lambda);<a name="line.372"></a>
+<FONT color="green">373</FONT>                final double a2 = (twolpd / delta) * Math.exp(-delta * (1 + delta) / twolpd);<a name="line.373"></a>
+<FONT color="green">374</FONT>                final double aSum = a1 + a2 + 1;<a name="line.374"></a>
+<FONT color="green">375</FONT>                final double p1 = a1 / aSum;<a name="line.375"></a>
+<FONT color="green">376</FONT>                final double p2 = a2 / aSum;<a name="line.376"></a>
+<FONT color="green">377</FONT>                final double c1 = 1 / (8 * lambda);<a name="line.377"></a>
+<FONT color="green">378</FONT>    <a name="line.378"></a>
+<FONT color="green">379</FONT>                double x = 0;<a name="line.379"></a>
+<FONT color="green">380</FONT>                double y = 0;<a name="line.380"></a>
+<FONT color="green">381</FONT>                double v = 0;<a name="line.381"></a>
+<FONT color="green">382</FONT>                int a = 0;<a name="line.382"></a>
+<FONT color="green">383</FONT>                double t = 0;<a name="line.383"></a>
+<FONT color="green">384</FONT>                double qr = 0;<a name="line.384"></a>
+<FONT color="green">385</FONT>                double qa = 0;<a name="line.385"></a>
+<FONT color="green">386</FONT>                for (;;) {<a name="line.386"></a>
+<FONT color="green">387</FONT>                    final double u = nextUniform(0.0, 1);<a name="line.387"></a>
+<FONT color="green">388</FONT>                    if (u &lt;= p1) {<a name="line.388"></a>
+<FONT color="green">389</FONT>                        final double n = nextGaussian(0d, 1d);<a name="line.389"></a>
+<FONT color="green">390</FONT>                        x = n * Math.sqrt(lambda + halfDelta) - 0.5d;<a name="line.390"></a>
+<FONT color="green">391</FONT>                        if (x &gt; delta || x &lt; -lambda) {<a name="line.391"></a>
+<FONT color="green">392</FONT>                            continue;<a name="line.392"></a>
+<FONT color="green">393</FONT>                        }<a name="line.393"></a>
+<FONT color="green">394</FONT>                        y = x &lt; 0 ? Math.floor(x) : Math.ceil(x);<a name="line.394"></a>
+<FONT color="green">395</FONT>                        final double e = nextExponential(1d);<a name="line.395"></a>
+<FONT color="green">396</FONT>                        v = -e - (n * n / 2) + c1;<a name="line.396"></a>
+<FONT color="green">397</FONT>                    } else {<a name="line.397"></a>
+<FONT color="green">398</FONT>                        if (u &gt; p1 + p2) {<a name="line.398"></a>
+<FONT color="green">399</FONT>                            y = lambda;<a name="line.399"></a>
+<FONT color="green">400</FONT>                            break;<a name="line.400"></a>
+<FONT color="green">401</FONT>                        } else {<a name="line.401"></a>
+<FONT color="green">402</FONT>                            x = delta + (twolpd / delta) * nextExponential(1d);<a name="line.402"></a>
+<FONT color="green">403</FONT>                            y = Math.ceil(x);<a name="line.403"></a>
+<FONT color="green">404</FONT>                            v = -nextExponential(1d) - delta * (x + 1) / twolpd;<a name="line.404"></a>
+<FONT color="green">405</FONT>                        }<a name="line.405"></a>
+<FONT color="green">406</FONT>                    }<a name="line.406"></a>
+<FONT color="green">407</FONT>                    a = x &lt; 0 ? 1 : 0;<a name="line.407"></a>
+<FONT color="green">408</FONT>                    t = y * (y + 1) / (2 * lambda);<a name="line.408"></a>
+<FONT color="green">409</FONT>                    if (v &lt; -t &amp;&amp; a == 0) {<a name="line.409"></a>
+<FONT color="green">410</FONT>                        y = lambda + y;<a name="line.410"></a>
+<FONT color="green">411</FONT>                        break;<a name="line.411"></a>
+<FONT color="green">412</FONT>                    }<a name="line.412"></a>
+<FONT color="green">413</FONT>                    qr = t * ((2 * y + 1) / (6 * lambda) - 1);<a name="line.413"></a>
+<FONT color="green">414</FONT>                    qa = qr - (t * t) / (3 * (lambda + a * (y + 1)));<a name="line.414"></a>
+<FONT color="green">415</FONT>                    if (v &lt; qa) {<a name="line.415"></a>
+<FONT color="green">416</FONT>                        y = lambda + y;<a name="line.416"></a>
+<FONT color="green">417</FONT>                        break;<a name="line.417"></a>
+<FONT color="green">418</FONT>                    }<a name="line.418"></a>
+<FONT color="green">419</FONT>                    if (v &gt; qr) {<a name="line.419"></a>
+<FONT color="green">420</FONT>                        continue;<a name="line.420"></a>
+<FONT color="green">421</FONT>                    }<a name="line.421"></a>
+<FONT color="green">422</FONT>                    if (v &lt; y * logLambda - MathUtils.factorialLog((int) (y + lambda)) + logLambdaFactorial) {<a name="line.422"></a>
+<FONT color="green">423</FONT>                        y = lambda + y;<a name="line.423"></a>
+<FONT color="green">424</FONT>                        break;<a name="line.424"></a>
+<FONT color="green">425</FONT>                    }<a name="line.425"></a>
+<FONT color="green">426</FONT>                }<a name="line.426"></a>
+<FONT color="green">427</FONT>                return y2 + (long) y;<a name="line.427"></a>
+<FONT color="green">428</FONT>            }<a name="line.428"></a>
+<FONT color="green">429</FONT>        }<a name="line.429"></a>
+<FONT color="green">430</FONT>    <a name="line.430"></a>
+<FONT color="green">431</FONT>        /**<a name="line.431"></a>
+<FONT color="green">432</FONT>         * Generate a random value from a Normal (a.k.a. Gaussian) distribution with<a name="line.432"></a>
+<FONT color="green">433</FONT>         * the given mean, &lt;code&gt;mu&lt;/code&gt; and the given standard deviation,<a name="line.433"></a>
+<FONT color="green">434</FONT>         * &lt;code&gt;sigma&lt;/code&gt;.<a name="line.434"></a>
+<FONT color="green">435</FONT>         *<a name="line.435"></a>
+<FONT color="green">436</FONT>         * @param mu<a name="line.436"></a>
+<FONT color="green">437</FONT>         *            the mean of the distribution<a name="line.437"></a>
+<FONT color="green">438</FONT>         * @param sigma<a name="line.438"></a>
+<FONT color="green">439</FONT>         *            the standard deviation of the distribution<a name="line.439"></a>
+<FONT color="green">440</FONT>         * @return the random Normal value<a name="line.440"></a>
+<FONT color="green">441</FONT>         */<a name="line.441"></a>
+<FONT color="green">442</FONT>        public double nextGaussian(double mu, double sigma) {<a name="line.442"></a>
+<FONT color="green">443</FONT>            if (sigma &lt;= 0) {<a name="line.443"></a>
+<FONT color="green">444</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.444"></a>
+<FONT color="green">445</FONT>                      "standard deviation must be positive ({0})", sigma);<a name="line.445"></a>
+<FONT color="green">446</FONT>            }<a name="line.446"></a>
+<FONT color="green">447</FONT>            return sigma * getRan().nextGaussian() + mu;<a name="line.447"></a>
+<FONT color="green">448</FONT>        }<a name="line.448"></a>
+<FONT color="green">449</FONT>    <a name="line.449"></a>
+<FONT color="green">450</FONT>        /**<a name="line.450"></a>
+<FONT color="green">451</FONT>         * Returns a random value from an Exponential distribution with the given<a name="line.451"></a>
+<FONT color="green">452</FONT>         * mean.<a name="line.452"></a>
+<FONT color="green">453</FONT>         * &lt;p&gt;<a name="line.453"></a>
+<FONT color="green">454</FONT>         * &lt;strong&gt;Algorithm Description&lt;/strong&gt;: Uses the &lt;a<a name="line.454"></a>
+<FONT color="green">455</FONT>         * href="http://www.jesus.ox.ac.uk/~clifford/a5/chap1/node5.html"&gt; Inversion<a name="line.455"></a>
+<FONT color="green">456</FONT>         * Method&lt;/a&gt; to generate exponentially distributed random values from<a name="line.456"></a>
+<FONT color="green">457</FONT>         * uniform deviates.<a name="line.457"></a>
+<FONT color="green">458</FONT>         * &lt;/p&gt;<a name="line.458"></a>
+<FONT color="green">459</FONT>         *<a name="line.459"></a>
+<FONT color="green">460</FONT>         * @param mean the mean of the distribution<a name="line.460"></a>
+<FONT color="green">461</FONT>         * @return the random Exponential value<a name="line.461"></a>
+<FONT color="green">462</FONT>         */<a name="line.462"></a>
+<FONT color="green">463</FONT>        public double nextExponential(double mean) {<a name="line.463"></a>
+<FONT color="green">464</FONT>            if (mean &lt;= 0.0) {<a name="line.464"></a>
+<FONT color="green">465</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.465"></a>
+<FONT color="green">466</FONT>                      "mean must be positive ({0})", mean);<a name="line.466"></a>
+<FONT color="green">467</FONT>            }<a name="line.467"></a>
+<FONT color="green">468</FONT>            final RandomGenerator generator = getRan();<a name="line.468"></a>
+<FONT color="green">469</FONT>            double unif = generator.nextDouble();<a name="line.469"></a>
+<FONT color="green">470</FONT>            while (unif == 0.0d) {<a name="line.470"></a>
+<FONT color="green">471</FONT>                unif = generator.nextDouble();<a name="line.471"></a>
+<FONT color="green">472</FONT>            }<a name="line.472"></a>
+<FONT color="green">473</FONT>            return -mean * Math.log(unif);<a name="line.473"></a>
+<FONT color="green">474</FONT>        }<a name="line.474"></a>
+<FONT color="green">475</FONT>    <a name="line.475"></a>
+<FONT color="green">476</FONT>        /**<a name="line.476"></a>
+<FONT color="green">477</FONT>         * {@inheritDoc}<a name="line.477"></a>
+<FONT color="green">478</FONT>         * &lt;p&gt;<a name="line.478"></a>
+<FONT color="green">479</FONT>         * &lt;strong&gt;Algorithm Description&lt;/strong&gt;: scales the output of<a name="line.479"></a>
+<FONT color="green">480</FONT>         * Random.nextDouble(), but rejects 0 values (i.e., will generate another<a name="line.480"></a>
+<FONT color="green">481</FONT>         * random double if Random.nextDouble() returns 0). This is necessary to<a name="line.481"></a>
+<FONT color="green">482</FONT>         * provide a symmetric output interval (both endpoints excluded).<a name="line.482"></a>
+<FONT color="green">483</FONT>         * &lt;/p&gt;<a name="line.483"></a>
+<FONT color="green">484</FONT>         *<a name="line.484"></a>
+<FONT color="green">485</FONT>         * @param lower<a name="line.485"></a>
+<FONT color="green">486</FONT>         *            the lower bound.<a name="line.486"></a>
+<FONT color="green">487</FONT>         * @param upper<a name="line.487"></a>
+<FONT color="green">488</FONT>         *            the upper bound.<a name="line.488"></a>
+<FONT color="green">489</FONT>         * @return a uniformly distributed random value from the interval (lower,<a name="line.489"></a>
+<FONT color="green">490</FONT>         *         upper)<a name="line.490"></a>
+<FONT color="green">491</FONT>         */<a name="line.491"></a>
+<FONT color="green">492</FONT>        public double nextUniform(double lower, double upper) {<a name="line.492"></a>
+<FONT color="green">493</FONT>            if (lower &gt;= upper) {<a name="line.493"></a>
+<FONT color="green">494</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.494"></a>
+<FONT color="green">495</FONT>                      "upper bound ({0}) must be greater than lower bound ({1})",<a name="line.495"></a>
+<FONT color="green">496</FONT>                      upper, lower);<a name="line.496"></a>
+<FONT color="green">497</FONT>            }<a name="line.497"></a>
+<FONT color="green">498</FONT>            final RandomGenerator generator = getRan();<a name="line.498"></a>
+<FONT color="green">499</FONT>    <a name="line.499"></a>
+<FONT color="green">500</FONT>            // ensure nextDouble() isn't 0.0<a name="line.500"></a>
+<FONT color="green">501</FONT>            double u = generator.nextDouble();<a name="line.501"></a>
+<FONT color="green">502</FONT>            while (u &lt;= 0.0) {<a name="line.502"></a>
+<FONT color="green">503</FONT>                u = generator.nextDouble();<a name="line.503"></a>
+<FONT color="green">504</FONT>            }<a name="line.504"></a>
+<FONT color="green">505</FONT>    <a name="line.505"></a>
+<FONT color="green">506</FONT>            return lower + u * (upper - lower);<a name="line.506"></a>
+<FONT color="green">507</FONT>        }<a name="line.507"></a>
+<FONT color="green">508</FONT>    <a name="line.508"></a>
+<FONT color="green">509</FONT>        /**<a name="line.509"></a>
+<FONT color="green">510</FONT>         * Returns the RandomGenerator used to generate non-secure random data.<a name="line.510"></a>
+<FONT color="green">511</FONT>         * &lt;p&gt;<a name="line.511"></a>
+<FONT color="green">512</FONT>         * Creates and initializes a default generator if null.<a name="line.512"></a>
+<FONT color="green">513</FONT>         * &lt;/p&gt;<a name="line.513"></a>
+<FONT color="green">514</FONT>         *<a name="line.514"></a>
+<FONT color="green">515</FONT>         * @return the Random used to generate random data<a name="line.515"></a>
+<FONT color="green">516</FONT>         * @since 1.1<a name="line.516"></a>
+<FONT color="green">517</FONT>         */<a name="line.517"></a>
+<FONT color="green">518</FONT>        private RandomGenerator getRan() {<a name="line.518"></a>
+<FONT color="green">519</FONT>            if (rand == null) {<a name="line.519"></a>
+<FONT color="green">520</FONT>                rand = new JDKRandomGenerator();<a name="line.520"></a>
+<FONT color="green">521</FONT>                rand.setSeed(System.currentTimeMillis());<a name="line.521"></a>
+<FONT color="green">522</FONT>            }<a name="line.522"></a>
+<FONT color="green">523</FONT>            return rand;<a name="line.523"></a>
+<FONT color="green">524</FONT>        }<a name="line.524"></a>
+<FONT color="green">525</FONT>    <a name="line.525"></a>
+<FONT color="green">526</FONT>        /**<a name="line.526"></a>
+<FONT color="green">527</FONT>         * Returns the SecureRandom used to generate secure random data.<a name="line.527"></a>
+<FONT color="green">528</FONT>         * &lt;p&gt;<a name="line.528"></a>
+<FONT color="green">529</FONT>         * Creates and initializes if null.<a name="line.529"></a>
+<FONT color="green">530</FONT>         * &lt;/p&gt;<a name="line.530"></a>
+<FONT color="green">531</FONT>         *<a name="line.531"></a>
+<FONT color="green">532</FONT>         * @return the SecureRandom used to generate secure random data<a name="line.532"></a>
+<FONT color="green">533</FONT>         */<a name="line.533"></a>
+<FONT color="green">534</FONT>        private SecureRandom getSecRan() {<a name="line.534"></a>
+<FONT color="green">535</FONT>            if (secRand == null) {<a name="line.535"></a>
+<FONT color="green">536</FONT>                secRand = new SecureRandom();<a name="line.536"></a>
+<FONT color="green">537</FONT>                secRand.setSeed(System.currentTimeMillis());<a name="line.537"></a>
+<FONT color="green">538</FONT>            }<a name="line.538"></a>
+<FONT color="green">539</FONT>            return secRand;<a name="line.539"></a>
+<FONT color="green">540</FONT>        }<a name="line.540"></a>
+<FONT color="green">541</FONT>    <a name="line.541"></a>
+<FONT color="green">542</FONT>        /**<a name="line.542"></a>
+<FONT color="green">543</FONT>         * Reseeds the random number generator with the supplied seed.<a name="line.543"></a>
+<FONT color="green">544</FONT>         * &lt;p&gt;<a name="line.544"></a>
+<FONT color="green">545</FONT>         * Will create and initialize if null.<a name="line.545"></a>
+<FONT color="green">546</FONT>         * &lt;/p&gt;<a name="line.546"></a>
+<FONT color="green">547</FONT>         *<a name="line.547"></a>
+<FONT color="green">548</FONT>         * @param seed<a name="line.548"></a>
+<FONT color="green">549</FONT>         *            the seed value to use<a name="line.549"></a>
+<FONT color="green">550</FONT>         */<a name="line.550"></a>
+<FONT color="green">551</FONT>        public void reSeed(long seed) {<a name="line.551"></a>
+<FONT color="green">552</FONT>            if (rand == null) {<a name="line.552"></a>
+<FONT color="green">553</FONT>                rand = new JDKRandomGenerator();<a name="line.553"></a>
+<FONT color="green">554</FONT>            }<a name="line.554"></a>
+<FONT color="green">555</FONT>            rand.setSeed(seed);<a name="line.555"></a>
+<FONT color="green">556</FONT>        }<a name="line.556"></a>
+<FONT color="green">557</FONT>    <a name="line.557"></a>
+<FONT color="green">558</FONT>        /**<a name="line.558"></a>
+<FONT color="green">559</FONT>         * Reseeds the secure random number generator with the current time in<a name="line.559"></a>
+<FONT color="green">560</FONT>         * milliseconds.<a name="line.560"></a>
+<FONT color="green">561</FONT>         * &lt;p&gt;<a name="line.561"></a>
+<FONT color="green">562</FONT>         * Will create and initialize if null.<a name="line.562"></a>
+<FONT color="green">563</FONT>         * &lt;/p&gt;<a name="line.563"></a>
+<FONT color="green">564</FONT>         */<a name="line.564"></a>
+<FONT color="green">565</FONT>        public void reSeedSecure() {<a name="line.565"></a>
+<FONT color="green">566</FONT>            if (secRand == null) {<a name="line.566"></a>
+<FONT color="green">567</FONT>                secRand = new SecureRandom();<a name="line.567"></a>
+<FONT color="green">568</FONT>            }<a name="line.568"></a>
+<FONT color="green">569</FONT>            secRand.setSeed(System.currentTimeMillis());<a name="line.569"></a>
+<FONT color="green">570</FONT>        }<a name="line.570"></a>
+<FONT color="green">571</FONT>    <a name="line.571"></a>
+<FONT color="green">572</FONT>        /**<a name="line.572"></a>
+<FONT color="green">573</FONT>         * Reseeds the secure random number generator with the supplied seed.<a name="line.573"></a>
+<FONT color="green">574</FONT>         * &lt;p&gt;<a name="line.574"></a>
+<FONT color="green">575</FONT>         * Will create and initialize if null.<a name="line.575"></a>
+<FONT color="green">576</FONT>         * &lt;/p&gt;<a name="line.576"></a>
+<FONT color="green">577</FONT>         *<a name="line.577"></a>
+<FONT color="green">578</FONT>         * @param seed<a name="line.578"></a>
+<FONT color="green">579</FONT>         *            the seed value to use<a name="line.579"></a>
+<FONT color="green">580</FONT>         */<a name="line.580"></a>
+<FONT color="green">581</FONT>        public void reSeedSecure(long seed) {<a name="line.581"></a>
+<FONT color="green">582</FONT>            if (secRand == null) {<a name="line.582"></a>
+<FONT color="green">583</FONT>                secRand = new SecureRandom();<a name="line.583"></a>
+<FONT color="green">584</FONT>            }<a name="line.584"></a>
+<FONT color="green">585</FONT>            secRand.setSeed(seed);<a name="line.585"></a>
+<FONT color="green">586</FONT>        }<a name="line.586"></a>
+<FONT color="green">587</FONT>    <a name="line.587"></a>
+<FONT color="green">588</FONT>        /**<a name="line.588"></a>
+<FONT color="green">589</FONT>         * Reseeds the random number generator with the current time in<a name="line.589"></a>
+<FONT color="green">590</FONT>         * milliseconds.<a name="line.590"></a>
+<FONT color="green">591</FONT>         */<a name="line.591"></a>
+<FONT color="green">592</FONT>        public void reSeed() {<a name="line.592"></a>
+<FONT color="green">593</FONT>            if (rand == null) {<a name="line.593"></a>
+<FONT color="green">594</FONT>                rand = new JDKRandomGenerator();<a name="line.594"></a>
+<FONT color="green">595</FONT>            }<a name="line.595"></a>
+<FONT color="green">596</FONT>            rand.setSeed(System.currentTimeMillis());<a name="line.596"></a>
+<FONT color="green">597</FONT>        }<a name="line.597"></a>
+<FONT color="green">598</FONT>    <a name="line.598"></a>
+<FONT color="green">599</FONT>        /**<a name="line.599"></a>
+<FONT color="green">600</FONT>         * Sets the PRNG algorithm for the underlying SecureRandom instance using<a name="line.600"></a>
+<FONT color="green">601</FONT>         * the Security Provider API. The Security Provider API is defined in &lt;a<a name="line.601"></a>
+<FONT color="green">602</FONT>         * href =<a name="line.602"></a>
+<FONT color="green">603</FONT>         * "http://java.sun.com/j2se/1.3/docs/guide/security/CryptoSpec.html#AppA"&gt;<a name="line.603"></a>
+<FONT color="green">604</FONT>         * Java Cryptography Architecture API Specification &amp; Reference.&lt;/a&gt;<a name="line.604"></a>
+<FONT color="green">605</FONT>         * &lt;p&gt;<a name="line.605"></a>
+<FONT color="green">606</FONT>         * &lt;strong&gt;USAGE NOTE:&lt;/strong&gt; This method carries &lt;i&gt;significant&lt;/i&gt;<a name="line.606"></a>
+<FONT color="green">607</FONT>         * overhead and may take several seconds to execute.<a name="line.607"></a>
+<FONT color="green">608</FONT>         * &lt;/p&gt;<a name="line.608"></a>
+<FONT color="green">609</FONT>         *<a name="line.609"></a>
+<FONT color="green">610</FONT>         * @param algorithm<a name="line.610"></a>
+<FONT color="green">611</FONT>         *            the name of the PRNG algorithm<a name="line.611"></a>
+<FONT color="green">612</FONT>         * @param provider<a name="line.612"></a>
+<FONT color="green">613</FONT>         *            the name of the provider<a name="line.613"></a>
+<FONT color="green">614</FONT>         * @throws NoSuchAlgorithmException<a name="line.614"></a>
+<FONT color="green">615</FONT>         *             if the specified algorithm is not available<a name="line.615"></a>
+<FONT color="green">616</FONT>         * @throws NoSuchProviderException<a name="line.616"></a>
+<FONT color="green">617</FONT>         *             if the specified provider is not installed<a name="line.617"></a>
+<FONT color="green">618</FONT>         */<a name="line.618"></a>
+<FONT color="green">619</FONT>        public void setSecureAlgorithm(String algorithm, String provider)<a name="line.619"></a>
+<FONT color="green">620</FONT>                throws NoSuchAlgorithmException, NoSuchProviderException {<a name="line.620"></a>
+<FONT color="green">621</FONT>            secRand = SecureRandom.getInstance(algorithm, provider);<a name="line.621"></a>
+<FONT color="green">622</FONT>        }<a name="line.622"></a>
+<FONT color="green">623</FONT>    <a name="line.623"></a>
+<FONT color="green">624</FONT>        /**<a name="line.624"></a>
+<FONT color="green">625</FONT>         * Generates an integer array of length &lt;code&gt;k&lt;/code&gt; whose entries are<a name="line.625"></a>
+<FONT color="green">626</FONT>         * selected randomly, without repetition, from the integers<a name="line.626"></a>
+<FONT color="green">627</FONT>         * &lt;code&gt;0 through n-1&lt;/code&gt; (inclusive).<a name="line.627"></a>
+<FONT color="green">628</FONT>         * &lt;p&gt;<a name="line.628"></a>
+<FONT color="green">629</FONT>         * Generated arrays represent permutations of &lt;code&gt;n&lt;/code&gt; taken<a name="line.629"></a>
+<FONT color="green">630</FONT>         * &lt;code&gt;k&lt;/code&gt; at a time.<a name="line.630"></a>
+<FONT color="green">631</FONT>         * &lt;/p&gt;<a name="line.631"></a>
+<FONT color="green">632</FONT>         * &lt;p&gt;<a name="line.632"></a>
+<FONT color="green">633</FONT>         * &lt;strong&gt;Preconditions:&lt;/strong&gt;<a name="line.633"></a>
+<FONT color="green">634</FONT>         * &lt;ul&gt;<a name="line.634"></a>
+<FONT color="green">635</FONT>         * &lt;li&gt; &lt;code&gt;k &lt;= n&lt;/code&gt;&lt;/li&gt;<a name="line.635"></a>
+<FONT color="green">636</FONT>         * &lt;li&gt; &lt;code&gt;n &gt; 0&lt;/code&gt;&lt;/li&gt;<a name="line.636"></a>
+<FONT color="green">637</FONT>         * &lt;/ul&gt;<a name="line.637"></a>
+<FONT color="green">638</FONT>         * If the preconditions are not met, an IllegalArgumentException is thrown.<a name="line.638"></a>
+<FONT color="green">639</FONT>         * &lt;/p&gt;<a name="line.639"></a>
+<FONT color="green">640</FONT>         * &lt;p&gt;<a name="line.640"></a>
+<FONT color="green">641</FONT>         * Uses a 2-cycle permutation shuffle. The shuffling process is described &lt;a<a name="line.641"></a>
+<FONT color="green">642</FONT>         * href="http://www.maths.abdn.ac.uk/~igc/tch/mx4002/notes/node83.html"&gt;<a name="line.642"></a>
+<FONT color="green">643</FONT>         * here&lt;/a&gt;.<a name="line.643"></a>
+<FONT color="green">644</FONT>         * &lt;/p&gt;<a name="line.644"></a>
+<FONT color="green">645</FONT>         *<a name="line.645"></a>
+<FONT color="green">646</FONT>         * @param n<a name="line.646"></a>
+<FONT color="green">647</FONT>         *            domain of the permutation (must be positive)<a name="line.647"></a>
+<FONT color="green">648</FONT>         * @param k<a name="line.648"></a>
+<FONT color="green">649</FONT>         *            size of the permutation (must satisfy 0 &lt; k &lt;= n).<a name="line.649"></a>
+<FONT color="green">650</FONT>         * @return the random permutation as an int array<a name="line.650"></a>
+<FONT color="green">651</FONT>         */<a name="line.651"></a>
+<FONT color="green">652</FONT>        public int[] nextPermutation(int n, int k) {<a name="line.652"></a>
+<FONT color="green">653</FONT>            if (k &gt; n) {<a name="line.653"></a>
+<FONT color="green">654</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.654"></a>
+<FONT color="green">655</FONT>                      "permutation k ({0}) exceeds n ({1})", k, n);<a name="line.655"></a>
+<FONT color="green">656</FONT>            }<a name="line.656"></a>
+<FONT color="green">657</FONT>            if (k == 0) {<a name="line.657"></a>
+<FONT color="green">658</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.658"></a>
+<FONT color="green">659</FONT>                      "permutation k ({0}) must be positive", k);<a name="line.659"></a>
+<FONT color="green">660</FONT>            }<a name="line.660"></a>
+<FONT color="green">661</FONT>    <a name="line.661"></a>
+<FONT color="green">662</FONT>            int[] index = getNatural(n);<a name="line.662"></a>
+<FONT color="green">663</FONT>            shuffle(index, n - k);<a name="line.663"></a>
+<FONT color="green">664</FONT>            int[] result = new int[k];<a name="line.664"></a>
+<FONT color="green">665</FONT>            for (int i = 0; i &lt; k; i++) {<a name="line.665"></a>
+<FONT color="green">666</FONT>                result[i] = index[n - i - 1];<a name="line.666"></a>
+<FONT color="green">667</FONT>            }<a name="line.667"></a>
+<FONT color="green">668</FONT>    <a name="line.668"></a>
+<FONT color="green">669</FONT>            return result;<a name="line.669"></a>
+<FONT color="green">670</FONT>        }<a name="line.670"></a>
+<FONT color="green">671</FONT>    <a name="line.671"></a>
+<FONT color="green">672</FONT>        /**<a name="line.672"></a>
+<FONT color="green">673</FONT>         * Uses a 2-cycle permutation shuffle to generate a random permutation.<a name="line.673"></a>
+<FONT color="green">674</FONT>         * &lt;strong&gt;Algorithm Description&lt;/strong&gt;: Uses a 2-cycle permutation<a name="line.674"></a>
+<FONT color="green">675</FONT>         * shuffle to generate a random permutation of &lt;code&gt;c.size()&lt;/code&gt; and<a name="line.675"></a>
+<FONT color="green">676</FONT>         * then returns the elements whose indexes correspond to the elements of the<a name="line.676"></a>
+<FONT color="green">677</FONT>         * generated permutation. This technique is described, and proven to<a name="line.677"></a>
+<FONT color="green">678</FONT>         * generate random samples, &lt;a<a name="line.678"></a>
+<FONT color="green">679</FONT>         * href="http://www.maths.abdn.ac.uk/~igc/tch/mx4002/notes/node83.html"&gt;<a name="line.679"></a>
+<FONT color="green">680</FONT>         * here&lt;/a&gt;<a name="line.680"></a>
+<FONT color="green">681</FONT>         *<a name="line.681"></a>
+<FONT color="green">682</FONT>         * @param c<a name="line.682"></a>
+<FONT color="green">683</FONT>         *            Collection to sample from.<a name="line.683"></a>
+<FONT color="green">684</FONT>         * @param k<a name="line.684"></a>
+<FONT color="green">685</FONT>         *            sample size.<a name="line.685"></a>
+<FONT color="green">686</FONT>         * @return the random sample.<a name="line.686"></a>
+<FONT color="green">687</FONT>         */<a name="line.687"></a>
+<FONT color="green">688</FONT>        public Object[] nextSample(Collection&lt;?&gt; c, int k) {<a name="line.688"></a>
+<FONT color="green">689</FONT>            int len = c.size();<a name="line.689"></a>
+<FONT color="green">690</FONT>            if (k &gt; len) {<a name="line.690"></a>
+<FONT color="green">691</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.691"></a>
+<FONT color="green">692</FONT>                      "sample size ({0}) exceeds collection size ({1})");<a name="line.692"></a>
+<FONT color="green">693</FONT>            }<a name="line.693"></a>
+<FONT color="green">694</FONT>            if (k &lt;= 0) {<a name="line.694"></a>
+<FONT color="green">695</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.695"></a>
+<FONT color="green">696</FONT>                      "sample size must be positive ({0})", k);<a name="line.696"></a>
+<FONT color="green">697</FONT>            }<a name="line.697"></a>
+<FONT color="green">698</FONT>    <a name="line.698"></a>
+<FONT color="green">699</FONT>            Object[] objects = c.toArray();<a name="line.699"></a>
+<FONT color="green">700</FONT>            int[] index = nextPermutation(len, k);<a name="line.700"></a>
+<FONT color="green">701</FONT>            Object[] result = new Object[k];<a name="line.701"></a>
+<FONT color="green">702</FONT>            for (int i = 0; i &lt; k; i++) {<a name="line.702"></a>
+<FONT color="green">703</FONT>                result[i] = objects[index[i]];<a name="line.703"></a>
+<FONT color="green">704</FONT>            }<a name="line.704"></a>
+<FONT color="green">705</FONT>            return result;<a name="line.705"></a>
+<FONT color="green">706</FONT>        }<a name="line.706"></a>
+<FONT color="green">707</FONT>    <a name="line.707"></a>
+<FONT color="green">708</FONT>        // ------------------------Private methods----------------------------------<a name="line.708"></a>
+<FONT color="green">709</FONT>    <a name="line.709"></a>
+<FONT color="green">710</FONT>        /**<a name="line.710"></a>
+<FONT color="green">711</FONT>         * Uses a 2-cycle permutation shuffle to randomly re-order the last elements<a name="line.711"></a>
+<FONT color="green">712</FONT>         * of list.<a name="line.712"></a>
+<FONT color="green">713</FONT>         *<a name="line.713"></a>
+<FONT color="green">714</FONT>         * @param list<a name="line.714"></a>
+<FONT color="green">715</FONT>         *            list to be shuffled<a name="line.715"></a>
+<FONT color="green">716</FONT>         * @param end<a name="line.716"></a>
+<FONT color="green">717</FONT>         *            element past which shuffling begins<a name="line.717"></a>
+<FONT color="green">718</FONT>         */<a name="line.718"></a>
+<FONT color="green">719</FONT>        private void shuffle(int[] list, int end) {<a name="line.719"></a>
+<FONT color="green">720</FONT>            int target = 0;<a name="line.720"></a>
+<FONT color="green">721</FONT>            for (int i = list.length - 1; i &gt;= end; i--) {<a name="line.721"></a>
+<FONT color="green">722</FONT>                if (i == 0) {<a name="line.722"></a>
+<FONT color="green">723</FONT>                    target = 0;<a name="line.723"></a>
+<FONT color="green">724</FONT>                } else {<a name="line.724"></a>
+<FONT color="green">725</FONT>                    target = nextInt(0, i);<a name="line.725"></a>
+<FONT color="green">726</FONT>                }<a name="line.726"></a>
+<FONT color="green">727</FONT>                int temp = list[target];<a name="line.727"></a>
+<FONT color="green">728</FONT>                list[target] = list[i];<a name="line.728"></a>
+<FONT color="green">729</FONT>                list[i] = temp;<a name="line.729"></a>
+<FONT color="green">730</FONT>            }<a name="line.730"></a>
+<FONT color="green">731</FONT>        }<a name="line.731"></a>
+<FONT color="green">732</FONT>    <a name="line.732"></a>
+<FONT color="green">733</FONT>        /**<a name="line.733"></a>
+<FONT color="green">734</FONT>         * Returns an array representing n.<a name="line.734"></a>
+<FONT color="green">735</FONT>         *<a name="line.735"></a>
+<FONT color="green">736</FONT>         * @param n<a name="line.736"></a>
+<FONT color="green">737</FONT>         *            the natural number to represent<a name="line.737"></a>
+<FONT color="green">738</FONT>         * @return array with entries = elements of n<a name="line.738"></a>
+<FONT color="green">739</FONT>         */<a name="line.739"></a>
+<FONT color="green">740</FONT>        private int[] getNatural(int n) {<a name="line.740"></a>
+<FONT color="green">741</FONT>            int[] natural = new int[n];<a name="line.741"></a>
+<FONT color="green">742</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.742"></a>
+<FONT color="green">743</FONT>                natural[i] = i;<a name="line.743"></a>
+<FONT color="green">744</FONT>            }<a name="line.744"></a>
+<FONT color="green">745</FONT>            return natural;<a name="line.745"></a>
+<FONT color="green">746</FONT>        }<a name="line.746"></a>
+<FONT color="green">747</FONT>    <a name="line.747"></a>
+<FONT color="green">748</FONT>    }<a name="line.748"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/RandomGenerator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,214 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.random;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Interface extracted from &lt;code&gt;java.util.Random&lt;/code&gt;.  This interface is<a name="line.21"></a>
+<FONT color="green">022</FONT>     * implemented by {@link AbstractRandomGenerator}.<a name="line.22"></a>
+<FONT color="green">023</FONT>     *<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @since 1.1<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public interface RandomGenerator {<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>        /**<a name="line.29"></a>
+<FONT color="green">030</FONT>         * Sets the seed of the underyling random number generator using an<a name="line.30"></a>
+<FONT color="green">031</FONT>         * &lt;code&gt;int&lt;/code&gt; seed.<a name="line.31"></a>
+<FONT color="green">032</FONT>         * &lt;p&gt;Sequences of values generated starting with the same seeds<a name="line.32"></a>
+<FONT color="green">033</FONT>         * should be identical.<a name="line.33"></a>
+<FONT color="green">034</FONT>         * &lt;/p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @param seed the seed value<a name="line.35"></a>
+<FONT color="green">036</FONT>         */<a name="line.36"></a>
+<FONT color="green">037</FONT>        void setSeed(int seed);<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /**<a name="line.39"></a>
+<FONT color="green">040</FONT>         * Sets the seed of the underyling random number generator using an<a name="line.40"></a>
+<FONT color="green">041</FONT>         * &lt;code&gt;int&lt;/code&gt; array seed.<a name="line.41"></a>
+<FONT color="green">042</FONT>         * &lt;p&gt;Sequences of values generated starting with the same seeds<a name="line.42"></a>
+<FONT color="green">043</FONT>         * should be identical.<a name="line.43"></a>
+<FONT color="green">044</FONT>         * &lt;/p&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @param seed the seed value<a name="line.45"></a>
+<FONT color="green">046</FONT>         */<a name="line.46"></a>
+<FONT color="green">047</FONT>        void setSeed(int[] seed);<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /**<a name="line.49"></a>
+<FONT color="green">050</FONT>         * Sets the seed of the underyling random number generator using a<a name="line.50"></a>
+<FONT color="green">051</FONT>         * &lt;code&gt;long&lt;/code&gt; seed.<a name="line.51"></a>
+<FONT color="green">052</FONT>         * &lt;p&gt;Sequences of values generated starting with the same seeds<a name="line.52"></a>
+<FONT color="green">053</FONT>         * should be identical.<a name="line.53"></a>
+<FONT color="green">054</FONT>         * &lt;/p&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param seed the seed value<a name="line.55"></a>
+<FONT color="green">056</FONT>         */<a name="line.56"></a>
+<FONT color="green">057</FONT>        void setSeed(long seed);<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /**<a name="line.59"></a>
+<FONT color="green">060</FONT>         * Generates random bytes and places them into a user-supplied<a name="line.60"></a>
+<FONT color="green">061</FONT>         * byte array.  The number of random bytes produced is equal to<a name="line.61"></a>
+<FONT color="green">062</FONT>         * the length of the byte array.<a name="line.62"></a>
+<FONT color="green">063</FONT>         *<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @param bytes the non-null byte array in which to put the<a name="line.64"></a>
+<FONT color="green">065</FONT>         * random bytes<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        void nextBytes(byte[] bytes);<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * Returns the next pseudorandom, uniformly distributed &lt;code&gt;int&lt;/code&gt;<a name="line.70"></a>
+<FONT color="green">071</FONT>         * value from this random number generator's sequence.<a name="line.71"></a>
+<FONT color="green">072</FONT>         * All 2&lt;font size="-1"&gt;&lt;sup&gt;32&lt;/sup&gt;&lt;/font&gt; possible &lt;tt&gt;int&lt;/tt&gt; values<a name="line.72"></a>
+<FONT color="green">073</FONT>         * should be produced with  (approximately) equal probability.<a name="line.73"></a>
+<FONT color="green">074</FONT>         *<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @return the next pseudorandom, uniformly distributed &lt;code&gt;int&lt;/code&gt;<a name="line.75"></a>
+<FONT color="green">076</FONT>         *  value from this random number generator's sequence<a name="line.76"></a>
+<FONT color="green">077</FONT>         */<a name="line.77"></a>
+<FONT color="green">078</FONT>        int nextInt();<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /**<a name="line.80"></a>
+<FONT color="green">081</FONT>         * Returns a pseudorandom, uniformly distributed &lt;tt&gt;int&lt;/tt&gt; value<a name="line.81"></a>
+<FONT color="green">082</FONT>         * between 0 (inclusive) and the specified value (exclusive), drawn from<a name="line.82"></a>
+<FONT color="green">083</FONT>         * this random number generator's sequence.<a name="line.83"></a>
+<FONT color="green">084</FONT>         *<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @param n the bound on the random number to be returned.  Must be<a name="line.85"></a>
+<FONT color="green">086</FONT>         * positive.<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @return  a pseudorandom, uniformly distributed &lt;tt&gt;int&lt;/tt&gt;<a name="line.87"></a>
+<FONT color="green">088</FONT>         * value between 0 (inclusive) and n (exclusive).<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @throws IllegalArgumentException  if n is not positive.<a name="line.89"></a>
+<FONT color="green">090</FONT>         */<a name="line.90"></a>
+<FONT color="green">091</FONT>        int nextInt(int n);<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /**<a name="line.93"></a>
+<FONT color="green">094</FONT>         * Returns the next pseudorandom, uniformly distributed &lt;code&gt;long&lt;/code&gt;<a name="line.94"></a>
+<FONT color="green">095</FONT>         * value from this random number generator's sequence.  All<a name="line.95"></a>
+<FONT color="green">096</FONT>         * 2&lt;font size="-1"&gt;&lt;sup&gt;64&lt;/sup&gt;&lt;/font&gt; possible &lt;tt&gt;long&lt;/tt&gt; values<a name="line.96"></a>
+<FONT color="green">097</FONT>         * should be produced with (approximately) equal probability.<a name="line.97"></a>
+<FONT color="green">098</FONT>         *<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @return  the next pseudorandom, uniformly distributed &lt;code&gt;long&lt;/code&gt;<a name="line.99"></a>
+<FONT color="green">100</FONT>         *value from this random number generator's sequence<a name="line.100"></a>
+<FONT color="green">101</FONT>         */<a name="line.101"></a>
+<FONT color="green">102</FONT>        long nextLong();<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /**<a name="line.104"></a>
+<FONT color="green">105</FONT>         * Returns the next pseudorandom, uniformly distributed<a name="line.105"></a>
+<FONT color="green">106</FONT>         * &lt;code&gt;boolean&lt;/code&gt; value from this random number generator's<a name="line.106"></a>
+<FONT color="green">107</FONT>         * sequence.<a name="line.107"></a>
+<FONT color="green">108</FONT>         *<a name="line.108"></a>
+<FONT color="green">109</FONT>         * @return  the next pseudorandom, uniformly distributed<a name="line.109"></a>
+<FONT color="green">110</FONT>         * &lt;code&gt;boolean&lt;/code&gt; value from this random number generator's<a name="line.110"></a>
+<FONT color="green">111</FONT>         * sequence<a name="line.111"></a>
+<FONT color="green">112</FONT>         */<a name="line.112"></a>
+<FONT color="green">113</FONT>        boolean nextBoolean();<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>        /**<a name="line.115"></a>
+<FONT color="green">116</FONT>         * Returns the next pseudorandom, uniformly distributed &lt;code&gt;float&lt;/code&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * value between &lt;code&gt;0.0&lt;/code&gt; and &lt;code&gt;1.0&lt;/code&gt; from this random<a name="line.117"></a>
+<FONT color="green">118</FONT>         * number generator's sequence.<a name="line.118"></a>
+<FONT color="green">119</FONT>         *<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @return  the next pseudorandom, uniformly distributed &lt;code&gt;float&lt;/code&gt;<a name="line.120"></a>
+<FONT color="green">121</FONT>         * value between &lt;code&gt;0.0&lt;/code&gt; and &lt;code&gt;1.0&lt;/code&gt; from this<a name="line.121"></a>
+<FONT color="green">122</FONT>         * random number generator's sequence<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        float nextFloat();<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>        /**<a name="line.126"></a>
+<FONT color="green">127</FONT>         * Returns the next pseudorandom, uniformly distributed<a name="line.127"></a>
+<FONT color="green">128</FONT>         * &lt;code&gt;double&lt;/code&gt; value between &lt;code&gt;0.0&lt;/code&gt; and<a name="line.128"></a>
+<FONT color="green">129</FONT>         * &lt;code&gt;1.0&lt;/code&gt; from this random number generator's sequence.<a name="line.129"></a>
+<FONT color="green">130</FONT>         *<a name="line.130"></a>
+<FONT color="green">131</FONT>         * @return  the next pseudorandom, uniformly distributed<a name="line.131"></a>
+<FONT color="green">132</FONT>         *  &lt;code&gt;double&lt;/code&gt; value between &lt;code&gt;0.0&lt;/code&gt; and<a name="line.132"></a>
+<FONT color="green">133</FONT>         *  &lt;code&gt;1.0&lt;/code&gt; from this random number generator's sequence<a name="line.133"></a>
+<FONT color="green">134</FONT>         */<a name="line.134"></a>
+<FONT color="green">135</FONT>        double nextDouble();<a name="line.135"></a>
+<FONT color="green">136</FONT>    <a name="line.136"></a>
+<FONT color="green">137</FONT>        /**<a name="line.137"></a>
+<FONT color="green">138</FONT>         * Returns the next pseudorandom, Gaussian ("normally") distributed<a name="line.138"></a>
+<FONT color="green">139</FONT>         * &lt;code&gt;double&lt;/code&gt; value with mean &lt;code&gt;0.0&lt;/code&gt; and standard<a name="line.139"></a>
+<FONT color="green">140</FONT>         * deviation &lt;code&gt;1.0&lt;/code&gt; from this random number generator's sequence.<a name="line.140"></a>
+<FONT color="green">141</FONT>         *<a name="line.141"></a>
+<FONT color="green">142</FONT>         * @return  the next pseudorandom, Gaussian ("normally") distributed<a name="line.142"></a>
+<FONT color="green">143</FONT>         * &lt;code&gt;double&lt;/code&gt; value with mean &lt;code&gt;0.0&lt;/code&gt; and<a name="line.143"></a>
+<FONT color="green">144</FONT>         * standard deviation &lt;code&gt;1.0&lt;/code&gt; from this random number<a name="line.144"></a>
+<FONT color="green">145</FONT>         *  generator's sequence<a name="line.145"></a>
+<FONT color="green">146</FONT>         */<a name="line.146"></a>
+<FONT color="green">147</FONT>        double nextGaussian();<a name="line.147"></a>
+<FONT color="green">148</FONT>    }<a name="line.148"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/RandomVectorGenerator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,101 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.random;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /** This interface represents a random generator for whole vectors.<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @since 1.2<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    public interface RandomVectorGenerator {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /** Generate a random vector.<a name="line.30"></a>
+<FONT color="green">031</FONT>         * @return a random vector as an array of double.<a name="line.31"></a>
+<FONT color="green">032</FONT>         */<a name="line.32"></a>
+<FONT color="green">033</FONT>        double[] nextVector();<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>    }<a name="line.35"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/UncorrelatedRandomVectorGenerator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,161 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.random;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * A {@link RandomVectorGenerator} that generates vectors with uncorrelated<a name="line.25"></a>
+<FONT color="green">026</FONT>     * components. Components of generated vectors follow (independent) Gaussian<a name="line.26"></a>
+<FONT color="green">027</FONT>     * distributions, with parameters supplied in the constructor.<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @since 1.2<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>    public class UncorrelatedRandomVectorGenerator<a name="line.33"></a>
+<FONT color="green">034</FONT>      implements RandomVectorGenerator {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Underlying scalar generator. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private final NormalizedRandomGenerator generator;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Mean vector. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private final double[] mean;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Standard deviation vector. */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private final double[] standardDeviation;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>      /** Simple constructor.<a name="line.45"></a>
+<FONT color="green">046</FONT>       * &lt;p&gt;Build an uncorrelated random vector generator from<a name="line.46"></a>
+<FONT color="green">047</FONT>       * its mean and standard deviation vectors.&lt;/p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>       * @param mean expected mean values for each component<a name="line.48"></a>
+<FONT color="green">049</FONT>       * @param standardDeviation standard deviation for each component<a name="line.49"></a>
+<FONT color="green">050</FONT>       * @param generator underlying generator for uncorrelated normalized<a name="line.50"></a>
+<FONT color="green">051</FONT>       * components<a name="line.51"></a>
+<FONT color="green">052</FONT>       */<a name="line.52"></a>
+<FONT color="green">053</FONT>      public UncorrelatedRandomVectorGenerator(double[] mean,<a name="line.53"></a>
+<FONT color="green">054</FONT>                                               double[] standardDeviation,<a name="line.54"></a>
+<FONT color="green">055</FONT>                                               NormalizedRandomGenerator generator) {<a name="line.55"></a>
+<FONT color="green">056</FONT>        if (mean.length != standardDeviation.length) {<a name="line.56"></a>
+<FONT color="green">057</FONT>          throw MathRuntimeException.createIllegalArgumentException(<a name="line.57"></a>
+<FONT color="green">058</FONT>                "dimension mismatch {0} != {1}",<a name="line.58"></a>
+<FONT color="green">059</FONT>                mean.length, standardDeviation.length);<a name="line.59"></a>
+<FONT color="green">060</FONT>        }<a name="line.60"></a>
+<FONT color="green">061</FONT>        this.mean              = mean.clone();<a name="line.61"></a>
+<FONT color="green">062</FONT>        this.standardDeviation = standardDeviation.clone();<a name="line.62"></a>
+<FONT color="green">063</FONT>        this.generator = generator;<a name="line.63"></a>
+<FONT color="green">064</FONT>      }<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>      /** Simple constructor.<a name="line.66"></a>
+<FONT color="green">067</FONT>       * &lt;p&gt;Build a null mean random and unit standard deviation<a name="line.67"></a>
+<FONT color="green">068</FONT>       * uncorrelated vector generator&lt;/p&gt;<a name="line.68"></a>
+<FONT color="green">069</FONT>       * @param dimension dimension of the vectors to generate<a name="line.69"></a>
+<FONT color="green">070</FONT>       * @param generator underlying generator for uncorrelated normalized<a name="line.70"></a>
+<FONT color="green">071</FONT>       * components<a name="line.71"></a>
+<FONT color="green">072</FONT>       */<a name="line.72"></a>
+<FONT color="green">073</FONT>      public UncorrelatedRandomVectorGenerator(int dimension,<a name="line.73"></a>
+<FONT color="green">074</FONT>                                               NormalizedRandomGenerator generator) {<a name="line.74"></a>
+<FONT color="green">075</FONT>        mean              = new double[dimension];<a name="line.75"></a>
+<FONT color="green">076</FONT>        standardDeviation = new double[dimension];<a name="line.76"></a>
+<FONT color="green">077</FONT>        Arrays.fill(standardDeviation, 1.0);<a name="line.77"></a>
+<FONT color="green">078</FONT>        this.generator = generator;<a name="line.78"></a>
+<FONT color="green">079</FONT>      }<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>      /** Generate an uncorrelated random vector.<a name="line.81"></a>
+<FONT color="green">082</FONT>       * @return a random vector as a newly built array of double<a name="line.82"></a>
+<FONT color="green">083</FONT>       */<a name="line.83"></a>
+<FONT color="green">084</FONT>      public double[] nextVector() {<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        double[] random = new double[mean.length];<a name="line.86"></a>
+<FONT color="green">087</FONT>        for (int i = 0; i &lt; random.length; ++i) {<a name="line.87"></a>
+<FONT color="green">088</FONT>          random[i] = mean[i] + standardDeviation[i] * generator.nextNormalizedDouble();<a name="line.88"></a>
+<FONT color="green">089</FONT>        }<a name="line.89"></a>
+<FONT color="green">090</FONT>    <a name="line.90"></a>
+<FONT color="green">091</FONT>        return random;<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>      }<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>    }<a name="line.95"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/UniformRandomGenerator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,125 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.random;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * This class implements a normalized uniform random generator.<a name="line.21"></a>
+<FONT color="green">022</FONT>     * &lt;p&gt;Since it is a normalized random generator, it generates values<a name="line.22"></a>
+<FONT color="green">023</FONT>     * from a uniform distribution with mean equal to 0 and standard<a name="line.23"></a>
+<FONT color="green">024</FONT>     * deviation equal to 1. Generated values fall in the range<a name="line.24"></a>
+<FONT color="green">025</FONT>     * [-&amp;#x0221A;3, +&amp;#x0221A;3].&lt;/p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @since 1.2<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.29"></a>
+<FONT color="green">030</FONT>     */<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>    public class UniformRandomGenerator implements NormalizedRandomGenerator {<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /** Serializable version identifier. */<a name="line.34"></a>
+<FONT color="green">035</FONT>        private static final long serialVersionUID = 1569292426375546027L;<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /** Square root of three. */<a name="line.37"></a>
+<FONT color="green">038</FONT>        private static final double SQRT3 = Math.sqrt(3.0);<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Underlying generator. */<a name="line.40"></a>
+<FONT color="green">041</FONT>        private final RandomGenerator generator;<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** Create a new generator.<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @param generator underlying random generator to use<a name="line.44"></a>
+<FONT color="green">045</FONT>         */<a name="line.45"></a>
+<FONT color="green">046</FONT>        public UniformRandomGenerator(RandomGenerator generator) {<a name="line.46"></a>
+<FONT color="green">047</FONT>            this.generator = generator;<a name="line.47"></a>
+<FONT color="green">048</FONT>        }<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Generate a random scalar with null mean and unit standard deviation.<a name="line.50"></a>
+<FONT color="green">051</FONT>         * &lt;p&gt;The number generated is uniformly distributed between -&amp;sqrt;(3)<a name="line.51"></a>
+<FONT color="green">052</FONT>         * and +&amp;sqrt;(3).&lt;/p&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>         * @return a random scalar with null mean and unit standard deviation<a name="line.53"></a>
+<FONT color="green">054</FONT>         */<a name="line.54"></a>
+<FONT color="green">055</FONT>        public double nextNormalizedDouble() {<a name="line.55"></a>
+<FONT color="green">056</FONT>            return SQRT3 * (2 * generator.nextDouble() - 1.0);<a name="line.56"></a>
+<FONT color="green">057</FONT>        }<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>    }<a name="line.59"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/UnitSphereRandomVectorGenerator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,148 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.random;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Generate random vectors isotropically located on the surface of a sphere.<a name="line.22"></a>
+<FONT color="green">023</FONT>     *<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @since 2.1<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    public class UnitSphereRandomVectorGenerator<a name="line.28"></a>
+<FONT color="green">029</FONT>        implements RandomVectorGenerator {<a name="line.29"></a>
+<FONT color="green">030</FONT>        /**<a name="line.30"></a>
+<FONT color="green">031</FONT>         * RNG used for generating the individual components of the vectors.<a name="line.31"></a>
+<FONT color="green">032</FONT>         */<a name="line.32"></a>
+<FONT color="green">033</FONT>        private final RandomGenerator rand;<a name="line.33"></a>
+<FONT color="green">034</FONT>        /**<a name="line.34"></a>
+<FONT color="green">035</FONT>         * Space dimension.<a name="line.35"></a>
+<FONT color="green">036</FONT>         */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private final int dimension;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /**<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @param dimension Space dimension.<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @param rand RNG for the individual components of the vectors.<a name="line.41"></a>
+<FONT color="green">042</FONT>         */<a name="line.42"></a>
+<FONT color="green">043</FONT>        public UnitSphereRandomVectorGenerator(final int dimension,<a name="line.43"></a>
+<FONT color="green">044</FONT>                                               final RandomGenerator rand) {<a name="line.44"></a>
+<FONT color="green">045</FONT>            this.dimension = dimension;<a name="line.45"></a>
+<FONT color="green">046</FONT>            this.rand = rand;<a name="line.46"></a>
+<FONT color="green">047</FONT>        }<a name="line.47"></a>
+<FONT color="green">048</FONT>        /**<a name="line.48"></a>
+<FONT color="green">049</FONT>         * Create an object that will use a default RNG ({@link MersenneTwister}),<a name="line.49"></a>
+<FONT color="green">050</FONT>         * in order to generate the individual components.<a name="line.50"></a>
+<FONT color="green">051</FONT>         *<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @param dimension Space dimension.<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        public UnitSphereRandomVectorGenerator(final int dimension) {<a name="line.54"></a>
+<FONT color="green">055</FONT>            this(dimension, new MersenneTwister());<a name="line.55"></a>
+<FONT color="green">056</FONT>        }<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /** {@inheritDoc} */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public double[] nextVector() {<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>            final double[] v = new double[dimension];<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>            double normSq;<a name="line.63"></a>
+<FONT color="green">064</FONT>            do {<a name="line.64"></a>
+<FONT color="green">065</FONT>                normSq = 0;<a name="line.65"></a>
+<FONT color="green">066</FONT>                for (int i = 0; i &lt; dimension; i++) {<a name="line.66"></a>
+<FONT color="green">067</FONT>                    final double comp = 2 * rand.nextDouble() - 1;<a name="line.67"></a>
+<FONT color="green">068</FONT>                    v[i] = comp;<a name="line.68"></a>
+<FONT color="green">069</FONT>                    normSq += comp * comp;<a name="line.69"></a>
+<FONT color="green">070</FONT>                }<a name="line.70"></a>
+<FONT color="green">071</FONT>            } while (normSq &gt; 1);<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>            final double f = 1 / Math.sqrt(normSq);<a name="line.73"></a>
+<FONT color="green">074</FONT>            for (int i = 0; i &lt; dimension; i++) {<a name="line.74"></a>
+<FONT color="green">075</FONT>                v[i] *= f;<a name="line.75"></a>
+<FONT color="green">076</FONT>            }<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>            return v;<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        }<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>    }<a name="line.82"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/random/ValueServer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,450 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.random;<a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.BufferedReader;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.IOException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.io.InputStreamReader;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.net.MalformedURLException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.net.URL;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    /**<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Generates values for use in simulation applications.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * How values are generated is determined by the &lt;code&gt;mode&lt;/code&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * property.&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * Supported &lt;code&gt;mode&lt;/code&gt; values are: &lt;ul&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;li&gt; DIGEST_MODE -- uses an empirical distribution &lt;/li&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;li&gt; REPLAY_MODE -- replays data from &lt;code&gt;valuesFileURL&lt;/code&gt;&lt;/li&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;li&gt; UNIFORM_MODE -- generates uniformly distributed random values with<a name="line.36"></a>
+<FONT color="green">037</FONT>     *                      mean = &lt;code&gt;mu&lt;/code&gt; &lt;/li&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * &lt;li&gt; EXPONENTIAL_MODE -- generates exponentially distributed random values<a name="line.38"></a>
+<FONT color="green">039</FONT>     *                         with mean = &lt;code&gt;mu&lt;/code&gt;&lt;/li&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;li&gt; GAUSSIAN_MODE -- generates Gaussian distributed random values with<a name="line.40"></a>
+<FONT color="green">041</FONT>     *                       mean = &lt;code&gt;mu&lt;/code&gt; and<a name="line.41"></a>
+<FONT color="green">042</FONT>     *                       standard deviation = &lt;code&gt;sigma&lt;/code&gt;&lt;/li&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     * &lt;li&gt; CONSTANT_MODE -- returns &lt;code&gt;mu&lt;/code&gt; every time.&lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     *<a name="line.44"></a>
+<FONT color="green">045</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.45"></a>
+<FONT color="green">046</FONT>     *<a name="line.46"></a>
+<FONT color="green">047</FONT>     */<a name="line.47"></a>
+<FONT color="green">048</FONT>    public class ValueServer {<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Use empirical distribution.  */<a name="line.50"></a>
+<FONT color="green">051</FONT>        public static final int DIGEST_MODE = 0;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** Replay data from valuesFilePath. */<a name="line.53"></a>
+<FONT color="green">054</FONT>        public static final int REPLAY_MODE = 1;<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** Uniform random deviates with mean = &amp;mu;. */<a name="line.56"></a>
+<FONT color="green">057</FONT>        public static final int UNIFORM_MODE = 2;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** Exponential random deviates with mean = &amp;mu;. */<a name="line.59"></a>
+<FONT color="green">060</FONT>        public static final int EXPONENTIAL_MODE = 3;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** Gaussian random deviates with mean = &amp;mu;, std dev = &amp;sigma;. */<a name="line.62"></a>
+<FONT color="green">063</FONT>        public static final int GAUSSIAN_MODE = 4;<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Always return mu */<a name="line.65"></a>
+<FONT color="green">066</FONT>        public static final int CONSTANT_MODE = 5;<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /** mode determines how values are generated. */<a name="line.68"></a>
+<FONT color="green">069</FONT>        private int mode = 5;<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** URI to raw data values. */<a name="line.71"></a>
+<FONT color="green">072</FONT>        private URL valuesFileURL = null;<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /** Mean for use with non-data-driven modes. */<a name="line.74"></a>
+<FONT color="green">075</FONT>        private double mu = 0.0;<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** Standard deviation for use with GAUSSIAN_MODE. */<a name="line.77"></a>
+<FONT color="green">078</FONT>        private double sigma = 0.0;<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /** Empirical probability distribution for use with DIGEST_MODE. */<a name="line.80"></a>
+<FONT color="green">081</FONT>        private EmpiricalDistribution empiricalDistribution = null;<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /** File pointer for REPLAY_MODE. */<a name="line.83"></a>
+<FONT color="green">084</FONT>        private BufferedReader filePointer = null;<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /** RandomDataImpl to use for random data generation. */<a name="line.86"></a>
+<FONT color="green">087</FONT>        private RandomData randomData = new RandomDataImpl();<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        // Data generation modes ======================================<a name="line.89"></a>
+<FONT color="green">090</FONT>    <a name="line.90"></a>
+<FONT color="green">091</FONT>        /** Creates new ValueServer */<a name="line.91"></a>
+<FONT color="green">092</FONT>        public ValueServer() {<a name="line.92"></a>
+<FONT color="green">093</FONT>        }<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /**<a name="line.95"></a>
+<FONT color="green">096</FONT>         * Construct a ValueServer instance using a RandomData as its source<a name="line.96"></a>
+<FONT color="green">097</FONT>         * of random data.<a name="line.97"></a>
+<FONT color="green">098</FONT>         *<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @param randomData the RandomData instance used to source random data<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @since 1.1<a name="line.100"></a>
+<FONT color="green">101</FONT>         */<a name="line.101"></a>
+<FONT color="green">102</FONT>        public ValueServer(RandomData randomData) {<a name="line.102"></a>
+<FONT color="green">103</FONT>            this.randomData = randomData;<a name="line.103"></a>
+<FONT color="green">104</FONT>        }<a name="line.104"></a>
+<FONT color="green">105</FONT>    <a name="line.105"></a>
+<FONT color="green">106</FONT>        /**<a name="line.106"></a>
+<FONT color="green">107</FONT>         * Returns the next generated value, generated according<a name="line.107"></a>
+<FONT color="green">108</FONT>         * to the mode value (see MODE constants).<a name="line.108"></a>
+<FONT color="green">109</FONT>         *<a name="line.109"></a>
+<FONT color="green">110</FONT>         * @return generated value<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @throws IOException in REPLAY_MODE if a file I/O error occurs<a name="line.111"></a>
+<FONT color="green">112</FONT>         */<a name="line.112"></a>
+<FONT color="green">113</FONT>        public double getNext() throws IOException {<a name="line.113"></a>
+<FONT color="green">114</FONT>            switch (mode) {<a name="line.114"></a>
+<FONT color="green">115</FONT>                case DIGEST_MODE: return getNextDigest();<a name="line.115"></a>
+<FONT color="green">116</FONT>                case REPLAY_MODE: return getNextReplay();<a name="line.116"></a>
+<FONT color="green">117</FONT>                case UNIFORM_MODE: return getNextUniform();<a name="line.117"></a>
+<FONT color="green">118</FONT>                case EXPONENTIAL_MODE: return getNextExponential();<a name="line.118"></a>
+<FONT color="green">119</FONT>                case GAUSSIAN_MODE: return getNextGaussian();<a name="line.119"></a>
+<FONT color="green">120</FONT>                case CONSTANT_MODE: return mu;<a name="line.120"></a>
+<FONT color="green">121</FONT>                default: throw MathRuntimeException.createIllegalStateException(<a name="line.121"></a>
+<FONT color="green">122</FONT>                        "unknown mode {0}, known modes: " +<a name="line.122"></a>
+<FONT color="green">123</FONT>                        "{1} ({2}), {3} ({4}), {5} ({6}), {7} ({8}), {9} ({10}) and {11} ({12})",<a name="line.123"></a>
+<FONT color="green">124</FONT>                        mode,<a name="line.124"></a>
+<FONT color="green">125</FONT>                        "DIGEST_MODE",   DIGEST_MODE,   "REPLAY_MODE",      REPLAY_MODE,<a name="line.125"></a>
+<FONT color="green">126</FONT>                        "UNIFORM_MODE",  UNIFORM_MODE,  "EXPONENTIAL_MODE", EXPONENTIAL_MODE,<a name="line.126"></a>
+<FONT color="green">127</FONT>                        "GAUSSIAN_MODE", GAUSSIAN_MODE, "CONSTANT_MODE",    CONSTANT_MODE);<a name="line.127"></a>
+<FONT color="green">128</FONT>            }<a name="line.128"></a>
+<FONT color="green">129</FONT>        }<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>        /**<a name="line.131"></a>
+<FONT color="green">132</FONT>         * Fills the input array with values generated using getNext() repeatedly.<a name="line.132"></a>
+<FONT color="green">133</FONT>         *<a name="line.133"></a>
+<FONT color="green">134</FONT>         * @param values array to be filled<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @throws IOException in REPLAY_MODE if a file I/O error occurs<a name="line.135"></a>
+<FONT color="green">136</FONT>         */<a name="line.136"></a>
+<FONT color="green">137</FONT>        public void fill(double[] values) throws IOException {<a name="line.137"></a>
+<FONT color="green">138</FONT>            for (int i = 0; i &lt; values.length; i++) {<a name="line.138"></a>
+<FONT color="green">139</FONT>                values[i] = getNext();<a name="line.139"></a>
+<FONT color="green">140</FONT>            }<a name="line.140"></a>
+<FONT color="green">141</FONT>        }<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>        /**<a name="line.143"></a>
+<FONT color="green">144</FONT>         * Returns an array of length &lt;code&gt;length&lt;/code&gt; with values generated<a name="line.144"></a>
+<FONT color="green">145</FONT>         * using getNext() repeatedly.<a name="line.145"></a>
+<FONT color="green">146</FONT>         *<a name="line.146"></a>
+<FONT color="green">147</FONT>         * @param length length of output array<a name="line.147"></a>
+<FONT color="green">148</FONT>         * @return array of generated values<a name="line.148"></a>
+<FONT color="green">149</FONT>         * @throws IOException in REPLAY_MODE if a file I/O error occurs<a name="line.149"></a>
+<FONT color="green">150</FONT>         */<a name="line.150"></a>
+<FONT color="green">151</FONT>        public double[] fill(int length) throws IOException {<a name="line.151"></a>
+<FONT color="green">152</FONT>            double[] out = new double[length];<a name="line.152"></a>
+<FONT color="green">153</FONT>            for (int i = 0; i &lt; length; i++) {<a name="line.153"></a>
+<FONT color="green">154</FONT>                out[i] = getNext();<a name="line.154"></a>
+<FONT color="green">155</FONT>            }<a name="line.155"></a>
+<FONT color="green">156</FONT>            return out;<a name="line.156"></a>
+<FONT color="green">157</FONT>        }<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>        /**<a name="line.159"></a>
+<FONT color="green">160</FONT>         * Computes the empirical distribution using values from the file<a name="line.160"></a>
+<FONT color="green">161</FONT>         * in &lt;code&gt;valuesFileURL&lt;/code&gt;, using the default number of bins.<a name="line.161"></a>
+<FONT color="green">162</FONT>         * &lt;p&gt;<a name="line.162"></a>
+<FONT color="green">163</FONT>         * &lt;code&gt;valuesFileURL&lt;/code&gt; must exist and be<a name="line.163"></a>
+<FONT color="green">164</FONT>         * readable by *this at runtime.&lt;/p&gt;<a name="line.164"></a>
+<FONT color="green">165</FONT>         * &lt;p&gt;<a name="line.165"></a>
+<FONT color="green">166</FONT>         * This method must be called before using &lt;code&gt;getNext()&lt;/code&gt;<a name="line.166"></a>
+<FONT color="green">167</FONT>         * with &lt;code&gt;mode = DIGEST_MODE&lt;/code&gt;&lt;/p&gt;<a name="line.167"></a>
+<FONT color="green">168</FONT>         *<a name="line.168"></a>
+<FONT color="green">169</FONT>         * @throws IOException if an I/O error occurs reading the input file<a name="line.169"></a>
+<FONT color="green">170</FONT>         */<a name="line.170"></a>
+<FONT color="green">171</FONT>        public void computeDistribution() throws IOException {<a name="line.171"></a>
+<FONT color="green">172</FONT>            empiricalDistribution = new EmpiricalDistributionImpl();<a name="line.172"></a>
+<FONT color="green">173</FONT>            empiricalDistribution.load(valuesFileURL);<a name="line.173"></a>
+<FONT color="green">174</FONT>        }<a name="line.174"></a>
+<FONT color="green">175</FONT>    <a name="line.175"></a>
+<FONT color="green">176</FONT>        /**<a name="line.176"></a>
+<FONT color="green">177</FONT>         * Computes the empirical distribution using values from the file<a name="line.177"></a>
+<FONT color="green">178</FONT>         * in &lt;code&gt;valuesFileURL&lt;/code&gt; and &lt;code&gt;binCount&lt;/code&gt; bins.<a name="line.178"></a>
+<FONT color="green">179</FONT>         * &lt;p&gt;<a name="line.179"></a>
+<FONT color="green">180</FONT>         * &lt;code&gt;valuesFileURL&lt;/code&gt; must exist and be readable by this process<a name="line.180"></a>
+<FONT color="green">181</FONT>         * at runtime.&lt;/p&gt;<a name="line.181"></a>
+<FONT color="green">182</FONT>         * &lt;p&gt;<a name="line.182"></a>
+<FONT color="green">183</FONT>         * This method must be called before using &lt;code&gt;getNext()&lt;/code&gt;<a name="line.183"></a>
+<FONT color="green">184</FONT>         * with &lt;code&gt;mode = DIGEST_MODE&lt;/code&gt;&lt;/p&gt;<a name="line.184"></a>
+<FONT color="green">185</FONT>         *<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @param binCount the number of bins used in computing the empirical<a name="line.186"></a>
+<FONT color="green">187</FONT>         * distribution<a name="line.187"></a>
+<FONT color="green">188</FONT>         * @throws IOException if an error occurs reading the input file<a name="line.188"></a>
+<FONT color="green">189</FONT>         */<a name="line.189"></a>
+<FONT color="green">190</FONT>        public void computeDistribution(int binCount)<a name="line.190"></a>
+<FONT color="green">191</FONT>                throws IOException {<a name="line.191"></a>
+<FONT color="green">192</FONT>            empiricalDistribution = new EmpiricalDistributionImpl(binCount);<a name="line.192"></a>
+<FONT color="green">193</FONT>            empiricalDistribution.load(valuesFileURL);<a name="line.193"></a>
+<FONT color="green">194</FONT>            mu = empiricalDistribution.getSampleStats().getMean();<a name="line.194"></a>
+<FONT color="green">195</FONT>            sigma = empiricalDistribution.getSampleStats().getStandardDeviation();<a name="line.195"></a>
+<FONT color="green">196</FONT>        }<a name="line.196"></a>
+<FONT color="green">197</FONT>    <a name="line.197"></a>
+<FONT color="green">198</FONT>        /** Getter for property mode.<a name="line.198"></a>
+<FONT color="green">199</FONT>         * @return Value of property mode.<a name="line.199"></a>
+<FONT color="green">200</FONT>         */<a name="line.200"></a>
+<FONT color="green">201</FONT>        public int getMode() {<a name="line.201"></a>
+<FONT color="green">202</FONT>            return mode;<a name="line.202"></a>
+<FONT color="green">203</FONT>        }<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>        /** Setter for property mode.<a name="line.205"></a>
+<FONT color="green">206</FONT>         * @param mode New value of property mode.<a name="line.206"></a>
+<FONT color="green">207</FONT>         */<a name="line.207"></a>
+<FONT color="green">208</FONT>        public void setMode(int mode) {<a name="line.208"></a>
+<FONT color="green">209</FONT>            this.mode = mode;<a name="line.209"></a>
+<FONT color="green">210</FONT>        }<a name="line.210"></a>
+<FONT color="green">211</FONT>    <a name="line.211"></a>
+<FONT color="green">212</FONT>        /**<a name="line.212"></a>
+<FONT color="green">213</FONT>         * Getter for &lt;code&gt;valuesFileURL&lt;code&gt;<a name="line.213"></a>
+<FONT color="green">214</FONT>         * @return Value of property valuesFileURL.<a name="line.214"></a>
+<FONT color="green">215</FONT>         */<a name="line.215"></a>
+<FONT color="green">216</FONT>        public URL getValuesFileURL() {<a name="line.216"></a>
+<FONT color="green">217</FONT>            return valuesFileURL;<a name="line.217"></a>
+<FONT color="green">218</FONT>        }<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>        /**<a name="line.220"></a>
+<FONT color="green">221</FONT>         * Sets the &lt;code&gt;valuesFileURL&lt;/code&gt; using a string URL representation<a name="line.221"></a>
+<FONT color="green">222</FONT>         * @param url String representation for new valuesFileURL.<a name="line.222"></a>
+<FONT color="green">223</FONT>         * @throws MalformedURLException if url is not well formed<a name="line.223"></a>
+<FONT color="green">224</FONT>         */<a name="line.224"></a>
+<FONT color="green">225</FONT>        public void setValuesFileURL(String url) throws MalformedURLException {<a name="line.225"></a>
+<FONT color="green">226</FONT>            this.valuesFileURL = new URL(url);<a name="line.226"></a>
+<FONT color="green">227</FONT>        }<a name="line.227"></a>
+<FONT color="green">228</FONT>    <a name="line.228"></a>
+<FONT color="green">229</FONT>        /**<a name="line.229"></a>
+<FONT color="green">230</FONT>         * Sets the &lt;code&gt;valuesFileURL&lt;/code&gt;<a name="line.230"></a>
+<FONT color="green">231</FONT>         * @param url New value of property valuesFileURL.<a name="line.231"></a>
+<FONT color="green">232</FONT>         */<a name="line.232"></a>
+<FONT color="green">233</FONT>        public void setValuesFileURL(URL url) {<a name="line.233"></a>
+<FONT color="green">234</FONT>            this.valuesFileURL = url;<a name="line.234"></a>
+<FONT color="green">235</FONT>        }<a name="line.235"></a>
+<FONT color="green">236</FONT>    <a name="line.236"></a>
+<FONT color="green">237</FONT>        /** Getter for property empiricalDistribution.<a name="line.237"></a>
+<FONT color="green">238</FONT>         * @return Value of property empiricalDistribution.<a name="line.238"></a>
+<FONT color="green">239</FONT>         */<a name="line.239"></a>
+<FONT color="green">240</FONT>        public EmpiricalDistribution getEmpiricalDistribution() {<a name="line.240"></a>
+<FONT color="green">241</FONT>            return empiricalDistribution;<a name="line.241"></a>
+<FONT color="green">242</FONT>        }<a name="line.242"></a>
+<FONT color="green">243</FONT>    <a name="line.243"></a>
+<FONT color="green">244</FONT>        /**<a name="line.244"></a>
+<FONT color="green">245</FONT>         * Resets REPLAY_MODE file pointer to the beginning of the &lt;code&gt;valuesFileURL&lt;/code&gt;.<a name="line.245"></a>
+<FONT color="green">246</FONT>         *<a name="line.246"></a>
+<FONT color="green">247</FONT>         * @throws IOException if an error occurs opening the file<a name="line.247"></a>
+<FONT color="green">248</FONT>         */<a name="line.248"></a>
+<FONT color="green">249</FONT>        public void resetReplayFile() throws IOException {<a name="line.249"></a>
+<FONT color="green">250</FONT>            if (filePointer != null) {<a name="line.250"></a>
+<FONT color="green">251</FONT>                try {<a name="line.251"></a>
+<FONT color="green">252</FONT>                    filePointer.close();<a name="line.252"></a>
+<FONT color="green">253</FONT>                    filePointer = null;<a name="line.253"></a>
+<FONT color="green">254</FONT>                } catch (IOException ex) {<a name="line.254"></a>
+<FONT color="green">255</FONT>                    // ignore<a name="line.255"></a>
+<FONT color="green">256</FONT>                }<a name="line.256"></a>
+<FONT color="green">257</FONT>            }<a name="line.257"></a>
+<FONT color="green">258</FONT>            filePointer = new BufferedReader(new InputStreamReader(valuesFileURL.openStream()));<a name="line.258"></a>
+<FONT color="green">259</FONT>        }<a name="line.259"></a>
+<FONT color="green">260</FONT>    <a name="line.260"></a>
+<FONT color="green">261</FONT>        /**<a name="line.261"></a>
+<FONT color="green">262</FONT>         * Closes &lt;code&gt;valuesFileURL&lt;/code&gt; after use in REPLAY_MODE.<a name="line.262"></a>
+<FONT color="green">263</FONT>         *<a name="line.263"></a>
+<FONT color="green">264</FONT>         * @throws IOException if an error occurs closing the file<a name="line.264"></a>
+<FONT color="green">265</FONT>         */<a name="line.265"></a>
+<FONT color="green">266</FONT>        public void closeReplayFile() throws IOException {<a name="line.266"></a>
+<FONT color="green">267</FONT>            if (filePointer != null) {<a name="line.267"></a>
+<FONT color="green">268</FONT>                filePointer.close();<a name="line.268"></a>
+<FONT color="green">269</FONT>                filePointer = null;<a name="line.269"></a>
+<FONT color="green">270</FONT>            }<a name="line.270"></a>
+<FONT color="green">271</FONT>        }<a name="line.271"></a>
+<FONT color="green">272</FONT>    <a name="line.272"></a>
+<FONT color="green">273</FONT>        /** Getter for property mu.<a name="line.273"></a>
+<FONT color="green">274</FONT>         * @return Value of property mu.<a name="line.274"></a>
+<FONT color="green">275</FONT>         */<a name="line.275"></a>
+<FONT color="green">276</FONT>        public double getMu() {<a name="line.276"></a>
+<FONT color="green">277</FONT>            return mu;<a name="line.277"></a>
+<FONT color="green">278</FONT>        }<a name="line.278"></a>
+<FONT color="green">279</FONT>    <a name="line.279"></a>
+<FONT color="green">280</FONT>        /** Setter for property mu.<a name="line.280"></a>
+<FONT color="green">281</FONT>         * @param mu New value of property mu.<a name="line.281"></a>
+<FONT color="green">282</FONT>         */<a name="line.282"></a>
+<FONT color="green">283</FONT>        public void setMu(double mu) {<a name="line.283"></a>
+<FONT color="green">284</FONT>            this.mu = mu;<a name="line.284"></a>
+<FONT color="green">285</FONT>        }<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>        /** Getter for property sigma.<a name="line.287"></a>
+<FONT color="green">288</FONT>         * @return Value of property sigma.<a name="line.288"></a>
+<FONT color="green">289</FONT>         */<a name="line.289"></a>
+<FONT color="green">290</FONT>        public double getSigma() {<a name="line.290"></a>
+<FONT color="green">291</FONT>            return sigma;<a name="line.291"></a>
+<FONT color="green">292</FONT>        }<a name="line.292"></a>
+<FONT color="green">293</FONT>    <a name="line.293"></a>
+<FONT color="green">294</FONT>        /** Setter for property sigma.<a name="line.294"></a>
+<FONT color="green">295</FONT>         * @param sigma New value of property sigma.<a name="line.295"></a>
+<FONT color="green">296</FONT>         */<a name="line.296"></a>
+<FONT color="green">297</FONT>        public void setSigma(double sigma) {<a name="line.297"></a>
+<FONT color="green">298</FONT>            this.sigma = sigma;<a name="line.298"></a>
+<FONT color="green">299</FONT>        }<a name="line.299"></a>
+<FONT color="green">300</FONT>    <a name="line.300"></a>
+<FONT color="green">301</FONT>        //------------- private methods ---------------------------------<a name="line.301"></a>
+<FONT color="green">302</FONT>    <a name="line.302"></a>
+<FONT color="green">303</FONT>        /**<a name="line.303"></a>
+<FONT color="green">304</FONT>         * Gets a random value in DIGEST_MODE.<a name="line.304"></a>
+<FONT color="green">305</FONT>         * &lt;p&gt;<a name="line.305"></a>
+<FONT color="green">306</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.306"></a>
+<FONT color="green">307</FONT>         * &lt;li&gt;Before this method is called, &lt;code&gt;computeDistribution()&lt;/code&gt;<a name="line.307"></a>
+<FONT color="green">308</FONT>         * must have completed successfully; otherwise an<a name="line.308"></a>
+<FONT color="green">309</FONT>         * &lt;code&gt;IllegalStateException&lt;/code&gt; will be thrown&lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.309"></a>
+<FONT color="green">310</FONT>         *<a name="line.310"></a>
+<FONT color="green">311</FONT>         * @return next random value from the empirical distribution digest<a name="line.311"></a>
+<FONT color="green">312</FONT>         */<a name="line.312"></a>
+<FONT color="green">313</FONT>        private double getNextDigest() {<a name="line.313"></a>
+<FONT color="green">314</FONT>            if ((empiricalDistribution == null) ||<a name="line.314"></a>
+<FONT color="green">315</FONT>                (empiricalDistribution.getBinStats().size() == 0)) {<a name="line.315"></a>
+<FONT color="green">316</FONT>                throw MathRuntimeException.createIllegalStateException("digest not initialized");<a name="line.316"></a>
+<FONT color="green">317</FONT>            }<a name="line.317"></a>
+<FONT color="green">318</FONT>            return empiricalDistribution.getNextValue();<a name="line.318"></a>
+<FONT color="green">319</FONT>        }<a name="line.319"></a>
+<FONT color="green">320</FONT>    <a name="line.320"></a>
+<FONT color="green">321</FONT>        /**<a name="line.321"></a>
+<FONT color="green">322</FONT>         * Gets next sequential value from the &lt;code&gt;valuesFileURL&lt;/code&gt;.<a name="line.322"></a>
+<FONT color="green">323</FONT>         * &lt;p&gt;<a name="line.323"></a>
+<FONT color="green">324</FONT>         * Throws an IOException if the read fails.&lt;/p&gt;<a name="line.324"></a>
+<FONT color="green">325</FONT>         * &lt;p&gt;<a name="line.325"></a>
+<FONT color="green">326</FONT>         * This method will open the &lt;code&gt;valuesFileURL&lt;/code&gt; if there is no<a name="line.326"></a>
+<FONT color="green">327</FONT>         * replay file open.&lt;/p&gt;<a name="line.327"></a>
+<FONT color="green">328</FONT>         * &lt;p&gt;<a name="line.328"></a>
+<FONT color="green">329</FONT>         * The &lt;code&gt;valuesFileURL&lt;/code&gt; will be closed and reopened to wrap around<a name="line.329"></a>
+<FONT color="green">330</FONT>         * from EOF to BOF if EOF is encountered. EOFException (which is a kind of<a name="line.330"></a>
+<FONT color="green">331</FONT>         * IOException) may still be thrown if the &lt;code&gt;valuesFileURL&lt;/code&gt; is<a name="line.331"></a>
+<FONT color="green">332</FONT>         * empty.&lt;/p&gt;<a name="line.332"></a>
+<FONT color="green">333</FONT>         *<a name="line.333"></a>
+<FONT color="green">334</FONT>         * @return next value from the replay file<a name="line.334"></a>
+<FONT color="green">335</FONT>         * @throws IOException if there is a problem reading from the file<a name="line.335"></a>
+<FONT color="green">336</FONT>         * @throws NumberFormatException if an invalid numeric string is<a name="line.336"></a>
+<FONT color="green">337</FONT>         *   encountered in the file<a name="line.337"></a>
+<FONT color="green">338</FONT>         */<a name="line.338"></a>
+<FONT color="green">339</FONT>        private double getNextReplay() throws IOException {<a name="line.339"></a>
+<FONT color="green">340</FONT>            String str = null;<a name="line.340"></a>
+<FONT color="green">341</FONT>            if (filePointer == null) {<a name="line.341"></a>
+<FONT color="green">342</FONT>                resetReplayFile();<a name="line.342"></a>
+<FONT color="green">343</FONT>            }<a name="line.343"></a>
+<FONT color="green">344</FONT>            if ((str = filePointer.readLine()) == null) {<a name="line.344"></a>
+<FONT color="green">345</FONT>                // we have probably reached end of file, wrap around from EOF to BOF<a name="line.345"></a>
+<FONT color="green">346</FONT>                closeReplayFile();<a name="line.346"></a>
+<FONT color="green">347</FONT>                resetReplayFile();<a name="line.347"></a>
+<FONT color="green">348</FONT>                if ((str = filePointer.readLine()) == null) {<a name="line.348"></a>
+<FONT color="green">349</FONT>                    throw MathRuntimeException.createEOFException("URL {0} contains no data",<a name="line.349"></a>
+<FONT color="green">350</FONT>                                                                  valuesFileURL);<a name="line.350"></a>
+<FONT color="green">351</FONT>                }<a name="line.351"></a>
+<FONT color="green">352</FONT>            }<a name="line.352"></a>
+<FONT color="green">353</FONT>            return Double.valueOf(str).doubleValue();<a name="line.353"></a>
+<FONT color="green">354</FONT>        }<a name="line.354"></a>
+<FONT color="green">355</FONT>    <a name="line.355"></a>
+<FONT color="green">356</FONT>        /**<a name="line.356"></a>
+<FONT color="green">357</FONT>         * Gets a uniformly distributed random value with mean = mu.<a name="line.357"></a>
+<FONT color="green">358</FONT>         *<a name="line.358"></a>
+<FONT color="green">359</FONT>         * @return random uniform value<a name="line.359"></a>
+<FONT color="green">360</FONT>         */<a name="line.360"></a>
+<FONT color="green">361</FONT>        private double getNextUniform() {<a name="line.361"></a>
+<FONT color="green">362</FONT>            return randomData.nextUniform(0, 2 * mu);<a name="line.362"></a>
+<FONT color="green">363</FONT>        }<a name="line.363"></a>
+<FONT color="green">364</FONT>    <a name="line.364"></a>
+<FONT color="green">365</FONT>        /**<a name="line.365"></a>
+<FONT color="green">366</FONT>         * Gets an exponentially distributed random value with mean = mu.<a name="line.366"></a>
+<FONT color="green">367</FONT>         *<a name="line.367"></a>
+<FONT color="green">368</FONT>         * @return random exponential value<a name="line.368"></a>
+<FONT color="green">369</FONT>         */<a name="line.369"></a>
+<FONT color="green">370</FONT>        private double getNextExponential() {<a name="line.370"></a>
+<FONT color="green">371</FONT>            return randomData.nextExponential(mu);<a name="line.371"></a>
+<FONT color="green">372</FONT>        }<a name="line.372"></a>
+<FONT color="green">373</FONT>    <a name="line.373"></a>
+<FONT color="green">374</FONT>        /**<a name="line.374"></a>
+<FONT color="green">375</FONT>         * Gets a Gaussian distributed random value with mean = mu<a name="line.375"></a>
+<FONT color="green">376</FONT>         * and standard deviation = sigma.<a name="line.376"></a>
+<FONT color="green">377</FONT>         *<a name="line.377"></a>
+<FONT color="green">378</FONT>         * @return random Gaussian value<a name="line.378"></a>
+<FONT color="green">379</FONT>         */<a name="line.379"></a>
+<FONT color="green">380</FONT>        private double getNextGaussian() {<a name="line.380"></a>
+<FONT color="green">381</FONT>            return randomData.nextGaussian(mu, sigma);<a name="line.381"></a>
+<FONT color="green">382</FONT>        }<a name="line.382"></a>
+<FONT color="green">383</FONT>    <a name="line.383"></a>
+<FONT color="green">384</FONT>    }<a name="line.384"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/special/Beta.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,267 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.special;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.util.ContinuedFraction;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * This is a utility class that provides computation methods related to the<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Beta family of functions.<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public class Beta {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /** Maximum allowed numerical error. */<a name="line.30"></a>
+<FONT color="green">031</FONT>        private static final double DEFAULT_EPSILON = 10e-15;<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /**<a name="line.33"></a>
+<FONT color="green">034</FONT>         * Default constructor.  Prohibit instantiation.<a name="line.34"></a>
+<FONT color="green">035</FONT>         */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private Beta() {<a name="line.36"></a>
+<FONT color="green">037</FONT>            super();<a name="line.37"></a>
+<FONT color="green">038</FONT>        }<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /**<a name="line.40"></a>
+<FONT color="green">041</FONT>         * Returns the<a name="line.41"></a>
+<FONT color="green">042</FONT>         * &lt;a href="http://mathworld.wolfram.com/RegularizedBetaFunction.html"&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>         * regularized beta function&lt;/a&gt; I(x, a, b).<a name="line.43"></a>
+<FONT color="green">044</FONT>         *<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @param x the value.<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param a the a parameter.<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @param b the b parameter.<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @return the regularized beta function I(x, a, b)<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @throws MathException if the algorithm fails to converge.<a name="line.49"></a>
+<FONT color="green">050</FONT>         */<a name="line.50"></a>
+<FONT color="green">051</FONT>        public static double regularizedBeta(double x, double a, double b)<a name="line.51"></a>
+<FONT color="green">052</FONT>            throws MathException<a name="line.52"></a>
+<FONT color="green">053</FONT>        {<a name="line.53"></a>
+<FONT color="green">054</FONT>            return regularizedBeta(x, a, b, DEFAULT_EPSILON, Integer.MAX_VALUE);<a name="line.54"></a>
+<FONT color="green">055</FONT>        }<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /**<a name="line.57"></a>
+<FONT color="green">058</FONT>         * Returns the<a name="line.58"></a>
+<FONT color="green">059</FONT>         * &lt;a href="http://mathworld.wolfram.com/RegularizedBetaFunction.html"&gt;<a name="line.59"></a>
+<FONT color="green">060</FONT>         * regularized beta function&lt;/a&gt; I(x, a, b).<a name="line.60"></a>
+<FONT color="green">061</FONT>         *<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param x the value.<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @param a the a parameter.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @param b the b parameter.<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param epsilon When the absolute value of the nth item in the<a name="line.65"></a>
+<FONT color="green">066</FONT>         *                series is less than epsilon the approximation ceases<a name="line.66"></a>
+<FONT color="green">067</FONT>         *                to calculate further elements in the series.<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @return the regularized beta function I(x, a, b)<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @throws MathException if the algorithm fails to converge.<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        public static double regularizedBeta(double x, double a, double b,<a name="line.71"></a>
+<FONT color="green">072</FONT>            double epsilon) throws MathException<a name="line.72"></a>
+<FONT color="green">073</FONT>        {<a name="line.73"></a>
+<FONT color="green">074</FONT>            return regularizedBeta(x, a, b, epsilon, Integer.MAX_VALUE);<a name="line.74"></a>
+<FONT color="green">075</FONT>        }<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /**<a name="line.77"></a>
+<FONT color="green">078</FONT>         * Returns the regularized beta function I(x, a, b).<a name="line.78"></a>
+<FONT color="green">079</FONT>         *<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @param x the value.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @param a the a parameter.<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @param b the b parameter.<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param maxIterations Maximum number of "iterations" to complete.<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @return the regularized beta function I(x, a, b)<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @throws MathException if the algorithm fails to converge.<a name="line.85"></a>
+<FONT color="green">086</FONT>         */<a name="line.86"></a>
+<FONT color="green">087</FONT>        public static double regularizedBeta(double x, double a, double b,<a name="line.87"></a>
+<FONT color="green">088</FONT>            int maxIterations) throws MathException<a name="line.88"></a>
+<FONT color="green">089</FONT>        {<a name="line.89"></a>
+<FONT color="green">090</FONT>            return regularizedBeta(x, a, b, DEFAULT_EPSILON, maxIterations);<a name="line.90"></a>
+<FONT color="green">091</FONT>        }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /**<a name="line.93"></a>
+<FONT color="green">094</FONT>         * Returns the regularized beta function I(x, a, b).<a name="line.94"></a>
+<FONT color="green">095</FONT>         *<a name="line.95"></a>
+<FONT color="green">096</FONT>         * The implementation of this method is based on:<a name="line.96"></a>
+<FONT color="green">097</FONT>         * &lt;ul&gt;<a name="line.97"></a>
+<FONT color="green">098</FONT>         * &lt;li&gt;<a name="line.98"></a>
+<FONT color="green">099</FONT>         * &lt;a href="http://mathworld.wolfram.com/RegularizedBetaFunction.html"&gt;<a name="line.99"></a>
+<FONT color="green">100</FONT>         * Regularized Beta Function&lt;/a&gt;.&lt;/li&gt;<a name="line.100"></a>
+<FONT color="green">101</FONT>         * &lt;li&gt;<a name="line.101"></a>
+<FONT color="green">102</FONT>         * &lt;a href="http://functions.wolfram.com/06.21.10.0001.01"&gt;<a name="line.102"></a>
+<FONT color="green">103</FONT>         * Regularized Beta Function&lt;/a&gt;.&lt;/li&gt;<a name="line.103"></a>
+<FONT color="green">104</FONT>         * &lt;/ul&gt;<a name="line.104"></a>
+<FONT color="green">105</FONT>         *<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @param x the value.<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @param a the a parameter.<a name="line.107"></a>
+<FONT color="green">108</FONT>         * @param b the b parameter.<a name="line.108"></a>
+<FONT color="green">109</FONT>         * @param epsilon When the absolute value of the nth item in the<a name="line.109"></a>
+<FONT color="green">110</FONT>         *                series is less than epsilon the approximation ceases<a name="line.110"></a>
+<FONT color="green">111</FONT>         *                to calculate further elements in the series.<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @param maxIterations Maximum number of "iterations" to complete.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @return the regularized beta function I(x, a, b)<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @throws MathException if the algorithm fails to converge.<a name="line.114"></a>
+<FONT color="green">115</FONT>         */<a name="line.115"></a>
+<FONT color="green">116</FONT>        public static double regularizedBeta(double x, final double a,<a name="line.116"></a>
+<FONT color="green">117</FONT>            final double b, double epsilon, int maxIterations) throws MathException<a name="line.117"></a>
+<FONT color="green">118</FONT>        {<a name="line.118"></a>
+<FONT color="green">119</FONT>            double ret;<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>            if (Double.isNaN(x) || Double.isNaN(a) || Double.isNaN(b) || (x &lt; 0) ||<a name="line.121"></a>
+<FONT color="green">122</FONT>                (x &gt; 1) || (a &lt;= 0.0) || (b &lt;= 0.0))<a name="line.122"></a>
+<FONT color="green">123</FONT>            {<a name="line.123"></a>
+<FONT color="green">124</FONT>                ret = Double.NaN;<a name="line.124"></a>
+<FONT color="green">125</FONT>            } else if (x &gt; (a + 1.0) / (a + b + 2.0)) {<a name="line.125"></a>
+<FONT color="green">126</FONT>                ret = 1.0 - regularizedBeta(1.0 - x, b, a, epsilon, maxIterations);<a name="line.126"></a>
+<FONT color="green">127</FONT>            } else {<a name="line.127"></a>
+<FONT color="green">128</FONT>                ContinuedFraction fraction = new ContinuedFraction() {<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>                    @Override<a name="line.130"></a>
+<FONT color="green">131</FONT>                    protected double getB(int n, double x) {<a name="line.131"></a>
+<FONT color="green">132</FONT>                        double ret;<a name="line.132"></a>
+<FONT color="green">133</FONT>                        double m;<a name="line.133"></a>
+<FONT color="green">134</FONT>                        if (n % 2 == 0) { // even<a name="line.134"></a>
+<FONT color="green">135</FONT>                            m = n / 2.0;<a name="line.135"></a>
+<FONT color="green">136</FONT>                            ret = (m * (b - m) * x) /<a name="line.136"></a>
+<FONT color="green">137</FONT>                                ((a + (2 * m) - 1) * (a + (2 * m)));<a name="line.137"></a>
+<FONT color="green">138</FONT>                        } else {<a name="line.138"></a>
+<FONT color="green">139</FONT>                            m = (n - 1.0) / 2.0;<a name="line.139"></a>
+<FONT color="green">140</FONT>                            ret = -((a + m) * (a + b + m) * x) /<a name="line.140"></a>
+<FONT color="green">141</FONT>                                    ((a + (2 * m)) * (a + (2 * m) + 1.0));<a name="line.141"></a>
+<FONT color="green">142</FONT>                        }<a name="line.142"></a>
+<FONT color="green">143</FONT>                        return ret;<a name="line.143"></a>
+<FONT color="green">144</FONT>                    }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>                    @Override<a name="line.146"></a>
+<FONT color="green">147</FONT>                    protected double getA(int n, double x) {<a name="line.147"></a>
+<FONT color="green">148</FONT>                        return 1.0;<a name="line.148"></a>
+<FONT color="green">149</FONT>                    }<a name="line.149"></a>
+<FONT color="green">150</FONT>                };<a name="line.150"></a>
+<FONT color="green">151</FONT>                ret = Math.exp((a * Math.log(x)) + (b * Math.log(1.0 - x)) -<a name="line.151"></a>
+<FONT color="green">152</FONT>                    Math.log(a) - logBeta(a, b, epsilon, maxIterations)) *<a name="line.152"></a>
+<FONT color="green">153</FONT>                    1.0 / fraction.evaluate(x, epsilon, maxIterations);<a name="line.153"></a>
+<FONT color="green">154</FONT>            }<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>            return ret;<a name="line.156"></a>
+<FONT color="green">157</FONT>        }<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>        /**<a name="line.159"></a>
+<FONT color="green">160</FONT>         * Returns the natural logarithm of the beta function B(a, b).<a name="line.160"></a>
+<FONT color="green">161</FONT>         *<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @param a the a parameter.<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @param b the b parameter.<a name="line.163"></a>
+<FONT color="green">164</FONT>         * @return log(B(a, b))<a name="line.164"></a>
+<FONT color="green">165</FONT>         */<a name="line.165"></a>
+<FONT color="green">166</FONT>        public static double logBeta(double a, double b) {<a name="line.166"></a>
+<FONT color="green">167</FONT>            return logBeta(a, b, DEFAULT_EPSILON, Integer.MAX_VALUE);<a name="line.167"></a>
+<FONT color="green">168</FONT>        }<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>        /**<a name="line.170"></a>
+<FONT color="green">171</FONT>         * Returns the natural logarithm of the beta function B(a, b).<a name="line.171"></a>
+<FONT color="green">172</FONT>         *<a name="line.172"></a>
+<FONT color="green">173</FONT>         * The implementation of this method is based on:<a name="line.173"></a>
+<FONT color="green">174</FONT>         * &lt;ul&gt;<a name="line.174"></a>
+<FONT color="green">175</FONT>         * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/BetaFunction.html"&gt;<a name="line.175"></a>
+<FONT color="green">176</FONT>         * Beta Function&lt;/a&gt;, equation (1).&lt;/li&gt;<a name="line.176"></a>
+<FONT color="green">177</FONT>         * &lt;/ul&gt;<a name="line.177"></a>
+<FONT color="green">178</FONT>         *<a name="line.178"></a>
+<FONT color="green">179</FONT>         * @param a the a parameter.<a name="line.179"></a>
+<FONT color="green">180</FONT>         * @param b the b parameter.<a name="line.180"></a>
+<FONT color="green">181</FONT>         * @param epsilon When the absolute value of the nth item in the<a name="line.181"></a>
+<FONT color="green">182</FONT>         *                series is less than epsilon the approximation ceases<a name="line.182"></a>
+<FONT color="green">183</FONT>         *                to calculate further elements in the series.<a name="line.183"></a>
+<FONT color="green">184</FONT>         * @param maxIterations Maximum number of "iterations" to complete.<a name="line.184"></a>
+<FONT color="green">185</FONT>         * @return log(B(a, b))<a name="line.185"></a>
+<FONT color="green">186</FONT>         */<a name="line.186"></a>
+<FONT color="green">187</FONT>        public static double logBeta(double a, double b, double epsilon,<a name="line.187"></a>
+<FONT color="green">188</FONT>            int maxIterations) {<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>            double ret;<a name="line.190"></a>
+<FONT color="green">191</FONT>    <a name="line.191"></a>
+<FONT color="green">192</FONT>            if (Double.isNaN(a) || Double.isNaN(b) || (a &lt;= 0.0) || (b &lt;= 0.0)) {<a name="line.192"></a>
+<FONT color="green">193</FONT>                ret = Double.NaN;<a name="line.193"></a>
+<FONT color="green">194</FONT>            } else {<a name="line.194"></a>
+<FONT color="green">195</FONT>                ret = Gamma.logGamma(a) + Gamma.logGamma(b) -<a name="line.195"></a>
+<FONT color="green">196</FONT>                    Gamma.logGamma(a + b);<a name="line.196"></a>
+<FONT color="green">197</FONT>            }<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>            return ret;<a name="line.199"></a>
+<FONT color="green">200</FONT>        }<a name="line.200"></a>
+<FONT color="green">201</FONT>    }<a name="line.201"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/special/Erf.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,123 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.special;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * This is a utility class that provides computation methods related to the<a name="line.22"></a>
+<FONT color="green">023</FONT>     * error functions.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public class Erf {<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>        /**<a name="line.29"></a>
+<FONT color="green">030</FONT>         * Default constructor.  Prohibit instantiation.<a name="line.30"></a>
+<FONT color="green">031</FONT>         */<a name="line.31"></a>
+<FONT color="green">032</FONT>        private Erf() {<a name="line.32"></a>
+<FONT color="green">033</FONT>            super();<a name="line.33"></a>
+<FONT color="green">034</FONT>        }<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /**<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Returns the error function erf(x).<a name="line.37"></a>
+<FONT color="green">038</FONT>         *<a name="line.38"></a>
+<FONT color="green">039</FONT>         * The implementation of this method is based on:<a name="line.39"></a>
+<FONT color="green">040</FONT>         * &lt;ul&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>         * &lt;li&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>         * &lt;a href="http://mathworld.wolfram.com/Erf.html"&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>         * Erf&lt;/a&gt;, equation (3).&lt;/li&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>         * &lt;/ul&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>         *<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param x the value.<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @return the error function erf(x)<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @throws MathException if the algorithm fails to converge.<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        public static double erf(double x) throws MathException {<a name="line.50"></a>
+<FONT color="green">051</FONT>            double ret = Gamma.regularizedGammaP(0.5, x * x, 1.0e-15, 10000);<a name="line.51"></a>
+<FONT color="green">052</FONT>            if (x &lt; 0) {<a name="line.52"></a>
+<FONT color="green">053</FONT>                ret = -ret;<a name="line.53"></a>
+<FONT color="green">054</FONT>            }<a name="line.54"></a>
+<FONT color="green">055</FONT>            return ret;<a name="line.55"></a>
+<FONT color="green">056</FONT>        }<a name="line.56"></a>
+<FONT color="green">057</FONT>    }<a name="line.57"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/special/Gamma.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,404 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.special;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.util.ContinuedFraction;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * This is a utility class that provides computation methods related to the<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Gamma family of functions.<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 920558 $ $Date: 2010-03-08 17:57:32 -0500 (Mon, 08 Mar 2010) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public class Gamma {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /**<a name="line.31"></a>
+<FONT color="green">032</FONT>         * &lt;a href="http://en.wikipedia.org/wiki/Euler-Mascheroni_constant"&gt;Euler-Mascheroni constant&lt;/a&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @since 2.0<a name="line.33"></a>
+<FONT color="green">034</FONT>         */<a name="line.34"></a>
+<FONT color="green">035</FONT>        public static final double GAMMA = 0.577215664901532860606512090082;<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /** Maximum allowed numerical error. */<a name="line.37"></a>
+<FONT color="green">038</FONT>        private static final double DEFAULT_EPSILON = 10e-15;<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Lanczos coefficients */<a name="line.40"></a>
+<FONT color="green">041</FONT>        private static final double[] LANCZOS =<a name="line.41"></a>
+<FONT color="green">042</FONT>        {<a name="line.42"></a>
+<FONT color="green">043</FONT>            0.99999999999999709182,<a name="line.43"></a>
+<FONT color="green">044</FONT>            57.156235665862923517,<a name="line.44"></a>
+<FONT color="green">045</FONT>            -59.597960355475491248,<a name="line.45"></a>
+<FONT color="green">046</FONT>            14.136097974741747174,<a name="line.46"></a>
+<FONT color="green">047</FONT>            -0.49191381609762019978,<a name="line.47"></a>
+<FONT color="green">048</FONT>            .33994649984811888699e-4,<a name="line.48"></a>
+<FONT color="green">049</FONT>            .46523628927048575665e-4,<a name="line.49"></a>
+<FONT color="green">050</FONT>            -.98374475304879564677e-4,<a name="line.50"></a>
+<FONT color="green">051</FONT>            .15808870322491248884e-3,<a name="line.51"></a>
+<FONT color="green">052</FONT>            -.21026444172410488319e-3,<a name="line.52"></a>
+<FONT color="green">053</FONT>            .21743961811521264320e-3,<a name="line.53"></a>
+<FONT color="green">054</FONT>            -.16431810653676389022e-3,<a name="line.54"></a>
+<FONT color="green">055</FONT>            .84418223983852743293e-4,<a name="line.55"></a>
+<FONT color="green">056</FONT>            -.26190838401581408670e-4,<a name="line.56"></a>
+<FONT color="green">057</FONT>            .36899182659531622704e-5,<a name="line.57"></a>
+<FONT color="green">058</FONT>        };<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Avoid repeated computation of log of 2 PI in logGamma */<a name="line.60"></a>
+<FONT color="green">061</FONT>        private static final double HALF_LOG_2_PI = 0.5 * Math.log(2.0 * Math.PI);<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        // limits for switching algorithm in digamma<a name="line.63"></a>
+<FONT color="green">064</FONT>        /** C limit. */<a name="line.64"></a>
+<FONT color="green">065</FONT>        private static final double C_LIMIT = 49;<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /** S limit. */<a name="line.67"></a>
+<FONT color="green">068</FONT>        private static final double S_LIMIT = 1e-5;<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /**<a name="line.70"></a>
+<FONT color="green">071</FONT>         * Default constructor.  Prohibit instantiation.<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        private Gamma() {<a name="line.73"></a>
+<FONT color="green">074</FONT>            super();<a name="line.74"></a>
+<FONT color="green">075</FONT>        }<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /**<a name="line.77"></a>
+<FONT color="green">078</FONT>         * Returns the natural logarithm of the gamma function &amp;#915;(x).<a name="line.78"></a>
+<FONT color="green">079</FONT>         *<a name="line.79"></a>
+<FONT color="green">080</FONT>         * The implementation of this method is based on:<a name="line.80"></a>
+<FONT color="green">081</FONT>         * &lt;ul&gt;<a name="line.81"></a>
+<FONT color="green">082</FONT>         * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/GammaFunction.html"&gt;<a name="line.82"></a>
+<FONT color="green">083</FONT>         * Gamma Function&lt;/a&gt;, equation (28).&lt;/li&gt;<a name="line.83"></a>
+<FONT color="green">084</FONT>         * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/LanczosApproximation.html"&gt;<a name="line.84"></a>
+<FONT color="green">085</FONT>         * Lanczos Approximation&lt;/a&gt;, equations (1) through (5).&lt;/li&gt;<a name="line.85"></a>
+<FONT color="green">086</FONT>         * &lt;li&gt;&lt;a href="http://my.fit.edu/~gabdo/gamma.txt"&gt;Paul Godfrey, A note on<a name="line.86"></a>
+<FONT color="green">087</FONT>         * the computation of the convergent Lanczos complex Gamma approximation<a name="line.87"></a>
+<FONT color="green">088</FONT>         * &lt;/a&gt;&lt;/li&gt;<a name="line.88"></a>
+<FONT color="green">089</FONT>         * &lt;/ul&gt;<a name="line.89"></a>
+<FONT color="green">090</FONT>         *<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @param x the value.<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @return log(&amp;#915;(x))<a name="line.92"></a>
+<FONT color="green">093</FONT>         */<a name="line.93"></a>
+<FONT color="green">094</FONT>        public static double logGamma(double x) {<a name="line.94"></a>
+<FONT color="green">095</FONT>            double ret;<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>            if (Double.isNaN(x) || (x &lt;= 0.0)) {<a name="line.97"></a>
+<FONT color="green">098</FONT>                ret = Double.NaN;<a name="line.98"></a>
+<FONT color="green">099</FONT>            } else {<a name="line.99"></a>
+<FONT color="green">100</FONT>                double g = 607.0 / 128.0;<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>                double sum = 0.0;<a name="line.102"></a>
+<FONT color="green">103</FONT>                for (int i = LANCZOS.length - 1; i &gt; 0; --i) {<a name="line.103"></a>
+<FONT color="green">104</FONT>                    sum = sum + (LANCZOS[i] / (x + i));<a name="line.104"></a>
+<FONT color="green">105</FONT>                }<a name="line.105"></a>
+<FONT color="green">106</FONT>                sum = sum + LANCZOS[0];<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>                double tmp = x + g + .5;<a name="line.108"></a>
+<FONT color="green">109</FONT>                ret = ((x + .5) * Math.log(tmp)) - tmp +<a name="line.109"></a>
+<FONT color="green">110</FONT>                    HALF_LOG_2_PI + Math.log(sum / x);<a name="line.110"></a>
+<FONT color="green">111</FONT>            }<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>            return ret;<a name="line.113"></a>
+<FONT color="green">114</FONT>        }<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>        /**<a name="line.116"></a>
+<FONT color="green">117</FONT>         * Returns the regularized gamma function P(a, x).<a name="line.117"></a>
+<FONT color="green">118</FONT>         *<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @param a the a parameter.<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @param x the value.<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @return the regularized gamma function P(a, x)<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @throws MathException if the algorithm fails to converge.<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        public static double regularizedGammaP(double a, double x)<a name="line.124"></a>
+<FONT color="green">125</FONT>            throws MathException<a name="line.125"></a>
+<FONT color="green">126</FONT>        {<a name="line.126"></a>
+<FONT color="green">127</FONT>            return regularizedGammaP(a, x, DEFAULT_EPSILON, Integer.MAX_VALUE);<a name="line.127"></a>
+<FONT color="green">128</FONT>        }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>        /**<a name="line.131"></a>
+<FONT color="green">132</FONT>         * Returns the regularized gamma function P(a, x).<a name="line.132"></a>
+<FONT color="green">133</FONT>         *<a name="line.133"></a>
+<FONT color="green">134</FONT>         * The implementation of this method is based on:<a name="line.134"></a>
+<FONT color="green">135</FONT>         * &lt;ul&gt;<a name="line.135"></a>
+<FONT color="green">136</FONT>         * &lt;li&gt;<a name="line.136"></a>
+<FONT color="green">137</FONT>         * &lt;a href="http://mathworld.wolfram.com/RegularizedGammaFunction.html"&gt;<a name="line.137"></a>
+<FONT color="green">138</FONT>         * Regularized Gamma Function&lt;/a&gt;, equation (1).&lt;/li&gt;<a name="line.138"></a>
+<FONT color="green">139</FONT>         * &lt;li&gt;<a name="line.139"></a>
+<FONT color="green">140</FONT>         * &lt;a href="http://mathworld.wolfram.com/IncompleteGammaFunction.html"&gt;<a name="line.140"></a>
+<FONT color="green">141</FONT>         * Incomplete Gamma Function&lt;/a&gt;, equation (4).&lt;/li&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>         * &lt;li&gt;<a name="line.142"></a>
+<FONT color="green">143</FONT>         * &lt;a href="http://mathworld.wolfram.com/ConfluentHypergeometricFunctionoftheFirstKind.html"&gt;<a name="line.143"></a>
+<FONT color="green">144</FONT>         * Confluent Hypergeometric Function of the First Kind&lt;/a&gt;, equation (1).<a name="line.144"></a>
+<FONT color="green">145</FONT>         * &lt;/li&gt;<a name="line.145"></a>
+<FONT color="green">146</FONT>         * &lt;/ul&gt;<a name="line.146"></a>
+<FONT color="green">147</FONT>         *<a name="line.147"></a>
+<FONT color="green">148</FONT>         * @param a the a parameter.<a name="line.148"></a>
+<FONT color="green">149</FONT>         * @param x the value.<a name="line.149"></a>
+<FONT color="green">150</FONT>         * @param epsilon When the absolute value of the nth item in the<a name="line.150"></a>
+<FONT color="green">151</FONT>         *                series is less than epsilon the approximation ceases<a name="line.151"></a>
+<FONT color="green">152</FONT>         *                to calculate further elements in the series.<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @param maxIterations Maximum number of "iterations" to complete.<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @return the regularized gamma function P(a, x)<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @throws MathException if the algorithm fails to converge.<a name="line.155"></a>
+<FONT color="green">156</FONT>         */<a name="line.156"></a>
+<FONT color="green">157</FONT>        public static double regularizedGammaP(double a,<a name="line.157"></a>
+<FONT color="green">158</FONT>                                               double x,<a name="line.158"></a>
+<FONT color="green">159</FONT>                                               double epsilon,<a name="line.159"></a>
+<FONT color="green">160</FONT>                                               int maxIterations)<a name="line.160"></a>
+<FONT color="green">161</FONT>            throws MathException<a name="line.161"></a>
+<FONT color="green">162</FONT>        {<a name="line.162"></a>
+<FONT color="green">163</FONT>            double ret;<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>            if (Double.isNaN(a) || Double.isNaN(x) || (a &lt;= 0.0) || (x &lt; 0.0)) {<a name="line.165"></a>
+<FONT color="green">166</FONT>                ret = Double.NaN;<a name="line.166"></a>
+<FONT color="green">167</FONT>            } else if (x == 0.0) {<a name="line.167"></a>
+<FONT color="green">168</FONT>                ret = 0.0;<a name="line.168"></a>
+<FONT color="green">169</FONT>            } else if (x &gt;= a + 1) {<a name="line.169"></a>
+<FONT color="green">170</FONT>                // use regularizedGammaQ because it should converge faster in this<a name="line.170"></a>
+<FONT color="green">171</FONT>                // case.<a name="line.171"></a>
+<FONT color="green">172</FONT>                ret = 1.0 - regularizedGammaQ(a, x, epsilon, maxIterations);<a name="line.172"></a>
+<FONT color="green">173</FONT>            } else {<a name="line.173"></a>
+<FONT color="green">174</FONT>                // calculate series<a name="line.174"></a>
+<FONT color="green">175</FONT>                double n = 0.0; // current element index<a name="line.175"></a>
+<FONT color="green">176</FONT>                double an = 1.0 / a; // n-th element in the series<a name="line.176"></a>
+<FONT color="green">177</FONT>                double sum = an; // partial sum<a name="line.177"></a>
+<FONT color="green">178</FONT>                while (Math.abs(an/sum) &gt; epsilon &amp;&amp; n &lt; maxIterations &amp;&amp; sum &lt; Double.POSITIVE_INFINITY) {<a name="line.178"></a>
+<FONT color="green">179</FONT>                    // compute next element in the series<a name="line.179"></a>
+<FONT color="green">180</FONT>                    n = n + 1.0;<a name="line.180"></a>
+<FONT color="green">181</FONT>                    an = an * (x / (a + n));<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>                    // update partial sum<a name="line.183"></a>
+<FONT color="green">184</FONT>                    sum = sum + an;<a name="line.184"></a>
+<FONT color="green">185</FONT>                }<a name="line.185"></a>
+<FONT color="green">186</FONT>                if (n &gt;= maxIterations) {<a name="line.186"></a>
+<FONT color="green">187</FONT>                    throw new MaxIterationsExceededException(maxIterations);<a name="line.187"></a>
+<FONT color="green">188</FONT>                } else if (Double.isInfinite(sum)) {<a name="line.188"></a>
+<FONT color="green">189</FONT>                    ret = 1.0;<a name="line.189"></a>
+<FONT color="green">190</FONT>                } else {<a name="line.190"></a>
+<FONT color="green">191</FONT>                    ret = Math.exp(-x + (a * Math.log(x)) - logGamma(a)) * sum;<a name="line.191"></a>
+<FONT color="green">192</FONT>                }<a name="line.192"></a>
+<FONT color="green">193</FONT>            }<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>            return ret;<a name="line.195"></a>
+<FONT color="green">196</FONT>        }<a name="line.196"></a>
+<FONT color="green">197</FONT>    <a name="line.197"></a>
+<FONT color="green">198</FONT>        /**<a name="line.198"></a>
+<FONT color="green">199</FONT>         * Returns the regularized gamma function Q(a, x) = 1 - P(a, x).<a name="line.199"></a>
+<FONT color="green">200</FONT>         *<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @param a the a parameter.<a name="line.201"></a>
+<FONT color="green">202</FONT>         * @param x the value.<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @return the regularized gamma function Q(a, x)<a name="line.203"></a>
+<FONT color="green">204</FONT>         * @throws MathException if the algorithm fails to converge.<a name="line.204"></a>
+<FONT color="green">205</FONT>         */<a name="line.205"></a>
+<FONT color="green">206</FONT>        public static double regularizedGammaQ(double a, double x)<a name="line.206"></a>
+<FONT color="green">207</FONT>            throws MathException<a name="line.207"></a>
+<FONT color="green">208</FONT>        {<a name="line.208"></a>
+<FONT color="green">209</FONT>            return regularizedGammaQ(a, x, DEFAULT_EPSILON, Integer.MAX_VALUE);<a name="line.209"></a>
+<FONT color="green">210</FONT>        }<a name="line.210"></a>
+<FONT color="green">211</FONT>    <a name="line.211"></a>
+<FONT color="green">212</FONT>        /**<a name="line.212"></a>
+<FONT color="green">213</FONT>         * Returns the regularized gamma function Q(a, x) = 1 - P(a, x).<a name="line.213"></a>
+<FONT color="green">214</FONT>         *<a name="line.214"></a>
+<FONT color="green">215</FONT>         * The implementation of this method is based on:<a name="line.215"></a>
+<FONT color="green">216</FONT>         * &lt;ul&gt;<a name="line.216"></a>
+<FONT color="green">217</FONT>         * &lt;li&gt;<a name="line.217"></a>
+<FONT color="green">218</FONT>         * &lt;a href="http://mathworld.wolfram.com/RegularizedGammaFunction.html"&gt;<a name="line.218"></a>
+<FONT color="green">219</FONT>         * Regularized Gamma Function&lt;/a&gt;, equation (1).&lt;/li&gt;<a name="line.219"></a>
+<FONT color="green">220</FONT>         * &lt;li&gt;<a name="line.220"></a>
+<FONT color="green">221</FONT>         * &lt;a href="http://functions.wolfram.com/GammaBetaErf/GammaRegularized/10/0003/"&gt;<a name="line.221"></a>
+<FONT color="green">222</FONT>         * Regularized incomplete gamma function: Continued fraction representations  (formula 06.08.10.0003)&lt;/a&gt;&lt;/li&gt;<a name="line.222"></a>
+<FONT color="green">223</FONT>         * &lt;/ul&gt;<a name="line.223"></a>
+<FONT color="green">224</FONT>         *<a name="line.224"></a>
+<FONT color="green">225</FONT>         * @param a the a parameter.<a name="line.225"></a>
+<FONT color="green">226</FONT>         * @param x the value.<a name="line.226"></a>
+<FONT color="green">227</FONT>         * @param epsilon When the absolute value of the nth item in the<a name="line.227"></a>
+<FONT color="green">228</FONT>         *                series is less than epsilon the approximation ceases<a name="line.228"></a>
+<FONT color="green">229</FONT>         *                to calculate further elements in the series.<a name="line.229"></a>
+<FONT color="green">230</FONT>         * @param maxIterations Maximum number of "iterations" to complete.<a name="line.230"></a>
+<FONT color="green">231</FONT>         * @return the regularized gamma function P(a, x)<a name="line.231"></a>
+<FONT color="green">232</FONT>         * @throws MathException if the algorithm fails to converge.<a name="line.232"></a>
+<FONT color="green">233</FONT>         */<a name="line.233"></a>
+<FONT color="green">234</FONT>        public static double regularizedGammaQ(final double a,<a name="line.234"></a>
+<FONT color="green">235</FONT>                                               double x,<a name="line.235"></a>
+<FONT color="green">236</FONT>                                               double epsilon,<a name="line.236"></a>
+<FONT color="green">237</FONT>                                               int maxIterations)<a name="line.237"></a>
+<FONT color="green">238</FONT>            throws MathException<a name="line.238"></a>
+<FONT color="green">239</FONT>        {<a name="line.239"></a>
+<FONT color="green">240</FONT>            double ret;<a name="line.240"></a>
+<FONT color="green">241</FONT>    <a name="line.241"></a>
+<FONT color="green">242</FONT>            if (Double.isNaN(a) || Double.isNaN(x) || (a &lt;= 0.0) || (x &lt; 0.0)) {<a name="line.242"></a>
+<FONT color="green">243</FONT>                ret = Double.NaN;<a name="line.243"></a>
+<FONT color="green">244</FONT>            } else if (x == 0.0) {<a name="line.244"></a>
+<FONT color="green">245</FONT>                ret = 1.0;<a name="line.245"></a>
+<FONT color="green">246</FONT>            } else if (x &lt; a + 1.0) {<a name="line.246"></a>
+<FONT color="green">247</FONT>                // use regularizedGammaP because it should converge faster in this<a name="line.247"></a>
+<FONT color="green">248</FONT>                // case.<a name="line.248"></a>
+<FONT color="green">249</FONT>                ret = 1.0 - regularizedGammaP(a, x, epsilon, maxIterations);<a name="line.249"></a>
+<FONT color="green">250</FONT>            } else {<a name="line.250"></a>
+<FONT color="green">251</FONT>                // create continued fraction<a name="line.251"></a>
+<FONT color="green">252</FONT>                ContinuedFraction cf = new ContinuedFraction() {<a name="line.252"></a>
+<FONT color="green">253</FONT>    <a name="line.253"></a>
+<FONT color="green">254</FONT>                    @Override<a name="line.254"></a>
+<FONT color="green">255</FONT>                    protected double getA(int n, double x) {<a name="line.255"></a>
+<FONT color="green">256</FONT>                        return ((2.0 * n) + 1.0) - a + x;<a name="line.256"></a>
+<FONT color="green">257</FONT>                    }<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>                    @Override<a name="line.259"></a>
+<FONT color="green">260</FONT>                    protected double getB(int n, double x) {<a name="line.260"></a>
+<FONT color="green">261</FONT>                        return n * (a - n);<a name="line.261"></a>
+<FONT color="green">262</FONT>                    }<a name="line.262"></a>
+<FONT color="green">263</FONT>                };<a name="line.263"></a>
+<FONT color="green">264</FONT>    <a name="line.264"></a>
+<FONT color="green">265</FONT>                ret = 1.0 / cf.evaluate(x, epsilon, maxIterations);<a name="line.265"></a>
+<FONT color="green">266</FONT>                ret = Math.exp(-x + (a * Math.log(x)) - logGamma(a)) * ret;<a name="line.266"></a>
+<FONT color="green">267</FONT>            }<a name="line.267"></a>
+<FONT color="green">268</FONT>    <a name="line.268"></a>
+<FONT color="green">269</FONT>            return ret;<a name="line.269"></a>
+<FONT color="green">270</FONT>        }<a name="line.270"></a>
+<FONT color="green">271</FONT>    <a name="line.271"></a>
+<FONT color="green">272</FONT>    <a name="line.272"></a>
+<FONT color="green">273</FONT>        /**<a name="line.273"></a>
+<FONT color="green">274</FONT>         * &lt;p&gt;Computes the digamma function of x.&lt;/p&gt;<a name="line.274"></a>
+<FONT color="green">275</FONT>         *<a name="line.275"></a>
+<FONT color="green">276</FONT>         * &lt;p&gt;This is an independently written implementation of the algorithm described in<a name="line.276"></a>
+<FONT color="green">277</FONT>         * Jose Bernardo, Algorithm AS 103: Psi (Digamma) Function, Applied Statistics, 1976.&lt;/p&gt;<a name="line.277"></a>
+<FONT color="green">278</FONT>         *<a name="line.278"></a>
+<FONT color="green">279</FONT>         * &lt;p&gt;Some of the constants have been changed to increase accuracy at the moderate expense<a name="line.279"></a>
+<FONT color="green">280</FONT>         * of run-time.  The result should be accurate to within 10^-8 absolute tolerance for<a name="line.280"></a>
+<FONT color="green">281</FONT>         * x &gt;= 10^-5 and within 10^-8 relative tolerance for x &gt; 0.&lt;/p&gt;<a name="line.281"></a>
+<FONT color="green">282</FONT>         *<a name="line.282"></a>
+<FONT color="green">283</FONT>         * &lt;p&gt;Performance for large negative values of x will be quite expensive (proportional to<a name="line.283"></a>
+<FONT color="green">284</FONT>         * |x|).  Accuracy for negative values of x should be about 10^-8 absolute for results<a name="line.284"></a>
+<FONT color="green">285</FONT>         * less than 10^5 and 10^-8 relative for results larger than that.&lt;/p&gt;<a name="line.285"></a>
+<FONT color="green">286</FONT>         *<a name="line.286"></a>
+<FONT color="green">287</FONT>         * @param x  the argument<a name="line.287"></a>
+<FONT color="green">288</FONT>         * @return   digamma(x) to within 10-8 relative or absolute error whichever is smaller<a name="line.288"></a>
+<FONT color="green">289</FONT>         * @see &lt;a href="http://en.wikipedia.org/wiki/Digamma_function"&gt; Digamma at wikipedia &lt;/a&gt;<a name="line.289"></a>
+<FONT color="green">290</FONT>         * @see &lt;a href="http://www.uv.es/~bernardo/1976AppStatist.pdf"&gt; Bernardo's original article &lt;/a&gt;<a name="line.290"></a>
+<FONT color="green">291</FONT>         * @since 2.0<a name="line.291"></a>
+<FONT color="green">292</FONT>         */<a name="line.292"></a>
+<FONT color="green">293</FONT>        public static double digamma(double x) {<a name="line.293"></a>
+<FONT color="green">294</FONT>            if (x &gt; 0 &amp;&amp; x &lt;= S_LIMIT) {<a name="line.294"></a>
+<FONT color="green">295</FONT>                // use method 5 from Bernardo AS103<a name="line.295"></a>
+<FONT color="green">296</FONT>                // accurate to O(x)<a name="line.296"></a>
+<FONT color="green">297</FONT>                return -GAMMA - 1 / x;<a name="line.297"></a>
+<FONT color="green">298</FONT>            }<a name="line.298"></a>
+<FONT color="green">299</FONT>    <a name="line.299"></a>
+<FONT color="green">300</FONT>            if (x &gt;= C_LIMIT) {<a name="line.300"></a>
+<FONT color="green">301</FONT>                // use method 4 (accurate to O(1/x^8)<a name="line.301"></a>
+<FONT color="green">302</FONT>                double inv = 1 / (x * x);<a name="line.302"></a>
+<FONT color="green">303</FONT>                //            1       1        1         1<a name="line.303"></a>
+<FONT color="green">304</FONT>                // log(x) -  --- - ------ + ------- - -------<a name="line.304"></a>
+<FONT color="green">305</FONT>                //           2 x   12 x^2   120 x^4   252 x^6<a name="line.305"></a>
+<FONT color="green">306</FONT>                return Math.log(x) - 0.5 / x - inv * ((1.0 / 12) + inv * (1.0 / 120 - inv / 252));<a name="line.306"></a>
+<FONT color="green">307</FONT>            }<a name="line.307"></a>
+<FONT color="green">308</FONT>    <a name="line.308"></a>
+<FONT color="green">309</FONT>            return digamma(x + 1) - 1 / x;<a name="line.309"></a>
+<FONT color="green">310</FONT>        }<a name="line.310"></a>
+<FONT color="green">311</FONT>    <a name="line.311"></a>
+<FONT color="green">312</FONT>        /**<a name="line.312"></a>
+<FONT color="green">313</FONT>         * &lt;p&gt;Computes the trigamma function of x.  This function is derived by taking the derivative of<a name="line.313"></a>
+<FONT color="green">314</FONT>         * the implementation of digamma.&lt;/p&gt;<a name="line.314"></a>
+<FONT color="green">315</FONT>         *<a name="line.315"></a>
+<FONT color="green">316</FONT>         * @param x  the argument<a name="line.316"></a>
+<FONT color="green">317</FONT>         * @return   trigamma(x) to within 10-8 relative or absolute error whichever is smaller<a name="line.317"></a>
+<FONT color="green">318</FONT>         * @see &lt;a href="http://en.wikipedia.org/wiki/Trigamma_function"&gt; Trigamma at wikipedia &lt;/a&gt;<a name="line.318"></a>
+<FONT color="green">319</FONT>         * @see Gamma#digamma(double)<a name="line.319"></a>
+<FONT color="green">320</FONT>         * @since 2.0<a name="line.320"></a>
+<FONT color="green">321</FONT>         */<a name="line.321"></a>
+<FONT color="green">322</FONT>        public static double trigamma(double x) {<a name="line.322"></a>
+<FONT color="green">323</FONT>            if (x &gt; 0 &amp;&amp; x &lt;= S_LIMIT) {<a name="line.323"></a>
+<FONT color="green">324</FONT>                return 1 / (x * x);<a name="line.324"></a>
+<FONT color="green">325</FONT>            }<a name="line.325"></a>
+<FONT color="green">326</FONT>    <a name="line.326"></a>
+<FONT color="green">327</FONT>            if (x &gt;= C_LIMIT) {<a name="line.327"></a>
+<FONT color="green">328</FONT>                double inv = 1 / (x * x);<a name="line.328"></a>
+<FONT color="green">329</FONT>                //  1    1      1       1       1<a name="line.329"></a>
+<FONT color="green">330</FONT>                //  - + ---- + ---- - ----- + -----<a name="line.330"></a>
+<FONT color="green">331</FONT>                //  x      2      3       5       7<a name="line.331"></a>
+<FONT color="green">332</FONT>                //      2 x    6 x    30 x    42 x<a name="line.332"></a>
+<FONT color="green">333</FONT>                return 1 / x + inv / 2 + inv / x * (1.0 / 6 - inv * (1.0 / 30 + inv / 42));<a name="line.333"></a>
+<FONT color="green">334</FONT>            }<a name="line.334"></a>
+<FONT color="green">335</FONT>    <a name="line.335"></a>
+<FONT color="green">336</FONT>            return trigamma(x + 1) + 1 / (x * x);<a name="line.336"></a>
+<FONT color="green">337</FONT>        }<a name="line.337"></a>
+<FONT color="green">338</FONT>    }<a name="line.338"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/Frequency.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,658 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.text.NumberFormat;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.Iterator;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.util.Comparator;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.util.TreeMap;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    /**<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Maintains a frequency distribution.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * Accepts int, long, char or Comparable values.  New values added must be<a name="line.30"></a>
+<FONT color="green">031</FONT>     * comparable to those that have been added, otherwise the add method will<a name="line.31"></a>
+<FONT color="green">032</FONT>     * throw an IllegalArgumentException.&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * Integer values (int, long, Integer, Long) are not distinguished by type --<a name="line.34"></a>
+<FONT color="green">035</FONT>     * i.e. &lt;code&gt;addValue(Long.valueOf(2)), addValue(2), addValue(2l)&lt;/code&gt; all have<a name="line.35"></a>
+<FONT color="green">036</FONT>     * the same effect (similarly for arguments to &lt;code&gt;getCount,&lt;/code&gt; etc.).&lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * char values are converted by &lt;code&gt;addValue&lt;/code&gt; to Character instances.<a name="line.38"></a>
+<FONT color="green">039</FONT>     * As such, these values are not comparable to integral values, so attempts<a name="line.39"></a>
+<FONT color="green">040</FONT>     * to combine integral types with chars in a frequency distribution will fail.<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;/p&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;p&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     * The values are ordered using the default (natural order), unless a<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;code&gt;Comparator&lt;/code&gt; is supplied in the constructor.&lt;/p&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     *<a name="line.45"></a>
+<FONT color="green">046</FONT>     * @version $Revision: 922722 $ $Date: 2010-03-13 21:15:01 -0500 (Sat, 13 Mar 2010) $<a name="line.46"></a>
+<FONT color="green">047</FONT>     */<a name="line.47"></a>
+<FONT color="green">048</FONT>    public class Frequency implements Serializable {<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Serializable version identifier */<a name="line.50"></a>
+<FONT color="green">051</FONT>        private static final long serialVersionUID = -3845586908418844111L;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** underlying collection */<a name="line.53"></a>
+<FONT color="green">054</FONT>        private final TreeMap&lt;Comparable&lt;?&gt;, Long&gt; freqTable;<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /**<a name="line.56"></a>
+<FONT color="green">057</FONT>         * Default constructor.<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public Frequency() {<a name="line.59"></a>
+<FONT color="green">060</FONT>            freqTable = new TreeMap&lt;Comparable&lt;?&gt;, Long&gt;();<a name="line.60"></a>
+<FONT color="green">061</FONT>        }<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /**<a name="line.63"></a>
+<FONT color="green">064</FONT>         * Constructor allowing values Comparator to be specified.<a name="line.64"></a>
+<FONT color="green">065</FONT>         *<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @param comparator Comparator used to order values<a name="line.66"></a>
+<FONT color="green">067</FONT>         */<a name="line.67"></a>
+<FONT color="green">068</FONT>        @SuppressWarnings("unchecked") // TODO is the cast OK?<a name="line.68"></a>
+<FONT color="green">069</FONT>        public Frequency(Comparator&lt;?&gt; comparator) {<a name="line.69"></a>
+<FONT color="green">070</FONT>            freqTable = new TreeMap&lt;Comparable&lt;?&gt;, Long&gt;((Comparator&lt;? super Comparable&lt;?&gt;&gt;) comparator);<a name="line.70"></a>
+<FONT color="green">071</FONT>        }<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /**<a name="line.73"></a>
+<FONT color="green">074</FONT>         * Return a string representation of this frequency<a name="line.74"></a>
+<FONT color="green">075</FONT>         * distribution.<a name="line.75"></a>
+<FONT color="green">076</FONT>         *<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @return a string representation.<a name="line.77"></a>
+<FONT color="green">078</FONT>         */<a name="line.78"></a>
+<FONT color="green">079</FONT>        @Override<a name="line.79"></a>
+<FONT color="green">080</FONT>        public String toString() {<a name="line.80"></a>
+<FONT color="green">081</FONT>            NumberFormat nf = NumberFormat.getPercentInstance();<a name="line.81"></a>
+<FONT color="green">082</FONT>            StringBuffer outBuffer = new StringBuffer();<a name="line.82"></a>
+<FONT color="green">083</FONT>            outBuffer.append("Value \t Freq. \t Pct. \t Cum Pct. \n");<a name="line.83"></a>
+<FONT color="green">084</FONT>            Iterator&lt;Comparable&lt;?&gt;&gt; iter = freqTable.keySet().iterator();<a name="line.84"></a>
+<FONT color="green">085</FONT>            while (iter.hasNext()) {<a name="line.85"></a>
+<FONT color="green">086</FONT>                Comparable&lt;?&gt; value = iter.next();<a name="line.86"></a>
+<FONT color="green">087</FONT>                outBuffer.append(value);<a name="line.87"></a>
+<FONT color="green">088</FONT>                outBuffer.append('\t');<a name="line.88"></a>
+<FONT color="green">089</FONT>                outBuffer.append(getCount(value));<a name="line.89"></a>
+<FONT color="green">090</FONT>                outBuffer.append('\t');<a name="line.90"></a>
+<FONT color="green">091</FONT>                outBuffer.append(nf.format(getPct(value)));<a name="line.91"></a>
+<FONT color="green">092</FONT>                outBuffer.append('\t');<a name="line.92"></a>
+<FONT color="green">093</FONT>                outBuffer.append(nf.format(getCumPct(value)));<a name="line.93"></a>
+<FONT color="green">094</FONT>                outBuffer.append('\n');<a name="line.94"></a>
+<FONT color="green">095</FONT>            }<a name="line.95"></a>
+<FONT color="green">096</FONT>            return outBuffer.toString();<a name="line.96"></a>
+<FONT color="green">097</FONT>        }<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>        /**<a name="line.99"></a>
+<FONT color="green">100</FONT>         * Adds 1 to the frequency count for v.<a name="line.100"></a>
+<FONT color="green">101</FONT>         * &lt;p&gt;<a name="line.101"></a>
+<FONT color="green">102</FONT>         * If other objects have already been added to this Frequency, v must<a name="line.102"></a>
+<FONT color="green">103</FONT>         * be comparable to those that have already been added.<a name="line.103"></a>
+<FONT color="green">104</FONT>         * &lt;/p&gt;<a name="line.104"></a>
+<FONT color="green">105</FONT>         *<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @param v the value to add.<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @throws IllegalArgumentException if &lt;code&gt;v&lt;/code&gt; is not Comparable,<a name="line.107"></a>
+<FONT color="green">108</FONT>         *         or is not comparable with previous entries<a name="line.108"></a>
+<FONT color="green">109</FONT>         * @deprecated use {@link #addValue(Comparable)} instead<a name="line.109"></a>
+<FONT color="green">110</FONT>         */<a name="line.110"></a>
+<FONT color="green">111</FONT>        @Deprecated<a name="line.111"></a>
+<FONT color="green">112</FONT>        public void addValue(Object v) {<a name="line.112"></a>
+<FONT color="green">113</FONT>            if (v instanceof Comparable&lt;?&gt;){<a name="line.113"></a>
+<FONT color="green">114</FONT>                addValue((Comparable&lt;?&gt;) v);<a name="line.114"></a>
+<FONT color="green">115</FONT>            } else {<a name="line.115"></a>
+<FONT color="green">116</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.116"></a>
+<FONT color="green">117</FONT>                      "class ({0}) does not implement Comparable",<a name="line.117"></a>
+<FONT color="green">118</FONT>                      v.getClass().getName());<a name="line.118"></a>
+<FONT color="green">119</FONT>            }<a name="line.119"></a>
+<FONT color="green">120</FONT>        }<a name="line.120"></a>
+<FONT color="green">121</FONT>    <a name="line.121"></a>
+<FONT color="green">122</FONT>        /**<a name="line.122"></a>
+<FONT color="green">123</FONT>         * Adds 1 to the frequency count for v.<a name="line.123"></a>
+<FONT color="green">124</FONT>         * &lt;p&gt;<a name="line.124"></a>
+<FONT color="green">125</FONT>         * If other objects have already been added to this Frequency, v must<a name="line.125"></a>
+<FONT color="green">126</FONT>         * be comparable to those that have already been added.<a name="line.126"></a>
+<FONT color="green">127</FONT>         * &lt;/p&gt;<a name="line.127"></a>
+<FONT color="green">128</FONT>         *<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @param v the value to add.<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @throws IllegalArgumentException if &lt;code&gt;v&lt;/code&gt; is not comparable with previous entries<a name="line.130"></a>
+<FONT color="green">131</FONT>         */<a name="line.131"></a>
+<FONT color="green">132</FONT>        public void addValue(Comparable&lt;?&gt; v){<a name="line.132"></a>
+<FONT color="green">133</FONT>            Comparable&lt;?&gt; obj = v;<a name="line.133"></a>
+<FONT color="green">134</FONT>            if (v instanceof Integer) {<a name="line.134"></a>
+<FONT color="green">135</FONT>               obj = Long.valueOf(((Integer) v).longValue());<a name="line.135"></a>
+<FONT color="green">136</FONT>            }<a name="line.136"></a>
+<FONT color="green">137</FONT>            try {<a name="line.137"></a>
+<FONT color="green">138</FONT>                Long count = freqTable.get(obj);<a name="line.138"></a>
+<FONT color="green">139</FONT>                if (count == null) {<a name="line.139"></a>
+<FONT color="green">140</FONT>                    freqTable.put(obj, Long.valueOf(1));<a name="line.140"></a>
+<FONT color="green">141</FONT>                } else {<a name="line.141"></a>
+<FONT color="green">142</FONT>                    freqTable.put(obj, Long.valueOf(count.longValue() + 1));<a name="line.142"></a>
+<FONT color="green">143</FONT>                }<a name="line.143"></a>
+<FONT color="green">144</FONT>            } catch (ClassCastException ex) {<a name="line.144"></a>
+<FONT color="green">145</FONT>                //TreeMap will throw ClassCastException if v is not comparable<a name="line.145"></a>
+<FONT color="green">146</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.146"></a>
+<FONT color="green">147</FONT>                      "instance of class {0} not comparable to existing values",<a name="line.147"></a>
+<FONT color="green">148</FONT>                      v.getClass().getName());<a name="line.148"></a>
+<FONT color="green">149</FONT>            }<a name="line.149"></a>
+<FONT color="green">150</FONT>        }<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>        /**<a name="line.152"></a>
+<FONT color="green">153</FONT>         * Adds 1 to the frequency count for v.<a name="line.153"></a>
+<FONT color="green">154</FONT>         *<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @param v the value to add.<a name="line.155"></a>
+<FONT color="green">156</FONT>         */<a name="line.156"></a>
+<FONT color="green">157</FONT>        public void addValue(int v) {<a name="line.157"></a>
+<FONT color="green">158</FONT>            addValue(Long.valueOf(v));<a name="line.158"></a>
+<FONT color="green">159</FONT>        }<a name="line.159"></a>
+<FONT color="green">160</FONT>    <a name="line.160"></a>
+<FONT color="green">161</FONT>        /**<a name="line.161"></a>
+<FONT color="green">162</FONT>         * Adds 1 to the frequency count for v.<a name="line.162"></a>
+<FONT color="green">163</FONT>         *<a name="line.163"></a>
+<FONT color="green">164</FONT>         * @param v the value to add.<a name="line.164"></a>
+<FONT color="green">165</FONT>         * @deprecated to be removed in math 3.0<a name="line.165"></a>
+<FONT color="green">166</FONT>         */<a name="line.166"></a>
+<FONT color="green">167</FONT>        @Deprecated<a name="line.167"></a>
+<FONT color="green">168</FONT>        public void addValue(Integer v) {<a name="line.168"></a>
+<FONT color="green">169</FONT>            addValue(Long.valueOf(v.longValue()));<a name="line.169"></a>
+<FONT color="green">170</FONT>        }<a name="line.170"></a>
+<FONT color="green">171</FONT>    <a name="line.171"></a>
+<FONT color="green">172</FONT>        /**<a name="line.172"></a>
+<FONT color="green">173</FONT>         * Adds 1 to the frequency count for v.<a name="line.173"></a>
+<FONT color="green">174</FONT>         *<a name="line.174"></a>
+<FONT color="green">175</FONT>         * @param v the value to add.<a name="line.175"></a>
+<FONT color="green">176</FONT>         */<a name="line.176"></a>
+<FONT color="green">177</FONT>        public void addValue(long v) {<a name="line.177"></a>
+<FONT color="green">178</FONT>            addValue(Long.valueOf(v));<a name="line.178"></a>
+<FONT color="green">179</FONT>        }<a name="line.179"></a>
+<FONT color="green">180</FONT>    <a name="line.180"></a>
+<FONT color="green">181</FONT>        /**<a name="line.181"></a>
+<FONT color="green">182</FONT>         * Adds 1 to the frequency count for v.<a name="line.182"></a>
+<FONT color="green">183</FONT>         *<a name="line.183"></a>
+<FONT color="green">184</FONT>         * @param v the value to add.<a name="line.184"></a>
+<FONT color="green">185</FONT>         */<a name="line.185"></a>
+<FONT color="green">186</FONT>        public void addValue(char v) {<a name="line.186"></a>
+<FONT color="green">187</FONT>            addValue(Character.valueOf(v));<a name="line.187"></a>
+<FONT color="green">188</FONT>        }<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>        /** Clears the frequency table */<a name="line.190"></a>
+<FONT color="green">191</FONT>        public void clear() {<a name="line.191"></a>
+<FONT color="green">192</FONT>            freqTable.clear();<a name="line.192"></a>
+<FONT color="green">193</FONT>        }<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>        /**<a name="line.195"></a>
+<FONT color="green">196</FONT>         * Returns an Iterator over the set of values that have been added.<a name="line.196"></a>
+<FONT color="green">197</FONT>         * &lt;p&gt;<a name="line.197"></a>
+<FONT color="green">198</FONT>         * If added values are integral (i.e., integers, longs, Integers, or Longs),<a name="line.198"></a>
+<FONT color="green">199</FONT>         * they are converted to Longs when they are added, so the objects returned<a name="line.199"></a>
+<FONT color="green">200</FONT>         * by the Iterator will in this case be Longs.&lt;/p&gt;<a name="line.200"></a>
+<FONT color="green">201</FONT>         *<a name="line.201"></a>
+<FONT color="green">202</FONT>         * @return values Iterator<a name="line.202"></a>
+<FONT color="green">203</FONT>         */<a name="line.203"></a>
+<FONT color="green">204</FONT>        public Iterator&lt;Comparable&lt;?&gt;&gt; valuesIterator() {<a name="line.204"></a>
+<FONT color="green">205</FONT>            return freqTable.keySet().iterator();<a name="line.205"></a>
+<FONT color="green">206</FONT>        }<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>        //-------------------------------------------------------------------------<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>        /**<a name="line.210"></a>
+<FONT color="green">211</FONT>         * Returns the sum of all frequencies.<a name="line.211"></a>
+<FONT color="green">212</FONT>         *<a name="line.212"></a>
+<FONT color="green">213</FONT>         * @return the total frequency count.<a name="line.213"></a>
+<FONT color="green">214</FONT>         */<a name="line.214"></a>
+<FONT color="green">215</FONT>        public long getSumFreq() {<a name="line.215"></a>
+<FONT color="green">216</FONT>            long result = 0;<a name="line.216"></a>
+<FONT color="green">217</FONT>            Iterator&lt;Long&gt; iterator = freqTable.values().iterator();<a name="line.217"></a>
+<FONT color="green">218</FONT>            while (iterator.hasNext())  {<a name="line.218"></a>
+<FONT color="green">219</FONT>                result += iterator.next().longValue();<a name="line.219"></a>
+<FONT color="green">220</FONT>            }<a name="line.220"></a>
+<FONT color="green">221</FONT>            return result;<a name="line.221"></a>
+<FONT color="green">222</FONT>        }<a name="line.222"></a>
+<FONT color="green">223</FONT>    <a name="line.223"></a>
+<FONT color="green">224</FONT>        /**<a name="line.224"></a>
+<FONT color="green">225</FONT>         * Returns the number of values = v.<a name="line.225"></a>
+<FONT color="green">226</FONT>         * Returns 0 if the value is not comparable.<a name="line.226"></a>
+<FONT color="green">227</FONT>         *<a name="line.227"></a>
+<FONT color="green">228</FONT>         * @param v the value to lookup.<a name="line.228"></a>
+<FONT color="green">229</FONT>         * @return the frequency of v.<a name="line.229"></a>
+<FONT color="green">230</FONT>         * @deprecated replaced by {@link #getCount(Comparable)} as of 2.0<a name="line.230"></a>
+<FONT color="green">231</FONT>         */<a name="line.231"></a>
+<FONT color="green">232</FONT>        @Deprecated<a name="line.232"></a>
+<FONT color="green">233</FONT>        public long getCount(Object v) {<a name="line.233"></a>
+<FONT color="green">234</FONT>            return getCount((Comparable&lt;?&gt;) v);<a name="line.234"></a>
+<FONT color="green">235</FONT>        }<a name="line.235"></a>
+<FONT color="green">236</FONT>    <a name="line.236"></a>
+<FONT color="green">237</FONT>        /**<a name="line.237"></a>
+<FONT color="green">238</FONT>         * Returns the number of values = v.<a name="line.238"></a>
+<FONT color="green">239</FONT>         * Returns 0 if the value is not comparable.<a name="line.239"></a>
+<FONT color="green">240</FONT>         *<a name="line.240"></a>
+<FONT color="green">241</FONT>         * @param v the value to lookup.<a name="line.241"></a>
+<FONT color="green">242</FONT>         * @return the frequency of v.<a name="line.242"></a>
+<FONT color="green">243</FONT>         */<a name="line.243"></a>
+<FONT color="green">244</FONT>        public long getCount(Comparable&lt;?&gt; v) {<a name="line.244"></a>
+<FONT color="green">245</FONT>            if (v instanceof Integer) {<a name="line.245"></a>
+<FONT color="green">246</FONT>                return getCount(((Integer) v).longValue());<a name="line.246"></a>
+<FONT color="green">247</FONT>            }<a name="line.247"></a>
+<FONT color="green">248</FONT>            long result = 0;<a name="line.248"></a>
+<FONT color="green">249</FONT>            try {<a name="line.249"></a>
+<FONT color="green">250</FONT>                Long count =  freqTable.get(v);<a name="line.250"></a>
+<FONT color="green">251</FONT>                if (count != null) {<a name="line.251"></a>
+<FONT color="green">252</FONT>                    result = count.longValue();<a name="line.252"></a>
+<FONT color="green">253</FONT>                }<a name="line.253"></a>
+<FONT color="green">254</FONT>            } catch (ClassCastException ex) {<a name="line.254"></a>
+<FONT color="green">255</FONT>                // ignore and return 0 -- ClassCastException will be thrown if value is not comparable<a name="line.255"></a>
+<FONT color="green">256</FONT>            }<a name="line.256"></a>
+<FONT color="green">257</FONT>            return result;<a name="line.257"></a>
+<FONT color="green">258</FONT>        }<a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>        /**<a name="line.260"></a>
+<FONT color="green">261</FONT>         * Returns the number of values = v.<a name="line.261"></a>
+<FONT color="green">262</FONT>         *<a name="line.262"></a>
+<FONT color="green">263</FONT>         * @param v the value to lookup.<a name="line.263"></a>
+<FONT color="green">264</FONT>         * @return the frequency of v.<a name="line.264"></a>
+<FONT color="green">265</FONT>         */<a name="line.265"></a>
+<FONT color="green">266</FONT>        public long getCount(int v) {<a name="line.266"></a>
+<FONT color="green">267</FONT>            return getCount(Long.valueOf(v));<a name="line.267"></a>
+<FONT color="green">268</FONT>        }<a name="line.268"></a>
+<FONT color="green">269</FONT>    <a name="line.269"></a>
+<FONT color="green">270</FONT>        /**<a name="line.270"></a>
+<FONT color="green">271</FONT>         * Returns the number of values = v.<a name="line.271"></a>
+<FONT color="green">272</FONT>         *<a name="line.272"></a>
+<FONT color="green">273</FONT>         * @param v the value to lookup.<a name="line.273"></a>
+<FONT color="green">274</FONT>         * @return the frequency of v.<a name="line.274"></a>
+<FONT color="green">275</FONT>         */<a name="line.275"></a>
+<FONT color="green">276</FONT>        public long getCount(long v) {<a name="line.276"></a>
+<FONT color="green">277</FONT>            return getCount(Long.valueOf(v));<a name="line.277"></a>
+<FONT color="green">278</FONT>        }<a name="line.278"></a>
+<FONT color="green">279</FONT>    <a name="line.279"></a>
+<FONT color="green">280</FONT>        /**<a name="line.280"></a>
+<FONT color="green">281</FONT>         * Returns the number of values = v.<a name="line.281"></a>
+<FONT color="green">282</FONT>         *<a name="line.282"></a>
+<FONT color="green">283</FONT>         * @param v the value to lookup.<a name="line.283"></a>
+<FONT color="green">284</FONT>         * @return the frequency of v.<a name="line.284"></a>
+<FONT color="green">285</FONT>         */<a name="line.285"></a>
+<FONT color="green">286</FONT>        public long getCount(char v) {<a name="line.286"></a>
+<FONT color="green">287</FONT>            return getCount(Character.valueOf(v));<a name="line.287"></a>
+<FONT color="green">288</FONT>        }<a name="line.288"></a>
+<FONT color="green">289</FONT>    <a name="line.289"></a>
+<FONT color="green">290</FONT>        //-------------------------------------------------------------<a name="line.290"></a>
+<FONT color="green">291</FONT>    <a name="line.291"></a>
+<FONT color="green">292</FONT>        /**<a name="line.292"></a>
+<FONT color="green">293</FONT>          * Returns the percentage of values that are equal to v<a name="line.293"></a>
+<FONT color="green">294</FONT>         * (as a proportion between 0 and 1).<a name="line.294"></a>
+<FONT color="green">295</FONT>         * &lt;p&gt;<a name="line.295"></a>
+<FONT color="green">296</FONT>         * Returns &lt;code&gt;Double.NaN&lt;/code&gt; if no values have been added.&lt;/p&gt;<a name="line.296"></a>
+<FONT color="green">297</FONT>         *<a name="line.297"></a>
+<FONT color="green">298</FONT>         * @param v the value to lookup<a name="line.298"></a>
+<FONT color="green">299</FONT>         * @return the proportion of values equal to v<a name="line.299"></a>
+<FONT color="green">300</FONT>         * @deprecated replaced by {@link #getPct(Comparable)} as of 2.0<a name="line.300"></a>
+<FONT color="green">301</FONT>         */<a name="line.301"></a>
+<FONT color="green">302</FONT>        @Deprecated<a name="line.302"></a>
+<FONT color="green">303</FONT>        public double getPct(Object v) {<a name="line.303"></a>
+<FONT color="green">304</FONT>            return getPct((Comparable&lt;?&gt;) v);<a name="line.304"></a>
+<FONT color="green">305</FONT>        }<a name="line.305"></a>
+<FONT color="green">306</FONT>    <a name="line.306"></a>
+<FONT color="green">307</FONT>        /**<a name="line.307"></a>
+<FONT color="green">308</FONT>         * Returns the percentage of values that are equal to v<a name="line.308"></a>
+<FONT color="green">309</FONT>         * (as a proportion between 0 and 1).<a name="line.309"></a>
+<FONT color="green">310</FONT>         * &lt;p&gt;<a name="line.310"></a>
+<FONT color="green">311</FONT>         * Returns &lt;code&gt;Double.NaN&lt;/code&gt; if no values have been added.&lt;/p&gt;<a name="line.311"></a>
+<FONT color="green">312</FONT>         *<a name="line.312"></a>
+<FONT color="green">313</FONT>         * @param v the value to lookup<a name="line.313"></a>
+<FONT color="green">314</FONT>         * @return the proportion of values equal to v<a name="line.314"></a>
+<FONT color="green">315</FONT>         */<a name="line.315"></a>
+<FONT color="green">316</FONT>        public double getPct(Comparable&lt;?&gt; v) {<a name="line.316"></a>
+<FONT color="green">317</FONT>            final long sumFreq = getSumFreq();<a name="line.317"></a>
+<FONT color="green">318</FONT>            if (sumFreq == 0) {<a name="line.318"></a>
+<FONT color="green">319</FONT>                return Double.NaN;<a name="line.319"></a>
+<FONT color="green">320</FONT>            }<a name="line.320"></a>
+<FONT color="green">321</FONT>            return (double) getCount(v) / (double) sumFreq;<a name="line.321"></a>
+<FONT color="green">322</FONT>        }<a name="line.322"></a>
+<FONT color="green">323</FONT>    <a name="line.323"></a>
+<FONT color="green">324</FONT>        /**<a name="line.324"></a>
+<FONT color="green">325</FONT>         * Returns the percentage of values that are equal to v<a name="line.325"></a>
+<FONT color="green">326</FONT>         * (as a proportion between 0 and 1).<a name="line.326"></a>
+<FONT color="green">327</FONT>         *<a name="line.327"></a>
+<FONT color="green">328</FONT>         * @param v the value to lookup<a name="line.328"></a>
+<FONT color="green">329</FONT>         * @return the proportion of values equal to v<a name="line.329"></a>
+<FONT color="green">330</FONT>         */<a name="line.330"></a>
+<FONT color="green">331</FONT>        public double getPct(int v) {<a name="line.331"></a>
+<FONT color="green">332</FONT>            return getPct(Long.valueOf(v));<a name="line.332"></a>
+<FONT color="green">333</FONT>        }<a name="line.333"></a>
+<FONT color="green">334</FONT>    <a name="line.334"></a>
+<FONT color="green">335</FONT>        /**<a name="line.335"></a>
+<FONT color="green">336</FONT>         * Returns the percentage of values that are equal to v<a name="line.336"></a>
+<FONT color="green">337</FONT>         * (as a proportion between 0 and 1).<a name="line.337"></a>
+<FONT color="green">338</FONT>         *<a name="line.338"></a>
+<FONT color="green">339</FONT>         * @param v the value to lookup<a name="line.339"></a>
+<FONT color="green">340</FONT>         * @return the proportion of values equal to v<a name="line.340"></a>
+<FONT color="green">341</FONT>         */<a name="line.341"></a>
+<FONT color="green">342</FONT>        public double getPct(long v) {<a name="line.342"></a>
+<FONT color="green">343</FONT>            return getPct(Long.valueOf(v));<a name="line.343"></a>
+<FONT color="green">344</FONT>        }<a name="line.344"></a>
+<FONT color="green">345</FONT>    <a name="line.345"></a>
+<FONT color="green">346</FONT>        /**<a name="line.346"></a>
+<FONT color="green">347</FONT>         * Returns the percentage of values that are equal to v<a name="line.347"></a>
+<FONT color="green">348</FONT>         * (as a proportion between 0 and 1).<a name="line.348"></a>
+<FONT color="green">349</FONT>         *<a name="line.349"></a>
+<FONT color="green">350</FONT>         * @param v the value to lookup<a name="line.350"></a>
+<FONT color="green">351</FONT>         * @return the proportion of values equal to v<a name="line.351"></a>
+<FONT color="green">352</FONT>         */<a name="line.352"></a>
+<FONT color="green">353</FONT>        public double getPct(char v) {<a name="line.353"></a>
+<FONT color="green">354</FONT>            return getPct(Character.valueOf(v));<a name="line.354"></a>
+<FONT color="green">355</FONT>        }<a name="line.355"></a>
+<FONT color="green">356</FONT>    <a name="line.356"></a>
+<FONT color="green">357</FONT>        //-----------------------------------------------------------------------------------------<a name="line.357"></a>
+<FONT color="green">358</FONT>    <a name="line.358"></a>
+<FONT color="green">359</FONT>        /**<a name="line.359"></a>
+<FONT color="green">360</FONT>         * Returns the cumulative frequency of values less than or equal to v.<a name="line.360"></a>
+<FONT color="green">361</FONT>         * &lt;p&gt;<a name="line.361"></a>
+<FONT color="green">362</FONT>         * Returns 0 if v is not comparable to the values set.&lt;/p&gt;<a name="line.362"></a>
+<FONT color="green">363</FONT>         *<a name="line.363"></a>
+<FONT color="green">364</FONT>         * @param v the value to lookup.<a name="line.364"></a>
+<FONT color="green">365</FONT>         * @return the proportion of values equal to v<a name="line.365"></a>
+<FONT color="green">366</FONT>         * @deprecated replaced by {@link #getCumFreq(Comparable)} as of 2.0<a name="line.366"></a>
+<FONT color="green">367</FONT>         */<a name="line.367"></a>
+<FONT color="green">368</FONT>        @Deprecated<a name="line.368"></a>
+<FONT color="green">369</FONT>        public long getCumFreq(Object v) {<a name="line.369"></a>
+<FONT color="green">370</FONT>            return getCumFreq((Comparable&lt;?&gt;) v);<a name="line.370"></a>
+<FONT color="green">371</FONT>        }<a name="line.371"></a>
+<FONT color="green">372</FONT>    <a name="line.372"></a>
+<FONT color="green">373</FONT>        /**<a name="line.373"></a>
+<FONT color="green">374</FONT>         * Returns the cumulative frequency of values less than or equal to v.<a name="line.374"></a>
+<FONT color="green">375</FONT>         * &lt;p&gt;<a name="line.375"></a>
+<FONT color="green">376</FONT>         * Returns 0 if v is not comparable to the values set.&lt;/p&gt;<a name="line.376"></a>
+<FONT color="green">377</FONT>         *<a name="line.377"></a>
+<FONT color="green">378</FONT>         * @param v the value to lookup.<a name="line.378"></a>
+<FONT color="green">379</FONT>         * @return the proportion of values equal to v<a name="line.379"></a>
+<FONT color="green">380</FONT>         */<a name="line.380"></a>
+<FONT color="green">381</FONT>        public long getCumFreq(Comparable&lt;?&gt; v) {<a name="line.381"></a>
+<FONT color="green">382</FONT>            if (getSumFreq() == 0) {<a name="line.382"></a>
+<FONT color="green">383</FONT>                return 0;<a name="line.383"></a>
+<FONT color="green">384</FONT>            }<a name="line.384"></a>
+<FONT color="green">385</FONT>            if (v instanceof Integer) {<a name="line.385"></a>
+<FONT color="green">386</FONT>                return getCumFreq(((Integer) v).longValue());<a name="line.386"></a>
+<FONT color="green">387</FONT>            }<a name="line.387"></a>
+<FONT color="green">388</FONT>            @SuppressWarnings("unchecked") // OK, freqTable is Comparable&lt;?&gt;<a name="line.388"></a>
+<FONT color="green">389</FONT>            Comparator&lt;Comparable&lt;?&gt;&gt; c = (Comparator&lt;Comparable&lt;?&gt;&gt;) freqTable.comparator();<a name="line.389"></a>
+<FONT color="green">390</FONT>            if (c == null) {<a name="line.390"></a>
+<FONT color="green">391</FONT>                c = new NaturalComparator();<a name="line.391"></a>
+<FONT color="green">392</FONT>            }<a name="line.392"></a>
+<FONT color="green">393</FONT>            long result = 0;<a name="line.393"></a>
+<FONT color="green">394</FONT>    <a name="line.394"></a>
+<FONT color="green">395</FONT>            try {<a name="line.395"></a>
+<FONT color="green">396</FONT>                Long value = freqTable.get(v);<a name="line.396"></a>
+<FONT color="green">397</FONT>                if (value != null) {<a name="line.397"></a>
+<FONT color="green">398</FONT>                    result = value.longValue();<a name="line.398"></a>
+<FONT color="green">399</FONT>                }<a name="line.399"></a>
+<FONT color="green">400</FONT>            } catch (ClassCastException ex) {<a name="line.400"></a>
+<FONT color="green">401</FONT>                return result;   // v is not comparable<a name="line.401"></a>
+<FONT color="green">402</FONT>            }<a name="line.402"></a>
+<FONT color="green">403</FONT>    <a name="line.403"></a>
+<FONT color="green">404</FONT>            if (c.compare(v, freqTable.firstKey()) &lt; 0) {<a name="line.404"></a>
+<FONT color="green">405</FONT>                return 0;  // v is comparable, but less than first value<a name="line.405"></a>
+<FONT color="green">406</FONT>            }<a name="line.406"></a>
+<FONT color="green">407</FONT>    <a name="line.407"></a>
+<FONT color="green">408</FONT>            if (c.compare(v, freqTable.lastKey()) &gt;= 0) {<a name="line.408"></a>
+<FONT color="green">409</FONT>                return getSumFreq();    // v is comparable, but greater than the last value<a name="line.409"></a>
+<FONT color="green">410</FONT>            }<a name="line.410"></a>
+<FONT color="green">411</FONT>    <a name="line.411"></a>
+<FONT color="green">412</FONT>            Iterator&lt;Comparable&lt;?&gt;&gt; values = valuesIterator();<a name="line.412"></a>
+<FONT color="green">413</FONT>            while (values.hasNext()) {<a name="line.413"></a>
+<FONT color="green">414</FONT>                Comparable&lt;?&gt; nextValue = values.next();<a name="line.414"></a>
+<FONT color="green">415</FONT>                if (c.compare(v, nextValue) &gt; 0) {<a name="line.415"></a>
+<FONT color="green">416</FONT>                    result += getCount(nextValue);<a name="line.416"></a>
+<FONT color="green">417</FONT>                } else {<a name="line.417"></a>
+<FONT color="green">418</FONT>                    return result;<a name="line.418"></a>
+<FONT color="green">419</FONT>                }<a name="line.419"></a>
+<FONT color="green">420</FONT>            }<a name="line.420"></a>
+<FONT color="green">421</FONT>            return result;<a name="line.421"></a>
+<FONT color="green">422</FONT>        }<a name="line.422"></a>
+<FONT color="green">423</FONT>    <a name="line.423"></a>
+<FONT color="green">424</FONT>         /**<a name="line.424"></a>
+<FONT color="green">425</FONT>         * Returns the cumulative frequency of values less than or equal to v.<a name="line.425"></a>
+<FONT color="green">426</FONT>         * &lt;p&gt;<a name="line.426"></a>
+<FONT color="green">427</FONT>         * Returns 0 if v is not comparable to the values set.&lt;/p&gt;<a name="line.427"></a>
+<FONT color="green">428</FONT>         *<a name="line.428"></a>
+<FONT color="green">429</FONT>         * @param v the value to lookup<a name="line.429"></a>
+<FONT color="green">430</FONT>         * @return the proportion of values equal to v<a name="line.430"></a>
+<FONT color="green">431</FONT>         */<a name="line.431"></a>
+<FONT color="green">432</FONT>        public long getCumFreq(int v) {<a name="line.432"></a>
+<FONT color="green">433</FONT>            return getCumFreq(Long.valueOf(v));<a name="line.433"></a>
+<FONT color="green">434</FONT>        }<a name="line.434"></a>
+<FONT color="green">435</FONT>    <a name="line.435"></a>
+<FONT color="green">436</FONT>         /**<a name="line.436"></a>
+<FONT color="green">437</FONT>         * Returns the cumulative frequency of values less than or equal to v.<a name="line.437"></a>
+<FONT color="green">438</FONT>         * &lt;p&gt;<a name="line.438"></a>
+<FONT color="green">439</FONT>         * Returns 0 if v is not comparable to the values set.&lt;/p&gt;<a name="line.439"></a>
+<FONT color="green">440</FONT>         *<a name="line.440"></a>
+<FONT color="green">441</FONT>         * @param v the value to lookup<a name="line.441"></a>
+<FONT color="green">442</FONT>         * @return the proportion of values equal to v<a name="line.442"></a>
+<FONT color="green">443</FONT>         */<a name="line.443"></a>
+<FONT color="green">444</FONT>        public long getCumFreq(long v) {<a name="line.444"></a>
+<FONT color="green">445</FONT>            return getCumFreq(Long.valueOf(v));<a name="line.445"></a>
+<FONT color="green">446</FONT>        }<a name="line.446"></a>
+<FONT color="green">447</FONT>    <a name="line.447"></a>
+<FONT color="green">448</FONT>        /**<a name="line.448"></a>
+<FONT color="green">449</FONT>         * Returns the cumulative frequency of values less than or equal to v.<a name="line.449"></a>
+<FONT color="green">450</FONT>         * &lt;p&gt;<a name="line.450"></a>
+<FONT color="green">451</FONT>         * Returns 0 if v is not comparable to the values set.&lt;/p&gt;<a name="line.451"></a>
+<FONT color="green">452</FONT>         *<a name="line.452"></a>
+<FONT color="green">453</FONT>         * @param v the value to lookup<a name="line.453"></a>
+<FONT color="green">454</FONT>         * @return the proportion of values equal to v<a name="line.454"></a>
+<FONT color="green">455</FONT>         */<a name="line.455"></a>
+<FONT color="green">456</FONT>        public long getCumFreq(char v) {<a name="line.456"></a>
+<FONT color="green">457</FONT>            return getCumFreq(Character.valueOf(v));<a name="line.457"></a>
+<FONT color="green">458</FONT>        }<a name="line.458"></a>
+<FONT color="green">459</FONT>    <a name="line.459"></a>
+<FONT color="green">460</FONT>        //----------------------------------------------------------------------------------------------<a name="line.460"></a>
+<FONT color="green">461</FONT>    <a name="line.461"></a>
+<FONT color="green">462</FONT>        /**<a name="line.462"></a>
+<FONT color="green">463</FONT>         * Returns the cumulative percentage of values less than or equal to v<a name="line.463"></a>
+<FONT color="green">464</FONT>         * (as a proportion between 0 and 1).<a name="line.464"></a>
+<FONT color="green">465</FONT>         * &lt;p&gt;<a name="line.465"></a>
+<FONT color="green">466</FONT>         * Returns &lt;code&gt;Double.NaN&lt;/code&gt; if no values have been added.<a name="line.466"></a>
+<FONT color="green">467</FONT>         * Returns 0 if at least one value has been added, but v is not comparable<a name="line.467"></a>
+<FONT color="green">468</FONT>         * to the values set.&lt;/p&gt;<a name="line.468"></a>
+<FONT color="green">469</FONT>         *<a name="line.469"></a>
+<FONT color="green">470</FONT>         * @param v the value to lookup<a name="line.470"></a>
+<FONT color="green">471</FONT>         * @return the proportion of values less than or equal to v<a name="line.471"></a>
+<FONT color="green">472</FONT>         * @deprecated replaced by {@link #getCumPct(Comparable)} as of 2.0<a name="line.472"></a>
+<FONT color="green">473</FONT>         */<a name="line.473"></a>
+<FONT color="green">474</FONT>        @Deprecated<a name="line.474"></a>
+<FONT color="green">475</FONT>        public double getCumPct(Object v) {<a name="line.475"></a>
+<FONT color="green">476</FONT>            return getCumPct((Comparable&lt;?&gt;) v);<a name="line.476"></a>
+<FONT color="green">477</FONT>    <a name="line.477"></a>
+<FONT color="green">478</FONT>        }<a name="line.478"></a>
+<FONT color="green">479</FONT>    <a name="line.479"></a>
+<FONT color="green">480</FONT>        /**<a name="line.480"></a>
+<FONT color="green">481</FONT>         * Returns the cumulative percentage of values less than or equal to v<a name="line.481"></a>
+<FONT color="green">482</FONT>         * (as a proportion between 0 and 1).<a name="line.482"></a>
+<FONT color="green">483</FONT>         * &lt;p&gt;<a name="line.483"></a>
+<FONT color="green">484</FONT>         * Returns &lt;code&gt;Double.NaN&lt;/code&gt; if no values have been added.<a name="line.484"></a>
+<FONT color="green">485</FONT>         * Returns 0 if at least one value has been added, but v is not comparable<a name="line.485"></a>
+<FONT color="green">486</FONT>         * to the values set.&lt;/p&gt;<a name="line.486"></a>
+<FONT color="green">487</FONT>         *<a name="line.487"></a>
+<FONT color="green">488</FONT>         * @param v the value to lookup<a name="line.488"></a>
+<FONT color="green">489</FONT>         * @return the proportion of values less than or equal to v<a name="line.489"></a>
+<FONT color="green">490</FONT>         */<a name="line.490"></a>
+<FONT color="green">491</FONT>        public double getCumPct(Comparable&lt;?&gt; v) {<a name="line.491"></a>
+<FONT color="green">492</FONT>            final long sumFreq = getSumFreq();<a name="line.492"></a>
+<FONT color="green">493</FONT>            if (sumFreq == 0) {<a name="line.493"></a>
+<FONT color="green">494</FONT>                return Double.NaN;<a name="line.494"></a>
+<FONT color="green">495</FONT>            }<a name="line.495"></a>
+<FONT color="green">496</FONT>            return (double) getCumFreq(v) / (double) sumFreq;<a name="line.496"></a>
+<FONT color="green">497</FONT>        }<a name="line.497"></a>
+<FONT color="green">498</FONT>    <a name="line.498"></a>
+<FONT color="green">499</FONT>        /**<a name="line.499"></a>
+<FONT color="green">500</FONT>         * Returns the cumulative percentage of values less than or equal to v<a name="line.500"></a>
+<FONT color="green">501</FONT>         * (as a proportion between 0 and 1).<a name="line.501"></a>
+<FONT color="green">502</FONT>         * &lt;p&gt;<a name="line.502"></a>
+<FONT color="green">503</FONT>         * Returns 0 if v is not comparable to the values set.&lt;/p&gt;<a name="line.503"></a>
+<FONT color="green">504</FONT>         *<a name="line.504"></a>
+<FONT color="green">505</FONT>         * @param v the value to lookup<a name="line.505"></a>
+<FONT color="green">506</FONT>         * @return the proportion of values less than or equal to v<a name="line.506"></a>
+<FONT color="green">507</FONT>         */<a name="line.507"></a>
+<FONT color="green">508</FONT>        public double getCumPct(int v) {<a name="line.508"></a>
+<FONT color="green">509</FONT>            return getCumPct(Long.valueOf(v));<a name="line.509"></a>
+<FONT color="green">510</FONT>        }<a name="line.510"></a>
+<FONT color="green">511</FONT>    <a name="line.511"></a>
+<FONT color="green">512</FONT>        /**<a name="line.512"></a>
+<FONT color="green">513</FONT>         * Returns the cumulative percentage of values less than or equal to v<a name="line.513"></a>
+<FONT color="green">514</FONT>         * (as a proportion between 0 and 1).<a name="line.514"></a>
+<FONT color="green">515</FONT>         * &lt;p&gt;<a name="line.515"></a>
+<FONT color="green">516</FONT>         * Returns 0 if v is not comparable to the values set.&lt;/p&gt;<a name="line.516"></a>
+<FONT color="green">517</FONT>         *<a name="line.517"></a>
+<FONT color="green">518</FONT>         * @param v the value to lookup<a name="line.518"></a>
+<FONT color="green">519</FONT>         * @return the proportion of values less than or equal to v<a name="line.519"></a>
+<FONT color="green">520</FONT>         */<a name="line.520"></a>
+<FONT color="green">521</FONT>        public double getCumPct(long v) {<a name="line.521"></a>
+<FONT color="green">522</FONT>            return getCumPct(Long.valueOf(v));<a name="line.522"></a>
+<FONT color="green">523</FONT>        }<a name="line.523"></a>
+<FONT color="green">524</FONT>    <a name="line.524"></a>
+<FONT color="green">525</FONT>        /**<a name="line.525"></a>
+<FONT color="green">526</FONT>         * Returns the cumulative percentage of values less than or equal to v<a name="line.526"></a>
+<FONT color="green">527</FONT>         * (as a proportion between 0 and 1).<a name="line.527"></a>
+<FONT color="green">528</FONT>         * &lt;p&gt;<a name="line.528"></a>
+<FONT color="green">529</FONT>         * Returns 0 if v is not comparable to the values set.&lt;/p&gt;<a name="line.529"></a>
+<FONT color="green">530</FONT>         *<a name="line.530"></a>
+<FONT color="green">531</FONT>         * @param v the value to lookup<a name="line.531"></a>
+<FONT color="green">532</FONT>         * @return the proportion of values less than or equal to v<a name="line.532"></a>
+<FONT color="green">533</FONT>         */<a name="line.533"></a>
+<FONT color="green">534</FONT>        public double getCumPct(char v) {<a name="line.534"></a>
+<FONT color="green">535</FONT>            return getCumPct(Character.valueOf(v));<a name="line.535"></a>
+<FONT color="green">536</FONT>        }<a name="line.536"></a>
+<FONT color="green">537</FONT>    <a name="line.537"></a>
+<FONT color="green">538</FONT>        /**<a name="line.538"></a>
+<FONT color="green">539</FONT>         * A Comparator that compares comparable objects using the<a name="line.539"></a>
+<FONT color="green">540</FONT>         * natural order.  Copied from Commons Collections ComparableComparator.<a name="line.540"></a>
+<FONT color="green">541</FONT>         */<a name="line.541"></a>
+<FONT color="green">542</FONT>        private static class NaturalComparator&lt;T extends Comparable&lt;T&gt;&gt; implements Comparator&lt;Comparable&lt;T&gt;&gt;, Serializable {<a name="line.542"></a>
+<FONT color="green">543</FONT>    <a name="line.543"></a>
+<FONT color="green">544</FONT>            /** Serializable version identifier */<a name="line.544"></a>
+<FONT color="green">545</FONT>            private static final long serialVersionUID = -3852193713161395148L;<a name="line.545"></a>
+<FONT color="green">546</FONT>    <a name="line.546"></a>
+<FONT color="green">547</FONT>            /**<a name="line.547"></a>
+<FONT color="green">548</FONT>             * Compare the two {@link Comparable Comparable} arguments.<a name="line.548"></a>
+<FONT color="green">549</FONT>             * This method is equivalent to:<a name="line.549"></a>
+<FONT color="green">550</FONT>             * &lt;pre&gt;(({@link Comparable Comparable})o1).{@link Comparable#compareTo compareTo}(o2)&lt;/pre&gt;<a name="line.550"></a>
+<FONT color="green">551</FONT>             *<a name="line.551"></a>
+<FONT color="green">552</FONT>             * @param  o1 the first object<a name="line.552"></a>
+<FONT color="green">553</FONT>             * @param  o2 the second object<a name="line.553"></a>
+<FONT color="green">554</FONT>             * @return  result of comparison<a name="line.554"></a>
+<FONT color="green">555</FONT>             * @throws NullPointerException when &lt;i&gt;o1&lt;/i&gt; is &lt;code&gt;null&lt;/code&gt;,<a name="line.555"></a>
+<FONT color="green">556</FONT>             *         or when &lt;code&gt;((Comparable)o1).compareTo(o2)&lt;/code&gt; does<a name="line.556"></a>
+<FONT color="green">557</FONT>             * @throws ClassCastException when &lt;i&gt;o1&lt;/i&gt; is not a {@link Comparable Comparable},<a name="line.557"></a>
+<FONT color="green">558</FONT>             *         or when &lt;code&gt;((Comparable)o1).compareTo(o2)&lt;/code&gt; does<a name="line.558"></a>
+<FONT color="green">559</FONT>             */<a name="line.559"></a>
+<FONT color="green">560</FONT>            @SuppressWarnings("unchecked") // cast to (T) may throw ClassCastException, see Javadoc<a name="line.560"></a>
+<FONT color="green">561</FONT>            public int compare(Comparable&lt;T&gt; o1, Comparable&lt;T&gt; o2) {<a name="line.561"></a>
+<FONT color="green">562</FONT>                return o1.compareTo((T) o2);<a name="line.562"></a>
+<FONT color="green">563</FONT>            }<a name="line.563"></a>
+<FONT color="green">564</FONT>        }<a name="line.564"></a>
+<FONT color="green">565</FONT>    <a name="line.565"></a>
+<FONT color="green">566</FONT>        /** {@inheritDoc} */<a name="line.566"></a>
+<FONT color="green">567</FONT>        @Override<a name="line.567"></a>
+<FONT color="green">568</FONT>        public int hashCode() {<a name="line.568"></a>
+<FONT color="green">569</FONT>            final int prime = 31;<a name="line.569"></a>
+<FONT color="green">570</FONT>            int result = 1;<a name="line.570"></a>
+<FONT color="green">571</FONT>            result = prime * result +<a name="line.571"></a>
+<FONT color="green">572</FONT>                     ((freqTable == null) ? 0 : freqTable.hashCode());<a name="line.572"></a>
+<FONT color="green">573</FONT>            return result;<a name="line.573"></a>
+<FONT color="green">574</FONT>        }<a name="line.574"></a>
+<FONT color="green">575</FONT>    <a name="line.575"></a>
+<FONT color="green">576</FONT>        /** {@inheritDoc} */<a name="line.576"></a>
+<FONT color="green">577</FONT>        @Override<a name="line.577"></a>
+<FONT color="green">578</FONT>        public boolean equals(Object obj) {<a name="line.578"></a>
+<FONT color="green">579</FONT>            if (this == obj)<a name="line.579"></a>
+<FONT color="green">580</FONT>                return true;<a name="line.580"></a>
+<FONT color="green">581</FONT>            if (!(obj instanceof Frequency))<a name="line.581"></a>
+<FONT color="green">582</FONT>                return false;<a name="line.582"></a>
+<FONT color="green">583</FONT>            Frequency other = (Frequency) obj;<a name="line.583"></a>
+<FONT color="green">584</FONT>            if (freqTable == null) {<a name="line.584"></a>
+<FONT color="green">585</FONT>                if (other.freqTable != null)<a name="line.585"></a>
+<FONT color="green">586</FONT>                    return false;<a name="line.586"></a>
+<FONT color="green">587</FONT>            } else if (!freqTable.equals(other.freqTable))<a name="line.587"></a>
+<FONT color="green">588</FONT>                return false;<a name="line.588"></a>
+<FONT color="green">589</FONT>            return true;<a name="line.589"></a>
+<FONT color="green">590</FONT>        }<a name="line.590"></a>
+<FONT color="green">591</FONT>    <a name="line.591"></a>
+<FONT color="green">592</FONT>    }<a name="line.592"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/StatUtils.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,691 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.stat.descriptive.UnivariateStatistic;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.stat.descriptive.moment.GeometricMean;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.stat.descriptive.moment.Mean;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.stat.descriptive.moment.Variance;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.stat.descriptive.rank.Max;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.stat.descriptive.rank.Min;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.stat.descriptive.rank.Percentile;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.stat.descriptive.summary.Product;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.stat.descriptive.summary.Sum;<a name="line.28"></a>
+<FONT color="green">029</FONT>    import org.apache.commons.math.stat.descriptive.summary.SumOfLogs;<a name="line.29"></a>
+<FONT color="green">030</FONT>    import org.apache.commons.math.stat.descriptive.summary.SumOfSquares;<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>    /**<a name="line.32"></a>
+<FONT color="green">033</FONT>     * StatUtils provides static methods for computing statistics based on data<a name="line.33"></a>
+<FONT color="green">034</FONT>     * stored in double[] arrays.<a name="line.34"></a>
+<FONT color="green">035</FONT>     *<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.36"></a>
+<FONT color="green">037</FONT>     */<a name="line.37"></a>
+<FONT color="green">038</FONT>    public final class StatUtils {<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** sum */<a name="line.40"></a>
+<FONT color="green">041</FONT>        private static final UnivariateStatistic SUM = new Sum();<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** sumSq */<a name="line.43"></a>
+<FONT color="green">044</FONT>        private static final UnivariateStatistic SUM_OF_SQUARES = new SumOfSquares();<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** prod */<a name="line.46"></a>
+<FONT color="green">047</FONT>        private static final UnivariateStatistic PRODUCT = new Product();<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** sumLog */<a name="line.49"></a>
+<FONT color="green">050</FONT>        private static final UnivariateStatistic SUM_OF_LOGS = new SumOfLogs();<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /** min */<a name="line.52"></a>
+<FONT color="green">053</FONT>        private static final UnivariateStatistic MIN = new Min();<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** max */<a name="line.55"></a>
+<FONT color="green">056</FONT>        private static final UnivariateStatistic MAX = new Max();<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /** mean */<a name="line.58"></a>
+<FONT color="green">059</FONT>        private static final UnivariateStatistic MEAN = new Mean();<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /** variance */<a name="line.61"></a>
+<FONT color="green">062</FONT>        private static final Variance VARIANCE = new Variance();<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /** percentile */<a name="line.64"></a>
+<FONT color="green">065</FONT>        private static final Percentile PERCENTILE = new Percentile();<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /** geometric mean */<a name="line.67"></a>
+<FONT color="green">068</FONT>        private static final GeometricMean GEOMETRIC_MEAN = new GeometricMean();<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /**<a name="line.70"></a>
+<FONT color="green">071</FONT>         * Private Constructor<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        private StatUtils() {<a name="line.73"></a>
+<FONT color="green">074</FONT>        }<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        /**<a name="line.76"></a>
+<FONT color="green">077</FONT>         * Returns the sum of the values in the input array, or<a name="line.77"></a>
+<FONT color="green">078</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt; if the array is empty.<a name="line.78"></a>
+<FONT color="green">079</FONT>         * &lt;p&gt;<a name="line.79"></a>
+<FONT color="green">080</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the input array<a name="line.80"></a>
+<FONT color="green">081</FONT>         * is null.&lt;/p&gt;<a name="line.81"></a>
+<FONT color="green">082</FONT>         *<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param values  array of values to sum<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @return the sum of the values or &lt;code&gt;Double.NaN&lt;/code&gt; if the array<a name="line.84"></a>
+<FONT color="green">085</FONT>         * is empty<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @throws IllegalArgumentException if the array is null<a name="line.86"></a>
+<FONT color="green">087</FONT>         */<a name="line.87"></a>
+<FONT color="green">088</FONT>        public static double sum(final double[] values) {<a name="line.88"></a>
+<FONT color="green">089</FONT>            return SUM.evaluate(values);<a name="line.89"></a>
+<FONT color="green">090</FONT>        }<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /**<a name="line.92"></a>
+<FONT color="green">093</FONT>         * Returns the sum of the entries in the specified portion of<a name="line.93"></a>
+<FONT color="green">094</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.94"></a>
+<FONT color="green">095</FONT>         * is empty.<a name="line.95"></a>
+<FONT color="green">096</FONT>         * &lt;p&gt;<a name="line.96"></a>
+<FONT color="green">097</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.97"></a>
+<FONT color="green">098</FONT>         *<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @param values the input array<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @param begin index of the first array element to include<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @param length the number of elements to include<a name="line.101"></a>
+<FONT color="green">102</FONT>         * @return the sum of the values or Double.NaN if length = 0<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.103"></a>
+<FONT color="green">104</FONT>         *  parameters are not valid<a name="line.104"></a>
+<FONT color="green">105</FONT>         */<a name="line.105"></a>
+<FONT color="green">106</FONT>        public static double sum(final double[] values, final int begin,<a name="line.106"></a>
+<FONT color="green">107</FONT>                final int length) {<a name="line.107"></a>
+<FONT color="green">108</FONT>            return SUM.evaluate(values, begin, length);<a name="line.108"></a>
+<FONT color="green">109</FONT>        }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /**<a name="line.111"></a>
+<FONT color="green">112</FONT>         * Returns the sum of the squares of the entries in the input array, or<a name="line.112"></a>
+<FONT color="green">113</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt; if the array is empty.<a name="line.113"></a>
+<FONT color="green">114</FONT>         * &lt;p&gt;<a name="line.114"></a>
+<FONT color="green">115</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.115"></a>
+<FONT color="green">116</FONT>         *<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @param values  input array<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @return the sum of the squared values or &lt;code&gt;Double.NaN&lt;/code&gt; if the<a name="line.118"></a>
+<FONT color="green">119</FONT>         * array is empty<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @throws IllegalArgumentException if the array is null<a name="line.120"></a>
+<FONT color="green">121</FONT>         */<a name="line.121"></a>
+<FONT color="green">122</FONT>        public static double sumSq(final double[] values) {<a name="line.122"></a>
+<FONT color="green">123</FONT>            return SUM_OF_SQUARES.evaluate(values);<a name="line.123"></a>
+<FONT color="green">124</FONT>        }<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>        /**<a name="line.126"></a>
+<FONT color="green">127</FONT>         * Returns the sum of the squares of the entries in the specified portion of<a name="line.127"></a>
+<FONT color="green">128</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.128"></a>
+<FONT color="green">129</FONT>         * is empty.<a name="line.129"></a>
+<FONT color="green">130</FONT>         * &lt;p&gt;<a name="line.130"></a>
+<FONT color="green">131</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.131"></a>
+<FONT color="green">132</FONT>         *<a name="line.132"></a>
+<FONT color="green">133</FONT>         * @param values the input array<a name="line.133"></a>
+<FONT color="green">134</FONT>         * @param begin index of the first array element to include<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @param length the number of elements to include<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @return the sum of the squares of the values or Double.NaN if length = 0<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.137"></a>
+<FONT color="green">138</FONT>         * parameters are not valid<a name="line.138"></a>
+<FONT color="green">139</FONT>         */<a name="line.139"></a>
+<FONT color="green">140</FONT>        public static double sumSq(final double[] values, final int begin,<a name="line.140"></a>
+<FONT color="green">141</FONT>                final int length) {<a name="line.141"></a>
+<FONT color="green">142</FONT>            return SUM_OF_SQUARES.evaluate(values, begin, length);<a name="line.142"></a>
+<FONT color="green">143</FONT>        }<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>        /**<a name="line.145"></a>
+<FONT color="green">146</FONT>         * Returns the product of the entries in the input array, or<a name="line.146"></a>
+<FONT color="green">147</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt; if the array is empty.<a name="line.147"></a>
+<FONT color="green">148</FONT>         * &lt;p&gt;<a name="line.148"></a>
+<FONT color="green">149</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.149"></a>
+<FONT color="green">150</FONT>         *<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @param values the input array<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @return the product of the values or Double.NaN if the array is empty<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @throws IllegalArgumentException if the array is null<a name="line.153"></a>
+<FONT color="green">154</FONT>         */<a name="line.154"></a>
+<FONT color="green">155</FONT>        public static double product(final double[] values) {<a name="line.155"></a>
+<FONT color="green">156</FONT>            return PRODUCT.evaluate(values);<a name="line.156"></a>
+<FONT color="green">157</FONT>        }<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>        /**<a name="line.159"></a>
+<FONT color="green">160</FONT>         * Returns the product of the entries in the specified portion of<a name="line.160"></a>
+<FONT color="green">161</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.161"></a>
+<FONT color="green">162</FONT>         * is empty.<a name="line.162"></a>
+<FONT color="green">163</FONT>         * &lt;p&gt;<a name="line.163"></a>
+<FONT color="green">164</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.164"></a>
+<FONT color="green">165</FONT>         *<a name="line.165"></a>
+<FONT color="green">166</FONT>         * @param values the input array<a name="line.166"></a>
+<FONT color="green">167</FONT>         * @param begin index of the first array element to include<a name="line.167"></a>
+<FONT color="green">168</FONT>         * @param length the number of elements to include<a name="line.168"></a>
+<FONT color="green">169</FONT>         * @return the product of the values or Double.NaN if length = 0<a name="line.169"></a>
+<FONT color="green">170</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.170"></a>
+<FONT color="green">171</FONT>         * parameters are not valid<a name="line.171"></a>
+<FONT color="green">172</FONT>         */<a name="line.172"></a>
+<FONT color="green">173</FONT>        public static double product(final double[] values, final int begin,<a name="line.173"></a>
+<FONT color="green">174</FONT>                final int length) {<a name="line.174"></a>
+<FONT color="green">175</FONT>            return PRODUCT.evaluate(values, begin, length);<a name="line.175"></a>
+<FONT color="green">176</FONT>        }<a name="line.176"></a>
+<FONT color="green">177</FONT>    <a name="line.177"></a>
+<FONT color="green">178</FONT>        /**<a name="line.178"></a>
+<FONT color="green">179</FONT>         * Returns the sum of the natural logs of the entries in the input array, or<a name="line.179"></a>
+<FONT color="green">180</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt; if the array is empty.<a name="line.180"></a>
+<FONT color="green">181</FONT>         * &lt;p&gt;<a name="line.181"></a>
+<FONT color="green">182</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.182"></a>
+<FONT color="green">183</FONT>         * &lt;p&gt;<a name="line.183"></a>
+<FONT color="green">184</FONT>         * See {@link org.apache.commons.math.stat.descriptive.summary.SumOfLogs}.<a name="line.184"></a>
+<FONT color="green">185</FONT>         * &lt;/p&gt;<a name="line.185"></a>
+<FONT color="green">186</FONT>         *<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @param values the input array<a name="line.187"></a>
+<FONT color="green">188</FONT>         * @return the sum of the natural logs of the values or Double.NaN if<a name="line.188"></a>
+<FONT color="green">189</FONT>         * the array is empty<a name="line.189"></a>
+<FONT color="green">190</FONT>         * @throws IllegalArgumentException if the array is null<a name="line.190"></a>
+<FONT color="green">191</FONT>         */<a name="line.191"></a>
+<FONT color="green">192</FONT>        public static double sumLog(final double[] values) {<a name="line.192"></a>
+<FONT color="green">193</FONT>            return SUM_OF_LOGS.evaluate(values);<a name="line.193"></a>
+<FONT color="green">194</FONT>        }<a name="line.194"></a>
+<FONT color="green">195</FONT>    <a name="line.195"></a>
+<FONT color="green">196</FONT>        /**<a name="line.196"></a>
+<FONT color="green">197</FONT>         * Returns the sum of the natural logs of the entries in the specified portion of<a name="line.197"></a>
+<FONT color="green">198</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.198"></a>
+<FONT color="green">199</FONT>         * is empty.<a name="line.199"></a>
+<FONT color="green">200</FONT>         * &lt;p&gt;<a name="line.200"></a>
+<FONT color="green">201</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.201"></a>
+<FONT color="green">202</FONT>         * &lt;p&gt;<a name="line.202"></a>
+<FONT color="green">203</FONT>         * See {@link org.apache.commons.math.stat.descriptive.summary.SumOfLogs}.<a name="line.203"></a>
+<FONT color="green">204</FONT>         * &lt;/p&gt;<a name="line.204"></a>
+<FONT color="green">205</FONT>         *<a name="line.205"></a>
+<FONT color="green">206</FONT>         * @param values the input array<a name="line.206"></a>
+<FONT color="green">207</FONT>         * @param begin index of the first array element to include<a name="line.207"></a>
+<FONT color="green">208</FONT>         * @param length the number of elements to include<a name="line.208"></a>
+<FONT color="green">209</FONT>         * @return the sum of the natural logs of the values or Double.NaN if<a name="line.209"></a>
+<FONT color="green">210</FONT>         * length = 0<a name="line.210"></a>
+<FONT color="green">211</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.211"></a>
+<FONT color="green">212</FONT>         * parameters are not valid<a name="line.212"></a>
+<FONT color="green">213</FONT>         */<a name="line.213"></a>
+<FONT color="green">214</FONT>        public static double sumLog(final double[] values, final int begin,<a name="line.214"></a>
+<FONT color="green">215</FONT>                final int length) {<a name="line.215"></a>
+<FONT color="green">216</FONT>            return SUM_OF_LOGS.evaluate(values, begin, length);<a name="line.216"></a>
+<FONT color="green">217</FONT>        }<a name="line.217"></a>
+<FONT color="green">218</FONT>    <a name="line.218"></a>
+<FONT color="green">219</FONT>        /**<a name="line.219"></a>
+<FONT color="green">220</FONT>         * Returns the arithmetic mean of the entries in the input array, or<a name="line.220"></a>
+<FONT color="green">221</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt; if the array is empty.<a name="line.221"></a>
+<FONT color="green">222</FONT>         * &lt;p&gt;<a name="line.222"></a>
+<FONT color="green">223</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.223"></a>
+<FONT color="green">224</FONT>         * &lt;p&gt;<a name="line.224"></a>
+<FONT color="green">225</FONT>         * See {@link org.apache.commons.math.stat.descriptive.moment.Mean} for<a name="line.225"></a>
+<FONT color="green">226</FONT>         * details on the computing algorithm.&lt;/p&gt;<a name="line.226"></a>
+<FONT color="green">227</FONT>         *<a name="line.227"></a>
+<FONT color="green">228</FONT>         * @param values the input array<a name="line.228"></a>
+<FONT color="green">229</FONT>         * @return the mean of the values or Double.NaN if the array is empty<a name="line.229"></a>
+<FONT color="green">230</FONT>         * @throws IllegalArgumentException if the array is null<a name="line.230"></a>
+<FONT color="green">231</FONT>         */<a name="line.231"></a>
+<FONT color="green">232</FONT>        public static double mean(final double[] values) {<a name="line.232"></a>
+<FONT color="green">233</FONT>            return MEAN.evaluate(values);<a name="line.233"></a>
+<FONT color="green">234</FONT>        }<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>        /**<a name="line.236"></a>
+<FONT color="green">237</FONT>         * Returns the arithmetic mean of the entries in the specified portion of<a name="line.237"></a>
+<FONT color="green">238</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.238"></a>
+<FONT color="green">239</FONT>         * is empty.<a name="line.239"></a>
+<FONT color="green">240</FONT>         * &lt;p&gt;<a name="line.240"></a>
+<FONT color="green">241</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.241"></a>
+<FONT color="green">242</FONT>         * &lt;p&gt;<a name="line.242"></a>
+<FONT color="green">243</FONT>         * See {@link org.apache.commons.math.stat.descriptive.moment.Mean} for<a name="line.243"></a>
+<FONT color="green">244</FONT>         * details on the computing algorithm.&lt;/p&gt;<a name="line.244"></a>
+<FONT color="green">245</FONT>         *<a name="line.245"></a>
+<FONT color="green">246</FONT>         * @param values the input array<a name="line.246"></a>
+<FONT color="green">247</FONT>         * @param begin index of the first array element to include<a name="line.247"></a>
+<FONT color="green">248</FONT>         * @param length the number of elements to include<a name="line.248"></a>
+<FONT color="green">249</FONT>         * @return the mean of the values or Double.NaN if length = 0<a name="line.249"></a>
+<FONT color="green">250</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.250"></a>
+<FONT color="green">251</FONT>         * parameters are not valid<a name="line.251"></a>
+<FONT color="green">252</FONT>         */<a name="line.252"></a>
+<FONT color="green">253</FONT>        public static double mean(final double[] values, final int begin,<a name="line.253"></a>
+<FONT color="green">254</FONT>                final int length) {<a name="line.254"></a>
+<FONT color="green">255</FONT>            return MEAN.evaluate(values, begin, length);<a name="line.255"></a>
+<FONT color="green">256</FONT>        }<a name="line.256"></a>
+<FONT color="green">257</FONT>    <a name="line.257"></a>
+<FONT color="green">258</FONT>        /**<a name="line.258"></a>
+<FONT color="green">259</FONT>         * Returns the geometric mean of the entries in the input array, or<a name="line.259"></a>
+<FONT color="green">260</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt; if the array is empty.<a name="line.260"></a>
+<FONT color="green">261</FONT>         * &lt;p&gt;<a name="line.261"></a>
+<FONT color="green">262</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.262"></a>
+<FONT color="green">263</FONT>         * &lt;p&gt;<a name="line.263"></a>
+<FONT color="green">264</FONT>         * See {@link org.apache.commons.math.stat.descriptive.moment.GeometricMean}<a name="line.264"></a>
+<FONT color="green">265</FONT>         * for details on the computing algorithm.&lt;/p&gt;<a name="line.265"></a>
+<FONT color="green">266</FONT>         *<a name="line.266"></a>
+<FONT color="green">267</FONT>         * @param values the input array<a name="line.267"></a>
+<FONT color="green">268</FONT>         * @return the geometric mean of the values or Double.NaN if the array is empty<a name="line.268"></a>
+<FONT color="green">269</FONT>         * @throws IllegalArgumentException if the array is null<a name="line.269"></a>
+<FONT color="green">270</FONT>         */<a name="line.270"></a>
+<FONT color="green">271</FONT>        public static double geometricMean(final double[] values) {<a name="line.271"></a>
+<FONT color="green">272</FONT>            return GEOMETRIC_MEAN.evaluate(values);<a name="line.272"></a>
+<FONT color="green">273</FONT>        }<a name="line.273"></a>
+<FONT color="green">274</FONT>    <a name="line.274"></a>
+<FONT color="green">275</FONT>        /**<a name="line.275"></a>
+<FONT color="green">276</FONT>         * Returns the geometric mean of the entries in the specified portion of<a name="line.276"></a>
+<FONT color="green">277</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.277"></a>
+<FONT color="green">278</FONT>         * is empty.<a name="line.278"></a>
+<FONT color="green">279</FONT>         * &lt;p&gt;<a name="line.279"></a>
+<FONT color="green">280</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.280"></a>
+<FONT color="green">281</FONT>         * &lt;p&gt;<a name="line.281"></a>
+<FONT color="green">282</FONT>         * See {@link org.apache.commons.math.stat.descriptive.moment.GeometricMean}<a name="line.282"></a>
+<FONT color="green">283</FONT>         * for details on the computing algorithm.&lt;/p&gt;<a name="line.283"></a>
+<FONT color="green">284</FONT>         *<a name="line.284"></a>
+<FONT color="green">285</FONT>         * @param values the input array<a name="line.285"></a>
+<FONT color="green">286</FONT>         * @param begin index of the first array element to include<a name="line.286"></a>
+<FONT color="green">287</FONT>         * @param length the number of elements to include<a name="line.287"></a>
+<FONT color="green">288</FONT>         * @return the geometric mean of the values or Double.NaN if length = 0<a name="line.288"></a>
+<FONT color="green">289</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.289"></a>
+<FONT color="green">290</FONT>         * parameters are not valid<a name="line.290"></a>
+<FONT color="green">291</FONT>         */<a name="line.291"></a>
+<FONT color="green">292</FONT>        public static double geometricMean(final double[] values, final int begin,<a name="line.292"></a>
+<FONT color="green">293</FONT>                final int length) {<a name="line.293"></a>
+<FONT color="green">294</FONT>            return GEOMETRIC_MEAN.evaluate(values, begin, length);<a name="line.294"></a>
+<FONT color="green">295</FONT>        }<a name="line.295"></a>
+<FONT color="green">296</FONT>    <a name="line.296"></a>
+<FONT color="green">297</FONT>    <a name="line.297"></a>
+<FONT color="green">298</FONT>        /**<a name="line.298"></a>
+<FONT color="green">299</FONT>         * Returns the variance of the entries in the input array, or<a name="line.299"></a>
+<FONT color="green">300</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt; if the array is empty.<a name="line.300"></a>
+<FONT color="green">301</FONT>         * &lt;p&gt;<a name="line.301"></a>
+<FONT color="green">302</FONT>         * See {@link org.apache.commons.math.stat.descriptive.moment.Variance} for<a name="line.302"></a>
+<FONT color="green">303</FONT>         * details on the computing algorithm.&lt;/p&gt;<a name="line.303"></a>
+<FONT color="green">304</FONT>         * &lt;p&gt;<a name="line.304"></a>
+<FONT color="green">305</FONT>         * Returns 0 for a single-value (i.e. length = 1) sample.&lt;/p&gt;<a name="line.305"></a>
+<FONT color="green">306</FONT>         * &lt;p&gt;<a name="line.306"></a>
+<FONT color="green">307</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.307"></a>
+<FONT color="green">308</FONT>         *<a name="line.308"></a>
+<FONT color="green">309</FONT>         * @param values the input array<a name="line.309"></a>
+<FONT color="green">310</FONT>         * @return the variance of the values or Double.NaN if the array is empty<a name="line.310"></a>
+<FONT color="green">311</FONT>         * @throws IllegalArgumentException if the array is null<a name="line.311"></a>
+<FONT color="green">312</FONT>         */<a name="line.312"></a>
+<FONT color="green">313</FONT>        public static double variance(final double[] values) {<a name="line.313"></a>
+<FONT color="green">314</FONT>            return VARIANCE.evaluate(values);<a name="line.314"></a>
+<FONT color="green">315</FONT>        }<a name="line.315"></a>
+<FONT color="green">316</FONT>    <a name="line.316"></a>
+<FONT color="green">317</FONT>        /**<a name="line.317"></a>
+<FONT color="green">318</FONT>         * Returns the variance of the entries in the specified portion of<a name="line.318"></a>
+<FONT color="green">319</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.319"></a>
+<FONT color="green">320</FONT>         * is empty.<a name="line.320"></a>
+<FONT color="green">321</FONT>         * &lt;p&gt;<a name="line.321"></a>
+<FONT color="green">322</FONT>         * See {@link org.apache.commons.math.stat.descriptive.moment.Variance} for<a name="line.322"></a>
+<FONT color="green">323</FONT>         * details on the computing algorithm.&lt;/p&gt;<a name="line.323"></a>
+<FONT color="green">324</FONT>         * &lt;p&gt;<a name="line.324"></a>
+<FONT color="green">325</FONT>         * Returns 0 for a single-value (i.e. length = 1) sample.&lt;/p&gt;<a name="line.325"></a>
+<FONT color="green">326</FONT>         * &lt;p&gt;<a name="line.326"></a>
+<FONT color="green">327</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null or the<a name="line.327"></a>
+<FONT color="green">328</FONT>         * array index parameters are not valid.&lt;/p&gt;<a name="line.328"></a>
+<FONT color="green">329</FONT>         *<a name="line.329"></a>
+<FONT color="green">330</FONT>         * @param values the input array<a name="line.330"></a>
+<FONT color="green">331</FONT>         * @param begin index of the first array element to include<a name="line.331"></a>
+<FONT color="green">332</FONT>         * @param length the number of elements to include<a name="line.332"></a>
+<FONT color="green">333</FONT>         * @return the variance of the values or Double.NaN if length = 0<a name="line.333"></a>
+<FONT color="green">334</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.334"></a>
+<FONT color="green">335</FONT>         *  parameters are not valid<a name="line.335"></a>
+<FONT color="green">336</FONT>         */<a name="line.336"></a>
+<FONT color="green">337</FONT>        public static double variance(final double[] values, final int begin,<a name="line.337"></a>
+<FONT color="green">338</FONT>                final int length) {<a name="line.338"></a>
+<FONT color="green">339</FONT>            return VARIANCE.evaluate(values, begin, length);<a name="line.339"></a>
+<FONT color="green">340</FONT>        }<a name="line.340"></a>
+<FONT color="green">341</FONT>    <a name="line.341"></a>
+<FONT color="green">342</FONT>        /**<a name="line.342"></a>
+<FONT color="green">343</FONT>         * Returns the variance of the entries in the specified portion of<a name="line.343"></a>
+<FONT color="green">344</FONT>         * the input array, using the precomputed mean value.  Returns<a name="line.344"></a>
+<FONT color="green">345</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray is empty.<a name="line.345"></a>
+<FONT color="green">346</FONT>         * &lt;p&gt;<a name="line.346"></a>
+<FONT color="green">347</FONT>         * See {@link org.apache.commons.math.stat.descriptive.moment.Variance} for<a name="line.347"></a>
+<FONT color="green">348</FONT>         * details on the computing algorithm.&lt;/p&gt;<a name="line.348"></a>
+<FONT color="green">349</FONT>         * &lt;p&gt;<a name="line.349"></a>
+<FONT color="green">350</FONT>         * The formula used assumes that the supplied mean value is the arithmetic<a name="line.350"></a>
+<FONT color="green">351</FONT>         * mean of the sample data, not a known population parameter.  This method<a name="line.351"></a>
+<FONT color="green">352</FONT>         * is supplied only to save computation when the mean has already been<a name="line.352"></a>
+<FONT color="green">353</FONT>         * computed.&lt;/p&gt;<a name="line.353"></a>
+<FONT color="green">354</FONT>         * &lt;p&gt;<a name="line.354"></a>
+<FONT color="green">355</FONT>         * Returns 0 for a single-value (i.e. length = 1) sample.&lt;/p&gt;<a name="line.355"></a>
+<FONT color="green">356</FONT>         * &lt;p&gt;<a name="line.356"></a>
+<FONT color="green">357</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null or the<a name="line.357"></a>
+<FONT color="green">358</FONT>         * array index parameters are not valid.&lt;/p&gt;<a name="line.358"></a>
+<FONT color="green">359</FONT>         *<a name="line.359"></a>
+<FONT color="green">360</FONT>         * @param values the input array<a name="line.360"></a>
+<FONT color="green">361</FONT>         * @param mean the precomputed mean value<a name="line.361"></a>
+<FONT color="green">362</FONT>         * @param begin index of the first array element to include<a name="line.362"></a>
+<FONT color="green">363</FONT>         * @param length the number of elements to include<a name="line.363"></a>
+<FONT color="green">364</FONT>         * @return the variance of the values or Double.NaN if length = 0<a name="line.364"></a>
+<FONT color="green">365</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.365"></a>
+<FONT color="green">366</FONT>         *  parameters are not valid<a name="line.366"></a>
+<FONT color="green">367</FONT>         */<a name="line.367"></a>
+<FONT color="green">368</FONT>        public static double variance(final double[] values, final double mean,<a name="line.368"></a>
+<FONT color="green">369</FONT>                final int begin, final int length) {<a name="line.369"></a>
+<FONT color="green">370</FONT>            return VARIANCE.evaluate(values, mean, begin, length);<a name="line.370"></a>
+<FONT color="green">371</FONT>        }<a name="line.371"></a>
+<FONT color="green">372</FONT>    <a name="line.372"></a>
+<FONT color="green">373</FONT>        /**<a name="line.373"></a>
+<FONT color="green">374</FONT>         * Returns the variance of the entries in the input array, using the<a name="line.374"></a>
+<FONT color="green">375</FONT>         * precomputed mean value.  Returns &lt;code&gt;Double.NaN&lt;/code&gt; if the array<a name="line.375"></a>
+<FONT color="green">376</FONT>         * is empty.<a name="line.376"></a>
+<FONT color="green">377</FONT>         * &lt;p&gt;<a name="line.377"></a>
+<FONT color="green">378</FONT>         * See {@link org.apache.commons.math.stat.descriptive.moment.Variance} for<a name="line.378"></a>
+<FONT color="green">379</FONT>         * details on the computing algorithm.&lt;/p&gt;<a name="line.379"></a>
+<FONT color="green">380</FONT>         * &lt;p&gt;<a name="line.380"></a>
+<FONT color="green">381</FONT>         * The formula used assumes that the supplied mean value is the arithmetic<a name="line.381"></a>
+<FONT color="green">382</FONT>         * mean of the sample data, not a known population parameter.  This method<a name="line.382"></a>
+<FONT color="green">383</FONT>         * is supplied only to save computation when the mean has already been<a name="line.383"></a>
+<FONT color="green">384</FONT>         * computed.&lt;/p&gt;<a name="line.384"></a>
+<FONT color="green">385</FONT>         * &lt;p&gt;<a name="line.385"></a>
+<FONT color="green">386</FONT>         * Returns 0 for a single-value (i.e. length = 1) sample.&lt;/p&gt;<a name="line.386"></a>
+<FONT color="green">387</FONT>         * &lt;p&gt;<a name="line.387"></a>
+<FONT color="green">388</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.388"></a>
+<FONT color="green">389</FONT>         *<a name="line.389"></a>
+<FONT color="green">390</FONT>         * @param values the input array<a name="line.390"></a>
+<FONT color="green">391</FONT>         * @param mean the precomputed mean value<a name="line.391"></a>
+<FONT color="green">392</FONT>         * @return the variance of the values or Double.NaN if the array is empty<a name="line.392"></a>
+<FONT color="green">393</FONT>         * @throws IllegalArgumentException if the array is null<a name="line.393"></a>
+<FONT color="green">394</FONT>         */<a name="line.394"></a>
+<FONT color="green">395</FONT>        public static double variance(final double[] values, final double mean) {<a name="line.395"></a>
+<FONT color="green">396</FONT>            return VARIANCE.evaluate(values, mean);<a name="line.396"></a>
+<FONT color="green">397</FONT>        }<a name="line.397"></a>
+<FONT color="green">398</FONT>    <a name="line.398"></a>
+<FONT color="green">399</FONT>        /**<a name="line.399"></a>
+<FONT color="green">400</FONT>         * Returns the maximum of the entries in the input array, or<a name="line.400"></a>
+<FONT color="green">401</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt; if the array is empty.<a name="line.401"></a>
+<FONT color="green">402</FONT>         * &lt;p&gt;<a name="line.402"></a>
+<FONT color="green">403</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.403"></a>
+<FONT color="green">404</FONT>         * &lt;p&gt;<a name="line.404"></a>
+<FONT color="green">405</FONT>         * &lt;ul&gt;<a name="line.405"></a>
+<FONT color="green">406</FONT>         * &lt;li&gt;The result is &lt;code&gt;NaN&lt;/code&gt; iff all values are &lt;code&gt;NaN&lt;/code&gt;<a name="line.406"></a>
+<FONT color="green">407</FONT>         * (i.e. &lt;code&gt;NaN&lt;/code&gt; values have no impact on the value of the statistic).&lt;/li&gt;<a name="line.407"></a>
+<FONT color="green">408</FONT>         * &lt;li&gt;If any of the values equals &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt;,<a name="line.408"></a>
+<FONT color="green">409</FONT>         * the result is &lt;code&gt;Double.POSITIVE_INFINITY.&lt;/code&gt;&lt;/li&gt;<a name="line.409"></a>
+<FONT color="green">410</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.410"></a>
+<FONT color="green">411</FONT>         *<a name="line.411"></a>
+<FONT color="green">412</FONT>         * @param values the input array<a name="line.412"></a>
+<FONT color="green">413</FONT>         * @return the maximum of the values or Double.NaN if the array is empty<a name="line.413"></a>
+<FONT color="green">414</FONT>         * @throws IllegalArgumentException if the array is null<a name="line.414"></a>
+<FONT color="green">415</FONT>         */<a name="line.415"></a>
+<FONT color="green">416</FONT>        public static double max(final double[] values) {<a name="line.416"></a>
+<FONT color="green">417</FONT>            return MAX.evaluate(values);<a name="line.417"></a>
+<FONT color="green">418</FONT>        }<a name="line.418"></a>
+<FONT color="green">419</FONT>    <a name="line.419"></a>
+<FONT color="green">420</FONT>        /**<a name="line.420"></a>
+<FONT color="green">421</FONT>         * Returns the maximum of the entries in the specified portion of<a name="line.421"></a>
+<FONT color="green">422</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.422"></a>
+<FONT color="green">423</FONT>         * is empty.<a name="line.423"></a>
+<FONT color="green">424</FONT>         * &lt;p&gt;<a name="line.424"></a>
+<FONT color="green">425</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null or<a name="line.425"></a>
+<FONT color="green">426</FONT>         * the array index parameters are not valid.&lt;/p&gt;<a name="line.426"></a>
+<FONT color="green">427</FONT>         * &lt;p&gt;<a name="line.427"></a>
+<FONT color="green">428</FONT>         * &lt;ul&gt;<a name="line.428"></a>
+<FONT color="green">429</FONT>         * &lt;li&gt;The result is &lt;code&gt;NaN&lt;/code&gt; iff all values are &lt;code&gt;NaN&lt;/code&gt;<a name="line.429"></a>
+<FONT color="green">430</FONT>         * (i.e. &lt;code&gt;NaN&lt;/code&gt; values have no impact on the value of the statistic).&lt;/li&gt;<a name="line.430"></a>
+<FONT color="green">431</FONT>         * &lt;li&gt;If any of the values equals &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt;,<a name="line.431"></a>
+<FONT color="green">432</FONT>         * the result is &lt;code&gt;Double.POSITIVE_INFINITY.&lt;/code&gt;&lt;/li&gt;<a name="line.432"></a>
+<FONT color="green">433</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.433"></a>
+<FONT color="green">434</FONT>         *<a name="line.434"></a>
+<FONT color="green">435</FONT>         * @param values the input array<a name="line.435"></a>
+<FONT color="green">436</FONT>         * @param begin index of the first array element to include<a name="line.436"></a>
+<FONT color="green">437</FONT>         * @param length the number of elements to include<a name="line.437"></a>
+<FONT color="green">438</FONT>         * @return the maximum of the values or Double.NaN if length = 0<a name="line.438"></a>
+<FONT color="green">439</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.439"></a>
+<FONT color="green">440</FONT>         * parameters are not valid<a name="line.440"></a>
+<FONT color="green">441</FONT>         */<a name="line.441"></a>
+<FONT color="green">442</FONT>        public static double max(final double[] values, final int begin,<a name="line.442"></a>
+<FONT color="green">443</FONT>                final int length) {<a name="line.443"></a>
+<FONT color="green">444</FONT>            return MAX.evaluate(values, begin, length);<a name="line.444"></a>
+<FONT color="green">445</FONT>        }<a name="line.445"></a>
+<FONT color="green">446</FONT>    <a name="line.446"></a>
+<FONT color="green">447</FONT>         /**<a name="line.447"></a>
+<FONT color="green">448</FONT>         * Returns the minimum of the entries in the input array, or<a name="line.448"></a>
+<FONT color="green">449</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt; if the array is empty.<a name="line.449"></a>
+<FONT color="green">450</FONT>         * &lt;p&gt;<a name="line.450"></a>
+<FONT color="green">451</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.451"></a>
+<FONT color="green">452</FONT>         * &lt;p&gt;<a name="line.452"></a>
+<FONT color="green">453</FONT>         * &lt;ul&gt;<a name="line.453"></a>
+<FONT color="green">454</FONT>         * &lt;li&gt;The result is &lt;code&gt;NaN&lt;/code&gt; iff all values are &lt;code&gt;NaN&lt;/code&gt;<a name="line.454"></a>
+<FONT color="green">455</FONT>         * (i.e. &lt;code&gt;NaN&lt;/code&gt; values have no impact on the value of the statistic).&lt;/li&gt;<a name="line.455"></a>
+<FONT color="green">456</FONT>         * &lt;li&gt;If any of the values equals &lt;code&gt;Double.NEGATIVE_INFINITY&lt;/code&gt;,<a name="line.456"></a>
+<FONT color="green">457</FONT>         * the result is &lt;code&gt;Double.NEGATIVE_INFINITY.&lt;/code&gt;&lt;/li&gt;<a name="line.457"></a>
+<FONT color="green">458</FONT>         * &lt;/ul&gt; &lt;/p&gt;<a name="line.458"></a>
+<FONT color="green">459</FONT>         *<a name="line.459"></a>
+<FONT color="green">460</FONT>         * @param values the input array<a name="line.460"></a>
+<FONT color="green">461</FONT>         * @return the minimum of the values or Double.NaN if the array is empty<a name="line.461"></a>
+<FONT color="green">462</FONT>         * @throws IllegalArgumentException if the array is null<a name="line.462"></a>
+<FONT color="green">463</FONT>         */<a name="line.463"></a>
+<FONT color="green">464</FONT>        public static double min(final double[] values) {<a name="line.464"></a>
+<FONT color="green">465</FONT>            return MIN.evaluate(values);<a name="line.465"></a>
+<FONT color="green">466</FONT>        }<a name="line.466"></a>
+<FONT color="green">467</FONT>    <a name="line.467"></a>
+<FONT color="green">468</FONT>         /**<a name="line.468"></a>
+<FONT color="green">469</FONT>         * Returns the minimum of the entries in the specified portion of<a name="line.469"></a>
+<FONT color="green">470</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.470"></a>
+<FONT color="green">471</FONT>         * is empty.<a name="line.471"></a>
+<FONT color="green">472</FONT>         * &lt;p&gt;<a name="line.472"></a>
+<FONT color="green">473</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null or<a name="line.473"></a>
+<FONT color="green">474</FONT>         * the array index parameters are not valid.&lt;/p&gt;<a name="line.474"></a>
+<FONT color="green">475</FONT>         * &lt;p&gt;<a name="line.475"></a>
+<FONT color="green">476</FONT>         * &lt;ul&gt;<a name="line.476"></a>
+<FONT color="green">477</FONT>         * &lt;li&gt;The result is &lt;code&gt;NaN&lt;/code&gt; iff all values are &lt;code&gt;NaN&lt;/code&gt;<a name="line.477"></a>
+<FONT color="green">478</FONT>         * (i.e. &lt;code&gt;NaN&lt;/code&gt; values have no impact on the value of the statistic).&lt;/li&gt;<a name="line.478"></a>
+<FONT color="green">479</FONT>         * &lt;li&gt;If any of the values equals &lt;code&gt;Double.NEGATIVE_INFINITY&lt;/code&gt;,<a name="line.479"></a>
+<FONT color="green">480</FONT>         * the result is &lt;code&gt;Double.NEGATIVE_INFINITY.&lt;/code&gt;&lt;/li&gt;<a name="line.480"></a>
+<FONT color="green">481</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.481"></a>
+<FONT color="green">482</FONT>         *<a name="line.482"></a>
+<FONT color="green">483</FONT>         * @param values the input array<a name="line.483"></a>
+<FONT color="green">484</FONT>         * @param begin index of the first array element to include<a name="line.484"></a>
+<FONT color="green">485</FONT>         * @param length the number of elements to include<a name="line.485"></a>
+<FONT color="green">486</FONT>         * @return the minimum of the values or Double.NaN if length = 0<a name="line.486"></a>
+<FONT color="green">487</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.487"></a>
+<FONT color="green">488</FONT>         * parameters are not valid<a name="line.488"></a>
+<FONT color="green">489</FONT>         */<a name="line.489"></a>
+<FONT color="green">490</FONT>        public static double min(final double[] values, final int begin,<a name="line.490"></a>
+<FONT color="green">491</FONT>                final int length) {<a name="line.491"></a>
+<FONT color="green">492</FONT>            return MIN.evaluate(values, begin, length);<a name="line.492"></a>
+<FONT color="green">493</FONT>        }<a name="line.493"></a>
+<FONT color="green">494</FONT>    <a name="line.494"></a>
+<FONT color="green">495</FONT>        /**<a name="line.495"></a>
+<FONT color="green">496</FONT>         * Returns an estimate of the &lt;code&gt;p&lt;/code&gt;th percentile of the values<a name="line.496"></a>
+<FONT color="green">497</FONT>         * in the &lt;code&gt;values&lt;/code&gt; array.<a name="line.497"></a>
+<FONT color="green">498</FONT>         * &lt;p&gt;<a name="line.498"></a>
+<FONT color="green">499</FONT>         * &lt;ul&gt;<a name="line.499"></a>
+<FONT color="green">500</FONT>         * &lt;li&gt;Returns &lt;code&gt;Double.NaN&lt;/code&gt; if &lt;code&gt;values&lt;/code&gt; has length<a name="line.500"></a>
+<FONT color="green">501</FONT>         * &lt;code&gt;0&lt;/code&gt;&lt;/li&gt;&lt;/p&gt;<a name="line.501"></a>
+<FONT color="green">502</FONT>         * &lt;li&gt;Returns (for any value of &lt;code&gt;p&lt;/code&gt;) &lt;code&gt;values[0]&lt;/code&gt;<a name="line.502"></a>
+<FONT color="green">503</FONT>         *  if &lt;code&gt;values&lt;/code&gt; has length &lt;code&gt;1&lt;/code&gt;&lt;/li&gt;<a name="line.503"></a>
+<FONT color="green">504</FONT>         * &lt;li&gt;Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if &lt;code&gt;values&lt;/code&gt;<a name="line.504"></a>
+<FONT color="green">505</FONT>         * is null  or p is not a valid quantile value (p must be greater than 0<a name="line.505"></a>
+<FONT color="green">506</FONT>         * and less than or equal to 100)&lt;/li&gt;<a name="line.506"></a>
+<FONT color="green">507</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.507"></a>
+<FONT color="green">508</FONT>         * &lt;p&gt;<a name="line.508"></a>
+<FONT color="green">509</FONT>         * See {@link org.apache.commons.math.stat.descriptive.rank.Percentile} for<a name="line.509"></a>
+<FONT color="green">510</FONT>         * a description of the percentile estimation algorithm used.&lt;/p&gt;<a name="line.510"></a>
+<FONT color="green">511</FONT>         *<a name="line.511"></a>
+<FONT color="green">512</FONT>         * @param values input array of values<a name="line.512"></a>
+<FONT color="green">513</FONT>         * @param p the percentile value to compute<a name="line.513"></a>
+<FONT color="green">514</FONT>         * @return the percentile value or Double.NaN if the array is empty<a name="line.514"></a>
+<FONT color="green">515</FONT>         * @throws IllegalArgumentException if &lt;code&gt;values&lt;/code&gt; is null<a name="line.515"></a>
+<FONT color="green">516</FONT>         * or p is invalid<a name="line.516"></a>
+<FONT color="green">517</FONT>         */<a name="line.517"></a>
+<FONT color="green">518</FONT>        public static double percentile(final double[] values, final double p) {<a name="line.518"></a>
+<FONT color="green">519</FONT>                return PERCENTILE.evaluate(values,p);<a name="line.519"></a>
+<FONT color="green">520</FONT>        }<a name="line.520"></a>
+<FONT color="green">521</FONT>    <a name="line.521"></a>
+<FONT color="green">522</FONT>         /**<a name="line.522"></a>
+<FONT color="green">523</FONT>         * Returns an estimate of the &lt;code&gt;p&lt;/code&gt;th percentile of the values<a name="line.523"></a>
+<FONT color="green">524</FONT>         * in the &lt;code&gt;values&lt;/code&gt; array, starting with the element in (0-based)<a name="line.524"></a>
+<FONT color="green">525</FONT>         * position &lt;code&gt;begin&lt;/code&gt; in the array and including &lt;code&gt;length&lt;/code&gt;<a name="line.525"></a>
+<FONT color="green">526</FONT>         * values.<a name="line.526"></a>
+<FONT color="green">527</FONT>         * &lt;p&gt;<a name="line.527"></a>
+<FONT color="green">528</FONT>         * &lt;ul&gt;<a name="line.528"></a>
+<FONT color="green">529</FONT>         * &lt;li&gt;Returns &lt;code&gt;Double.NaN&lt;/code&gt; if &lt;code&gt;length = 0&lt;/code&gt;&lt;/li&gt;<a name="line.529"></a>
+<FONT color="green">530</FONT>         * &lt;li&gt;Returns (for any value of &lt;code&gt;p&lt;/code&gt;) &lt;code&gt;values[begin]&lt;/code&gt;<a name="line.530"></a>
+<FONT color="green">531</FONT>         *  if &lt;code&gt;length = 1 &lt;/code&gt;&lt;/li&gt;<a name="line.531"></a>
+<FONT color="green">532</FONT>         * &lt;li&gt;Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if &lt;code&gt;values&lt;/code&gt;<a name="line.532"></a>
+<FONT color="green">533</FONT>         *  is null , &lt;code&gt;begin&lt;/code&gt; or &lt;code&gt;length&lt;/code&gt; is invalid, or<a name="line.533"></a>
+<FONT color="green">534</FONT>         * &lt;code&gt;p&lt;/code&gt; is not a valid quantile value (p must be greater than 0<a name="line.534"></a>
+<FONT color="green">535</FONT>         * and less than or equal to 100)&lt;/li&gt;<a name="line.535"></a>
+<FONT color="green">536</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.536"></a>
+<FONT color="green">537</FONT>         * &lt;p&gt;<a name="line.537"></a>
+<FONT color="green">538</FONT>          * See {@link org.apache.commons.math.stat.descriptive.rank.Percentile} for<a name="line.538"></a>
+<FONT color="green">539</FONT>          * a description of the percentile estimation algorithm used.&lt;/p&gt;<a name="line.539"></a>
+<FONT color="green">540</FONT>         *<a name="line.540"></a>
+<FONT color="green">541</FONT>         * @param values array of input values<a name="line.541"></a>
+<FONT color="green">542</FONT>         * @param p  the percentile to compute<a name="line.542"></a>
+<FONT color="green">543</FONT>         * @param begin  the first (0-based) element to include in the computation<a name="line.543"></a>
+<FONT color="green">544</FONT>         * @param length  the number of array elements to include<a name="line.544"></a>
+<FONT color="green">545</FONT>         * @return  the percentile value<a name="line.545"></a>
+<FONT color="green">546</FONT>         * @throws IllegalArgumentException if the parameters are not valid or the<a name="line.546"></a>
+<FONT color="green">547</FONT>         * input array is null<a name="line.547"></a>
+<FONT color="green">548</FONT>         */<a name="line.548"></a>
+<FONT color="green">549</FONT>        public static double percentile(final double[] values, final int begin,<a name="line.549"></a>
+<FONT color="green">550</FONT>                final int length, final double p) {<a name="line.550"></a>
+<FONT color="green">551</FONT>            return PERCENTILE.evaluate(values, begin, length, p);<a name="line.551"></a>
+<FONT color="green">552</FONT>        }<a name="line.552"></a>
+<FONT color="green">553</FONT>    <a name="line.553"></a>
+<FONT color="green">554</FONT>        /**<a name="line.554"></a>
+<FONT color="green">555</FONT>         * Returns the sum of the (signed) differences between corresponding elements of the<a name="line.555"></a>
+<FONT color="green">556</FONT>         * input arrays -- i.e., sum(sample1[i] - sample2[i]).<a name="line.556"></a>
+<FONT color="green">557</FONT>         *<a name="line.557"></a>
+<FONT color="green">558</FONT>         * @param sample1  the first array<a name="line.558"></a>
+<FONT color="green">559</FONT>         * @param sample2  the second array<a name="line.559"></a>
+<FONT color="green">560</FONT>         * @return sum of paired differences<a name="line.560"></a>
+<FONT color="green">561</FONT>         * @throws IllegalArgumentException if the arrays do not have the same<a name="line.561"></a>
+<FONT color="green">562</FONT>         * (positive) length<a name="line.562"></a>
+<FONT color="green">563</FONT>         */<a name="line.563"></a>
+<FONT color="green">564</FONT>        public static double sumDifference(final double[] sample1, final double[] sample2)<a name="line.564"></a>
+<FONT color="green">565</FONT>            throws IllegalArgumentException {<a name="line.565"></a>
+<FONT color="green">566</FONT>            int n = sample1.length;<a name="line.566"></a>
+<FONT color="green">567</FONT>            if ((n  != sample2.length) || (n &lt; 1)) {<a name="line.567"></a>
+<FONT color="green">568</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.568"></a>
+<FONT color="green">569</FONT>                      "input arrays must have the same positive length ({0} and {1})",<a name="line.569"></a>
+<FONT color="green">570</FONT>                      n, sample2.length);<a name="line.570"></a>
+<FONT color="green">571</FONT>            }<a name="line.571"></a>
+<FONT color="green">572</FONT>            double result = 0;<a name="line.572"></a>
+<FONT color="green">573</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.573"></a>
+<FONT color="green">574</FONT>                result += sample1[i] - sample2[i];<a name="line.574"></a>
+<FONT color="green">575</FONT>            }<a name="line.575"></a>
+<FONT color="green">576</FONT>            return result;<a name="line.576"></a>
+<FONT color="green">577</FONT>        }<a name="line.577"></a>
+<FONT color="green">578</FONT>    <a name="line.578"></a>
+<FONT color="green">579</FONT>        /**<a name="line.579"></a>
+<FONT color="green">580</FONT>         * Returns the mean of the (signed) differences between corresponding elements of the<a name="line.580"></a>
+<FONT color="green">581</FONT>         * input arrays -- i.e., sum(sample1[i] - sample2[i]) / sample1.length.<a name="line.581"></a>
+<FONT color="green">582</FONT>         *<a name="line.582"></a>
+<FONT color="green">583</FONT>         * @param sample1  the first array<a name="line.583"></a>
+<FONT color="green">584</FONT>         * @param sample2  the second array<a name="line.584"></a>
+<FONT color="green">585</FONT>         * @return mean of paired differences<a name="line.585"></a>
+<FONT color="green">586</FONT>         * @throws IllegalArgumentException if the arrays do not have the same<a name="line.586"></a>
+<FONT color="green">587</FONT>         * (positive) length<a name="line.587"></a>
+<FONT color="green">588</FONT>         */<a name="line.588"></a>
+<FONT color="green">589</FONT>        public static double meanDifference(final double[] sample1, final double[] sample2)<a name="line.589"></a>
+<FONT color="green">590</FONT>        throws IllegalArgumentException {<a name="line.590"></a>
+<FONT color="green">591</FONT>            return sumDifference(sample1, sample2) / sample1.length;<a name="line.591"></a>
+<FONT color="green">592</FONT>        }<a name="line.592"></a>
+<FONT color="green">593</FONT>    <a name="line.593"></a>
+<FONT color="green">594</FONT>        /**<a name="line.594"></a>
+<FONT color="green">595</FONT>         * Returns the variance of the (signed) differences between corresponding elements of the<a name="line.595"></a>
+<FONT color="green">596</FONT>         * input arrays -- i.e., var(sample1[i] - sample2[i]).<a name="line.596"></a>
+<FONT color="green">597</FONT>         *<a name="line.597"></a>
+<FONT color="green">598</FONT>         * @param sample1  the first array<a name="line.598"></a>
+<FONT color="green">599</FONT>         * @param sample2  the second array<a name="line.599"></a>
+<FONT color="green">600</FONT>         * @param meanDifference   the mean difference between corresponding entries<a name="line.600"></a>
+<FONT color="green">601</FONT>         * @see #meanDifference(double[],double[])<a name="line.601"></a>
+<FONT color="green">602</FONT>         * @return variance of paired differences<a name="line.602"></a>
+<FONT color="green">603</FONT>         * @throws IllegalArgumentException if the arrays do not have the same<a name="line.603"></a>
+<FONT color="green">604</FONT>         * length or their common length is less than 2.<a name="line.604"></a>
+<FONT color="green">605</FONT>         */<a name="line.605"></a>
+<FONT color="green">606</FONT>        public static double varianceDifference(final double[] sample1, final double[] sample2,<a name="line.606"></a>
+<FONT color="green">607</FONT>                double meanDifference)  throws IllegalArgumentException {<a name="line.607"></a>
+<FONT color="green">608</FONT>            double sum1 = 0d;<a name="line.608"></a>
+<FONT color="green">609</FONT>            double sum2 = 0d;<a name="line.609"></a>
+<FONT color="green">610</FONT>            double diff = 0d;<a name="line.610"></a>
+<FONT color="green">611</FONT>            int n = sample1.length;<a name="line.611"></a>
+<FONT color="green">612</FONT>            if (n &lt; 2 || n != sample2.length) {<a name="line.612"></a>
+<FONT color="green">613</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.613"></a>
+<FONT color="green">614</FONT>                      "input arrays must have the same length and at least two elements ({0} and {1})",<a name="line.614"></a>
+<FONT color="green">615</FONT>                      n, sample2.length);<a name="line.615"></a>
+<FONT color="green">616</FONT>            }<a name="line.616"></a>
+<FONT color="green">617</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.617"></a>
+<FONT color="green">618</FONT>                diff = sample1[i] - sample2[i];<a name="line.618"></a>
+<FONT color="green">619</FONT>                sum1 += (diff - meanDifference) *(diff - meanDifference);<a name="line.619"></a>
+<FONT color="green">620</FONT>                sum2 += diff - meanDifference;<a name="line.620"></a>
+<FONT color="green">621</FONT>            }<a name="line.621"></a>
+<FONT color="green">622</FONT>            return (sum1 - (sum2 * sum2 / n)) / (n - 1);<a name="line.622"></a>
+<FONT color="green">623</FONT>        }<a name="line.623"></a>
+<FONT color="green">624</FONT>    <a name="line.624"></a>
+<FONT color="green">625</FONT>    }<a name="line.625"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/clustering/Cluster.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,140 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.stat.clustering;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.ArrayList;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.util.List;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Cluster holding a set of {@link Clusterable} points.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @param &lt;T&gt; the type of points that can be clustered<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 771076 $ $Date: 2009-05-03 12:28:48 -0400 (Sun, 03 May 2009) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @since 2.0<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public class Cluster&lt;T extends Clusterable&lt;T&gt;&gt; implements Serializable {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** Serializable version identifier. */<a name="line.32"></a>
+<FONT color="green">033</FONT>        private static final long serialVersionUID = -3442297081515880464L;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** The points contained in this cluster. */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private final List&lt;T&gt; points;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Center of the cluster. */<a name="line.38"></a>
+<FONT color="green">039</FONT>        private final T center;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * Build a cluster centered at a specified point.<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @param center the point which is to be the center of this cluster<a name="line.43"></a>
+<FONT color="green">044</FONT>         */<a name="line.44"></a>
+<FONT color="green">045</FONT>        public Cluster(final T center) {<a name="line.45"></a>
+<FONT color="green">046</FONT>            this.center = center;<a name="line.46"></a>
+<FONT color="green">047</FONT>            points = new ArrayList&lt;T&gt;();<a name="line.47"></a>
+<FONT color="green">048</FONT>        }<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Add a point to this cluster.<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @param point point to add<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        public void addPoint(final T point) {<a name="line.54"></a>
+<FONT color="green">055</FONT>            points.add(point);<a name="line.55"></a>
+<FONT color="green">056</FONT>        }<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /**<a name="line.58"></a>
+<FONT color="green">059</FONT>         * Get the points contained in the cluster.<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @return points contained in the cluster<a name="line.60"></a>
+<FONT color="green">061</FONT>         */<a name="line.61"></a>
+<FONT color="green">062</FONT>        public List&lt;T&gt; getPoints() {<a name="line.62"></a>
+<FONT color="green">063</FONT>            return points;<a name="line.63"></a>
+<FONT color="green">064</FONT>        }<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /**<a name="line.66"></a>
+<FONT color="green">067</FONT>         * Get the point chosen to be the center of this cluster.<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @return chosen cluster center<a name="line.68"></a>
+<FONT color="green">069</FONT>         */<a name="line.69"></a>
+<FONT color="green">070</FONT>        public T getCenter() {<a name="line.70"></a>
+<FONT color="green">071</FONT>            return center;<a name="line.71"></a>
+<FONT color="green">072</FONT>        }<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>    }<a name="line.74"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/clustering/Clusterable.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,112 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.stat.clustering;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Collection;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Interface for points that can be clustered together.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @param &lt;T&gt; the type of point that can be clustered<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 2.0<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public interface Clusterable&lt;T&gt; {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /**<a name="line.30"></a>
+<FONT color="green">031</FONT>         * Returns the distance from the given point.<a name="line.31"></a>
+<FONT color="green">032</FONT>         *<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @param p the point to compute the distance from<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @return the distance from the given point<a name="line.34"></a>
+<FONT color="green">035</FONT>         */<a name="line.35"></a>
+<FONT color="green">036</FONT>        double distanceFrom(T p);<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /**<a name="line.38"></a>
+<FONT color="green">039</FONT>         * Returns the centroid of the given Collection of points.<a name="line.39"></a>
+<FONT color="green">040</FONT>         *<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @param p the Collection of points to compute the centroid of<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @return the centroid of the given Collection of Points<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        T centroidOf(Collection&lt;T&gt; p);<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>    }<a name="line.46"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/clustering/EuclideanIntegerPoint.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,186 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.stat.clustering;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.Collection;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * A simple implementation of {@link Clusterable} for points with integer coordinates.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @since 2.0<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public class EuclideanIntegerPoint implements Clusterable&lt;EuclideanIntegerPoint&gt;, Serializable {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** Serializable version identifier. */<a name="line.32"></a>
+<FONT color="green">033</FONT>        private static final long serialVersionUID = 3946024775784901369L;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Point coordinates. */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private final int[] point;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /**<a name="line.38"></a>
+<FONT color="green">039</FONT>         * Build an instance wrapping an integer array.<a name="line.39"></a>
+<FONT color="green">040</FONT>         * &lt;p&gt;The wrapped array is referenced, it is &lt;em&gt;not&lt;/em&gt; copied.&lt;/p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @param point the n-dimensional point in integer space<a name="line.41"></a>
+<FONT color="green">042</FONT>         */<a name="line.42"></a>
+<FONT color="green">043</FONT>        public EuclideanIntegerPoint(final int[] point) {<a name="line.43"></a>
+<FONT color="green">044</FONT>            this.point = point;<a name="line.44"></a>
+<FONT color="green">045</FONT>        }<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Get the n-dimensional point in integer space.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @return a reference (not a copy!) to the wrapped array<a name="line.49"></a>
+<FONT color="green">050</FONT>         */<a name="line.50"></a>
+<FONT color="green">051</FONT>        public int[] getPoint() {<a name="line.51"></a>
+<FONT color="green">052</FONT>            return point;<a name="line.52"></a>
+<FONT color="green">053</FONT>        }<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** {@inheritDoc} */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public double distanceFrom(final EuclideanIntegerPoint p) {<a name="line.56"></a>
+<FONT color="green">057</FONT>            return MathUtils.distance(point, p.getPoint());<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** {@inheritDoc} */<a name="line.60"></a>
+<FONT color="green">061</FONT>        public EuclideanIntegerPoint centroidOf(final Collection&lt;EuclideanIntegerPoint&gt; points) {<a name="line.61"></a>
+<FONT color="green">062</FONT>            int[] centroid = new int[getPoint().length];<a name="line.62"></a>
+<FONT color="green">063</FONT>            for (EuclideanIntegerPoint p : points) {<a name="line.63"></a>
+<FONT color="green">064</FONT>                for (int i = 0; i &lt; centroid.length; i++) {<a name="line.64"></a>
+<FONT color="green">065</FONT>                    centroid[i] += p.getPoint()[i];<a name="line.65"></a>
+<FONT color="green">066</FONT>                }<a name="line.66"></a>
+<FONT color="green">067</FONT>            }<a name="line.67"></a>
+<FONT color="green">068</FONT>            for (int i = 0; i &lt; centroid.length; i++) {<a name="line.68"></a>
+<FONT color="green">069</FONT>                centroid[i] /= points.size();<a name="line.69"></a>
+<FONT color="green">070</FONT>            }<a name="line.70"></a>
+<FONT color="green">071</FONT>            return new EuclideanIntegerPoint(centroid);<a name="line.71"></a>
+<FONT color="green">072</FONT>        }<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /** {@inheritDoc} */<a name="line.74"></a>
+<FONT color="green">075</FONT>        @Override<a name="line.75"></a>
+<FONT color="green">076</FONT>        public boolean equals(final Object other) {<a name="line.76"></a>
+<FONT color="green">077</FONT>            if (!(other instanceof EuclideanIntegerPoint)) {<a name="line.77"></a>
+<FONT color="green">078</FONT>                return false;<a name="line.78"></a>
+<FONT color="green">079</FONT>            }<a name="line.79"></a>
+<FONT color="green">080</FONT>            final int[] otherPoint = ((EuclideanIntegerPoint) other).getPoint();<a name="line.80"></a>
+<FONT color="green">081</FONT>            if (point.length != otherPoint.length) {<a name="line.81"></a>
+<FONT color="green">082</FONT>                return false;<a name="line.82"></a>
+<FONT color="green">083</FONT>            }<a name="line.83"></a>
+<FONT color="green">084</FONT>            for (int i = 0; i &lt; point.length; i++) {<a name="line.84"></a>
+<FONT color="green">085</FONT>                if (point[i] != otherPoint[i]) {<a name="line.85"></a>
+<FONT color="green">086</FONT>                    return false;<a name="line.86"></a>
+<FONT color="green">087</FONT>                }<a name="line.87"></a>
+<FONT color="green">088</FONT>            }<a name="line.88"></a>
+<FONT color="green">089</FONT>            return true;<a name="line.89"></a>
+<FONT color="green">090</FONT>        }<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /** {@inheritDoc} */<a name="line.92"></a>
+<FONT color="green">093</FONT>        @Override<a name="line.93"></a>
+<FONT color="green">094</FONT>        public int hashCode() {<a name="line.94"></a>
+<FONT color="green">095</FONT>            int hashCode = 0;<a name="line.95"></a>
+<FONT color="green">096</FONT>            for (Integer i : point) {<a name="line.96"></a>
+<FONT color="green">097</FONT>                hashCode += i.hashCode() * 13 + 7;<a name="line.97"></a>
+<FONT color="green">098</FONT>            }<a name="line.98"></a>
+<FONT color="green">099</FONT>            return hashCode;<a name="line.99"></a>
+<FONT color="green">100</FONT>        }<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>        /**<a name="line.102"></a>
+<FONT color="green">103</FONT>         * {@inheritDoc}<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @since 2.1<a name="line.104"></a>
+<FONT color="green">105</FONT>         */<a name="line.105"></a>
+<FONT color="green">106</FONT>        @Override<a name="line.106"></a>
+<FONT color="green">107</FONT>        public String toString() {<a name="line.107"></a>
+<FONT color="green">108</FONT>            final StringBuffer buff = new StringBuffer("(");<a name="line.108"></a>
+<FONT color="green">109</FONT>            final int[] coordinates = getPoint();<a name="line.109"></a>
+<FONT color="green">110</FONT>            for (int i = 0; i &lt; coordinates.length; i++) {<a name="line.110"></a>
+<FONT color="green">111</FONT>                buff.append(coordinates[i]);<a name="line.111"></a>
+<FONT color="green">112</FONT>                if (i &lt; coordinates.length - 1) {<a name="line.112"></a>
+<FONT color="green">113</FONT>                    buff.append(",");<a name="line.113"></a>
+<FONT color="green">114</FONT>                }<a name="line.114"></a>
+<FONT color="green">115</FONT>            }<a name="line.115"></a>
+<FONT color="green">116</FONT>            buff.append(")");<a name="line.116"></a>
+<FONT color="green">117</FONT>            return buff.toString();<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>    }<a name="line.120"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/clustering/KMeansPlusPlusClusterer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,231 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.stat.clustering;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.ArrayList;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.Collection;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.util.List;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.util.Random;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Clustering algorithm based on David Arthur and Sergei Vassilvitski k-means++ algorithm.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @param &lt;T&gt; type of the points to cluster<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @see &lt;a href="http://en.wikipedia.org/wiki/K-means%2B%2B"&gt;K-means++ (wikipedia)&lt;/a&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @since 2.0<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    public class KMeansPlusPlusClusterer&lt;T extends Clusterable&lt;T&gt;&gt; {<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /** Random generator for choosing initial centers. */<a name="line.34"></a>
+<FONT color="green">035</FONT>        private final Random random;<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /** Build a clusterer.<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @param random random generator to use for choosing initial centers<a name="line.38"></a>
+<FONT color="green">039</FONT>         */<a name="line.39"></a>
+<FONT color="green">040</FONT>        public KMeansPlusPlusClusterer(final Random random) {<a name="line.40"></a>
+<FONT color="green">041</FONT>            this.random = random;<a name="line.41"></a>
+<FONT color="green">042</FONT>        }<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /**<a name="line.44"></a>
+<FONT color="green">045</FONT>         * Runs the K-means++ clustering algorithm.<a name="line.45"></a>
+<FONT color="green">046</FONT>         *<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @param points the points to cluster<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @param k the number of clusters to split the data into<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @param maxIterations the maximum number of iterations to run the algorithm<a name="line.49"></a>
+<FONT color="green">050</FONT>         *     for.  If negative, no maximum will be used<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @return a list of clusters containing the points<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        public List&lt;Cluster&lt;T&gt;&gt; cluster(final Collection&lt;T&gt; points,<a name="line.53"></a>
+<FONT color="green">054</FONT>                                        final int k, final int maxIterations) {<a name="line.54"></a>
+<FONT color="green">055</FONT>            // create the initial clusters<a name="line.55"></a>
+<FONT color="green">056</FONT>            List&lt;Cluster&lt;T&gt;&gt; clusters = chooseInitialCenters(points, k, random);<a name="line.56"></a>
+<FONT color="green">057</FONT>            assignPointsToClusters(clusters, points);<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>            // iterate through updating the centers until we're done<a name="line.59"></a>
+<FONT color="green">060</FONT>            final int max = (maxIterations &lt; 0) ? Integer.MAX_VALUE : maxIterations;<a name="line.60"></a>
+<FONT color="green">061</FONT>            for (int count = 0; count &lt; max; count++) {<a name="line.61"></a>
+<FONT color="green">062</FONT>                boolean clusteringChanged = false;<a name="line.62"></a>
+<FONT color="green">063</FONT>                List&lt;Cluster&lt;T&gt;&gt; newClusters = new ArrayList&lt;Cluster&lt;T&gt;&gt;();<a name="line.63"></a>
+<FONT color="green">064</FONT>                for (final Cluster&lt;T&gt; cluster : clusters) {<a name="line.64"></a>
+<FONT color="green">065</FONT>                    final T newCenter = cluster.getCenter().centroidOf(cluster.getPoints());<a name="line.65"></a>
+<FONT color="green">066</FONT>                    if (!newCenter.equals(cluster.getCenter())) {<a name="line.66"></a>
+<FONT color="green">067</FONT>                        clusteringChanged = true;<a name="line.67"></a>
+<FONT color="green">068</FONT>                    }<a name="line.68"></a>
+<FONT color="green">069</FONT>                    newClusters.add(new Cluster&lt;T&gt;(newCenter));<a name="line.69"></a>
+<FONT color="green">070</FONT>                }<a name="line.70"></a>
+<FONT color="green">071</FONT>                if (!clusteringChanged) {<a name="line.71"></a>
+<FONT color="green">072</FONT>                    return clusters;<a name="line.72"></a>
+<FONT color="green">073</FONT>                }<a name="line.73"></a>
+<FONT color="green">074</FONT>                assignPointsToClusters(newClusters, points);<a name="line.74"></a>
+<FONT color="green">075</FONT>                clusters = newClusters;<a name="line.75"></a>
+<FONT color="green">076</FONT>            }<a name="line.76"></a>
+<FONT color="green">077</FONT>            return clusters;<a name="line.77"></a>
+<FONT color="green">078</FONT>        }<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /**<a name="line.80"></a>
+<FONT color="green">081</FONT>         * Adds the given points to the closest {@link Cluster}.<a name="line.81"></a>
+<FONT color="green">082</FONT>         *<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param &lt;T&gt; type of the points to cluster<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @param clusters the {@link Cluster}s to add the points to<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @param points the points to add to the given {@link Cluster}s<a name="line.85"></a>
+<FONT color="green">086</FONT>         */<a name="line.86"></a>
+<FONT color="green">087</FONT>        private static &lt;T extends Clusterable&lt;T&gt;&gt; void<a name="line.87"></a>
+<FONT color="green">088</FONT>            assignPointsToClusters(final Collection&lt;Cluster&lt;T&gt;&gt; clusters, final Collection&lt;T&gt; points) {<a name="line.88"></a>
+<FONT color="green">089</FONT>            for (final T p : points) {<a name="line.89"></a>
+<FONT color="green">090</FONT>                Cluster&lt;T&gt; cluster = getNearestCluster(clusters, p);<a name="line.90"></a>
+<FONT color="green">091</FONT>                cluster.addPoint(p);<a name="line.91"></a>
+<FONT color="green">092</FONT>            }<a name="line.92"></a>
+<FONT color="green">093</FONT>        }<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /**<a name="line.95"></a>
+<FONT color="green">096</FONT>         * Use K-means++ to choose the initial centers.<a name="line.96"></a>
+<FONT color="green">097</FONT>         *<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @param &lt;T&gt; type of the points to cluster<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @param points the points to choose the initial centers from<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @param k the number of centers to choose<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @param random random generator to use<a name="line.101"></a>
+<FONT color="green">102</FONT>         * @return the initial centers<a name="line.102"></a>
+<FONT color="green">103</FONT>         */<a name="line.103"></a>
+<FONT color="green">104</FONT>        private static &lt;T extends Clusterable&lt;T&gt;&gt; List&lt;Cluster&lt;T&gt;&gt;<a name="line.104"></a>
+<FONT color="green">105</FONT>            chooseInitialCenters(final Collection&lt;T&gt; points, final int k, final Random random) {<a name="line.105"></a>
+<FONT color="green">106</FONT>    <a name="line.106"></a>
+<FONT color="green">107</FONT>            final List&lt;T&gt; pointSet = new ArrayList&lt;T&gt;(points);<a name="line.107"></a>
+<FONT color="green">108</FONT>            final List&lt;Cluster&lt;T&gt;&gt; resultSet = new ArrayList&lt;Cluster&lt;T&gt;&gt;();<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>            // Choose one center uniformly at random from among the data points.<a name="line.110"></a>
+<FONT color="green">111</FONT>            final T firstPoint = pointSet.remove(random.nextInt(pointSet.size()));<a name="line.111"></a>
+<FONT color="green">112</FONT>            resultSet.add(new Cluster&lt;T&gt;(firstPoint));<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>            final double[] dx2 = new double[pointSet.size()];<a name="line.114"></a>
+<FONT color="green">115</FONT>            while (resultSet.size() &lt; k) {<a name="line.115"></a>
+<FONT color="green">116</FONT>                // For each data point x, compute D(x), the distance between x and<a name="line.116"></a>
+<FONT color="green">117</FONT>                // the nearest center that has already been chosen.<a name="line.117"></a>
+<FONT color="green">118</FONT>                int sum = 0;<a name="line.118"></a>
+<FONT color="green">119</FONT>                for (int i = 0; i &lt; pointSet.size(); i++) {<a name="line.119"></a>
+<FONT color="green">120</FONT>                    final T p = pointSet.get(i);<a name="line.120"></a>
+<FONT color="green">121</FONT>                    final Cluster&lt;T&gt; nearest = getNearestCluster(resultSet, p);<a name="line.121"></a>
+<FONT color="green">122</FONT>                    final double d = p.distanceFrom(nearest.getCenter());<a name="line.122"></a>
+<FONT color="green">123</FONT>                    sum += d * d;<a name="line.123"></a>
+<FONT color="green">124</FONT>                    dx2[i] = sum;<a name="line.124"></a>
+<FONT color="green">125</FONT>                }<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>                // Add one new data point as a center. Each point x is chosen with<a name="line.127"></a>
+<FONT color="green">128</FONT>                // probability proportional to D(x)2<a name="line.128"></a>
+<FONT color="green">129</FONT>                final double r = random.nextDouble() * sum;<a name="line.129"></a>
+<FONT color="green">130</FONT>                for (int i = 0 ; i &lt; dx2.length; i++) {<a name="line.130"></a>
+<FONT color="green">131</FONT>                    if (dx2[i] &gt;= r) {<a name="line.131"></a>
+<FONT color="green">132</FONT>                        final T p = pointSet.remove(i);<a name="line.132"></a>
+<FONT color="green">133</FONT>                        resultSet.add(new Cluster&lt;T&gt;(p));<a name="line.133"></a>
+<FONT color="green">134</FONT>                        break;<a name="line.134"></a>
+<FONT color="green">135</FONT>                    }<a name="line.135"></a>
+<FONT color="green">136</FONT>                }<a name="line.136"></a>
+<FONT color="green">137</FONT>            }<a name="line.137"></a>
+<FONT color="green">138</FONT>    <a name="line.138"></a>
+<FONT color="green">139</FONT>            return resultSet;<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>        }<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>        /**<a name="line.143"></a>
+<FONT color="green">144</FONT>         * Returns the nearest {@link Cluster} to the given point<a name="line.144"></a>
+<FONT color="green">145</FONT>         *<a name="line.145"></a>
+<FONT color="green">146</FONT>         * @param &lt;T&gt; type of the points to cluster<a name="line.146"></a>
+<FONT color="green">147</FONT>         * @param clusters the {@link Cluster}s to search<a name="line.147"></a>
+<FONT color="green">148</FONT>         * @param point the point to find the nearest {@link Cluster} for<a name="line.148"></a>
+<FONT color="green">149</FONT>         * @return the nearest {@link Cluster} to the given point<a name="line.149"></a>
+<FONT color="green">150</FONT>         */<a name="line.150"></a>
+<FONT color="green">151</FONT>        private static &lt;T extends Clusterable&lt;T&gt;&gt; Cluster&lt;T&gt;<a name="line.151"></a>
+<FONT color="green">152</FONT>            getNearestCluster(final Collection&lt;Cluster&lt;T&gt;&gt; clusters, final T point) {<a name="line.152"></a>
+<FONT color="green">153</FONT>            double minDistance = Double.MAX_VALUE;<a name="line.153"></a>
+<FONT color="green">154</FONT>            Cluster&lt;T&gt; minCluster = null;<a name="line.154"></a>
+<FONT color="green">155</FONT>            for (final Cluster&lt;T&gt; c : clusters) {<a name="line.155"></a>
+<FONT color="green">156</FONT>                final double distance = point.distanceFrom(c.getCenter());<a name="line.156"></a>
+<FONT color="green">157</FONT>                if (distance &lt; minDistance) {<a name="line.157"></a>
+<FONT color="green">158</FONT>                    minDistance = distance;<a name="line.158"></a>
+<FONT color="green">159</FONT>                    minCluster = c;<a name="line.159"></a>
+<FONT color="green">160</FONT>                }<a name="line.160"></a>
+<FONT color="green">161</FONT>            }<a name="line.161"></a>
+<FONT color="green">162</FONT>            return minCluster;<a name="line.162"></a>
+<FONT color="green">163</FONT>        }<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>    }<a name="line.165"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/correlation/Covariance.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,339 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.correlation;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.linear.RealMatrix;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.linear.BlockRealMatrix;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.stat.descriptive.moment.Mean;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.stat.descriptive.moment.Variance;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Computes covariances for pairs of arrays or columns of a matrix.<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;The constructors that take &lt;code&gt;RealMatrix&lt;/code&gt; or<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;code&gt;double[][]&lt;/code&gt; arguments generate covariance matrices.  The<a name="line.29"></a>
+<FONT color="green">030</FONT>     * columns of the input matrices are assumed to represent variable values.&lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     *<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;The constructor argument &lt;code&gt;biasCorrected&lt;/code&gt; determines whether or<a name="line.32"></a>
+<FONT color="green">033</FONT>     * not computed covariances are bias-corrected.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     *<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;p&gt;Unbiased covariances are given by the formula&lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;code&gt;cov(X, Y) = &amp;Sigma;[(x&lt;sub&gt;i&lt;/sub&gt; - E(X))(y&lt;sub&gt;i&lt;/sub&gt; - E(Y))] / (n - 1)&lt;/code&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * where &lt;code&gt;E(X)&lt;/code&gt; is the mean of &lt;code&gt;X&lt;/code&gt; and &lt;code&gt;E(Y)&lt;/code&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * is the mean of the &lt;code&gt;Y&lt;/code&gt; values.<a name="line.38"></a>
+<FONT color="green">039</FONT>     *<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;p&gt;Non-bias-corrected estimates use &lt;code&gt;n&lt;/code&gt; in place of &lt;code&gt;n - 1&lt;/code&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     *<a name="line.41"></a>
+<FONT color="green">042</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.42"></a>
+<FONT color="green">043</FONT>     * @since 2.0<a name="line.43"></a>
+<FONT color="green">044</FONT>     */<a name="line.44"></a>
+<FONT color="green">045</FONT>    public class Covariance {<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** covariance matrix */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private final RealMatrix covarianceMatrix;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Create an empty covariance matrix.<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        /** Number of observations (length of covariate vectors) */<a name="line.53"></a>
+<FONT color="green">054</FONT>        private final int n;<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /**<a name="line.56"></a>
+<FONT color="green">057</FONT>         * Create a Covariance with no data<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public Covariance() {<a name="line.59"></a>
+<FONT color="green">060</FONT>            super();<a name="line.60"></a>
+<FONT color="green">061</FONT>            covarianceMatrix = null;<a name="line.61"></a>
+<FONT color="green">062</FONT>            n = 0;<a name="line.62"></a>
+<FONT color="green">063</FONT>        }<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /**<a name="line.65"></a>
+<FONT color="green">066</FONT>         * Create a Covariance matrix from a rectangular array<a name="line.66"></a>
+<FONT color="green">067</FONT>         * whose columns represent covariates.<a name="line.67"></a>
+<FONT color="green">068</FONT>         *<a name="line.68"></a>
+<FONT color="green">069</FONT>         * &lt;p&gt;The &lt;code&gt;biasCorrected&lt;/code&gt; parameter determines whether or not<a name="line.69"></a>
+<FONT color="green">070</FONT>         * covariance estimates are bias-corrected.&lt;/p&gt;<a name="line.70"></a>
+<FONT color="green">071</FONT>         *<a name="line.71"></a>
+<FONT color="green">072</FONT>         * &lt;p&gt;The input array must be rectangular with at least two columns<a name="line.72"></a>
+<FONT color="green">073</FONT>         * and two rows.&lt;/p&gt;<a name="line.73"></a>
+<FONT color="green">074</FONT>         *<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @param data rectangular array with columns representing covariates<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @param biasCorrected true means covariances are bias-corrected<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @throws IllegalArgumentException if the input data array is not<a name="line.77"></a>
+<FONT color="green">078</FONT>         * rectangular with at least two rows and two columns.<a name="line.78"></a>
+<FONT color="green">079</FONT>         */<a name="line.79"></a>
+<FONT color="green">080</FONT>        public Covariance(double[][] data, boolean biasCorrected) {<a name="line.80"></a>
+<FONT color="green">081</FONT>            this(new BlockRealMatrix(data), biasCorrected);<a name="line.81"></a>
+<FONT color="green">082</FONT>        }<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /**<a name="line.84"></a>
+<FONT color="green">085</FONT>         * Create a Covariance matrix from a rectangular array<a name="line.85"></a>
+<FONT color="green">086</FONT>         * whose columns represent covariates.<a name="line.86"></a>
+<FONT color="green">087</FONT>         *<a name="line.87"></a>
+<FONT color="green">088</FONT>         * &lt;p&gt;The input array must be rectangular with at least two columns<a name="line.88"></a>
+<FONT color="green">089</FONT>         * and two rows&lt;/p&gt;<a name="line.89"></a>
+<FONT color="green">090</FONT>         *<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @param data rectangular array with columns representing covariates<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @throws IllegalArgumentException if the input data array is not<a name="line.92"></a>
+<FONT color="green">093</FONT>         * rectangular with at least two rows and two columns.<a name="line.93"></a>
+<FONT color="green">094</FONT>         */<a name="line.94"></a>
+<FONT color="green">095</FONT>        public Covariance(double[][] data) {<a name="line.95"></a>
+<FONT color="green">096</FONT>            this(data, true);<a name="line.96"></a>
+<FONT color="green">097</FONT>        }<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>        /**<a name="line.99"></a>
+<FONT color="green">100</FONT>         * Create a covariance matrix from a matrix whose columns<a name="line.100"></a>
+<FONT color="green">101</FONT>         * represent covariates.<a name="line.101"></a>
+<FONT color="green">102</FONT>         *<a name="line.102"></a>
+<FONT color="green">103</FONT>         * &lt;p&gt;The &lt;code&gt;biasCorrected&lt;/code&gt; parameter determines whether or not<a name="line.103"></a>
+<FONT color="green">104</FONT>         * covariance estimates are bias-corrected.&lt;/p&gt;<a name="line.104"></a>
+<FONT color="green">105</FONT>         *<a name="line.105"></a>
+<FONT color="green">106</FONT>         * &lt;p&gt;The matrix must have at least two columns and two rows&lt;/p&gt;<a name="line.106"></a>
+<FONT color="green">107</FONT>         *<a name="line.107"></a>
+<FONT color="green">108</FONT>         * @param matrix matrix with columns representing covariates<a name="line.108"></a>
+<FONT color="green">109</FONT>         * @param biasCorrected true means covariances are bias-corrected<a name="line.109"></a>
+<FONT color="green">110</FONT>         * @throws IllegalArgumentException if the input matrix does not have<a name="line.110"></a>
+<FONT color="green">111</FONT>         * at least two rows and two columns<a name="line.111"></a>
+<FONT color="green">112</FONT>         */<a name="line.112"></a>
+<FONT color="green">113</FONT>        public Covariance(RealMatrix matrix, boolean biasCorrected) {<a name="line.113"></a>
+<FONT color="green">114</FONT>           checkSufficientData(matrix);<a name="line.114"></a>
+<FONT color="green">115</FONT>           n = matrix.getRowDimension();<a name="line.115"></a>
+<FONT color="green">116</FONT>           covarianceMatrix = computeCovarianceMatrix(matrix, biasCorrected);<a name="line.116"></a>
+<FONT color="green">117</FONT>        }<a name="line.117"></a>
+<FONT color="green">118</FONT>    <a name="line.118"></a>
+<FONT color="green">119</FONT>        /**<a name="line.119"></a>
+<FONT color="green">120</FONT>         * Create a covariance matrix from a matrix whose columns<a name="line.120"></a>
+<FONT color="green">121</FONT>         * represent covariates.<a name="line.121"></a>
+<FONT color="green">122</FONT>         *<a name="line.122"></a>
+<FONT color="green">123</FONT>         * &lt;p&gt;The matrix must have at least two columns and two rows&lt;/p&gt;<a name="line.123"></a>
+<FONT color="green">124</FONT>         *<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @param matrix matrix with columns representing covariates<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @throws IllegalArgumentException if the input matrix does not have<a name="line.126"></a>
+<FONT color="green">127</FONT>         * at least two rows and two columns<a name="line.127"></a>
+<FONT color="green">128</FONT>         */<a name="line.128"></a>
+<FONT color="green">129</FONT>        public Covariance(RealMatrix matrix) {<a name="line.129"></a>
+<FONT color="green">130</FONT>            this(matrix, true);<a name="line.130"></a>
+<FONT color="green">131</FONT>        }<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>        /**<a name="line.133"></a>
+<FONT color="green">134</FONT>         * Returns the covariance matrix<a name="line.134"></a>
+<FONT color="green">135</FONT>         *<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @return covariance matrix<a name="line.136"></a>
+<FONT color="green">137</FONT>         */<a name="line.137"></a>
+<FONT color="green">138</FONT>        public RealMatrix getCovarianceMatrix() {<a name="line.138"></a>
+<FONT color="green">139</FONT>            return covarianceMatrix;<a name="line.139"></a>
+<FONT color="green">140</FONT>        }<a name="line.140"></a>
+<FONT color="green">141</FONT>    <a name="line.141"></a>
+<FONT color="green">142</FONT>        /**<a name="line.142"></a>
+<FONT color="green">143</FONT>         * Returns the number of observations (length of covariate vectors)<a name="line.143"></a>
+<FONT color="green">144</FONT>         *<a name="line.144"></a>
+<FONT color="green">145</FONT>         * @return number of observations<a name="line.145"></a>
+<FONT color="green">146</FONT>         */<a name="line.146"></a>
+<FONT color="green">147</FONT>    <a name="line.147"></a>
+<FONT color="green">148</FONT>        public int getN() {<a name="line.148"></a>
+<FONT color="green">149</FONT>            return n;<a name="line.149"></a>
+<FONT color="green">150</FONT>        }<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>        /**<a name="line.152"></a>
+<FONT color="green">153</FONT>         * Compute a covariance matrix from a matrix whose columns represent<a name="line.153"></a>
+<FONT color="green">154</FONT>         * covariates.<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @param matrix input matrix (must have at least two columns and two rows)<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @param biasCorrected determines whether or not covariance estimates are bias-corrected<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @return covariance matrix<a name="line.157"></a>
+<FONT color="green">158</FONT>         */<a name="line.158"></a>
+<FONT color="green">159</FONT>        protected RealMatrix computeCovarianceMatrix(RealMatrix matrix, boolean biasCorrected) {<a name="line.159"></a>
+<FONT color="green">160</FONT>            int dimension = matrix.getColumnDimension();<a name="line.160"></a>
+<FONT color="green">161</FONT>            Variance variance = new Variance(biasCorrected);<a name="line.161"></a>
+<FONT color="green">162</FONT>            RealMatrix outMatrix = new BlockRealMatrix(dimension, dimension);<a name="line.162"></a>
+<FONT color="green">163</FONT>            for (int i = 0; i &lt; dimension; i++) {<a name="line.163"></a>
+<FONT color="green">164</FONT>                for (int j = 0; j &lt; i; j++) {<a name="line.164"></a>
+<FONT color="green">165</FONT>                  double cov = covariance(matrix.getColumn(i), matrix.getColumn(j), biasCorrected);<a name="line.165"></a>
+<FONT color="green">166</FONT>                  outMatrix.setEntry(i, j, cov);<a name="line.166"></a>
+<FONT color="green">167</FONT>                  outMatrix.setEntry(j, i, cov);<a name="line.167"></a>
+<FONT color="green">168</FONT>                }<a name="line.168"></a>
+<FONT color="green">169</FONT>                outMatrix.setEntry(i, i, variance.evaluate(matrix.getColumn(i)));<a name="line.169"></a>
+<FONT color="green">170</FONT>            }<a name="line.170"></a>
+<FONT color="green">171</FONT>            return outMatrix;<a name="line.171"></a>
+<FONT color="green">172</FONT>        }<a name="line.172"></a>
+<FONT color="green">173</FONT>    <a name="line.173"></a>
+<FONT color="green">174</FONT>        /**<a name="line.174"></a>
+<FONT color="green">175</FONT>         * Create a covariance matrix from a matrix whose columns represent<a name="line.175"></a>
+<FONT color="green">176</FONT>         * covariates. Covariances are computed using the bias-corrected formula.<a name="line.176"></a>
+<FONT color="green">177</FONT>         * @param matrix input matrix (must have at least two columns and two rows)<a name="line.177"></a>
+<FONT color="green">178</FONT>         * @return covariance matrix<a name="line.178"></a>
+<FONT color="green">179</FONT>         * @see #Covariance<a name="line.179"></a>
+<FONT color="green">180</FONT>         */<a name="line.180"></a>
+<FONT color="green">181</FONT>        protected RealMatrix computeCovarianceMatrix(RealMatrix matrix) {<a name="line.181"></a>
+<FONT color="green">182</FONT>            return computeCovarianceMatrix(matrix, true);<a name="line.182"></a>
+<FONT color="green">183</FONT>        }<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>        /**<a name="line.185"></a>
+<FONT color="green">186</FONT>         * Compute a covariance matrix from a rectangular array whose columns represent<a name="line.186"></a>
+<FONT color="green">187</FONT>         * covariates.<a name="line.187"></a>
+<FONT color="green">188</FONT>         * @param data input array (must have at least two columns and two rows)<a name="line.188"></a>
+<FONT color="green">189</FONT>         * @param biasCorrected determines whether or not covariance estimates are bias-corrected<a name="line.189"></a>
+<FONT color="green">190</FONT>         * @return covariance matrix<a name="line.190"></a>
+<FONT color="green">191</FONT>         */<a name="line.191"></a>
+<FONT color="green">192</FONT>        protected RealMatrix computeCovarianceMatrix(double[][] data, boolean biasCorrected) {<a name="line.192"></a>
+<FONT color="green">193</FONT>            return computeCovarianceMatrix(new BlockRealMatrix(data), biasCorrected);<a name="line.193"></a>
+<FONT color="green">194</FONT>        }<a name="line.194"></a>
+<FONT color="green">195</FONT>    <a name="line.195"></a>
+<FONT color="green">196</FONT>        /**<a name="line.196"></a>
+<FONT color="green">197</FONT>         * Create a covariance matrix from a rectangual array whose columns represent<a name="line.197"></a>
+<FONT color="green">198</FONT>         * covariates. Covariances are computed using the bias-corrected formula.<a name="line.198"></a>
+<FONT color="green">199</FONT>         * @param data input array (must have at least two columns and two rows)<a name="line.199"></a>
+<FONT color="green">200</FONT>         * @return covariance matrix<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @see #Covariance<a name="line.201"></a>
+<FONT color="green">202</FONT>         */<a name="line.202"></a>
+<FONT color="green">203</FONT>        protected RealMatrix computeCovarianceMatrix(double[][] data) {<a name="line.203"></a>
+<FONT color="green">204</FONT>            return computeCovarianceMatrix(data, true);<a name="line.204"></a>
+<FONT color="green">205</FONT>        }<a name="line.205"></a>
+<FONT color="green">206</FONT>    <a name="line.206"></a>
+<FONT color="green">207</FONT>        /**<a name="line.207"></a>
+<FONT color="green">208</FONT>         * Computes the covariance between the two arrays.<a name="line.208"></a>
+<FONT color="green">209</FONT>         *<a name="line.209"></a>
+<FONT color="green">210</FONT>         * &lt;p&gt;Array lengths must match and the common length must be at least 2.&lt;/p&gt;<a name="line.210"></a>
+<FONT color="green">211</FONT>         *<a name="line.211"></a>
+<FONT color="green">212</FONT>         * @param xArray first data array<a name="line.212"></a>
+<FONT color="green">213</FONT>         * @param yArray second data array<a name="line.213"></a>
+<FONT color="green">214</FONT>         * @param biasCorrected if true, returned value will be bias-corrected<a name="line.214"></a>
+<FONT color="green">215</FONT>         * @return returns the covariance for the two arrays<a name="line.215"></a>
+<FONT color="green">216</FONT>         * @throws  IllegalArgumentException if the arrays lengths do not match or<a name="line.216"></a>
+<FONT color="green">217</FONT>         * there is insufficient data<a name="line.217"></a>
+<FONT color="green">218</FONT>         */<a name="line.218"></a>
+<FONT color="green">219</FONT>        public double covariance(final double[] xArray, final double[] yArray, boolean biasCorrected)<a name="line.219"></a>
+<FONT color="green">220</FONT>            throws IllegalArgumentException {<a name="line.220"></a>
+<FONT color="green">221</FONT>            Mean mean = new Mean();<a name="line.221"></a>
+<FONT color="green">222</FONT>            double result = 0d;<a name="line.222"></a>
+<FONT color="green">223</FONT>            int length = xArray.length;<a name="line.223"></a>
+<FONT color="green">224</FONT>            if(length == yArray.length &amp;&amp; length &gt; 1) {<a name="line.224"></a>
+<FONT color="green">225</FONT>                double xMean = mean.evaluate(xArray);<a name="line.225"></a>
+<FONT color="green">226</FONT>                double yMean = mean.evaluate(yArray);<a name="line.226"></a>
+<FONT color="green">227</FONT>                for (int i = 0; i &lt; length; i++) {<a name="line.227"></a>
+<FONT color="green">228</FONT>                    double xDev = xArray[i] - xMean;<a name="line.228"></a>
+<FONT color="green">229</FONT>                    double yDev = yArray[i] - yMean;<a name="line.229"></a>
+<FONT color="green">230</FONT>                    result += (xDev * yDev - result) / (i + 1);<a name="line.230"></a>
+<FONT color="green">231</FONT>                }<a name="line.231"></a>
+<FONT color="green">232</FONT>            }<a name="line.232"></a>
+<FONT color="green">233</FONT>            else {<a name="line.233"></a>
+<FONT color="green">234</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.234"></a>
+<FONT color="green">235</FONT>                   "arrays must have the same length and both must have at " +<a name="line.235"></a>
+<FONT color="green">236</FONT>                   "least two elements. xArray has size {0}, yArray has {1} elements",<a name="line.236"></a>
+<FONT color="green">237</FONT>                        length, yArray.length);<a name="line.237"></a>
+<FONT color="green">238</FONT>            }<a name="line.238"></a>
+<FONT color="green">239</FONT>            return biasCorrected ? result * ((double) length / (double)(length - 1)) : result;<a name="line.239"></a>
+<FONT color="green">240</FONT>        }<a name="line.240"></a>
+<FONT color="green">241</FONT>    <a name="line.241"></a>
+<FONT color="green">242</FONT>        /**<a name="line.242"></a>
+<FONT color="green">243</FONT>         * Computes the covariance between the two arrays, using the bias-corrected<a name="line.243"></a>
+<FONT color="green">244</FONT>         * formula.<a name="line.244"></a>
+<FONT color="green">245</FONT>         *<a name="line.245"></a>
+<FONT color="green">246</FONT>         * &lt;p&gt;Array lengths must match and the common length must be at least 2.&lt;/p&gt;<a name="line.246"></a>
+<FONT color="green">247</FONT>         *<a name="line.247"></a>
+<FONT color="green">248</FONT>         * @param xArray first data array<a name="line.248"></a>
+<FONT color="green">249</FONT>         * @param yArray second data array<a name="line.249"></a>
+<FONT color="green">250</FONT>         * @return returns the covariance for the two arrays<a name="line.250"></a>
+<FONT color="green">251</FONT>         * @throws  IllegalArgumentException if the arrays lengths do not match or<a name="line.251"></a>
+<FONT color="green">252</FONT>         * there is insufficient data<a name="line.252"></a>
+<FONT color="green">253</FONT>         */<a name="line.253"></a>
+<FONT color="green">254</FONT>        public double covariance(final double[] xArray, final double[] yArray)<a name="line.254"></a>
+<FONT color="green">255</FONT>            throws IllegalArgumentException {<a name="line.255"></a>
+<FONT color="green">256</FONT>            return covariance(xArray, yArray, true);<a name="line.256"></a>
+<FONT color="green">257</FONT>        }<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>        /**<a name="line.259"></a>
+<FONT color="green">260</FONT>         * Throws IllegalArgumentException of the matrix does not have at least<a name="line.260"></a>
+<FONT color="green">261</FONT>         * two columns and two rows<a name="line.261"></a>
+<FONT color="green">262</FONT>         * @param matrix matrix to check<a name="line.262"></a>
+<FONT color="green">263</FONT>         */<a name="line.263"></a>
+<FONT color="green">264</FONT>        private void checkSufficientData(final RealMatrix matrix) {<a name="line.264"></a>
+<FONT color="green">265</FONT>            int nRows = matrix.getRowDimension();<a name="line.265"></a>
+<FONT color="green">266</FONT>            int nCols = matrix.getColumnDimension();<a name="line.266"></a>
+<FONT color="green">267</FONT>            if (nRows &lt; 2 || nCols &lt; 2) {<a name="line.267"></a>
+<FONT color="green">268</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.268"></a>
+<FONT color="green">269</FONT>                        "insufficient data: only {0} rows and {1} columns.",<a name="line.269"></a>
+<FONT color="green">270</FONT>                        nRows, nCols);<a name="line.270"></a>
+<FONT color="green">271</FONT>            }<a name="line.271"></a>
+<FONT color="green">272</FONT>        }<a name="line.272"></a>
+<FONT color="green">273</FONT>    }<a name="line.273"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/correlation/PearsonsCorrelation.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,347 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.correlation;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.distribution.TDistribution;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.distribution.TDistributionImpl;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.linear.RealMatrix;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.linear.BlockRealMatrix;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.stat.regression.SimpleRegression;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    /**<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Computes Pearson's product-moment correlation coefficients for pairs of arrays<a name="line.28"></a>
+<FONT color="green">029</FONT>     * or columns of a matrix.<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;The constructors that take &lt;code&gt;RealMatrix&lt;/code&gt; or<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;code&gt;double[][]&lt;/code&gt; arguments generate correlation matrices.  The<a name="line.32"></a>
+<FONT color="green">033</FONT>     * columns of the input matrices are assumed to represent variable values.<a name="line.33"></a>
+<FONT color="green">034</FONT>     * Correlations are given by the formula&lt;/p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;code&gt;cor(X, Y) = &amp;Sigma;[(x&lt;sub&gt;i&lt;/sub&gt; - E(X))(y&lt;sub&gt;i&lt;/sub&gt; - E(Y))] / [(n - 1)s(X)s(Y)]&lt;/code&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * where &lt;code&gt;E(X)&lt;/code&gt; is the mean of &lt;code&gt;X&lt;/code&gt;, &lt;code&gt;E(Y)&lt;/code&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * is the mean of the &lt;code&gt;Y&lt;/code&gt; values and s(X), s(Y) are standard deviations.<a name="line.37"></a>
+<FONT color="green">038</FONT>     *<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @since 2.0<a name="line.40"></a>
+<FONT color="green">041</FONT>     */<a name="line.41"></a>
+<FONT color="green">042</FONT>    public class PearsonsCorrelation {<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** correlation matrix */<a name="line.44"></a>
+<FONT color="green">045</FONT>        private final RealMatrix correlationMatrix;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** number of observations */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private final int nObs;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Create a PearsonsCorrelation instance without data<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        public PearsonsCorrelation() {<a name="line.53"></a>
+<FONT color="green">054</FONT>            super();<a name="line.54"></a>
+<FONT color="green">055</FONT>            correlationMatrix = null;<a name="line.55"></a>
+<FONT color="green">056</FONT>            nObs = 0;<a name="line.56"></a>
+<FONT color="green">057</FONT>        }<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /**<a name="line.59"></a>
+<FONT color="green">060</FONT>         * Create a PearsonsCorrelation from a rectangular array<a name="line.60"></a>
+<FONT color="green">061</FONT>         * whose columns represent values of variables to be correlated.<a name="line.61"></a>
+<FONT color="green">062</FONT>         *<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @param data rectangular array with columns representing variables<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @throws IllegalArgumentException if the input data array is not<a name="line.64"></a>
+<FONT color="green">065</FONT>         * rectangular with at least two rows and two columns.<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        public PearsonsCorrelation(double[][] data) {<a name="line.67"></a>
+<FONT color="green">068</FONT>            this(new BlockRealMatrix(data));<a name="line.68"></a>
+<FONT color="green">069</FONT>        }<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /**<a name="line.71"></a>
+<FONT color="green">072</FONT>         * Create a PearsonsCorrelation from a RealMatrix whose columns<a name="line.72"></a>
+<FONT color="green">073</FONT>         * represent variables to be correlated.<a name="line.73"></a>
+<FONT color="green">074</FONT>         *<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @param matrix matrix with columns representing variables to correlate<a name="line.75"></a>
+<FONT color="green">076</FONT>         */<a name="line.76"></a>
+<FONT color="green">077</FONT>        public PearsonsCorrelation(RealMatrix matrix) {<a name="line.77"></a>
+<FONT color="green">078</FONT>            checkSufficientData(matrix);<a name="line.78"></a>
+<FONT color="green">079</FONT>            nObs = matrix.getRowDimension();<a name="line.79"></a>
+<FONT color="green">080</FONT>            correlationMatrix = computeCorrelationMatrix(matrix);<a name="line.80"></a>
+<FONT color="green">081</FONT>        }<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /**<a name="line.83"></a>
+<FONT color="green">084</FONT>         * Create a PearsonsCorrelation from a {@link Covariance}.  The correlation<a name="line.84"></a>
+<FONT color="green">085</FONT>         * matrix is computed by scaling the Covariance's covariance matrix.<a name="line.85"></a>
+<FONT color="green">086</FONT>         * The Covariance instance must have been created from a data matrix with<a name="line.86"></a>
+<FONT color="green">087</FONT>         * columns representing variable values.<a name="line.87"></a>
+<FONT color="green">088</FONT>         *<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @param covariance Covariance instance<a name="line.89"></a>
+<FONT color="green">090</FONT>         */<a name="line.90"></a>
+<FONT color="green">091</FONT>        public PearsonsCorrelation(Covariance covariance) {<a name="line.91"></a>
+<FONT color="green">092</FONT>            RealMatrix covarianceMatrix = covariance.getCovarianceMatrix();<a name="line.92"></a>
+<FONT color="green">093</FONT>            if (covarianceMatrix == null) {<a name="line.93"></a>
+<FONT color="green">094</FONT>                throw MathRuntimeException.createIllegalArgumentException("covariance matrix is null");<a name="line.94"></a>
+<FONT color="green">095</FONT>            }<a name="line.95"></a>
+<FONT color="green">096</FONT>            nObs = covariance.getN();<a name="line.96"></a>
+<FONT color="green">097</FONT>            correlationMatrix = covarianceToCorrelation(covarianceMatrix);<a name="line.97"></a>
+<FONT color="green">098</FONT>        }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>        /**<a name="line.100"></a>
+<FONT color="green">101</FONT>         * Create a PearsonsCorrelation from a covariance matrix.  The correlation<a name="line.101"></a>
+<FONT color="green">102</FONT>         * matrix is computed by scaling the covariance matrix.<a name="line.102"></a>
+<FONT color="green">103</FONT>         *<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @param covarianceMatrix covariance matrix<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @param numberOfObservations the number of observations in the dataset used to compute<a name="line.105"></a>
+<FONT color="green">106</FONT>         * the covariance matrix<a name="line.106"></a>
+<FONT color="green">107</FONT>         */<a name="line.107"></a>
+<FONT color="green">108</FONT>        public PearsonsCorrelation(RealMatrix covarianceMatrix, int numberOfObservations) {<a name="line.108"></a>
+<FONT color="green">109</FONT>            nObs = numberOfObservations;<a name="line.109"></a>
+<FONT color="green">110</FONT>            correlationMatrix = covarianceToCorrelation(covarianceMatrix);<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>        }<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /**<a name="line.114"></a>
+<FONT color="green">115</FONT>         * Returns the correlation matrix<a name="line.115"></a>
+<FONT color="green">116</FONT>         *<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @return correlation matrix<a name="line.117"></a>
+<FONT color="green">118</FONT>         */<a name="line.118"></a>
+<FONT color="green">119</FONT>        public RealMatrix getCorrelationMatrix() {<a name="line.119"></a>
+<FONT color="green">120</FONT>            return correlationMatrix;<a name="line.120"></a>
+<FONT color="green">121</FONT>        }<a name="line.121"></a>
+<FONT color="green">122</FONT>    <a name="line.122"></a>
+<FONT color="green">123</FONT>        /**<a name="line.123"></a>
+<FONT color="green">124</FONT>         * Returns a matrix of standard errors associated with the estimates<a name="line.124"></a>
+<FONT color="green">125</FONT>         * in the correlation matrix.&lt;br/&gt;<a name="line.125"></a>
+<FONT color="green">126</FONT>         * &lt;code&gt;getCorrelationStandardErrors().getEntry(i,j)&lt;/code&gt; is the standard<a name="line.126"></a>
+<FONT color="green">127</FONT>         * error associated with &lt;code&gt;getCorrelationMatrix.getEntry(i,j)&lt;/code&gt;<a name="line.127"></a>
+<FONT color="green">128</FONT>         * &lt;p&gt;The formula used to compute the standard error is &lt;br/&gt;<a name="line.128"></a>
+<FONT color="green">129</FONT>         * &lt;code&gt;SE&lt;sub&gt;r&lt;/sub&gt; = ((1 - r&lt;sup&gt;2&lt;/sup&gt;) / (n - 2))&lt;sup&gt;1/2&lt;/sup&gt;&lt;/code&gt;<a name="line.129"></a>
+<FONT color="green">130</FONT>         * where &lt;code&gt;r&lt;/code&gt; is the estimated correlation coefficient and<a name="line.130"></a>
+<FONT color="green">131</FONT>         * &lt;code&gt;n&lt;/code&gt; is the number of observations in the source dataset.&lt;/p&gt;<a name="line.131"></a>
+<FONT color="green">132</FONT>         *<a name="line.132"></a>
+<FONT color="green">133</FONT>         * @return matrix of correlation standard errors<a name="line.133"></a>
+<FONT color="green">134</FONT>         */<a name="line.134"></a>
+<FONT color="green">135</FONT>        public RealMatrix getCorrelationStandardErrors() {<a name="line.135"></a>
+<FONT color="green">136</FONT>            int nVars = correlationMatrix.getColumnDimension();<a name="line.136"></a>
+<FONT color="green">137</FONT>            double[][] out = new double[nVars][nVars];<a name="line.137"></a>
+<FONT color="green">138</FONT>            for (int i = 0; i &lt; nVars; i++) {<a name="line.138"></a>
+<FONT color="green">139</FONT>                for (int j = 0; j &lt; nVars; j++) {<a name="line.139"></a>
+<FONT color="green">140</FONT>                    double r = correlationMatrix.getEntry(i, j);<a name="line.140"></a>
+<FONT color="green">141</FONT>                    out[i][j] = Math.sqrt((1 - r * r) /(nObs - 2));<a name="line.141"></a>
+<FONT color="green">142</FONT>                }<a name="line.142"></a>
+<FONT color="green">143</FONT>            }<a name="line.143"></a>
+<FONT color="green">144</FONT>            return new BlockRealMatrix(out);<a name="line.144"></a>
+<FONT color="green">145</FONT>        }<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>        /**<a name="line.147"></a>
+<FONT color="green">148</FONT>         * Returns a matrix of p-values associated with the (two-sided) null<a name="line.148"></a>
+<FONT color="green">149</FONT>         * hypothesis that the corresponding correlation coefficient is zero.<a name="line.149"></a>
+<FONT color="green">150</FONT>         * &lt;p&gt;&lt;code&gt;getCorrelationPValues().getEntry(i,j)&lt;/code&gt; is the probability<a name="line.150"></a>
+<FONT color="green">151</FONT>         * that a random variable distributed as &lt;code&gt;t&lt;sub&gt;n-2&lt;/sub&gt;&lt;/code&gt; takes<a name="line.151"></a>
+<FONT color="green">152</FONT>         * a value with absolute value greater than or equal to &lt;br&gt;<a name="line.152"></a>
+<FONT color="green">153</FONT>         * &lt;code&gt;|r|((n - 2) / (1 - r&lt;sup&gt;2&lt;/sup&gt;))&lt;sup&gt;1/2&lt;/sup&gt;&lt;/code&gt;&lt;/p&gt;<a name="line.153"></a>
+<FONT color="green">154</FONT>         * &lt;p&gt;The values in the matrix are sometimes referred to as the<a name="line.154"></a>
+<FONT color="green">155</FONT>         * &lt;i&gt;significance&lt;/i&gt; of the corresponding correlation coefficients.&lt;/p&gt;<a name="line.155"></a>
+<FONT color="green">156</FONT>         *<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @return matrix of p-values<a name="line.157"></a>
+<FONT color="green">158</FONT>         * @throws MathException if an error occurs estimating probabilities<a name="line.158"></a>
+<FONT color="green">159</FONT>         */<a name="line.159"></a>
+<FONT color="green">160</FONT>        public RealMatrix getCorrelationPValues() throws MathException {<a name="line.160"></a>
+<FONT color="green">161</FONT>            TDistribution tDistribution = new TDistributionImpl(nObs - 2);<a name="line.161"></a>
+<FONT color="green">162</FONT>            int nVars = correlationMatrix.getColumnDimension();<a name="line.162"></a>
+<FONT color="green">163</FONT>            double[][] out = new double[nVars][nVars];<a name="line.163"></a>
+<FONT color="green">164</FONT>            for (int i = 0; i &lt; nVars; i++) {<a name="line.164"></a>
+<FONT color="green">165</FONT>                for (int j = 0; j &lt; nVars; j++) {<a name="line.165"></a>
+<FONT color="green">166</FONT>                    if (i == j) {<a name="line.166"></a>
+<FONT color="green">167</FONT>                        out[i][j] = 0d;<a name="line.167"></a>
+<FONT color="green">168</FONT>                    } else {<a name="line.168"></a>
+<FONT color="green">169</FONT>                        double r = correlationMatrix.getEntry(i, j);<a name="line.169"></a>
+<FONT color="green">170</FONT>                        double t = Math.abs(r * Math.sqrt((nObs - 2)/(1 - r * r)));<a name="line.170"></a>
+<FONT color="green">171</FONT>                        out[i][j] = 2 * (1 - tDistribution.cumulativeProbability(t));<a name="line.171"></a>
+<FONT color="green">172</FONT>                    }<a name="line.172"></a>
+<FONT color="green">173</FONT>                }<a name="line.173"></a>
+<FONT color="green">174</FONT>            }<a name="line.174"></a>
+<FONT color="green">175</FONT>            return new BlockRealMatrix(out);<a name="line.175"></a>
+<FONT color="green">176</FONT>        }<a name="line.176"></a>
+<FONT color="green">177</FONT>    <a name="line.177"></a>
+<FONT color="green">178</FONT>    <a name="line.178"></a>
+<FONT color="green">179</FONT>        /**<a name="line.179"></a>
+<FONT color="green">180</FONT>         * Computes the correlation matrix for the columns of the<a name="line.180"></a>
+<FONT color="green">181</FONT>         * input matrix.<a name="line.181"></a>
+<FONT color="green">182</FONT>         *<a name="line.182"></a>
+<FONT color="green">183</FONT>         * @param matrix matrix with columns representing variables to correlate<a name="line.183"></a>
+<FONT color="green">184</FONT>         * @return correlation matrix<a name="line.184"></a>
+<FONT color="green">185</FONT>         */<a name="line.185"></a>
+<FONT color="green">186</FONT>        public RealMatrix computeCorrelationMatrix(RealMatrix matrix) {<a name="line.186"></a>
+<FONT color="green">187</FONT>            int nVars = matrix.getColumnDimension();<a name="line.187"></a>
+<FONT color="green">188</FONT>            RealMatrix outMatrix = new BlockRealMatrix(nVars, nVars);<a name="line.188"></a>
+<FONT color="green">189</FONT>            for (int i = 0; i &lt; nVars; i++) {<a name="line.189"></a>
+<FONT color="green">190</FONT>                for (int j = 0; j &lt; i; j++) {<a name="line.190"></a>
+<FONT color="green">191</FONT>                  double corr = correlation(matrix.getColumn(i), matrix.getColumn(j));<a name="line.191"></a>
+<FONT color="green">192</FONT>                  outMatrix.setEntry(i, j, corr);<a name="line.192"></a>
+<FONT color="green">193</FONT>                  outMatrix.setEntry(j, i, corr);<a name="line.193"></a>
+<FONT color="green">194</FONT>                }<a name="line.194"></a>
+<FONT color="green">195</FONT>                outMatrix.setEntry(i, i, 1d);<a name="line.195"></a>
+<FONT color="green">196</FONT>            }<a name="line.196"></a>
+<FONT color="green">197</FONT>            return outMatrix;<a name="line.197"></a>
+<FONT color="green">198</FONT>        }<a name="line.198"></a>
+<FONT color="green">199</FONT>    <a name="line.199"></a>
+<FONT color="green">200</FONT>        /**<a name="line.200"></a>
+<FONT color="green">201</FONT>         * Computes the correlation matrix for the columns of the<a name="line.201"></a>
+<FONT color="green">202</FONT>         * input rectangular array.  The colums of the array represent values<a name="line.202"></a>
+<FONT color="green">203</FONT>         * of variables to be correlated.<a name="line.203"></a>
+<FONT color="green">204</FONT>         *<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @param data matrix with columns representing variables to correlate<a name="line.205"></a>
+<FONT color="green">206</FONT>         * @return correlation matrix<a name="line.206"></a>
+<FONT color="green">207</FONT>         */<a name="line.207"></a>
+<FONT color="green">208</FONT>        public RealMatrix computeCorrelationMatrix(double[][] data) {<a name="line.208"></a>
+<FONT color="green">209</FONT>           return computeCorrelationMatrix(new BlockRealMatrix(data));<a name="line.209"></a>
+<FONT color="green">210</FONT>        }<a name="line.210"></a>
+<FONT color="green">211</FONT>    <a name="line.211"></a>
+<FONT color="green">212</FONT>        /**<a name="line.212"></a>
+<FONT color="green">213</FONT>         * Computes the Pearson's product-moment correlation coefficient between the two arrays.<a name="line.213"></a>
+<FONT color="green">214</FONT>         *<a name="line.214"></a>
+<FONT color="green">215</FONT>         * &lt;/p&gt;Throws IllegalArgumentException if the arrays do not have the same length<a name="line.215"></a>
+<FONT color="green">216</FONT>         * or their common length is less than 2&lt;/p&gt;<a name="line.216"></a>
+<FONT color="green">217</FONT>         *<a name="line.217"></a>
+<FONT color="green">218</FONT>         * @param xArray first data array<a name="line.218"></a>
+<FONT color="green">219</FONT>         * @param yArray second data array<a name="line.219"></a>
+<FONT color="green">220</FONT>         * @return Returns Pearson's correlation coefficient for the two arrays<a name="line.220"></a>
+<FONT color="green">221</FONT>         * @throws  IllegalArgumentException if the arrays lengths do not match or<a name="line.221"></a>
+<FONT color="green">222</FONT>         * there is insufficient data<a name="line.222"></a>
+<FONT color="green">223</FONT>         */<a name="line.223"></a>
+<FONT color="green">224</FONT>        public double correlation(final double[] xArray, final double[] yArray) throws IllegalArgumentException {<a name="line.224"></a>
+<FONT color="green">225</FONT>            SimpleRegression regression = new SimpleRegression();<a name="line.225"></a>
+<FONT color="green">226</FONT>            if(xArray.length == yArray.length &amp;&amp; xArray.length &gt; 1) {<a name="line.226"></a>
+<FONT color="green">227</FONT>                for(int i=0; i&lt;xArray.length; i++) {<a name="line.227"></a>
+<FONT color="green">228</FONT>                    regression.addData(xArray[i], yArray[i]);<a name="line.228"></a>
+<FONT color="green">229</FONT>                }<a name="line.229"></a>
+<FONT color="green">230</FONT>                return regression.getR();<a name="line.230"></a>
+<FONT color="green">231</FONT>            }<a name="line.231"></a>
+<FONT color="green">232</FONT>            else {<a name="line.232"></a>
+<FONT color="green">233</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.233"></a>
+<FONT color="green">234</FONT>                        "invalid array dimensions. xArray has size {0}; yArray has {1} elements",<a name="line.234"></a>
+<FONT color="green">235</FONT>                        xArray.length, yArray.length);<a name="line.235"></a>
+<FONT color="green">236</FONT>            }<a name="line.236"></a>
+<FONT color="green">237</FONT>        }<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>        /**<a name="line.239"></a>
+<FONT color="green">240</FONT>         * Derives a correlation matrix from a covariance matrix.<a name="line.240"></a>
+<FONT color="green">241</FONT>         *<a name="line.241"></a>
+<FONT color="green">242</FONT>         * &lt;p&gt;Uses the formula &lt;br/&gt;<a name="line.242"></a>
+<FONT color="green">243</FONT>         * &lt;code&gt;r(X,Y) = cov(X,Y)/s(X)s(Y)&lt;/code&gt; where<a name="line.243"></a>
+<FONT color="green">244</FONT>         * &lt;code&gt;r(&amp;middot,&amp;middot;)&lt;/code&gt; is the correlation coefficient and<a name="line.244"></a>
+<FONT color="green">245</FONT>         * &lt;code&gt;s(&amp;middot;)&lt;/code&gt; means standard deviation.&lt;/p&gt;<a name="line.245"></a>
+<FONT color="green">246</FONT>         *<a name="line.246"></a>
+<FONT color="green">247</FONT>         * @param covarianceMatrix the covariance matrix<a name="line.247"></a>
+<FONT color="green">248</FONT>         * @return correlation matrix<a name="line.248"></a>
+<FONT color="green">249</FONT>         */<a name="line.249"></a>
+<FONT color="green">250</FONT>        public RealMatrix covarianceToCorrelation(RealMatrix covarianceMatrix) {<a name="line.250"></a>
+<FONT color="green">251</FONT>            int nVars = covarianceMatrix.getColumnDimension();<a name="line.251"></a>
+<FONT color="green">252</FONT>            RealMatrix outMatrix = new BlockRealMatrix(nVars, nVars);<a name="line.252"></a>
+<FONT color="green">253</FONT>            for (int i = 0; i &lt; nVars; i++) {<a name="line.253"></a>
+<FONT color="green">254</FONT>                double sigma = Math.sqrt(covarianceMatrix.getEntry(i, i));<a name="line.254"></a>
+<FONT color="green">255</FONT>                outMatrix.setEntry(i, i, 1d);<a name="line.255"></a>
+<FONT color="green">256</FONT>                for (int j = 0; j &lt; i; j++) {<a name="line.256"></a>
+<FONT color="green">257</FONT>                    double entry = covarianceMatrix.getEntry(i, j) /<a name="line.257"></a>
+<FONT color="green">258</FONT>                           (sigma * Math.sqrt(covarianceMatrix.getEntry(j, j)));<a name="line.258"></a>
+<FONT color="green">259</FONT>                    outMatrix.setEntry(i, j, entry);<a name="line.259"></a>
+<FONT color="green">260</FONT>                    outMatrix.setEntry(j, i, entry);<a name="line.260"></a>
+<FONT color="green">261</FONT>                }<a name="line.261"></a>
+<FONT color="green">262</FONT>            }<a name="line.262"></a>
+<FONT color="green">263</FONT>            return outMatrix;<a name="line.263"></a>
+<FONT color="green">264</FONT>        }<a name="line.264"></a>
+<FONT color="green">265</FONT>    <a name="line.265"></a>
+<FONT color="green">266</FONT>        /**<a name="line.266"></a>
+<FONT color="green">267</FONT>         * Throws IllegalArgumentException of the matrix does not have at least<a name="line.267"></a>
+<FONT color="green">268</FONT>         * two columns and two rows<a name="line.268"></a>
+<FONT color="green">269</FONT>         *<a name="line.269"></a>
+<FONT color="green">270</FONT>         * @param matrix matrix to check for sufficiency<a name="line.270"></a>
+<FONT color="green">271</FONT>         */<a name="line.271"></a>
+<FONT color="green">272</FONT>        private void checkSufficientData(final RealMatrix matrix) {<a name="line.272"></a>
+<FONT color="green">273</FONT>            int nRows = matrix.getRowDimension();<a name="line.273"></a>
+<FONT color="green">274</FONT>            int nCols = matrix.getColumnDimension();<a name="line.274"></a>
+<FONT color="green">275</FONT>            if (nRows &lt; 2 || nCols &lt; 2) {<a name="line.275"></a>
+<FONT color="green">276</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.276"></a>
+<FONT color="green">277</FONT>                        "insufficient data: only {0} rows and {1} columns.",<a name="line.277"></a>
+<FONT color="green">278</FONT>                        nRows, nCols);<a name="line.278"></a>
+<FONT color="green">279</FONT>            }<a name="line.279"></a>
+<FONT color="green">280</FONT>        }<a name="line.280"></a>
+<FONT color="green">281</FONT>    }<a name="line.281"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/correlation/SpearmansCorrelation.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,236 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.stat.correlation;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.linear.BlockRealMatrix;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.linear.RealMatrix;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.stat.ranking.NaturalRanking;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.stat.ranking.RankingAlgorithm;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;Spearman's rank correlation. This implementation performs a rank<a name="line.27"></a>
+<FONT color="green">028</FONT>     * transformation on the input data and then computes {@link PearsonsCorrelation}<a name="line.28"></a>
+<FONT color="green">029</FONT>     * on the ranked data.&lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;By default, ranks are computed using {@link NaturalRanking} with default<a name="line.31"></a>
+<FONT color="green">032</FONT>     * strategies for handling NaNs and ties in the data (NaNs maximal, ties averaged).<a name="line.32"></a>
+<FONT color="green">033</FONT>     * The ranking algorithm can be set using a constructor argument.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     *<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @since 2.0<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.36"></a>
+<FONT color="green">037</FONT>     */<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>    public class SpearmansCorrelation {<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Input data */<a name="line.41"></a>
+<FONT color="green">042</FONT>        private final RealMatrix data;<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Ranking algorithm  */<a name="line.44"></a>
+<FONT color="green">045</FONT>        private final RankingAlgorithm rankingAlgorithm;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** Rank correlation */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private final PearsonsCorrelation rankCorrelation;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Create a SpearmansCorrelation with the given input data matrix<a name="line.51"></a>
+<FONT color="green">052</FONT>         * and ranking algorithm.<a name="line.52"></a>
+<FONT color="green">053</FONT>         *<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @param dataMatrix matrix of data with columns representing<a name="line.54"></a>
+<FONT color="green">055</FONT>         * variables to correlate<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param rankingAlgorithm ranking algorithm<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        public SpearmansCorrelation(final RealMatrix dataMatrix, final RankingAlgorithm rankingAlgorithm) {<a name="line.58"></a>
+<FONT color="green">059</FONT>            this.data = dataMatrix.copy();<a name="line.59"></a>
+<FONT color="green">060</FONT>            this.rankingAlgorithm = rankingAlgorithm;<a name="line.60"></a>
+<FONT color="green">061</FONT>            rankTransform(data);<a name="line.61"></a>
+<FONT color="green">062</FONT>            rankCorrelation = new PearsonsCorrelation(data);<a name="line.62"></a>
+<FONT color="green">063</FONT>        }<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /**<a name="line.65"></a>
+<FONT color="green">066</FONT>         * Create a SpearmansCorrelation from the given data matrix.<a name="line.66"></a>
+<FONT color="green">067</FONT>         *<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param dataMatrix matrix of data with columns representing<a name="line.68"></a>
+<FONT color="green">069</FONT>         * variables to correlate<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        public SpearmansCorrelation(final RealMatrix dataMatrix) {<a name="line.71"></a>
+<FONT color="green">072</FONT>            this(dataMatrix, new NaturalRanking());<a name="line.72"></a>
+<FONT color="green">073</FONT>        }<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /**<a name="line.75"></a>
+<FONT color="green">076</FONT>         * Create a SpearmansCorrelation without data.<a name="line.76"></a>
+<FONT color="green">077</FONT>         */<a name="line.77"></a>
+<FONT color="green">078</FONT>        public SpearmansCorrelation() {<a name="line.78"></a>
+<FONT color="green">079</FONT>            data = null;<a name="line.79"></a>
+<FONT color="green">080</FONT>            this.rankingAlgorithm = new NaturalRanking();<a name="line.80"></a>
+<FONT color="green">081</FONT>            rankCorrelation = null;<a name="line.81"></a>
+<FONT color="green">082</FONT>        }<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /**<a name="line.84"></a>
+<FONT color="green">085</FONT>         * Calculate the Spearman Rank Correlation Matrix.<a name="line.85"></a>
+<FONT color="green">086</FONT>         *<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @return Spearman Rank Correlation Matrix<a name="line.87"></a>
+<FONT color="green">088</FONT>         */<a name="line.88"></a>
+<FONT color="green">089</FONT>        public RealMatrix getCorrelationMatrix() {<a name="line.89"></a>
+<FONT color="green">090</FONT>            return rankCorrelation.getCorrelationMatrix();<a name="line.90"></a>
+<FONT color="green">091</FONT>        }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /**<a name="line.93"></a>
+<FONT color="green">094</FONT>         * Returns a {@link PearsonsCorrelation} instance constructed from the<a name="line.94"></a>
+<FONT color="green">095</FONT>         * ranked input data. That is,<a name="line.95"></a>
+<FONT color="green">096</FONT>         * &lt;code&gt;new SpearmansCorrelation(matrix).getRankCorrelation()&lt;/code&gt;<a name="line.96"></a>
+<FONT color="green">097</FONT>         * is equivalent to<a name="line.97"></a>
+<FONT color="green">098</FONT>         * &lt;code&gt;new PearsonsCorrelation(rankTransform(matrix))&lt;/code&gt; where<a name="line.98"></a>
+<FONT color="green">099</FONT>         * &lt;code&gt;rankTransform(matrix)&lt;/code&gt; is the result of applying the<a name="line.99"></a>
+<FONT color="green">100</FONT>         * configured &lt;code&gt;RankingAlgorithm&lt;/code&gt; to each of the columns of<a name="line.100"></a>
+<FONT color="green">101</FONT>         * &lt;code&gt;matrix.&lt;/code&gt;<a name="line.101"></a>
+<FONT color="green">102</FONT>         *<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @return PearsonsCorrelation among ranked column data<a name="line.103"></a>
+<FONT color="green">104</FONT>         */<a name="line.104"></a>
+<FONT color="green">105</FONT>        public PearsonsCorrelation getRankCorrelation() {<a name="line.105"></a>
+<FONT color="green">106</FONT>            return rankCorrelation;<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /**<a name="line.109"></a>
+<FONT color="green">110</FONT>         * Computes the Spearman's rank correlation matrix for the columns of the<a name="line.110"></a>
+<FONT color="green">111</FONT>         * input matrix.<a name="line.111"></a>
+<FONT color="green">112</FONT>         *<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param matrix matrix with columns representing variables to correlate<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @return correlation matrix<a name="line.114"></a>
+<FONT color="green">115</FONT>         */<a name="line.115"></a>
+<FONT color="green">116</FONT>        public RealMatrix computeCorrelationMatrix(RealMatrix matrix) {<a name="line.116"></a>
+<FONT color="green">117</FONT>            RealMatrix matrixCopy = matrix.copy();<a name="line.117"></a>
+<FONT color="green">118</FONT>            rankTransform(matrixCopy);<a name="line.118"></a>
+<FONT color="green">119</FONT>            return new PearsonsCorrelation().computeCorrelationMatrix(matrixCopy);<a name="line.119"></a>
+<FONT color="green">120</FONT>        }<a name="line.120"></a>
+<FONT color="green">121</FONT>    <a name="line.121"></a>
+<FONT color="green">122</FONT>        /**<a name="line.122"></a>
+<FONT color="green">123</FONT>         * Computes the Spearman's rank correlation matrix for the columns of the<a name="line.123"></a>
+<FONT color="green">124</FONT>         * input rectangular array.  The columns of the array represent values<a name="line.124"></a>
+<FONT color="green">125</FONT>         * of variables to be correlated.<a name="line.125"></a>
+<FONT color="green">126</FONT>         *<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @param matrix matrix with columns representing variables to correlate<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @return correlation matrix<a name="line.128"></a>
+<FONT color="green">129</FONT>         */<a name="line.129"></a>
+<FONT color="green">130</FONT>        public RealMatrix computeCorrelationMatrix(double[][] matrix) {<a name="line.130"></a>
+<FONT color="green">131</FONT>           return computeCorrelationMatrix(new BlockRealMatrix(matrix));<a name="line.131"></a>
+<FONT color="green">132</FONT>        }<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>        /**<a name="line.134"></a>
+<FONT color="green">135</FONT>         * Computes the Spearman's rank correlation coefficient between the two arrays.<a name="line.135"></a>
+<FONT color="green">136</FONT>         *<a name="line.136"></a>
+<FONT color="green">137</FONT>         * &lt;/p&gt;Throws IllegalArgumentException if the arrays do not have the same length<a name="line.137"></a>
+<FONT color="green">138</FONT>         * or their common length is less than 2&lt;/p&gt;<a name="line.138"></a>
+<FONT color="green">139</FONT>         *<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @param xArray first data array<a name="line.140"></a>
+<FONT color="green">141</FONT>         * @param yArray second data array<a name="line.141"></a>
+<FONT color="green">142</FONT>         * @return Returns Spearman's rank correlation coefficient for the two arrays<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @throws  IllegalArgumentException if the arrays lengths do not match or<a name="line.143"></a>
+<FONT color="green">144</FONT>         * there is insufficient data<a name="line.144"></a>
+<FONT color="green">145</FONT>         */<a name="line.145"></a>
+<FONT color="green">146</FONT>        public double correlation(final double[] xArray, final double[] yArray)<a name="line.146"></a>
+<FONT color="green">147</FONT>        throws IllegalArgumentException {<a name="line.147"></a>
+<FONT color="green">148</FONT>            if (xArray.length == yArray.length &amp;&amp; xArray.length &gt; 1) {<a name="line.148"></a>
+<FONT color="green">149</FONT>                return new PearsonsCorrelation().correlation(rankingAlgorithm.rank(xArray),<a name="line.149"></a>
+<FONT color="green">150</FONT>                        rankingAlgorithm.rank(yArray));<a name="line.150"></a>
+<FONT color="green">151</FONT>            }<a name="line.151"></a>
+<FONT color="green">152</FONT>            else {<a name="line.152"></a>
+<FONT color="green">153</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.153"></a>
+<FONT color="green">154</FONT>                        "invalid array dimensions. xArray has size {0}; yArray has {1} elements",<a name="line.154"></a>
+<FONT color="green">155</FONT>                        xArray.length, yArray.length);<a name="line.155"></a>
+<FONT color="green">156</FONT>            }<a name="line.156"></a>
+<FONT color="green">157</FONT>        }<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>        /**<a name="line.159"></a>
+<FONT color="green">160</FONT>         * Applies rank transform to each of the columns of &lt;code&gt;matrix&lt;/code&gt;<a name="line.160"></a>
+<FONT color="green">161</FONT>         * using the current &lt;code&gt;rankingAlgorithm&lt;/code&gt;<a name="line.161"></a>
+<FONT color="green">162</FONT>         *<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @param matrix matrix to transform<a name="line.163"></a>
+<FONT color="green">164</FONT>         */<a name="line.164"></a>
+<FONT color="green">165</FONT>        private void rankTransform(RealMatrix matrix) {<a name="line.165"></a>
+<FONT color="green">166</FONT>            for (int i = 0; i &lt; matrix.getColumnDimension(); i++) {<a name="line.166"></a>
+<FONT color="green">167</FONT>                matrix.setColumn(i, rankingAlgorithm.rank(matrix.getColumn(i)));<a name="line.167"></a>
+<FONT color="green">168</FONT>            }<a name="line.168"></a>
+<FONT color="green">169</FONT>        }<a name="line.169"></a>
+<FONT color="green">170</FONT>    }<a name="line.170"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/AbstractStorelessUnivariateStatistic.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,248 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     *<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Abstract implementation of the {@link StorelessUnivariateStatistic} interface.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Provides default &lt;code&gt;evaluate()&lt;/code&gt; and &lt;code&gt;incrementAll(double[])&lt;code&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * implementations.&lt;/p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;strong&gt;Note that these implementations are not synchronized.&lt;/strong&gt;&lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 811833 $ $Date: 2009-09-06 12:27:50 -0400 (Sun, 06 Sep 2009) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public abstract class AbstractStorelessUnivariateStatistic<a name="line.33"></a>
+<FONT color="green">034</FONT>        extends AbstractUnivariateStatistic<a name="line.34"></a>
+<FONT color="green">035</FONT>        implements StorelessUnivariateStatistic {<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /**<a name="line.37"></a>
+<FONT color="green">038</FONT>         * This default implementation calls {@link #clear}, then invokes<a name="line.38"></a>
+<FONT color="green">039</FONT>         * {@link #increment} in a loop over the the input array, and then uses<a name="line.39"></a>
+<FONT color="green">040</FONT>         * {@link #getResult} to compute the return value.<a name="line.40"></a>
+<FONT color="green">041</FONT>         * &lt;p&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>         * Note that this implementation changes the internal state of the<a name="line.42"></a>
+<FONT color="green">043</FONT>         * statistic.  Its side effects are the same as invoking {@link #clear} and<a name="line.43"></a>
+<FONT color="green">044</FONT>         * then {@link #incrementAll(double[])}.&lt;/p&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>         * &lt;p&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>         * Implementations may override this method with a more efficient and<a name="line.46"></a>
+<FONT color="green">047</FONT>         * possibly more accurate implementation that works directly with the<a name="line.47"></a>
+<FONT color="green">048</FONT>         * input array.&lt;/p&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>         * &lt;p&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>         * If the array is null, an IllegalArgumentException is thrown.&lt;/p&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @param values input array<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @return the value of the statistic applied to the input array<a name="line.52"></a>
+<FONT color="green">053</FONT>         * @see org.apache.commons.math.stat.descriptive.UnivariateStatistic#evaluate(double[])<a name="line.53"></a>
+<FONT color="green">054</FONT>         */<a name="line.54"></a>
+<FONT color="green">055</FONT>        @Override<a name="line.55"></a>
+<FONT color="green">056</FONT>        public double evaluate(final double[] values) {<a name="line.56"></a>
+<FONT color="green">057</FONT>            if (values == null) {<a name="line.57"></a>
+<FONT color="green">058</FONT>                throw MathRuntimeException.createIllegalArgumentException("input values array is null");<a name="line.58"></a>
+<FONT color="green">059</FONT>            }<a name="line.59"></a>
+<FONT color="green">060</FONT>            return evaluate(values, 0, values.length);<a name="line.60"></a>
+<FONT color="green">061</FONT>        }<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /**<a name="line.63"></a>
+<FONT color="green">064</FONT>         * This default implementation calls {@link #clear}, then invokes<a name="line.64"></a>
+<FONT color="green">065</FONT>         * {@link #increment} in a loop over the specified portion of the input<a name="line.65"></a>
+<FONT color="green">066</FONT>         * array, and then uses {@link #getResult} to compute the return value.<a name="line.66"></a>
+<FONT color="green">067</FONT>         * &lt;p&gt;<a name="line.67"></a>
+<FONT color="green">068</FONT>         * Note that this implementation changes the internal state of the<a name="line.68"></a>
+<FONT color="green">069</FONT>         * statistic.  Its side effects are the same as invoking {@link #clear} and<a name="line.69"></a>
+<FONT color="green">070</FONT>         * then {@link #incrementAll(double[], int, int)}.&lt;/p&gt;<a name="line.70"></a>
+<FONT color="green">071</FONT>         * &lt;p&gt;<a name="line.71"></a>
+<FONT color="green">072</FONT>         * Implementations may override this method with a more efficient and<a name="line.72"></a>
+<FONT color="green">073</FONT>         * possibly more accurate implementation that works directly with the<a name="line.73"></a>
+<FONT color="green">074</FONT>         * input array.&lt;/p&gt;<a name="line.74"></a>
+<FONT color="green">075</FONT>         * &lt;p&gt;<a name="line.75"></a>
+<FONT color="green">076</FONT>         * If the array is null or the index parameters are not valid, an<a name="line.76"></a>
+<FONT color="green">077</FONT>         * IllegalArgumentException is thrown.&lt;/p&gt;<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @param values the input array<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @param begin the index of the first element to include<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @param length the number of elements to include<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @return the value of the statistic applied to the included array entries<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @see org.apache.commons.math.stat.descriptive.UnivariateStatistic#evaluate(double[], int, int)<a name="line.82"></a>
+<FONT color="green">083</FONT>         */<a name="line.83"></a>
+<FONT color="green">084</FONT>        @Override<a name="line.84"></a>
+<FONT color="green">085</FONT>        public double evaluate(final double[] values, final int begin, final int length) {<a name="line.85"></a>
+<FONT color="green">086</FONT>            if (test(values, begin, length)) {<a name="line.86"></a>
+<FONT color="green">087</FONT>                clear();<a name="line.87"></a>
+<FONT color="green">088</FONT>                incrementAll(values, begin, length);<a name="line.88"></a>
+<FONT color="green">089</FONT>            }<a name="line.89"></a>
+<FONT color="green">090</FONT>            return getResult();<a name="line.90"></a>
+<FONT color="green">091</FONT>        }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /**<a name="line.93"></a>
+<FONT color="green">094</FONT>         * {@inheritDoc}<a name="line.94"></a>
+<FONT color="green">095</FONT>         */<a name="line.95"></a>
+<FONT color="green">096</FONT>        @Override<a name="line.96"></a>
+<FONT color="green">097</FONT>        public abstract StorelessUnivariateStatistic copy();<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>        /**<a name="line.99"></a>
+<FONT color="green">100</FONT>         * {@inheritDoc}<a name="line.100"></a>
+<FONT color="green">101</FONT>         */<a name="line.101"></a>
+<FONT color="green">102</FONT>        public abstract void clear();<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /**<a name="line.104"></a>
+<FONT color="green">105</FONT>         * {@inheritDoc}<a name="line.105"></a>
+<FONT color="green">106</FONT>         */<a name="line.106"></a>
+<FONT color="green">107</FONT>        public abstract double getResult();<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /**<a name="line.109"></a>
+<FONT color="green">110</FONT>         * {@inheritDoc}<a name="line.110"></a>
+<FONT color="green">111</FONT>         */<a name="line.111"></a>
+<FONT color="green">112</FONT>        public abstract void increment(final double d);<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /**<a name="line.114"></a>
+<FONT color="green">115</FONT>         * This default implementation just calls {@link #increment} in a loop over<a name="line.115"></a>
+<FONT color="green">116</FONT>         * the input array.<a name="line.116"></a>
+<FONT color="green">117</FONT>         * &lt;p&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>         * Throws IllegalArgumentException if the input values array is null.&lt;/p&gt;<a name="line.118"></a>
+<FONT color="green">119</FONT>         *<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @param values values to add<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @throws IllegalArgumentException if values is null<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @see org.apache.commons.math.stat.descriptive.StorelessUnivariateStatistic#incrementAll(double[])<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        public void incrementAll(double[] values) {<a name="line.124"></a>
+<FONT color="green">125</FONT>            if (values == null) {<a name="line.125"></a>
+<FONT color="green">126</FONT>                throw MathRuntimeException.createIllegalArgumentException("input values array is null");<a name="line.126"></a>
+<FONT color="green">127</FONT>            }<a name="line.127"></a>
+<FONT color="green">128</FONT>            incrementAll(values, 0, values.length);<a name="line.128"></a>
+<FONT color="green">129</FONT>        }<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>        /**<a name="line.131"></a>
+<FONT color="green">132</FONT>         * This default implementation just calls {@link #increment} in a loop over<a name="line.132"></a>
+<FONT color="green">133</FONT>         * the specified portion of the input array.<a name="line.133"></a>
+<FONT color="green">134</FONT>         * &lt;p&gt;<a name="line.134"></a>
+<FONT color="green">135</FONT>         * Throws IllegalArgumentException if the input values array is null.&lt;/p&gt;<a name="line.135"></a>
+<FONT color="green">136</FONT>         *<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @param values  array holding values to add<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @param begin   index of the first array element to add<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @param length  number of array elements to add<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @throws IllegalArgumentException if values is null<a name="line.140"></a>
+<FONT color="green">141</FONT>         * @see org.apache.commons.math.stat.descriptive.StorelessUnivariateStatistic#incrementAll(double[], int, int)<a name="line.141"></a>
+<FONT color="green">142</FONT>         */<a name="line.142"></a>
+<FONT color="green">143</FONT>        public void incrementAll(double[] values, int begin, int length) {<a name="line.143"></a>
+<FONT color="green">144</FONT>            if (test(values, begin, length)) {<a name="line.144"></a>
+<FONT color="green">145</FONT>                int k = begin + length;<a name="line.145"></a>
+<FONT color="green">146</FONT>                for (int i = begin; i &lt; k; i++) {<a name="line.146"></a>
+<FONT color="green">147</FONT>                    increment(values[i]);<a name="line.147"></a>
+<FONT color="green">148</FONT>                }<a name="line.148"></a>
+<FONT color="green">149</FONT>            }<a name="line.149"></a>
+<FONT color="green">150</FONT>        }<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>        /**<a name="line.152"></a>
+<FONT color="green">153</FONT>         * Returns true iff &lt;code&gt;object&lt;/code&gt; is an<a name="line.153"></a>
+<FONT color="green">154</FONT>         * &lt;code&gt;AbstractStorelessUnivariateStatistic&lt;/code&gt; returning the same<a name="line.154"></a>
+<FONT color="green">155</FONT>         * values as this for &lt;code&gt;getResult()&lt;/code&gt; and &lt;code&gt;getN()&lt;/code&gt;<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @param object object to test equality against.<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @return true if object returns the same value as this<a name="line.157"></a>
+<FONT color="green">158</FONT>         */<a name="line.158"></a>
+<FONT color="green">159</FONT>        @Override<a name="line.159"></a>
+<FONT color="green">160</FONT>        public boolean equals(Object object) {<a name="line.160"></a>
+<FONT color="green">161</FONT>            if (object == this ) {<a name="line.161"></a>
+<FONT color="green">162</FONT>                return true;<a name="line.162"></a>
+<FONT color="green">163</FONT>            }<a name="line.163"></a>
+<FONT color="green">164</FONT>           if (object instanceof AbstractStorelessUnivariateStatistic == false) {<a name="line.164"></a>
+<FONT color="green">165</FONT>                return false;<a name="line.165"></a>
+<FONT color="green">166</FONT>            }<a name="line.166"></a>
+<FONT color="green">167</FONT>            AbstractStorelessUnivariateStatistic stat = (AbstractStorelessUnivariateStatistic) object;<a name="line.167"></a>
+<FONT color="green">168</FONT>            return MathUtils.equals(stat.getResult(), this.getResult()) &amp;&amp;<a name="line.168"></a>
+<FONT color="green">169</FONT>                   MathUtils.equals(stat.getN(), this.getN());<a name="line.169"></a>
+<FONT color="green">170</FONT>        }<a name="line.170"></a>
+<FONT color="green">171</FONT>    <a name="line.171"></a>
+<FONT color="green">172</FONT>        /**<a name="line.172"></a>
+<FONT color="green">173</FONT>         * Returns hash code based on getResult() and getN()<a name="line.173"></a>
+<FONT color="green">174</FONT>         *<a name="line.174"></a>
+<FONT color="green">175</FONT>         * @return hash code<a name="line.175"></a>
+<FONT color="green">176</FONT>         */<a name="line.176"></a>
+<FONT color="green">177</FONT>        @Override<a name="line.177"></a>
+<FONT color="green">178</FONT>        public int hashCode() {<a name="line.178"></a>
+<FONT color="green">179</FONT>            return 31* (31 + MathUtils.hash(getResult())) + MathUtils.hash(getN());<a name="line.179"></a>
+<FONT color="green">180</FONT>        }<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>    }<a name="line.182"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/AbstractUnivariateStatistic.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,243 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Abstract base class for all implementations of the<a name="line.22"></a>
+<FONT color="green">023</FONT>     * {@link UnivariateStatistic} interface.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Provides a default implementation of &lt;code&gt;evaluate(double[]),&lt;/code&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * delegating to &lt;code&gt;evaluate(double[], int, int)&lt;/code&gt; in the natural way.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;/p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * Also includes a &lt;code&gt;test&lt;/code&gt; method that performs generic parameter<a name="line.29"></a>
+<FONT color="green">030</FONT>     * validation for the &lt;code&gt;evaluate&lt;/code&gt; methods.&lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     *<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @version $Revision: 894705 $ $Date: 2009-12-30 15:24:54 -0500 (Wed, 30 Dec 2009) $<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public abstract class AbstractUnivariateStatistic<a name="line.34"></a>
+<FONT color="green">035</FONT>        implements UnivariateStatistic {<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /**<a name="line.37"></a>
+<FONT color="green">038</FONT>         * {@inheritDoc}<a name="line.38"></a>
+<FONT color="green">039</FONT>         */<a name="line.39"></a>
+<FONT color="green">040</FONT>        public double evaluate(final double[] values) {<a name="line.40"></a>
+<FONT color="green">041</FONT>            test(values, 0, 0);<a name="line.41"></a>
+<FONT color="green">042</FONT>            return evaluate(values, 0, values.length);<a name="line.42"></a>
+<FONT color="green">043</FONT>        }<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**<a name="line.45"></a>
+<FONT color="green">046</FONT>         * {@inheritDoc}<a name="line.46"></a>
+<FONT color="green">047</FONT>         */<a name="line.47"></a>
+<FONT color="green">048</FONT>        public abstract double evaluate(final double[] values, final int begin, final int length);<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * {@inheritDoc}<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        public abstract UnivariateStatistic copy();<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * This method is used by &lt;code&gt;evaluate(double[], int, int)&lt;/code&gt; methods<a name="line.56"></a>
+<FONT color="green">057</FONT>         * to verify that the input parameters designate a subarray of positive length.<a name="line.57"></a>
+<FONT color="green">058</FONT>         * &lt;p&gt;<a name="line.58"></a>
+<FONT color="green">059</FONT>         * &lt;ul&gt;<a name="line.59"></a>
+<FONT color="green">060</FONT>         * &lt;li&gt;returns &lt;code&gt;true&lt;/code&gt; iff the parameters designate a subarray of<a name="line.60"></a>
+<FONT color="green">061</FONT>         * positive length&lt;/li&gt;<a name="line.61"></a>
+<FONT color="green">062</FONT>         * &lt;li&gt;throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null or<a name="line.62"></a>
+<FONT color="green">063</FONT>         * or the indices are invalid&lt;/li&gt;<a name="line.63"></a>
+<FONT color="green">064</FONT>         * &lt;li&gt;returns &lt;code&gt;false&lt;/li&gt; if the array is non-null, but<a name="line.64"></a>
+<FONT color="green">065</FONT>         * &lt;code&gt;length&lt;/code&gt; is 0.<a name="line.65"></a>
+<FONT color="green">066</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.66"></a>
+<FONT color="green">067</FONT>         *<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param values the input array<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @param begin index of the first array element to include<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @param length the number of elements to include<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @return true if the parameters are valid and designate a subarray of positive length<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @throws IllegalArgumentException if the indices are invalid or the array is null<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        protected boolean test(<a name="line.74"></a>
+<FONT color="green">075</FONT>            final double[] values,<a name="line.75"></a>
+<FONT color="green">076</FONT>            final int begin,<a name="line.76"></a>
+<FONT color="green">077</FONT>            final int length) {<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>            if (values == null) {<a name="line.79"></a>
+<FONT color="green">080</FONT>                throw MathRuntimeException.createIllegalArgumentException("input values array is null");<a name="line.80"></a>
+<FONT color="green">081</FONT>            }<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>            if (begin &lt; 0) {<a name="line.83"></a>
+<FONT color="green">084</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.84"></a>
+<FONT color="green">085</FONT>                      "start position cannot be negative ({0})", begin);<a name="line.85"></a>
+<FONT color="green">086</FONT>            }<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>            if (length &lt; 0) {<a name="line.88"></a>
+<FONT color="green">089</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.89"></a>
+<FONT color="green">090</FONT>                      "length cannot be negative ({0})", length);<a name="line.90"></a>
+<FONT color="green">091</FONT>            }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>            if (begin + length &gt; values.length) {<a name="line.93"></a>
+<FONT color="green">094</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.94"></a>
+<FONT color="green">095</FONT>                      "subarray ends after array end");<a name="line.95"></a>
+<FONT color="green">096</FONT>            }<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>            if (length == 0) {<a name="line.98"></a>
+<FONT color="green">099</FONT>                return false;<a name="line.99"></a>
+<FONT color="green">100</FONT>            }<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>            return true;<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        }<a name="line.104"></a>
+<FONT color="green">105</FONT>    <a name="line.105"></a>
+<FONT color="green">106</FONT>        /**<a name="line.106"></a>
+<FONT color="green">107</FONT>         * This method is used by &lt;code&gt;evaluate(double[], double[], int, int)&lt;/code&gt; methods<a name="line.107"></a>
+<FONT color="green">108</FONT>         * to verify that the begin and length parameters designate a subarray of positive length<a name="line.108"></a>
+<FONT color="green">109</FONT>         * and the weights are all non-negative, non-NaN, finite, and not all zero.<a name="line.109"></a>
+<FONT color="green">110</FONT>         * &lt;p&gt;<a name="line.110"></a>
+<FONT color="green">111</FONT>         * &lt;ul&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>         * &lt;li&gt;returns &lt;code&gt;true&lt;/code&gt; iff the parameters designate a subarray of<a name="line.112"></a>
+<FONT color="green">113</FONT>         * positive length and the weights array contains legitimate values.&lt;/li&gt;<a name="line.113"></a>
+<FONT color="green">114</FONT>         * &lt;li&gt;throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if any of the following are true:<a name="line.114"></a>
+<FONT color="green">115</FONT>         * &lt;ul&gt;&lt;li&gt;the values array is null&lt;/li&gt;<a name="line.115"></a>
+<FONT color="green">116</FONT>         *     &lt;li&gt;the weights array is null&lt;/li&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         *     &lt;li&gt;the weights array does not have the same length as the values array&lt;/li&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>         *     &lt;li&gt;the weights array contains one or more infinite values&lt;/li&gt;<a name="line.118"></a>
+<FONT color="green">119</FONT>         *     &lt;li&gt;the weights array contains one or more NaN values&lt;/li&gt;<a name="line.119"></a>
+<FONT color="green">120</FONT>         *     &lt;li&gt;the weights array contains negative values&lt;/li&gt;<a name="line.120"></a>
+<FONT color="green">121</FONT>         *     &lt;li&gt;the start and length arguments do not determine a valid array&lt;/li&gt;&lt;/ul&gt;<a name="line.121"></a>
+<FONT color="green">122</FONT>         * &lt;/li&gt;<a name="line.122"></a>
+<FONT color="green">123</FONT>         * &lt;li&gt;returns &lt;code&gt;false&lt;/li&gt; if the array is non-null, but<a name="line.123"></a>
+<FONT color="green">124</FONT>         * &lt;code&gt;length&lt;/code&gt; is 0.<a name="line.124"></a>
+<FONT color="green">125</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.125"></a>
+<FONT color="green">126</FONT>         *<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @param values the input array<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @param weights the weights array<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @param begin index of the first array element to include<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @param length the number of elements to include<a name="line.130"></a>
+<FONT color="green">131</FONT>         * @return true if the parameters are valid and designate a subarray of positive length<a name="line.131"></a>
+<FONT color="green">132</FONT>         * @throws IllegalArgumentException if the indices are invalid or the array is null<a name="line.132"></a>
+<FONT color="green">133</FONT>         * @since 2.1<a name="line.133"></a>
+<FONT color="green">134</FONT>         */<a name="line.134"></a>
+<FONT color="green">135</FONT>        protected boolean test(<a name="line.135"></a>
+<FONT color="green">136</FONT>            final double[] values,<a name="line.136"></a>
+<FONT color="green">137</FONT>            final double[] weights,<a name="line.137"></a>
+<FONT color="green">138</FONT>            final int begin,<a name="line.138"></a>
+<FONT color="green">139</FONT>            final int length) {<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>            if (weights == null) {<a name="line.141"></a>
+<FONT color="green">142</FONT>                throw MathRuntimeException.createIllegalArgumentException("input weights array is null");<a name="line.142"></a>
+<FONT color="green">143</FONT>            }<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>            if (weights.length !=  values.length) {<a name="line.145"></a>
+<FONT color="green">146</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.146"></a>
+<FONT color="green">147</FONT>                      "Different number of weights and values");<a name="line.147"></a>
+<FONT color="green">148</FONT>            }<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>            boolean containsPositiveWeight = false;<a name="line.150"></a>
+<FONT color="green">151</FONT>            for (int i = begin; i &lt; begin + length; i++) {<a name="line.151"></a>
+<FONT color="green">152</FONT>                if (Double.isNaN(weights[i])) {<a name="line.152"></a>
+<FONT color="green">153</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.153"></a>
+<FONT color="green">154</FONT>                            "NaN weight at index {0}", i);<a name="line.154"></a>
+<FONT color="green">155</FONT>                }<a name="line.155"></a>
+<FONT color="green">156</FONT>                if (Double.isInfinite(weights[i])) {<a name="line.156"></a>
+<FONT color="green">157</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.157"></a>
+<FONT color="green">158</FONT>                            "Infinite weight at index {0}", i);<a name="line.158"></a>
+<FONT color="green">159</FONT>                }<a name="line.159"></a>
+<FONT color="green">160</FONT>                if (weights[i] &lt; 0) {<a name="line.160"></a>
+<FONT color="green">161</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.161"></a>
+<FONT color="green">162</FONT>                          "negative weight {0} at index {1} ", weights[i], i);<a name="line.162"></a>
+<FONT color="green">163</FONT>                }<a name="line.163"></a>
+<FONT color="green">164</FONT>                if (!containsPositiveWeight &amp;&amp; weights[i] &gt; 0.0) {<a name="line.164"></a>
+<FONT color="green">165</FONT>                    containsPositiveWeight = true;<a name="line.165"></a>
+<FONT color="green">166</FONT>                }<a name="line.166"></a>
+<FONT color="green">167</FONT>            }<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>            if (!containsPositiveWeight) {<a name="line.169"></a>
+<FONT color="green">170</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.170"></a>
+<FONT color="green">171</FONT>                        "weight array must contain at least one non-zero value");<a name="line.171"></a>
+<FONT color="green">172</FONT>            }<a name="line.172"></a>
+<FONT color="green">173</FONT>    <a name="line.173"></a>
+<FONT color="green">174</FONT>            return test(values, begin, length);<a name="line.174"></a>
+<FONT color="green">175</FONT>        }<a name="line.175"></a>
+<FONT color="green">176</FONT>    }<a name="line.176"></a>
+<FONT color="green">177</FONT>    <a name="line.177"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/AggregateSummaryStatistics.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,482 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.stat.descriptive;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.Collection;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.util.Iterator;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * An aggregator for {@code SummaryStatistics} from several data sets or<a name="line.26"></a>
+<FONT color="green">027</FONT>     * data set partitions.  In its simplest usage mode, the client creates an<a name="line.27"></a>
+<FONT color="green">028</FONT>     * instance via the zero-argument constructor, then uses<a name="line.28"></a>
+<FONT color="green">029</FONT>     * {@link #createContributingStatistics()} to obtain a {@code SummaryStatistics}<a name="line.29"></a>
+<FONT color="green">030</FONT>     * for each individual data set / partition.  The per-set statistics objects<a name="line.30"></a>
+<FONT color="green">031</FONT>     * are used as normal, and at any time the aggregate statistics for all the<a name="line.31"></a>
+<FONT color="green">032</FONT>     * contributors can be obtained from this object.<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;/p&gt;&lt;p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * Clients with specialized requirements can use alternative constructors to<a name="line.34"></a>
+<FONT color="green">035</FONT>     * control the statistics implementations and initial values used by the<a name="line.35"></a>
+<FONT color="green">036</FONT>     * contributing and the internal aggregate {@code SummaryStatistics} objects.<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;/p&gt;&lt;p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * A static {@link #aggregate(Collection)} method is also included that computes<a name="line.38"></a>
+<FONT color="green">039</FONT>     * aggregate statistics directly from a Collection of SummaryStatistics instances.<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;/p&gt;&lt;p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * When {@link #createContributingStatistics()} is used to create SummaryStatistics<a name="line.41"></a>
+<FONT color="green">042</FONT>     * instances to be aggregated concurrently, the created instances'<a name="line.42"></a>
+<FONT color="green">043</FONT>     * {@link SummaryStatistics#addValue(double)} methods must synchronize on the aggregating<a name="line.43"></a>
+<FONT color="green">044</FONT>     * instance maintained by this class.  In multithreaded environments, if the functionality<a name="line.44"></a>
+<FONT color="green">045</FONT>     * provided by {@link #aggregate(Collection)} is adequate, that method should be used<a name="line.45"></a>
+<FONT color="green">046</FONT>     * to avoid unecessary computation and synchronization delays.&lt;/p&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     *<a name="line.47"></a>
+<FONT color="green">048</FONT>     * @since 2.0<a name="line.48"></a>
+<FONT color="green">049</FONT>     * @version $Revision: 811833 $ $Date: 2009-09-06 12:27:50 -0400 (Sun, 06 Sep 2009) $<a name="line.49"></a>
+<FONT color="green">050</FONT>     *<a name="line.50"></a>
+<FONT color="green">051</FONT>     */<a name="line.51"></a>
+<FONT color="green">052</FONT>    public class AggregateSummaryStatistics implements StatisticalSummary,<a name="line.52"></a>
+<FONT color="green">053</FONT>            Serializable {<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** Serializable version identifier */<a name="line.56"></a>
+<FONT color="green">057</FONT>        private static final long serialVersionUID = -8207112444016386906L;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /**<a name="line.59"></a>
+<FONT color="green">060</FONT>         * A SummaryStatistics serving as a prototype for creating SummaryStatistics<a name="line.60"></a>
+<FONT color="green">061</FONT>         * contributing to this aggregate<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        private final SummaryStatistics statisticsPrototype;<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /**<a name="line.65"></a>
+<FONT color="green">066</FONT>         * The SummaryStatistics in which aggregate statistics are accumulated.<a name="line.66"></a>
+<FONT color="green">067</FONT>         */<a name="line.67"></a>
+<FONT color="green">068</FONT>        private final SummaryStatistics statistics;<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /**<a name="line.70"></a>
+<FONT color="green">071</FONT>         * Initializes a new AggregateSummaryStatistics with default statistics<a name="line.71"></a>
+<FONT color="green">072</FONT>         * implementations.<a name="line.72"></a>
+<FONT color="green">073</FONT>         *<a name="line.73"></a>
+<FONT color="green">074</FONT>         */<a name="line.74"></a>
+<FONT color="green">075</FONT>        public AggregateSummaryStatistics() {<a name="line.75"></a>
+<FONT color="green">076</FONT>            this(new SummaryStatistics());<a name="line.76"></a>
+<FONT color="green">077</FONT>        }<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        /**<a name="line.79"></a>
+<FONT color="green">080</FONT>         * Initializes a new AggregateSummaryStatistics with the specified statistics<a name="line.80"></a>
+<FONT color="green">081</FONT>         * object as a prototype for contributing statistics and for the internal<a name="line.81"></a>
+<FONT color="green">082</FONT>         * aggregate statistics.  This provides for customized statistics implementations<a name="line.82"></a>
+<FONT color="green">083</FONT>         * to be used by contributing and aggregate statistics.<a name="line.83"></a>
+<FONT color="green">084</FONT>         *<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @param prototypeStatistics a {@code SummaryStatistics} serving as a<a name="line.85"></a>
+<FONT color="green">086</FONT>         *      prototype both for the internal aggregate statistics and for<a name="line.86"></a>
+<FONT color="green">087</FONT>         *      contributing statistics obtained via the<a name="line.87"></a>
+<FONT color="green">088</FONT>         *      {@code createContributingStatistics()} method.  Being a prototype<a name="line.88"></a>
+<FONT color="green">089</FONT>         *      means that other objects are initialized by copying this object's state.<a name="line.89"></a>
+<FONT color="green">090</FONT>         *      If {@code null}, a new, default statistics object is used.  Any statistic<a name="line.90"></a>
+<FONT color="green">091</FONT>         *      values in the prototype are propagated to contributing statistics<a name="line.91"></a>
+<FONT color="green">092</FONT>         *      objects and (once) into these aggregate statistics.<a name="line.92"></a>
+<FONT color="green">093</FONT>         * @see #createContributingStatistics()<a name="line.93"></a>
+<FONT color="green">094</FONT>         */<a name="line.94"></a>
+<FONT color="green">095</FONT>        public AggregateSummaryStatistics(SummaryStatistics prototypeStatistics) {<a name="line.95"></a>
+<FONT color="green">096</FONT>            this(prototypeStatistics,<a name="line.96"></a>
+<FONT color="green">097</FONT>                 prototypeStatistics == null ? null : new SummaryStatistics(prototypeStatistics));<a name="line.97"></a>
+<FONT color="green">098</FONT>        }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>        /**<a name="line.100"></a>
+<FONT color="green">101</FONT>         * Initializes a new AggregateSummaryStatistics with the specified statistics<a name="line.101"></a>
+<FONT color="green">102</FONT>         * object as a prototype for contributing statistics and for the internal<a name="line.102"></a>
+<FONT color="green">103</FONT>         * aggregate statistics.  This provides for different statistics implementations<a name="line.103"></a>
+<FONT color="green">104</FONT>         * to be used by contributing and aggregate statistics and for an initial<a name="line.104"></a>
+<FONT color="green">105</FONT>         * state to be supplied for the aggregate statistics.<a name="line.105"></a>
+<FONT color="green">106</FONT>         *<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @param prototypeStatistics a {@code SummaryStatistics} serving as a<a name="line.107"></a>
+<FONT color="green">108</FONT>         *      prototype both for the internal aggregate statistics and for<a name="line.108"></a>
+<FONT color="green">109</FONT>         *      contributing statistics obtained via the<a name="line.109"></a>
+<FONT color="green">110</FONT>         *      {@code createContributingStatistics()} method.  Being a prototype<a name="line.110"></a>
+<FONT color="green">111</FONT>         *      means that other objects are initialized by copying this object's state.<a name="line.111"></a>
+<FONT color="green">112</FONT>         *      If {@code null}, a new, default statistics object is used.  Any statistic<a name="line.112"></a>
+<FONT color="green">113</FONT>         *      values in the prototype are propagated to contributing statistics<a name="line.113"></a>
+<FONT color="green">114</FONT>         *      objects, but not into these aggregate statistics.<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @param initialStatistics a {@code SummaryStatistics} to serve as the<a name="line.115"></a>
+<FONT color="green">116</FONT>         *      internal aggregate statistics object.  If {@code null}, a new, default<a name="line.116"></a>
+<FONT color="green">117</FONT>         *      statistics object is used.<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @see #createContributingStatistics()<a name="line.118"></a>
+<FONT color="green">119</FONT>         */<a name="line.119"></a>
+<FONT color="green">120</FONT>        public AggregateSummaryStatistics(SummaryStatistics prototypeStatistics,<a name="line.120"></a>
+<FONT color="green">121</FONT>                                          SummaryStatistics initialStatistics) {<a name="line.121"></a>
+<FONT color="green">122</FONT>            this.statisticsPrototype =<a name="line.122"></a>
+<FONT color="green">123</FONT>                (prototypeStatistics == null) ? new SummaryStatistics() : prototypeStatistics;<a name="line.123"></a>
+<FONT color="green">124</FONT>            this.statistics =<a name="line.124"></a>
+<FONT color="green">125</FONT>                (initialStatistics == null) ? new SummaryStatistics() : initialStatistics;<a name="line.125"></a>
+<FONT color="green">126</FONT>        }<a name="line.126"></a>
+<FONT color="green">127</FONT>    <a name="line.127"></a>
+<FONT color="green">128</FONT>        /**<a name="line.128"></a>
+<FONT color="green">129</FONT>         * {@inheritDoc}.  This version returns the maximum over all the aggregated<a name="line.129"></a>
+<FONT color="green">130</FONT>         * data.<a name="line.130"></a>
+<FONT color="green">131</FONT>         *<a name="line.131"></a>
+<FONT color="green">132</FONT>         * @see StatisticalSummary#getMax()<a name="line.132"></a>
+<FONT color="green">133</FONT>         */<a name="line.133"></a>
+<FONT color="green">134</FONT>        public double getMax() {<a name="line.134"></a>
+<FONT color="green">135</FONT>            synchronized (statistics) {<a name="line.135"></a>
+<FONT color="green">136</FONT>                return statistics.getMax();<a name="line.136"></a>
+<FONT color="green">137</FONT>            }<a name="line.137"></a>
+<FONT color="green">138</FONT>        }<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>        /**<a name="line.140"></a>
+<FONT color="green">141</FONT>         * {@inheritDoc}.  This version returns the mean of all the aggregated data.<a name="line.141"></a>
+<FONT color="green">142</FONT>         *<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @see StatisticalSummary#getMean()<a name="line.143"></a>
+<FONT color="green">144</FONT>         */<a name="line.144"></a>
+<FONT color="green">145</FONT>        public double getMean() {<a name="line.145"></a>
+<FONT color="green">146</FONT>            synchronized (statistics) {<a name="line.146"></a>
+<FONT color="green">147</FONT>                return statistics.getMean();<a name="line.147"></a>
+<FONT color="green">148</FONT>            }<a name="line.148"></a>
+<FONT color="green">149</FONT>        }<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>        /**<a name="line.151"></a>
+<FONT color="green">152</FONT>         * {@inheritDoc}.  This version returns the minimum over all the aggregated<a name="line.152"></a>
+<FONT color="green">153</FONT>         * data.<a name="line.153"></a>
+<FONT color="green">154</FONT>         *<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @see StatisticalSummary#getMin()<a name="line.155"></a>
+<FONT color="green">156</FONT>         */<a name="line.156"></a>
+<FONT color="green">157</FONT>        public double getMin() {<a name="line.157"></a>
+<FONT color="green">158</FONT>            synchronized (statistics) {<a name="line.158"></a>
+<FONT color="green">159</FONT>                return statistics.getMin();<a name="line.159"></a>
+<FONT color="green">160</FONT>            }<a name="line.160"></a>
+<FONT color="green">161</FONT>        }<a name="line.161"></a>
+<FONT color="green">162</FONT>    <a name="line.162"></a>
+<FONT color="green">163</FONT>        /**<a name="line.163"></a>
+<FONT color="green">164</FONT>         * {@inheritDoc}.  This version returns a count of all the aggregated data.<a name="line.164"></a>
+<FONT color="green">165</FONT>         *<a name="line.165"></a>
+<FONT color="green">166</FONT>         * @see StatisticalSummary#getN()<a name="line.166"></a>
+<FONT color="green">167</FONT>         */<a name="line.167"></a>
+<FONT color="green">168</FONT>        public long getN() {<a name="line.168"></a>
+<FONT color="green">169</FONT>            synchronized (statistics) {<a name="line.169"></a>
+<FONT color="green">170</FONT>                return statistics.getN();<a name="line.170"></a>
+<FONT color="green">171</FONT>            }<a name="line.171"></a>
+<FONT color="green">172</FONT>        }<a name="line.172"></a>
+<FONT color="green">173</FONT>    <a name="line.173"></a>
+<FONT color="green">174</FONT>        /**<a name="line.174"></a>
+<FONT color="green">175</FONT>         * {@inheritDoc}.  This version returns the standard deviation of all the<a name="line.175"></a>
+<FONT color="green">176</FONT>         * aggregated data.<a name="line.176"></a>
+<FONT color="green">177</FONT>         *<a name="line.177"></a>
+<FONT color="green">178</FONT>         * @see StatisticalSummary#getStandardDeviation()<a name="line.178"></a>
+<FONT color="green">179</FONT>         */<a name="line.179"></a>
+<FONT color="green">180</FONT>        public double getStandardDeviation() {<a name="line.180"></a>
+<FONT color="green">181</FONT>            synchronized (statistics) {<a name="line.181"></a>
+<FONT color="green">182</FONT>                return statistics.getStandardDeviation();<a name="line.182"></a>
+<FONT color="green">183</FONT>            }<a name="line.183"></a>
+<FONT color="green">184</FONT>        }<a name="line.184"></a>
+<FONT color="green">185</FONT>    <a name="line.185"></a>
+<FONT color="green">186</FONT>        /**<a name="line.186"></a>
+<FONT color="green">187</FONT>         * {@inheritDoc}.  This version returns a sum of all the aggregated data.<a name="line.187"></a>
+<FONT color="green">188</FONT>         *<a name="line.188"></a>
+<FONT color="green">189</FONT>         * @see StatisticalSummary#getSum()<a name="line.189"></a>
+<FONT color="green">190</FONT>         */<a name="line.190"></a>
+<FONT color="green">191</FONT>        public double getSum() {<a name="line.191"></a>
+<FONT color="green">192</FONT>            synchronized (statistics) {<a name="line.192"></a>
+<FONT color="green">193</FONT>                return statistics.getSum();<a name="line.193"></a>
+<FONT color="green">194</FONT>            }<a name="line.194"></a>
+<FONT color="green">195</FONT>        }<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>        /**<a name="line.197"></a>
+<FONT color="green">198</FONT>         * {@inheritDoc}.  This version returns the variance of all the aggregated<a name="line.198"></a>
+<FONT color="green">199</FONT>         * data.<a name="line.199"></a>
+<FONT color="green">200</FONT>         *<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @see StatisticalSummary#getVariance()<a name="line.201"></a>
+<FONT color="green">202</FONT>         */<a name="line.202"></a>
+<FONT color="green">203</FONT>        public double getVariance() {<a name="line.203"></a>
+<FONT color="green">204</FONT>            synchronized (statistics) {<a name="line.204"></a>
+<FONT color="green">205</FONT>                return statistics.getVariance();<a name="line.205"></a>
+<FONT color="green">206</FONT>            }<a name="line.206"></a>
+<FONT color="green">207</FONT>        }<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>        /**<a name="line.209"></a>
+<FONT color="green">210</FONT>         * Returns the sum of the logs of all the aggregated data.<a name="line.210"></a>
+<FONT color="green">211</FONT>         *<a name="line.211"></a>
+<FONT color="green">212</FONT>         * @return the sum of logs<a name="line.212"></a>
+<FONT color="green">213</FONT>         * @see SummaryStatistics#getSumOfLogs()<a name="line.213"></a>
+<FONT color="green">214</FONT>         */<a name="line.214"></a>
+<FONT color="green">215</FONT>        public double getSumOfLogs() {<a name="line.215"></a>
+<FONT color="green">216</FONT>            synchronized (statistics) {<a name="line.216"></a>
+<FONT color="green">217</FONT>                return statistics.getSumOfLogs();<a name="line.217"></a>
+<FONT color="green">218</FONT>            }<a name="line.218"></a>
+<FONT color="green">219</FONT>        }<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>        /**<a name="line.221"></a>
+<FONT color="green">222</FONT>         * Returns the geometric mean of all the aggregated data.<a name="line.222"></a>
+<FONT color="green">223</FONT>         *<a name="line.223"></a>
+<FONT color="green">224</FONT>         * @return the geometric mean<a name="line.224"></a>
+<FONT color="green">225</FONT>         * @see SummaryStatistics#getGeometricMean()<a name="line.225"></a>
+<FONT color="green">226</FONT>         */<a name="line.226"></a>
+<FONT color="green">227</FONT>        public double getGeometricMean() {<a name="line.227"></a>
+<FONT color="green">228</FONT>            synchronized (statistics) {<a name="line.228"></a>
+<FONT color="green">229</FONT>                return statistics.getGeometricMean();<a name="line.229"></a>
+<FONT color="green">230</FONT>            }<a name="line.230"></a>
+<FONT color="green">231</FONT>        }<a name="line.231"></a>
+<FONT color="green">232</FONT>    <a name="line.232"></a>
+<FONT color="green">233</FONT>        /**<a name="line.233"></a>
+<FONT color="green">234</FONT>         * Returns the sum of the squares of all the aggregated data.<a name="line.234"></a>
+<FONT color="green">235</FONT>         *<a name="line.235"></a>
+<FONT color="green">236</FONT>         * @return The sum of squares<a name="line.236"></a>
+<FONT color="green">237</FONT>         * @see SummaryStatistics#getSumsq()<a name="line.237"></a>
+<FONT color="green">238</FONT>         */<a name="line.238"></a>
+<FONT color="green">239</FONT>        public double getSumsq() {<a name="line.239"></a>
+<FONT color="green">240</FONT>            synchronized (statistics) {<a name="line.240"></a>
+<FONT color="green">241</FONT>                return statistics.getSumsq();<a name="line.241"></a>
+<FONT color="green">242</FONT>            }<a name="line.242"></a>
+<FONT color="green">243</FONT>        }<a name="line.243"></a>
+<FONT color="green">244</FONT>    <a name="line.244"></a>
+<FONT color="green">245</FONT>        /**<a name="line.245"></a>
+<FONT color="green">246</FONT>         * Returns a statistic related to the Second Central Moment.  Specifically,<a name="line.246"></a>
+<FONT color="green">247</FONT>         * what is returned is the sum of squared deviations from the sample mean<a name="line.247"></a>
+<FONT color="green">248</FONT>         * among the all of the aggregated data.<a name="line.248"></a>
+<FONT color="green">249</FONT>         *<a name="line.249"></a>
+<FONT color="green">250</FONT>         * @return second central moment statistic<a name="line.250"></a>
+<FONT color="green">251</FONT>         * @see SummaryStatistics#getSecondMoment()<a name="line.251"></a>
+<FONT color="green">252</FONT>         */<a name="line.252"></a>
+<FONT color="green">253</FONT>        public double getSecondMoment() {<a name="line.253"></a>
+<FONT color="green">254</FONT>            synchronized (statistics) {<a name="line.254"></a>
+<FONT color="green">255</FONT>                return statistics.getSecondMoment();<a name="line.255"></a>
+<FONT color="green">256</FONT>            }<a name="line.256"></a>
+<FONT color="green">257</FONT>        }<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>        /**<a name="line.259"></a>
+<FONT color="green">260</FONT>         * Return a {@link StatisticalSummaryValues} instance reporting current<a name="line.260"></a>
+<FONT color="green">261</FONT>         * aggregate statistics.<a name="line.261"></a>
+<FONT color="green">262</FONT>         *<a name="line.262"></a>
+<FONT color="green">263</FONT>         * @return Current values of aggregate statistics<a name="line.263"></a>
+<FONT color="green">264</FONT>         */<a name="line.264"></a>
+<FONT color="green">265</FONT>        public StatisticalSummary getSummary() {<a name="line.265"></a>
+<FONT color="green">266</FONT>            synchronized (statistics) {<a name="line.266"></a>
+<FONT color="green">267</FONT>                return new StatisticalSummaryValues(getMean(), getVariance(), getN(),<a name="line.267"></a>
+<FONT color="green">268</FONT>                        getMax(), getMin(), getSum());<a name="line.268"></a>
+<FONT color="green">269</FONT>            }<a name="line.269"></a>
+<FONT color="green">270</FONT>        }<a name="line.270"></a>
+<FONT color="green">271</FONT>    <a name="line.271"></a>
+<FONT color="green">272</FONT>        /**<a name="line.272"></a>
+<FONT color="green">273</FONT>         * Creates and returns a {@code SummaryStatistics} whose data will be<a name="line.273"></a>
+<FONT color="green">274</FONT>         * aggregated with those of this {@code AggregateSummaryStatistics}.<a name="line.274"></a>
+<FONT color="green">275</FONT>         *<a name="line.275"></a>
+<FONT color="green">276</FONT>         * @return a {@code SummaryStatistics} whose data will be aggregated with<a name="line.276"></a>
+<FONT color="green">277</FONT>         *      those of this {@code AggregateSummaryStatistics}.  The initial state<a name="line.277"></a>
+<FONT color="green">278</FONT>         *      is a copy of the configured prototype statistics.<a name="line.278"></a>
+<FONT color="green">279</FONT>         */<a name="line.279"></a>
+<FONT color="green">280</FONT>        public SummaryStatistics createContributingStatistics() {<a name="line.280"></a>
+<FONT color="green">281</FONT>            SummaryStatistics contributingStatistics<a name="line.281"></a>
+<FONT color="green">282</FONT>                    = new AggregatingSummaryStatistics(statistics);<a name="line.282"></a>
+<FONT color="green">283</FONT>    <a name="line.283"></a>
+<FONT color="green">284</FONT>            SummaryStatistics.copy(statisticsPrototype, contributingStatistics);<a name="line.284"></a>
+<FONT color="green">285</FONT>    <a name="line.285"></a>
+<FONT color="green">286</FONT>            return contributingStatistics;<a name="line.286"></a>
+<FONT color="green">287</FONT>        }<a name="line.287"></a>
+<FONT color="green">288</FONT>    <a name="line.288"></a>
+<FONT color="green">289</FONT>        /**<a name="line.289"></a>
+<FONT color="green">290</FONT>         * Computes aggregate summary statistics. This method can be used to combine statistics<a name="line.290"></a>
+<FONT color="green">291</FONT>         * computed over partitions or subsamples - i.e., the StatisticalSummaryValues returned<a name="line.291"></a>
+<FONT color="green">292</FONT>         * should contain the same values that would have been obtained by computing a single<a name="line.292"></a>
+<FONT color="green">293</FONT>         * StatisticalSummary over the combined dataset.<a name="line.293"></a>
+<FONT color="green">294</FONT>         * &lt;p&gt;<a name="line.294"></a>
+<FONT color="green">295</FONT>         * Returns null if the collection is empty or null.<a name="line.295"></a>
+<FONT color="green">296</FONT>         * &lt;/p&gt;<a name="line.296"></a>
+<FONT color="green">297</FONT>         *<a name="line.297"></a>
+<FONT color="green">298</FONT>         * @param statistics collection of SummaryStatistics to aggregate<a name="line.298"></a>
+<FONT color="green">299</FONT>         * @return summary statistics for the combined dataset<a name="line.299"></a>
+<FONT color="green">300</FONT>         */<a name="line.300"></a>
+<FONT color="green">301</FONT>        public static StatisticalSummaryValues aggregate(Collection&lt;SummaryStatistics&gt; statistics) {<a name="line.301"></a>
+<FONT color="green">302</FONT>            if (statistics == null) {<a name="line.302"></a>
+<FONT color="green">303</FONT>                return null;<a name="line.303"></a>
+<FONT color="green">304</FONT>            }<a name="line.304"></a>
+<FONT color="green">305</FONT>            Iterator&lt;SummaryStatistics&gt; iterator = statistics.iterator();<a name="line.305"></a>
+<FONT color="green">306</FONT>            if (!iterator.hasNext()) {<a name="line.306"></a>
+<FONT color="green">307</FONT>                return null;<a name="line.307"></a>
+<FONT color="green">308</FONT>            }<a name="line.308"></a>
+<FONT color="green">309</FONT>            SummaryStatistics current = iterator.next();<a name="line.309"></a>
+<FONT color="green">310</FONT>            long n = current.getN();<a name="line.310"></a>
+<FONT color="green">311</FONT>            double min = current.getMin();<a name="line.311"></a>
+<FONT color="green">312</FONT>            double sum = current.getSum();<a name="line.312"></a>
+<FONT color="green">313</FONT>            double max = current.getMax();<a name="line.313"></a>
+<FONT color="green">314</FONT>            double m2 = current.getSecondMoment();<a name="line.314"></a>
+<FONT color="green">315</FONT>            double mean = current.getMean();<a name="line.315"></a>
+<FONT color="green">316</FONT>            while (iterator.hasNext()) {<a name="line.316"></a>
+<FONT color="green">317</FONT>                current = iterator.next();<a name="line.317"></a>
+<FONT color="green">318</FONT>                if (current.getMin() &lt; min || Double.isNaN(min)) {<a name="line.318"></a>
+<FONT color="green">319</FONT>                    min = current.getMin();<a name="line.319"></a>
+<FONT color="green">320</FONT>                }<a name="line.320"></a>
+<FONT color="green">321</FONT>                if (current.getMax() &gt; max || Double.isNaN(max)) {<a name="line.321"></a>
+<FONT color="green">322</FONT>                    max = current.getMax();<a name="line.322"></a>
+<FONT color="green">323</FONT>                }<a name="line.323"></a>
+<FONT color="green">324</FONT>                sum += current.getSum();<a name="line.324"></a>
+<FONT color="green">325</FONT>                final double oldN = n;<a name="line.325"></a>
+<FONT color="green">326</FONT>                final double curN = current.getN();<a name="line.326"></a>
+<FONT color="green">327</FONT>                n += curN;<a name="line.327"></a>
+<FONT color="green">328</FONT>                final double meanDiff = current.getMean() - mean;<a name="line.328"></a>
+<FONT color="green">329</FONT>                mean = sum / n;<a name="line.329"></a>
+<FONT color="green">330</FONT>                m2 = m2 + current.getSecondMoment() + meanDiff * meanDiff * oldN * curN / n;<a name="line.330"></a>
+<FONT color="green">331</FONT>            }<a name="line.331"></a>
+<FONT color="green">332</FONT>            final double variance;<a name="line.332"></a>
+<FONT color="green">333</FONT>            if (n == 0) {<a name="line.333"></a>
+<FONT color="green">334</FONT>                variance = Double.NaN;<a name="line.334"></a>
+<FONT color="green">335</FONT>            } else if (n == 1) {<a name="line.335"></a>
+<FONT color="green">336</FONT>                variance = 0d;<a name="line.336"></a>
+<FONT color="green">337</FONT>            } else {<a name="line.337"></a>
+<FONT color="green">338</FONT>                variance = m2 / (n - 1);<a name="line.338"></a>
+<FONT color="green">339</FONT>            }<a name="line.339"></a>
+<FONT color="green">340</FONT>            return new StatisticalSummaryValues(mean, variance, n, max, min, sum);<a name="line.340"></a>
+<FONT color="green">341</FONT>        }<a name="line.341"></a>
+<FONT color="green">342</FONT>    <a name="line.342"></a>
+<FONT color="green">343</FONT>        /**<a name="line.343"></a>
+<FONT color="green">344</FONT>         * A SummaryStatistics that also forwards all values added to it to a second<a name="line.344"></a>
+<FONT color="green">345</FONT>         * {@code SummaryStatistics} for aggregation.<a name="line.345"></a>
+<FONT color="green">346</FONT>         *<a name="line.346"></a>
+<FONT color="green">347</FONT>         * @since 2.0<a name="line.347"></a>
+<FONT color="green">348</FONT>         */<a name="line.348"></a>
+<FONT color="green">349</FONT>        private static class AggregatingSummaryStatistics extends SummaryStatistics {<a name="line.349"></a>
+<FONT color="green">350</FONT>    <a name="line.350"></a>
+<FONT color="green">351</FONT>            /**<a name="line.351"></a>
+<FONT color="green">352</FONT>             * The serialization version of this class<a name="line.352"></a>
+<FONT color="green">353</FONT>             */<a name="line.353"></a>
+<FONT color="green">354</FONT>            private static final long serialVersionUID = 1L;<a name="line.354"></a>
+<FONT color="green">355</FONT>    <a name="line.355"></a>
+<FONT color="green">356</FONT>            /**<a name="line.356"></a>
+<FONT color="green">357</FONT>             * An additional SummaryStatistics into which values added to these<a name="line.357"></a>
+<FONT color="green">358</FONT>             * statistics (and possibly others) are aggregated<a name="line.358"></a>
+<FONT color="green">359</FONT>             */<a name="line.359"></a>
+<FONT color="green">360</FONT>            private final SummaryStatistics aggregateStatistics;<a name="line.360"></a>
+<FONT color="green">361</FONT>    <a name="line.361"></a>
+<FONT color="green">362</FONT>            /**<a name="line.362"></a>
+<FONT color="green">363</FONT>             * Initializes a new AggregatingSummaryStatistics with the specified<a name="line.363"></a>
+<FONT color="green">364</FONT>             * aggregate statistics object<a name="line.364"></a>
+<FONT color="green">365</FONT>             *<a name="line.365"></a>
+<FONT color="green">366</FONT>             * @param aggregateStatistics a {@code SummaryStatistics} into which<a name="line.366"></a>
+<FONT color="green">367</FONT>             *      values added to this statistics object should be aggregated<a name="line.367"></a>
+<FONT color="green">368</FONT>             */<a name="line.368"></a>
+<FONT color="green">369</FONT>            public AggregatingSummaryStatistics(SummaryStatistics aggregateStatistics) {<a name="line.369"></a>
+<FONT color="green">370</FONT>                this.aggregateStatistics = aggregateStatistics;<a name="line.370"></a>
+<FONT color="green">371</FONT>            }<a name="line.371"></a>
+<FONT color="green">372</FONT>    <a name="line.372"></a>
+<FONT color="green">373</FONT>            /**<a name="line.373"></a>
+<FONT color="green">374</FONT>             * {@inheritDoc}.  This version adds the provided value to the configured<a name="line.374"></a>
+<FONT color="green">375</FONT>             * aggregate after adding it to these statistics.<a name="line.375"></a>
+<FONT color="green">376</FONT>             *<a name="line.376"></a>
+<FONT color="green">377</FONT>             * @see SummaryStatistics#addValue(double)<a name="line.377"></a>
+<FONT color="green">378</FONT>             */<a name="line.378"></a>
+<FONT color="green">379</FONT>            @Override<a name="line.379"></a>
+<FONT color="green">380</FONT>            public void addValue(double value) {<a name="line.380"></a>
+<FONT color="green">381</FONT>                super.addValue(value);<a name="line.381"></a>
+<FONT color="green">382</FONT>                synchronized (aggregateStatistics) {<a name="line.382"></a>
+<FONT color="green">383</FONT>                    aggregateStatistics.addValue(value);<a name="line.383"></a>
+<FONT color="green">384</FONT>                }<a name="line.384"></a>
+<FONT color="green">385</FONT>            }<a name="line.385"></a>
+<FONT color="green">386</FONT>    <a name="line.386"></a>
+<FONT color="green">387</FONT>            /**<a name="line.387"></a>
+<FONT color="green">388</FONT>             * Returns true iff &lt;code&gt;object&lt;/code&gt; is a<a name="line.388"></a>
+<FONT color="green">389</FONT>             * &lt;code&gt;SummaryStatistics&lt;/code&gt; instance and all statistics have the<a name="line.389"></a>
+<FONT color="green">390</FONT>             * same values as this.<a name="line.390"></a>
+<FONT color="green">391</FONT>             * @param object the object to test equality against.<a name="line.391"></a>
+<FONT color="green">392</FONT>             * @return true if object equals this<a name="line.392"></a>
+<FONT color="green">393</FONT>             */<a name="line.393"></a>
+<FONT color="green">394</FONT>            @Override<a name="line.394"></a>
+<FONT color="green">395</FONT>            public boolean equals(Object object) {<a name="line.395"></a>
+<FONT color="green">396</FONT>                if (object == this) {<a name="line.396"></a>
+<FONT color="green">397</FONT>                    return true;<a name="line.397"></a>
+<FONT color="green">398</FONT>                }<a name="line.398"></a>
+<FONT color="green">399</FONT>                if (object instanceof AggregatingSummaryStatistics == false) {<a name="line.399"></a>
+<FONT color="green">400</FONT>                    return false;<a name="line.400"></a>
+<FONT color="green">401</FONT>                }<a name="line.401"></a>
+<FONT color="green">402</FONT>                AggregatingSummaryStatistics stat = (AggregatingSummaryStatistics)object;<a name="line.402"></a>
+<FONT color="green">403</FONT>                return super.equals(stat) &amp;&amp;<a name="line.403"></a>
+<FONT color="green">404</FONT>                       aggregateStatistics.equals(stat.aggregateStatistics);<a name="line.404"></a>
+<FONT color="green">405</FONT>            }<a name="line.405"></a>
+<FONT color="green">406</FONT>    <a name="line.406"></a>
+<FONT color="green">407</FONT>            /**<a name="line.407"></a>
+<FONT color="green">408</FONT>             * Returns hash code based on values of statistics<a name="line.408"></a>
+<FONT color="green">409</FONT>             * @return hash code<a name="line.409"></a>
+<FONT color="green">410</FONT>             */<a name="line.410"></a>
+<FONT color="green">411</FONT>            @Override<a name="line.411"></a>
+<FONT color="green">412</FONT>            public int hashCode() {<a name="line.412"></a>
+<FONT color="green">413</FONT>                return 123 + super.hashCode() + aggregateStatistics.hashCode();<a name="line.413"></a>
+<FONT color="green">414</FONT>            }<a name="line.414"></a>
+<FONT color="green">415</FONT>        }<a name="line.415"></a>
+<FONT color="green">416</FONT>    }<a name="line.416"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,779 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.lang.reflect.InvocationTargetException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.Arrays;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.stat.descriptive.moment.GeometricMean;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.stat.descriptive.moment.Kurtosis;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.stat.descriptive.moment.Mean;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.stat.descriptive.moment.Skewness;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.stat.descriptive.moment.Variance;<a name="line.28"></a>
+<FONT color="green">029</FONT>    import org.apache.commons.math.stat.descriptive.rank.Max;<a name="line.29"></a>
+<FONT color="green">030</FONT>    import org.apache.commons.math.stat.descriptive.rank.Min;<a name="line.30"></a>
+<FONT color="green">031</FONT>    import org.apache.commons.math.stat.descriptive.rank.Percentile;<a name="line.31"></a>
+<FONT color="green">032</FONT>    import org.apache.commons.math.stat.descriptive.summary.Sum;<a name="line.32"></a>
+<FONT color="green">033</FONT>    import org.apache.commons.math.stat.descriptive.summary.SumOfSquares;<a name="line.33"></a>
+<FONT color="green">034</FONT>    import org.apache.commons.math.util.ResizableDoubleArray;<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>    /**<a name="line.37"></a>
+<FONT color="green">038</FONT>     * Maintains a dataset of values of a single variable and computes descriptive<a name="line.38"></a>
+<FONT color="green">039</FONT>     * statistics based on stored data. The {@link #getWindowSize() windowSize}<a name="line.39"></a>
+<FONT color="green">040</FONT>     * property sets a limit on the number of values that can be stored in the<a name="line.40"></a>
+<FONT color="green">041</FONT>     * dataset.  The default value, INFINITE_WINDOW, puts no limit on the size of<a name="line.41"></a>
+<FONT color="green">042</FONT>     * the dataset.  This value should be used with caution, as the backing store<a name="line.42"></a>
+<FONT color="green">043</FONT>     * will grow without bound in this case.  For very large datasets,<a name="line.43"></a>
+<FONT color="green">044</FONT>     * {@link SummaryStatistics}, which does not store the dataset, should be used<a name="line.44"></a>
+<FONT color="green">045</FONT>     * instead of this class. If &lt;code&gt;windowSize&lt;/code&gt; is not INFINITE_WINDOW and<a name="line.45"></a>
+<FONT color="green">046</FONT>     * more values are added than can be stored in the dataset, new values are<a name="line.46"></a>
+<FONT color="green">047</FONT>     * added in a "rolling" manner, with new values replacing the "oldest" values<a name="line.47"></a>
+<FONT color="green">048</FONT>     * in the dataset.<a name="line.48"></a>
+<FONT color="green">049</FONT>     *<a name="line.49"></a>
+<FONT color="green">050</FONT>     * &lt;p&gt;Note: this class is not threadsafe.  Use<a name="line.50"></a>
+<FONT color="green">051</FONT>     * {@link SynchronizedDescriptiveStatistics} if concurrent access from multiple<a name="line.51"></a>
+<FONT color="green">052</FONT>     * threads is required.&lt;/p&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>     *<a name="line.53"></a>
+<FONT color="green">054</FONT>     * @version $Revision: 885278 $ $Date: 2009-11-29 16:47:51 -0500 (Sun, 29 Nov 2009) $<a name="line.54"></a>
+<FONT color="green">055</FONT>     */<a name="line.55"></a>
+<FONT color="green">056</FONT>    public class DescriptiveStatistics implements StatisticalSummary, Serializable {<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /**<a name="line.58"></a>
+<FONT color="green">059</FONT>         * Represents an infinite window size.  When the {@link #getWindowSize()}<a name="line.59"></a>
+<FONT color="green">060</FONT>         * returns this value, there is no limit to the number of data values<a name="line.60"></a>
+<FONT color="green">061</FONT>         * that can be stored in the dataset.<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        public static final int INFINITE_WINDOW = -1;<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Serialization UID */<a name="line.65"></a>
+<FONT color="green">066</FONT>        private static final long serialVersionUID = 4133067267405273064L;<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /** Name of the setQuantile method. */<a name="line.68"></a>
+<FONT color="green">069</FONT>        private static final String SET_QUANTILE_METHOD_NAME = "setQuantile";<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** Message for unsupported setQuantile. */<a name="line.71"></a>
+<FONT color="green">072</FONT>        private static final String UNSUPPORTED_METHOD_MESSAGE =<a name="line.72"></a>
+<FONT color="green">073</FONT>            "percentile implementation {0} does not support {1}";<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /** Message for illegal accesson setquantile. */<a name="line.75"></a>
+<FONT color="green">076</FONT>        private static final String ILLEGAL_ACCESS_MESSAGE =<a name="line.76"></a>
+<FONT color="green">077</FONT>            "cannot access {0} method in percentile implementation {1}";<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        /** hold the window size **/<a name="line.79"></a>
+<FONT color="green">080</FONT>        protected int windowSize = INFINITE_WINDOW;<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>        /**<a name="line.82"></a>
+<FONT color="green">083</FONT>         *  Stored data values<a name="line.83"></a>
+<FONT color="green">084</FONT>         */<a name="line.84"></a>
+<FONT color="green">085</FONT>        protected ResizableDoubleArray eDA = new ResizableDoubleArray();<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>        /** Mean statistic implementation - can be reset by setter. */<a name="line.87"></a>
+<FONT color="green">088</FONT>        private UnivariateStatistic meanImpl = new Mean();<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>        /** Geometric mean statistic implementation - can be reset by setter. */<a name="line.90"></a>
+<FONT color="green">091</FONT>        private UnivariateStatistic geometricMeanImpl = new GeometricMean();<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /** Kurtosis statistic implementation - can be reset by setter. */<a name="line.93"></a>
+<FONT color="green">094</FONT>        private UnivariateStatistic kurtosisImpl = new Kurtosis();<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /** Maximum statistic implementation - can be reset by setter. */<a name="line.96"></a>
+<FONT color="green">097</FONT>        private UnivariateStatistic maxImpl = new Max();<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>        /** Minimum statistic implementation - can be reset by setter. */<a name="line.99"></a>
+<FONT color="green">100</FONT>        private UnivariateStatistic minImpl = new Min();<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>        /** Percentile statistic implementation - can be reset by setter. */<a name="line.102"></a>
+<FONT color="green">103</FONT>        private UnivariateStatistic percentileImpl = new Percentile();<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /** Skewness statistic implementation - can be reset by setter. */<a name="line.105"></a>
+<FONT color="green">106</FONT>        private UnivariateStatistic skewnessImpl = new Skewness();<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>        /** Variance statistic implementation - can be reset by setter. */<a name="line.108"></a>
+<FONT color="green">109</FONT>        private UnivariateStatistic varianceImpl = new Variance();<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /** Sum of squares statistic implementation - can be reset by setter. */<a name="line.111"></a>
+<FONT color="green">112</FONT>        private UnivariateStatistic sumsqImpl = new SumOfSquares();<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /** Sum statistic implementation - can be reset by setter. */<a name="line.114"></a>
+<FONT color="green">115</FONT>        private UnivariateStatistic sumImpl = new Sum();<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>        /**<a name="line.117"></a>
+<FONT color="green">118</FONT>         * Construct a DescriptiveStatistics instance with an infinite window<a name="line.118"></a>
+<FONT color="green">119</FONT>         */<a name="line.119"></a>
+<FONT color="green">120</FONT>        public DescriptiveStatistics() {<a name="line.120"></a>
+<FONT color="green">121</FONT>        }<a name="line.121"></a>
+<FONT color="green">122</FONT>    <a name="line.122"></a>
+<FONT color="green">123</FONT>        /**<a name="line.123"></a>
+<FONT color="green">124</FONT>         * Construct a DescriptiveStatistics instance with the specified window<a name="line.124"></a>
+<FONT color="green">125</FONT>         *<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @param window the window size.<a name="line.126"></a>
+<FONT color="green">127</FONT>         */<a name="line.127"></a>
+<FONT color="green">128</FONT>        public DescriptiveStatistics(int window) {<a name="line.128"></a>
+<FONT color="green">129</FONT>            setWindowSize(window);<a name="line.129"></a>
+<FONT color="green">130</FONT>        }<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>        /**<a name="line.132"></a>
+<FONT color="green">133</FONT>         * Copy constructor.  Construct a new DescriptiveStatistics instance that<a name="line.133"></a>
+<FONT color="green">134</FONT>         * is a copy of original.<a name="line.134"></a>
+<FONT color="green">135</FONT>         *<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @param original DescriptiveStatistics instance to copy<a name="line.136"></a>
+<FONT color="green">137</FONT>         */<a name="line.137"></a>
+<FONT color="green">138</FONT>        public DescriptiveStatistics(DescriptiveStatistics original) {<a name="line.138"></a>
+<FONT color="green">139</FONT>            copy(original, this);<a name="line.139"></a>
+<FONT color="green">140</FONT>        }<a name="line.140"></a>
+<FONT color="green">141</FONT>    <a name="line.141"></a>
+<FONT color="green">142</FONT>        /**<a name="line.142"></a>
+<FONT color="green">143</FONT>         * Adds the value to the dataset. If the dataset is at the maximum size<a name="line.143"></a>
+<FONT color="green">144</FONT>         * (i.e., the number of stored elements equals the currently configured<a name="line.144"></a>
+<FONT color="green">145</FONT>         * windowSize), the first (oldest) element in the dataset is discarded<a name="line.145"></a>
+<FONT color="green">146</FONT>         * to make room for the new value.<a name="line.146"></a>
+<FONT color="green">147</FONT>         *<a name="line.147"></a>
+<FONT color="green">148</FONT>         * @param v the value to be added<a name="line.148"></a>
+<FONT color="green">149</FONT>         */<a name="line.149"></a>
+<FONT color="green">150</FONT>        public void addValue(double v) {<a name="line.150"></a>
+<FONT color="green">151</FONT>            if (windowSize != INFINITE_WINDOW) {<a name="line.151"></a>
+<FONT color="green">152</FONT>                if (getN() == windowSize) {<a name="line.152"></a>
+<FONT color="green">153</FONT>                    eDA.addElementRolling(v);<a name="line.153"></a>
+<FONT color="green">154</FONT>                } else if (getN() &lt; windowSize) {<a name="line.154"></a>
+<FONT color="green">155</FONT>                    eDA.addElement(v);<a name="line.155"></a>
+<FONT color="green">156</FONT>                }<a name="line.156"></a>
+<FONT color="green">157</FONT>            } else {<a name="line.157"></a>
+<FONT color="green">158</FONT>                eDA.addElement(v);<a name="line.158"></a>
+<FONT color="green">159</FONT>            }<a name="line.159"></a>
+<FONT color="green">160</FONT>        }<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>        /**<a name="line.162"></a>
+<FONT color="green">163</FONT>         * Removes the most recent value from the dataset.<a name="line.163"></a>
+<FONT color="green">164</FONT>         */<a name="line.164"></a>
+<FONT color="green">165</FONT>        public void removeMostRecentValue() {<a name="line.165"></a>
+<FONT color="green">166</FONT>            eDA.discardMostRecentElements(1);<a name="line.166"></a>
+<FONT color="green">167</FONT>        }<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>        /**<a name="line.169"></a>
+<FONT color="green">170</FONT>         * Replaces the most recently stored value with the given value.<a name="line.170"></a>
+<FONT color="green">171</FONT>         * There must be at least one element stored to call this method.<a name="line.171"></a>
+<FONT color="green">172</FONT>         *<a name="line.172"></a>
+<FONT color="green">173</FONT>         * @param v the value to replace the most recent stored value<a name="line.173"></a>
+<FONT color="green">174</FONT>         * @return replaced value<a name="line.174"></a>
+<FONT color="green">175</FONT>         */<a name="line.175"></a>
+<FONT color="green">176</FONT>        public double replaceMostRecentValue(double v) {<a name="line.176"></a>
+<FONT color="green">177</FONT>            return eDA.substituteMostRecentElement(v);<a name="line.177"></a>
+<FONT color="green">178</FONT>        }<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>        /**<a name="line.180"></a>
+<FONT color="green">181</FONT>         * Returns the &lt;a href="http://www.xycoon.com/arithmetic_mean.htm"&gt;<a name="line.181"></a>
+<FONT color="green">182</FONT>         * arithmetic mean &lt;/a&gt; of the available values<a name="line.182"></a>
+<FONT color="green">183</FONT>         * @return The mean or Double.NaN if no values have been added.<a name="line.183"></a>
+<FONT color="green">184</FONT>         */<a name="line.184"></a>
+<FONT color="green">185</FONT>        public double getMean() {<a name="line.185"></a>
+<FONT color="green">186</FONT>            return apply(meanImpl);<a name="line.186"></a>
+<FONT color="green">187</FONT>        }<a name="line.187"></a>
+<FONT color="green">188</FONT>    <a name="line.188"></a>
+<FONT color="green">189</FONT>        /**<a name="line.189"></a>
+<FONT color="green">190</FONT>         * Returns the &lt;a href="http://www.xycoon.com/geometric_mean.htm"&gt;<a name="line.190"></a>
+<FONT color="green">191</FONT>         * geometric mean &lt;/a&gt; of the available values<a name="line.191"></a>
+<FONT color="green">192</FONT>         * @return The geometricMean, Double.NaN if no values have been added,<a name="line.192"></a>
+<FONT color="green">193</FONT>         * or if the product of the available values is less than or equal to 0.<a name="line.193"></a>
+<FONT color="green">194</FONT>         */<a name="line.194"></a>
+<FONT color="green">195</FONT>        public double getGeometricMean() {<a name="line.195"></a>
+<FONT color="green">196</FONT>            return apply(geometricMeanImpl);<a name="line.196"></a>
+<FONT color="green">197</FONT>        }<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>        /**<a name="line.199"></a>
+<FONT color="green">200</FONT>         * Returns the variance of the available values.<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @return The variance, Double.NaN if no values have been added<a name="line.201"></a>
+<FONT color="green">202</FONT>         * or 0.0 for a single value set.<a name="line.202"></a>
+<FONT color="green">203</FONT>         */<a name="line.203"></a>
+<FONT color="green">204</FONT>        public double getVariance() {<a name="line.204"></a>
+<FONT color="green">205</FONT>            return apply(varianceImpl);<a name="line.205"></a>
+<FONT color="green">206</FONT>        }<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>        /**<a name="line.208"></a>
+<FONT color="green">209</FONT>         * Returns the standard deviation of the available values.<a name="line.209"></a>
+<FONT color="green">210</FONT>         * @return The standard deviation, Double.NaN if no values have been added<a name="line.210"></a>
+<FONT color="green">211</FONT>         * or 0.0 for a single value set.<a name="line.211"></a>
+<FONT color="green">212</FONT>         */<a name="line.212"></a>
+<FONT color="green">213</FONT>        public double getStandardDeviation() {<a name="line.213"></a>
+<FONT color="green">214</FONT>            double stdDev = Double.NaN;<a name="line.214"></a>
+<FONT color="green">215</FONT>            if (getN() &gt; 0) {<a name="line.215"></a>
+<FONT color="green">216</FONT>                if (getN() &gt; 1) {<a name="line.216"></a>
+<FONT color="green">217</FONT>                    stdDev = Math.sqrt(getVariance());<a name="line.217"></a>
+<FONT color="green">218</FONT>                } else {<a name="line.218"></a>
+<FONT color="green">219</FONT>                    stdDev = 0.0;<a name="line.219"></a>
+<FONT color="green">220</FONT>                }<a name="line.220"></a>
+<FONT color="green">221</FONT>            }<a name="line.221"></a>
+<FONT color="green">222</FONT>            return stdDev;<a name="line.222"></a>
+<FONT color="green">223</FONT>        }<a name="line.223"></a>
+<FONT color="green">224</FONT>    <a name="line.224"></a>
+<FONT color="green">225</FONT>        /**<a name="line.225"></a>
+<FONT color="green">226</FONT>         * Returns the skewness of the available values. Skewness is a<a name="line.226"></a>
+<FONT color="green">227</FONT>         * measure of the asymmetry of a given distribution.<a name="line.227"></a>
+<FONT color="green">228</FONT>         * @return The skewness, Double.NaN if no values have been added<a name="line.228"></a>
+<FONT color="green">229</FONT>         * or 0.0 for a value set &amp;lt;=2.<a name="line.229"></a>
+<FONT color="green">230</FONT>         */<a name="line.230"></a>
+<FONT color="green">231</FONT>        public double getSkewness() {<a name="line.231"></a>
+<FONT color="green">232</FONT>            return apply(skewnessImpl);<a name="line.232"></a>
+<FONT color="green">233</FONT>        }<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>        /**<a name="line.235"></a>
+<FONT color="green">236</FONT>         * Returns the Kurtosis of the available values. Kurtosis is a<a name="line.236"></a>
+<FONT color="green">237</FONT>         * measure of the "peakedness" of a distribution<a name="line.237"></a>
+<FONT color="green">238</FONT>         * @return The kurtosis, Double.NaN if no values have been added, or 0.0<a name="line.238"></a>
+<FONT color="green">239</FONT>         * for a value set &amp;lt;=3.<a name="line.239"></a>
+<FONT color="green">240</FONT>         */<a name="line.240"></a>
+<FONT color="green">241</FONT>        public double getKurtosis() {<a name="line.241"></a>
+<FONT color="green">242</FONT>            return apply(kurtosisImpl);<a name="line.242"></a>
+<FONT color="green">243</FONT>        }<a name="line.243"></a>
+<FONT color="green">244</FONT>    <a name="line.244"></a>
+<FONT color="green">245</FONT>        /**<a name="line.245"></a>
+<FONT color="green">246</FONT>         * Returns the maximum of the available values<a name="line.246"></a>
+<FONT color="green">247</FONT>         * @return The max or Double.NaN if no values have been added.<a name="line.247"></a>
+<FONT color="green">248</FONT>         */<a name="line.248"></a>
+<FONT color="green">249</FONT>        public double getMax() {<a name="line.249"></a>
+<FONT color="green">250</FONT>            return apply(maxImpl);<a name="line.250"></a>
+<FONT color="green">251</FONT>        }<a name="line.251"></a>
+<FONT color="green">252</FONT>    <a name="line.252"></a>
+<FONT color="green">253</FONT>        /**<a name="line.253"></a>
+<FONT color="green">254</FONT>        * Returns the minimum of the available values<a name="line.254"></a>
+<FONT color="green">255</FONT>        * @return The min or Double.NaN if no values have been added.<a name="line.255"></a>
+<FONT color="green">256</FONT>        */<a name="line.256"></a>
+<FONT color="green">257</FONT>        public double getMin() {<a name="line.257"></a>
+<FONT color="green">258</FONT>            return apply(minImpl);<a name="line.258"></a>
+<FONT color="green">259</FONT>        }<a name="line.259"></a>
+<FONT color="green">260</FONT>    <a name="line.260"></a>
+<FONT color="green">261</FONT>        /**<a name="line.261"></a>
+<FONT color="green">262</FONT>         * Returns the number of available values<a name="line.262"></a>
+<FONT color="green">263</FONT>         * @return The number of available values<a name="line.263"></a>
+<FONT color="green">264</FONT>         */<a name="line.264"></a>
+<FONT color="green">265</FONT>        public long getN() {<a name="line.265"></a>
+<FONT color="green">266</FONT>            return eDA.getNumElements();<a name="line.266"></a>
+<FONT color="green">267</FONT>        }<a name="line.267"></a>
+<FONT color="green">268</FONT>    <a name="line.268"></a>
+<FONT color="green">269</FONT>        /**<a name="line.269"></a>
+<FONT color="green">270</FONT>         * Returns the sum of the values that have been added to Univariate.<a name="line.270"></a>
+<FONT color="green">271</FONT>         * @return The sum or Double.NaN if no values have been added<a name="line.271"></a>
+<FONT color="green">272</FONT>         */<a name="line.272"></a>
+<FONT color="green">273</FONT>        public double getSum() {<a name="line.273"></a>
+<FONT color="green">274</FONT>            return apply(sumImpl);<a name="line.274"></a>
+<FONT color="green">275</FONT>        }<a name="line.275"></a>
+<FONT color="green">276</FONT>    <a name="line.276"></a>
+<FONT color="green">277</FONT>        /**<a name="line.277"></a>
+<FONT color="green">278</FONT>         * Returns the sum of the squares of the available values.<a name="line.278"></a>
+<FONT color="green">279</FONT>         * @return The sum of the squares or Double.NaN if no<a name="line.279"></a>
+<FONT color="green">280</FONT>         * values have been added.<a name="line.280"></a>
+<FONT color="green">281</FONT>         */<a name="line.281"></a>
+<FONT color="green">282</FONT>        public double getSumsq() {<a name="line.282"></a>
+<FONT color="green">283</FONT>            return apply(sumsqImpl);<a name="line.283"></a>
+<FONT color="green">284</FONT>        }<a name="line.284"></a>
+<FONT color="green">285</FONT>    <a name="line.285"></a>
+<FONT color="green">286</FONT>        /**<a name="line.286"></a>
+<FONT color="green">287</FONT>         * Resets all statistics and storage<a name="line.287"></a>
+<FONT color="green">288</FONT>         */<a name="line.288"></a>
+<FONT color="green">289</FONT>        public void clear() {<a name="line.289"></a>
+<FONT color="green">290</FONT>            eDA.clear();<a name="line.290"></a>
+<FONT color="green">291</FONT>        }<a name="line.291"></a>
+<FONT color="green">292</FONT>    <a name="line.292"></a>
+<FONT color="green">293</FONT>    <a name="line.293"></a>
+<FONT color="green">294</FONT>        /**<a name="line.294"></a>
+<FONT color="green">295</FONT>         * Returns the maximum number of values that can be stored in the<a name="line.295"></a>
+<FONT color="green">296</FONT>         * dataset, or INFINITE_WINDOW (-1) if there is no limit.<a name="line.296"></a>
+<FONT color="green">297</FONT>         *<a name="line.297"></a>
+<FONT color="green">298</FONT>         * @return The current window size or -1 if its Infinite.<a name="line.298"></a>
+<FONT color="green">299</FONT>         */<a name="line.299"></a>
+<FONT color="green">300</FONT>        public int getWindowSize() {<a name="line.300"></a>
+<FONT color="green">301</FONT>            return windowSize;<a name="line.301"></a>
+<FONT color="green">302</FONT>        }<a name="line.302"></a>
+<FONT color="green">303</FONT>    <a name="line.303"></a>
+<FONT color="green">304</FONT>        /**<a name="line.304"></a>
+<FONT color="green">305</FONT>         * WindowSize controls the number of values which contribute<a name="line.305"></a>
+<FONT color="green">306</FONT>         * to the reported statistics.  For example, if<a name="line.306"></a>
+<FONT color="green">307</FONT>         * windowSize is set to 3 and the values {1,2,3,4,5}<a name="line.307"></a>
+<FONT color="green">308</FONT>         * have been added &lt;strong&gt; in that order&lt;/strong&gt;<a name="line.308"></a>
+<FONT color="green">309</FONT>         * then the &lt;i&gt;available values&lt;/i&gt; are {3,4,5} and all<a name="line.309"></a>
+<FONT color="green">310</FONT>         * reported statistics will be based on these values<a name="line.310"></a>
+<FONT color="green">311</FONT>         * @param windowSize sets the size of the window.<a name="line.311"></a>
+<FONT color="green">312</FONT>         */<a name="line.312"></a>
+<FONT color="green">313</FONT>        public void setWindowSize(int windowSize) {<a name="line.313"></a>
+<FONT color="green">314</FONT>            if (windowSize &lt; 1) {<a name="line.314"></a>
+<FONT color="green">315</FONT>                if (windowSize != INFINITE_WINDOW) {<a name="line.315"></a>
+<FONT color="green">316</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.316"></a>
+<FONT color="green">317</FONT>                          "window size must be positive ({0})", windowSize);<a name="line.317"></a>
+<FONT color="green">318</FONT>                }<a name="line.318"></a>
+<FONT color="green">319</FONT>            }<a name="line.319"></a>
+<FONT color="green">320</FONT>    <a name="line.320"></a>
+<FONT color="green">321</FONT>            this.windowSize = windowSize;<a name="line.321"></a>
+<FONT color="green">322</FONT>    <a name="line.322"></a>
+<FONT color="green">323</FONT>            // We need to check to see if we need to discard elements<a name="line.323"></a>
+<FONT color="green">324</FONT>            // from the front of the array.  If the windowSize is less than<a name="line.324"></a>
+<FONT color="green">325</FONT>            // the current number of elements.<a name="line.325"></a>
+<FONT color="green">326</FONT>            if (windowSize != INFINITE_WINDOW &amp;&amp; windowSize &lt; eDA.getNumElements()) {<a name="line.326"></a>
+<FONT color="green">327</FONT>                eDA.discardFrontElements(eDA.getNumElements() - windowSize);<a name="line.327"></a>
+<FONT color="green">328</FONT>            }<a name="line.328"></a>
+<FONT color="green">329</FONT>        }<a name="line.329"></a>
+<FONT color="green">330</FONT>    <a name="line.330"></a>
+<FONT color="green">331</FONT>        /**<a name="line.331"></a>
+<FONT color="green">332</FONT>         * Returns the current set of values in an array of double primitives.<a name="line.332"></a>
+<FONT color="green">333</FONT>         * The order of addition is preserved.  The returned array is a fresh<a name="line.333"></a>
+<FONT color="green">334</FONT>         * copy of the underlying data -- i.e., it is not a reference to the<a name="line.334"></a>
+<FONT color="green">335</FONT>         * stored data.<a name="line.335"></a>
+<FONT color="green">336</FONT>         *<a name="line.336"></a>
+<FONT color="green">337</FONT>         * @return returns the current set of numbers in the order in which they<a name="line.337"></a>
+<FONT color="green">338</FONT>         *         were added to this set<a name="line.338"></a>
+<FONT color="green">339</FONT>         */<a name="line.339"></a>
+<FONT color="green">340</FONT>        public double[] getValues() {<a name="line.340"></a>
+<FONT color="green">341</FONT>            return eDA.getElements();<a name="line.341"></a>
+<FONT color="green">342</FONT>        }<a name="line.342"></a>
+<FONT color="green">343</FONT>    <a name="line.343"></a>
+<FONT color="green">344</FONT>        /**<a name="line.344"></a>
+<FONT color="green">345</FONT>         * Returns the current set of values in an array of double primitives,<a name="line.345"></a>
+<FONT color="green">346</FONT>         * sorted in ascending order.  The returned array is a fresh<a name="line.346"></a>
+<FONT color="green">347</FONT>         * copy of the underlying data -- i.e., it is not a reference to the<a name="line.347"></a>
+<FONT color="green">348</FONT>         * stored data.<a name="line.348"></a>
+<FONT color="green">349</FONT>         * @return returns the current set of<a name="line.349"></a>
+<FONT color="green">350</FONT>         * numbers sorted in ascending order<a name="line.350"></a>
+<FONT color="green">351</FONT>         */<a name="line.351"></a>
+<FONT color="green">352</FONT>        public double[] getSortedValues() {<a name="line.352"></a>
+<FONT color="green">353</FONT>            double[] sort = getValues();<a name="line.353"></a>
+<FONT color="green">354</FONT>            Arrays.sort(sort);<a name="line.354"></a>
+<FONT color="green">355</FONT>            return sort;<a name="line.355"></a>
+<FONT color="green">356</FONT>        }<a name="line.356"></a>
+<FONT color="green">357</FONT>    <a name="line.357"></a>
+<FONT color="green">358</FONT>        /**<a name="line.358"></a>
+<FONT color="green">359</FONT>         * Returns the element at the specified index<a name="line.359"></a>
+<FONT color="green">360</FONT>         * @param index The Index of the element<a name="line.360"></a>
+<FONT color="green">361</FONT>         * @return return the element at the specified index<a name="line.361"></a>
+<FONT color="green">362</FONT>         */<a name="line.362"></a>
+<FONT color="green">363</FONT>        public double getElement(int index) {<a name="line.363"></a>
+<FONT color="green">364</FONT>            return eDA.getElement(index);<a name="line.364"></a>
+<FONT color="green">365</FONT>        }<a name="line.365"></a>
+<FONT color="green">366</FONT>    <a name="line.366"></a>
+<FONT color="green">367</FONT>        /**<a name="line.367"></a>
+<FONT color="green">368</FONT>         * Returns an estimate for the pth percentile of the stored values.<a name="line.368"></a>
+<FONT color="green">369</FONT>         * &lt;p&gt;<a name="line.369"></a>
+<FONT color="green">370</FONT>         * The implementation provided here follows the first estimation procedure presented<a name="line.370"></a>
+<FONT color="green">371</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/prc/section2/prc252.htm"&gt;here.&lt;/a&gt;<a name="line.371"></a>
+<FONT color="green">372</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.372"></a>
+<FONT color="green">373</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;:&lt;ul&gt;<a name="line.373"></a>
+<FONT color="green">374</FONT>         * &lt;li&gt;&lt;code&gt;0 &amp;lt; p &amp;le; 100&lt;/code&gt; (otherwise an<a name="line.374"></a>
+<FONT color="green">375</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown)&lt;/li&gt;<a name="line.375"></a>
+<FONT color="green">376</FONT>         * &lt;li&gt;at least one value must be stored (returns &lt;code&gt;Double.NaN<a name="line.376"></a>
+<FONT color="green">377</FONT>         *     &lt;/code&gt; otherwise)&lt;/li&gt;<a name="line.377"></a>
+<FONT color="green">378</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.378"></a>
+<FONT color="green">379</FONT>         *<a name="line.379"></a>
+<FONT color="green">380</FONT>         * @param p the requested percentile (scaled from 0 - 100)<a name="line.380"></a>
+<FONT color="green">381</FONT>         * @return An estimate for the pth percentile of the stored data<a name="line.381"></a>
+<FONT color="green">382</FONT>         * @throws IllegalStateException if percentile implementation has been<a name="line.382"></a>
+<FONT color="green">383</FONT>         *  overridden and the supplied implementation does not support setQuantile<a name="line.383"></a>
+<FONT color="green">384</FONT>         * values<a name="line.384"></a>
+<FONT color="green">385</FONT>         */<a name="line.385"></a>
+<FONT color="green">386</FONT>        public double getPercentile(double p) {<a name="line.386"></a>
+<FONT color="green">387</FONT>            if (percentileImpl instanceof Percentile) {<a name="line.387"></a>
+<FONT color="green">388</FONT>                ((Percentile) percentileImpl).setQuantile(p);<a name="line.388"></a>
+<FONT color="green">389</FONT>            } else {<a name="line.389"></a>
+<FONT color="green">390</FONT>                try {<a name="line.390"></a>
+<FONT color="green">391</FONT>                    percentileImpl.getClass().getMethod(SET_QUANTILE_METHOD_NAME,<a name="line.391"></a>
+<FONT color="green">392</FONT>                            new Class[] {Double.TYPE}).invoke(percentileImpl,<a name="line.392"></a>
+<FONT color="green">393</FONT>                                    new Object[] {Double.valueOf(p)});<a name="line.393"></a>
+<FONT color="green">394</FONT>                } catch (NoSuchMethodException e1) { // Setter guard should prevent<a name="line.394"></a>
+<FONT color="green">395</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.395"></a>
+<FONT color="green">396</FONT>                          UNSUPPORTED_METHOD_MESSAGE,<a name="line.396"></a>
+<FONT color="green">397</FONT>                          percentileImpl.getClass().getName(), SET_QUANTILE_METHOD_NAME);<a name="line.397"></a>
+<FONT color="green">398</FONT>                } catch (IllegalAccessException e2) {<a name="line.398"></a>
+<FONT color="green">399</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.399"></a>
+<FONT color="green">400</FONT>                          ILLEGAL_ACCESS_MESSAGE,<a name="line.400"></a>
+<FONT color="green">401</FONT>                          SET_QUANTILE_METHOD_NAME, percentileImpl.getClass().getName());<a name="line.401"></a>
+<FONT color="green">402</FONT>                } catch (InvocationTargetException e3) {<a name="line.402"></a>
+<FONT color="green">403</FONT>                    throw MathRuntimeException.createIllegalArgumentException(e3.getCause());<a name="line.403"></a>
+<FONT color="green">404</FONT>                }<a name="line.404"></a>
+<FONT color="green">405</FONT>            }<a name="line.405"></a>
+<FONT color="green">406</FONT>            return apply(percentileImpl);<a name="line.406"></a>
+<FONT color="green">407</FONT>        }<a name="line.407"></a>
+<FONT color="green">408</FONT>    <a name="line.408"></a>
+<FONT color="green">409</FONT>        /**<a name="line.409"></a>
+<FONT color="green">410</FONT>         * Generates a text report displaying univariate statistics from values<a name="line.410"></a>
+<FONT color="green">411</FONT>         * that have been added.  Each statistic is displayed on a separate<a name="line.411"></a>
+<FONT color="green">412</FONT>         * line.<a name="line.412"></a>
+<FONT color="green">413</FONT>         *<a name="line.413"></a>
+<FONT color="green">414</FONT>         * @return String with line feeds displaying statistics<a name="line.414"></a>
+<FONT color="green">415</FONT>         */<a name="line.415"></a>
+<FONT color="green">416</FONT>        @Override<a name="line.416"></a>
+<FONT color="green">417</FONT>        public String toString() {<a name="line.417"></a>
+<FONT color="green">418</FONT>            StringBuffer outBuffer = new StringBuffer();<a name="line.418"></a>
+<FONT color="green">419</FONT>            String endl = "\n";<a name="line.419"></a>
+<FONT color="green">420</FONT>            outBuffer.append("DescriptiveStatistics:").append(endl);<a name="line.420"></a>
+<FONT color="green">421</FONT>            outBuffer.append("n: ").append(getN()).append(endl);<a name="line.421"></a>
+<FONT color="green">422</FONT>            outBuffer.append("min: ").append(getMin()).append(endl);<a name="line.422"></a>
+<FONT color="green">423</FONT>            outBuffer.append("max: ").append(getMax()).append(endl);<a name="line.423"></a>
+<FONT color="green">424</FONT>            outBuffer.append("mean: ").append(getMean()).append(endl);<a name="line.424"></a>
+<FONT color="green">425</FONT>            outBuffer.append("std dev: ").append(getStandardDeviation())<a name="line.425"></a>
+<FONT color="green">426</FONT>                .append(endl);<a name="line.426"></a>
+<FONT color="green">427</FONT>            outBuffer.append("median: ").append(getPercentile(50)).append(endl);<a name="line.427"></a>
+<FONT color="green">428</FONT>            outBuffer.append("skewness: ").append(getSkewness()).append(endl);<a name="line.428"></a>
+<FONT color="green">429</FONT>            outBuffer.append("kurtosis: ").append(getKurtosis()).append(endl);<a name="line.429"></a>
+<FONT color="green">430</FONT>            return outBuffer.toString();<a name="line.430"></a>
+<FONT color="green">431</FONT>        }<a name="line.431"></a>
+<FONT color="green">432</FONT>    <a name="line.432"></a>
+<FONT color="green">433</FONT>        /**<a name="line.433"></a>
+<FONT color="green">434</FONT>         * Apply the given statistic to the data associated with this set of statistics.<a name="line.434"></a>
+<FONT color="green">435</FONT>         * @param stat the statistic to apply<a name="line.435"></a>
+<FONT color="green">436</FONT>         * @return the computed value of the statistic.<a name="line.436"></a>
+<FONT color="green">437</FONT>         */<a name="line.437"></a>
+<FONT color="green">438</FONT>        public double apply(UnivariateStatistic stat) {<a name="line.438"></a>
+<FONT color="green">439</FONT>            return stat.evaluate(eDA.getInternalValues(), eDA.start(), eDA.getNumElements());<a name="line.439"></a>
+<FONT color="green">440</FONT>        }<a name="line.440"></a>
+<FONT color="green">441</FONT>    <a name="line.441"></a>
+<FONT color="green">442</FONT>        // Implementation getters and setter<a name="line.442"></a>
+<FONT color="green">443</FONT>    <a name="line.443"></a>
+<FONT color="green">444</FONT>        /**<a name="line.444"></a>
+<FONT color="green">445</FONT>         * Returns the currently configured mean implementation.<a name="line.445"></a>
+<FONT color="green">446</FONT>         *<a name="line.446"></a>
+<FONT color="green">447</FONT>         * @return the UnivariateStatistic implementing the mean<a name="line.447"></a>
+<FONT color="green">448</FONT>         * @since 1.2<a name="line.448"></a>
+<FONT color="green">449</FONT>         */<a name="line.449"></a>
+<FONT color="green">450</FONT>        public synchronized UnivariateStatistic getMeanImpl() {<a name="line.450"></a>
+<FONT color="green">451</FONT>            return meanImpl;<a name="line.451"></a>
+<FONT color="green">452</FONT>        }<a name="line.452"></a>
+<FONT color="green">453</FONT>    <a name="line.453"></a>
+<FONT color="green">454</FONT>        /**<a name="line.454"></a>
+<FONT color="green">455</FONT>         * &lt;p&gt;Sets the implementation for the mean.&lt;/p&gt;<a name="line.455"></a>
+<FONT color="green">456</FONT>         *<a name="line.456"></a>
+<FONT color="green">457</FONT>         * @param meanImpl the UnivariateStatistic instance to use<a name="line.457"></a>
+<FONT color="green">458</FONT>         * for computing the mean<a name="line.458"></a>
+<FONT color="green">459</FONT>         * @since 1.2<a name="line.459"></a>
+<FONT color="green">460</FONT>         */<a name="line.460"></a>
+<FONT color="green">461</FONT>        public synchronized void setMeanImpl(UnivariateStatistic meanImpl) {<a name="line.461"></a>
+<FONT color="green">462</FONT>            this.meanImpl = meanImpl;<a name="line.462"></a>
+<FONT color="green">463</FONT>        }<a name="line.463"></a>
+<FONT color="green">464</FONT>    <a name="line.464"></a>
+<FONT color="green">465</FONT>        /**<a name="line.465"></a>
+<FONT color="green">466</FONT>         * Returns the currently configured geometric mean implementation.<a name="line.466"></a>
+<FONT color="green">467</FONT>         *<a name="line.467"></a>
+<FONT color="green">468</FONT>         * @return the UnivariateStatistic implementing the geometric mean<a name="line.468"></a>
+<FONT color="green">469</FONT>         * @since 1.2<a name="line.469"></a>
+<FONT color="green">470</FONT>         */<a name="line.470"></a>
+<FONT color="green">471</FONT>        public synchronized UnivariateStatistic getGeometricMeanImpl() {<a name="line.471"></a>
+<FONT color="green">472</FONT>            return geometricMeanImpl;<a name="line.472"></a>
+<FONT color="green">473</FONT>        }<a name="line.473"></a>
+<FONT color="green">474</FONT>    <a name="line.474"></a>
+<FONT color="green">475</FONT>        /**<a name="line.475"></a>
+<FONT color="green">476</FONT>         * &lt;p&gt;Sets the implementation for the gemoetric mean.&lt;/p&gt;<a name="line.476"></a>
+<FONT color="green">477</FONT>         *<a name="line.477"></a>
+<FONT color="green">478</FONT>         * @param geometricMeanImpl the UnivariateStatistic instance to use<a name="line.478"></a>
+<FONT color="green">479</FONT>         * for computing the geometric mean<a name="line.479"></a>
+<FONT color="green">480</FONT>         * @since 1.2<a name="line.480"></a>
+<FONT color="green">481</FONT>         */<a name="line.481"></a>
+<FONT color="green">482</FONT>        public synchronized void setGeometricMeanImpl(<a name="line.482"></a>
+<FONT color="green">483</FONT>                UnivariateStatistic geometricMeanImpl) {<a name="line.483"></a>
+<FONT color="green">484</FONT>            this.geometricMeanImpl = geometricMeanImpl;<a name="line.484"></a>
+<FONT color="green">485</FONT>        }<a name="line.485"></a>
+<FONT color="green">486</FONT>    <a name="line.486"></a>
+<FONT color="green">487</FONT>        /**<a name="line.487"></a>
+<FONT color="green">488</FONT>         * Returns the currently configured kurtosis implementation.<a name="line.488"></a>
+<FONT color="green">489</FONT>         *<a name="line.489"></a>
+<FONT color="green">490</FONT>         * @return the UnivariateStatistic implementing the kurtosis<a name="line.490"></a>
+<FONT color="green">491</FONT>         * @since 1.2<a name="line.491"></a>
+<FONT color="green">492</FONT>         */<a name="line.492"></a>
+<FONT color="green">493</FONT>        public synchronized UnivariateStatistic getKurtosisImpl() {<a name="line.493"></a>
+<FONT color="green">494</FONT>            return kurtosisImpl;<a name="line.494"></a>
+<FONT color="green">495</FONT>        }<a name="line.495"></a>
+<FONT color="green">496</FONT>    <a name="line.496"></a>
+<FONT color="green">497</FONT>        /**<a name="line.497"></a>
+<FONT color="green">498</FONT>         * &lt;p&gt;Sets the implementation for the kurtosis.&lt;/p&gt;<a name="line.498"></a>
+<FONT color="green">499</FONT>         *<a name="line.499"></a>
+<FONT color="green">500</FONT>         * @param kurtosisImpl the UnivariateStatistic instance to use<a name="line.500"></a>
+<FONT color="green">501</FONT>         * for computing the kurtosis<a name="line.501"></a>
+<FONT color="green">502</FONT>         * @since 1.2<a name="line.502"></a>
+<FONT color="green">503</FONT>         */<a name="line.503"></a>
+<FONT color="green">504</FONT>        public synchronized void setKurtosisImpl(UnivariateStatistic kurtosisImpl) {<a name="line.504"></a>
+<FONT color="green">505</FONT>            this.kurtosisImpl = kurtosisImpl;<a name="line.505"></a>
+<FONT color="green">506</FONT>        }<a name="line.506"></a>
+<FONT color="green">507</FONT>    <a name="line.507"></a>
+<FONT color="green">508</FONT>        /**<a name="line.508"></a>
+<FONT color="green">509</FONT>         * Returns the currently configured maximum implementation.<a name="line.509"></a>
+<FONT color="green">510</FONT>         *<a name="line.510"></a>
+<FONT color="green">511</FONT>         * @return the UnivariateStatistic implementing the maximum<a name="line.511"></a>
+<FONT color="green">512</FONT>         * @since 1.2<a name="line.512"></a>
+<FONT color="green">513</FONT>         */<a name="line.513"></a>
+<FONT color="green">514</FONT>        public synchronized UnivariateStatistic getMaxImpl() {<a name="line.514"></a>
+<FONT color="green">515</FONT>            return maxImpl;<a name="line.515"></a>
+<FONT color="green">516</FONT>        }<a name="line.516"></a>
+<FONT color="green">517</FONT>    <a name="line.517"></a>
+<FONT color="green">518</FONT>        /**<a name="line.518"></a>
+<FONT color="green">519</FONT>         * &lt;p&gt;Sets the implementation for the maximum.&lt;/p&gt;<a name="line.519"></a>
+<FONT color="green">520</FONT>         *<a name="line.520"></a>
+<FONT color="green">521</FONT>         * @param maxImpl the UnivariateStatistic instance to use<a name="line.521"></a>
+<FONT color="green">522</FONT>         * for computing the maximum<a name="line.522"></a>
+<FONT color="green">523</FONT>         * @since 1.2<a name="line.523"></a>
+<FONT color="green">524</FONT>         */<a name="line.524"></a>
+<FONT color="green">525</FONT>        public synchronized void setMaxImpl(UnivariateStatistic maxImpl) {<a name="line.525"></a>
+<FONT color="green">526</FONT>            this.maxImpl = maxImpl;<a name="line.526"></a>
+<FONT color="green">527</FONT>        }<a name="line.527"></a>
+<FONT color="green">528</FONT>    <a name="line.528"></a>
+<FONT color="green">529</FONT>        /**<a name="line.529"></a>
+<FONT color="green">530</FONT>         * Returns the currently configured minimum implementation.<a name="line.530"></a>
+<FONT color="green">531</FONT>         *<a name="line.531"></a>
+<FONT color="green">532</FONT>         * @return the UnivariateStatistic implementing the minimum<a name="line.532"></a>
+<FONT color="green">533</FONT>         * @since 1.2<a name="line.533"></a>
+<FONT color="green">534</FONT>         */<a name="line.534"></a>
+<FONT color="green">535</FONT>        public synchronized UnivariateStatistic getMinImpl() {<a name="line.535"></a>
+<FONT color="green">536</FONT>            return minImpl;<a name="line.536"></a>
+<FONT color="green">537</FONT>        }<a name="line.537"></a>
+<FONT color="green">538</FONT>    <a name="line.538"></a>
+<FONT color="green">539</FONT>        /**<a name="line.539"></a>
+<FONT color="green">540</FONT>         * &lt;p&gt;Sets the implementation for the minimum.&lt;/p&gt;<a name="line.540"></a>
+<FONT color="green">541</FONT>         *<a name="line.541"></a>
+<FONT color="green">542</FONT>         * @param minImpl the UnivariateStatistic instance to use<a name="line.542"></a>
+<FONT color="green">543</FONT>         * for computing the minimum<a name="line.543"></a>
+<FONT color="green">544</FONT>         * @since 1.2<a name="line.544"></a>
+<FONT color="green">545</FONT>         */<a name="line.545"></a>
+<FONT color="green">546</FONT>        public synchronized void setMinImpl(UnivariateStatistic minImpl) {<a name="line.546"></a>
+<FONT color="green">547</FONT>            this.minImpl = minImpl;<a name="line.547"></a>
+<FONT color="green">548</FONT>        }<a name="line.548"></a>
+<FONT color="green">549</FONT>    <a name="line.549"></a>
+<FONT color="green">550</FONT>        /**<a name="line.550"></a>
+<FONT color="green">551</FONT>         * Returns the currently configured percentile implementation.<a name="line.551"></a>
+<FONT color="green">552</FONT>         *<a name="line.552"></a>
+<FONT color="green">553</FONT>         * @return the UnivariateStatistic implementing the percentile<a name="line.553"></a>
+<FONT color="green">554</FONT>         * @since 1.2<a name="line.554"></a>
+<FONT color="green">555</FONT>         */<a name="line.555"></a>
+<FONT color="green">556</FONT>        public synchronized UnivariateStatistic getPercentileImpl() {<a name="line.556"></a>
+<FONT color="green">557</FONT>            return percentileImpl;<a name="line.557"></a>
+<FONT color="green">558</FONT>        }<a name="line.558"></a>
+<FONT color="green">559</FONT>    <a name="line.559"></a>
+<FONT color="green">560</FONT>        /**<a name="line.560"></a>
+<FONT color="green">561</FONT>         * Sets the implementation to be used by {@link #getPercentile(double)}.<a name="line.561"></a>
+<FONT color="green">562</FONT>         * The supplied &lt;code&gt;UnivariateStatistic&lt;/code&gt; must provide a<a name="line.562"></a>
+<FONT color="green">563</FONT>         * &lt;code&gt;setQuantile(double)&lt;/code&gt; method; otherwise<a name="line.563"></a>
+<FONT color="green">564</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown.<a name="line.564"></a>
+<FONT color="green">565</FONT>         *<a name="line.565"></a>
+<FONT color="green">566</FONT>         * @param percentileImpl the percentileImpl to set<a name="line.566"></a>
+<FONT color="green">567</FONT>         * @throws IllegalArgumentException if the supplied implementation does not<a name="line.567"></a>
+<FONT color="green">568</FONT>         *  provide a &lt;code&gt;setQuantile&lt;/code&gt; method<a name="line.568"></a>
+<FONT color="green">569</FONT>         * @since 1.2<a name="line.569"></a>
+<FONT color="green">570</FONT>         */<a name="line.570"></a>
+<FONT color="green">571</FONT>        public synchronized void setPercentileImpl(<a name="line.571"></a>
+<FONT color="green">572</FONT>                UnivariateStatistic percentileImpl) {<a name="line.572"></a>
+<FONT color="green">573</FONT>            try {<a name="line.573"></a>
+<FONT color="green">574</FONT>                percentileImpl.getClass().getMethod(SET_QUANTILE_METHOD_NAME,<a name="line.574"></a>
+<FONT color="green">575</FONT>                        new Class[] {Double.TYPE}).invoke(percentileImpl,<a name="line.575"></a>
+<FONT color="green">576</FONT>                                new Object[] {Double.valueOf(50.0d)});<a name="line.576"></a>
+<FONT color="green">577</FONT>            } catch (NoSuchMethodException e1) {<a name="line.577"></a>
+<FONT color="green">578</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.578"></a>
+<FONT color="green">579</FONT>                      "percentile implementation {0} does not support setQuantile",<a name="line.579"></a>
+<FONT color="green">580</FONT>                      percentileImpl.getClass().getName());<a name="line.580"></a>
+<FONT color="green">581</FONT>            } catch (IllegalAccessException e2) {<a name="line.581"></a>
+<FONT color="green">582</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.582"></a>
+<FONT color="green">583</FONT>                      ILLEGAL_ACCESS_MESSAGE,<a name="line.583"></a>
+<FONT color="green">584</FONT>                      SET_QUANTILE_METHOD_NAME, percentileImpl.getClass().getName());<a name="line.584"></a>
+<FONT color="green">585</FONT>            } catch (InvocationTargetException e3) {<a name="line.585"></a>
+<FONT color="green">586</FONT>                throw MathRuntimeException.createIllegalArgumentException(e3.getCause());<a name="line.586"></a>
+<FONT color="green">587</FONT>            }<a name="line.587"></a>
+<FONT color="green">588</FONT>            this.percentileImpl = percentileImpl;<a name="line.588"></a>
+<FONT color="green">589</FONT>        }<a name="line.589"></a>
+<FONT color="green">590</FONT>    <a name="line.590"></a>
+<FONT color="green">591</FONT>        /**<a name="line.591"></a>
+<FONT color="green">592</FONT>         * Returns the currently configured skewness implementation.<a name="line.592"></a>
+<FONT color="green">593</FONT>         *<a name="line.593"></a>
+<FONT color="green">594</FONT>         * @return the UnivariateStatistic implementing the skewness<a name="line.594"></a>
+<FONT color="green">595</FONT>         * @since 1.2<a name="line.595"></a>
+<FONT color="green">596</FONT>         */<a name="line.596"></a>
+<FONT color="green">597</FONT>        public synchronized UnivariateStatistic getSkewnessImpl() {<a name="line.597"></a>
+<FONT color="green">598</FONT>            return skewnessImpl;<a name="line.598"></a>
+<FONT color="green">599</FONT>        }<a name="line.599"></a>
+<FONT color="green">600</FONT>    <a name="line.600"></a>
+<FONT color="green">601</FONT>        /**<a name="line.601"></a>
+<FONT color="green">602</FONT>         * &lt;p&gt;Sets the implementation for the skewness.&lt;/p&gt;<a name="line.602"></a>
+<FONT color="green">603</FONT>         *<a name="line.603"></a>
+<FONT color="green">604</FONT>         * @param skewnessImpl the UnivariateStatistic instance to use<a name="line.604"></a>
+<FONT color="green">605</FONT>         * for computing the skewness<a name="line.605"></a>
+<FONT color="green">606</FONT>         * @since 1.2<a name="line.606"></a>
+<FONT color="green">607</FONT>         */<a name="line.607"></a>
+<FONT color="green">608</FONT>        public synchronized void setSkewnessImpl(<a name="line.608"></a>
+<FONT color="green">609</FONT>                UnivariateStatistic skewnessImpl) {<a name="line.609"></a>
+<FONT color="green">610</FONT>            this.skewnessImpl = skewnessImpl;<a name="line.610"></a>
+<FONT color="green">611</FONT>        }<a name="line.611"></a>
+<FONT color="green">612</FONT>    <a name="line.612"></a>
+<FONT color="green">613</FONT>        /**<a name="line.613"></a>
+<FONT color="green">614</FONT>         * Returns the currently configured variance implementation.<a name="line.614"></a>
+<FONT color="green">615</FONT>         *<a name="line.615"></a>
+<FONT color="green">616</FONT>         * @return the UnivariateStatistic implementing the variance<a name="line.616"></a>
+<FONT color="green">617</FONT>         * @since 1.2<a name="line.617"></a>
+<FONT color="green">618</FONT>         */<a name="line.618"></a>
+<FONT color="green">619</FONT>        public synchronized UnivariateStatistic getVarianceImpl() {<a name="line.619"></a>
+<FONT color="green">620</FONT>            return varianceImpl;<a name="line.620"></a>
+<FONT color="green">621</FONT>        }<a name="line.621"></a>
+<FONT color="green">622</FONT>    <a name="line.622"></a>
+<FONT color="green">623</FONT>        /**<a name="line.623"></a>
+<FONT color="green">624</FONT>         * &lt;p&gt;Sets the implementation for the variance.&lt;/p&gt;<a name="line.624"></a>
+<FONT color="green">625</FONT>         *<a name="line.625"></a>
+<FONT color="green">626</FONT>         * @param varianceImpl the UnivariateStatistic instance to use<a name="line.626"></a>
+<FONT color="green">627</FONT>         * for computing the variance<a name="line.627"></a>
+<FONT color="green">628</FONT>         * @since 1.2<a name="line.628"></a>
+<FONT color="green">629</FONT>         */<a name="line.629"></a>
+<FONT color="green">630</FONT>        public synchronized void setVarianceImpl(<a name="line.630"></a>
+<FONT color="green">631</FONT>                UnivariateStatistic varianceImpl) {<a name="line.631"></a>
+<FONT color="green">632</FONT>            this.varianceImpl = varianceImpl;<a name="line.632"></a>
+<FONT color="green">633</FONT>        }<a name="line.633"></a>
+<FONT color="green">634</FONT>    <a name="line.634"></a>
+<FONT color="green">635</FONT>        /**<a name="line.635"></a>
+<FONT color="green">636</FONT>         * Returns the currently configured sum of squares implementation.<a name="line.636"></a>
+<FONT color="green">637</FONT>         *<a name="line.637"></a>
+<FONT color="green">638</FONT>         * @return the UnivariateStatistic implementing the sum of squares<a name="line.638"></a>
+<FONT color="green">639</FONT>         * @since 1.2<a name="line.639"></a>
+<FONT color="green">640</FONT>         */<a name="line.640"></a>
+<FONT color="green">641</FONT>        public synchronized UnivariateStatistic getSumsqImpl() {<a name="line.641"></a>
+<FONT color="green">642</FONT>            return sumsqImpl;<a name="line.642"></a>
+<FONT color="green">643</FONT>        }<a name="line.643"></a>
+<FONT color="green">644</FONT>    <a name="line.644"></a>
+<FONT color="green">645</FONT>        /**<a name="line.645"></a>
+<FONT color="green">646</FONT>         * &lt;p&gt;Sets the implementation for the sum of squares.&lt;/p&gt;<a name="line.646"></a>
+<FONT color="green">647</FONT>         *<a name="line.647"></a>
+<FONT color="green">648</FONT>         * @param sumsqImpl the UnivariateStatistic instance to use<a name="line.648"></a>
+<FONT color="green">649</FONT>         * for computing the sum of squares<a name="line.649"></a>
+<FONT color="green">650</FONT>         * @since 1.2<a name="line.650"></a>
+<FONT color="green">651</FONT>         */<a name="line.651"></a>
+<FONT color="green">652</FONT>        public synchronized void setSumsqImpl(UnivariateStatistic sumsqImpl) {<a name="line.652"></a>
+<FONT color="green">653</FONT>            this.sumsqImpl = sumsqImpl;<a name="line.653"></a>
+<FONT color="green">654</FONT>        }<a name="line.654"></a>
+<FONT color="green">655</FONT>    <a name="line.655"></a>
+<FONT color="green">656</FONT>        /**<a name="line.656"></a>
+<FONT color="green">657</FONT>         * Returns the currently configured sum implementation.<a name="line.657"></a>
+<FONT color="green">658</FONT>         *<a name="line.658"></a>
+<FONT color="green">659</FONT>         * @return the UnivariateStatistic implementing the sum<a name="line.659"></a>
+<FONT color="green">660</FONT>         * @since 1.2<a name="line.660"></a>
+<FONT color="green">661</FONT>         */<a name="line.661"></a>
+<FONT color="green">662</FONT>        public synchronized UnivariateStatistic getSumImpl() {<a name="line.662"></a>
+<FONT color="green">663</FONT>            return sumImpl;<a name="line.663"></a>
+<FONT color="green">664</FONT>        }<a name="line.664"></a>
+<FONT color="green">665</FONT>    <a name="line.665"></a>
+<FONT color="green">666</FONT>        /**<a name="line.666"></a>
+<FONT color="green">667</FONT>         * &lt;p&gt;Sets the implementation for the sum.&lt;/p&gt;<a name="line.667"></a>
+<FONT color="green">668</FONT>         *<a name="line.668"></a>
+<FONT color="green">669</FONT>         * @param sumImpl the UnivariateStatistic instance to use<a name="line.669"></a>
+<FONT color="green">670</FONT>         * for computing the sum<a name="line.670"></a>
+<FONT color="green">671</FONT>         * @since 1.2<a name="line.671"></a>
+<FONT color="green">672</FONT>         */<a name="line.672"></a>
+<FONT color="green">673</FONT>        public synchronized void setSumImpl(UnivariateStatistic sumImpl) {<a name="line.673"></a>
+<FONT color="green">674</FONT>            this.sumImpl = sumImpl;<a name="line.674"></a>
+<FONT color="green">675</FONT>        }<a name="line.675"></a>
+<FONT color="green">676</FONT>    <a name="line.676"></a>
+<FONT color="green">677</FONT>        /**<a name="line.677"></a>
+<FONT color="green">678</FONT>         * Returns a copy of this DescriptiveStatistics instance with the same internal state.<a name="line.678"></a>
+<FONT color="green">679</FONT>         *<a name="line.679"></a>
+<FONT color="green">680</FONT>         * @return a copy of this<a name="line.680"></a>
+<FONT color="green">681</FONT>         */<a name="line.681"></a>
+<FONT color="green">682</FONT>        public DescriptiveStatistics copy() {<a name="line.682"></a>
+<FONT color="green">683</FONT>            DescriptiveStatistics result = new DescriptiveStatistics();<a name="line.683"></a>
+<FONT color="green">684</FONT>            copy(this, result);<a name="line.684"></a>
+<FONT color="green">685</FONT>            return result;<a name="line.685"></a>
+<FONT color="green">686</FONT>        }<a name="line.686"></a>
+<FONT color="green">687</FONT>    <a name="line.687"></a>
+<FONT color="green">688</FONT>        /**<a name="line.688"></a>
+<FONT color="green">689</FONT>         * Copies source to dest.<a name="line.689"></a>
+<FONT color="green">690</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.690"></a>
+<FONT color="green">691</FONT>         *<a name="line.691"></a>
+<FONT color="green">692</FONT>         * @param source DescriptiveStatistics to copy<a name="line.692"></a>
+<FONT color="green">693</FONT>         * @param dest DescriptiveStatistics to copy to<a name="line.693"></a>
+<FONT color="green">694</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.694"></a>
+<FONT color="green">695</FONT>         */<a name="line.695"></a>
+<FONT color="green">696</FONT>        public static void copy(DescriptiveStatistics source, DescriptiveStatistics dest) {<a name="line.696"></a>
+<FONT color="green">697</FONT>            // Copy data and window size<a name="line.697"></a>
+<FONT color="green">698</FONT>            dest.eDA = source.eDA.copy();<a name="line.698"></a>
+<FONT color="green">699</FONT>            dest.windowSize = source.windowSize;<a name="line.699"></a>
+<FONT color="green">700</FONT>    <a name="line.700"></a>
+<FONT color="green">701</FONT>            // Copy implementations<a name="line.701"></a>
+<FONT color="green">702</FONT>            dest.maxImpl = source.maxImpl.copy();<a name="line.702"></a>
+<FONT color="green">703</FONT>            dest.meanImpl = source.meanImpl.copy();<a name="line.703"></a>
+<FONT color="green">704</FONT>            dest.minImpl = source.minImpl.copy();<a name="line.704"></a>
+<FONT color="green">705</FONT>            dest.sumImpl = source.sumImpl.copy();<a name="line.705"></a>
+<FONT color="green">706</FONT>            dest.varianceImpl = source.varianceImpl.copy();<a name="line.706"></a>
+<FONT color="green">707</FONT>            dest.sumsqImpl = source.sumsqImpl.copy();<a name="line.707"></a>
+<FONT color="green">708</FONT>            dest.geometricMeanImpl = source.geometricMeanImpl.copy();<a name="line.708"></a>
+<FONT color="green">709</FONT>            dest.kurtosisImpl = source.kurtosisImpl;<a name="line.709"></a>
+<FONT color="green">710</FONT>            dest.skewnessImpl = source.skewnessImpl;<a name="line.710"></a>
+<FONT color="green">711</FONT>            dest.percentileImpl = source.percentileImpl;<a name="line.711"></a>
+<FONT color="green">712</FONT>        }<a name="line.712"></a>
+<FONT color="green">713</FONT>    }<a name="line.713"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,699 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.DimensionMismatchException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.linear.RealMatrix;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.stat.descriptive.moment.GeometricMean;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.stat.descriptive.moment.Mean;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.stat.descriptive.moment.VectorialCovariance;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.stat.descriptive.rank.Max;<a name="line.28"></a>
+<FONT color="green">029</FONT>    import org.apache.commons.math.stat.descriptive.rank.Min;<a name="line.29"></a>
+<FONT color="green">030</FONT>    import org.apache.commons.math.stat.descriptive.summary.Sum;<a name="line.30"></a>
+<FONT color="green">031</FONT>    import org.apache.commons.math.stat.descriptive.summary.SumOfLogs;<a name="line.31"></a>
+<FONT color="green">032</FONT>    import org.apache.commons.math.stat.descriptive.summary.SumOfSquares;<a name="line.32"></a>
+<FONT color="green">033</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>    /**<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;p&gt;Computes summary statistics for a stream of n-tuples added using the<a name="line.36"></a>
+<FONT color="green">037</FONT>     * {@link #addValue(double[]) addValue} method. The data values are not stored<a name="line.37"></a>
+<FONT color="green">038</FONT>     * in memory, so this class can be used to compute statistics for very large<a name="line.38"></a>
+<FONT color="green">039</FONT>     * n-tuple streams.&lt;/p&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     *<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;p&gt;The {@link StorelessUnivariateStatistic} instances used to maintain<a name="line.41"></a>
+<FONT color="green">042</FONT>     * summary state and compute statistics are configurable via setters.<a name="line.42"></a>
+<FONT color="green">043</FONT>     * For example, the default implementation for the mean can be overridden by<a name="line.43"></a>
+<FONT color="green">044</FONT>     * calling {@link #setMeanImpl(StorelessUnivariateStatistic[])}. Actual<a name="line.44"></a>
+<FONT color="green">045</FONT>     * parameters to these methods must implement the<a name="line.45"></a>
+<FONT color="green">046</FONT>     * {@link StorelessUnivariateStatistic} interface and configuration must be<a name="line.46"></a>
+<FONT color="green">047</FONT>     * completed before &lt;code&gt;addValue&lt;/code&gt; is called. No configuration is<a name="line.47"></a>
+<FONT color="green">048</FONT>     * necessary to use the default, commons-math provided implementations.&lt;/p&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>     *<a name="line.49"></a>
+<FONT color="green">050</FONT>     * &lt;p&gt;To compute statistics for a stream of n-tuples, construct a<a name="line.50"></a>
+<FONT color="green">051</FONT>     * MultivariateStatistics instance with dimension n and then use<a name="line.51"></a>
+<FONT color="green">052</FONT>     * {@link #addValue(double[])} to add n-tuples. The &lt;code&gt;getXxx&lt;/code&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>     * methods where Xxx is a statistic return an array of &lt;code&gt;double&lt;/code&gt;<a name="line.53"></a>
+<FONT color="green">054</FONT>     * values, where for &lt;code&gt;i = 0,...,n-1&lt;/code&gt; the i&lt;sup&gt;th&lt;/sup&gt; array element is the<a name="line.54"></a>
+<FONT color="green">055</FONT>     * value of the given statistic for data range consisting of the i&lt;sup&gt;th&lt;/sup&gt; element of<a name="line.55"></a>
+<FONT color="green">056</FONT>     * each of the input n-tuples.  For example, if &lt;code&gt;addValue&lt;/code&gt; is called<a name="line.56"></a>
+<FONT color="green">057</FONT>     * with actual parameters {0, 1, 2}, then {3, 4, 5} and finally {6, 7, 8},<a name="line.57"></a>
+<FONT color="green">058</FONT>     * &lt;code&gt;getSum&lt;/code&gt; will return a three-element array with values<a name="line.58"></a>
+<FONT color="green">059</FONT>     * {0+3+6, 1+4+7, 2+5+8}&lt;/p&gt;<a name="line.59"></a>
+<FONT color="green">060</FONT>     *<a name="line.60"></a>
+<FONT color="green">061</FONT>     * &lt;p&gt;Note: This class is not thread-safe. Use<a name="line.61"></a>
+<FONT color="green">062</FONT>     * {@link SynchronizedMultivariateSummaryStatistics} if concurrent access from multiple<a name="line.62"></a>
+<FONT color="green">063</FONT>     * threads is required.&lt;/p&gt;<a name="line.63"></a>
+<FONT color="green">064</FONT>     *<a name="line.64"></a>
+<FONT color="green">065</FONT>     * @since 1.2<a name="line.65"></a>
+<FONT color="green">066</FONT>     * @version $Revision: 811833 $ $Date: 2009-09-06 12:27:50 -0400 (Sun, 06 Sep 2009) $<a name="line.66"></a>
+<FONT color="green">067</FONT>     */<a name="line.67"></a>
+<FONT color="green">068</FONT>    public class MultivariateSummaryStatistics<a name="line.68"></a>
+<FONT color="green">069</FONT>      implements StatisticalMultivariateSummary, Serializable {<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** Serialization UID */<a name="line.71"></a>
+<FONT color="green">072</FONT>        private static final long serialVersionUID = 2271900808994826718L;<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /** Dimension of the data. */<a name="line.74"></a>
+<FONT color="green">075</FONT>        private int k;<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** Count of values that have been added */<a name="line.77"></a>
+<FONT color="green">078</FONT>        private long n = 0;<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /** Sum statistic implementation - can be reset by setter. */<a name="line.80"></a>
+<FONT color="green">081</FONT>        private StorelessUnivariateStatistic[] sumImpl;<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /** Sum of squares statistic implementation - can be reset by setter. */<a name="line.83"></a>
+<FONT color="green">084</FONT>        private StorelessUnivariateStatistic[] sumSqImpl;<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /** Minimum statistic implementation - can be reset by setter. */<a name="line.86"></a>
+<FONT color="green">087</FONT>        private StorelessUnivariateStatistic[] minImpl;<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /** Maximum statistic implementation - can be reset by setter. */<a name="line.89"></a>
+<FONT color="green">090</FONT>        private StorelessUnivariateStatistic[] maxImpl;<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /** Sum of log statistic implementation - can be reset by setter. */<a name="line.92"></a>
+<FONT color="green">093</FONT>        private StorelessUnivariateStatistic[] sumLogImpl;<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /** Geometric mean statistic implementation - can be reset by setter. */<a name="line.95"></a>
+<FONT color="green">096</FONT>        private StorelessUnivariateStatistic[] geoMeanImpl;<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /** Mean statistic implementation - can be reset by setter. */<a name="line.98"></a>
+<FONT color="green">099</FONT>        private StorelessUnivariateStatistic[] meanImpl;<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /** Covariance statistic implementation - cannot be reset. */<a name="line.101"></a>
+<FONT color="green">102</FONT>        private VectorialCovariance covarianceImpl;<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /**<a name="line.104"></a>
+<FONT color="green">105</FONT>         * Construct a MultivariateSummaryStatistics instance<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @param k dimension of the data<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @param isCovarianceBiasCorrected if true, the unbiased sample<a name="line.107"></a>
+<FONT color="green">108</FONT>         * covariance is computed, otherwise the biased population covariance<a name="line.108"></a>
+<FONT color="green">109</FONT>         * is computed<a name="line.109"></a>
+<FONT color="green">110</FONT>         */<a name="line.110"></a>
+<FONT color="green">111</FONT>        public MultivariateSummaryStatistics(int k, boolean isCovarianceBiasCorrected) {<a name="line.111"></a>
+<FONT color="green">112</FONT>            this.k = k;<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>            sumImpl     = new StorelessUnivariateStatistic[k];<a name="line.114"></a>
+<FONT color="green">115</FONT>            sumSqImpl   = new StorelessUnivariateStatistic[k];<a name="line.115"></a>
+<FONT color="green">116</FONT>            minImpl     = new StorelessUnivariateStatistic[k];<a name="line.116"></a>
+<FONT color="green">117</FONT>            maxImpl     = new StorelessUnivariateStatistic[k];<a name="line.117"></a>
+<FONT color="green">118</FONT>            sumLogImpl  = new StorelessUnivariateStatistic[k];<a name="line.118"></a>
+<FONT color="green">119</FONT>            geoMeanImpl = new StorelessUnivariateStatistic[k];<a name="line.119"></a>
+<FONT color="green">120</FONT>            meanImpl    = new StorelessUnivariateStatistic[k];<a name="line.120"></a>
+<FONT color="green">121</FONT>    <a name="line.121"></a>
+<FONT color="green">122</FONT>            for (int i = 0; i &lt; k; ++i) {<a name="line.122"></a>
+<FONT color="green">123</FONT>                sumImpl[i]     = new Sum();<a name="line.123"></a>
+<FONT color="green">124</FONT>                sumSqImpl[i]   = new SumOfSquares();<a name="line.124"></a>
+<FONT color="green">125</FONT>                minImpl[i]     = new Min();<a name="line.125"></a>
+<FONT color="green">126</FONT>                maxImpl[i]     = new Max();<a name="line.126"></a>
+<FONT color="green">127</FONT>                sumLogImpl[i]  = new SumOfLogs();<a name="line.127"></a>
+<FONT color="green">128</FONT>                geoMeanImpl[i] = new GeometricMean();<a name="line.128"></a>
+<FONT color="green">129</FONT>                meanImpl[i]    = new Mean();<a name="line.129"></a>
+<FONT color="green">130</FONT>            }<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>            covarianceImpl =<a name="line.132"></a>
+<FONT color="green">133</FONT>                new VectorialCovariance(k, isCovarianceBiasCorrected);<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>        }<a name="line.135"></a>
+<FONT color="green">136</FONT>    <a name="line.136"></a>
+<FONT color="green">137</FONT>        /**<a name="line.137"></a>
+<FONT color="green">138</FONT>         * Add an n-tuple to the data<a name="line.138"></a>
+<FONT color="green">139</FONT>         *<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @param value  the n-tuple to add<a name="line.140"></a>
+<FONT color="green">141</FONT>         * @throws DimensionMismatchException if the length of the array<a name="line.141"></a>
+<FONT color="green">142</FONT>         * does not match the one used at construction<a name="line.142"></a>
+<FONT color="green">143</FONT>         */<a name="line.143"></a>
+<FONT color="green">144</FONT>        public void addValue(double[] value)<a name="line.144"></a>
+<FONT color="green">145</FONT>          throws DimensionMismatchException {<a name="line.145"></a>
+<FONT color="green">146</FONT>            checkDimension(value.length);<a name="line.146"></a>
+<FONT color="green">147</FONT>            for (int i = 0; i &lt; k; ++i) {<a name="line.147"></a>
+<FONT color="green">148</FONT>                double v = value[i];<a name="line.148"></a>
+<FONT color="green">149</FONT>                sumImpl[i].increment(v);<a name="line.149"></a>
+<FONT color="green">150</FONT>                sumSqImpl[i].increment(v);<a name="line.150"></a>
+<FONT color="green">151</FONT>                minImpl[i].increment(v);<a name="line.151"></a>
+<FONT color="green">152</FONT>                maxImpl[i].increment(v);<a name="line.152"></a>
+<FONT color="green">153</FONT>                sumLogImpl[i].increment(v);<a name="line.153"></a>
+<FONT color="green">154</FONT>                geoMeanImpl[i].increment(v);<a name="line.154"></a>
+<FONT color="green">155</FONT>                meanImpl[i].increment(v);<a name="line.155"></a>
+<FONT color="green">156</FONT>            }<a name="line.156"></a>
+<FONT color="green">157</FONT>            covarianceImpl.increment(value);<a name="line.157"></a>
+<FONT color="green">158</FONT>            n++;<a name="line.158"></a>
+<FONT color="green">159</FONT>        }<a name="line.159"></a>
+<FONT color="green">160</FONT>    <a name="line.160"></a>
+<FONT color="green">161</FONT>        /**<a name="line.161"></a>
+<FONT color="green">162</FONT>         * Returns the dimension of the data<a name="line.162"></a>
+<FONT color="green">163</FONT>         * @return The dimension of the data<a name="line.163"></a>
+<FONT color="green">164</FONT>         */<a name="line.164"></a>
+<FONT color="green">165</FONT>        public int getDimension() {<a name="line.165"></a>
+<FONT color="green">166</FONT>            return k;<a name="line.166"></a>
+<FONT color="green">167</FONT>        }<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>        /**<a name="line.169"></a>
+<FONT color="green">170</FONT>         * Returns the number of available values<a name="line.170"></a>
+<FONT color="green">171</FONT>         * @return The number of available values<a name="line.171"></a>
+<FONT color="green">172</FONT>         */<a name="line.172"></a>
+<FONT color="green">173</FONT>        public long getN() {<a name="line.173"></a>
+<FONT color="green">174</FONT>            return n;<a name="line.174"></a>
+<FONT color="green">175</FONT>        }<a name="line.175"></a>
+<FONT color="green">176</FONT>    <a name="line.176"></a>
+<FONT color="green">177</FONT>        /**<a name="line.177"></a>
+<FONT color="green">178</FONT>         * Returns an array of the results of a statistic.<a name="line.178"></a>
+<FONT color="green">179</FONT>         * @param stats univariate statistic array<a name="line.179"></a>
+<FONT color="green">180</FONT>         * @return results array<a name="line.180"></a>
+<FONT color="green">181</FONT>         */<a name="line.181"></a>
+<FONT color="green">182</FONT>        private double[] getResults(StorelessUnivariateStatistic[] stats) {<a name="line.182"></a>
+<FONT color="green">183</FONT>            double[] results = new double[stats.length];<a name="line.183"></a>
+<FONT color="green">184</FONT>            for (int i = 0; i &lt; results.length; ++i) {<a name="line.184"></a>
+<FONT color="green">185</FONT>                results[i] = stats[i].getResult();<a name="line.185"></a>
+<FONT color="green">186</FONT>            }<a name="line.186"></a>
+<FONT color="green">187</FONT>            return results;<a name="line.187"></a>
+<FONT color="green">188</FONT>        }<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>        /**<a name="line.190"></a>
+<FONT color="green">191</FONT>         * Returns an array whose i&lt;sup&gt;th&lt;/sup&gt; entry is the sum of the<a name="line.191"></a>
+<FONT color="green">192</FONT>         * i&lt;sup&gt;th&lt;/sup&gt; entries of the arrays that have been added using<a name="line.192"></a>
+<FONT color="green">193</FONT>         * {@link #addValue(double[])}<a name="line.193"></a>
+<FONT color="green">194</FONT>         *<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @return the array of component sums<a name="line.195"></a>
+<FONT color="green">196</FONT>         */<a name="line.196"></a>
+<FONT color="green">197</FONT>        public double[] getSum() {<a name="line.197"></a>
+<FONT color="green">198</FONT>            return getResults(sumImpl);<a name="line.198"></a>
+<FONT color="green">199</FONT>        }<a name="line.199"></a>
+<FONT color="green">200</FONT>    <a name="line.200"></a>
+<FONT color="green">201</FONT>        /**<a name="line.201"></a>
+<FONT color="green">202</FONT>         * Returns an array whose i&lt;sup&gt;th&lt;/sup&gt; entry is the sum of squares of the<a name="line.202"></a>
+<FONT color="green">203</FONT>         * i&lt;sup&gt;th&lt;/sup&gt; entries of the arrays that have been added using<a name="line.203"></a>
+<FONT color="green">204</FONT>         * {@link #addValue(double[])}<a name="line.204"></a>
+<FONT color="green">205</FONT>         *<a name="line.205"></a>
+<FONT color="green">206</FONT>         * @return the array of component sums of squares<a name="line.206"></a>
+<FONT color="green">207</FONT>         */<a name="line.207"></a>
+<FONT color="green">208</FONT>        public double[] getSumSq() {<a name="line.208"></a>
+<FONT color="green">209</FONT>            return getResults(sumSqImpl);<a name="line.209"></a>
+<FONT color="green">210</FONT>        }<a name="line.210"></a>
+<FONT color="green">211</FONT>    <a name="line.211"></a>
+<FONT color="green">212</FONT>        /**<a name="line.212"></a>
+<FONT color="green">213</FONT>         * Returns an array whose i&lt;sup&gt;th&lt;/sup&gt; entry is the sum of logs of the<a name="line.213"></a>
+<FONT color="green">214</FONT>         * i&lt;sup&gt;th&lt;/sup&gt; entries of the arrays that have been added using<a name="line.214"></a>
+<FONT color="green">215</FONT>         * {@link #addValue(double[])}<a name="line.215"></a>
+<FONT color="green">216</FONT>         *<a name="line.216"></a>
+<FONT color="green">217</FONT>         * @return the array of component log sums<a name="line.217"></a>
+<FONT color="green">218</FONT>         */<a name="line.218"></a>
+<FONT color="green">219</FONT>        public double[] getSumLog() {<a name="line.219"></a>
+<FONT color="green">220</FONT>            return getResults(sumLogImpl);<a name="line.220"></a>
+<FONT color="green">221</FONT>        }<a name="line.221"></a>
+<FONT color="green">222</FONT>    <a name="line.222"></a>
+<FONT color="green">223</FONT>        /**<a name="line.223"></a>
+<FONT color="green">224</FONT>         * Returns an array whose i&lt;sup&gt;th&lt;/sup&gt; entry is the mean of the<a name="line.224"></a>
+<FONT color="green">225</FONT>         * i&lt;sup&gt;th&lt;/sup&gt; entries of the arrays that have been added using<a name="line.225"></a>
+<FONT color="green">226</FONT>         * {@link #addValue(double[])}<a name="line.226"></a>
+<FONT color="green">227</FONT>         *<a name="line.227"></a>
+<FONT color="green">228</FONT>         * @return the array of component means<a name="line.228"></a>
+<FONT color="green">229</FONT>         */<a name="line.229"></a>
+<FONT color="green">230</FONT>        public double[] getMean() {<a name="line.230"></a>
+<FONT color="green">231</FONT>            return getResults(meanImpl);<a name="line.231"></a>
+<FONT color="green">232</FONT>        }<a name="line.232"></a>
+<FONT color="green">233</FONT>    <a name="line.233"></a>
+<FONT color="green">234</FONT>        /**<a name="line.234"></a>
+<FONT color="green">235</FONT>         * Returns an array whose i&lt;sup&gt;th&lt;/sup&gt; entry is the standard deviation of the<a name="line.235"></a>
+<FONT color="green">236</FONT>         * i&lt;sup&gt;th&lt;/sup&gt; entries of the arrays that have been added using<a name="line.236"></a>
+<FONT color="green">237</FONT>         * {@link #addValue(double[])}<a name="line.237"></a>
+<FONT color="green">238</FONT>         *<a name="line.238"></a>
+<FONT color="green">239</FONT>         * @return the array of component standard deviations<a name="line.239"></a>
+<FONT color="green">240</FONT>         */<a name="line.240"></a>
+<FONT color="green">241</FONT>        public double[] getStandardDeviation() {<a name="line.241"></a>
+<FONT color="green">242</FONT>            double[] stdDev = new double[k];<a name="line.242"></a>
+<FONT color="green">243</FONT>            if (getN() &lt; 1) {<a name="line.243"></a>
+<FONT color="green">244</FONT>                Arrays.fill(stdDev, Double.NaN);<a name="line.244"></a>
+<FONT color="green">245</FONT>            } else if (getN() &lt; 2) {<a name="line.245"></a>
+<FONT color="green">246</FONT>                Arrays.fill(stdDev, 0.0);<a name="line.246"></a>
+<FONT color="green">247</FONT>            } else {<a name="line.247"></a>
+<FONT color="green">248</FONT>                RealMatrix matrix = covarianceImpl.getResult();<a name="line.248"></a>
+<FONT color="green">249</FONT>                for (int i = 0; i &lt; k; ++i) {<a name="line.249"></a>
+<FONT color="green">250</FONT>                    stdDev[i] = Math.sqrt(matrix.getEntry(i, i));<a name="line.250"></a>
+<FONT color="green">251</FONT>                }<a name="line.251"></a>
+<FONT color="green">252</FONT>            }<a name="line.252"></a>
+<FONT color="green">253</FONT>            return stdDev;<a name="line.253"></a>
+<FONT color="green">254</FONT>        }<a name="line.254"></a>
+<FONT color="green">255</FONT>    <a name="line.255"></a>
+<FONT color="green">256</FONT>        /**<a name="line.256"></a>
+<FONT color="green">257</FONT>         * Returns the covariance matrix of the values that have been added.<a name="line.257"></a>
+<FONT color="green">258</FONT>         *<a name="line.258"></a>
+<FONT color="green">259</FONT>         * @return the covariance matrix<a name="line.259"></a>
+<FONT color="green">260</FONT>         */<a name="line.260"></a>
+<FONT color="green">261</FONT>        public RealMatrix getCovariance() {<a name="line.261"></a>
+<FONT color="green">262</FONT>            return covarianceImpl.getResult();<a name="line.262"></a>
+<FONT color="green">263</FONT>        }<a name="line.263"></a>
+<FONT color="green">264</FONT>    <a name="line.264"></a>
+<FONT color="green">265</FONT>        /**<a name="line.265"></a>
+<FONT color="green">266</FONT>         * Returns an array whose i&lt;sup&gt;th&lt;/sup&gt; entry is the maximum of the<a name="line.266"></a>
+<FONT color="green">267</FONT>         * i&lt;sup&gt;th&lt;/sup&gt; entries of the arrays that have been added using<a name="line.267"></a>
+<FONT color="green">268</FONT>         * {@link #addValue(double[])}<a name="line.268"></a>
+<FONT color="green">269</FONT>         *<a name="line.269"></a>
+<FONT color="green">270</FONT>         * @return the array of component maxima<a name="line.270"></a>
+<FONT color="green">271</FONT>         */<a name="line.271"></a>
+<FONT color="green">272</FONT>        public double[] getMax() {<a name="line.272"></a>
+<FONT color="green">273</FONT>            return getResults(maxImpl);<a name="line.273"></a>
+<FONT color="green">274</FONT>        }<a name="line.274"></a>
+<FONT color="green">275</FONT>    <a name="line.275"></a>
+<FONT color="green">276</FONT>        /**<a name="line.276"></a>
+<FONT color="green">277</FONT>         * Returns an array whose i&lt;sup&gt;th&lt;/sup&gt; entry is the minimum of the<a name="line.277"></a>
+<FONT color="green">278</FONT>         * i&lt;sup&gt;th&lt;/sup&gt; entries of the arrays that have been added using<a name="line.278"></a>
+<FONT color="green">279</FONT>         * {@link #addValue(double[])}<a name="line.279"></a>
+<FONT color="green">280</FONT>         *<a name="line.280"></a>
+<FONT color="green">281</FONT>         * @return the array of component minima<a name="line.281"></a>
+<FONT color="green">282</FONT>         */<a name="line.282"></a>
+<FONT color="green">283</FONT>        public double[] getMin() {<a name="line.283"></a>
+<FONT color="green">284</FONT>            return getResults(minImpl);<a name="line.284"></a>
+<FONT color="green">285</FONT>        }<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>        /**<a name="line.287"></a>
+<FONT color="green">288</FONT>         * Returns an array whose i&lt;sup&gt;th&lt;/sup&gt; entry is the geometric mean of the<a name="line.288"></a>
+<FONT color="green">289</FONT>         * i&lt;sup&gt;th&lt;/sup&gt; entries of the arrays that have been added using<a name="line.289"></a>
+<FONT color="green">290</FONT>         * {@link #addValue(double[])}<a name="line.290"></a>
+<FONT color="green">291</FONT>         *<a name="line.291"></a>
+<FONT color="green">292</FONT>         * @return the array of component geometric means<a name="line.292"></a>
+<FONT color="green">293</FONT>         */<a name="line.293"></a>
+<FONT color="green">294</FONT>        public double[] getGeometricMean() {<a name="line.294"></a>
+<FONT color="green">295</FONT>            return getResults(geoMeanImpl);<a name="line.295"></a>
+<FONT color="green">296</FONT>        }<a name="line.296"></a>
+<FONT color="green">297</FONT>    <a name="line.297"></a>
+<FONT color="green">298</FONT>        /**<a name="line.298"></a>
+<FONT color="green">299</FONT>         * Generates a text report displaying<a name="line.299"></a>
+<FONT color="green">300</FONT>         * summary statistics from values that<a name="line.300"></a>
+<FONT color="green">301</FONT>         * have been added.<a name="line.301"></a>
+<FONT color="green">302</FONT>         * @return String with line feeds displaying statistics<a name="line.302"></a>
+<FONT color="green">303</FONT>         */<a name="line.303"></a>
+<FONT color="green">304</FONT>        @Override<a name="line.304"></a>
+<FONT color="green">305</FONT>        public String toString() {<a name="line.305"></a>
+<FONT color="green">306</FONT>            StringBuffer outBuffer = new StringBuffer();<a name="line.306"></a>
+<FONT color="green">307</FONT>            outBuffer.append("MultivariateSummaryStatistics:\n");<a name="line.307"></a>
+<FONT color="green">308</FONT>            outBuffer.append("n: " + getN() + "\n");<a name="line.308"></a>
+<FONT color="green">309</FONT>            append(outBuffer, getMin(), "min: ", ", ", "\n");<a name="line.309"></a>
+<FONT color="green">310</FONT>            append(outBuffer, getMax(), "max: ", ", ", "\n");<a name="line.310"></a>
+<FONT color="green">311</FONT>            append(outBuffer, getMean(), "mean: ", ", ", "\n");<a name="line.311"></a>
+<FONT color="green">312</FONT>            append(outBuffer, getGeometricMean(), "geometric mean: ", ", ", "\n");<a name="line.312"></a>
+<FONT color="green">313</FONT>            append(outBuffer, getSumSq(), "sum of squares: ", ", ", "\n");<a name="line.313"></a>
+<FONT color="green">314</FONT>            append(outBuffer, getSumLog(), "sum of logarithms: ", ", ", "\n");<a name="line.314"></a>
+<FONT color="green">315</FONT>            append(outBuffer, getStandardDeviation(), "standard deviation: ", ", ", "\n");<a name="line.315"></a>
+<FONT color="green">316</FONT>            outBuffer.append("covariance: " + getCovariance().toString() + "\n");<a name="line.316"></a>
+<FONT color="green">317</FONT>            return outBuffer.toString();<a name="line.317"></a>
+<FONT color="green">318</FONT>        }<a name="line.318"></a>
+<FONT color="green">319</FONT>    <a name="line.319"></a>
+<FONT color="green">320</FONT>        /**<a name="line.320"></a>
+<FONT color="green">321</FONT>         * Append a text representation of an array to a buffer.<a name="line.321"></a>
+<FONT color="green">322</FONT>         * @param buffer buffer to fill<a name="line.322"></a>
+<FONT color="green">323</FONT>         * @param data data array<a name="line.323"></a>
+<FONT color="green">324</FONT>         * @param prefix text prefix<a name="line.324"></a>
+<FONT color="green">325</FONT>         * @param separator elements separator<a name="line.325"></a>
+<FONT color="green">326</FONT>         * @param suffix text suffix<a name="line.326"></a>
+<FONT color="green">327</FONT>         */<a name="line.327"></a>
+<FONT color="green">328</FONT>        private void append(StringBuffer buffer, double[] data,<a name="line.328"></a>
+<FONT color="green">329</FONT>                            String prefix, String separator, String suffix) {<a name="line.329"></a>
+<FONT color="green">330</FONT>            buffer.append(prefix);<a name="line.330"></a>
+<FONT color="green">331</FONT>            for (int i = 0; i &lt; data.length; ++i) {<a name="line.331"></a>
+<FONT color="green">332</FONT>                if (i &gt; 0) {<a name="line.332"></a>
+<FONT color="green">333</FONT>                    buffer.append(separator);<a name="line.333"></a>
+<FONT color="green">334</FONT>                }<a name="line.334"></a>
+<FONT color="green">335</FONT>                buffer.append(data[i]);<a name="line.335"></a>
+<FONT color="green">336</FONT>            }<a name="line.336"></a>
+<FONT color="green">337</FONT>            buffer.append(suffix);<a name="line.337"></a>
+<FONT color="green">338</FONT>        }<a name="line.338"></a>
+<FONT color="green">339</FONT>    <a name="line.339"></a>
+<FONT color="green">340</FONT>        /**<a name="line.340"></a>
+<FONT color="green">341</FONT>         * Resets all statistics and storage<a name="line.341"></a>
+<FONT color="green">342</FONT>         */<a name="line.342"></a>
+<FONT color="green">343</FONT>        public void clear() {<a name="line.343"></a>
+<FONT color="green">344</FONT>            this.n = 0;<a name="line.344"></a>
+<FONT color="green">345</FONT>            for (int i = 0; i &lt; k; ++i) {<a name="line.345"></a>
+<FONT color="green">346</FONT>                minImpl[i].clear();<a name="line.346"></a>
+<FONT color="green">347</FONT>                maxImpl[i].clear();<a name="line.347"></a>
+<FONT color="green">348</FONT>                sumImpl[i].clear();<a name="line.348"></a>
+<FONT color="green">349</FONT>                sumLogImpl[i].clear();<a name="line.349"></a>
+<FONT color="green">350</FONT>                sumSqImpl[i].clear();<a name="line.350"></a>
+<FONT color="green">351</FONT>                geoMeanImpl[i].clear();<a name="line.351"></a>
+<FONT color="green">352</FONT>                meanImpl[i].clear();<a name="line.352"></a>
+<FONT color="green">353</FONT>            }<a name="line.353"></a>
+<FONT color="green">354</FONT>            covarianceImpl.clear();<a name="line.354"></a>
+<FONT color="green">355</FONT>        }<a name="line.355"></a>
+<FONT color="green">356</FONT>    <a name="line.356"></a>
+<FONT color="green">357</FONT>        /**<a name="line.357"></a>
+<FONT color="green">358</FONT>         * Returns true iff &lt;code&gt;object&lt;/code&gt; is a &lt;code&gt;SummaryStatistics&lt;/code&gt;<a name="line.358"></a>
+<FONT color="green">359</FONT>         * instance and all statistics have the same values as this.<a name="line.359"></a>
+<FONT color="green">360</FONT>         * @param object the object to test equality against.<a name="line.360"></a>
+<FONT color="green">361</FONT>         * @return true if object equals this<a name="line.361"></a>
+<FONT color="green">362</FONT>         */<a name="line.362"></a>
+<FONT color="green">363</FONT>        @Override<a name="line.363"></a>
+<FONT color="green">364</FONT>        public boolean equals(Object object) {<a name="line.364"></a>
+<FONT color="green">365</FONT>            if (object == this ) {<a name="line.365"></a>
+<FONT color="green">366</FONT>                return true;<a name="line.366"></a>
+<FONT color="green">367</FONT>            }<a name="line.367"></a>
+<FONT color="green">368</FONT>            if (object instanceof MultivariateSummaryStatistics == false) {<a name="line.368"></a>
+<FONT color="green">369</FONT>                return false;<a name="line.369"></a>
+<FONT color="green">370</FONT>            }<a name="line.370"></a>
+<FONT color="green">371</FONT>            MultivariateSummaryStatistics stat = (MultivariateSummaryStatistics) object;<a name="line.371"></a>
+<FONT color="green">372</FONT>            return MathUtils.equals(stat.getGeometricMean(), getGeometricMean()) &amp;&amp;<a name="line.372"></a>
+<FONT color="green">373</FONT>                   MathUtils.equals(stat.getMax(),           getMax())           &amp;&amp;<a name="line.373"></a>
+<FONT color="green">374</FONT>                   MathUtils.equals(stat.getMean(),          getMean())          &amp;&amp;<a name="line.374"></a>
+<FONT color="green">375</FONT>                   MathUtils.equals(stat.getMin(),           getMin())           &amp;&amp;<a name="line.375"></a>
+<FONT color="green">376</FONT>                   MathUtils.equals(stat.getN(),             getN())             &amp;&amp;<a name="line.376"></a>
+<FONT color="green">377</FONT>                   MathUtils.equals(stat.getSum(),           getSum())           &amp;&amp;<a name="line.377"></a>
+<FONT color="green">378</FONT>                   MathUtils.equals(stat.getSumSq(),         getSumSq())         &amp;&amp;<a name="line.378"></a>
+<FONT color="green">379</FONT>                   MathUtils.equals(stat.getSumLog(),        getSumLog())        &amp;&amp;<a name="line.379"></a>
+<FONT color="green">380</FONT>                   stat.getCovariance().equals( getCovariance());<a name="line.380"></a>
+<FONT color="green">381</FONT>        }<a name="line.381"></a>
+<FONT color="green">382</FONT>    <a name="line.382"></a>
+<FONT color="green">383</FONT>        /**<a name="line.383"></a>
+<FONT color="green">384</FONT>         * Returns hash code based on values of statistics<a name="line.384"></a>
+<FONT color="green">385</FONT>         *<a name="line.385"></a>
+<FONT color="green">386</FONT>         * @return hash code<a name="line.386"></a>
+<FONT color="green">387</FONT>         */<a name="line.387"></a>
+<FONT color="green">388</FONT>        @Override<a name="line.388"></a>
+<FONT color="green">389</FONT>        public int hashCode() {<a name="line.389"></a>
+<FONT color="green">390</FONT>            int result = 31 + MathUtils.hash(getGeometricMean());<a name="line.390"></a>
+<FONT color="green">391</FONT>            result = result * 31 + MathUtils.hash(getGeometricMean());<a name="line.391"></a>
+<FONT color="green">392</FONT>            result = result * 31 + MathUtils.hash(getMax());<a name="line.392"></a>
+<FONT color="green">393</FONT>            result = result * 31 + MathUtils.hash(getMean());<a name="line.393"></a>
+<FONT color="green">394</FONT>            result = result * 31 + MathUtils.hash(getMin());<a name="line.394"></a>
+<FONT color="green">395</FONT>            result = result * 31 + MathUtils.hash(getN());<a name="line.395"></a>
+<FONT color="green">396</FONT>            result = result * 31 + MathUtils.hash(getSum());<a name="line.396"></a>
+<FONT color="green">397</FONT>            result = result * 31 + MathUtils.hash(getSumSq());<a name="line.397"></a>
+<FONT color="green">398</FONT>            result = result * 31 + MathUtils.hash(getSumLog());<a name="line.398"></a>
+<FONT color="green">399</FONT>            result = result * 31 + getCovariance().hashCode();<a name="line.399"></a>
+<FONT color="green">400</FONT>            return result;<a name="line.400"></a>
+<FONT color="green">401</FONT>        }<a name="line.401"></a>
+<FONT color="green">402</FONT>    <a name="line.402"></a>
+<FONT color="green">403</FONT>        // Getters and setters for statistics implementations<a name="line.403"></a>
+<FONT color="green">404</FONT>        /**<a name="line.404"></a>
+<FONT color="green">405</FONT>         * Sets statistics implementations.<a name="line.405"></a>
+<FONT color="green">406</FONT>         * @param newImpl new implementations for statistics<a name="line.406"></a>
+<FONT color="green">407</FONT>         * @param oldImpl old implementations for statistics<a name="line.407"></a>
+<FONT color="green">408</FONT>         * @throws DimensionMismatchException if the array dimension<a name="line.408"></a>
+<FONT color="green">409</FONT>         * does not match the one used at construction<a name="line.409"></a>
+<FONT color="green">410</FONT>         * @throws IllegalStateException if data has already been added<a name="line.410"></a>
+<FONT color="green">411</FONT>         *  (i.e if n &gt; 0)<a name="line.411"></a>
+<FONT color="green">412</FONT>         */<a name="line.412"></a>
+<FONT color="green">413</FONT>        private void setImpl(StorelessUnivariateStatistic[] newImpl,<a name="line.413"></a>
+<FONT color="green">414</FONT>                             StorelessUnivariateStatistic[] oldImpl)<a name="line.414"></a>
+<FONT color="green">415</FONT>           throws DimensionMismatchException, IllegalStateException {<a name="line.415"></a>
+<FONT color="green">416</FONT>            checkEmpty();<a name="line.416"></a>
+<FONT color="green">417</FONT>            checkDimension(newImpl.length);<a name="line.417"></a>
+<FONT color="green">418</FONT>            System.arraycopy(newImpl, 0, oldImpl, 0, newImpl.length);<a name="line.418"></a>
+<FONT color="green">419</FONT>        }<a name="line.419"></a>
+<FONT color="green">420</FONT>    <a name="line.420"></a>
+<FONT color="green">421</FONT>        /**<a name="line.421"></a>
+<FONT color="green">422</FONT>         * Returns the currently configured Sum implementation<a name="line.422"></a>
+<FONT color="green">423</FONT>         *<a name="line.423"></a>
+<FONT color="green">424</FONT>         * @return the StorelessUnivariateStatistic implementing the sum<a name="line.424"></a>
+<FONT color="green">425</FONT>         */<a name="line.425"></a>
+<FONT color="green">426</FONT>        public StorelessUnivariateStatistic[] getSumImpl() {<a name="line.426"></a>
+<FONT color="green">427</FONT>            return sumImpl.clone();<a name="line.427"></a>
+<FONT color="green">428</FONT>        }<a name="line.428"></a>
+<FONT color="green">429</FONT>    <a name="line.429"></a>
+<FONT color="green">430</FONT>        /**<a name="line.430"></a>
+<FONT color="green">431</FONT>         * &lt;p&gt;Sets the implementation for the Sum.&lt;/p&gt;<a name="line.431"></a>
+<FONT color="green">432</FONT>         * &lt;p&gt;This method must be activated before any data has been added - i.e.,<a name="line.432"></a>
+<FONT color="green">433</FONT>         * before {@link #addValue(double[]) addValue} has been used to add data;<a name="line.433"></a>
+<FONT color="green">434</FONT>         * otherwise an IllegalStateException will be thrown.&lt;/p&gt;<a name="line.434"></a>
+<FONT color="green">435</FONT>         *<a name="line.435"></a>
+<FONT color="green">436</FONT>         * @param sumImpl the StorelessUnivariateStatistic instance to use<a name="line.436"></a>
+<FONT color="green">437</FONT>         * for computing the Sum<a name="line.437"></a>
+<FONT color="green">438</FONT>         * @throws DimensionMismatchException if the array dimension<a name="line.438"></a>
+<FONT color="green">439</FONT>         * does not match the one used at construction<a name="line.439"></a>
+<FONT color="green">440</FONT>         * @throws IllegalStateException if data has already been added<a name="line.440"></a>
+<FONT color="green">441</FONT>         *  (i.e if n &gt; 0)<a name="line.441"></a>
+<FONT color="green">442</FONT>         */<a name="line.442"></a>
+<FONT color="green">443</FONT>        public void setSumImpl(StorelessUnivariateStatistic[] sumImpl)<a name="line.443"></a>
+<FONT color="green">444</FONT>          throws DimensionMismatchException {<a name="line.444"></a>
+<FONT color="green">445</FONT>            setImpl(sumImpl, this.sumImpl);<a name="line.445"></a>
+<FONT color="green">446</FONT>        }<a name="line.446"></a>
+<FONT color="green">447</FONT>    <a name="line.447"></a>
+<FONT color="green">448</FONT>        /**<a name="line.448"></a>
+<FONT color="green">449</FONT>         * Returns the currently configured sum of squares implementation<a name="line.449"></a>
+<FONT color="green">450</FONT>         *<a name="line.450"></a>
+<FONT color="green">451</FONT>         * @return the StorelessUnivariateStatistic implementing the sum of squares<a name="line.451"></a>
+<FONT color="green">452</FONT>         */<a name="line.452"></a>
+<FONT color="green">453</FONT>        public StorelessUnivariateStatistic[] getSumsqImpl() {<a name="line.453"></a>
+<FONT color="green">454</FONT>            return sumSqImpl.clone();<a name="line.454"></a>
+<FONT color="green">455</FONT>        }<a name="line.455"></a>
+<FONT color="green">456</FONT>    <a name="line.456"></a>
+<FONT color="green">457</FONT>        /**<a name="line.457"></a>
+<FONT color="green">458</FONT>         * &lt;p&gt;Sets the implementation for the sum of squares.&lt;/p&gt;<a name="line.458"></a>
+<FONT color="green">459</FONT>         * &lt;p&gt;This method must be activated before any data has been added - i.e.,<a name="line.459"></a>
+<FONT color="green">460</FONT>         * before {@link #addValue(double[]) addValue} has been used to add data;<a name="line.460"></a>
+<FONT color="green">461</FONT>         * otherwise an IllegalStateException will be thrown.&lt;/p&gt;<a name="line.461"></a>
+<FONT color="green">462</FONT>         *<a name="line.462"></a>
+<FONT color="green">463</FONT>         * @param sumsqImpl the StorelessUnivariateStatistic instance to use<a name="line.463"></a>
+<FONT color="green">464</FONT>         * for computing the sum of squares<a name="line.464"></a>
+<FONT color="green">465</FONT>         * @throws DimensionMismatchException if the array dimension<a name="line.465"></a>
+<FONT color="green">466</FONT>         * does not match the one used at construction<a name="line.466"></a>
+<FONT color="green">467</FONT>         * @throws IllegalStateException if data has already been added<a name="line.467"></a>
+<FONT color="green">468</FONT>         *  (i.e if n &gt; 0)<a name="line.468"></a>
+<FONT color="green">469</FONT>         */<a name="line.469"></a>
+<FONT color="green">470</FONT>        public void setSumsqImpl(StorelessUnivariateStatistic[] sumsqImpl)<a name="line.470"></a>
+<FONT color="green">471</FONT>          throws DimensionMismatchException {<a name="line.471"></a>
+<FONT color="green">472</FONT>            setImpl(sumsqImpl, this.sumSqImpl);<a name="line.472"></a>
+<FONT color="green">473</FONT>        }<a name="line.473"></a>
+<FONT color="green">474</FONT>    <a name="line.474"></a>
+<FONT color="green">475</FONT>        /**<a name="line.475"></a>
+<FONT color="green">476</FONT>         * Returns the currently configured minimum implementation<a name="line.476"></a>
+<FONT color="green">477</FONT>         *<a name="line.477"></a>
+<FONT color="green">478</FONT>         * @return the StorelessUnivariateStatistic implementing the minimum<a name="line.478"></a>
+<FONT color="green">479</FONT>         */<a name="line.479"></a>
+<FONT color="green">480</FONT>        public StorelessUnivariateStatistic[] getMinImpl() {<a name="line.480"></a>
+<FONT color="green">481</FONT>            return minImpl.clone();<a name="line.481"></a>
+<FONT color="green">482</FONT>        }<a name="line.482"></a>
+<FONT color="green">483</FONT>    <a name="line.483"></a>
+<FONT color="green">484</FONT>        /**<a name="line.484"></a>
+<FONT color="green">485</FONT>         * &lt;p&gt;Sets the implementation for the minimum.&lt;/p&gt;<a name="line.485"></a>
+<FONT color="green">486</FONT>         * &lt;p&gt;This method must be activated before any data has been added - i.e.,<a name="line.486"></a>
+<FONT color="green">487</FONT>         * before {@link #addValue(double[]) addValue} has been used to add data;<a name="line.487"></a>
+<FONT color="green">488</FONT>         * otherwise an IllegalStateException will be thrown.&lt;/p&gt;<a name="line.488"></a>
+<FONT color="green">489</FONT>         *<a name="line.489"></a>
+<FONT color="green">490</FONT>         * @param minImpl the StorelessUnivariateStatistic instance to use<a name="line.490"></a>
+<FONT color="green">491</FONT>         * for computing the minimum<a name="line.491"></a>
+<FONT color="green">492</FONT>         * @throws DimensionMismatchException if the array dimension<a name="line.492"></a>
+<FONT color="green">493</FONT>         * does not match the one used at construction<a name="line.493"></a>
+<FONT color="green">494</FONT>         * @throws IllegalStateException if data has already been added<a name="line.494"></a>
+<FONT color="green">495</FONT>         *  (i.e if n &gt; 0)<a name="line.495"></a>
+<FONT color="green">496</FONT>         */<a name="line.496"></a>
+<FONT color="green">497</FONT>        public void setMinImpl(StorelessUnivariateStatistic[] minImpl)<a name="line.497"></a>
+<FONT color="green">498</FONT>          throws DimensionMismatchException {<a name="line.498"></a>
+<FONT color="green">499</FONT>            setImpl(minImpl, this.minImpl);<a name="line.499"></a>
+<FONT color="green">500</FONT>        }<a name="line.500"></a>
+<FONT color="green">501</FONT>    <a name="line.501"></a>
+<FONT color="green">502</FONT>        /**<a name="line.502"></a>
+<FONT color="green">503</FONT>         * Returns the currently configured maximum implementation<a name="line.503"></a>
+<FONT color="green">504</FONT>         *<a name="line.504"></a>
+<FONT color="green">505</FONT>         * @return the StorelessUnivariateStatistic implementing the maximum<a name="line.505"></a>
+<FONT color="green">506</FONT>         */<a name="line.506"></a>
+<FONT color="green">507</FONT>        public StorelessUnivariateStatistic[] getMaxImpl() {<a name="line.507"></a>
+<FONT color="green">508</FONT>            return maxImpl.clone();<a name="line.508"></a>
+<FONT color="green">509</FONT>        }<a name="line.509"></a>
+<FONT color="green">510</FONT>    <a name="line.510"></a>
+<FONT color="green">511</FONT>        /**<a name="line.511"></a>
+<FONT color="green">512</FONT>         * &lt;p&gt;Sets the implementation for the maximum.&lt;/p&gt;<a name="line.512"></a>
+<FONT color="green">513</FONT>         * &lt;p&gt;This method must be activated before any data has been added - i.e.,<a name="line.513"></a>
+<FONT color="green">514</FONT>         * before {@link #addValue(double[]) addValue} has been used to add data;<a name="line.514"></a>
+<FONT color="green">515</FONT>         * otherwise an IllegalStateException will be thrown.&lt;/p&gt;<a name="line.515"></a>
+<FONT color="green">516</FONT>         *<a name="line.516"></a>
+<FONT color="green">517</FONT>         * @param maxImpl the StorelessUnivariateStatistic instance to use<a name="line.517"></a>
+<FONT color="green">518</FONT>         * for computing the maximum<a name="line.518"></a>
+<FONT color="green">519</FONT>         * @throws DimensionMismatchException if the array dimension<a name="line.519"></a>
+<FONT color="green">520</FONT>         * does not match the one used at construction<a name="line.520"></a>
+<FONT color="green">521</FONT>         * @throws IllegalStateException if data has already been added<a name="line.521"></a>
+<FONT color="green">522</FONT>         *  (i.e if n &gt; 0)<a name="line.522"></a>
+<FONT color="green">523</FONT>         */<a name="line.523"></a>
+<FONT color="green">524</FONT>        public void setMaxImpl(StorelessUnivariateStatistic[] maxImpl)<a name="line.524"></a>
+<FONT color="green">525</FONT>          throws DimensionMismatchException {<a name="line.525"></a>
+<FONT color="green">526</FONT>            setImpl(maxImpl, this.maxImpl);<a name="line.526"></a>
+<FONT color="green">527</FONT>        }<a name="line.527"></a>
+<FONT color="green">528</FONT>    <a name="line.528"></a>
+<FONT color="green">529</FONT>        /**<a name="line.529"></a>
+<FONT color="green">530</FONT>         * Returns the currently configured sum of logs implementation<a name="line.530"></a>
+<FONT color="green">531</FONT>         *<a name="line.531"></a>
+<FONT color="green">532</FONT>         * @return the StorelessUnivariateStatistic implementing the log sum<a name="line.532"></a>
+<FONT color="green">533</FONT>         */<a name="line.533"></a>
+<FONT color="green">534</FONT>        public StorelessUnivariateStatistic[] getSumLogImpl() {<a name="line.534"></a>
+<FONT color="green">535</FONT>            return sumLogImpl.clone();<a name="line.535"></a>
+<FONT color="green">536</FONT>        }<a name="line.536"></a>
+<FONT color="green">537</FONT>    <a name="line.537"></a>
+<FONT color="green">538</FONT>        /**<a name="line.538"></a>
+<FONT color="green">539</FONT>         * &lt;p&gt;Sets the implementation for the sum of logs.&lt;/p&gt;<a name="line.539"></a>
+<FONT color="green">540</FONT>         * &lt;p&gt;This method must be activated before any data has been added - i.e.,<a name="line.540"></a>
+<FONT color="green">541</FONT>         * before {@link #addValue(double[]) addValue} has been used to add data;<a name="line.541"></a>
+<FONT color="green">542</FONT>         * otherwise an IllegalStateException will be thrown.&lt;/p&gt;<a name="line.542"></a>
+<FONT color="green">543</FONT>         *<a name="line.543"></a>
+<FONT color="green">544</FONT>         * @param sumLogImpl the StorelessUnivariateStatistic instance to use<a name="line.544"></a>
+<FONT color="green">545</FONT>         * for computing the log sum<a name="line.545"></a>
+<FONT color="green">546</FONT>         * @throws DimensionMismatchException if the array dimension<a name="line.546"></a>
+<FONT color="green">547</FONT>         * does not match the one used at construction<a name="line.547"></a>
+<FONT color="green">548</FONT>         * @throws IllegalStateException if data has already been added<a name="line.548"></a>
+<FONT color="green">549</FONT>         *  (i.e if n &gt; 0)<a name="line.549"></a>
+<FONT color="green">550</FONT>         */<a name="line.550"></a>
+<FONT color="green">551</FONT>        public void setSumLogImpl(StorelessUnivariateStatistic[] sumLogImpl)<a name="line.551"></a>
+<FONT color="green">552</FONT>          throws DimensionMismatchException {<a name="line.552"></a>
+<FONT color="green">553</FONT>            setImpl(sumLogImpl, this.sumLogImpl);<a name="line.553"></a>
+<FONT color="green">554</FONT>        }<a name="line.554"></a>
+<FONT color="green">555</FONT>    <a name="line.555"></a>
+<FONT color="green">556</FONT>        /**<a name="line.556"></a>
+<FONT color="green">557</FONT>         * Returns the currently configured geometric mean implementation<a name="line.557"></a>
+<FONT color="green">558</FONT>         *<a name="line.558"></a>
+<FONT color="green">559</FONT>         * @return the StorelessUnivariateStatistic implementing the geometric mean<a name="line.559"></a>
+<FONT color="green">560</FONT>         */<a name="line.560"></a>
+<FONT color="green">561</FONT>        public StorelessUnivariateStatistic[] getGeoMeanImpl() {<a name="line.561"></a>
+<FONT color="green">562</FONT>            return geoMeanImpl.clone();<a name="line.562"></a>
+<FONT color="green">563</FONT>        }<a name="line.563"></a>
+<FONT color="green">564</FONT>    <a name="line.564"></a>
+<FONT color="green">565</FONT>        /**<a name="line.565"></a>
+<FONT color="green">566</FONT>         * &lt;p&gt;Sets the implementation for the geometric mean.&lt;/p&gt;<a name="line.566"></a>
+<FONT color="green">567</FONT>         * &lt;p&gt;This method must be activated before any data has been added - i.e.,<a name="line.567"></a>
+<FONT color="green">568</FONT>         * before {@link #addValue(double[]) addValue} has been used to add data;<a name="line.568"></a>
+<FONT color="green">569</FONT>         * otherwise an IllegalStateException will be thrown.&lt;/p&gt;<a name="line.569"></a>
+<FONT color="green">570</FONT>         *<a name="line.570"></a>
+<FONT color="green">571</FONT>         * @param geoMeanImpl the StorelessUnivariateStatistic instance to use<a name="line.571"></a>
+<FONT color="green">572</FONT>         * for computing the geometric mean<a name="line.572"></a>
+<FONT color="green">573</FONT>         * @throws DimensionMismatchException if the array dimension<a name="line.573"></a>
+<FONT color="green">574</FONT>         * does not match the one used at construction<a name="line.574"></a>
+<FONT color="green">575</FONT>         * @throws IllegalStateException if data has already been added<a name="line.575"></a>
+<FONT color="green">576</FONT>         *  (i.e if n &gt; 0)<a name="line.576"></a>
+<FONT color="green">577</FONT>         */<a name="line.577"></a>
+<FONT color="green">578</FONT>        public void setGeoMeanImpl(StorelessUnivariateStatistic[] geoMeanImpl)<a name="line.578"></a>
+<FONT color="green">579</FONT>          throws DimensionMismatchException {<a name="line.579"></a>
+<FONT color="green">580</FONT>            setImpl(geoMeanImpl, this.geoMeanImpl);<a name="line.580"></a>
+<FONT color="green">581</FONT>        }<a name="line.581"></a>
+<FONT color="green">582</FONT>    <a name="line.582"></a>
+<FONT color="green">583</FONT>        /**<a name="line.583"></a>
+<FONT color="green">584</FONT>         * Returns the currently configured mean implementation<a name="line.584"></a>
+<FONT color="green">585</FONT>         *<a name="line.585"></a>
+<FONT color="green">586</FONT>         * @return the StorelessUnivariateStatistic implementing the mean<a name="line.586"></a>
+<FONT color="green">587</FONT>         */<a name="line.587"></a>
+<FONT color="green">588</FONT>        public StorelessUnivariateStatistic[] getMeanImpl() {<a name="line.588"></a>
+<FONT color="green">589</FONT>            return meanImpl.clone();<a name="line.589"></a>
+<FONT color="green">590</FONT>        }<a name="line.590"></a>
+<FONT color="green">591</FONT>    <a name="line.591"></a>
+<FONT color="green">592</FONT>        /**<a name="line.592"></a>
+<FONT color="green">593</FONT>         * &lt;p&gt;Sets the implementation for the mean.&lt;/p&gt;<a name="line.593"></a>
+<FONT color="green">594</FONT>         * &lt;p&gt;This method must be activated before any data has been added - i.e.,<a name="line.594"></a>
+<FONT color="green">595</FONT>         * before {@link #addValue(double[]) addValue} has been used to add data;<a name="line.595"></a>
+<FONT color="green">596</FONT>         * otherwise an IllegalStateException will be thrown.&lt;/p&gt;<a name="line.596"></a>
+<FONT color="green">597</FONT>         *<a name="line.597"></a>
+<FONT color="green">598</FONT>         * @param meanImpl the StorelessUnivariateStatistic instance to use<a name="line.598"></a>
+<FONT color="green">599</FONT>         * for computing the mean<a name="line.599"></a>
+<FONT color="green">600</FONT>         * @throws DimensionMismatchException if the array dimension<a name="line.600"></a>
+<FONT color="green">601</FONT>         * does not match the one used at construction<a name="line.601"></a>
+<FONT color="green">602</FONT>         * @throws IllegalStateException if data has already been added<a name="line.602"></a>
+<FONT color="green">603</FONT>         *  (i.e if n &gt; 0)<a name="line.603"></a>
+<FONT color="green">604</FONT>         */<a name="line.604"></a>
+<FONT color="green">605</FONT>        public void setMeanImpl(StorelessUnivariateStatistic[] meanImpl)<a name="line.605"></a>
+<FONT color="green">606</FONT>          throws DimensionMismatchException {<a name="line.606"></a>
+<FONT color="green">607</FONT>            setImpl(meanImpl, this.meanImpl);<a name="line.607"></a>
+<FONT color="green">608</FONT>        }<a name="line.608"></a>
+<FONT color="green">609</FONT>    <a name="line.609"></a>
+<FONT color="green">610</FONT>        /**<a name="line.610"></a>
+<FONT color="green">611</FONT>         * Throws IllegalStateException if n &gt; 0.<a name="line.611"></a>
+<FONT color="green">612</FONT>         */<a name="line.612"></a>
+<FONT color="green">613</FONT>        private void checkEmpty() {<a name="line.613"></a>
+<FONT color="green">614</FONT>            if (n &gt; 0) {<a name="line.614"></a>
+<FONT color="green">615</FONT>                throw MathRuntimeException.createIllegalStateException(<a name="line.615"></a>
+<FONT color="green">616</FONT>                        "{0} values have been added before statistic is configured",<a name="line.616"></a>
+<FONT color="green">617</FONT>                        n);<a name="line.617"></a>
+<FONT color="green">618</FONT>            }<a name="line.618"></a>
+<FONT color="green">619</FONT>        }<a name="line.619"></a>
+<FONT color="green">620</FONT>    <a name="line.620"></a>
+<FONT color="green">621</FONT>        /**<a name="line.621"></a>
+<FONT color="green">622</FONT>         * Throws DimensionMismatchException if dimension != k.<a name="line.622"></a>
+<FONT color="green">623</FONT>         * @param dimension dimension to check<a name="line.623"></a>
+<FONT color="green">624</FONT>         * @throws DimensionMismatchException if dimension != k<a name="line.624"></a>
+<FONT color="green">625</FONT>         */<a name="line.625"></a>
+<FONT color="green">626</FONT>        private void checkDimension(int dimension)<a name="line.626"></a>
+<FONT color="green">627</FONT>          throws DimensionMismatchException {<a name="line.627"></a>
+<FONT color="green">628</FONT>            if (dimension != k) {<a name="line.628"></a>
+<FONT color="green">629</FONT>                throw new DimensionMismatchException(dimension, k);<a name="line.629"></a>
+<FONT color="green">630</FONT>            }<a name="line.630"></a>
+<FONT color="green">631</FONT>        }<a name="line.631"></a>
+<FONT color="green">632</FONT>    <a name="line.632"></a>
+<FONT color="green">633</FONT>    }<a name="line.633"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/StatisticalMultivariateSummary.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,186 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.linear.RealMatrix;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     *  Reporting interface for basic multivariate statistics.<a name="line.22"></a>
+<FONT color="green">023</FONT>     *<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @since 1.2<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public interface StatisticalMultivariateSummary {<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>        /**<a name="line.29"></a>
+<FONT color="green">030</FONT>         * Returns the dimension of the data<a name="line.30"></a>
+<FONT color="green">031</FONT>         * @return The dimension of the data<a name="line.31"></a>
+<FONT color="green">032</FONT>         */<a name="line.32"></a>
+<FONT color="green">033</FONT>        int getDimension();<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /**<a name="line.35"></a>
+<FONT color="green">036</FONT>         * Returns an array whose i&lt;sup&gt;th&lt;/sup&gt; entry is the<a name="line.36"></a>
+<FONT color="green">037</FONT>         * mean of the i&lt;sup&gt;th&lt;/sup&gt; entries of the arrays<a name="line.37"></a>
+<FONT color="green">038</FONT>         * that correspond to each multivariate sample<a name="line.38"></a>
+<FONT color="green">039</FONT>         *<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @return the array of component means<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        double[] getMean();<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /**<a name="line.44"></a>
+<FONT color="green">045</FONT>         * Returns the covariance of the available values.<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @return The covariance, null if no multivariate sample<a name="line.46"></a>
+<FONT color="green">047</FONT>         * have been added or a zeroed matrix for a single value set.<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        RealMatrix getCovariance();<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /**<a name="line.51"></a>
+<FONT color="green">052</FONT>         * Returns an array whose i&lt;sup&gt;th&lt;/sup&gt; entry is the<a name="line.52"></a>
+<FONT color="green">053</FONT>         * standard deviation of the i&lt;sup&gt;th&lt;/sup&gt; entries of the arrays<a name="line.53"></a>
+<FONT color="green">054</FONT>         * that correspond to each multivariate sample<a name="line.54"></a>
+<FONT color="green">055</FONT>         *<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @return the array of component standard deviations<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        double[] getStandardDeviation();<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /**<a name="line.60"></a>
+<FONT color="green">061</FONT>         * Returns an array whose i&lt;sup&gt;th&lt;/sup&gt; entry is the<a name="line.61"></a>
+<FONT color="green">062</FONT>         * maximum of the i&lt;sup&gt;th&lt;/sup&gt; entries of the arrays<a name="line.62"></a>
+<FONT color="green">063</FONT>         * that correspond to each multivariate sample<a name="line.63"></a>
+<FONT color="green">064</FONT>         *<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @return the array of component maxima<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        double[] getMax();<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * Returns an array whose i&lt;sup&gt;th&lt;/sup&gt; entry is the<a name="line.70"></a>
+<FONT color="green">071</FONT>         * minimum of the i&lt;sup&gt;th&lt;/sup&gt; entries of the arrays<a name="line.71"></a>
+<FONT color="green">072</FONT>         * that correspond to each multivariate sample<a name="line.72"></a>
+<FONT color="green">073</FONT>         *<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @return the array of component minima<a name="line.74"></a>
+<FONT color="green">075</FONT>         */<a name="line.75"></a>
+<FONT color="green">076</FONT>        double[] getMin();<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /**<a name="line.78"></a>
+<FONT color="green">079</FONT>         * Returns the number of available values<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @return The number of available values<a name="line.80"></a>
+<FONT color="green">081</FONT>         */<a name="line.81"></a>
+<FONT color="green">082</FONT>        long getN();<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /**<a name="line.84"></a>
+<FONT color="green">085</FONT>         * Returns an array whose i&lt;sup&gt;th&lt;/sup&gt; entry is the<a name="line.85"></a>
+<FONT color="green">086</FONT>         * geometric mean of the i&lt;sup&gt;th&lt;/sup&gt; entries of the arrays<a name="line.86"></a>
+<FONT color="green">087</FONT>         * that correspond to each multivariate sample<a name="line.87"></a>
+<FONT color="green">088</FONT>         *<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @return the array of component geometric means<a name="line.89"></a>
+<FONT color="green">090</FONT>         */<a name="line.90"></a>
+<FONT color="green">091</FONT>        double[] getGeometricMean();<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /**<a name="line.93"></a>
+<FONT color="green">094</FONT>         * Returns an array whose i&lt;sup&gt;th&lt;/sup&gt; entry is the<a name="line.94"></a>
+<FONT color="green">095</FONT>         * sum of the i&lt;sup&gt;th&lt;/sup&gt; entries of the arrays<a name="line.95"></a>
+<FONT color="green">096</FONT>         * that correspond to each multivariate sample<a name="line.96"></a>
+<FONT color="green">097</FONT>         *<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @return the array of component sums<a name="line.98"></a>
+<FONT color="green">099</FONT>         */<a name="line.99"></a>
+<FONT color="green">100</FONT>        double[] getSum();<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>        /**<a name="line.102"></a>
+<FONT color="green">103</FONT>         * Returns an array whose i&lt;sup&gt;th&lt;/sup&gt; entry is the<a name="line.103"></a>
+<FONT color="green">104</FONT>         * sum of squares of the i&lt;sup&gt;th&lt;/sup&gt; entries of the arrays<a name="line.104"></a>
+<FONT color="green">105</FONT>         * that correspond to each multivariate sample<a name="line.105"></a>
+<FONT color="green">106</FONT>         *<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @return the array of component sums of squares<a name="line.107"></a>
+<FONT color="green">108</FONT>         */<a name="line.108"></a>
+<FONT color="green">109</FONT>        double[] getSumSq();<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /**<a name="line.111"></a>
+<FONT color="green">112</FONT>         * Returns an array whose i&lt;sup&gt;th&lt;/sup&gt; entry is the<a name="line.112"></a>
+<FONT color="green">113</FONT>         * sum of logs of the i&lt;sup&gt;th&lt;/sup&gt; entries of the arrays<a name="line.113"></a>
+<FONT color="green">114</FONT>         * that correspond to each multivariate sample<a name="line.114"></a>
+<FONT color="green">115</FONT>         *<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @return the array of component log sums<a name="line.116"></a>
+<FONT color="green">117</FONT>         */<a name="line.117"></a>
+<FONT color="green">118</FONT>        double[] getSumLog();<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>    }<a name="line.120"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/StatisticalSummary.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,131 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     *  Reporting interface for basic univariate statistics.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>      * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.22"></a>
+<FONT color="green">023</FONT>     */<a name="line.23"></a>
+<FONT color="green">024</FONT>    public interface StatisticalSummary {<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>        /**<a name="line.26"></a>
+<FONT color="green">027</FONT>         * Returns the &lt;a href="http://www.xycoon.com/arithmetic_mean.htm"&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>         * arithmetic mean &lt;/a&gt; of the available values<a name="line.28"></a>
+<FONT color="green">029</FONT>         * @return The mean or Double.NaN if no values have been added.<a name="line.29"></a>
+<FONT color="green">030</FONT>         */<a name="line.30"></a>
+<FONT color="green">031</FONT>        double getMean();<a name="line.31"></a>
+<FONT color="green">032</FONT>        /**<a name="line.32"></a>
+<FONT color="green">033</FONT>         * Returns the variance of the available values.<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @return The variance, Double.NaN if no values have been added<a name="line.34"></a>
+<FONT color="green">035</FONT>         * or 0.0 for a single value set.<a name="line.35"></a>
+<FONT color="green">036</FONT>         */<a name="line.36"></a>
+<FONT color="green">037</FONT>        double getVariance();<a name="line.37"></a>
+<FONT color="green">038</FONT>        /**<a name="line.38"></a>
+<FONT color="green">039</FONT>         * Returns the standard deviation of the available values.<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @return The standard deviation, Double.NaN if no values have been added<a name="line.40"></a>
+<FONT color="green">041</FONT>         * or 0.0 for a single value set.<a name="line.41"></a>
+<FONT color="green">042</FONT>         */<a name="line.42"></a>
+<FONT color="green">043</FONT>        double getStandardDeviation();<a name="line.43"></a>
+<FONT color="green">044</FONT>        /**<a name="line.44"></a>
+<FONT color="green">045</FONT>         * Returns the maximum of the available values<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @return The max or Double.NaN if no values have been added.<a name="line.46"></a>
+<FONT color="green">047</FONT>         */<a name="line.47"></a>
+<FONT color="green">048</FONT>        double getMax();<a name="line.48"></a>
+<FONT color="green">049</FONT>        /**<a name="line.49"></a>
+<FONT color="green">050</FONT>        * Returns the minimum of the available values<a name="line.50"></a>
+<FONT color="green">051</FONT>        * @return The min or Double.NaN if no values have been added.<a name="line.51"></a>
+<FONT color="green">052</FONT>        */<a name="line.52"></a>
+<FONT color="green">053</FONT>        double getMin();<a name="line.53"></a>
+<FONT color="green">054</FONT>        /**<a name="line.54"></a>
+<FONT color="green">055</FONT>         * Returns the number of available values<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @return The number of available values<a name="line.56"></a>
+<FONT color="green">057</FONT>         */<a name="line.57"></a>
+<FONT color="green">058</FONT>        long getN();<a name="line.58"></a>
+<FONT color="green">059</FONT>        /**<a name="line.59"></a>
+<FONT color="green">060</FONT>         * Returns the sum of the values that have been added to Univariate.<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @return The sum or Double.NaN if no values have been added<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        double getSum();<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>    }<a name="line.65"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/StatisticalSummaryValues.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,228 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     *  Value object representing the results of a univariate statistical summary.<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 811833 $ $Date: 2009-09-06 12:27:50 -0400 (Sun, 06 Sep 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public class StatisticalSummaryValues implements Serializable,<a name="line.27"></a>
+<FONT color="green">028</FONT>        StatisticalSummary {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /** Serialization id */<a name="line.30"></a>
+<FONT color="green">031</FONT>        private static final long serialVersionUID = -5108854841843722536L;<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** The sample mean */<a name="line.33"></a>
+<FONT color="green">034</FONT>        private final double mean;<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** The sample variance */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private final double variance;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** The number of observations in the sample */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private final long n;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** The maximum value */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private final double max;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** The minimum value */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private final double min;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** The sum of the sample values */<a name="line.48"></a>
+<FONT color="green">049</FONT>        private final double sum;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /**<a name="line.51"></a>
+<FONT color="green">052</FONT>          * Constructor<a name="line.52"></a>
+<FONT color="green">053</FONT>          *<a name="line.53"></a>
+<FONT color="green">054</FONT>          * @param mean  the sample mean<a name="line.54"></a>
+<FONT color="green">055</FONT>          * @param variance  the sample variance<a name="line.55"></a>
+<FONT color="green">056</FONT>          * @param n  the number of observations in the sample<a name="line.56"></a>
+<FONT color="green">057</FONT>          * @param max  the maximum value<a name="line.57"></a>
+<FONT color="green">058</FONT>          * @param min  the minimum value<a name="line.58"></a>
+<FONT color="green">059</FONT>          * @param sum  the sum of the values<a name="line.59"></a>
+<FONT color="green">060</FONT>         */<a name="line.60"></a>
+<FONT color="green">061</FONT>        public StatisticalSummaryValues(double mean, double variance, long n,<a name="line.61"></a>
+<FONT color="green">062</FONT>            double max, double min, double sum) {<a name="line.62"></a>
+<FONT color="green">063</FONT>            super();<a name="line.63"></a>
+<FONT color="green">064</FONT>            this.mean = mean;<a name="line.64"></a>
+<FONT color="green">065</FONT>            this.variance = variance;<a name="line.65"></a>
+<FONT color="green">066</FONT>            this.n = n;<a name="line.66"></a>
+<FONT color="green">067</FONT>            this.max = max;<a name="line.67"></a>
+<FONT color="green">068</FONT>            this.min = min;<a name="line.68"></a>
+<FONT color="green">069</FONT>            this.sum = sum;<a name="line.69"></a>
+<FONT color="green">070</FONT>        }<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /**<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @return Returns the max.<a name="line.73"></a>
+<FONT color="green">074</FONT>         */<a name="line.74"></a>
+<FONT color="green">075</FONT>        public double getMax() {<a name="line.75"></a>
+<FONT color="green">076</FONT>            return max;<a name="line.76"></a>
+<FONT color="green">077</FONT>        }<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        /**<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @return Returns the mean.<a name="line.80"></a>
+<FONT color="green">081</FONT>         */<a name="line.81"></a>
+<FONT color="green">082</FONT>        public double getMean() {<a name="line.82"></a>
+<FONT color="green">083</FONT>            return mean;<a name="line.83"></a>
+<FONT color="green">084</FONT>        }<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /**<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @return Returns the min.<a name="line.87"></a>
+<FONT color="green">088</FONT>         */<a name="line.88"></a>
+<FONT color="green">089</FONT>        public double getMin() {<a name="line.89"></a>
+<FONT color="green">090</FONT>            return min;<a name="line.90"></a>
+<FONT color="green">091</FONT>        }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /**<a name="line.93"></a>
+<FONT color="green">094</FONT>         * @return Returns the number of values.<a name="line.94"></a>
+<FONT color="green">095</FONT>         */<a name="line.95"></a>
+<FONT color="green">096</FONT>        public long getN() {<a name="line.96"></a>
+<FONT color="green">097</FONT>            return n;<a name="line.97"></a>
+<FONT color="green">098</FONT>        }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>        /**<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @return Returns the sum.<a name="line.101"></a>
+<FONT color="green">102</FONT>         */<a name="line.102"></a>
+<FONT color="green">103</FONT>        public double getSum() {<a name="line.103"></a>
+<FONT color="green">104</FONT>            return sum;<a name="line.104"></a>
+<FONT color="green">105</FONT>        }<a name="line.105"></a>
+<FONT color="green">106</FONT>    <a name="line.106"></a>
+<FONT color="green">107</FONT>        /**<a name="line.107"></a>
+<FONT color="green">108</FONT>         * @return Returns the standard deviation<a name="line.108"></a>
+<FONT color="green">109</FONT>         */<a name="line.109"></a>
+<FONT color="green">110</FONT>        public double getStandardDeviation() {<a name="line.110"></a>
+<FONT color="green">111</FONT>            return Math.sqrt(variance);<a name="line.111"></a>
+<FONT color="green">112</FONT>        }<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /**<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @return Returns the variance.<a name="line.115"></a>
+<FONT color="green">116</FONT>         */<a name="line.116"></a>
+<FONT color="green">117</FONT>        public double getVariance() {<a name="line.117"></a>
+<FONT color="green">118</FONT>            return variance;<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /**<a name="line.121"></a>
+<FONT color="green">122</FONT>         * Returns true iff &lt;code&gt;object&lt;/code&gt; is a<a name="line.122"></a>
+<FONT color="green">123</FONT>         * &lt;code&gt;StatisticalSummaryValues&lt;/code&gt; instance and all statistics have<a name="line.123"></a>
+<FONT color="green">124</FONT>         *  the same values as this.<a name="line.124"></a>
+<FONT color="green">125</FONT>         *<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @param object the object to test equality against.<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @return true if object equals this<a name="line.127"></a>
+<FONT color="green">128</FONT>         */<a name="line.128"></a>
+<FONT color="green">129</FONT>        @Override<a name="line.129"></a>
+<FONT color="green">130</FONT>        public boolean equals(Object object) {<a name="line.130"></a>
+<FONT color="green">131</FONT>            if (object == this ) {<a name="line.131"></a>
+<FONT color="green">132</FONT>                return true;<a name="line.132"></a>
+<FONT color="green">133</FONT>            }<a name="line.133"></a>
+<FONT color="green">134</FONT>            if (object instanceof StatisticalSummaryValues == false) {<a name="line.134"></a>
+<FONT color="green">135</FONT>                return false;<a name="line.135"></a>
+<FONT color="green">136</FONT>            }<a name="line.136"></a>
+<FONT color="green">137</FONT>            StatisticalSummaryValues stat = (StatisticalSummaryValues) object;<a name="line.137"></a>
+<FONT color="green">138</FONT>            return MathUtils.equals(stat.getMax(),      getMax())  &amp;&amp;<a name="line.138"></a>
+<FONT color="green">139</FONT>                   MathUtils.equals(stat.getMean(),     getMean()) &amp;&amp;<a name="line.139"></a>
+<FONT color="green">140</FONT>                   MathUtils.equals(stat.getMin(),      getMin())  &amp;&amp;<a name="line.140"></a>
+<FONT color="green">141</FONT>                   MathUtils.equals(stat.getN(),        getN())    &amp;&amp;<a name="line.141"></a>
+<FONT color="green">142</FONT>                   MathUtils.equals(stat.getSum(),      getSum())  &amp;&amp;<a name="line.142"></a>
+<FONT color="green">143</FONT>                   MathUtils.equals(stat.getVariance(), getVariance());<a name="line.143"></a>
+<FONT color="green">144</FONT>        }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>        /**<a name="line.146"></a>
+<FONT color="green">147</FONT>         * Returns hash code based on values of statistics<a name="line.147"></a>
+<FONT color="green">148</FONT>         *<a name="line.148"></a>
+<FONT color="green">149</FONT>         * @return hash code<a name="line.149"></a>
+<FONT color="green">150</FONT>         */<a name="line.150"></a>
+<FONT color="green">151</FONT>        @Override<a name="line.151"></a>
+<FONT color="green">152</FONT>        public int hashCode() {<a name="line.152"></a>
+<FONT color="green">153</FONT>            int result = 31 + MathUtils.hash(getMax());<a name="line.153"></a>
+<FONT color="green">154</FONT>            result = result * 31 + MathUtils.hash(getMean());<a name="line.154"></a>
+<FONT color="green">155</FONT>            result = result * 31 + MathUtils.hash(getMin());<a name="line.155"></a>
+<FONT color="green">156</FONT>            result = result * 31 + MathUtils.hash(getN());<a name="line.156"></a>
+<FONT color="green">157</FONT>            result = result * 31 + MathUtils.hash(getSum());<a name="line.157"></a>
+<FONT color="green">158</FONT>            result = result * 31 + MathUtils.hash(getVariance());<a name="line.158"></a>
+<FONT color="green">159</FONT>            return result;<a name="line.159"></a>
+<FONT color="green">160</FONT>        }<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>    }<a name="line.162"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/StorelessUnivariateStatistic.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,152 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Extends the definition of {@link UnivariateStatistic} with<a name="line.20"></a>
+<FONT color="green">021</FONT>     * {@link #increment} and {@link #incrementAll(double[])} methods for adding<a name="line.21"></a>
+<FONT color="green">022</FONT>     * values and updating internal state.<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;p&gt;<a name="line.23"></a>
+<FONT color="green">024</FONT>     * This interface is designed to be used for calculating statistics that can be<a name="line.24"></a>
+<FONT color="green">025</FONT>     * computed in one pass through the data without storing the full array of<a name="line.25"></a>
+<FONT color="green">026</FONT>     * sample values.&lt;/p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public interface StorelessUnivariateStatistic extends UnivariateStatistic {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /**<a name="line.32"></a>
+<FONT color="green">033</FONT>         * Updates the internal state of the statistic to reflect the addition of the new value.<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @param d  the new value.<a name="line.34"></a>
+<FONT color="green">035</FONT>         */<a name="line.35"></a>
+<FONT color="green">036</FONT>        void increment(double d);<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /**<a name="line.38"></a>
+<FONT color="green">039</FONT>         * Updates the internal state of the statistic to reflect addition of<a name="line.39"></a>
+<FONT color="green">040</FONT>         * all values in the values array.  Does not clear the statistic first --<a name="line.40"></a>
+<FONT color="green">041</FONT>         * i.e., the values are added &lt;strong&gt;incrementally&lt;/strong&gt; to the dataset.<a name="line.41"></a>
+<FONT color="green">042</FONT>         *<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @param values  array holding the new values to add<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @throws IllegalArgumentException if the array is null<a name="line.44"></a>
+<FONT color="green">045</FONT>         */<a name="line.45"></a>
+<FONT color="green">046</FONT>        void incrementAll(double[] values);<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /**<a name="line.48"></a>
+<FONT color="green">049</FONT>         * Updates the internal state of the statistic to reflect addition of<a name="line.49"></a>
+<FONT color="green">050</FONT>         * the values in the designated portion of the values array.  Does not<a name="line.50"></a>
+<FONT color="green">051</FONT>         * clear the statistic first -- i.e., the values are added<a name="line.51"></a>
+<FONT color="green">052</FONT>         * &lt;strong&gt;incrementally&lt;/strong&gt; to the dataset.<a name="line.52"></a>
+<FONT color="green">053</FONT>         *<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @param values  array holding the new values to add<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param start  the array index of the first value to add<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param length  the number of elements to add<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @throws IllegalArgumentException if the array is null or the index<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        void incrementAll(double[] values, int start, int length);<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Returns the current value of the Statistic.<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @return value of the statistic, &lt;code&gt;Double.NaN&lt;/code&gt; if it<a name="line.63"></a>
+<FONT color="green">064</FONT>         * has been cleared or just instantiated.<a name="line.64"></a>
+<FONT color="green">065</FONT>         */<a name="line.65"></a>
+<FONT color="green">066</FONT>        double getResult();<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /**<a name="line.68"></a>
+<FONT color="green">069</FONT>         * Returns the number of values that have been added.<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @return the number of values.<a name="line.70"></a>
+<FONT color="green">071</FONT>         */<a name="line.71"></a>
+<FONT color="green">072</FONT>        long getN();<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /**<a name="line.74"></a>
+<FONT color="green">075</FONT>         * Clears the internal state of the Statistic<a name="line.75"></a>
+<FONT color="green">076</FONT>         */<a name="line.76"></a>
+<FONT color="green">077</FONT>        void clear();<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        /**<a name="line.79"></a>
+<FONT color="green">080</FONT>         * Returns a copy of the statistic with the same internal state.<a name="line.80"></a>
+<FONT color="green">081</FONT>         *<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @return a copy of the statistic<a name="line.82"></a>
+<FONT color="green">083</FONT>         */<a name="line.83"></a>
+<FONT color="green">084</FONT>        StorelessUnivariateStatistic copy();<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>    }<a name="line.86"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/SummaryStatistics.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,781 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.stat.descriptive.moment.GeometricMean;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.stat.descriptive.moment.Mean;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.stat.descriptive.moment.SecondMoment;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.stat.descriptive.moment.Variance;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.stat.descriptive.rank.Max;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.stat.descriptive.rank.Min;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.stat.descriptive.summary.Sum;<a name="line.28"></a>
+<FONT color="green">029</FONT>    import org.apache.commons.math.stat.descriptive.summary.SumOfLogs;<a name="line.29"></a>
+<FONT color="green">030</FONT>    import org.apache.commons.math.stat.descriptive.summary.SumOfSquares;<a name="line.30"></a>
+<FONT color="green">031</FONT>    import org.apache.commons.math.util.MathUtils;<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>    /**<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * Computes summary statistics for a stream of data values added using the<a name="line.35"></a>
+<FONT color="green">036</FONT>     * {@link #addValue(double) addValue} method. The data values are not stored in<a name="line.36"></a>
+<FONT color="green">037</FONT>     * memory, so this class can be used to compute statistics for very large data<a name="line.37"></a>
+<FONT color="green">038</FONT>     * streams.<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;/p&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * The {@link StorelessUnivariateStatistic} instances used to maintain summary<a name="line.41"></a>
+<FONT color="green">042</FONT>     * state and compute statistics are configurable via setters. For example, the<a name="line.42"></a>
+<FONT color="green">043</FONT>     * default implementation for the variance can be overridden by calling<a name="line.43"></a>
+<FONT color="green">044</FONT>     * {@link #setVarianceImpl(StorelessUnivariateStatistic)}. Actual parameters to<a name="line.44"></a>
+<FONT color="green">045</FONT>     * these methods must implement the {@link StorelessUnivariateStatistic}<a name="line.45"></a>
+<FONT color="green">046</FONT>     * interface and configuration must be completed before &lt;code&gt;addValue&lt;/code&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     * is called. No configuration is necessary to use the default, commons-math<a name="line.47"></a>
+<FONT color="green">048</FONT>     * provided implementations.<a name="line.48"></a>
+<FONT color="green">049</FONT>     * &lt;/p&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     * &lt;p&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>     * Note: This class is not thread-safe. Use<a name="line.51"></a>
+<FONT color="green">052</FONT>     * {@link SynchronizedSummaryStatistics} if concurrent access from multiple<a name="line.52"></a>
+<FONT color="green">053</FONT>     * threads is required.<a name="line.53"></a>
+<FONT color="green">054</FONT>     * &lt;/p&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>     * @version $Revision: 811833 $ $Date: 2009-09-06 12:27:50 -0400 (Sun, 06 Sep 2009) $<a name="line.55"></a>
+<FONT color="green">056</FONT>     */<a name="line.56"></a>
+<FONT color="green">057</FONT>    public class SummaryStatistics implements StatisticalSummary, Serializable {<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** Serialization UID */<a name="line.59"></a>
+<FONT color="green">060</FONT>        private static final long serialVersionUID = -2021321786743555871L;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** count of values that have been added */<a name="line.62"></a>
+<FONT color="green">063</FONT>        protected long n = 0;<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** SecondMoment is used to compute the mean and variance */<a name="line.65"></a>
+<FONT color="green">066</FONT>        protected SecondMoment secondMoment = new SecondMoment();<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /** sum of values that have been added */<a name="line.68"></a>
+<FONT color="green">069</FONT>        protected Sum sum = new Sum();<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** sum of the square of each value that has been added */<a name="line.71"></a>
+<FONT color="green">072</FONT>        protected SumOfSquares sumsq = new SumOfSquares();<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /** min of values that have been added */<a name="line.74"></a>
+<FONT color="green">075</FONT>        protected Min min = new Min();<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** max of values that have been added */<a name="line.77"></a>
+<FONT color="green">078</FONT>        protected Max max = new Max();<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /** sumLog of values that have been added */<a name="line.80"></a>
+<FONT color="green">081</FONT>        protected SumOfLogs sumLog = new SumOfLogs();<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /** geoMean of values that have been added */<a name="line.83"></a>
+<FONT color="green">084</FONT>        protected GeometricMean geoMean = new GeometricMean(sumLog);<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /** mean of values that have been added */<a name="line.86"></a>
+<FONT color="green">087</FONT>        protected Mean mean = new Mean();<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /** variance of values that have been added */<a name="line.89"></a>
+<FONT color="green">090</FONT>        protected Variance variance = new Variance();<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /** Sum statistic implementation - can be reset by setter. */<a name="line.92"></a>
+<FONT color="green">093</FONT>        private StorelessUnivariateStatistic sumImpl = sum;<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /** Sum of squares statistic implementation - can be reset by setter. */<a name="line.95"></a>
+<FONT color="green">096</FONT>        private StorelessUnivariateStatistic sumsqImpl = sumsq;<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /** Minimum statistic implementation - can be reset by setter. */<a name="line.98"></a>
+<FONT color="green">099</FONT>        private StorelessUnivariateStatistic minImpl = min;<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /** Maximum statistic implementation - can be reset by setter. */<a name="line.101"></a>
+<FONT color="green">102</FONT>        private StorelessUnivariateStatistic maxImpl = max;<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /** Sum of log statistic implementation - can be reset by setter. */<a name="line.104"></a>
+<FONT color="green">105</FONT>        private StorelessUnivariateStatistic sumLogImpl = sumLog;<a name="line.105"></a>
+<FONT color="green">106</FONT>    <a name="line.106"></a>
+<FONT color="green">107</FONT>        /** Geometric mean statistic implementation - can be reset by setter. */<a name="line.107"></a>
+<FONT color="green">108</FONT>        private StorelessUnivariateStatistic geoMeanImpl = geoMean;<a name="line.108"></a>
+<FONT color="green">109</FONT>    <a name="line.109"></a>
+<FONT color="green">110</FONT>        /** Mean statistic implementation - can be reset by setter. */<a name="line.110"></a>
+<FONT color="green">111</FONT>        private StorelessUnivariateStatistic meanImpl = mean;<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>        /** Variance statistic implementation - can be reset by setter. */<a name="line.113"></a>
+<FONT color="green">114</FONT>        private StorelessUnivariateStatistic varianceImpl = variance;<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>        /**<a name="line.116"></a>
+<FONT color="green">117</FONT>         * Construct a SummaryStatistics instance<a name="line.117"></a>
+<FONT color="green">118</FONT>         */<a name="line.118"></a>
+<FONT color="green">119</FONT>        public SummaryStatistics() {<a name="line.119"></a>
+<FONT color="green">120</FONT>        }<a name="line.120"></a>
+<FONT color="green">121</FONT>    <a name="line.121"></a>
+<FONT color="green">122</FONT>        /**<a name="line.122"></a>
+<FONT color="green">123</FONT>         * A copy constructor. Creates a deep-copy of the {@code original}.<a name="line.123"></a>
+<FONT color="green">124</FONT>         *<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @param original the {@code SummaryStatistics} instance to copy<a name="line.125"></a>
+<FONT color="green">126</FONT>         */<a name="line.126"></a>
+<FONT color="green">127</FONT>        public SummaryStatistics(SummaryStatistics original) {<a name="line.127"></a>
+<FONT color="green">128</FONT>            copy(original, this);<a name="line.128"></a>
+<FONT color="green">129</FONT>        }<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>        /**<a name="line.131"></a>
+<FONT color="green">132</FONT>         * Return a {@link StatisticalSummaryValues} instance reporting current<a name="line.132"></a>
+<FONT color="green">133</FONT>         * statistics.<a name="line.133"></a>
+<FONT color="green">134</FONT>         * @return Current values of statistics<a name="line.134"></a>
+<FONT color="green">135</FONT>         */<a name="line.135"></a>
+<FONT color="green">136</FONT>        public StatisticalSummary getSummary() {<a name="line.136"></a>
+<FONT color="green">137</FONT>            return new StatisticalSummaryValues(getMean(), getVariance(), getN(),<a name="line.137"></a>
+<FONT color="green">138</FONT>                    getMax(), getMin(), getSum());<a name="line.138"></a>
+<FONT color="green">139</FONT>        }<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>        /**<a name="line.141"></a>
+<FONT color="green">142</FONT>         * Add a value to the data<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @param value the value to add<a name="line.143"></a>
+<FONT color="green">144</FONT>         */<a name="line.144"></a>
+<FONT color="green">145</FONT>        public void addValue(double value) {<a name="line.145"></a>
+<FONT color="green">146</FONT>            sumImpl.increment(value);<a name="line.146"></a>
+<FONT color="green">147</FONT>            sumsqImpl.increment(value);<a name="line.147"></a>
+<FONT color="green">148</FONT>            minImpl.increment(value);<a name="line.148"></a>
+<FONT color="green">149</FONT>            maxImpl.increment(value);<a name="line.149"></a>
+<FONT color="green">150</FONT>            sumLogImpl.increment(value);<a name="line.150"></a>
+<FONT color="green">151</FONT>            secondMoment.increment(value);<a name="line.151"></a>
+<FONT color="green">152</FONT>            // If mean, variance or geomean have been overridden,<a name="line.152"></a>
+<FONT color="green">153</FONT>            // need to increment these<a name="line.153"></a>
+<FONT color="green">154</FONT>            if (!(meanImpl instanceof Mean)) {<a name="line.154"></a>
+<FONT color="green">155</FONT>                meanImpl.increment(value);<a name="line.155"></a>
+<FONT color="green">156</FONT>            }<a name="line.156"></a>
+<FONT color="green">157</FONT>            if (!(varianceImpl instanceof Variance)) {<a name="line.157"></a>
+<FONT color="green">158</FONT>                varianceImpl.increment(value);<a name="line.158"></a>
+<FONT color="green">159</FONT>            }<a name="line.159"></a>
+<FONT color="green">160</FONT>            if (!(geoMeanImpl instanceof GeometricMean)) {<a name="line.160"></a>
+<FONT color="green">161</FONT>                geoMeanImpl.increment(value);<a name="line.161"></a>
+<FONT color="green">162</FONT>            }<a name="line.162"></a>
+<FONT color="green">163</FONT>            n++;<a name="line.163"></a>
+<FONT color="green">164</FONT>        }<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>        /**<a name="line.166"></a>
+<FONT color="green">167</FONT>         * Returns the number of available values<a name="line.167"></a>
+<FONT color="green">168</FONT>         * @return The number of available values<a name="line.168"></a>
+<FONT color="green">169</FONT>         */<a name="line.169"></a>
+<FONT color="green">170</FONT>        public long getN() {<a name="line.170"></a>
+<FONT color="green">171</FONT>            return n;<a name="line.171"></a>
+<FONT color="green">172</FONT>        }<a name="line.172"></a>
+<FONT color="green">173</FONT>    <a name="line.173"></a>
+<FONT color="green">174</FONT>        /**<a name="line.174"></a>
+<FONT color="green">175</FONT>         * Returns the sum of the values that have been added<a name="line.175"></a>
+<FONT color="green">176</FONT>         * @return The sum or &lt;code&gt;Double.NaN&lt;/code&gt; if no values have been added<a name="line.176"></a>
+<FONT color="green">177</FONT>         */<a name="line.177"></a>
+<FONT color="green">178</FONT>        public double getSum() {<a name="line.178"></a>
+<FONT color="green">179</FONT>            return sumImpl.getResult();<a name="line.179"></a>
+<FONT color="green">180</FONT>        }<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>        /**<a name="line.182"></a>
+<FONT color="green">183</FONT>         * Returns the sum of the squares of the values that have been added.<a name="line.183"></a>
+<FONT color="green">184</FONT>         * &lt;p&gt;<a name="line.184"></a>
+<FONT color="green">185</FONT>         * Double.NaN is returned if no values have been added.<a name="line.185"></a>
+<FONT color="green">186</FONT>         * &lt;/p&gt;<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @return The sum of squares<a name="line.187"></a>
+<FONT color="green">188</FONT>         */<a name="line.188"></a>
+<FONT color="green">189</FONT>        public double getSumsq() {<a name="line.189"></a>
+<FONT color="green">190</FONT>            return sumsqImpl.getResult();<a name="line.190"></a>
+<FONT color="green">191</FONT>        }<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>        /**<a name="line.193"></a>
+<FONT color="green">194</FONT>         * Returns the mean of the values that have been added.<a name="line.194"></a>
+<FONT color="green">195</FONT>         * &lt;p&gt;<a name="line.195"></a>
+<FONT color="green">196</FONT>         * Double.NaN is returned if no values have been added.<a name="line.196"></a>
+<FONT color="green">197</FONT>         * &lt;/p&gt;<a name="line.197"></a>
+<FONT color="green">198</FONT>         * @return the mean<a name="line.198"></a>
+<FONT color="green">199</FONT>         */<a name="line.199"></a>
+<FONT color="green">200</FONT>        public double getMean() {<a name="line.200"></a>
+<FONT color="green">201</FONT>            if (mean == meanImpl) {<a name="line.201"></a>
+<FONT color="green">202</FONT>                return new Mean(secondMoment).getResult();<a name="line.202"></a>
+<FONT color="green">203</FONT>            } else {<a name="line.203"></a>
+<FONT color="green">204</FONT>                return meanImpl.getResult();<a name="line.204"></a>
+<FONT color="green">205</FONT>            }<a name="line.205"></a>
+<FONT color="green">206</FONT>        }<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>        /**<a name="line.208"></a>
+<FONT color="green">209</FONT>         * Returns the standard deviation of the values that have been added.<a name="line.209"></a>
+<FONT color="green">210</FONT>         * &lt;p&gt;<a name="line.210"></a>
+<FONT color="green">211</FONT>         * Double.NaN is returned if no values have been added.<a name="line.211"></a>
+<FONT color="green">212</FONT>         * &lt;/p&gt;<a name="line.212"></a>
+<FONT color="green">213</FONT>         * @return the standard deviation<a name="line.213"></a>
+<FONT color="green">214</FONT>         */<a name="line.214"></a>
+<FONT color="green">215</FONT>        public double getStandardDeviation() {<a name="line.215"></a>
+<FONT color="green">216</FONT>            double stdDev = Double.NaN;<a name="line.216"></a>
+<FONT color="green">217</FONT>            if (getN() &gt; 0) {<a name="line.217"></a>
+<FONT color="green">218</FONT>                if (getN() &gt; 1) {<a name="line.218"></a>
+<FONT color="green">219</FONT>                    stdDev = Math.sqrt(getVariance());<a name="line.219"></a>
+<FONT color="green">220</FONT>                } else {<a name="line.220"></a>
+<FONT color="green">221</FONT>                    stdDev = 0.0;<a name="line.221"></a>
+<FONT color="green">222</FONT>                }<a name="line.222"></a>
+<FONT color="green">223</FONT>            }<a name="line.223"></a>
+<FONT color="green">224</FONT>            return stdDev;<a name="line.224"></a>
+<FONT color="green">225</FONT>        }<a name="line.225"></a>
+<FONT color="green">226</FONT>    <a name="line.226"></a>
+<FONT color="green">227</FONT>        /**<a name="line.227"></a>
+<FONT color="green">228</FONT>         * Returns the variance of the values that have been added.<a name="line.228"></a>
+<FONT color="green">229</FONT>         * &lt;p&gt;<a name="line.229"></a>
+<FONT color="green">230</FONT>         * Double.NaN is returned if no values have been added.<a name="line.230"></a>
+<FONT color="green">231</FONT>         * &lt;/p&gt;<a name="line.231"></a>
+<FONT color="green">232</FONT>         * @return the variance<a name="line.232"></a>
+<FONT color="green">233</FONT>         */<a name="line.233"></a>
+<FONT color="green">234</FONT>        public double getVariance() {<a name="line.234"></a>
+<FONT color="green">235</FONT>            if (varianceImpl == variance) {<a name="line.235"></a>
+<FONT color="green">236</FONT>                return new Variance(secondMoment).getResult();<a name="line.236"></a>
+<FONT color="green">237</FONT>            } else {<a name="line.237"></a>
+<FONT color="green">238</FONT>                return varianceImpl.getResult();<a name="line.238"></a>
+<FONT color="green">239</FONT>            }<a name="line.239"></a>
+<FONT color="green">240</FONT>        }<a name="line.240"></a>
+<FONT color="green">241</FONT>    <a name="line.241"></a>
+<FONT color="green">242</FONT>        /**<a name="line.242"></a>
+<FONT color="green">243</FONT>         * Returns the maximum of the values that have been added.<a name="line.243"></a>
+<FONT color="green">244</FONT>         * &lt;p&gt;<a name="line.244"></a>
+<FONT color="green">245</FONT>         * Double.NaN is returned if no values have been added.<a name="line.245"></a>
+<FONT color="green">246</FONT>         * &lt;/p&gt;<a name="line.246"></a>
+<FONT color="green">247</FONT>         * @return the maximum<a name="line.247"></a>
+<FONT color="green">248</FONT>         */<a name="line.248"></a>
+<FONT color="green">249</FONT>        public double getMax() {<a name="line.249"></a>
+<FONT color="green">250</FONT>            return maxImpl.getResult();<a name="line.250"></a>
+<FONT color="green">251</FONT>        }<a name="line.251"></a>
+<FONT color="green">252</FONT>    <a name="line.252"></a>
+<FONT color="green">253</FONT>        /**<a name="line.253"></a>
+<FONT color="green">254</FONT>         * Returns the minimum of the values that have been added.<a name="line.254"></a>
+<FONT color="green">255</FONT>         * &lt;p&gt;<a name="line.255"></a>
+<FONT color="green">256</FONT>         * Double.NaN is returned if no values have been added.<a name="line.256"></a>
+<FONT color="green">257</FONT>         * &lt;/p&gt;<a name="line.257"></a>
+<FONT color="green">258</FONT>         * @return the minimum<a name="line.258"></a>
+<FONT color="green">259</FONT>         */<a name="line.259"></a>
+<FONT color="green">260</FONT>        public double getMin() {<a name="line.260"></a>
+<FONT color="green">261</FONT>            return minImpl.getResult();<a name="line.261"></a>
+<FONT color="green">262</FONT>        }<a name="line.262"></a>
+<FONT color="green">263</FONT>    <a name="line.263"></a>
+<FONT color="green">264</FONT>        /**<a name="line.264"></a>
+<FONT color="green">265</FONT>         * Returns the geometric mean of the values that have been added.<a name="line.265"></a>
+<FONT color="green">266</FONT>         * &lt;p&gt;<a name="line.266"></a>
+<FONT color="green">267</FONT>         * Double.NaN is returned if no values have been added.<a name="line.267"></a>
+<FONT color="green">268</FONT>         * &lt;/p&gt;<a name="line.268"></a>
+<FONT color="green">269</FONT>         * @return the geometric mean<a name="line.269"></a>
+<FONT color="green">270</FONT>         */<a name="line.270"></a>
+<FONT color="green">271</FONT>        public double getGeometricMean() {<a name="line.271"></a>
+<FONT color="green">272</FONT>            return geoMeanImpl.getResult();<a name="line.272"></a>
+<FONT color="green">273</FONT>        }<a name="line.273"></a>
+<FONT color="green">274</FONT>    <a name="line.274"></a>
+<FONT color="green">275</FONT>        /**<a name="line.275"></a>
+<FONT color="green">276</FONT>         * Returns the sum of the logs of the values that have been added.<a name="line.276"></a>
+<FONT color="green">277</FONT>         * &lt;p&gt;<a name="line.277"></a>
+<FONT color="green">278</FONT>         * Double.NaN is returned if no values have been added.<a name="line.278"></a>
+<FONT color="green">279</FONT>         * &lt;/p&gt;<a name="line.279"></a>
+<FONT color="green">280</FONT>         * @return the sum of logs<a name="line.280"></a>
+<FONT color="green">281</FONT>         * @since 1.2<a name="line.281"></a>
+<FONT color="green">282</FONT>         */<a name="line.282"></a>
+<FONT color="green">283</FONT>        public double getSumOfLogs() {<a name="line.283"></a>
+<FONT color="green">284</FONT>            return sumLogImpl.getResult();<a name="line.284"></a>
+<FONT color="green">285</FONT>        }<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>        /**<a name="line.287"></a>
+<FONT color="green">288</FONT>         * Returns a statistic related to the Second Central Moment.  Specifically,<a name="line.288"></a>
+<FONT color="green">289</FONT>         * what is returned is the sum of squared deviations from the sample mean<a name="line.289"></a>
+<FONT color="green">290</FONT>         * among the values that have been added.<a name="line.290"></a>
+<FONT color="green">291</FONT>         * &lt;p&gt;<a name="line.291"></a>
+<FONT color="green">292</FONT>         * Returns &lt;code&gt;Double.NaN&lt;/code&gt; if no data values have been added and<a name="line.292"></a>
+<FONT color="green">293</FONT>         * returns &lt;code&gt;0&lt;/code&gt; if there is just one value in the data set.&lt;/p&gt;<a name="line.293"></a>
+<FONT color="green">294</FONT>         * &lt;p&gt;<a name="line.294"></a>
+<FONT color="green">295</FONT>         * @return second central moment statistic<a name="line.295"></a>
+<FONT color="green">296</FONT>         * @since 2.0<a name="line.296"></a>
+<FONT color="green">297</FONT>         */<a name="line.297"></a>
+<FONT color="green">298</FONT>        public double getSecondMoment() {<a name="line.298"></a>
+<FONT color="green">299</FONT>            return secondMoment.getResult();<a name="line.299"></a>
+<FONT color="green">300</FONT>        }<a name="line.300"></a>
+<FONT color="green">301</FONT>    <a name="line.301"></a>
+<FONT color="green">302</FONT>        /**<a name="line.302"></a>
+<FONT color="green">303</FONT>         * Generates a text report displaying summary statistics from values that<a name="line.303"></a>
+<FONT color="green">304</FONT>         * have been added.<a name="line.304"></a>
+<FONT color="green">305</FONT>         * @return String with line feeds displaying statistics<a name="line.305"></a>
+<FONT color="green">306</FONT>         * @since 1.2<a name="line.306"></a>
+<FONT color="green">307</FONT>         */<a name="line.307"></a>
+<FONT color="green">308</FONT>        @Override<a name="line.308"></a>
+<FONT color="green">309</FONT>        public String toString() {<a name="line.309"></a>
+<FONT color="green">310</FONT>            StringBuffer outBuffer = new StringBuffer();<a name="line.310"></a>
+<FONT color="green">311</FONT>            String endl = "\n";<a name="line.311"></a>
+<FONT color="green">312</FONT>            outBuffer.append("SummaryStatistics:").append(endl);<a name="line.312"></a>
+<FONT color="green">313</FONT>            outBuffer.append("n: ").append(getN()).append(endl);<a name="line.313"></a>
+<FONT color="green">314</FONT>            outBuffer.append("min: ").append(getMin()).append(endl);<a name="line.314"></a>
+<FONT color="green">315</FONT>            outBuffer.append("max: ").append(getMax()).append(endl);<a name="line.315"></a>
+<FONT color="green">316</FONT>            outBuffer.append("mean: ").append(getMean()).append(endl);<a name="line.316"></a>
+<FONT color="green">317</FONT>            outBuffer.append("geometric mean: ").append(getGeometricMean())<a name="line.317"></a>
+<FONT color="green">318</FONT>                .append(endl);<a name="line.318"></a>
+<FONT color="green">319</FONT>            outBuffer.append("variance: ").append(getVariance()).append(endl);<a name="line.319"></a>
+<FONT color="green">320</FONT>            outBuffer.append("sum of squares: ").append(getSumsq()).append(endl);<a name="line.320"></a>
+<FONT color="green">321</FONT>            outBuffer.append("standard deviation: ").append(getStandardDeviation())<a name="line.321"></a>
+<FONT color="green">322</FONT>                .append(endl);<a name="line.322"></a>
+<FONT color="green">323</FONT>            outBuffer.append("sum of logs: ").append(getSumOfLogs()).append(endl);<a name="line.323"></a>
+<FONT color="green">324</FONT>            return outBuffer.toString();<a name="line.324"></a>
+<FONT color="green">325</FONT>        }<a name="line.325"></a>
+<FONT color="green">326</FONT>    <a name="line.326"></a>
+<FONT color="green">327</FONT>        /**<a name="line.327"></a>
+<FONT color="green">328</FONT>         * Resets all statistics and storage<a name="line.328"></a>
+<FONT color="green">329</FONT>         */<a name="line.329"></a>
+<FONT color="green">330</FONT>        public void clear() {<a name="line.330"></a>
+<FONT color="green">331</FONT>            this.n = 0;<a name="line.331"></a>
+<FONT color="green">332</FONT>            minImpl.clear();<a name="line.332"></a>
+<FONT color="green">333</FONT>            maxImpl.clear();<a name="line.333"></a>
+<FONT color="green">334</FONT>            sumImpl.clear();<a name="line.334"></a>
+<FONT color="green">335</FONT>            sumLogImpl.clear();<a name="line.335"></a>
+<FONT color="green">336</FONT>            sumsqImpl.clear();<a name="line.336"></a>
+<FONT color="green">337</FONT>            geoMeanImpl.clear();<a name="line.337"></a>
+<FONT color="green">338</FONT>            secondMoment.clear();<a name="line.338"></a>
+<FONT color="green">339</FONT>            if (meanImpl != mean) {<a name="line.339"></a>
+<FONT color="green">340</FONT>                meanImpl.clear();<a name="line.340"></a>
+<FONT color="green">341</FONT>            }<a name="line.341"></a>
+<FONT color="green">342</FONT>            if (varianceImpl != variance) {<a name="line.342"></a>
+<FONT color="green">343</FONT>                varianceImpl.clear();<a name="line.343"></a>
+<FONT color="green">344</FONT>            }<a name="line.344"></a>
+<FONT color="green">345</FONT>        }<a name="line.345"></a>
+<FONT color="green">346</FONT>    <a name="line.346"></a>
+<FONT color="green">347</FONT>        /**<a name="line.347"></a>
+<FONT color="green">348</FONT>         * Returns true iff &lt;code&gt;object&lt;/code&gt; is a<a name="line.348"></a>
+<FONT color="green">349</FONT>         * &lt;code&gt;SummaryStatistics&lt;/code&gt; instance and all statistics have the<a name="line.349"></a>
+<FONT color="green">350</FONT>         * same values as this.<a name="line.350"></a>
+<FONT color="green">351</FONT>         * @param object the object to test equality against.<a name="line.351"></a>
+<FONT color="green">352</FONT>         * @return true if object equals this<a name="line.352"></a>
+<FONT color="green">353</FONT>         */<a name="line.353"></a>
+<FONT color="green">354</FONT>        @Override<a name="line.354"></a>
+<FONT color="green">355</FONT>        public boolean equals(Object object) {<a name="line.355"></a>
+<FONT color="green">356</FONT>            if (object == this) {<a name="line.356"></a>
+<FONT color="green">357</FONT>                return true;<a name="line.357"></a>
+<FONT color="green">358</FONT>            }<a name="line.358"></a>
+<FONT color="green">359</FONT>            if (object instanceof SummaryStatistics == false) {<a name="line.359"></a>
+<FONT color="green">360</FONT>                return false;<a name="line.360"></a>
+<FONT color="green">361</FONT>            }<a name="line.361"></a>
+<FONT color="green">362</FONT>            SummaryStatistics stat = (SummaryStatistics)object;<a name="line.362"></a>
+<FONT color="green">363</FONT>            return MathUtils.equals(stat.getGeometricMean(), getGeometricMean()) &amp;&amp;<a name="line.363"></a>
+<FONT color="green">364</FONT>                   MathUtils.equals(stat.getMax(),           getMax())           &amp;&amp;<a name="line.364"></a>
+<FONT color="green">365</FONT>                   MathUtils.equals(stat.getMean(),          getMean())          &amp;&amp;<a name="line.365"></a>
+<FONT color="green">366</FONT>                   MathUtils.equals(stat.getMin(),           getMin())           &amp;&amp;<a name="line.366"></a>
+<FONT color="green">367</FONT>                   MathUtils.equals(stat.getN(),             getN())             &amp;&amp;<a name="line.367"></a>
+<FONT color="green">368</FONT>                   MathUtils.equals(stat.getSum(),           getSum())           &amp;&amp;<a name="line.368"></a>
+<FONT color="green">369</FONT>                   MathUtils.equals(stat.getSumsq(),         getSumsq())         &amp;&amp;<a name="line.369"></a>
+<FONT color="green">370</FONT>                   MathUtils.equals(stat.getVariance(),      getVariance());<a name="line.370"></a>
+<FONT color="green">371</FONT>        }<a name="line.371"></a>
+<FONT color="green">372</FONT>    <a name="line.372"></a>
+<FONT color="green">373</FONT>        /**<a name="line.373"></a>
+<FONT color="green">374</FONT>         * Returns hash code based on values of statistics<a name="line.374"></a>
+<FONT color="green">375</FONT>         * @return hash code<a name="line.375"></a>
+<FONT color="green">376</FONT>         */<a name="line.376"></a>
+<FONT color="green">377</FONT>        @Override<a name="line.377"></a>
+<FONT color="green">378</FONT>        public int hashCode() {<a name="line.378"></a>
+<FONT color="green">379</FONT>            int result = 31 + MathUtils.hash(getGeometricMean());<a name="line.379"></a>
+<FONT color="green">380</FONT>            result = result * 31 + MathUtils.hash(getGeometricMean());<a name="line.380"></a>
+<FONT color="green">381</FONT>            result = result * 31 + MathUtils.hash(getMax());<a name="line.381"></a>
+<FONT color="green">382</FONT>            result = result * 31 + MathUtils.hash(getMean());<a name="line.382"></a>
+<FONT color="green">383</FONT>            result = result * 31 + MathUtils.hash(getMin());<a name="line.383"></a>
+<FONT color="green">384</FONT>            result = result * 31 + MathUtils.hash(getN());<a name="line.384"></a>
+<FONT color="green">385</FONT>            result = result * 31 + MathUtils.hash(getSum());<a name="line.385"></a>
+<FONT color="green">386</FONT>            result = result * 31 + MathUtils.hash(getSumsq());<a name="line.386"></a>
+<FONT color="green">387</FONT>            result = result * 31 + MathUtils.hash(getVariance());<a name="line.387"></a>
+<FONT color="green">388</FONT>            return result;<a name="line.388"></a>
+<FONT color="green">389</FONT>        }<a name="line.389"></a>
+<FONT color="green">390</FONT>    <a name="line.390"></a>
+<FONT color="green">391</FONT>        // Getters and setters for statistics implementations<a name="line.391"></a>
+<FONT color="green">392</FONT>        /**<a name="line.392"></a>
+<FONT color="green">393</FONT>         * Returns the currently configured Sum implementation<a name="line.393"></a>
+<FONT color="green">394</FONT>         * @return the StorelessUnivariateStatistic implementing the sum<a name="line.394"></a>
+<FONT color="green">395</FONT>         * @since 1.2<a name="line.395"></a>
+<FONT color="green">396</FONT>         */<a name="line.396"></a>
+<FONT color="green">397</FONT>        public StorelessUnivariateStatistic getSumImpl() {<a name="line.397"></a>
+<FONT color="green">398</FONT>            return sumImpl;<a name="line.398"></a>
+<FONT color="green">399</FONT>        }<a name="line.399"></a>
+<FONT color="green">400</FONT>    <a name="line.400"></a>
+<FONT color="green">401</FONT>        /**<a name="line.401"></a>
+<FONT color="green">402</FONT>         * &lt;p&gt;<a name="line.402"></a>
+<FONT color="green">403</FONT>         * Sets the implementation for the Sum.<a name="line.403"></a>
+<FONT color="green">404</FONT>         * &lt;/p&gt;<a name="line.404"></a>
+<FONT color="green">405</FONT>         * &lt;p&gt;<a name="line.405"></a>
+<FONT color="green">406</FONT>         * This method must be activated before any data has been added - i.e.,<a name="line.406"></a>
+<FONT color="green">407</FONT>         * before {@link #addValue(double) addValue} has been used to add data;<a name="line.407"></a>
+<FONT color="green">408</FONT>         * otherwise an IllegalStateException will be thrown.<a name="line.408"></a>
+<FONT color="green">409</FONT>         * &lt;/p&gt;<a name="line.409"></a>
+<FONT color="green">410</FONT>         * @param sumImpl the StorelessUnivariateStatistic instance to use for<a name="line.410"></a>
+<FONT color="green">411</FONT>         *        computing the Sum<a name="line.411"></a>
+<FONT color="green">412</FONT>         * @throws IllegalStateException if data has already been added (i.e if n &gt;<a name="line.412"></a>
+<FONT color="green">413</FONT>         *         0)<a name="line.413"></a>
+<FONT color="green">414</FONT>         * @since 1.2<a name="line.414"></a>
+<FONT color="green">415</FONT>         */<a name="line.415"></a>
+<FONT color="green">416</FONT>        public void setSumImpl(StorelessUnivariateStatistic sumImpl) {<a name="line.416"></a>
+<FONT color="green">417</FONT>            checkEmpty();<a name="line.417"></a>
+<FONT color="green">418</FONT>            this.sumImpl = sumImpl;<a name="line.418"></a>
+<FONT color="green">419</FONT>        }<a name="line.419"></a>
+<FONT color="green">420</FONT>    <a name="line.420"></a>
+<FONT color="green">421</FONT>        /**<a name="line.421"></a>
+<FONT color="green">422</FONT>         * Returns the currently configured sum of squares implementation<a name="line.422"></a>
+<FONT color="green">423</FONT>         * @return the StorelessUnivariateStatistic implementing the sum of squares<a name="line.423"></a>
+<FONT color="green">424</FONT>         * @since 1.2<a name="line.424"></a>
+<FONT color="green">425</FONT>         */<a name="line.425"></a>
+<FONT color="green">426</FONT>        public StorelessUnivariateStatistic getSumsqImpl() {<a name="line.426"></a>
+<FONT color="green">427</FONT>            return sumsqImpl;<a name="line.427"></a>
+<FONT color="green">428</FONT>        }<a name="line.428"></a>
+<FONT color="green">429</FONT>    <a name="line.429"></a>
+<FONT color="green">430</FONT>        /**<a name="line.430"></a>
+<FONT color="green">431</FONT>         * &lt;p&gt;<a name="line.431"></a>
+<FONT color="green">432</FONT>         * Sets the implementation for the sum of squares.<a name="line.432"></a>
+<FONT color="green">433</FONT>         * &lt;/p&gt;<a name="line.433"></a>
+<FONT color="green">434</FONT>         * &lt;p&gt;<a name="line.434"></a>
+<FONT color="green">435</FONT>         * This method must be activated before any data has been added - i.e.,<a name="line.435"></a>
+<FONT color="green">436</FONT>         * before {@link #addValue(double) addValue} has been used to add data;<a name="line.436"></a>
+<FONT color="green">437</FONT>         * otherwise an IllegalStateException will be thrown.<a name="line.437"></a>
+<FONT color="green">438</FONT>         * &lt;/p&gt;<a name="line.438"></a>
+<FONT color="green">439</FONT>         * @param sumsqImpl the StorelessUnivariateStatistic instance to use for<a name="line.439"></a>
+<FONT color="green">440</FONT>         *        computing the sum of squares<a name="line.440"></a>
+<FONT color="green">441</FONT>         * @throws IllegalStateException if data has already been added (i.e if n &gt;<a name="line.441"></a>
+<FONT color="green">442</FONT>         *         0)<a name="line.442"></a>
+<FONT color="green">443</FONT>         * @since 1.2<a name="line.443"></a>
+<FONT color="green">444</FONT>         */<a name="line.444"></a>
+<FONT color="green">445</FONT>        public void setSumsqImpl(StorelessUnivariateStatistic sumsqImpl) {<a name="line.445"></a>
+<FONT color="green">446</FONT>            checkEmpty();<a name="line.446"></a>
+<FONT color="green">447</FONT>            this.sumsqImpl = sumsqImpl;<a name="line.447"></a>
+<FONT color="green">448</FONT>        }<a name="line.448"></a>
+<FONT color="green">449</FONT>    <a name="line.449"></a>
+<FONT color="green">450</FONT>        /**<a name="line.450"></a>
+<FONT color="green">451</FONT>         * Returns the currently configured minimum implementation<a name="line.451"></a>
+<FONT color="green">452</FONT>         * @return the StorelessUnivariateStatistic implementing the minimum<a name="line.452"></a>
+<FONT color="green">453</FONT>         * @since 1.2<a name="line.453"></a>
+<FONT color="green">454</FONT>         */<a name="line.454"></a>
+<FONT color="green">455</FONT>        public StorelessUnivariateStatistic getMinImpl() {<a name="line.455"></a>
+<FONT color="green">456</FONT>            return minImpl;<a name="line.456"></a>
+<FONT color="green">457</FONT>        }<a name="line.457"></a>
+<FONT color="green">458</FONT>    <a name="line.458"></a>
+<FONT color="green">459</FONT>        /**<a name="line.459"></a>
+<FONT color="green">460</FONT>         * &lt;p&gt;<a name="line.460"></a>
+<FONT color="green">461</FONT>         * Sets the implementation for the minimum.<a name="line.461"></a>
+<FONT color="green">462</FONT>         * &lt;/p&gt;<a name="line.462"></a>
+<FONT color="green">463</FONT>         * &lt;p&gt;<a name="line.463"></a>
+<FONT color="green">464</FONT>         * This method must be activated before any data has been added - i.e.,<a name="line.464"></a>
+<FONT color="green">465</FONT>         * before {@link #addValue(double) addValue} has been used to add data;<a name="line.465"></a>
+<FONT color="green">466</FONT>         * otherwise an IllegalStateException will be thrown.<a name="line.466"></a>
+<FONT color="green">467</FONT>         * &lt;/p&gt;<a name="line.467"></a>
+<FONT color="green">468</FONT>         * @param minImpl the StorelessUnivariateStatistic instance to use for<a name="line.468"></a>
+<FONT color="green">469</FONT>         *        computing the minimum<a name="line.469"></a>
+<FONT color="green">470</FONT>         * @throws IllegalStateException if data has already been added (i.e if n &gt;<a name="line.470"></a>
+<FONT color="green">471</FONT>         *         0)<a name="line.471"></a>
+<FONT color="green">472</FONT>         * @since 1.2<a name="line.472"></a>
+<FONT color="green">473</FONT>         */<a name="line.473"></a>
+<FONT color="green">474</FONT>        public void setMinImpl(StorelessUnivariateStatistic minImpl) {<a name="line.474"></a>
+<FONT color="green">475</FONT>            checkEmpty();<a name="line.475"></a>
+<FONT color="green">476</FONT>            this.minImpl = minImpl;<a name="line.476"></a>
+<FONT color="green">477</FONT>        }<a name="line.477"></a>
+<FONT color="green">478</FONT>    <a name="line.478"></a>
+<FONT color="green">479</FONT>        /**<a name="line.479"></a>
+<FONT color="green">480</FONT>         * Returns the currently configured maximum implementation<a name="line.480"></a>
+<FONT color="green">481</FONT>         * @return the StorelessUnivariateStatistic implementing the maximum<a name="line.481"></a>
+<FONT color="green">482</FONT>         * @since 1.2<a name="line.482"></a>
+<FONT color="green">483</FONT>         */<a name="line.483"></a>
+<FONT color="green">484</FONT>        public StorelessUnivariateStatistic getMaxImpl() {<a name="line.484"></a>
+<FONT color="green">485</FONT>            return maxImpl;<a name="line.485"></a>
+<FONT color="green">486</FONT>        }<a name="line.486"></a>
+<FONT color="green">487</FONT>    <a name="line.487"></a>
+<FONT color="green">488</FONT>        /**<a name="line.488"></a>
+<FONT color="green">489</FONT>         * &lt;p&gt;<a name="line.489"></a>
+<FONT color="green">490</FONT>         * Sets the implementation for the maximum.<a name="line.490"></a>
+<FONT color="green">491</FONT>         * &lt;/p&gt;<a name="line.491"></a>
+<FONT color="green">492</FONT>         * &lt;p&gt;<a name="line.492"></a>
+<FONT color="green">493</FONT>         * This method must be activated before any data has been added - i.e.,<a name="line.493"></a>
+<FONT color="green">494</FONT>         * before {@link #addValue(double) addValue} has been used to add data;<a name="line.494"></a>
+<FONT color="green">495</FONT>         * otherwise an IllegalStateException will be thrown.<a name="line.495"></a>
+<FONT color="green">496</FONT>         * &lt;/p&gt;<a name="line.496"></a>
+<FONT color="green">497</FONT>         * @param maxImpl the StorelessUnivariateStatistic instance to use for<a name="line.497"></a>
+<FONT color="green">498</FONT>         *        computing the maximum<a name="line.498"></a>
+<FONT color="green">499</FONT>         * @throws IllegalStateException if data has already been added (i.e if n &gt;<a name="line.499"></a>
+<FONT color="green">500</FONT>         *         0)<a name="line.500"></a>
+<FONT color="green">501</FONT>         * @since 1.2<a name="line.501"></a>
+<FONT color="green">502</FONT>         */<a name="line.502"></a>
+<FONT color="green">503</FONT>        public void setMaxImpl(StorelessUnivariateStatistic maxImpl) {<a name="line.503"></a>
+<FONT color="green">504</FONT>            checkEmpty();<a name="line.504"></a>
+<FONT color="green">505</FONT>            this.maxImpl = maxImpl;<a name="line.505"></a>
+<FONT color="green">506</FONT>        }<a name="line.506"></a>
+<FONT color="green">507</FONT>    <a name="line.507"></a>
+<FONT color="green">508</FONT>        /**<a name="line.508"></a>
+<FONT color="green">509</FONT>         * Returns the currently configured sum of logs implementation<a name="line.509"></a>
+<FONT color="green">510</FONT>         * @return the StorelessUnivariateStatistic implementing the log sum<a name="line.510"></a>
+<FONT color="green">511</FONT>         * @since 1.2<a name="line.511"></a>
+<FONT color="green">512</FONT>         */<a name="line.512"></a>
+<FONT color="green">513</FONT>        public StorelessUnivariateStatistic getSumLogImpl() {<a name="line.513"></a>
+<FONT color="green">514</FONT>            return sumLogImpl;<a name="line.514"></a>
+<FONT color="green">515</FONT>        }<a name="line.515"></a>
+<FONT color="green">516</FONT>    <a name="line.516"></a>
+<FONT color="green">517</FONT>        /**<a name="line.517"></a>
+<FONT color="green">518</FONT>         * &lt;p&gt;<a name="line.518"></a>
+<FONT color="green">519</FONT>         * Sets the implementation for the sum of logs.<a name="line.519"></a>
+<FONT color="green">520</FONT>         * &lt;/p&gt;<a name="line.520"></a>
+<FONT color="green">521</FONT>         * &lt;p&gt;<a name="line.521"></a>
+<FONT color="green">522</FONT>         * This method must be activated before any data has been added - i.e.,<a name="line.522"></a>
+<FONT color="green">523</FONT>         * before {@link #addValue(double) addValue} has been used to add data;<a name="line.523"></a>
+<FONT color="green">524</FONT>         * otherwise an IllegalStateException will be thrown.<a name="line.524"></a>
+<FONT color="green">525</FONT>         * &lt;/p&gt;<a name="line.525"></a>
+<FONT color="green">526</FONT>         * @param sumLogImpl the StorelessUnivariateStatistic instance to use for<a name="line.526"></a>
+<FONT color="green">527</FONT>         *        computing the log sum<a name="line.527"></a>
+<FONT color="green">528</FONT>         * @throws IllegalStateException if data has already been added (i.e if n &gt;<a name="line.528"></a>
+<FONT color="green">529</FONT>         *         0)<a name="line.529"></a>
+<FONT color="green">530</FONT>         * @since 1.2<a name="line.530"></a>
+<FONT color="green">531</FONT>         */<a name="line.531"></a>
+<FONT color="green">532</FONT>        public void setSumLogImpl(StorelessUnivariateStatistic sumLogImpl) {<a name="line.532"></a>
+<FONT color="green">533</FONT>            checkEmpty();<a name="line.533"></a>
+<FONT color="green">534</FONT>            this.sumLogImpl = sumLogImpl;<a name="line.534"></a>
+<FONT color="green">535</FONT>            geoMean.setSumLogImpl(sumLogImpl);<a name="line.535"></a>
+<FONT color="green">536</FONT>        }<a name="line.536"></a>
+<FONT color="green">537</FONT>    <a name="line.537"></a>
+<FONT color="green">538</FONT>        /**<a name="line.538"></a>
+<FONT color="green">539</FONT>         * Returns the currently configured geometric mean implementation<a name="line.539"></a>
+<FONT color="green">540</FONT>         * @return the StorelessUnivariateStatistic implementing the geometric mean<a name="line.540"></a>
+<FONT color="green">541</FONT>         * @since 1.2<a name="line.541"></a>
+<FONT color="green">542</FONT>         */<a name="line.542"></a>
+<FONT color="green">543</FONT>        public StorelessUnivariateStatistic getGeoMeanImpl() {<a name="line.543"></a>
+<FONT color="green">544</FONT>            return geoMeanImpl;<a name="line.544"></a>
+<FONT color="green">545</FONT>        }<a name="line.545"></a>
+<FONT color="green">546</FONT>    <a name="line.546"></a>
+<FONT color="green">547</FONT>        /**<a name="line.547"></a>
+<FONT color="green">548</FONT>         * &lt;p&gt;<a name="line.548"></a>
+<FONT color="green">549</FONT>         * Sets the implementation for the geometric mean.<a name="line.549"></a>
+<FONT color="green">550</FONT>         * &lt;/p&gt;<a name="line.550"></a>
+<FONT color="green">551</FONT>         * &lt;p&gt;<a name="line.551"></a>
+<FONT color="green">552</FONT>         * This method must be activated before any data has been added - i.e.,<a name="line.552"></a>
+<FONT color="green">553</FONT>         * before {@link #addValue(double) addValue} has been used to add data;<a name="line.553"></a>
+<FONT color="green">554</FONT>         * otherwise an IllegalStateException will be thrown.<a name="line.554"></a>
+<FONT color="green">555</FONT>         * &lt;/p&gt;<a name="line.555"></a>
+<FONT color="green">556</FONT>         * @param geoMeanImpl the StorelessUnivariateStatistic instance to use for<a name="line.556"></a>
+<FONT color="green">557</FONT>         *        computing the geometric mean<a name="line.557"></a>
+<FONT color="green">558</FONT>         * @throws IllegalStateException if data has already been added (i.e if n &gt;<a name="line.558"></a>
+<FONT color="green">559</FONT>         *         0)<a name="line.559"></a>
+<FONT color="green">560</FONT>         * @since 1.2<a name="line.560"></a>
+<FONT color="green">561</FONT>         */<a name="line.561"></a>
+<FONT color="green">562</FONT>        public void setGeoMeanImpl(StorelessUnivariateStatistic geoMeanImpl) {<a name="line.562"></a>
+<FONT color="green">563</FONT>            checkEmpty();<a name="line.563"></a>
+<FONT color="green">564</FONT>            this.geoMeanImpl = geoMeanImpl;<a name="line.564"></a>
+<FONT color="green">565</FONT>        }<a name="line.565"></a>
+<FONT color="green">566</FONT>    <a name="line.566"></a>
+<FONT color="green">567</FONT>        /**<a name="line.567"></a>
+<FONT color="green">568</FONT>         * Returns the currently configured mean implementation<a name="line.568"></a>
+<FONT color="green">569</FONT>         * @return the StorelessUnivariateStatistic implementing the mean<a name="line.569"></a>
+<FONT color="green">570</FONT>         * @since 1.2<a name="line.570"></a>
+<FONT color="green">571</FONT>         */<a name="line.571"></a>
+<FONT color="green">572</FONT>        public StorelessUnivariateStatistic getMeanImpl() {<a name="line.572"></a>
+<FONT color="green">573</FONT>            return meanImpl;<a name="line.573"></a>
+<FONT color="green">574</FONT>        }<a name="line.574"></a>
+<FONT color="green">575</FONT>    <a name="line.575"></a>
+<FONT color="green">576</FONT>        /**<a name="line.576"></a>
+<FONT color="green">577</FONT>         * &lt;p&gt;<a name="line.577"></a>
+<FONT color="green">578</FONT>         * Sets the implementation for the mean.<a name="line.578"></a>
+<FONT color="green">579</FONT>         * &lt;/p&gt;<a name="line.579"></a>
+<FONT color="green">580</FONT>         * &lt;p&gt;<a name="line.580"></a>
+<FONT color="green">581</FONT>         * This method must be activated before any data has been added - i.e.,<a name="line.581"></a>
+<FONT color="green">582</FONT>         * before {@link #addValue(double) addValue} has been used to add data;<a name="line.582"></a>
+<FONT color="green">583</FONT>         * otherwise an IllegalStateException will be thrown.<a name="line.583"></a>
+<FONT color="green">584</FONT>         * &lt;/p&gt;<a name="line.584"></a>
+<FONT color="green">585</FONT>         * @param meanImpl the StorelessUnivariateStatistic instance to use for<a name="line.585"></a>
+<FONT color="green">586</FONT>         *        computing the mean<a name="line.586"></a>
+<FONT color="green">587</FONT>         * @throws IllegalStateException if data has already been added (i.e if n &gt;<a name="line.587"></a>
+<FONT color="green">588</FONT>         *         0)<a name="line.588"></a>
+<FONT color="green">589</FONT>         * @since 1.2<a name="line.589"></a>
+<FONT color="green">590</FONT>         */<a name="line.590"></a>
+<FONT color="green">591</FONT>        public void setMeanImpl(StorelessUnivariateStatistic meanImpl) {<a name="line.591"></a>
+<FONT color="green">592</FONT>            checkEmpty();<a name="line.592"></a>
+<FONT color="green">593</FONT>            this.meanImpl = meanImpl;<a name="line.593"></a>
+<FONT color="green">594</FONT>        }<a name="line.594"></a>
+<FONT color="green">595</FONT>    <a name="line.595"></a>
+<FONT color="green">596</FONT>        /**<a name="line.596"></a>
+<FONT color="green">597</FONT>         * Returns the currently configured variance implementation<a name="line.597"></a>
+<FONT color="green">598</FONT>         * @return the StorelessUnivariateStatistic implementing the variance<a name="line.598"></a>
+<FONT color="green">599</FONT>         * @since 1.2<a name="line.599"></a>
+<FONT color="green">600</FONT>         */<a name="line.600"></a>
+<FONT color="green">601</FONT>        public StorelessUnivariateStatistic getVarianceImpl() {<a name="line.601"></a>
+<FONT color="green">602</FONT>            return varianceImpl;<a name="line.602"></a>
+<FONT color="green">603</FONT>        }<a name="line.603"></a>
+<FONT color="green">604</FONT>    <a name="line.604"></a>
+<FONT color="green">605</FONT>        /**<a name="line.605"></a>
+<FONT color="green">606</FONT>         * &lt;p&gt;<a name="line.606"></a>
+<FONT color="green">607</FONT>         * Sets the implementation for the variance.<a name="line.607"></a>
+<FONT color="green">608</FONT>         * &lt;/p&gt;<a name="line.608"></a>
+<FONT color="green">609</FONT>         * &lt;p&gt;<a name="line.609"></a>
+<FONT color="green">610</FONT>         * This method must be activated before any data has been added - i.e.,<a name="line.610"></a>
+<FONT color="green">611</FONT>         * before {@link #addValue(double) addValue} has been used to add data;<a name="line.611"></a>
+<FONT color="green">612</FONT>         * otherwise an IllegalStateException will be thrown.<a name="line.612"></a>
+<FONT color="green">613</FONT>         * &lt;/p&gt;<a name="line.613"></a>
+<FONT color="green">614</FONT>         * @param varianceImpl the StorelessUnivariateStatistic instance to use for<a name="line.614"></a>
+<FONT color="green">615</FONT>         *        computing the variance<a name="line.615"></a>
+<FONT color="green">616</FONT>         * @throws IllegalStateException if data has already been added (i.e if n &gt;<a name="line.616"></a>
+<FONT color="green">617</FONT>         *         0)<a name="line.617"></a>
+<FONT color="green">618</FONT>         * @since 1.2<a name="line.618"></a>
+<FONT color="green">619</FONT>         */<a name="line.619"></a>
+<FONT color="green">620</FONT>        public void setVarianceImpl(StorelessUnivariateStatistic varianceImpl) {<a name="line.620"></a>
+<FONT color="green">621</FONT>            checkEmpty();<a name="line.621"></a>
+<FONT color="green">622</FONT>            this.varianceImpl = varianceImpl;<a name="line.622"></a>
+<FONT color="green">623</FONT>        }<a name="line.623"></a>
+<FONT color="green">624</FONT>    <a name="line.624"></a>
+<FONT color="green">625</FONT>        /**<a name="line.625"></a>
+<FONT color="green">626</FONT>         * Throws IllegalStateException if n &gt; 0.<a name="line.626"></a>
+<FONT color="green">627</FONT>         */<a name="line.627"></a>
+<FONT color="green">628</FONT>        private void checkEmpty() {<a name="line.628"></a>
+<FONT color="green">629</FONT>            if (n &gt; 0) {<a name="line.629"></a>
+<FONT color="green">630</FONT>                throw MathRuntimeException.createIllegalStateException(<a name="line.630"></a>
+<FONT color="green">631</FONT>                        "{0} values have been added before statistic is configured",<a name="line.631"></a>
+<FONT color="green">632</FONT>                        n);<a name="line.632"></a>
+<FONT color="green">633</FONT>            }<a name="line.633"></a>
+<FONT color="green">634</FONT>        }<a name="line.634"></a>
+<FONT color="green">635</FONT>    <a name="line.635"></a>
+<FONT color="green">636</FONT>        /**<a name="line.636"></a>
+<FONT color="green">637</FONT>         * Returns a copy of this SummaryStatistics instance with the same internal state.<a name="line.637"></a>
+<FONT color="green">638</FONT>         *<a name="line.638"></a>
+<FONT color="green">639</FONT>         * @return a copy of this<a name="line.639"></a>
+<FONT color="green">640</FONT>         */<a name="line.640"></a>
+<FONT color="green">641</FONT>        public SummaryStatistics copy() {<a name="line.641"></a>
+<FONT color="green">642</FONT>            SummaryStatistics result = new SummaryStatistics();<a name="line.642"></a>
+<FONT color="green">643</FONT>            copy(this, result);<a name="line.643"></a>
+<FONT color="green">644</FONT>            return result;<a name="line.644"></a>
+<FONT color="green">645</FONT>        }<a name="line.645"></a>
+<FONT color="green">646</FONT>    <a name="line.646"></a>
+<FONT color="green">647</FONT>        /**<a name="line.647"></a>
+<FONT color="green">648</FONT>         * Copies source to dest.<a name="line.648"></a>
+<FONT color="green">649</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.649"></a>
+<FONT color="green">650</FONT>         *<a name="line.650"></a>
+<FONT color="green">651</FONT>         * @param source SummaryStatistics to copy<a name="line.651"></a>
+<FONT color="green">652</FONT>         * @param dest SummaryStatistics to copy to<a name="line.652"></a>
+<FONT color="green">653</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.653"></a>
+<FONT color="green">654</FONT>         */<a name="line.654"></a>
+<FONT color="green">655</FONT>        public static void copy(SummaryStatistics source, SummaryStatistics dest) {<a name="line.655"></a>
+<FONT color="green">656</FONT>            dest.maxImpl = source.maxImpl.copy();<a name="line.656"></a>
+<FONT color="green">657</FONT>            dest.meanImpl = source.meanImpl.copy();<a name="line.657"></a>
+<FONT color="green">658</FONT>            dest.minImpl = source.minImpl.copy();<a name="line.658"></a>
+<FONT color="green">659</FONT>            dest.sumImpl = source.sumImpl.copy();<a name="line.659"></a>
+<FONT color="green">660</FONT>            dest.varianceImpl = source.varianceImpl.copy();<a name="line.660"></a>
+<FONT color="green">661</FONT>            dest.sumLogImpl = source.sumLogImpl.copy();<a name="line.661"></a>
+<FONT color="green">662</FONT>            dest.sumsqImpl = source.sumsqImpl.copy();<a name="line.662"></a>
+<FONT color="green">663</FONT>            if (source.getGeoMeanImpl() instanceof GeometricMean) {<a name="line.663"></a>
+<FONT color="green">664</FONT>                // Keep geoMeanImpl, sumLogImpl in synch<a name="line.664"></a>
+<FONT color="green">665</FONT>                dest.geoMeanImpl = new GeometricMean((SumOfLogs) dest.sumLogImpl);<a name="line.665"></a>
+<FONT color="green">666</FONT>            } else {<a name="line.666"></a>
+<FONT color="green">667</FONT>                dest.geoMeanImpl = source.geoMeanImpl.copy();<a name="line.667"></a>
+<FONT color="green">668</FONT>            }<a name="line.668"></a>
+<FONT color="green">669</FONT>            SecondMoment.copy(source.secondMoment, dest.secondMoment);<a name="line.669"></a>
+<FONT color="green">670</FONT>            dest.n = source.n;<a name="line.670"></a>
+<FONT color="green">671</FONT>    <a name="line.671"></a>
+<FONT color="green">672</FONT>            // Make sure that if stat == statImpl in source, same<a name="line.672"></a>
+<FONT color="green">673</FONT>            // holds in dest; otherwise copy stat<a name="line.673"></a>
+<FONT color="green">674</FONT>            if (source.geoMean == source.geoMeanImpl) {<a name="line.674"></a>
+<FONT color="green">675</FONT>                dest.geoMean = (GeometricMean) dest.geoMeanImpl;<a name="line.675"></a>
+<FONT color="green">676</FONT>            } else {<a name="line.676"></a>
+<FONT color="green">677</FONT>                GeometricMean.copy(source.geoMean, dest.geoMean);<a name="line.677"></a>
+<FONT color="green">678</FONT>            }<a name="line.678"></a>
+<FONT color="green">679</FONT>            if (source.max == source.maxImpl) {<a name="line.679"></a>
+<FONT color="green">680</FONT>                dest.max = (Max) dest.maxImpl;<a name="line.680"></a>
+<FONT color="green">681</FONT>            } else {<a name="line.681"></a>
+<FONT color="green">682</FONT>                Max.copy(source.max, dest.max);<a name="line.682"></a>
+<FONT color="green">683</FONT>            }<a name="line.683"></a>
+<FONT color="green">684</FONT>            if (source.mean == source.meanImpl) {<a name="line.684"></a>
+<FONT color="green">685</FONT>                dest.mean = (Mean) dest.meanImpl;<a name="line.685"></a>
+<FONT color="green">686</FONT>            } else {<a name="line.686"></a>
+<FONT color="green">687</FONT>                Mean.copy(source.mean, dest.mean);<a name="line.687"></a>
+<FONT color="green">688</FONT>            }<a name="line.688"></a>
+<FONT color="green">689</FONT>            if (source.min == source.minImpl) {<a name="line.689"></a>
+<FONT color="green">690</FONT>                dest.min = (Min) dest.minImpl;<a name="line.690"></a>
+<FONT color="green">691</FONT>            } else {<a name="line.691"></a>
+<FONT color="green">692</FONT>                Min.copy(source.min, dest.min);<a name="line.692"></a>
+<FONT color="green">693</FONT>            }<a name="line.693"></a>
+<FONT color="green">694</FONT>            if (source.sum == source.sumImpl) {<a name="line.694"></a>
+<FONT color="green">695</FONT>                dest.sum = (Sum) dest.sumImpl;<a name="line.695"></a>
+<FONT color="green">696</FONT>            } else {<a name="line.696"></a>
+<FONT color="green">697</FONT>                Sum.copy(source.sum, dest.sum);<a name="line.697"></a>
+<FONT color="green">698</FONT>            }<a name="line.698"></a>
+<FONT color="green">699</FONT>            if (source.variance == source.varianceImpl) {<a name="line.699"></a>
+<FONT color="green">700</FONT>                dest.variance = (Variance) dest.varianceImpl;<a name="line.700"></a>
+<FONT color="green">701</FONT>            } else {<a name="line.701"></a>
+<FONT color="green">702</FONT>                Variance.copy(source.variance, dest.variance);<a name="line.702"></a>
+<FONT color="green">703</FONT>            }<a name="line.703"></a>
+<FONT color="green">704</FONT>            if (source.sumLog == source.sumLogImpl) {<a name="line.704"></a>
+<FONT color="green">705</FONT>                dest.sumLog = (SumOfLogs) dest.sumLogImpl;<a name="line.705"></a>
+<FONT color="green">706</FONT>            } else {<a name="line.706"></a>
+<FONT color="green">707</FONT>                SumOfLogs.copy(source.sumLog, dest.sumLog);<a name="line.707"></a>
+<FONT color="green">708</FONT>            }<a name="line.708"></a>
+<FONT color="green">709</FONT>            if (source.sumsq == source.sumsqImpl) {<a name="line.709"></a>
+<FONT color="green">710</FONT>                dest.sumsq = (SumOfSquares) dest.sumsqImpl;<a name="line.710"></a>
+<FONT color="green">711</FONT>            } else {<a name="line.711"></a>
+<FONT color="green">712</FONT>                SumOfSquares.copy(source.sumsq, dest.sumsq);<a name="line.712"></a>
+<FONT color="green">713</FONT>            }<a name="line.713"></a>
+<FONT color="green">714</FONT>        }<a name="line.714"></a>
+<FONT color="green">715</FONT>    }<a name="line.715"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/SynchronizedDescriptiveStatistics.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,238 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Implementation of<a name="line.20"></a>
+<FONT color="green">021</FONT>     * {@link org.apache.commons.math.stat.descriptive.DescriptiveStatistics} that<a name="line.21"></a>
+<FONT color="green">022</FONT>     * is safe to use in a multithreaded environment.  Multiple threads can safely<a name="line.22"></a>
+<FONT color="green">023</FONT>     * operate on a single instance without causing runtime exceptions due to race<a name="line.23"></a>
+<FONT color="green">024</FONT>     * conditions.  In effect, this implementation makes modification and access<a name="line.24"></a>
+<FONT color="green">025</FONT>     * methods atomic operations for a single instance.  That is to say, as one<a name="line.25"></a>
+<FONT color="green">026</FONT>     * thread is computing a statistic from the instance, no other thread can modify<a name="line.26"></a>
+<FONT color="green">027</FONT>     * the instance nor compute another statistic.<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @since 1.2<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    public class SynchronizedDescriptiveStatistics extends DescriptiveStatistics {<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /** Serialization UID */<a name="line.34"></a>
+<FONT color="green">035</FONT>        private static final long serialVersionUID = 1L;<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /**<a name="line.37"></a>
+<FONT color="green">038</FONT>         * Construct an instance with infinite window<a name="line.38"></a>
+<FONT color="green">039</FONT>         */<a name="line.39"></a>
+<FONT color="green">040</FONT>        public SynchronizedDescriptiveStatistics() {<a name="line.40"></a>
+<FONT color="green">041</FONT>            this(INFINITE_WINDOW);<a name="line.41"></a>
+<FONT color="green">042</FONT>        }<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /**<a name="line.44"></a>
+<FONT color="green">045</FONT>         * Construct an instance with finite window<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @param window the finite window size.<a name="line.46"></a>
+<FONT color="green">047</FONT>         */<a name="line.47"></a>
+<FONT color="green">048</FONT>        public SynchronizedDescriptiveStatistics(int window) {<a name="line.48"></a>
+<FONT color="green">049</FONT>            super(window);<a name="line.49"></a>
+<FONT color="green">050</FONT>        }<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * A copy constructor. Creates a deep-copy of the {@code original}.<a name="line.53"></a>
+<FONT color="green">054</FONT>         *<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param original the {@code SynchronizedDescriptiveStatistics} instance to copy<a name="line.55"></a>
+<FONT color="green">056</FONT>         */<a name="line.56"></a>
+<FONT color="green">057</FONT>        public SynchronizedDescriptiveStatistics(SynchronizedDescriptiveStatistics original) {<a name="line.57"></a>
+<FONT color="green">058</FONT>            copy(original, this);<a name="line.58"></a>
+<FONT color="green">059</FONT>        }<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * {@inheritDoc}<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        @Override<a name="line.64"></a>
+<FONT color="green">065</FONT>        public synchronized void addValue(double v) {<a name="line.65"></a>
+<FONT color="green">066</FONT>            super.addValue(v);<a name="line.66"></a>
+<FONT color="green">067</FONT>        }<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * {@inheritDoc}<a name="line.70"></a>
+<FONT color="green">071</FONT>         */<a name="line.71"></a>
+<FONT color="green">072</FONT>        @Override<a name="line.72"></a>
+<FONT color="green">073</FONT>        public synchronized double apply(UnivariateStatistic stat) {<a name="line.73"></a>
+<FONT color="green">074</FONT>            return super.apply(stat);<a name="line.74"></a>
+<FONT color="green">075</FONT>        }<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /**<a name="line.77"></a>
+<FONT color="green">078</FONT>         * {@inheritDoc}<a name="line.78"></a>
+<FONT color="green">079</FONT>         */<a name="line.79"></a>
+<FONT color="green">080</FONT>        @Override<a name="line.80"></a>
+<FONT color="green">081</FONT>        public synchronized void clear() {<a name="line.81"></a>
+<FONT color="green">082</FONT>            super.clear();<a name="line.82"></a>
+<FONT color="green">083</FONT>        }<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>        /**<a name="line.85"></a>
+<FONT color="green">086</FONT>         * {@inheritDoc}<a name="line.86"></a>
+<FONT color="green">087</FONT>         */<a name="line.87"></a>
+<FONT color="green">088</FONT>        @Override<a name="line.88"></a>
+<FONT color="green">089</FONT>        public synchronized double getElement(int index) {<a name="line.89"></a>
+<FONT color="green">090</FONT>            return super.getElement(index);<a name="line.90"></a>
+<FONT color="green">091</FONT>        }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /**<a name="line.93"></a>
+<FONT color="green">094</FONT>         * {@inheritDoc}<a name="line.94"></a>
+<FONT color="green">095</FONT>         */<a name="line.95"></a>
+<FONT color="green">096</FONT>        @Override<a name="line.96"></a>
+<FONT color="green">097</FONT>        public synchronized long getN() {<a name="line.97"></a>
+<FONT color="green">098</FONT>            return super.getN();<a name="line.98"></a>
+<FONT color="green">099</FONT>        }<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /**<a name="line.101"></a>
+<FONT color="green">102</FONT>         * {@inheritDoc}<a name="line.102"></a>
+<FONT color="green">103</FONT>         */<a name="line.103"></a>
+<FONT color="green">104</FONT>        @Override<a name="line.104"></a>
+<FONT color="green">105</FONT>        public synchronized double getStandardDeviation() {<a name="line.105"></a>
+<FONT color="green">106</FONT>            return super.getStandardDeviation();<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /**<a name="line.109"></a>
+<FONT color="green">110</FONT>         * {@inheritDoc}<a name="line.110"></a>
+<FONT color="green">111</FONT>         */<a name="line.111"></a>
+<FONT color="green">112</FONT>        @Override<a name="line.112"></a>
+<FONT color="green">113</FONT>        public synchronized double[] getValues() {<a name="line.113"></a>
+<FONT color="green">114</FONT>            return super.getValues();<a name="line.114"></a>
+<FONT color="green">115</FONT>        }<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>        /**<a name="line.117"></a>
+<FONT color="green">118</FONT>         * {@inheritDoc}<a name="line.118"></a>
+<FONT color="green">119</FONT>         */<a name="line.119"></a>
+<FONT color="green">120</FONT>        @Override<a name="line.120"></a>
+<FONT color="green">121</FONT>        public synchronized int getWindowSize() {<a name="line.121"></a>
+<FONT color="green">122</FONT>            return super.getWindowSize();<a name="line.122"></a>
+<FONT color="green">123</FONT>        }<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>        /**<a name="line.125"></a>
+<FONT color="green">126</FONT>         * {@inheritDoc}<a name="line.126"></a>
+<FONT color="green">127</FONT>         */<a name="line.127"></a>
+<FONT color="green">128</FONT>        @Override<a name="line.128"></a>
+<FONT color="green">129</FONT>        public synchronized void setWindowSize(int windowSize) {<a name="line.129"></a>
+<FONT color="green">130</FONT>            super.setWindowSize(windowSize);<a name="line.130"></a>
+<FONT color="green">131</FONT>        }<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>        /**<a name="line.133"></a>
+<FONT color="green">134</FONT>         * {@inheritDoc}<a name="line.134"></a>
+<FONT color="green">135</FONT>         */<a name="line.135"></a>
+<FONT color="green">136</FONT>        @Override<a name="line.136"></a>
+<FONT color="green">137</FONT>        public synchronized String toString() {<a name="line.137"></a>
+<FONT color="green">138</FONT>            return super.toString();<a name="line.138"></a>
+<FONT color="green">139</FONT>        }<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>        /**<a name="line.141"></a>
+<FONT color="green">142</FONT>         * Returns a copy of this SynchronizedDescriptiveStatistics instance with the<a name="line.142"></a>
+<FONT color="green">143</FONT>         * same internal state.<a name="line.143"></a>
+<FONT color="green">144</FONT>         *<a name="line.144"></a>
+<FONT color="green">145</FONT>         * @return a copy of this<a name="line.145"></a>
+<FONT color="green">146</FONT>         */<a name="line.146"></a>
+<FONT color="green">147</FONT>        @Override<a name="line.147"></a>
+<FONT color="green">148</FONT>        public synchronized SynchronizedDescriptiveStatistics copy() {<a name="line.148"></a>
+<FONT color="green">149</FONT>            SynchronizedDescriptiveStatistics result =<a name="line.149"></a>
+<FONT color="green">150</FONT>                new SynchronizedDescriptiveStatistics();<a name="line.150"></a>
+<FONT color="green">151</FONT>            copy(this, result);<a name="line.151"></a>
+<FONT color="green">152</FONT>            return result;<a name="line.152"></a>
+<FONT color="green">153</FONT>        }<a name="line.153"></a>
+<FONT color="green">154</FONT>    <a name="line.154"></a>
+<FONT color="green">155</FONT>        /**<a name="line.155"></a>
+<FONT color="green">156</FONT>         * Copies source to dest.<a name="line.156"></a>
+<FONT color="green">157</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.157"></a>
+<FONT color="green">158</FONT>         * &lt;p&gt;Acquires synchronization lock on source, then dest before copying.&lt;/p&gt;<a name="line.158"></a>
+<FONT color="green">159</FONT>         *<a name="line.159"></a>
+<FONT color="green">160</FONT>         * @param source SynchronizedDescriptiveStatistics to copy<a name="line.160"></a>
+<FONT color="green">161</FONT>         * @param dest SynchronizedDescriptiveStatistics to copy to<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.162"></a>
+<FONT color="green">163</FONT>         */<a name="line.163"></a>
+<FONT color="green">164</FONT>        public static void copy(SynchronizedDescriptiveStatistics source,<a name="line.164"></a>
+<FONT color="green">165</FONT>                SynchronizedDescriptiveStatistics dest) {<a name="line.165"></a>
+<FONT color="green">166</FONT>            synchronized (source) {<a name="line.166"></a>
+<FONT color="green">167</FONT>                synchronized (dest) {<a name="line.167"></a>
+<FONT color="green">168</FONT>                    DescriptiveStatistics.copy(source, dest);<a name="line.168"></a>
+<FONT color="green">169</FONT>                }<a name="line.169"></a>
+<FONT color="green">170</FONT>            }<a name="line.170"></a>
+<FONT color="green">171</FONT>        }<a name="line.171"></a>
+<FONT color="green">172</FONT>    }<a name="line.172"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/SynchronizedMultivariateSummaryStatistics.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,365 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.DimensionMismatchException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.linear.RealMatrix;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Implementation of<a name="line.23"></a>
+<FONT color="green">024</FONT>     * {@link org.apache.commons.math.stat.descriptive.MultivariateSummaryStatistics} that<a name="line.24"></a>
+<FONT color="green">025</FONT>     * is safe to use in a multithreaded environment.  Multiple threads can safely<a name="line.25"></a>
+<FONT color="green">026</FONT>     * operate on a single instance without causing runtime exceptions due to race<a name="line.26"></a>
+<FONT color="green">027</FONT>     * conditions.  In effect, this implementation makes modification and access<a name="line.27"></a>
+<FONT color="green">028</FONT>     * methods atomic operations for a single instance.  That is to say, as one<a name="line.28"></a>
+<FONT color="green">029</FONT>     * thread is computing a statistic from the instance, no other thread can modify<a name="line.29"></a>
+<FONT color="green">030</FONT>     * the instance nor compute another statistic.<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 1.2<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public class SynchronizedMultivariateSummaryStatistics<a name="line.34"></a>
+<FONT color="green">035</FONT>      extends MultivariateSummaryStatistics {<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /** Serialization UID */<a name="line.37"></a>
+<FONT color="green">038</FONT>        private static final long serialVersionUID = 7099834153347155363L;<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /**<a name="line.40"></a>
+<FONT color="green">041</FONT>         * Construct a SynchronizedMultivariateSummaryStatistics instance<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @param k dimension of the data<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @param isCovarianceBiasCorrected if true, the unbiased sample<a name="line.43"></a>
+<FONT color="green">044</FONT>         * covariance is computed, otherwise the biased population covariance<a name="line.44"></a>
+<FONT color="green">045</FONT>         * is computed<a name="line.45"></a>
+<FONT color="green">046</FONT>         */<a name="line.46"></a>
+<FONT color="green">047</FONT>        public SynchronizedMultivariateSummaryStatistics(int k, boolean isCovarianceBiasCorrected) {<a name="line.47"></a>
+<FONT color="green">048</FONT>            super(k, isCovarianceBiasCorrected);<a name="line.48"></a>
+<FONT color="green">049</FONT>        }<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /**<a name="line.51"></a>
+<FONT color="green">052</FONT>         * {@inheritDoc}<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        @Override<a name="line.54"></a>
+<FONT color="green">055</FONT>        public synchronized void addValue(double[] value)<a name="line.55"></a>
+<FONT color="green">056</FONT>          throws DimensionMismatchException {<a name="line.56"></a>
+<FONT color="green">057</FONT>          super.addValue(value);<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /**<a name="line.60"></a>
+<FONT color="green">061</FONT>         * {@inheritDoc}<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        @Override<a name="line.63"></a>
+<FONT color="green">064</FONT>        public synchronized int getDimension() {<a name="line.64"></a>
+<FONT color="green">065</FONT>            return super.getDimension();<a name="line.65"></a>
+<FONT color="green">066</FONT>        }<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /**<a name="line.68"></a>
+<FONT color="green">069</FONT>         * {@inheritDoc}<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        @Override<a name="line.71"></a>
+<FONT color="green">072</FONT>        public synchronized long getN() {<a name="line.72"></a>
+<FONT color="green">073</FONT>            return super.getN();<a name="line.73"></a>
+<FONT color="green">074</FONT>        }<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        /**<a name="line.76"></a>
+<FONT color="green">077</FONT>         * {@inheritDoc}<a name="line.77"></a>
+<FONT color="green">078</FONT>         */<a name="line.78"></a>
+<FONT color="green">079</FONT>        @Override<a name="line.79"></a>
+<FONT color="green">080</FONT>        public synchronized double[] getSum() {<a name="line.80"></a>
+<FONT color="green">081</FONT>            return super.getSum();<a name="line.81"></a>
+<FONT color="green">082</FONT>        }<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /**<a name="line.84"></a>
+<FONT color="green">085</FONT>         * {@inheritDoc}<a name="line.85"></a>
+<FONT color="green">086</FONT>         */<a name="line.86"></a>
+<FONT color="green">087</FONT>        @Override<a name="line.87"></a>
+<FONT color="green">088</FONT>        public synchronized double[] getSumSq() {<a name="line.88"></a>
+<FONT color="green">089</FONT>            return super.getSumSq();<a name="line.89"></a>
+<FONT color="green">090</FONT>        }<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /**<a name="line.92"></a>
+<FONT color="green">093</FONT>         * {@inheritDoc}<a name="line.93"></a>
+<FONT color="green">094</FONT>         */<a name="line.94"></a>
+<FONT color="green">095</FONT>        @Override<a name="line.95"></a>
+<FONT color="green">096</FONT>        public synchronized double[] getSumLog() {<a name="line.96"></a>
+<FONT color="green">097</FONT>            return super.getSumLog();<a name="line.97"></a>
+<FONT color="green">098</FONT>        }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>        /**<a name="line.100"></a>
+<FONT color="green">101</FONT>         * {@inheritDoc}<a name="line.101"></a>
+<FONT color="green">102</FONT>         */<a name="line.102"></a>
+<FONT color="green">103</FONT>        @Override<a name="line.103"></a>
+<FONT color="green">104</FONT>        public synchronized double[] getMean() {<a name="line.104"></a>
+<FONT color="green">105</FONT>            return super.getMean();<a name="line.105"></a>
+<FONT color="green">106</FONT>        }<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>        /**<a name="line.108"></a>
+<FONT color="green">109</FONT>         * {@inheritDoc}<a name="line.109"></a>
+<FONT color="green">110</FONT>         */<a name="line.110"></a>
+<FONT color="green">111</FONT>        @Override<a name="line.111"></a>
+<FONT color="green">112</FONT>        public synchronized double[] getStandardDeviation() {<a name="line.112"></a>
+<FONT color="green">113</FONT>            return super.getStandardDeviation();<a name="line.113"></a>
+<FONT color="green">114</FONT>        }<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>        /**<a name="line.116"></a>
+<FONT color="green">117</FONT>         * {@inheritDoc}<a name="line.117"></a>
+<FONT color="green">118</FONT>         */<a name="line.118"></a>
+<FONT color="green">119</FONT>        @Override<a name="line.119"></a>
+<FONT color="green">120</FONT>        public synchronized RealMatrix getCovariance() {<a name="line.120"></a>
+<FONT color="green">121</FONT>            return super.getCovariance();<a name="line.121"></a>
+<FONT color="green">122</FONT>        }<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>        /**<a name="line.124"></a>
+<FONT color="green">125</FONT>         * {@inheritDoc}<a name="line.125"></a>
+<FONT color="green">126</FONT>         */<a name="line.126"></a>
+<FONT color="green">127</FONT>        @Override<a name="line.127"></a>
+<FONT color="green">128</FONT>        public synchronized double[] getMax() {<a name="line.128"></a>
+<FONT color="green">129</FONT>            return super.getMax();<a name="line.129"></a>
+<FONT color="green">130</FONT>        }<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>        /**<a name="line.132"></a>
+<FONT color="green">133</FONT>         * {@inheritDoc}<a name="line.133"></a>
+<FONT color="green">134</FONT>         */<a name="line.134"></a>
+<FONT color="green">135</FONT>        @Override<a name="line.135"></a>
+<FONT color="green">136</FONT>        public synchronized double[] getMin() {<a name="line.136"></a>
+<FONT color="green">137</FONT>            return super.getMin();<a name="line.137"></a>
+<FONT color="green">138</FONT>        }<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>        /**<a name="line.140"></a>
+<FONT color="green">141</FONT>         * {@inheritDoc}<a name="line.141"></a>
+<FONT color="green">142</FONT>         */<a name="line.142"></a>
+<FONT color="green">143</FONT>        @Override<a name="line.143"></a>
+<FONT color="green">144</FONT>        public synchronized double[] getGeometricMean() {<a name="line.144"></a>
+<FONT color="green">145</FONT>            return super.getGeometricMean();<a name="line.145"></a>
+<FONT color="green">146</FONT>        }<a name="line.146"></a>
+<FONT color="green">147</FONT>    <a name="line.147"></a>
+<FONT color="green">148</FONT>        /**<a name="line.148"></a>
+<FONT color="green">149</FONT>         * {@inheritDoc}<a name="line.149"></a>
+<FONT color="green">150</FONT>         */<a name="line.150"></a>
+<FONT color="green">151</FONT>        @Override<a name="line.151"></a>
+<FONT color="green">152</FONT>        public synchronized String toString() {<a name="line.152"></a>
+<FONT color="green">153</FONT>            return super.toString();<a name="line.153"></a>
+<FONT color="green">154</FONT>        }<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>        /**<a name="line.156"></a>
+<FONT color="green">157</FONT>         * {@inheritDoc}<a name="line.157"></a>
+<FONT color="green">158</FONT>         */<a name="line.158"></a>
+<FONT color="green">159</FONT>        @Override<a name="line.159"></a>
+<FONT color="green">160</FONT>        public synchronized void clear() {<a name="line.160"></a>
+<FONT color="green">161</FONT>            super.clear();<a name="line.161"></a>
+<FONT color="green">162</FONT>        }<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>        /**<a name="line.164"></a>
+<FONT color="green">165</FONT>         * {@inheritDoc}<a name="line.165"></a>
+<FONT color="green">166</FONT>         */<a name="line.166"></a>
+<FONT color="green">167</FONT>        @Override<a name="line.167"></a>
+<FONT color="green">168</FONT>        public synchronized boolean equals(Object object) {<a name="line.168"></a>
+<FONT color="green">169</FONT>            return super.equals(object);<a name="line.169"></a>
+<FONT color="green">170</FONT>        }<a name="line.170"></a>
+<FONT color="green">171</FONT>    <a name="line.171"></a>
+<FONT color="green">172</FONT>        /**<a name="line.172"></a>
+<FONT color="green">173</FONT>         * {@inheritDoc}<a name="line.173"></a>
+<FONT color="green">174</FONT>         */<a name="line.174"></a>
+<FONT color="green">175</FONT>        @Override<a name="line.175"></a>
+<FONT color="green">176</FONT>        public synchronized int hashCode() {<a name="line.176"></a>
+<FONT color="green">177</FONT>            return super.hashCode();<a name="line.177"></a>
+<FONT color="green">178</FONT>        }<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>        /**<a name="line.180"></a>
+<FONT color="green">181</FONT>         * {@inheritDoc}<a name="line.181"></a>
+<FONT color="green">182</FONT>         */<a name="line.182"></a>
+<FONT color="green">183</FONT>        @Override<a name="line.183"></a>
+<FONT color="green">184</FONT>        public synchronized StorelessUnivariateStatistic[] getSumImpl() {<a name="line.184"></a>
+<FONT color="green">185</FONT>            return super.getSumImpl();<a name="line.185"></a>
+<FONT color="green">186</FONT>        }<a name="line.186"></a>
+<FONT color="green">187</FONT>    <a name="line.187"></a>
+<FONT color="green">188</FONT>        /**<a name="line.188"></a>
+<FONT color="green">189</FONT>         * {@inheritDoc}<a name="line.189"></a>
+<FONT color="green">190</FONT>         */<a name="line.190"></a>
+<FONT color="green">191</FONT>        @Override<a name="line.191"></a>
+<FONT color="green">192</FONT>        public synchronized void setSumImpl(StorelessUnivariateStatistic[] sumImpl)<a name="line.192"></a>
+<FONT color="green">193</FONT>          throws DimensionMismatchException {<a name="line.193"></a>
+<FONT color="green">194</FONT>            super.setSumImpl(sumImpl);<a name="line.194"></a>
+<FONT color="green">195</FONT>        }<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>        /**<a name="line.197"></a>
+<FONT color="green">198</FONT>         * {@inheritDoc}<a name="line.198"></a>
+<FONT color="green">199</FONT>         */<a name="line.199"></a>
+<FONT color="green">200</FONT>        @Override<a name="line.200"></a>
+<FONT color="green">201</FONT>        public synchronized StorelessUnivariateStatistic[] getSumsqImpl() {<a name="line.201"></a>
+<FONT color="green">202</FONT>            return super.getSumsqImpl();<a name="line.202"></a>
+<FONT color="green">203</FONT>        }<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>        /**<a name="line.205"></a>
+<FONT color="green">206</FONT>         * {@inheritDoc}<a name="line.206"></a>
+<FONT color="green">207</FONT>         */<a name="line.207"></a>
+<FONT color="green">208</FONT>        @Override<a name="line.208"></a>
+<FONT color="green">209</FONT>        public synchronized void setSumsqImpl(StorelessUnivariateStatistic[] sumsqImpl)<a name="line.209"></a>
+<FONT color="green">210</FONT>          throws DimensionMismatchException {<a name="line.210"></a>
+<FONT color="green">211</FONT>            super.setSumsqImpl(sumsqImpl);<a name="line.211"></a>
+<FONT color="green">212</FONT>        }<a name="line.212"></a>
+<FONT color="green">213</FONT>    <a name="line.213"></a>
+<FONT color="green">214</FONT>        /**<a name="line.214"></a>
+<FONT color="green">215</FONT>         * {@inheritDoc}<a name="line.215"></a>
+<FONT color="green">216</FONT>         */<a name="line.216"></a>
+<FONT color="green">217</FONT>        @Override<a name="line.217"></a>
+<FONT color="green">218</FONT>        public synchronized StorelessUnivariateStatistic[] getMinImpl() {<a name="line.218"></a>
+<FONT color="green">219</FONT>            return super.getMinImpl();<a name="line.219"></a>
+<FONT color="green">220</FONT>        }<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>        /**<a name="line.222"></a>
+<FONT color="green">223</FONT>         * {@inheritDoc}<a name="line.223"></a>
+<FONT color="green">224</FONT>         */<a name="line.224"></a>
+<FONT color="green">225</FONT>        @Override<a name="line.225"></a>
+<FONT color="green">226</FONT>        public synchronized void setMinImpl(StorelessUnivariateStatistic[] minImpl)<a name="line.226"></a>
+<FONT color="green">227</FONT>          throws DimensionMismatchException {<a name="line.227"></a>
+<FONT color="green">228</FONT>            super.setMinImpl(minImpl);<a name="line.228"></a>
+<FONT color="green">229</FONT>        }<a name="line.229"></a>
+<FONT color="green">230</FONT>    <a name="line.230"></a>
+<FONT color="green">231</FONT>        /**<a name="line.231"></a>
+<FONT color="green">232</FONT>         * {@inheritDoc}<a name="line.232"></a>
+<FONT color="green">233</FONT>         */<a name="line.233"></a>
+<FONT color="green">234</FONT>        @Override<a name="line.234"></a>
+<FONT color="green">235</FONT>        public synchronized StorelessUnivariateStatistic[] getMaxImpl() {<a name="line.235"></a>
+<FONT color="green">236</FONT>            return super.getMaxImpl();<a name="line.236"></a>
+<FONT color="green">237</FONT>        }<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>        /**<a name="line.239"></a>
+<FONT color="green">240</FONT>         * {@inheritDoc}<a name="line.240"></a>
+<FONT color="green">241</FONT>         */<a name="line.241"></a>
+<FONT color="green">242</FONT>        @Override<a name="line.242"></a>
+<FONT color="green">243</FONT>        public synchronized void setMaxImpl(StorelessUnivariateStatistic[] maxImpl)<a name="line.243"></a>
+<FONT color="green">244</FONT>          throws DimensionMismatchException {<a name="line.244"></a>
+<FONT color="green">245</FONT>            super.setMaxImpl(maxImpl);<a name="line.245"></a>
+<FONT color="green">246</FONT>        }<a name="line.246"></a>
+<FONT color="green">247</FONT>    <a name="line.247"></a>
+<FONT color="green">248</FONT>        /**<a name="line.248"></a>
+<FONT color="green">249</FONT>         * {@inheritDoc}<a name="line.249"></a>
+<FONT color="green">250</FONT>         */<a name="line.250"></a>
+<FONT color="green">251</FONT>        @Override<a name="line.251"></a>
+<FONT color="green">252</FONT>        public synchronized StorelessUnivariateStatistic[] getSumLogImpl() {<a name="line.252"></a>
+<FONT color="green">253</FONT>            return super.getSumLogImpl();<a name="line.253"></a>
+<FONT color="green">254</FONT>        }<a name="line.254"></a>
+<FONT color="green">255</FONT>    <a name="line.255"></a>
+<FONT color="green">256</FONT>        /**<a name="line.256"></a>
+<FONT color="green">257</FONT>         * {@inheritDoc}<a name="line.257"></a>
+<FONT color="green">258</FONT>         */<a name="line.258"></a>
+<FONT color="green">259</FONT>        @Override<a name="line.259"></a>
+<FONT color="green">260</FONT>        public synchronized void setSumLogImpl(StorelessUnivariateStatistic[] sumLogImpl)<a name="line.260"></a>
+<FONT color="green">261</FONT>          throws DimensionMismatchException {<a name="line.261"></a>
+<FONT color="green">262</FONT>            super.setSumLogImpl(sumLogImpl);<a name="line.262"></a>
+<FONT color="green">263</FONT>        }<a name="line.263"></a>
+<FONT color="green">264</FONT>    <a name="line.264"></a>
+<FONT color="green">265</FONT>        /**<a name="line.265"></a>
+<FONT color="green">266</FONT>         * {@inheritDoc}<a name="line.266"></a>
+<FONT color="green">267</FONT>         */<a name="line.267"></a>
+<FONT color="green">268</FONT>        @Override<a name="line.268"></a>
+<FONT color="green">269</FONT>        public synchronized StorelessUnivariateStatistic[] getGeoMeanImpl() {<a name="line.269"></a>
+<FONT color="green">270</FONT>            return super.getGeoMeanImpl();<a name="line.270"></a>
+<FONT color="green">271</FONT>        }<a name="line.271"></a>
+<FONT color="green">272</FONT>    <a name="line.272"></a>
+<FONT color="green">273</FONT>        /**<a name="line.273"></a>
+<FONT color="green">274</FONT>         * {@inheritDoc}<a name="line.274"></a>
+<FONT color="green">275</FONT>         */<a name="line.275"></a>
+<FONT color="green">276</FONT>        @Override<a name="line.276"></a>
+<FONT color="green">277</FONT>        public synchronized void setGeoMeanImpl(StorelessUnivariateStatistic[] geoMeanImpl)<a name="line.277"></a>
+<FONT color="green">278</FONT>          throws DimensionMismatchException {<a name="line.278"></a>
+<FONT color="green">279</FONT>            super.setGeoMeanImpl(geoMeanImpl);<a name="line.279"></a>
+<FONT color="green">280</FONT>        }<a name="line.280"></a>
+<FONT color="green">281</FONT>    <a name="line.281"></a>
+<FONT color="green">282</FONT>        /**<a name="line.282"></a>
+<FONT color="green">283</FONT>         * {@inheritDoc}<a name="line.283"></a>
+<FONT color="green">284</FONT>         */<a name="line.284"></a>
+<FONT color="green">285</FONT>        @Override<a name="line.285"></a>
+<FONT color="green">286</FONT>        public synchronized StorelessUnivariateStatistic[] getMeanImpl() {<a name="line.286"></a>
+<FONT color="green">287</FONT>            return super.getMeanImpl();<a name="line.287"></a>
+<FONT color="green">288</FONT>        }<a name="line.288"></a>
+<FONT color="green">289</FONT>    <a name="line.289"></a>
+<FONT color="green">290</FONT>        /**<a name="line.290"></a>
+<FONT color="green">291</FONT>         * {@inheritDoc}<a name="line.291"></a>
+<FONT color="green">292</FONT>         */<a name="line.292"></a>
+<FONT color="green">293</FONT>        @Override<a name="line.293"></a>
+<FONT color="green">294</FONT>        public synchronized void setMeanImpl(StorelessUnivariateStatistic[] meanImpl)<a name="line.294"></a>
+<FONT color="green">295</FONT>          throws DimensionMismatchException {<a name="line.295"></a>
+<FONT color="green">296</FONT>            super.setMeanImpl(meanImpl);<a name="line.296"></a>
+<FONT color="green">297</FONT>        }<a name="line.297"></a>
+<FONT color="green">298</FONT>    <a name="line.298"></a>
+<FONT color="green">299</FONT>    }<a name="line.299"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/SynchronizedSummaryStatistics.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,399 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Implementation of<a name="line.20"></a>
+<FONT color="green">021</FONT>     * {@link org.apache.commons.math.stat.descriptive.SummaryStatistics} that<a name="line.21"></a>
+<FONT color="green">022</FONT>     * is safe to use in a multithreaded environment.  Multiple threads can safely<a name="line.22"></a>
+<FONT color="green">023</FONT>     * operate on a single instance without causing runtime exceptions due to race<a name="line.23"></a>
+<FONT color="green">024</FONT>     * conditions.  In effect, this implementation makes modification and access<a name="line.24"></a>
+<FONT color="green">025</FONT>     * methods atomic operations for a single instance.  That is to say, as one<a name="line.25"></a>
+<FONT color="green">026</FONT>     * thread is computing a statistic from the instance, no other thread can modify<a name="line.26"></a>
+<FONT color="green">027</FONT>     * the instance nor compute another statistic.<a name="line.27"></a>
+<FONT color="green">028</FONT>     *<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @since 1.2<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    public class SynchronizedSummaryStatistics extends SummaryStatistics {<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /** Serialization UID */<a name="line.34"></a>
+<FONT color="green">035</FONT>        private static final long serialVersionUID = 1909861009042253704L;<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /**<a name="line.37"></a>
+<FONT color="green">038</FONT>         * Construct a SynchronizedSummaryStatistics instance<a name="line.38"></a>
+<FONT color="green">039</FONT>         */<a name="line.39"></a>
+<FONT color="green">040</FONT>        public SynchronizedSummaryStatistics() {<a name="line.40"></a>
+<FONT color="green">041</FONT>            super();<a name="line.41"></a>
+<FONT color="green">042</FONT>        }<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /**<a name="line.44"></a>
+<FONT color="green">045</FONT>         * A copy constructor. Creates a deep-copy of the {@code original}.<a name="line.45"></a>
+<FONT color="green">046</FONT>         *<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @param original the {@code SynchronizedSummaryStatistics} instance to copy<a name="line.47"></a>
+<FONT color="green">048</FONT>         */<a name="line.48"></a>
+<FONT color="green">049</FONT>        public SynchronizedSummaryStatistics(SynchronizedSummaryStatistics original) {<a name="line.49"></a>
+<FONT color="green">050</FONT>            copy(original, this);<a name="line.50"></a>
+<FONT color="green">051</FONT>        }<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * {@inheritDoc}<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        @Override<a name="line.56"></a>
+<FONT color="green">057</FONT>        public synchronized StatisticalSummary getSummary() {<a name="line.57"></a>
+<FONT color="green">058</FONT>            return super.getSummary();<a name="line.58"></a>
+<FONT color="green">059</FONT>        }<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * {@inheritDoc}<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        @Override<a name="line.64"></a>
+<FONT color="green">065</FONT>        public synchronized void addValue(double value) {<a name="line.65"></a>
+<FONT color="green">066</FONT>            super.addValue(value);<a name="line.66"></a>
+<FONT color="green">067</FONT>        }<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * {@inheritDoc}<a name="line.70"></a>
+<FONT color="green">071</FONT>         */<a name="line.71"></a>
+<FONT color="green">072</FONT>        @Override<a name="line.72"></a>
+<FONT color="green">073</FONT>        public synchronized long getN() {<a name="line.73"></a>
+<FONT color="green">074</FONT>            return super.getN();<a name="line.74"></a>
+<FONT color="green">075</FONT>        }<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /**<a name="line.77"></a>
+<FONT color="green">078</FONT>         * {@inheritDoc}<a name="line.78"></a>
+<FONT color="green">079</FONT>         */<a name="line.79"></a>
+<FONT color="green">080</FONT>        @Override<a name="line.80"></a>
+<FONT color="green">081</FONT>        public synchronized double getSum() {<a name="line.81"></a>
+<FONT color="green">082</FONT>            return super.getSum();<a name="line.82"></a>
+<FONT color="green">083</FONT>        }<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>        /**<a name="line.85"></a>
+<FONT color="green">086</FONT>         * {@inheritDoc}<a name="line.86"></a>
+<FONT color="green">087</FONT>         */<a name="line.87"></a>
+<FONT color="green">088</FONT>        @Override<a name="line.88"></a>
+<FONT color="green">089</FONT>        public synchronized double getSumsq() {<a name="line.89"></a>
+<FONT color="green">090</FONT>            return super.getSumsq();<a name="line.90"></a>
+<FONT color="green">091</FONT>        }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /**<a name="line.93"></a>
+<FONT color="green">094</FONT>         * {@inheritDoc}<a name="line.94"></a>
+<FONT color="green">095</FONT>         */<a name="line.95"></a>
+<FONT color="green">096</FONT>        @Override<a name="line.96"></a>
+<FONT color="green">097</FONT>        public synchronized double getMean() {<a name="line.97"></a>
+<FONT color="green">098</FONT>            return super.getMean();<a name="line.98"></a>
+<FONT color="green">099</FONT>        }<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /**<a name="line.101"></a>
+<FONT color="green">102</FONT>         * {@inheritDoc}<a name="line.102"></a>
+<FONT color="green">103</FONT>         */<a name="line.103"></a>
+<FONT color="green">104</FONT>        @Override<a name="line.104"></a>
+<FONT color="green">105</FONT>        public synchronized double getStandardDeviation() {<a name="line.105"></a>
+<FONT color="green">106</FONT>            return super.getStandardDeviation();<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /**<a name="line.109"></a>
+<FONT color="green">110</FONT>         * {@inheritDoc}<a name="line.110"></a>
+<FONT color="green">111</FONT>         */<a name="line.111"></a>
+<FONT color="green">112</FONT>        @Override<a name="line.112"></a>
+<FONT color="green">113</FONT>        public synchronized double getVariance() {<a name="line.113"></a>
+<FONT color="green">114</FONT>            return super.getVariance();<a name="line.114"></a>
+<FONT color="green">115</FONT>        }<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>        /**<a name="line.117"></a>
+<FONT color="green">118</FONT>         * {@inheritDoc}<a name="line.118"></a>
+<FONT color="green">119</FONT>         */<a name="line.119"></a>
+<FONT color="green">120</FONT>        @Override<a name="line.120"></a>
+<FONT color="green">121</FONT>        public synchronized double getMax() {<a name="line.121"></a>
+<FONT color="green">122</FONT>            return super.getMax();<a name="line.122"></a>
+<FONT color="green">123</FONT>        }<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>        /**<a name="line.125"></a>
+<FONT color="green">126</FONT>         * {@inheritDoc}<a name="line.126"></a>
+<FONT color="green">127</FONT>         */<a name="line.127"></a>
+<FONT color="green">128</FONT>        @Override<a name="line.128"></a>
+<FONT color="green">129</FONT>        public synchronized double getMin() {<a name="line.129"></a>
+<FONT color="green">130</FONT>            return super.getMin();<a name="line.130"></a>
+<FONT color="green">131</FONT>        }<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>        /**<a name="line.133"></a>
+<FONT color="green">134</FONT>         * {@inheritDoc}<a name="line.134"></a>
+<FONT color="green">135</FONT>         */<a name="line.135"></a>
+<FONT color="green">136</FONT>        @Override<a name="line.136"></a>
+<FONT color="green">137</FONT>        public synchronized double getGeometricMean() {<a name="line.137"></a>
+<FONT color="green">138</FONT>            return super.getGeometricMean();<a name="line.138"></a>
+<FONT color="green">139</FONT>        }<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>        /**<a name="line.141"></a>
+<FONT color="green">142</FONT>         * {@inheritDoc}<a name="line.142"></a>
+<FONT color="green">143</FONT>         */<a name="line.143"></a>
+<FONT color="green">144</FONT>        @Override<a name="line.144"></a>
+<FONT color="green">145</FONT>        public synchronized String toString() {<a name="line.145"></a>
+<FONT color="green">146</FONT>            return super.toString();<a name="line.146"></a>
+<FONT color="green">147</FONT>        }<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>        /**<a name="line.149"></a>
+<FONT color="green">150</FONT>         * {@inheritDoc}<a name="line.150"></a>
+<FONT color="green">151</FONT>         */<a name="line.151"></a>
+<FONT color="green">152</FONT>        @Override<a name="line.152"></a>
+<FONT color="green">153</FONT>        public synchronized void clear() {<a name="line.153"></a>
+<FONT color="green">154</FONT>            super.clear();<a name="line.154"></a>
+<FONT color="green">155</FONT>        }<a name="line.155"></a>
+<FONT color="green">156</FONT>    <a name="line.156"></a>
+<FONT color="green">157</FONT>        /**<a name="line.157"></a>
+<FONT color="green">158</FONT>         * {@inheritDoc}<a name="line.158"></a>
+<FONT color="green">159</FONT>         */<a name="line.159"></a>
+<FONT color="green">160</FONT>        @Override<a name="line.160"></a>
+<FONT color="green">161</FONT>        public synchronized boolean equals(Object object) {<a name="line.161"></a>
+<FONT color="green">162</FONT>            return super.equals(object);<a name="line.162"></a>
+<FONT color="green">163</FONT>        }<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>        /**<a name="line.165"></a>
+<FONT color="green">166</FONT>         * {@inheritDoc}<a name="line.166"></a>
+<FONT color="green">167</FONT>         */<a name="line.167"></a>
+<FONT color="green">168</FONT>        @Override<a name="line.168"></a>
+<FONT color="green">169</FONT>        public synchronized int hashCode() {<a name="line.169"></a>
+<FONT color="green">170</FONT>            return super.hashCode();<a name="line.170"></a>
+<FONT color="green">171</FONT>        }<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>        /**<a name="line.173"></a>
+<FONT color="green">174</FONT>         * {@inheritDoc}<a name="line.174"></a>
+<FONT color="green">175</FONT>         */<a name="line.175"></a>
+<FONT color="green">176</FONT>        @Override<a name="line.176"></a>
+<FONT color="green">177</FONT>        public synchronized StorelessUnivariateStatistic getSumImpl() {<a name="line.177"></a>
+<FONT color="green">178</FONT>            return super.getSumImpl();<a name="line.178"></a>
+<FONT color="green">179</FONT>        }<a name="line.179"></a>
+<FONT color="green">180</FONT>    <a name="line.180"></a>
+<FONT color="green">181</FONT>        /**<a name="line.181"></a>
+<FONT color="green">182</FONT>         * {@inheritDoc}<a name="line.182"></a>
+<FONT color="green">183</FONT>         */<a name="line.183"></a>
+<FONT color="green">184</FONT>        @Override<a name="line.184"></a>
+<FONT color="green">185</FONT>        public synchronized void setSumImpl(StorelessUnivariateStatistic sumImpl) {<a name="line.185"></a>
+<FONT color="green">186</FONT>            super.setSumImpl(sumImpl);<a name="line.186"></a>
+<FONT color="green">187</FONT>        }<a name="line.187"></a>
+<FONT color="green">188</FONT>    <a name="line.188"></a>
+<FONT color="green">189</FONT>        /**<a name="line.189"></a>
+<FONT color="green">190</FONT>         * {@inheritDoc}<a name="line.190"></a>
+<FONT color="green">191</FONT>         */<a name="line.191"></a>
+<FONT color="green">192</FONT>        @Override<a name="line.192"></a>
+<FONT color="green">193</FONT>        public synchronized StorelessUnivariateStatistic getSumsqImpl() {<a name="line.193"></a>
+<FONT color="green">194</FONT>            return super.getSumsqImpl();<a name="line.194"></a>
+<FONT color="green">195</FONT>        }<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>        /**<a name="line.197"></a>
+<FONT color="green">198</FONT>         * {@inheritDoc}<a name="line.198"></a>
+<FONT color="green">199</FONT>         */<a name="line.199"></a>
+<FONT color="green">200</FONT>        @Override<a name="line.200"></a>
+<FONT color="green">201</FONT>        public synchronized void setSumsqImpl(StorelessUnivariateStatistic sumsqImpl) {<a name="line.201"></a>
+<FONT color="green">202</FONT>            super.setSumsqImpl(sumsqImpl);<a name="line.202"></a>
+<FONT color="green">203</FONT>        }<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>        /**<a name="line.205"></a>
+<FONT color="green">206</FONT>         * {@inheritDoc}<a name="line.206"></a>
+<FONT color="green">207</FONT>         */<a name="line.207"></a>
+<FONT color="green">208</FONT>        @Override<a name="line.208"></a>
+<FONT color="green">209</FONT>        public synchronized StorelessUnivariateStatistic getMinImpl() {<a name="line.209"></a>
+<FONT color="green">210</FONT>            return super.getMinImpl();<a name="line.210"></a>
+<FONT color="green">211</FONT>        }<a name="line.211"></a>
+<FONT color="green">212</FONT>    <a name="line.212"></a>
+<FONT color="green">213</FONT>        /**<a name="line.213"></a>
+<FONT color="green">214</FONT>         * {@inheritDoc}<a name="line.214"></a>
+<FONT color="green">215</FONT>         */<a name="line.215"></a>
+<FONT color="green">216</FONT>        @Override<a name="line.216"></a>
+<FONT color="green">217</FONT>        public synchronized void setMinImpl(StorelessUnivariateStatistic minImpl) {<a name="line.217"></a>
+<FONT color="green">218</FONT>            super.setMinImpl(minImpl);<a name="line.218"></a>
+<FONT color="green">219</FONT>        }<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>        /**<a name="line.221"></a>
+<FONT color="green">222</FONT>         * {@inheritDoc}<a name="line.222"></a>
+<FONT color="green">223</FONT>         */<a name="line.223"></a>
+<FONT color="green">224</FONT>        @Override<a name="line.224"></a>
+<FONT color="green">225</FONT>        public synchronized StorelessUnivariateStatistic getMaxImpl() {<a name="line.225"></a>
+<FONT color="green">226</FONT>            return super.getMaxImpl();<a name="line.226"></a>
+<FONT color="green">227</FONT>        }<a name="line.227"></a>
+<FONT color="green">228</FONT>    <a name="line.228"></a>
+<FONT color="green">229</FONT>        /**<a name="line.229"></a>
+<FONT color="green">230</FONT>         * {@inheritDoc}<a name="line.230"></a>
+<FONT color="green">231</FONT>         */<a name="line.231"></a>
+<FONT color="green">232</FONT>        @Override<a name="line.232"></a>
+<FONT color="green">233</FONT>        public synchronized void setMaxImpl(StorelessUnivariateStatistic maxImpl) {<a name="line.233"></a>
+<FONT color="green">234</FONT>            super.setMaxImpl(maxImpl);<a name="line.234"></a>
+<FONT color="green">235</FONT>        }<a name="line.235"></a>
+<FONT color="green">236</FONT>    <a name="line.236"></a>
+<FONT color="green">237</FONT>        /**<a name="line.237"></a>
+<FONT color="green">238</FONT>         * {@inheritDoc}<a name="line.238"></a>
+<FONT color="green">239</FONT>         */<a name="line.239"></a>
+<FONT color="green">240</FONT>        @Override<a name="line.240"></a>
+<FONT color="green">241</FONT>        public synchronized StorelessUnivariateStatistic getSumLogImpl() {<a name="line.241"></a>
+<FONT color="green">242</FONT>            return super.getSumLogImpl();<a name="line.242"></a>
+<FONT color="green">243</FONT>        }<a name="line.243"></a>
+<FONT color="green">244</FONT>    <a name="line.244"></a>
+<FONT color="green">245</FONT>        /**<a name="line.245"></a>
+<FONT color="green">246</FONT>         * {@inheritDoc}<a name="line.246"></a>
+<FONT color="green">247</FONT>         */<a name="line.247"></a>
+<FONT color="green">248</FONT>        @Override<a name="line.248"></a>
+<FONT color="green">249</FONT>        public synchronized void setSumLogImpl(StorelessUnivariateStatistic sumLogImpl) {<a name="line.249"></a>
+<FONT color="green">250</FONT>            super.setSumLogImpl(sumLogImpl);<a name="line.250"></a>
+<FONT color="green">251</FONT>        }<a name="line.251"></a>
+<FONT color="green">252</FONT>    <a name="line.252"></a>
+<FONT color="green">253</FONT>        /**<a name="line.253"></a>
+<FONT color="green">254</FONT>         * {@inheritDoc}<a name="line.254"></a>
+<FONT color="green">255</FONT>         */<a name="line.255"></a>
+<FONT color="green">256</FONT>        @Override<a name="line.256"></a>
+<FONT color="green">257</FONT>        public synchronized StorelessUnivariateStatistic getGeoMeanImpl() {<a name="line.257"></a>
+<FONT color="green">258</FONT>            return super.getGeoMeanImpl();<a name="line.258"></a>
+<FONT color="green">259</FONT>        }<a name="line.259"></a>
+<FONT color="green">260</FONT>    <a name="line.260"></a>
+<FONT color="green">261</FONT>        /**<a name="line.261"></a>
+<FONT color="green">262</FONT>         * {@inheritDoc}<a name="line.262"></a>
+<FONT color="green">263</FONT>         */<a name="line.263"></a>
+<FONT color="green">264</FONT>        @Override<a name="line.264"></a>
+<FONT color="green">265</FONT>        public synchronized void setGeoMeanImpl(StorelessUnivariateStatistic geoMeanImpl) {<a name="line.265"></a>
+<FONT color="green">266</FONT>            super.setGeoMeanImpl(geoMeanImpl);<a name="line.266"></a>
+<FONT color="green">267</FONT>        }<a name="line.267"></a>
+<FONT color="green">268</FONT>    <a name="line.268"></a>
+<FONT color="green">269</FONT>        /**<a name="line.269"></a>
+<FONT color="green">270</FONT>         * {@inheritDoc}<a name="line.270"></a>
+<FONT color="green">271</FONT>         */<a name="line.271"></a>
+<FONT color="green">272</FONT>        @Override<a name="line.272"></a>
+<FONT color="green">273</FONT>        public synchronized StorelessUnivariateStatistic getMeanImpl() {<a name="line.273"></a>
+<FONT color="green">274</FONT>            return super.getMeanImpl();<a name="line.274"></a>
+<FONT color="green">275</FONT>        }<a name="line.275"></a>
+<FONT color="green">276</FONT>    <a name="line.276"></a>
+<FONT color="green">277</FONT>        /**<a name="line.277"></a>
+<FONT color="green">278</FONT>         * {@inheritDoc}<a name="line.278"></a>
+<FONT color="green">279</FONT>         */<a name="line.279"></a>
+<FONT color="green">280</FONT>        @Override<a name="line.280"></a>
+<FONT color="green">281</FONT>        public synchronized void setMeanImpl(StorelessUnivariateStatistic meanImpl) {<a name="line.281"></a>
+<FONT color="green">282</FONT>            super.setMeanImpl(meanImpl);<a name="line.282"></a>
+<FONT color="green">283</FONT>        }<a name="line.283"></a>
+<FONT color="green">284</FONT>    <a name="line.284"></a>
+<FONT color="green">285</FONT>        /**<a name="line.285"></a>
+<FONT color="green">286</FONT>         * {@inheritDoc}<a name="line.286"></a>
+<FONT color="green">287</FONT>         */<a name="line.287"></a>
+<FONT color="green">288</FONT>        @Override<a name="line.288"></a>
+<FONT color="green">289</FONT>        public synchronized StorelessUnivariateStatistic getVarianceImpl() {<a name="line.289"></a>
+<FONT color="green">290</FONT>            return super.getVarianceImpl();<a name="line.290"></a>
+<FONT color="green">291</FONT>        }<a name="line.291"></a>
+<FONT color="green">292</FONT>    <a name="line.292"></a>
+<FONT color="green">293</FONT>        /**<a name="line.293"></a>
+<FONT color="green">294</FONT>         * {@inheritDoc}<a name="line.294"></a>
+<FONT color="green">295</FONT>         */<a name="line.295"></a>
+<FONT color="green">296</FONT>        @Override<a name="line.296"></a>
+<FONT color="green">297</FONT>        public synchronized void setVarianceImpl(StorelessUnivariateStatistic varianceImpl) {<a name="line.297"></a>
+<FONT color="green">298</FONT>            super.setVarianceImpl(varianceImpl);<a name="line.298"></a>
+<FONT color="green">299</FONT>        }<a name="line.299"></a>
+<FONT color="green">300</FONT>    <a name="line.300"></a>
+<FONT color="green">301</FONT>        /**<a name="line.301"></a>
+<FONT color="green">302</FONT>         * Returns a copy of this SynchronizedSummaryStatistics instance with the<a name="line.302"></a>
+<FONT color="green">303</FONT>         * same internal state.<a name="line.303"></a>
+<FONT color="green">304</FONT>         *<a name="line.304"></a>
+<FONT color="green">305</FONT>         * @return a copy of this<a name="line.305"></a>
+<FONT color="green">306</FONT>         */<a name="line.306"></a>
+<FONT color="green">307</FONT>        @Override<a name="line.307"></a>
+<FONT color="green">308</FONT>        public synchronized SynchronizedSummaryStatistics copy() {<a name="line.308"></a>
+<FONT color="green">309</FONT>            SynchronizedSummaryStatistics result =<a name="line.309"></a>
+<FONT color="green">310</FONT>                new SynchronizedSummaryStatistics();<a name="line.310"></a>
+<FONT color="green">311</FONT>            copy(this, result);<a name="line.311"></a>
+<FONT color="green">312</FONT>            return result;<a name="line.312"></a>
+<FONT color="green">313</FONT>        }<a name="line.313"></a>
+<FONT color="green">314</FONT>    <a name="line.314"></a>
+<FONT color="green">315</FONT>        /**<a name="line.315"></a>
+<FONT color="green">316</FONT>         * Copies source to dest.<a name="line.316"></a>
+<FONT color="green">317</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.317"></a>
+<FONT color="green">318</FONT>         * &lt;p&gt;Acquires synchronization lock on source, then dest before copying.&lt;/p&gt;<a name="line.318"></a>
+<FONT color="green">319</FONT>         *<a name="line.319"></a>
+<FONT color="green">320</FONT>         * @param source SynchronizedSummaryStatistics to copy<a name="line.320"></a>
+<FONT color="green">321</FONT>         * @param dest SynchronizedSummaryStatistics to copy to<a name="line.321"></a>
+<FONT color="green">322</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.322"></a>
+<FONT color="green">323</FONT>         */<a name="line.323"></a>
+<FONT color="green">324</FONT>        public static void copy(SynchronizedSummaryStatistics source,<a name="line.324"></a>
+<FONT color="green">325</FONT>                SynchronizedSummaryStatistics dest) {<a name="line.325"></a>
+<FONT color="green">326</FONT>            synchronized (source) {<a name="line.326"></a>
+<FONT color="green">327</FONT>                synchronized (dest) {<a name="line.327"></a>
+<FONT color="green">328</FONT>                    SummaryStatistics.copy(source, dest);<a name="line.328"></a>
+<FONT color="green">329</FONT>                }<a name="line.329"></a>
+<FONT color="green">330</FONT>            }<a name="line.330"></a>
+<FONT color="green">331</FONT>        }<a name="line.331"></a>
+<FONT color="green">332</FONT>    <a name="line.332"></a>
+<FONT color="green">333</FONT>    }<a name="line.333"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/UnivariateStatistic.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,119 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Base interface implemented by all statistics.<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     */<a name="line.24"></a>
+<FONT color="green">025</FONT>    public interface UnivariateStatistic {<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>        /**<a name="line.27"></a>
+<FONT color="green">028</FONT>         * Returns the result of evaluating the statistic over the input array.<a name="line.28"></a>
+<FONT color="green">029</FONT>         *<a name="line.29"></a>
+<FONT color="green">030</FONT>         * @param values input array<a name="line.30"></a>
+<FONT color="green">031</FONT>         * @return the value of the statistic applied to the input array<a name="line.31"></a>
+<FONT color="green">032</FONT>         */<a name="line.32"></a>
+<FONT color="green">033</FONT>        double evaluate(double[] values);<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /**<a name="line.35"></a>
+<FONT color="green">036</FONT>         * Returns the result of evaluating the statistic over the specified entries<a name="line.36"></a>
+<FONT color="green">037</FONT>         * in the input array.<a name="line.37"></a>
+<FONT color="green">038</FONT>         *<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @param values the input array<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @param begin the index of the first element to include<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @param length the number of elements to include<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @return the value of the statistic applied to the included array entries<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        double evaluate(double[] values, int begin, int length);<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /**<a name="line.46"></a>
+<FONT color="green">047</FONT>         * Returns a copy of the statistic with the same internal state.<a name="line.47"></a>
+<FONT color="green">048</FONT>         *<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @return a copy of the statistic<a name="line.49"></a>
+<FONT color="green">050</FONT>         */<a name="line.50"></a>
+<FONT color="green">051</FONT>        UnivariateStatistic copy();<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>    }<a name="line.53"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/WeightedEvaluation.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,115 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * Weighted evaluation for statistics.<a name="line.20"></a>
+<FONT color="green">021</FONT>     *<a name="line.21"></a>
+<FONT color="green">022</FONT>     * @since 2.1<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 894474 $ $Date: 2009-12-29 15:02:37 -0500 (Tue, 29 Dec 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     */<a name="line.24"></a>
+<FONT color="green">025</FONT>    public interface WeightedEvaluation {<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>        /**<a name="line.27"></a>
+<FONT color="green">028</FONT>         * Returns the result of evaluating the statistic over the input array,<a name="line.28"></a>
+<FONT color="green">029</FONT>         * using the supplied weights.<a name="line.29"></a>
+<FONT color="green">030</FONT>         *<a name="line.30"></a>
+<FONT color="green">031</FONT>         * @param values input array<a name="line.31"></a>
+<FONT color="green">032</FONT>         * @param weights array of weights<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @return the value of the weighted statistic applied to the input array<a name="line.33"></a>
+<FONT color="green">034</FONT>         */<a name="line.34"></a>
+<FONT color="green">035</FONT>        double evaluate(double[] values, double[] weights);<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /**<a name="line.37"></a>
+<FONT color="green">038</FONT>         * Returns the result of evaluating the statistic over the specified entries<a name="line.38"></a>
+<FONT color="green">039</FONT>         * in the input array, using corresponding entries in the supplied weights array.<a name="line.39"></a>
+<FONT color="green">040</FONT>         *<a name="line.40"></a>
+<FONT color="green">041</FONT>         * @param values the input array<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @param weights array of weights<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @param begin the index of the first element to include<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @param length the number of elements to include<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @return the value of the weighted statistic applied to the included array entries<a name="line.45"></a>
+<FONT color="green">046</FONT>         */<a name="line.46"></a>
+<FONT color="green">047</FONT>        double evaluate(double[] values, double[] weights, int begin, int length);<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>    }<a name="line.49"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/FirstMoment.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,225 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.moment;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Computes the first moment (arithmetic mean).  Uses the definitional formula:<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * mean = sum(x_i) / n &lt;/p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * where &lt;code&gt;n&lt;/code&gt; is the number of observations. &lt;/p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * To limit numeric errors, the value of the statistic is computed using the<a name="line.29"></a>
+<FONT color="green">030</FONT>     * following recursive updating algorithm: &lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;ol&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;li&gt;Initialize &lt;code&gt;m = &lt;/code&gt; the first value&lt;/li&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;li&gt;For each additional value, update using &lt;br&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     *   &lt;code&gt;m = m + (new value - m) / (number of observations)&lt;/code&gt;&lt;/li&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;/ol&gt;&lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     *  Returns &lt;code&gt;Double.NaN&lt;/code&gt; if the dataset is empty.&lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;p&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;strong&gt;Note that this implementation is not synchronized.&lt;/strong&gt; If<a name="line.40"></a>
+<FONT color="green">041</FONT>     * multiple threads access an instance of this class concurrently, and at least<a name="line.41"></a>
+<FONT color="green">042</FONT>     * one of the threads invokes the &lt;code&gt;increment()&lt;/code&gt; or<a name="line.42"></a>
+<FONT color="green">043</FONT>     * &lt;code&gt;clear()&lt;/code&gt; method, it must be synchronized externally.&lt;/p&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     *<a name="line.44"></a>
+<FONT color="green">045</FONT>     * @version $Revision: 902934 $ $Date: 2010-01-25 14:09:17 -0500 (Mon, 25 Jan 2010) $<a name="line.45"></a>
+<FONT color="green">046</FONT>     */<a name="line.46"></a>
+<FONT color="green">047</FONT>    public class FirstMoment extends AbstractStorelessUnivariateStatistic<a name="line.47"></a>
+<FONT color="green">048</FONT>        implements Serializable {<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Serializable version identifier */<a name="line.50"></a>
+<FONT color="green">051</FONT>        private static final long serialVersionUID = 6112755307178490473L;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /** Count of values that have been added */<a name="line.54"></a>
+<FONT color="green">055</FONT>        protected long n;<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /** First moment of values that have been added */<a name="line.57"></a>
+<FONT color="green">058</FONT>        protected double m1;<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /**<a name="line.60"></a>
+<FONT color="green">061</FONT>         * Deviation of most recently added value from previous first moment.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Retained to prevent repeated computation in higher order moments.<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        protected double dev;<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /**<a name="line.66"></a>
+<FONT color="green">067</FONT>         * Deviation of most recently added value from previous first moment,<a name="line.67"></a>
+<FONT color="green">068</FONT>         * normalized by previous sample size.  Retained to prevent repeated<a name="line.68"></a>
+<FONT color="green">069</FONT>         * computation in higher order moments<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        protected double nDev;<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /**<a name="line.73"></a>
+<FONT color="green">074</FONT>         * Create a FirstMoment instance<a name="line.74"></a>
+<FONT color="green">075</FONT>         */<a name="line.75"></a>
+<FONT color="green">076</FONT>        public FirstMoment() {<a name="line.76"></a>
+<FONT color="green">077</FONT>            n = 0;<a name="line.77"></a>
+<FONT color="green">078</FONT>            m1 = Double.NaN;<a name="line.78"></a>
+<FONT color="green">079</FONT>            dev = Double.NaN;<a name="line.79"></a>
+<FONT color="green">080</FONT>            nDev = Double.NaN;<a name="line.80"></a>
+<FONT color="green">081</FONT>        }<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /**<a name="line.83"></a>
+<FONT color="green">084</FONT>         * Copy constructor, creates a new {@code FirstMoment} identical<a name="line.84"></a>
+<FONT color="green">085</FONT>         * to the {@code original}<a name="line.85"></a>
+<FONT color="green">086</FONT>         *<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @param original the {@code FirstMoment} instance to copy<a name="line.87"></a>
+<FONT color="green">088</FONT>         */<a name="line.88"></a>
+<FONT color="green">089</FONT>         public FirstMoment(FirstMoment original) {<a name="line.89"></a>
+<FONT color="green">090</FONT>             super();<a name="line.90"></a>
+<FONT color="green">091</FONT>             copy(original, this);<a name="line.91"></a>
+<FONT color="green">092</FONT>         }<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>        /**<a name="line.94"></a>
+<FONT color="green">095</FONT>         * {@inheritDoc}<a name="line.95"></a>
+<FONT color="green">096</FONT>         */<a name="line.96"></a>
+<FONT color="green">097</FONT>         @Override<a name="line.97"></a>
+<FONT color="green">098</FONT>        public void increment(final double d) {<a name="line.98"></a>
+<FONT color="green">099</FONT>            if (n == 0) {<a name="line.99"></a>
+<FONT color="green">100</FONT>                m1 = 0.0;<a name="line.100"></a>
+<FONT color="green">101</FONT>            }<a name="line.101"></a>
+<FONT color="green">102</FONT>            n++;<a name="line.102"></a>
+<FONT color="green">103</FONT>            double n0 = n;<a name="line.103"></a>
+<FONT color="green">104</FONT>            dev = d - m1;<a name="line.104"></a>
+<FONT color="green">105</FONT>            nDev = dev / n0;<a name="line.105"></a>
+<FONT color="green">106</FONT>            m1 += nDev;<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /**<a name="line.109"></a>
+<FONT color="green">110</FONT>         * {@inheritDoc}<a name="line.110"></a>
+<FONT color="green">111</FONT>         */<a name="line.111"></a>
+<FONT color="green">112</FONT>        @Override<a name="line.112"></a>
+<FONT color="green">113</FONT>        public void clear() {<a name="line.113"></a>
+<FONT color="green">114</FONT>            m1 = Double.NaN;<a name="line.114"></a>
+<FONT color="green">115</FONT>            n = 0;<a name="line.115"></a>
+<FONT color="green">116</FONT>            dev = Double.NaN;<a name="line.116"></a>
+<FONT color="green">117</FONT>            nDev = Double.NaN;<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /**<a name="line.120"></a>
+<FONT color="green">121</FONT>         * {@inheritDoc}<a name="line.121"></a>
+<FONT color="green">122</FONT>         */<a name="line.122"></a>
+<FONT color="green">123</FONT>        @Override<a name="line.123"></a>
+<FONT color="green">124</FONT>        public double getResult() {<a name="line.124"></a>
+<FONT color="green">125</FONT>            return m1;<a name="line.125"></a>
+<FONT color="green">126</FONT>        }<a name="line.126"></a>
+<FONT color="green">127</FONT>    <a name="line.127"></a>
+<FONT color="green">128</FONT>        /**<a name="line.128"></a>
+<FONT color="green">129</FONT>         * {@inheritDoc}<a name="line.129"></a>
+<FONT color="green">130</FONT>         */<a name="line.130"></a>
+<FONT color="green">131</FONT>        public long getN() {<a name="line.131"></a>
+<FONT color="green">132</FONT>            return n;<a name="line.132"></a>
+<FONT color="green">133</FONT>        }<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>        /**<a name="line.135"></a>
+<FONT color="green">136</FONT>         * {@inheritDoc}<a name="line.136"></a>
+<FONT color="green">137</FONT>         */<a name="line.137"></a>
+<FONT color="green">138</FONT>        @Override<a name="line.138"></a>
+<FONT color="green">139</FONT>        public FirstMoment copy() {<a name="line.139"></a>
+<FONT color="green">140</FONT>            FirstMoment result = new FirstMoment();<a name="line.140"></a>
+<FONT color="green">141</FONT>            copy(this, result);<a name="line.141"></a>
+<FONT color="green">142</FONT>            return result;<a name="line.142"></a>
+<FONT color="green">143</FONT>        }<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>        /**<a name="line.145"></a>
+<FONT color="green">146</FONT>         * Copies source to dest.<a name="line.146"></a>
+<FONT color="green">147</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.147"></a>
+<FONT color="green">148</FONT>         *<a name="line.148"></a>
+<FONT color="green">149</FONT>         * @param source FirstMoment to copy<a name="line.149"></a>
+<FONT color="green">150</FONT>         * @param dest FirstMoment to copy to<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.151"></a>
+<FONT color="green">152</FONT>         */<a name="line.152"></a>
+<FONT color="green">153</FONT>        public static void copy(FirstMoment source, FirstMoment dest) {<a name="line.153"></a>
+<FONT color="green">154</FONT>            dest.n = source.n;<a name="line.154"></a>
+<FONT color="green">155</FONT>            dest.m1 = source.m1;<a name="line.155"></a>
+<FONT color="green">156</FONT>            dest.dev = source.dev;<a name="line.156"></a>
+<FONT color="green">157</FONT>            dest.nDev = source.nDev;<a name="line.157"></a>
+<FONT color="green">158</FONT>        }<a name="line.158"></a>
+<FONT color="green">159</FONT>    }<a name="line.159"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/FourthMoment.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,208 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.moment;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Computes a statistic related to the Fourth Central Moment.  Specifically,<a name="line.22"></a>
+<FONT color="green">023</FONT>     * what is computed is the sum of<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * (x_i - xbar) ^ 4, &lt;/p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * where the x_i are the<a name="line.27"></a>
+<FONT color="green">028</FONT>     * sample observations and xbar is the sample mean. &lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * The following recursive updating formula is used: &lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * Let &lt;ul&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;li&gt; dev = (current obs - previous mean) &lt;/li&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;li&gt; m2 = previous value of {@link SecondMoment} &lt;/li&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;li&gt; m2 = previous value of {@link ThirdMoment} &lt;/li&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;li&gt; n = number of observations (including current obs) &lt;/li&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;/ul&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * Then &lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;p&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     * new value = old value - 4 * (dev/n) * m3 + 6 * (dev/n)^2 * m2 + &lt;br&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * [n^2 - 3 * (n-1)] * dev^4 * (n-1) / n^3 &lt;/p&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;p&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     * Returns &lt;code&gt;Double.NaN&lt;/code&gt; if no data values have been added and<a name="line.43"></a>
+<FONT color="green">044</FONT>     * returns &lt;code&gt;0&lt;/code&gt; if there is just one value in the data set. &lt;/p&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     * &lt;p&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     * &lt;strong&gt;Note that this implementation is not synchronized.&lt;/strong&gt; If<a name="line.46"></a>
+<FONT color="green">047</FONT>     * multiple threads access an instance of this class concurrently, and at least<a name="line.47"></a>
+<FONT color="green">048</FONT>     * one of the threads invokes the &lt;code&gt;increment()&lt;/code&gt; or<a name="line.48"></a>
+<FONT color="green">049</FONT>     * &lt;code&gt;clear()&lt;/code&gt; method, it must be synchronized externally. &lt;/p&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     *<a name="line.50"></a>
+<FONT color="green">051</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.51"></a>
+<FONT color="green">052</FONT>     */<a name="line.52"></a>
+<FONT color="green">053</FONT>    public class FourthMoment extends ThirdMoment implements Serializable{<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** Serializable version identifier */<a name="line.55"></a>
+<FONT color="green">056</FONT>        private static final long serialVersionUID = 4763990447117157611L;<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /** fourth moment of values that have been added */<a name="line.58"></a>
+<FONT color="green">059</FONT>        protected double m4;<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Create a FourthMoment instance<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public FourthMoment() {<a name="line.64"></a>
+<FONT color="green">065</FONT>            super();<a name="line.65"></a>
+<FONT color="green">066</FONT>            m4 = Double.NaN;<a name="line.66"></a>
+<FONT color="green">067</FONT>        }<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * Copy constructor, creates a new {@code FourthMoment} identical<a name="line.70"></a>
+<FONT color="green">071</FONT>         * to the {@code original}<a name="line.71"></a>
+<FONT color="green">072</FONT>         *<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @param original the {@code FourthMoment} instance to copy<a name="line.73"></a>
+<FONT color="green">074</FONT>         */<a name="line.74"></a>
+<FONT color="green">075</FONT>         public FourthMoment(FourthMoment original) {<a name="line.75"></a>
+<FONT color="green">076</FONT>             super();<a name="line.76"></a>
+<FONT color="green">077</FONT>             copy(original, this);<a name="line.77"></a>
+<FONT color="green">078</FONT>         }<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /**<a name="line.80"></a>
+<FONT color="green">081</FONT>         * {@inheritDoc}<a name="line.81"></a>
+<FONT color="green">082</FONT>         */<a name="line.82"></a>
+<FONT color="green">083</FONT>         @Override<a name="line.83"></a>
+<FONT color="green">084</FONT>        public void increment(final double d) {<a name="line.84"></a>
+<FONT color="green">085</FONT>            if (n &lt; 1) {<a name="line.85"></a>
+<FONT color="green">086</FONT>                m4 = 0.0;<a name="line.86"></a>
+<FONT color="green">087</FONT>                m3 = 0.0;<a name="line.87"></a>
+<FONT color="green">088</FONT>                m2 = 0.0;<a name="line.88"></a>
+<FONT color="green">089</FONT>                m1 = 0.0;<a name="line.89"></a>
+<FONT color="green">090</FONT>            }<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>            double prevM3 = m3;<a name="line.92"></a>
+<FONT color="green">093</FONT>            double prevM2 = m2;<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>            super.increment(d);<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>            double n0 = n;<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>            m4 = m4 - 4.0 * nDev * prevM3 + 6.0 * nDevSq * prevM2 +<a name="line.99"></a>
+<FONT color="green">100</FONT>                ((n0 * n0) - 3 * (n0 -1)) * (nDevSq * nDevSq * (n0 - 1) * n0);<a name="line.100"></a>
+<FONT color="green">101</FONT>        }<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        /**<a name="line.103"></a>
+<FONT color="green">104</FONT>         * {@inheritDoc}<a name="line.104"></a>
+<FONT color="green">105</FONT>         */<a name="line.105"></a>
+<FONT color="green">106</FONT>        @Override<a name="line.106"></a>
+<FONT color="green">107</FONT>        public double getResult() {<a name="line.107"></a>
+<FONT color="green">108</FONT>            return m4;<a name="line.108"></a>
+<FONT color="green">109</FONT>        }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /**<a name="line.111"></a>
+<FONT color="green">112</FONT>         * {@inheritDoc}<a name="line.112"></a>
+<FONT color="green">113</FONT>         */<a name="line.113"></a>
+<FONT color="green">114</FONT>        @Override<a name="line.114"></a>
+<FONT color="green">115</FONT>        public void clear() {<a name="line.115"></a>
+<FONT color="green">116</FONT>            super.clear();<a name="line.116"></a>
+<FONT color="green">117</FONT>            m4 = Double.NaN;<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /**<a name="line.120"></a>
+<FONT color="green">121</FONT>         * {@inheritDoc}<a name="line.121"></a>
+<FONT color="green">122</FONT>         */<a name="line.122"></a>
+<FONT color="green">123</FONT>        @Override<a name="line.123"></a>
+<FONT color="green">124</FONT>        public FourthMoment copy() {<a name="line.124"></a>
+<FONT color="green">125</FONT>            FourthMoment result = new FourthMoment();<a name="line.125"></a>
+<FONT color="green">126</FONT>            copy(this, result);<a name="line.126"></a>
+<FONT color="green">127</FONT>            return result;<a name="line.127"></a>
+<FONT color="green">128</FONT>        }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /**<a name="line.130"></a>
+<FONT color="green">131</FONT>         * Copies source to dest.<a name="line.131"></a>
+<FONT color="green">132</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.132"></a>
+<FONT color="green">133</FONT>         *<a name="line.133"></a>
+<FONT color="green">134</FONT>         * @param source FourthMoment to copy<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @param dest FourthMoment to copy to<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.136"></a>
+<FONT color="green">137</FONT>         */<a name="line.137"></a>
+<FONT color="green">138</FONT>        public static void copy(FourthMoment source, FourthMoment dest) {<a name="line.138"></a>
+<FONT color="green">139</FONT>            ThirdMoment.copy(source, dest);<a name="line.139"></a>
+<FONT color="green">140</FONT>            dest.m4 = source.m4;<a name="line.140"></a>
+<FONT color="green">141</FONT>        }<a name="line.141"></a>
+<FONT color="green">142</FONT>    }<a name="line.142"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/GeometricMean.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,268 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.moment;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.stat.descriptive.StorelessUnivariateStatistic;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.stat.descriptive.summary.SumOfLogs;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Returns the &lt;a href="http://www.xycoon.com/geometric_mean.htm"&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * geometric mean &lt;/a&gt; of the available values.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * Uses a {@link SumOfLogs} instance to compute sum of logs and returns<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;code&gt; exp( 1/n  (sum of logs) ).&lt;/code&gt;  Therefore, &lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;ul&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;li&gt;If any of values are &lt; 0, the result is &lt;code&gt;NaN.&lt;/code&gt;&lt;/li&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;li&gt;If all values are non-negative and less than<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt;,  but at least one value is 0, the<a name="line.35"></a>
+<FONT color="green">036</FONT>     * result is &lt;code&gt;0.&lt;/code&gt;&lt;/li&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;li&gt;If both &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt; and<a name="line.37"></a>
+<FONT color="green">038</FONT>     * &lt;code&gt;Double.NEGATIVE_INFINITY&lt;/code&gt; are among the values, the result is<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;code&gt;NaN.&lt;/code&gt;&lt;/li&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;/ul&gt; &lt;/p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;p&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;strong&gt;Note that this implementation is not synchronized.&lt;/strong&gt; If<a name="line.42"></a>
+<FONT color="green">043</FONT>     * multiple threads access an instance of this class concurrently, and at least<a name="line.43"></a>
+<FONT color="green">044</FONT>     * one of the threads invokes the &lt;code&gt;increment()&lt;/code&gt; or<a name="line.44"></a>
+<FONT color="green">045</FONT>     * &lt;code&gt;clear()&lt;/code&gt; method, it must be synchronized externally.&lt;/p&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     *<a name="line.46"></a>
+<FONT color="green">047</FONT>     *<a name="line.47"></a>
+<FONT color="green">048</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.48"></a>
+<FONT color="green">049</FONT>     */<a name="line.49"></a>
+<FONT color="green">050</FONT>    public class GeometricMean extends AbstractStorelessUnivariateStatistic implements Serializable {<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /** Serializable version identifier */<a name="line.52"></a>
+<FONT color="green">053</FONT>        private static final long serialVersionUID = -8178734905303459453L;<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** Wrapped SumOfLogs instance */<a name="line.55"></a>
+<FONT color="green">056</FONT>        private StorelessUnivariateStatistic sumOfLogs;<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /**<a name="line.58"></a>
+<FONT color="green">059</FONT>         * Create a GeometricMean instance<a name="line.59"></a>
+<FONT color="green">060</FONT>         */<a name="line.60"></a>
+<FONT color="green">061</FONT>        public GeometricMean() {<a name="line.61"></a>
+<FONT color="green">062</FONT>            sumOfLogs = new SumOfLogs();<a name="line.62"></a>
+<FONT color="green">063</FONT>        }<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /**<a name="line.65"></a>
+<FONT color="green">066</FONT>         * Copy constructor, creates a new {@code GeometricMean} identical<a name="line.66"></a>
+<FONT color="green">067</FONT>         * to the {@code original}<a name="line.67"></a>
+<FONT color="green">068</FONT>         *<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @param original the {@code GeometricMean} instance to copy<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        public GeometricMean(GeometricMean original) {<a name="line.71"></a>
+<FONT color="green">072</FONT>            super();<a name="line.72"></a>
+<FONT color="green">073</FONT>            copy(original, this);<a name="line.73"></a>
+<FONT color="green">074</FONT>        }<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        /**<a name="line.76"></a>
+<FONT color="green">077</FONT>         * Create a GeometricMean instance using the given SumOfLogs instance<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @param sumOfLogs sum of logs instance to use for computation<a name="line.78"></a>
+<FONT color="green">079</FONT>         */<a name="line.79"></a>
+<FONT color="green">080</FONT>        public GeometricMean(SumOfLogs sumOfLogs) {<a name="line.80"></a>
+<FONT color="green">081</FONT>            this.sumOfLogs = sumOfLogs;<a name="line.81"></a>
+<FONT color="green">082</FONT>        }<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /**<a name="line.84"></a>
+<FONT color="green">085</FONT>         * {@inheritDoc}<a name="line.85"></a>
+<FONT color="green">086</FONT>         */<a name="line.86"></a>
+<FONT color="green">087</FONT>        @Override<a name="line.87"></a>
+<FONT color="green">088</FONT>        public GeometricMean copy() {<a name="line.88"></a>
+<FONT color="green">089</FONT>            GeometricMean result = new GeometricMean();<a name="line.89"></a>
+<FONT color="green">090</FONT>            copy(this, result);<a name="line.90"></a>
+<FONT color="green">091</FONT>            return result;<a name="line.91"></a>
+<FONT color="green">092</FONT>        }<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>        /**<a name="line.94"></a>
+<FONT color="green">095</FONT>         * {@inheritDoc}<a name="line.95"></a>
+<FONT color="green">096</FONT>         */<a name="line.96"></a>
+<FONT color="green">097</FONT>        @Override<a name="line.97"></a>
+<FONT color="green">098</FONT>        public void increment(final double d) {<a name="line.98"></a>
+<FONT color="green">099</FONT>            sumOfLogs.increment(d);<a name="line.99"></a>
+<FONT color="green">100</FONT>        }<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>        /**<a name="line.102"></a>
+<FONT color="green">103</FONT>         * {@inheritDoc}<a name="line.103"></a>
+<FONT color="green">104</FONT>         */<a name="line.104"></a>
+<FONT color="green">105</FONT>        @Override<a name="line.105"></a>
+<FONT color="green">106</FONT>        public double getResult() {<a name="line.106"></a>
+<FONT color="green">107</FONT>            if (sumOfLogs.getN() &gt; 0) {<a name="line.107"></a>
+<FONT color="green">108</FONT>                return Math.exp(sumOfLogs.getResult() / sumOfLogs.getN());<a name="line.108"></a>
+<FONT color="green">109</FONT>            } else {<a name="line.109"></a>
+<FONT color="green">110</FONT>                return Double.NaN;<a name="line.110"></a>
+<FONT color="green">111</FONT>            }<a name="line.111"></a>
+<FONT color="green">112</FONT>        }<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /**<a name="line.114"></a>
+<FONT color="green">115</FONT>         * {@inheritDoc}<a name="line.115"></a>
+<FONT color="green">116</FONT>         */<a name="line.116"></a>
+<FONT color="green">117</FONT>        @Override<a name="line.117"></a>
+<FONT color="green">118</FONT>        public void clear() {<a name="line.118"></a>
+<FONT color="green">119</FONT>            sumOfLogs.clear();<a name="line.119"></a>
+<FONT color="green">120</FONT>        }<a name="line.120"></a>
+<FONT color="green">121</FONT>    <a name="line.121"></a>
+<FONT color="green">122</FONT>        /**<a name="line.122"></a>
+<FONT color="green">123</FONT>         * Returns the geometric mean of the entries in the specified portion<a name="line.123"></a>
+<FONT color="green">124</FONT>         * of the input array.<a name="line.124"></a>
+<FONT color="green">125</FONT>         * &lt;p&gt;<a name="line.125"></a>
+<FONT color="green">126</FONT>         * See {@link GeometricMean} for details on the computing algorithm.&lt;/p&gt;<a name="line.126"></a>
+<FONT color="green">127</FONT>         * &lt;p&gt;<a name="line.127"></a>
+<FONT color="green">128</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.128"></a>
+<FONT color="green">129</FONT>         *<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @param values input array containing the values<a name="line.130"></a>
+<FONT color="green">131</FONT>         * @param begin first array element to include<a name="line.131"></a>
+<FONT color="green">132</FONT>         * @param length the number of elements to include<a name="line.132"></a>
+<FONT color="green">133</FONT>         * @return the geometric mean or Double.NaN if length = 0 or<a name="line.133"></a>
+<FONT color="green">134</FONT>         * any of the values are &amp;lt;= 0.<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @throws IllegalArgumentException if the input array is null or the array<a name="line.135"></a>
+<FONT color="green">136</FONT>         * index parameters are not valid<a name="line.136"></a>
+<FONT color="green">137</FONT>         */<a name="line.137"></a>
+<FONT color="green">138</FONT>        @Override<a name="line.138"></a>
+<FONT color="green">139</FONT>        public double evaluate(<a name="line.139"></a>
+<FONT color="green">140</FONT>            final double[] values, final int begin, final int length) {<a name="line.140"></a>
+<FONT color="green">141</FONT>            return Math.exp(<a name="line.141"></a>
+<FONT color="green">142</FONT>                sumOfLogs.evaluate(values, begin, length) / length);<a name="line.142"></a>
+<FONT color="green">143</FONT>        }<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>        /**<a name="line.145"></a>
+<FONT color="green">146</FONT>         * {@inheritDoc}<a name="line.146"></a>
+<FONT color="green">147</FONT>         */<a name="line.147"></a>
+<FONT color="green">148</FONT>        public long getN() {<a name="line.148"></a>
+<FONT color="green">149</FONT>            return sumOfLogs.getN();<a name="line.149"></a>
+<FONT color="green">150</FONT>        }<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>        /**<a name="line.152"></a>
+<FONT color="green">153</FONT>         * &lt;p&gt;Sets the implementation for the sum of logs.&lt;/p&gt;<a name="line.153"></a>
+<FONT color="green">154</FONT>         * &lt;p&gt;This method must be activated before any data has been added - i.e.,<a name="line.154"></a>
+<FONT color="green">155</FONT>         * before {@link #increment(double) increment} has been used to add data;<a name="line.155"></a>
+<FONT color="green">156</FONT>         * otherwise an IllegalStateException will be thrown.&lt;/p&gt;<a name="line.156"></a>
+<FONT color="green">157</FONT>         *<a name="line.157"></a>
+<FONT color="green">158</FONT>         * @param sumLogImpl the StorelessUnivariateStatistic instance to use<a name="line.158"></a>
+<FONT color="green">159</FONT>         * for computing the log sum<a name="line.159"></a>
+<FONT color="green">160</FONT>         * @throws IllegalStateException if data has already been added<a name="line.160"></a>
+<FONT color="green">161</FONT>         *  (i.e if n &gt; 0)<a name="line.161"></a>
+<FONT color="green">162</FONT>         */<a name="line.162"></a>
+<FONT color="green">163</FONT>        public void setSumLogImpl(<a name="line.163"></a>
+<FONT color="green">164</FONT>                StorelessUnivariateStatistic sumLogImpl) {<a name="line.164"></a>
+<FONT color="green">165</FONT>            checkEmpty();<a name="line.165"></a>
+<FONT color="green">166</FONT>            this.sumOfLogs = sumLogImpl;<a name="line.166"></a>
+<FONT color="green">167</FONT>        }<a name="line.167"></a>
+<FONT color="green">168</FONT>    <a name="line.168"></a>
+<FONT color="green">169</FONT>        /**<a name="line.169"></a>
+<FONT color="green">170</FONT>         * Returns the currently configured sum of logs implementation<a name="line.170"></a>
+<FONT color="green">171</FONT>         *<a name="line.171"></a>
+<FONT color="green">172</FONT>         * @return the StorelessUnivariateStatistic implementing the log sum<a name="line.172"></a>
+<FONT color="green">173</FONT>         */<a name="line.173"></a>
+<FONT color="green">174</FONT>        public StorelessUnivariateStatistic getSumLogImpl() {<a name="line.174"></a>
+<FONT color="green">175</FONT>            return sumOfLogs;<a name="line.175"></a>
+<FONT color="green">176</FONT>        }<a name="line.176"></a>
+<FONT color="green">177</FONT>    <a name="line.177"></a>
+<FONT color="green">178</FONT>        /**<a name="line.178"></a>
+<FONT color="green">179</FONT>         * Copies source to dest.<a name="line.179"></a>
+<FONT color="green">180</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.180"></a>
+<FONT color="green">181</FONT>         *<a name="line.181"></a>
+<FONT color="green">182</FONT>         * @param source GeometricMean to copy<a name="line.182"></a>
+<FONT color="green">183</FONT>         * @param dest GeometricMean to copy to<a name="line.183"></a>
+<FONT color="green">184</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.184"></a>
+<FONT color="green">185</FONT>         */<a name="line.185"></a>
+<FONT color="green">186</FONT>        public static void copy(GeometricMean source, GeometricMean dest) {<a name="line.186"></a>
+<FONT color="green">187</FONT>            dest.sumOfLogs = source.sumOfLogs.copy();<a name="line.187"></a>
+<FONT color="green">188</FONT>        }<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>        /**<a name="line.191"></a>
+<FONT color="green">192</FONT>         * Throws IllegalStateException if n &gt; 0.<a name="line.192"></a>
+<FONT color="green">193</FONT>         */<a name="line.193"></a>
+<FONT color="green">194</FONT>        private void checkEmpty() {<a name="line.194"></a>
+<FONT color="green">195</FONT>            if (getN() &gt; 0) {<a name="line.195"></a>
+<FONT color="green">196</FONT>                throw MathRuntimeException.createIllegalStateException(<a name="line.196"></a>
+<FONT color="green">197</FONT>                        "{0} values have been added before statistic is configured",<a name="line.197"></a>
+<FONT color="green">198</FONT>                        getN());<a name="line.198"></a>
+<FONT color="green">199</FONT>            }<a name="line.199"></a>
+<FONT color="green">200</FONT>        }<a name="line.200"></a>
+<FONT color="green">201</FONT>    <a name="line.201"></a>
+<FONT color="green">202</FONT>    }<a name="line.202"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/Kurtosis.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,285 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.moment;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Computes the Kurtosis of the available values.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * We use the following (unbiased) formula to define kurtosis:&lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     *  &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     *  kurtosis = { [n(n+1) / (n -1)(n - 2)(n-3)] sum[(x_i - mean)^4] / std^4 } - [3(n-1)^2 / (n-2)(n-3)]<a name="line.30"></a>
+<FONT color="green">031</FONT>     *  &lt;/p&gt;&lt;p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     *  where n is the number of values, mean is the {@link Mean} and std is the<a name="line.32"></a>
+<FONT color="green">033</FONT>     * {@link StandardDeviation}&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     *  Note that this statistic is undefined for n &lt; 4.  &lt;code&gt;Double.Nan&lt;/code&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     *  is returned when there is not sufficient data to compute the statistic.&lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * &lt;strong&gt;Note that this implementation is not synchronized.&lt;/strong&gt; If<a name="line.38"></a>
+<FONT color="green">039</FONT>     * multiple threads access an instance of this class concurrently, and at least<a name="line.39"></a>
+<FONT color="green">040</FONT>     * one of the threads invokes the &lt;code&gt;increment()&lt;/code&gt; or<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;code&gt;clear()&lt;/code&gt; method, it must be synchronized externally.&lt;/p&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     *<a name="line.42"></a>
+<FONT color="green">043</FONT>     * @version $Revision: 811833 $ $Date: 2009-09-06 12:27:50 -0400 (Sun, 06 Sep 2009) $<a name="line.43"></a>
+<FONT color="green">044</FONT>     */<a name="line.44"></a>
+<FONT color="green">045</FONT>    public class Kurtosis extends AbstractStorelessUnivariateStatistic  implements Serializable {<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** Serializable version identifier */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private static final long serialVersionUID = 2784465764798260919L;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**Fourth Moment on which this statistic is based */<a name="line.50"></a>
+<FONT color="green">051</FONT>        protected FourthMoment moment;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Determines whether or not this statistic can be incremented or cleared.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * &lt;p&gt;<a name="line.55"></a>
+<FONT color="green">056</FONT>         * Statistics based on (constructed from) external moments cannot<a name="line.56"></a>
+<FONT color="green">057</FONT>         * be incremented or cleared.&lt;/p&gt;<a name="line.57"></a>
+<FONT color="green">058</FONT>        */<a name="line.58"></a>
+<FONT color="green">059</FONT>        protected boolean incMoment;<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Construct a Kurtosis<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public Kurtosis() {<a name="line.64"></a>
+<FONT color="green">065</FONT>            incMoment = true;<a name="line.65"></a>
+<FONT color="green">066</FONT>            moment = new FourthMoment();<a name="line.66"></a>
+<FONT color="green">067</FONT>        }<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * Construct a Kurtosis from an external moment<a name="line.70"></a>
+<FONT color="green">071</FONT>         *<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param m4 external Moment<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        public Kurtosis(final FourthMoment m4) {<a name="line.74"></a>
+<FONT color="green">075</FONT>            incMoment = false;<a name="line.75"></a>
+<FONT color="green">076</FONT>            this.moment = m4;<a name="line.76"></a>
+<FONT color="green">077</FONT>        }<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        /**<a name="line.79"></a>
+<FONT color="green">080</FONT>         * Copy constructor, creates a new {@code Kurtosis} identical<a name="line.80"></a>
+<FONT color="green">081</FONT>         * to the {@code original}<a name="line.81"></a>
+<FONT color="green">082</FONT>         *<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param original the {@code Kurtosis} instance to copy<a name="line.83"></a>
+<FONT color="green">084</FONT>         */<a name="line.84"></a>
+<FONT color="green">085</FONT>        public Kurtosis(Kurtosis original) {<a name="line.85"></a>
+<FONT color="green">086</FONT>            copy(original, this);<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /**<a name="line.89"></a>
+<FONT color="green">090</FONT>         * {@inheritDoc}<a name="line.90"></a>
+<FONT color="green">091</FONT>         */<a name="line.91"></a>
+<FONT color="green">092</FONT>        @Override<a name="line.92"></a>
+<FONT color="green">093</FONT>        public void increment(final double d) {<a name="line.93"></a>
+<FONT color="green">094</FONT>            if (incMoment) {<a name="line.94"></a>
+<FONT color="green">095</FONT>                moment.increment(d);<a name="line.95"></a>
+<FONT color="green">096</FONT>            }  else  {<a name="line.96"></a>
+<FONT color="green">097</FONT>                throw MathRuntimeException.createIllegalStateException(<a name="line.97"></a>
+<FONT color="green">098</FONT>                        "statistics constructed from external moments cannot be incremented");<a name="line.98"></a>
+<FONT color="green">099</FONT>            }<a name="line.99"></a>
+<FONT color="green">100</FONT>        }<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>        /**<a name="line.102"></a>
+<FONT color="green">103</FONT>         * {@inheritDoc}<a name="line.103"></a>
+<FONT color="green">104</FONT>         */<a name="line.104"></a>
+<FONT color="green">105</FONT>        @Override<a name="line.105"></a>
+<FONT color="green">106</FONT>        public double getResult() {<a name="line.106"></a>
+<FONT color="green">107</FONT>            double kurtosis = Double.NaN;<a name="line.107"></a>
+<FONT color="green">108</FONT>            if (moment.getN() &gt; 3) {<a name="line.108"></a>
+<FONT color="green">109</FONT>                double variance = moment.m2 / (moment.n - 1);<a name="line.109"></a>
+<FONT color="green">110</FONT>                    if (moment.n &lt;= 3 || variance &lt; 10E-20) {<a name="line.110"></a>
+<FONT color="green">111</FONT>                        kurtosis = 0.0;<a name="line.111"></a>
+<FONT color="green">112</FONT>                    } else {<a name="line.112"></a>
+<FONT color="green">113</FONT>                        double n = moment.n;<a name="line.113"></a>
+<FONT color="green">114</FONT>                        kurtosis =<a name="line.114"></a>
+<FONT color="green">115</FONT>                            (n * (n + 1) * moment.m4 -<a name="line.115"></a>
+<FONT color="green">116</FONT>                                    3 * moment.m2 * moment.m2 * (n - 1)) /<a name="line.116"></a>
+<FONT color="green">117</FONT>                                    ((n - 1) * (n -2) * (n -3) * variance * variance);<a name="line.117"></a>
+<FONT color="green">118</FONT>                    }<a name="line.118"></a>
+<FONT color="green">119</FONT>            }<a name="line.119"></a>
+<FONT color="green">120</FONT>            return kurtosis;<a name="line.120"></a>
+<FONT color="green">121</FONT>        }<a name="line.121"></a>
+<FONT color="green">122</FONT>    <a name="line.122"></a>
+<FONT color="green">123</FONT>        /**<a name="line.123"></a>
+<FONT color="green">124</FONT>         * {@inheritDoc}<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        @Override<a name="line.126"></a>
+<FONT color="green">127</FONT>        public void clear() {<a name="line.127"></a>
+<FONT color="green">128</FONT>            if (incMoment) {<a name="line.128"></a>
+<FONT color="green">129</FONT>                moment.clear();<a name="line.129"></a>
+<FONT color="green">130</FONT>            } else  {<a name="line.130"></a>
+<FONT color="green">131</FONT>                throw MathRuntimeException.createIllegalStateException(<a name="line.131"></a>
+<FONT color="green">132</FONT>                        "statistics constructed from external moments cannot be cleared");<a name="line.132"></a>
+<FONT color="green">133</FONT>            }<a name="line.133"></a>
+<FONT color="green">134</FONT>        }<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>        /**<a name="line.136"></a>
+<FONT color="green">137</FONT>         * {@inheritDoc}<a name="line.137"></a>
+<FONT color="green">138</FONT>         */<a name="line.138"></a>
+<FONT color="green">139</FONT>        public long getN() {<a name="line.139"></a>
+<FONT color="green">140</FONT>            return moment.getN();<a name="line.140"></a>
+<FONT color="green">141</FONT>        }<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>        /* UnvariateStatistic Approach  */<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>        /**<a name="line.145"></a>
+<FONT color="green">146</FONT>         * Returns the kurtosis of the entries in the specified portion of the<a name="line.146"></a>
+<FONT color="green">147</FONT>         * input array.<a name="line.147"></a>
+<FONT color="green">148</FONT>         * &lt;p&gt;<a name="line.148"></a>
+<FONT color="green">149</FONT>         * See {@link Kurtosis} for details on the computing algorithm.&lt;/p&gt;<a name="line.149"></a>
+<FONT color="green">150</FONT>         * &lt;p&gt;<a name="line.150"></a>
+<FONT color="green">151</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.151"></a>
+<FONT color="green">152</FONT>         *<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @param values the input array<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @param begin index of the first array element to include<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @param length the number of elements to include<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @return the kurtosis of the values or Double.NaN if length is less than<a name="line.156"></a>
+<FONT color="green">157</FONT>         * 4<a name="line.157"></a>
+<FONT color="green">158</FONT>         * @throws IllegalArgumentException if the input array is null or the array<a name="line.158"></a>
+<FONT color="green">159</FONT>         * index parameters are not valid<a name="line.159"></a>
+<FONT color="green">160</FONT>         */<a name="line.160"></a>
+<FONT color="green">161</FONT>        @Override<a name="line.161"></a>
+<FONT color="green">162</FONT>        public double evaluate(final double[] values,final int begin, final int length) {<a name="line.162"></a>
+<FONT color="green">163</FONT>            // Initialize the kurtosis<a name="line.163"></a>
+<FONT color="green">164</FONT>            double kurt = Double.NaN;<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>            if (test(values, begin, length) &amp;&amp; length &gt; 3) {<a name="line.166"></a>
+<FONT color="green">167</FONT>    <a name="line.167"></a>
+<FONT color="green">168</FONT>                // Compute the mean and standard deviation<a name="line.168"></a>
+<FONT color="green">169</FONT>                Variance variance = new Variance();<a name="line.169"></a>
+<FONT color="green">170</FONT>                variance.incrementAll(values, begin, length);<a name="line.170"></a>
+<FONT color="green">171</FONT>                double mean = variance.moment.m1;<a name="line.171"></a>
+<FONT color="green">172</FONT>                double stdDev = Math.sqrt(variance.getResult());<a name="line.172"></a>
+<FONT color="green">173</FONT>    <a name="line.173"></a>
+<FONT color="green">174</FONT>                // Sum the ^4 of the distance from the mean divided by the<a name="line.174"></a>
+<FONT color="green">175</FONT>                // standard deviation<a name="line.175"></a>
+<FONT color="green">176</FONT>                double accum3 = 0.0;<a name="line.176"></a>
+<FONT color="green">177</FONT>                for (int i = begin; i &lt; begin + length; i++) {<a name="line.177"></a>
+<FONT color="green">178</FONT>                    accum3 += Math.pow(values[i] - mean, 4.0);<a name="line.178"></a>
+<FONT color="green">179</FONT>                }<a name="line.179"></a>
+<FONT color="green">180</FONT>                accum3 /= Math.pow(stdDev, 4.0d);<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>                // Get N<a name="line.182"></a>
+<FONT color="green">183</FONT>                double n0 = length;<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>                double coefficientOne =<a name="line.185"></a>
+<FONT color="green">186</FONT>                    (n0 * (n0 + 1)) / ((n0 - 1) * (n0 - 2) * (n0 - 3));<a name="line.186"></a>
+<FONT color="green">187</FONT>                double termTwo =<a name="line.187"></a>
+<FONT color="green">188</FONT>                    (3 * Math.pow(n0 - 1, 2.0)) / ((n0 - 2) * (n0 - 3));<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>                // Calculate kurtosis<a name="line.190"></a>
+<FONT color="green">191</FONT>                kurt = (coefficientOne * accum3) - termTwo;<a name="line.191"></a>
+<FONT color="green">192</FONT>            }<a name="line.192"></a>
+<FONT color="green">193</FONT>            return kurt;<a name="line.193"></a>
+<FONT color="green">194</FONT>        }<a name="line.194"></a>
+<FONT color="green">195</FONT>    <a name="line.195"></a>
+<FONT color="green">196</FONT>        /**<a name="line.196"></a>
+<FONT color="green">197</FONT>         * {@inheritDoc}<a name="line.197"></a>
+<FONT color="green">198</FONT>         */<a name="line.198"></a>
+<FONT color="green">199</FONT>        @Override<a name="line.199"></a>
+<FONT color="green">200</FONT>        public Kurtosis copy() {<a name="line.200"></a>
+<FONT color="green">201</FONT>            Kurtosis result = new Kurtosis();<a name="line.201"></a>
+<FONT color="green">202</FONT>            copy(this, result);<a name="line.202"></a>
+<FONT color="green">203</FONT>            return result;<a name="line.203"></a>
+<FONT color="green">204</FONT>        }<a name="line.204"></a>
+<FONT color="green">205</FONT>    <a name="line.205"></a>
+<FONT color="green">206</FONT>        /**<a name="line.206"></a>
+<FONT color="green">207</FONT>         * Copies source to dest.<a name="line.207"></a>
+<FONT color="green">208</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.208"></a>
+<FONT color="green">209</FONT>         *<a name="line.209"></a>
+<FONT color="green">210</FONT>         * @param source Kurtosis to copy<a name="line.210"></a>
+<FONT color="green">211</FONT>         * @param dest Kurtosis to copy to<a name="line.211"></a>
+<FONT color="green">212</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.212"></a>
+<FONT color="green">213</FONT>         */<a name="line.213"></a>
+<FONT color="green">214</FONT>        public static void copy(Kurtosis source, Kurtosis dest) {<a name="line.214"></a>
+<FONT color="green">215</FONT>            dest.moment = source.moment.copy();<a name="line.215"></a>
+<FONT color="green">216</FONT>            dest.incMoment = source.incMoment;<a name="line.216"></a>
+<FONT color="green">217</FONT>        }<a name="line.217"></a>
+<FONT color="green">218</FONT>    <a name="line.218"></a>
+<FONT color="green">219</FONT>    }<a name="line.219"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/Mean.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,337 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.moment;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.stat.descriptive.WeightedEvaluation;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.stat.descriptive.summary.Sum;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;Computes the arithmetic mean of a set of values. Uses the definitional<a name="line.26"></a>
+<FONT color="green">027</FONT>     * formula:&lt;/p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * mean = sum(x_i) / n<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;where &lt;code&gt;n&lt;/code&gt; is the number of observations.<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;p&gt;When {@link #increment(double)} is used to add data incrementally from a<a name="line.33"></a>
+<FONT color="green">034</FONT>     * stream of (unstored) values, the value of the statistic that<a name="line.34"></a>
+<FONT color="green">035</FONT>     * {@link #getResult()} returns is computed using the following recursive<a name="line.35"></a>
+<FONT color="green">036</FONT>     * updating algorithm: &lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;ol&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * &lt;li&gt;Initialize &lt;code&gt;m = &lt;/code&gt; the first value&lt;/li&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;li&gt;For each additional value, update using &lt;br&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     *   &lt;code&gt;m = m + (new value - m) / (number of observations)&lt;/code&gt;&lt;/li&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;/ol&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;p&gt; If {@link #evaluate(double[])} is used to compute the mean of an array<a name="line.42"></a>
+<FONT color="green">043</FONT>     * of stored values, a two-pass, corrected algorithm is used, starting with<a name="line.43"></a>
+<FONT color="green">044</FONT>     * the definitional formula computed using the array of stored values and then<a name="line.44"></a>
+<FONT color="green">045</FONT>     * correcting this by adding the mean deviation of the data values from the<a name="line.45"></a>
+<FONT color="green">046</FONT>     * arithmetic mean. See, e.g. "Comparison of Several Algorithms for Computing<a name="line.46"></a>
+<FONT color="green">047</FONT>     * Sample Means and Variances," Robert F. Ling, Journal of the American<a name="line.47"></a>
+<FONT color="green">048</FONT>     * Statistical Association, Vol. 69, No. 348 (Dec., 1974), pp. 859-866. &lt;/p&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>     * &lt;p&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     *  Returns &lt;code&gt;Double.NaN&lt;/code&gt; if the dataset is empty.<a name="line.50"></a>
+<FONT color="green">051</FONT>     * &lt;/p&gt;<a name="line.51"></a>
+<FONT color="green">052</FONT>     * &lt;strong&gt;Note that this implementation is not synchronized.&lt;/strong&gt; If<a name="line.52"></a>
+<FONT color="green">053</FONT>     * multiple threads access an instance of this class concurrently, and at least<a name="line.53"></a>
+<FONT color="green">054</FONT>     * one of the threads invokes the &lt;code&gt;increment()&lt;/code&gt; or<a name="line.54"></a>
+<FONT color="green">055</FONT>     * &lt;code&gt;clear()&lt;/code&gt; method, it must be synchronized externally.<a name="line.55"></a>
+<FONT color="green">056</FONT>     *<a name="line.56"></a>
+<FONT color="green">057</FONT>     * @version $Revision: 908626 $ $Date: 2010-02-10 13:44:42 -0500 (Wed, 10 Feb 2010) $<a name="line.57"></a>
+<FONT color="green">058</FONT>     */<a name="line.58"></a>
+<FONT color="green">059</FONT>    public class Mean extends AbstractStorelessUnivariateStatistic<a name="line.59"></a>
+<FONT color="green">060</FONT>        implements Serializable, WeightedEvaluation {<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** Serializable version identifier */<a name="line.62"></a>
+<FONT color="green">063</FONT>        private static final long serialVersionUID = -1296043746617791564L;<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** First moment on which this statistic is based. */<a name="line.65"></a>
+<FONT color="green">066</FONT>        protected FirstMoment moment;<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /**<a name="line.68"></a>
+<FONT color="green">069</FONT>         * Determines whether or not this statistic can be incremented or cleared.<a name="line.69"></a>
+<FONT color="green">070</FONT>         * &lt;p&gt;<a name="line.70"></a>
+<FONT color="green">071</FONT>         * Statistics based on (constructed from) external moments cannot<a name="line.71"></a>
+<FONT color="green">072</FONT>         * be incremented or cleared.&lt;/p&gt;<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        protected boolean incMoment;<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        /** Constructs a Mean. */<a name="line.76"></a>
+<FONT color="green">077</FONT>        public Mean() {<a name="line.77"></a>
+<FONT color="green">078</FONT>            incMoment = true;<a name="line.78"></a>
+<FONT color="green">079</FONT>            moment = new FirstMoment();<a name="line.79"></a>
+<FONT color="green">080</FONT>        }<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>        /**<a name="line.82"></a>
+<FONT color="green">083</FONT>         * Constructs a Mean with an External Moment.<a name="line.83"></a>
+<FONT color="green">084</FONT>         *<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @param m1 the moment<a name="line.85"></a>
+<FONT color="green">086</FONT>         */<a name="line.86"></a>
+<FONT color="green">087</FONT>        public Mean(final FirstMoment m1) {<a name="line.87"></a>
+<FONT color="green">088</FONT>            this.moment = m1;<a name="line.88"></a>
+<FONT color="green">089</FONT>            incMoment = false;<a name="line.89"></a>
+<FONT color="green">090</FONT>        }<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /**<a name="line.92"></a>
+<FONT color="green">093</FONT>         * Copy constructor, creates a new {@code Mean} identical<a name="line.93"></a>
+<FONT color="green">094</FONT>         * to the {@code original}<a name="line.94"></a>
+<FONT color="green">095</FONT>         *<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @param original the {@code Mean} instance to copy<a name="line.96"></a>
+<FONT color="green">097</FONT>         */<a name="line.97"></a>
+<FONT color="green">098</FONT>        public Mean(Mean original) {<a name="line.98"></a>
+<FONT color="green">099</FONT>            copy(original, this);<a name="line.99"></a>
+<FONT color="green">100</FONT>        }<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>        /**<a name="line.102"></a>
+<FONT color="green">103</FONT>         * {@inheritDoc}<a name="line.103"></a>
+<FONT color="green">104</FONT>         */<a name="line.104"></a>
+<FONT color="green">105</FONT>        @Override<a name="line.105"></a>
+<FONT color="green">106</FONT>        public void increment(final double d) {<a name="line.106"></a>
+<FONT color="green">107</FONT>            if (incMoment) {<a name="line.107"></a>
+<FONT color="green">108</FONT>                moment.increment(d);<a name="line.108"></a>
+<FONT color="green">109</FONT>            }<a name="line.109"></a>
+<FONT color="green">110</FONT>        }<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>        /**<a name="line.112"></a>
+<FONT color="green">113</FONT>         * {@inheritDoc}<a name="line.113"></a>
+<FONT color="green">114</FONT>         */<a name="line.114"></a>
+<FONT color="green">115</FONT>        @Override<a name="line.115"></a>
+<FONT color="green">116</FONT>        public void clear() {<a name="line.116"></a>
+<FONT color="green">117</FONT>            if (incMoment) {<a name="line.117"></a>
+<FONT color="green">118</FONT>                moment.clear();<a name="line.118"></a>
+<FONT color="green">119</FONT>            }<a name="line.119"></a>
+<FONT color="green">120</FONT>        }<a name="line.120"></a>
+<FONT color="green">121</FONT>    <a name="line.121"></a>
+<FONT color="green">122</FONT>        /**<a name="line.122"></a>
+<FONT color="green">123</FONT>         * {@inheritDoc}<a name="line.123"></a>
+<FONT color="green">124</FONT>         */<a name="line.124"></a>
+<FONT color="green">125</FONT>        @Override<a name="line.125"></a>
+<FONT color="green">126</FONT>        public double getResult() {<a name="line.126"></a>
+<FONT color="green">127</FONT>            return moment.m1;<a name="line.127"></a>
+<FONT color="green">128</FONT>        }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /**<a name="line.130"></a>
+<FONT color="green">131</FONT>         * {@inheritDoc}<a name="line.131"></a>
+<FONT color="green">132</FONT>         */<a name="line.132"></a>
+<FONT color="green">133</FONT>        public long getN() {<a name="line.133"></a>
+<FONT color="green">134</FONT>            return moment.getN();<a name="line.134"></a>
+<FONT color="green">135</FONT>        }<a name="line.135"></a>
+<FONT color="green">136</FONT>    <a name="line.136"></a>
+<FONT color="green">137</FONT>        /**<a name="line.137"></a>
+<FONT color="green">138</FONT>         * Returns the arithmetic mean of the entries in the specified portion of<a name="line.138"></a>
+<FONT color="green">139</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.139"></a>
+<FONT color="green">140</FONT>         * is empty.<a name="line.140"></a>
+<FONT color="green">141</FONT>         * &lt;p&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.142"></a>
+<FONT color="green">143</FONT>         * &lt;p&gt;<a name="line.143"></a>
+<FONT color="green">144</FONT>         * See {@link Mean} for details on the computing algorithm.&lt;/p&gt;<a name="line.144"></a>
+<FONT color="green">145</FONT>         *<a name="line.145"></a>
+<FONT color="green">146</FONT>         * @param values the input array<a name="line.146"></a>
+<FONT color="green">147</FONT>         * @param begin index of the first array element to include<a name="line.147"></a>
+<FONT color="green">148</FONT>         * @param length the number of elements to include<a name="line.148"></a>
+<FONT color="green">149</FONT>         * @return the mean of the values or Double.NaN if length = 0<a name="line.149"></a>
+<FONT color="green">150</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.150"></a>
+<FONT color="green">151</FONT>         *  parameters are not valid<a name="line.151"></a>
+<FONT color="green">152</FONT>         */<a name="line.152"></a>
+<FONT color="green">153</FONT>        @Override<a name="line.153"></a>
+<FONT color="green">154</FONT>        public double evaluate(final double[] values,final int begin, final int length) {<a name="line.154"></a>
+<FONT color="green">155</FONT>            if (test(values, begin, length)) {<a name="line.155"></a>
+<FONT color="green">156</FONT>                Sum sum = new Sum();<a name="line.156"></a>
+<FONT color="green">157</FONT>                double sampleSize = length;<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>                // Compute initial estimate using definitional formula<a name="line.159"></a>
+<FONT color="green">160</FONT>                double xbar = sum.evaluate(values, begin, length) / sampleSize;<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>                // Compute correction factor in second pass<a name="line.162"></a>
+<FONT color="green">163</FONT>                double correction = 0;<a name="line.163"></a>
+<FONT color="green">164</FONT>                for (int i = begin; i &lt; begin + length; i++) {<a name="line.164"></a>
+<FONT color="green">165</FONT>                    correction += values[i] - xbar;<a name="line.165"></a>
+<FONT color="green">166</FONT>                }<a name="line.166"></a>
+<FONT color="green">167</FONT>                return xbar + (correction/sampleSize);<a name="line.167"></a>
+<FONT color="green">168</FONT>            }<a name="line.168"></a>
+<FONT color="green">169</FONT>            return Double.NaN;<a name="line.169"></a>
+<FONT color="green">170</FONT>        }<a name="line.170"></a>
+<FONT color="green">171</FONT>    <a name="line.171"></a>
+<FONT color="green">172</FONT>        /**<a name="line.172"></a>
+<FONT color="green">173</FONT>         * Returns the weighted arithmetic mean of the entries in the specified portion of<a name="line.173"></a>
+<FONT color="green">174</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.174"></a>
+<FONT color="green">175</FONT>         * is empty.<a name="line.175"></a>
+<FONT color="green">176</FONT>         * &lt;p&gt;<a name="line.176"></a>
+<FONT color="green">177</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if either array is null.&lt;/p&gt;<a name="line.177"></a>
+<FONT color="green">178</FONT>         * &lt;p&gt;<a name="line.178"></a>
+<FONT color="green">179</FONT>         * See {@link Mean} for details on the computing algorithm. The two-pass algorithm<a name="line.179"></a>
+<FONT color="green">180</FONT>         * described above is used here, with weights applied in computing both the original<a name="line.180"></a>
+<FONT color="green">181</FONT>         * estimate and the correction factor.&lt;/p&gt;<a name="line.181"></a>
+<FONT color="green">182</FONT>         * &lt;p&gt;<a name="line.182"></a>
+<FONT color="green">183</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if any of the following are true:<a name="line.183"></a>
+<FONT color="green">184</FONT>         * &lt;ul&gt;&lt;li&gt;the values array is null&lt;/li&gt;<a name="line.184"></a>
+<FONT color="green">185</FONT>         *     &lt;li&gt;the weights array is null&lt;/li&gt;<a name="line.185"></a>
+<FONT color="green">186</FONT>         *     &lt;li&gt;the weights array does not have the same length as the values array&lt;/li&gt;<a name="line.186"></a>
+<FONT color="green">187</FONT>         *     &lt;li&gt;the weights array contains one or more infinite values&lt;/li&gt;<a name="line.187"></a>
+<FONT color="green">188</FONT>         *     &lt;li&gt;the weights array contains one or more NaN values&lt;/li&gt;<a name="line.188"></a>
+<FONT color="green">189</FONT>         *     &lt;li&gt;the weights array contains negative values&lt;/li&gt;<a name="line.189"></a>
+<FONT color="green">190</FONT>         *     &lt;li&gt;the start and length arguments do not determine a valid array&lt;/li&gt;<a name="line.190"></a>
+<FONT color="green">191</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.191"></a>
+<FONT color="green">192</FONT>         *<a name="line.192"></a>
+<FONT color="green">193</FONT>         * @param values the input array<a name="line.193"></a>
+<FONT color="green">194</FONT>         * @param weights the weights array<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @param begin index of the first array element to include<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @param length the number of elements to include<a name="line.196"></a>
+<FONT color="green">197</FONT>         * @return the mean of the values or Double.NaN if length = 0<a name="line.197"></a>
+<FONT color="green">198</FONT>         * @throws IllegalArgumentException if the parameters are not valid<a name="line.198"></a>
+<FONT color="green">199</FONT>         * @since 2.1<a name="line.199"></a>
+<FONT color="green">200</FONT>         */<a name="line.200"></a>
+<FONT color="green">201</FONT>        public double evaluate(final double[] values, final double[] weights,<a name="line.201"></a>
+<FONT color="green">202</FONT>                               final int begin, final int length) {<a name="line.202"></a>
+<FONT color="green">203</FONT>            if (test(values, weights, begin, length)) {<a name="line.203"></a>
+<FONT color="green">204</FONT>                Sum sum = new Sum();<a name="line.204"></a>
+<FONT color="green">205</FONT>    <a name="line.205"></a>
+<FONT color="green">206</FONT>                // Compute initial estimate using definitional formula<a name="line.206"></a>
+<FONT color="green">207</FONT>                double sumw = sum.evaluate(weights,begin,length);<a name="line.207"></a>
+<FONT color="green">208</FONT>                double xbarw = sum.evaluate(values, weights, begin, length) / sumw;<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>                // Compute correction factor in second pass<a name="line.210"></a>
+<FONT color="green">211</FONT>                double correction = 0;<a name="line.211"></a>
+<FONT color="green">212</FONT>                for (int i = begin; i &lt; begin + length; i++) {<a name="line.212"></a>
+<FONT color="green">213</FONT>                    correction += weights[i] * (values[i] - xbarw);<a name="line.213"></a>
+<FONT color="green">214</FONT>                }<a name="line.214"></a>
+<FONT color="green">215</FONT>                return xbarw + (correction/sumw);<a name="line.215"></a>
+<FONT color="green">216</FONT>            }<a name="line.216"></a>
+<FONT color="green">217</FONT>            return Double.NaN;<a name="line.217"></a>
+<FONT color="green">218</FONT>        }<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>        /**<a name="line.220"></a>
+<FONT color="green">221</FONT>         * Returns the weighted arithmetic mean of the entries in the input array.<a name="line.221"></a>
+<FONT color="green">222</FONT>         * &lt;p&gt;<a name="line.222"></a>
+<FONT color="green">223</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if either array is null.&lt;/p&gt;<a name="line.223"></a>
+<FONT color="green">224</FONT>         * &lt;p&gt;<a name="line.224"></a>
+<FONT color="green">225</FONT>         * See {@link Mean} for details on the computing algorithm. The two-pass algorithm<a name="line.225"></a>
+<FONT color="green">226</FONT>         * described above is used here, with weights applied in computing both the original<a name="line.226"></a>
+<FONT color="green">227</FONT>         * estimate and the correction factor.&lt;/p&gt;<a name="line.227"></a>
+<FONT color="green">228</FONT>         * &lt;p&gt;<a name="line.228"></a>
+<FONT color="green">229</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if any of the following are true:<a name="line.229"></a>
+<FONT color="green">230</FONT>         * &lt;ul&gt;&lt;li&gt;the values array is null&lt;/li&gt;<a name="line.230"></a>
+<FONT color="green">231</FONT>         *     &lt;li&gt;the weights array is null&lt;/li&gt;<a name="line.231"></a>
+<FONT color="green">232</FONT>         *     &lt;li&gt;the weights array does not have the same length as the values array&lt;/li&gt;<a name="line.232"></a>
+<FONT color="green">233</FONT>         *     &lt;li&gt;the weights array contains one or more infinite values&lt;/li&gt;<a name="line.233"></a>
+<FONT color="green">234</FONT>         *     &lt;li&gt;the weights array contains one or more NaN values&lt;/li&gt;<a name="line.234"></a>
+<FONT color="green">235</FONT>         *     &lt;li&gt;the weights array contains negative values&lt;/li&gt;<a name="line.235"></a>
+<FONT color="green">236</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.236"></a>
+<FONT color="green">237</FONT>         *<a name="line.237"></a>
+<FONT color="green">238</FONT>         * @param values the input array<a name="line.238"></a>
+<FONT color="green">239</FONT>         * @param weights the weights array<a name="line.239"></a>
+<FONT color="green">240</FONT>         * @return the mean of the values or Double.NaN if length = 0<a name="line.240"></a>
+<FONT color="green">241</FONT>         * @throws IllegalArgumentException if the parameters are not valid<a name="line.241"></a>
+<FONT color="green">242</FONT>         * @since 2.1<a name="line.242"></a>
+<FONT color="green">243</FONT>         */<a name="line.243"></a>
+<FONT color="green">244</FONT>        public double evaluate(final double[] values, final double[] weights) {<a name="line.244"></a>
+<FONT color="green">245</FONT>            return evaluate(values, weights, 0, values.length);<a name="line.245"></a>
+<FONT color="green">246</FONT>        }<a name="line.246"></a>
+<FONT color="green">247</FONT>    <a name="line.247"></a>
+<FONT color="green">248</FONT>        /**<a name="line.248"></a>
+<FONT color="green">249</FONT>         * {@inheritDoc}<a name="line.249"></a>
+<FONT color="green">250</FONT>         */<a name="line.250"></a>
+<FONT color="green">251</FONT>        @Override<a name="line.251"></a>
+<FONT color="green">252</FONT>        public Mean copy() {<a name="line.252"></a>
+<FONT color="green">253</FONT>            Mean result = new Mean();<a name="line.253"></a>
+<FONT color="green">254</FONT>            copy(this, result);<a name="line.254"></a>
+<FONT color="green">255</FONT>            return result;<a name="line.255"></a>
+<FONT color="green">256</FONT>        }<a name="line.256"></a>
+<FONT color="green">257</FONT>    <a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>        /**<a name="line.259"></a>
+<FONT color="green">260</FONT>         * Copies source to dest.<a name="line.260"></a>
+<FONT color="green">261</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.261"></a>
+<FONT color="green">262</FONT>         *<a name="line.262"></a>
+<FONT color="green">263</FONT>         * @param source Mean to copy<a name="line.263"></a>
+<FONT color="green">264</FONT>         * @param dest Mean to copy to<a name="line.264"></a>
+<FONT color="green">265</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.265"></a>
+<FONT color="green">266</FONT>         */<a name="line.266"></a>
+<FONT color="green">267</FONT>        public static void copy(Mean source, Mean dest) {<a name="line.267"></a>
+<FONT color="green">268</FONT>            dest.incMoment = source.incMoment;<a name="line.268"></a>
+<FONT color="green">269</FONT>            dest.moment = source.moment.copy();<a name="line.269"></a>
+<FONT color="green">270</FONT>        }<a name="line.270"></a>
+<FONT color="green">271</FONT>    }<a name="line.271"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/SecondMoment.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,190 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.moment;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Computes a statistic related to the Second Central Moment.  Specifically,<a name="line.22"></a>
+<FONT color="green">023</FONT>     * what is computed is the sum of squared deviations from the sample mean.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * The following recursive updating formula is used:&lt;/p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Let &lt;ul&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;li&gt; dev = (current obs - previous mean) &lt;/li&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;li&gt; n = number of observations (including current obs) &lt;/li&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;/ul&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * Then&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * new value = old value + dev^2 * (n -1) / n.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * Returns &lt;code&gt;Double.NaN&lt;/code&gt; if no data values have been added and<a name="line.35"></a>
+<FONT color="green">036</FONT>     * returns &lt;code&gt;0&lt;/code&gt; if there is just one value in the data set.&lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * &lt;strong&gt;Note that this implementation is not synchronized.&lt;/strong&gt; If<a name="line.38"></a>
+<FONT color="green">039</FONT>     * multiple threads access an instance of this class concurrently, and at least<a name="line.39"></a>
+<FONT color="green">040</FONT>     * one of the threads invokes the &lt;code&gt;increment()&lt;/code&gt; or<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;code&gt;clear()&lt;/code&gt; method, it must be synchronized externally.&lt;/p&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     *<a name="line.42"></a>
+<FONT color="green">043</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.43"></a>
+<FONT color="green">044</FONT>     */<a name="line.44"></a>
+<FONT color="green">045</FONT>    public class SecondMoment extends FirstMoment implements Serializable {<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** Serializable version identifier */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private static final long serialVersionUID = 3942403127395076445L;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** second moment of values that have been added */<a name="line.50"></a>
+<FONT color="green">051</FONT>        protected double m2;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /**<a name="line.53"></a>
+<FONT color="green">054</FONT>         * Create a SecondMoment instance<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public SecondMoment() {<a name="line.56"></a>
+<FONT color="green">057</FONT>            super();<a name="line.57"></a>
+<FONT color="green">058</FONT>            m2 = Double.NaN;<a name="line.58"></a>
+<FONT color="green">059</FONT>        }<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Copy constructor, creates a new {@code SecondMoment} identical<a name="line.62"></a>
+<FONT color="green">063</FONT>         * to the {@code original}<a name="line.63"></a>
+<FONT color="green">064</FONT>         *<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param original the {@code SecondMoment} instance to copy<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        public SecondMoment(SecondMoment original) {<a name="line.67"></a>
+<FONT color="green">068</FONT>            super(original);<a name="line.68"></a>
+<FONT color="green">069</FONT>            this.m2 = original.m2;<a name="line.69"></a>
+<FONT color="green">070</FONT>        }<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /**<a name="line.72"></a>
+<FONT color="green">073</FONT>         * {@inheritDoc}<a name="line.73"></a>
+<FONT color="green">074</FONT>         */<a name="line.74"></a>
+<FONT color="green">075</FONT>        @Override<a name="line.75"></a>
+<FONT color="green">076</FONT>        public void increment(final double d) {<a name="line.76"></a>
+<FONT color="green">077</FONT>            if (n &lt; 1) {<a name="line.77"></a>
+<FONT color="green">078</FONT>                m1 = m2 = 0.0;<a name="line.78"></a>
+<FONT color="green">079</FONT>            }<a name="line.79"></a>
+<FONT color="green">080</FONT>            super.increment(d);<a name="line.80"></a>
+<FONT color="green">081</FONT>            m2 += ((double) n - 1) * dev * nDev;<a name="line.81"></a>
+<FONT color="green">082</FONT>        }<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /**<a name="line.84"></a>
+<FONT color="green">085</FONT>         * {@inheritDoc}<a name="line.85"></a>
+<FONT color="green">086</FONT>         */<a name="line.86"></a>
+<FONT color="green">087</FONT>        @Override<a name="line.87"></a>
+<FONT color="green">088</FONT>        public void clear() {<a name="line.88"></a>
+<FONT color="green">089</FONT>            super.clear();<a name="line.89"></a>
+<FONT color="green">090</FONT>            m2 = Double.NaN;<a name="line.90"></a>
+<FONT color="green">091</FONT>        }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /**<a name="line.93"></a>
+<FONT color="green">094</FONT>         * {@inheritDoc}<a name="line.94"></a>
+<FONT color="green">095</FONT>         */<a name="line.95"></a>
+<FONT color="green">096</FONT>        @Override<a name="line.96"></a>
+<FONT color="green">097</FONT>        public double getResult() {<a name="line.97"></a>
+<FONT color="green">098</FONT>            return m2;<a name="line.98"></a>
+<FONT color="green">099</FONT>        }<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /**<a name="line.101"></a>
+<FONT color="green">102</FONT>         * {@inheritDoc}<a name="line.102"></a>
+<FONT color="green">103</FONT>         */<a name="line.103"></a>
+<FONT color="green">104</FONT>        @Override<a name="line.104"></a>
+<FONT color="green">105</FONT>        public SecondMoment copy() {<a name="line.105"></a>
+<FONT color="green">106</FONT>            SecondMoment result = new SecondMoment();<a name="line.106"></a>
+<FONT color="green">107</FONT>            copy(this, result);<a name="line.107"></a>
+<FONT color="green">108</FONT>            return result;<a name="line.108"></a>
+<FONT color="green">109</FONT>        }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /**<a name="line.111"></a>
+<FONT color="green">112</FONT>         * Copies source to dest.<a name="line.112"></a>
+<FONT color="green">113</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.113"></a>
+<FONT color="green">114</FONT>         *<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @param source SecondMoment to copy<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @param dest SecondMoment to copy to<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.117"></a>
+<FONT color="green">118</FONT>         */<a name="line.118"></a>
+<FONT color="green">119</FONT>        public static void copy(SecondMoment source, SecondMoment dest) {<a name="line.119"></a>
+<FONT color="green">120</FONT>            FirstMoment.copy(source, dest);<a name="line.120"></a>
+<FONT color="green">121</FONT>            dest.m2 = source.m2;<a name="line.121"></a>
+<FONT color="green">122</FONT>        }<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>    }<a name="line.124"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/SemiVariance.Direction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,443 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.stat.descriptive.moment;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.stat.descriptive.AbstractUnivariateStatistic;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;Computes the semivariance of a set of values with respect to a given cutoff value.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * We define the &lt;i&gt;downside semivariance&lt;/i&gt; of a set of values &lt;code&gt;x&lt;/code&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * against the &lt;i&gt;cutoff value&lt;/i&gt; &lt;code&gt;cutoff&lt;/code&gt; to be &lt;br/&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;code&gt;&amp;Sigma; (x[i] - target)&lt;sup&gt;2&lt;/sup&gt; / df&lt;/code&gt; &lt;br/&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * where the sum is taken over all &lt;code&gt;i&lt;/code&gt; such that &lt;code&gt;x[i] &lt; cutoff&lt;/code&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * and &lt;code&gt;df&lt;/code&gt; is the length of &lt;code&gt;x&lt;/code&gt; (non-bias-corrected) or<a name="line.30"></a>
+<FONT color="green">031</FONT>     * one less than this number (bias corrected).  The &lt;i&gt;upside semivariance&lt;/i&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * is defined similarly, with the sum taken over values of &lt;code&gt;x&lt;/code&gt; that<a name="line.32"></a>
+<FONT color="green">033</FONT>     * exceed the cutoff value.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     *<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;p&gt;The cutoff value defaults to the mean, bias correction defaults to &lt;code&gt;true&lt;/code&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * and the "variance direction" (upside or downside) defaults to downside.  The variance direction<a name="line.36"></a>
+<FONT color="green">037</FONT>     * and bias correction may be set using property setters or their values can provided as<a name="line.37"></a>
+<FONT color="green">038</FONT>     * parameters to {@link #evaluate(double[], double, Direction, boolean, int, int)}.&lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     *<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;p&gt;If the input array is null, &lt;code&gt;evaluate&lt;/code&gt; methods throw<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;code&gt;IllegalArgumentException.&lt;/code&gt;  If the array has length 1, &lt;code&gt;0&lt;/code&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * is returned, regardless of the value of the &lt;code&gt;cutoff.&lt;/code&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     *<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;p&gt;&lt;strong&gt;Note that this class is not intended to be threadsafe.&lt;/strong&gt; If<a name="line.44"></a>
+<FONT color="green">045</FONT>     * multiple threads access an instance of this class concurrently, and one or<a name="line.45"></a>
+<FONT color="green">046</FONT>     * more of these threads invoke property setters, external synchronization must<a name="line.46"></a>
+<FONT color="green">047</FONT>     * be provided to ensure correct results.&lt;/p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     *<a name="line.48"></a>
+<FONT color="green">049</FONT>     * @version $Revision: 917275 $ $Date: 2010-02-28 14:43:11 -0500 (Sun, 28 Feb 2010) $<a name="line.49"></a>
+<FONT color="green">050</FONT>     * @since 2.1<a name="line.50"></a>
+<FONT color="green">051</FONT>     */<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>    public class SemiVariance extends AbstractUnivariateStatistic implements Serializable {<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * The UPSIDE Direction is used to specify that the observations above the<a name="line.56"></a>
+<FONT color="green">057</FONT>         * cutoff point will be used to calculate SemiVariance.<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public static final Direction UPSIDE_VARIANCE = Direction.UPSIDE;<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * The DOWNSIDE Direction is used to specify that the observations below<a name="line.62"></a>
+<FONT color="green">063</FONT>         * the cutoff point will be used to calculate SemiVariance<a name="line.63"></a>
+<FONT color="green">064</FONT>         */<a name="line.64"></a>
+<FONT color="green">065</FONT>        public static final Direction DOWNSIDE_VARIANCE = Direction.DOWNSIDE;<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /** Serializable version identifier */<a name="line.67"></a>
+<FONT color="green">068</FONT>        private static final long serialVersionUID = -2653430366886024994L;<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /**<a name="line.70"></a>
+<FONT color="green">071</FONT>         * Determines whether or not bias correction is applied when computing the<a name="line.71"></a>
+<FONT color="green">072</FONT>         * value of the statisic.  True means that bias is corrected.<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        private boolean biasCorrected = true;<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        /**<a name="line.76"></a>
+<FONT color="green">077</FONT>         * Determines whether to calculate downside or upside SemiVariance.<a name="line.77"></a>
+<FONT color="green">078</FONT>         */<a name="line.78"></a>
+<FONT color="green">079</FONT>        private Direction varianceDirection = Direction.DOWNSIDE;<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /**<a name="line.81"></a>
+<FONT color="green">082</FONT>         * Constructs a SemiVariance with default (true) &lt;code&gt;biasCorrected&lt;/code&gt;<a name="line.82"></a>
+<FONT color="green">083</FONT>         * property and default (Downside) &lt;code&gt;varianceDirection&lt;/code&gt; property.<a name="line.83"></a>
+<FONT color="green">084</FONT>         */<a name="line.84"></a>
+<FONT color="green">085</FONT>        public SemiVariance() {<a name="line.85"></a>
+<FONT color="green">086</FONT>        }<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>        /**<a name="line.88"></a>
+<FONT color="green">089</FONT>         * Constructs a SemiVariance with the specified &lt;code&gt;biasCorrected&lt;/code&gt;<a name="line.89"></a>
+<FONT color="green">090</FONT>         * property and default (Downside) &lt;code&gt;varianceDirection&lt;/code&gt; property.<a name="line.90"></a>
+<FONT color="green">091</FONT>         *<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @param biasCorrected  setting for bias correction - true means<a name="line.92"></a>
+<FONT color="green">093</FONT>         * bias will be corrected and is equivalent to using the argumentless<a name="line.93"></a>
+<FONT color="green">094</FONT>         * constructor<a name="line.94"></a>
+<FONT color="green">095</FONT>         */<a name="line.95"></a>
+<FONT color="green">096</FONT>        public SemiVariance(final boolean biasCorrected) {<a name="line.96"></a>
+<FONT color="green">097</FONT>            this.biasCorrected = biasCorrected;<a name="line.97"></a>
+<FONT color="green">098</FONT>        }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /**<a name="line.101"></a>
+<FONT color="green">102</FONT>         * Constructs a SemiVariance with the specified &lt;code&gt;Direction&lt;/code&gt; property<a name="line.102"></a>
+<FONT color="green">103</FONT>         * and default (true) &lt;code&gt;biasCorrected&lt;/code&gt; property<a name="line.103"></a>
+<FONT color="green">104</FONT>         *<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @param direction  setting for the direction of the SemiVariance<a name="line.105"></a>
+<FONT color="green">106</FONT>         * to calculate<a name="line.106"></a>
+<FONT color="green">107</FONT>         */<a name="line.107"></a>
+<FONT color="green">108</FONT>        public SemiVariance(final Direction direction) {<a name="line.108"></a>
+<FONT color="green">109</FONT>            this.varianceDirection = direction;<a name="line.109"></a>
+<FONT color="green">110</FONT>        }<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>        /**<a name="line.113"></a>
+<FONT color="green">114</FONT>         * Constructs a SemiVariance with the specified &lt;code&gt;isBiasCorrected&lt;/code&gt;<a name="line.114"></a>
+<FONT color="green">115</FONT>         * property and the specified &lt;code&gt;Direction&lt;/code&gt; property.<a name="line.115"></a>
+<FONT color="green">116</FONT>         *<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @param corrected  setting for bias correction - true means<a name="line.117"></a>
+<FONT color="green">118</FONT>         * bias will be corrected and is equivalent to using the argumentless<a name="line.118"></a>
+<FONT color="green">119</FONT>         * constructor<a name="line.119"></a>
+<FONT color="green">120</FONT>         *<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @param direction  setting for the direction of the SemiVariance<a name="line.121"></a>
+<FONT color="green">122</FONT>         * to calculate<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        public SemiVariance(final boolean corrected, final Direction direction) {<a name="line.124"></a>
+<FONT color="green">125</FONT>            this.biasCorrected = corrected;<a name="line.125"></a>
+<FONT color="green">126</FONT>            this.varianceDirection = direction;<a name="line.126"></a>
+<FONT color="green">127</FONT>        }<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /**<a name="line.130"></a>
+<FONT color="green">131</FONT>         * Copy constructor, creates a new {@code SemiVariance} identical<a name="line.131"></a>
+<FONT color="green">132</FONT>         * to the {@code original}<a name="line.132"></a>
+<FONT color="green">133</FONT>         *<a name="line.133"></a>
+<FONT color="green">134</FONT>         * @param original the {@code SemiVariance} instance to copy<a name="line.134"></a>
+<FONT color="green">135</FONT>         */<a name="line.135"></a>
+<FONT color="green">136</FONT>        public SemiVariance(final SemiVariance original) {<a name="line.136"></a>
+<FONT color="green">137</FONT>            copy(original, this);<a name="line.137"></a>
+<FONT color="green">138</FONT>        }<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>        /**<a name="line.141"></a>
+<FONT color="green">142</FONT>         * {@inheritDoc}<a name="line.142"></a>
+<FONT color="green">143</FONT>         */<a name="line.143"></a>
+<FONT color="green">144</FONT>        @Override<a name="line.144"></a>
+<FONT color="green">145</FONT>        public SemiVariance copy() {<a name="line.145"></a>
+<FONT color="green">146</FONT>            SemiVariance result = new SemiVariance();<a name="line.146"></a>
+<FONT color="green">147</FONT>            copy(this, result);<a name="line.147"></a>
+<FONT color="green">148</FONT>            return result;<a name="line.148"></a>
+<FONT color="green">149</FONT>        }<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>        /**<a name="line.152"></a>
+<FONT color="green">153</FONT>         * Copies source to dest.<a name="line.153"></a>
+<FONT color="green">154</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.154"></a>
+<FONT color="green">155</FONT>         *<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @param source SemiVariance to copy<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @param dest SemiVariance to copy to<a name="line.157"></a>
+<FONT color="green">158</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.158"></a>
+<FONT color="green">159</FONT>         */<a name="line.159"></a>
+<FONT color="green">160</FONT>        public static void copy(final SemiVariance source, SemiVariance dest) {<a name="line.160"></a>
+<FONT color="green">161</FONT>            dest.biasCorrected = source.biasCorrected;<a name="line.161"></a>
+<FONT color="green">162</FONT>            dest.varianceDirection = source.varianceDirection;<a name="line.162"></a>
+<FONT color="green">163</FONT>        }<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>        /**<a name="line.166"></a>
+<FONT color="green">167</FONT>         * This method calculates {@link SemiVariance} for the entire array against the mean, using<a name="line.167"></a>
+<FONT color="green">168</FONT>         * instance properties varianceDirection and biasCorrection.<a name="line.168"></a>
+<FONT color="green">169</FONT>         *<a name="line.169"></a>
+<FONT color="green">170</FONT>         * @param values the input array<a name="line.170"></a>
+<FONT color="green">171</FONT>         * @return the SemiVariance<a name="line.171"></a>
+<FONT color="green">172</FONT>         * @throws IllegalArgumentException if values is null<a name="line.172"></a>
+<FONT color="green">173</FONT>         *<a name="line.173"></a>
+<FONT color="green">174</FONT>         */<a name="line.174"></a>
+<FONT color="green">175</FONT>        @Override<a name="line.175"></a>
+<FONT color="green">176</FONT>        public double evaluate(final double[] values) {<a name="line.176"></a>
+<FONT color="green">177</FONT>            if (values == null) {<a name="line.177"></a>
+<FONT color="green">178</FONT>                throw MathRuntimeException.createIllegalArgumentException("input values array is null");<a name="line.178"></a>
+<FONT color="green">179</FONT>             }<a name="line.179"></a>
+<FONT color="green">180</FONT>            return evaluate(values, 0, values.length);<a name="line.180"></a>
+<FONT color="green">181</FONT>        }<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>        /**<a name="line.184"></a>
+<FONT color="green">185</FONT>          * &lt;p&gt;Returns the {@link SemiVariance} of the designated values against the mean, using<a name="line.185"></a>
+<FONT color="green">186</FONT>          * instance properties varianceDirection and biasCorrection.&lt;/p&gt;<a name="line.186"></a>
+<FONT color="green">187</FONT>          *<a name="line.187"></a>
+<FONT color="green">188</FONT>          * &lt;p&gt;Returns &lt;code&gt;NaN&lt;/code&gt; if the array is empty and throws<a name="line.188"></a>
+<FONT color="green">189</FONT>          * &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.189"></a>
+<FONT color="green">190</FONT>          *<a name="line.190"></a>
+<FONT color="green">191</FONT>          * @param values the input array<a name="line.191"></a>
+<FONT color="green">192</FONT>          * @param start index of the first array element to include<a name="line.192"></a>
+<FONT color="green">193</FONT>          * @param length the number of elements to include<a name="line.193"></a>
+<FONT color="green">194</FONT>          * @return the SemiVariance<a name="line.194"></a>
+<FONT color="green">195</FONT>          * @throws IllegalArgumentException if the parameters are not valid<a name="line.195"></a>
+<FONT color="green">196</FONT>          *<a name="line.196"></a>
+<FONT color="green">197</FONT>          */<a name="line.197"></a>
+<FONT color="green">198</FONT>          @Override<a name="line.198"></a>
+<FONT color="green">199</FONT>          public double evaluate(final double[] values, final int start, final int length) {<a name="line.199"></a>
+<FONT color="green">200</FONT>            double m = (new Mean()).evaluate(values, start, length);<a name="line.200"></a>
+<FONT color="green">201</FONT>            return evaluate(values, m, varianceDirection, biasCorrected, 0, values.length);<a name="line.201"></a>
+<FONT color="green">202</FONT>          }<a name="line.202"></a>
+<FONT color="green">203</FONT>    <a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>          /**<a name="line.205"></a>
+<FONT color="green">206</FONT>           * This method calculates {@link SemiVariance} for the entire array against the mean, using<a name="line.206"></a>
+<FONT color="green">207</FONT>           * the current value of the biasCorrection instance property.<a name="line.207"></a>
+<FONT color="green">208</FONT>           *<a name="line.208"></a>
+<FONT color="green">209</FONT>           * @param values the input array<a name="line.209"></a>
+<FONT color="green">210</FONT>           * @param direction the {@link Direction} of the semivariance<a name="line.210"></a>
+<FONT color="green">211</FONT>           * @return the SemiVariance<a name="line.211"></a>
+<FONT color="green">212</FONT>           * @throws IllegalArgumentException if values is null<a name="line.212"></a>
+<FONT color="green">213</FONT>           *<a name="line.213"></a>
+<FONT color="green">214</FONT>           */<a name="line.214"></a>
+<FONT color="green">215</FONT>          public double evaluate(final double[] values, Direction direction) {<a name="line.215"></a>
+<FONT color="green">216</FONT>              double m = (new Mean()).evaluate(values);<a name="line.216"></a>
+<FONT color="green">217</FONT>              return evaluate (values, m, direction, biasCorrected, 0, values.length);<a name="line.217"></a>
+<FONT color="green">218</FONT>          }<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>          /**<a name="line.220"></a>
+<FONT color="green">221</FONT>           * &lt;p&gt;Returns the {@link SemiVariance} of the designated values against the cutoff, using<a name="line.221"></a>
+<FONT color="green">222</FONT>           * instance properties variancDirection and biasCorrection.&lt;/p&gt;<a name="line.222"></a>
+<FONT color="green">223</FONT>           *<a name="line.223"></a>
+<FONT color="green">224</FONT>           * &lt;p&gt;Returns &lt;code&gt;NaN&lt;/code&gt; if the array is empty and throws<a name="line.224"></a>
+<FONT color="green">225</FONT>           * &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.225"></a>
+<FONT color="green">226</FONT>           *<a name="line.226"></a>
+<FONT color="green">227</FONT>           * @param values the input array<a name="line.227"></a>
+<FONT color="green">228</FONT>           * @param cutoff the reference point<a name="line.228"></a>
+<FONT color="green">229</FONT>           * @return the SemiVariance<a name="line.229"></a>
+<FONT color="green">230</FONT>           * @throws IllegalArgumentException if values is null<a name="line.230"></a>
+<FONT color="green">231</FONT>           */<a name="line.231"></a>
+<FONT color="green">232</FONT>          public double evaluate(final double[] values, final double cutoff) {<a name="line.232"></a>
+<FONT color="green">233</FONT>              return evaluate(values, cutoff, varianceDirection, biasCorrected, 0, values.length);<a name="line.233"></a>
+<FONT color="green">234</FONT>          }<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>          /**<a name="line.236"></a>
+<FONT color="green">237</FONT>           * &lt;p&gt;Returns the {@link SemiVariance} of the designated values against the cutoff in the<a name="line.237"></a>
+<FONT color="green">238</FONT>           * given direction, using the current value of the biasCorrection instance property.&lt;/p&gt;<a name="line.238"></a>
+<FONT color="green">239</FONT>           *<a name="line.239"></a>
+<FONT color="green">240</FONT>           * &lt;p&gt;Returns &lt;code&gt;NaN&lt;/code&gt; if the array is empty and throws<a name="line.240"></a>
+<FONT color="green">241</FONT>           * &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.241"></a>
+<FONT color="green">242</FONT>           *<a name="line.242"></a>
+<FONT color="green">243</FONT>           * @param values the input array<a name="line.243"></a>
+<FONT color="green">244</FONT>           * @param cutoff the reference point<a name="line.244"></a>
+<FONT color="green">245</FONT>           * @param direction the {@link Direction} of the semivariance<a name="line.245"></a>
+<FONT color="green">246</FONT>           * @return the SemiVariance<a name="line.246"></a>
+<FONT color="green">247</FONT>           * @throws IllegalArgumentException if values is null<a name="line.247"></a>
+<FONT color="green">248</FONT>           */<a name="line.248"></a>
+<FONT color="green">249</FONT>          public double evaluate(final double[] values, final double cutoff, final Direction direction) {<a name="line.249"></a>
+<FONT color="green">250</FONT>              return evaluate(values, cutoff, direction, biasCorrected, 0, values.length);<a name="line.250"></a>
+<FONT color="green">251</FONT>          }<a name="line.251"></a>
+<FONT color="green">252</FONT>    <a name="line.252"></a>
+<FONT color="green">253</FONT>    <a name="line.253"></a>
+<FONT color="green">254</FONT>         /**<a name="line.254"></a>
+<FONT color="green">255</FONT>          * &lt;p&gt;Returns the {@link SemiVariance} of the designated values against the cutoff<a name="line.255"></a>
+<FONT color="green">256</FONT>          * in the given direction with the provided bias correction.&lt;/p&gt;<a name="line.256"></a>
+<FONT color="green">257</FONT>          *<a name="line.257"></a>
+<FONT color="green">258</FONT>          * &lt;p&gt;Returns &lt;code&gt;NaN&lt;/code&gt; if the array is empty and throws<a name="line.258"></a>
+<FONT color="green">259</FONT>          * &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.259"></a>
+<FONT color="green">260</FONT>          *<a name="line.260"></a>
+<FONT color="green">261</FONT>          * @param values the input array<a name="line.261"></a>
+<FONT color="green">262</FONT>          * @param cutoff the reference point<a name="line.262"></a>
+<FONT color="green">263</FONT>          * @param direction the {@link Direction} of the semivariance<a name="line.263"></a>
+<FONT color="green">264</FONT>          * @param corrected the BiasCorrection flag<a name="line.264"></a>
+<FONT color="green">265</FONT>          * @param start index of the first array element to include<a name="line.265"></a>
+<FONT color="green">266</FONT>          * @param length the number of elements to include<a name="line.266"></a>
+<FONT color="green">267</FONT>          * @return the SemiVariance<a name="line.267"></a>
+<FONT color="green">268</FONT>          * @throws IllegalArgumentException if the parameters are not valid<a name="line.268"></a>
+<FONT color="green">269</FONT>          *<a name="line.269"></a>
+<FONT color="green">270</FONT>          */<a name="line.270"></a>
+<FONT color="green">271</FONT>        public double evaluate (final double[] values, final double cutoff, final Direction direction,<a name="line.271"></a>
+<FONT color="green">272</FONT>                final boolean corrected, final int start, final int length) {<a name="line.272"></a>
+<FONT color="green">273</FONT>    <a name="line.273"></a>
+<FONT color="green">274</FONT>            test(values, start, length);<a name="line.274"></a>
+<FONT color="green">275</FONT>            if (values.length == 0) {<a name="line.275"></a>
+<FONT color="green">276</FONT>                return Double.NaN;<a name="line.276"></a>
+<FONT color="green">277</FONT>            } else {<a name="line.277"></a>
+<FONT color="green">278</FONT>                if (values.length == 1) {<a name="line.278"></a>
+<FONT color="green">279</FONT>                    return 0.0;<a name="line.279"></a>
+<FONT color="green">280</FONT>                } else {<a name="line.280"></a>
+<FONT color="green">281</FONT>                    final boolean booleanDirection = direction.getDirection();<a name="line.281"></a>
+<FONT color="green">282</FONT>    <a name="line.282"></a>
+<FONT color="green">283</FONT>                    double dev = 0.0;<a name="line.283"></a>
+<FONT color="green">284</FONT>                    double sumsq = 0.0;<a name="line.284"></a>
+<FONT color="green">285</FONT>                    for (int i = start; i &lt; length; i++) {<a name="line.285"></a>
+<FONT color="green">286</FONT>                        if ((values[i] &gt; cutoff) == booleanDirection) {<a name="line.286"></a>
+<FONT color="green">287</FONT>                           dev = values[i] - cutoff;<a name="line.287"></a>
+<FONT color="green">288</FONT>                           sumsq += dev * dev;<a name="line.288"></a>
+<FONT color="green">289</FONT>                        }<a name="line.289"></a>
+<FONT color="green">290</FONT>                    }<a name="line.290"></a>
+<FONT color="green">291</FONT>    <a name="line.291"></a>
+<FONT color="green">292</FONT>                    if (corrected) {<a name="line.292"></a>
+<FONT color="green">293</FONT>                        return sumsq / (length - 1.0);<a name="line.293"></a>
+<FONT color="green">294</FONT>                    } else {<a name="line.294"></a>
+<FONT color="green">295</FONT>                        return sumsq / length;<a name="line.295"></a>
+<FONT color="green">296</FONT>                    }<a name="line.296"></a>
+<FONT color="green">297</FONT>                }<a name="line.297"></a>
+<FONT color="green">298</FONT>            }<a name="line.298"></a>
+<FONT color="green">299</FONT>        }<a name="line.299"></a>
+<FONT color="green">300</FONT>    <a name="line.300"></a>
+<FONT color="green">301</FONT>        /**<a name="line.301"></a>
+<FONT color="green">302</FONT>         * Returns true iff biasCorrected property is set to true.<a name="line.302"></a>
+<FONT color="green">303</FONT>         *<a name="line.303"></a>
+<FONT color="green">304</FONT>         * @return the value of biasCorrected.<a name="line.304"></a>
+<FONT color="green">305</FONT>         */<a name="line.305"></a>
+<FONT color="green">306</FONT>        public boolean isBiasCorrected() {<a name="line.306"></a>
+<FONT color="green">307</FONT>            return biasCorrected;<a name="line.307"></a>
+<FONT color="green">308</FONT>        }<a name="line.308"></a>
+<FONT color="green">309</FONT>    <a name="line.309"></a>
+<FONT color="green">310</FONT>        /**<a name="line.310"></a>
+<FONT color="green">311</FONT>         * Sets the biasCorrected property.<a name="line.311"></a>
+<FONT color="green">312</FONT>         *<a name="line.312"></a>
+<FONT color="green">313</FONT>         * @param biasCorrected new biasCorrected property value<a name="line.313"></a>
+<FONT color="green">314</FONT>         */<a name="line.314"></a>
+<FONT color="green">315</FONT>        public void setBiasCorrected(boolean biasCorrected) {<a name="line.315"></a>
+<FONT color="green">316</FONT>            this.biasCorrected = biasCorrected;<a name="line.316"></a>
+<FONT color="green">317</FONT>        }<a name="line.317"></a>
+<FONT color="green">318</FONT>    <a name="line.318"></a>
+<FONT color="green">319</FONT>        /**<a name="line.319"></a>
+<FONT color="green">320</FONT>         * Returns the varianceDirection property.<a name="line.320"></a>
+<FONT color="green">321</FONT>         *<a name="line.321"></a>
+<FONT color="green">322</FONT>         * @return the varianceDirection<a name="line.322"></a>
+<FONT color="green">323</FONT>         */<a name="line.323"></a>
+<FONT color="green">324</FONT>        public Direction getVarianceDirection () {<a name="line.324"></a>
+<FONT color="green">325</FONT>            return varianceDirection;<a name="line.325"></a>
+<FONT color="green">326</FONT>        }<a name="line.326"></a>
+<FONT color="green">327</FONT>    <a name="line.327"></a>
+<FONT color="green">328</FONT>        /**<a name="line.328"></a>
+<FONT color="green">329</FONT>         * Sets the variance direction<a name="line.329"></a>
+<FONT color="green">330</FONT>         *<a name="line.330"></a>
+<FONT color="green">331</FONT>         * @param varianceDirection the direction of the semivariance<a name="line.331"></a>
+<FONT color="green">332</FONT>         */<a name="line.332"></a>
+<FONT color="green">333</FONT>        public void setVarianceDirection(Direction varianceDirection) {<a name="line.333"></a>
+<FONT color="green">334</FONT>            this.varianceDirection = varianceDirection;<a name="line.334"></a>
+<FONT color="green">335</FONT>        }<a name="line.335"></a>
+<FONT color="green">336</FONT>    <a name="line.336"></a>
+<FONT color="green">337</FONT>        /**<a name="line.337"></a>
+<FONT color="green">338</FONT>         * The direction of the semivariance - either upside or downside. The direction<a name="line.338"></a>
+<FONT color="green">339</FONT>         * is represented by boolean, with true corresponding to UPSIDE semivariance.<a name="line.339"></a>
+<FONT color="green">340</FONT>         */<a name="line.340"></a>
+<FONT color="green">341</FONT>        public enum Direction {<a name="line.341"></a>
+<FONT color="green">342</FONT>            /**<a name="line.342"></a>
+<FONT color="green">343</FONT>             * The UPSIDE Direction is used to specify that the observations above the<a name="line.343"></a>
+<FONT color="green">344</FONT>             * cutoff point will be used to calculate SemiVariance<a name="line.344"></a>
+<FONT color="green">345</FONT>             */<a name="line.345"></a>
+<FONT color="green">346</FONT>            UPSIDE (true),<a name="line.346"></a>
+<FONT color="green">347</FONT>    <a name="line.347"></a>
+<FONT color="green">348</FONT>            /**<a name="line.348"></a>
+<FONT color="green">349</FONT>             * The DOWNSIDE Direction is used to specify that the observations below<a name="line.349"></a>
+<FONT color="green">350</FONT>             * the cutoff point will be used to calculate SemiVariance<a name="line.350"></a>
+<FONT color="green">351</FONT>             */<a name="line.351"></a>
+<FONT color="green">352</FONT>            DOWNSIDE (false);<a name="line.352"></a>
+<FONT color="green">353</FONT>    <a name="line.353"></a>
+<FONT color="green">354</FONT>            /**<a name="line.354"></a>
+<FONT color="green">355</FONT>             *   boolean value  UPSIDE &lt;-&gt; true<a name="line.355"></a>
+<FONT color="green">356</FONT>             */<a name="line.356"></a>
+<FONT color="green">357</FONT>            private boolean direction;<a name="line.357"></a>
+<FONT color="green">358</FONT>    <a name="line.358"></a>
+<FONT color="green">359</FONT>            /**<a name="line.359"></a>
+<FONT color="green">360</FONT>             * Create a Direction with the given value.<a name="line.360"></a>
+<FONT color="green">361</FONT>             *<a name="line.361"></a>
+<FONT color="green">362</FONT>             * @param b boolean value representing the Direction. True corresponds to UPSIDE.<a name="line.362"></a>
+<FONT color="green">363</FONT>             */<a name="line.363"></a>
+<FONT color="green">364</FONT>            Direction (boolean b) {<a name="line.364"></a>
+<FONT color="green">365</FONT>                direction = b;<a name="line.365"></a>
+<FONT color="green">366</FONT>            }<a name="line.366"></a>
+<FONT color="green">367</FONT>    <a name="line.367"></a>
+<FONT color="green">368</FONT>            /**<a name="line.368"></a>
+<FONT color="green">369</FONT>             * Returns the value of this Direction. True corresponds to UPSIDE.<a name="line.369"></a>
+<FONT color="green">370</FONT>             *<a name="line.370"></a>
+<FONT color="green">371</FONT>             * @return true if direction is UPSIDE; false otherwise<a name="line.371"></a>
+<FONT color="green">372</FONT>             */<a name="line.372"></a>
+<FONT color="green">373</FONT>            boolean getDirection () {<a name="line.373"></a>
+<FONT color="green">374</FONT>                return direction;<a name="line.374"></a>
+<FONT color="green">375</FONT>            }<a name="line.375"></a>
+<FONT color="green">376</FONT>        }<a name="line.376"></a>
+<FONT color="green">377</FONT>    }<a name="line.377"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/SemiVariance.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,443 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.stat.descriptive.moment;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.stat.descriptive.AbstractUnivariateStatistic;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;Computes the semivariance of a set of values with respect to a given cutoff value.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * We define the &lt;i&gt;downside semivariance&lt;/i&gt; of a set of values &lt;code&gt;x&lt;/code&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * against the &lt;i&gt;cutoff value&lt;/i&gt; &lt;code&gt;cutoff&lt;/code&gt; to be &lt;br/&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;code&gt;&amp;Sigma; (x[i] - target)&lt;sup&gt;2&lt;/sup&gt; / df&lt;/code&gt; &lt;br/&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * where the sum is taken over all &lt;code&gt;i&lt;/code&gt; such that &lt;code&gt;x[i] &lt; cutoff&lt;/code&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * and &lt;code&gt;df&lt;/code&gt; is the length of &lt;code&gt;x&lt;/code&gt; (non-bias-corrected) or<a name="line.30"></a>
+<FONT color="green">031</FONT>     * one less than this number (bias corrected).  The &lt;i&gt;upside semivariance&lt;/i&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * is defined similarly, with the sum taken over values of &lt;code&gt;x&lt;/code&gt; that<a name="line.32"></a>
+<FONT color="green">033</FONT>     * exceed the cutoff value.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     *<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;p&gt;The cutoff value defaults to the mean, bias correction defaults to &lt;code&gt;true&lt;/code&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * and the "variance direction" (upside or downside) defaults to downside.  The variance direction<a name="line.36"></a>
+<FONT color="green">037</FONT>     * and bias correction may be set using property setters or their values can provided as<a name="line.37"></a>
+<FONT color="green">038</FONT>     * parameters to {@link #evaluate(double[], double, Direction, boolean, int, int)}.&lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     *<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;p&gt;If the input array is null, &lt;code&gt;evaluate&lt;/code&gt; methods throw<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;code&gt;IllegalArgumentException.&lt;/code&gt;  If the array has length 1, &lt;code&gt;0&lt;/code&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * is returned, regardless of the value of the &lt;code&gt;cutoff.&lt;/code&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     *<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;p&gt;&lt;strong&gt;Note that this class is not intended to be threadsafe.&lt;/strong&gt; If<a name="line.44"></a>
+<FONT color="green">045</FONT>     * multiple threads access an instance of this class concurrently, and one or<a name="line.45"></a>
+<FONT color="green">046</FONT>     * more of these threads invoke property setters, external synchronization must<a name="line.46"></a>
+<FONT color="green">047</FONT>     * be provided to ensure correct results.&lt;/p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     *<a name="line.48"></a>
+<FONT color="green">049</FONT>     * @version $Revision: 917275 $ $Date: 2010-02-28 14:43:11 -0500 (Sun, 28 Feb 2010) $<a name="line.49"></a>
+<FONT color="green">050</FONT>     * @since 2.1<a name="line.50"></a>
+<FONT color="green">051</FONT>     */<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>    public class SemiVariance extends AbstractUnivariateStatistic implements Serializable {<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * The UPSIDE Direction is used to specify that the observations above the<a name="line.56"></a>
+<FONT color="green">057</FONT>         * cutoff point will be used to calculate SemiVariance.<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public static final Direction UPSIDE_VARIANCE = Direction.UPSIDE;<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * The DOWNSIDE Direction is used to specify that the observations below<a name="line.62"></a>
+<FONT color="green">063</FONT>         * the cutoff point will be used to calculate SemiVariance<a name="line.63"></a>
+<FONT color="green">064</FONT>         */<a name="line.64"></a>
+<FONT color="green">065</FONT>        public static final Direction DOWNSIDE_VARIANCE = Direction.DOWNSIDE;<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /** Serializable version identifier */<a name="line.67"></a>
+<FONT color="green">068</FONT>        private static final long serialVersionUID = -2653430366886024994L;<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /**<a name="line.70"></a>
+<FONT color="green">071</FONT>         * Determines whether or not bias correction is applied when computing the<a name="line.71"></a>
+<FONT color="green">072</FONT>         * value of the statisic.  True means that bias is corrected.<a name="line.72"></a>
+<FONT color="green">073</FONT>         */<a name="line.73"></a>
+<FONT color="green">074</FONT>        private boolean biasCorrected = true;<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        /**<a name="line.76"></a>
+<FONT color="green">077</FONT>         * Determines whether to calculate downside or upside SemiVariance.<a name="line.77"></a>
+<FONT color="green">078</FONT>         */<a name="line.78"></a>
+<FONT color="green">079</FONT>        private Direction varianceDirection = Direction.DOWNSIDE;<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /**<a name="line.81"></a>
+<FONT color="green">082</FONT>         * Constructs a SemiVariance with default (true) &lt;code&gt;biasCorrected&lt;/code&gt;<a name="line.82"></a>
+<FONT color="green">083</FONT>         * property and default (Downside) &lt;code&gt;varianceDirection&lt;/code&gt; property.<a name="line.83"></a>
+<FONT color="green">084</FONT>         */<a name="line.84"></a>
+<FONT color="green">085</FONT>        public SemiVariance() {<a name="line.85"></a>
+<FONT color="green">086</FONT>        }<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>        /**<a name="line.88"></a>
+<FONT color="green">089</FONT>         * Constructs a SemiVariance with the specified &lt;code&gt;biasCorrected&lt;/code&gt;<a name="line.89"></a>
+<FONT color="green">090</FONT>         * property and default (Downside) &lt;code&gt;varianceDirection&lt;/code&gt; property.<a name="line.90"></a>
+<FONT color="green">091</FONT>         *<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @param biasCorrected  setting for bias correction - true means<a name="line.92"></a>
+<FONT color="green">093</FONT>         * bias will be corrected and is equivalent to using the argumentless<a name="line.93"></a>
+<FONT color="green">094</FONT>         * constructor<a name="line.94"></a>
+<FONT color="green">095</FONT>         */<a name="line.95"></a>
+<FONT color="green">096</FONT>        public SemiVariance(final boolean biasCorrected) {<a name="line.96"></a>
+<FONT color="green">097</FONT>            this.biasCorrected = biasCorrected;<a name="line.97"></a>
+<FONT color="green">098</FONT>        }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /**<a name="line.101"></a>
+<FONT color="green">102</FONT>         * Constructs a SemiVariance with the specified &lt;code&gt;Direction&lt;/code&gt; property<a name="line.102"></a>
+<FONT color="green">103</FONT>         * and default (true) &lt;code&gt;biasCorrected&lt;/code&gt; property<a name="line.103"></a>
+<FONT color="green">104</FONT>         *<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @param direction  setting for the direction of the SemiVariance<a name="line.105"></a>
+<FONT color="green">106</FONT>         * to calculate<a name="line.106"></a>
+<FONT color="green">107</FONT>         */<a name="line.107"></a>
+<FONT color="green">108</FONT>        public SemiVariance(final Direction direction) {<a name="line.108"></a>
+<FONT color="green">109</FONT>            this.varianceDirection = direction;<a name="line.109"></a>
+<FONT color="green">110</FONT>        }<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>        /**<a name="line.113"></a>
+<FONT color="green">114</FONT>         * Constructs a SemiVariance with the specified &lt;code&gt;isBiasCorrected&lt;/code&gt;<a name="line.114"></a>
+<FONT color="green">115</FONT>         * property and the specified &lt;code&gt;Direction&lt;/code&gt; property.<a name="line.115"></a>
+<FONT color="green">116</FONT>         *<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @param corrected  setting for bias correction - true means<a name="line.117"></a>
+<FONT color="green">118</FONT>         * bias will be corrected and is equivalent to using the argumentless<a name="line.118"></a>
+<FONT color="green">119</FONT>         * constructor<a name="line.119"></a>
+<FONT color="green">120</FONT>         *<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @param direction  setting for the direction of the SemiVariance<a name="line.121"></a>
+<FONT color="green">122</FONT>         * to calculate<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        public SemiVariance(final boolean corrected, final Direction direction) {<a name="line.124"></a>
+<FONT color="green">125</FONT>            this.biasCorrected = corrected;<a name="line.125"></a>
+<FONT color="green">126</FONT>            this.varianceDirection = direction;<a name="line.126"></a>
+<FONT color="green">127</FONT>        }<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /**<a name="line.130"></a>
+<FONT color="green">131</FONT>         * Copy constructor, creates a new {@code SemiVariance} identical<a name="line.131"></a>
+<FONT color="green">132</FONT>         * to the {@code original}<a name="line.132"></a>
+<FONT color="green">133</FONT>         *<a name="line.133"></a>
+<FONT color="green">134</FONT>         * @param original the {@code SemiVariance} instance to copy<a name="line.134"></a>
+<FONT color="green">135</FONT>         */<a name="line.135"></a>
+<FONT color="green">136</FONT>        public SemiVariance(final SemiVariance original) {<a name="line.136"></a>
+<FONT color="green">137</FONT>            copy(original, this);<a name="line.137"></a>
+<FONT color="green">138</FONT>        }<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>        /**<a name="line.141"></a>
+<FONT color="green">142</FONT>         * {@inheritDoc}<a name="line.142"></a>
+<FONT color="green">143</FONT>         */<a name="line.143"></a>
+<FONT color="green">144</FONT>        @Override<a name="line.144"></a>
+<FONT color="green">145</FONT>        public SemiVariance copy() {<a name="line.145"></a>
+<FONT color="green">146</FONT>            SemiVariance result = new SemiVariance();<a name="line.146"></a>
+<FONT color="green">147</FONT>            copy(this, result);<a name="line.147"></a>
+<FONT color="green">148</FONT>            return result;<a name="line.148"></a>
+<FONT color="green">149</FONT>        }<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>        /**<a name="line.152"></a>
+<FONT color="green">153</FONT>         * Copies source to dest.<a name="line.153"></a>
+<FONT color="green">154</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.154"></a>
+<FONT color="green">155</FONT>         *<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @param source SemiVariance to copy<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @param dest SemiVariance to copy to<a name="line.157"></a>
+<FONT color="green">158</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.158"></a>
+<FONT color="green">159</FONT>         */<a name="line.159"></a>
+<FONT color="green">160</FONT>        public static void copy(final SemiVariance source, SemiVariance dest) {<a name="line.160"></a>
+<FONT color="green">161</FONT>            dest.biasCorrected = source.biasCorrected;<a name="line.161"></a>
+<FONT color="green">162</FONT>            dest.varianceDirection = source.varianceDirection;<a name="line.162"></a>
+<FONT color="green">163</FONT>        }<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>        /**<a name="line.166"></a>
+<FONT color="green">167</FONT>         * This method calculates {@link SemiVariance} for the entire array against the mean, using<a name="line.167"></a>
+<FONT color="green">168</FONT>         * instance properties varianceDirection and biasCorrection.<a name="line.168"></a>
+<FONT color="green">169</FONT>         *<a name="line.169"></a>
+<FONT color="green">170</FONT>         * @param values the input array<a name="line.170"></a>
+<FONT color="green">171</FONT>         * @return the SemiVariance<a name="line.171"></a>
+<FONT color="green">172</FONT>         * @throws IllegalArgumentException if values is null<a name="line.172"></a>
+<FONT color="green">173</FONT>         *<a name="line.173"></a>
+<FONT color="green">174</FONT>         */<a name="line.174"></a>
+<FONT color="green">175</FONT>        @Override<a name="line.175"></a>
+<FONT color="green">176</FONT>        public double evaluate(final double[] values) {<a name="line.176"></a>
+<FONT color="green">177</FONT>            if (values == null) {<a name="line.177"></a>
+<FONT color="green">178</FONT>                throw MathRuntimeException.createIllegalArgumentException("input values array is null");<a name="line.178"></a>
+<FONT color="green">179</FONT>             }<a name="line.179"></a>
+<FONT color="green">180</FONT>            return evaluate(values, 0, values.length);<a name="line.180"></a>
+<FONT color="green">181</FONT>        }<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>        /**<a name="line.184"></a>
+<FONT color="green">185</FONT>          * &lt;p&gt;Returns the {@link SemiVariance} of the designated values against the mean, using<a name="line.185"></a>
+<FONT color="green">186</FONT>          * instance properties varianceDirection and biasCorrection.&lt;/p&gt;<a name="line.186"></a>
+<FONT color="green">187</FONT>          *<a name="line.187"></a>
+<FONT color="green">188</FONT>          * &lt;p&gt;Returns &lt;code&gt;NaN&lt;/code&gt; if the array is empty and throws<a name="line.188"></a>
+<FONT color="green">189</FONT>          * &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.189"></a>
+<FONT color="green">190</FONT>          *<a name="line.190"></a>
+<FONT color="green">191</FONT>          * @param values the input array<a name="line.191"></a>
+<FONT color="green">192</FONT>          * @param start index of the first array element to include<a name="line.192"></a>
+<FONT color="green">193</FONT>          * @param length the number of elements to include<a name="line.193"></a>
+<FONT color="green">194</FONT>          * @return the SemiVariance<a name="line.194"></a>
+<FONT color="green">195</FONT>          * @throws IllegalArgumentException if the parameters are not valid<a name="line.195"></a>
+<FONT color="green">196</FONT>          *<a name="line.196"></a>
+<FONT color="green">197</FONT>          */<a name="line.197"></a>
+<FONT color="green">198</FONT>          @Override<a name="line.198"></a>
+<FONT color="green">199</FONT>          public double evaluate(final double[] values, final int start, final int length) {<a name="line.199"></a>
+<FONT color="green">200</FONT>            double m = (new Mean()).evaluate(values, start, length);<a name="line.200"></a>
+<FONT color="green">201</FONT>            return evaluate(values, m, varianceDirection, biasCorrected, 0, values.length);<a name="line.201"></a>
+<FONT color="green">202</FONT>          }<a name="line.202"></a>
+<FONT color="green">203</FONT>    <a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>          /**<a name="line.205"></a>
+<FONT color="green">206</FONT>           * This method calculates {@link SemiVariance} for the entire array against the mean, using<a name="line.206"></a>
+<FONT color="green">207</FONT>           * the current value of the biasCorrection instance property.<a name="line.207"></a>
+<FONT color="green">208</FONT>           *<a name="line.208"></a>
+<FONT color="green">209</FONT>           * @param values the input array<a name="line.209"></a>
+<FONT color="green">210</FONT>           * @param direction the {@link Direction} of the semivariance<a name="line.210"></a>
+<FONT color="green">211</FONT>           * @return the SemiVariance<a name="line.211"></a>
+<FONT color="green">212</FONT>           * @throws IllegalArgumentException if values is null<a name="line.212"></a>
+<FONT color="green">213</FONT>           *<a name="line.213"></a>
+<FONT color="green">214</FONT>           */<a name="line.214"></a>
+<FONT color="green">215</FONT>          public double evaluate(final double[] values, Direction direction) {<a name="line.215"></a>
+<FONT color="green">216</FONT>              double m = (new Mean()).evaluate(values);<a name="line.216"></a>
+<FONT color="green">217</FONT>              return evaluate (values, m, direction, biasCorrected, 0, values.length);<a name="line.217"></a>
+<FONT color="green">218</FONT>          }<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>          /**<a name="line.220"></a>
+<FONT color="green">221</FONT>           * &lt;p&gt;Returns the {@link SemiVariance} of the designated values against the cutoff, using<a name="line.221"></a>
+<FONT color="green">222</FONT>           * instance properties variancDirection and biasCorrection.&lt;/p&gt;<a name="line.222"></a>
+<FONT color="green">223</FONT>           *<a name="line.223"></a>
+<FONT color="green">224</FONT>           * &lt;p&gt;Returns &lt;code&gt;NaN&lt;/code&gt; if the array is empty and throws<a name="line.224"></a>
+<FONT color="green">225</FONT>           * &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.225"></a>
+<FONT color="green">226</FONT>           *<a name="line.226"></a>
+<FONT color="green">227</FONT>           * @param values the input array<a name="line.227"></a>
+<FONT color="green">228</FONT>           * @param cutoff the reference point<a name="line.228"></a>
+<FONT color="green">229</FONT>           * @return the SemiVariance<a name="line.229"></a>
+<FONT color="green">230</FONT>           * @throws IllegalArgumentException if values is null<a name="line.230"></a>
+<FONT color="green">231</FONT>           */<a name="line.231"></a>
+<FONT color="green">232</FONT>          public double evaluate(final double[] values, final double cutoff) {<a name="line.232"></a>
+<FONT color="green">233</FONT>              return evaluate(values, cutoff, varianceDirection, biasCorrected, 0, values.length);<a name="line.233"></a>
+<FONT color="green">234</FONT>          }<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>          /**<a name="line.236"></a>
+<FONT color="green">237</FONT>           * &lt;p&gt;Returns the {@link SemiVariance} of the designated values against the cutoff in the<a name="line.237"></a>
+<FONT color="green">238</FONT>           * given direction, using the current value of the biasCorrection instance property.&lt;/p&gt;<a name="line.238"></a>
+<FONT color="green">239</FONT>           *<a name="line.239"></a>
+<FONT color="green">240</FONT>           * &lt;p&gt;Returns &lt;code&gt;NaN&lt;/code&gt; if the array is empty and throws<a name="line.240"></a>
+<FONT color="green">241</FONT>           * &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.241"></a>
+<FONT color="green">242</FONT>           *<a name="line.242"></a>
+<FONT color="green">243</FONT>           * @param values the input array<a name="line.243"></a>
+<FONT color="green">244</FONT>           * @param cutoff the reference point<a name="line.244"></a>
+<FONT color="green">245</FONT>           * @param direction the {@link Direction} of the semivariance<a name="line.245"></a>
+<FONT color="green">246</FONT>           * @return the SemiVariance<a name="line.246"></a>
+<FONT color="green">247</FONT>           * @throws IllegalArgumentException if values is null<a name="line.247"></a>
+<FONT color="green">248</FONT>           */<a name="line.248"></a>
+<FONT color="green">249</FONT>          public double evaluate(final double[] values, final double cutoff, final Direction direction) {<a name="line.249"></a>
+<FONT color="green">250</FONT>              return evaluate(values, cutoff, direction, biasCorrected, 0, values.length);<a name="line.250"></a>
+<FONT color="green">251</FONT>          }<a name="line.251"></a>
+<FONT color="green">252</FONT>    <a name="line.252"></a>
+<FONT color="green">253</FONT>    <a name="line.253"></a>
+<FONT color="green">254</FONT>         /**<a name="line.254"></a>
+<FONT color="green">255</FONT>          * &lt;p&gt;Returns the {@link SemiVariance} of the designated values against the cutoff<a name="line.255"></a>
+<FONT color="green">256</FONT>          * in the given direction with the provided bias correction.&lt;/p&gt;<a name="line.256"></a>
+<FONT color="green">257</FONT>          *<a name="line.257"></a>
+<FONT color="green">258</FONT>          * &lt;p&gt;Returns &lt;code&gt;NaN&lt;/code&gt; if the array is empty and throws<a name="line.258"></a>
+<FONT color="green">259</FONT>          * &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.259"></a>
+<FONT color="green">260</FONT>          *<a name="line.260"></a>
+<FONT color="green">261</FONT>          * @param values the input array<a name="line.261"></a>
+<FONT color="green">262</FONT>          * @param cutoff the reference point<a name="line.262"></a>
+<FONT color="green">263</FONT>          * @param direction the {@link Direction} of the semivariance<a name="line.263"></a>
+<FONT color="green">264</FONT>          * @param corrected the BiasCorrection flag<a name="line.264"></a>
+<FONT color="green">265</FONT>          * @param start index of the first array element to include<a name="line.265"></a>
+<FONT color="green">266</FONT>          * @param length the number of elements to include<a name="line.266"></a>
+<FONT color="green">267</FONT>          * @return the SemiVariance<a name="line.267"></a>
+<FONT color="green">268</FONT>          * @throws IllegalArgumentException if the parameters are not valid<a name="line.268"></a>
+<FONT color="green">269</FONT>          *<a name="line.269"></a>
+<FONT color="green">270</FONT>          */<a name="line.270"></a>
+<FONT color="green">271</FONT>        public double evaluate (final double[] values, final double cutoff, final Direction direction,<a name="line.271"></a>
+<FONT color="green">272</FONT>                final boolean corrected, final int start, final int length) {<a name="line.272"></a>
+<FONT color="green">273</FONT>    <a name="line.273"></a>
+<FONT color="green">274</FONT>            test(values, start, length);<a name="line.274"></a>
+<FONT color="green">275</FONT>            if (values.length == 0) {<a name="line.275"></a>
+<FONT color="green">276</FONT>                return Double.NaN;<a name="line.276"></a>
+<FONT color="green">277</FONT>            } else {<a name="line.277"></a>
+<FONT color="green">278</FONT>                if (values.length == 1) {<a name="line.278"></a>
+<FONT color="green">279</FONT>                    return 0.0;<a name="line.279"></a>
+<FONT color="green">280</FONT>                } else {<a name="line.280"></a>
+<FONT color="green">281</FONT>                    final boolean booleanDirection = direction.getDirection();<a name="line.281"></a>
+<FONT color="green">282</FONT>    <a name="line.282"></a>
+<FONT color="green">283</FONT>                    double dev = 0.0;<a name="line.283"></a>
+<FONT color="green">284</FONT>                    double sumsq = 0.0;<a name="line.284"></a>
+<FONT color="green">285</FONT>                    for (int i = start; i &lt; length; i++) {<a name="line.285"></a>
+<FONT color="green">286</FONT>                        if ((values[i] &gt; cutoff) == booleanDirection) {<a name="line.286"></a>
+<FONT color="green">287</FONT>                           dev = values[i] - cutoff;<a name="line.287"></a>
+<FONT color="green">288</FONT>                           sumsq += dev * dev;<a name="line.288"></a>
+<FONT color="green">289</FONT>                        }<a name="line.289"></a>
+<FONT color="green">290</FONT>                    }<a name="line.290"></a>
+<FONT color="green">291</FONT>    <a name="line.291"></a>
+<FONT color="green">292</FONT>                    if (corrected) {<a name="line.292"></a>
+<FONT color="green">293</FONT>                        return sumsq / (length - 1.0);<a name="line.293"></a>
+<FONT color="green">294</FONT>                    } else {<a name="line.294"></a>
+<FONT color="green">295</FONT>                        return sumsq / length;<a name="line.295"></a>
+<FONT color="green">296</FONT>                    }<a name="line.296"></a>
+<FONT color="green">297</FONT>                }<a name="line.297"></a>
+<FONT color="green">298</FONT>            }<a name="line.298"></a>
+<FONT color="green">299</FONT>        }<a name="line.299"></a>
+<FONT color="green">300</FONT>    <a name="line.300"></a>
+<FONT color="green">301</FONT>        /**<a name="line.301"></a>
+<FONT color="green">302</FONT>         * Returns true iff biasCorrected property is set to true.<a name="line.302"></a>
+<FONT color="green">303</FONT>         *<a name="line.303"></a>
+<FONT color="green">304</FONT>         * @return the value of biasCorrected.<a name="line.304"></a>
+<FONT color="green">305</FONT>         */<a name="line.305"></a>
+<FONT color="green">306</FONT>        public boolean isBiasCorrected() {<a name="line.306"></a>
+<FONT color="green">307</FONT>            return biasCorrected;<a name="line.307"></a>
+<FONT color="green">308</FONT>        }<a name="line.308"></a>
+<FONT color="green">309</FONT>    <a name="line.309"></a>
+<FONT color="green">310</FONT>        /**<a name="line.310"></a>
+<FONT color="green">311</FONT>         * Sets the biasCorrected property.<a name="line.311"></a>
+<FONT color="green">312</FONT>         *<a name="line.312"></a>
+<FONT color="green">313</FONT>         * @param biasCorrected new biasCorrected property value<a name="line.313"></a>
+<FONT color="green">314</FONT>         */<a name="line.314"></a>
+<FONT color="green">315</FONT>        public void setBiasCorrected(boolean biasCorrected) {<a name="line.315"></a>
+<FONT color="green">316</FONT>            this.biasCorrected = biasCorrected;<a name="line.316"></a>
+<FONT color="green">317</FONT>        }<a name="line.317"></a>
+<FONT color="green">318</FONT>    <a name="line.318"></a>
+<FONT color="green">319</FONT>        /**<a name="line.319"></a>
+<FONT color="green">320</FONT>         * Returns the varianceDirection property.<a name="line.320"></a>
+<FONT color="green">321</FONT>         *<a name="line.321"></a>
+<FONT color="green">322</FONT>         * @return the varianceDirection<a name="line.322"></a>
+<FONT color="green">323</FONT>         */<a name="line.323"></a>
+<FONT color="green">324</FONT>        public Direction getVarianceDirection () {<a name="line.324"></a>
+<FONT color="green">325</FONT>            return varianceDirection;<a name="line.325"></a>
+<FONT color="green">326</FONT>        }<a name="line.326"></a>
+<FONT color="green">327</FONT>    <a name="line.327"></a>
+<FONT color="green">328</FONT>        /**<a name="line.328"></a>
+<FONT color="green">329</FONT>         * Sets the variance direction<a name="line.329"></a>
+<FONT color="green">330</FONT>         *<a name="line.330"></a>
+<FONT color="green">331</FONT>         * @param varianceDirection the direction of the semivariance<a name="line.331"></a>
+<FONT color="green">332</FONT>         */<a name="line.332"></a>
+<FONT color="green">333</FONT>        public void setVarianceDirection(Direction varianceDirection) {<a name="line.333"></a>
+<FONT color="green">334</FONT>            this.varianceDirection = varianceDirection;<a name="line.334"></a>
+<FONT color="green">335</FONT>        }<a name="line.335"></a>
+<FONT color="green">336</FONT>    <a name="line.336"></a>
+<FONT color="green">337</FONT>        /**<a name="line.337"></a>
+<FONT color="green">338</FONT>         * The direction of the semivariance - either upside or downside. The direction<a name="line.338"></a>
+<FONT color="green">339</FONT>         * is represented by boolean, with true corresponding to UPSIDE semivariance.<a name="line.339"></a>
+<FONT color="green">340</FONT>         */<a name="line.340"></a>
+<FONT color="green">341</FONT>        public enum Direction {<a name="line.341"></a>
+<FONT color="green">342</FONT>            /**<a name="line.342"></a>
+<FONT color="green">343</FONT>             * The UPSIDE Direction is used to specify that the observations above the<a name="line.343"></a>
+<FONT color="green">344</FONT>             * cutoff point will be used to calculate SemiVariance<a name="line.344"></a>
+<FONT color="green">345</FONT>             */<a name="line.345"></a>
+<FONT color="green">346</FONT>            UPSIDE (true),<a name="line.346"></a>
+<FONT color="green">347</FONT>    <a name="line.347"></a>
+<FONT color="green">348</FONT>            /**<a name="line.348"></a>
+<FONT color="green">349</FONT>             * The DOWNSIDE Direction is used to specify that the observations below<a name="line.349"></a>
+<FONT color="green">350</FONT>             * the cutoff point will be used to calculate SemiVariance<a name="line.350"></a>
+<FONT color="green">351</FONT>             */<a name="line.351"></a>
+<FONT color="green">352</FONT>            DOWNSIDE (false);<a name="line.352"></a>
+<FONT color="green">353</FONT>    <a name="line.353"></a>
+<FONT color="green">354</FONT>            /**<a name="line.354"></a>
+<FONT color="green">355</FONT>             *   boolean value  UPSIDE &lt;-&gt; true<a name="line.355"></a>
+<FONT color="green">356</FONT>             */<a name="line.356"></a>
+<FONT color="green">357</FONT>            private boolean direction;<a name="line.357"></a>
+<FONT color="green">358</FONT>    <a name="line.358"></a>
+<FONT color="green">359</FONT>            /**<a name="line.359"></a>
+<FONT color="green">360</FONT>             * Create a Direction with the given value.<a name="line.360"></a>
+<FONT color="green">361</FONT>             *<a name="line.361"></a>
+<FONT color="green">362</FONT>             * @param b boolean value representing the Direction. True corresponds to UPSIDE.<a name="line.362"></a>
+<FONT color="green">363</FONT>             */<a name="line.363"></a>
+<FONT color="green">364</FONT>            Direction (boolean b) {<a name="line.364"></a>
+<FONT color="green">365</FONT>                direction = b;<a name="line.365"></a>
+<FONT color="green">366</FONT>            }<a name="line.366"></a>
+<FONT color="green">367</FONT>    <a name="line.367"></a>
+<FONT color="green">368</FONT>            /**<a name="line.368"></a>
+<FONT color="green">369</FONT>             * Returns the value of this Direction. True corresponds to UPSIDE.<a name="line.369"></a>
+<FONT color="green">370</FONT>             *<a name="line.370"></a>
+<FONT color="green">371</FONT>             * @return true if direction is UPSIDE; false otherwise<a name="line.371"></a>
+<FONT color="green">372</FONT>             */<a name="line.372"></a>
+<FONT color="green">373</FONT>            boolean getDirection () {<a name="line.373"></a>
+<FONT color="green">374</FONT>                return direction;<a name="line.374"></a>
+<FONT color="green">375</FONT>            }<a name="line.375"></a>
+<FONT color="green">376</FONT>        }<a name="line.376"></a>
+<FONT color="green">377</FONT>    }<a name="line.377"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/Skewness.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,277 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.moment;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Computes the skewness of the available values.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * We use the following (unbiased) formula to define skewness:&lt;/p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * skewness = [n / (n -1) (n - 2)] sum[(x_i - mean)^3] / std^3 &lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * where n is the number of values, mean is the {@link Mean} and std is the<a name="line.30"></a>
+<FONT color="green">031</FONT>     * {@link StandardDeviation} &lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;strong&gt;Note that this implementation is not synchronized.&lt;/strong&gt; If<a name="line.33"></a>
+<FONT color="green">034</FONT>     * multiple threads access an instance of this class concurrently, and at least<a name="line.34"></a>
+<FONT color="green">035</FONT>     * one of the threads invokes the &lt;code&gt;increment()&lt;/code&gt; or<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;code&gt;clear()&lt;/code&gt; method, it must be synchronized externally. &lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @version $Revision: 811833 $ $Date: 2009-09-06 12:27:50 -0400 (Sun, 06 Sep 2009) $<a name="line.38"></a>
+<FONT color="green">039</FONT>     */<a name="line.39"></a>
+<FONT color="green">040</FONT>    public class Skewness extends AbstractStorelessUnivariateStatistic implements Serializable {<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Serializable version identifier */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private static final long serialVersionUID = 7101857578996691352L;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Third moment on which this statistic is based */<a name="line.45"></a>
+<FONT color="green">046</FONT>        protected ThirdMoment moment = null;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>         /**<a name="line.48"></a>
+<FONT color="green">049</FONT>         * Determines whether or not this statistic can be incremented or cleared.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * &lt;p&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Statistics based on (constructed from) external moments cannot<a name="line.51"></a>
+<FONT color="green">052</FONT>         * be incremented or cleared.&lt;/p&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>        */<a name="line.53"></a>
+<FONT color="green">054</FONT>        protected boolean incMoment;<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /**<a name="line.56"></a>
+<FONT color="green">057</FONT>         * Constructs a Skewness<a name="line.57"></a>
+<FONT color="green">058</FONT>         */<a name="line.58"></a>
+<FONT color="green">059</FONT>        public Skewness() {<a name="line.59"></a>
+<FONT color="green">060</FONT>            incMoment = true;<a name="line.60"></a>
+<FONT color="green">061</FONT>            moment = new ThirdMoment();<a name="line.61"></a>
+<FONT color="green">062</FONT>        }<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /**<a name="line.64"></a>
+<FONT color="green">065</FONT>         * Constructs a Skewness with an external moment<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @param m3 external moment<a name="line.66"></a>
+<FONT color="green">067</FONT>         */<a name="line.67"></a>
+<FONT color="green">068</FONT>        public Skewness(final ThirdMoment m3) {<a name="line.68"></a>
+<FONT color="green">069</FONT>            incMoment = false;<a name="line.69"></a>
+<FONT color="green">070</FONT>            this.moment = m3;<a name="line.70"></a>
+<FONT color="green">071</FONT>        }<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /**<a name="line.73"></a>
+<FONT color="green">074</FONT>         * Copy constructor, creates a new {@code Skewness} identical<a name="line.74"></a>
+<FONT color="green">075</FONT>         * to the {@code original}<a name="line.75"></a>
+<FONT color="green">076</FONT>         *<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @param original the {@code Skewness} instance to copy<a name="line.77"></a>
+<FONT color="green">078</FONT>         */<a name="line.78"></a>
+<FONT color="green">079</FONT>        public Skewness(Skewness original) {<a name="line.79"></a>
+<FONT color="green">080</FONT>            copy(original, this);<a name="line.80"></a>
+<FONT color="green">081</FONT>        }<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /**<a name="line.83"></a>
+<FONT color="green">084</FONT>         * {@inheritDoc}<a name="line.84"></a>
+<FONT color="green">085</FONT>         */<a name="line.85"></a>
+<FONT color="green">086</FONT>        @Override<a name="line.86"></a>
+<FONT color="green">087</FONT>        public void increment(final double d) {<a name="line.87"></a>
+<FONT color="green">088</FONT>            if (incMoment) {<a name="line.88"></a>
+<FONT color="green">089</FONT>                moment.increment(d);<a name="line.89"></a>
+<FONT color="green">090</FONT>            }<a name="line.90"></a>
+<FONT color="green">091</FONT>        }<a name="line.91"></a>
+<FONT color="green">092</FONT>    <a name="line.92"></a>
+<FONT color="green">093</FONT>        /**<a name="line.93"></a>
+<FONT color="green">094</FONT>         * Returns the value of the statistic based on the values that have been added.<a name="line.94"></a>
+<FONT color="green">095</FONT>         * &lt;p&gt;<a name="line.95"></a>
+<FONT color="green">096</FONT>         * See {@link Skewness} for the definition used in the computation.&lt;/p&gt;<a name="line.96"></a>
+<FONT color="green">097</FONT>         *<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @return the skewness of the available values.<a name="line.98"></a>
+<FONT color="green">099</FONT>         */<a name="line.99"></a>
+<FONT color="green">100</FONT>        @Override<a name="line.100"></a>
+<FONT color="green">101</FONT>        public double getResult() {<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>            if (moment.n &lt; 3) {<a name="line.103"></a>
+<FONT color="green">104</FONT>                return Double.NaN;<a name="line.104"></a>
+<FONT color="green">105</FONT>            }<a name="line.105"></a>
+<FONT color="green">106</FONT>            double variance = moment.m2 / (moment.n - 1);<a name="line.106"></a>
+<FONT color="green">107</FONT>            if (variance &lt; 10E-20) {<a name="line.107"></a>
+<FONT color="green">108</FONT>                return 0.0d;<a name="line.108"></a>
+<FONT color="green">109</FONT>            } else {<a name="line.109"></a>
+<FONT color="green">110</FONT>                double n0 = moment.getN();<a name="line.110"></a>
+<FONT color="green">111</FONT>                return  (n0 * moment.m3) /<a name="line.111"></a>
+<FONT color="green">112</FONT>                ((n0 - 1) * (n0 -2) * Math.sqrt(variance) * variance);<a name="line.112"></a>
+<FONT color="green">113</FONT>            }<a name="line.113"></a>
+<FONT color="green">114</FONT>        }<a name="line.114"></a>
+<FONT color="green">115</FONT>    <a name="line.115"></a>
+<FONT color="green">116</FONT>        /**<a name="line.116"></a>
+<FONT color="green">117</FONT>         * {@inheritDoc}<a name="line.117"></a>
+<FONT color="green">118</FONT>         */<a name="line.118"></a>
+<FONT color="green">119</FONT>        public long getN() {<a name="line.119"></a>
+<FONT color="green">120</FONT>            return moment.getN();<a name="line.120"></a>
+<FONT color="green">121</FONT>        }<a name="line.121"></a>
+<FONT color="green">122</FONT>    <a name="line.122"></a>
+<FONT color="green">123</FONT>        /**<a name="line.123"></a>
+<FONT color="green">124</FONT>         * {@inheritDoc}<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        @Override<a name="line.126"></a>
+<FONT color="green">127</FONT>        public void clear() {<a name="line.127"></a>
+<FONT color="green">128</FONT>            if (incMoment) {<a name="line.128"></a>
+<FONT color="green">129</FONT>                moment.clear();<a name="line.129"></a>
+<FONT color="green">130</FONT>            }<a name="line.130"></a>
+<FONT color="green">131</FONT>        }<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>        /**<a name="line.133"></a>
+<FONT color="green">134</FONT>         * Returns the Skewness of the entries in the specifed portion of the<a name="line.134"></a>
+<FONT color="green">135</FONT>         * input array.<a name="line.135"></a>
+<FONT color="green">136</FONT>         * &lt;p&gt;<a name="line.136"></a>
+<FONT color="green">137</FONT>         * See {@link Skewness} for the definition used in the computation.&lt;/p&gt;<a name="line.137"></a>
+<FONT color="green">138</FONT>         * &lt;p&gt;<a name="line.138"></a>
+<FONT color="green">139</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.139"></a>
+<FONT color="green">140</FONT>         *<a name="line.140"></a>
+<FONT color="green">141</FONT>         * @param values the input array<a name="line.141"></a>
+<FONT color="green">142</FONT>         * @param begin the index of the first array element to include<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @param length the number of elements to include<a name="line.143"></a>
+<FONT color="green">144</FONT>         * @return the skewness of the values or Double.NaN if length is less than<a name="line.144"></a>
+<FONT color="green">145</FONT>         * 3<a name="line.145"></a>
+<FONT color="green">146</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.146"></a>
+<FONT color="green">147</FONT>         *  parameters are not valid<a name="line.147"></a>
+<FONT color="green">148</FONT>         */<a name="line.148"></a>
+<FONT color="green">149</FONT>        @Override<a name="line.149"></a>
+<FONT color="green">150</FONT>        public double evaluate(final double[] values,final int begin,<a name="line.150"></a>
+<FONT color="green">151</FONT>                final int length) {<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>            // Initialize the skewness<a name="line.153"></a>
+<FONT color="green">154</FONT>            double skew = Double.NaN;<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>            if (test(values, begin, length) &amp;&amp; length &gt; 2 ){<a name="line.156"></a>
+<FONT color="green">157</FONT>                Mean mean = new Mean();<a name="line.157"></a>
+<FONT color="green">158</FONT>                // Get the mean and the standard deviation<a name="line.158"></a>
+<FONT color="green">159</FONT>                double m = mean.evaluate(values, begin, length);<a name="line.159"></a>
+<FONT color="green">160</FONT>    <a name="line.160"></a>
+<FONT color="green">161</FONT>                // Calc the std, this is implemented here instead<a name="line.161"></a>
+<FONT color="green">162</FONT>                // of using the standardDeviation method eliminate<a name="line.162"></a>
+<FONT color="green">163</FONT>                // a duplicate pass to get the mean<a name="line.163"></a>
+<FONT color="green">164</FONT>                double accum = 0.0;<a name="line.164"></a>
+<FONT color="green">165</FONT>                double accum2 = 0.0;<a name="line.165"></a>
+<FONT color="green">166</FONT>                for (int i = begin; i &lt; begin + length; i++) {<a name="line.166"></a>
+<FONT color="green">167</FONT>                    final double d = values[i] - m;<a name="line.167"></a>
+<FONT color="green">168</FONT>                    accum  += d * d;<a name="line.168"></a>
+<FONT color="green">169</FONT>                    accum2 += d;<a name="line.169"></a>
+<FONT color="green">170</FONT>                }<a name="line.170"></a>
+<FONT color="green">171</FONT>                final double variance = (accum - (accum2 * accum2 / length)) / (length - 1);<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>                double accum3 = 0.0;<a name="line.173"></a>
+<FONT color="green">174</FONT>                for (int i = begin; i &lt; begin + length; i++) {<a name="line.174"></a>
+<FONT color="green">175</FONT>                    final double d = values[i] - m;<a name="line.175"></a>
+<FONT color="green">176</FONT>                    accum3 += d * d * d;<a name="line.176"></a>
+<FONT color="green">177</FONT>                }<a name="line.177"></a>
+<FONT color="green">178</FONT>                accum3 /= variance * Math.sqrt(variance);<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>                // Get N<a name="line.180"></a>
+<FONT color="green">181</FONT>                double n0 = length;<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>                // Calculate skewness<a name="line.183"></a>
+<FONT color="green">184</FONT>                skew = (n0 / ((n0 - 1) * (n0 - 2))) * accum3;<a name="line.184"></a>
+<FONT color="green">185</FONT>            }<a name="line.185"></a>
+<FONT color="green">186</FONT>            return skew;<a name="line.186"></a>
+<FONT color="green">187</FONT>        }<a name="line.187"></a>
+<FONT color="green">188</FONT>    <a name="line.188"></a>
+<FONT color="green">189</FONT>        /**<a name="line.189"></a>
+<FONT color="green">190</FONT>         * {@inheritDoc}<a name="line.190"></a>
+<FONT color="green">191</FONT>         */<a name="line.191"></a>
+<FONT color="green">192</FONT>        @Override<a name="line.192"></a>
+<FONT color="green">193</FONT>        public Skewness copy() {<a name="line.193"></a>
+<FONT color="green">194</FONT>            Skewness result = new Skewness();<a name="line.194"></a>
+<FONT color="green">195</FONT>            copy(this, result);<a name="line.195"></a>
+<FONT color="green">196</FONT>            return result;<a name="line.196"></a>
+<FONT color="green">197</FONT>        }<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>        /**<a name="line.199"></a>
+<FONT color="green">200</FONT>         * Copies source to dest.<a name="line.200"></a>
+<FONT color="green">201</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.201"></a>
+<FONT color="green">202</FONT>         *<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @param source Skewness to copy<a name="line.203"></a>
+<FONT color="green">204</FONT>         * @param dest Skewness to copy to<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.205"></a>
+<FONT color="green">206</FONT>         */<a name="line.206"></a>
+<FONT color="green">207</FONT>        public static void copy(Skewness source, Skewness dest) {<a name="line.207"></a>
+<FONT color="green">208</FONT>            dest.moment = new ThirdMoment(source.moment.copy());<a name="line.208"></a>
+<FONT color="green">209</FONT>            dest.incMoment = source.incMoment;<a name="line.209"></a>
+<FONT color="green">210</FONT>        }<a name="line.210"></a>
+<FONT color="green">211</FONT>    }<a name="line.211"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/StandardDeviation.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,335 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.moment;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Computes the sample standard deviation.  The standard deviation<a name="line.24"></a>
+<FONT color="green">025</FONT>     * is the positive square root of the variance.  This implementation wraps a<a name="line.25"></a>
+<FONT color="green">026</FONT>     * {@link Variance} instance.  The &lt;code&gt;isBiasCorrected&lt;/code&gt; property of the<a name="line.26"></a>
+<FONT color="green">027</FONT>     * wrapped Variance instance is exposed, so that this class can be used to<a name="line.27"></a>
+<FONT color="green">028</FONT>     * compute both the "sample standard deviation" (the square root of the<a name="line.28"></a>
+<FONT color="green">029</FONT>     * bias-corrected "sample variance") or the "population standard deviation"<a name="line.29"></a>
+<FONT color="green">030</FONT>     * (the square root of the non-bias-corrected "population variance"). See<a name="line.30"></a>
+<FONT color="green">031</FONT>     * {@link Variance} for more information.<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;strong&gt;Note that this implementation is not synchronized.&lt;/strong&gt; If<a name="line.33"></a>
+<FONT color="green">034</FONT>     * multiple threads access an instance of this class concurrently, and at least<a name="line.34"></a>
+<FONT color="green">035</FONT>     * one of the threads invokes the &lt;code&gt;increment()&lt;/code&gt; or<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;code&gt;clear()&lt;/code&gt; method, it must be synchronized externally.&lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.38"></a>
+<FONT color="green">039</FONT>     */<a name="line.39"></a>
+<FONT color="green">040</FONT>    public class StandardDeviation extends AbstractStorelessUnivariateStatistic<a name="line.40"></a>
+<FONT color="green">041</FONT>        implements Serializable {<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** Serializable version identifier */<a name="line.43"></a>
+<FONT color="green">044</FONT>        private static final long serialVersionUID = 5728716329662425188L;<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** Wrapped Variance instance */<a name="line.46"></a>
+<FONT color="green">047</FONT>        private Variance variance = null;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /**<a name="line.49"></a>
+<FONT color="green">050</FONT>         * Constructs a StandardDeviation.  Sets the underlying {@link Variance}<a name="line.50"></a>
+<FONT color="green">051</FONT>         * instance's &lt;code&gt;isBiasCorrected&lt;/code&gt; property to true.<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        public StandardDeviation() {<a name="line.53"></a>
+<FONT color="green">054</FONT>            variance = new Variance();<a name="line.54"></a>
+<FONT color="green">055</FONT>        }<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /**<a name="line.57"></a>
+<FONT color="green">058</FONT>         * Constructs a StandardDeviation from an external second moment.<a name="line.58"></a>
+<FONT color="green">059</FONT>         *<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @param m2 the external moment<a name="line.60"></a>
+<FONT color="green">061</FONT>         */<a name="line.61"></a>
+<FONT color="green">062</FONT>        public StandardDeviation(final SecondMoment m2) {<a name="line.62"></a>
+<FONT color="green">063</FONT>            variance = new Variance(m2);<a name="line.63"></a>
+<FONT color="green">064</FONT>        }<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /**<a name="line.66"></a>
+<FONT color="green">067</FONT>         * Copy constructor, creates a new {@code StandardDeviation} identical<a name="line.67"></a>
+<FONT color="green">068</FONT>         * to the {@code original}<a name="line.68"></a>
+<FONT color="green">069</FONT>         *<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @param original the {@code StandardDeviation} instance to copy<a name="line.70"></a>
+<FONT color="green">071</FONT>         */<a name="line.71"></a>
+<FONT color="green">072</FONT>        public StandardDeviation(StandardDeviation original) {<a name="line.72"></a>
+<FONT color="green">073</FONT>            copy(original, this);<a name="line.73"></a>
+<FONT color="green">074</FONT>        }<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        /**<a name="line.76"></a>
+<FONT color="green">077</FONT>         * Contructs a StandardDeviation with the specified value for the<a name="line.77"></a>
+<FONT color="green">078</FONT>         * &lt;code&gt;isBiasCorrected&lt;/code&gt; property.  If this property is set to<a name="line.78"></a>
+<FONT color="green">079</FONT>         * &lt;code&gt;true&lt;/code&gt;, the {@link Variance} used in computing results will<a name="line.79"></a>
+<FONT color="green">080</FONT>         * use the bias-corrected, or "sample" formula.  See {@link Variance} for<a name="line.80"></a>
+<FONT color="green">081</FONT>         * details.<a name="line.81"></a>
+<FONT color="green">082</FONT>         *<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param isBiasCorrected  whether or not the variance computation will use<a name="line.83"></a>
+<FONT color="green">084</FONT>         * the bias-corrected formula<a name="line.84"></a>
+<FONT color="green">085</FONT>         */<a name="line.85"></a>
+<FONT color="green">086</FONT>        public StandardDeviation(boolean isBiasCorrected) {<a name="line.86"></a>
+<FONT color="green">087</FONT>            variance = new Variance(isBiasCorrected);<a name="line.87"></a>
+<FONT color="green">088</FONT>        }<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>        /**<a name="line.90"></a>
+<FONT color="green">091</FONT>         * Contructs a StandardDeviation with the specified value for the<a name="line.91"></a>
+<FONT color="green">092</FONT>         * &lt;code&gt;isBiasCorrected&lt;/code&gt; property and the supplied external moment.<a name="line.92"></a>
+<FONT color="green">093</FONT>         * If &lt;code&gt;isBiasCorrected&lt;/code&gt; is set to &lt;code&gt;true&lt;/code&gt;, the<a name="line.93"></a>
+<FONT color="green">094</FONT>         * {@link Variance} used in computing results will use the bias-corrected,<a name="line.94"></a>
+<FONT color="green">095</FONT>         * or "sample" formula.  See {@link Variance} for details.<a name="line.95"></a>
+<FONT color="green">096</FONT>         *<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @param isBiasCorrected  whether or not the variance computation will use<a name="line.97"></a>
+<FONT color="green">098</FONT>         * the bias-corrected formula<a name="line.98"></a>
+<FONT color="green">099</FONT>          * @param m2 the external moment<a name="line.99"></a>
+<FONT color="green">100</FONT>         */<a name="line.100"></a>
+<FONT color="green">101</FONT>        public StandardDeviation(boolean isBiasCorrected, SecondMoment m2) {<a name="line.101"></a>
+<FONT color="green">102</FONT>            variance = new Variance(isBiasCorrected, m2);<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /**<a name="line.105"></a>
+<FONT color="green">106</FONT>         * {@inheritDoc}<a name="line.106"></a>
+<FONT color="green">107</FONT>         */<a name="line.107"></a>
+<FONT color="green">108</FONT>        @Override<a name="line.108"></a>
+<FONT color="green">109</FONT>        public void increment(final double d) {<a name="line.109"></a>
+<FONT color="green">110</FONT>            variance.increment(d);<a name="line.110"></a>
+<FONT color="green">111</FONT>        }<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>        /**<a name="line.113"></a>
+<FONT color="green">114</FONT>         * {@inheritDoc}<a name="line.114"></a>
+<FONT color="green">115</FONT>         */<a name="line.115"></a>
+<FONT color="green">116</FONT>        public long getN() {<a name="line.116"></a>
+<FONT color="green">117</FONT>            return variance.getN();<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /**<a name="line.120"></a>
+<FONT color="green">121</FONT>         * {@inheritDoc}<a name="line.121"></a>
+<FONT color="green">122</FONT>         */<a name="line.122"></a>
+<FONT color="green">123</FONT>        @Override<a name="line.123"></a>
+<FONT color="green">124</FONT>        public double getResult() {<a name="line.124"></a>
+<FONT color="green">125</FONT>            return Math.sqrt(variance.getResult());<a name="line.125"></a>
+<FONT color="green">126</FONT>        }<a name="line.126"></a>
+<FONT color="green">127</FONT>    <a name="line.127"></a>
+<FONT color="green">128</FONT>        /**<a name="line.128"></a>
+<FONT color="green">129</FONT>         * {@inheritDoc}<a name="line.129"></a>
+<FONT color="green">130</FONT>         */<a name="line.130"></a>
+<FONT color="green">131</FONT>        @Override<a name="line.131"></a>
+<FONT color="green">132</FONT>        public void clear() {<a name="line.132"></a>
+<FONT color="green">133</FONT>            variance.clear();<a name="line.133"></a>
+<FONT color="green">134</FONT>        }<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>        /**<a name="line.136"></a>
+<FONT color="green">137</FONT>         * Returns the Standard Deviation of the entries in the input array, or<a name="line.137"></a>
+<FONT color="green">138</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt; if the array is empty.<a name="line.138"></a>
+<FONT color="green">139</FONT>         * &lt;p&gt;<a name="line.139"></a>
+<FONT color="green">140</FONT>         * Returns 0 for a single-value (i.e. length = 1) sample.&lt;/p&gt;<a name="line.140"></a>
+<FONT color="green">141</FONT>         * &lt;p&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.142"></a>
+<FONT color="green">143</FONT>         * &lt;p&gt;<a name="line.143"></a>
+<FONT color="green">144</FONT>         * Does not change the internal state of the statistic.&lt;/p&gt;<a name="line.144"></a>
+<FONT color="green">145</FONT>         *<a name="line.145"></a>
+<FONT color="green">146</FONT>         * @param values the input array<a name="line.146"></a>
+<FONT color="green">147</FONT>         * @return the standard deviation of the values or Double.NaN if length = 0<a name="line.147"></a>
+<FONT color="green">148</FONT>         * @throws IllegalArgumentException if the array is null<a name="line.148"></a>
+<FONT color="green">149</FONT>         */<a name="line.149"></a>
+<FONT color="green">150</FONT>        @Override<a name="line.150"></a>
+<FONT color="green">151</FONT>        public double evaluate(final double[] values)  {<a name="line.151"></a>
+<FONT color="green">152</FONT>            return Math.sqrt(variance.evaluate(values));<a name="line.152"></a>
+<FONT color="green">153</FONT>        }<a name="line.153"></a>
+<FONT color="green">154</FONT>    <a name="line.154"></a>
+<FONT color="green">155</FONT>        /**<a name="line.155"></a>
+<FONT color="green">156</FONT>         * Returns the Standard Deviation of the entries in the specified portion of<a name="line.156"></a>
+<FONT color="green">157</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.157"></a>
+<FONT color="green">158</FONT>         * is empty.<a name="line.158"></a>
+<FONT color="green">159</FONT>         * &lt;p&gt;<a name="line.159"></a>
+<FONT color="green">160</FONT>         * Returns 0 for a single-value (i.e. length = 1) sample. &lt;/p&gt;<a name="line.160"></a>
+<FONT color="green">161</FONT>         * &lt;p&gt;<a name="line.161"></a>
+<FONT color="green">162</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.162"></a>
+<FONT color="green">163</FONT>         * &lt;p&gt;<a name="line.163"></a>
+<FONT color="green">164</FONT>         * Does not change the internal state of the statistic.&lt;/p&gt;<a name="line.164"></a>
+<FONT color="green">165</FONT>         *<a name="line.165"></a>
+<FONT color="green">166</FONT>         * @param values the input array<a name="line.166"></a>
+<FONT color="green">167</FONT>         * @param begin index of the first array element to include<a name="line.167"></a>
+<FONT color="green">168</FONT>         * @param length the number of elements to include<a name="line.168"></a>
+<FONT color="green">169</FONT>         * @return the standard deviation of the values or Double.NaN if length = 0<a name="line.169"></a>
+<FONT color="green">170</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.170"></a>
+<FONT color="green">171</FONT>         *  parameters are not valid<a name="line.171"></a>
+<FONT color="green">172</FONT>         */<a name="line.172"></a>
+<FONT color="green">173</FONT>        @Override<a name="line.173"></a>
+<FONT color="green">174</FONT>        public double evaluate(final double[] values, final int begin, final int length)  {<a name="line.174"></a>
+<FONT color="green">175</FONT>           return Math.sqrt(variance.evaluate(values, begin, length));<a name="line.175"></a>
+<FONT color="green">176</FONT>        }<a name="line.176"></a>
+<FONT color="green">177</FONT>    <a name="line.177"></a>
+<FONT color="green">178</FONT>        /**<a name="line.178"></a>
+<FONT color="green">179</FONT>         * Returns the Standard Deviation of the entries in the specified portion of<a name="line.179"></a>
+<FONT color="green">180</FONT>         * the input array, using the precomputed mean value.  Returns<a name="line.180"></a>
+<FONT color="green">181</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray is empty.<a name="line.181"></a>
+<FONT color="green">182</FONT>         * &lt;p&gt;<a name="line.182"></a>
+<FONT color="green">183</FONT>         * Returns 0 for a single-value (i.e. length = 1) sample.&lt;/p&gt;<a name="line.183"></a>
+<FONT color="green">184</FONT>         * &lt;p&gt;<a name="line.184"></a>
+<FONT color="green">185</FONT>         * The formula used assumes that the supplied mean value is the arithmetic<a name="line.185"></a>
+<FONT color="green">186</FONT>         * mean of the sample data, not a known population parameter.  This method<a name="line.186"></a>
+<FONT color="green">187</FONT>         * is supplied only to save computation when the mean has already been<a name="line.187"></a>
+<FONT color="green">188</FONT>         * computed.&lt;/p&gt;<a name="line.188"></a>
+<FONT color="green">189</FONT>         * &lt;p&gt;<a name="line.189"></a>
+<FONT color="green">190</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.190"></a>
+<FONT color="green">191</FONT>         * &lt;p&gt;<a name="line.191"></a>
+<FONT color="green">192</FONT>         * Does not change the internal state of the statistic.&lt;/p&gt;<a name="line.192"></a>
+<FONT color="green">193</FONT>         *<a name="line.193"></a>
+<FONT color="green">194</FONT>         * @param values the input array<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @param mean the precomputed mean value<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @param begin index of the first array element to include<a name="line.196"></a>
+<FONT color="green">197</FONT>         * @param length the number of elements to include<a name="line.197"></a>
+<FONT color="green">198</FONT>         * @return the standard deviation of the values or Double.NaN if length = 0<a name="line.198"></a>
+<FONT color="green">199</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.199"></a>
+<FONT color="green">200</FONT>         *  parameters are not valid<a name="line.200"></a>
+<FONT color="green">201</FONT>         */<a name="line.201"></a>
+<FONT color="green">202</FONT>        public double evaluate(final double[] values, final double mean,<a name="line.202"></a>
+<FONT color="green">203</FONT>                final int begin, final int length)  {<a name="line.203"></a>
+<FONT color="green">204</FONT>            return Math.sqrt(variance.evaluate(values, mean, begin, length));<a name="line.204"></a>
+<FONT color="green">205</FONT>        }<a name="line.205"></a>
+<FONT color="green">206</FONT>    <a name="line.206"></a>
+<FONT color="green">207</FONT>        /**<a name="line.207"></a>
+<FONT color="green">208</FONT>         * Returns the Standard Deviation of the entries in the input array, using<a name="line.208"></a>
+<FONT color="green">209</FONT>         * the precomputed mean value.  Returns<a name="line.209"></a>
+<FONT color="green">210</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray is empty.<a name="line.210"></a>
+<FONT color="green">211</FONT>         * &lt;p&gt;<a name="line.211"></a>
+<FONT color="green">212</FONT>         * Returns 0 for a single-value (i.e. length = 1) sample.&lt;/p&gt;<a name="line.212"></a>
+<FONT color="green">213</FONT>         * &lt;p&gt;<a name="line.213"></a>
+<FONT color="green">214</FONT>         * The formula used assumes that the supplied mean value is the arithmetic<a name="line.214"></a>
+<FONT color="green">215</FONT>         * mean of the sample data, not a known population parameter.  This method<a name="line.215"></a>
+<FONT color="green">216</FONT>         * is supplied only to save computation when the mean has already been<a name="line.216"></a>
+<FONT color="green">217</FONT>         * computed.&lt;/p&gt;<a name="line.217"></a>
+<FONT color="green">218</FONT>         * &lt;p&gt;<a name="line.218"></a>
+<FONT color="green">219</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.219"></a>
+<FONT color="green">220</FONT>         * &lt;p&gt;<a name="line.220"></a>
+<FONT color="green">221</FONT>         * Does not change the internal state of the statistic.&lt;/p&gt;<a name="line.221"></a>
+<FONT color="green">222</FONT>         *<a name="line.222"></a>
+<FONT color="green">223</FONT>         * @param values the input array<a name="line.223"></a>
+<FONT color="green">224</FONT>         * @param mean the precomputed mean value<a name="line.224"></a>
+<FONT color="green">225</FONT>         * @return the standard deviation of the values or Double.NaN if length = 0<a name="line.225"></a>
+<FONT color="green">226</FONT>         * @throws IllegalArgumentException if the array is null<a name="line.226"></a>
+<FONT color="green">227</FONT>         */<a name="line.227"></a>
+<FONT color="green">228</FONT>        public double evaluate(final double[] values, final double mean)  {<a name="line.228"></a>
+<FONT color="green">229</FONT>            return Math.sqrt(variance.evaluate(values, mean));<a name="line.229"></a>
+<FONT color="green">230</FONT>        }<a name="line.230"></a>
+<FONT color="green">231</FONT>    <a name="line.231"></a>
+<FONT color="green">232</FONT>        /**<a name="line.232"></a>
+<FONT color="green">233</FONT>         * @return Returns the isBiasCorrected.<a name="line.233"></a>
+<FONT color="green">234</FONT>         */<a name="line.234"></a>
+<FONT color="green">235</FONT>        public boolean isBiasCorrected() {<a name="line.235"></a>
+<FONT color="green">236</FONT>            return variance.isBiasCorrected();<a name="line.236"></a>
+<FONT color="green">237</FONT>        }<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>        /**<a name="line.239"></a>
+<FONT color="green">240</FONT>         * @param isBiasCorrected The isBiasCorrected to set.<a name="line.240"></a>
+<FONT color="green">241</FONT>         */<a name="line.241"></a>
+<FONT color="green">242</FONT>        public void setBiasCorrected(boolean isBiasCorrected) {<a name="line.242"></a>
+<FONT color="green">243</FONT>            variance.setBiasCorrected(isBiasCorrected);<a name="line.243"></a>
+<FONT color="green">244</FONT>        }<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>        /**<a name="line.246"></a>
+<FONT color="green">247</FONT>         * {@inheritDoc}<a name="line.247"></a>
+<FONT color="green">248</FONT>         */<a name="line.248"></a>
+<FONT color="green">249</FONT>        @Override<a name="line.249"></a>
+<FONT color="green">250</FONT>        public StandardDeviation copy() {<a name="line.250"></a>
+<FONT color="green">251</FONT>            StandardDeviation result = new StandardDeviation();<a name="line.251"></a>
+<FONT color="green">252</FONT>            copy(this, result);<a name="line.252"></a>
+<FONT color="green">253</FONT>            return result;<a name="line.253"></a>
+<FONT color="green">254</FONT>        }<a name="line.254"></a>
+<FONT color="green">255</FONT>    <a name="line.255"></a>
+<FONT color="green">256</FONT>    <a name="line.256"></a>
+<FONT color="green">257</FONT>        /**<a name="line.257"></a>
+<FONT color="green">258</FONT>         * Copies source to dest.<a name="line.258"></a>
+<FONT color="green">259</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.259"></a>
+<FONT color="green">260</FONT>         *<a name="line.260"></a>
+<FONT color="green">261</FONT>         * @param source StandardDeviation to copy<a name="line.261"></a>
+<FONT color="green">262</FONT>         * @param dest StandardDeviation to copy to<a name="line.262"></a>
+<FONT color="green">263</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.263"></a>
+<FONT color="green">264</FONT>         */<a name="line.264"></a>
+<FONT color="green">265</FONT>        public static void copy(StandardDeviation source, StandardDeviation dest) {<a name="line.265"></a>
+<FONT color="green">266</FONT>            dest.variance = source.variance.copy();<a name="line.266"></a>
+<FONT color="green">267</FONT>        }<a name="line.267"></a>
+<FONT color="green">268</FONT>    <a name="line.268"></a>
+<FONT color="green">269</FONT>    }<a name="line.269"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/ThirdMoment.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,205 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.moment;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Computes a statistic related to the Third Central Moment.  Specifically,<a name="line.23"></a>
+<FONT color="green">024</FONT>     * what is computed is the sum of cubed deviations from the sample mean.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * The following recursive updating formula is used:&lt;/p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Let &lt;ul&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;li&gt; dev = (current obs - previous mean) &lt;/li&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;li&gt; m2 = previous value of {@link SecondMoment} &lt;/li&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;li&gt; n = number of observations (including current obs) &lt;/li&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;/ul&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * Then&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * new value = old value - 3 * (dev/n) * m2 + (n-1) * (n -2) * (dev^3/n^2)&lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * Returns &lt;code&gt;Double.NaN&lt;/code&gt; if no data values have been added and<a name="line.37"></a>
+<FONT color="green">038</FONT>     * returns &lt;code&gt;0&lt;/code&gt; if there is just one value in the data set.&lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;p&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;strong&gt;Note that this implementation is not synchronized.&lt;/strong&gt; If<a name="line.40"></a>
+<FONT color="green">041</FONT>     * multiple threads access an instance of this class concurrently, and at least<a name="line.41"></a>
+<FONT color="green">042</FONT>     * one of the threads invokes the &lt;code&gt;increment()&lt;/code&gt; or<a name="line.42"></a>
+<FONT color="green">043</FONT>     * &lt;code&gt;clear()&lt;/code&gt; method, it must be synchronized externally.&lt;/p&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     *<a name="line.44"></a>
+<FONT color="green">045</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.45"></a>
+<FONT color="green">046</FONT>     */<a name="line.46"></a>
+<FONT color="green">047</FONT>    public class ThirdMoment extends SecondMoment implements Serializable {<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** Serializable version identifier */<a name="line.49"></a>
+<FONT color="green">050</FONT>        private static final long serialVersionUID = -7818711964045118679L;<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /** third moment of values that have been added */<a name="line.52"></a>
+<FONT color="green">053</FONT>        protected double m3;<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>         /**<a name="line.55"></a>
+<FONT color="green">056</FONT>         * Square of deviation of most recently added value from previous first<a name="line.56"></a>
+<FONT color="green">057</FONT>         * moment, normalized by previous sample size.  Retained to prevent<a name="line.57"></a>
+<FONT color="green">058</FONT>         * repeated computation in higher order moments.  nDevSq = nDev * nDev.<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        protected double nDevSq;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /**<a name="line.62"></a>
+<FONT color="green">063</FONT>         * Create a FourthMoment instance<a name="line.63"></a>
+<FONT color="green">064</FONT>         */<a name="line.64"></a>
+<FONT color="green">065</FONT>        public ThirdMoment() {<a name="line.65"></a>
+<FONT color="green">066</FONT>            super();<a name="line.66"></a>
+<FONT color="green">067</FONT>            m3 = Double.NaN;<a name="line.67"></a>
+<FONT color="green">068</FONT>            nDevSq = Double.NaN;<a name="line.68"></a>
+<FONT color="green">069</FONT>        }<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /**<a name="line.71"></a>
+<FONT color="green">072</FONT>         * Copy constructor, creates a new {@code ThirdMoment} identical<a name="line.72"></a>
+<FONT color="green">073</FONT>         * to the {@code original}<a name="line.73"></a>
+<FONT color="green">074</FONT>         *<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @param original the {@code ThirdMoment} instance to copy<a name="line.75"></a>
+<FONT color="green">076</FONT>         */<a name="line.76"></a>
+<FONT color="green">077</FONT>        public ThirdMoment(ThirdMoment original) {<a name="line.77"></a>
+<FONT color="green">078</FONT>            copy(original, this);<a name="line.78"></a>
+<FONT color="green">079</FONT>        }<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /**<a name="line.81"></a>
+<FONT color="green">082</FONT>         * {@inheritDoc}<a name="line.82"></a>
+<FONT color="green">083</FONT>         */<a name="line.83"></a>
+<FONT color="green">084</FONT>        @Override<a name="line.84"></a>
+<FONT color="green">085</FONT>        public void increment(final double d) {<a name="line.85"></a>
+<FONT color="green">086</FONT>            if (n &lt; 1) {<a name="line.86"></a>
+<FONT color="green">087</FONT>                m3 = m2 = m1 = 0.0;<a name="line.87"></a>
+<FONT color="green">088</FONT>            }<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>            double prevM2 = m2;<a name="line.90"></a>
+<FONT color="green">091</FONT>            super.increment(d);<a name="line.91"></a>
+<FONT color="green">092</FONT>            nDevSq = nDev * nDev;<a name="line.92"></a>
+<FONT color="green">093</FONT>            double n0 = n;<a name="line.93"></a>
+<FONT color="green">094</FONT>            m3 = m3 - 3.0 * nDev * prevM2 + (n0 - 1) * (n0 - 2) * nDevSq * dev;<a name="line.94"></a>
+<FONT color="green">095</FONT>        }<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /**<a name="line.97"></a>
+<FONT color="green">098</FONT>         * {@inheritDoc}<a name="line.98"></a>
+<FONT color="green">099</FONT>         */<a name="line.99"></a>
+<FONT color="green">100</FONT>        @Override<a name="line.100"></a>
+<FONT color="green">101</FONT>        public double getResult() {<a name="line.101"></a>
+<FONT color="green">102</FONT>            return m3;<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /**<a name="line.105"></a>
+<FONT color="green">106</FONT>         * {@inheritDoc}<a name="line.106"></a>
+<FONT color="green">107</FONT>         */<a name="line.107"></a>
+<FONT color="green">108</FONT>        @Override<a name="line.108"></a>
+<FONT color="green">109</FONT>        public void clear() {<a name="line.109"></a>
+<FONT color="green">110</FONT>            super.clear();<a name="line.110"></a>
+<FONT color="green">111</FONT>            m3 = Double.NaN;<a name="line.111"></a>
+<FONT color="green">112</FONT>            nDevSq = Double.NaN;<a name="line.112"></a>
+<FONT color="green">113</FONT>        }<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>        /**<a name="line.115"></a>
+<FONT color="green">116</FONT>         * {@inheritDoc}<a name="line.116"></a>
+<FONT color="green">117</FONT>         */<a name="line.117"></a>
+<FONT color="green">118</FONT>        @Override<a name="line.118"></a>
+<FONT color="green">119</FONT>        public ThirdMoment copy() {<a name="line.119"></a>
+<FONT color="green">120</FONT>            ThirdMoment result = new ThirdMoment();<a name="line.120"></a>
+<FONT color="green">121</FONT>            copy(this, result);<a name="line.121"></a>
+<FONT color="green">122</FONT>            return result;<a name="line.122"></a>
+<FONT color="green">123</FONT>        }<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>        /**<a name="line.125"></a>
+<FONT color="green">126</FONT>         * Copies source to dest.<a name="line.126"></a>
+<FONT color="green">127</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.127"></a>
+<FONT color="green">128</FONT>         *<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @param source ThirdMoment to copy<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @param dest ThirdMoment to copy to<a name="line.130"></a>
+<FONT color="green">131</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.131"></a>
+<FONT color="green">132</FONT>         */<a name="line.132"></a>
+<FONT color="green">133</FONT>        public static void copy(ThirdMoment source, ThirdMoment dest) {<a name="line.133"></a>
+<FONT color="green">134</FONT>            SecondMoment.copy(source, dest);<a name="line.134"></a>
+<FONT color="green">135</FONT>            dest.m3 = source.m3;<a name="line.135"></a>
+<FONT color="green">136</FONT>            dest.nDevSq = source.nDevSq;<a name="line.136"></a>
+<FONT color="green">137</FONT>        }<a name="line.137"></a>
+<FONT color="green">138</FONT>    <a name="line.138"></a>
+<FONT color="green">139</FONT>    }<a name="line.139"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/Variance.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,672 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.moment;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.stat.descriptive.WeightedEvaluation;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Computes the variance of the available values.  By default, the unbiased<a name="line.26"></a>
+<FONT color="green">027</FONT>     * "sample variance" definitional formula is used:<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * variance = sum((x_i - mean)^2) / (n - 1) &lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * where mean is the {@link Mean} and &lt;code&gt;n&lt;/code&gt; is the number<a name="line.31"></a>
+<FONT color="green">032</FONT>     * of sample observations.&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * The definitional formula does not have good numerical properties, so<a name="line.34"></a>
+<FONT color="green">035</FONT>     * this implementation does not compute the statistic using the definitional<a name="line.35"></a>
+<FONT color="green">036</FONT>     * formula. &lt;ul&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;li&gt; The &lt;code&gt;getResult&lt;/code&gt; method computes the variance using<a name="line.37"></a>
+<FONT color="green">038</FONT>     * updating formulas based on West's algorithm, as described in<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;a href="http://doi.acm.org/10.1145/359146.359152"&gt; Chan, T. F. and<a name="line.39"></a>
+<FONT color="green">040</FONT>     * J. G. Lewis 1979, &lt;i&gt;Communications of the ACM&lt;/i&gt;,<a name="line.40"></a>
+<FONT color="green">041</FONT>     * vol. 22 no. 9, pp. 526-531.&lt;/a&gt;&lt;/li&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;li&gt; The &lt;code&gt;evaluate&lt;/code&gt; methods leverage the fact that they have the<a name="line.42"></a>
+<FONT color="green">043</FONT>     * full array of values in memory to execute a two-pass algorithm.<a name="line.43"></a>
+<FONT color="green">044</FONT>     * Specifically, these methods use the "corrected two-pass algorithm" from<a name="line.44"></a>
+<FONT color="green">045</FONT>     * Chan, Golub, Levesque, &lt;i&gt;Algorithms for Computing the Sample Variance&lt;/i&gt;,<a name="line.45"></a>
+<FONT color="green">046</FONT>     * American Statistician, vol. 37, no. 3 (1983) pp. 242-247.&lt;/li&gt;&lt;/ul&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     * Note that adding values using &lt;code&gt;increment&lt;/code&gt; or<a name="line.47"></a>
+<FONT color="green">048</FONT>     * &lt;code&gt;incrementAll&lt;/code&gt; and then executing &lt;code&gt;getResult&lt;/code&gt; will<a name="line.48"></a>
+<FONT color="green">049</FONT>     * sometimes give a different, less accurate, result than executing<a name="line.49"></a>
+<FONT color="green">050</FONT>     * &lt;code&gt;evaluate&lt;/code&gt; with the full array of values. The former approach<a name="line.50"></a>
+<FONT color="green">051</FONT>     * should only be used when the full array of values is not available.&lt;/p&gt;<a name="line.51"></a>
+<FONT color="green">052</FONT>     * &lt;p&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>     * The "population variance"  ( sum((x_i - mean)^2) / n ) can also<a name="line.53"></a>
+<FONT color="green">054</FONT>     * be computed using this statistic.  The &lt;code&gt;isBiasCorrected&lt;/code&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>     * property determines whether the "population" or "sample" value is<a name="line.55"></a>
+<FONT color="green">056</FONT>     * returned by the &lt;code&gt;evaluate&lt;/code&gt; and &lt;code&gt;getResult&lt;/code&gt; methods.<a name="line.56"></a>
+<FONT color="green">057</FONT>     * To compute population variances, set this property to &lt;code&gt;false.&lt;/code&gt;<a name="line.57"></a>
+<FONT color="green">058</FONT>     * &lt;/p&gt;<a name="line.58"></a>
+<FONT color="green">059</FONT>     * &lt;p&gt;<a name="line.59"></a>
+<FONT color="green">060</FONT>     * &lt;strong&gt;Note that this implementation is not synchronized.&lt;/strong&gt; If<a name="line.60"></a>
+<FONT color="green">061</FONT>     * multiple threads access an instance of this class concurrently, and at least<a name="line.61"></a>
+<FONT color="green">062</FONT>     * one of the threads invokes the &lt;code&gt;increment()&lt;/code&gt; or<a name="line.62"></a>
+<FONT color="green">063</FONT>     * &lt;code&gt;clear()&lt;/code&gt; method, it must be synchronized externally.&lt;/p&gt;<a name="line.63"></a>
+<FONT color="green">064</FONT>     *<a name="line.64"></a>
+<FONT color="green">065</FONT>     * @version $Revision: 908626 $ $Date: 2010-02-10 13:44:42 -0500 (Wed, 10 Feb 2010) $<a name="line.65"></a>
+<FONT color="green">066</FONT>     */<a name="line.66"></a>
+<FONT color="green">067</FONT>    public class Variance extends AbstractStorelessUnivariateStatistic implements Serializable, WeightedEvaluation {<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /** Serializable version identifier */<a name="line.69"></a>
+<FONT color="green">070</FONT>        private static final long serialVersionUID = -9111962718267217978L;<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /** SecondMoment is used in incremental calculation of Variance*/<a name="line.72"></a>
+<FONT color="green">073</FONT>        protected SecondMoment moment = null;<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /**<a name="line.75"></a>
+<FONT color="green">076</FONT>         * Boolean test to determine if this Variance should also increment<a name="line.76"></a>
+<FONT color="green">077</FONT>         * the second moment, this evaluates to false when this Variance is<a name="line.77"></a>
+<FONT color="green">078</FONT>         * constructed with an external SecondMoment as a parameter.<a name="line.78"></a>
+<FONT color="green">079</FONT>         */<a name="line.79"></a>
+<FONT color="green">080</FONT>        protected boolean incMoment = true;<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>        /**<a name="line.82"></a>
+<FONT color="green">083</FONT>         * Determines whether or not bias correction is applied when computing the<a name="line.83"></a>
+<FONT color="green">084</FONT>         * value of the statisic.  True means that bias is corrected.  See<a name="line.84"></a>
+<FONT color="green">085</FONT>         * {@link Variance} for details on the formula.<a name="line.85"></a>
+<FONT color="green">086</FONT>         */<a name="line.86"></a>
+<FONT color="green">087</FONT>        private boolean isBiasCorrected = true;<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /**<a name="line.89"></a>
+<FONT color="green">090</FONT>         * Constructs a Variance with default (true) &lt;code&gt;isBiasCorrected&lt;/code&gt;<a name="line.90"></a>
+<FONT color="green">091</FONT>         * property.<a name="line.91"></a>
+<FONT color="green">092</FONT>         */<a name="line.92"></a>
+<FONT color="green">093</FONT>        public Variance() {<a name="line.93"></a>
+<FONT color="green">094</FONT>            moment = new SecondMoment();<a name="line.94"></a>
+<FONT color="green">095</FONT>        }<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /**<a name="line.97"></a>
+<FONT color="green">098</FONT>         * Constructs a Variance based on an external second moment.<a name="line.98"></a>
+<FONT color="green">099</FONT>         *<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @param m2 the SecondMoment (Third or Fourth moments work<a name="line.100"></a>
+<FONT color="green">101</FONT>         * here as well.)<a name="line.101"></a>
+<FONT color="green">102</FONT>         */<a name="line.102"></a>
+<FONT color="green">103</FONT>        public Variance(final SecondMoment m2) {<a name="line.103"></a>
+<FONT color="green">104</FONT>            incMoment = false;<a name="line.104"></a>
+<FONT color="green">105</FONT>            this.moment = m2;<a name="line.105"></a>
+<FONT color="green">106</FONT>        }<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>        /**<a name="line.108"></a>
+<FONT color="green">109</FONT>         * Constructs a Variance with the specified &lt;code&gt;isBiasCorrected&lt;/code&gt;<a name="line.109"></a>
+<FONT color="green">110</FONT>         * property<a name="line.110"></a>
+<FONT color="green">111</FONT>         *<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @param isBiasCorrected  setting for bias correction - true means<a name="line.112"></a>
+<FONT color="green">113</FONT>         * bias will be corrected and is equivalent to using the argumentless<a name="line.113"></a>
+<FONT color="green">114</FONT>         * constructor<a name="line.114"></a>
+<FONT color="green">115</FONT>         */<a name="line.115"></a>
+<FONT color="green">116</FONT>        public Variance(boolean isBiasCorrected) {<a name="line.116"></a>
+<FONT color="green">117</FONT>            moment = new SecondMoment();<a name="line.117"></a>
+<FONT color="green">118</FONT>            this.isBiasCorrected = isBiasCorrected;<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /**<a name="line.121"></a>
+<FONT color="green">122</FONT>         * Constructs a Variance with the specified &lt;code&gt;isBiasCorrected&lt;/code&gt;<a name="line.122"></a>
+<FONT color="green">123</FONT>         * property and the supplied external second moment.<a name="line.123"></a>
+<FONT color="green">124</FONT>         *<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @param isBiasCorrected  setting for bias correction - true means<a name="line.125"></a>
+<FONT color="green">126</FONT>         * bias will be corrected<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @param m2 the SecondMoment (Third or Fourth moments work<a name="line.127"></a>
+<FONT color="green">128</FONT>         * here as well.)<a name="line.128"></a>
+<FONT color="green">129</FONT>         */<a name="line.129"></a>
+<FONT color="green">130</FONT>        public Variance(boolean isBiasCorrected, SecondMoment m2) {<a name="line.130"></a>
+<FONT color="green">131</FONT>            incMoment = false;<a name="line.131"></a>
+<FONT color="green">132</FONT>            this.moment = m2;<a name="line.132"></a>
+<FONT color="green">133</FONT>            this.isBiasCorrected = isBiasCorrected;<a name="line.133"></a>
+<FONT color="green">134</FONT>        }<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>        /**<a name="line.136"></a>
+<FONT color="green">137</FONT>         * Copy constructor, creates a new {@code Variance} identical<a name="line.137"></a>
+<FONT color="green">138</FONT>         * to the {@code original}<a name="line.138"></a>
+<FONT color="green">139</FONT>         *<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @param original the {@code Variance} instance to copy<a name="line.140"></a>
+<FONT color="green">141</FONT>         */<a name="line.141"></a>
+<FONT color="green">142</FONT>        public Variance(Variance original) {<a name="line.142"></a>
+<FONT color="green">143</FONT>            copy(original, this);<a name="line.143"></a>
+<FONT color="green">144</FONT>        }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>        /**<a name="line.146"></a>
+<FONT color="green">147</FONT>         * {@inheritDoc}<a name="line.147"></a>
+<FONT color="green">148</FONT>         * &lt;p&gt;If all values are available, it is more accurate to use<a name="line.148"></a>
+<FONT color="green">149</FONT>         * {@link #evaluate(double[])} rather than adding values one at a time<a name="line.149"></a>
+<FONT color="green">150</FONT>         * using this method and then executing {@link #getResult}, since<a name="line.150"></a>
+<FONT color="green">151</FONT>         * &lt;code&gt;evaluate&lt;/code&gt; leverages the fact that is has the full<a name="line.151"></a>
+<FONT color="green">152</FONT>         * list of values together to execute a two-pass algorithm.<a name="line.152"></a>
+<FONT color="green">153</FONT>         * See {@link Variance}.&lt;/p&gt;<a name="line.153"></a>
+<FONT color="green">154</FONT>         */<a name="line.154"></a>
+<FONT color="green">155</FONT>        @Override<a name="line.155"></a>
+<FONT color="green">156</FONT>        public void increment(final double d) {<a name="line.156"></a>
+<FONT color="green">157</FONT>            if (incMoment) {<a name="line.157"></a>
+<FONT color="green">158</FONT>                moment.increment(d);<a name="line.158"></a>
+<FONT color="green">159</FONT>            }<a name="line.159"></a>
+<FONT color="green">160</FONT>        }<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>        /**<a name="line.162"></a>
+<FONT color="green">163</FONT>         * {@inheritDoc}<a name="line.163"></a>
+<FONT color="green">164</FONT>         */<a name="line.164"></a>
+<FONT color="green">165</FONT>        @Override<a name="line.165"></a>
+<FONT color="green">166</FONT>        public double getResult() {<a name="line.166"></a>
+<FONT color="green">167</FONT>                if (moment.n == 0) {<a name="line.167"></a>
+<FONT color="green">168</FONT>                    return Double.NaN;<a name="line.168"></a>
+<FONT color="green">169</FONT>                } else if (moment.n == 1) {<a name="line.169"></a>
+<FONT color="green">170</FONT>                    return 0d;<a name="line.170"></a>
+<FONT color="green">171</FONT>                } else {<a name="line.171"></a>
+<FONT color="green">172</FONT>                    if (isBiasCorrected) {<a name="line.172"></a>
+<FONT color="green">173</FONT>                        return moment.m2 / (moment.n - 1d);<a name="line.173"></a>
+<FONT color="green">174</FONT>                    } else {<a name="line.174"></a>
+<FONT color="green">175</FONT>                        return moment.m2 / (moment.n);<a name="line.175"></a>
+<FONT color="green">176</FONT>                    }<a name="line.176"></a>
+<FONT color="green">177</FONT>                }<a name="line.177"></a>
+<FONT color="green">178</FONT>        }<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>        /**<a name="line.180"></a>
+<FONT color="green">181</FONT>         * {@inheritDoc}<a name="line.181"></a>
+<FONT color="green">182</FONT>         */<a name="line.182"></a>
+<FONT color="green">183</FONT>        public long getN() {<a name="line.183"></a>
+<FONT color="green">184</FONT>            return moment.getN();<a name="line.184"></a>
+<FONT color="green">185</FONT>        }<a name="line.185"></a>
+<FONT color="green">186</FONT>    <a name="line.186"></a>
+<FONT color="green">187</FONT>        /**<a name="line.187"></a>
+<FONT color="green">188</FONT>         * {@inheritDoc}<a name="line.188"></a>
+<FONT color="green">189</FONT>         */<a name="line.189"></a>
+<FONT color="green">190</FONT>        @Override<a name="line.190"></a>
+<FONT color="green">191</FONT>        public void clear() {<a name="line.191"></a>
+<FONT color="green">192</FONT>            if (incMoment) {<a name="line.192"></a>
+<FONT color="green">193</FONT>                moment.clear();<a name="line.193"></a>
+<FONT color="green">194</FONT>            }<a name="line.194"></a>
+<FONT color="green">195</FONT>        }<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>        /**<a name="line.197"></a>
+<FONT color="green">198</FONT>         * Returns the variance of the entries in the input array, or<a name="line.198"></a>
+<FONT color="green">199</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt; if the array is empty.<a name="line.199"></a>
+<FONT color="green">200</FONT>         * &lt;p&gt;<a name="line.200"></a>
+<FONT color="green">201</FONT>         * See {@link Variance} for details on the computing algorithm.&lt;/p&gt;<a name="line.201"></a>
+<FONT color="green">202</FONT>         * &lt;p&gt;<a name="line.202"></a>
+<FONT color="green">203</FONT>         * Returns 0 for a single-value (i.e. length = 1) sample.&lt;/p&gt;<a name="line.203"></a>
+<FONT color="green">204</FONT>         * &lt;p&gt;<a name="line.204"></a>
+<FONT color="green">205</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.205"></a>
+<FONT color="green">206</FONT>         * &lt;p&gt;<a name="line.206"></a>
+<FONT color="green">207</FONT>         * Does not change the internal state of the statistic.&lt;/p&gt;<a name="line.207"></a>
+<FONT color="green">208</FONT>         *<a name="line.208"></a>
+<FONT color="green">209</FONT>         * @param values the input array<a name="line.209"></a>
+<FONT color="green">210</FONT>         * @return the variance of the values or Double.NaN if length = 0<a name="line.210"></a>
+<FONT color="green">211</FONT>         * @throws IllegalArgumentException if the array is null<a name="line.211"></a>
+<FONT color="green">212</FONT>         */<a name="line.212"></a>
+<FONT color="green">213</FONT>        @Override<a name="line.213"></a>
+<FONT color="green">214</FONT>        public double evaluate(final double[] values) {<a name="line.214"></a>
+<FONT color="green">215</FONT>            if (values == null) {<a name="line.215"></a>
+<FONT color="green">216</FONT>                throw MathRuntimeException.createIllegalArgumentException("input values array is null");<a name="line.216"></a>
+<FONT color="green">217</FONT>            }<a name="line.217"></a>
+<FONT color="green">218</FONT>            return evaluate(values, 0, values.length);<a name="line.218"></a>
+<FONT color="green">219</FONT>        }<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>        /**<a name="line.221"></a>
+<FONT color="green">222</FONT>         * Returns the variance of the entries in the specified portion of<a name="line.222"></a>
+<FONT color="green">223</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.223"></a>
+<FONT color="green">224</FONT>         * is empty.<a name="line.224"></a>
+<FONT color="green">225</FONT>         * &lt;p&gt;<a name="line.225"></a>
+<FONT color="green">226</FONT>         * See {@link Variance} for details on the computing algorithm.&lt;/p&gt;<a name="line.226"></a>
+<FONT color="green">227</FONT>         * &lt;p&gt;<a name="line.227"></a>
+<FONT color="green">228</FONT>         * Returns 0 for a single-value (i.e. length = 1) sample.&lt;/p&gt;<a name="line.228"></a>
+<FONT color="green">229</FONT>         * &lt;p&gt;<a name="line.229"></a>
+<FONT color="green">230</FONT>         * Does not change the internal state of the statistic.&lt;/p&gt;<a name="line.230"></a>
+<FONT color="green">231</FONT>         * &lt;p&gt;<a name="line.231"></a>
+<FONT color="green">232</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.232"></a>
+<FONT color="green">233</FONT>         *<a name="line.233"></a>
+<FONT color="green">234</FONT>         * @param values the input array<a name="line.234"></a>
+<FONT color="green">235</FONT>         * @param begin index of the first array element to include<a name="line.235"></a>
+<FONT color="green">236</FONT>         * @param length the number of elements to include<a name="line.236"></a>
+<FONT color="green">237</FONT>         * @return the variance of the values or Double.NaN if length = 0<a name="line.237"></a>
+<FONT color="green">238</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.238"></a>
+<FONT color="green">239</FONT>         *  parameters are not valid<a name="line.239"></a>
+<FONT color="green">240</FONT>         */<a name="line.240"></a>
+<FONT color="green">241</FONT>        @Override<a name="line.241"></a>
+<FONT color="green">242</FONT>        public double evaluate(final double[] values, final int begin, final int length) {<a name="line.242"></a>
+<FONT color="green">243</FONT>    <a name="line.243"></a>
+<FONT color="green">244</FONT>            double var = Double.NaN;<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>            if (test(values, begin, length)) {<a name="line.246"></a>
+<FONT color="green">247</FONT>                clear();<a name="line.247"></a>
+<FONT color="green">248</FONT>                if (length == 1) {<a name="line.248"></a>
+<FONT color="green">249</FONT>                    var = 0.0;<a name="line.249"></a>
+<FONT color="green">250</FONT>                } else if (length &gt; 1) {<a name="line.250"></a>
+<FONT color="green">251</FONT>                    Mean mean = new Mean();<a name="line.251"></a>
+<FONT color="green">252</FONT>                    double m = mean.evaluate(values, begin, length);<a name="line.252"></a>
+<FONT color="green">253</FONT>                    var = evaluate(values, m, begin, length);<a name="line.253"></a>
+<FONT color="green">254</FONT>                }<a name="line.254"></a>
+<FONT color="green">255</FONT>            }<a name="line.255"></a>
+<FONT color="green">256</FONT>            return var;<a name="line.256"></a>
+<FONT color="green">257</FONT>        }<a name="line.257"></a>
+<FONT color="green">258</FONT>    <a name="line.258"></a>
+<FONT color="green">259</FONT>        /**<a name="line.259"></a>
+<FONT color="green">260</FONT>         * &lt;p&gt;Returns the weighted variance of the entries in the specified portion of<a name="line.260"></a>
+<FONT color="green">261</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.261"></a>
+<FONT color="green">262</FONT>         * is empty.&lt;/p&gt;<a name="line.262"></a>
+<FONT color="green">263</FONT>         * &lt;p&gt;<a name="line.263"></a>
+<FONT color="green">264</FONT>         * Uses the formula &lt;pre&gt;<a name="line.264"></a>
+<FONT color="green">265</FONT>         *   &amp;Sigma;(weights[i]*(values[i] - weightedMean)&lt;sup&gt;2&lt;/sup&gt;)/(&amp;Sigma;(weights[i]) - 1)<a name="line.265"></a>
+<FONT color="green">266</FONT>         * &lt;/pre&gt;<a name="line.266"></a>
+<FONT color="green">267</FONT>         * where weightedMean is the weighted mean&lt;/p&gt;<a name="line.267"></a>
+<FONT color="green">268</FONT>         * &lt;p&gt;<a name="line.268"></a>
+<FONT color="green">269</FONT>         * This formula will not return the same result as the unweighted variance when all<a name="line.269"></a>
+<FONT color="green">270</FONT>         * weights are equal, unless all weights are equal to 1. The formula assumes that<a name="line.270"></a>
+<FONT color="green">271</FONT>         * weights are to be treated as "expansion values," as will be the case if for example<a name="line.271"></a>
+<FONT color="green">272</FONT>         * the weights represent frequency counts. To normalize weights so that the denominator<a name="line.272"></a>
+<FONT color="green">273</FONT>         * in the variance computation equals the length of the input vector minus one, use &lt;pre&gt;<a name="line.273"></a>
+<FONT color="green">274</FONT>         *   &lt;code&gt;evaluate(values, MathUtils.normalizeArray(weights, values.length)); &lt;/code&gt;<a name="line.274"></a>
+<FONT color="green">275</FONT>         * &lt;/pre&gt;<a name="line.275"></a>
+<FONT color="green">276</FONT>         * &lt;p&gt;<a name="line.276"></a>
+<FONT color="green">277</FONT>         * Returns 0 for a single-value (i.e. length = 1) sample.&lt;/p&gt;<a name="line.277"></a>
+<FONT color="green">278</FONT>         * &lt;p&gt;<a name="line.278"></a>
+<FONT color="green">279</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if any of the following are true:<a name="line.279"></a>
+<FONT color="green">280</FONT>         * &lt;ul&gt;&lt;li&gt;the values array is null&lt;/li&gt;<a name="line.280"></a>
+<FONT color="green">281</FONT>         *     &lt;li&gt;the weights array is null&lt;/li&gt;<a name="line.281"></a>
+<FONT color="green">282</FONT>         *     &lt;li&gt;the weights array does not have the same length as the values array&lt;/li&gt;<a name="line.282"></a>
+<FONT color="green">283</FONT>         *     &lt;li&gt;the weights array contains one or more infinite values&lt;/li&gt;<a name="line.283"></a>
+<FONT color="green">284</FONT>         *     &lt;li&gt;the weights array contains one or more NaN values&lt;/li&gt;<a name="line.284"></a>
+<FONT color="green">285</FONT>         *     &lt;li&gt;the weights array contains negative values&lt;/li&gt;<a name="line.285"></a>
+<FONT color="green">286</FONT>         *     &lt;li&gt;the start and length arguments do not determine a valid array&lt;/li&gt;<a name="line.286"></a>
+<FONT color="green">287</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.287"></a>
+<FONT color="green">288</FONT>         * &lt;p&gt;<a name="line.288"></a>
+<FONT color="green">289</FONT>         * Does not change the internal state of the statistic.&lt;/p&gt;<a name="line.289"></a>
+<FONT color="green">290</FONT>         * &lt;p&gt;<a name="line.290"></a>
+<FONT color="green">291</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if either array is null.&lt;/p&gt;<a name="line.291"></a>
+<FONT color="green">292</FONT>         *<a name="line.292"></a>
+<FONT color="green">293</FONT>         * @param values the input array<a name="line.293"></a>
+<FONT color="green">294</FONT>         * @param weights the weights array<a name="line.294"></a>
+<FONT color="green">295</FONT>         * @param begin index of the first array element to include<a name="line.295"></a>
+<FONT color="green">296</FONT>         * @param length the number of elements to include<a name="line.296"></a>
+<FONT color="green">297</FONT>         * @return the weighted variance of the values or Double.NaN if length = 0<a name="line.297"></a>
+<FONT color="green">298</FONT>         * @throws IllegalArgumentException if the parameters are not valid<a name="line.298"></a>
+<FONT color="green">299</FONT>         * @since 2.1<a name="line.299"></a>
+<FONT color="green">300</FONT>         */<a name="line.300"></a>
+<FONT color="green">301</FONT>        public double evaluate(final double[] values, final double[] weights,<a name="line.301"></a>
+<FONT color="green">302</FONT>                               final int begin, final int length) {<a name="line.302"></a>
+<FONT color="green">303</FONT>    <a name="line.303"></a>
+<FONT color="green">304</FONT>            double var = Double.NaN;<a name="line.304"></a>
+<FONT color="green">305</FONT>    <a name="line.305"></a>
+<FONT color="green">306</FONT>            if (test(values, weights,begin, length)) {<a name="line.306"></a>
+<FONT color="green">307</FONT>                clear();<a name="line.307"></a>
+<FONT color="green">308</FONT>                if (length == 1) {<a name="line.308"></a>
+<FONT color="green">309</FONT>                    var = 0.0;<a name="line.309"></a>
+<FONT color="green">310</FONT>                } else if (length &gt; 1) {<a name="line.310"></a>
+<FONT color="green">311</FONT>                    Mean mean = new Mean();<a name="line.311"></a>
+<FONT color="green">312</FONT>                    double m = mean.evaluate(values, weights, begin, length);<a name="line.312"></a>
+<FONT color="green">313</FONT>                    var = evaluate(values, weights, m, begin, length);<a name="line.313"></a>
+<FONT color="green">314</FONT>                }<a name="line.314"></a>
+<FONT color="green">315</FONT>            }<a name="line.315"></a>
+<FONT color="green">316</FONT>            return var;<a name="line.316"></a>
+<FONT color="green">317</FONT>        }<a name="line.317"></a>
+<FONT color="green">318</FONT>    <a name="line.318"></a>
+<FONT color="green">319</FONT>        /**<a name="line.319"></a>
+<FONT color="green">320</FONT>         * &lt;p&gt;<a name="line.320"></a>
+<FONT color="green">321</FONT>         * Returns the weighted variance of the entries in the the input array.&lt;/p&gt;<a name="line.321"></a>
+<FONT color="green">322</FONT>         * &lt;p&gt;<a name="line.322"></a>
+<FONT color="green">323</FONT>         * Uses the formula &lt;pre&gt;<a name="line.323"></a>
+<FONT color="green">324</FONT>         *   &amp;Sigma;(weights[i]*(values[i] - weightedMean)&lt;sup&gt;2&lt;/sup&gt;)/(&amp;Sigma;(weights[i]) - 1)<a name="line.324"></a>
+<FONT color="green">325</FONT>         * &lt;/pre&gt;<a name="line.325"></a>
+<FONT color="green">326</FONT>         * where weightedMean is the weighted mean&lt;/p&gt;<a name="line.326"></a>
+<FONT color="green">327</FONT>         * &lt;p&gt;<a name="line.327"></a>
+<FONT color="green">328</FONT>         * This formula will not return the same result as the unweighted variance when all<a name="line.328"></a>
+<FONT color="green">329</FONT>         * weights are equal, unless all weights are equal to 1. The formula assumes that<a name="line.329"></a>
+<FONT color="green">330</FONT>         * weights are to be treated as "expansion values," as will be the case if for example<a name="line.330"></a>
+<FONT color="green">331</FONT>         * the weights represent frequency counts. To normalize weights so that the denominator<a name="line.331"></a>
+<FONT color="green">332</FONT>         * in the variance computation equals the length of the input vector minus one, use &lt;pre&gt;<a name="line.332"></a>
+<FONT color="green">333</FONT>         *   &lt;code&gt;evaluate(values, MathUtils.normalizeArray(weights, values.length)); &lt;/code&gt;<a name="line.333"></a>
+<FONT color="green">334</FONT>         * &lt;/pre&gt;<a name="line.334"></a>
+<FONT color="green">335</FONT>         * &lt;p&gt;<a name="line.335"></a>
+<FONT color="green">336</FONT>         * Returns 0 for a single-value (i.e. length = 1) sample.&lt;/p&gt;<a name="line.336"></a>
+<FONT color="green">337</FONT>         * &lt;p&gt;<a name="line.337"></a>
+<FONT color="green">338</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if any of the following are true:<a name="line.338"></a>
+<FONT color="green">339</FONT>         * &lt;ul&gt;&lt;li&gt;the values array is null&lt;/li&gt;<a name="line.339"></a>
+<FONT color="green">340</FONT>         *     &lt;li&gt;the weights array is null&lt;/li&gt;<a name="line.340"></a>
+<FONT color="green">341</FONT>         *     &lt;li&gt;the weights array does not have the same length as the values array&lt;/li&gt;<a name="line.341"></a>
+<FONT color="green">342</FONT>         *     &lt;li&gt;the weights array contains one or more infinite values&lt;/li&gt;<a name="line.342"></a>
+<FONT color="green">343</FONT>         *     &lt;li&gt;the weights array contains one or more NaN values&lt;/li&gt;<a name="line.343"></a>
+<FONT color="green">344</FONT>         *     &lt;li&gt;the weights array contains negative values&lt;/li&gt;<a name="line.344"></a>
+<FONT color="green">345</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.345"></a>
+<FONT color="green">346</FONT>         * &lt;p&gt;<a name="line.346"></a>
+<FONT color="green">347</FONT>         * Does not change the internal state of the statistic.&lt;/p&gt;<a name="line.347"></a>
+<FONT color="green">348</FONT>         * &lt;p&gt;<a name="line.348"></a>
+<FONT color="green">349</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if either array is null.&lt;/p&gt;<a name="line.349"></a>
+<FONT color="green">350</FONT>         *<a name="line.350"></a>
+<FONT color="green">351</FONT>         * @param values the input array<a name="line.351"></a>
+<FONT color="green">352</FONT>         * @param weights the weights array<a name="line.352"></a>
+<FONT color="green">353</FONT>         * @return the weighted variance of the values<a name="line.353"></a>
+<FONT color="green">354</FONT>         * @throws IllegalArgumentException if the parameters are not valid<a name="line.354"></a>
+<FONT color="green">355</FONT>         * @since 2.1<a name="line.355"></a>
+<FONT color="green">356</FONT>         */<a name="line.356"></a>
+<FONT color="green">357</FONT>        public double evaluate(final double[] values, final double[] weights) {<a name="line.357"></a>
+<FONT color="green">358</FONT>            return evaluate(values, weights, 0, values.length);<a name="line.358"></a>
+<FONT color="green">359</FONT>        }<a name="line.359"></a>
+<FONT color="green">360</FONT>    <a name="line.360"></a>
+<FONT color="green">361</FONT>        /**<a name="line.361"></a>
+<FONT color="green">362</FONT>         * Returns the variance of the entries in the specified portion of<a name="line.362"></a>
+<FONT color="green">363</FONT>         * the input array, using the precomputed mean value.  Returns<a name="line.363"></a>
+<FONT color="green">364</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray is empty.<a name="line.364"></a>
+<FONT color="green">365</FONT>         * &lt;p&gt;<a name="line.365"></a>
+<FONT color="green">366</FONT>         * See {@link Variance} for details on the computing algorithm.&lt;/p&gt;<a name="line.366"></a>
+<FONT color="green">367</FONT>         * &lt;p&gt;<a name="line.367"></a>
+<FONT color="green">368</FONT>         * The formula used assumes that the supplied mean value is the arithmetic<a name="line.368"></a>
+<FONT color="green">369</FONT>         * mean of the sample data, not a known population parameter.  This method<a name="line.369"></a>
+<FONT color="green">370</FONT>         * is supplied only to save computation when the mean has already been<a name="line.370"></a>
+<FONT color="green">371</FONT>         * computed.&lt;/p&gt;<a name="line.371"></a>
+<FONT color="green">372</FONT>         * &lt;p&gt;<a name="line.372"></a>
+<FONT color="green">373</FONT>         * Returns 0 for a single-value (i.e. length = 1) sample.&lt;/p&gt;<a name="line.373"></a>
+<FONT color="green">374</FONT>         * &lt;p&gt;<a name="line.374"></a>
+<FONT color="green">375</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.375"></a>
+<FONT color="green">376</FONT>         * &lt;p&gt;<a name="line.376"></a>
+<FONT color="green">377</FONT>         * Does not change the internal state of the statistic.&lt;/p&gt;<a name="line.377"></a>
+<FONT color="green">378</FONT>         *<a name="line.378"></a>
+<FONT color="green">379</FONT>         * @param values the input array<a name="line.379"></a>
+<FONT color="green">380</FONT>         * @param mean the precomputed mean value<a name="line.380"></a>
+<FONT color="green">381</FONT>         * @param begin index of the first array element to include<a name="line.381"></a>
+<FONT color="green">382</FONT>         * @param length the number of elements to include<a name="line.382"></a>
+<FONT color="green">383</FONT>         * @return the variance of the values or Double.NaN if length = 0<a name="line.383"></a>
+<FONT color="green">384</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.384"></a>
+<FONT color="green">385</FONT>         *  parameters are not valid<a name="line.385"></a>
+<FONT color="green">386</FONT>         */<a name="line.386"></a>
+<FONT color="green">387</FONT>        public double evaluate(final double[] values, final double mean,<a name="line.387"></a>
+<FONT color="green">388</FONT>                final int begin, final int length) {<a name="line.388"></a>
+<FONT color="green">389</FONT>    <a name="line.389"></a>
+<FONT color="green">390</FONT>            double var = Double.NaN;<a name="line.390"></a>
+<FONT color="green">391</FONT>    <a name="line.391"></a>
+<FONT color="green">392</FONT>            if (test(values, begin, length)) {<a name="line.392"></a>
+<FONT color="green">393</FONT>                if (length == 1) {<a name="line.393"></a>
+<FONT color="green">394</FONT>                    var = 0.0;<a name="line.394"></a>
+<FONT color="green">395</FONT>                } else if (length &gt; 1) {<a name="line.395"></a>
+<FONT color="green">396</FONT>                    double accum = 0.0;<a name="line.396"></a>
+<FONT color="green">397</FONT>                    double dev = 0.0;<a name="line.397"></a>
+<FONT color="green">398</FONT>                    double accum2 = 0.0;<a name="line.398"></a>
+<FONT color="green">399</FONT>                    for (int i = begin; i &lt; begin + length; i++) {<a name="line.399"></a>
+<FONT color="green">400</FONT>                        dev = values[i] - mean;<a name="line.400"></a>
+<FONT color="green">401</FONT>                        accum += dev * dev;<a name="line.401"></a>
+<FONT color="green">402</FONT>                        accum2 += dev;<a name="line.402"></a>
+<FONT color="green">403</FONT>                    }<a name="line.403"></a>
+<FONT color="green">404</FONT>                    double len = length;<a name="line.404"></a>
+<FONT color="green">405</FONT>                    if (isBiasCorrected) {<a name="line.405"></a>
+<FONT color="green">406</FONT>                        var = (accum - (accum2 * accum2 / len)) / (len - 1.0);<a name="line.406"></a>
+<FONT color="green">407</FONT>                    } else {<a name="line.407"></a>
+<FONT color="green">408</FONT>                        var = (accum - (accum2 * accum2 / len)) / len;<a name="line.408"></a>
+<FONT color="green">409</FONT>                    }<a name="line.409"></a>
+<FONT color="green">410</FONT>                }<a name="line.410"></a>
+<FONT color="green">411</FONT>            }<a name="line.411"></a>
+<FONT color="green">412</FONT>            return var;<a name="line.412"></a>
+<FONT color="green">413</FONT>        }<a name="line.413"></a>
+<FONT color="green">414</FONT>    <a name="line.414"></a>
+<FONT color="green">415</FONT>        /**<a name="line.415"></a>
+<FONT color="green">416</FONT>         * Returns the variance of the entries in the input array, using the<a name="line.416"></a>
+<FONT color="green">417</FONT>         * precomputed mean value.  Returns &lt;code&gt;Double.NaN&lt;/code&gt; if the array<a name="line.417"></a>
+<FONT color="green">418</FONT>         * is empty.<a name="line.418"></a>
+<FONT color="green">419</FONT>         * &lt;p&gt;<a name="line.419"></a>
+<FONT color="green">420</FONT>         * See {@link Variance} for details on the computing algorithm.&lt;/p&gt;<a name="line.420"></a>
+<FONT color="green">421</FONT>         * &lt;p&gt;<a name="line.421"></a>
+<FONT color="green">422</FONT>         * If &lt;code&gt;isBiasCorrected&lt;/code&gt; is &lt;code&gt;true&lt;/code&gt; the formula used<a name="line.422"></a>
+<FONT color="green">423</FONT>         * assumes that the supplied mean value is the arithmetic mean of the<a name="line.423"></a>
+<FONT color="green">424</FONT>         * sample data, not a known population parameter.  If the mean is a known<a name="line.424"></a>
+<FONT color="green">425</FONT>         * population parameter, or if the "population" version of the variance is<a name="line.425"></a>
+<FONT color="green">426</FONT>         * desired, set &lt;code&gt;isBiasCorrected&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt; before<a name="line.426"></a>
+<FONT color="green">427</FONT>         * invoking this method.&lt;/p&gt;<a name="line.427"></a>
+<FONT color="green">428</FONT>         * &lt;p&gt;<a name="line.428"></a>
+<FONT color="green">429</FONT>         * Returns 0 for a single-value (i.e. length = 1) sample.&lt;/p&gt;<a name="line.429"></a>
+<FONT color="green">430</FONT>         * &lt;p&gt;<a name="line.430"></a>
+<FONT color="green">431</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.431"></a>
+<FONT color="green">432</FONT>         * &lt;p&gt;<a name="line.432"></a>
+<FONT color="green">433</FONT>         * Does not change the internal state of the statistic.&lt;/p&gt;<a name="line.433"></a>
+<FONT color="green">434</FONT>         *<a name="line.434"></a>
+<FONT color="green">435</FONT>         * @param values the input array<a name="line.435"></a>
+<FONT color="green">436</FONT>         * @param mean the precomputed mean value<a name="line.436"></a>
+<FONT color="green">437</FONT>         * @return the variance of the values or Double.NaN if the array is empty<a name="line.437"></a>
+<FONT color="green">438</FONT>         * @throws IllegalArgumentException if the array is null<a name="line.438"></a>
+<FONT color="green">439</FONT>         */<a name="line.439"></a>
+<FONT color="green">440</FONT>        public double evaluate(final double[] values, final double mean) {<a name="line.440"></a>
+<FONT color="green">441</FONT>            return evaluate(values, mean, 0, values.length);<a name="line.441"></a>
+<FONT color="green">442</FONT>        }<a name="line.442"></a>
+<FONT color="green">443</FONT>    <a name="line.443"></a>
+<FONT color="green">444</FONT>        /**<a name="line.444"></a>
+<FONT color="green">445</FONT>         * Returns the weighted variance of the entries in the specified portion of<a name="line.445"></a>
+<FONT color="green">446</FONT>         * the input array, using the precomputed weighted mean value.  Returns<a name="line.446"></a>
+<FONT color="green">447</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray is empty.<a name="line.447"></a>
+<FONT color="green">448</FONT>         * &lt;p&gt;<a name="line.448"></a>
+<FONT color="green">449</FONT>         * Uses the formula &lt;pre&gt;<a name="line.449"></a>
+<FONT color="green">450</FONT>         *   &amp;Sigma;(weights[i]*(values[i] - mean)&lt;sup&gt;2&lt;/sup&gt;)/(&amp;Sigma;(weights[i]) - 1)<a name="line.450"></a>
+<FONT color="green">451</FONT>         * &lt;/pre&gt;&lt;/p&gt;<a name="line.451"></a>
+<FONT color="green">452</FONT>         * &lt;p&gt;<a name="line.452"></a>
+<FONT color="green">453</FONT>         * The formula used assumes that the supplied mean value is the weighted arithmetic<a name="line.453"></a>
+<FONT color="green">454</FONT>         * mean of the sample data, not a known population parameter. This method<a name="line.454"></a>
+<FONT color="green">455</FONT>         * is supplied only to save computation when the mean has already been<a name="line.455"></a>
+<FONT color="green">456</FONT>         * computed.&lt;/p&gt;<a name="line.456"></a>
+<FONT color="green">457</FONT>         * &lt;p&gt;<a name="line.457"></a>
+<FONT color="green">458</FONT>         * This formula will not return the same result as the unweighted variance when all<a name="line.458"></a>
+<FONT color="green">459</FONT>         * weights are equal, unless all weights are equal to 1. The formula assumes that<a name="line.459"></a>
+<FONT color="green">460</FONT>         * weights are to be treated as "expansion values," as will be the case if for example<a name="line.460"></a>
+<FONT color="green">461</FONT>         * the weights represent frequency counts. To normalize weights so that the denominator<a name="line.461"></a>
+<FONT color="green">462</FONT>         * in the variance computation equals the length of the input vector minus one, use &lt;pre&gt;<a name="line.462"></a>
+<FONT color="green">463</FONT>         *   &lt;code&gt;evaluate(values, MathUtils.normalizeArray(weights, values.length), mean); &lt;/code&gt;<a name="line.463"></a>
+<FONT color="green">464</FONT>         * &lt;/pre&gt;<a name="line.464"></a>
+<FONT color="green">465</FONT>         * &lt;p&gt;<a name="line.465"></a>
+<FONT color="green">466</FONT>         * Returns 0 for a single-value (i.e. length = 1) sample.&lt;/p&gt;<a name="line.466"></a>
+<FONT color="green">467</FONT>         * &lt;p&gt;<a name="line.467"></a>
+<FONT color="green">468</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if any of the following are true:<a name="line.468"></a>
+<FONT color="green">469</FONT>         * &lt;ul&gt;&lt;li&gt;the values array is null&lt;/li&gt;<a name="line.469"></a>
+<FONT color="green">470</FONT>         *     &lt;li&gt;the weights array is null&lt;/li&gt;<a name="line.470"></a>
+<FONT color="green">471</FONT>         *     &lt;li&gt;the weights array does not have the same length as the values array&lt;/li&gt;<a name="line.471"></a>
+<FONT color="green">472</FONT>         *     &lt;li&gt;the weights array contains one or more infinite values&lt;/li&gt;<a name="line.472"></a>
+<FONT color="green">473</FONT>         *     &lt;li&gt;the weights array contains one or more NaN values&lt;/li&gt;<a name="line.473"></a>
+<FONT color="green">474</FONT>         *     &lt;li&gt;the weights array contains negative values&lt;/li&gt;<a name="line.474"></a>
+<FONT color="green">475</FONT>         *     &lt;li&gt;the start and length arguments do not determine a valid array&lt;/li&gt;<a name="line.475"></a>
+<FONT color="green">476</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.476"></a>
+<FONT color="green">477</FONT>         * &lt;p&gt;<a name="line.477"></a>
+<FONT color="green">478</FONT>         * Does not change the internal state of the statistic.&lt;/p&gt;<a name="line.478"></a>
+<FONT color="green">479</FONT>         *<a name="line.479"></a>
+<FONT color="green">480</FONT>         * @param values the input array<a name="line.480"></a>
+<FONT color="green">481</FONT>         * @param weights the weights array<a name="line.481"></a>
+<FONT color="green">482</FONT>         * @param mean the precomputed weighted mean value<a name="line.482"></a>
+<FONT color="green">483</FONT>         * @param begin index of the first array element to include<a name="line.483"></a>
+<FONT color="green">484</FONT>         * @param length the number of elements to include<a name="line.484"></a>
+<FONT color="green">485</FONT>         * @return the variance of the values or Double.NaN if length = 0<a name="line.485"></a>
+<FONT color="green">486</FONT>         * @throws IllegalArgumentException if the parameters are not valid<a name="line.486"></a>
+<FONT color="green">487</FONT>         * @since 2.1<a name="line.487"></a>
+<FONT color="green">488</FONT>         */<a name="line.488"></a>
+<FONT color="green">489</FONT>        public double evaluate(final double[] values, final double[] weights,<a name="line.489"></a>
+<FONT color="green">490</FONT>                               final double mean, final int begin, final int length) {<a name="line.490"></a>
+<FONT color="green">491</FONT>    <a name="line.491"></a>
+<FONT color="green">492</FONT>            double var = Double.NaN;<a name="line.492"></a>
+<FONT color="green">493</FONT>    <a name="line.493"></a>
+<FONT color="green">494</FONT>            if (test(values, weights, begin, length)) {<a name="line.494"></a>
+<FONT color="green">495</FONT>                if (length == 1) {<a name="line.495"></a>
+<FONT color="green">496</FONT>                    var = 0.0;<a name="line.496"></a>
+<FONT color="green">497</FONT>                } else if (length &gt; 1) {<a name="line.497"></a>
+<FONT color="green">498</FONT>                    double accum = 0.0;<a name="line.498"></a>
+<FONT color="green">499</FONT>                    double dev = 0.0;<a name="line.499"></a>
+<FONT color="green">500</FONT>                    double accum2 = 0.0;<a name="line.500"></a>
+<FONT color="green">501</FONT>                    for (int i = begin; i &lt; begin + length; i++) {<a name="line.501"></a>
+<FONT color="green">502</FONT>                        dev = values[i] - mean;<a name="line.502"></a>
+<FONT color="green">503</FONT>                        accum += weights[i] * (dev * dev);<a name="line.503"></a>
+<FONT color="green">504</FONT>                        accum2 += weights[i] * dev;<a name="line.504"></a>
+<FONT color="green">505</FONT>                    }<a name="line.505"></a>
+<FONT color="green">506</FONT>    <a name="line.506"></a>
+<FONT color="green">507</FONT>                    double sumWts = 0;<a name="line.507"></a>
+<FONT color="green">508</FONT>                    for (int i = 0; i &lt; weights.length; i++) {<a name="line.508"></a>
+<FONT color="green">509</FONT>                        sumWts += weights[i];<a name="line.509"></a>
+<FONT color="green">510</FONT>                    }<a name="line.510"></a>
+<FONT color="green">511</FONT>    <a name="line.511"></a>
+<FONT color="green">512</FONT>                    if (isBiasCorrected) {<a name="line.512"></a>
+<FONT color="green">513</FONT>                        var = (accum - (accum2 * accum2 / sumWts)) / (sumWts - 1.0);<a name="line.513"></a>
+<FONT color="green">514</FONT>                    } else {<a name="line.514"></a>
+<FONT color="green">515</FONT>                        var = (accum - (accum2 * accum2 / sumWts)) / sumWts;<a name="line.515"></a>
+<FONT color="green">516</FONT>                    }<a name="line.516"></a>
+<FONT color="green">517</FONT>                }<a name="line.517"></a>
+<FONT color="green">518</FONT>            }<a name="line.518"></a>
+<FONT color="green">519</FONT>            return var;<a name="line.519"></a>
+<FONT color="green">520</FONT>        }<a name="line.520"></a>
+<FONT color="green">521</FONT>    <a name="line.521"></a>
+<FONT color="green">522</FONT>        /**<a name="line.522"></a>
+<FONT color="green">523</FONT>         * &lt;p&gt;Returns the weighted variance of the values in the input array, using<a name="line.523"></a>
+<FONT color="green">524</FONT>         * the precomputed weighted mean value.&lt;/p&gt;<a name="line.524"></a>
+<FONT color="green">525</FONT>         * &lt;p&gt;<a name="line.525"></a>
+<FONT color="green">526</FONT>         * Uses the formula &lt;pre&gt;<a name="line.526"></a>
+<FONT color="green">527</FONT>         *   &amp;Sigma;(weights[i]*(values[i] - mean)&lt;sup&gt;2&lt;/sup&gt;)/(&amp;Sigma;(weights[i]) - 1)<a name="line.527"></a>
+<FONT color="green">528</FONT>         * &lt;/pre&gt;&lt;/p&gt;<a name="line.528"></a>
+<FONT color="green">529</FONT>         * &lt;p&gt;<a name="line.529"></a>
+<FONT color="green">530</FONT>         * The formula used assumes that the supplied mean value is the weighted arithmetic<a name="line.530"></a>
+<FONT color="green">531</FONT>         * mean of the sample data, not a known population parameter. This method<a name="line.531"></a>
+<FONT color="green">532</FONT>         * is supplied only to save computation when the mean has already been<a name="line.532"></a>
+<FONT color="green">533</FONT>         * computed.&lt;/p&gt;<a name="line.533"></a>
+<FONT color="green">534</FONT>         * &lt;p&gt;<a name="line.534"></a>
+<FONT color="green">535</FONT>         * This formula will not return the same result as the unweighted variance when all<a name="line.535"></a>
+<FONT color="green">536</FONT>         * weights are equal, unless all weights are equal to 1. The formula assumes that<a name="line.536"></a>
+<FONT color="green">537</FONT>         * weights are to be treated as "expansion values," as will be the case if for example<a name="line.537"></a>
+<FONT color="green">538</FONT>         * the weights represent frequency counts. To normalize weights so that the denominator<a name="line.538"></a>
+<FONT color="green">539</FONT>         * in the variance computation equals the length of the input vector minus one, use &lt;pre&gt;<a name="line.539"></a>
+<FONT color="green">540</FONT>         *   &lt;code&gt;evaluate(values, MathUtils.normalizeArray(weights, values.length), mean); &lt;/code&gt;<a name="line.540"></a>
+<FONT color="green">541</FONT>         * &lt;/pre&gt;<a name="line.541"></a>
+<FONT color="green">542</FONT>         * &lt;p&gt;<a name="line.542"></a>
+<FONT color="green">543</FONT>         * Returns 0 for a single-value (i.e. length = 1) sample.&lt;/p&gt;<a name="line.543"></a>
+<FONT color="green">544</FONT>         * &lt;p&gt;<a name="line.544"></a>
+<FONT color="green">545</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if any of the following are true:<a name="line.545"></a>
+<FONT color="green">546</FONT>         * &lt;ul&gt;&lt;li&gt;the values array is null&lt;/li&gt;<a name="line.546"></a>
+<FONT color="green">547</FONT>         *     &lt;li&gt;the weights array is null&lt;/li&gt;<a name="line.547"></a>
+<FONT color="green">548</FONT>         *     &lt;li&gt;the weights array does not have the same length as the values array&lt;/li&gt;<a name="line.548"></a>
+<FONT color="green">549</FONT>         *     &lt;li&gt;the weights array contains one or more infinite values&lt;/li&gt;<a name="line.549"></a>
+<FONT color="green">550</FONT>         *     &lt;li&gt;the weights array contains one or more NaN values&lt;/li&gt;<a name="line.550"></a>
+<FONT color="green">551</FONT>         *     &lt;li&gt;the weights array contains negative values&lt;/li&gt;<a name="line.551"></a>
+<FONT color="green">552</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.552"></a>
+<FONT color="green">553</FONT>         * &lt;p&gt;<a name="line.553"></a>
+<FONT color="green">554</FONT>         * Does not change the internal state of the statistic.&lt;/p&gt;<a name="line.554"></a>
+<FONT color="green">555</FONT>         *<a name="line.555"></a>
+<FONT color="green">556</FONT>         * @param values the input array<a name="line.556"></a>
+<FONT color="green">557</FONT>         * @param weights the weights array<a name="line.557"></a>
+<FONT color="green">558</FONT>         * @param mean the precomputed weighted mean value<a name="line.558"></a>
+<FONT color="green">559</FONT>         * @return the variance of the values or Double.NaN if length = 0<a name="line.559"></a>
+<FONT color="green">560</FONT>         * @throws IllegalArgumentException if the parameters are not valid<a name="line.560"></a>
+<FONT color="green">561</FONT>         * @since 2.1<a name="line.561"></a>
+<FONT color="green">562</FONT>         */<a name="line.562"></a>
+<FONT color="green">563</FONT>        public double evaluate(final double[] values, final double[] weights, final double mean) {<a name="line.563"></a>
+<FONT color="green">564</FONT>            return evaluate(values, weights, mean, 0, values.length);<a name="line.564"></a>
+<FONT color="green">565</FONT>        }<a name="line.565"></a>
+<FONT color="green">566</FONT>    <a name="line.566"></a>
+<FONT color="green">567</FONT>        /**<a name="line.567"></a>
+<FONT color="green">568</FONT>         * @return Returns the isBiasCorrected.<a name="line.568"></a>
+<FONT color="green">569</FONT>         */<a name="line.569"></a>
+<FONT color="green">570</FONT>        public boolean isBiasCorrected() {<a name="line.570"></a>
+<FONT color="green">571</FONT>            return isBiasCorrected;<a name="line.571"></a>
+<FONT color="green">572</FONT>        }<a name="line.572"></a>
+<FONT color="green">573</FONT>    <a name="line.573"></a>
+<FONT color="green">574</FONT>        /**<a name="line.574"></a>
+<FONT color="green">575</FONT>         * @param biasCorrected The isBiasCorrected to set.<a name="line.575"></a>
+<FONT color="green">576</FONT>         */<a name="line.576"></a>
+<FONT color="green">577</FONT>        public void setBiasCorrected(boolean biasCorrected) {<a name="line.577"></a>
+<FONT color="green">578</FONT>            this.isBiasCorrected = biasCorrected;<a name="line.578"></a>
+<FONT color="green">579</FONT>        }<a name="line.579"></a>
+<FONT color="green">580</FONT>    <a name="line.580"></a>
+<FONT color="green">581</FONT>        /**<a name="line.581"></a>
+<FONT color="green">582</FONT>         * {@inheritDoc}<a name="line.582"></a>
+<FONT color="green">583</FONT>         */<a name="line.583"></a>
+<FONT color="green">584</FONT>        @Override<a name="line.584"></a>
+<FONT color="green">585</FONT>        public Variance copy() {<a name="line.585"></a>
+<FONT color="green">586</FONT>            Variance result = new Variance();<a name="line.586"></a>
+<FONT color="green">587</FONT>            copy(this, result);<a name="line.587"></a>
+<FONT color="green">588</FONT>            return result;<a name="line.588"></a>
+<FONT color="green">589</FONT>        }<a name="line.589"></a>
+<FONT color="green">590</FONT>    <a name="line.590"></a>
+<FONT color="green">591</FONT>    <a name="line.591"></a>
+<FONT color="green">592</FONT>        /**<a name="line.592"></a>
+<FONT color="green">593</FONT>         * Copies source to dest.<a name="line.593"></a>
+<FONT color="green">594</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.594"></a>
+<FONT color="green">595</FONT>         *<a name="line.595"></a>
+<FONT color="green">596</FONT>         * @param source Variance to copy<a name="line.596"></a>
+<FONT color="green">597</FONT>         * @param dest Variance to copy to<a name="line.597"></a>
+<FONT color="green">598</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.598"></a>
+<FONT color="green">599</FONT>         */<a name="line.599"></a>
+<FONT color="green">600</FONT>        public static void copy(Variance source, Variance dest) {<a name="line.600"></a>
+<FONT color="green">601</FONT>            dest.moment = source.moment.copy();<a name="line.601"></a>
+<FONT color="green">602</FONT>            dest.isBiasCorrected = source.isBiasCorrected;<a name="line.602"></a>
+<FONT color="green">603</FONT>            dest.incMoment = source.incMoment;<a name="line.603"></a>
+<FONT color="green">604</FONT>        }<a name="line.604"></a>
+<FONT color="green">605</FONT>    <a name="line.605"></a>
+<FONT color="green">606</FONT>    }<a name="line.606"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/VectorialCovariance.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,218 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.moment;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.DimensionMismatchException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.linear.MatrixUtils;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.linear.RealMatrix;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Returns the covariance matrix of the available vectors.<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @since 1.2<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @version $Revision: 922714 $ $Date: 2010-03-13 20:35:14 -0500 (Sat, 13 Mar 2010) $<a name="line.29"></a>
+<FONT color="green">030</FONT>     */<a name="line.30"></a>
+<FONT color="green">031</FONT>    public class VectorialCovariance implements Serializable {<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** Serializable version identifier */<a name="line.33"></a>
+<FONT color="green">034</FONT>        private static final long serialVersionUID = 4118372414238930270L;<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Sums for each component. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private final double[] sums;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Sums of products for each component. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private final double[] productsSums;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Indicator for bias correction. */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private final boolean isBiasCorrected;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Number of vectors in the sample. */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private long n;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** Constructs a VectorialCovariance.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @param dimension vectors dimension<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @param isBiasCorrected if true, computed the unbiased sample covariance,<a name="line.50"></a>
+<FONT color="green">051</FONT>         * otherwise computes the biased population covariance<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        public VectorialCovariance(int dimension, boolean isBiasCorrected) {<a name="line.53"></a>
+<FONT color="green">054</FONT>            sums         = new double[dimension];<a name="line.54"></a>
+<FONT color="green">055</FONT>            productsSums = new double[dimension * (dimension + 1) / 2];<a name="line.55"></a>
+<FONT color="green">056</FONT>            n            = 0;<a name="line.56"></a>
+<FONT color="green">057</FONT>            this.isBiasCorrected = isBiasCorrected;<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /**<a name="line.60"></a>
+<FONT color="green">061</FONT>         * Add a new vector to the sample.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param v vector to add<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @exception DimensionMismatchException if the vector does not have the right dimension<a name="line.63"></a>
+<FONT color="green">064</FONT>         */<a name="line.64"></a>
+<FONT color="green">065</FONT>        public void increment(double[] v) throws DimensionMismatchException {<a name="line.65"></a>
+<FONT color="green">066</FONT>            if (v.length != sums.length) {<a name="line.66"></a>
+<FONT color="green">067</FONT>                throw new DimensionMismatchException(v.length, sums.length);<a name="line.67"></a>
+<FONT color="green">068</FONT>            }<a name="line.68"></a>
+<FONT color="green">069</FONT>            int k = 0;<a name="line.69"></a>
+<FONT color="green">070</FONT>            for (int i = 0; i &lt; v.length; ++i) {<a name="line.70"></a>
+<FONT color="green">071</FONT>                sums[i] += v[i];<a name="line.71"></a>
+<FONT color="green">072</FONT>                for (int j = 0; j &lt;= i; ++j) {<a name="line.72"></a>
+<FONT color="green">073</FONT>                    productsSums[k++] += v[i] * v[j];<a name="line.73"></a>
+<FONT color="green">074</FONT>                }<a name="line.74"></a>
+<FONT color="green">075</FONT>            }<a name="line.75"></a>
+<FONT color="green">076</FONT>            n++;<a name="line.76"></a>
+<FONT color="green">077</FONT>        }<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        /**<a name="line.79"></a>
+<FONT color="green">080</FONT>         * Get the covariance matrix.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @return covariance matrix<a name="line.81"></a>
+<FONT color="green">082</FONT>         */<a name="line.82"></a>
+<FONT color="green">083</FONT>        public RealMatrix getResult() {<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>            int dimension = sums.length;<a name="line.85"></a>
+<FONT color="green">086</FONT>            RealMatrix result = MatrixUtils.createRealMatrix(dimension, dimension);<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>            if (n &gt; 1) {<a name="line.88"></a>
+<FONT color="green">089</FONT>                double c = 1.0 / (n * (isBiasCorrected ? (n - 1) : n));<a name="line.89"></a>
+<FONT color="green">090</FONT>                int k = 0;<a name="line.90"></a>
+<FONT color="green">091</FONT>                for (int i = 0; i &lt; dimension; ++i) {<a name="line.91"></a>
+<FONT color="green">092</FONT>                    for (int j = 0; j &lt;= i; ++j) {<a name="line.92"></a>
+<FONT color="green">093</FONT>                        double e = c * (n * productsSums[k++] - sums[i] * sums[j]);<a name="line.93"></a>
+<FONT color="green">094</FONT>                        result.setEntry(i, j, e);<a name="line.94"></a>
+<FONT color="green">095</FONT>                        result.setEntry(j, i, e);<a name="line.95"></a>
+<FONT color="green">096</FONT>                    }<a name="line.96"></a>
+<FONT color="green">097</FONT>                }<a name="line.97"></a>
+<FONT color="green">098</FONT>            }<a name="line.98"></a>
+<FONT color="green">099</FONT>    <a name="line.99"></a>
+<FONT color="green">100</FONT>            return result;<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>        }<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /**<a name="line.104"></a>
+<FONT color="green">105</FONT>         * Get the number of vectors in the sample.<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @return number of vectors in the sample<a name="line.106"></a>
+<FONT color="green">107</FONT>         */<a name="line.107"></a>
+<FONT color="green">108</FONT>        public long getN() {<a name="line.108"></a>
+<FONT color="green">109</FONT>            return n;<a name="line.109"></a>
+<FONT color="green">110</FONT>        }<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>        /**<a name="line.112"></a>
+<FONT color="green">113</FONT>         * Clears the internal state of the Statistic<a name="line.113"></a>
+<FONT color="green">114</FONT>         */<a name="line.114"></a>
+<FONT color="green">115</FONT>        public void clear() {<a name="line.115"></a>
+<FONT color="green">116</FONT>            n = 0;<a name="line.116"></a>
+<FONT color="green">117</FONT>            Arrays.fill(sums, 0.0);<a name="line.117"></a>
+<FONT color="green">118</FONT>            Arrays.fill(productsSums, 0.0);<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /** {@inheritDoc} */<a name="line.121"></a>
+<FONT color="green">122</FONT>        @Override<a name="line.122"></a>
+<FONT color="green">123</FONT>        public int hashCode() {<a name="line.123"></a>
+<FONT color="green">124</FONT>            final int prime = 31;<a name="line.124"></a>
+<FONT color="green">125</FONT>            int result = 1;<a name="line.125"></a>
+<FONT color="green">126</FONT>            result = prime * result + (isBiasCorrected ? 1231 : 1237);<a name="line.126"></a>
+<FONT color="green">127</FONT>            result = prime * result + (int) (n ^ (n &gt;&gt;&gt; 32));<a name="line.127"></a>
+<FONT color="green">128</FONT>            result = prime * result + Arrays.hashCode(productsSums);<a name="line.128"></a>
+<FONT color="green">129</FONT>            result = prime * result + Arrays.hashCode(sums);<a name="line.129"></a>
+<FONT color="green">130</FONT>            return result;<a name="line.130"></a>
+<FONT color="green">131</FONT>        }<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>        /** {@inheritDoc} */<a name="line.133"></a>
+<FONT color="green">134</FONT>        @Override<a name="line.134"></a>
+<FONT color="green">135</FONT>        public boolean equals(Object obj) {<a name="line.135"></a>
+<FONT color="green">136</FONT>            if (this == obj)<a name="line.136"></a>
+<FONT color="green">137</FONT>                return true;<a name="line.137"></a>
+<FONT color="green">138</FONT>            if (!(obj instanceof VectorialCovariance))<a name="line.138"></a>
+<FONT color="green">139</FONT>                return false;<a name="line.139"></a>
+<FONT color="green">140</FONT>            VectorialCovariance other = (VectorialCovariance) obj;<a name="line.140"></a>
+<FONT color="green">141</FONT>            if (isBiasCorrected != other.isBiasCorrected)<a name="line.141"></a>
+<FONT color="green">142</FONT>                return false;<a name="line.142"></a>
+<FONT color="green">143</FONT>            if (n != other.n)<a name="line.143"></a>
+<FONT color="green">144</FONT>                return false;<a name="line.144"></a>
+<FONT color="green">145</FONT>            if (!Arrays.equals(productsSums, other.productsSums))<a name="line.145"></a>
+<FONT color="green">146</FONT>                return false;<a name="line.146"></a>
+<FONT color="green">147</FONT>            if (!Arrays.equals(sums, other.sums))<a name="line.147"></a>
+<FONT color="green">148</FONT>                return false;<a name="line.148"></a>
+<FONT color="green">149</FONT>            return true;<a name="line.149"></a>
+<FONT color="green">150</FONT>        }<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>    }<a name="line.152"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/moment/VectorialMean.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,169 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.moment;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.DimensionMismatchException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Returns the arithmetic mean of the available vectors.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @since 1.2<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 922714 $ $Date: 2010-03-13 20:35:14 -0500 (Sat, 13 Mar 2010) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public class VectorialMean implements Serializable {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /** Serializable version identifier */<a name="line.31"></a>
+<FONT color="green">032</FONT>        private static final long serialVersionUID = 8223009086481006892L;<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /** Means for each component. */<a name="line.34"></a>
+<FONT color="green">035</FONT>        private final Mean[] means;<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /** Constructs a VectorialMean.<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @param dimension vectors dimension<a name="line.38"></a>
+<FONT color="green">039</FONT>         */<a name="line.39"></a>
+<FONT color="green">040</FONT>        public VectorialMean(int dimension) {<a name="line.40"></a>
+<FONT color="green">041</FONT>            means = new Mean[dimension];<a name="line.41"></a>
+<FONT color="green">042</FONT>            for (int i = 0; i &lt; dimension; ++i) {<a name="line.42"></a>
+<FONT color="green">043</FONT>                means[i] = new Mean();<a name="line.43"></a>
+<FONT color="green">044</FONT>            }<a name="line.44"></a>
+<FONT color="green">045</FONT>        }<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Add a new vector to the sample.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @param v vector to add<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @exception DimensionMismatchException if the vector does not have the right dimension<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        public void increment(double[] v) throws DimensionMismatchException {<a name="line.52"></a>
+<FONT color="green">053</FONT>            if (v.length != means.length) {<a name="line.53"></a>
+<FONT color="green">054</FONT>                throw new DimensionMismatchException(v.length, means.length);<a name="line.54"></a>
+<FONT color="green">055</FONT>            }<a name="line.55"></a>
+<FONT color="green">056</FONT>            for (int i = 0; i &lt; v.length; ++i) {<a name="line.56"></a>
+<FONT color="green">057</FONT>                means[i].increment(v[i]);<a name="line.57"></a>
+<FONT color="green">058</FONT>            }<a name="line.58"></a>
+<FONT color="green">059</FONT>        }<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Get the mean vector.<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @return mean vector<a name="line.63"></a>
+<FONT color="green">064</FONT>         */<a name="line.64"></a>
+<FONT color="green">065</FONT>        public double[] getResult() {<a name="line.65"></a>
+<FONT color="green">066</FONT>            double[] result = new double[means.length];<a name="line.66"></a>
+<FONT color="green">067</FONT>            for (int i = 0; i &lt; result.length; ++i) {<a name="line.67"></a>
+<FONT color="green">068</FONT>                result[i] = means[i].getResult();<a name="line.68"></a>
+<FONT color="green">069</FONT>            }<a name="line.69"></a>
+<FONT color="green">070</FONT>            return result;<a name="line.70"></a>
+<FONT color="green">071</FONT>        }<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /**<a name="line.73"></a>
+<FONT color="green">074</FONT>         * Get the number of vectors in the sample.<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @return number of vectors in the sample<a name="line.75"></a>
+<FONT color="green">076</FONT>         */<a name="line.76"></a>
+<FONT color="green">077</FONT>        public long getN() {<a name="line.77"></a>
+<FONT color="green">078</FONT>            return (means.length == 0) ? 0 : means[0].getN();<a name="line.78"></a>
+<FONT color="green">079</FONT>        }<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /** {@inheritDoc} */<a name="line.81"></a>
+<FONT color="green">082</FONT>        @Override<a name="line.82"></a>
+<FONT color="green">083</FONT>        public int hashCode() {<a name="line.83"></a>
+<FONT color="green">084</FONT>            final int prime = 31;<a name="line.84"></a>
+<FONT color="green">085</FONT>            int result = 1;<a name="line.85"></a>
+<FONT color="green">086</FONT>            result = prime * result + Arrays.hashCode(means);<a name="line.86"></a>
+<FONT color="green">087</FONT>            return result;<a name="line.87"></a>
+<FONT color="green">088</FONT>        }<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>        /** {@inheritDoc} */<a name="line.90"></a>
+<FONT color="green">091</FONT>        @Override<a name="line.91"></a>
+<FONT color="green">092</FONT>        public boolean equals(Object obj) {<a name="line.92"></a>
+<FONT color="green">093</FONT>            if (this == obj)<a name="line.93"></a>
+<FONT color="green">094</FONT>                return true;<a name="line.94"></a>
+<FONT color="green">095</FONT>            if (!(obj instanceof VectorialMean))<a name="line.95"></a>
+<FONT color="green">096</FONT>                return false;<a name="line.96"></a>
+<FONT color="green">097</FONT>            VectorialMean other = (VectorialMean) obj;<a name="line.97"></a>
+<FONT color="green">098</FONT>            if (!Arrays.equals(means, other.means))<a name="line.98"></a>
+<FONT color="green">099</FONT>                return false;<a name="line.99"></a>
+<FONT color="green">100</FONT>            return true;<a name="line.100"></a>
+<FONT color="green">101</FONT>        }<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>    }<a name="line.103"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/rank/Max.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,228 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.rank;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Returns the maximum of the available values.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;ul&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;li&gt;The result is &lt;code&gt;NaN&lt;/code&gt; iff all values are &lt;code&gt;NaN&lt;/code&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * (i.e. &lt;code&gt;NaN&lt;/code&gt; values have no impact on the value of the statistic).&lt;/li&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;li&gt;If any of the values equals &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt;,<a name="line.29"></a>
+<FONT color="green">030</FONT>     * the result is &lt;code&gt;Double.POSITIVE_INFINITY.&lt;/code&gt;&lt;/li&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;/ul&gt;&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>    * &lt;p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;strong&gt;Note that this implementation is not synchronized.&lt;/strong&gt; If<a name="line.33"></a>
+<FONT color="green">034</FONT>     * multiple threads access an instance of this class concurrently, and at least<a name="line.34"></a>
+<FONT color="green">035</FONT>     * one of the threads invokes the &lt;code&gt;increment()&lt;/code&gt; or<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;code&gt;clear()&lt;/code&gt; method, it must be synchronized externally.&lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.38"></a>
+<FONT color="green">039</FONT>     */<a name="line.39"></a>
+<FONT color="green">040</FONT>    public class Max extends AbstractStorelessUnivariateStatistic implements Serializable {<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Serializable version identifier */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private static final long serialVersionUID = -5593383832225844641L;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /** Number of values that have been added */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private long n;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** Current value of the statistic */<a name="line.48"></a>
+<FONT color="green">049</FONT>        private double value;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /**<a name="line.51"></a>
+<FONT color="green">052</FONT>         * Create a Max instance<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        public Max() {<a name="line.54"></a>
+<FONT color="green">055</FONT>            n = 0;<a name="line.55"></a>
+<FONT color="green">056</FONT>            value = Double.NaN;<a name="line.56"></a>
+<FONT color="green">057</FONT>        }<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /**<a name="line.59"></a>
+<FONT color="green">060</FONT>         * Copy constructor, creates a new {@code Max} identical<a name="line.60"></a>
+<FONT color="green">061</FONT>         * to the {@code original}<a name="line.61"></a>
+<FONT color="green">062</FONT>         *<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @param original the {@code Max} instance to copy<a name="line.63"></a>
+<FONT color="green">064</FONT>         */<a name="line.64"></a>
+<FONT color="green">065</FONT>        public Max(Max original) {<a name="line.65"></a>
+<FONT color="green">066</FONT>            copy(original, this);<a name="line.66"></a>
+<FONT color="green">067</FONT>        }<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * {@inheritDoc}<a name="line.70"></a>
+<FONT color="green">071</FONT>         */<a name="line.71"></a>
+<FONT color="green">072</FONT>        @Override<a name="line.72"></a>
+<FONT color="green">073</FONT>        public void increment(final double d) {<a name="line.73"></a>
+<FONT color="green">074</FONT>            if (d &gt; value || Double.isNaN(value)) {<a name="line.74"></a>
+<FONT color="green">075</FONT>                value = d;<a name="line.75"></a>
+<FONT color="green">076</FONT>            }<a name="line.76"></a>
+<FONT color="green">077</FONT>            n++;<a name="line.77"></a>
+<FONT color="green">078</FONT>        }<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /**<a name="line.80"></a>
+<FONT color="green">081</FONT>         * {@inheritDoc}<a name="line.81"></a>
+<FONT color="green">082</FONT>         */<a name="line.82"></a>
+<FONT color="green">083</FONT>        @Override<a name="line.83"></a>
+<FONT color="green">084</FONT>        public void clear() {<a name="line.84"></a>
+<FONT color="green">085</FONT>            value = Double.NaN;<a name="line.85"></a>
+<FONT color="green">086</FONT>            n = 0;<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /**<a name="line.89"></a>
+<FONT color="green">090</FONT>         * {@inheritDoc}<a name="line.90"></a>
+<FONT color="green">091</FONT>         */<a name="line.91"></a>
+<FONT color="green">092</FONT>        @Override<a name="line.92"></a>
+<FONT color="green">093</FONT>        public double getResult() {<a name="line.93"></a>
+<FONT color="green">094</FONT>            return value;<a name="line.94"></a>
+<FONT color="green">095</FONT>        }<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /**<a name="line.97"></a>
+<FONT color="green">098</FONT>         * {@inheritDoc}<a name="line.98"></a>
+<FONT color="green">099</FONT>         */<a name="line.99"></a>
+<FONT color="green">100</FONT>        public long getN() {<a name="line.100"></a>
+<FONT color="green">101</FONT>            return n;<a name="line.101"></a>
+<FONT color="green">102</FONT>        }<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /**<a name="line.104"></a>
+<FONT color="green">105</FONT>         * Returns the maximum of the entries in the specified portion of<a name="line.105"></a>
+<FONT color="green">106</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.106"></a>
+<FONT color="green">107</FONT>         * is empty.<a name="line.107"></a>
+<FONT color="green">108</FONT>         * &lt;p&gt;<a name="line.108"></a>
+<FONT color="green">109</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null or<a name="line.109"></a>
+<FONT color="green">110</FONT>         * the array index parameters are not valid.&lt;/p&gt;<a name="line.110"></a>
+<FONT color="green">111</FONT>         * &lt;p&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>         * &lt;ul&gt;<a name="line.112"></a>
+<FONT color="green">113</FONT>         * &lt;li&gt;The result is &lt;code&gt;NaN&lt;/code&gt; iff all values are &lt;code&gt;NaN&lt;/code&gt;<a name="line.113"></a>
+<FONT color="green">114</FONT>         * (i.e. &lt;code&gt;NaN&lt;/code&gt; values have no impact on the value of the statistic).&lt;/li&gt;<a name="line.114"></a>
+<FONT color="green">115</FONT>         * &lt;li&gt;If any of the values equals &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt;,<a name="line.115"></a>
+<FONT color="green">116</FONT>         * the result is &lt;code&gt;Double.POSITIVE_INFINITY.&lt;/code&gt;&lt;/li&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>         *<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @param values the input array<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @param begin index of the first array element to include<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @param length the number of elements to include<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @return the maximum of the values or Double.NaN if length = 0<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.123"></a>
+<FONT color="green">124</FONT>         *  parameters are not valid<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        @Override<a name="line.126"></a>
+<FONT color="green">127</FONT>        public double evaluate(final double[] values, final int begin, final int length) {<a name="line.127"></a>
+<FONT color="green">128</FONT>            double max = Double.NaN;<a name="line.128"></a>
+<FONT color="green">129</FONT>            if (test(values, begin, length)) {<a name="line.129"></a>
+<FONT color="green">130</FONT>                max = values[begin];<a name="line.130"></a>
+<FONT color="green">131</FONT>                for (int i = begin; i &lt; begin + length; i++) {<a name="line.131"></a>
+<FONT color="green">132</FONT>                    if (!Double.isNaN(values[i])) {<a name="line.132"></a>
+<FONT color="green">133</FONT>                        max = (max &gt; values[i]) ? max : values[i];<a name="line.133"></a>
+<FONT color="green">134</FONT>                    }<a name="line.134"></a>
+<FONT color="green">135</FONT>                }<a name="line.135"></a>
+<FONT color="green">136</FONT>            }<a name="line.136"></a>
+<FONT color="green">137</FONT>            return max;<a name="line.137"></a>
+<FONT color="green">138</FONT>        }<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>        /**<a name="line.140"></a>
+<FONT color="green">141</FONT>         * {@inheritDoc}<a name="line.141"></a>
+<FONT color="green">142</FONT>         */<a name="line.142"></a>
+<FONT color="green">143</FONT>        @Override<a name="line.143"></a>
+<FONT color="green">144</FONT>        public Max copy() {<a name="line.144"></a>
+<FONT color="green">145</FONT>            Max result = new Max();<a name="line.145"></a>
+<FONT color="green">146</FONT>            copy(this, result);<a name="line.146"></a>
+<FONT color="green">147</FONT>            return result;<a name="line.147"></a>
+<FONT color="green">148</FONT>        }<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>        /**<a name="line.150"></a>
+<FONT color="green">151</FONT>         * Copies source to dest.<a name="line.151"></a>
+<FONT color="green">152</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.152"></a>
+<FONT color="green">153</FONT>         *<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @param source Max to copy<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @param dest Max to copy to<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.156"></a>
+<FONT color="green">157</FONT>         */<a name="line.157"></a>
+<FONT color="green">158</FONT>        public static void copy(Max source, Max dest) {<a name="line.158"></a>
+<FONT color="green">159</FONT>            dest.n = source.n;<a name="line.159"></a>
+<FONT color="green">160</FONT>            dest.value = source.value;<a name="line.160"></a>
+<FONT color="green">161</FONT>        }<a name="line.161"></a>
+<FONT color="green">162</FONT>    }<a name="line.162"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/rank/Median.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,121 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.rank;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Returns the median of the available values.  This is the same as the 50th percentile.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * See {@link Percentile} for a description of the algorithm used.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;strong&gt;Note that this implementation is not synchronized.&lt;/strong&gt; If<a name="line.26"></a>
+<FONT color="green">027</FONT>     * multiple threads access an instance of this class concurrently, and at least<a name="line.27"></a>
+<FONT color="green">028</FONT>     * one of the threads invokes the &lt;code&gt;increment()&lt;/code&gt; or<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;code&gt;clear()&lt;/code&gt; method, it must be synchronized externally.&lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public class Median extends Percentile implements Serializable {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Serializable version identifier */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private static final long serialVersionUID = -3961477041290915687L;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /**<a name="line.38"></a>
+<FONT color="green">039</FONT>         * Default constructor.<a name="line.39"></a>
+<FONT color="green">040</FONT>         */<a name="line.40"></a>
+<FONT color="green">041</FONT>        public Median() {<a name="line.41"></a>
+<FONT color="green">042</FONT>            super(50.0);<a name="line.42"></a>
+<FONT color="green">043</FONT>        }<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**<a name="line.45"></a>
+<FONT color="green">046</FONT>         * Copy constructor, creates a new {@code Median} identical<a name="line.46"></a>
+<FONT color="green">047</FONT>         * to the {@code original}<a name="line.47"></a>
+<FONT color="green">048</FONT>         *<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @param original the {@code Median} instance to copy<a name="line.49"></a>
+<FONT color="green">050</FONT>         */<a name="line.50"></a>
+<FONT color="green">051</FONT>        public Median(Median original) {<a name="line.51"></a>
+<FONT color="green">052</FONT>            super(original);<a name="line.52"></a>
+<FONT color="green">053</FONT>        }<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>    }<a name="line.55"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/rank/Min.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,228 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.rank;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Returns the minimum of the available values.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;ul&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;li&gt;The result is &lt;code&gt;NaN&lt;/code&gt; iff all values are &lt;code&gt;NaN&lt;/code&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * (i.e. &lt;code&gt;NaN&lt;/code&gt; values have no impact on the value of the statistic).&lt;/li&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;li&gt;If any of the values equals &lt;code&gt;Double.NEGATIVE_INFINITY&lt;/code&gt;,<a name="line.29"></a>
+<FONT color="green">030</FONT>     * the result is &lt;code&gt;Double.NEGATIVE_INFINITY.&lt;/code&gt;&lt;/li&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;/ul&gt;&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;strong&gt;Note that this implementation is not synchronized.&lt;/strong&gt; If<a name="line.33"></a>
+<FONT color="green">034</FONT>     * multiple threads access an instance of this class concurrently, and at least<a name="line.34"></a>
+<FONT color="green">035</FONT>     * one of the threads invokes the &lt;code&gt;increment()&lt;/code&gt; or<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;code&gt;clear()&lt;/code&gt; method, it must be synchronized externally.&lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.38"></a>
+<FONT color="green">039</FONT>     */<a name="line.39"></a>
+<FONT color="green">040</FONT>    public class Min extends AbstractStorelessUnivariateStatistic implements Serializable {<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** Serializable version identifier */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private static final long serialVersionUID = -2941995784909003131L;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**Number of values that have been added */<a name="line.45"></a>
+<FONT color="green">046</FONT>        private long n;<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /**Current value of the statistic */<a name="line.48"></a>
+<FONT color="green">049</FONT>        private double value;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /**<a name="line.51"></a>
+<FONT color="green">052</FONT>         * Create a Min instance<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        public Min() {<a name="line.54"></a>
+<FONT color="green">055</FONT>            n = 0;<a name="line.55"></a>
+<FONT color="green">056</FONT>            value = Double.NaN;<a name="line.56"></a>
+<FONT color="green">057</FONT>        }<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /**<a name="line.59"></a>
+<FONT color="green">060</FONT>         * Copy constructor, creates a new {@code Min} identical<a name="line.60"></a>
+<FONT color="green">061</FONT>         * to the {@code original}<a name="line.61"></a>
+<FONT color="green">062</FONT>         *<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @param original the {@code Min} instance to copy<a name="line.63"></a>
+<FONT color="green">064</FONT>         */<a name="line.64"></a>
+<FONT color="green">065</FONT>        public Min(Min original) {<a name="line.65"></a>
+<FONT color="green">066</FONT>            copy(original, this);<a name="line.66"></a>
+<FONT color="green">067</FONT>        }<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /**<a name="line.69"></a>
+<FONT color="green">070</FONT>         * {@inheritDoc}<a name="line.70"></a>
+<FONT color="green">071</FONT>         */<a name="line.71"></a>
+<FONT color="green">072</FONT>        @Override<a name="line.72"></a>
+<FONT color="green">073</FONT>        public void increment(final double d) {<a name="line.73"></a>
+<FONT color="green">074</FONT>            if (d &lt; value || Double.isNaN(value)) {<a name="line.74"></a>
+<FONT color="green">075</FONT>                value = d;<a name="line.75"></a>
+<FONT color="green">076</FONT>            }<a name="line.76"></a>
+<FONT color="green">077</FONT>            n++;<a name="line.77"></a>
+<FONT color="green">078</FONT>        }<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /**<a name="line.80"></a>
+<FONT color="green">081</FONT>         * {@inheritDoc}<a name="line.81"></a>
+<FONT color="green">082</FONT>         */<a name="line.82"></a>
+<FONT color="green">083</FONT>        @Override<a name="line.83"></a>
+<FONT color="green">084</FONT>        public void clear() {<a name="line.84"></a>
+<FONT color="green">085</FONT>            value = Double.NaN;<a name="line.85"></a>
+<FONT color="green">086</FONT>            n = 0;<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /**<a name="line.89"></a>
+<FONT color="green">090</FONT>         * {@inheritDoc}<a name="line.90"></a>
+<FONT color="green">091</FONT>         */<a name="line.91"></a>
+<FONT color="green">092</FONT>        @Override<a name="line.92"></a>
+<FONT color="green">093</FONT>        public double getResult() {<a name="line.93"></a>
+<FONT color="green">094</FONT>            return value;<a name="line.94"></a>
+<FONT color="green">095</FONT>        }<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /**<a name="line.97"></a>
+<FONT color="green">098</FONT>         * {@inheritDoc}<a name="line.98"></a>
+<FONT color="green">099</FONT>         */<a name="line.99"></a>
+<FONT color="green">100</FONT>        public long getN() {<a name="line.100"></a>
+<FONT color="green">101</FONT>            return n;<a name="line.101"></a>
+<FONT color="green">102</FONT>        }<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /**<a name="line.104"></a>
+<FONT color="green">105</FONT>         * Returns the minimum of the entries in the specified portion of<a name="line.105"></a>
+<FONT color="green">106</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.106"></a>
+<FONT color="green">107</FONT>         * is empty.<a name="line.107"></a>
+<FONT color="green">108</FONT>         * &lt;p&gt;<a name="line.108"></a>
+<FONT color="green">109</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null or<a name="line.109"></a>
+<FONT color="green">110</FONT>         * the array index parameters are not valid.&lt;/p&gt;<a name="line.110"></a>
+<FONT color="green">111</FONT>         * &lt;p&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>         * &lt;ul&gt;<a name="line.112"></a>
+<FONT color="green">113</FONT>         * &lt;li&gt;The result is &lt;code&gt;NaN&lt;/code&gt; iff all values are &lt;code&gt;NaN&lt;/code&gt;<a name="line.113"></a>
+<FONT color="green">114</FONT>         * (i.e. &lt;code&gt;NaN&lt;/code&gt; values have no impact on the value of the statistic).&lt;/li&gt;<a name="line.114"></a>
+<FONT color="green">115</FONT>         * &lt;li&gt;If any of the values equals &lt;code&gt;Double.NEGATIVE_INFINITY&lt;/code&gt;,<a name="line.115"></a>
+<FONT color="green">116</FONT>         * the result is &lt;code&gt;Double.NEGATIVE_INFINITY.&lt;/code&gt;&lt;/li&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * &lt;/ul&gt; &lt;/p&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>         *<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @param values the input array<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @param begin index of the first array element to include<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @param length the number of elements to include<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @return the minimum of the values or Double.NaN if length = 0<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.123"></a>
+<FONT color="green">124</FONT>         *  parameters are not valid<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        @Override<a name="line.126"></a>
+<FONT color="green">127</FONT>        public double evaluate(final double[] values,final int begin, final int length) {<a name="line.127"></a>
+<FONT color="green">128</FONT>            double min = Double.NaN;<a name="line.128"></a>
+<FONT color="green">129</FONT>            if (test(values, begin, length)) {<a name="line.129"></a>
+<FONT color="green">130</FONT>                min = values[begin];<a name="line.130"></a>
+<FONT color="green">131</FONT>                for (int i = begin; i &lt; begin + length; i++) {<a name="line.131"></a>
+<FONT color="green">132</FONT>                    if (!Double.isNaN(values[i])) {<a name="line.132"></a>
+<FONT color="green">133</FONT>                        min = (min &lt; values[i]) ? min : values[i];<a name="line.133"></a>
+<FONT color="green">134</FONT>                    }<a name="line.134"></a>
+<FONT color="green">135</FONT>                }<a name="line.135"></a>
+<FONT color="green">136</FONT>            }<a name="line.136"></a>
+<FONT color="green">137</FONT>            return min;<a name="line.137"></a>
+<FONT color="green">138</FONT>        }<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>        /**<a name="line.140"></a>
+<FONT color="green">141</FONT>         * {@inheritDoc}<a name="line.141"></a>
+<FONT color="green">142</FONT>         */<a name="line.142"></a>
+<FONT color="green">143</FONT>        @Override<a name="line.143"></a>
+<FONT color="green">144</FONT>        public Min copy() {<a name="line.144"></a>
+<FONT color="green">145</FONT>            Min result = new Min();<a name="line.145"></a>
+<FONT color="green">146</FONT>            copy(this, result);<a name="line.146"></a>
+<FONT color="green">147</FONT>            return result;<a name="line.147"></a>
+<FONT color="green">148</FONT>        }<a name="line.148"></a>
+<FONT color="green">149</FONT>    <a name="line.149"></a>
+<FONT color="green">150</FONT>        /**<a name="line.150"></a>
+<FONT color="green">151</FONT>         * Copies source to dest.<a name="line.151"></a>
+<FONT color="green">152</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.152"></a>
+<FONT color="green">153</FONT>         *<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @param source Min to copy<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @param dest Min to copy to<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.156"></a>
+<FONT color="green">157</FONT>         */<a name="line.157"></a>
+<FONT color="green">158</FONT>        public static void copy(Min source, Min dest) {<a name="line.158"></a>
+<FONT color="green">159</FONT>            dest.n = source.n;<a name="line.159"></a>
+<FONT color="green">160</FONT>            dest.value = source.value;<a name="line.160"></a>
+<FONT color="green">161</FONT>        }<a name="line.161"></a>
+<FONT color="green">162</FONT>    }<a name="line.162"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/rank/Percentile.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,344 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.rank;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.stat.descriptive.AbstractUnivariateStatistic;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Provides percentile computation.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * There are several commonly used methods for estimating percentiles (a.k.a.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * quantiles) based on sample data.  For large samples, the different methods<a name="line.29"></a>
+<FONT color="green">030</FONT>     * agree closely, but when sample sizes are small, different methods will give<a name="line.30"></a>
+<FONT color="green">031</FONT>     * significantly different results.  The algorithm implemented here works as follows:<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;ol&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;li&gt;Let &lt;code&gt;n&lt;/code&gt; be the length of the (sorted) array and<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;code&gt;0 &lt; p &lt;= 100&lt;/code&gt; be the desired percentile.&lt;/li&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;li&gt;If &lt;code&gt; n = 1 &lt;/code&gt; return the unique array element (regardless of<a name="line.35"></a>
+<FONT color="green">036</FONT>     * the value of &lt;code&gt;p&lt;/code&gt;); otherwise &lt;/li&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;li&gt;Compute the estimated percentile position<a name="line.37"></a>
+<FONT color="green">038</FONT>     * &lt;code&gt; pos = p * (n + 1) / 100&lt;/code&gt; and the difference, &lt;code&gt;d&lt;/code&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * between &lt;code&gt;pos&lt;/code&gt; and &lt;code&gt;floor(pos)&lt;/code&gt; (i.e. the fractional<a name="line.39"></a>
+<FONT color="green">040</FONT>     * part of &lt;code&gt;pos&lt;/code&gt;).  If &lt;code&gt;pos &gt;= n&lt;/code&gt; return the largest<a name="line.40"></a>
+<FONT color="green">041</FONT>     * element in the array; otherwise&lt;/li&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * &lt;li&gt;Let &lt;code&gt;lower&lt;/code&gt; be the element in position<a name="line.42"></a>
+<FONT color="green">043</FONT>     * &lt;code&gt;floor(pos)&lt;/code&gt; in the array and let &lt;code&gt;upper&lt;/code&gt; be the<a name="line.43"></a>
+<FONT color="green">044</FONT>     * next element in the array.  Return &lt;code&gt;lower + d * (upper - lower)&lt;/code&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     * &lt;/li&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     * &lt;/ol&gt;&lt;/p&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     * &lt;p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     * To compute percentiles, the data must be (totally) ordered.  Input arrays<a name="line.48"></a>
+<FONT color="green">049</FONT>     * are copied and then sorted using  {@link java.util.Arrays#sort(double[])}.<a name="line.49"></a>
+<FONT color="green">050</FONT>     * The ordering used by &lt;code&gt;Arrays.sort(double[])&lt;/code&gt; is the one determined<a name="line.50"></a>
+<FONT color="green">051</FONT>     * by {@link java.lang.Double#compareTo(Double)}.  This ordering makes<a name="line.51"></a>
+<FONT color="green">052</FONT>     * &lt;code&gt;Double.NaN&lt;/code&gt; larger than any other value (including<a name="line.52"></a>
+<FONT color="green">053</FONT>     * &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt;).  Therefore, for example, the median<a name="line.53"></a>
+<FONT color="green">054</FONT>     * (50th percentile) of<a name="line.54"></a>
+<FONT color="green">055</FONT>     * &lt;code&gt;{0, 1, 2, 3, 4, Double.NaN}&lt;/code&gt; evaluates to &lt;code&gt;2.5.&lt;/code&gt;&lt;/p&gt;<a name="line.55"></a>
+<FONT color="green">056</FONT>     * &lt;p&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>     * Since percentile estimation usually involves interpolation between array<a name="line.57"></a>
+<FONT color="green">058</FONT>     * elements, arrays containing  &lt;code&gt;NaN&lt;/code&gt; or infinite values will often<a name="line.58"></a>
+<FONT color="green">059</FONT>     * result in &lt;code&gt;NaN&lt;code&gt; or infinite values returned.&lt;/p&gt;<a name="line.59"></a>
+<FONT color="green">060</FONT>     * &lt;p&gt;<a name="line.60"></a>
+<FONT color="green">061</FONT>     * &lt;strong&gt;Note that this implementation is not synchronized.&lt;/strong&gt; If<a name="line.61"></a>
+<FONT color="green">062</FONT>     * multiple threads access an instance of this class concurrently, and at least<a name="line.62"></a>
+<FONT color="green">063</FONT>     * one of the threads invokes the &lt;code&gt;increment()&lt;/code&gt; or<a name="line.63"></a>
+<FONT color="green">064</FONT>     * &lt;code&gt;clear()&lt;/code&gt; method, it must be synchronized externally.&lt;/p&gt;<a name="line.64"></a>
+<FONT color="green">065</FONT>     *<a name="line.65"></a>
+<FONT color="green">066</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.66"></a>
+<FONT color="green">067</FONT>     */<a name="line.67"></a>
+<FONT color="green">068</FONT>    public class Percentile extends AbstractUnivariateStatistic implements Serializable {<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /** Serializable version identifier */<a name="line.70"></a>
+<FONT color="green">071</FONT>        private static final long serialVersionUID = -8091216485095130416L;<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /** Determines what percentile is computed when evaluate() is activated<a name="line.73"></a>
+<FONT color="green">074</FONT>         * with no quantile argument */<a name="line.74"></a>
+<FONT color="green">075</FONT>        private double quantile = 0.0;<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /**<a name="line.77"></a>
+<FONT color="green">078</FONT>         * Constructs a Percentile with a default quantile<a name="line.78"></a>
+<FONT color="green">079</FONT>         * value of 50.0.<a name="line.79"></a>
+<FONT color="green">080</FONT>         */<a name="line.80"></a>
+<FONT color="green">081</FONT>        public Percentile() {<a name="line.81"></a>
+<FONT color="green">082</FONT>            this(50.0);<a name="line.82"></a>
+<FONT color="green">083</FONT>        }<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>        /**<a name="line.85"></a>
+<FONT color="green">086</FONT>         * Constructs a Percentile with the specific quantile value.<a name="line.86"></a>
+<FONT color="green">087</FONT>         * @param p the quantile<a name="line.87"></a>
+<FONT color="green">088</FONT>         * @throws IllegalArgumentException  if p is not greater than 0 and less<a name="line.88"></a>
+<FONT color="green">089</FONT>         * than or equal to 100<a name="line.89"></a>
+<FONT color="green">090</FONT>         */<a name="line.90"></a>
+<FONT color="green">091</FONT>        public Percentile(final double p) {<a name="line.91"></a>
+<FONT color="green">092</FONT>            setQuantile(p);<a name="line.92"></a>
+<FONT color="green">093</FONT>        }<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /**<a name="line.95"></a>
+<FONT color="green">096</FONT>         * Copy constructor, creates a new {@code Percentile} identical<a name="line.96"></a>
+<FONT color="green">097</FONT>         * to the {@code original}<a name="line.97"></a>
+<FONT color="green">098</FONT>         *<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @param original the {@code Percentile} instance to copy<a name="line.99"></a>
+<FONT color="green">100</FONT>         */<a name="line.100"></a>
+<FONT color="green">101</FONT>        public Percentile(Percentile original) {<a name="line.101"></a>
+<FONT color="green">102</FONT>            copy(original, this);<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /**<a name="line.105"></a>
+<FONT color="green">106</FONT>         * Returns an estimate of the &lt;code&gt;p&lt;/code&gt;th percentile of the values<a name="line.106"></a>
+<FONT color="green">107</FONT>         * in the &lt;code&gt;values&lt;/code&gt; array.<a name="line.107"></a>
+<FONT color="green">108</FONT>         * &lt;p&gt;<a name="line.108"></a>
+<FONT color="green">109</FONT>         * Calls to this method do not modify the internal &lt;code&gt;quantile&lt;/code&gt;<a name="line.109"></a>
+<FONT color="green">110</FONT>         * state of this statistic.&lt;/p&gt;<a name="line.110"></a>
+<FONT color="green">111</FONT>         * &lt;p&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>         * &lt;ul&gt;<a name="line.112"></a>
+<FONT color="green">113</FONT>         * &lt;li&gt;Returns &lt;code&gt;Double.NaN&lt;/code&gt; if &lt;code&gt;values&lt;/code&gt; has length<a name="line.113"></a>
+<FONT color="green">114</FONT>         * &lt;code&gt;0&lt;/code&gt;&lt;/li&gt;<a name="line.114"></a>
+<FONT color="green">115</FONT>         * &lt;li&gt;Returns (for any value of &lt;code&gt;p&lt;/code&gt;) &lt;code&gt;values[0]&lt;/code&gt;<a name="line.115"></a>
+<FONT color="green">116</FONT>         *  if &lt;code&gt;values&lt;/code&gt; has length &lt;code&gt;1&lt;/code&gt;&lt;/li&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * &lt;li&gt;Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if &lt;code&gt;values&lt;/code&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>         * is null or p is not a valid quantile value (p must be greater than 0<a name="line.118"></a>
+<FONT color="green">119</FONT>         * and less than or equal to 100) &lt;/li&gt;<a name="line.119"></a>
+<FONT color="green">120</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.120"></a>
+<FONT color="green">121</FONT>         * &lt;p&gt;<a name="line.121"></a>
+<FONT color="green">122</FONT>         * See {@link Percentile} for a description of the percentile estimation<a name="line.122"></a>
+<FONT color="green">123</FONT>         * algorithm used.&lt;/p&gt;<a name="line.123"></a>
+<FONT color="green">124</FONT>         *<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @param values input array of values<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @param p the percentile value to compute<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @return the percentile value or Double.NaN if the array is empty<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @throws IllegalArgumentException if &lt;code&gt;values&lt;/code&gt; is null<a name="line.128"></a>
+<FONT color="green">129</FONT>         *     or p is invalid<a name="line.129"></a>
+<FONT color="green">130</FONT>         */<a name="line.130"></a>
+<FONT color="green">131</FONT>        public double evaluate(final double[] values, final double p) {<a name="line.131"></a>
+<FONT color="green">132</FONT>            test(values, 0, 0);<a name="line.132"></a>
+<FONT color="green">133</FONT>            return evaluate(values, 0, values.length, p);<a name="line.133"></a>
+<FONT color="green">134</FONT>        }<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>        /**<a name="line.136"></a>
+<FONT color="green">137</FONT>         * Returns an estimate of the &lt;code&gt;quantile&lt;/code&gt;th percentile of the<a name="line.137"></a>
+<FONT color="green">138</FONT>         * designated values in the &lt;code&gt;values&lt;/code&gt; array.  The quantile<a name="line.138"></a>
+<FONT color="green">139</FONT>         * estimated is determined by the &lt;code&gt;quantile&lt;/code&gt; property.<a name="line.139"></a>
+<FONT color="green">140</FONT>         * &lt;p&gt;<a name="line.140"></a>
+<FONT color="green">141</FONT>         * &lt;ul&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>         * &lt;li&gt;Returns &lt;code&gt;Double.NaN&lt;/code&gt; if &lt;code&gt;length = 0&lt;/code&gt;&lt;/li&gt;<a name="line.142"></a>
+<FONT color="green">143</FONT>         * &lt;li&gt;Returns (for any value of &lt;code&gt;quantile&lt;/code&gt;)<a name="line.143"></a>
+<FONT color="green">144</FONT>         * &lt;code&gt;values[begin]&lt;/code&gt; if &lt;code&gt;length = 1 &lt;/code&gt;&lt;/li&gt;<a name="line.144"></a>
+<FONT color="green">145</FONT>         * &lt;li&gt;Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if &lt;code&gt;values&lt;/code&gt;<a name="line.145"></a>
+<FONT color="green">146</FONT>         * is null,  or &lt;code&gt;start&lt;/code&gt; or &lt;code&gt;length&lt;/code&gt;<a name="line.146"></a>
+<FONT color="green">147</FONT>         * is invalid&lt;/li&gt;<a name="line.147"></a>
+<FONT color="green">148</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.148"></a>
+<FONT color="green">149</FONT>         * &lt;p&gt;<a name="line.149"></a>
+<FONT color="green">150</FONT>         * See {@link Percentile} for a description of the percentile estimation<a name="line.150"></a>
+<FONT color="green">151</FONT>         * algorithm used.&lt;/p&gt;<a name="line.151"></a>
+<FONT color="green">152</FONT>         *<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @param values the input array<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @param start index of the first array element to include<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @param length the number of elements to include<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @return the percentile value<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @throws IllegalArgumentException if the parameters are not valid<a name="line.157"></a>
+<FONT color="green">158</FONT>         *<a name="line.158"></a>
+<FONT color="green">159</FONT>         */<a name="line.159"></a>
+<FONT color="green">160</FONT>        @Override<a name="line.160"></a>
+<FONT color="green">161</FONT>        public double evaluate( final double[] values, final int start, final int length) {<a name="line.161"></a>
+<FONT color="green">162</FONT>            return evaluate(values, start, length, quantile);<a name="line.162"></a>
+<FONT color="green">163</FONT>        }<a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>         /**<a name="line.165"></a>
+<FONT color="green">166</FONT>         * Returns an estimate of the &lt;code&gt;p&lt;/code&gt;th percentile of the values<a name="line.166"></a>
+<FONT color="green">167</FONT>         * in the &lt;code&gt;values&lt;/code&gt; array, starting with the element in (0-based)<a name="line.167"></a>
+<FONT color="green">168</FONT>         * position &lt;code&gt;begin&lt;/code&gt; in the array and including &lt;code&gt;length&lt;/code&gt;<a name="line.168"></a>
+<FONT color="green">169</FONT>         * values.<a name="line.169"></a>
+<FONT color="green">170</FONT>         * &lt;p&gt;<a name="line.170"></a>
+<FONT color="green">171</FONT>         * Calls to this method do not modify the internal &lt;code&gt;quantile&lt;/code&gt;<a name="line.171"></a>
+<FONT color="green">172</FONT>         * state of this statistic.&lt;/p&gt;<a name="line.172"></a>
+<FONT color="green">173</FONT>         * &lt;p&gt;<a name="line.173"></a>
+<FONT color="green">174</FONT>         * &lt;ul&gt;<a name="line.174"></a>
+<FONT color="green">175</FONT>         * &lt;li&gt;Returns &lt;code&gt;Double.NaN&lt;/code&gt; if &lt;code&gt;length = 0&lt;/code&gt;&lt;/li&gt;<a name="line.175"></a>
+<FONT color="green">176</FONT>         * &lt;li&gt;Returns (for any value of &lt;code&gt;p&lt;/code&gt;) &lt;code&gt;values[begin]&lt;/code&gt;<a name="line.176"></a>
+<FONT color="green">177</FONT>         *  if &lt;code&gt;length = 1 &lt;/code&gt;&lt;/li&gt;<a name="line.177"></a>
+<FONT color="green">178</FONT>         * &lt;li&gt;Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if &lt;code&gt;values&lt;/code&gt;<a name="line.178"></a>
+<FONT color="green">179</FONT>         *  is null , &lt;code&gt;begin&lt;/code&gt; or &lt;code&gt;length&lt;/code&gt; is invalid, or<a name="line.179"></a>
+<FONT color="green">180</FONT>         * &lt;code&gt;p&lt;/code&gt; is not a valid quantile value (p must be greater than 0<a name="line.180"></a>
+<FONT color="green">181</FONT>         * and less than or equal to 100)&lt;/li&gt;<a name="line.181"></a>
+<FONT color="green">182</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.182"></a>
+<FONT color="green">183</FONT>         * &lt;p&gt;<a name="line.183"></a>
+<FONT color="green">184</FONT>         * See {@link Percentile} for a description of the percentile estimation<a name="line.184"></a>
+<FONT color="green">185</FONT>         * algorithm used.&lt;/p&gt;<a name="line.185"></a>
+<FONT color="green">186</FONT>         *<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @param values array of input values<a name="line.187"></a>
+<FONT color="green">188</FONT>         * @param p  the percentile to compute<a name="line.188"></a>
+<FONT color="green">189</FONT>         * @param begin  the first (0-based) element to include in the computation<a name="line.189"></a>
+<FONT color="green">190</FONT>         * @param length  the number of array elements to include<a name="line.190"></a>
+<FONT color="green">191</FONT>         * @return  the percentile value<a name="line.191"></a>
+<FONT color="green">192</FONT>         * @throws IllegalArgumentException if the parameters are not valid or the<a name="line.192"></a>
+<FONT color="green">193</FONT>         * input array is null<a name="line.193"></a>
+<FONT color="green">194</FONT>         */<a name="line.194"></a>
+<FONT color="green">195</FONT>        public double evaluate(final double[] values, final int begin,<a name="line.195"></a>
+<FONT color="green">196</FONT>                final int length, final double p) {<a name="line.196"></a>
+<FONT color="green">197</FONT>    <a name="line.197"></a>
+<FONT color="green">198</FONT>            test(values, begin, length);<a name="line.198"></a>
+<FONT color="green">199</FONT>    <a name="line.199"></a>
+<FONT color="green">200</FONT>            if ((p &gt; 100) || (p &lt;= 0)) {<a name="line.200"></a>
+<FONT color="green">201</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.201"></a>
+<FONT color="green">202</FONT>                      "out of bounds quantile value: {0}, must be in (0, 100]", p);<a name="line.202"></a>
+<FONT color="green">203</FONT>            }<a name="line.203"></a>
+<FONT color="green">204</FONT>            if (length == 0) {<a name="line.204"></a>
+<FONT color="green">205</FONT>                return Double.NaN;<a name="line.205"></a>
+<FONT color="green">206</FONT>            }<a name="line.206"></a>
+<FONT color="green">207</FONT>            if (length == 1) {<a name="line.207"></a>
+<FONT color="green">208</FONT>                return values[begin]; // always return single value for n = 1<a name="line.208"></a>
+<FONT color="green">209</FONT>            }<a name="line.209"></a>
+<FONT color="green">210</FONT>            double n = length;<a name="line.210"></a>
+<FONT color="green">211</FONT>            double pos = p * (n + 1) / 100;<a name="line.211"></a>
+<FONT color="green">212</FONT>            double fpos = Math.floor(pos);<a name="line.212"></a>
+<FONT color="green">213</FONT>            int intPos = (int) fpos;<a name="line.213"></a>
+<FONT color="green">214</FONT>            double dif = pos - fpos;<a name="line.214"></a>
+<FONT color="green">215</FONT>            double[] sorted = new double[length];<a name="line.215"></a>
+<FONT color="green">216</FONT>            System.arraycopy(values, begin, sorted, 0, length);<a name="line.216"></a>
+<FONT color="green">217</FONT>            Arrays.sort(sorted);<a name="line.217"></a>
+<FONT color="green">218</FONT>    <a name="line.218"></a>
+<FONT color="green">219</FONT>            if (pos &lt; 1) {<a name="line.219"></a>
+<FONT color="green">220</FONT>                return sorted[0];<a name="line.220"></a>
+<FONT color="green">221</FONT>            }<a name="line.221"></a>
+<FONT color="green">222</FONT>            if (pos &gt;= n) {<a name="line.222"></a>
+<FONT color="green">223</FONT>                return sorted[length - 1];<a name="line.223"></a>
+<FONT color="green">224</FONT>            }<a name="line.224"></a>
+<FONT color="green">225</FONT>            double lower = sorted[intPos - 1];<a name="line.225"></a>
+<FONT color="green">226</FONT>            double upper = sorted[intPos];<a name="line.226"></a>
+<FONT color="green">227</FONT>            return lower + dif * (upper - lower);<a name="line.227"></a>
+<FONT color="green">228</FONT>        }<a name="line.228"></a>
+<FONT color="green">229</FONT>    <a name="line.229"></a>
+<FONT color="green">230</FONT>        /**<a name="line.230"></a>
+<FONT color="green">231</FONT>         * Returns the value of the quantile field (determines what percentile is<a name="line.231"></a>
+<FONT color="green">232</FONT>         * computed when evaluate() is called with no quantile argument).<a name="line.232"></a>
+<FONT color="green">233</FONT>         *<a name="line.233"></a>
+<FONT color="green">234</FONT>         * @return quantile<a name="line.234"></a>
+<FONT color="green">235</FONT>         */<a name="line.235"></a>
+<FONT color="green">236</FONT>        public double getQuantile() {<a name="line.236"></a>
+<FONT color="green">237</FONT>            return quantile;<a name="line.237"></a>
+<FONT color="green">238</FONT>        }<a name="line.238"></a>
+<FONT color="green">239</FONT>    <a name="line.239"></a>
+<FONT color="green">240</FONT>        /**<a name="line.240"></a>
+<FONT color="green">241</FONT>         * Sets the value of the quantile field (determines what percentile is<a name="line.241"></a>
+<FONT color="green">242</FONT>         * computed when evaluate() is called with no quantile argument).<a name="line.242"></a>
+<FONT color="green">243</FONT>         *<a name="line.243"></a>
+<FONT color="green">244</FONT>         * @param p a value between 0 &lt; p &lt;= 100<a name="line.244"></a>
+<FONT color="green">245</FONT>         * @throws IllegalArgumentException  if p is not greater than 0 and less<a name="line.245"></a>
+<FONT color="green">246</FONT>         * than or equal to 100<a name="line.246"></a>
+<FONT color="green">247</FONT>         */<a name="line.247"></a>
+<FONT color="green">248</FONT>        public void setQuantile(final double p) {<a name="line.248"></a>
+<FONT color="green">249</FONT>            if (p &lt;= 0 || p &gt; 100) {<a name="line.249"></a>
+<FONT color="green">250</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.250"></a>
+<FONT color="green">251</FONT>                      "out of bounds quantile value: {0}, must be in (0, 100]", p);<a name="line.251"></a>
+<FONT color="green">252</FONT>            }<a name="line.252"></a>
+<FONT color="green">253</FONT>            quantile = p;<a name="line.253"></a>
+<FONT color="green">254</FONT>        }<a name="line.254"></a>
+<FONT color="green">255</FONT>    <a name="line.255"></a>
+<FONT color="green">256</FONT>        /**<a name="line.256"></a>
+<FONT color="green">257</FONT>         * {@inheritDoc}<a name="line.257"></a>
+<FONT color="green">258</FONT>         */<a name="line.258"></a>
+<FONT color="green">259</FONT>        @Override<a name="line.259"></a>
+<FONT color="green">260</FONT>        public Percentile copy() {<a name="line.260"></a>
+<FONT color="green">261</FONT>            Percentile result = new Percentile();<a name="line.261"></a>
+<FONT color="green">262</FONT>            copy(this, result);<a name="line.262"></a>
+<FONT color="green">263</FONT>            return result;<a name="line.263"></a>
+<FONT color="green">264</FONT>        }<a name="line.264"></a>
+<FONT color="green">265</FONT>    <a name="line.265"></a>
+<FONT color="green">266</FONT>        /**<a name="line.266"></a>
+<FONT color="green">267</FONT>         * Copies source to dest.<a name="line.267"></a>
+<FONT color="green">268</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.268"></a>
+<FONT color="green">269</FONT>         *<a name="line.269"></a>
+<FONT color="green">270</FONT>         * @param source Percentile to copy<a name="line.270"></a>
+<FONT color="green">271</FONT>         * @param dest Percentile to copy to<a name="line.271"></a>
+<FONT color="green">272</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.272"></a>
+<FONT color="green">273</FONT>         */<a name="line.273"></a>
+<FONT color="green">274</FONT>        public static void copy(Percentile source, Percentile dest) {<a name="line.274"></a>
+<FONT color="green">275</FONT>            dest.quantile = source.quantile;<a name="line.275"></a>
+<FONT color="green">276</FONT>        }<a name="line.276"></a>
+<FONT color="green">277</FONT>    <a name="line.277"></a>
+<FONT color="green">278</FONT>    }<a name="line.278"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/summary/Product.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,288 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.summary;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.stat.descriptive.WeightedEvaluation;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Returns the product of the available values.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * If there are no values in the dataset, or any of the values are<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;code&gt;NaN&lt;/code&gt;, then &lt;code&gt;NaN&lt;/code&gt; is returned.&lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;strong&gt;Note that this implementation is not synchronized.&lt;/strong&gt; If<a name="line.30"></a>
+<FONT color="green">031</FONT>     * multiple threads access an instance of this class concurrently, and at least<a name="line.31"></a>
+<FONT color="green">032</FONT>     * one of the threads invokes the &lt;code&gt;increment()&lt;/code&gt; or<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;code&gt;clear()&lt;/code&gt; method, it must be synchronized externally.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     *<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @version $Revision: 917270 $ $Date: 2010-02-28 14:37:53 -0500 (Sun, 28 Feb 2010) $<a name="line.35"></a>
+<FONT color="green">036</FONT>     */<a name="line.36"></a>
+<FONT color="green">037</FONT>    public class Product extends AbstractStorelessUnivariateStatistic implements Serializable, WeightedEvaluation {<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Serializable version identifier */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private static final long serialVersionUID = 2824226005990582538L;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /**The number of values that have been added */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private long n;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**<a name="line.45"></a>
+<FONT color="green">046</FONT>         * The current Running Product.<a name="line.46"></a>
+<FONT color="green">047</FONT>         */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private double value;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Create a Product instance<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        public Product() {<a name="line.53"></a>
+<FONT color="green">054</FONT>            n = 0;<a name="line.54"></a>
+<FONT color="green">055</FONT>            value = Double.NaN;<a name="line.55"></a>
+<FONT color="green">056</FONT>        }<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /**<a name="line.58"></a>
+<FONT color="green">059</FONT>         * Copy constructor, creates a new {@code Product} identical<a name="line.59"></a>
+<FONT color="green">060</FONT>         * to the {@code original}<a name="line.60"></a>
+<FONT color="green">061</FONT>         *<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param original the {@code Product} instance to copy<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public Product(Product original) {<a name="line.64"></a>
+<FONT color="green">065</FONT>            copy(original, this);<a name="line.65"></a>
+<FONT color="green">066</FONT>        }<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /**<a name="line.68"></a>
+<FONT color="green">069</FONT>         * {@inheritDoc}<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        @Override<a name="line.71"></a>
+<FONT color="green">072</FONT>        public void increment(final double d) {<a name="line.72"></a>
+<FONT color="green">073</FONT>            if (n == 0) {<a name="line.73"></a>
+<FONT color="green">074</FONT>                value = d;<a name="line.74"></a>
+<FONT color="green">075</FONT>            } else {<a name="line.75"></a>
+<FONT color="green">076</FONT>                value *= d;<a name="line.76"></a>
+<FONT color="green">077</FONT>            }<a name="line.77"></a>
+<FONT color="green">078</FONT>            n++;<a name="line.78"></a>
+<FONT color="green">079</FONT>        }<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /**<a name="line.81"></a>
+<FONT color="green">082</FONT>         * {@inheritDoc}<a name="line.82"></a>
+<FONT color="green">083</FONT>         */<a name="line.83"></a>
+<FONT color="green">084</FONT>        @Override<a name="line.84"></a>
+<FONT color="green">085</FONT>        public double getResult() {<a name="line.85"></a>
+<FONT color="green">086</FONT>            return value;<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /**<a name="line.89"></a>
+<FONT color="green">090</FONT>         * {@inheritDoc}<a name="line.90"></a>
+<FONT color="green">091</FONT>         */<a name="line.91"></a>
+<FONT color="green">092</FONT>        public long getN() {<a name="line.92"></a>
+<FONT color="green">093</FONT>            return n;<a name="line.93"></a>
+<FONT color="green">094</FONT>        }<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /**<a name="line.96"></a>
+<FONT color="green">097</FONT>         * {@inheritDoc}<a name="line.97"></a>
+<FONT color="green">098</FONT>         */<a name="line.98"></a>
+<FONT color="green">099</FONT>        @Override<a name="line.99"></a>
+<FONT color="green">100</FONT>        public void clear() {<a name="line.100"></a>
+<FONT color="green">101</FONT>            value = Double.NaN;<a name="line.101"></a>
+<FONT color="green">102</FONT>            n = 0;<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /**<a name="line.105"></a>
+<FONT color="green">106</FONT>         * Returns the product of the entries in the specified portion of<a name="line.106"></a>
+<FONT color="green">107</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.107"></a>
+<FONT color="green">108</FONT>         * is empty.<a name="line.108"></a>
+<FONT color="green">109</FONT>         * &lt;p&gt;<a name="line.109"></a>
+<FONT color="green">110</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.110"></a>
+<FONT color="green">111</FONT>         *<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @param values the input array<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param begin index of the first array element to include<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param length the number of elements to include<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @return the product of the values or Double.NaN if length = 0<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.116"></a>
+<FONT color="green">117</FONT>         *  parameters are not valid<a name="line.117"></a>
+<FONT color="green">118</FONT>         */<a name="line.118"></a>
+<FONT color="green">119</FONT>        @Override<a name="line.119"></a>
+<FONT color="green">120</FONT>        public double evaluate(final double[] values, final int begin, final int length) {<a name="line.120"></a>
+<FONT color="green">121</FONT>            double product = Double.NaN;<a name="line.121"></a>
+<FONT color="green">122</FONT>            if (test(values, begin, length)) {<a name="line.122"></a>
+<FONT color="green">123</FONT>                product = 1.0;<a name="line.123"></a>
+<FONT color="green">124</FONT>                for (int i = begin; i &lt; begin + length; i++) {<a name="line.124"></a>
+<FONT color="green">125</FONT>                    product *= values[i];<a name="line.125"></a>
+<FONT color="green">126</FONT>                }<a name="line.126"></a>
+<FONT color="green">127</FONT>            }<a name="line.127"></a>
+<FONT color="green">128</FONT>            return product;<a name="line.128"></a>
+<FONT color="green">129</FONT>        }<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>        /**<a name="line.131"></a>
+<FONT color="green">132</FONT>         * &lt;p&gt;Returns the weighted product of the entries in the specified portion of<a name="line.132"></a>
+<FONT color="green">133</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.133"></a>
+<FONT color="green">134</FONT>         * is empty.&lt;/p&gt;<a name="line.134"></a>
+<FONT color="green">135</FONT>         *<a name="line.135"></a>
+<FONT color="green">136</FONT>         * &lt;p&gt;Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if any of the following are true:<a name="line.136"></a>
+<FONT color="green">137</FONT>         * &lt;ul&gt;&lt;li&gt;the values array is null&lt;/li&gt;<a name="line.137"></a>
+<FONT color="green">138</FONT>         *     &lt;li&gt;the weights array is null&lt;/li&gt;<a name="line.138"></a>
+<FONT color="green">139</FONT>         *     &lt;li&gt;the weights array does not have the same length as the values array&lt;/li&gt;<a name="line.139"></a>
+<FONT color="green">140</FONT>         *     &lt;li&gt;the weights array contains one or more infinite values&lt;/li&gt;<a name="line.140"></a>
+<FONT color="green">141</FONT>         *     &lt;li&gt;the weights array contains one or more NaN values&lt;/li&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>         *     &lt;li&gt;the weights array contains negative values&lt;/li&gt;<a name="line.142"></a>
+<FONT color="green">143</FONT>         *     &lt;li&gt;the start and length arguments do not determine a valid array&lt;/li&gt;<a name="line.143"></a>
+<FONT color="green">144</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.144"></a>
+<FONT color="green">145</FONT>         *<a name="line.145"></a>
+<FONT color="green">146</FONT>         * &lt;p&gt;Uses the formula, &lt;pre&gt;<a name="line.146"></a>
+<FONT color="green">147</FONT>         *    weighted product = &amp;prod;values[i]&lt;sup&gt;weights[i]&lt;/sup&gt;<a name="line.147"></a>
+<FONT color="green">148</FONT>         * &lt;/pre&gt;<a name="line.148"></a>
+<FONT color="green">149</FONT>         * that is, the weights are applied as exponents when computing the weighted product.&lt;/p&gt;<a name="line.149"></a>
+<FONT color="green">150</FONT>         *<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @param values the input array<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @param weights the weights array<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @param begin index of the first array element to include<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @param length the number of elements to include<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @return the product of the values or Double.NaN if length = 0<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @throws IllegalArgumentException if the parameters are not valid<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @since 2.1<a name="line.157"></a>
+<FONT color="green">158</FONT>         */<a name="line.158"></a>
+<FONT color="green">159</FONT>        public double evaluate(final double[] values, final double[] weights,<a name="line.159"></a>
+<FONT color="green">160</FONT>                               final int begin, final int length) {<a name="line.160"></a>
+<FONT color="green">161</FONT>            double product = Double.NaN;<a name="line.161"></a>
+<FONT color="green">162</FONT>            if (test(values, weights, begin, length)) {<a name="line.162"></a>
+<FONT color="green">163</FONT>                product = 1.0;<a name="line.163"></a>
+<FONT color="green">164</FONT>                for (int i = begin; i &lt; begin + length; i++) {<a name="line.164"></a>
+<FONT color="green">165</FONT>                    product *= Math.pow(values[i], weights[i]);<a name="line.165"></a>
+<FONT color="green">166</FONT>                }<a name="line.166"></a>
+<FONT color="green">167</FONT>            }<a name="line.167"></a>
+<FONT color="green">168</FONT>            return product;<a name="line.168"></a>
+<FONT color="green">169</FONT>        }<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>        /**<a name="line.171"></a>
+<FONT color="green">172</FONT>         * &lt;p&gt;Returns the weighted product of the entries in the input array.&lt;/p&gt;<a name="line.172"></a>
+<FONT color="green">173</FONT>         *<a name="line.173"></a>
+<FONT color="green">174</FONT>         * &lt;p&gt;Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if any of the following are true:<a name="line.174"></a>
+<FONT color="green">175</FONT>         * &lt;ul&gt;&lt;li&gt;the values array is null&lt;/li&gt;<a name="line.175"></a>
+<FONT color="green">176</FONT>         *     &lt;li&gt;the weights array is null&lt;/li&gt;<a name="line.176"></a>
+<FONT color="green">177</FONT>         *     &lt;li&gt;the weights array does not have the same length as the values array&lt;/li&gt;<a name="line.177"></a>
+<FONT color="green">178</FONT>         *     &lt;li&gt;the weights array contains one or more infinite values&lt;/li&gt;<a name="line.178"></a>
+<FONT color="green">179</FONT>         *     &lt;li&gt;the weights array contains one or more NaN values&lt;/li&gt;<a name="line.179"></a>
+<FONT color="green">180</FONT>         *     &lt;li&gt;the weights array contains negative values&lt;/li&gt;<a name="line.180"></a>
+<FONT color="green">181</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.181"></a>
+<FONT color="green">182</FONT>         *<a name="line.182"></a>
+<FONT color="green">183</FONT>         * &lt;p&gt;Uses the formula, &lt;pre&gt;<a name="line.183"></a>
+<FONT color="green">184</FONT>         *    weighted product = &amp;prod;values[i]&lt;sup&gt;weights[i]&lt;/sup&gt;<a name="line.184"></a>
+<FONT color="green">185</FONT>         * &lt;/pre&gt;<a name="line.185"></a>
+<FONT color="green">186</FONT>         * that is, the weights are applied as exponents when computing the weighted product.&lt;/p&gt;<a name="line.186"></a>
+<FONT color="green">187</FONT>         *<a name="line.187"></a>
+<FONT color="green">188</FONT>         * @param values the input array<a name="line.188"></a>
+<FONT color="green">189</FONT>         * @param weights the weights array<a name="line.189"></a>
+<FONT color="green">190</FONT>         * @return the product of the values or Double.NaN if length = 0<a name="line.190"></a>
+<FONT color="green">191</FONT>         * @throws IllegalArgumentException if the parameters are not valid<a name="line.191"></a>
+<FONT color="green">192</FONT>         * @since 2.1<a name="line.192"></a>
+<FONT color="green">193</FONT>         */<a name="line.193"></a>
+<FONT color="green">194</FONT>        public double evaluate(final double[] values, final double[] weights) {<a name="line.194"></a>
+<FONT color="green">195</FONT>            return evaluate(values, weights, 0, values.length);<a name="line.195"></a>
+<FONT color="green">196</FONT>        }<a name="line.196"></a>
+<FONT color="green">197</FONT>    <a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>        /**<a name="line.199"></a>
+<FONT color="green">200</FONT>         * {@inheritDoc}<a name="line.200"></a>
+<FONT color="green">201</FONT>         */<a name="line.201"></a>
+<FONT color="green">202</FONT>        @Override<a name="line.202"></a>
+<FONT color="green">203</FONT>        public Product copy() {<a name="line.203"></a>
+<FONT color="green">204</FONT>            Product result = new Product();<a name="line.204"></a>
+<FONT color="green">205</FONT>            copy(this, result);<a name="line.205"></a>
+<FONT color="green">206</FONT>            return result;<a name="line.206"></a>
+<FONT color="green">207</FONT>        }<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>        /**<a name="line.209"></a>
+<FONT color="green">210</FONT>         * Copies source to dest.<a name="line.210"></a>
+<FONT color="green">211</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.211"></a>
+<FONT color="green">212</FONT>         *<a name="line.212"></a>
+<FONT color="green">213</FONT>         * @param source Product to copy<a name="line.213"></a>
+<FONT color="green">214</FONT>         * @param dest Product to copy to<a name="line.214"></a>
+<FONT color="green">215</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.215"></a>
+<FONT color="green">216</FONT>         */<a name="line.216"></a>
+<FONT color="green">217</FONT>        public static void copy(Product source, Product dest) {<a name="line.217"></a>
+<FONT color="green">218</FONT>            dest.n = source.n;<a name="line.218"></a>
+<FONT color="green">219</FONT>            dest.value = source.value;<a name="line.219"></a>
+<FONT color="green">220</FONT>        }<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>    }<a name="line.222"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/summary/Sum.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,285 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.summary;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>      * Returns the sum of the available values.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * If there are no values in the dataset, or any of the values are<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;code&gt;NaN&lt;/code&gt;, then &lt;code&gt;NaN&lt;/code&gt; is returned.&lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;strong&gt;Note that this implementation is not synchronized.&lt;/strong&gt; If<a name="line.30"></a>
+<FONT color="green">031</FONT>     * multiple threads access an instance of this class concurrently, and at least<a name="line.31"></a>
+<FONT color="green">032</FONT>     * one of the threads invokes the &lt;code&gt;increment()&lt;/code&gt; or<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;code&gt;clear()&lt;/code&gt; method, it must be synchronized externally.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     *<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @version $Revision: 917270 $ $Date: 2010-02-28 14:37:53 -0500 (Sun, 28 Feb 2010) $<a name="line.35"></a>
+<FONT color="green">036</FONT>     */<a name="line.36"></a>
+<FONT color="green">037</FONT>    public class Sum extends AbstractStorelessUnivariateStatistic implements Serializable {<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Serializable version identifier */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private static final long serialVersionUID = -8231831954703408316L;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** */<a name="line.42"></a>
+<FONT color="green">043</FONT>        private long n;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**<a name="line.45"></a>
+<FONT color="green">046</FONT>         * The currently running sum.<a name="line.46"></a>
+<FONT color="green">047</FONT>         */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private double value;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Create a Sum instance<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        public Sum() {<a name="line.53"></a>
+<FONT color="green">054</FONT>            n = 0;<a name="line.54"></a>
+<FONT color="green">055</FONT>            value = Double.NaN;<a name="line.55"></a>
+<FONT color="green">056</FONT>        }<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /**<a name="line.58"></a>
+<FONT color="green">059</FONT>         * Copy constructor, creates a new {@code Sum} identical<a name="line.59"></a>
+<FONT color="green">060</FONT>         * to the {@code original}<a name="line.60"></a>
+<FONT color="green">061</FONT>         *<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param original the {@code Sum} instance to copy<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public Sum(Sum original) {<a name="line.64"></a>
+<FONT color="green">065</FONT>            copy(original, this);<a name="line.65"></a>
+<FONT color="green">066</FONT>        }<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /**<a name="line.68"></a>
+<FONT color="green">069</FONT>         * {@inheritDoc}<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        @Override<a name="line.71"></a>
+<FONT color="green">072</FONT>        public void increment(final double d) {<a name="line.72"></a>
+<FONT color="green">073</FONT>            if (n == 0) {<a name="line.73"></a>
+<FONT color="green">074</FONT>                value = d;<a name="line.74"></a>
+<FONT color="green">075</FONT>            } else {<a name="line.75"></a>
+<FONT color="green">076</FONT>                value += d;<a name="line.76"></a>
+<FONT color="green">077</FONT>            }<a name="line.77"></a>
+<FONT color="green">078</FONT>            n++;<a name="line.78"></a>
+<FONT color="green">079</FONT>        }<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /**<a name="line.81"></a>
+<FONT color="green">082</FONT>         * {@inheritDoc}<a name="line.82"></a>
+<FONT color="green">083</FONT>         */<a name="line.83"></a>
+<FONT color="green">084</FONT>        @Override<a name="line.84"></a>
+<FONT color="green">085</FONT>        public double getResult() {<a name="line.85"></a>
+<FONT color="green">086</FONT>            return value;<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /**<a name="line.89"></a>
+<FONT color="green">090</FONT>         * {@inheritDoc}<a name="line.90"></a>
+<FONT color="green">091</FONT>         */<a name="line.91"></a>
+<FONT color="green">092</FONT>        public long getN() {<a name="line.92"></a>
+<FONT color="green">093</FONT>            return n;<a name="line.93"></a>
+<FONT color="green">094</FONT>        }<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /**<a name="line.96"></a>
+<FONT color="green">097</FONT>         * {@inheritDoc}<a name="line.97"></a>
+<FONT color="green">098</FONT>         */<a name="line.98"></a>
+<FONT color="green">099</FONT>        @Override<a name="line.99"></a>
+<FONT color="green">100</FONT>        public void clear() {<a name="line.100"></a>
+<FONT color="green">101</FONT>            value = Double.NaN;<a name="line.101"></a>
+<FONT color="green">102</FONT>            n = 0;<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /**<a name="line.105"></a>
+<FONT color="green">106</FONT>         * The sum of the entries in the specified portion of<a name="line.106"></a>
+<FONT color="green">107</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.107"></a>
+<FONT color="green">108</FONT>         * is empty.<a name="line.108"></a>
+<FONT color="green">109</FONT>         * &lt;p&gt;<a name="line.109"></a>
+<FONT color="green">110</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.110"></a>
+<FONT color="green">111</FONT>         *<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @param values the input array<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param begin index of the first array element to include<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param length the number of elements to include<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @return the sum of the values or Double.NaN if length = 0<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.116"></a>
+<FONT color="green">117</FONT>         *  parameters are not valid<a name="line.117"></a>
+<FONT color="green">118</FONT>         */<a name="line.118"></a>
+<FONT color="green">119</FONT>        @Override<a name="line.119"></a>
+<FONT color="green">120</FONT>        public double evaluate(final double[] values, final int begin, final int length) {<a name="line.120"></a>
+<FONT color="green">121</FONT>            double sum = Double.NaN;<a name="line.121"></a>
+<FONT color="green">122</FONT>            if (test(values, begin, length)) {<a name="line.122"></a>
+<FONT color="green">123</FONT>                sum = 0.0;<a name="line.123"></a>
+<FONT color="green">124</FONT>                for (int i = begin; i &lt; begin + length; i++) {<a name="line.124"></a>
+<FONT color="green">125</FONT>                    sum += values[i];<a name="line.125"></a>
+<FONT color="green">126</FONT>                }<a name="line.126"></a>
+<FONT color="green">127</FONT>            }<a name="line.127"></a>
+<FONT color="green">128</FONT>            return sum;<a name="line.128"></a>
+<FONT color="green">129</FONT>        }<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>        /**<a name="line.131"></a>
+<FONT color="green">132</FONT>         * The weighted sum of the entries in the specified portion of<a name="line.132"></a>
+<FONT color="green">133</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.133"></a>
+<FONT color="green">134</FONT>         * is empty.<a name="line.134"></a>
+<FONT color="green">135</FONT>         * &lt;p&gt;<a name="line.135"></a>
+<FONT color="green">136</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if any of the following are true:<a name="line.136"></a>
+<FONT color="green">137</FONT>         * &lt;ul&gt;&lt;li&gt;the values array is null&lt;/li&gt;<a name="line.137"></a>
+<FONT color="green">138</FONT>         *     &lt;li&gt;the weights array is null&lt;/li&gt;<a name="line.138"></a>
+<FONT color="green">139</FONT>         *     &lt;li&gt;the weights array does not have the same length as the values array&lt;/li&gt;<a name="line.139"></a>
+<FONT color="green">140</FONT>         *     &lt;li&gt;the weights array contains one or more infinite values&lt;/li&gt;<a name="line.140"></a>
+<FONT color="green">141</FONT>         *     &lt;li&gt;the weights array contains one or more NaN values&lt;/li&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>         *     &lt;li&gt;the weights array contains negative values&lt;/li&gt;<a name="line.142"></a>
+<FONT color="green">143</FONT>         *     &lt;li&gt;the start and length arguments do not determine a valid array&lt;/li&gt;<a name="line.143"></a>
+<FONT color="green">144</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.144"></a>
+<FONT color="green">145</FONT>         * &lt;p&gt;<a name="line.145"></a>
+<FONT color="green">146</FONT>         * Uses the formula, &lt;pre&gt;<a name="line.146"></a>
+<FONT color="green">147</FONT>         *    weighted sum = &amp;Sigma;(values[i] * weights[i])<a name="line.147"></a>
+<FONT color="green">148</FONT>         * &lt;/pre&gt;&lt;/p&gt;<a name="line.148"></a>
+<FONT color="green">149</FONT>         *<a name="line.149"></a>
+<FONT color="green">150</FONT>         * @param values the input array<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @param weights the weights array<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @param begin index of the first array element to include<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @param length the number of elements to include<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @return the sum of the values or Double.NaN if length = 0<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @throws IllegalArgumentException if the parameters are not valid<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @since 2.1<a name="line.156"></a>
+<FONT color="green">157</FONT>         */<a name="line.157"></a>
+<FONT color="green">158</FONT>        public double evaluate(final double[] values, final double[] weights,<a name="line.158"></a>
+<FONT color="green">159</FONT>                               final int begin, final int length) {<a name="line.159"></a>
+<FONT color="green">160</FONT>            double sum = Double.NaN;<a name="line.160"></a>
+<FONT color="green">161</FONT>            if (test(values, weights, begin, length)) {<a name="line.161"></a>
+<FONT color="green">162</FONT>                sum = 0.0;<a name="line.162"></a>
+<FONT color="green">163</FONT>                for (int i = begin; i &lt; begin + length; i++) {<a name="line.163"></a>
+<FONT color="green">164</FONT>                    sum += values[i] * weights[i];<a name="line.164"></a>
+<FONT color="green">165</FONT>                }<a name="line.165"></a>
+<FONT color="green">166</FONT>            }<a name="line.166"></a>
+<FONT color="green">167</FONT>            return sum;<a name="line.167"></a>
+<FONT color="green">168</FONT>        }<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>        /**<a name="line.170"></a>
+<FONT color="green">171</FONT>         * The weighted sum of the entries in the the input array.<a name="line.171"></a>
+<FONT color="green">172</FONT>         * &lt;p&gt;<a name="line.172"></a>
+<FONT color="green">173</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if any of the following are true:<a name="line.173"></a>
+<FONT color="green">174</FONT>         * &lt;ul&gt;&lt;li&gt;the values array is null&lt;/li&gt;<a name="line.174"></a>
+<FONT color="green">175</FONT>         *     &lt;li&gt;the weights array is null&lt;/li&gt;<a name="line.175"></a>
+<FONT color="green">176</FONT>         *     &lt;li&gt;the weights array does not have the same length as the values array&lt;/li&gt;<a name="line.176"></a>
+<FONT color="green">177</FONT>         *     &lt;li&gt;the weights array contains one or more infinite values&lt;/li&gt;<a name="line.177"></a>
+<FONT color="green">178</FONT>         *     &lt;li&gt;the weights array contains one or more NaN values&lt;/li&gt;<a name="line.178"></a>
+<FONT color="green">179</FONT>         *     &lt;li&gt;the weights array contains negative values&lt;/li&gt;<a name="line.179"></a>
+<FONT color="green">180</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.180"></a>
+<FONT color="green">181</FONT>         * &lt;p&gt;<a name="line.181"></a>
+<FONT color="green">182</FONT>         * Uses the formula, &lt;pre&gt;<a name="line.182"></a>
+<FONT color="green">183</FONT>         *    weighted sum = &amp;Sigma;(values[i] * weights[i])<a name="line.183"></a>
+<FONT color="green">184</FONT>         * &lt;/pre&gt;&lt;/p&gt;<a name="line.184"></a>
+<FONT color="green">185</FONT>         *<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @param values the input array<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @param weights the weights array<a name="line.187"></a>
+<FONT color="green">188</FONT>         * @return the sum of the values or Double.NaN if length = 0<a name="line.188"></a>
+<FONT color="green">189</FONT>         * @throws IllegalArgumentException if the parameters are not valid<a name="line.189"></a>
+<FONT color="green">190</FONT>         * @since 2.1<a name="line.190"></a>
+<FONT color="green">191</FONT>         */<a name="line.191"></a>
+<FONT color="green">192</FONT>        public double evaluate(final double[] values, final double[] weights) {<a name="line.192"></a>
+<FONT color="green">193</FONT>            return evaluate(values, weights, 0, values.length);<a name="line.193"></a>
+<FONT color="green">194</FONT>        }<a name="line.194"></a>
+<FONT color="green">195</FONT>    <a name="line.195"></a>
+<FONT color="green">196</FONT>        /**<a name="line.196"></a>
+<FONT color="green">197</FONT>         * {@inheritDoc}<a name="line.197"></a>
+<FONT color="green">198</FONT>         */<a name="line.198"></a>
+<FONT color="green">199</FONT>        @Override<a name="line.199"></a>
+<FONT color="green">200</FONT>        public Sum copy() {<a name="line.200"></a>
+<FONT color="green">201</FONT>            Sum result = new Sum();<a name="line.201"></a>
+<FONT color="green">202</FONT>            copy(this, result);<a name="line.202"></a>
+<FONT color="green">203</FONT>            return result;<a name="line.203"></a>
+<FONT color="green">204</FONT>        }<a name="line.204"></a>
+<FONT color="green">205</FONT>    <a name="line.205"></a>
+<FONT color="green">206</FONT>        /**<a name="line.206"></a>
+<FONT color="green">207</FONT>         * Copies source to dest.<a name="line.207"></a>
+<FONT color="green">208</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.208"></a>
+<FONT color="green">209</FONT>         *<a name="line.209"></a>
+<FONT color="green">210</FONT>         * @param source Sum to copy<a name="line.210"></a>
+<FONT color="green">211</FONT>         * @param dest Sum to copy to<a name="line.211"></a>
+<FONT color="green">212</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.212"></a>
+<FONT color="green">213</FONT>         */<a name="line.213"></a>
+<FONT color="green">214</FONT>        public static void copy(Sum source, Sum dest) {<a name="line.214"></a>
+<FONT color="green">215</FONT>            dest.n = source.n;<a name="line.215"></a>
+<FONT color="green">216</FONT>            dest.value = source.value;<a name="line.216"></a>
+<FONT color="green">217</FONT>        }<a name="line.217"></a>
+<FONT color="green">218</FONT>    <a name="line.218"></a>
+<FONT color="green">219</FONT>    }<a name="line.219"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/summary/SumOfLogs.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,229 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.summary;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Returns the sum of the natural logs for this collection of values.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Uses {@link java.lang.Math#log(double)} to compute the logs.  Therefore,<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;ul&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;li&gt;If any of values are &lt; 0, the result is &lt;code&gt;NaN.&lt;/code&gt;&lt;/li&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;li&gt;If all values are non-negative and less than<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt;,  but at least one value is 0, the<a name="line.30"></a>
+<FONT color="green">031</FONT>     * result is &lt;code&gt;Double.NEGATIVE_INFINITY.&lt;/code&gt;&lt;/li&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;li&gt;If both &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt; and<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;code&gt;Double.NEGATIVE_INFINITY&lt;/code&gt; are among the values, the result is<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;code&gt;NaN.&lt;/code&gt;&lt;/li&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * &lt;/ul&gt;&lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;strong&gt;Note that this implementation is not synchronized.&lt;/strong&gt; If<a name="line.37"></a>
+<FONT color="green">038</FONT>     * multiple threads access an instance of this class concurrently, and at least<a name="line.38"></a>
+<FONT color="green">039</FONT>     * one of the threads invokes the &lt;code&gt;increment()&lt;/code&gt; or<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;code&gt;clear()&lt;/code&gt; method, it must be synchronized externally.&lt;/p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     *<a name="line.41"></a>
+<FONT color="green">042</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.42"></a>
+<FONT color="green">043</FONT>     */<a name="line.43"></a>
+<FONT color="green">044</FONT>    public class SumOfLogs extends AbstractStorelessUnivariateStatistic implements Serializable {<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** Serializable version identifier */<a name="line.46"></a>
+<FONT color="green">047</FONT>        private static final long serialVersionUID = -370076995648386763L;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /**Number of values that have been added */<a name="line.49"></a>
+<FONT color="green">050</FONT>        private int n;<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * The currently running value<a name="line.53"></a>
+<FONT color="green">054</FONT>         */<a name="line.54"></a>
+<FONT color="green">055</FONT>        private double value;<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /**<a name="line.57"></a>
+<FONT color="green">058</FONT>         * Create a SumOfLogs instance<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        public SumOfLogs() {<a name="line.60"></a>
+<FONT color="green">061</FONT>           value = 0d;<a name="line.61"></a>
+<FONT color="green">062</FONT>           n = 0;<a name="line.62"></a>
+<FONT color="green">063</FONT>        }<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /**<a name="line.65"></a>
+<FONT color="green">066</FONT>         * Copy constructor, creates a new {@code SumOfLogs} identical<a name="line.66"></a>
+<FONT color="green">067</FONT>         * to the {@code original}<a name="line.67"></a>
+<FONT color="green">068</FONT>         *<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @param original the {@code SumOfLogs} instance to copy<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        public SumOfLogs(SumOfLogs original) {<a name="line.71"></a>
+<FONT color="green">072</FONT>            copy(original, this);<a name="line.72"></a>
+<FONT color="green">073</FONT>        }<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /**<a name="line.75"></a>
+<FONT color="green">076</FONT>         * {@inheritDoc}<a name="line.76"></a>
+<FONT color="green">077</FONT>         */<a name="line.77"></a>
+<FONT color="green">078</FONT>        @Override<a name="line.78"></a>
+<FONT color="green">079</FONT>        public void increment(final double d) {<a name="line.79"></a>
+<FONT color="green">080</FONT>            value += Math.log(d);<a name="line.80"></a>
+<FONT color="green">081</FONT>            n++;<a name="line.81"></a>
+<FONT color="green">082</FONT>        }<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /**<a name="line.84"></a>
+<FONT color="green">085</FONT>         * {@inheritDoc}<a name="line.85"></a>
+<FONT color="green">086</FONT>         */<a name="line.86"></a>
+<FONT color="green">087</FONT>        @Override<a name="line.87"></a>
+<FONT color="green">088</FONT>        public double getResult() {<a name="line.88"></a>
+<FONT color="green">089</FONT>            if (n &gt; 0) {<a name="line.89"></a>
+<FONT color="green">090</FONT>                return value;<a name="line.90"></a>
+<FONT color="green">091</FONT>            } else {<a name="line.91"></a>
+<FONT color="green">092</FONT>                return Double.NaN;<a name="line.92"></a>
+<FONT color="green">093</FONT>            }<a name="line.93"></a>
+<FONT color="green">094</FONT>        }<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>        /**<a name="line.96"></a>
+<FONT color="green">097</FONT>         * {@inheritDoc}<a name="line.97"></a>
+<FONT color="green">098</FONT>         */<a name="line.98"></a>
+<FONT color="green">099</FONT>        public long getN() {<a name="line.99"></a>
+<FONT color="green">100</FONT>            return n;<a name="line.100"></a>
+<FONT color="green">101</FONT>        }<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        /**<a name="line.103"></a>
+<FONT color="green">104</FONT>         * {@inheritDoc}<a name="line.104"></a>
+<FONT color="green">105</FONT>         */<a name="line.105"></a>
+<FONT color="green">106</FONT>        @Override<a name="line.106"></a>
+<FONT color="green">107</FONT>        public void clear() {<a name="line.107"></a>
+<FONT color="green">108</FONT>            value = 0d;<a name="line.108"></a>
+<FONT color="green">109</FONT>            n = 0;<a name="line.109"></a>
+<FONT color="green">110</FONT>        }<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>        /**<a name="line.112"></a>
+<FONT color="green">113</FONT>         * Returns the sum of the natural logs of the entries in the specified portion of<a name="line.113"></a>
+<FONT color="green">114</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.114"></a>
+<FONT color="green">115</FONT>         * is empty.<a name="line.115"></a>
+<FONT color="green">116</FONT>         * &lt;p&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>         * &lt;p&gt;<a name="line.118"></a>
+<FONT color="green">119</FONT>         * See {@link SumOfLogs}.&lt;/p&gt;<a name="line.119"></a>
+<FONT color="green">120</FONT>         *<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @param values the input array<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @param begin index of the first array element to include<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @param length the number of elements to include<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @return the sum of the natural logs of the values or Double.NaN if<a name="line.124"></a>
+<FONT color="green">125</FONT>         * length = 0<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.126"></a>
+<FONT color="green">127</FONT>         *  parameters are not valid<a name="line.127"></a>
+<FONT color="green">128</FONT>         */<a name="line.128"></a>
+<FONT color="green">129</FONT>        @Override<a name="line.129"></a>
+<FONT color="green">130</FONT>        public double evaluate(final double[] values, final int begin, final int length) {<a name="line.130"></a>
+<FONT color="green">131</FONT>            double sumLog = Double.NaN;<a name="line.131"></a>
+<FONT color="green">132</FONT>            if (test(values, begin, length)) {<a name="line.132"></a>
+<FONT color="green">133</FONT>                sumLog = 0.0;<a name="line.133"></a>
+<FONT color="green">134</FONT>                for (int i = begin; i &lt; begin + length; i++) {<a name="line.134"></a>
+<FONT color="green">135</FONT>                    sumLog += Math.log(values[i]);<a name="line.135"></a>
+<FONT color="green">136</FONT>                }<a name="line.136"></a>
+<FONT color="green">137</FONT>            }<a name="line.137"></a>
+<FONT color="green">138</FONT>            return sumLog;<a name="line.138"></a>
+<FONT color="green">139</FONT>        }<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>        /**<a name="line.141"></a>
+<FONT color="green">142</FONT>         * {@inheritDoc}<a name="line.142"></a>
+<FONT color="green">143</FONT>         */<a name="line.143"></a>
+<FONT color="green">144</FONT>        @Override<a name="line.144"></a>
+<FONT color="green">145</FONT>        public SumOfLogs copy() {<a name="line.145"></a>
+<FONT color="green">146</FONT>            SumOfLogs result = new SumOfLogs();<a name="line.146"></a>
+<FONT color="green">147</FONT>            copy(this, result);<a name="line.147"></a>
+<FONT color="green">148</FONT>            return result;<a name="line.148"></a>
+<FONT color="green">149</FONT>        }<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>        /**<a name="line.151"></a>
+<FONT color="green">152</FONT>         * Copies source to dest.<a name="line.152"></a>
+<FONT color="green">153</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.153"></a>
+<FONT color="green">154</FONT>         *<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @param source SumOfLogs to copy<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @param dest SumOfLogs to copy to<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.157"></a>
+<FONT color="green">158</FONT>         */<a name="line.158"></a>
+<FONT color="green">159</FONT>        public static void copy(SumOfLogs source, SumOfLogs dest) {<a name="line.159"></a>
+<FONT color="green">160</FONT>            dest.n = source.n;<a name="line.160"></a>
+<FONT color="green">161</FONT>            dest.value = source.value;<a name="line.161"></a>
+<FONT color="green">162</FONT>        }<a name="line.162"></a>
+<FONT color="green">163</FONT>    }<a name="line.163"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/descriptive/summary/SumOfSquares.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,219 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.descriptive.summary;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Returns the sum of the squares of the available values.<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * If there are no values in the dataset, or any of the values are<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;code&gt;NaN&lt;/code&gt;, then &lt;code&gt;NaN&lt;/code&gt; is returned.&lt;/p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;strong&gt;Note that this implementation is not synchronized.&lt;/strong&gt; If<a name="line.29"></a>
+<FONT color="green">030</FONT>     * multiple threads access an instance of this class concurrently, and at least<a name="line.30"></a>
+<FONT color="green">031</FONT>     * one of the threads invokes the &lt;code&gt;increment()&lt;/code&gt; or<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;code&gt;clear()&lt;/code&gt; method, it must be synchronized externally.&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     *<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.34"></a>
+<FONT color="green">035</FONT>     */<a name="line.35"></a>
+<FONT color="green">036</FONT>    public class SumOfSquares extends AbstractStorelessUnivariateStatistic implements Serializable {<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Serializable version identifier */<a name="line.38"></a>
+<FONT color="green">039</FONT>        private static final long serialVersionUID = 1460986908574398008L;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** */<a name="line.41"></a>
+<FONT color="green">042</FONT>        private long n;<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /**<a name="line.44"></a>
+<FONT color="green">045</FONT>         * The currently running sumSq<a name="line.45"></a>
+<FONT color="green">046</FONT>         */<a name="line.46"></a>
+<FONT color="green">047</FONT>        private double value;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /**<a name="line.49"></a>
+<FONT color="green">050</FONT>         * Create a SumOfSquares instance<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        public SumOfSquares() {<a name="line.52"></a>
+<FONT color="green">053</FONT>            n = 0;<a name="line.53"></a>
+<FONT color="green">054</FONT>            value = Double.NaN;<a name="line.54"></a>
+<FONT color="green">055</FONT>        }<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /**<a name="line.57"></a>
+<FONT color="green">058</FONT>         * Copy constructor, creates a new {@code SumOfSquares} identical<a name="line.58"></a>
+<FONT color="green">059</FONT>         * to the {@code original}<a name="line.59"></a>
+<FONT color="green">060</FONT>         *<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param original the {@code SumOfSquares} instance to copy<a name="line.61"></a>
+<FONT color="green">062</FONT>         */<a name="line.62"></a>
+<FONT color="green">063</FONT>        public SumOfSquares(SumOfSquares original) {<a name="line.63"></a>
+<FONT color="green">064</FONT>            copy(original, this);<a name="line.64"></a>
+<FONT color="green">065</FONT>        }<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /**<a name="line.67"></a>
+<FONT color="green">068</FONT>         * {@inheritDoc}<a name="line.68"></a>
+<FONT color="green">069</FONT>         */<a name="line.69"></a>
+<FONT color="green">070</FONT>        @Override<a name="line.70"></a>
+<FONT color="green">071</FONT>        public void increment(final double d) {<a name="line.71"></a>
+<FONT color="green">072</FONT>            if (n == 0) {<a name="line.72"></a>
+<FONT color="green">073</FONT>                value = d * d;<a name="line.73"></a>
+<FONT color="green">074</FONT>            } else {<a name="line.74"></a>
+<FONT color="green">075</FONT>                value += d * d;<a name="line.75"></a>
+<FONT color="green">076</FONT>            }<a name="line.76"></a>
+<FONT color="green">077</FONT>            n++;<a name="line.77"></a>
+<FONT color="green">078</FONT>        }<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /**<a name="line.80"></a>
+<FONT color="green">081</FONT>         * {@inheritDoc}<a name="line.81"></a>
+<FONT color="green">082</FONT>         */<a name="line.82"></a>
+<FONT color="green">083</FONT>        @Override<a name="line.83"></a>
+<FONT color="green">084</FONT>        public double getResult() {<a name="line.84"></a>
+<FONT color="green">085</FONT>            return value;<a name="line.85"></a>
+<FONT color="green">086</FONT>        }<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>        /**<a name="line.88"></a>
+<FONT color="green">089</FONT>         * {@inheritDoc}<a name="line.89"></a>
+<FONT color="green">090</FONT>         */<a name="line.90"></a>
+<FONT color="green">091</FONT>        public long getN() {<a name="line.91"></a>
+<FONT color="green">092</FONT>            return n;<a name="line.92"></a>
+<FONT color="green">093</FONT>        }<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /**<a name="line.95"></a>
+<FONT color="green">096</FONT>         * {@inheritDoc}<a name="line.96"></a>
+<FONT color="green">097</FONT>         */<a name="line.97"></a>
+<FONT color="green">098</FONT>        @Override<a name="line.98"></a>
+<FONT color="green">099</FONT>        public void clear() {<a name="line.99"></a>
+<FONT color="green">100</FONT>            value = Double.NaN;<a name="line.100"></a>
+<FONT color="green">101</FONT>            n = 0;<a name="line.101"></a>
+<FONT color="green">102</FONT>        }<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /**<a name="line.104"></a>
+<FONT color="green">105</FONT>         * Returns the sum of the squares of the entries in the specified portion of<a name="line.105"></a>
+<FONT color="green">106</FONT>         * the input array, or &lt;code&gt;Double.NaN&lt;/code&gt; if the designated subarray<a name="line.106"></a>
+<FONT color="green">107</FONT>         * is empty.<a name="line.107"></a>
+<FONT color="green">108</FONT>         * &lt;p&gt;<a name="line.108"></a>
+<FONT color="green">109</FONT>         * Throws &lt;code&gt;IllegalArgumentException&lt;/code&gt; if the array is null.&lt;/p&gt;<a name="line.109"></a>
+<FONT color="green">110</FONT>         *<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @param values the input array<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @param begin index of the first array element to include<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param length the number of elements to include<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @return the sum of the squares of the values or Double.NaN if length = 0<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @throws IllegalArgumentException if the array is null or the array index<a name="line.115"></a>
+<FONT color="green">116</FONT>         *  parameters are not valid<a name="line.116"></a>
+<FONT color="green">117</FONT>         */<a name="line.117"></a>
+<FONT color="green">118</FONT>        @Override<a name="line.118"></a>
+<FONT color="green">119</FONT>        public double evaluate(final double[] values,final int begin, final int length) {<a name="line.119"></a>
+<FONT color="green">120</FONT>            double sumSq = Double.NaN;<a name="line.120"></a>
+<FONT color="green">121</FONT>            if (test(values, begin, length)) {<a name="line.121"></a>
+<FONT color="green">122</FONT>                sumSq = 0.0;<a name="line.122"></a>
+<FONT color="green">123</FONT>                for (int i = begin; i &lt; begin + length; i++) {<a name="line.123"></a>
+<FONT color="green">124</FONT>                    sumSq += values[i] * values[i];<a name="line.124"></a>
+<FONT color="green">125</FONT>                }<a name="line.125"></a>
+<FONT color="green">126</FONT>            }<a name="line.126"></a>
+<FONT color="green">127</FONT>            return sumSq;<a name="line.127"></a>
+<FONT color="green">128</FONT>        }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /**<a name="line.130"></a>
+<FONT color="green">131</FONT>         * {@inheritDoc}<a name="line.131"></a>
+<FONT color="green">132</FONT>         */<a name="line.132"></a>
+<FONT color="green">133</FONT>        @Override<a name="line.133"></a>
+<FONT color="green">134</FONT>        public SumOfSquares copy() {<a name="line.134"></a>
+<FONT color="green">135</FONT>            SumOfSquares result = new SumOfSquares();<a name="line.135"></a>
+<FONT color="green">136</FONT>            copy(this, result);<a name="line.136"></a>
+<FONT color="green">137</FONT>            return result;<a name="line.137"></a>
+<FONT color="green">138</FONT>        }<a name="line.138"></a>
+<FONT color="green">139</FONT>    <a name="line.139"></a>
+<FONT color="green">140</FONT>        /**<a name="line.140"></a>
+<FONT color="green">141</FONT>         * Copies source to dest.<a name="line.141"></a>
+<FONT color="green">142</FONT>         * &lt;p&gt;Neither source nor dest can be null.&lt;/p&gt;<a name="line.142"></a>
+<FONT color="green">143</FONT>         *<a name="line.143"></a>
+<FONT color="green">144</FONT>         * @param source SumOfSquares to copy<a name="line.144"></a>
+<FONT color="green">145</FONT>         * @param dest SumOfSquares to copy to<a name="line.145"></a>
+<FONT color="green">146</FONT>         * @throws NullPointerException if either source or dest is null<a name="line.146"></a>
+<FONT color="green">147</FONT>         */<a name="line.147"></a>
+<FONT color="green">148</FONT>        public static void copy(SumOfSquares source, SumOfSquares dest) {<a name="line.148"></a>
+<FONT color="green">149</FONT>            dest.n = source.n;<a name="line.149"></a>
+<FONT color="green">150</FONT>            dest.value = source.value;<a name="line.150"></a>
+<FONT color="green">151</FONT>        }<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>    }<a name="line.153"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/inference/ChiSquareTest.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,288 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.inference;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * An interface for Chi-Square tests.<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;p&gt;This interface handles only known distributions. If the distribution is<a name="line.23"></a>
+<FONT color="green">024</FONT>     * unknown and should be provided by a sample, then the {@link UnknownDistributionChiSquareTest<a name="line.24"></a>
+<FONT color="green">025</FONT>     * UnknownDistributionChiSquareTest} extended interface should be used instead.&lt;/p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public interface ChiSquareTest {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>         /**<a name="line.30"></a>
+<FONT color="green">031</FONT>         * Computes the &lt;a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda35f.htm"&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>         * Chi-Square statistic&lt;/a&gt; comparing &lt;code&gt;observed&lt;/code&gt; and &lt;code&gt;expected&lt;/code&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>         * frequency counts.<a name="line.33"></a>
+<FONT color="green">034</FONT>         * &lt;p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>         * This statistic can be used to perform a Chi-Square test evaluating the null hypothesis that<a name="line.35"></a>
+<FONT color="green">036</FONT>         *  the observed counts follow the expected distribution.&lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>         * &lt;p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>         * &lt;li&gt;Expected counts must all be positive.<a name="line.39"></a>
+<FONT color="green">040</FONT>         * &lt;/li&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>         * &lt;li&gt;Observed counts must all be &gt;= 0.<a name="line.41"></a>
+<FONT color="green">042</FONT>         * &lt;/li&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>         * &lt;li&gt;The observed and expected arrays must have the same length and<a name="line.43"></a>
+<FONT color="green">044</FONT>         * their common length must be at least 2.<a name="line.44"></a>
+<FONT color="green">045</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;&lt;p&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>         * If any of the preconditions are not met, an<a name="line.46"></a>
+<FONT color="green">047</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>         *<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @param observed array of observed frequency counts<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @param expected array of expected frequency counts<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @return chiSquare statistic<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @throws IllegalArgumentException if preconditions are not met<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        double chiSquare(double[] expected, long[] observed)<a name="line.54"></a>
+<FONT color="green">055</FONT>            throws IllegalArgumentException;<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /**<a name="line.57"></a>
+<FONT color="green">058</FONT>         * Returns the &lt;i&gt;observed significance level&lt;/i&gt;, or &lt;a href=<a name="line.58"></a>
+<FONT color="green">059</FONT>         * "http://www.cas.lancs.ac.uk/glossary_v1.1/hyptest.html#pvalue"&gt;<a name="line.59"></a>
+<FONT color="green">060</FONT>         * p-value&lt;/a&gt;, associated with a<a name="line.60"></a>
+<FONT color="green">061</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda35f.htm"&gt;<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Chi-square goodness of fit test&lt;/a&gt; comparing the &lt;code&gt;observed&lt;/code&gt;<a name="line.62"></a>
+<FONT color="green">063</FONT>         * frequency counts to those in the &lt;code&gt;expected&lt;/code&gt; array.<a name="line.63"></a>
+<FONT color="green">064</FONT>         * &lt;p&gt;<a name="line.64"></a>
+<FONT color="green">065</FONT>         * The number returned is the smallest significance level at which one can reject<a name="line.65"></a>
+<FONT color="green">066</FONT>         * the null hypothesis that the observed counts conform to the frequency distribution<a name="line.66"></a>
+<FONT color="green">067</FONT>         * described by the expected counts.&lt;/p&gt;<a name="line.67"></a>
+<FONT color="green">068</FONT>         * &lt;p&gt;<a name="line.68"></a>
+<FONT color="green">069</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.69"></a>
+<FONT color="green">070</FONT>         * &lt;li&gt;Expected counts must all be positive.<a name="line.70"></a>
+<FONT color="green">071</FONT>         * &lt;/li&gt;<a name="line.71"></a>
+<FONT color="green">072</FONT>         * &lt;li&gt;Observed counts must all be &gt;= 0.<a name="line.72"></a>
+<FONT color="green">073</FONT>         * &lt;/li&gt;<a name="line.73"></a>
+<FONT color="green">074</FONT>         * &lt;li&gt;The observed and expected arrays must have the same length and<a name="line.74"></a>
+<FONT color="green">075</FONT>         * their common length must be at least 2.<a name="line.75"></a>
+<FONT color="green">076</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;&lt;p&gt;<a name="line.76"></a>
+<FONT color="green">077</FONT>         * If any of the preconditions are not met, an<a name="line.77"></a>
+<FONT color="green">078</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.78"></a>
+<FONT color="green">079</FONT>         *<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @param observed array of observed frequency counts<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @param expected array of expected frequency counts<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @return p-value<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @throws IllegalArgumentException if preconditions are not met<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.84"></a>
+<FONT color="green">085</FONT>         */<a name="line.85"></a>
+<FONT color="green">086</FONT>        double chiSquareTest(double[] expected, long[] observed)<a name="line.86"></a>
+<FONT color="green">087</FONT>            throws IllegalArgumentException, MathException;<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /**<a name="line.89"></a>
+<FONT color="green">090</FONT>         * Performs a &lt;a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda35f.htm"&gt;<a name="line.90"></a>
+<FONT color="green">091</FONT>         * Chi-square goodness of fit test&lt;/a&gt; evaluating the null hypothesis that the observed counts<a name="line.91"></a>
+<FONT color="green">092</FONT>         * conform to the frequency distribution described by the expected counts, with<a name="line.92"></a>
+<FONT color="green">093</FONT>         * significance level &lt;code&gt;alpha&lt;/code&gt;.  Returns true iff the null hypothesis can be rejected<a name="line.93"></a>
+<FONT color="green">094</FONT>         * with 100 * (1 - alpha) percent confidence.<a name="line.94"></a>
+<FONT color="green">095</FONT>         * &lt;p&gt;<a name="line.95"></a>
+<FONT color="green">096</FONT>         * &lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;<a name="line.96"></a>
+<FONT color="green">097</FONT>         * To test the hypothesis that &lt;code&gt;observed&lt;/code&gt; follows<a name="line.97"></a>
+<FONT color="green">098</FONT>         * &lt;code&gt;expected&lt;/code&gt; at the 99% level, use &lt;/p&gt;&lt;p&gt;<a name="line.98"></a>
+<FONT color="green">099</FONT>         * &lt;code&gt;chiSquareTest(expected, observed, 0.01) &lt;/code&gt;&lt;/p&gt;<a name="line.99"></a>
+<FONT color="green">100</FONT>         * &lt;p&gt;<a name="line.100"></a>
+<FONT color="green">101</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.101"></a>
+<FONT color="green">102</FONT>         * &lt;li&gt;Expected counts must all be positive.<a name="line.102"></a>
+<FONT color="green">103</FONT>         * &lt;/li&gt;<a name="line.103"></a>
+<FONT color="green">104</FONT>         * &lt;li&gt;Observed counts must all be &gt;= 0.<a name="line.104"></a>
+<FONT color="green">105</FONT>         * &lt;/li&gt;<a name="line.105"></a>
+<FONT color="green">106</FONT>         * &lt;li&gt;The observed and expected arrays must have the same length and<a name="line.106"></a>
+<FONT color="green">107</FONT>         * their common length must be at least 2.<a name="line.107"></a>
+<FONT color="green">108</FONT>         * &lt;li&gt; &lt;code&gt; 0 &lt; alpha &lt; 0.5 &lt;/code&gt;<a name="line.108"></a>
+<FONT color="green">109</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;&lt;p&gt;<a name="line.109"></a>
+<FONT color="green">110</FONT>         * If any of the preconditions are not met, an<a name="line.110"></a>
+<FONT color="green">111</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>         *<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param observed array of observed frequency counts<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param expected array of expected frequency counts<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @param alpha significance level of the test<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @return true iff null hypothesis can be rejected with confidence<a name="line.116"></a>
+<FONT color="green">117</FONT>         * 1 - alpha<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @throws IllegalArgumentException if preconditions are not met<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @throws MathException if an error occurs performing the test<a name="line.119"></a>
+<FONT color="green">120</FONT>         */<a name="line.120"></a>
+<FONT color="green">121</FONT>        boolean chiSquareTest(double[] expected, long[] observed, double alpha)<a name="line.121"></a>
+<FONT color="green">122</FONT>            throws IllegalArgumentException, MathException;<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>        /**<a name="line.124"></a>
+<FONT color="green">125</FONT>         *  Computes the Chi-Square statistic associated with a<a name="line.125"></a>
+<FONT color="green">126</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/prc/section4/prc45.htm"&gt;<a name="line.126"></a>
+<FONT color="green">127</FONT>         *  chi-square test of independence&lt;/a&gt; based on the input &lt;code&gt;counts&lt;/code&gt;<a name="line.127"></a>
+<FONT color="green">128</FONT>         *  array, viewed as a two-way table.<a name="line.128"></a>
+<FONT color="green">129</FONT>         * &lt;p&gt;<a name="line.129"></a>
+<FONT color="green">130</FONT>         * The rows of the 2-way table are<a name="line.130"></a>
+<FONT color="green">131</FONT>         * &lt;code&gt;count[0], ... , count[count.length - 1] &lt;/code&gt;&lt;/p&gt;<a name="line.131"></a>
+<FONT color="green">132</FONT>         * &lt;p&gt;<a name="line.132"></a>
+<FONT color="green">133</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.133"></a>
+<FONT color="green">134</FONT>         * &lt;li&gt;All counts must be &gt;= 0.<a name="line.134"></a>
+<FONT color="green">135</FONT>         * &lt;/li&gt;<a name="line.135"></a>
+<FONT color="green">136</FONT>         * &lt;li&gt;The count array must be rectangular (i.e. all count[i] subarrays<a name="line.136"></a>
+<FONT color="green">137</FONT>         *  must have the same length).<a name="line.137"></a>
+<FONT color="green">138</FONT>         * &lt;/li&gt;<a name="line.138"></a>
+<FONT color="green">139</FONT>         * &lt;li&gt;The 2-way table represented by &lt;code&gt;counts&lt;/code&gt; must have at<a name="line.139"></a>
+<FONT color="green">140</FONT>         *  least 2 columns and at least 2 rows.<a name="line.140"></a>
+<FONT color="green">141</FONT>         * &lt;/li&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;&lt;p&gt;<a name="line.142"></a>
+<FONT color="green">143</FONT>         * If any of the preconditions are not met, an<a name="line.143"></a>
+<FONT color="green">144</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.144"></a>
+<FONT color="green">145</FONT>         *<a name="line.145"></a>
+<FONT color="green">146</FONT>         * @param counts array representation of 2-way table<a name="line.146"></a>
+<FONT color="green">147</FONT>         * @return chiSquare statistic<a name="line.147"></a>
+<FONT color="green">148</FONT>         * @throws IllegalArgumentException if preconditions are not met<a name="line.148"></a>
+<FONT color="green">149</FONT>         */<a name="line.149"></a>
+<FONT color="green">150</FONT>        double chiSquare(long[][] counts)<a name="line.150"></a>
+<FONT color="green">151</FONT>        throws IllegalArgumentException;<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>        /**<a name="line.153"></a>
+<FONT color="green">154</FONT>         * Returns the &lt;i&gt;observed significance level&lt;/i&gt;, or &lt;a href=<a name="line.154"></a>
+<FONT color="green">155</FONT>         * "http://www.cas.lancs.ac.uk/glossary_v1.1/hyptest.html#pvalue"&gt;<a name="line.155"></a>
+<FONT color="green">156</FONT>         * p-value&lt;/a&gt;, associated with a<a name="line.156"></a>
+<FONT color="green">157</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/prc/section4/prc45.htm"&gt;<a name="line.157"></a>
+<FONT color="green">158</FONT>         * chi-square test of independence&lt;/a&gt; based on the input &lt;code&gt;counts&lt;/code&gt;<a name="line.158"></a>
+<FONT color="green">159</FONT>         * array, viewed as a two-way table.<a name="line.159"></a>
+<FONT color="green">160</FONT>         * &lt;p&gt;<a name="line.160"></a>
+<FONT color="green">161</FONT>         * The rows of the 2-way table are<a name="line.161"></a>
+<FONT color="green">162</FONT>         * &lt;code&gt;count[0], ... , count[count.length - 1] &lt;/code&gt;&lt;/p&gt;<a name="line.162"></a>
+<FONT color="green">163</FONT>         * &lt;p&gt;<a name="line.163"></a>
+<FONT color="green">164</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.164"></a>
+<FONT color="green">165</FONT>         * &lt;li&gt;All counts must be &gt;= 0.<a name="line.165"></a>
+<FONT color="green">166</FONT>         * &lt;/li&gt;<a name="line.166"></a>
+<FONT color="green">167</FONT>         * &lt;li&gt;The count array must be rectangular (i.e. all count[i] subarrays must have the same length).<a name="line.167"></a>
+<FONT color="green">168</FONT>         * &lt;/li&gt;<a name="line.168"></a>
+<FONT color="green">169</FONT>         * &lt;li&gt;The 2-way table represented by &lt;code&gt;counts&lt;/code&gt; must have at least 2 columns and<a name="line.169"></a>
+<FONT color="green">170</FONT>         *        at least 2 rows.<a name="line.170"></a>
+<FONT color="green">171</FONT>         * &lt;/li&gt;<a name="line.171"></a>
+<FONT color="green">172</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;&lt;p&gt;<a name="line.172"></a>
+<FONT color="green">173</FONT>         * If any of the preconditions are not met, an<a name="line.173"></a>
+<FONT color="green">174</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.174"></a>
+<FONT color="green">175</FONT>         *<a name="line.175"></a>
+<FONT color="green">176</FONT>         * @param counts array representation of 2-way table<a name="line.176"></a>
+<FONT color="green">177</FONT>         * @return p-value<a name="line.177"></a>
+<FONT color="green">178</FONT>         * @throws IllegalArgumentException if preconditions are not met<a name="line.178"></a>
+<FONT color="green">179</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.179"></a>
+<FONT color="green">180</FONT>         */<a name="line.180"></a>
+<FONT color="green">181</FONT>        double chiSquareTest(long[][] counts)<a name="line.181"></a>
+<FONT color="green">182</FONT>        throws IllegalArgumentException, MathException;<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>        /**<a name="line.184"></a>
+<FONT color="green">185</FONT>         * Performs a &lt;a href="http://www.itl.nist.gov/div898/handbook/prc/section4/prc45.htm"&gt;<a name="line.185"></a>
+<FONT color="green">186</FONT>         * chi-square test of independence&lt;/a&gt; evaluating the null hypothesis that the classifications<a name="line.186"></a>
+<FONT color="green">187</FONT>         * represented by the counts in the columns of the input 2-way table are independent of the rows,<a name="line.187"></a>
+<FONT color="green">188</FONT>         * with significance level &lt;code&gt;alpha&lt;/code&gt;.  Returns true iff the null hypothesis can be rejected<a name="line.188"></a>
+<FONT color="green">189</FONT>         * with 100 * (1 - alpha) percent confidence.<a name="line.189"></a>
+<FONT color="green">190</FONT>         * &lt;p&gt;<a name="line.190"></a>
+<FONT color="green">191</FONT>         * The rows of the 2-way table are<a name="line.191"></a>
+<FONT color="green">192</FONT>         * &lt;code&gt;count[0], ... , count[count.length - 1] &lt;/code&gt;&lt;/p&gt;<a name="line.192"></a>
+<FONT color="green">193</FONT>         * &lt;p&gt;<a name="line.193"></a>
+<FONT color="green">194</FONT>         * &lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;<a name="line.194"></a>
+<FONT color="green">195</FONT>         * To test the null hypothesis that the counts in<a name="line.195"></a>
+<FONT color="green">196</FONT>         * &lt;code&gt;count[0], ... , count[count.length - 1] &lt;/code&gt;<a name="line.196"></a>
+<FONT color="green">197</FONT>         *  all correspond to the same underlying probability distribution at the 99% level, use &lt;/p&gt;&lt;p&gt;<a name="line.197"></a>
+<FONT color="green">198</FONT>         * &lt;code&gt;chiSquareTest(counts, 0.01) &lt;/code&gt;&lt;/p&gt;<a name="line.198"></a>
+<FONT color="green">199</FONT>         * &lt;p&gt;<a name="line.199"></a>
+<FONT color="green">200</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.200"></a>
+<FONT color="green">201</FONT>         * &lt;li&gt;All counts must be &gt;= 0.<a name="line.201"></a>
+<FONT color="green">202</FONT>         * &lt;/li&gt;<a name="line.202"></a>
+<FONT color="green">203</FONT>         * &lt;li&gt;The count array must be rectangular (i.e. all count[i] subarrays must have the same length).<a name="line.203"></a>
+<FONT color="green">204</FONT>         * &lt;/li&gt;<a name="line.204"></a>
+<FONT color="green">205</FONT>         * &lt;li&gt;The 2-way table represented by &lt;code&gt;counts&lt;/code&gt; must have at least 2 columns and<a name="line.205"></a>
+<FONT color="green">206</FONT>         *        at least 2 rows.<a name="line.206"></a>
+<FONT color="green">207</FONT>         * &lt;/li&gt;<a name="line.207"></a>
+<FONT color="green">208</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;&lt;p&gt;<a name="line.208"></a>
+<FONT color="green">209</FONT>         * If any of the preconditions are not met, an<a name="line.209"></a>
+<FONT color="green">210</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.210"></a>
+<FONT color="green">211</FONT>         *<a name="line.211"></a>
+<FONT color="green">212</FONT>         * @param counts array representation of 2-way table<a name="line.212"></a>
+<FONT color="green">213</FONT>         * @param alpha significance level of the test<a name="line.213"></a>
+<FONT color="green">214</FONT>         * @return true iff null hypothesis can be rejected with confidence<a name="line.214"></a>
+<FONT color="green">215</FONT>         * 1 - alpha<a name="line.215"></a>
+<FONT color="green">216</FONT>         * @throws IllegalArgumentException if preconditions are not met<a name="line.216"></a>
+<FONT color="green">217</FONT>         * @throws MathException if an error occurs performing the test<a name="line.217"></a>
+<FONT color="green">218</FONT>         */<a name="line.218"></a>
+<FONT color="green">219</FONT>        boolean chiSquareTest(long[][] counts, double alpha)<a name="line.219"></a>
+<FONT color="green">220</FONT>        throws IllegalArgumentException, MathException;<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>    }<a name="line.222"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/inference/ChiSquareTestImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,492 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.inference;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.distribution.ChiSquaredDistribution;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.distribution.ChiSquaredDistributionImpl;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Implements Chi-Square test statistics defined in the<a name="line.25"></a>
+<FONT color="green">026</FONT>     * {@link UnknownDistributionChiSquareTest} interface.<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @version $Revision: 811833 $ $Date: 2009-09-06 12:27:50 -0400 (Sun, 06 Sep 2009) $<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public class ChiSquareTestImpl implements UnknownDistributionChiSquareTest {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** Distribution used to compute inference statistics. */<a name="line.32"></a>
+<FONT color="green">033</FONT>        private ChiSquaredDistribution distribution;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /**<a name="line.35"></a>
+<FONT color="green">036</FONT>         * Construct a ChiSquareTestImpl<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        public ChiSquareTestImpl() {<a name="line.38"></a>
+<FONT color="green">039</FONT>            this(new ChiSquaredDistributionImpl(1.0));<a name="line.39"></a>
+<FONT color="green">040</FONT>        }<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /**<a name="line.42"></a>
+<FONT color="green">043</FONT>         * Create a test instance using the given distribution for computing<a name="line.43"></a>
+<FONT color="green">044</FONT>         * inference statistics.<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @param x distribution used to compute inference statistics.<a name="line.45"></a>
+<FONT color="green">046</FONT>         * @since 1.2<a name="line.46"></a>
+<FONT color="green">047</FONT>         */<a name="line.47"></a>
+<FONT color="green">048</FONT>        public ChiSquareTestImpl(ChiSquaredDistribution x) {<a name="line.48"></a>
+<FONT color="green">049</FONT>            super();<a name="line.49"></a>
+<FONT color="green">050</FONT>            setDistribution(x);<a name="line.50"></a>
+<FONT color="green">051</FONT>        }<a name="line.51"></a>
+<FONT color="green">052</FONT>         /**<a name="line.52"></a>
+<FONT color="green">053</FONT>         * {@inheritDoc}<a name="line.53"></a>
+<FONT color="green">054</FONT>         * &lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;This implementation rescales the<a name="line.54"></a>
+<FONT color="green">055</FONT>         * &lt;code&gt;expected&lt;/code&gt; array if necessary to ensure that the sum of the<a name="line.55"></a>
+<FONT color="green">056</FONT>         * expected and observed counts are equal.&lt;/p&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>         *<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @param observed array of observed frequency counts<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @param expected array of expected frequency counts<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @return chi-square test statistic<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @throws IllegalArgumentException if preconditions are not met<a name="line.61"></a>
+<FONT color="green">062</FONT>         * or length is less than 2<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        public double chiSquare(double[] expected, long[] observed)<a name="line.64"></a>
+<FONT color="green">065</FONT>            throws IllegalArgumentException {<a name="line.65"></a>
+<FONT color="green">066</FONT>            if (expected.length &lt; 2) {<a name="line.66"></a>
+<FONT color="green">067</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.67"></a>
+<FONT color="green">068</FONT>                      "expected array length = {0}, must be at least 2",<a name="line.68"></a>
+<FONT color="green">069</FONT>                      expected.length);<a name="line.69"></a>
+<FONT color="green">070</FONT>            }<a name="line.70"></a>
+<FONT color="green">071</FONT>            if (expected.length != observed.length) {<a name="line.71"></a>
+<FONT color="green">072</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.72"></a>
+<FONT color="green">073</FONT>                      "dimension mismatch {0} != {1}", expected.length, observed.length);<a name="line.73"></a>
+<FONT color="green">074</FONT>            }<a name="line.74"></a>
+<FONT color="green">075</FONT>            checkPositive(expected);<a name="line.75"></a>
+<FONT color="green">076</FONT>            checkNonNegative(observed);<a name="line.76"></a>
+<FONT color="green">077</FONT>            double sumExpected = 0d;<a name="line.77"></a>
+<FONT color="green">078</FONT>            double sumObserved = 0d;<a name="line.78"></a>
+<FONT color="green">079</FONT>            for (int i = 0; i &lt; observed.length; i++) {<a name="line.79"></a>
+<FONT color="green">080</FONT>                sumExpected += expected[i];<a name="line.80"></a>
+<FONT color="green">081</FONT>                sumObserved += observed[i];<a name="line.81"></a>
+<FONT color="green">082</FONT>            }<a name="line.82"></a>
+<FONT color="green">083</FONT>            double ratio = 1.0d;<a name="line.83"></a>
+<FONT color="green">084</FONT>            boolean rescale = false;<a name="line.84"></a>
+<FONT color="green">085</FONT>            if (Math.abs(sumExpected - sumObserved) &gt; 10E-6) {<a name="line.85"></a>
+<FONT color="green">086</FONT>                ratio = sumObserved / sumExpected;<a name="line.86"></a>
+<FONT color="green">087</FONT>                rescale = true;<a name="line.87"></a>
+<FONT color="green">088</FONT>            }<a name="line.88"></a>
+<FONT color="green">089</FONT>            double sumSq = 0.0d;<a name="line.89"></a>
+<FONT color="green">090</FONT>            for (int i = 0; i &lt; observed.length; i++) {<a name="line.90"></a>
+<FONT color="green">091</FONT>                if (rescale) {<a name="line.91"></a>
+<FONT color="green">092</FONT>                    final double dev = observed[i] - ratio * expected[i];<a name="line.92"></a>
+<FONT color="green">093</FONT>                    sumSq += dev * dev / (ratio * expected[i]);<a name="line.93"></a>
+<FONT color="green">094</FONT>                } else {<a name="line.94"></a>
+<FONT color="green">095</FONT>                    final double dev = observed[i] - expected[i];<a name="line.95"></a>
+<FONT color="green">096</FONT>                    sumSq += dev * dev / expected[i];<a name="line.96"></a>
+<FONT color="green">097</FONT>                }<a name="line.97"></a>
+<FONT color="green">098</FONT>            }<a name="line.98"></a>
+<FONT color="green">099</FONT>            return sumSq;<a name="line.99"></a>
+<FONT color="green">100</FONT>        }<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>        /**<a name="line.102"></a>
+<FONT color="green">103</FONT>         * {@inheritDoc}<a name="line.103"></a>
+<FONT color="green">104</FONT>         * &lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;This implementation rescales the<a name="line.104"></a>
+<FONT color="green">105</FONT>         * &lt;code&gt;expected&lt;/code&gt; array if necessary to ensure that the sum of the<a name="line.105"></a>
+<FONT color="green">106</FONT>         * expected and observed counts are equal.&lt;/p&gt;<a name="line.106"></a>
+<FONT color="green">107</FONT>         *<a name="line.107"></a>
+<FONT color="green">108</FONT>         * @param observed array of observed frequency counts<a name="line.108"></a>
+<FONT color="green">109</FONT>         * @param expected array of expected frequency counts<a name="line.109"></a>
+<FONT color="green">110</FONT>         * @return p-value<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @throws IllegalArgumentException if preconditions are not met<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.112"></a>
+<FONT color="green">113</FONT>         */<a name="line.113"></a>
+<FONT color="green">114</FONT>        public double chiSquareTest(double[] expected, long[] observed)<a name="line.114"></a>
+<FONT color="green">115</FONT>            throws IllegalArgumentException, MathException {<a name="line.115"></a>
+<FONT color="green">116</FONT>            distribution.setDegreesOfFreedom(expected.length - 1.0);<a name="line.116"></a>
+<FONT color="green">117</FONT>            return 1.0 - distribution.cumulativeProbability(<a name="line.117"></a>
+<FONT color="green">118</FONT>                chiSquare(expected, observed));<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /**<a name="line.121"></a>
+<FONT color="green">122</FONT>         * {@inheritDoc}<a name="line.122"></a>
+<FONT color="green">123</FONT>         * &lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;This implementation rescales the<a name="line.123"></a>
+<FONT color="green">124</FONT>         * &lt;code&gt;expected&lt;/code&gt; array if necessary to ensure that the sum of the<a name="line.124"></a>
+<FONT color="green">125</FONT>         * expected and observed counts are equal.&lt;/p&gt;<a name="line.125"></a>
+<FONT color="green">126</FONT>         *<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @param observed array of observed frequency counts<a name="line.127"></a>
+<FONT color="green">128</FONT>         * @param expected array of expected frequency counts<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @param alpha significance level of the test<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @return true iff null hypothesis can be rejected with confidence<a name="line.130"></a>
+<FONT color="green">131</FONT>         * 1 - alpha<a name="line.131"></a>
+<FONT color="green">132</FONT>         * @throws IllegalArgumentException if preconditions are not met<a name="line.132"></a>
+<FONT color="green">133</FONT>         * @throws MathException if an error occurs performing the test<a name="line.133"></a>
+<FONT color="green">134</FONT>         */<a name="line.134"></a>
+<FONT color="green">135</FONT>        public boolean chiSquareTest(double[] expected, long[] observed,<a name="line.135"></a>
+<FONT color="green">136</FONT>                double alpha) throws IllegalArgumentException, MathException {<a name="line.136"></a>
+<FONT color="green">137</FONT>            if ((alpha &lt;= 0) || (alpha &gt; 0.5)) {<a name="line.137"></a>
+<FONT color="green">138</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.138"></a>
+<FONT color="green">139</FONT>                      "out of bounds significance level {0}, must be between {1} and {2}",<a name="line.139"></a>
+<FONT color="green">140</FONT>                      alpha, 0, 0.5);<a name="line.140"></a>
+<FONT color="green">141</FONT>            }<a name="line.141"></a>
+<FONT color="green">142</FONT>            return chiSquareTest(expected, observed) &lt; alpha;<a name="line.142"></a>
+<FONT color="green">143</FONT>        }<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>        /**<a name="line.145"></a>
+<FONT color="green">146</FONT>         * @param counts array representation of 2-way table<a name="line.146"></a>
+<FONT color="green">147</FONT>         * @return chi-square test statistic<a name="line.147"></a>
+<FONT color="green">148</FONT>         * @throws IllegalArgumentException if preconditions are not met<a name="line.148"></a>
+<FONT color="green">149</FONT>         */<a name="line.149"></a>
+<FONT color="green">150</FONT>        public double chiSquare(long[][] counts) throws IllegalArgumentException {<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>            checkArray(counts);<a name="line.152"></a>
+<FONT color="green">153</FONT>            int nRows = counts.length;<a name="line.153"></a>
+<FONT color="green">154</FONT>            int nCols = counts[0].length;<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>            // compute row, column and total sums<a name="line.156"></a>
+<FONT color="green">157</FONT>            double[] rowSum = new double[nRows];<a name="line.157"></a>
+<FONT color="green">158</FONT>            double[] colSum = new double[nCols];<a name="line.158"></a>
+<FONT color="green">159</FONT>            double total = 0.0d;<a name="line.159"></a>
+<FONT color="green">160</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.160"></a>
+<FONT color="green">161</FONT>                for (int col = 0; col &lt; nCols; col++) {<a name="line.161"></a>
+<FONT color="green">162</FONT>                    rowSum[row] += counts[row][col];<a name="line.162"></a>
+<FONT color="green">163</FONT>                    colSum[col] += counts[row][col];<a name="line.163"></a>
+<FONT color="green">164</FONT>                    total += counts[row][col];<a name="line.164"></a>
+<FONT color="green">165</FONT>                }<a name="line.165"></a>
+<FONT color="green">166</FONT>            }<a name="line.166"></a>
+<FONT color="green">167</FONT>    <a name="line.167"></a>
+<FONT color="green">168</FONT>            // compute expected counts and chi-square<a name="line.168"></a>
+<FONT color="green">169</FONT>            double sumSq = 0.0d;<a name="line.169"></a>
+<FONT color="green">170</FONT>            double expected = 0.0d;<a name="line.170"></a>
+<FONT color="green">171</FONT>            for (int row = 0; row &lt; nRows; row++) {<a name="line.171"></a>
+<FONT color="green">172</FONT>                for (int col = 0; col &lt; nCols; col++) {<a name="line.172"></a>
+<FONT color="green">173</FONT>                    expected = (rowSum[row] * colSum[col]) / total;<a name="line.173"></a>
+<FONT color="green">174</FONT>                    sumSq += ((counts[row][col] - expected) *<a name="line.174"></a>
+<FONT color="green">175</FONT>                            (counts[row][col] - expected)) / expected;<a name="line.175"></a>
+<FONT color="green">176</FONT>                }<a name="line.176"></a>
+<FONT color="green">177</FONT>            }<a name="line.177"></a>
+<FONT color="green">178</FONT>            return sumSq;<a name="line.178"></a>
+<FONT color="green">179</FONT>        }<a name="line.179"></a>
+<FONT color="green">180</FONT>    <a name="line.180"></a>
+<FONT color="green">181</FONT>        /**<a name="line.181"></a>
+<FONT color="green">182</FONT>         * @param counts array representation of 2-way table<a name="line.182"></a>
+<FONT color="green">183</FONT>         * @return p-value<a name="line.183"></a>
+<FONT color="green">184</FONT>         * @throws IllegalArgumentException if preconditions are not met<a name="line.184"></a>
+<FONT color="green">185</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.185"></a>
+<FONT color="green">186</FONT>         */<a name="line.186"></a>
+<FONT color="green">187</FONT>        public double chiSquareTest(long[][] counts)<a name="line.187"></a>
+<FONT color="green">188</FONT>        throws IllegalArgumentException, MathException {<a name="line.188"></a>
+<FONT color="green">189</FONT>            checkArray(counts);<a name="line.189"></a>
+<FONT color="green">190</FONT>            double df = ((double) counts.length -1) * ((double) counts[0].length - 1);<a name="line.190"></a>
+<FONT color="green">191</FONT>            distribution.setDegreesOfFreedom(df);<a name="line.191"></a>
+<FONT color="green">192</FONT>            return 1 - distribution.cumulativeProbability(chiSquare(counts));<a name="line.192"></a>
+<FONT color="green">193</FONT>        }<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>        /**<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @param counts array representation of 2-way table<a name="line.196"></a>
+<FONT color="green">197</FONT>         * @param alpha significance level of the test<a name="line.197"></a>
+<FONT color="green">198</FONT>         * @return true iff null hypothesis can be rejected with confidence<a name="line.198"></a>
+<FONT color="green">199</FONT>         * 1 - alpha<a name="line.199"></a>
+<FONT color="green">200</FONT>         * @throws IllegalArgumentException if preconditions are not met<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @throws MathException if an error occurs performing the test<a name="line.201"></a>
+<FONT color="green">202</FONT>         */<a name="line.202"></a>
+<FONT color="green">203</FONT>        public boolean chiSquareTest(long[][] counts, double alpha)<a name="line.203"></a>
+<FONT color="green">204</FONT>        throws IllegalArgumentException, MathException {<a name="line.204"></a>
+<FONT color="green">205</FONT>            if ((alpha &lt;= 0) || (alpha &gt; 0.5)) {<a name="line.205"></a>
+<FONT color="green">206</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.206"></a>
+<FONT color="green">207</FONT>                      "out of bounds significance level {0}, must be between {1} and {2}",<a name="line.207"></a>
+<FONT color="green">208</FONT>                      alpha, 0.0, 0.5);<a name="line.208"></a>
+<FONT color="green">209</FONT>            }<a name="line.209"></a>
+<FONT color="green">210</FONT>            return chiSquareTest(counts) &lt; alpha;<a name="line.210"></a>
+<FONT color="green">211</FONT>        }<a name="line.211"></a>
+<FONT color="green">212</FONT>    <a name="line.212"></a>
+<FONT color="green">213</FONT>        /**<a name="line.213"></a>
+<FONT color="green">214</FONT>         * @param observed1 array of observed frequency counts of the first data set<a name="line.214"></a>
+<FONT color="green">215</FONT>         * @param observed2 array of observed frequency counts of the second data set<a name="line.215"></a>
+<FONT color="green">216</FONT>         * @return chi-square test statistic<a name="line.216"></a>
+<FONT color="green">217</FONT>         * @throws IllegalArgumentException if preconditions are not met<a name="line.217"></a>
+<FONT color="green">218</FONT>         * @since 1.2<a name="line.218"></a>
+<FONT color="green">219</FONT>         */<a name="line.219"></a>
+<FONT color="green">220</FONT>        public double chiSquareDataSetsComparison(long[] observed1, long[] observed2)<a name="line.220"></a>
+<FONT color="green">221</FONT>            throws IllegalArgumentException {<a name="line.221"></a>
+<FONT color="green">222</FONT>    <a name="line.222"></a>
+<FONT color="green">223</FONT>            // Make sure lengths are same<a name="line.223"></a>
+<FONT color="green">224</FONT>            if (observed1.length &lt; 2) {<a name="line.224"></a>
+<FONT color="green">225</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.225"></a>
+<FONT color="green">226</FONT>                      "observed array length = {0}, must be at least 2",<a name="line.226"></a>
+<FONT color="green">227</FONT>                      observed1.length);<a name="line.227"></a>
+<FONT color="green">228</FONT>            }<a name="line.228"></a>
+<FONT color="green">229</FONT>            if (observed1.length != observed2.length) {<a name="line.229"></a>
+<FONT color="green">230</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.230"></a>
+<FONT color="green">231</FONT>                      "dimension mismatch {0} != {1}",<a name="line.231"></a>
+<FONT color="green">232</FONT>                      observed1.length, observed2.length);<a name="line.232"></a>
+<FONT color="green">233</FONT>            }<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>            // Ensure non-negative counts<a name="line.235"></a>
+<FONT color="green">236</FONT>            checkNonNegative(observed1);<a name="line.236"></a>
+<FONT color="green">237</FONT>            checkNonNegative(observed2);<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>            // Compute and compare count sums<a name="line.239"></a>
+<FONT color="green">240</FONT>            long countSum1 = 0;<a name="line.240"></a>
+<FONT color="green">241</FONT>            long countSum2 = 0;<a name="line.241"></a>
+<FONT color="green">242</FONT>            boolean unequalCounts = false;<a name="line.242"></a>
+<FONT color="green">243</FONT>            double weight = 0.0;<a name="line.243"></a>
+<FONT color="green">244</FONT>            for (int i = 0; i &lt; observed1.length; i++) {<a name="line.244"></a>
+<FONT color="green">245</FONT>                countSum1 += observed1[i];<a name="line.245"></a>
+<FONT color="green">246</FONT>                countSum2 += observed2[i];<a name="line.246"></a>
+<FONT color="green">247</FONT>            }<a name="line.247"></a>
+<FONT color="green">248</FONT>            // Ensure neither sample is uniformly 0<a name="line.248"></a>
+<FONT color="green">249</FONT>            if (countSum1 == 0) {<a name="line.249"></a>
+<FONT color="green">250</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.250"></a>
+<FONT color="green">251</FONT>                      "observed counts are all 0 in first observed array");<a name="line.251"></a>
+<FONT color="green">252</FONT>            }<a name="line.252"></a>
+<FONT color="green">253</FONT>            if (countSum2 == 0) {<a name="line.253"></a>
+<FONT color="green">254</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.254"></a>
+<FONT color="green">255</FONT>                      "observed counts are all 0 in second observed array");<a name="line.255"></a>
+<FONT color="green">256</FONT>            }<a name="line.256"></a>
+<FONT color="green">257</FONT>            // Compare and compute weight only if different<a name="line.257"></a>
+<FONT color="green">258</FONT>            unequalCounts = countSum1 != countSum2;<a name="line.258"></a>
+<FONT color="green">259</FONT>            if (unequalCounts) {<a name="line.259"></a>
+<FONT color="green">260</FONT>                weight = Math.sqrt((double) countSum1 / (double) countSum2);<a name="line.260"></a>
+<FONT color="green">261</FONT>            }<a name="line.261"></a>
+<FONT color="green">262</FONT>            // Compute ChiSquare statistic<a name="line.262"></a>
+<FONT color="green">263</FONT>            double sumSq = 0.0d;<a name="line.263"></a>
+<FONT color="green">264</FONT>            double dev = 0.0d;<a name="line.264"></a>
+<FONT color="green">265</FONT>            double obs1 = 0.0d;<a name="line.265"></a>
+<FONT color="green">266</FONT>            double obs2 = 0.0d;<a name="line.266"></a>
+<FONT color="green">267</FONT>            for (int i = 0; i &lt; observed1.length; i++) {<a name="line.267"></a>
+<FONT color="green">268</FONT>                if (observed1[i] == 0 &amp;&amp; observed2[i] == 0) {<a name="line.268"></a>
+<FONT color="green">269</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.269"></a>
+<FONT color="green">270</FONT>                          "observed counts are both zero for entry {0}", i);<a name="line.270"></a>
+<FONT color="green">271</FONT>                } else {<a name="line.271"></a>
+<FONT color="green">272</FONT>                    obs1 = observed1[i];<a name="line.272"></a>
+<FONT color="green">273</FONT>                    obs2 = observed2[i];<a name="line.273"></a>
+<FONT color="green">274</FONT>                    if (unequalCounts) { // apply weights<a name="line.274"></a>
+<FONT color="green">275</FONT>                        dev = obs1/weight - obs2 * weight;<a name="line.275"></a>
+<FONT color="green">276</FONT>                    } else {<a name="line.276"></a>
+<FONT color="green">277</FONT>                        dev = obs1 - obs2;<a name="line.277"></a>
+<FONT color="green">278</FONT>                    }<a name="line.278"></a>
+<FONT color="green">279</FONT>                    sumSq += (dev * dev) / (obs1 + obs2);<a name="line.279"></a>
+<FONT color="green">280</FONT>                }<a name="line.280"></a>
+<FONT color="green">281</FONT>            }<a name="line.281"></a>
+<FONT color="green">282</FONT>            return sumSq;<a name="line.282"></a>
+<FONT color="green">283</FONT>        }<a name="line.283"></a>
+<FONT color="green">284</FONT>    <a name="line.284"></a>
+<FONT color="green">285</FONT>        /**<a name="line.285"></a>
+<FONT color="green">286</FONT>         * @param observed1 array of observed frequency counts of the first data set<a name="line.286"></a>
+<FONT color="green">287</FONT>         * @param observed2 array of observed frequency counts of the second data set<a name="line.287"></a>
+<FONT color="green">288</FONT>         * @return p-value<a name="line.288"></a>
+<FONT color="green">289</FONT>         * @throws IllegalArgumentException if preconditions are not met<a name="line.289"></a>
+<FONT color="green">290</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.290"></a>
+<FONT color="green">291</FONT>         * @since 1.2<a name="line.291"></a>
+<FONT color="green">292</FONT>         */<a name="line.292"></a>
+<FONT color="green">293</FONT>        public double chiSquareTestDataSetsComparison(long[] observed1, long[] observed2)<a name="line.293"></a>
+<FONT color="green">294</FONT>            throws IllegalArgumentException, MathException {<a name="line.294"></a>
+<FONT color="green">295</FONT>            distribution.setDegreesOfFreedom((double) observed1.length - 1);<a name="line.295"></a>
+<FONT color="green">296</FONT>            return 1 - distribution.cumulativeProbability(<a name="line.296"></a>
+<FONT color="green">297</FONT>                    chiSquareDataSetsComparison(observed1, observed2));<a name="line.297"></a>
+<FONT color="green">298</FONT>        }<a name="line.298"></a>
+<FONT color="green">299</FONT>    <a name="line.299"></a>
+<FONT color="green">300</FONT>        /**<a name="line.300"></a>
+<FONT color="green">301</FONT>         * @param observed1 array of observed frequency counts of the first data set<a name="line.301"></a>
+<FONT color="green">302</FONT>         * @param observed2 array of observed frequency counts of the second data set<a name="line.302"></a>
+<FONT color="green">303</FONT>         * @param alpha significance level of the test<a name="line.303"></a>
+<FONT color="green">304</FONT>         * @return true iff null hypothesis can be rejected with confidence<a name="line.304"></a>
+<FONT color="green">305</FONT>         * 1 - alpha<a name="line.305"></a>
+<FONT color="green">306</FONT>         * @throws IllegalArgumentException if preconditions are not met<a name="line.306"></a>
+<FONT color="green">307</FONT>         * @throws MathException if an error occurs performing the test<a name="line.307"></a>
+<FONT color="green">308</FONT>         * @since 1.2<a name="line.308"></a>
+<FONT color="green">309</FONT>         */<a name="line.309"></a>
+<FONT color="green">310</FONT>        public boolean chiSquareTestDataSetsComparison(long[] observed1, long[] observed2,<a name="line.310"></a>
+<FONT color="green">311</FONT>                double alpha) throws IllegalArgumentException, MathException {<a name="line.311"></a>
+<FONT color="green">312</FONT>            if ((alpha &lt;= 0) || (alpha &gt; 0.5)) {<a name="line.312"></a>
+<FONT color="green">313</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.313"></a>
+<FONT color="green">314</FONT>                      "out of bounds significance level {0}, must be between {1} and {2}",<a name="line.314"></a>
+<FONT color="green">315</FONT>                      alpha, 0.0, 0.5);<a name="line.315"></a>
+<FONT color="green">316</FONT>            }<a name="line.316"></a>
+<FONT color="green">317</FONT>            return chiSquareTestDataSetsComparison(observed1, observed2) &lt; alpha;<a name="line.317"></a>
+<FONT color="green">318</FONT>        }<a name="line.318"></a>
+<FONT color="green">319</FONT>    <a name="line.319"></a>
+<FONT color="green">320</FONT>        /**<a name="line.320"></a>
+<FONT color="green">321</FONT>         * Checks to make sure that the input long[][] array is rectangular,<a name="line.321"></a>
+<FONT color="green">322</FONT>         * has at least 2 rows and 2 columns, and has all non-negative entries,<a name="line.322"></a>
+<FONT color="green">323</FONT>         * throwing IllegalArgumentException if any of these checks fail.<a name="line.323"></a>
+<FONT color="green">324</FONT>         *<a name="line.324"></a>
+<FONT color="green">325</FONT>         * @param in input 2-way table to check<a name="line.325"></a>
+<FONT color="green">326</FONT>         * @throws IllegalArgumentException if the array is not valid<a name="line.326"></a>
+<FONT color="green">327</FONT>         */<a name="line.327"></a>
+<FONT color="green">328</FONT>        private void checkArray(long[][] in) throws IllegalArgumentException {<a name="line.328"></a>
+<FONT color="green">329</FONT>    <a name="line.329"></a>
+<FONT color="green">330</FONT>            if (in.length &lt; 2) {<a name="line.330"></a>
+<FONT color="green">331</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.331"></a>
+<FONT color="green">332</FONT>                      "invalid row dimension: {0} (must be at least 2)",<a name="line.332"></a>
+<FONT color="green">333</FONT>                      in.length);<a name="line.333"></a>
+<FONT color="green">334</FONT>            }<a name="line.334"></a>
+<FONT color="green">335</FONT>    <a name="line.335"></a>
+<FONT color="green">336</FONT>            if (in[0].length &lt; 2) {<a name="line.336"></a>
+<FONT color="green">337</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.337"></a>
+<FONT color="green">338</FONT>                      "invalid column dimension: {0} (must be at least 2)",<a name="line.338"></a>
+<FONT color="green">339</FONT>                      in[0].length);<a name="line.339"></a>
+<FONT color="green">340</FONT>            }<a name="line.340"></a>
+<FONT color="green">341</FONT>    <a name="line.341"></a>
+<FONT color="green">342</FONT>            checkRectangular(in);<a name="line.342"></a>
+<FONT color="green">343</FONT>            checkNonNegative(in);<a name="line.343"></a>
+<FONT color="green">344</FONT>    <a name="line.344"></a>
+<FONT color="green">345</FONT>        }<a name="line.345"></a>
+<FONT color="green">346</FONT>    <a name="line.346"></a>
+<FONT color="green">347</FONT>        //---------------------  Private array methods -- should find a utility home for these<a name="line.347"></a>
+<FONT color="green">348</FONT>    <a name="line.348"></a>
+<FONT color="green">349</FONT>        /**<a name="line.349"></a>
+<FONT color="green">350</FONT>         * Throws IllegalArgumentException if the input array is not rectangular.<a name="line.350"></a>
+<FONT color="green">351</FONT>         *<a name="line.351"></a>
+<FONT color="green">352</FONT>         * @param in array to be tested<a name="line.352"></a>
+<FONT color="green">353</FONT>         * @throws NullPointerException if input array is null<a name="line.353"></a>
+<FONT color="green">354</FONT>         * @throws IllegalArgumentException if input array is not rectangular<a name="line.354"></a>
+<FONT color="green">355</FONT>         */<a name="line.355"></a>
+<FONT color="green">356</FONT>        private void checkRectangular(long[][] in) {<a name="line.356"></a>
+<FONT color="green">357</FONT>            for (int i = 1; i &lt; in.length; i++) {<a name="line.357"></a>
+<FONT color="green">358</FONT>                if (in[i].length != in[0].length) {<a name="line.358"></a>
+<FONT color="green">359</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.359"></a>
+<FONT color="green">360</FONT>                          "some rows have length {0} while others have length {1}",<a name="line.360"></a>
+<FONT color="green">361</FONT>                          in[i].length, in[0].length);<a name="line.361"></a>
+<FONT color="green">362</FONT>                }<a name="line.362"></a>
+<FONT color="green">363</FONT>            }<a name="line.363"></a>
+<FONT color="green">364</FONT>        }<a name="line.364"></a>
+<FONT color="green">365</FONT>    <a name="line.365"></a>
+<FONT color="green">366</FONT>        /**<a name="line.366"></a>
+<FONT color="green">367</FONT>         * Check all entries of the input array are &gt; 0.<a name="line.367"></a>
+<FONT color="green">368</FONT>         *<a name="line.368"></a>
+<FONT color="green">369</FONT>         * @param in array to be tested<a name="line.369"></a>
+<FONT color="green">370</FONT>         * @exception IllegalArgumentException if one entry is not positive<a name="line.370"></a>
+<FONT color="green">371</FONT>         */<a name="line.371"></a>
+<FONT color="green">372</FONT>        private void checkPositive(double[] in) throws IllegalArgumentException {<a name="line.372"></a>
+<FONT color="green">373</FONT>            for (int i = 0; i &lt; in.length; i++) {<a name="line.373"></a>
+<FONT color="green">374</FONT>                if (in[i] &lt;= 0) {<a name="line.374"></a>
+<FONT color="green">375</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.375"></a>
+<FONT color="green">376</FONT>                          "element {0} is not positive: {1}",<a name="line.376"></a>
+<FONT color="green">377</FONT>                          i, in[i]);<a name="line.377"></a>
+<FONT color="green">378</FONT>                }<a name="line.378"></a>
+<FONT color="green">379</FONT>            }<a name="line.379"></a>
+<FONT color="green">380</FONT>        }<a name="line.380"></a>
+<FONT color="green">381</FONT>    <a name="line.381"></a>
+<FONT color="green">382</FONT>        /**<a name="line.382"></a>
+<FONT color="green">383</FONT>         * Check all entries of the input array are &gt;= 0.<a name="line.383"></a>
+<FONT color="green">384</FONT>         *<a name="line.384"></a>
+<FONT color="green">385</FONT>         * @param in array to be tested<a name="line.385"></a>
+<FONT color="green">386</FONT>         * @exception IllegalArgumentException if one entry is negative<a name="line.386"></a>
+<FONT color="green">387</FONT>         */<a name="line.387"></a>
+<FONT color="green">388</FONT>        private void checkNonNegative(long[] in) throws IllegalArgumentException {<a name="line.388"></a>
+<FONT color="green">389</FONT>            for (int i = 0; i &lt; in.length; i++) {<a name="line.389"></a>
+<FONT color="green">390</FONT>                if (in[i] &lt; 0) {<a name="line.390"></a>
+<FONT color="green">391</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.391"></a>
+<FONT color="green">392</FONT>                          "element {0} is negative: {1}",<a name="line.392"></a>
+<FONT color="green">393</FONT>                          i, in[i]);<a name="line.393"></a>
+<FONT color="green">394</FONT>                }<a name="line.394"></a>
+<FONT color="green">395</FONT>            }<a name="line.395"></a>
+<FONT color="green">396</FONT>        }<a name="line.396"></a>
+<FONT color="green">397</FONT>    <a name="line.397"></a>
+<FONT color="green">398</FONT>        /**<a name="line.398"></a>
+<FONT color="green">399</FONT>         * Check all entries of the input array are &gt;= 0.<a name="line.399"></a>
+<FONT color="green">400</FONT>         *<a name="line.400"></a>
+<FONT color="green">401</FONT>         * @param in array to be tested<a name="line.401"></a>
+<FONT color="green">402</FONT>         * @exception IllegalArgumentException if one entry is negative<a name="line.402"></a>
+<FONT color="green">403</FONT>         */<a name="line.403"></a>
+<FONT color="green">404</FONT>        private void checkNonNegative(long[][] in) throws IllegalArgumentException {<a name="line.404"></a>
+<FONT color="green">405</FONT>            for (int i = 0; i &lt; in.length; i ++) {<a name="line.405"></a>
+<FONT color="green">406</FONT>                for (int j = 0; j &lt; in[i].length; j++) {<a name="line.406"></a>
+<FONT color="green">407</FONT>                    if (in[i][j] &lt; 0) {<a name="line.407"></a>
+<FONT color="green">408</FONT>                        throw MathRuntimeException.createIllegalArgumentException(<a name="line.408"></a>
+<FONT color="green">409</FONT>                              "element ({0}, {1}) is negative: {2}",<a name="line.409"></a>
+<FONT color="green">410</FONT>                              i, j, in[i][j]);<a name="line.410"></a>
+<FONT color="green">411</FONT>                    }<a name="line.411"></a>
+<FONT color="green">412</FONT>                }<a name="line.412"></a>
+<FONT color="green">413</FONT>            }<a name="line.413"></a>
+<FONT color="green">414</FONT>        }<a name="line.414"></a>
+<FONT color="green">415</FONT>    <a name="line.415"></a>
+<FONT color="green">416</FONT>        /**<a name="line.416"></a>
+<FONT color="green">417</FONT>         * Modify the distribution used to compute inference statistics.<a name="line.417"></a>
+<FONT color="green">418</FONT>         *<a name="line.418"></a>
+<FONT color="green">419</FONT>         * @param value<a name="line.419"></a>
+<FONT color="green">420</FONT>         *            the new distribution<a name="line.420"></a>
+<FONT color="green">421</FONT>         * @since 1.2<a name="line.421"></a>
+<FONT color="green">422</FONT>         */<a name="line.422"></a>
+<FONT color="green">423</FONT>        public void setDistribution(ChiSquaredDistribution value) {<a name="line.423"></a>
+<FONT color="green">424</FONT>            distribution = value;<a name="line.424"></a>
+<FONT color="green">425</FONT>        }<a name="line.425"></a>
+<FONT color="green">426</FONT>    }<a name="line.426"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/inference/OneWayAnova.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,169 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.inference;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Collection;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * An interface for one-way ANOVA (analysis of variance).<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt; Tests for differences between two or more categories of univariate data<a name="line.25"></a>
+<FONT color="green">026</FONT>     * (for example, the body mass index of accountants, lawyers, doctors and<a name="line.26"></a>
+<FONT color="green">027</FONT>     * computer programmers).  When two categories are given, this is equivalent to<a name="line.27"></a>
+<FONT color="green">028</FONT>     * the {@link org.apache.commons.math.stat.inference.TTest}.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     *<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 1.2<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public interface OneWayAnova {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /**<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Computes the ANOVA F-value for a collection of &lt;code&gt;double[]&lt;/code&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>         * arrays.<a name="line.38"></a>
+<FONT color="green">039</FONT>         *<a name="line.39"></a>
+<FONT color="green">040</FONT>         * &lt;p&gt;&lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>         * &lt;li&gt;The categoryData &lt;code&gt;Collection&lt;/code&gt; must contain<a name="line.41"></a>
+<FONT color="green">042</FONT>         * &lt;code&gt;double[]&lt;/code&gt; arrays.&lt;/li&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>         * &lt;li&gt; There must be at least two &lt;code&gt;double[]&lt;/code&gt; arrays in the<a name="line.43"></a>
+<FONT color="green">044</FONT>         * &lt;code&gt;categoryData&lt;/code&gt; collection and each of these arrays must<a name="line.44"></a>
+<FONT color="green">045</FONT>         * contain at least two values.&lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>         *<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @param categoryData &lt;code&gt;Collection&lt;/code&gt; of &lt;code&gt;double[]&lt;/code&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>         * arrays each containing data for one category<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @return Fvalue<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @throws IllegalArgumentException if the preconditions are not met<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @throws MathException if the statistic can not be computed do to a<a name="line.51"></a>
+<FONT color="green">052</FONT>         *         convergence or other numerical error.<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        double anovaFValue(Collection&lt;double[]&gt; categoryData)<a name="line.54"></a>
+<FONT color="green">055</FONT>            throws IllegalArgumentException, MathException;<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /**<a name="line.57"></a>
+<FONT color="green">058</FONT>         * Computes the ANOVA P-value for a collection of &lt;code&gt;double[]&lt;/code&gt;<a name="line.58"></a>
+<FONT color="green">059</FONT>         * arrays.<a name="line.59"></a>
+<FONT color="green">060</FONT>         *<a name="line.60"></a>
+<FONT color="green">061</FONT>         * &lt;p&gt;&lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.61"></a>
+<FONT color="green">062</FONT>         * &lt;li&gt;The categoryData &lt;code&gt;Collection&lt;/code&gt; must contain<a name="line.62"></a>
+<FONT color="green">063</FONT>         * &lt;code&gt;double[]&lt;/code&gt; arrays.&lt;/li&gt;<a name="line.63"></a>
+<FONT color="green">064</FONT>         * &lt;li&gt; There must be at least two &lt;code&gt;double[]&lt;/code&gt; arrays in the<a name="line.64"></a>
+<FONT color="green">065</FONT>         * &lt;code&gt;categoryData&lt;/code&gt; collection and each of these arrays must<a name="line.65"></a>
+<FONT color="green">066</FONT>         * contain at least two values.&lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.66"></a>
+<FONT color="green">067</FONT>         *<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param categoryData &lt;code&gt;Collection&lt;/code&gt; of &lt;code&gt;double[]&lt;/code&gt;<a name="line.68"></a>
+<FONT color="green">069</FONT>         * arrays each containing data for one category<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @return Pvalue<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @throws IllegalArgumentException if the preconditions are not met<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @throws MathException if the statistic can not be computed do to a<a name="line.72"></a>
+<FONT color="green">073</FONT>         *         convergence or other numerical error.<a name="line.73"></a>
+<FONT color="green">074</FONT>         */<a name="line.74"></a>
+<FONT color="green">075</FONT>        double anovaPValue(Collection&lt;double[]&gt; categoryData)<a name="line.75"></a>
+<FONT color="green">076</FONT>            throws IllegalArgumentException, MathException;<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /**<a name="line.78"></a>
+<FONT color="green">079</FONT>         * Performs an ANOVA test, evaluating the null hypothesis that there<a name="line.79"></a>
+<FONT color="green">080</FONT>         * is no difference among the means of the data categories.<a name="line.80"></a>
+<FONT color="green">081</FONT>         *<a name="line.81"></a>
+<FONT color="green">082</FONT>         * &lt;p&gt;&lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.82"></a>
+<FONT color="green">083</FONT>         * &lt;li&gt;The categoryData &lt;code&gt;Collection&lt;/code&gt; must contain<a name="line.83"></a>
+<FONT color="green">084</FONT>         * &lt;code&gt;double[]&lt;/code&gt; arrays.&lt;/li&gt;<a name="line.84"></a>
+<FONT color="green">085</FONT>         * &lt;li&gt; There must be at least two &lt;code&gt;double[]&lt;/code&gt; arrays in the<a name="line.85"></a>
+<FONT color="green">086</FONT>         * &lt;code&gt;categoryData&lt;/code&gt; collection and each of these arrays must<a name="line.86"></a>
+<FONT color="green">087</FONT>         * contain at least two values.&lt;/li&gt;<a name="line.87"></a>
+<FONT color="green">088</FONT>         * &lt;li&gt;alpha must be strictly greater than 0 and less than or equal to 0.5.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.89"></a>
+<FONT color="green">090</FONT>         *<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @param categoryData &lt;code&gt;Collection&lt;/code&gt; of &lt;code&gt;double[]&lt;/code&gt;<a name="line.91"></a>
+<FONT color="green">092</FONT>         * arrays each containing data for one category<a name="line.92"></a>
+<FONT color="green">093</FONT>         * @param alpha significance level of the test<a name="line.93"></a>
+<FONT color="green">094</FONT>         * @return true if the null hypothesis can be rejected with<a name="line.94"></a>
+<FONT color="green">095</FONT>         * confidence 1 - alpha<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @throws IllegalArgumentException if the preconditions are not met<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @throws MathException if the statistic can not be computed do to a<a name="line.97"></a>
+<FONT color="green">098</FONT>         *         convergence or other numerical error.<a name="line.98"></a>
+<FONT color="green">099</FONT>         */<a name="line.99"></a>
+<FONT color="green">100</FONT>        boolean anovaTest(Collection&lt;double[]&gt; categoryData, double alpha)<a name="line.100"></a>
+<FONT color="green">101</FONT>            throws IllegalArgumentException, MathException;<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>    }<a name="line.103"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/inference/OneWayAnovaImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,275 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.inference;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.Collection;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.distribution.FDistribution;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.distribution.FDistributionImpl;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.stat.descriptive.summary.Sum;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.stat.descriptive.summary.SumOfSquares;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>    /**<a name="line.29"></a>
+<FONT color="green">030</FONT>     * Implements one-way ANOVA statistics defined in the {@link OneWayAnovaImpl}<a name="line.30"></a>
+<FONT color="green">031</FONT>     * interface.<a name="line.31"></a>
+<FONT color="green">032</FONT>     *<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;p&gt;Uses the<a name="line.33"></a>
+<FONT color="green">034</FONT>     * {@link org.apache.commons.math.distribution.FDistribution<a name="line.34"></a>
+<FONT color="green">035</FONT>     *  commons-math F Distribution implementation} to estimate exact p-values.&lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     *<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;p&gt;This implementation is based on a description at<a name="line.37"></a>
+<FONT color="green">038</FONT>     * http://faculty.vassar.edu/lowry/ch13pt1.html&lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;pre&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     * Abbreviations: bg = between groups,<a name="line.40"></a>
+<FONT color="green">041</FONT>     *                wg = within groups,<a name="line.41"></a>
+<FONT color="green">042</FONT>     *                ss = sum squared deviations<a name="line.42"></a>
+<FONT color="green">043</FONT>     * &lt;/pre&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     *<a name="line.44"></a>
+<FONT color="green">045</FONT>     * @since 1.2<a name="line.45"></a>
+<FONT color="green">046</FONT>     * @version $Revision: 825917 $ $Date: 2009-10-16 10:47:27 -0400 (Fri, 16 Oct 2009) $<a name="line.46"></a>
+<FONT color="green">047</FONT>     */<a name="line.47"></a>
+<FONT color="green">048</FONT>    public class OneWayAnovaImpl implements OneWayAnova  {<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Default constructor.<a name="line.51"></a>
+<FONT color="green">052</FONT>         */<a name="line.52"></a>
+<FONT color="green">053</FONT>        public OneWayAnovaImpl() {<a name="line.53"></a>
+<FONT color="green">054</FONT>        }<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /**<a name="line.56"></a>
+<FONT color="green">057</FONT>         * {@inheritDoc}&lt;p&gt;<a name="line.57"></a>
+<FONT color="green">058</FONT>         * This implementation computes the F statistic using the definitional<a name="line.58"></a>
+<FONT color="green">059</FONT>         * formula&lt;pre&gt;<a name="line.59"></a>
+<FONT color="green">060</FONT>         *   F = msbg/mswg&lt;/pre&gt;<a name="line.60"></a>
+<FONT color="green">061</FONT>         * where&lt;pre&gt;<a name="line.61"></a>
+<FONT color="green">062</FONT>         *  msbg = between group mean square<a name="line.62"></a>
+<FONT color="green">063</FONT>         *  mswg = within group mean square&lt;/pre&gt;<a name="line.63"></a>
+<FONT color="green">064</FONT>         * are as defined &lt;a href="http://faculty.vassar.edu/lowry/ch13pt1.html"&gt;<a name="line.64"></a>
+<FONT color="green">065</FONT>         * here&lt;/a&gt;&lt;/p&gt;<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        public double anovaFValue(Collection&lt;double[]&gt; categoryData)<a name="line.67"></a>
+<FONT color="green">068</FONT>            throws IllegalArgumentException, MathException {<a name="line.68"></a>
+<FONT color="green">069</FONT>            AnovaStats a = anovaStats(categoryData);<a name="line.69"></a>
+<FONT color="green">070</FONT>            return a.F;<a name="line.70"></a>
+<FONT color="green">071</FONT>        }<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /**<a name="line.73"></a>
+<FONT color="green">074</FONT>         * {@inheritDoc}&lt;p&gt;<a name="line.74"></a>
+<FONT color="green">075</FONT>         * This implementation uses the<a name="line.75"></a>
+<FONT color="green">076</FONT>         * {@link org.apache.commons.math.distribution.FDistribution<a name="line.76"></a>
+<FONT color="green">077</FONT>         * commons-math F Distribution implementation} to estimate the exact<a name="line.77"></a>
+<FONT color="green">078</FONT>         * p-value, using the formula&lt;pre&gt;<a name="line.78"></a>
+<FONT color="green">079</FONT>         *   p = 1 - cumulativeProbability(F)&lt;/pre&gt;<a name="line.79"></a>
+<FONT color="green">080</FONT>         * where &lt;code&gt;F&lt;/code&gt; is the F value and &lt;code&gt;cumulativeProbability&lt;/code&gt;<a name="line.80"></a>
+<FONT color="green">081</FONT>         * is the commons-math implementation of the F distribution.&lt;/p&gt;<a name="line.81"></a>
+<FONT color="green">082</FONT>         */<a name="line.82"></a>
+<FONT color="green">083</FONT>        public double anovaPValue(Collection&lt;double[]&gt; categoryData)<a name="line.83"></a>
+<FONT color="green">084</FONT>            throws IllegalArgumentException, MathException {<a name="line.84"></a>
+<FONT color="green">085</FONT>            AnovaStats a = anovaStats(categoryData);<a name="line.85"></a>
+<FONT color="green">086</FONT>            FDistribution fdist = new FDistributionImpl(a.dfbg, a.dfwg);<a name="line.86"></a>
+<FONT color="green">087</FONT>            return 1.0 - fdist.cumulativeProbability(a.F);<a name="line.87"></a>
+<FONT color="green">088</FONT>        }<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>        /**<a name="line.90"></a>
+<FONT color="green">091</FONT>         * {@inheritDoc}&lt;p&gt;<a name="line.91"></a>
+<FONT color="green">092</FONT>         * This implementation uses the<a name="line.92"></a>
+<FONT color="green">093</FONT>         * {@link org.apache.commons.math.distribution.FDistribution<a name="line.93"></a>
+<FONT color="green">094</FONT>         * commons-math F Distribution implementation} to estimate the exact<a name="line.94"></a>
+<FONT color="green">095</FONT>         * p-value, using the formula&lt;pre&gt;<a name="line.95"></a>
+<FONT color="green">096</FONT>         *   p = 1 - cumulativeProbability(F)&lt;/pre&gt;<a name="line.96"></a>
+<FONT color="green">097</FONT>         * where &lt;code&gt;F&lt;/code&gt; is the F value and &lt;code&gt;cumulativeProbability&lt;/code&gt;<a name="line.97"></a>
+<FONT color="green">098</FONT>         * is the commons-math implementation of the F distribution.&lt;/p&gt;<a name="line.98"></a>
+<FONT color="green">099</FONT>         * &lt;p&gt;True is returned iff the estimated p-value is less than alpha.&lt;/p&gt;<a name="line.99"></a>
+<FONT color="green">100</FONT>         */<a name="line.100"></a>
+<FONT color="green">101</FONT>        public boolean anovaTest(Collection&lt;double[]&gt; categoryData, double alpha)<a name="line.101"></a>
+<FONT color="green">102</FONT>            throws IllegalArgumentException, MathException {<a name="line.102"></a>
+<FONT color="green">103</FONT>            if ((alpha &lt;= 0) || (alpha &gt; 0.5)) {<a name="line.103"></a>
+<FONT color="green">104</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.104"></a>
+<FONT color="green">105</FONT>                      "out of bounds significance level {0}, must be between {1} and {2}",<a name="line.105"></a>
+<FONT color="green">106</FONT>                      alpha, 0, 0.5);<a name="line.106"></a>
+<FONT color="green">107</FONT>            }<a name="line.107"></a>
+<FONT color="green">108</FONT>            return anovaPValue(categoryData) &lt; alpha;<a name="line.108"></a>
+<FONT color="green">109</FONT>        }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>        /**<a name="line.112"></a>
+<FONT color="green">113</FONT>         * This method actually does the calculations (except P-value).<a name="line.113"></a>
+<FONT color="green">114</FONT>         *<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @param categoryData &lt;code&gt;Collection&lt;/code&gt; of &lt;code&gt;double[]&lt;/code&gt;<a name="line.115"></a>
+<FONT color="green">116</FONT>         * arrays each containing data for one category<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @return computed AnovaStats<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @throws IllegalArgumentException if categoryData does not meet<a name="line.118"></a>
+<FONT color="green">119</FONT>         * preconditions specified in the interface definition<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @throws MathException if an error occurs computing the Anova stats<a name="line.120"></a>
+<FONT color="green">121</FONT>         */<a name="line.121"></a>
+<FONT color="green">122</FONT>        private AnovaStats anovaStats(Collection&lt;double[]&gt; categoryData)<a name="line.122"></a>
+<FONT color="green">123</FONT>            throws IllegalArgumentException, MathException {<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>            // check if we have enough categories<a name="line.125"></a>
+<FONT color="green">126</FONT>            if (categoryData.size() &lt; 2) {<a name="line.126"></a>
+<FONT color="green">127</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.127"></a>
+<FONT color="green">128</FONT>                      "two or more categories required, got {0}",<a name="line.128"></a>
+<FONT color="green">129</FONT>                      categoryData.size());<a name="line.129"></a>
+<FONT color="green">130</FONT>            }<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>            // check if each category has enough data and all is double[]<a name="line.132"></a>
+<FONT color="green">133</FONT>            for (double[] array : categoryData) {<a name="line.133"></a>
+<FONT color="green">134</FONT>                if (array.length &lt;= 1) {<a name="line.134"></a>
+<FONT color="green">135</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.135"></a>
+<FONT color="green">136</FONT>                          "two or more values required in each category, one has {0}",<a name="line.136"></a>
+<FONT color="green">137</FONT>                          array.length);<a name="line.137"></a>
+<FONT color="green">138</FONT>                }<a name="line.138"></a>
+<FONT color="green">139</FONT>            }<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>            int dfwg = 0;<a name="line.141"></a>
+<FONT color="green">142</FONT>            double sswg = 0;<a name="line.142"></a>
+<FONT color="green">143</FONT>            Sum totsum = new Sum();<a name="line.143"></a>
+<FONT color="green">144</FONT>            SumOfSquares totsumsq = new SumOfSquares();<a name="line.144"></a>
+<FONT color="green">145</FONT>            int totnum = 0;<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>            for (double[] data : categoryData) {<a name="line.147"></a>
+<FONT color="green">148</FONT>    <a name="line.148"></a>
+<FONT color="green">149</FONT>                Sum sum = new Sum();<a name="line.149"></a>
+<FONT color="green">150</FONT>                SumOfSquares sumsq = new SumOfSquares();<a name="line.150"></a>
+<FONT color="green">151</FONT>                int num = 0;<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>                for (int i = 0; i &lt; data.length; i++) {<a name="line.153"></a>
+<FONT color="green">154</FONT>                    double val = data[i];<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>                    // within category<a name="line.156"></a>
+<FONT color="green">157</FONT>                    num++;<a name="line.157"></a>
+<FONT color="green">158</FONT>                    sum.increment(val);<a name="line.158"></a>
+<FONT color="green">159</FONT>                    sumsq.increment(val);<a name="line.159"></a>
+<FONT color="green">160</FONT>    <a name="line.160"></a>
+<FONT color="green">161</FONT>                    // for all categories<a name="line.161"></a>
+<FONT color="green">162</FONT>                    totnum++;<a name="line.162"></a>
+<FONT color="green">163</FONT>                    totsum.increment(val);<a name="line.163"></a>
+<FONT color="green">164</FONT>                    totsumsq.increment(val);<a name="line.164"></a>
+<FONT color="green">165</FONT>                }<a name="line.165"></a>
+<FONT color="green">166</FONT>                dfwg += num - 1;<a name="line.166"></a>
+<FONT color="green">167</FONT>                double ss = sumsq.getResult() - sum.getResult() * sum.getResult() / num;<a name="line.167"></a>
+<FONT color="green">168</FONT>                sswg += ss;<a name="line.168"></a>
+<FONT color="green">169</FONT>            }<a name="line.169"></a>
+<FONT color="green">170</FONT>            double sst = totsumsq.getResult() - totsum.getResult() *<a name="line.170"></a>
+<FONT color="green">171</FONT>                totsum.getResult()/totnum;<a name="line.171"></a>
+<FONT color="green">172</FONT>            double ssbg = sst - sswg;<a name="line.172"></a>
+<FONT color="green">173</FONT>            int dfbg = categoryData.size() - 1;<a name="line.173"></a>
+<FONT color="green">174</FONT>            double msbg = ssbg/dfbg;<a name="line.174"></a>
+<FONT color="green">175</FONT>            double mswg = sswg/dfwg;<a name="line.175"></a>
+<FONT color="green">176</FONT>            double F = msbg/mswg;<a name="line.176"></a>
+<FONT color="green">177</FONT>    <a name="line.177"></a>
+<FONT color="green">178</FONT>            return new AnovaStats(dfbg, dfwg, F);<a name="line.178"></a>
+<FONT color="green">179</FONT>        }<a name="line.179"></a>
+<FONT color="green">180</FONT>    <a name="line.180"></a>
+<FONT color="green">181</FONT>        /**<a name="line.181"></a>
+<FONT color="green">182</FONT>            Convenience class to pass dfbg,dfwg,F values around within AnovaImpl.<a name="line.182"></a>
+<FONT color="green">183</FONT>            No get/set methods provided.<a name="line.183"></a>
+<FONT color="green">184</FONT>        */<a name="line.184"></a>
+<FONT color="green">185</FONT>        private static class AnovaStats {<a name="line.185"></a>
+<FONT color="green">186</FONT>    <a name="line.186"></a>
+<FONT color="green">187</FONT>            /** Degrees of freedom in numerator (between groups). */<a name="line.187"></a>
+<FONT color="green">188</FONT>            private int dfbg;<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>            /** Degrees of freedom in denominator (within groups). */<a name="line.190"></a>
+<FONT color="green">191</FONT>            private int dfwg;<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>            /** Statistic. */<a name="line.193"></a>
+<FONT color="green">194</FONT>            private double F;<a name="line.194"></a>
+<FONT color="green">195</FONT>    <a name="line.195"></a>
+<FONT color="green">196</FONT>            /**<a name="line.196"></a>
+<FONT color="green">197</FONT>             * Constructor<a name="line.197"></a>
+<FONT color="green">198</FONT>             * @param dfbg degrees of freedom in numerator (between groups)<a name="line.198"></a>
+<FONT color="green">199</FONT>             * @param dfwg degrees of freedom in denominator (within groups)<a name="line.199"></a>
+<FONT color="green">200</FONT>             * @param F statistic<a name="line.200"></a>
+<FONT color="green">201</FONT>             */<a name="line.201"></a>
+<FONT color="green">202</FONT>            private AnovaStats(int dfbg, int dfwg, double F) {<a name="line.202"></a>
+<FONT color="green">203</FONT>                this.dfbg = dfbg;<a name="line.203"></a>
+<FONT color="green">204</FONT>                this.dfwg = dfwg;<a name="line.204"></a>
+<FONT color="green">205</FONT>                this.F = F;<a name="line.205"></a>
+<FONT color="green">206</FONT>            }<a name="line.206"></a>
+<FONT color="green">207</FONT>        }<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>    }<a name="line.209"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/inference/TTest.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,837 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.inference;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.stat.descriptive.StatisticalSummary;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * An interface for Student's t-tests.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Tests can be:&lt;ul&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;li&gt;One-sample or two-sample&lt;/li&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;li&gt;One-sided or two-sided&lt;/li&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;li&gt;Paired or unpaired (for two-sample tests)&lt;/li&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;li&gt;Homoscedastic (equal variance assumption) or heteroscedastic<a name="line.29"></a>
+<FONT color="green">030</FONT>     * (for two sample tests)&lt;/li&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;li&gt;Fixed significance level (boolean-valued) or returning p-values.<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * Test statistics are available for all tests.  Methods including "Test" in<a name="line.34"></a>
+<FONT color="green">035</FONT>     * in their names perform tests, all other methods return t-statistics.  Among<a name="line.35"></a>
+<FONT color="green">036</FONT>     * the "Test" methods, &lt;code&gt;double-&lt;/code&gt;valued methods return p-values;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;code&gt;boolean-&lt;/code&gt;valued methods perform fixed significance level tests.<a name="line.37"></a>
+<FONT color="green">038</FONT>     * Significance levels are always specified as numbers between 0 and 0.5<a name="line.38"></a>
+<FONT color="green">039</FONT>     * (e.g. tests at the 95% level  use &lt;code&gt;alpha=0.05&lt;/code&gt;).&lt;/p&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;p&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * Input to tests can be either &lt;code&gt;double[]&lt;/code&gt; arrays or<a name="line.41"></a>
+<FONT color="green">042</FONT>     * {@link StatisticalSummary} instances.&lt;/p&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     *<a name="line.43"></a>
+<FONT color="green">044</FONT>     *<a name="line.44"></a>
+<FONT color="green">045</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.45"></a>
+<FONT color="green">046</FONT>     */<a name="line.46"></a>
+<FONT color="green">047</FONT>    public interface TTest {<a name="line.47"></a>
+<FONT color="green">048</FONT>        /**<a name="line.48"></a>
+<FONT color="green">049</FONT>         * Computes a paired, 2-sample t-statistic based on the data in the input<a name="line.49"></a>
+<FONT color="green">050</FONT>         * arrays.  The t-statistic returned is equivalent to what would be returned by<a name="line.50"></a>
+<FONT color="green">051</FONT>         * computing the one-sample t-statistic {@link #t(double, double[])}, with<a name="line.51"></a>
+<FONT color="green">052</FONT>         * &lt;code&gt;mu = 0&lt;/code&gt; and the sample array consisting of the (signed)<a name="line.52"></a>
+<FONT color="green">053</FONT>         * differences between corresponding entries in &lt;code&gt;sample1&lt;/code&gt; and<a name="line.53"></a>
+<FONT color="green">054</FONT>         * &lt;code&gt;sample2.&lt;/code&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>         * &lt;p&gt;<a name="line.55"></a>
+<FONT color="green">056</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>         * &lt;li&gt;The input arrays must have the same length and their common length<a name="line.57"></a>
+<FONT color="green">058</FONT>         * must be at least 2.<a name="line.58"></a>
+<FONT color="green">059</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.59"></a>
+<FONT color="green">060</FONT>         *<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param sample1 array of sample data values<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param sample2 array of sample data values<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @return t statistic<a name="line.63"></a>
+<FONT color="green">064</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @throws MathException if the statistic can not be computed do to a<a name="line.65"></a>
+<FONT color="green">066</FONT>         *         convergence or other numerical error.<a name="line.66"></a>
+<FONT color="green">067</FONT>         */<a name="line.67"></a>
+<FONT color="green">068</FONT>        double pairedT(double[] sample1, double[] sample2)<a name="line.68"></a>
+<FONT color="green">069</FONT>            throws IllegalArgumentException, MathException;<a name="line.69"></a>
+<FONT color="green">070</FONT>        /**<a name="line.70"></a>
+<FONT color="green">071</FONT>         * Returns the &lt;i&gt;observed significance level&lt;/i&gt;, or<a name="line.71"></a>
+<FONT color="green">072</FONT>         * &lt;i&gt; p-value&lt;/i&gt;, associated with a paired, two-sample, two-tailed t-test<a name="line.72"></a>
+<FONT color="green">073</FONT>         * based on the data in the input arrays.<a name="line.73"></a>
+<FONT color="green">074</FONT>         * &lt;p&gt;<a name="line.74"></a>
+<FONT color="green">075</FONT>         * The number returned is the smallest significance level<a name="line.75"></a>
+<FONT color="green">076</FONT>         * at which one can reject the null hypothesis that the mean of the paired<a name="line.76"></a>
+<FONT color="green">077</FONT>         * differences is 0 in favor of the two-sided alternative that the mean paired<a name="line.77"></a>
+<FONT color="green">078</FONT>         * difference is not equal to 0. For a one-sided test, divide the returned<a name="line.78"></a>
+<FONT color="green">079</FONT>         * value by 2.&lt;/p&gt;<a name="line.79"></a>
+<FONT color="green">080</FONT>         * &lt;p&gt;<a name="line.80"></a>
+<FONT color="green">081</FONT>         * This test is equivalent to a one-sample t-test computed using<a name="line.81"></a>
+<FONT color="green">082</FONT>         * {@link #tTest(double, double[])} with &lt;code&gt;mu = 0&lt;/code&gt; and the sample<a name="line.82"></a>
+<FONT color="green">083</FONT>         * array consisting of the signed differences between corresponding elements of<a name="line.83"></a>
+<FONT color="green">084</FONT>         * &lt;code&gt;sample1&lt;/code&gt; and &lt;code&gt;sample2.&lt;/code&gt;&lt;/p&gt;<a name="line.84"></a>
+<FONT color="green">085</FONT>         * &lt;p&gt;<a name="line.85"></a>
+<FONT color="green">086</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.86"></a>
+<FONT color="green">087</FONT>         * The validity of the p-value depends on the assumptions of the parametric<a name="line.87"></a>
+<FONT color="green">088</FONT>         * t-test procedure, as discussed<a name="line.88"></a>
+<FONT color="green">089</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;<a name="line.89"></a>
+<FONT color="green">090</FONT>         * here&lt;/a&gt;&lt;/p&gt;<a name="line.90"></a>
+<FONT color="green">091</FONT>         * &lt;p&gt;<a name="line.91"></a>
+<FONT color="green">092</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.92"></a>
+<FONT color="green">093</FONT>         * &lt;li&gt;The input array lengths must be the same and their common length must<a name="line.93"></a>
+<FONT color="green">094</FONT>         * be at least 2.<a name="line.94"></a>
+<FONT color="green">095</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.95"></a>
+<FONT color="green">096</FONT>         *<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @param sample1 array of sample data values<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @param sample2 array of sample data values<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @return p-value for t-test<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.101"></a>
+<FONT color="green">102</FONT>         */<a name="line.102"></a>
+<FONT color="green">103</FONT>        double pairedTTest(double[] sample1, double[] sample2)<a name="line.103"></a>
+<FONT color="green">104</FONT>            throws IllegalArgumentException, MathException;<a name="line.104"></a>
+<FONT color="green">105</FONT>        /**<a name="line.105"></a>
+<FONT color="green">106</FONT>         * Performs a paired t-test evaluating the null hypothesis that the<a name="line.106"></a>
+<FONT color="green">107</FONT>         * mean of the paired differences between &lt;code&gt;sample1&lt;/code&gt; and<a name="line.107"></a>
+<FONT color="green">108</FONT>         * &lt;code&gt;sample2&lt;/code&gt; is 0 in favor of the two-sided alternative that the<a name="line.108"></a>
+<FONT color="green">109</FONT>         * mean paired difference is not equal to 0, with significance level<a name="line.109"></a>
+<FONT color="green">110</FONT>         * &lt;code&gt;alpha&lt;/code&gt;.<a name="line.110"></a>
+<FONT color="green">111</FONT>         * &lt;p&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>         * Returns &lt;code&gt;true&lt;/code&gt; iff the null hypothesis can be rejected with<a name="line.112"></a>
+<FONT color="green">113</FONT>         * confidence &lt;code&gt;1 - alpha&lt;/code&gt;.  To perform a 1-sided test, use<a name="line.113"></a>
+<FONT color="green">114</FONT>         * &lt;code&gt;alpha * 2&lt;/code&gt;&lt;/p&gt;<a name="line.114"></a>
+<FONT color="green">115</FONT>         * &lt;p&gt;<a name="line.115"></a>
+<FONT color="green">116</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * The validity of the test depends on the assumptions of the parametric<a name="line.117"></a>
+<FONT color="green">118</FONT>         * t-test procedure, as discussed<a name="line.118"></a>
+<FONT color="green">119</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;<a name="line.119"></a>
+<FONT color="green">120</FONT>         * here&lt;/a&gt;&lt;/p&gt;<a name="line.120"></a>
+<FONT color="green">121</FONT>         * &lt;p&gt;<a name="line.121"></a>
+<FONT color="green">122</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.122"></a>
+<FONT color="green">123</FONT>         * &lt;li&gt;The input array lengths must be the same and their common length<a name="line.123"></a>
+<FONT color="green">124</FONT>         * must be at least 2.<a name="line.124"></a>
+<FONT color="green">125</FONT>         * &lt;/li&gt;<a name="line.125"></a>
+<FONT color="green">126</FONT>         * &lt;li&gt; &lt;code&gt; 0 &lt; alpha &lt; 0.5 &lt;/code&gt;<a name="line.126"></a>
+<FONT color="green">127</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.127"></a>
+<FONT color="green">128</FONT>         *<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @param sample1 array of sample data values<a name="line.129"></a>
+<FONT color="green">130</FONT>         * @param sample2 array of sample data values<a name="line.130"></a>
+<FONT color="green">131</FONT>         * @param alpha significance level of the test<a name="line.131"></a>
+<FONT color="green">132</FONT>         * @return true if the null hypothesis can be rejected with<a name="line.132"></a>
+<FONT color="green">133</FONT>         * confidence 1 - alpha<a name="line.133"></a>
+<FONT color="green">134</FONT>         * @throws IllegalArgumentException if the preconditions are not met<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @throws MathException if an error occurs performing the test<a name="line.135"></a>
+<FONT color="green">136</FONT>         */<a name="line.136"></a>
+<FONT color="green">137</FONT>        boolean pairedTTest(<a name="line.137"></a>
+<FONT color="green">138</FONT>            double[] sample1,<a name="line.138"></a>
+<FONT color="green">139</FONT>            double[] sample2,<a name="line.139"></a>
+<FONT color="green">140</FONT>            double alpha)<a name="line.140"></a>
+<FONT color="green">141</FONT>            throws IllegalArgumentException, MathException;<a name="line.141"></a>
+<FONT color="green">142</FONT>        /**<a name="line.142"></a>
+<FONT color="green">143</FONT>         * Computes a &lt;a href="http://www.itl.nist.gov/div898/handbook/prc/section2/prc22.htm#formula"&gt;<a name="line.143"></a>
+<FONT color="green">144</FONT>         * t statistic &lt;/a&gt; given observed values and a comparison constant.<a name="line.144"></a>
+<FONT color="green">145</FONT>         * &lt;p&gt;<a name="line.145"></a>
+<FONT color="green">146</FONT>         * This statistic can be used to perform a one sample t-test for the mean.<a name="line.146"></a>
+<FONT color="green">147</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.147"></a>
+<FONT color="green">148</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.148"></a>
+<FONT color="green">149</FONT>         * &lt;li&gt;The observed array length must be at least 2.<a name="line.149"></a>
+<FONT color="green">150</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.150"></a>
+<FONT color="green">151</FONT>         *<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @param mu comparison constant<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @param observed array of values<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @return t statistic<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @throws IllegalArgumentException if input array length is less than 2<a name="line.155"></a>
+<FONT color="green">156</FONT>         */<a name="line.156"></a>
+<FONT color="green">157</FONT>        double t(double mu, double[] observed)<a name="line.157"></a>
+<FONT color="green">158</FONT>            throws IllegalArgumentException;<a name="line.158"></a>
+<FONT color="green">159</FONT>        /**<a name="line.159"></a>
+<FONT color="green">160</FONT>         * Computes a &lt;a href="http://www.itl.nist.gov/div898/handbook/prc/section2/prc22.htm#formula"&gt;<a name="line.160"></a>
+<FONT color="green">161</FONT>         * t statistic &lt;/a&gt; to use in comparing the mean of the dataset described by<a name="line.161"></a>
+<FONT color="green">162</FONT>         * &lt;code&gt;sampleStats&lt;/code&gt; to &lt;code&gt;mu&lt;/code&gt;.<a name="line.162"></a>
+<FONT color="green">163</FONT>         * &lt;p&gt;<a name="line.163"></a>
+<FONT color="green">164</FONT>         * This statistic can be used to perform a one sample t-test for the mean.<a name="line.164"></a>
+<FONT color="green">165</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.165"></a>
+<FONT color="green">166</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.166"></a>
+<FONT color="green">167</FONT>         * &lt;li&gt;&lt;code&gt;observed.getN() &gt; = 2&lt;/code&gt;.<a name="line.167"></a>
+<FONT color="green">168</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.168"></a>
+<FONT color="green">169</FONT>         *<a name="line.169"></a>
+<FONT color="green">170</FONT>         * @param mu comparison constant<a name="line.170"></a>
+<FONT color="green">171</FONT>         * @param sampleStats DescriptiveStatistics holding sample summary statitstics<a name="line.171"></a>
+<FONT color="green">172</FONT>         * @return t statistic<a name="line.172"></a>
+<FONT color="green">173</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.173"></a>
+<FONT color="green">174</FONT>         */<a name="line.174"></a>
+<FONT color="green">175</FONT>        double t(double mu, StatisticalSummary sampleStats)<a name="line.175"></a>
+<FONT color="green">176</FONT>            throws IllegalArgumentException;<a name="line.176"></a>
+<FONT color="green">177</FONT>        /**<a name="line.177"></a>
+<FONT color="green">178</FONT>         * Computes a 2-sample t statistic,  under the hypothesis of equal<a name="line.178"></a>
+<FONT color="green">179</FONT>         * subpopulation variances.  To compute a t-statistic without the<a name="line.179"></a>
+<FONT color="green">180</FONT>         * equal variances hypothesis, use {@link #t(double[], double[])}.<a name="line.180"></a>
+<FONT color="green">181</FONT>         * &lt;p&gt;<a name="line.181"></a>
+<FONT color="green">182</FONT>         * This statistic can be used to perform a (homoscedastic) two-sample<a name="line.182"></a>
+<FONT color="green">183</FONT>         * t-test to compare sample means.&lt;/p&gt;<a name="line.183"></a>
+<FONT color="green">184</FONT>         * &lt;p&gt;<a name="line.184"></a>
+<FONT color="green">185</FONT>         * The t-statisitc is&lt;/p&gt;<a name="line.185"></a>
+<FONT color="green">186</FONT>         * &lt;p&gt;<a name="line.186"></a>
+<FONT color="green">187</FONT>         * &amp;nbsp;&amp;nbsp;&lt;code&gt;  t = (m1 - m2) / (sqrt(1/n1 +1/n2) sqrt(var))&lt;/code&gt;<a name="line.187"></a>
+<FONT color="green">188</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.188"></a>
+<FONT color="green">189</FONT>         * where &lt;strong&gt;&lt;code&gt;n1&lt;/code&gt;&lt;/strong&gt; is the size of first sample;<a name="line.189"></a>
+<FONT color="green">190</FONT>         * &lt;strong&gt;&lt;code&gt; n2&lt;/code&gt;&lt;/strong&gt; is the size of second sample;<a name="line.190"></a>
+<FONT color="green">191</FONT>         * &lt;strong&gt;&lt;code&gt; m1&lt;/code&gt;&lt;/strong&gt; is the mean of first sample;<a name="line.191"></a>
+<FONT color="green">192</FONT>         * &lt;strong&gt;&lt;code&gt; m2&lt;/code&gt;&lt;/strong&gt; is the mean of second sample&lt;/li&gt;<a name="line.192"></a>
+<FONT color="green">193</FONT>         * &lt;/ul&gt;<a name="line.193"></a>
+<FONT color="green">194</FONT>         * and &lt;strong&gt;&lt;code&gt;var&lt;/code&gt;&lt;/strong&gt; is the pooled variance estimate:<a name="line.194"></a>
+<FONT color="green">195</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.195"></a>
+<FONT color="green">196</FONT>         * &lt;code&gt;var = sqrt(((n1 - 1)var1 + (n2 - 1)var2) / ((n1-1) + (n2-1)))&lt;/code&gt;<a name="line.196"></a>
+<FONT color="green">197</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.197"></a>
+<FONT color="green">198</FONT>         * with &lt;strong&gt;&lt;code&gt;var1&lt;code&gt;&lt;/strong&gt; the variance of the first sample and<a name="line.198"></a>
+<FONT color="green">199</FONT>         * &lt;strong&gt;&lt;code&gt;var2&lt;/code&gt;&lt;/strong&gt; the variance of the second sample.<a name="line.199"></a>
+<FONT color="green">200</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.200"></a>
+<FONT color="green">201</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.201"></a>
+<FONT color="green">202</FONT>         * &lt;li&gt;The observed array lengths must both be at least 2.<a name="line.202"></a>
+<FONT color="green">203</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.203"></a>
+<FONT color="green">204</FONT>         *<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @param sample1 array of sample data values<a name="line.205"></a>
+<FONT color="green">206</FONT>         * @param sample2 array of sample data values<a name="line.206"></a>
+<FONT color="green">207</FONT>         * @return t statistic<a name="line.207"></a>
+<FONT color="green">208</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.208"></a>
+<FONT color="green">209</FONT>         */<a name="line.209"></a>
+<FONT color="green">210</FONT>        double homoscedasticT(double[] sample1, double[] sample2)<a name="line.210"></a>
+<FONT color="green">211</FONT>            throws IllegalArgumentException;<a name="line.211"></a>
+<FONT color="green">212</FONT>        /**<a name="line.212"></a>
+<FONT color="green">213</FONT>         * Computes a 2-sample t statistic, without the hypothesis of equal<a name="line.213"></a>
+<FONT color="green">214</FONT>         * subpopulation variances.  To compute a t-statistic assuming equal<a name="line.214"></a>
+<FONT color="green">215</FONT>         * variances, use {@link #homoscedasticT(double[], double[])}.<a name="line.215"></a>
+<FONT color="green">216</FONT>         * &lt;p&gt;<a name="line.216"></a>
+<FONT color="green">217</FONT>         * This statistic can be used to perform a two-sample t-test to compare<a name="line.217"></a>
+<FONT color="green">218</FONT>         * sample means.&lt;/p&gt;<a name="line.218"></a>
+<FONT color="green">219</FONT>         * &lt;p&gt;<a name="line.219"></a>
+<FONT color="green">220</FONT>         * The t-statisitc is&lt;/p&gt;<a name="line.220"></a>
+<FONT color="green">221</FONT>         * &lt;p&gt;<a name="line.221"></a>
+<FONT color="green">222</FONT>         * &amp;nbsp;&amp;nbsp; &lt;code&gt;  t = (m1 - m2) / sqrt(var1/n1 + var2/n2)&lt;/code&gt;<a name="line.222"></a>
+<FONT color="green">223</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.223"></a>
+<FONT color="green">224</FONT>         *  where &lt;strong&gt;&lt;code&gt;n1&lt;/code&gt;&lt;/strong&gt; is the size of the first sample<a name="line.224"></a>
+<FONT color="green">225</FONT>         * &lt;strong&gt;&lt;code&gt; n2&lt;/code&gt;&lt;/strong&gt; is the size of the second sample;<a name="line.225"></a>
+<FONT color="green">226</FONT>         * &lt;strong&gt;&lt;code&gt; m1&lt;/code&gt;&lt;/strong&gt; is the mean of the first sample;<a name="line.226"></a>
+<FONT color="green">227</FONT>         * &lt;strong&gt;&lt;code&gt; m2&lt;/code&gt;&lt;/strong&gt; is the mean of the second sample;<a name="line.227"></a>
+<FONT color="green">228</FONT>         * &lt;strong&gt;&lt;code&gt; var1&lt;/code&gt;&lt;/strong&gt; is the variance of the first sample;<a name="line.228"></a>
+<FONT color="green">229</FONT>         * &lt;strong&gt;&lt;code&gt; var2&lt;/code&gt;&lt;/strong&gt; is the variance of the second sample;<a name="line.229"></a>
+<FONT color="green">230</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.230"></a>
+<FONT color="green">231</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.231"></a>
+<FONT color="green">232</FONT>         * &lt;li&gt;The observed array lengths must both be at least 2.<a name="line.232"></a>
+<FONT color="green">233</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.233"></a>
+<FONT color="green">234</FONT>         *<a name="line.234"></a>
+<FONT color="green">235</FONT>         * @param sample1 array of sample data values<a name="line.235"></a>
+<FONT color="green">236</FONT>         * @param sample2 array of sample data values<a name="line.236"></a>
+<FONT color="green">237</FONT>         * @return t statistic<a name="line.237"></a>
+<FONT color="green">238</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.238"></a>
+<FONT color="green">239</FONT>         */<a name="line.239"></a>
+<FONT color="green">240</FONT>        double t(double[] sample1, double[] sample2)<a name="line.240"></a>
+<FONT color="green">241</FONT>            throws IllegalArgumentException;<a name="line.241"></a>
+<FONT color="green">242</FONT>        /**<a name="line.242"></a>
+<FONT color="green">243</FONT>         * Computes a 2-sample t statistic &lt;/a&gt;, comparing the means of the datasets<a name="line.243"></a>
+<FONT color="green">244</FONT>         * described by two {@link StatisticalSummary} instances, without the<a name="line.244"></a>
+<FONT color="green">245</FONT>         * assumption of equal subpopulation variances.  Use<a name="line.245"></a>
+<FONT color="green">246</FONT>         * {@link #homoscedasticT(StatisticalSummary, StatisticalSummary)} to<a name="line.246"></a>
+<FONT color="green">247</FONT>         * compute a t-statistic under the equal variances assumption.<a name="line.247"></a>
+<FONT color="green">248</FONT>         * &lt;p&gt;<a name="line.248"></a>
+<FONT color="green">249</FONT>         * This statistic can be used to perform a two-sample t-test to compare<a name="line.249"></a>
+<FONT color="green">250</FONT>         * sample means.&lt;/p&gt;<a name="line.250"></a>
+<FONT color="green">251</FONT>         * &lt;p&gt;<a name="line.251"></a>
+<FONT color="green">252</FONT>          * The returned  t-statisitc is&lt;/p&gt;<a name="line.252"></a>
+<FONT color="green">253</FONT>         * &lt;p&gt;<a name="line.253"></a>
+<FONT color="green">254</FONT>         * &amp;nbsp;&amp;nbsp; &lt;code&gt;  t = (m1 - m2) / sqrt(var1/n1 + var2/n2)&lt;/code&gt;<a name="line.254"></a>
+<FONT color="green">255</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.255"></a>
+<FONT color="green">256</FONT>         * where &lt;strong&gt;&lt;code&gt;n1&lt;/code&gt;&lt;/strong&gt; is the size of the first sample;<a name="line.256"></a>
+<FONT color="green">257</FONT>         * &lt;strong&gt;&lt;code&gt; n2&lt;/code&gt;&lt;/strong&gt; is the size of the second sample;<a name="line.257"></a>
+<FONT color="green">258</FONT>         * &lt;strong&gt;&lt;code&gt; m1&lt;/code&gt;&lt;/strong&gt; is the mean of the first sample;<a name="line.258"></a>
+<FONT color="green">259</FONT>         * &lt;strong&gt;&lt;code&gt; m2&lt;/code&gt;&lt;/strong&gt; is the mean of the second sample<a name="line.259"></a>
+<FONT color="green">260</FONT>         * &lt;strong&gt;&lt;code&gt; var1&lt;/code&gt;&lt;/strong&gt; is the variance of the first sample;<a name="line.260"></a>
+<FONT color="green">261</FONT>         * &lt;strong&gt;&lt;code&gt; var2&lt;/code&gt;&lt;/strong&gt; is the variance of the second sample<a name="line.261"></a>
+<FONT color="green">262</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.262"></a>
+<FONT color="green">263</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.263"></a>
+<FONT color="green">264</FONT>         * &lt;li&gt;The datasets described by the two Univariates must each contain<a name="line.264"></a>
+<FONT color="green">265</FONT>         * at least 2 observations.<a name="line.265"></a>
+<FONT color="green">266</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.266"></a>
+<FONT color="green">267</FONT>         *<a name="line.267"></a>
+<FONT color="green">268</FONT>         * @param sampleStats1 StatisticalSummary describing data from the first sample<a name="line.268"></a>
+<FONT color="green">269</FONT>         * @param sampleStats2 StatisticalSummary describing data from the second sample<a name="line.269"></a>
+<FONT color="green">270</FONT>         * @return t statistic<a name="line.270"></a>
+<FONT color="green">271</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.271"></a>
+<FONT color="green">272</FONT>         */<a name="line.272"></a>
+<FONT color="green">273</FONT>        double t(<a name="line.273"></a>
+<FONT color="green">274</FONT>            StatisticalSummary sampleStats1,<a name="line.274"></a>
+<FONT color="green">275</FONT>            StatisticalSummary sampleStats2)<a name="line.275"></a>
+<FONT color="green">276</FONT>            throws IllegalArgumentException;<a name="line.276"></a>
+<FONT color="green">277</FONT>        /**<a name="line.277"></a>
+<FONT color="green">278</FONT>         * Computes a 2-sample t statistic, comparing the means of the datasets<a name="line.278"></a>
+<FONT color="green">279</FONT>         * described by two {@link StatisticalSummary} instances, under the<a name="line.279"></a>
+<FONT color="green">280</FONT>         * assumption of equal subpopulation variances.  To compute a t-statistic<a name="line.280"></a>
+<FONT color="green">281</FONT>         * without the equal variances assumption, use<a name="line.281"></a>
+<FONT color="green">282</FONT>         * {@link #t(StatisticalSummary, StatisticalSummary)}.<a name="line.282"></a>
+<FONT color="green">283</FONT>         * &lt;p&gt;<a name="line.283"></a>
+<FONT color="green">284</FONT>         * This statistic can be used to perform a (homoscedastic) two-sample<a name="line.284"></a>
+<FONT color="green">285</FONT>         * t-test to compare sample means.&lt;/p&gt;<a name="line.285"></a>
+<FONT color="green">286</FONT>         * &lt;p&gt;<a name="line.286"></a>
+<FONT color="green">287</FONT>         * The t-statisitc returned is&lt;/p&gt;<a name="line.287"></a>
+<FONT color="green">288</FONT>         * &lt;p&gt;<a name="line.288"></a>
+<FONT color="green">289</FONT>         * &amp;nbsp;&amp;nbsp;&lt;code&gt;  t = (m1 - m2) / (sqrt(1/n1 +1/n2) sqrt(var))&lt;/code&gt;<a name="line.289"></a>
+<FONT color="green">290</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.290"></a>
+<FONT color="green">291</FONT>         * where &lt;strong&gt;&lt;code&gt;n1&lt;/code&gt;&lt;/strong&gt; is the size of first sample;<a name="line.291"></a>
+<FONT color="green">292</FONT>         * &lt;strong&gt;&lt;code&gt; n2&lt;/code&gt;&lt;/strong&gt; is the size of second sample;<a name="line.292"></a>
+<FONT color="green">293</FONT>         * &lt;strong&gt;&lt;code&gt; m1&lt;/code&gt;&lt;/strong&gt; is the mean of first sample;<a name="line.293"></a>
+<FONT color="green">294</FONT>         * &lt;strong&gt;&lt;code&gt; m2&lt;/code&gt;&lt;/strong&gt; is the mean of second sample<a name="line.294"></a>
+<FONT color="green">295</FONT>         * and &lt;strong&gt;&lt;code&gt;var&lt;/code&gt;&lt;/strong&gt; is the pooled variance estimate:<a name="line.295"></a>
+<FONT color="green">296</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.296"></a>
+<FONT color="green">297</FONT>         * &lt;code&gt;var = sqrt(((n1 - 1)var1 + (n2 - 1)var2) / ((n1-1) + (n2-1)))&lt;/code&gt;<a name="line.297"></a>
+<FONT color="green">298</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.298"></a>
+<FONT color="green">299</FONT>         * with &lt;strong&gt;&lt;code&gt;var1&lt;code&gt;&lt;/strong&gt; the variance of the first sample and<a name="line.299"></a>
+<FONT color="green">300</FONT>         * &lt;strong&gt;&lt;code&gt;var2&lt;/code&gt;&lt;/strong&gt; the variance of the second sample.<a name="line.300"></a>
+<FONT color="green">301</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.301"></a>
+<FONT color="green">302</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.302"></a>
+<FONT color="green">303</FONT>         * &lt;li&gt;The datasets described by the two Univariates must each contain<a name="line.303"></a>
+<FONT color="green">304</FONT>         * at least 2 observations.<a name="line.304"></a>
+<FONT color="green">305</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.305"></a>
+<FONT color="green">306</FONT>         *<a name="line.306"></a>
+<FONT color="green">307</FONT>         * @param sampleStats1 StatisticalSummary describing data from the first sample<a name="line.307"></a>
+<FONT color="green">308</FONT>         * @param sampleStats2 StatisticalSummary describing data from the second sample<a name="line.308"></a>
+<FONT color="green">309</FONT>         * @return t statistic<a name="line.309"></a>
+<FONT color="green">310</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.310"></a>
+<FONT color="green">311</FONT>         */<a name="line.311"></a>
+<FONT color="green">312</FONT>        double homoscedasticT(<a name="line.312"></a>
+<FONT color="green">313</FONT>            StatisticalSummary sampleStats1,<a name="line.313"></a>
+<FONT color="green">314</FONT>            StatisticalSummary sampleStats2)<a name="line.314"></a>
+<FONT color="green">315</FONT>            throws IllegalArgumentException;<a name="line.315"></a>
+<FONT color="green">316</FONT>        /**<a name="line.316"></a>
+<FONT color="green">317</FONT>         * Returns the &lt;i&gt;observed significance level&lt;/i&gt;, or<a name="line.317"></a>
+<FONT color="green">318</FONT>         * &lt;i&gt;p-value&lt;/i&gt;, associated with a one-sample, two-tailed t-test<a name="line.318"></a>
+<FONT color="green">319</FONT>         * comparing the mean of the input array with the constant &lt;code&gt;mu&lt;/code&gt;.<a name="line.319"></a>
+<FONT color="green">320</FONT>         * &lt;p&gt;<a name="line.320"></a>
+<FONT color="green">321</FONT>         * The number returned is the smallest significance level<a name="line.321"></a>
+<FONT color="green">322</FONT>         * at which one can reject the null hypothesis that the mean equals<a name="line.322"></a>
+<FONT color="green">323</FONT>         * &lt;code&gt;mu&lt;/code&gt; in favor of the two-sided alternative that the mean<a name="line.323"></a>
+<FONT color="green">324</FONT>         * is different from &lt;code&gt;mu&lt;/code&gt;. For a one-sided test, divide the<a name="line.324"></a>
+<FONT color="green">325</FONT>         * returned value by 2.&lt;/p&gt;<a name="line.325"></a>
+<FONT color="green">326</FONT>         * &lt;p&gt;<a name="line.326"></a>
+<FONT color="green">327</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.327"></a>
+<FONT color="green">328</FONT>         * The validity of the test depends on the assumptions of the parametric<a name="line.328"></a>
+<FONT color="green">329</FONT>         * t-test procedure, as discussed<a name="line.329"></a>
+<FONT color="green">330</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;here&lt;/a&gt;<a name="line.330"></a>
+<FONT color="green">331</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.331"></a>
+<FONT color="green">332</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.332"></a>
+<FONT color="green">333</FONT>         * &lt;li&gt;The observed array length must be at least 2.<a name="line.333"></a>
+<FONT color="green">334</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.334"></a>
+<FONT color="green">335</FONT>         *<a name="line.335"></a>
+<FONT color="green">336</FONT>         * @param mu constant value to compare sample mean against<a name="line.336"></a>
+<FONT color="green">337</FONT>         * @param sample array of sample data values<a name="line.337"></a>
+<FONT color="green">338</FONT>         * @return p-value<a name="line.338"></a>
+<FONT color="green">339</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.339"></a>
+<FONT color="green">340</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.340"></a>
+<FONT color="green">341</FONT>         */<a name="line.341"></a>
+<FONT color="green">342</FONT>        double tTest(double mu, double[] sample)<a name="line.342"></a>
+<FONT color="green">343</FONT>            throws IllegalArgumentException, MathException;<a name="line.343"></a>
+<FONT color="green">344</FONT>        /**<a name="line.344"></a>
+<FONT color="green">345</FONT>         * Performs a &lt;a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm"&gt;<a name="line.345"></a>
+<FONT color="green">346</FONT>         * two-sided t-test&lt;/a&gt; evaluating the null hypothesis that the mean of the population from<a name="line.346"></a>
+<FONT color="green">347</FONT>         * which &lt;code&gt;sample&lt;/code&gt; is drawn equals &lt;code&gt;mu&lt;/code&gt;.<a name="line.347"></a>
+<FONT color="green">348</FONT>         * &lt;p&gt;<a name="line.348"></a>
+<FONT color="green">349</FONT>         * Returns &lt;code&gt;true&lt;/code&gt; iff the null hypothesis can be<a name="line.349"></a>
+<FONT color="green">350</FONT>         * rejected with confidence &lt;code&gt;1 - alpha&lt;/code&gt;.  To<a name="line.350"></a>
+<FONT color="green">351</FONT>         * perform a 1-sided test, use &lt;code&gt;alpha * 2&lt;/code&gt;&lt;/p&gt;<a name="line.351"></a>
+<FONT color="green">352</FONT>         * &lt;p&gt;<a name="line.352"></a>
+<FONT color="green">353</FONT>         * &lt;strong&gt;Examples:&lt;/strong&gt;&lt;br&gt;&lt;ol&gt;<a name="line.353"></a>
+<FONT color="green">354</FONT>         * &lt;li&gt;To test the (2-sided) hypothesis &lt;code&gt;sample mean = mu &lt;/code&gt; at<a name="line.354"></a>
+<FONT color="green">355</FONT>         * the 95% level, use &lt;br&gt;&lt;code&gt;tTest(mu, sample, 0.05) &lt;/code&gt;<a name="line.355"></a>
+<FONT color="green">356</FONT>         * &lt;/li&gt;<a name="line.356"></a>
+<FONT color="green">357</FONT>         * &lt;li&gt;To test the (one-sided) hypothesis &lt;code&gt; sample mean &lt; mu &lt;/code&gt;<a name="line.357"></a>
+<FONT color="green">358</FONT>         * at the 99% level, first verify that the measured sample mean is less<a name="line.358"></a>
+<FONT color="green">359</FONT>         * than &lt;code&gt;mu&lt;/code&gt; and then use<a name="line.359"></a>
+<FONT color="green">360</FONT>         * &lt;br&gt;&lt;code&gt;tTest(mu, sample, 0.02) &lt;/code&gt;<a name="line.360"></a>
+<FONT color="green">361</FONT>         * &lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;<a name="line.361"></a>
+<FONT color="green">362</FONT>         * &lt;p&gt;<a name="line.362"></a>
+<FONT color="green">363</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.363"></a>
+<FONT color="green">364</FONT>         * The validity of the test depends on the assumptions of the one-sample<a name="line.364"></a>
+<FONT color="green">365</FONT>         * parametric t-test procedure, as discussed<a name="line.365"></a>
+<FONT color="green">366</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/sg_glos.html#one-sample"&gt;here&lt;/a&gt;<a name="line.366"></a>
+<FONT color="green">367</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.367"></a>
+<FONT color="green">368</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.368"></a>
+<FONT color="green">369</FONT>         * &lt;li&gt;The observed array length must be at least 2.<a name="line.369"></a>
+<FONT color="green">370</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.370"></a>
+<FONT color="green">371</FONT>         *<a name="line.371"></a>
+<FONT color="green">372</FONT>         * @param mu constant value to compare sample mean against<a name="line.372"></a>
+<FONT color="green">373</FONT>         * @param sample array of sample data values<a name="line.373"></a>
+<FONT color="green">374</FONT>         * @param alpha significance level of the test<a name="line.374"></a>
+<FONT color="green">375</FONT>         * @return p-value<a name="line.375"></a>
+<FONT color="green">376</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.376"></a>
+<FONT color="green">377</FONT>         * @throws MathException if an error computing the p-value<a name="line.377"></a>
+<FONT color="green">378</FONT>         */<a name="line.378"></a>
+<FONT color="green">379</FONT>        boolean tTest(double mu, double[] sample, double alpha)<a name="line.379"></a>
+<FONT color="green">380</FONT>            throws IllegalArgumentException, MathException;<a name="line.380"></a>
+<FONT color="green">381</FONT>        /**<a name="line.381"></a>
+<FONT color="green">382</FONT>         * Returns the &lt;i&gt;observed significance level&lt;/i&gt;, or<a name="line.382"></a>
+<FONT color="green">383</FONT>         * &lt;i&gt;p-value&lt;/i&gt;, associated with a one-sample, two-tailed t-test<a name="line.383"></a>
+<FONT color="green">384</FONT>         * comparing the mean of the dataset described by &lt;code&gt;sampleStats&lt;/code&gt;<a name="line.384"></a>
+<FONT color="green">385</FONT>         * with the constant &lt;code&gt;mu&lt;/code&gt;.<a name="line.385"></a>
+<FONT color="green">386</FONT>         * &lt;p&gt;<a name="line.386"></a>
+<FONT color="green">387</FONT>         * The number returned is the smallest significance level<a name="line.387"></a>
+<FONT color="green">388</FONT>         * at which one can reject the null hypothesis that the mean equals<a name="line.388"></a>
+<FONT color="green">389</FONT>         * &lt;code&gt;mu&lt;/code&gt; in favor of the two-sided alternative that the mean<a name="line.389"></a>
+<FONT color="green">390</FONT>         * is different from &lt;code&gt;mu&lt;/code&gt;. For a one-sided test, divide the<a name="line.390"></a>
+<FONT color="green">391</FONT>         * returned value by 2.&lt;/p&gt;<a name="line.391"></a>
+<FONT color="green">392</FONT>         * &lt;p&gt;<a name="line.392"></a>
+<FONT color="green">393</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.393"></a>
+<FONT color="green">394</FONT>         * The validity of the test depends on the assumptions of the parametric<a name="line.394"></a>
+<FONT color="green">395</FONT>         * t-test procedure, as discussed<a name="line.395"></a>
+<FONT color="green">396</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;<a name="line.396"></a>
+<FONT color="green">397</FONT>         * here&lt;/a&gt;&lt;/p&gt;<a name="line.397"></a>
+<FONT color="green">398</FONT>         * &lt;p&gt;<a name="line.398"></a>
+<FONT color="green">399</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.399"></a>
+<FONT color="green">400</FONT>         * &lt;li&gt;The sample must contain at least 2 observations.<a name="line.400"></a>
+<FONT color="green">401</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.401"></a>
+<FONT color="green">402</FONT>         *<a name="line.402"></a>
+<FONT color="green">403</FONT>         * @param mu constant value to compare sample mean against<a name="line.403"></a>
+<FONT color="green">404</FONT>         * @param sampleStats StatisticalSummary describing sample data<a name="line.404"></a>
+<FONT color="green">405</FONT>         * @return p-value<a name="line.405"></a>
+<FONT color="green">406</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.406"></a>
+<FONT color="green">407</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.407"></a>
+<FONT color="green">408</FONT>         */<a name="line.408"></a>
+<FONT color="green">409</FONT>        double tTest(double mu, StatisticalSummary sampleStats)<a name="line.409"></a>
+<FONT color="green">410</FONT>            throws IllegalArgumentException, MathException;<a name="line.410"></a>
+<FONT color="green">411</FONT>        /**<a name="line.411"></a>
+<FONT color="green">412</FONT>         * Performs a &lt;a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm"&gt;<a name="line.412"></a>
+<FONT color="green">413</FONT>         * two-sided t-test&lt;/a&gt; evaluating the null hypothesis that the mean of the<a name="line.413"></a>
+<FONT color="green">414</FONT>         * population from which the dataset described by &lt;code&gt;stats&lt;/code&gt; is<a name="line.414"></a>
+<FONT color="green">415</FONT>         * drawn equals &lt;code&gt;mu&lt;/code&gt;.<a name="line.415"></a>
+<FONT color="green">416</FONT>         * &lt;p&gt;<a name="line.416"></a>
+<FONT color="green">417</FONT>         * Returns &lt;code&gt;true&lt;/code&gt; iff the null hypothesis can be rejected with<a name="line.417"></a>
+<FONT color="green">418</FONT>         * confidence &lt;code&gt;1 - alpha&lt;/code&gt;.  To  perform a 1-sided test, use<a name="line.418"></a>
+<FONT color="green">419</FONT>         * &lt;code&gt;alpha * 2.&lt;/code&gt;&lt;/p&gt;<a name="line.419"></a>
+<FONT color="green">420</FONT>         * &lt;p&gt;<a name="line.420"></a>
+<FONT color="green">421</FONT>         * &lt;strong&gt;Examples:&lt;/strong&gt;&lt;br&gt;&lt;ol&gt;<a name="line.421"></a>
+<FONT color="green">422</FONT>         * &lt;li&gt;To test the (2-sided) hypothesis &lt;code&gt;sample mean = mu &lt;/code&gt; at<a name="line.422"></a>
+<FONT color="green">423</FONT>         * the 95% level, use &lt;br&gt;&lt;code&gt;tTest(mu, sampleStats, 0.05) &lt;/code&gt;<a name="line.423"></a>
+<FONT color="green">424</FONT>         * &lt;/li&gt;<a name="line.424"></a>
+<FONT color="green">425</FONT>         * &lt;li&gt;To test the (one-sided) hypothesis &lt;code&gt; sample mean &lt; mu &lt;/code&gt;<a name="line.425"></a>
+<FONT color="green">426</FONT>         * at the 99% level, first verify that the measured sample mean is less<a name="line.426"></a>
+<FONT color="green">427</FONT>         * than &lt;code&gt;mu&lt;/code&gt; and then use<a name="line.427"></a>
+<FONT color="green">428</FONT>         * &lt;br&gt;&lt;code&gt;tTest(mu, sampleStats, 0.02) &lt;/code&gt;<a name="line.428"></a>
+<FONT color="green">429</FONT>         * &lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;<a name="line.429"></a>
+<FONT color="green">430</FONT>         * &lt;p&gt;<a name="line.430"></a>
+<FONT color="green">431</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.431"></a>
+<FONT color="green">432</FONT>         * The validity of the test depends on the assumptions of the one-sample<a name="line.432"></a>
+<FONT color="green">433</FONT>         * parametric t-test procedure, as discussed<a name="line.433"></a>
+<FONT color="green">434</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/sg_glos.html#one-sample"&gt;here&lt;/a&gt;<a name="line.434"></a>
+<FONT color="green">435</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.435"></a>
+<FONT color="green">436</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.436"></a>
+<FONT color="green">437</FONT>         * &lt;li&gt;The sample must include at least 2 observations.<a name="line.437"></a>
+<FONT color="green">438</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.438"></a>
+<FONT color="green">439</FONT>         *<a name="line.439"></a>
+<FONT color="green">440</FONT>         * @param mu constant value to compare sample mean against<a name="line.440"></a>
+<FONT color="green">441</FONT>         * @param sampleStats StatisticalSummary describing sample data values<a name="line.441"></a>
+<FONT color="green">442</FONT>         * @param alpha significance level of the test<a name="line.442"></a>
+<FONT color="green">443</FONT>         * @return p-value<a name="line.443"></a>
+<FONT color="green">444</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.444"></a>
+<FONT color="green">445</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.445"></a>
+<FONT color="green">446</FONT>         */<a name="line.446"></a>
+<FONT color="green">447</FONT>        boolean tTest(<a name="line.447"></a>
+<FONT color="green">448</FONT>            double mu,<a name="line.448"></a>
+<FONT color="green">449</FONT>            StatisticalSummary sampleStats,<a name="line.449"></a>
+<FONT color="green">450</FONT>            double alpha)<a name="line.450"></a>
+<FONT color="green">451</FONT>            throws IllegalArgumentException, MathException;<a name="line.451"></a>
+<FONT color="green">452</FONT>        /**<a name="line.452"></a>
+<FONT color="green">453</FONT>         * Returns the &lt;i&gt;observed significance level&lt;/i&gt;, or<a name="line.453"></a>
+<FONT color="green">454</FONT>         * &lt;i&gt;p-value&lt;/i&gt;, associated with a two-sample, two-tailed t-test<a name="line.454"></a>
+<FONT color="green">455</FONT>         * comparing the means of the input arrays.<a name="line.455"></a>
+<FONT color="green">456</FONT>         * &lt;p&gt;<a name="line.456"></a>
+<FONT color="green">457</FONT>         * The number returned is the smallest significance level<a name="line.457"></a>
+<FONT color="green">458</FONT>         * at which one can reject the null hypothesis that the two means are<a name="line.458"></a>
+<FONT color="green">459</FONT>         * equal in favor of the two-sided alternative that they are different.<a name="line.459"></a>
+<FONT color="green">460</FONT>         * For a one-sided test, divide the returned value by 2.&lt;/p&gt;<a name="line.460"></a>
+<FONT color="green">461</FONT>         * &lt;p&gt;<a name="line.461"></a>
+<FONT color="green">462</FONT>         * The test does not assume that the underlying popuation variances are<a name="line.462"></a>
+<FONT color="green">463</FONT>         * equal  and it uses approximated degrees of freedom computed from the<a name="line.463"></a>
+<FONT color="green">464</FONT>         * sample data to compute the p-value.  The t-statistic used is as defined in<a name="line.464"></a>
+<FONT color="green">465</FONT>         * {@link #t(double[], double[])} and the Welch-Satterthwaite approximation<a name="line.465"></a>
+<FONT color="green">466</FONT>         * to the degrees of freedom is used,<a name="line.466"></a>
+<FONT color="green">467</FONT>         * as described<a name="line.467"></a>
+<FONT color="green">468</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/prc/section3/prc31.htm"&gt;<a name="line.468"></a>
+<FONT color="green">469</FONT>         * here.&lt;/a&gt;  To perform the test under the assumption of equal subpopulation<a name="line.469"></a>
+<FONT color="green">470</FONT>         * variances, use {@link #homoscedasticTTest(double[], double[])}.&lt;/p&gt;<a name="line.470"></a>
+<FONT color="green">471</FONT>         * &lt;p&gt;<a name="line.471"></a>
+<FONT color="green">472</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.472"></a>
+<FONT color="green">473</FONT>         * The validity of the p-value depends on the assumptions of the parametric<a name="line.473"></a>
+<FONT color="green">474</FONT>         * t-test procedure, as discussed<a name="line.474"></a>
+<FONT color="green">475</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;<a name="line.475"></a>
+<FONT color="green">476</FONT>         * here&lt;/a&gt;&lt;/p&gt;<a name="line.476"></a>
+<FONT color="green">477</FONT>         * &lt;p&gt;<a name="line.477"></a>
+<FONT color="green">478</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.478"></a>
+<FONT color="green">479</FONT>         * &lt;li&gt;The observed array lengths must both be at least 2.<a name="line.479"></a>
+<FONT color="green">480</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.480"></a>
+<FONT color="green">481</FONT>         *<a name="line.481"></a>
+<FONT color="green">482</FONT>         * @param sample1 array of sample data values<a name="line.482"></a>
+<FONT color="green">483</FONT>         * @param sample2 array of sample data values<a name="line.483"></a>
+<FONT color="green">484</FONT>         * @return p-value for t-test<a name="line.484"></a>
+<FONT color="green">485</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.485"></a>
+<FONT color="green">486</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.486"></a>
+<FONT color="green">487</FONT>         */<a name="line.487"></a>
+<FONT color="green">488</FONT>        double tTest(double[] sample1, double[] sample2)<a name="line.488"></a>
+<FONT color="green">489</FONT>            throws IllegalArgumentException, MathException;<a name="line.489"></a>
+<FONT color="green">490</FONT>        /**<a name="line.490"></a>
+<FONT color="green">491</FONT>         * Returns the &lt;i&gt;observed significance level&lt;/i&gt;, or<a name="line.491"></a>
+<FONT color="green">492</FONT>         * &lt;i&gt;p-value&lt;/i&gt;, associated with a two-sample, two-tailed t-test<a name="line.492"></a>
+<FONT color="green">493</FONT>         * comparing the means of the input arrays, under the assumption that<a name="line.493"></a>
+<FONT color="green">494</FONT>         * the two samples are drawn from subpopulations with equal variances.<a name="line.494"></a>
+<FONT color="green">495</FONT>         * To perform the test without the equal variances assumption, use<a name="line.495"></a>
+<FONT color="green">496</FONT>         * {@link #tTest(double[], double[])}.&lt;/p&gt;<a name="line.496"></a>
+<FONT color="green">497</FONT>         * &lt;p&gt;<a name="line.497"></a>
+<FONT color="green">498</FONT>         * The number returned is the smallest significance level<a name="line.498"></a>
+<FONT color="green">499</FONT>         * at which one can reject the null hypothesis that the two means are<a name="line.499"></a>
+<FONT color="green">500</FONT>         * equal in favor of the two-sided alternative that they are different.<a name="line.500"></a>
+<FONT color="green">501</FONT>         * For a one-sided test, divide the returned value by 2.&lt;/p&gt;<a name="line.501"></a>
+<FONT color="green">502</FONT>         * &lt;p&gt;<a name="line.502"></a>
+<FONT color="green">503</FONT>         * A pooled variance estimate is used to compute the t-statistic.  See<a name="line.503"></a>
+<FONT color="green">504</FONT>         * {@link #homoscedasticT(double[], double[])}. The sum of the sample sizes<a name="line.504"></a>
+<FONT color="green">505</FONT>         * minus 2 is used as the degrees of freedom.&lt;/p&gt;<a name="line.505"></a>
+<FONT color="green">506</FONT>         * &lt;p&gt;<a name="line.506"></a>
+<FONT color="green">507</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.507"></a>
+<FONT color="green">508</FONT>         * The validity of the p-value depends on the assumptions of the parametric<a name="line.508"></a>
+<FONT color="green">509</FONT>         * t-test procedure, as discussed<a name="line.509"></a>
+<FONT color="green">510</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;<a name="line.510"></a>
+<FONT color="green">511</FONT>         * here&lt;/a&gt;&lt;/p&gt;<a name="line.511"></a>
+<FONT color="green">512</FONT>         * &lt;p&gt;<a name="line.512"></a>
+<FONT color="green">513</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.513"></a>
+<FONT color="green">514</FONT>         * &lt;li&gt;The observed array lengths must both be at least 2.<a name="line.514"></a>
+<FONT color="green">515</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.515"></a>
+<FONT color="green">516</FONT>         *<a name="line.516"></a>
+<FONT color="green">517</FONT>         * @param sample1 array of sample data values<a name="line.517"></a>
+<FONT color="green">518</FONT>         * @param sample2 array of sample data values<a name="line.518"></a>
+<FONT color="green">519</FONT>         * @return p-value for t-test<a name="line.519"></a>
+<FONT color="green">520</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.520"></a>
+<FONT color="green">521</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.521"></a>
+<FONT color="green">522</FONT>         */<a name="line.522"></a>
+<FONT color="green">523</FONT>        double homoscedasticTTest(<a name="line.523"></a>
+<FONT color="green">524</FONT>            double[] sample1,<a name="line.524"></a>
+<FONT color="green">525</FONT>            double[] sample2)<a name="line.525"></a>
+<FONT color="green">526</FONT>            throws IllegalArgumentException, MathException;<a name="line.526"></a>
+<FONT color="green">527</FONT>        /**<a name="line.527"></a>
+<FONT color="green">528</FONT>         * Performs a<a name="line.528"></a>
+<FONT color="green">529</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm"&gt;<a name="line.529"></a>
+<FONT color="green">530</FONT>         * two-sided t-test&lt;/a&gt; evaluating the null hypothesis that &lt;code&gt;sample1&lt;/code&gt;<a name="line.530"></a>
+<FONT color="green">531</FONT>         * and &lt;code&gt;sample2&lt;/code&gt; are drawn from populations with the same mean,<a name="line.531"></a>
+<FONT color="green">532</FONT>         * with significance level &lt;code&gt;alpha&lt;/code&gt;.  This test does not assume<a name="line.532"></a>
+<FONT color="green">533</FONT>         * that the subpopulation variances are equal.  To perform the test assuming<a name="line.533"></a>
+<FONT color="green">534</FONT>         * equal variances, use<a name="line.534"></a>
+<FONT color="green">535</FONT>         * {@link #homoscedasticTTest(double[], double[], double)}.<a name="line.535"></a>
+<FONT color="green">536</FONT>         * &lt;p&gt;<a name="line.536"></a>
+<FONT color="green">537</FONT>         * Returns &lt;code&gt;true&lt;/code&gt; iff the null hypothesis that the means are<a name="line.537"></a>
+<FONT color="green">538</FONT>         * equal can be rejected with confidence &lt;code&gt;1 - alpha&lt;/code&gt;.  To<a name="line.538"></a>
+<FONT color="green">539</FONT>         * perform a 1-sided test, use &lt;code&gt;alpha * 2&lt;/code&gt;&lt;/p&gt;<a name="line.539"></a>
+<FONT color="green">540</FONT>         * &lt;p&gt;<a name="line.540"></a>
+<FONT color="green">541</FONT>         * See {@link #t(double[], double[])} for the formula used to compute the<a name="line.541"></a>
+<FONT color="green">542</FONT>         * t-statistic.  Degrees of freedom are approximated using the<a name="line.542"></a>
+<FONT color="green">543</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/prc/section3/prc31.htm"&gt;<a name="line.543"></a>
+<FONT color="green">544</FONT>         * Welch-Satterthwaite approximation.&lt;/a&gt;&lt;/p&gt;<a name="line.544"></a>
+<FONT color="green">545</FONT>         * &lt;p&gt;<a name="line.545"></a>
+<FONT color="green">546</FONT>         * &lt;strong&gt;Examples:&lt;/strong&gt;&lt;br&gt;&lt;ol&gt;<a name="line.546"></a>
+<FONT color="green">547</FONT>         * &lt;li&gt;To test the (2-sided) hypothesis &lt;code&gt;mean 1 = mean 2 &lt;/code&gt; at<a name="line.547"></a>
+<FONT color="green">548</FONT>         * the 95% level,  use<a name="line.548"></a>
+<FONT color="green">549</FONT>         * &lt;br&gt;&lt;code&gt;tTest(sample1, sample2, 0.05). &lt;/code&gt;<a name="line.549"></a>
+<FONT color="green">550</FONT>         * &lt;/li&gt;<a name="line.550"></a>
+<FONT color="green">551</FONT>         * &lt;li&gt;To test the (one-sided) hypothesis &lt;code&gt; mean 1 &lt; mean 2 &lt;/code&gt;,<a name="line.551"></a>
+<FONT color="green">552</FONT>         * at the 99% level, first verify that the measured  mean of &lt;code&gt;sample 1&lt;/code&gt;<a name="line.552"></a>
+<FONT color="green">553</FONT>         * is less than the mean of &lt;code&gt;sample 2&lt;/code&gt; and then use<a name="line.553"></a>
+<FONT color="green">554</FONT>         * &lt;br&gt;&lt;code&gt;tTest(sample1, sample2, 0.02) &lt;/code&gt;<a name="line.554"></a>
+<FONT color="green">555</FONT>         * &lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;<a name="line.555"></a>
+<FONT color="green">556</FONT>         * &lt;p&gt;<a name="line.556"></a>
+<FONT color="green">557</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.557"></a>
+<FONT color="green">558</FONT>         * The validity of the test depends on the assumptions of the parametric<a name="line.558"></a>
+<FONT color="green">559</FONT>         * t-test procedure, as discussed<a name="line.559"></a>
+<FONT color="green">560</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;<a name="line.560"></a>
+<FONT color="green">561</FONT>         * here&lt;/a&gt;&lt;/p&gt;<a name="line.561"></a>
+<FONT color="green">562</FONT>         * &lt;p&gt;<a name="line.562"></a>
+<FONT color="green">563</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.563"></a>
+<FONT color="green">564</FONT>         * &lt;li&gt;The observed array lengths must both be at least 2.<a name="line.564"></a>
+<FONT color="green">565</FONT>         * &lt;/li&gt;<a name="line.565"></a>
+<FONT color="green">566</FONT>         * &lt;li&gt; &lt;code&gt; 0 &lt; alpha &lt; 0.5 &lt;/code&gt;<a name="line.566"></a>
+<FONT color="green">567</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.567"></a>
+<FONT color="green">568</FONT>         *<a name="line.568"></a>
+<FONT color="green">569</FONT>         * @param sample1 array of sample data values<a name="line.569"></a>
+<FONT color="green">570</FONT>         * @param sample2 array of sample data values<a name="line.570"></a>
+<FONT color="green">571</FONT>         * @param alpha significance level of the test<a name="line.571"></a>
+<FONT color="green">572</FONT>         * @return true if the null hypothesis can be rejected with<a name="line.572"></a>
+<FONT color="green">573</FONT>         * confidence 1 - alpha<a name="line.573"></a>
+<FONT color="green">574</FONT>         * @throws IllegalArgumentException if the preconditions are not met<a name="line.574"></a>
+<FONT color="green">575</FONT>         * @throws MathException if an error occurs performing the test<a name="line.575"></a>
+<FONT color="green">576</FONT>         */<a name="line.576"></a>
+<FONT color="green">577</FONT>        boolean tTest(<a name="line.577"></a>
+<FONT color="green">578</FONT>            double[] sample1,<a name="line.578"></a>
+<FONT color="green">579</FONT>            double[] sample2,<a name="line.579"></a>
+<FONT color="green">580</FONT>            double alpha)<a name="line.580"></a>
+<FONT color="green">581</FONT>            throws IllegalArgumentException, MathException;<a name="line.581"></a>
+<FONT color="green">582</FONT>        /**<a name="line.582"></a>
+<FONT color="green">583</FONT>         * Performs a<a name="line.583"></a>
+<FONT color="green">584</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm"&gt;<a name="line.584"></a>
+<FONT color="green">585</FONT>         * two-sided t-test&lt;/a&gt; evaluating the null hypothesis that &lt;code&gt;sample1&lt;/code&gt;<a name="line.585"></a>
+<FONT color="green">586</FONT>         * and &lt;code&gt;sample2&lt;/code&gt; are drawn from populations with the same mean,<a name="line.586"></a>
+<FONT color="green">587</FONT>         * with significance level &lt;code&gt;alpha&lt;/code&gt;,  assuming that the<a name="line.587"></a>
+<FONT color="green">588</FONT>         * subpopulation variances are equal.  Use<a name="line.588"></a>
+<FONT color="green">589</FONT>         * {@link #tTest(double[], double[], double)} to perform the test without<a name="line.589"></a>
+<FONT color="green">590</FONT>         * the assumption of equal variances.<a name="line.590"></a>
+<FONT color="green">591</FONT>         * &lt;p&gt;<a name="line.591"></a>
+<FONT color="green">592</FONT>         * Returns &lt;code&gt;true&lt;/code&gt; iff the null hypothesis that the means are<a name="line.592"></a>
+<FONT color="green">593</FONT>         * equal can be rejected with confidence &lt;code&gt;1 - alpha&lt;/code&gt;.  To<a name="line.593"></a>
+<FONT color="green">594</FONT>         * perform a 1-sided test, use &lt;code&gt;alpha * 2.&lt;/code&gt;  To perform the test<a name="line.594"></a>
+<FONT color="green">595</FONT>         * without the assumption of equal subpopulation variances, use<a name="line.595"></a>
+<FONT color="green">596</FONT>         * {@link #tTest(double[], double[], double)}.&lt;/p&gt;<a name="line.596"></a>
+<FONT color="green">597</FONT>         * &lt;p&gt;<a name="line.597"></a>
+<FONT color="green">598</FONT>         * A pooled variance estimate is used to compute the t-statistic. See<a name="line.598"></a>
+<FONT color="green">599</FONT>         * {@link #t(double[], double[])} for the formula. The sum of the sample<a name="line.599"></a>
+<FONT color="green">600</FONT>         * sizes minus 2 is used as the degrees of freedom.&lt;/p&gt;<a name="line.600"></a>
+<FONT color="green">601</FONT>         * &lt;p&gt;<a name="line.601"></a>
+<FONT color="green">602</FONT>         * &lt;strong&gt;Examples:&lt;/strong&gt;&lt;br&gt;&lt;ol&gt;<a name="line.602"></a>
+<FONT color="green">603</FONT>         * &lt;li&gt;To test the (2-sided) hypothesis &lt;code&gt;mean 1 = mean 2 &lt;/code&gt; at<a name="line.603"></a>
+<FONT color="green">604</FONT>         * the 95% level, use &lt;br&gt;&lt;code&gt;tTest(sample1, sample2, 0.05). &lt;/code&gt;<a name="line.604"></a>
+<FONT color="green">605</FONT>         * &lt;/li&gt;<a name="line.605"></a>
+<FONT color="green">606</FONT>         * &lt;li&gt;To test the (one-sided) hypothesis &lt;code&gt; mean 1 &lt; mean 2, &lt;/code&gt;<a name="line.606"></a>
+<FONT color="green">607</FONT>         * at the 99% level, first verify that the measured mean of<a name="line.607"></a>
+<FONT color="green">608</FONT>         * &lt;code&gt;sample 1&lt;/code&gt; is less than the mean of &lt;code&gt;sample 2&lt;/code&gt;<a name="line.608"></a>
+<FONT color="green">609</FONT>         * and then use<a name="line.609"></a>
+<FONT color="green">610</FONT>         * &lt;br&gt;&lt;code&gt;tTest(sample1, sample2, 0.02) &lt;/code&gt;<a name="line.610"></a>
+<FONT color="green">611</FONT>         * &lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;<a name="line.611"></a>
+<FONT color="green">612</FONT>         * &lt;p&gt;<a name="line.612"></a>
+<FONT color="green">613</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.613"></a>
+<FONT color="green">614</FONT>         * The validity of the test depends on the assumptions of the parametric<a name="line.614"></a>
+<FONT color="green">615</FONT>         * t-test procedure, as discussed<a name="line.615"></a>
+<FONT color="green">616</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;<a name="line.616"></a>
+<FONT color="green">617</FONT>         * here&lt;/a&gt;&lt;/p&gt;<a name="line.617"></a>
+<FONT color="green">618</FONT>         * &lt;p&gt;<a name="line.618"></a>
+<FONT color="green">619</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.619"></a>
+<FONT color="green">620</FONT>         * &lt;li&gt;The observed array lengths must both be at least 2.<a name="line.620"></a>
+<FONT color="green">621</FONT>         * &lt;/li&gt;<a name="line.621"></a>
+<FONT color="green">622</FONT>         * &lt;li&gt; &lt;code&gt; 0 &lt; alpha &lt; 0.5 &lt;/code&gt;<a name="line.622"></a>
+<FONT color="green">623</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.623"></a>
+<FONT color="green">624</FONT>         *<a name="line.624"></a>
+<FONT color="green">625</FONT>         * @param sample1 array of sample data values<a name="line.625"></a>
+<FONT color="green">626</FONT>         * @param sample2 array of sample data values<a name="line.626"></a>
+<FONT color="green">627</FONT>         * @param alpha significance level of the test<a name="line.627"></a>
+<FONT color="green">628</FONT>         * @return true if the null hypothesis can be rejected with<a name="line.628"></a>
+<FONT color="green">629</FONT>         * confidence 1 - alpha<a name="line.629"></a>
+<FONT color="green">630</FONT>         * @throws IllegalArgumentException if the preconditions are not met<a name="line.630"></a>
+<FONT color="green">631</FONT>         * @throws MathException if an error occurs performing the test<a name="line.631"></a>
+<FONT color="green">632</FONT>         */<a name="line.632"></a>
+<FONT color="green">633</FONT>        boolean homoscedasticTTest(<a name="line.633"></a>
+<FONT color="green">634</FONT>            double[] sample1,<a name="line.634"></a>
+<FONT color="green">635</FONT>            double[] sample2,<a name="line.635"></a>
+<FONT color="green">636</FONT>            double alpha)<a name="line.636"></a>
+<FONT color="green">637</FONT>            throws IllegalArgumentException, MathException;<a name="line.637"></a>
+<FONT color="green">638</FONT>        /**<a name="line.638"></a>
+<FONT color="green">639</FONT>         * Returns the &lt;i&gt;observed significance level&lt;/i&gt;, or<a name="line.639"></a>
+<FONT color="green">640</FONT>         * &lt;i&gt;p-value&lt;/i&gt;, associated with a two-sample, two-tailed t-test<a name="line.640"></a>
+<FONT color="green">641</FONT>         * comparing the means of the datasets described by two StatisticalSummary<a name="line.641"></a>
+<FONT color="green">642</FONT>         * instances.<a name="line.642"></a>
+<FONT color="green">643</FONT>         * &lt;p&gt;<a name="line.643"></a>
+<FONT color="green">644</FONT>         * The number returned is the smallest significance level<a name="line.644"></a>
+<FONT color="green">645</FONT>         * at which one can reject the null hypothesis that the two means are<a name="line.645"></a>
+<FONT color="green">646</FONT>         * equal in favor of the two-sided alternative that they are different.<a name="line.646"></a>
+<FONT color="green">647</FONT>         * For a one-sided test, divide the returned value by 2.&lt;/p&gt;<a name="line.647"></a>
+<FONT color="green">648</FONT>         * &lt;p&gt;<a name="line.648"></a>
+<FONT color="green">649</FONT>         * The test does not assume that the underlying popuation variances are<a name="line.649"></a>
+<FONT color="green">650</FONT>         * equal  and it uses approximated degrees of freedom computed from the<a name="line.650"></a>
+<FONT color="green">651</FONT>         * sample data to compute the p-value.   To perform the test assuming<a name="line.651"></a>
+<FONT color="green">652</FONT>         * equal variances, use<a name="line.652"></a>
+<FONT color="green">653</FONT>         * {@link #homoscedasticTTest(StatisticalSummary, StatisticalSummary)}.&lt;/p&gt;<a name="line.653"></a>
+<FONT color="green">654</FONT>         * &lt;p&gt;<a name="line.654"></a>
+<FONT color="green">655</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.655"></a>
+<FONT color="green">656</FONT>         * The validity of the p-value depends on the assumptions of the parametric<a name="line.656"></a>
+<FONT color="green">657</FONT>         * t-test procedure, as discussed<a name="line.657"></a>
+<FONT color="green">658</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;<a name="line.658"></a>
+<FONT color="green">659</FONT>         * here&lt;/a&gt;&lt;/p&gt;<a name="line.659"></a>
+<FONT color="green">660</FONT>         * &lt;p&gt;<a name="line.660"></a>
+<FONT color="green">661</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.661"></a>
+<FONT color="green">662</FONT>         * &lt;li&gt;The datasets described by the two Univariates must each contain<a name="line.662"></a>
+<FONT color="green">663</FONT>         * at least 2 observations.<a name="line.663"></a>
+<FONT color="green">664</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.664"></a>
+<FONT color="green">665</FONT>         *<a name="line.665"></a>
+<FONT color="green">666</FONT>         * @param sampleStats1  StatisticalSummary describing data from the first sample<a name="line.666"></a>
+<FONT color="green">667</FONT>         * @param sampleStats2  StatisticalSummary describing data from the second sample<a name="line.667"></a>
+<FONT color="green">668</FONT>         * @return p-value for t-test<a name="line.668"></a>
+<FONT color="green">669</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.669"></a>
+<FONT color="green">670</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.670"></a>
+<FONT color="green">671</FONT>         */<a name="line.671"></a>
+<FONT color="green">672</FONT>        double tTest(<a name="line.672"></a>
+<FONT color="green">673</FONT>            StatisticalSummary sampleStats1,<a name="line.673"></a>
+<FONT color="green">674</FONT>            StatisticalSummary sampleStats2)<a name="line.674"></a>
+<FONT color="green">675</FONT>            throws IllegalArgumentException, MathException;<a name="line.675"></a>
+<FONT color="green">676</FONT>        /**<a name="line.676"></a>
+<FONT color="green">677</FONT>         * Returns the &lt;i&gt;observed significance level&lt;/i&gt;, or<a name="line.677"></a>
+<FONT color="green">678</FONT>         * &lt;i&gt;p-value&lt;/i&gt;, associated with a two-sample, two-tailed t-test<a name="line.678"></a>
+<FONT color="green">679</FONT>         * comparing the means of the datasets described by two StatisticalSummary<a name="line.679"></a>
+<FONT color="green">680</FONT>         * instances, under the hypothesis of equal subpopulation variances. To<a name="line.680"></a>
+<FONT color="green">681</FONT>         * perform a test without the equal variances assumption, use<a name="line.681"></a>
+<FONT color="green">682</FONT>         * {@link #tTest(StatisticalSummary, StatisticalSummary)}.<a name="line.682"></a>
+<FONT color="green">683</FONT>         * &lt;p&gt;<a name="line.683"></a>
+<FONT color="green">684</FONT>         * The number returned is the smallest significance level<a name="line.684"></a>
+<FONT color="green">685</FONT>         * at which one can reject the null hypothesis that the two means are<a name="line.685"></a>
+<FONT color="green">686</FONT>         * equal in favor of the two-sided alternative that they are different.<a name="line.686"></a>
+<FONT color="green">687</FONT>         * For a one-sided test, divide the returned value by 2.&lt;/p&gt;<a name="line.687"></a>
+<FONT color="green">688</FONT>         * &lt;p&gt;<a name="line.688"></a>
+<FONT color="green">689</FONT>         * See {@link #homoscedasticT(double[], double[])} for the formula used to<a name="line.689"></a>
+<FONT color="green">690</FONT>         * compute the t-statistic. The sum of the  sample sizes minus 2 is used as<a name="line.690"></a>
+<FONT color="green">691</FONT>         * the degrees of freedom.&lt;/p&gt;<a name="line.691"></a>
+<FONT color="green">692</FONT>         * &lt;p&gt;<a name="line.692"></a>
+<FONT color="green">693</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.693"></a>
+<FONT color="green">694</FONT>         * The validity of the p-value depends on the assumptions of the parametric<a name="line.694"></a>
+<FONT color="green">695</FONT>         * t-test procedure, as discussed<a name="line.695"></a>
+<FONT color="green">696</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;here&lt;/a&gt;<a name="line.696"></a>
+<FONT color="green">697</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.697"></a>
+<FONT color="green">698</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.698"></a>
+<FONT color="green">699</FONT>         * &lt;li&gt;The datasets described by the two Univariates must each contain<a name="line.699"></a>
+<FONT color="green">700</FONT>         * at least 2 observations.<a name="line.700"></a>
+<FONT color="green">701</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.701"></a>
+<FONT color="green">702</FONT>         *<a name="line.702"></a>
+<FONT color="green">703</FONT>         * @param sampleStats1  StatisticalSummary describing data from the first sample<a name="line.703"></a>
+<FONT color="green">704</FONT>         * @param sampleStats2  StatisticalSummary describing data from the second sample<a name="line.704"></a>
+<FONT color="green">705</FONT>         * @return p-value for t-test<a name="line.705"></a>
+<FONT color="green">706</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.706"></a>
+<FONT color="green">707</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.707"></a>
+<FONT color="green">708</FONT>         */<a name="line.708"></a>
+<FONT color="green">709</FONT>        double homoscedasticTTest(<a name="line.709"></a>
+<FONT color="green">710</FONT>            StatisticalSummary sampleStats1,<a name="line.710"></a>
+<FONT color="green">711</FONT>            StatisticalSummary sampleStats2)<a name="line.711"></a>
+<FONT color="green">712</FONT>            throws IllegalArgumentException, MathException;<a name="line.712"></a>
+<FONT color="green">713</FONT>        /**<a name="line.713"></a>
+<FONT color="green">714</FONT>         * Performs a<a name="line.714"></a>
+<FONT color="green">715</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm"&gt;<a name="line.715"></a>
+<FONT color="green">716</FONT>         * two-sided t-test&lt;/a&gt; evaluating the null hypothesis that<a name="line.716"></a>
+<FONT color="green">717</FONT>         * &lt;code&gt;sampleStats1&lt;/code&gt; and &lt;code&gt;sampleStats2&lt;/code&gt; describe<a name="line.717"></a>
+<FONT color="green">718</FONT>         * datasets drawn from populations with the same mean, with significance<a name="line.718"></a>
+<FONT color="green">719</FONT>         * level &lt;code&gt;alpha&lt;/code&gt;.   This test does not assume that the<a name="line.719"></a>
+<FONT color="green">720</FONT>         * subpopulation variances are equal.  To perform the test under the equal<a name="line.720"></a>
+<FONT color="green">721</FONT>         * variances assumption, use<a name="line.721"></a>
+<FONT color="green">722</FONT>         * {@link #homoscedasticTTest(StatisticalSummary, StatisticalSummary)}.<a name="line.722"></a>
+<FONT color="green">723</FONT>         * &lt;p&gt;<a name="line.723"></a>
+<FONT color="green">724</FONT>         * Returns &lt;code&gt;true&lt;/code&gt; iff the null hypothesis that the means are<a name="line.724"></a>
+<FONT color="green">725</FONT>         * equal can be rejected with confidence &lt;code&gt;1 - alpha&lt;/code&gt;.  To<a name="line.725"></a>
+<FONT color="green">726</FONT>         * perform a 1-sided test, use &lt;code&gt;alpha * 2&lt;/code&gt;&lt;/p&gt;<a name="line.726"></a>
+<FONT color="green">727</FONT>         * &lt;p&gt;<a name="line.727"></a>
+<FONT color="green">728</FONT>         * See {@link #t(double[], double[])} for the formula used to compute the<a name="line.728"></a>
+<FONT color="green">729</FONT>         * t-statistic.  Degrees of freedom are approximated using the<a name="line.729"></a>
+<FONT color="green">730</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/prc/section3/prc31.htm"&gt;<a name="line.730"></a>
+<FONT color="green">731</FONT>         * Welch-Satterthwaite approximation.&lt;/a&gt;&lt;/p&gt;<a name="line.731"></a>
+<FONT color="green">732</FONT>         * &lt;p&gt;<a name="line.732"></a>
+<FONT color="green">733</FONT>         * &lt;strong&gt;Examples:&lt;/strong&gt;&lt;br&gt;&lt;ol&gt;<a name="line.733"></a>
+<FONT color="green">734</FONT>         * &lt;li&gt;To test the (2-sided) hypothesis &lt;code&gt;mean 1 = mean 2 &lt;/code&gt; at<a name="line.734"></a>
+<FONT color="green">735</FONT>         * the 95%, use<a name="line.735"></a>
+<FONT color="green">736</FONT>         * &lt;br&gt;&lt;code&gt;tTest(sampleStats1, sampleStats2, 0.05) &lt;/code&gt;<a name="line.736"></a>
+<FONT color="green">737</FONT>         * &lt;/li&gt;<a name="line.737"></a>
+<FONT color="green">738</FONT>         * &lt;li&gt;To test the (one-sided) hypothesis &lt;code&gt; mean 1 &lt; mean 2 &lt;/code&gt;<a name="line.738"></a>
+<FONT color="green">739</FONT>         * at the 99% level,  first verify that the measured mean of<a name="line.739"></a>
+<FONT color="green">740</FONT>         * &lt;code&gt;sample 1&lt;/code&gt; is less than  the mean of &lt;code&gt;sample 2&lt;/code&gt;<a name="line.740"></a>
+<FONT color="green">741</FONT>         * and then use<a name="line.741"></a>
+<FONT color="green">742</FONT>         * &lt;br&gt;&lt;code&gt;tTest(sampleStats1, sampleStats2, 0.02) &lt;/code&gt;<a name="line.742"></a>
+<FONT color="green">743</FONT>         * &lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;<a name="line.743"></a>
+<FONT color="green">744</FONT>         * &lt;p&gt;<a name="line.744"></a>
+<FONT color="green">745</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.745"></a>
+<FONT color="green">746</FONT>         * The validity of the test depends on the assumptions of the parametric<a name="line.746"></a>
+<FONT color="green">747</FONT>         * t-test procedure, as discussed<a name="line.747"></a>
+<FONT color="green">748</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;<a name="line.748"></a>
+<FONT color="green">749</FONT>         * here&lt;/a&gt;&lt;/p&gt;<a name="line.749"></a>
+<FONT color="green">750</FONT>         * &lt;p&gt;<a name="line.750"></a>
+<FONT color="green">751</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.751"></a>
+<FONT color="green">752</FONT>         * &lt;li&gt;The datasets described by the two Univariates must each contain<a name="line.752"></a>
+<FONT color="green">753</FONT>         * at least 2 observations.<a name="line.753"></a>
+<FONT color="green">754</FONT>         * &lt;/li&gt;<a name="line.754"></a>
+<FONT color="green">755</FONT>         * &lt;li&gt; &lt;code&gt; 0 &lt; alpha &lt; 0.5 &lt;/code&gt;<a name="line.755"></a>
+<FONT color="green">756</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.756"></a>
+<FONT color="green">757</FONT>         *<a name="line.757"></a>
+<FONT color="green">758</FONT>         * @param sampleStats1 StatisticalSummary describing sample data values<a name="line.758"></a>
+<FONT color="green">759</FONT>         * @param sampleStats2 StatisticalSummary describing sample data values<a name="line.759"></a>
+<FONT color="green">760</FONT>         * @param alpha significance level of the test<a name="line.760"></a>
+<FONT color="green">761</FONT>         * @return true if the null hypothesis can be rejected with<a name="line.761"></a>
+<FONT color="green">762</FONT>         * confidence 1 - alpha<a name="line.762"></a>
+<FONT color="green">763</FONT>         * @throws IllegalArgumentException if the preconditions are not met<a name="line.763"></a>
+<FONT color="green">764</FONT>         * @throws MathException if an error occurs performing the test<a name="line.764"></a>
+<FONT color="green">765</FONT>         */<a name="line.765"></a>
+<FONT color="green">766</FONT>        boolean tTest(<a name="line.766"></a>
+<FONT color="green">767</FONT>            StatisticalSummary sampleStats1,<a name="line.767"></a>
+<FONT color="green">768</FONT>            StatisticalSummary sampleStats2,<a name="line.768"></a>
+<FONT color="green">769</FONT>            double alpha)<a name="line.769"></a>
+<FONT color="green">770</FONT>            throws IllegalArgumentException, MathException;<a name="line.770"></a>
+<FONT color="green">771</FONT>    }<a name="line.771"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/inference/TTestImpl.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,1130 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.inference;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.distribution.TDistribution;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.distribution.TDistributionImpl;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.stat.StatUtils;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.stat.descriptive.StatisticalSummary;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Implements t-test statistics defined in the {@link TTest} interface.<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * Uses commons-math {@link org.apache.commons.math.distribution.TDistribution}<a name="line.29"></a>
+<FONT color="green">030</FONT>     * implementation to estimate exact p-values.&lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     *<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @version $Revision: 885278 $ $Date: 2009-11-29 16:47:51 -0500 (Sun, 29 Nov 2009) $<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public class TTestImpl implements TTest  {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Message for insufficient data. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private static final String INSUFFICIENT_DATA_MESSAGE =<a name="line.37"></a>
+<FONT color="green">038</FONT>            "insufficient data for t statistic, needs at least 2, got {0}";<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** Distribution used to compute inference statistics. */<a name="line.40"></a>
+<FONT color="green">041</FONT>        private TDistribution distribution;<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /**<a name="line.43"></a>
+<FONT color="green">044</FONT>         * Default constructor.<a name="line.44"></a>
+<FONT color="green">045</FONT>         */<a name="line.45"></a>
+<FONT color="green">046</FONT>        public TTestImpl() {<a name="line.46"></a>
+<FONT color="green">047</FONT>            this(new TDistributionImpl(1.0));<a name="line.47"></a>
+<FONT color="green">048</FONT>        }<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Create a test instance using the given distribution for computing<a name="line.51"></a>
+<FONT color="green">052</FONT>         * inference statistics.<a name="line.52"></a>
+<FONT color="green">053</FONT>         * @param t distribution used to compute inference statistics.<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @since 1.2<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public TTestImpl(TDistribution t) {<a name="line.56"></a>
+<FONT color="green">057</FONT>            super();<a name="line.57"></a>
+<FONT color="green">058</FONT>            setDistribution(t);<a name="line.58"></a>
+<FONT color="green">059</FONT>        }<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /**<a name="line.61"></a>
+<FONT color="green">062</FONT>         * Computes a paired, 2-sample t-statistic based on the data in the input<a name="line.62"></a>
+<FONT color="green">063</FONT>         * arrays.  The t-statistic returned is equivalent to what would be returned by<a name="line.63"></a>
+<FONT color="green">064</FONT>         * computing the one-sample t-statistic {@link #t(double, double[])}, with<a name="line.64"></a>
+<FONT color="green">065</FONT>         * &lt;code&gt;mu = 0&lt;/code&gt; and the sample array consisting of the (signed)<a name="line.65"></a>
+<FONT color="green">066</FONT>         * differences between corresponding entries in &lt;code&gt;sample1&lt;/code&gt; and<a name="line.66"></a>
+<FONT color="green">067</FONT>         * &lt;code&gt;sample2.&lt;/code&gt;<a name="line.67"></a>
+<FONT color="green">068</FONT>         * &lt;p&gt;<a name="line.68"></a>
+<FONT color="green">069</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.69"></a>
+<FONT color="green">070</FONT>         * &lt;li&gt;The input arrays must have the same length and their common length<a name="line.70"></a>
+<FONT color="green">071</FONT>         * must be at least 2.<a name="line.71"></a>
+<FONT color="green">072</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.72"></a>
+<FONT color="green">073</FONT>         *<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @param sample1 array of sample data values<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @param sample2 array of sample data values<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @return t statistic<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @throws MathException if the statistic can not be computed do to a<a name="line.78"></a>
+<FONT color="green">079</FONT>         *         convergence or other numerical error.<a name="line.79"></a>
+<FONT color="green">080</FONT>         */<a name="line.80"></a>
+<FONT color="green">081</FONT>        public double pairedT(double[] sample1, double[] sample2)<a name="line.81"></a>
+<FONT color="green">082</FONT>            throws IllegalArgumentException, MathException {<a name="line.82"></a>
+<FONT color="green">083</FONT>            checkSampleData(sample1);<a name="line.83"></a>
+<FONT color="green">084</FONT>            checkSampleData(sample2);<a name="line.84"></a>
+<FONT color="green">085</FONT>            double meanDifference = StatUtils.meanDifference(sample1, sample2);<a name="line.85"></a>
+<FONT color="green">086</FONT>            return t(meanDifference, 0,<a name="line.86"></a>
+<FONT color="green">087</FONT>                    StatUtils.varianceDifference(sample1, sample2, meanDifference),<a name="line.87"></a>
+<FONT color="green">088</FONT>                    sample1.length);<a name="line.88"></a>
+<FONT color="green">089</FONT>        }<a name="line.89"></a>
+<FONT color="green">090</FONT>    <a name="line.90"></a>
+<FONT color="green">091</FONT>         /**<a name="line.91"></a>
+<FONT color="green">092</FONT>         * Returns the &lt;i&gt;observed significance level&lt;/i&gt;, or<a name="line.92"></a>
+<FONT color="green">093</FONT>         * &lt;i&gt; p-value&lt;/i&gt;, associated with a paired, two-sample, two-tailed t-test<a name="line.93"></a>
+<FONT color="green">094</FONT>         * based on the data in the input arrays.<a name="line.94"></a>
+<FONT color="green">095</FONT>         * &lt;p&gt;<a name="line.95"></a>
+<FONT color="green">096</FONT>         * The number returned is the smallest significance level<a name="line.96"></a>
+<FONT color="green">097</FONT>         * at which one can reject the null hypothesis that the mean of the paired<a name="line.97"></a>
+<FONT color="green">098</FONT>         * differences is 0 in favor of the two-sided alternative that the mean paired<a name="line.98"></a>
+<FONT color="green">099</FONT>         * difference is not equal to 0. For a one-sided test, divide the returned<a name="line.99"></a>
+<FONT color="green">100</FONT>         * value by 2.&lt;/p&gt;<a name="line.100"></a>
+<FONT color="green">101</FONT>         * &lt;p&gt;<a name="line.101"></a>
+<FONT color="green">102</FONT>         * This test is equivalent to a one-sample t-test computed using<a name="line.102"></a>
+<FONT color="green">103</FONT>         * {@link #tTest(double, double[])} with &lt;code&gt;mu = 0&lt;/code&gt; and the sample<a name="line.103"></a>
+<FONT color="green">104</FONT>         * array consisting of the signed differences between corresponding elements of<a name="line.104"></a>
+<FONT color="green">105</FONT>         * &lt;code&gt;sample1&lt;/code&gt; and &lt;code&gt;sample2.&lt;/code&gt;&lt;/p&gt;<a name="line.105"></a>
+<FONT color="green">106</FONT>         * &lt;p&gt;<a name="line.106"></a>
+<FONT color="green">107</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.107"></a>
+<FONT color="green">108</FONT>         * The validity of the p-value depends on the assumptions of the parametric<a name="line.108"></a>
+<FONT color="green">109</FONT>         * t-test procedure, as discussed<a name="line.109"></a>
+<FONT color="green">110</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;<a name="line.110"></a>
+<FONT color="green">111</FONT>         * here&lt;/a&gt;&lt;/p&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>         * &lt;p&gt;<a name="line.112"></a>
+<FONT color="green">113</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.113"></a>
+<FONT color="green">114</FONT>         * &lt;li&gt;The input array lengths must be the same and their common length must<a name="line.114"></a>
+<FONT color="green">115</FONT>         * be at least 2.<a name="line.115"></a>
+<FONT color="green">116</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         *<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @param sample1 array of sample data values<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @param sample2 array of sample data values<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @return p-value for t-test<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        public double pairedTTest(double[] sample1, double[] sample2)<a name="line.124"></a>
+<FONT color="green">125</FONT>            throws IllegalArgumentException, MathException {<a name="line.125"></a>
+<FONT color="green">126</FONT>            double meanDifference = StatUtils.meanDifference(sample1, sample2);<a name="line.126"></a>
+<FONT color="green">127</FONT>            return tTest(meanDifference, 0,<a name="line.127"></a>
+<FONT color="green">128</FONT>                    StatUtils.varianceDifference(sample1, sample2, meanDifference),<a name="line.128"></a>
+<FONT color="green">129</FONT>                    sample1.length);<a name="line.129"></a>
+<FONT color="green">130</FONT>        }<a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>         /**<a name="line.132"></a>
+<FONT color="green">133</FONT>         * Performs a paired t-test evaluating the null hypothesis that the<a name="line.133"></a>
+<FONT color="green">134</FONT>         * mean of the paired differences between &lt;code&gt;sample1&lt;/code&gt; and<a name="line.134"></a>
+<FONT color="green">135</FONT>         * &lt;code&gt;sample2&lt;/code&gt; is 0 in favor of the two-sided alternative that the<a name="line.135"></a>
+<FONT color="green">136</FONT>         * mean paired difference is not equal to 0, with significance level<a name="line.136"></a>
+<FONT color="green">137</FONT>         * &lt;code&gt;alpha&lt;/code&gt;.<a name="line.137"></a>
+<FONT color="green">138</FONT>         * &lt;p&gt;<a name="line.138"></a>
+<FONT color="green">139</FONT>         * Returns &lt;code&gt;true&lt;/code&gt; iff the null hypothesis can be rejected with<a name="line.139"></a>
+<FONT color="green">140</FONT>         * confidence &lt;code&gt;1 - alpha&lt;/code&gt;.  To perform a 1-sided test, use<a name="line.140"></a>
+<FONT color="green">141</FONT>         * &lt;code&gt;alpha * 2&lt;/code&gt;&lt;/p&gt;<a name="line.141"></a>
+<FONT color="green">142</FONT>         * &lt;p&gt;<a name="line.142"></a>
+<FONT color="green">143</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.143"></a>
+<FONT color="green">144</FONT>         * The validity of the test depends on the assumptions of the parametric<a name="line.144"></a>
+<FONT color="green">145</FONT>         * t-test procedure, as discussed<a name="line.145"></a>
+<FONT color="green">146</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;<a name="line.146"></a>
+<FONT color="green">147</FONT>         * here&lt;/a&gt;&lt;/p&gt;<a name="line.147"></a>
+<FONT color="green">148</FONT>         * &lt;p&gt;<a name="line.148"></a>
+<FONT color="green">149</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.149"></a>
+<FONT color="green">150</FONT>         * &lt;li&gt;The input array lengths must be the same and their common length<a name="line.150"></a>
+<FONT color="green">151</FONT>         * must be at least 2.<a name="line.151"></a>
+<FONT color="green">152</FONT>         * &lt;/li&gt;<a name="line.152"></a>
+<FONT color="green">153</FONT>         * &lt;li&gt; &lt;code&gt; 0 &lt; alpha &lt; 0.5 &lt;/code&gt;<a name="line.153"></a>
+<FONT color="green">154</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.154"></a>
+<FONT color="green">155</FONT>         *<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @param sample1 array of sample data values<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @param sample2 array of sample data values<a name="line.157"></a>
+<FONT color="green">158</FONT>         * @param alpha significance level of the test<a name="line.158"></a>
+<FONT color="green">159</FONT>         * @return true if the null hypothesis can be rejected with<a name="line.159"></a>
+<FONT color="green">160</FONT>         * confidence 1 - alpha<a name="line.160"></a>
+<FONT color="green">161</FONT>         * @throws IllegalArgumentException if the preconditions are not met<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @throws MathException if an error occurs performing the test<a name="line.162"></a>
+<FONT color="green">163</FONT>         */<a name="line.163"></a>
+<FONT color="green">164</FONT>        public boolean pairedTTest(double[] sample1, double[] sample2, double alpha)<a name="line.164"></a>
+<FONT color="green">165</FONT>            throws IllegalArgumentException, MathException {<a name="line.165"></a>
+<FONT color="green">166</FONT>            checkSignificanceLevel(alpha);<a name="line.166"></a>
+<FONT color="green">167</FONT>            return pairedTTest(sample1, sample2) &lt; alpha;<a name="line.167"></a>
+<FONT color="green">168</FONT>        }<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>        /**<a name="line.170"></a>
+<FONT color="green">171</FONT>         * Computes a &lt;a href="http://www.itl.nist.gov/div898/handbook/prc/section2/prc22.htm#formula"&gt;<a name="line.171"></a>
+<FONT color="green">172</FONT>         * t statistic &lt;/a&gt; given observed values and a comparison constant.<a name="line.172"></a>
+<FONT color="green">173</FONT>         * &lt;p&gt;<a name="line.173"></a>
+<FONT color="green">174</FONT>         * This statistic can be used to perform a one sample t-test for the mean.<a name="line.174"></a>
+<FONT color="green">175</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.175"></a>
+<FONT color="green">176</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.176"></a>
+<FONT color="green">177</FONT>         * &lt;li&gt;The observed array length must be at least 2.<a name="line.177"></a>
+<FONT color="green">178</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.178"></a>
+<FONT color="green">179</FONT>         *<a name="line.179"></a>
+<FONT color="green">180</FONT>         * @param mu comparison constant<a name="line.180"></a>
+<FONT color="green">181</FONT>         * @param observed array of values<a name="line.181"></a>
+<FONT color="green">182</FONT>         * @return t statistic<a name="line.182"></a>
+<FONT color="green">183</FONT>         * @throws IllegalArgumentException if input array length is less than 2<a name="line.183"></a>
+<FONT color="green">184</FONT>         */<a name="line.184"></a>
+<FONT color="green">185</FONT>        public double t(double mu, double[] observed)<a name="line.185"></a>
+<FONT color="green">186</FONT>        throws IllegalArgumentException {<a name="line.186"></a>
+<FONT color="green">187</FONT>            checkSampleData(observed);<a name="line.187"></a>
+<FONT color="green">188</FONT>            return t(StatUtils.mean(observed), mu, StatUtils.variance(observed),<a name="line.188"></a>
+<FONT color="green">189</FONT>                    observed.length);<a name="line.189"></a>
+<FONT color="green">190</FONT>        }<a name="line.190"></a>
+<FONT color="green">191</FONT>    <a name="line.191"></a>
+<FONT color="green">192</FONT>        /**<a name="line.192"></a>
+<FONT color="green">193</FONT>         * Computes a &lt;a href="http://www.itl.nist.gov/div898/handbook/prc/section2/prc22.htm#formula"&gt;<a name="line.193"></a>
+<FONT color="green">194</FONT>         * t statistic &lt;/a&gt; to use in comparing the mean of the dataset described by<a name="line.194"></a>
+<FONT color="green">195</FONT>         * &lt;code&gt;sampleStats&lt;/code&gt; to &lt;code&gt;mu&lt;/code&gt;.<a name="line.195"></a>
+<FONT color="green">196</FONT>         * &lt;p&gt;<a name="line.196"></a>
+<FONT color="green">197</FONT>         * This statistic can be used to perform a one sample t-test for the mean.<a name="line.197"></a>
+<FONT color="green">198</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.198"></a>
+<FONT color="green">199</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.199"></a>
+<FONT color="green">200</FONT>         * &lt;li&gt;&lt;code&gt;observed.getN() &gt; = 2&lt;/code&gt;.<a name="line.200"></a>
+<FONT color="green">201</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.201"></a>
+<FONT color="green">202</FONT>         *<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @param mu comparison constant<a name="line.203"></a>
+<FONT color="green">204</FONT>         * @param sampleStats DescriptiveStatistics holding sample summary statitstics<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @return t statistic<a name="line.205"></a>
+<FONT color="green">206</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.206"></a>
+<FONT color="green">207</FONT>         */<a name="line.207"></a>
+<FONT color="green">208</FONT>        public double t(double mu, StatisticalSummary sampleStats)<a name="line.208"></a>
+<FONT color="green">209</FONT>        throws IllegalArgumentException {<a name="line.209"></a>
+<FONT color="green">210</FONT>            checkSampleData(sampleStats);<a name="line.210"></a>
+<FONT color="green">211</FONT>            return t(sampleStats.getMean(), mu, sampleStats.getVariance(),<a name="line.211"></a>
+<FONT color="green">212</FONT>                    sampleStats.getN());<a name="line.212"></a>
+<FONT color="green">213</FONT>        }<a name="line.213"></a>
+<FONT color="green">214</FONT>    <a name="line.214"></a>
+<FONT color="green">215</FONT>        /**<a name="line.215"></a>
+<FONT color="green">216</FONT>         * Computes a 2-sample t statistic,  under the hypothesis of equal<a name="line.216"></a>
+<FONT color="green">217</FONT>         * subpopulation variances.  To compute a t-statistic without the<a name="line.217"></a>
+<FONT color="green">218</FONT>         * equal variances hypothesis, use {@link #t(double[], double[])}.<a name="line.218"></a>
+<FONT color="green">219</FONT>         * &lt;p&gt;<a name="line.219"></a>
+<FONT color="green">220</FONT>         * This statistic can be used to perform a (homoscedastic) two-sample<a name="line.220"></a>
+<FONT color="green">221</FONT>         * t-test to compare sample means.&lt;/p&gt;<a name="line.221"></a>
+<FONT color="green">222</FONT>         * &lt;p&gt;<a name="line.222"></a>
+<FONT color="green">223</FONT>         * The t-statisitc is&lt;/p&gt;<a name="line.223"></a>
+<FONT color="green">224</FONT>         * &lt;p&gt;<a name="line.224"></a>
+<FONT color="green">225</FONT>         * &amp;nbsp;&amp;nbsp;&lt;code&gt;  t = (m1 - m2) / (sqrt(1/n1 +1/n2) sqrt(var))&lt;/code&gt;<a name="line.225"></a>
+<FONT color="green">226</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.226"></a>
+<FONT color="green">227</FONT>         * where &lt;strong&gt;&lt;code&gt;n1&lt;/code&gt;&lt;/strong&gt; is the size of first sample;<a name="line.227"></a>
+<FONT color="green">228</FONT>         * &lt;strong&gt;&lt;code&gt; n2&lt;/code&gt;&lt;/strong&gt; is the size of second sample;<a name="line.228"></a>
+<FONT color="green">229</FONT>         * &lt;strong&gt;&lt;code&gt; m1&lt;/code&gt;&lt;/strong&gt; is the mean of first sample;<a name="line.229"></a>
+<FONT color="green">230</FONT>         * &lt;strong&gt;&lt;code&gt; m2&lt;/code&gt;&lt;/strong&gt; is the mean of second sample&lt;/li&gt;<a name="line.230"></a>
+<FONT color="green">231</FONT>         * &lt;/ul&gt;<a name="line.231"></a>
+<FONT color="green">232</FONT>         * and &lt;strong&gt;&lt;code&gt;var&lt;/code&gt;&lt;/strong&gt; is the pooled variance estimate:<a name="line.232"></a>
+<FONT color="green">233</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.233"></a>
+<FONT color="green">234</FONT>         * &lt;code&gt;var = sqrt(((n1 - 1)var1 + (n2 - 1)var2) / ((n1-1) + (n2-1)))&lt;/code&gt;<a name="line.234"></a>
+<FONT color="green">235</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.235"></a>
+<FONT color="green">236</FONT>         * with &lt;strong&gt;&lt;code&gt;var1&lt;code&gt;&lt;/strong&gt; the variance of the first sample and<a name="line.236"></a>
+<FONT color="green">237</FONT>         * &lt;strong&gt;&lt;code&gt;var2&lt;/code&gt;&lt;/strong&gt; the variance of the second sample.<a name="line.237"></a>
+<FONT color="green">238</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.238"></a>
+<FONT color="green">239</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.239"></a>
+<FONT color="green">240</FONT>         * &lt;li&gt;The observed array lengths must both be at least 2.<a name="line.240"></a>
+<FONT color="green">241</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.241"></a>
+<FONT color="green">242</FONT>         *<a name="line.242"></a>
+<FONT color="green">243</FONT>         * @param sample1 array of sample data values<a name="line.243"></a>
+<FONT color="green">244</FONT>         * @param sample2 array of sample data values<a name="line.244"></a>
+<FONT color="green">245</FONT>         * @return t statistic<a name="line.245"></a>
+<FONT color="green">246</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.246"></a>
+<FONT color="green">247</FONT>         */<a name="line.247"></a>
+<FONT color="green">248</FONT>        public double homoscedasticT(double[] sample1, double[] sample2)<a name="line.248"></a>
+<FONT color="green">249</FONT>        throws IllegalArgumentException {<a name="line.249"></a>
+<FONT color="green">250</FONT>            checkSampleData(sample1);<a name="line.250"></a>
+<FONT color="green">251</FONT>            checkSampleData(sample2);<a name="line.251"></a>
+<FONT color="green">252</FONT>            return homoscedasticT(StatUtils.mean(sample1), StatUtils.mean(sample2),<a name="line.252"></a>
+<FONT color="green">253</FONT>                    StatUtils.variance(sample1), StatUtils.variance(sample2),<a name="line.253"></a>
+<FONT color="green">254</FONT>                    sample1.length, sample2.length);<a name="line.254"></a>
+<FONT color="green">255</FONT>        }<a name="line.255"></a>
+<FONT color="green">256</FONT>    <a name="line.256"></a>
+<FONT color="green">257</FONT>        /**<a name="line.257"></a>
+<FONT color="green">258</FONT>         * Computes a 2-sample t statistic, without the hypothesis of equal<a name="line.258"></a>
+<FONT color="green">259</FONT>         * subpopulation variances.  To compute a t-statistic assuming equal<a name="line.259"></a>
+<FONT color="green">260</FONT>         * variances, use {@link #homoscedasticT(double[], double[])}.<a name="line.260"></a>
+<FONT color="green">261</FONT>         * &lt;p&gt;<a name="line.261"></a>
+<FONT color="green">262</FONT>         * This statistic can be used to perform a two-sample t-test to compare<a name="line.262"></a>
+<FONT color="green">263</FONT>         * sample means.&lt;/p&gt;<a name="line.263"></a>
+<FONT color="green">264</FONT>         * &lt;p&gt;<a name="line.264"></a>
+<FONT color="green">265</FONT>         * The t-statisitc is&lt;/p&gt;<a name="line.265"></a>
+<FONT color="green">266</FONT>         * &lt;p&gt;<a name="line.266"></a>
+<FONT color="green">267</FONT>         * &amp;nbsp;&amp;nbsp; &lt;code&gt;  t = (m1 - m2) / sqrt(var1/n1 + var2/n2)&lt;/code&gt;<a name="line.267"></a>
+<FONT color="green">268</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.268"></a>
+<FONT color="green">269</FONT>         *  where &lt;strong&gt;&lt;code&gt;n1&lt;/code&gt;&lt;/strong&gt; is the size of the first sample<a name="line.269"></a>
+<FONT color="green">270</FONT>         * &lt;strong&gt;&lt;code&gt; n2&lt;/code&gt;&lt;/strong&gt; is the size of the second sample;<a name="line.270"></a>
+<FONT color="green">271</FONT>         * &lt;strong&gt;&lt;code&gt; m1&lt;/code&gt;&lt;/strong&gt; is the mean of the first sample;<a name="line.271"></a>
+<FONT color="green">272</FONT>         * &lt;strong&gt;&lt;code&gt; m2&lt;/code&gt;&lt;/strong&gt; is the mean of the second sample;<a name="line.272"></a>
+<FONT color="green">273</FONT>         * &lt;strong&gt;&lt;code&gt; var1&lt;/code&gt;&lt;/strong&gt; is the variance of the first sample;<a name="line.273"></a>
+<FONT color="green">274</FONT>         * &lt;strong&gt;&lt;code&gt; var2&lt;/code&gt;&lt;/strong&gt; is the variance of the second sample;<a name="line.274"></a>
+<FONT color="green">275</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.275"></a>
+<FONT color="green">276</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.276"></a>
+<FONT color="green">277</FONT>         * &lt;li&gt;The observed array lengths must both be at least 2.<a name="line.277"></a>
+<FONT color="green">278</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.278"></a>
+<FONT color="green">279</FONT>         *<a name="line.279"></a>
+<FONT color="green">280</FONT>         * @param sample1 array of sample data values<a name="line.280"></a>
+<FONT color="green">281</FONT>         * @param sample2 array of sample data values<a name="line.281"></a>
+<FONT color="green">282</FONT>         * @return t statistic<a name="line.282"></a>
+<FONT color="green">283</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.283"></a>
+<FONT color="green">284</FONT>         */<a name="line.284"></a>
+<FONT color="green">285</FONT>        public double t(double[] sample1, double[] sample2)<a name="line.285"></a>
+<FONT color="green">286</FONT>        throws IllegalArgumentException {<a name="line.286"></a>
+<FONT color="green">287</FONT>            checkSampleData(sample1);<a name="line.287"></a>
+<FONT color="green">288</FONT>            checkSampleData(sample2);<a name="line.288"></a>
+<FONT color="green">289</FONT>            return t(StatUtils.mean(sample1), StatUtils.mean(sample2),<a name="line.289"></a>
+<FONT color="green">290</FONT>                    StatUtils.variance(sample1), StatUtils.variance(sample2),<a name="line.290"></a>
+<FONT color="green">291</FONT>                    sample1.length, sample2.length);<a name="line.291"></a>
+<FONT color="green">292</FONT>        }<a name="line.292"></a>
+<FONT color="green">293</FONT>    <a name="line.293"></a>
+<FONT color="green">294</FONT>        /**<a name="line.294"></a>
+<FONT color="green">295</FONT>         * Computes a 2-sample t statistic &lt;/a&gt;, comparing the means of the datasets<a name="line.295"></a>
+<FONT color="green">296</FONT>         * described by two {@link StatisticalSummary} instances, without the<a name="line.296"></a>
+<FONT color="green">297</FONT>         * assumption of equal subpopulation variances.  Use<a name="line.297"></a>
+<FONT color="green">298</FONT>         * {@link #homoscedasticT(StatisticalSummary, StatisticalSummary)} to<a name="line.298"></a>
+<FONT color="green">299</FONT>         * compute a t-statistic under the equal variances assumption.<a name="line.299"></a>
+<FONT color="green">300</FONT>         * &lt;p&gt;<a name="line.300"></a>
+<FONT color="green">301</FONT>         * This statistic can be used to perform a two-sample t-test to compare<a name="line.301"></a>
+<FONT color="green">302</FONT>         * sample means.&lt;/p&gt;<a name="line.302"></a>
+<FONT color="green">303</FONT>         * &lt;p&gt;<a name="line.303"></a>
+<FONT color="green">304</FONT>          * The returned  t-statisitc is&lt;/p&gt;<a name="line.304"></a>
+<FONT color="green">305</FONT>         * &lt;p&gt;<a name="line.305"></a>
+<FONT color="green">306</FONT>         * &amp;nbsp;&amp;nbsp; &lt;code&gt;  t = (m1 - m2) / sqrt(var1/n1 + var2/n2)&lt;/code&gt;<a name="line.306"></a>
+<FONT color="green">307</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.307"></a>
+<FONT color="green">308</FONT>         * where &lt;strong&gt;&lt;code&gt;n1&lt;/code&gt;&lt;/strong&gt; is the size of the first sample;<a name="line.308"></a>
+<FONT color="green">309</FONT>         * &lt;strong&gt;&lt;code&gt; n2&lt;/code&gt;&lt;/strong&gt; is the size of the second sample;<a name="line.309"></a>
+<FONT color="green">310</FONT>         * &lt;strong&gt;&lt;code&gt; m1&lt;/code&gt;&lt;/strong&gt; is the mean of the first sample;<a name="line.310"></a>
+<FONT color="green">311</FONT>         * &lt;strong&gt;&lt;code&gt; m2&lt;/code&gt;&lt;/strong&gt; is the mean of the second sample<a name="line.311"></a>
+<FONT color="green">312</FONT>         * &lt;strong&gt;&lt;code&gt; var1&lt;/code&gt;&lt;/strong&gt; is the variance of the first sample;<a name="line.312"></a>
+<FONT color="green">313</FONT>         * &lt;strong&gt;&lt;code&gt; var2&lt;/code&gt;&lt;/strong&gt; is the variance of the second sample<a name="line.313"></a>
+<FONT color="green">314</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.314"></a>
+<FONT color="green">315</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.315"></a>
+<FONT color="green">316</FONT>         * &lt;li&gt;The datasets described by the two Univariates must each contain<a name="line.316"></a>
+<FONT color="green">317</FONT>         * at least 2 observations.<a name="line.317"></a>
+<FONT color="green">318</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.318"></a>
+<FONT color="green">319</FONT>         *<a name="line.319"></a>
+<FONT color="green">320</FONT>         * @param sampleStats1 StatisticalSummary describing data from the first sample<a name="line.320"></a>
+<FONT color="green">321</FONT>         * @param sampleStats2 StatisticalSummary describing data from the second sample<a name="line.321"></a>
+<FONT color="green">322</FONT>         * @return t statistic<a name="line.322"></a>
+<FONT color="green">323</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.323"></a>
+<FONT color="green">324</FONT>         */<a name="line.324"></a>
+<FONT color="green">325</FONT>        public double t(StatisticalSummary sampleStats1,<a name="line.325"></a>
+<FONT color="green">326</FONT>                        StatisticalSummary sampleStats2)<a name="line.326"></a>
+<FONT color="green">327</FONT>        throws IllegalArgumentException {<a name="line.327"></a>
+<FONT color="green">328</FONT>            checkSampleData(sampleStats1);<a name="line.328"></a>
+<FONT color="green">329</FONT>            checkSampleData(sampleStats2);<a name="line.329"></a>
+<FONT color="green">330</FONT>            return t(sampleStats1.getMean(), sampleStats2.getMean(),<a name="line.330"></a>
+<FONT color="green">331</FONT>                    sampleStats1.getVariance(), sampleStats2.getVariance(),<a name="line.331"></a>
+<FONT color="green">332</FONT>                    sampleStats1.getN(), sampleStats2.getN());<a name="line.332"></a>
+<FONT color="green">333</FONT>        }<a name="line.333"></a>
+<FONT color="green">334</FONT>    <a name="line.334"></a>
+<FONT color="green">335</FONT>        /**<a name="line.335"></a>
+<FONT color="green">336</FONT>         * Computes a 2-sample t statistic, comparing the means of the datasets<a name="line.336"></a>
+<FONT color="green">337</FONT>         * described by two {@link StatisticalSummary} instances, under the<a name="line.337"></a>
+<FONT color="green">338</FONT>         * assumption of equal subpopulation variances.  To compute a t-statistic<a name="line.338"></a>
+<FONT color="green">339</FONT>         * without the equal variances assumption, use<a name="line.339"></a>
+<FONT color="green">340</FONT>         * {@link #t(StatisticalSummary, StatisticalSummary)}.<a name="line.340"></a>
+<FONT color="green">341</FONT>         * &lt;p&gt;<a name="line.341"></a>
+<FONT color="green">342</FONT>         * This statistic can be used to perform a (homoscedastic) two-sample<a name="line.342"></a>
+<FONT color="green">343</FONT>         * t-test to compare sample means.&lt;/p&gt;<a name="line.343"></a>
+<FONT color="green">344</FONT>         * &lt;p&gt;<a name="line.344"></a>
+<FONT color="green">345</FONT>         * The t-statisitc returned is&lt;/p&gt;<a name="line.345"></a>
+<FONT color="green">346</FONT>         * &lt;p&gt;<a name="line.346"></a>
+<FONT color="green">347</FONT>         * &amp;nbsp;&amp;nbsp;&lt;code&gt;  t = (m1 - m2) / (sqrt(1/n1 +1/n2) sqrt(var))&lt;/code&gt;<a name="line.347"></a>
+<FONT color="green">348</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.348"></a>
+<FONT color="green">349</FONT>         * where &lt;strong&gt;&lt;code&gt;n1&lt;/code&gt;&lt;/strong&gt; is the size of first sample;<a name="line.349"></a>
+<FONT color="green">350</FONT>         * &lt;strong&gt;&lt;code&gt; n2&lt;/code&gt;&lt;/strong&gt; is the size of second sample;<a name="line.350"></a>
+<FONT color="green">351</FONT>         * &lt;strong&gt;&lt;code&gt; m1&lt;/code&gt;&lt;/strong&gt; is the mean of first sample;<a name="line.351"></a>
+<FONT color="green">352</FONT>         * &lt;strong&gt;&lt;code&gt; m2&lt;/code&gt;&lt;/strong&gt; is the mean of second sample<a name="line.352"></a>
+<FONT color="green">353</FONT>         * and &lt;strong&gt;&lt;code&gt;var&lt;/code&gt;&lt;/strong&gt; is the pooled variance estimate:<a name="line.353"></a>
+<FONT color="green">354</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.354"></a>
+<FONT color="green">355</FONT>         * &lt;code&gt;var = sqrt(((n1 - 1)var1 + (n2 - 1)var2) / ((n1-1) + (n2-1)))&lt;/code&gt;<a name="line.355"></a>
+<FONT color="green">356</FONT>         * &lt;p&gt;<a name="line.356"></a>
+<FONT color="green">357</FONT>         * with &lt;strong&gt;&lt;code&gt;var1&lt;code&gt;&lt;/strong&gt; the variance of the first sample and<a name="line.357"></a>
+<FONT color="green">358</FONT>         * &lt;strong&gt;&lt;code&gt;var2&lt;/code&gt;&lt;/strong&gt; the variance of the second sample.<a name="line.358"></a>
+<FONT color="green">359</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.359"></a>
+<FONT color="green">360</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.360"></a>
+<FONT color="green">361</FONT>         * &lt;li&gt;The datasets described by the two Univariates must each contain<a name="line.361"></a>
+<FONT color="green">362</FONT>         * at least 2 observations.<a name="line.362"></a>
+<FONT color="green">363</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.363"></a>
+<FONT color="green">364</FONT>         *<a name="line.364"></a>
+<FONT color="green">365</FONT>         * @param sampleStats1 StatisticalSummary describing data from the first sample<a name="line.365"></a>
+<FONT color="green">366</FONT>         * @param sampleStats2 StatisticalSummary describing data from the second sample<a name="line.366"></a>
+<FONT color="green">367</FONT>         * @return t statistic<a name="line.367"></a>
+<FONT color="green">368</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.368"></a>
+<FONT color="green">369</FONT>         */<a name="line.369"></a>
+<FONT color="green">370</FONT>        public double homoscedasticT(StatisticalSummary sampleStats1,<a name="line.370"></a>
+<FONT color="green">371</FONT>                StatisticalSummary sampleStats2)<a name="line.371"></a>
+<FONT color="green">372</FONT>        throws IllegalArgumentException {<a name="line.372"></a>
+<FONT color="green">373</FONT>            checkSampleData(sampleStats1);<a name="line.373"></a>
+<FONT color="green">374</FONT>            checkSampleData(sampleStats2);<a name="line.374"></a>
+<FONT color="green">375</FONT>            return homoscedasticT(sampleStats1.getMean(), sampleStats2.getMean(),<a name="line.375"></a>
+<FONT color="green">376</FONT>                    sampleStats1.getVariance(), sampleStats2.getVariance(),<a name="line.376"></a>
+<FONT color="green">377</FONT>                    sampleStats1.getN(), sampleStats2.getN());<a name="line.377"></a>
+<FONT color="green">378</FONT>        }<a name="line.378"></a>
+<FONT color="green">379</FONT>    <a name="line.379"></a>
+<FONT color="green">380</FONT>         /**<a name="line.380"></a>
+<FONT color="green">381</FONT>         * Returns the &lt;i&gt;observed significance level&lt;/i&gt;, or<a name="line.381"></a>
+<FONT color="green">382</FONT>         * &lt;i&gt;p-value&lt;/i&gt;, associated with a one-sample, two-tailed t-test<a name="line.382"></a>
+<FONT color="green">383</FONT>         * comparing the mean of the input array with the constant &lt;code&gt;mu&lt;/code&gt;.<a name="line.383"></a>
+<FONT color="green">384</FONT>         * &lt;p&gt;<a name="line.384"></a>
+<FONT color="green">385</FONT>         * The number returned is the smallest significance level<a name="line.385"></a>
+<FONT color="green">386</FONT>         * at which one can reject the null hypothesis that the mean equals<a name="line.386"></a>
+<FONT color="green">387</FONT>         * &lt;code&gt;mu&lt;/code&gt; in favor of the two-sided alternative that the mean<a name="line.387"></a>
+<FONT color="green">388</FONT>         * is different from &lt;code&gt;mu&lt;/code&gt;. For a one-sided test, divide the<a name="line.388"></a>
+<FONT color="green">389</FONT>         * returned value by 2.&lt;/p&gt;<a name="line.389"></a>
+<FONT color="green">390</FONT>         * &lt;p&gt;<a name="line.390"></a>
+<FONT color="green">391</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.391"></a>
+<FONT color="green">392</FONT>         * The validity of the test depends on the assumptions of the parametric<a name="line.392"></a>
+<FONT color="green">393</FONT>         * t-test procedure, as discussed<a name="line.393"></a>
+<FONT color="green">394</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;here&lt;/a&gt;<a name="line.394"></a>
+<FONT color="green">395</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.395"></a>
+<FONT color="green">396</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.396"></a>
+<FONT color="green">397</FONT>         * &lt;li&gt;The observed array length must be at least 2.<a name="line.397"></a>
+<FONT color="green">398</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.398"></a>
+<FONT color="green">399</FONT>         *<a name="line.399"></a>
+<FONT color="green">400</FONT>         * @param mu constant value to compare sample mean against<a name="line.400"></a>
+<FONT color="green">401</FONT>         * @param sample array of sample data values<a name="line.401"></a>
+<FONT color="green">402</FONT>         * @return p-value<a name="line.402"></a>
+<FONT color="green">403</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.403"></a>
+<FONT color="green">404</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.404"></a>
+<FONT color="green">405</FONT>         */<a name="line.405"></a>
+<FONT color="green">406</FONT>        public double tTest(double mu, double[] sample)<a name="line.406"></a>
+<FONT color="green">407</FONT>        throws IllegalArgumentException, MathException {<a name="line.407"></a>
+<FONT color="green">408</FONT>            checkSampleData(sample);<a name="line.408"></a>
+<FONT color="green">409</FONT>            return tTest( StatUtils.mean(sample), mu, StatUtils.variance(sample),<a name="line.409"></a>
+<FONT color="green">410</FONT>                    sample.length);<a name="line.410"></a>
+<FONT color="green">411</FONT>        }<a name="line.411"></a>
+<FONT color="green">412</FONT>    <a name="line.412"></a>
+<FONT color="green">413</FONT>        /**<a name="line.413"></a>
+<FONT color="green">414</FONT>         * Performs a &lt;a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm"&gt;<a name="line.414"></a>
+<FONT color="green">415</FONT>         * two-sided t-test&lt;/a&gt; evaluating the null hypothesis that the mean of the population from<a name="line.415"></a>
+<FONT color="green">416</FONT>         * which &lt;code&gt;sample&lt;/code&gt; is drawn equals &lt;code&gt;mu&lt;/code&gt;.<a name="line.416"></a>
+<FONT color="green">417</FONT>         * &lt;p&gt;<a name="line.417"></a>
+<FONT color="green">418</FONT>         * Returns &lt;code&gt;true&lt;/code&gt; iff the null hypothesis can be<a name="line.418"></a>
+<FONT color="green">419</FONT>         * rejected with confidence &lt;code&gt;1 - alpha&lt;/code&gt;.  To<a name="line.419"></a>
+<FONT color="green">420</FONT>         * perform a 1-sided test, use &lt;code&gt;alpha * 2&lt;/code&gt;<a name="line.420"></a>
+<FONT color="green">421</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.421"></a>
+<FONT color="green">422</FONT>         * &lt;strong&gt;Examples:&lt;/strong&gt;&lt;br&gt;&lt;ol&gt;<a name="line.422"></a>
+<FONT color="green">423</FONT>         * &lt;li&gt;To test the (2-sided) hypothesis &lt;code&gt;sample mean = mu &lt;/code&gt; at<a name="line.423"></a>
+<FONT color="green">424</FONT>         * the 95% level, use &lt;br&gt;&lt;code&gt;tTest(mu, sample, 0.05) &lt;/code&gt;<a name="line.424"></a>
+<FONT color="green">425</FONT>         * &lt;/li&gt;<a name="line.425"></a>
+<FONT color="green">426</FONT>         * &lt;li&gt;To test the (one-sided) hypothesis &lt;code&gt; sample mean &lt; mu &lt;/code&gt;<a name="line.426"></a>
+<FONT color="green">427</FONT>         * at the 99% level, first verify that the measured sample mean is less<a name="line.427"></a>
+<FONT color="green">428</FONT>         * than &lt;code&gt;mu&lt;/code&gt; and then use<a name="line.428"></a>
+<FONT color="green">429</FONT>         * &lt;br&gt;&lt;code&gt;tTest(mu, sample, 0.02) &lt;/code&gt;<a name="line.429"></a>
+<FONT color="green">430</FONT>         * &lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;<a name="line.430"></a>
+<FONT color="green">431</FONT>         * &lt;p&gt;<a name="line.431"></a>
+<FONT color="green">432</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.432"></a>
+<FONT color="green">433</FONT>         * The validity of the test depends on the assumptions of the one-sample<a name="line.433"></a>
+<FONT color="green">434</FONT>         * parametric t-test procedure, as discussed<a name="line.434"></a>
+<FONT color="green">435</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/sg_glos.html#one-sample"&gt;here&lt;/a&gt;<a name="line.435"></a>
+<FONT color="green">436</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.436"></a>
+<FONT color="green">437</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.437"></a>
+<FONT color="green">438</FONT>         * &lt;li&gt;The observed array length must be at least 2.<a name="line.438"></a>
+<FONT color="green">439</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.439"></a>
+<FONT color="green">440</FONT>         *<a name="line.440"></a>
+<FONT color="green">441</FONT>         * @param mu constant value to compare sample mean against<a name="line.441"></a>
+<FONT color="green">442</FONT>         * @param sample array of sample data values<a name="line.442"></a>
+<FONT color="green">443</FONT>         * @param alpha significance level of the test<a name="line.443"></a>
+<FONT color="green">444</FONT>         * @return p-value<a name="line.444"></a>
+<FONT color="green">445</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.445"></a>
+<FONT color="green">446</FONT>         * @throws MathException if an error computing the p-value<a name="line.446"></a>
+<FONT color="green">447</FONT>         */<a name="line.447"></a>
+<FONT color="green">448</FONT>        public boolean tTest(double mu, double[] sample, double alpha)<a name="line.448"></a>
+<FONT color="green">449</FONT>        throws IllegalArgumentException, MathException {<a name="line.449"></a>
+<FONT color="green">450</FONT>            checkSignificanceLevel(alpha);<a name="line.450"></a>
+<FONT color="green">451</FONT>            return tTest(mu, sample) &lt; alpha;<a name="line.451"></a>
+<FONT color="green">452</FONT>        }<a name="line.452"></a>
+<FONT color="green">453</FONT>    <a name="line.453"></a>
+<FONT color="green">454</FONT>        /**<a name="line.454"></a>
+<FONT color="green">455</FONT>         * Returns the &lt;i&gt;observed significance level&lt;/i&gt;, or<a name="line.455"></a>
+<FONT color="green">456</FONT>         * &lt;i&gt;p-value&lt;/i&gt;, associated with a one-sample, two-tailed t-test<a name="line.456"></a>
+<FONT color="green">457</FONT>         * comparing the mean of the dataset described by &lt;code&gt;sampleStats&lt;/code&gt;<a name="line.457"></a>
+<FONT color="green">458</FONT>         * with the constant &lt;code&gt;mu&lt;/code&gt;.<a name="line.458"></a>
+<FONT color="green">459</FONT>         * &lt;p&gt;<a name="line.459"></a>
+<FONT color="green">460</FONT>         * The number returned is the smallest significance level<a name="line.460"></a>
+<FONT color="green">461</FONT>         * at which one can reject the null hypothesis that the mean equals<a name="line.461"></a>
+<FONT color="green">462</FONT>         * &lt;code&gt;mu&lt;/code&gt; in favor of the two-sided alternative that the mean<a name="line.462"></a>
+<FONT color="green">463</FONT>         * is different from &lt;code&gt;mu&lt;/code&gt;. For a one-sided test, divide the<a name="line.463"></a>
+<FONT color="green">464</FONT>         * returned value by 2.&lt;/p&gt;<a name="line.464"></a>
+<FONT color="green">465</FONT>         * &lt;p&gt;<a name="line.465"></a>
+<FONT color="green">466</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.466"></a>
+<FONT color="green">467</FONT>         * The validity of the test depends on the assumptions of the parametric<a name="line.467"></a>
+<FONT color="green">468</FONT>         * t-test procedure, as discussed<a name="line.468"></a>
+<FONT color="green">469</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;<a name="line.469"></a>
+<FONT color="green">470</FONT>         * here&lt;/a&gt;&lt;/p&gt;<a name="line.470"></a>
+<FONT color="green">471</FONT>         * &lt;p&gt;<a name="line.471"></a>
+<FONT color="green">472</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.472"></a>
+<FONT color="green">473</FONT>         * &lt;li&gt;The sample must contain at least 2 observations.<a name="line.473"></a>
+<FONT color="green">474</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.474"></a>
+<FONT color="green">475</FONT>         *<a name="line.475"></a>
+<FONT color="green">476</FONT>         * @param mu constant value to compare sample mean against<a name="line.476"></a>
+<FONT color="green">477</FONT>         * @param sampleStats StatisticalSummary describing sample data<a name="line.477"></a>
+<FONT color="green">478</FONT>         * @return p-value<a name="line.478"></a>
+<FONT color="green">479</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.479"></a>
+<FONT color="green">480</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.480"></a>
+<FONT color="green">481</FONT>         */<a name="line.481"></a>
+<FONT color="green">482</FONT>        public double tTest(double mu, StatisticalSummary sampleStats)<a name="line.482"></a>
+<FONT color="green">483</FONT>        throws IllegalArgumentException, MathException {<a name="line.483"></a>
+<FONT color="green">484</FONT>            checkSampleData(sampleStats);<a name="line.484"></a>
+<FONT color="green">485</FONT>            return tTest(sampleStats.getMean(), mu, sampleStats.getVariance(),<a name="line.485"></a>
+<FONT color="green">486</FONT>                    sampleStats.getN());<a name="line.486"></a>
+<FONT color="green">487</FONT>        }<a name="line.487"></a>
+<FONT color="green">488</FONT>    <a name="line.488"></a>
+<FONT color="green">489</FONT>         /**<a name="line.489"></a>
+<FONT color="green">490</FONT>         * Performs a &lt;a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm"&gt;<a name="line.490"></a>
+<FONT color="green">491</FONT>         * two-sided t-test&lt;/a&gt; evaluating the null hypothesis that the mean of the<a name="line.491"></a>
+<FONT color="green">492</FONT>         * population from which the dataset described by &lt;code&gt;stats&lt;/code&gt; is<a name="line.492"></a>
+<FONT color="green">493</FONT>         * drawn equals &lt;code&gt;mu&lt;/code&gt;.<a name="line.493"></a>
+<FONT color="green">494</FONT>         * &lt;p&gt;<a name="line.494"></a>
+<FONT color="green">495</FONT>         * Returns &lt;code&gt;true&lt;/code&gt; iff the null hypothesis can be rejected with<a name="line.495"></a>
+<FONT color="green">496</FONT>         * confidence &lt;code&gt;1 - alpha&lt;/code&gt;.  To  perform a 1-sided test, use<a name="line.496"></a>
+<FONT color="green">497</FONT>         * &lt;code&gt;alpha * 2.&lt;/code&gt;&lt;/p&gt;<a name="line.497"></a>
+<FONT color="green">498</FONT>         * &lt;p&gt;<a name="line.498"></a>
+<FONT color="green">499</FONT>         * &lt;strong&gt;Examples:&lt;/strong&gt;&lt;br&gt;&lt;ol&gt;<a name="line.499"></a>
+<FONT color="green">500</FONT>         * &lt;li&gt;To test the (2-sided) hypothesis &lt;code&gt;sample mean = mu &lt;/code&gt; at<a name="line.500"></a>
+<FONT color="green">501</FONT>         * the 95% level, use &lt;br&gt;&lt;code&gt;tTest(mu, sampleStats, 0.05) &lt;/code&gt;<a name="line.501"></a>
+<FONT color="green">502</FONT>         * &lt;/li&gt;<a name="line.502"></a>
+<FONT color="green">503</FONT>         * &lt;li&gt;To test the (one-sided) hypothesis &lt;code&gt; sample mean &lt; mu &lt;/code&gt;<a name="line.503"></a>
+<FONT color="green">504</FONT>         * at the 99% level, first verify that the measured sample mean is less<a name="line.504"></a>
+<FONT color="green">505</FONT>         * than &lt;code&gt;mu&lt;/code&gt; and then use<a name="line.505"></a>
+<FONT color="green">506</FONT>         * &lt;br&gt;&lt;code&gt;tTest(mu, sampleStats, 0.02) &lt;/code&gt;<a name="line.506"></a>
+<FONT color="green">507</FONT>         * &lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;<a name="line.507"></a>
+<FONT color="green">508</FONT>         * &lt;p&gt;<a name="line.508"></a>
+<FONT color="green">509</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.509"></a>
+<FONT color="green">510</FONT>         * The validity of the test depends on the assumptions of the one-sample<a name="line.510"></a>
+<FONT color="green">511</FONT>         * parametric t-test procedure, as discussed<a name="line.511"></a>
+<FONT color="green">512</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/sg_glos.html#one-sample"&gt;here&lt;/a&gt;<a name="line.512"></a>
+<FONT color="green">513</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.513"></a>
+<FONT color="green">514</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.514"></a>
+<FONT color="green">515</FONT>         * &lt;li&gt;The sample must include at least 2 observations.<a name="line.515"></a>
+<FONT color="green">516</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.516"></a>
+<FONT color="green">517</FONT>         *<a name="line.517"></a>
+<FONT color="green">518</FONT>         * @param mu constant value to compare sample mean against<a name="line.518"></a>
+<FONT color="green">519</FONT>         * @param sampleStats StatisticalSummary describing sample data values<a name="line.519"></a>
+<FONT color="green">520</FONT>         * @param alpha significance level of the test<a name="line.520"></a>
+<FONT color="green">521</FONT>         * @return p-value<a name="line.521"></a>
+<FONT color="green">522</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.522"></a>
+<FONT color="green">523</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.523"></a>
+<FONT color="green">524</FONT>         */<a name="line.524"></a>
+<FONT color="green">525</FONT>        public boolean tTest( double mu, StatisticalSummary sampleStats,<a name="line.525"></a>
+<FONT color="green">526</FONT>                double alpha)<a name="line.526"></a>
+<FONT color="green">527</FONT>        throws IllegalArgumentException, MathException {<a name="line.527"></a>
+<FONT color="green">528</FONT>            checkSignificanceLevel(alpha);<a name="line.528"></a>
+<FONT color="green">529</FONT>            return tTest(mu, sampleStats) &lt; alpha;<a name="line.529"></a>
+<FONT color="green">530</FONT>        }<a name="line.530"></a>
+<FONT color="green">531</FONT>    <a name="line.531"></a>
+<FONT color="green">532</FONT>        /**<a name="line.532"></a>
+<FONT color="green">533</FONT>         * Returns the &lt;i&gt;observed significance level&lt;/i&gt;, or<a name="line.533"></a>
+<FONT color="green">534</FONT>         * &lt;i&gt;p-value&lt;/i&gt;, associated with a two-sample, two-tailed t-test<a name="line.534"></a>
+<FONT color="green">535</FONT>         * comparing the means of the input arrays.<a name="line.535"></a>
+<FONT color="green">536</FONT>         * &lt;p&gt;<a name="line.536"></a>
+<FONT color="green">537</FONT>         * The number returned is the smallest significance level<a name="line.537"></a>
+<FONT color="green">538</FONT>         * at which one can reject the null hypothesis that the two means are<a name="line.538"></a>
+<FONT color="green">539</FONT>         * equal in favor of the two-sided alternative that they are different.<a name="line.539"></a>
+<FONT color="green">540</FONT>         * For a one-sided test, divide the returned value by 2.&lt;/p&gt;<a name="line.540"></a>
+<FONT color="green">541</FONT>         * &lt;p&gt;<a name="line.541"></a>
+<FONT color="green">542</FONT>         * The test does not assume that the underlying popuation variances are<a name="line.542"></a>
+<FONT color="green">543</FONT>         * equal  and it uses approximated degrees of freedom computed from the<a name="line.543"></a>
+<FONT color="green">544</FONT>         * sample data to compute the p-value.  The t-statistic used is as defined in<a name="line.544"></a>
+<FONT color="green">545</FONT>         * {@link #t(double[], double[])} and the Welch-Satterthwaite approximation<a name="line.545"></a>
+<FONT color="green">546</FONT>         * to the degrees of freedom is used,<a name="line.546"></a>
+<FONT color="green">547</FONT>         * as described<a name="line.547"></a>
+<FONT color="green">548</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/prc/section3/prc31.htm"&gt;<a name="line.548"></a>
+<FONT color="green">549</FONT>         * here.&lt;/a&gt;  To perform the test under the assumption of equal subpopulation<a name="line.549"></a>
+<FONT color="green">550</FONT>         * variances, use {@link #homoscedasticTTest(double[], double[])}.&lt;/p&gt;<a name="line.550"></a>
+<FONT color="green">551</FONT>         * &lt;p&gt;<a name="line.551"></a>
+<FONT color="green">552</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.552"></a>
+<FONT color="green">553</FONT>         * The validity of the p-value depends on the assumptions of the parametric<a name="line.553"></a>
+<FONT color="green">554</FONT>         * t-test procedure, as discussed<a name="line.554"></a>
+<FONT color="green">555</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;<a name="line.555"></a>
+<FONT color="green">556</FONT>         * here&lt;/a&gt;&lt;/p&gt;<a name="line.556"></a>
+<FONT color="green">557</FONT>         * &lt;p&gt;<a name="line.557"></a>
+<FONT color="green">558</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.558"></a>
+<FONT color="green">559</FONT>         * &lt;li&gt;The observed array lengths must both be at least 2.<a name="line.559"></a>
+<FONT color="green">560</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.560"></a>
+<FONT color="green">561</FONT>         *<a name="line.561"></a>
+<FONT color="green">562</FONT>         * @param sample1 array of sample data values<a name="line.562"></a>
+<FONT color="green">563</FONT>         * @param sample2 array of sample data values<a name="line.563"></a>
+<FONT color="green">564</FONT>         * @return p-value for t-test<a name="line.564"></a>
+<FONT color="green">565</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.565"></a>
+<FONT color="green">566</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.566"></a>
+<FONT color="green">567</FONT>         */<a name="line.567"></a>
+<FONT color="green">568</FONT>        public double tTest(double[] sample1, double[] sample2)<a name="line.568"></a>
+<FONT color="green">569</FONT>        throws IllegalArgumentException, MathException {<a name="line.569"></a>
+<FONT color="green">570</FONT>            checkSampleData(sample1);<a name="line.570"></a>
+<FONT color="green">571</FONT>            checkSampleData(sample2);<a name="line.571"></a>
+<FONT color="green">572</FONT>            return tTest(StatUtils.mean(sample1), StatUtils.mean(sample2),<a name="line.572"></a>
+<FONT color="green">573</FONT>                    StatUtils.variance(sample1), StatUtils.variance(sample2),<a name="line.573"></a>
+<FONT color="green">574</FONT>                    sample1.length, sample2.length);<a name="line.574"></a>
+<FONT color="green">575</FONT>        }<a name="line.575"></a>
+<FONT color="green">576</FONT>    <a name="line.576"></a>
+<FONT color="green">577</FONT>        /**<a name="line.577"></a>
+<FONT color="green">578</FONT>         * Returns the &lt;i&gt;observed significance level&lt;/i&gt;, or<a name="line.578"></a>
+<FONT color="green">579</FONT>         * &lt;i&gt;p-value&lt;/i&gt;, associated with a two-sample, two-tailed t-test<a name="line.579"></a>
+<FONT color="green">580</FONT>         * comparing the means of the input arrays, under the assumption that<a name="line.580"></a>
+<FONT color="green">581</FONT>         * the two samples are drawn from subpopulations with equal variances.<a name="line.581"></a>
+<FONT color="green">582</FONT>         * To perform the test without the equal variances assumption, use<a name="line.582"></a>
+<FONT color="green">583</FONT>         * {@link #tTest(double[], double[])}.<a name="line.583"></a>
+<FONT color="green">584</FONT>         * &lt;p&gt;<a name="line.584"></a>
+<FONT color="green">585</FONT>         * The number returned is the smallest significance level<a name="line.585"></a>
+<FONT color="green">586</FONT>         * at which one can reject the null hypothesis that the two means are<a name="line.586"></a>
+<FONT color="green">587</FONT>         * equal in favor of the two-sided alternative that they are different.<a name="line.587"></a>
+<FONT color="green">588</FONT>         * For a one-sided test, divide the returned value by 2.&lt;/p&gt;<a name="line.588"></a>
+<FONT color="green">589</FONT>         * &lt;p&gt;<a name="line.589"></a>
+<FONT color="green">590</FONT>         * A pooled variance estimate is used to compute the t-statistic.  See<a name="line.590"></a>
+<FONT color="green">591</FONT>         * {@link #homoscedasticT(double[], double[])}. The sum of the sample sizes<a name="line.591"></a>
+<FONT color="green">592</FONT>         * minus 2 is used as the degrees of freedom.&lt;/p&gt;<a name="line.592"></a>
+<FONT color="green">593</FONT>         * &lt;p&gt;<a name="line.593"></a>
+<FONT color="green">594</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.594"></a>
+<FONT color="green">595</FONT>         * The validity of the p-value depends on the assumptions of the parametric<a name="line.595"></a>
+<FONT color="green">596</FONT>         * t-test procedure, as discussed<a name="line.596"></a>
+<FONT color="green">597</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;<a name="line.597"></a>
+<FONT color="green">598</FONT>         * here&lt;/a&gt;&lt;/p&gt;<a name="line.598"></a>
+<FONT color="green">599</FONT>         * &lt;p&gt;<a name="line.599"></a>
+<FONT color="green">600</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.600"></a>
+<FONT color="green">601</FONT>         * &lt;li&gt;The observed array lengths must both be at least 2.<a name="line.601"></a>
+<FONT color="green">602</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.602"></a>
+<FONT color="green">603</FONT>         *<a name="line.603"></a>
+<FONT color="green">604</FONT>         * @param sample1 array of sample data values<a name="line.604"></a>
+<FONT color="green">605</FONT>         * @param sample2 array of sample data values<a name="line.605"></a>
+<FONT color="green">606</FONT>         * @return p-value for t-test<a name="line.606"></a>
+<FONT color="green">607</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.607"></a>
+<FONT color="green">608</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.608"></a>
+<FONT color="green">609</FONT>         */<a name="line.609"></a>
+<FONT color="green">610</FONT>        public double homoscedasticTTest(double[] sample1, double[] sample2)<a name="line.610"></a>
+<FONT color="green">611</FONT>        throws IllegalArgumentException, MathException {<a name="line.611"></a>
+<FONT color="green">612</FONT>            checkSampleData(sample1);<a name="line.612"></a>
+<FONT color="green">613</FONT>            checkSampleData(sample2);<a name="line.613"></a>
+<FONT color="green">614</FONT>            return homoscedasticTTest(StatUtils.mean(sample1),<a name="line.614"></a>
+<FONT color="green">615</FONT>                    StatUtils.mean(sample2), StatUtils.variance(sample1),<a name="line.615"></a>
+<FONT color="green">616</FONT>                    StatUtils.variance(sample2), sample1.length,<a name="line.616"></a>
+<FONT color="green">617</FONT>                    sample2.length);<a name="line.617"></a>
+<FONT color="green">618</FONT>        }<a name="line.618"></a>
+<FONT color="green">619</FONT>    <a name="line.619"></a>
+<FONT color="green">620</FONT>    <a name="line.620"></a>
+<FONT color="green">621</FONT>         /**<a name="line.621"></a>
+<FONT color="green">622</FONT>         * Performs a<a name="line.622"></a>
+<FONT color="green">623</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm"&gt;<a name="line.623"></a>
+<FONT color="green">624</FONT>         * two-sided t-test&lt;/a&gt; evaluating the null hypothesis that &lt;code&gt;sample1&lt;/code&gt;<a name="line.624"></a>
+<FONT color="green">625</FONT>         * and &lt;code&gt;sample2&lt;/code&gt; are drawn from populations with the same mean,<a name="line.625"></a>
+<FONT color="green">626</FONT>         * with significance level &lt;code&gt;alpha&lt;/code&gt;.  This test does not assume<a name="line.626"></a>
+<FONT color="green">627</FONT>         * that the subpopulation variances are equal.  To perform the test assuming<a name="line.627"></a>
+<FONT color="green">628</FONT>         * equal variances, use<a name="line.628"></a>
+<FONT color="green">629</FONT>         * {@link #homoscedasticTTest(double[], double[], double)}.<a name="line.629"></a>
+<FONT color="green">630</FONT>         * &lt;p&gt;<a name="line.630"></a>
+<FONT color="green">631</FONT>         * Returns &lt;code&gt;true&lt;/code&gt; iff the null hypothesis that the means are<a name="line.631"></a>
+<FONT color="green">632</FONT>         * equal can be rejected with confidence &lt;code&gt;1 - alpha&lt;/code&gt;.  To<a name="line.632"></a>
+<FONT color="green">633</FONT>         * perform a 1-sided test, use &lt;code&gt;alpha / 2&lt;/code&gt;&lt;/p&gt;<a name="line.633"></a>
+<FONT color="green">634</FONT>         * &lt;p&gt;<a name="line.634"></a>
+<FONT color="green">635</FONT>         * See {@link #t(double[], double[])} for the formula used to compute the<a name="line.635"></a>
+<FONT color="green">636</FONT>         * t-statistic.  Degrees of freedom are approximated using the<a name="line.636"></a>
+<FONT color="green">637</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/prc/section3/prc31.htm"&gt;<a name="line.637"></a>
+<FONT color="green">638</FONT>         * Welch-Satterthwaite approximation.&lt;/a&gt;&lt;/p&gt;<a name="line.638"></a>
+<FONT color="green">639</FONT>    <a name="line.639"></a>
+<FONT color="green">640</FONT>         * &lt;p&gt;<a name="line.640"></a>
+<FONT color="green">641</FONT>         * &lt;strong&gt;Examples:&lt;/strong&gt;&lt;br&gt;&lt;ol&gt;<a name="line.641"></a>
+<FONT color="green">642</FONT>         * &lt;li&gt;To test the (2-sided) hypothesis &lt;code&gt;mean 1 = mean 2 &lt;/code&gt; at<a name="line.642"></a>
+<FONT color="green">643</FONT>         * the 95% level,  use<a name="line.643"></a>
+<FONT color="green">644</FONT>         * &lt;br&gt;&lt;code&gt;tTest(sample1, sample2, 0.05). &lt;/code&gt;<a name="line.644"></a>
+<FONT color="green">645</FONT>         * &lt;/li&gt;<a name="line.645"></a>
+<FONT color="green">646</FONT>         * &lt;li&gt;To test the (one-sided) hypothesis &lt;code&gt; mean 1 &lt; mean 2 &lt;/code&gt; at<a name="line.646"></a>
+<FONT color="green">647</FONT>         * the 99% level, first verify that the measured  mean of &lt;code&gt;sample 1&lt;/code&gt;<a name="line.647"></a>
+<FONT color="green">648</FONT>         * is less than the mean of &lt;code&gt;sample 2&lt;/code&gt; and then use<a name="line.648"></a>
+<FONT color="green">649</FONT>         * &lt;br&gt;&lt;code&gt;tTest(sample1, sample2, 0.02) &lt;/code&gt;<a name="line.649"></a>
+<FONT color="green">650</FONT>         * &lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;<a name="line.650"></a>
+<FONT color="green">651</FONT>         * &lt;p&gt;<a name="line.651"></a>
+<FONT color="green">652</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.652"></a>
+<FONT color="green">653</FONT>         * The validity of the test depends on the assumptions of the parametric<a name="line.653"></a>
+<FONT color="green">654</FONT>         * t-test procedure, as discussed<a name="line.654"></a>
+<FONT color="green">655</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;<a name="line.655"></a>
+<FONT color="green">656</FONT>         * here&lt;/a&gt;&lt;/p&gt;<a name="line.656"></a>
+<FONT color="green">657</FONT>         * &lt;p&gt;<a name="line.657"></a>
+<FONT color="green">658</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.658"></a>
+<FONT color="green">659</FONT>         * &lt;li&gt;The observed array lengths must both be at least 2.<a name="line.659"></a>
+<FONT color="green">660</FONT>         * &lt;/li&gt;<a name="line.660"></a>
+<FONT color="green">661</FONT>         * &lt;li&gt; &lt;code&gt; 0 &lt; alpha &lt; 0.5 &lt;/code&gt;<a name="line.661"></a>
+<FONT color="green">662</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.662"></a>
+<FONT color="green">663</FONT>         *<a name="line.663"></a>
+<FONT color="green">664</FONT>         * @param sample1 array of sample data values<a name="line.664"></a>
+<FONT color="green">665</FONT>         * @param sample2 array of sample data values<a name="line.665"></a>
+<FONT color="green">666</FONT>         * @param alpha significance level of the test<a name="line.666"></a>
+<FONT color="green">667</FONT>         * @return true if the null hypothesis can be rejected with<a name="line.667"></a>
+<FONT color="green">668</FONT>         * confidence 1 - alpha<a name="line.668"></a>
+<FONT color="green">669</FONT>         * @throws IllegalArgumentException if the preconditions are not met<a name="line.669"></a>
+<FONT color="green">670</FONT>         * @throws MathException if an error occurs performing the test<a name="line.670"></a>
+<FONT color="green">671</FONT>         */<a name="line.671"></a>
+<FONT color="green">672</FONT>        public boolean tTest(double[] sample1, double[] sample2,<a name="line.672"></a>
+<FONT color="green">673</FONT>                double alpha)<a name="line.673"></a>
+<FONT color="green">674</FONT>        throws IllegalArgumentException, MathException {<a name="line.674"></a>
+<FONT color="green">675</FONT>            checkSignificanceLevel(alpha);<a name="line.675"></a>
+<FONT color="green">676</FONT>            return tTest(sample1, sample2) &lt; alpha;<a name="line.676"></a>
+<FONT color="green">677</FONT>        }<a name="line.677"></a>
+<FONT color="green">678</FONT>    <a name="line.678"></a>
+<FONT color="green">679</FONT>        /**<a name="line.679"></a>
+<FONT color="green">680</FONT>         * Performs a<a name="line.680"></a>
+<FONT color="green">681</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm"&gt;<a name="line.681"></a>
+<FONT color="green">682</FONT>         * two-sided t-test&lt;/a&gt; evaluating the null hypothesis that &lt;code&gt;sample1&lt;/code&gt;<a name="line.682"></a>
+<FONT color="green">683</FONT>         * and &lt;code&gt;sample2&lt;/code&gt; are drawn from populations with the same mean,<a name="line.683"></a>
+<FONT color="green">684</FONT>         * with significance level &lt;code&gt;alpha&lt;/code&gt;,  assuming that the<a name="line.684"></a>
+<FONT color="green">685</FONT>         * subpopulation variances are equal.  Use<a name="line.685"></a>
+<FONT color="green">686</FONT>         * {@link #tTest(double[], double[], double)} to perform the test without<a name="line.686"></a>
+<FONT color="green">687</FONT>         * the assumption of equal variances.<a name="line.687"></a>
+<FONT color="green">688</FONT>         * &lt;p&gt;<a name="line.688"></a>
+<FONT color="green">689</FONT>         * Returns &lt;code&gt;true&lt;/code&gt; iff the null hypothesis that the means are<a name="line.689"></a>
+<FONT color="green">690</FONT>         * equal can be rejected with confidence &lt;code&gt;1 - alpha&lt;/code&gt;.  To<a name="line.690"></a>
+<FONT color="green">691</FONT>         * perform a 1-sided test, use &lt;code&gt;alpha * 2.&lt;/code&gt;  To perform the test<a name="line.691"></a>
+<FONT color="green">692</FONT>         * without the assumption of equal subpopulation variances, use<a name="line.692"></a>
+<FONT color="green">693</FONT>         * {@link #tTest(double[], double[], double)}.&lt;/p&gt;<a name="line.693"></a>
+<FONT color="green">694</FONT>         * &lt;p&gt;<a name="line.694"></a>
+<FONT color="green">695</FONT>         * A pooled variance estimate is used to compute the t-statistic. See<a name="line.695"></a>
+<FONT color="green">696</FONT>         * {@link #t(double[], double[])} for the formula. The sum of the sample<a name="line.696"></a>
+<FONT color="green">697</FONT>         * sizes minus 2 is used as the degrees of freedom.&lt;/p&gt;<a name="line.697"></a>
+<FONT color="green">698</FONT>         * &lt;p&gt;<a name="line.698"></a>
+<FONT color="green">699</FONT>         * &lt;strong&gt;Examples:&lt;/strong&gt;&lt;br&gt;&lt;ol&gt;<a name="line.699"></a>
+<FONT color="green">700</FONT>         * &lt;li&gt;To test the (2-sided) hypothesis &lt;code&gt;mean 1 = mean 2 &lt;/code&gt; at<a name="line.700"></a>
+<FONT color="green">701</FONT>         * the 95% level, use &lt;br&gt;&lt;code&gt;tTest(sample1, sample2, 0.05). &lt;/code&gt;<a name="line.701"></a>
+<FONT color="green">702</FONT>         * &lt;/li&gt;<a name="line.702"></a>
+<FONT color="green">703</FONT>         * &lt;li&gt;To test the (one-sided) hypothesis &lt;code&gt; mean 1 &lt; mean 2, &lt;/code&gt;<a name="line.703"></a>
+<FONT color="green">704</FONT>         * at the 99% level, first verify that the measured mean of<a name="line.704"></a>
+<FONT color="green">705</FONT>         * &lt;code&gt;sample 1&lt;/code&gt; is less than the mean of &lt;code&gt;sample 2&lt;/code&gt;<a name="line.705"></a>
+<FONT color="green">706</FONT>         * and then use<a name="line.706"></a>
+<FONT color="green">707</FONT>         * &lt;br&gt;&lt;code&gt;tTest(sample1, sample2, 0.02) &lt;/code&gt;<a name="line.707"></a>
+<FONT color="green">708</FONT>         * &lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;<a name="line.708"></a>
+<FONT color="green">709</FONT>         * &lt;p&gt;<a name="line.709"></a>
+<FONT color="green">710</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.710"></a>
+<FONT color="green">711</FONT>         * The validity of the test depends on the assumptions of the parametric<a name="line.711"></a>
+<FONT color="green">712</FONT>         * t-test procedure, as discussed<a name="line.712"></a>
+<FONT color="green">713</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;<a name="line.713"></a>
+<FONT color="green">714</FONT>         * here&lt;/a&gt;&lt;/p&gt;<a name="line.714"></a>
+<FONT color="green">715</FONT>         * &lt;p&gt;<a name="line.715"></a>
+<FONT color="green">716</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.716"></a>
+<FONT color="green">717</FONT>         * &lt;li&gt;The observed array lengths must both be at least 2.<a name="line.717"></a>
+<FONT color="green">718</FONT>         * &lt;/li&gt;<a name="line.718"></a>
+<FONT color="green">719</FONT>         * &lt;li&gt; &lt;code&gt; 0 &lt; alpha &lt; 0.5 &lt;/code&gt;<a name="line.719"></a>
+<FONT color="green">720</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.720"></a>
+<FONT color="green">721</FONT>         *<a name="line.721"></a>
+<FONT color="green">722</FONT>         * @param sample1 array of sample data values<a name="line.722"></a>
+<FONT color="green">723</FONT>         * @param sample2 array of sample data values<a name="line.723"></a>
+<FONT color="green">724</FONT>         * @param alpha significance level of the test<a name="line.724"></a>
+<FONT color="green">725</FONT>         * @return true if the null hypothesis can be rejected with<a name="line.725"></a>
+<FONT color="green">726</FONT>         * confidence 1 - alpha<a name="line.726"></a>
+<FONT color="green">727</FONT>         * @throws IllegalArgumentException if the preconditions are not met<a name="line.727"></a>
+<FONT color="green">728</FONT>         * @throws MathException if an error occurs performing the test<a name="line.728"></a>
+<FONT color="green">729</FONT>         */<a name="line.729"></a>
+<FONT color="green">730</FONT>        public boolean homoscedasticTTest(double[] sample1, double[] sample2,<a name="line.730"></a>
+<FONT color="green">731</FONT>                double alpha)<a name="line.731"></a>
+<FONT color="green">732</FONT>        throws IllegalArgumentException, MathException {<a name="line.732"></a>
+<FONT color="green">733</FONT>            checkSignificanceLevel(alpha);<a name="line.733"></a>
+<FONT color="green">734</FONT>            return homoscedasticTTest(sample1, sample2) &lt; alpha;<a name="line.734"></a>
+<FONT color="green">735</FONT>        }<a name="line.735"></a>
+<FONT color="green">736</FONT>    <a name="line.736"></a>
+<FONT color="green">737</FONT>         /**<a name="line.737"></a>
+<FONT color="green">738</FONT>         * Returns the &lt;i&gt;observed significance level&lt;/i&gt;, or<a name="line.738"></a>
+<FONT color="green">739</FONT>         * &lt;i&gt;p-value&lt;/i&gt;, associated with a two-sample, two-tailed t-test<a name="line.739"></a>
+<FONT color="green">740</FONT>         * comparing the means of the datasets described by two StatisticalSummary<a name="line.740"></a>
+<FONT color="green">741</FONT>         * instances.<a name="line.741"></a>
+<FONT color="green">742</FONT>         * &lt;p&gt;<a name="line.742"></a>
+<FONT color="green">743</FONT>         * The number returned is the smallest significance level<a name="line.743"></a>
+<FONT color="green">744</FONT>         * at which one can reject the null hypothesis that the two means are<a name="line.744"></a>
+<FONT color="green">745</FONT>         * equal in favor of the two-sided alternative that they are different.<a name="line.745"></a>
+<FONT color="green">746</FONT>         * For a one-sided test, divide the returned value by 2.&lt;/p&gt;<a name="line.746"></a>
+<FONT color="green">747</FONT>         * &lt;p&gt;<a name="line.747"></a>
+<FONT color="green">748</FONT>         * The test does not assume that the underlying popuation variances are<a name="line.748"></a>
+<FONT color="green">749</FONT>         * equal  and it uses approximated degrees of freedom computed from the<a name="line.749"></a>
+<FONT color="green">750</FONT>         * sample data to compute the p-value.   To perform the test assuming<a name="line.750"></a>
+<FONT color="green">751</FONT>         * equal variances, use<a name="line.751"></a>
+<FONT color="green">752</FONT>         * {@link #homoscedasticTTest(StatisticalSummary, StatisticalSummary)}.&lt;/p&gt;<a name="line.752"></a>
+<FONT color="green">753</FONT>         * &lt;p&gt;<a name="line.753"></a>
+<FONT color="green">754</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.754"></a>
+<FONT color="green">755</FONT>         * The validity of the p-value depends on the assumptions of the parametric<a name="line.755"></a>
+<FONT color="green">756</FONT>         * t-test procedure, as discussed<a name="line.756"></a>
+<FONT color="green">757</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;<a name="line.757"></a>
+<FONT color="green">758</FONT>         * here&lt;/a&gt;&lt;/p&gt;<a name="line.758"></a>
+<FONT color="green">759</FONT>         * &lt;p&gt;<a name="line.759"></a>
+<FONT color="green">760</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.760"></a>
+<FONT color="green">761</FONT>         * &lt;li&gt;The datasets described by the two Univariates must each contain<a name="line.761"></a>
+<FONT color="green">762</FONT>         * at least 2 observations.<a name="line.762"></a>
+<FONT color="green">763</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.763"></a>
+<FONT color="green">764</FONT>         *<a name="line.764"></a>
+<FONT color="green">765</FONT>         * @param sampleStats1  StatisticalSummary describing data from the first sample<a name="line.765"></a>
+<FONT color="green">766</FONT>         * @param sampleStats2  StatisticalSummary describing data from the second sample<a name="line.766"></a>
+<FONT color="green">767</FONT>         * @return p-value for t-test<a name="line.767"></a>
+<FONT color="green">768</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.768"></a>
+<FONT color="green">769</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.769"></a>
+<FONT color="green">770</FONT>         */<a name="line.770"></a>
+<FONT color="green">771</FONT>        public double tTest(StatisticalSummary sampleStats1, StatisticalSummary sampleStats2)<a name="line.771"></a>
+<FONT color="green">772</FONT>        throws IllegalArgumentException, MathException {<a name="line.772"></a>
+<FONT color="green">773</FONT>            checkSampleData(sampleStats1);<a name="line.773"></a>
+<FONT color="green">774</FONT>            checkSampleData(sampleStats2);<a name="line.774"></a>
+<FONT color="green">775</FONT>            return tTest(sampleStats1.getMean(), sampleStats2.getMean(), sampleStats1.getVariance(),<a name="line.775"></a>
+<FONT color="green">776</FONT>                    sampleStats2.getVariance(), sampleStats1.getN(),<a name="line.776"></a>
+<FONT color="green">777</FONT>                    sampleStats2.getN());<a name="line.777"></a>
+<FONT color="green">778</FONT>        }<a name="line.778"></a>
+<FONT color="green">779</FONT>    <a name="line.779"></a>
+<FONT color="green">780</FONT>        /**<a name="line.780"></a>
+<FONT color="green">781</FONT>         * Returns the &lt;i&gt;observed significance level&lt;/i&gt;, or<a name="line.781"></a>
+<FONT color="green">782</FONT>         * &lt;i&gt;p-value&lt;/i&gt;, associated with a two-sample, two-tailed t-test<a name="line.782"></a>
+<FONT color="green">783</FONT>         * comparing the means of the datasets described by two StatisticalSummary<a name="line.783"></a>
+<FONT color="green">784</FONT>         * instances, under the hypothesis of equal subpopulation variances. To<a name="line.784"></a>
+<FONT color="green">785</FONT>         * perform a test without the equal variances assumption, use<a name="line.785"></a>
+<FONT color="green">786</FONT>         * {@link #tTest(StatisticalSummary, StatisticalSummary)}.<a name="line.786"></a>
+<FONT color="green">787</FONT>         * &lt;p&gt;<a name="line.787"></a>
+<FONT color="green">788</FONT>         * The number returned is the smallest significance level<a name="line.788"></a>
+<FONT color="green">789</FONT>         * at which one can reject the null hypothesis that the two means are<a name="line.789"></a>
+<FONT color="green">790</FONT>         * equal in favor of the two-sided alternative that they are different.<a name="line.790"></a>
+<FONT color="green">791</FONT>         * For a one-sided test, divide the returned value by 2.&lt;/p&gt;<a name="line.791"></a>
+<FONT color="green">792</FONT>         * &lt;p&gt;<a name="line.792"></a>
+<FONT color="green">793</FONT>         * See {@link #homoscedasticT(double[], double[])} for the formula used to<a name="line.793"></a>
+<FONT color="green">794</FONT>         * compute the t-statistic. The sum of the  sample sizes minus 2 is used as<a name="line.794"></a>
+<FONT color="green">795</FONT>         * the degrees of freedom.&lt;/p&gt;<a name="line.795"></a>
+<FONT color="green">796</FONT>         * &lt;p&gt;<a name="line.796"></a>
+<FONT color="green">797</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.797"></a>
+<FONT color="green">798</FONT>         * The validity of the p-value depends on the assumptions of the parametric<a name="line.798"></a>
+<FONT color="green">799</FONT>         * t-test procedure, as discussed<a name="line.799"></a>
+<FONT color="green">800</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;here&lt;/a&gt;<a name="line.800"></a>
+<FONT color="green">801</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.801"></a>
+<FONT color="green">802</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.802"></a>
+<FONT color="green">803</FONT>         * &lt;li&gt;The datasets described by the two Univariates must each contain<a name="line.803"></a>
+<FONT color="green">804</FONT>         * at least 2 observations.<a name="line.804"></a>
+<FONT color="green">805</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.805"></a>
+<FONT color="green">806</FONT>         *<a name="line.806"></a>
+<FONT color="green">807</FONT>         * @param sampleStats1  StatisticalSummary describing data from the first sample<a name="line.807"></a>
+<FONT color="green">808</FONT>         * @param sampleStats2  StatisticalSummary describing data from the second sample<a name="line.808"></a>
+<FONT color="green">809</FONT>         * @return p-value for t-test<a name="line.809"></a>
+<FONT color="green">810</FONT>         * @throws IllegalArgumentException if the precondition is not met<a name="line.810"></a>
+<FONT color="green">811</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.811"></a>
+<FONT color="green">812</FONT>         */<a name="line.812"></a>
+<FONT color="green">813</FONT>        public double homoscedasticTTest(StatisticalSummary sampleStats1,<a name="line.813"></a>
+<FONT color="green">814</FONT>                                         StatisticalSummary sampleStats2)<a name="line.814"></a>
+<FONT color="green">815</FONT>        throws IllegalArgumentException, MathException {<a name="line.815"></a>
+<FONT color="green">816</FONT>            checkSampleData(sampleStats1);<a name="line.816"></a>
+<FONT color="green">817</FONT>            checkSampleData(sampleStats2);<a name="line.817"></a>
+<FONT color="green">818</FONT>            return homoscedasticTTest(sampleStats1.getMean(),<a name="line.818"></a>
+<FONT color="green">819</FONT>                    sampleStats2.getMean(), sampleStats1.getVariance(),<a name="line.819"></a>
+<FONT color="green">820</FONT>                    sampleStats2.getVariance(), sampleStats1.getN(),<a name="line.820"></a>
+<FONT color="green">821</FONT>                    sampleStats2.getN());<a name="line.821"></a>
+<FONT color="green">822</FONT>        }<a name="line.822"></a>
+<FONT color="green">823</FONT>    <a name="line.823"></a>
+<FONT color="green">824</FONT>        /**<a name="line.824"></a>
+<FONT color="green">825</FONT>         * Performs a<a name="line.825"></a>
+<FONT color="green">826</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm"&gt;<a name="line.826"></a>
+<FONT color="green">827</FONT>         * two-sided t-test&lt;/a&gt; evaluating the null hypothesis that<a name="line.827"></a>
+<FONT color="green">828</FONT>         * &lt;code&gt;sampleStats1&lt;/code&gt; and &lt;code&gt;sampleStats2&lt;/code&gt; describe<a name="line.828"></a>
+<FONT color="green">829</FONT>         * datasets drawn from populations with the same mean, with significance<a name="line.829"></a>
+<FONT color="green">830</FONT>         * level &lt;code&gt;alpha&lt;/code&gt;.   This test does not assume that the<a name="line.830"></a>
+<FONT color="green">831</FONT>         * subpopulation variances are equal.  To perform the test under the equal<a name="line.831"></a>
+<FONT color="green">832</FONT>         * variances assumption, use<a name="line.832"></a>
+<FONT color="green">833</FONT>         * {@link #homoscedasticTTest(StatisticalSummary, StatisticalSummary)}.<a name="line.833"></a>
+<FONT color="green">834</FONT>         * &lt;p&gt;<a name="line.834"></a>
+<FONT color="green">835</FONT>         * Returns &lt;code&gt;true&lt;/code&gt; iff the null hypothesis that the means are<a name="line.835"></a>
+<FONT color="green">836</FONT>         * equal can be rejected with confidence &lt;code&gt;1 - alpha&lt;/code&gt;.  To<a name="line.836"></a>
+<FONT color="green">837</FONT>         * perform a 1-sided test, use &lt;code&gt;alpha * 2&lt;/code&gt;&lt;/p&gt;<a name="line.837"></a>
+<FONT color="green">838</FONT>         * &lt;p&gt;<a name="line.838"></a>
+<FONT color="green">839</FONT>         * See {@link #t(double[], double[])} for the formula used to compute the<a name="line.839"></a>
+<FONT color="green">840</FONT>         * t-statistic.  Degrees of freedom are approximated using the<a name="line.840"></a>
+<FONT color="green">841</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/handbook/prc/section3/prc31.htm"&gt;<a name="line.841"></a>
+<FONT color="green">842</FONT>         * Welch-Satterthwaite approximation.&lt;/a&gt;&lt;/p&gt;<a name="line.842"></a>
+<FONT color="green">843</FONT>         * &lt;p&gt;<a name="line.843"></a>
+<FONT color="green">844</FONT>         * &lt;strong&gt;Examples:&lt;/strong&gt;&lt;br&gt;&lt;ol&gt;<a name="line.844"></a>
+<FONT color="green">845</FONT>         * &lt;li&gt;To test the (2-sided) hypothesis &lt;code&gt;mean 1 = mean 2 &lt;/code&gt; at<a name="line.845"></a>
+<FONT color="green">846</FONT>         * the 95%, use<a name="line.846"></a>
+<FONT color="green">847</FONT>         * &lt;br&gt;&lt;code&gt;tTest(sampleStats1, sampleStats2, 0.05) &lt;/code&gt;<a name="line.847"></a>
+<FONT color="green">848</FONT>         * &lt;/li&gt;<a name="line.848"></a>
+<FONT color="green">849</FONT>         * &lt;li&gt;To test the (one-sided) hypothesis &lt;code&gt; mean 1 &lt; mean 2 &lt;/code&gt;<a name="line.849"></a>
+<FONT color="green">850</FONT>         * at the 99% level,  first verify that the measured mean of<a name="line.850"></a>
+<FONT color="green">851</FONT>         * &lt;code&gt;sample 1&lt;/code&gt; is less than  the mean of &lt;code&gt;sample 2&lt;/code&gt;<a name="line.851"></a>
+<FONT color="green">852</FONT>         * and then use<a name="line.852"></a>
+<FONT color="green">853</FONT>         * &lt;br&gt;&lt;code&gt;tTest(sampleStats1, sampleStats2, 0.02) &lt;/code&gt;<a name="line.853"></a>
+<FONT color="green">854</FONT>         * &lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;<a name="line.854"></a>
+<FONT color="green">855</FONT>         * &lt;p&gt;<a name="line.855"></a>
+<FONT color="green">856</FONT>         * &lt;strong&gt;Usage Note:&lt;/strong&gt;&lt;br&gt;<a name="line.856"></a>
+<FONT color="green">857</FONT>         * The validity of the test depends on the assumptions of the parametric<a name="line.857"></a>
+<FONT color="green">858</FONT>         * t-test procedure, as discussed<a name="line.858"></a>
+<FONT color="green">859</FONT>         * &lt;a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html"&gt;<a name="line.859"></a>
+<FONT color="green">860</FONT>         * here&lt;/a&gt;&lt;/p&gt;<a name="line.860"></a>
+<FONT color="green">861</FONT>         * &lt;p&gt;<a name="line.861"></a>
+<FONT color="green">862</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.862"></a>
+<FONT color="green">863</FONT>         * &lt;li&gt;The datasets described by the two Univariates must each contain<a name="line.863"></a>
+<FONT color="green">864</FONT>         * at least 2 observations.<a name="line.864"></a>
+<FONT color="green">865</FONT>         * &lt;/li&gt;<a name="line.865"></a>
+<FONT color="green">866</FONT>         * &lt;li&gt; &lt;code&gt; 0 &lt; alpha &lt; 0.5 &lt;/code&gt;<a name="line.866"></a>
+<FONT color="green">867</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.867"></a>
+<FONT color="green">868</FONT>         *<a name="line.868"></a>
+<FONT color="green">869</FONT>         * @param sampleStats1 StatisticalSummary describing sample data values<a name="line.869"></a>
+<FONT color="green">870</FONT>         * @param sampleStats2 StatisticalSummary describing sample data values<a name="line.870"></a>
+<FONT color="green">871</FONT>         * @param alpha significance level of the test<a name="line.871"></a>
+<FONT color="green">872</FONT>         * @return true if the null hypothesis can be rejected with<a name="line.872"></a>
+<FONT color="green">873</FONT>         * confidence 1 - alpha<a name="line.873"></a>
+<FONT color="green">874</FONT>         * @throws IllegalArgumentException if the preconditions are not met<a name="line.874"></a>
+<FONT color="green">875</FONT>         * @throws MathException if an error occurs performing the test<a name="line.875"></a>
+<FONT color="green">876</FONT>         */<a name="line.876"></a>
+<FONT color="green">877</FONT>        public boolean tTest(StatisticalSummary sampleStats1,<a name="line.877"></a>
+<FONT color="green">878</FONT>                StatisticalSummary sampleStats2, double alpha)<a name="line.878"></a>
+<FONT color="green">879</FONT>        throws IllegalArgumentException, MathException {<a name="line.879"></a>
+<FONT color="green">880</FONT>            checkSignificanceLevel(alpha);<a name="line.880"></a>
+<FONT color="green">881</FONT>            return tTest(sampleStats1, sampleStats2) &lt; alpha;<a name="line.881"></a>
+<FONT color="green">882</FONT>        }<a name="line.882"></a>
+<FONT color="green">883</FONT>    <a name="line.883"></a>
+<FONT color="green">884</FONT>        //----------------------------------------------- Protected methods<a name="line.884"></a>
+<FONT color="green">885</FONT>    <a name="line.885"></a>
+<FONT color="green">886</FONT>        /**<a name="line.886"></a>
+<FONT color="green">887</FONT>         * Computes approximate degrees of freedom for 2-sample t-test.<a name="line.887"></a>
+<FONT color="green">888</FONT>         *<a name="line.888"></a>
+<FONT color="green">889</FONT>         * @param v1 first sample variance<a name="line.889"></a>
+<FONT color="green">890</FONT>         * @param v2 second sample variance<a name="line.890"></a>
+<FONT color="green">891</FONT>         * @param n1 first sample n<a name="line.891"></a>
+<FONT color="green">892</FONT>         * @param n2 second sample n<a name="line.892"></a>
+<FONT color="green">893</FONT>         * @return approximate degrees of freedom<a name="line.893"></a>
+<FONT color="green">894</FONT>         */<a name="line.894"></a>
+<FONT color="green">895</FONT>        protected double df(double v1, double v2, double n1, double n2) {<a name="line.895"></a>
+<FONT color="green">896</FONT>            return (((v1 / n1) + (v2 / n2)) * ((v1 / n1) + (v2 / n2))) /<a name="line.896"></a>
+<FONT color="green">897</FONT>            ((v1 * v1) / (n1 * n1 * (n1 - 1d)) + (v2 * v2) /<a name="line.897"></a>
+<FONT color="green">898</FONT>                    (n2 * n2 * (n2 - 1d)));<a name="line.898"></a>
+<FONT color="green">899</FONT>        }<a name="line.899"></a>
+<FONT color="green">900</FONT>    <a name="line.900"></a>
+<FONT color="green">901</FONT>        /**<a name="line.901"></a>
+<FONT color="green">902</FONT>         * Computes t test statistic for 1-sample t-test.<a name="line.902"></a>
+<FONT color="green">903</FONT>         *<a name="line.903"></a>
+<FONT color="green">904</FONT>         * @param m sample mean<a name="line.904"></a>
+<FONT color="green">905</FONT>         * @param mu constant to test against<a name="line.905"></a>
+<FONT color="green">906</FONT>         * @param v sample variance<a name="line.906"></a>
+<FONT color="green">907</FONT>         * @param n sample n<a name="line.907"></a>
+<FONT color="green">908</FONT>         * @return t test statistic<a name="line.908"></a>
+<FONT color="green">909</FONT>         */<a name="line.909"></a>
+<FONT color="green">910</FONT>        protected double t(double m, double mu, double v, double n) {<a name="line.910"></a>
+<FONT color="green">911</FONT>            return (m - mu) / Math.sqrt(v / n);<a name="line.911"></a>
+<FONT color="green">912</FONT>        }<a name="line.912"></a>
+<FONT color="green">913</FONT>    <a name="line.913"></a>
+<FONT color="green">914</FONT>        /**<a name="line.914"></a>
+<FONT color="green">915</FONT>         * Computes t test statistic for 2-sample t-test.<a name="line.915"></a>
+<FONT color="green">916</FONT>         * &lt;p&gt;<a name="line.916"></a>
+<FONT color="green">917</FONT>         * Does not assume that subpopulation variances are equal.&lt;/p&gt;<a name="line.917"></a>
+<FONT color="green">918</FONT>         *<a name="line.918"></a>
+<FONT color="green">919</FONT>         * @param m1 first sample mean<a name="line.919"></a>
+<FONT color="green">920</FONT>         * @param m2 second sample mean<a name="line.920"></a>
+<FONT color="green">921</FONT>         * @param v1 first sample variance<a name="line.921"></a>
+<FONT color="green">922</FONT>         * @param v2 second sample variance<a name="line.922"></a>
+<FONT color="green">923</FONT>         * @param n1 first sample n<a name="line.923"></a>
+<FONT color="green">924</FONT>         * @param n2 second sample n<a name="line.924"></a>
+<FONT color="green">925</FONT>         * @return t test statistic<a name="line.925"></a>
+<FONT color="green">926</FONT>         */<a name="line.926"></a>
+<FONT color="green">927</FONT>        protected double t(double m1, double m2,  double v1, double v2, double n1,<a name="line.927"></a>
+<FONT color="green">928</FONT>                double n2)  {<a name="line.928"></a>
+<FONT color="green">929</FONT>                return (m1 - m2) / Math.sqrt((v1 / n1) + (v2 / n2));<a name="line.929"></a>
+<FONT color="green">930</FONT>        }<a name="line.930"></a>
+<FONT color="green">931</FONT>    <a name="line.931"></a>
+<FONT color="green">932</FONT>        /**<a name="line.932"></a>
+<FONT color="green">933</FONT>         * Computes t test statistic for 2-sample t-test under the hypothesis<a name="line.933"></a>
+<FONT color="green">934</FONT>         * of equal subpopulation variances.<a name="line.934"></a>
+<FONT color="green">935</FONT>         *<a name="line.935"></a>
+<FONT color="green">936</FONT>         * @param m1 first sample mean<a name="line.936"></a>
+<FONT color="green">937</FONT>         * @param m2 second sample mean<a name="line.937"></a>
+<FONT color="green">938</FONT>         * @param v1 first sample variance<a name="line.938"></a>
+<FONT color="green">939</FONT>         * @param v2 second sample variance<a name="line.939"></a>
+<FONT color="green">940</FONT>         * @param n1 first sample n<a name="line.940"></a>
+<FONT color="green">941</FONT>         * @param n2 second sample n<a name="line.941"></a>
+<FONT color="green">942</FONT>         * @return t test statistic<a name="line.942"></a>
+<FONT color="green">943</FONT>         */<a name="line.943"></a>
+<FONT color="green">944</FONT>        protected double homoscedasticT(double m1, double m2,  double v1,<a name="line.944"></a>
+<FONT color="green">945</FONT>                double v2, double n1, double n2)  {<a name="line.945"></a>
+<FONT color="green">946</FONT>                double pooledVariance = ((n1  - 1) * v1 + (n2 -1) * v2 ) / (n1 + n2 - 2);<a name="line.946"></a>
+<FONT color="green">947</FONT>                return (m1 - m2) / Math.sqrt(pooledVariance * (1d / n1 + 1d / n2));<a name="line.947"></a>
+<FONT color="green">948</FONT>        }<a name="line.948"></a>
+<FONT color="green">949</FONT>    <a name="line.949"></a>
+<FONT color="green">950</FONT>        /**<a name="line.950"></a>
+<FONT color="green">951</FONT>         * Computes p-value for 2-sided, 1-sample t-test.<a name="line.951"></a>
+<FONT color="green">952</FONT>         *<a name="line.952"></a>
+<FONT color="green">953</FONT>         * @param m sample mean<a name="line.953"></a>
+<FONT color="green">954</FONT>         * @param mu constant to test against<a name="line.954"></a>
+<FONT color="green">955</FONT>         * @param v sample variance<a name="line.955"></a>
+<FONT color="green">956</FONT>         * @param n sample n<a name="line.956"></a>
+<FONT color="green">957</FONT>         * @return p-value<a name="line.957"></a>
+<FONT color="green">958</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.958"></a>
+<FONT color="green">959</FONT>         */<a name="line.959"></a>
+<FONT color="green">960</FONT>        protected double tTest(double m, double mu, double v, double n)<a name="line.960"></a>
+<FONT color="green">961</FONT>        throws MathException {<a name="line.961"></a>
+<FONT color="green">962</FONT>            double t = Math.abs(t(m, mu, v, n));<a name="line.962"></a>
+<FONT color="green">963</FONT>            distribution.setDegreesOfFreedom(n - 1);<a name="line.963"></a>
+<FONT color="green">964</FONT>            return 2.0 * distribution.cumulativeProbability(-t);<a name="line.964"></a>
+<FONT color="green">965</FONT>        }<a name="line.965"></a>
+<FONT color="green">966</FONT>    <a name="line.966"></a>
+<FONT color="green">967</FONT>        /**<a name="line.967"></a>
+<FONT color="green">968</FONT>         * Computes p-value for 2-sided, 2-sample t-test.<a name="line.968"></a>
+<FONT color="green">969</FONT>         * &lt;p&gt;<a name="line.969"></a>
+<FONT color="green">970</FONT>         * Does not assume subpopulation variances are equal. Degrees of freedom<a name="line.970"></a>
+<FONT color="green">971</FONT>         * are estimated from the data.&lt;/p&gt;<a name="line.971"></a>
+<FONT color="green">972</FONT>         *<a name="line.972"></a>
+<FONT color="green">973</FONT>         * @param m1 first sample mean<a name="line.973"></a>
+<FONT color="green">974</FONT>         * @param m2 second sample mean<a name="line.974"></a>
+<FONT color="green">975</FONT>         * @param v1 first sample variance<a name="line.975"></a>
+<FONT color="green">976</FONT>         * @param v2 second sample variance<a name="line.976"></a>
+<FONT color="green">977</FONT>         * @param n1 first sample n<a name="line.977"></a>
+<FONT color="green">978</FONT>         * @param n2 second sample n<a name="line.978"></a>
+<FONT color="green">979</FONT>         * @return p-value<a name="line.979"></a>
+<FONT color="green">980</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.980"></a>
+<FONT color="green">981</FONT>         */<a name="line.981"></a>
+<FONT color="green">982</FONT>        protected double tTest(double m1, double m2, double v1, double v2,<a name="line.982"></a>
+<FONT color="green">983</FONT>                double n1, double n2)<a name="line.983"></a>
+<FONT color="green">984</FONT>        throws MathException {<a name="line.984"></a>
+<FONT color="green">985</FONT>            double t = Math.abs(t(m1, m2, v1, v2, n1, n2));<a name="line.985"></a>
+<FONT color="green">986</FONT>            double degreesOfFreedom = 0;<a name="line.986"></a>
+<FONT color="green">987</FONT>            degreesOfFreedom = df(v1, v2, n1, n2);<a name="line.987"></a>
+<FONT color="green">988</FONT>            distribution.setDegreesOfFreedom(degreesOfFreedom);<a name="line.988"></a>
+<FONT color="green">989</FONT>            return 2.0 * distribution.cumulativeProbability(-t);<a name="line.989"></a>
+<FONT color="green">990</FONT>        }<a name="line.990"></a>
+<FONT color="green">991</FONT>    <a name="line.991"></a>
+<FONT color="green">992</FONT>        /**<a name="line.992"></a>
+<FONT color="green">993</FONT>         * Computes p-value for 2-sided, 2-sample t-test, under the assumption<a name="line.993"></a>
+<FONT color="green">994</FONT>         * of equal subpopulation variances.<a name="line.994"></a>
+<FONT color="green">995</FONT>         * &lt;p&gt;<a name="line.995"></a>
+<FONT color="green">996</FONT>         * The sum of the sample sizes minus 2 is used as degrees of freedom.&lt;/p&gt;<a name="line.996"></a>
+<FONT color="green">997</FONT>         *<a name="line.997"></a>
+<FONT color="green">998</FONT>         * @param m1 first sample mean<a name="line.998"></a>
+<FONT color="green">999</FONT>         * @param m2 second sample mean<a name="line.999"></a>
+<FONT color="green">1000</FONT>         * @param v1 first sample variance<a name="line.1000"></a>
+<FONT color="green">1001</FONT>         * @param v2 second sample variance<a name="line.1001"></a>
+<FONT color="green">1002</FONT>         * @param n1 first sample n<a name="line.1002"></a>
+<FONT color="green">1003</FONT>         * @param n2 second sample n<a name="line.1003"></a>
+<FONT color="green">1004</FONT>         * @return p-value<a name="line.1004"></a>
+<FONT color="green">1005</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.1005"></a>
+<FONT color="green">1006</FONT>         */<a name="line.1006"></a>
+<FONT color="green">1007</FONT>        protected double homoscedasticTTest(double m1, double m2, double v1,<a name="line.1007"></a>
+<FONT color="green">1008</FONT>                double v2, double n1, double n2)<a name="line.1008"></a>
+<FONT color="green">1009</FONT>        throws MathException {<a name="line.1009"></a>
+<FONT color="green">1010</FONT>            double t = Math.abs(homoscedasticT(m1, m2, v1, v2, n1, n2));<a name="line.1010"></a>
+<FONT color="green">1011</FONT>            double degreesOfFreedom = n1 + n2 - 2;<a name="line.1011"></a>
+<FONT color="green">1012</FONT>            distribution.setDegreesOfFreedom(degreesOfFreedom);<a name="line.1012"></a>
+<FONT color="green">1013</FONT>            return 2.0 * distribution.cumulativeProbability(-t);<a name="line.1013"></a>
+<FONT color="green">1014</FONT>        }<a name="line.1014"></a>
+<FONT color="green">1015</FONT>    <a name="line.1015"></a>
+<FONT color="green">1016</FONT>        /**<a name="line.1016"></a>
+<FONT color="green">1017</FONT>         * Modify the distribution used to compute inference statistics.<a name="line.1017"></a>
+<FONT color="green">1018</FONT>         * @param value the new distribution<a name="line.1018"></a>
+<FONT color="green">1019</FONT>         * @since 1.2<a name="line.1019"></a>
+<FONT color="green">1020</FONT>         */<a name="line.1020"></a>
+<FONT color="green">1021</FONT>        public void setDistribution(TDistribution value) {<a name="line.1021"></a>
+<FONT color="green">1022</FONT>            distribution = value;<a name="line.1022"></a>
+<FONT color="green">1023</FONT>        }<a name="line.1023"></a>
+<FONT color="green">1024</FONT>    <a name="line.1024"></a>
+<FONT color="green">1025</FONT>        /** Check significance level.<a name="line.1025"></a>
+<FONT color="green">1026</FONT>         * @param alpha significance level<a name="line.1026"></a>
+<FONT color="green">1027</FONT>         * @exception IllegalArgumentException if significance level is out of bounds<a name="line.1027"></a>
+<FONT color="green">1028</FONT>         */<a name="line.1028"></a>
+<FONT color="green">1029</FONT>        private void checkSignificanceLevel(final double alpha)<a name="line.1029"></a>
+<FONT color="green">1030</FONT>            throws IllegalArgumentException {<a name="line.1030"></a>
+<FONT color="green">1031</FONT>            if ((alpha &lt;= 0) || (alpha &gt; 0.5)) {<a name="line.1031"></a>
+<FONT color="green">1032</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1032"></a>
+<FONT color="green">1033</FONT>                      "out of bounds significance level {0}, must be between {1} and {2}",<a name="line.1033"></a>
+<FONT color="green">1034</FONT>                      alpha, 0.0, 0.5);<a name="line.1034"></a>
+<FONT color="green">1035</FONT>            }<a name="line.1035"></a>
+<FONT color="green">1036</FONT>        }<a name="line.1036"></a>
+<FONT color="green">1037</FONT>    <a name="line.1037"></a>
+<FONT color="green">1038</FONT>        /** Check sample data.<a name="line.1038"></a>
+<FONT color="green">1039</FONT>         * @param data sample data<a name="line.1039"></a>
+<FONT color="green">1040</FONT>         * @exception IllegalArgumentException if there is not enough sample data<a name="line.1040"></a>
+<FONT color="green">1041</FONT>         */<a name="line.1041"></a>
+<FONT color="green">1042</FONT>        private void checkSampleData(final double[] data)<a name="line.1042"></a>
+<FONT color="green">1043</FONT>            throws IllegalArgumentException {<a name="line.1043"></a>
+<FONT color="green">1044</FONT>            if ((data == null) || (data.length &lt; 2)) {<a name="line.1044"></a>
+<FONT color="green">1045</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1045"></a>
+<FONT color="green">1046</FONT>                      INSUFFICIENT_DATA_MESSAGE,<a name="line.1046"></a>
+<FONT color="green">1047</FONT>                      (data == null) ? 0 : data.length);<a name="line.1047"></a>
+<FONT color="green">1048</FONT>            }<a name="line.1048"></a>
+<FONT color="green">1049</FONT>        }<a name="line.1049"></a>
+<FONT color="green">1050</FONT>    <a name="line.1050"></a>
+<FONT color="green">1051</FONT>        /** Check sample data.<a name="line.1051"></a>
+<FONT color="green">1052</FONT>         * @param stat statistical summary<a name="line.1052"></a>
+<FONT color="green">1053</FONT>         * @exception IllegalArgumentException if there is not enough sample data<a name="line.1053"></a>
+<FONT color="green">1054</FONT>         */<a name="line.1054"></a>
+<FONT color="green">1055</FONT>        private void checkSampleData(final StatisticalSummary stat)<a name="line.1055"></a>
+<FONT color="green">1056</FONT>            throws IllegalArgumentException {<a name="line.1056"></a>
+<FONT color="green">1057</FONT>            if ((stat == null) || (stat.getN() &lt; 2)) {<a name="line.1057"></a>
+<FONT color="green">1058</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1058"></a>
+<FONT color="green">1059</FONT>                      INSUFFICIENT_DATA_MESSAGE,<a name="line.1059"></a>
+<FONT color="green">1060</FONT>                      (stat == null) ? 0 : stat.getN());<a name="line.1060"></a>
+<FONT color="green">1061</FONT>            }<a name="line.1061"></a>
+<FONT color="green">1062</FONT>        }<a name="line.1062"></a>
+<FONT color="green">1063</FONT>    <a name="line.1063"></a>
+<FONT color="green">1064</FONT>    }<a name="line.1064"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/inference/TestUtils.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,481 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.inference;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.util.Collection;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.stat.descriptive.StatisticalSummary;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * A collection of static methods to create inference test instances or to<a name="line.24"></a>
+<FONT color="green">025</FONT>     * perform inference tests.<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @since 1.1<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public class TestUtils  {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** Singleton TTest instance using default implementation. */<a name="line.32"></a>
+<FONT color="green">033</FONT>        private static TTest tTest = new TTestImpl();<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Singleton ChiSquareTest instance using default implementation. */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private static ChiSquareTest chiSquareTest =<a name="line.36"></a>
+<FONT color="green">037</FONT>            new ChiSquareTestImpl();<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Singleton ChiSquareTest instance using default implementation. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private static UnknownDistributionChiSquareTest unknownDistributionChiSquareTest =<a name="line.40"></a>
+<FONT color="green">041</FONT>            new ChiSquareTestImpl();<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** Singleton OneWayAnova instance using default implementation. */<a name="line.43"></a>
+<FONT color="green">044</FONT>        private static OneWayAnova oneWayAnova =<a name="line.44"></a>
+<FONT color="green">045</FONT>            new OneWayAnovaImpl();<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /**<a name="line.47"></a>
+<FONT color="green">048</FONT>         * Prevent instantiation.<a name="line.48"></a>
+<FONT color="green">049</FONT>         */<a name="line.49"></a>
+<FONT color="green">050</FONT>        protected TestUtils() {<a name="line.50"></a>
+<FONT color="green">051</FONT>            super();<a name="line.51"></a>
+<FONT color="green">052</FONT>        }<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        /**<a name="line.54"></a>
+<FONT color="green">055</FONT>         * Set the (singleton) TTest instance.<a name="line.55"></a>
+<FONT color="green">056</FONT>         *<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @param chiSquareTest the new instance to use<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @since 1.2<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        public static void setChiSquareTest(TTest chiSquareTest) {<a name="line.60"></a>
+<FONT color="green">061</FONT>            TestUtils.tTest = chiSquareTest;<a name="line.61"></a>
+<FONT color="green">062</FONT>        }<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /**<a name="line.64"></a>
+<FONT color="green">065</FONT>         * Return a (singleton) TTest instance.  Does not create a new instance.<a name="line.65"></a>
+<FONT color="green">066</FONT>         *<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @return a TTest instance<a name="line.67"></a>
+<FONT color="green">068</FONT>         */<a name="line.68"></a>
+<FONT color="green">069</FONT>        public static TTest getTTest() {<a name="line.69"></a>
+<FONT color="green">070</FONT>            return tTest;<a name="line.70"></a>
+<FONT color="green">071</FONT>        }<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /**<a name="line.73"></a>
+<FONT color="green">074</FONT>         * Set the (singleton) ChiSquareTest instance.<a name="line.74"></a>
+<FONT color="green">075</FONT>         *<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @param chiSquareTest the new instance to use<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @since 1.2<a name="line.77"></a>
+<FONT color="green">078</FONT>         */<a name="line.78"></a>
+<FONT color="green">079</FONT>        public static void setChiSquareTest(ChiSquareTest chiSquareTest) {<a name="line.79"></a>
+<FONT color="green">080</FONT>            TestUtils.chiSquareTest = chiSquareTest;<a name="line.80"></a>
+<FONT color="green">081</FONT>        }<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /**<a name="line.83"></a>
+<FONT color="green">084</FONT>         * Return a (singleton) ChiSquareTest instance.  Does not create a new instance.<a name="line.84"></a>
+<FONT color="green">085</FONT>         *<a name="line.85"></a>
+<FONT color="green">086</FONT>         * @return a ChiSquareTest instance<a name="line.86"></a>
+<FONT color="green">087</FONT>         */<a name="line.87"></a>
+<FONT color="green">088</FONT>        public static ChiSquareTest getChiSquareTest() {<a name="line.88"></a>
+<FONT color="green">089</FONT>            return chiSquareTest;<a name="line.89"></a>
+<FONT color="green">090</FONT>        }<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /**<a name="line.92"></a>
+<FONT color="green">093</FONT>         * Set the (singleton) UnknownDistributionChiSquareTest instance.<a name="line.93"></a>
+<FONT color="green">094</FONT>         *<a name="line.94"></a>
+<FONT color="green">095</FONT>         * @param unknownDistributionChiSquareTest the new instance to use<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @since 1.2<a name="line.96"></a>
+<FONT color="green">097</FONT>         */<a name="line.97"></a>
+<FONT color="green">098</FONT>        public static void setUnknownDistributionChiSquareTest(UnknownDistributionChiSquareTest unknownDistributionChiSquareTest) {<a name="line.98"></a>
+<FONT color="green">099</FONT>            TestUtils.unknownDistributionChiSquareTest = unknownDistributionChiSquareTest;<a name="line.99"></a>
+<FONT color="green">100</FONT>        }<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>        /**<a name="line.102"></a>
+<FONT color="green">103</FONT>         * Return a (singleton) UnknownDistributionChiSquareTest instance.  Does not create a new instance.<a name="line.103"></a>
+<FONT color="green">104</FONT>         *<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @return a UnknownDistributionChiSquareTest instance<a name="line.105"></a>
+<FONT color="green">106</FONT>         */<a name="line.106"></a>
+<FONT color="green">107</FONT>        public static UnknownDistributionChiSquareTest getUnknownDistributionChiSquareTest() {<a name="line.107"></a>
+<FONT color="green">108</FONT>            return unknownDistributionChiSquareTest;<a name="line.108"></a>
+<FONT color="green">109</FONT>        }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        /**<a name="line.111"></a>
+<FONT color="green">112</FONT>         * Set the (singleton) OneWayAnova instance<a name="line.112"></a>
+<FONT color="green">113</FONT>         *<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param oneWayAnova the new instance to use<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @since 1.2<a name="line.115"></a>
+<FONT color="green">116</FONT>         */<a name="line.116"></a>
+<FONT color="green">117</FONT>        public static void setOneWayAnova(OneWayAnova oneWayAnova) {<a name="line.117"></a>
+<FONT color="green">118</FONT>            TestUtils.oneWayAnova = oneWayAnova;<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /**<a name="line.121"></a>
+<FONT color="green">122</FONT>         * Return a (singleton) OneWayAnova instance.  Does not create a new instance.<a name="line.122"></a>
+<FONT color="green">123</FONT>         *<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @return a OneWayAnova instance<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @since 1.2<a name="line.125"></a>
+<FONT color="green">126</FONT>         */<a name="line.126"></a>
+<FONT color="green">127</FONT>        public static OneWayAnova getOneWayAnova() {<a name="line.127"></a>
+<FONT color="green">128</FONT>            return oneWayAnova;<a name="line.128"></a>
+<FONT color="green">129</FONT>        }<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>    <a name="line.131"></a>
+<FONT color="green">132</FONT>        // CHECKSTYLE: stop JavadocMethodCheck<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>        /**<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @see org.apache.commons.math.stat.inference.TTest#homoscedasticT(double[], double[])<a name="line.135"></a>
+<FONT color="green">136</FONT>         */<a name="line.136"></a>
+<FONT color="green">137</FONT>        public static double homoscedasticT(double[] sample1, double[] sample2)<a name="line.137"></a>
+<FONT color="green">138</FONT>            throws IllegalArgumentException {<a name="line.138"></a>
+<FONT color="green">139</FONT>            return tTest.homoscedasticT(sample1, sample2);<a name="line.139"></a>
+<FONT color="green">140</FONT>        }<a name="line.140"></a>
+<FONT color="green">141</FONT>    <a name="line.141"></a>
+<FONT color="green">142</FONT>        /**<a name="line.142"></a>
+<FONT color="green">143</FONT>         * @see org.apache.commons.math.stat.inference.TTest#homoscedasticT(org.apache.commons.math.stat.descriptive.StatisticalSummary, org.apache.commons.math.stat.descriptive.StatisticalSummary)<a name="line.143"></a>
+<FONT color="green">144</FONT>         */<a name="line.144"></a>
+<FONT color="green">145</FONT>        public static double homoscedasticT(StatisticalSummary sampleStats1,<a name="line.145"></a>
+<FONT color="green">146</FONT>            StatisticalSummary sampleStats2)<a name="line.146"></a>
+<FONT color="green">147</FONT>            throws IllegalArgumentException {<a name="line.147"></a>
+<FONT color="green">148</FONT>            return tTest.homoscedasticT(sampleStats1, sampleStats2);<a name="line.148"></a>
+<FONT color="green">149</FONT>        }<a name="line.149"></a>
+<FONT color="green">150</FONT>    <a name="line.150"></a>
+<FONT color="green">151</FONT>        /**<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @see org.apache.commons.math.stat.inference.TTest#homoscedasticTTest(double[], double[], double)<a name="line.152"></a>
+<FONT color="green">153</FONT>         */<a name="line.153"></a>
+<FONT color="green">154</FONT>        public static boolean homoscedasticTTest(double[] sample1, double[] sample2,<a name="line.154"></a>
+<FONT color="green">155</FONT>                double alpha)<a name="line.155"></a>
+<FONT color="green">156</FONT>            throws IllegalArgumentException, MathException {<a name="line.156"></a>
+<FONT color="green">157</FONT>            return tTest. homoscedasticTTest(sample1, sample2, alpha);<a name="line.157"></a>
+<FONT color="green">158</FONT>        }<a name="line.158"></a>
+<FONT color="green">159</FONT>    <a name="line.159"></a>
+<FONT color="green">160</FONT>        /**<a name="line.160"></a>
+<FONT color="green">161</FONT>         * @see org.apache.commons.math.stat.inference.TTest#homoscedasticTTest(double[], double[])<a name="line.161"></a>
+<FONT color="green">162</FONT>         */<a name="line.162"></a>
+<FONT color="green">163</FONT>        public static double homoscedasticTTest(double[] sample1, double[] sample2)<a name="line.163"></a>
+<FONT color="green">164</FONT>            throws IllegalArgumentException, MathException {<a name="line.164"></a>
+<FONT color="green">165</FONT>            return tTest.homoscedasticTTest(sample1, sample2);<a name="line.165"></a>
+<FONT color="green">166</FONT>        }<a name="line.166"></a>
+<FONT color="green">167</FONT>    <a name="line.167"></a>
+<FONT color="green">168</FONT>        /**<a name="line.168"></a>
+<FONT color="green">169</FONT>         * @see org.apache.commons.math.stat.inference.TTest#homoscedasticTTest(org.apache.commons.math.stat.descriptive.StatisticalSummary, org.apache.commons.math.stat.descriptive.StatisticalSummary)<a name="line.169"></a>
+<FONT color="green">170</FONT>         */<a name="line.170"></a>
+<FONT color="green">171</FONT>        public static double homoscedasticTTest(StatisticalSummary sampleStats1,<a name="line.171"></a>
+<FONT color="green">172</FONT>            StatisticalSummary sampleStats2)<a name="line.172"></a>
+<FONT color="green">173</FONT>            throws IllegalArgumentException, MathException {<a name="line.173"></a>
+<FONT color="green">174</FONT>            return tTest.homoscedasticTTest(sampleStats1, sampleStats2);<a name="line.174"></a>
+<FONT color="green">175</FONT>        }<a name="line.175"></a>
+<FONT color="green">176</FONT>    <a name="line.176"></a>
+<FONT color="green">177</FONT>        /**<a name="line.177"></a>
+<FONT color="green">178</FONT>         * @see org.apache.commons.math.stat.inference.TTest#pairedT(double[], double[])<a name="line.178"></a>
+<FONT color="green">179</FONT>         */<a name="line.179"></a>
+<FONT color="green">180</FONT>        public static double pairedT(double[] sample1, double[] sample2)<a name="line.180"></a>
+<FONT color="green">181</FONT>            throws IllegalArgumentException, MathException {<a name="line.181"></a>
+<FONT color="green">182</FONT>            return tTest.pairedT(sample1, sample2);<a name="line.182"></a>
+<FONT color="green">183</FONT>        }<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>        /**<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @see org.apache.commons.math.stat.inference.TTest#pairedTTest(double[], double[], double)<a name="line.186"></a>
+<FONT color="green">187</FONT>         */<a name="line.187"></a>
+<FONT color="green">188</FONT>        public static boolean pairedTTest(double[] sample1, double[] sample2,<a name="line.188"></a>
+<FONT color="green">189</FONT>            double alpha)<a name="line.189"></a>
+<FONT color="green">190</FONT>            throws IllegalArgumentException, MathException {<a name="line.190"></a>
+<FONT color="green">191</FONT>            return tTest.pairedTTest(sample1, sample2, alpha);<a name="line.191"></a>
+<FONT color="green">192</FONT>        }<a name="line.192"></a>
+<FONT color="green">193</FONT>    <a name="line.193"></a>
+<FONT color="green">194</FONT>        /**<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @see org.apache.commons.math.stat.inference.TTest#pairedTTest(double[], double[])<a name="line.195"></a>
+<FONT color="green">196</FONT>         */<a name="line.196"></a>
+<FONT color="green">197</FONT>        public static double pairedTTest(double[] sample1, double[] sample2)<a name="line.197"></a>
+<FONT color="green">198</FONT>            throws IllegalArgumentException, MathException {<a name="line.198"></a>
+<FONT color="green">199</FONT>            return tTest.pairedTTest(sample1, sample2);<a name="line.199"></a>
+<FONT color="green">200</FONT>        }<a name="line.200"></a>
+<FONT color="green">201</FONT>    <a name="line.201"></a>
+<FONT color="green">202</FONT>        /**<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @see org.apache.commons.math.stat.inference.TTest#t(double, double[])<a name="line.203"></a>
+<FONT color="green">204</FONT>         */<a name="line.204"></a>
+<FONT color="green">205</FONT>        public static double t(double mu, double[] observed)<a name="line.205"></a>
+<FONT color="green">206</FONT>            throws IllegalArgumentException {<a name="line.206"></a>
+<FONT color="green">207</FONT>            return tTest.t(mu, observed);<a name="line.207"></a>
+<FONT color="green">208</FONT>        }<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>        /**<a name="line.210"></a>
+<FONT color="green">211</FONT>         * @see org.apache.commons.math.stat.inference.TTest#t(double, org.apache.commons.math.stat.descriptive.StatisticalSummary)<a name="line.211"></a>
+<FONT color="green">212</FONT>         */<a name="line.212"></a>
+<FONT color="green">213</FONT>        public static double t(double mu, StatisticalSummary sampleStats)<a name="line.213"></a>
+<FONT color="green">214</FONT>            throws IllegalArgumentException {<a name="line.214"></a>
+<FONT color="green">215</FONT>            return tTest.t(mu, sampleStats);<a name="line.215"></a>
+<FONT color="green">216</FONT>        }<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>        /**<a name="line.218"></a>
+<FONT color="green">219</FONT>         * @see org.apache.commons.math.stat.inference.TTest#t(double[], double[])<a name="line.219"></a>
+<FONT color="green">220</FONT>         */<a name="line.220"></a>
+<FONT color="green">221</FONT>        public static double t(double[] sample1, double[] sample2)<a name="line.221"></a>
+<FONT color="green">222</FONT>            throws IllegalArgumentException {<a name="line.222"></a>
+<FONT color="green">223</FONT>            return tTest.t(sample1, sample2);<a name="line.223"></a>
+<FONT color="green">224</FONT>        }<a name="line.224"></a>
+<FONT color="green">225</FONT>    <a name="line.225"></a>
+<FONT color="green">226</FONT>        /**<a name="line.226"></a>
+<FONT color="green">227</FONT>         * @see org.apache.commons.math.stat.inference.TTest#t(org.apache.commons.math.stat.descriptive.StatisticalSummary, org.apache.commons.math.stat.descriptive.StatisticalSummary)<a name="line.227"></a>
+<FONT color="green">228</FONT>         */<a name="line.228"></a>
+<FONT color="green">229</FONT>        public static double t(StatisticalSummary sampleStats1,<a name="line.229"></a>
+<FONT color="green">230</FONT>                StatisticalSummary sampleStats2)<a name="line.230"></a>
+<FONT color="green">231</FONT>            throws IllegalArgumentException {<a name="line.231"></a>
+<FONT color="green">232</FONT>            return tTest.t(sampleStats1, sampleStats2);<a name="line.232"></a>
+<FONT color="green">233</FONT>        }<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>        /**<a name="line.235"></a>
+<FONT color="green">236</FONT>         * @see org.apache.commons.math.stat.inference.TTest#tTest(double, double[], double)<a name="line.236"></a>
+<FONT color="green">237</FONT>         */<a name="line.237"></a>
+<FONT color="green">238</FONT>        public static boolean tTest(double mu, double[] sample, double alpha)<a name="line.238"></a>
+<FONT color="green">239</FONT>            throws IllegalArgumentException, MathException {<a name="line.239"></a>
+<FONT color="green">240</FONT>            return tTest.tTest(mu, sample, alpha);<a name="line.240"></a>
+<FONT color="green">241</FONT>        }<a name="line.241"></a>
+<FONT color="green">242</FONT>    <a name="line.242"></a>
+<FONT color="green">243</FONT>        /**<a name="line.243"></a>
+<FONT color="green">244</FONT>         * @see org.apache.commons.math.stat.inference.TTest#tTest(double, double[])<a name="line.244"></a>
+<FONT color="green">245</FONT>         */<a name="line.245"></a>
+<FONT color="green">246</FONT>        public static double tTest(double mu, double[] sample)<a name="line.246"></a>
+<FONT color="green">247</FONT>            throws IllegalArgumentException, MathException {<a name="line.247"></a>
+<FONT color="green">248</FONT>            return tTest.tTest(mu, sample);<a name="line.248"></a>
+<FONT color="green">249</FONT>        }<a name="line.249"></a>
+<FONT color="green">250</FONT>    <a name="line.250"></a>
+<FONT color="green">251</FONT>        /**<a name="line.251"></a>
+<FONT color="green">252</FONT>         * @see org.apache.commons.math.stat.inference.TTest#tTest(double, org.apache.commons.math.stat.descriptive.StatisticalSummary, double)<a name="line.252"></a>
+<FONT color="green">253</FONT>         */<a name="line.253"></a>
+<FONT color="green">254</FONT>        public static boolean tTest(double mu, StatisticalSummary sampleStats,<a name="line.254"></a>
+<FONT color="green">255</FONT>            double alpha)<a name="line.255"></a>
+<FONT color="green">256</FONT>            throws IllegalArgumentException, MathException {<a name="line.256"></a>
+<FONT color="green">257</FONT>            return tTest. tTest(mu, sampleStats, alpha);<a name="line.257"></a>
+<FONT color="green">258</FONT>        }<a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>        /**<a name="line.260"></a>
+<FONT color="green">261</FONT>         * @see org.apache.commons.math.stat.inference.TTest#tTest(double, org.apache.commons.math.stat.descriptive.StatisticalSummary)<a name="line.261"></a>
+<FONT color="green">262</FONT>         */<a name="line.262"></a>
+<FONT color="green">263</FONT>        public static double tTest(double mu, StatisticalSummary sampleStats)<a name="line.263"></a>
+<FONT color="green">264</FONT>            throws IllegalArgumentException, MathException {<a name="line.264"></a>
+<FONT color="green">265</FONT>            return tTest.tTest(mu, sampleStats);<a name="line.265"></a>
+<FONT color="green">266</FONT>        }<a name="line.266"></a>
+<FONT color="green">267</FONT>    <a name="line.267"></a>
+<FONT color="green">268</FONT>        /**<a name="line.268"></a>
+<FONT color="green">269</FONT>         * @see org.apache.commons.math.stat.inference.TTest#tTest(double[], double[], double)<a name="line.269"></a>
+<FONT color="green">270</FONT>         */<a name="line.270"></a>
+<FONT color="green">271</FONT>        public static boolean tTest(double[] sample1, double[] sample2, double alpha)<a name="line.271"></a>
+<FONT color="green">272</FONT>            throws IllegalArgumentException, MathException {<a name="line.272"></a>
+<FONT color="green">273</FONT>            return tTest.tTest(sample1, sample2, alpha);<a name="line.273"></a>
+<FONT color="green">274</FONT>        }<a name="line.274"></a>
+<FONT color="green">275</FONT>    <a name="line.275"></a>
+<FONT color="green">276</FONT>        /**<a name="line.276"></a>
+<FONT color="green">277</FONT>         * @see org.apache.commons.math.stat.inference.TTest#tTest(double[], double[])<a name="line.277"></a>
+<FONT color="green">278</FONT>         */<a name="line.278"></a>
+<FONT color="green">279</FONT>        public static double tTest(double[] sample1, double[] sample2)<a name="line.279"></a>
+<FONT color="green">280</FONT>            throws IllegalArgumentException, MathException {<a name="line.280"></a>
+<FONT color="green">281</FONT>            return tTest.tTest(sample1, sample2);<a name="line.281"></a>
+<FONT color="green">282</FONT>        }<a name="line.282"></a>
+<FONT color="green">283</FONT>    <a name="line.283"></a>
+<FONT color="green">284</FONT>        /**<a name="line.284"></a>
+<FONT color="green">285</FONT>         * @see org.apache.commons.math.stat.inference.TTest#tTest(org.apache.commons.math.stat.descriptive.StatisticalSummary, org.apache.commons.math.stat.descriptive.StatisticalSummary, double)<a name="line.285"></a>
+<FONT color="green">286</FONT>         */<a name="line.286"></a>
+<FONT color="green">287</FONT>        public static boolean tTest(StatisticalSummary sampleStats1,<a name="line.287"></a>
+<FONT color="green">288</FONT>            StatisticalSummary sampleStats2, double alpha)<a name="line.288"></a>
+<FONT color="green">289</FONT>            throws IllegalArgumentException, MathException {<a name="line.289"></a>
+<FONT color="green">290</FONT>            return tTest. tTest(sampleStats1, sampleStats2, alpha);<a name="line.290"></a>
+<FONT color="green">291</FONT>        }<a name="line.291"></a>
+<FONT color="green">292</FONT>    <a name="line.292"></a>
+<FONT color="green">293</FONT>        /**<a name="line.293"></a>
+<FONT color="green">294</FONT>         * @see org.apache.commons.math.stat.inference.TTest#tTest(org.apache.commons.math.stat.descriptive.StatisticalSummary, org.apache.commons.math.stat.descriptive.StatisticalSummary)<a name="line.294"></a>
+<FONT color="green">295</FONT>         */<a name="line.295"></a>
+<FONT color="green">296</FONT>        public static double tTest(StatisticalSummary sampleStats1,<a name="line.296"></a>
+<FONT color="green">297</FONT>            StatisticalSummary sampleStats2)<a name="line.297"></a>
+<FONT color="green">298</FONT>            throws IllegalArgumentException, MathException {<a name="line.298"></a>
+<FONT color="green">299</FONT>            return tTest.tTest(sampleStats1, sampleStats2);<a name="line.299"></a>
+<FONT color="green">300</FONT>        }<a name="line.300"></a>
+<FONT color="green">301</FONT>    <a name="line.301"></a>
+<FONT color="green">302</FONT>        /**<a name="line.302"></a>
+<FONT color="green">303</FONT>         * @see org.apache.commons.math.stat.inference.ChiSquareTest#chiSquare(double[], long[])<a name="line.303"></a>
+<FONT color="green">304</FONT>         */<a name="line.304"></a>
+<FONT color="green">305</FONT>        public static double chiSquare(double[] expected, long[] observed)<a name="line.305"></a>
+<FONT color="green">306</FONT>            throws IllegalArgumentException {<a name="line.306"></a>
+<FONT color="green">307</FONT>            return chiSquareTest.chiSquare(expected, observed);<a name="line.307"></a>
+<FONT color="green">308</FONT>        }<a name="line.308"></a>
+<FONT color="green">309</FONT>    <a name="line.309"></a>
+<FONT color="green">310</FONT>        /**<a name="line.310"></a>
+<FONT color="green">311</FONT>         * @see org.apache.commons.math.stat.inference.ChiSquareTest#chiSquare(long[][])<a name="line.311"></a>
+<FONT color="green">312</FONT>         */<a name="line.312"></a>
+<FONT color="green">313</FONT>        public static double chiSquare(long[][] counts)<a name="line.313"></a>
+<FONT color="green">314</FONT>            throws IllegalArgumentException {<a name="line.314"></a>
+<FONT color="green">315</FONT>            return chiSquareTest.chiSquare(counts);<a name="line.315"></a>
+<FONT color="green">316</FONT>        }<a name="line.316"></a>
+<FONT color="green">317</FONT>    <a name="line.317"></a>
+<FONT color="green">318</FONT>        /**<a name="line.318"></a>
+<FONT color="green">319</FONT>         * @see org.apache.commons.math.stat.inference.ChiSquareTest#chiSquareTest(double[], long[], double)<a name="line.319"></a>
+<FONT color="green">320</FONT>         */<a name="line.320"></a>
+<FONT color="green">321</FONT>        public static boolean chiSquareTest(double[] expected, long[] observed,<a name="line.321"></a>
+<FONT color="green">322</FONT>            double alpha)<a name="line.322"></a>
+<FONT color="green">323</FONT>            throws IllegalArgumentException, MathException {<a name="line.323"></a>
+<FONT color="green">324</FONT>            return chiSquareTest.chiSquareTest(expected, observed, alpha);<a name="line.324"></a>
+<FONT color="green">325</FONT>        }<a name="line.325"></a>
+<FONT color="green">326</FONT>    <a name="line.326"></a>
+<FONT color="green">327</FONT>        /**<a name="line.327"></a>
+<FONT color="green">328</FONT>         * @see org.apache.commons.math.stat.inference.ChiSquareTest#chiSquareTest(double[], long[])<a name="line.328"></a>
+<FONT color="green">329</FONT>         */<a name="line.329"></a>
+<FONT color="green">330</FONT>        public static double chiSquareTest(double[] expected, long[] observed)<a name="line.330"></a>
+<FONT color="green">331</FONT>            throws IllegalArgumentException, MathException {<a name="line.331"></a>
+<FONT color="green">332</FONT>            return chiSquareTest.chiSquareTest(expected, observed);<a name="line.332"></a>
+<FONT color="green">333</FONT>        }<a name="line.333"></a>
+<FONT color="green">334</FONT>    <a name="line.334"></a>
+<FONT color="green">335</FONT>        /**<a name="line.335"></a>
+<FONT color="green">336</FONT>         * @see org.apache.commons.math.stat.inference.ChiSquareTest#chiSquareTest(long[][], double)<a name="line.336"></a>
+<FONT color="green">337</FONT>         */<a name="line.337"></a>
+<FONT color="green">338</FONT>        public static boolean chiSquareTest(long[][] counts, double alpha)<a name="line.338"></a>
+<FONT color="green">339</FONT>            throws IllegalArgumentException, MathException {<a name="line.339"></a>
+<FONT color="green">340</FONT>            return chiSquareTest. chiSquareTest(counts, alpha);<a name="line.340"></a>
+<FONT color="green">341</FONT>        }<a name="line.341"></a>
+<FONT color="green">342</FONT>    <a name="line.342"></a>
+<FONT color="green">343</FONT>        /**<a name="line.343"></a>
+<FONT color="green">344</FONT>         * @see org.apache.commons.math.stat.inference.ChiSquareTest#chiSquareTest(long[][])<a name="line.344"></a>
+<FONT color="green">345</FONT>         */<a name="line.345"></a>
+<FONT color="green">346</FONT>        public static double chiSquareTest(long[][] counts)<a name="line.346"></a>
+<FONT color="green">347</FONT>            throws IllegalArgumentException, MathException {<a name="line.347"></a>
+<FONT color="green">348</FONT>            return chiSquareTest. chiSquareTest(counts);<a name="line.348"></a>
+<FONT color="green">349</FONT>        }<a name="line.349"></a>
+<FONT color="green">350</FONT>    <a name="line.350"></a>
+<FONT color="green">351</FONT>        /**<a name="line.351"></a>
+<FONT color="green">352</FONT>         * @see org.apache.commons.math.stat.inference.UnknownDistributionChiSquareTest#chiSquareDataSetsComparison(long[], long[])<a name="line.352"></a>
+<FONT color="green">353</FONT>         *<a name="line.353"></a>
+<FONT color="green">354</FONT>         * @since 1.2<a name="line.354"></a>
+<FONT color="green">355</FONT>         */<a name="line.355"></a>
+<FONT color="green">356</FONT>        public static double chiSquareDataSetsComparison(long[] observed1, long[] observed2)<a name="line.356"></a>
+<FONT color="green">357</FONT>            throws IllegalArgumentException {<a name="line.357"></a>
+<FONT color="green">358</FONT>            return unknownDistributionChiSquareTest.chiSquareDataSetsComparison(observed1, observed2);<a name="line.358"></a>
+<FONT color="green">359</FONT>        }<a name="line.359"></a>
+<FONT color="green">360</FONT>    <a name="line.360"></a>
+<FONT color="green">361</FONT>        /**<a name="line.361"></a>
+<FONT color="green">362</FONT>         * @see org.apache.commons.math.stat.inference.UnknownDistributionChiSquareTest#chiSquareTestDataSetsComparison(long[], long[])<a name="line.362"></a>
+<FONT color="green">363</FONT>         *<a name="line.363"></a>
+<FONT color="green">364</FONT>         * @since 1.2<a name="line.364"></a>
+<FONT color="green">365</FONT>         */<a name="line.365"></a>
+<FONT color="green">366</FONT>        public static double chiSquareTestDataSetsComparison(long[] observed1, long[] observed2)<a name="line.366"></a>
+<FONT color="green">367</FONT>            throws IllegalArgumentException, MathException {<a name="line.367"></a>
+<FONT color="green">368</FONT>            return unknownDistributionChiSquareTest.chiSquareTestDataSetsComparison(observed1, observed2);<a name="line.368"></a>
+<FONT color="green">369</FONT>        }<a name="line.369"></a>
+<FONT color="green">370</FONT>    <a name="line.370"></a>
+<FONT color="green">371</FONT>    <a name="line.371"></a>
+<FONT color="green">372</FONT>        /**<a name="line.372"></a>
+<FONT color="green">373</FONT>         * @see org.apache.commons.math.stat.inference.UnknownDistributionChiSquareTest#chiSquareTestDataSetsComparison(long[], long[], double)<a name="line.373"></a>
+<FONT color="green">374</FONT>         *<a name="line.374"></a>
+<FONT color="green">375</FONT>         * @since 1.2<a name="line.375"></a>
+<FONT color="green">376</FONT>         */<a name="line.376"></a>
+<FONT color="green">377</FONT>        public static boolean chiSquareTestDataSetsComparison(long[] observed1, long[] observed2,<a name="line.377"></a>
+<FONT color="green">378</FONT>            double alpha)<a name="line.378"></a>
+<FONT color="green">379</FONT>            throws IllegalArgumentException, MathException {<a name="line.379"></a>
+<FONT color="green">380</FONT>            return unknownDistributionChiSquareTest.chiSquareTestDataSetsComparison(observed1, observed2, alpha);<a name="line.380"></a>
+<FONT color="green">381</FONT>        }<a name="line.381"></a>
+<FONT color="green">382</FONT>    <a name="line.382"></a>
+<FONT color="green">383</FONT>        /**<a name="line.383"></a>
+<FONT color="green">384</FONT>         * @see org.apache.commons.math.stat.inference.OneWayAnova#anovaFValue(Collection)<a name="line.384"></a>
+<FONT color="green">385</FONT>         *<a name="line.385"></a>
+<FONT color="green">386</FONT>         * @since 1.2<a name="line.386"></a>
+<FONT color="green">387</FONT>         */<a name="line.387"></a>
+<FONT color="green">388</FONT>        public static double oneWayAnovaFValue(Collection&lt;double[]&gt; categoryData)<a name="line.388"></a>
+<FONT color="green">389</FONT>        throws IllegalArgumentException, MathException {<a name="line.389"></a>
+<FONT color="green">390</FONT>            return oneWayAnova.anovaFValue(categoryData);<a name="line.390"></a>
+<FONT color="green">391</FONT>        }<a name="line.391"></a>
+<FONT color="green">392</FONT>    <a name="line.392"></a>
+<FONT color="green">393</FONT>        /**<a name="line.393"></a>
+<FONT color="green">394</FONT>         * @see org.apache.commons.math.stat.inference.OneWayAnova#anovaPValue(Collection)<a name="line.394"></a>
+<FONT color="green">395</FONT>         *<a name="line.395"></a>
+<FONT color="green">396</FONT>         * @since 1.2<a name="line.396"></a>
+<FONT color="green">397</FONT>         */<a name="line.397"></a>
+<FONT color="green">398</FONT>        public static double oneWayAnovaPValue(Collection&lt;double[]&gt; categoryData)<a name="line.398"></a>
+<FONT color="green">399</FONT>        throws IllegalArgumentException, MathException {<a name="line.399"></a>
+<FONT color="green">400</FONT>            return oneWayAnova.anovaPValue(categoryData);<a name="line.400"></a>
+<FONT color="green">401</FONT>        }<a name="line.401"></a>
+<FONT color="green">402</FONT>    <a name="line.402"></a>
+<FONT color="green">403</FONT>        /**<a name="line.403"></a>
+<FONT color="green">404</FONT>         * @see org.apache.commons.math.stat.inference.OneWayAnova#anovaTest(Collection,double)<a name="line.404"></a>
+<FONT color="green">405</FONT>         *<a name="line.405"></a>
+<FONT color="green">406</FONT>         * @since 1.2<a name="line.406"></a>
+<FONT color="green">407</FONT>         */<a name="line.407"></a>
+<FONT color="green">408</FONT>        public static boolean oneWayAnovaTest(Collection&lt;double[]&gt; categoryData, double alpha)<a name="line.408"></a>
+<FONT color="green">409</FONT>        throws IllegalArgumentException, MathException {<a name="line.409"></a>
+<FONT color="green">410</FONT>            return oneWayAnova.anovaTest(categoryData, alpha);<a name="line.410"></a>
+<FONT color="green">411</FONT>        }<a name="line.411"></a>
+<FONT color="green">412</FONT>    <a name="line.412"></a>
+<FONT color="green">413</FONT>        // CHECKSTYLE: resume JavadocMethodCheck<a name="line.413"></a>
+<FONT color="green">414</FONT>    <a name="line.414"></a>
+<FONT color="green">415</FONT>    }<a name="line.415"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/inference/UnknownDistributionChiSquareTest.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,210 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.inference;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * An interface for Chi-Square tests for unknown distributions.<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;p&gt;Two samples tests are used when the distribution is unknown &lt;i&gt;a priori&lt;/i&gt;<a name="line.23"></a>
+<FONT color="green">024</FONT>     * but provided by one sample. We compare the second sample against the first.&lt;/p&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     *<a name="line.25"></a>
+<FONT color="green">026</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @since 1.2<a name="line.27"></a>
+<FONT color="green">028</FONT>     */<a name="line.28"></a>
+<FONT color="green">029</FONT>    public interface UnknownDistributionChiSquareTest extends ChiSquareTest {<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>        /**<a name="line.31"></a>
+<FONT color="green">032</FONT>         * &lt;p&gt;Computes a<a name="line.32"></a>
+<FONT color="green">033</FONT>         * &lt;a href="http://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/chi2samp.htm"&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>         * Chi-Square two sample test statistic&lt;/a&gt; comparing bin frequency counts<a name="line.34"></a>
+<FONT color="green">035</FONT>         * in &lt;code&gt;observed1&lt;/code&gt; and &lt;code&gt;observed2&lt;/code&gt;.  The<a name="line.35"></a>
+<FONT color="green">036</FONT>         * sums of frequency counts in the two samples are not required to be the<a name="line.36"></a>
+<FONT color="green">037</FONT>         * same.  The formula used to compute the test statistic is&lt;/p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>         * &lt;code&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>         * &amp;sum;[(K * observed1[i] - observed2[i]/K)&lt;sup&gt;2&lt;/sup&gt; / (observed1[i] + observed2[i])]<a name="line.39"></a>
+<FONT color="green">040</FONT>         * &lt;/code&gt; where<a name="line.40"></a>
+<FONT color="green">041</FONT>         * &lt;br/&gt;&lt;code&gt;K = &amp;sqrt;[&amp;sum(observed2 / &amp;sum;(observed1)]&lt;/code&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>         * &lt;/p&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>         * &lt;p&gt;This statistic can be used to perform a Chi-Square test evaluating the null hypothesis that<a name="line.43"></a>
+<FONT color="green">044</FONT>         * both observed counts follow the same distribution.&lt;/p&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>         * &lt;p&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>         * &lt;li&gt;Observed counts must be non-negative.<a name="line.47"></a>
+<FONT color="green">048</FONT>         * &lt;/li&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>         * &lt;li&gt;Observed counts for a specific bin must not both be zero.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * &lt;/li&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>         * &lt;li&gt;Observed counts for a specific sample must not all be 0.<a name="line.51"></a>
+<FONT color="green">052</FONT>         * &lt;/li&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>         * &lt;li&gt;The arrays &lt;code&gt;observed1&lt;/code&gt; and &lt;code&gt;observed2&lt;/code&gt; must have the same length and<a name="line.53"></a>
+<FONT color="green">054</FONT>         * their common length must be at least 2.<a name="line.54"></a>
+<FONT color="green">055</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;&lt;p&gt;<a name="line.55"></a>
+<FONT color="green">056</FONT>         * If any of the preconditions are not met, an<a name="line.56"></a>
+<FONT color="green">057</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.57"></a>
+<FONT color="green">058</FONT>         *<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @param observed1 array of observed frequency counts of the first data set<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @param observed2 array of observed frequency counts of the second data set<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @return chiSquare statistic<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @throws IllegalArgumentException if preconditions are not met<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        double chiSquareDataSetsComparison(long[] observed1, long[] observed2)<a name="line.64"></a>
+<FONT color="green">065</FONT>            throws IllegalArgumentException;<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /**<a name="line.67"></a>
+<FONT color="green">068</FONT>         * &lt;p&gt;Returns the &lt;i&gt;observed significance level&lt;/i&gt;, or &lt;a href=<a name="line.68"></a>
+<FONT color="green">069</FONT>         * "http://www.cas.lancs.ac.uk/glossary_v1.1/hyptest.html#pvalue"&gt;<a name="line.69"></a>
+<FONT color="green">070</FONT>         * p-value&lt;/a&gt;, associated with a Chi-Square two sample test comparing<a name="line.70"></a>
+<FONT color="green">071</FONT>         * bin frequency counts in &lt;code&gt;observed1&lt;/code&gt; and<a name="line.71"></a>
+<FONT color="green">072</FONT>         * &lt;code&gt;observed2&lt;/code&gt;.<a name="line.72"></a>
+<FONT color="green">073</FONT>         * &lt;/p&gt;<a name="line.73"></a>
+<FONT color="green">074</FONT>         * &lt;p&gt;The number returned is the smallest significance level at which one<a name="line.74"></a>
+<FONT color="green">075</FONT>         * can reject the null hypothesis that the observed counts conform to the<a name="line.75"></a>
+<FONT color="green">076</FONT>         * same distribution.<a name="line.76"></a>
+<FONT color="green">077</FONT>         * &lt;/p&gt;<a name="line.77"></a>
+<FONT color="green">078</FONT>         * &lt;p&gt;See {@link #chiSquareDataSetsComparison(long[], long[])} for details<a name="line.78"></a>
+<FONT color="green">079</FONT>         * on the formula used to compute the test statistic. The degrees of<a name="line.79"></a>
+<FONT color="green">080</FONT>         * of freedom used to perform the test is one less than the common length<a name="line.80"></a>
+<FONT color="green">081</FONT>         * of the input observed count arrays.<a name="line.81"></a>
+<FONT color="green">082</FONT>         * &lt;/p&gt;<a name="line.82"></a>
+<FONT color="green">083</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.83"></a>
+<FONT color="green">084</FONT>         * &lt;li&gt;Observed counts must be non-negative.<a name="line.84"></a>
+<FONT color="green">085</FONT>         * &lt;/li&gt;<a name="line.85"></a>
+<FONT color="green">086</FONT>         * &lt;li&gt;Observed counts for a specific bin must not both be zero.<a name="line.86"></a>
+<FONT color="green">087</FONT>         * &lt;/li&gt;<a name="line.87"></a>
+<FONT color="green">088</FONT>         * &lt;li&gt;Observed counts for a specific sample must not all be 0.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * &lt;/li&gt;<a name="line.89"></a>
+<FONT color="green">090</FONT>         * &lt;li&gt;The arrays &lt;code&gt;observed1&lt;/code&gt; and &lt;code&gt;observed2&lt;/code&gt; must<a name="line.90"></a>
+<FONT color="green">091</FONT>         * have the same length and<a name="line.91"></a>
+<FONT color="green">092</FONT>         * their common length must be at least 2.<a name="line.92"></a>
+<FONT color="green">093</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;<a name="line.93"></a>
+<FONT color="green">094</FONT>         * If any of the preconditions are not met, an<a name="line.94"></a>
+<FONT color="green">095</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.95"></a>
+<FONT color="green">096</FONT>         *<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @param observed1 array of observed frequency counts of the first data set<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @param observed2 array of observed frequency counts of the second data set<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @return p-value<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @throws IllegalArgumentException if preconditions are not met<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @throws MathException if an error occurs computing the p-value<a name="line.101"></a>
+<FONT color="green">102</FONT>         */<a name="line.102"></a>
+<FONT color="green">103</FONT>        double chiSquareTestDataSetsComparison(long[] observed1, long[] observed2)<a name="line.103"></a>
+<FONT color="green">104</FONT>          throws IllegalArgumentException, MathException;<a name="line.104"></a>
+<FONT color="green">105</FONT>    <a name="line.105"></a>
+<FONT color="green">106</FONT>        /**<a name="line.106"></a>
+<FONT color="green">107</FONT>         * &lt;p&gt;Performs a Chi-Square two sample test comparing two binned data<a name="line.107"></a>
+<FONT color="green">108</FONT>         * sets. The test evaluates the null hypothesis that the two lists of<a name="line.108"></a>
+<FONT color="green">109</FONT>         * observed counts conform to the same frequency distribution, with<a name="line.109"></a>
+<FONT color="green">110</FONT>         * significance level &lt;code&gt;alpha&lt;/code&gt;.  Returns true iff the null<a name="line.110"></a>
+<FONT color="green">111</FONT>         * hypothesis can be rejected with 100 * (1 - alpha) percent confidence.<a name="line.111"></a>
+<FONT color="green">112</FONT>         * &lt;/p&gt;<a name="line.112"></a>
+<FONT color="green">113</FONT>         * &lt;p&gt;See {@link #chiSquareDataSetsComparison(long[], long[])} for<a name="line.113"></a>
+<FONT color="green">114</FONT>         * details on the formula used to compute the Chisquare statistic used<a name="line.114"></a>
+<FONT color="green">115</FONT>         * in the test. The degrees of of freedom used to perform the test is<a name="line.115"></a>
+<FONT color="green">116</FONT>         * one less than the common length of the input observed count arrays.<a name="line.116"></a>
+<FONT color="green">117</FONT>         * &lt;/p&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.118"></a>
+<FONT color="green">119</FONT>         * &lt;li&gt;Observed counts must be non-negative.<a name="line.119"></a>
+<FONT color="green">120</FONT>         * &lt;/li&gt;<a name="line.120"></a>
+<FONT color="green">121</FONT>         * &lt;li&gt;Observed counts for a specific bin must not both be zero.<a name="line.121"></a>
+<FONT color="green">122</FONT>         * &lt;/li&gt;<a name="line.122"></a>
+<FONT color="green">123</FONT>         * &lt;li&gt;Observed counts for a specific sample must not all be 0.<a name="line.123"></a>
+<FONT color="green">124</FONT>         * &lt;/li&gt;<a name="line.124"></a>
+<FONT color="green">125</FONT>         * &lt;li&gt;The arrays &lt;code&gt;observed1&lt;/code&gt; and &lt;code&gt;observed2&lt;/code&gt; must<a name="line.125"></a>
+<FONT color="green">126</FONT>         * have the same length and their common length must be at least 2.<a name="line.126"></a>
+<FONT color="green">127</FONT>         * &lt;/li&gt;<a name="line.127"></a>
+<FONT color="green">128</FONT>         * &lt;li&gt; &lt;code&gt; 0 &lt; alpha &lt; 0.5 &lt;/code&gt;<a name="line.128"></a>
+<FONT color="green">129</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;<a name="line.129"></a>
+<FONT color="green">130</FONT>         * If any of the preconditions are not met, an<a name="line.130"></a>
+<FONT color="green">131</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown.&lt;/p&gt;<a name="line.131"></a>
+<FONT color="green">132</FONT>         *<a name="line.132"></a>
+<FONT color="green">133</FONT>         * @param observed1 array of observed frequency counts of the first data set<a name="line.133"></a>
+<FONT color="green">134</FONT>         * @param observed2 array of observed frequency counts of the second data set<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @param alpha significance level of the test<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @return true iff null hypothesis can be rejected with confidence<a name="line.136"></a>
+<FONT color="green">137</FONT>         * 1 - alpha<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @throws IllegalArgumentException if preconditions are not met<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @throws MathException if an error occurs performing the test<a name="line.139"></a>
+<FONT color="green">140</FONT>         */<a name="line.140"></a>
+<FONT color="green">141</FONT>        boolean chiSquareTestDataSetsComparison(long[] observed1, long[] observed2, double alpha)<a name="line.141"></a>
+<FONT color="green">142</FONT>          throws IllegalArgumentException, MathException;<a name="line.142"></a>
+<FONT color="green">143</FONT>    <a name="line.143"></a>
+<FONT color="green">144</FONT>    }<a name="line.144"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/ranking/NaNStrategy.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,115 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.stat.ranking;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Strategies for handling NaN values in rank transformations.<a name="line.21"></a>
+<FONT color="green">022</FONT>     * &lt;ul&gt;<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;li&gt;MINIMAL - NaNs are treated as minimal in the ordering, equivalent to<a name="line.23"></a>
+<FONT color="green">024</FONT>     * (that is, tied with) &lt;code&gt;Double.NEGATIVE_INFINITY&lt;/code&gt;.&lt;/li&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;li&gt;MAXIMAL - NaNs are treated as maximal in the ordering, equivalent to<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;code&gt;Double.POSITIVE_INFINITY&lt;/code&gt;&lt;/li&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;li&gt;REMOVED - NaNs are removed before the rank transform is applied&lt;/li&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;li&gt;FIXED - NaNs are left "in place," that is the rank transformation is<a name="line.28"></a>
+<FONT color="green">029</FONT>     * applied to the other elements in the input array, but the NaN elements<a name="line.29"></a>
+<FONT color="green">030</FONT>     * are returned unchanged.&lt;/li&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;/ul&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     *<a name="line.32"></a>
+<FONT color="green">033</FONT>     * @since 2.0<a name="line.33"></a>
+<FONT color="green">034</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.34"></a>
+<FONT color="green">035</FONT>     */<a name="line.35"></a>
+<FONT color="green">036</FONT>    public enum NaNStrategy {<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** NaNs are considered minimal in the ordering */<a name="line.38"></a>
+<FONT color="green">039</FONT>        MINIMAL,<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** NaNs are considered maximal in the ordering */<a name="line.41"></a>
+<FONT color="green">042</FONT>        MAXIMAL,<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** NaNs are removed before computing ranks */<a name="line.44"></a>
+<FONT color="green">045</FONT>        REMOVED,<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** NaNs are left in place */<a name="line.47"></a>
+<FONT color="green">048</FONT>        FIXED<a name="line.48"></a>
+<FONT color="green">049</FONT>    }<a name="line.49"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/ranking/NaturalRanking.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,529 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.stat.ranking;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.ArrayList;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.Arrays;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.util.Iterator;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.util.List;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.random.RandomData;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.random.RandomDataImpl;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.random.RandomGenerator;<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>    /**<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt; Ranking based on the natural ordering on doubles.&lt;/p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;p&gt;NaNs are treated according to the configured {@link NaNStrategy} and ties<a name="line.33"></a>
+<FONT color="green">034</FONT>     * are handled using the selected {@link TiesStrategy}.<a name="line.34"></a>
+<FONT color="green">035</FONT>     * Configuration settings are supplied in optional constructor arguments.<a name="line.35"></a>
+<FONT color="green">036</FONT>     * Defaults are {@link NaNStrategy#MAXIMAL} and {@link TiesStrategy#AVERAGE},<a name="line.36"></a>
+<FONT color="green">037</FONT>     * respectively. When using {@link TiesStrategy#RANDOM}, a<a name="line.37"></a>
+<FONT color="green">038</FONT>     * {@link RandomGenerator} may be supplied as a constructor argument.&lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;p&gt;Examples:<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;table border="1" cellpadding="3"&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;tr&gt;&lt;th colspan="3"&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     * Input data: (20, 17, 30, 42.3, 17, 50, Double.NaN, Double.NEGATIVE_INFINITY, 17)<a name="line.42"></a>
+<FONT color="green">043</FONT>     * &lt;/th&gt;&lt;/tr&gt;<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;tr&gt;&lt;th&gt;NaNStrategy&lt;/th&gt;&lt;th&gt;TiesStrategy&lt;/th&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     * &lt;th&gt;&lt;code&gt;rank(data)&lt;/code&gt;&lt;/th&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     * &lt;tr&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     * &lt;td&gt;default (NaNs maximal)&lt;/td&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     * &lt;td&gt;default (ties averaged)&lt;/td&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>     * &lt;td&gt;(5, 3, 6, 7, 3, 8, 9, 1, 3)&lt;/td&gt;&lt;/tr&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     * &lt;tr&gt;<a name="line.50"></a>
+<FONT color="green">051</FONT>     * &lt;td&gt;default (NaNs maximal)&lt;/td&gt;<a name="line.51"></a>
+<FONT color="green">052</FONT>     * &lt;td&gt;MINIMUM&lt;/td&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>     * &lt;td&gt;(5, 2, 6, 7, 2, 8, 9, 1, 2)&lt;/td&gt;&lt;/tr&gt;<a name="line.53"></a>
+<FONT color="green">054</FONT>     * &lt;tr&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>     * &lt;td&gt;MINIMAL&lt;/td&gt;<a name="line.55"></a>
+<FONT color="green">056</FONT>     * &lt;td&gt;default (ties averaged)&lt;/td&gt;<a name="line.56"></a>
+<FONT color="green">057</FONT>     * &lt;td&gt;(6, 4, 7, 8, 4, 9, 1.5, 1.5, 4)&lt;/td&gt;&lt;/tr&gt;<a name="line.57"></a>
+<FONT color="green">058</FONT>     * &lt;tr&gt;<a name="line.58"></a>
+<FONT color="green">059</FONT>     * &lt;td&gt;REMOVED&lt;/td&gt;<a name="line.59"></a>
+<FONT color="green">060</FONT>     * &lt;td&gt;SEQUENTIAL&lt;/td&gt;<a name="line.60"></a>
+<FONT color="green">061</FONT>     * &lt;td&gt;(5, 2, 6, 7, 3, 8, 1, 4)&lt;/td&gt;&lt;/tr&gt;<a name="line.61"></a>
+<FONT color="green">062</FONT>     * &lt;tr&gt;<a name="line.62"></a>
+<FONT color="green">063</FONT>     * &lt;td&gt;MINIMAL&lt;/td&gt;<a name="line.63"></a>
+<FONT color="green">064</FONT>     * &lt;td&gt;MAXIMUM&lt;/td&gt;<a name="line.64"></a>
+<FONT color="green">065</FONT>     * &lt;td&gt;(6, 5, 7, 8, 5, 9, 2, 2, 5)&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/p&gt;<a name="line.65"></a>
+<FONT color="green">066</FONT>     *<a name="line.66"></a>
+<FONT color="green">067</FONT>     * @since 2.0<a name="line.67"></a>
+<FONT color="green">068</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.68"></a>
+<FONT color="green">069</FONT>     */<a name="line.69"></a>
+<FONT color="green">070</FONT>    public class NaturalRanking implements RankingAlgorithm {<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /** default NaN strategy */<a name="line.72"></a>
+<FONT color="green">073</FONT>        public static final NaNStrategy DEFAULT_NAN_STRATEGY = NaNStrategy.MAXIMAL;<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /** default ties strategy */<a name="line.75"></a>
+<FONT color="green">076</FONT>        public static final TiesStrategy DEFAULT_TIES_STRATEGY = TiesStrategy.AVERAGE;<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>        /** NaN strategy - defaults to NaNs maximal */<a name="line.78"></a>
+<FONT color="green">079</FONT>        private final NaNStrategy nanStrategy;<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /** Ties strategy - defaults to ties averaged */<a name="line.81"></a>
+<FONT color="green">082</FONT>        private final TiesStrategy tiesStrategy;<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>        /** Source of random data - used only when ties strategy is RANDOM */<a name="line.84"></a>
+<FONT color="green">085</FONT>        private final RandomData randomData;<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>        /**<a name="line.87"></a>
+<FONT color="green">088</FONT>         * Create a NaturalRanking with default strategies for handling ties and NaNs.<a name="line.88"></a>
+<FONT color="green">089</FONT>         */<a name="line.89"></a>
+<FONT color="green">090</FONT>        public NaturalRanking() {<a name="line.90"></a>
+<FONT color="green">091</FONT>            super();<a name="line.91"></a>
+<FONT color="green">092</FONT>            tiesStrategy = DEFAULT_TIES_STRATEGY;<a name="line.92"></a>
+<FONT color="green">093</FONT>            nanStrategy = DEFAULT_NAN_STRATEGY;<a name="line.93"></a>
+<FONT color="green">094</FONT>            randomData = null;<a name="line.94"></a>
+<FONT color="green">095</FONT>        }<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /**<a name="line.97"></a>
+<FONT color="green">098</FONT>         * Create a NaturalRanking with the given TiesStrategy.<a name="line.98"></a>
+<FONT color="green">099</FONT>         *<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @param tiesStrategy the TiesStrategy to use<a name="line.100"></a>
+<FONT color="green">101</FONT>         */<a name="line.101"></a>
+<FONT color="green">102</FONT>        public NaturalRanking(TiesStrategy tiesStrategy) {<a name="line.102"></a>
+<FONT color="green">103</FONT>            super();<a name="line.103"></a>
+<FONT color="green">104</FONT>            this.tiesStrategy = tiesStrategy;<a name="line.104"></a>
+<FONT color="green">105</FONT>            nanStrategy = DEFAULT_NAN_STRATEGY;<a name="line.105"></a>
+<FONT color="green">106</FONT>            randomData = new RandomDataImpl();<a name="line.106"></a>
+<FONT color="green">107</FONT>        }<a name="line.107"></a>
+<FONT color="green">108</FONT>    <a name="line.108"></a>
+<FONT color="green">109</FONT>        /**<a name="line.109"></a>
+<FONT color="green">110</FONT>         * Create a NaturalRanking with the given NaNStrategy.<a name="line.110"></a>
+<FONT color="green">111</FONT>         *<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @param nanStrategy the NaNStrategy to use<a name="line.112"></a>
+<FONT color="green">113</FONT>         */<a name="line.113"></a>
+<FONT color="green">114</FONT>        public NaturalRanking(NaNStrategy nanStrategy) {<a name="line.114"></a>
+<FONT color="green">115</FONT>            super();<a name="line.115"></a>
+<FONT color="green">116</FONT>            this.nanStrategy = nanStrategy;<a name="line.116"></a>
+<FONT color="green">117</FONT>            tiesStrategy = DEFAULT_TIES_STRATEGY;<a name="line.117"></a>
+<FONT color="green">118</FONT>            randomData = null;<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /**<a name="line.121"></a>
+<FONT color="green">122</FONT>         * Create a NaturalRanking with the given NaNStrategy and TiesStrategy.<a name="line.122"></a>
+<FONT color="green">123</FONT>         *<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @param nanStrategy NaNStrategy to use<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @param tiesStrategy TiesStrategy to use<a name="line.125"></a>
+<FONT color="green">126</FONT>         */<a name="line.126"></a>
+<FONT color="green">127</FONT>        public NaturalRanking(NaNStrategy nanStrategy, TiesStrategy tiesStrategy) {<a name="line.127"></a>
+<FONT color="green">128</FONT>            super();<a name="line.128"></a>
+<FONT color="green">129</FONT>            this.nanStrategy = nanStrategy;<a name="line.129"></a>
+<FONT color="green">130</FONT>            this.tiesStrategy = tiesStrategy;<a name="line.130"></a>
+<FONT color="green">131</FONT>            randomData = new RandomDataImpl();<a name="line.131"></a>
+<FONT color="green">132</FONT>        }<a name="line.132"></a>
+<FONT color="green">133</FONT>    <a name="line.133"></a>
+<FONT color="green">134</FONT>        /**<a name="line.134"></a>
+<FONT color="green">135</FONT>         * Create a NaturalRanking with TiesStrategy.RANDOM and the given<a name="line.135"></a>
+<FONT color="green">136</FONT>         * RandomGenerator as the source of random data.<a name="line.136"></a>
+<FONT color="green">137</FONT>         *<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @param randomGenerator source of random data<a name="line.138"></a>
+<FONT color="green">139</FONT>         */<a name="line.139"></a>
+<FONT color="green">140</FONT>        public NaturalRanking(RandomGenerator randomGenerator) {<a name="line.140"></a>
+<FONT color="green">141</FONT>            super();<a name="line.141"></a>
+<FONT color="green">142</FONT>            this.tiesStrategy = TiesStrategy.RANDOM;<a name="line.142"></a>
+<FONT color="green">143</FONT>            nanStrategy = DEFAULT_NAN_STRATEGY;<a name="line.143"></a>
+<FONT color="green">144</FONT>            randomData = new RandomDataImpl(randomGenerator);<a name="line.144"></a>
+<FONT color="green">145</FONT>        }<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>    <a name="line.147"></a>
+<FONT color="green">148</FONT>        /**<a name="line.148"></a>
+<FONT color="green">149</FONT>         * Create a NaturalRanking with the given NaNStrategy, TiesStrategy.RANDOM<a name="line.149"></a>
+<FONT color="green">150</FONT>         * and the given source of random data.<a name="line.150"></a>
+<FONT color="green">151</FONT>         *<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @param nanStrategy NaNStrategy to use<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @param randomGenerator source of random data<a name="line.153"></a>
+<FONT color="green">154</FONT>         */<a name="line.154"></a>
+<FONT color="green">155</FONT>        public NaturalRanking(NaNStrategy nanStrategy,<a name="line.155"></a>
+<FONT color="green">156</FONT>                RandomGenerator randomGenerator) {<a name="line.156"></a>
+<FONT color="green">157</FONT>            super();<a name="line.157"></a>
+<FONT color="green">158</FONT>            this.nanStrategy = nanStrategy;<a name="line.158"></a>
+<FONT color="green">159</FONT>            this.tiesStrategy = TiesStrategy.RANDOM;<a name="line.159"></a>
+<FONT color="green">160</FONT>            randomData = new RandomDataImpl(randomGenerator);<a name="line.160"></a>
+<FONT color="green">161</FONT>        }<a name="line.161"></a>
+<FONT color="green">162</FONT>    <a name="line.162"></a>
+<FONT color="green">163</FONT>        /**<a name="line.163"></a>
+<FONT color="green">164</FONT>         * Return the NaNStrategy<a name="line.164"></a>
+<FONT color="green">165</FONT>         *<a name="line.165"></a>
+<FONT color="green">166</FONT>         * @return returns the NaNStrategy<a name="line.166"></a>
+<FONT color="green">167</FONT>         */<a name="line.167"></a>
+<FONT color="green">168</FONT>        public NaNStrategy getNanStrategy() {<a name="line.168"></a>
+<FONT color="green">169</FONT>            return nanStrategy;<a name="line.169"></a>
+<FONT color="green">170</FONT>        }<a name="line.170"></a>
+<FONT color="green">171</FONT>    <a name="line.171"></a>
+<FONT color="green">172</FONT>        /**<a name="line.172"></a>
+<FONT color="green">173</FONT>         * Return the TiesStrategy<a name="line.173"></a>
+<FONT color="green">174</FONT>         *<a name="line.174"></a>
+<FONT color="green">175</FONT>         * @return the TiesStrategy<a name="line.175"></a>
+<FONT color="green">176</FONT>         */<a name="line.176"></a>
+<FONT color="green">177</FONT>        public TiesStrategy getTiesStrategy() {<a name="line.177"></a>
+<FONT color="green">178</FONT>            return tiesStrategy;<a name="line.178"></a>
+<FONT color="green">179</FONT>        }<a name="line.179"></a>
+<FONT color="green">180</FONT>    <a name="line.180"></a>
+<FONT color="green">181</FONT>        /**<a name="line.181"></a>
+<FONT color="green">182</FONT>         * Rank &lt;code&gt;data&lt;/code&gt; using the natural ordering on Doubles, with<a name="line.182"></a>
+<FONT color="green">183</FONT>         * NaN values handled according to &lt;code&gt;nanStrategy&lt;/code&gt; and ties<a name="line.183"></a>
+<FONT color="green">184</FONT>         * resolved using &lt;code&gt;tiesStrategy.&lt;/code&gt;<a name="line.184"></a>
+<FONT color="green">185</FONT>         *<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @param data array to be ranked<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @return array of ranks<a name="line.187"></a>
+<FONT color="green">188</FONT>         */<a name="line.188"></a>
+<FONT color="green">189</FONT>        public double[] rank(double[] data) {<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>            // Array recording initial positions of data to be ranked<a name="line.191"></a>
+<FONT color="green">192</FONT>            IntDoublePair[] ranks = new IntDoublePair[data.length];<a name="line.192"></a>
+<FONT color="green">193</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.193"></a>
+<FONT color="green">194</FONT>                ranks[i] = new IntDoublePair(data[i], i);<a name="line.194"></a>
+<FONT color="green">195</FONT>            }<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>            // Recode, remove or record positions of NaNs<a name="line.197"></a>
+<FONT color="green">198</FONT>            List&lt;Integer&gt; nanPositions = null;<a name="line.198"></a>
+<FONT color="green">199</FONT>            switch (nanStrategy) {<a name="line.199"></a>
+<FONT color="green">200</FONT>                case MAXIMAL: // Replace NaNs with +INFs<a name="line.200"></a>
+<FONT color="green">201</FONT>                    recodeNaNs(ranks, Double.POSITIVE_INFINITY);<a name="line.201"></a>
+<FONT color="green">202</FONT>                    break;<a name="line.202"></a>
+<FONT color="green">203</FONT>                case MINIMAL: // Replace NaNs with -INFs<a name="line.203"></a>
+<FONT color="green">204</FONT>                    recodeNaNs(ranks, Double.NEGATIVE_INFINITY);<a name="line.204"></a>
+<FONT color="green">205</FONT>                    break;<a name="line.205"></a>
+<FONT color="green">206</FONT>                case REMOVED: // Drop NaNs from data<a name="line.206"></a>
+<FONT color="green">207</FONT>                    ranks = removeNaNs(ranks);<a name="line.207"></a>
+<FONT color="green">208</FONT>                    break;<a name="line.208"></a>
+<FONT color="green">209</FONT>                case FIXED:   // Record positions of NaNs<a name="line.209"></a>
+<FONT color="green">210</FONT>                    nanPositions = getNanPositions(ranks);<a name="line.210"></a>
+<FONT color="green">211</FONT>                    break;<a name="line.211"></a>
+<FONT color="green">212</FONT>                default: // this should not happen unless NaNStrategy enum is changed<a name="line.212"></a>
+<FONT color="green">213</FONT>                    throw MathRuntimeException.createInternalError(null);<a name="line.213"></a>
+<FONT color="green">214</FONT>            }<a name="line.214"></a>
+<FONT color="green">215</FONT>    <a name="line.215"></a>
+<FONT color="green">216</FONT>            // Sort the IntDoublePairs<a name="line.216"></a>
+<FONT color="green">217</FONT>            Arrays.sort(ranks);<a name="line.217"></a>
+<FONT color="green">218</FONT>    <a name="line.218"></a>
+<FONT color="green">219</FONT>            // Walk the sorted array, filling output array using sorted positions,<a name="line.219"></a>
+<FONT color="green">220</FONT>            // resolving ties as we go<a name="line.220"></a>
+<FONT color="green">221</FONT>            double[] out = new double[ranks.length];<a name="line.221"></a>
+<FONT color="green">222</FONT>            int pos = 1;  // position in sorted array<a name="line.222"></a>
+<FONT color="green">223</FONT>            out[ranks[0].getPosition()] = pos;<a name="line.223"></a>
+<FONT color="green">224</FONT>            List&lt;Integer&gt; tiesTrace = new ArrayList&lt;Integer&gt;();<a name="line.224"></a>
+<FONT color="green">225</FONT>            tiesTrace.add(ranks[0].getPosition());<a name="line.225"></a>
+<FONT color="green">226</FONT>            for (int i = 1; i &lt; ranks.length; i++) {<a name="line.226"></a>
+<FONT color="green">227</FONT>                if (Double.compare(ranks[i].getValue(), ranks[i - 1].getValue()) &gt; 0) {<a name="line.227"></a>
+<FONT color="green">228</FONT>                    // tie sequence has ended (or had length 1)<a name="line.228"></a>
+<FONT color="green">229</FONT>                    pos = i + 1;<a name="line.229"></a>
+<FONT color="green">230</FONT>                    if (tiesTrace.size() &gt; 1) {  // if seq is nontrivial, resolve<a name="line.230"></a>
+<FONT color="green">231</FONT>                        resolveTie(out, tiesTrace);<a name="line.231"></a>
+<FONT color="green">232</FONT>                    }<a name="line.232"></a>
+<FONT color="green">233</FONT>                    tiesTrace = new ArrayList&lt;Integer&gt;();<a name="line.233"></a>
+<FONT color="green">234</FONT>                    tiesTrace.add(ranks[i].getPosition());<a name="line.234"></a>
+<FONT color="green">235</FONT>                } else {<a name="line.235"></a>
+<FONT color="green">236</FONT>                    // tie sequence continues<a name="line.236"></a>
+<FONT color="green">237</FONT>                    tiesTrace.add(ranks[i].getPosition());<a name="line.237"></a>
+<FONT color="green">238</FONT>                }<a name="line.238"></a>
+<FONT color="green">239</FONT>                out[ranks[i].getPosition()] = pos;<a name="line.239"></a>
+<FONT color="green">240</FONT>            }<a name="line.240"></a>
+<FONT color="green">241</FONT>            if (tiesTrace.size() &gt; 1) {  // handle tie sequence at end<a name="line.241"></a>
+<FONT color="green">242</FONT>                resolveTie(out, tiesTrace);<a name="line.242"></a>
+<FONT color="green">243</FONT>            }<a name="line.243"></a>
+<FONT color="green">244</FONT>            if (nanStrategy == NaNStrategy.FIXED) {<a name="line.244"></a>
+<FONT color="green">245</FONT>                restoreNaNs(out, nanPositions);<a name="line.245"></a>
+<FONT color="green">246</FONT>            }<a name="line.246"></a>
+<FONT color="green">247</FONT>            return out;<a name="line.247"></a>
+<FONT color="green">248</FONT>        }<a name="line.248"></a>
+<FONT color="green">249</FONT>    <a name="line.249"></a>
+<FONT color="green">250</FONT>        /**<a name="line.250"></a>
+<FONT color="green">251</FONT>         * Returns an array that is a copy of the input array with IntDoublePairs<a name="line.251"></a>
+<FONT color="green">252</FONT>         * having NaN values removed.<a name="line.252"></a>
+<FONT color="green">253</FONT>         *<a name="line.253"></a>
+<FONT color="green">254</FONT>         * @param ranks input array<a name="line.254"></a>
+<FONT color="green">255</FONT>         * @return array with NaN-valued entries removed<a name="line.255"></a>
+<FONT color="green">256</FONT>         */<a name="line.256"></a>
+<FONT color="green">257</FONT>        private IntDoublePair[] removeNaNs(IntDoublePair[] ranks) {<a name="line.257"></a>
+<FONT color="green">258</FONT>            if (!containsNaNs(ranks)) {<a name="line.258"></a>
+<FONT color="green">259</FONT>                return ranks;<a name="line.259"></a>
+<FONT color="green">260</FONT>            }<a name="line.260"></a>
+<FONT color="green">261</FONT>            IntDoublePair[] outRanks = new IntDoublePair[ranks.length];<a name="line.261"></a>
+<FONT color="green">262</FONT>            int j = 0;<a name="line.262"></a>
+<FONT color="green">263</FONT>            for (int i = 0; i &lt; ranks.length; i++) {<a name="line.263"></a>
+<FONT color="green">264</FONT>                if (Double.isNaN(ranks[i].getValue())) {<a name="line.264"></a>
+<FONT color="green">265</FONT>                    // drop, but adjust original ranks of later elements<a name="line.265"></a>
+<FONT color="green">266</FONT>                    for (int k = i + 1; k &lt; ranks.length; k++) {<a name="line.266"></a>
+<FONT color="green">267</FONT>                        ranks[k] = new IntDoublePair(<a name="line.267"></a>
+<FONT color="green">268</FONT>                                ranks[k].getValue(), ranks[k].getPosition() - 1);<a name="line.268"></a>
+<FONT color="green">269</FONT>                    }<a name="line.269"></a>
+<FONT color="green">270</FONT>                } else {<a name="line.270"></a>
+<FONT color="green">271</FONT>                    outRanks[j] = new IntDoublePair(<a name="line.271"></a>
+<FONT color="green">272</FONT>                            ranks[i].getValue(), ranks[i].getPosition());<a name="line.272"></a>
+<FONT color="green">273</FONT>                    j++;<a name="line.273"></a>
+<FONT color="green">274</FONT>                }<a name="line.274"></a>
+<FONT color="green">275</FONT>            }<a name="line.275"></a>
+<FONT color="green">276</FONT>            IntDoublePair[] returnRanks = new IntDoublePair[j];<a name="line.276"></a>
+<FONT color="green">277</FONT>            System.arraycopy(outRanks, 0, returnRanks, 0, j);<a name="line.277"></a>
+<FONT color="green">278</FONT>            return returnRanks;<a name="line.278"></a>
+<FONT color="green">279</FONT>        }<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>        /**<a name="line.281"></a>
+<FONT color="green">282</FONT>         * Recodes NaN values to the given value.<a name="line.282"></a>
+<FONT color="green">283</FONT>         *<a name="line.283"></a>
+<FONT color="green">284</FONT>         * @param ranks array to recode<a name="line.284"></a>
+<FONT color="green">285</FONT>         * @param value the value to replace NaNs with<a name="line.285"></a>
+<FONT color="green">286</FONT>         */<a name="line.286"></a>
+<FONT color="green">287</FONT>        private void recodeNaNs(IntDoublePair[] ranks, double value) {<a name="line.287"></a>
+<FONT color="green">288</FONT>            for (int i = 0; i &lt; ranks.length; i++) {<a name="line.288"></a>
+<FONT color="green">289</FONT>                if (Double.isNaN(ranks[i].getValue())) {<a name="line.289"></a>
+<FONT color="green">290</FONT>                    ranks[i] = new IntDoublePair(<a name="line.290"></a>
+<FONT color="green">291</FONT>                            value, ranks[i].getPosition());<a name="line.291"></a>
+<FONT color="green">292</FONT>                }<a name="line.292"></a>
+<FONT color="green">293</FONT>            }<a name="line.293"></a>
+<FONT color="green">294</FONT>        }<a name="line.294"></a>
+<FONT color="green">295</FONT>    <a name="line.295"></a>
+<FONT color="green">296</FONT>        /**<a name="line.296"></a>
+<FONT color="green">297</FONT>         * Checks for presence of NaNs in &lt;code&gt;ranks.&lt;/code&gt;<a name="line.297"></a>
+<FONT color="green">298</FONT>         *<a name="line.298"></a>
+<FONT color="green">299</FONT>         * @param ranks array to be searched for NaNs<a name="line.299"></a>
+<FONT color="green">300</FONT>         * @return true iff ranks contains one or more NaNs<a name="line.300"></a>
+<FONT color="green">301</FONT>         */<a name="line.301"></a>
+<FONT color="green">302</FONT>        private boolean containsNaNs(IntDoublePair[] ranks) {<a name="line.302"></a>
+<FONT color="green">303</FONT>            for (int i = 0; i &lt; ranks.length; i++) {<a name="line.303"></a>
+<FONT color="green">304</FONT>                if (Double.isNaN(ranks[i].getValue())) {<a name="line.304"></a>
+<FONT color="green">305</FONT>                    return true;<a name="line.305"></a>
+<FONT color="green">306</FONT>                }<a name="line.306"></a>
+<FONT color="green">307</FONT>            }<a name="line.307"></a>
+<FONT color="green">308</FONT>            return false;<a name="line.308"></a>
+<FONT color="green">309</FONT>        }<a name="line.309"></a>
+<FONT color="green">310</FONT>    <a name="line.310"></a>
+<FONT color="green">311</FONT>        /**<a name="line.311"></a>
+<FONT color="green">312</FONT>         * Resolve a sequence of ties, using the configured {@link TiesStrategy}.<a name="line.312"></a>
+<FONT color="green">313</FONT>         * The input &lt;code&gt;ranks&lt;/code&gt; array is expected to take the same value<a name="line.313"></a>
+<FONT color="green">314</FONT>         * for all indices in &lt;code&gt;tiesTrace&lt;/code&gt;.  The common value is recoded<a name="line.314"></a>
+<FONT color="green">315</FONT>         * according to the tiesStrategy. For example, if ranks = &lt;5,8,2,6,2,7,1,2&gt;,<a name="line.315"></a>
+<FONT color="green">316</FONT>         * tiesTrace = &lt;2,4,7&gt; and tiesStrategy is MINIMUM, ranks will be unchanged.<a name="line.316"></a>
+<FONT color="green">317</FONT>         * The same array and trace with tiesStrategy AVERAGE will come out<a name="line.317"></a>
+<FONT color="green">318</FONT>         * &lt;5,8,3,6,3,7,1,3&gt;.<a name="line.318"></a>
+<FONT color="green">319</FONT>         *<a name="line.319"></a>
+<FONT color="green">320</FONT>         * @param ranks array of ranks<a name="line.320"></a>
+<FONT color="green">321</FONT>         * @param tiesTrace list of indices where &lt;code&gt;ranks&lt;/code&gt; is constant<a name="line.321"></a>
+<FONT color="green">322</FONT>         * -- that is, for any i and j in TiesTrace, &lt;code&gt; ranks[i] == ranks[j]<a name="line.322"></a>
+<FONT color="green">323</FONT>         * &lt;/code&gt;<a name="line.323"></a>
+<FONT color="green">324</FONT>         */<a name="line.324"></a>
+<FONT color="green">325</FONT>        private void resolveTie(double[] ranks, List&lt;Integer&gt; tiesTrace) {<a name="line.325"></a>
+<FONT color="green">326</FONT>    <a name="line.326"></a>
+<FONT color="green">327</FONT>            // constant value of ranks over tiesTrace<a name="line.327"></a>
+<FONT color="green">328</FONT>            final double c = ranks[tiesTrace.get(0)];<a name="line.328"></a>
+<FONT color="green">329</FONT>    <a name="line.329"></a>
+<FONT color="green">330</FONT>            // length of sequence of tied ranks<a name="line.330"></a>
+<FONT color="green">331</FONT>            final int length = tiesTrace.size();<a name="line.331"></a>
+<FONT color="green">332</FONT>    <a name="line.332"></a>
+<FONT color="green">333</FONT>            switch (tiesStrategy) {<a name="line.333"></a>
+<FONT color="green">334</FONT>                case  AVERAGE:  // Replace ranks with average<a name="line.334"></a>
+<FONT color="green">335</FONT>                    fill(ranks, tiesTrace, (2 * c + length - 1) / 2d);<a name="line.335"></a>
+<FONT color="green">336</FONT>                    break;<a name="line.336"></a>
+<FONT color="green">337</FONT>                case MAXIMUM:   // Replace ranks with maximum values<a name="line.337"></a>
+<FONT color="green">338</FONT>                    fill(ranks, tiesTrace, c + length - 1);<a name="line.338"></a>
+<FONT color="green">339</FONT>                    break;<a name="line.339"></a>
+<FONT color="green">340</FONT>                case MINIMUM:   // Replace ties with minimum<a name="line.340"></a>
+<FONT color="green">341</FONT>                    fill(ranks, tiesTrace, c);<a name="line.341"></a>
+<FONT color="green">342</FONT>                    break;<a name="line.342"></a>
+<FONT color="green">343</FONT>                case RANDOM:    // Fill with random integral values in [c, c + length - 1]<a name="line.343"></a>
+<FONT color="green">344</FONT>                    Iterator&lt;Integer&gt; iterator = tiesTrace.iterator();<a name="line.344"></a>
+<FONT color="green">345</FONT>                    long f = Math.round(c);<a name="line.345"></a>
+<FONT color="green">346</FONT>                    while (iterator.hasNext()) {<a name="line.346"></a>
+<FONT color="green">347</FONT>                        ranks[iterator.next()] =<a name="line.347"></a>
+<FONT color="green">348</FONT>                            randomData.nextLong(f, f + length - 1);<a name="line.348"></a>
+<FONT color="green">349</FONT>                    }<a name="line.349"></a>
+<FONT color="green">350</FONT>                    break;<a name="line.350"></a>
+<FONT color="green">351</FONT>                case SEQUENTIAL:  // Fill sequentially from c to c + length - 1<a name="line.351"></a>
+<FONT color="green">352</FONT>                    // walk and fill<a name="line.352"></a>
+<FONT color="green">353</FONT>                    iterator = tiesTrace.iterator();<a name="line.353"></a>
+<FONT color="green">354</FONT>                    f = Math.round(c);<a name="line.354"></a>
+<FONT color="green">355</FONT>                    int i = 0;<a name="line.355"></a>
+<FONT color="green">356</FONT>                    while (iterator.hasNext()) {<a name="line.356"></a>
+<FONT color="green">357</FONT>                        ranks[iterator.next()] = f + i++;<a name="line.357"></a>
+<FONT color="green">358</FONT>                    }<a name="line.358"></a>
+<FONT color="green">359</FONT>                    break;<a name="line.359"></a>
+<FONT color="green">360</FONT>                default: // this should not happen unless TiesStrategy enum is changed<a name="line.360"></a>
+<FONT color="green">361</FONT>                    throw MathRuntimeException.createInternalError(null);<a name="line.361"></a>
+<FONT color="green">362</FONT>            }<a name="line.362"></a>
+<FONT color="green">363</FONT>        }<a name="line.363"></a>
+<FONT color="green">364</FONT>    <a name="line.364"></a>
+<FONT color="green">365</FONT>        /**<a name="line.365"></a>
+<FONT color="green">366</FONT>         * Sets&lt;code&gt;data[i] = value&lt;/code&gt; for each i in &lt;code&gt;tiesTrace.&lt;/code&gt;<a name="line.366"></a>
+<FONT color="green">367</FONT>         *<a name="line.367"></a>
+<FONT color="green">368</FONT>         * @param data array to modify<a name="line.368"></a>
+<FONT color="green">369</FONT>         * @param tiesTrace list of index values to set<a name="line.369"></a>
+<FONT color="green">370</FONT>         * @param value value to set<a name="line.370"></a>
+<FONT color="green">371</FONT>         */<a name="line.371"></a>
+<FONT color="green">372</FONT>        private void fill(double[] data, List&lt;Integer&gt; tiesTrace, double value) {<a name="line.372"></a>
+<FONT color="green">373</FONT>            Iterator&lt;Integer&gt; iterator = tiesTrace.iterator();<a name="line.373"></a>
+<FONT color="green">374</FONT>            while (iterator.hasNext()) {<a name="line.374"></a>
+<FONT color="green">375</FONT>                data[iterator.next()] = value;<a name="line.375"></a>
+<FONT color="green">376</FONT>            }<a name="line.376"></a>
+<FONT color="green">377</FONT>        }<a name="line.377"></a>
+<FONT color="green">378</FONT>    <a name="line.378"></a>
+<FONT color="green">379</FONT>        /**<a name="line.379"></a>
+<FONT color="green">380</FONT>         * Set &lt;code&gt;ranks[i] = Double.NaN&lt;/code&gt; for each i in &lt;code&gt;nanPositions.&lt;/code&gt;<a name="line.380"></a>
+<FONT color="green">381</FONT>         *<a name="line.381"></a>
+<FONT color="green">382</FONT>         * @param ranks array to modify<a name="line.382"></a>
+<FONT color="green">383</FONT>         * @param nanPositions list of index values to set to &lt;code&gt;Double.NaN&lt;/code&gt;<a name="line.383"></a>
+<FONT color="green">384</FONT>         */<a name="line.384"></a>
+<FONT color="green">385</FONT>        private void restoreNaNs(double[] ranks, List&lt;Integer&gt; nanPositions) {<a name="line.385"></a>
+<FONT color="green">386</FONT>            if (nanPositions.size() == 0) {<a name="line.386"></a>
+<FONT color="green">387</FONT>                return;<a name="line.387"></a>
+<FONT color="green">388</FONT>            }<a name="line.388"></a>
+<FONT color="green">389</FONT>            Iterator&lt;Integer&gt; iterator = nanPositions.iterator();<a name="line.389"></a>
+<FONT color="green">390</FONT>            while (iterator.hasNext()) {<a name="line.390"></a>
+<FONT color="green">391</FONT>                ranks[iterator.next().intValue()] = Double.NaN;<a name="line.391"></a>
+<FONT color="green">392</FONT>            }<a name="line.392"></a>
+<FONT color="green">393</FONT>    <a name="line.393"></a>
+<FONT color="green">394</FONT>        }<a name="line.394"></a>
+<FONT color="green">395</FONT>    <a name="line.395"></a>
+<FONT color="green">396</FONT>        /**<a name="line.396"></a>
+<FONT color="green">397</FONT>         * Returns a list of indexes where &lt;code&gt;ranks&lt;/code&gt; is &lt;code&gt;NaN.&lt;/code&gt;<a name="line.397"></a>
+<FONT color="green">398</FONT>         *<a name="line.398"></a>
+<FONT color="green">399</FONT>         * @param ranks array to search for &lt;code&gt;NaNs&lt;/code&gt;<a name="line.399"></a>
+<FONT color="green">400</FONT>         * @return list of indexes i such that &lt;code&gt;ranks[i] = NaN&lt;/code&gt;<a name="line.400"></a>
+<FONT color="green">401</FONT>         */<a name="line.401"></a>
+<FONT color="green">402</FONT>        private List&lt;Integer&gt; getNanPositions(IntDoublePair[] ranks) {<a name="line.402"></a>
+<FONT color="green">403</FONT>            ArrayList&lt;Integer&gt; out = new ArrayList&lt;Integer&gt;();<a name="line.403"></a>
+<FONT color="green">404</FONT>            for (int i = 0; i &lt; ranks.length; i++) {<a name="line.404"></a>
+<FONT color="green">405</FONT>                if (Double.isNaN(ranks[i].getValue())) {<a name="line.405"></a>
+<FONT color="green">406</FONT>                    out.add(Integer.valueOf(i));<a name="line.406"></a>
+<FONT color="green">407</FONT>                }<a name="line.407"></a>
+<FONT color="green">408</FONT>            }<a name="line.408"></a>
+<FONT color="green">409</FONT>            return out;<a name="line.409"></a>
+<FONT color="green">410</FONT>        }<a name="line.410"></a>
+<FONT color="green">411</FONT>    <a name="line.411"></a>
+<FONT color="green">412</FONT>        /**<a name="line.412"></a>
+<FONT color="green">413</FONT>         * Represents the position of a double value in an ordering.<a name="line.413"></a>
+<FONT color="green">414</FONT>         * Comparable interface is implemented so Arrays.sort can be used<a name="line.414"></a>
+<FONT color="green">415</FONT>         * to sort an array of IntDoublePairs by value.  Note that the<a name="line.415"></a>
+<FONT color="green">416</FONT>         * implicitly defined natural ordering is NOT consistent with equals.<a name="line.416"></a>
+<FONT color="green">417</FONT>         */<a name="line.417"></a>
+<FONT color="green">418</FONT>        private static class IntDoublePair implements Comparable&lt;IntDoublePair&gt;  {<a name="line.418"></a>
+<FONT color="green">419</FONT>    <a name="line.419"></a>
+<FONT color="green">420</FONT>            /** Value of the pair */<a name="line.420"></a>
+<FONT color="green">421</FONT>            private final double value;<a name="line.421"></a>
+<FONT color="green">422</FONT>    <a name="line.422"></a>
+<FONT color="green">423</FONT>            /** Original position of the pair */<a name="line.423"></a>
+<FONT color="green">424</FONT>            private final int position;<a name="line.424"></a>
+<FONT color="green">425</FONT>    <a name="line.425"></a>
+<FONT color="green">426</FONT>            /**<a name="line.426"></a>
+<FONT color="green">427</FONT>             * Construct an IntDoublePair with the given value and position.<a name="line.427"></a>
+<FONT color="green">428</FONT>             * @param value the value of the pair<a name="line.428"></a>
+<FONT color="green">429</FONT>             * @param position the original position<a name="line.429"></a>
+<FONT color="green">430</FONT>             */<a name="line.430"></a>
+<FONT color="green">431</FONT>            public IntDoublePair(double value, int position) {<a name="line.431"></a>
+<FONT color="green">432</FONT>                this.value = value;<a name="line.432"></a>
+<FONT color="green">433</FONT>                this.position = position;<a name="line.433"></a>
+<FONT color="green">434</FONT>            }<a name="line.434"></a>
+<FONT color="green">435</FONT>    <a name="line.435"></a>
+<FONT color="green">436</FONT>            /**<a name="line.436"></a>
+<FONT color="green">437</FONT>             * Compare this IntDoublePair to another pair.<a name="line.437"></a>
+<FONT color="green">438</FONT>             * Only the &lt;strong&gt;values&lt;/strong&gt; are compared.<a name="line.438"></a>
+<FONT color="green">439</FONT>             *<a name="line.439"></a>
+<FONT color="green">440</FONT>             * @param other the other pair to compare this to<a name="line.440"></a>
+<FONT color="green">441</FONT>             * @return result of &lt;code&gt;Double.compare(value, other.value)&lt;/code&gt;<a name="line.441"></a>
+<FONT color="green">442</FONT>             */<a name="line.442"></a>
+<FONT color="green">443</FONT>            public int compareTo(IntDoublePair other) {<a name="line.443"></a>
+<FONT color="green">444</FONT>                return Double.compare(value, other.value);<a name="line.444"></a>
+<FONT color="green">445</FONT>            }<a name="line.445"></a>
+<FONT color="green">446</FONT>    <a name="line.446"></a>
+<FONT color="green">447</FONT>            /**<a name="line.447"></a>
+<FONT color="green">448</FONT>             * Returns the value of the pair.<a name="line.448"></a>
+<FONT color="green">449</FONT>             * @return value<a name="line.449"></a>
+<FONT color="green">450</FONT>             */<a name="line.450"></a>
+<FONT color="green">451</FONT>            public double getValue() {<a name="line.451"></a>
+<FONT color="green">452</FONT>                return value;<a name="line.452"></a>
+<FONT color="green">453</FONT>            }<a name="line.453"></a>
+<FONT color="green">454</FONT>    <a name="line.454"></a>
+<FONT color="green">455</FONT>            /**<a name="line.455"></a>
+<FONT color="green">456</FONT>             * Returns the original position of the pair.<a name="line.456"></a>
+<FONT color="green">457</FONT>             * @return position<a name="line.457"></a>
+<FONT color="green">458</FONT>             */<a name="line.458"></a>
+<FONT color="green">459</FONT>            public int getPosition() {<a name="line.459"></a>
+<FONT color="green">460</FONT>                return position;<a name="line.460"></a>
+<FONT color="green">461</FONT>            }<a name="line.461"></a>
+<FONT color="green">462</FONT>        }<a name="line.462"></a>
+<FONT color="green">463</FONT>    }<a name="line.463"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/ranking/RankingAlgorithm.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,107 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.stat.ranking;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Interface representing a rank transformation.<a name="line.21"></a>
+<FONT color="green">022</FONT>     *<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @since 2.0<a name="line.23"></a>
+<FONT color="green">024</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.24"></a>
+<FONT color="green">025</FONT>     */<a name="line.25"></a>
+<FONT color="green">026</FONT>    public interface RankingAlgorithm {<a name="line.26"></a>
+<FONT color="green">027</FONT>        /**<a name="line.27"></a>
+<FONT color="green">028</FONT>         * &lt;p&gt;Performs a rank transformation on the input data, returning an array<a name="line.28"></a>
+<FONT color="green">029</FONT>         * of ranks.&lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>         *<a name="line.30"></a>
+<FONT color="green">031</FONT>         * &lt;p&gt;Ranks should be 1-based - that is, the smallest value<a name="line.31"></a>
+<FONT color="green">032</FONT>         * returned in an array of ranks should be greater than or equal to one,<a name="line.32"></a>
+<FONT color="green">033</FONT>         * rather than 0. Ranks should in general take integer values, though<a name="line.33"></a>
+<FONT color="green">034</FONT>         * implementations may return averages or other floating point values<a name="line.34"></a>
+<FONT color="green">035</FONT>         * to resolve ties in the input data.&lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>         *<a name="line.36"></a>
+<FONT color="green">037</FONT>         * @param data array of data to be ranked<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @return an array of ranks corresponding to the elements of the input array<a name="line.38"></a>
+<FONT color="green">039</FONT>         */<a name="line.39"></a>
+<FONT color="green">040</FONT>        double[] rank (double[] data);<a name="line.40"></a>
+<FONT color="green">041</FONT>    }<a name="line.41"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/ranking/TiesStrategy.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,121 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.stat.ranking;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Strategies for handling tied values in rank transformations.<a name="line.21"></a>
+<FONT color="green">022</FONT>     * &lt;ul&gt;<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;li&gt;SEQUENTIAL - Ties are assigned ranks in order of occurrence in the original array,<a name="line.23"></a>
+<FONT color="green">024</FONT>     * for example (1,3,4,3) is ranked as (1,2,4,3)&lt;/li&gt;<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;li&gt;MINIMUM - Tied values are assigned the minimum applicable rank, or the rank<a name="line.25"></a>
+<FONT color="green">026</FONT>     * of the first occurrence. For example, (1,3,4,3) is ranked as (1,2,4,2)&lt;/li&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;li&gt;MAXIMUM - Tied values are assigned the maximum applicable rank, or the rank<a name="line.27"></a>
+<FONT color="green">028</FONT>     * of the last occurrence. For example, (1,3,4,3) is ranked as (1,3,4,3)&lt;/li&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;li&gt;AVERAGE - Tied values are assigned the average of the applicable ranks.<a name="line.29"></a>
+<FONT color="green">030</FONT>     * For example, (1,3,4,3) is ranked as (1,2.5,4,2.5)&lt;/li&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;li&gt;AVERAGE - Tied values are assigned a random integer rank from among the<a name="line.31"></a>
+<FONT color="green">032</FONT>     * applicable values. The assigned rank will always be an integer, (inclusively)<a name="line.32"></a>
+<FONT color="green">033</FONT>     * between the values retured by the MINIMUM and MAXIMUM strategies.&lt;/li&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;/ul&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     *<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @since 2.0<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.37"></a>
+<FONT color="green">038</FONT>     */<a name="line.38"></a>
+<FONT color="green">039</FONT>    public enum TiesStrategy {<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Ties assigned sequential ranks in order of occurrence */<a name="line.41"></a>
+<FONT color="green">042</FONT>        SEQUENTIAL,<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Ties get the minimum applicable rank */<a name="line.44"></a>
+<FONT color="green">045</FONT>        MINIMUM,<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** Ties get the maximum applicable rank */<a name="line.47"></a>
+<FONT color="green">048</FONT>        MAXIMUM,<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Ties get the average of applicable ranks */<a name="line.50"></a>
+<FONT color="green">051</FONT>        AVERAGE,<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** Ties get a random integral value from among applicable ranks */<a name="line.53"></a>
+<FONT color="green">054</FONT>        RANDOM<a name="line.54"></a>
+<FONT color="green">055</FONT>    }<a name="line.55"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/regression/AbstractMultipleLinearRegression.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,269 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.regression;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.linear.RealMatrix;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.linear.Array2DRowRealMatrix;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.linear.RealVector;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.linear.ArrayRealVector;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Abstract base class for implementations of MultipleLinearRegression.<a name="line.26"></a>
+<FONT color="green">027</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @since 2.0<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public abstract class AbstractMultipleLinearRegression implements<a name="line.30"></a>
+<FONT color="green">031</FONT>            MultipleLinearRegression {<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>        /** X sample data. */<a name="line.33"></a>
+<FONT color="green">034</FONT>        protected RealMatrix X;<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Y sample data. */<a name="line.36"></a>
+<FONT color="green">037</FONT>        protected RealVector Y;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /**<a name="line.39"></a>
+<FONT color="green">040</FONT>         * Loads model x and y sample data from a flat array of data, overriding any previous sample.<a name="line.40"></a>
+<FONT color="green">041</FONT>         * Assumes that rows are concatenated with y values first in each row.<a name="line.41"></a>
+<FONT color="green">042</FONT>         *<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @param data input data array<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @param nobs number of observations (rows)<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @param nvars number of independent variables (columns, not counting y)<a name="line.45"></a>
+<FONT color="green">046</FONT>         */<a name="line.46"></a>
+<FONT color="green">047</FONT>        public void newSampleData(double[] data, int nobs, int nvars) {<a name="line.47"></a>
+<FONT color="green">048</FONT>            double[] y = new double[nobs];<a name="line.48"></a>
+<FONT color="green">049</FONT>            double[][] x = new double[nobs][nvars + 1];<a name="line.49"></a>
+<FONT color="green">050</FONT>            int pointer = 0;<a name="line.50"></a>
+<FONT color="green">051</FONT>            for (int i = 0; i &lt; nobs; i++) {<a name="line.51"></a>
+<FONT color="green">052</FONT>                y[i] = data[pointer++];<a name="line.52"></a>
+<FONT color="green">053</FONT>                x[i][0] = 1.0d;<a name="line.53"></a>
+<FONT color="green">054</FONT>                for (int j = 1; j &lt; nvars + 1; j++) {<a name="line.54"></a>
+<FONT color="green">055</FONT>                    x[i][j] = data[pointer++];<a name="line.55"></a>
+<FONT color="green">056</FONT>                }<a name="line.56"></a>
+<FONT color="green">057</FONT>            }<a name="line.57"></a>
+<FONT color="green">058</FONT>            this.X = new Array2DRowRealMatrix(x);<a name="line.58"></a>
+<FONT color="green">059</FONT>            this.Y = new ArrayRealVector(y);<a name="line.59"></a>
+<FONT color="green">060</FONT>        }<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /**<a name="line.62"></a>
+<FONT color="green">063</FONT>         * Loads new y sample data, overriding any previous sample<a name="line.63"></a>
+<FONT color="green">064</FONT>         *<a name="line.64"></a>
+<FONT color="green">065</FONT>         * @param y the [n,1] array representing the y sample<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        protected void newYSampleData(double[] y) {<a name="line.67"></a>
+<FONT color="green">068</FONT>            this.Y = new ArrayRealVector(y);<a name="line.68"></a>
+<FONT color="green">069</FONT>        }<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /**<a name="line.71"></a>
+<FONT color="green">072</FONT>         * Loads new x sample data, overriding any previous sample<a name="line.72"></a>
+<FONT color="green">073</FONT>         *<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @param x the [n,k] array representing the x sample<a name="line.74"></a>
+<FONT color="green">075</FONT>         */<a name="line.75"></a>
+<FONT color="green">076</FONT>        protected void newXSampleData(double[][] x) {<a name="line.76"></a>
+<FONT color="green">077</FONT>            this.X = new Array2DRowRealMatrix(x);<a name="line.77"></a>
+<FONT color="green">078</FONT>        }<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /**<a name="line.80"></a>
+<FONT color="green">081</FONT>         * Validates sample data.<a name="line.81"></a>
+<FONT color="green">082</FONT>         *<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param x the [n,k] array representing the x sample<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @param y the [n,1] array representing the y sample<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @throws IllegalArgumentException if the x and y array data are not<a name="line.85"></a>
+<FONT color="green">086</FONT>         *             compatible for the regression<a name="line.86"></a>
+<FONT color="green">087</FONT>         */<a name="line.87"></a>
+<FONT color="green">088</FONT>        protected void validateSampleData(double[][] x, double[] y) {<a name="line.88"></a>
+<FONT color="green">089</FONT>            if ((x == null) || (y == null) || (x.length != y.length)) {<a name="line.89"></a>
+<FONT color="green">090</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.90"></a>
+<FONT color="green">091</FONT>                      "dimension mismatch {0} != {1}",<a name="line.91"></a>
+<FONT color="green">092</FONT>                      (x == null) ? 0 : x.length,<a name="line.92"></a>
+<FONT color="green">093</FONT>                      (y == null) ? 0 : y.length);<a name="line.93"></a>
+<FONT color="green">094</FONT>            } else if ((x.length &gt; 0) &amp;&amp; (x[0].length &gt; x.length)) {<a name="line.94"></a>
+<FONT color="green">095</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.95"></a>
+<FONT color="green">096</FONT>                      "not enough data ({0} rows) for this many predictors ({1} predictors)",<a name="line.96"></a>
+<FONT color="green">097</FONT>                      x.length, x[0].length);<a name="line.97"></a>
+<FONT color="green">098</FONT>            }<a name="line.98"></a>
+<FONT color="green">099</FONT>        }<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /**<a name="line.101"></a>
+<FONT color="green">102</FONT>         * Validates sample data.<a name="line.102"></a>
+<FONT color="green">103</FONT>         *<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @param x the [n,k] array representing the x sample<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @param covariance the [n,n] array representing the covariance matrix<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @throws IllegalArgumentException if the x sample data or covariance<a name="line.106"></a>
+<FONT color="green">107</FONT>         *             matrix are not compatible for the regression<a name="line.107"></a>
+<FONT color="green">108</FONT>         */<a name="line.108"></a>
+<FONT color="green">109</FONT>        protected void validateCovarianceData(double[][] x, double[][] covariance) {<a name="line.109"></a>
+<FONT color="green">110</FONT>            if (x.length != covariance.length) {<a name="line.110"></a>
+<FONT color="green">111</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.111"></a>
+<FONT color="green">112</FONT>                     "dimension mismatch {0} != {1}", x.length, covariance.length);<a name="line.112"></a>
+<FONT color="green">113</FONT>            }<a name="line.113"></a>
+<FONT color="green">114</FONT>            if (covariance.length &gt; 0 &amp;&amp; covariance.length != covariance[0].length) {<a name="line.114"></a>
+<FONT color="green">115</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.115"></a>
+<FONT color="green">116</FONT>                      "a {0}x{1} matrix was provided instead of a square matrix",<a name="line.116"></a>
+<FONT color="green">117</FONT>                      covariance.length, covariance[0].length);<a name="line.117"></a>
+<FONT color="green">118</FONT>            }<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /**<a name="line.121"></a>
+<FONT color="green">122</FONT>         * {@inheritDoc}<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        public double[] estimateRegressionParameters() {<a name="line.124"></a>
+<FONT color="green">125</FONT>            RealVector b = calculateBeta();<a name="line.125"></a>
+<FONT color="green">126</FONT>            return b.getData();<a name="line.126"></a>
+<FONT color="green">127</FONT>        }<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>        /**<a name="line.129"></a>
+<FONT color="green">130</FONT>         * {@inheritDoc}<a name="line.130"></a>
+<FONT color="green">131</FONT>         */<a name="line.131"></a>
+<FONT color="green">132</FONT>        public double[] estimateResiduals() {<a name="line.132"></a>
+<FONT color="green">133</FONT>            RealVector b = calculateBeta();<a name="line.133"></a>
+<FONT color="green">134</FONT>            RealVector e = Y.subtract(X.operate(b));<a name="line.134"></a>
+<FONT color="green">135</FONT>            return e.getData();<a name="line.135"></a>
+<FONT color="green">136</FONT>        }<a name="line.136"></a>
+<FONT color="green">137</FONT>    <a name="line.137"></a>
+<FONT color="green">138</FONT>        /**<a name="line.138"></a>
+<FONT color="green">139</FONT>         * {@inheritDoc}<a name="line.139"></a>
+<FONT color="green">140</FONT>         */<a name="line.140"></a>
+<FONT color="green">141</FONT>        public double[][] estimateRegressionParametersVariance() {<a name="line.141"></a>
+<FONT color="green">142</FONT>            return calculateBetaVariance().getData();<a name="line.142"></a>
+<FONT color="green">143</FONT>        }<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>        /**<a name="line.145"></a>
+<FONT color="green">146</FONT>         * {@inheritDoc}<a name="line.146"></a>
+<FONT color="green">147</FONT>         */<a name="line.147"></a>
+<FONT color="green">148</FONT>        public double[] estimateRegressionParametersStandardErrors() {<a name="line.148"></a>
+<FONT color="green">149</FONT>            double[][] betaVariance = estimateRegressionParametersVariance();<a name="line.149"></a>
+<FONT color="green">150</FONT>            double sigma = calculateYVariance();<a name="line.150"></a>
+<FONT color="green">151</FONT>            int length = betaVariance[0].length;<a name="line.151"></a>
+<FONT color="green">152</FONT>            double[] result = new double[length];<a name="line.152"></a>
+<FONT color="green">153</FONT>            for (int i = 0; i &lt; length; i++) {<a name="line.153"></a>
+<FONT color="green">154</FONT>                result[i] = Math.sqrt(sigma * betaVariance[i][i]);<a name="line.154"></a>
+<FONT color="green">155</FONT>            }<a name="line.155"></a>
+<FONT color="green">156</FONT>            return result;<a name="line.156"></a>
+<FONT color="green">157</FONT>        }<a name="line.157"></a>
+<FONT color="green">158</FONT>    <a name="line.158"></a>
+<FONT color="green">159</FONT>        /**<a name="line.159"></a>
+<FONT color="green">160</FONT>         * {@inheritDoc}<a name="line.160"></a>
+<FONT color="green">161</FONT>         */<a name="line.161"></a>
+<FONT color="green">162</FONT>        public double estimateRegressandVariance() {<a name="line.162"></a>
+<FONT color="green">163</FONT>            return calculateYVariance();<a name="line.163"></a>
+<FONT color="green">164</FONT>        }<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>        /**<a name="line.166"></a>
+<FONT color="green">167</FONT>         * Calculates the beta of multiple linear regression in matrix notation.<a name="line.167"></a>
+<FONT color="green">168</FONT>         *<a name="line.168"></a>
+<FONT color="green">169</FONT>         * @return beta<a name="line.169"></a>
+<FONT color="green">170</FONT>         */<a name="line.170"></a>
+<FONT color="green">171</FONT>        protected abstract RealVector calculateBeta();<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>        /**<a name="line.173"></a>
+<FONT color="green">174</FONT>         * Calculates the beta variance of multiple linear regression in matrix<a name="line.174"></a>
+<FONT color="green">175</FONT>         * notation.<a name="line.175"></a>
+<FONT color="green">176</FONT>         *<a name="line.176"></a>
+<FONT color="green">177</FONT>         * @return beta variance<a name="line.177"></a>
+<FONT color="green">178</FONT>         */<a name="line.178"></a>
+<FONT color="green">179</FONT>        protected abstract RealMatrix calculateBetaVariance();<a name="line.179"></a>
+<FONT color="green">180</FONT>    <a name="line.180"></a>
+<FONT color="green">181</FONT>        /**<a name="line.181"></a>
+<FONT color="green">182</FONT>         * Calculates the Y variance of multiple linear regression.<a name="line.182"></a>
+<FONT color="green">183</FONT>         *<a name="line.183"></a>
+<FONT color="green">184</FONT>         * @return Y variance<a name="line.184"></a>
+<FONT color="green">185</FONT>         */<a name="line.185"></a>
+<FONT color="green">186</FONT>        protected abstract double calculateYVariance();<a name="line.186"></a>
+<FONT color="green">187</FONT>    <a name="line.187"></a>
+<FONT color="green">188</FONT>        /**<a name="line.188"></a>
+<FONT color="green">189</FONT>         * Calculates the residuals of multiple linear regression in matrix<a name="line.189"></a>
+<FONT color="green">190</FONT>         * notation.<a name="line.190"></a>
+<FONT color="green">191</FONT>         *<a name="line.191"></a>
+<FONT color="green">192</FONT>         * &lt;pre&gt;<a name="line.192"></a>
+<FONT color="green">193</FONT>         * u = y - X * b<a name="line.193"></a>
+<FONT color="green">194</FONT>         * &lt;/pre&gt;<a name="line.194"></a>
+<FONT color="green">195</FONT>         *<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @return The residuals [n,1] matrix<a name="line.196"></a>
+<FONT color="green">197</FONT>         */<a name="line.197"></a>
+<FONT color="green">198</FONT>        protected RealVector calculateResiduals() {<a name="line.198"></a>
+<FONT color="green">199</FONT>            RealVector b = calculateBeta();<a name="line.199"></a>
+<FONT color="green">200</FONT>            return Y.subtract(X.operate(b));<a name="line.200"></a>
+<FONT color="green">201</FONT>        }<a name="line.201"></a>
+<FONT color="green">202</FONT>    <a name="line.202"></a>
+<FONT color="green">203</FONT>    }<a name="line.203"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/regression/GLSMultipleLinearRegression.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,197 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.regression;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.linear.LUDecompositionImpl;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.linear.RealMatrix;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.linear.Array2DRowRealMatrix;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.linear.RealVector;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * The GLS implementation of the multiple linear regression.<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * GLS assumes a general covariance matrix Omega of the error<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;pre&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * u ~ N(0, Omega)<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;/pre&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     *<a name="line.32"></a>
+<FONT color="green">033</FONT>     * Estimated by GLS,<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;pre&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * b=(X' Omega^-1 X)^-1X'Omega^-1 y<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;/pre&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * whose variance is<a name="line.37"></a>
+<FONT color="green">038</FONT>     * &lt;pre&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * Var(b)=(X' Omega^-1 X)^-1<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;/pre&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.41"></a>
+<FONT color="green">042</FONT>     * @since 2.0<a name="line.42"></a>
+<FONT color="green">043</FONT>     */<a name="line.43"></a>
+<FONT color="green">044</FONT>    public class GLSMultipleLinearRegression extends AbstractMultipleLinearRegression {<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** Covariance matrix. */<a name="line.46"></a>
+<FONT color="green">047</FONT>        private RealMatrix Omega;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** Inverse of covariance matrix. */<a name="line.49"></a>
+<FONT color="green">050</FONT>        private RealMatrix OmegaInverse;<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /** Replace sample data, overriding any previous sample.<a name="line.52"></a>
+<FONT color="green">053</FONT>         * @param y y values of the sample<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @param x x values of the sample<a name="line.54"></a>
+<FONT color="green">055</FONT>         * @param covariance array representing the covariance matrix<a name="line.55"></a>
+<FONT color="green">056</FONT>         */<a name="line.56"></a>
+<FONT color="green">057</FONT>        public void newSampleData(double[] y, double[][] x, double[][] covariance) {<a name="line.57"></a>
+<FONT color="green">058</FONT>            validateSampleData(x, y);<a name="line.58"></a>
+<FONT color="green">059</FONT>            newYSampleData(y);<a name="line.59"></a>
+<FONT color="green">060</FONT>            newXSampleData(x);<a name="line.60"></a>
+<FONT color="green">061</FONT>            validateCovarianceData(x, covariance);<a name="line.61"></a>
+<FONT color="green">062</FONT>            newCovarianceData(covariance);<a name="line.62"></a>
+<FONT color="green">063</FONT>        }<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /**<a name="line.65"></a>
+<FONT color="green">066</FONT>         * Add the covariance data.<a name="line.66"></a>
+<FONT color="green">067</FONT>         *<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param omega the [n,n] array representing the covariance<a name="line.68"></a>
+<FONT color="green">069</FONT>         */<a name="line.69"></a>
+<FONT color="green">070</FONT>        protected void newCovarianceData(double[][] omega){<a name="line.70"></a>
+<FONT color="green">071</FONT>            this.Omega = new Array2DRowRealMatrix(omega);<a name="line.71"></a>
+<FONT color="green">072</FONT>            this.OmegaInverse = null;<a name="line.72"></a>
+<FONT color="green">073</FONT>        }<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /**<a name="line.75"></a>
+<FONT color="green">076</FONT>         * Get the inverse of the covariance.<a name="line.76"></a>
+<FONT color="green">077</FONT>         * &lt;p&gt;The inverse of the covariance matrix is lazily evaluated and cached.&lt;/p&gt;<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @return inverse of the covariance<a name="line.78"></a>
+<FONT color="green">079</FONT>         */<a name="line.79"></a>
+<FONT color="green">080</FONT>        protected RealMatrix getOmegaInverse() {<a name="line.80"></a>
+<FONT color="green">081</FONT>            if (OmegaInverse == null) {<a name="line.81"></a>
+<FONT color="green">082</FONT>                OmegaInverse = new LUDecompositionImpl(Omega).getSolver().getInverse();<a name="line.82"></a>
+<FONT color="green">083</FONT>            }<a name="line.83"></a>
+<FONT color="green">084</FONT>            return OmegaInverse;<a name="line.84"></a>
+<FONT color="green">085</FONT>        }<a name="line.85"></a>
+<FONT color="green">086</FONT>    <a name="line.86"></a>
+<FONT color="green">087</FONT>        /**<a name="line.87"></a>
+<FONT color="green">088</FONT>         * Calculates beta by GLS.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * &lt;pre&gt;<a name="line.89"></a>
+<FONT color="green">090</FONT>         *  b=(X' Omega^-1 X)^-1X'Omega^-1 y<a name="line.90"></a>
+<FONT color="green">091</FONT>         * &lt;/pre&gt;<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @return beta<a name="line.92"></a>
+<FONT color="green">093</FONT>         */<a name="line.93"></a>
+<FONT color="green">094</FONT>        @Override<a name="line.94"></a>
+<FONT color="green">095</FONT>        protected RealVector calculateBeta() {<a name="line.95"></a>
+<FONT color="green">096</FONT>            RealMatrix OI = getOmegaInverse();<a name="line.96"></a>
+<FONT color="green">097</FONT>            RealMatrix XT = X.transpose();<a name="line.97"></a>
+<FONT color="green">098</FONT>            RealMatrix XTOIX = XT.multiply(OI).multiply(X);<a name="line.98"></a>
+<FONT color="green">099</FONT>            RealMatrix inverse = new LUDecompositionImpl(XTOIX).getSolver().getInverse();<a name="line.99"></a>
+<FONT color="green">100</FONT>            return inverse.multiply(XT).multiply(OI).operate(Y);<a name="line.100"></a>
+<FONT color="green">101</FONT>        }<a name="line.101"></a>
+<FONT color="green">102</FONT>    <a name="line.102"></a>
+<FONT color="green">103</FONT>        /**<a name="line.103"></a>
+<FONT color="green">104</FONT>         * Calculates the variance on the beta by GLS.<a name="line.104"></a>
+<FONT color="green">105</FONT>         * &lt;pre&gt;<a name="line.105"></a>
+<FONT color="green">106</FONT>         *  Var(b)=(X' Omega^-1 X)^-1<a name="line.106"></a>
+<FONT color="green">107</FONT>         * &lt;/pre&gt;<a name="line.107"></a>
+<FONT color="green">108</FONT>         * @return The beta variance matrix<a name="line.108"></a>
+<FONT color="green">109</FONT>         */<a name="line.109"></a>
+<FONT color="green">110</FONT>        @Override<a name="line.110"></a>
+<FONT color="green">111</FONT>        protected RealMatrix calculateBetaVariance() {<a name="line.111"></a>
+<FONT color="green">112</FONT>            RealMatrix OI = getOmegaInverse();<a name="line.112"></a>
+<FONT color="green">113</FONT>            RealMatrix XTOIX = X.transpose().multiply(OI).multiply(X);<a name="line.113"></a>
+<FONT color="green">114</FONT>            return new LUDecompositionImpl(XTOIX).getSolver().getInverse();<a name="line.114"></a>
+<FONT color="green">115</FONT>        }<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>        /**<a name="line.117"></a>
+<FONT color="green">118</FONT>         * Calculates the variance on the y by GLS.<a name="line.118"></a>
+<FONT color="green">119</FONT>         * &lt;pre&gt;<a name="line.119"></a>
+<FONT color="green">120</FONT>         *  Var(y)=Tr(u' Omega^-1 u)/(n-k)<a name="line.120"></a>
+<FONT color="green">121</FONT>         * &lt;/pre&gt;<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @return The Y variance<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        @Override<a name="line.124"></a>
+<FONT color="green">125</FONT>        protected double calculateYVariance() {<a name="line.125"></a>
+<FONT color="green">126</FONT>            RealVector residuals = calculateResiduals();<a name="line.126"></a>
+<FONT color="green">127</FONT>            double t = residuals.dotProduct(getOmegaInverse().operate(residuals));<a name="line.127"></a>
+<FONT color="green">128</FONT>            return t / (X.getRowDimension() - X.getColumnDimension());<a name="line.128"></a>
+<FONT color="green">129</FONT>        }<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>    }<a name="line.131"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/regression/MultipleLinearRegression.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,136 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.regression;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    /**<a name="line.19"></a>
+<FONT color="green">020</FONT>     * The multiple linear regression can be represented in matrix-notation.<a name="line.20"></a>
+<FONT color="green">021</FONT>     * &lt;pre&gt;<a name="line.21"></a>
+<FONT color="green">022</FONT>     *  y=X*b+u<a name="line.22"></a>
+<FONT color="green">023</FONT>     * &lt;/pre&gt;<a name="line.23"></a>
+<FONT color="green">024</FONT>     * where y is an &lt;code&gt;n-vector&lt;/code&gt; &lt;b&gt;regressand&lt;/b&gt;, X is a &lt;code&gt;[n,k]&lt;/code&gt; matrix whose &lt;code&gt;k&lt;/code&gt; columns are called<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;b&gt;regressors&lt;/b&gt;, b is &lt;code&gt;k-vector&lt;/code&gt; of &lt;b&gt;regression parameters&lt;/b&gt; and &lt;code&gt;u&lt;/code&gt; is an &lt;code&gt;n-vector&lt;/code&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * of &lt;b&gt;error terms&lt;/b&gt; or &lt;b&gt;residuals&lt;/b&gt;.<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * The notation is quite standard in literature,<a name="line.28"></a>
+<FONT color="green">029</FONT>     * cf eg &lt;a href="http://www.econ.queensu.ca/ETM"&gt;Davidson and MacKinnon, Econometrics Theory and Methods, 2004&lt;/a&gt;.<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 2.0<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public interface MultipleLinearRegression {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /**<a name="line.35"></a>
+<FONT color="green">036</FONT>         * Estimates the regression parameters b.<a name="line.36"></a>
+<FONT color="green">037</FONT>         *<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @return The [k,1] array representing b<a name="line.38"></a>
+<FONT color="green">039</FONT>         */<a name="line.39"></a>
+<FONT color="green">040</FONT>        double[] estimateRegressionParameters();<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /**<a name="line.42"></a>
+<FONT color="green">043</FONT>         * Estimates the variance of the regression parameters, ie Var(b).<a name="line.43"></a>
+<FONT color="green">044</FONT>         *<a name="line.44"></a>
+<FONT color="green">045</FONT>         * @return The [k,k] array representing the variance of b<a name="line.45"></a>
+<FONT color="green">046</FONT>         */<a name="line.46"></a>
+<FONT color="green">047</FONT>        double[][] estimateRegressionParametersVariance();<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /**<a name="line.49"></a>
+<FONT color="green">050</FONT>         * Estimates the residuals, ie u = y - X*b.<a name="line.50"></a>
+<FONT color="green">051</FONT>         *<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @return The [n,1] array representing the residuals<a name="line.52"></a>
+<FONT color="green">053</FONT>         */<a name="line.53"></a>
+<FONT color="green">054</FONT>        double[] estimateResiduals();<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /**<a name="line.56"></a>
+<FONT color="green">057</FONT>         * Returns the variance of the regressand, ie Var(y).<a name="line.57"></a>
+<FONT color="green">058</FONT>         *<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @return The double representing the variance of y<a name="line.59"></a>
+<FONT color="green">060</FONT>         */<a name="line.60"></a>
+<FONT color="green">061</FONT>        double estimateRegressandVariance();<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /**<a name="line.63"></a>
+<FONT color="green">064</FONT>         * Returns the standard errors of the regression parameters.<a name="line.64"></a>
+<FONT color="green">065</FONT>         *<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @return standard errors of estimated regression parameters<a name="line.66"></a>
+<FONT color="green">067</FONT>         */<a name="line.67"></a>
+<FONT color="green">068</FONT>         double[] estimateRegressionParametersStandardErrors();<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>    }<a name="line.70"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/regression/OLSMultipleLinearRegression.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,245 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.stat.regression;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.linear.Array2DRowRealMatrix;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.linear.LUDecompositionImpl;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.linear.QRDecomposition;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.linear.QRDecompositionImpl;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.linear.RealMatrix;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.linear.RealVector;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;Implements ordinary least squares (OLS) to estimate the parameters of a<a name="line.27"></a>
+<FONT color="green">028</FONT>     * multiple linear regression model.&lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     *<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;p&gt;OLS assumes the covariance matrix of the error to be diagonal and with<a name="line.30"></a>
+<FONT color="green">031</FONT>     * equal variance.&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * u ~ N(0, &amp;sigma;&lt;sup&gt;2&lt;/sup&gt;I)<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;/p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     *<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;p&gt;The regression coefficients, b, satisfy the normal equations:<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * X&lt;sup&gt;T&lt;/sup&gt; X b = X&lt;sup&gt;T&lt;/sup&gt; y<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;/p&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     *<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;p&gt;To solve the normal equations, this implementation uses QR decomposition<a name="line.41"></a>
+<FONT color="green">042</FONT>     * of the X matrix. (See {@link QRDecompositionImpl} for details on the<a name="line.42"></a>
+<FONT color="green">043</FONT>     * decomposition algorithm.)<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;/p&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     * &lt;p&gt;X&lt;sup&gt;T&lt;/sup&gt;X b = X&lt;sup&gt;T&lt;/sup&gt; y &lt;br/&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     * (QR)&lt;sup&gt;T&lt;/sup&gt; (QR) b = (QR)&lt;sup&gt;T&lt;/sup&gt;y &lt;br/&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     * R&lt;sup&gt;T&lt;/sup&gt; (Q&lt;sup&gt;T&lt;/sup&gt;Q) R b = R&lt;sup&gt;T&lt;/sup&gt; Q&lt;sup&gt;T&lt;/sup&gt; y &lt;br/&gt;<a name="line.47"></a>
+<FONT color="green">048</FONT>     * R&lt;sup&gt;T&lt;/sup&gt; R b = R&lt;sup&gt;T&lt;/sup&gt; Q&lt;sup&gt;T&lt;/sup&gt; y &lt;br/&gt;<a name="line.48"></a>
+<FONT color="green">049</FONT>     * (R&lt;sup&gt;T&lt;/sup&gt;)&lt;sup&gt;-1&lt;/sup&gt; R&lt;sup&gt;T&lt;/sup&gt; R b = (R&lt;sup&gt;T&lt;/sup&gt;)&lt;sup&gt;-1&lt;/sup&gt; R&lt;sup&gt;T&lt;/sup&gt; Q&lt;sup&gt;T&lt;/sup&gt; y &lt;br/&gt;<a name="line.49"></a>
+<FONT color="green">050</FONT>     * R b = Q&lt;sup&gt;T&lt;/sup&gt; y<a name="line.50"></a>
+<FONT color="green">051</FONT>     * &lt;/p&gt;<a name="line.51"></a>
+<FONT color="green">052</FONT>     * Given Q and R, the last equation is solved by back-subsitution.&lt;/p&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>     *<a name="line.53"></a>
+<FONT color="green">054</FONT>     * @version $Revision: 825925 $ $Date: 2009-10-16 11:11:47 -0400 (Fri, 16 Oct 2009) $<a name="line.54"></a>
+<FONT color="green">055</FONT>     * @since 2.0<a name="line.55"></a>
+<FONT color="green">056</FONT>     */<a name="line.56"></a>
+<FONT color="green">057</FONT>    public class OLSMultipleLinearRegression extends AbstractMultipleLinearRegression {<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** Cached QR decomposition of X matrix */<a name="line.59"></a>
+<FONT color="green">060</FONT>        private QRDecomposition qr = null;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /**<a name="line.62"></a>
+<FONT color="green">063</FONT>         * Loads model x and y sample data, overriding any previous sample.<a name="line.63"></a>
+<FONT color="green">064</FONT>         *<a name="line.64"></a>
+<FONT color="green">065</FONT>         * Computes and caches QR decomposition of the X matrix.<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @param y the [n,1] array representing the y sample<a name="line.66"></a>
+<FONT color="green">067</FONT>         * @param x the [n,k] array representing the x sample<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @throws IllegalArgumentException if the x and y array data are not<a name="line.68"></a>
+<FONT color="green">069</FONT>         *             compatible for the regression<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        public void newSampleData(double[] y, double[][] x) {<a name="line.71"></a>
+<FONT color="green">072</FONT>            validateSampleData(x, y);<a name="line.72"></a>
+<FONT color="green">073</FONT>            newYSampleData(y);<a name="line.73"></a>
+<FONT color="green">074</FONT>            newXSampleData(x);<a name="line.74"></a>
+<FONT color="green">075</FONT>        }<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /**<a name="line.77"></a>
+<FONT color="green">078</FONT>         * {@inheritDoc}<a name="line.78"></a>
+<FONT color="green">079</FONT>         *<a name="line.79"></a>
+<FONT color="green">080</FONT>         * Computes and caches QR decomposition of the X matrix<a name="line.80"></a>
+<FONT color="green">081</FONT>         */<a name="line.81"></a>
+<FONT color="green">082</FONT>        @Override<a name="line.82"></a>
+<FONT color="green">083</FONT>        public void newSampleData(double[] data, int nobs, int nvars) {<a name="line.83"></a>
+<FONT color="green">084</FONT>            super.newSampleData(data, nobs, nvars);<a name="line.84"></a>
+<FONT color="green">085</FONT>            qr = new QRDecompositionImpl(X);<a name="line.85"></a>
+<FONT color="green">086</FONT>        }<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>        /**<a name="line.88"></a>
+<FONT color="green">089</FONT>         * &lt;p&gt;Compute the "hat" matrix.<a name="line.89"></a>
+<FONT color="green">090</FONT>         * &lt;/p&gt;<a name="line.90"></a>
+<FONT color="green">091</FONT>         * &lt;p&gt;The hat matrix is defined in terms of the design matrix X<a name="line.91"></a>
+<FONT color="green">092</FONT>         *  by X(X&lt;sup&gt;T&lt;/sup&gt;X)&lt;sup&gt;-1&lt;/sup&gt;X&lt;sup&gt;T&lt;/sup&gt;<a name="line.92"></a>
+<FONT color="green">093</FONT>         * &lt;/p&gt;<a name="line.93"></a>
+<FONT color="green">094</FONT>         * &lt;p&gt;The implementation here uses the QR decomposition to compute the<a name="line.94"></a>
+<FONT color="green">095</FONT>         * hat matrix as Q I&lt;sub&gt;p&lt;/sub&gt;Q&lt;sup&gt;T&lt;/sup&gt; where I&lt;sub&gt;p&lt;/sub&gt; is the<a name="line.95"></a>
+<FONT color="green">096</FONT>         * p-dimensional identity matrix augmented by 0's.  This computational<a name="line.96"></a>
+<FONT color="green">097</FONT>         * formula is from "The Hat Matrix in Regression and ANOVA",<a name="line.97"></a>
+<FONT color="green">098</FONT>         * David C. Hoaglin and Roy E. Welsch,<a name="line.98"></a>
+<FONT color="green">099</FONT>         * &lt;i&gt;The American Statistician&lt;/i&gt;, Vol. 32, No. 1 (Feb., 1978), pp. 17-22.<a name="line.99"></a>
+<FONT color="green">100</FONT>         *<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @return the hat matrix<a name="line.101"></a>
+<FONT color="green">102</FONT>         */<a name="line.102"></a>
+<FONT color="green">103</FONT>        public RealMatrix calculateHat() {<a name="line.103"></a>
+<FONT color="green">104</FONT>            // Create augmented identity matrix<a name="line.104"></a>
+<FONT color="green">105</FONT>            RealMatrix Q = qr.getQ();<a name="line.105"></a>
+<FONT color="green">106</FONT>            final int p = qr.getR().getColumnDimension();<a name="line.106"></a>
+<FONT color="green">107</FONT>            final int n = Q.getColumnDimension();<a name="line.107"></a>
+<FONT color="green">108</FONT>            Array2DRowRealMatrix augI = new Array2DRowRealMatrix(n, n);<a name="line.108"></a>
+<FONT color="green">109</FONT>            double[][] augIData = augI.getDataRef();<a name="line.109"></a>
+<FONT color="green">110</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.110"></a>
+<FONT color="green">111</FONT>                for (int j =0; j &lt; n; j++) {<a name="line.111"></a>
+<FONT color="green">112</FONT>                    if (i == j &amp;&amp; i &lt; p) {<a name="line.112"></a>
+<FONT color="green">113</FONT>                        augIData[i][j] = 1d;<a name="line.113"></a>
+<FONT color="green">114</FONT>                    } else {<a name="line.114"></a>
+<FONT color="green">115</FONT>                        augIData[i][j] = 0d;<a name="line.115"></a>
+<FONT color="green">116</FONT>                    }<a name="line.116"></a>
+<FONT color="green">117</FONT>                }<a name="line.117"></a>
+<FONT color="green">118</FONT>            }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>            // Compute and return Hat matrix<a name="line.120"></a>
+<FONT color="green">121</FONT>            return Q.multiply(augI).multiply(Q.transpose());<a name="line.121"></a>
+<FONT color="green">122</FONT>        }<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>        /**<a name="line.124"></a>
+<FONT color="green">125</FONT>         * Loads new x sample data, overriding any previous sample<a name="line.125"></a>
+<FONT color="green">126</FONT>         *<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @param x the [n,k] array representing the x sample<a name="line.127"></a>
+<FONT color="green">128</FONT>         */<a name="line.128"></a>
+<FONT color="green">129</FONT>        @Override<a name="line.129"></a>
+<FONT color="green">130</FONT>        protected void newXSampleData(double[][] x) {<a name="line.130"></a>
+<FONT color="green">131</FONT>            this.X = new Array2DRowRealMatrix(x);<a name="line.131"></a>
+<FONT color="green">132</FONT>            qr = new QRDecompositionImpl(X);<a name="line.132"></a>
+<FONT color="green">133</FONT>        }<a name="line.133"></a>
+<FONT color="green">134</FONT>    <a name="line.134"></a>
+<FONT color="green">135</FONT>        /**<a name="line.135"></a>
+<FONT color="green">136</FONT>         * Calculates regression coefficients using OLS.<a name="line.136"></a>
+<FONT color="green">137</FONT>         *<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @return beta<a name="line.138"></a>
+<FONT color="green">139</FONT>         */<a name="line.139"></a>
+<FONT color="green">140</FONT>        @Override<a name="line.140"></a>
+<FONT color="green">141</FONT>        protected RealVector calculateBeta() {<a name="line.141"></a>
+<FONT color="green">142</FONT>            return qr.getSolver().solve(Y);<a name="line.142"></a>
+<FONT color="green">143</FONT>        }<a name="line.143"></a>
+<FONT color="green">144</FONT>    <a name="line.144"></a>
+<FONT color="green">145</FONT>        /**<a name="line.145"></a>
+<FONT color="green">146</FONT>         * &lt;p&gt;Calculates the variance on the beta by OLS.<a name="line.146"></a>
+<FONT color="green">147</FONT>         * &lt;/p&gt;<a name="line.147"></a>
+<FONT color="green">148</FONT>         * &lt;p&gt;Var(b) = (X&lt;sup&gt;T&lt;/sup&gt;X)&lt;sup&gt;-1&lt;/sup&gt;<a name="line.148"></a>
+<FONT color="green">149</FONT>         * &lt;/p&gt;<a name="line.149"></a>
+<FONT color="green">150</FONT>         * &lt;p&gt;Uses QR decomposition to reduce (X&lt;sup&gt;T&lt;/sup&gt;X)&lt;sup&gt;-1&lt;/sup&gt;<a name="line.150"></a>
+<FONT color="green">151</FONT>         * to (R&lt;sup&gt;T&lt;/sup&gt;R)&lt;sup&gt;-1&lt;/sup&gt;, with only the top p rows of<a name="line.151"></a>
+<FONT color="green">152</FONT>         * R included, where p = the length of the beta vector.&lt;/p&gt;<a name="line.152"></a>
+<FONT color="green">153</FONT>         *<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @return The beta variance<a name="line.154"></a>
+<FONT color="green">155</FONT>         */<a name="line.155"></a>
+<FONT color="green">156</FONT>        @Override<a name="line.156"></a>
+<FONT color="green">157</FONT>        protected RealMatrix calculateBetaVariance() {<a name="line.157"></a>
+<FONT color="green">158</FONT>            int p = X.getColumnDimension();<a name="line.158"></a>
+<FONT color="green">159</FONT>            RealMatrix Raug = qr.getR().getSubMatrix(0, p - 1 , 0, p - 1);<a name="line.159"></a>
+<FONT color="green">160</FONT>            RealMatrix Rinv = new LUDecompositionImpl(Raug).getSolver().getInverse();<a name="line.160"></a>
+<FONT color="green">161</FONT>            return Rinv.multiply(Rinv.transpose());<a name="line.161"></a>
+<FONT color="green">162</FONT>        }<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>    <a name="line.164"></a>
+<FONT color="green">165</FONT>        /**<a name="line.165"></a>
+<FONT color="green">166</FONT>         * &lt;p&gt;Calculates the variance on the Y by OLS.<a name="line.166"></a>
+<FONT color="green">167</FONT>         * &lt;/p&gt;<a name="line.167"></a>
+<FONT color="green">168</FONT>         * &lt;p&gt; Var(y) = Tr(u&lt;sup&gt;T&lt;/sup&gt;u)/(n - k)<a name="line.168"></a>
+<FONT color="green">169</FONT>         * &lt;/p&gt;<a name="line.169"></a>
+<FONT color="green">170</FONT>         * @return The Y variance<a name="line.170"></a>
+<FONT color="green">171</FONT>         */<a name="line.171"></a>
+<FONT color="green">172</FONT>        @Override<a name="line.172"></a>
+<FONT color="green">173</FONT>        protected double calculateYVariance() {<a name="line.173"></a>
+<FONT color="green">174</FONT>            RealVector residuals = calculateResiduals();<a name="line.174"></a>
+<FONT color="green">175</FONT>            return residuals.dotProduct(residuals) /<a name="line.175"></a>
+<FONT color="green">176</FONT>                   (X.getRowDimension() - X.getColumnDimension());<a name="line.176"></a>
+<FONT color="green">177</FONT>        }<a name="line.177"></a>
+<FONT color="green">178</FONT>    <a name="line.178"></a>
+<FONT color="green">179</FONT>    }<a name="line.179"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/stat/regression/SimpleRegression.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,687 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.stat.regression;<a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MathException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.distribution.TDistribution;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.distribution.TDistributionImpl;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Estimates an ordinary least squares regression model<a name="line.27"></a>
+<FONT color="green">028</FONT>     * with one independent variable.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;code&gt; y = intercept + slope * x  &lt;/code&gt;&lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * Standard errors for &lt;code&gt;intercept&lt;/code&gt; and &lt;code&gt;slope&lt;/code&gt; are<a name="line.32"></a>
+<FONT color="green">033</FONT>     * available as well as ANOVA, r-square and Pearson's r statistics.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * Observations (x,y pairs) can be added to the model one at a time or they<a name="line.35"></a>
+<FONT color="green">036</FONT>     * can be provided in a 2-dimensional array.  The observations are not stored<a name="line.36"></a>
+<FONT color="green">037</FONT>     * in memory, so there is no limit to the number of observations that can be<a name="line.37"></a>
+<FONT color="green">038</FONT>     * added to the model.&lt;/p&gt;<a name="line.38"></a>
+<FONT color="green">039</FONT>     * &lt;p&gt;<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;strong&gt;Usage Notes&lt;/strong&gt;: &lt;ul&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * &lt;li&gt; When there are fewer than two observations in the model, or when<a name="line.41"></a>
+<FONT color="green">042</FONT>     * there is no variation in the x values (i.e. all x values are the same)<a name="line.42"></a>
+<FONT color="green">043</FONT>     * all statistics return &lt;code&gt;NaN&lt;/code&gt;. At least two observations with<a name="line.43"></a>
+<FONT color="green">044</FONT>     * different x coordinates are requred to estimate a bivariate regression<a name="line.44"></a>
+<FONT color="green">045</FONT>     * model.<a name="line.45"></a>
+<FONT color="green">046</FONT>     * &lt;/li&gt;<a name="line.46"></a>
+<FONT color="green">047</FONT>     * &lt;li&gt; getters for the statistics always compute values based on the current<a name="line.47"></a>
+<FONT color="green">048</FONT>     * set of observations -- i.e., you can get statistics, then add more data<a name="line.48"></a>
+<FONT color="green">049</FONT>     * and get updated statistics without using a new instance.  There is no<a name="line.49"></a>
+<FONT color="green">050</FONT>     * "compute" method that updates all statistics.  Each of the getters performs<a name="line.50"></a>
+<FONT color="green">051</FONT>     * the necessary computations to return the requested statistic.&lt;/li&gt;<a name="line.51"></a>
+<FONT color="green">052</FONT>     * &lt;/ul&gt;&lt;/p&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>     *<a name="line.53"></a>
+<FONT color="green">054</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.54"></a>
+<FONT color="green">055</FONT>     */<a name="line.55"></a>
+<FONT color="green">056</FONT>    public class SimpleRegression implements Serializable {<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /** Serializable version identifier */<a name="line.58"></a>
+<FONT color="green">059</FONT>        private static final long serialVersionUID = -3004689053607543335L;<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /** the distribution used to compute inference statistics. */<a name="line.61"></a>
+<FONT color="green">062</FONT>        private TDistribution distribution;<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /** sum of x values */<a name="line.64"></a>
+<FONT color="green">065</FONT>        private double sumX = 0d;<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /** total variation in x (sum of squared deviations from xbar) */<a name="line.67"></a>
+<FONT color="green">068</FONT>        private double sumXX = 0d;<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /** sum of y values */<a name="line.70"></a>
+<FONT color="green">071</FONT>        private double sumY = 0d;<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>        /** total variation in y (sum of squared deviations from ybar) */<a name="line.73"></a>
+<FONT color="green">074</FONT>        private double sumYY = 0d;<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        /** sum of products */<a name="line.76"></a>
+<FONT color="green">077</FONT>        private double sumXY = 0d;<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        /** number of observations */<a name="line.79"></a>
+<FONT color="green">080</FONT>        private long n = 0;<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>        /** mean of accumulated x values, used in updating formulas */<a name="line.82"></a>
+<FONT color="green">083</FONT>        private double xbar = 0;<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>        /** mean of accumulated y values, used in updating formulas */<a name="line.85"></a>
+<FONT color="green">086</FONT>        private double ybar = 0;<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>        // ---------------------Public methods--------------------------------------<a name="line.88"></a>
+<FONT color="green">089</FONT>    <a name="line.89"></a>
+<FONT color="green">090</FONT>        /**<a name="line.90"></a>
+<FONT color="green">091</FONT>         * Create an empty SimpleRegression instance<a name="line.91"></a>
+<FONT color="green">092</FONT>         */<a name="line.92"></a>
+<FONT color="green">093</FONT>        public SimpleRegression() {<a name="line.93"></a>
+<FONT color="green">094</FONT>            this(new TDistributionImpl(1.0));<a name="line.94"></a>
+<FONT color="green">095</FONT>        }<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /**<a name="line.97"></a>
+<FONT color="green">098</FONT>         * Create an empty SimpleRegression using the given distribution object to<a name="line.98"></a>
+<FONT color="green">099</FONT>         * compute inference statistics.<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @param t the distribution used to compute inference statistics.<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @since 1.2<a name="line.101"></a>
+<FONT color="green">102</FONT>         */<a name="line.102"></a>
+<FONT color="green">103</FONT>        public SimpleRegression(TDistribution t) {<a name="line.103"></a>
+<FONT color="green">104</FONT>            super();<a name="line.104"></a>
+<FONT color="green">105</FONT>            setDistribution(t);<a name="line.105"></a>
+<FONT color="green">106</FONT>        }<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>        /**<a name="line.108"></a>
+<FONT color="green">109</FONT>         * Adds the observation (x,y) to the regression data set.<a name="line.109"></a>
+<FONT color="green">110</FONT>         * &lt;p&gt;<a name="line.110"></a>
+<FONT color="green">111</FONT>         * Uses updating formulas for means and sums of squares defined in<a name="line.111"></a>
+<FONT color="green">112</FONT>         * "Algorithms for Computing the Sample Variance: Analysis and<a name="line.112"></a>
+<FONT color="green">113</FONT>         * Recommendations", Chan, T.F., Golub, G.H., and LeVeque, R.J.<a name="line.113"></a>
+<FONT color="green">114</FONT>         * 1983, American Statistician, vol. 37, pp. 242-247, referenced in<a name="line.114"></a>
+<FONT color="green">115</FONT>         * Weisberg, S. "Applied Linear Regression". 2nd Ed. 1985.&lt;/p&gt;<a name="line.115"></a>
+<FONT color="green">116</FONT>         *<a name="line.116"></a>
+<FONT color="green">117</FONT>         *<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @param x independent variable value<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @param y dependent variable value<a name="line.119"></a>
+<FONT color="green">120</FONT>         */<a name="line.120"></a>
+<FONT color="green">121</FONT>        public void addData(double x, double y) {<a name="line.121"></a>
+<FONT color="green">122</FONT>            if (n == 0) {<a name="line.122"></a>
+<FONT color="green">123</FONT>                xbar = x;<a name="line.123"></a>
+<FONT color="green">124</FONT>                ybar = y;<a name="line.124"></a>
+<FONT color="green">125</FONT>            } else {<a name="line.125"></a>
+<FONT color="green">126</FONT>                double dx = x - xbar;<a name="line.126"></a>
+<FONT color="green">127</FONT>                double dy = y - ybar;<a name="line.127"></a>
+<FONT color="green">128</FONT>                sumXX += dx * dx * (double) n / (n + 1d);<a name="line.128"></a>
+<FONT color="green">129</FONT>                sumYY += dy * dy * (double) n / (n + 1d);<a name="line.129"></a>
+<FONT color="green">130</FONT>                sumXY += dx * dy * (double) n / (n + 1d);<a name="line.130"></a>
+<FONT color="green">131</FONT>                xbar += dx / (n + 1.0);<a name="line.131"></a>
+<FONT color="green">132</FONT>                ybar += dy / (n + 1.0);<a name="line.132"></a>
+<FONT color="green">133</FONT>            }<a name="line.133"></a>
+<FONT color="green">134</FONT>            sumX += x;<a name="line.134"></a>
+<FONT color="green">135</FONT>            sumY += y;<a name="line.135"></a>
+<FONT color="green">136</FONT>            n++;<a name="line.136"></a>
+<FONT color="green">137</FONT>    <a name="line.137"></a>
+<FONT color="green">138</FONT>            if (n &gt; 2) {<a name="line.138"></a>
+<FONT color="green">139</FONT>                distribution.setDegreesOfFreedom(n - 2);<a name="line.139"></a>
+<FONT color="green">140</FONT>            }<a name="line.140"></a>
+<FONT color="green">141</FONT>        }<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>    <a name="line.143"></a>
+<FONT color="green">144</FONT>        /**<a name="line.144"></a>
+<FONT color="green">145</FONT>         * Removes the observation (x,y) from the regression data set.<a name="line.145"></a>
+<FONT color="green">146</FONT>         * &lt;p&gt;<a name="line.146"></a>
+<FONT color="green">147</FONT>         * Mirrors the addData method.  This method permits the use of<a name="line.147"></a>
+<FONT color="green">148</FONT>         * SimpleRegression instances in streaming mode where the regression<a name="line.148"></a>
+<FONT color="green">149</FONT>         * is applied to a sliding "window" of observations, however the caller is<a name="line.149"></a>
+<FONT color="green">150</FONT>         * responsible for maintaining the set of observations in the window.&lt;/p&gt;<a name="line.150"></a>
+<FONT color="green">151</FONT>         *<a name="line.151"></a>
+<FONT color="green">152</FONT>         * The method has no effect if there are no points of data (i.e. n=0)<a name="line.152"></a>
+<FONT color="green">153</FONT>         *<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @param x independent variable value<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @param y dependent variable value<a name="line.155"></a>
+<FONT color="green">156</FONT>         */<a name="line.156"></a>
+<FONT color="green">157</FONT>        public void removeData(double x, double y) {<a name="line.157"></a>
+<FONT color="green">158</FONT>            if (n &gt; 0) {<a name="line.158"></a>
+<FONT color="green">159</FONT>                double dx = x - xbar;<a name="line.159"></a>
+<FONT color="green">160</FONT>                double dy = y - ybar;<a name="line.160"></a>
+<FONT color="green">161</FONT>                sumXX -= dx * dx * (double) n / (n - 1d);<a name="line.161"></a>
+<FONT color="green">162</FONT>                sumYY -= dy * dy * (double) n / (n - 1d);<a name="line.162"></a>
+<FONT color="green">163</FONT>                sumXY -= dx * dy * (double) n / (n - 1d);<a name="line.163"></a>
+<FONT color="green">164</FONT>                xbar -= dx / (n - 1.0);<a name="line.164"></a>
+<FONT color="green">165</FONT>                ybar -= dy / (n - 1.0);<a name="line.165"></a>
+<FONT color="green">166</FONT>                sumX -= x;<a name="line.166"></a>
+<FONT color="green">167</FONT>                sumY -= y;<a name="line.167"></a>
+<FONT color="green">168</FONT>                n--;<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>                if (n &gt; 2) {<a name="line.170"></a>
+<FONT color="green">171</FONT>                    distribution.setDegreesOfFreedom(n - 2);<a name="line.171"></a>
+<FONT color="green">172</FONT>                }<a name="line.172"></a>
+<FONT color="green">173</FONT>            }<a name="line.173"></a>
+<FONT color="green">174</FONT>        }<a name="line.174"></a>
+<FONT color="green">175</FONT>    <a name="line.175"></a>
+<FONT color="green">176</FONT>        /**<a name="line.176"></a>
+<FONT color="green">177</FONT>         * Adds the observations represented by the elements in<a name="line.177"></a>
+<FONT color="green">178</FONT>         * &lt;code&gt;data&lt;/code&gt;.<a name="line.178"></a>
+<FONT color="green">179</FONT>         * &lt;p&gt;<a name="line.179"></a>
+<FONT color="green">180</FONT>         * &lt;code&gt;(data[0][0],data[0][1])&lt;/code&gt; will be the first observation, then<a name="line.180"></a>
+<FONT color="green">181</FONT>         * &lt;code&gt;(data[1][0],data[1][1])&lt;/code&gt;, etc.&lt;/p&gt;<a name="line.181"></a>
+<FONT color="green">182</FONT>         * &lt;p&gt;<a name="line.182"></a>
+<FONT color="green">183</FONT>         * This method does not replace data that has already been added.  The<a name="line.183"></a>
+<FONT color="green">184</FONT>         * observations represented by &lt;code&gt;data&lt;/code&gt; are added to the existing<a name="line.184"></a>
+<FONT color="green">185</FONT>         * dataset.&lt;/p&gt;<a name="line.185"></a>
+<FONT color="green">186</FONT>         * &lt;p&gt;<a name="line.186"></a>
+<FONT color="green">187</FONT>         * To replace all data, use &lt;code&gt;clear()&lt;/code&gt; before adding the new<a name="line.187"></a>
+<FONT color="green">188</FONT>         * data.&lt;/p&gt;<a name="line.188"></a>
+<FONT color="green">189</FONT>         *<a name="line.189"></a>
+<FONT color="green">190</FONT>         * @param data array of observations to be added<a name="line.190"></a>
+<FONT color="green">191</FONT>         */<a name="line.191"></a>
+<FONT color="green">192</FONT>        public void addData(double[][] data) {<a name="line.192"></a>
+<FONT color="green">193</FONT>            for (int i = 0; i &lt; data.length; i++) {<a name="line.193"></a>
+<FONT color="green">194</FONT>                addData(data[i][0], data[i][1]);<a name="line.194"></a>
+<FONT color="green">195</FONT>            }<a name="line.195"></a>
+<FONT color="green">196</FONT>        }<a name="line.196"></a>
+<FONT color="green">197</FONT>    <a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>        /**<a name="line.199"></a>
+<FONT color="green">200</FONT>         * Removes observations represented by the elements in &lt;code&gt;data&lt;/code&gt;.<a name="line.200"></a>
+<FONT color="green">201</FONT>          * &lt;p&gt;<a name="line.201"></a>
+<FONT color="green">202</FONT>         * If the array is larger than the current n, only the first n elements are<a name="line.202"></a>
+<FONT color="green">203</FONT>         * processed.  This method permits the use of SimpleRegression instances in<a name="line.203"></a>
+<FONT color="green">204</FONT>         * streaming mode where the regression is applied to a sliding "window" of<a name="line.204"></a>
+<FONT color="green">205</FONT>         * observations, however the caller is responsible for maintaining the set<a name="line.205"></a>
+<FONT color="green">206</FONT>         * of observations in the window.&lt;/p&gt;<a name="line.206"></a>
+<FONT color="green">207</FONT>         * &lt;p&gt;<a name="line.207"></a>
+<FONT color="green">208</FONT>         * To remove all data, use &lt;code&gt;clear()&lt;/code&gt;.&lt;/p&gt;<a name="line.208"></a>
+<FONT color="green">209</FONT>         *<a name="line.209"></a>
+<FONT color="green">210</FONT>         * @param data array of observations to be removed<a name="line.210"></a>
+<FONT color="green">211</FONT>         */<a name="line.211"></a>
+<FONT color="green">212</FONT>        public void removeData(double[][] data) {<a name="line.212"></a>
+<FONT color="green">213</FONT>            for (int i = 0; i &lt; data.length &amp;&amp; n &gt; 0; i++) {<a name="line.213"></a>
+<FONT color="green">214</FONT>                removeData(data[i][0], data[i][1]);<a name="line.214"></a>
+<FONT color="green">215</FONT>            }<a name="line.215"></a>
+<FONT color="green">216</FONT>        }<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>        /**<a name="line.218"></a>
+<FONT color="green">219</FONT>         * Clears all data from the model.<a name="line.219"></a>
+<FONT color="green">220</FONT>         */<a name="line.220"></a>
+<FONT color="green">221</FONT>        public void clear() {<a name="line.221"></a>
+<FONT color="green">222</FONT>            sumX = 0d;<a name="line.222"></a>
+<FONT color="green">223</FONT>            sumXX = 0d;<a name="line.223"></a>
+<FONT color="green">224</FONT>            sumY = 0d;<a name="line.224"></a>
+<FONT color="green">225</FONT>            sumYY = 0d;<a name="line.225"></a>
+<FONT color="green">226</FONT>            sumXY = 0d;<a name="line.226"></a>
+<FONT color="green">227</FONT>            n = 0;<a name="line.227"></a>
+<FONT color="green">228</FONT>        }<a name="line.228"></a>
+<FONT color="green">229</FONT>    <a name="line.229"></a>
+<FONT color="green">230</FONT>        /**<a name="line.230"></a>
+<FONT color="green">231</FONT>         * Returns the number of observations that have been added to the model.<a name="line.231"></a>
+<FONT color="green">232</FONT>         *<a name="line.232"></a>
+<FONT color="green">233</FONT>         * @return n number of observations that have been added.<a name="line.233"></a>
+<FONT color="green">234</FONT>         */<a name="line.234"></a>
+<FONT color="green">235</FONT>        public long getN() {<a name="line.235"></a>
+<FONT color="green">236</FONT>            return n;<a name="line.236"></a>
+<FONT color="green">237</FONT>        }<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>        /**<a name="line.239"></a>
+<FONT color="green">240</FONT>         * Returns the "predicted" &lt;code&gt;y&lt;/code&gt; value associated with the<a name="line.240"></a>
+<FONT color="green">241</FONT>         * supplied &lt;code&gt;x&lt;/code&gt; value,  based on the data that has been<a name="line.241"></a>
+<FONT color="green">242</FONT>         * added to the model when this method is activated.<a name="line.242"></a>
+<FONT color="green">243</FONT>         * &lt;p&gt;<a name="line.243"></a>
+<FONT color="green">244</FONT>         * &lt;code&gt; predict(x) = intercept + slope * x &lt;/code&gt;&lt;/p&gt;<a name="line.244"></a>
+<FONT color="green">245</FONT>         * &lt;p&gt;<a name="line.245"></a>
+<FONT color="green">246</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.246"></a>
+<FONT color="green">247</FONT>         * &lt;li&gt;At least two observations (with at least two different x values)<a name="line.247"></a>
+<FONT color="green">248</FONT>         * must have been added before invoking this method. If this method is<a name="line.248"></a>
+<FONT color="green">249</FONT>         * invoked before a model can be estimated, &lt;code&gt;Double,NaN&lt;/code&gt; is<a name="line.249"></a>
+<FONT color="green">250</FONT>         * returned.<a name="line.250"></a>
+<FONT color="green">251</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.251"></a>
+<FONT color="green">252</FONT>         *<a name="line.252"></a>
+<FONT color="green">253</FONT>         * @param x input &lt;code&gt;x&lt;/code&gt; value<a name="line.253"></a>
+<FONT color="green">254</FONT>         * @return predicted &lt;code&gt;y&lt;/code&gt; value<a name="line.254"></a>
+<FONT color="green">255</FONT>         */<a name="line.255"></a>
+<FONT color="green">256</FONT>        public double predict(double x) {<a name="line.256"></a>
+<FONT color="green">257</FONT>            double b1 = getSlope();<a name="line.257"></a>
+<FONT color="green">258</FONT>            return getIntercept(b1) + b1 * x;<a name="line.258"></a>
+<FONT color="green">259</FONT>        }<a name="line.259"></a>
+<FONT color="green">260</FONT>    <a name="line.260"></a>
+<FONT color="green">261</FONT>        /**<a name="line.261"></a>
+<FONT color="green">262</FONT>         * Returns the intercept of the estimated regression line.<a name="line.262"></a>
+<FONT color="green">263</FONT>         * &lt;p&gt;<a name="line.263"></a>
+<FONT color="green">264</FONT>         * The least squares estimate of the intercept is computed using the<a name="line.264"></a>
+<FONT color="green">265</FONT>         * &lt;a href="http://www.xycoon.com/estimation4.htm"&gt;normal equations&lt;/a&gt;.<a name="line.265"></a>
+<FONT color="green">266</FONT>         * The intercept is sometimes denoted b0.&lt;/p&gt;<a name="line.266"></a>
+<FONT color="green">267</FONT>         * &lt;p&gt;<a name="line.267"></a>
+<FONT color="green">268</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.268"></a>
+<FONT color="green">269</FONT>         * &lt;li&gt;At least two observations (with at least two different x values)<a name="line.269"></a>
+<FONT color="green">270</FONT>         * must have been added before invoking this method. If this method is<a name="line.270"></a>
+<FONT color="green">271</FONT>         * invoked before a model can be estimated, &lt;code&gt;Double,NaN&lt;/code&gt; is<a name="line.271"></a>
+<FONT color="green">272</FONT>         * returned.<a name="line.272"></a>
+<FONT color="green">273</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.273"></a>
+<FONT color="green">274</FONT>         *<a name="line.274"></a>
+<FONT color="green">275</FONT>         * @return the intercept of the regression line<a name="line.275"></a>
+<FONT color="green">276</FONT>         */<a name="line.276"></a>
+<FONT color="green">277</FONT>        public double getIntercept() {<a name="line.277"></a>
+<FONT color="green">278</FONT>            return getIntercept(getSlope());<a name="line.278"></a>
+<FONT color="green">279</FONT>        }<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>        /**<a name="line.281"></a>
+<FONT color="green">282</FONT>        * Returns the slope of the estimated regression line.<a name="line.282"></a>
+<FONT color="green">283</FONT>        * &lt;p&gt;<a name="line.283"></a>
+<FONT color="green">284</FONT>        * The least squares estimate of the slope is computed using the<a name="line.284"></a>
+<FONT color="green">285</FONT>        * &lt;a href="http://www.xycoon.com/estimation4.htm"&gt;normal equations&lt;/a&gt;.<a name="line.285"></a>
+<FONT color="green">286</FONT>        * The slope is sometimes denoted b1.&lt;/p&gt;<a name="line.286"></a>
+<FONT color="green">287</FONT>        * &lt;p&gt;<a name="line.287"></a>
+<FONT color="green">288</FONT>        * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.288"></a>
+<FONT color="green">289</FONT>        * &lt;li&gt;At least two observations (with at least two different x values)<a name="line.289"></a>
+<FONT color="green">290</FONT>        * must have been added before invoking this method. If this method is<a name="line.290"></a>
+<FONT color="green">291</FONT>        * invoked before a model can be estimated, &lt;code&gt;Double.NaN&lt;/code&gt; is<a name="line.291"></a>
+<FONT color="green">292</FONT>        * returned.<a name="line.292"></a>
+<FONT color="green">293</FONT>        * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.293"></a>
+<FONT color="green">294</FONT>        *<a name="line.294"></a>
+<FONT color="green">295</FONT>        * @return the slope of the regression line<a name="line.295"></a>
+<FONT color="green">296</FONT>        */<a name="line.296"></a>
+<FONT color="green">297</FONT>        public double getSlope() {<a name="line.297"></a>
+<FONT color="green">298</FONT>            if (n &lt; 2) {<a name="line.298"></a>
+<FONT color="green">299</FONT>                return Double.NaN; //not enough data<a name="line.299"></a>
+<FONT color="green">300</FONT>            }<a name="line.300"></a>
+<FONT color="green">301</FONT>            if (Math.abs(sumXX) &lt; 10 * Double.MIN_VALUE) {<a name="line.301"></a>
+<FONT color="green">302</FONT>                return Double.NaN; //not enough variation in x<a name="line.302"></a>
+<FONT color="green">303</FONT>            }<a name="line.303"></a>
+<FONT color="green">304</FONT>            return sumXY / sumXX;<a name="line.304"></a>
+<FONT color="green">305</FONT>        }<a name="line.305"></a>
+<FONT color="green">306</FONT>    <a name="line.306"></a>
+<FONT color="green">307</FONT>        /**<a name="line.307"></a>
+<FONT color="green">308</FONT>         * Returns the &lt;a href="http://www.xycoon.com/SumOfSquares.htm"&gt;<a name="line.308"></a>
+<FONT color="green">309</FONT>         * sum of squared errors&lt;/a&gt; (SSE) associated with the regression<a name="line.309"></a>
+<FONT color="green">310</FONT>         * model.<a name="line.310"></a>
+<FONT color="green">311</FONT>         * &lt;p&gt;<a name="line.311"></a>
+<FONT color="green">312</FONT>         * The sum is computed using the computational formula&lt;/p&gt;<a name="line.312"></a>
+<FONT color="green">313</FONT>         * &lt;p&gt;<a name="line.313"></a>
+<FONT color="green">314</FONT>         * &lt;code&gt;SSE = SYY - (SXY * SXY / SXX)&lt;/code&gt;&lt;/p&gt;<a name="line.314"></a>
+<FONT color="green">315</FONT>         * &lt;p&gt;<a name="line.315"></a>
+<FONT color="green">316</FONT>         * where &lt;code&gt;SYY&lt;/code&gt; is the sum of the squared deviations of the y<a name="line.316"></a>
+<FONT color="green">317</FONT>         * values about their mean, &lt;code&gt;SXX&lt;/code&gt; is similarly defined and<a name="line.317"></a>
+<FONT color="green">318</FONT>         * &lt;code&gt;SXY&lt;/code&gt; is the sum of the products of x and y mean deviations.<a name="line.318"></a>
+<FONT color="green">319</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.319"></a>
+<FONT color="green">320</FONT>         * The sums are accumulated using the updating algorithm referenced in<a name="line.320"></a>
+<FONT color="green">321</FONT>         * {@link #addData}.&lt;/p&gt;<a name="line.321"></a>
+<FONT color="green">322</FONT>         * &lt;p&gt;<a name="line.322"></a>
+<FONT color="green">323</FONT>         * The return value is constrained to be non-negative - i.e., if due to<a name="line.323"></a>
+<FONT color="green">324</FONT>         * rounding errors the computational formula returns a negative result,<a name="line.324"></a>
+<FONT color="green">325</FONT>         * 0 is returned.&lt;/p&gt;<a name="line.325"></a>
+<FONT color="green">326</FONT>         * &lt;p&gt;<a name="line.326"></a>
+<FONT color="green">327</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.327"></a>
+<FONT color="green">328</FONT>         * &lt;li&gt;At least two observations (with at least two different x values)<a name="line.328"></a>
+<FONT color="green">329</FONT>         * must have been added before invoking this method. If this method is<a name="line.329"></a>
+<FONT color="green">330</FONT>         * invoked before a model can be estimated, &lt;code&gt;Double,NaN&lt;/code&gt; is<a name="line.330"></a>
+<FONT color="green">331</FONT>         * returned.<a name="line.331"></a>
+<FONT color="green">332</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.332"></a>
+<FONT color="green">333</FONT>         *<a name="line.333"></a>
+<FONT color="green">334</FONT>         * @return sum of squared errors associated with the regression model<a name="line.334"></a>
+<FONT color="green">335</FONT>         */<a name="line.335"></a>
+<FONT color="green">336</FONT>        public double getSumSquaredErrors() {<a name="line.336"></a>
+<FONT color="green">337</FONT>            return Math.max(0d, sumYY - sumXY * sumXY / sumXX);<a name="line.337"></a>
+<FONT color="green">338</FONT>        }<a name="line.338"></a>
+<FONT color="green">339</FONT>    <a name="line.339"></a>
+<FONT color="green">340</FONT>        /**<a name="line.340"></a>
+<FONT color="green">341</FONT>         * Returns the sum of squared deviations of the y values about their mean.<a name="line.341"></a>
+<FONT color="green">342</FONT>         * &lt;p&gt;<a name="line.342"></a>
+<FONT color="green">343</FONT>         * This is defined as SSTO<a name="line.343"></a>
+<FONT color="green">344</FONT>         * &lt;a href="http://www.xycoon.com/SumOfSquares.htm"&gt;here&lt;/a&gt;.&lt;/p&gt;<a name="line.344"></a>
+<FONT color="green">345</FONT>         * &lt;p&gt;<a name="line.345"></a>
+<FONT color="green">346</FONT>         * If &lt;code&gt;n &lt; 2&lt;/code&gt;, this returns &lt;code&gt;Double.NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.346"></a>
+<FONT color="green">347</FONT>         *<a name="line.347"></a>
+<FONT color="green">348</FONT>         * @return sum of squared deviations of y values<a name="line.348"></a>
+<FONT color="green">349</FONT>         */<a name="line.349"></a>
+<FONT color="green">350</FONT>        public double getTotalSumSquares() {<a name="line.350"></a>
+<FONT color="green">351</FONT>            if (n &lt; 2) {<a name="line.351"></a>
+<FONT color="green">352</FONT>                return Double.NaN;<a name="line.352"></a>
+<FONT color="green">353</FONT>            }<a name="line.353"></a>
+<FONT color="green">354</FONT>            return sumYY;<a name="line.354"></a>
+<FONT color="green">355</FONT>        }<a name="line.355"></a>
+<FONT color="green">356</FONT>    <a name="line.356"></a>
+<FONT color="green">357</FONT>        /**<a name="line.357"></a>
+<FONT color="green">358</FONT>         * Returns the sum of squared deviations of the x values about their mean.<a name="line.358"></a>
+<FONT color="green">359</FONT>         *<a name="line.359"></a>
+<FONT color="green">360</FONT>         * If &lt;code&gt;n &lt; 2&lt;/code&gt;, this returns &lt;code&gt;Double.NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.360"></a>
+<FONT color="green">361</FONT>         *<a name="line.361"></a>
+<FONT color="green">362</FONT>         * @return sum of squared deviations of x values<a name="line.362"></a>
+<FONT color="green">363</FONT>         */<a name="line.363"></a>
+<FONT color="green">364</FONT>        public double getXSumSquares() {<a name="line.364"></a>
+<FONT color="green">365</FONT>            if (n &lt; 2) {<a name="line.365"></a>
+<FONT color="green">366</FONT>                return Double.NaN;<a name="line.366"></a>
+<FONT color="green">367</FONT>            }<a name="line.367"></a>
+<FONT color="green">368</FONT>            return sumXX;<a name="line.368"></a>
+<FONT color="green">369</FONT>        }<a name="line.369"></a>
+<FONT color="green">370</FONT>    <a name="line.370"></a>
+<FONT color="green">371</FONT>        /**<a name="line.371"></a>
+<FONT color="green">372</FONT>         * Returns the sum of crossproducts, x&lt;sub&gt;i&lt;/sub&gt;*y&lt;sub&gt;i&lt;/sub&gt;.<a name="line.372"></a>
+<FONT color="green">373</FONT>         *<a name="line.373"></a>
+<FONT color="green">374</FONT>         * @return sum of cross products<a name="line.374"></a>
+<FONT color="green">375</FONT>         */<a name="line.375"></a>
+<FONT color="green">376</FONT>        public double getSumOfCrossProducts() {<a name="line.376"></a>
+<FONT color="green">377</FONT>            return sumXY;<a name="line.377"></a>
+<FONT color="green">378</FONT>        }<a name="line.378"></a>
+<FONT color="green">379</FONT>    <a name="line.379"></a>
+<FONT color="green">380</FONT>        /**<a name="line.380"></a>
+<FONT color="green">381</FONT>         * Returns the sum of squared deviations of the predicted y values about<a name="line.381"></a>
+<FONT color="green">382</FONT>         * their mean (which equals the mean of y).<a name="line.382"></a>
+<FONT color="green">383</FONT>         * &lt;p&gt;<a name="line.383"></a>
+<FONT color="green">384</FONT>         * This is usually abbreviated SSR or SSM.  It is defined as SSM<a name="line.384"></a>
+<FONT color="green">385</FONT>         * &lt;a href="http://www.xycoon.com/SumOfSquares.htm"&gt;here&lt;/a&gt;&lt;/p&gt;<a name="line.385"></a>
+<FONT color="green">386</FONT>         * &lt;p&gt;<a name="line.386"></a>
+<FONT color="green">387</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.387"></a>
+<FONT color="green">388</FONT>         * &lt;li&gt;At least two observations (with at least two different x values)<a name="line.388"></a>
+<FONT color="green">389</FONT>         * must have been added before invoking this method. If this method is<a name="line.389"></a>
+<FONT color="green">390</FONT>         * invoked before a model can be estimated, &lt;code&gt;Double.NaN&lt;/code&gt; is<a name="line.390"></a>
+<FONT color="green">391</FONT>         * returned.<a name="line.391"></a>
+<FONT color="green">392</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.392"></a>
+<FONT color="green">393</FONT>         *<a name="line.393"></a>
+<FONT color="green">394</FONT>         * @return sum of squared deviations of predicted y values<a name="line.394"></a>
+<FONT color="green">395</FONT>         */<a name="line.395"></a>
+<FONT color="green">396</FONT>        public double getRegressionSumSquares() {<a name="line.396"></a>
+<FONT color="green">397</FONT>            return getRegressionSumSquares(getSlope());<a name="line.397"></a>
+<FONT color="green">398</FONT>        }<a name="line.398"></a>
+<FONT color="green">399</FONT>    <a name="line.399"></a>
+<FONT color="green">400</FONT>        /**<a name="line.400"></a>
+<FONT color="green">401</FONT>         * Returns the sum of squared errors divided by the degrees of freedom,<a name="line.401"></a>
+<FONT color="green">402</FONT>         * usually abbreviated MSE.<a name="line.402"></a>
+<FONT color="green">403</FONT>         * &lt;p&gt;<a name="line.403"></a>
+<FONT color="green">404</FONT>         * If there are fewer than &lt;strong&gt;three&lt;/strong&gt; data pairs in the model,<a name="line.404"></a>
+<FONT color="green">405</FONT>         * or if there is no variation in &lt;code&gt;x&lt;/code&gt;, this returns<a name="line.405"></a>
+<FONT color="green">406</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.406"></a>
+<FONT color="green">407</FONT>         *<a name="line.407"></a>
+<FONT color="green">408</FONT>         * @return sum of squared deviations of y values<a name="line.408"></a>
+<FONT color="green">409</FONT>         */<a name="line.409"></a>
+<FONT color="green">410</FONT>        public double getMeanSquareError() {<a name="line.410"></a>
+<FONT color="green">411</FONT>            if (n &lt; 3) {<a name="line.411"></a>
+<FONT color="green">412</FONT>                return Double.NaN;<a name="line.412"></a>
+<FONT color="green">413</FONT>            }<a name="line.413"></a>
+<FONT color="green">414</FONT>            return getSumSquaredErrors() / (n - 2);<a name="line.414"></a>
+<FONT color="green">415</FONT>        }<a name="line.415"></a>
+<FONT color="green">416</FONT>    <a name="line.416"></a>
+<FONT color="green">417</FONT>        /**<a name="line.417"></a>
+<FONT color="green">418</FONT>         * Returns &lt;a href="http://mathworld.wolfram.com/CorrelationCoefficient.html"&gt;<a name="line.418"></a>
+<FONT color="green">419</FONT>         * Pearson's product moment correlation coefficient&lt;/a&gt;,<a name="line.419"></a>
+<FONT color="green">420</FONT>         * usually denoted r.<a name="line.420"></a>
+<FONT color="green">421</FONT>         * &lt;p&gt;<a name="line.421"></a>
+<FONT color="green">422</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.422"></a>
+<FONT color="green">423</FONT>         * &lt;li&gt;At least two observations (with at least two different x values)<a name="line.423"></a>
+<FONT color="green">424</FONT>         * must have been added before invoking this method. If this method is<a name="line.424"></a>
+<FONT color="green">425</FONT>         * invoked before a model can be estimated, &lt;code&gt;Double,NaN&lt;/code&gt; is<a name="line.425"></a>
+<FONT color="green">426</FONT>         * returned.<a name="line.426"></a>
+<FONT color="green">427</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.427"></a>
+<FONT color="green">428</FONT>         *<a name="line.428"></a>
+<FONT color="green">429</FONT>         * @return Pearson's r<a name="line.429"></a>
+<FONT color="green">430</FONT>         */<a name="line.430"></a>
+<FONT color="green">431</FONT>        public double getR() {<a name="line.431"></a>
+<FONT color="green">432</FONT>            double b1 = getSlope();<a name="line.432"></a>
+<FONT color="green">433</FONT>            double result = Math.sqrt(getRSquare());<a name="line.433"></a>
+<FONT color="green">434</FONT>            if (b1 &lt; 0) {<a name="line.434"></a>
+<FONT color="green">435</FONT>                result = -result;<a name="line.435"></a>
+<FONT color="green">436</FONT>            }<a name="line.436"></a>
+<FONT color="green">437</FONT>            return result;<a name="line.437"></a>
+<FONT color="green">438</FONT>        }<a name="line.438"></a>
+<FONT color="green">439</FONT>    <a name="line.439"></a>
+<FONT color="green">440</FONT>        /**<a name="line.440"></a>
+<FONT color="green">441</FONT>         * Returns the &lt;a href="http://www.xycoon.com/coefficient1.htm"&gt;<a name="line.441"></a>
+<FONT color="green">442</FONT>         * coefficient of determination&lt;/a&gt;,<a name="line.442"></a>
+<FONT color="green">443</FONT>         * usually denoted r-square.<a name="line.443"></a>
+<FONT color="green">444</FONT>         * &lt;p&gt;<a name="line.444"></a>
+<FONT color="green">445</FONT>         * &lt;strong&gt;Preconditions&lt;/strong&gt;: &lt;ul&gt;<a name="line.445"></a>
+<FONT color="green">446</FONT>         * &lt;li&gt;At least two observations (with at least two different x values)<a name="line.446"></a>
+<FONT color="green">447</FONT>         * must have been added before invoking this method. If this method is<a name="line.447"></a>
+<FONT color="green">448</FONT>         * invoked before a model can be estimated, &lt;code&gt;Double,NaN&lt;/code&gt; is<a name="line.448"></a>
+<FONT color="green">449</FONT>         * returned.<a name="line.449"></a>
+<FONT color="green">450</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.450"></a>
+<FONT color="green">451</FONT>         *<a name="line.451"></a>
+<FONT color="green">452</FONT>         * @return r-square<a name="line.452"></a>
+<FONT color="green">453</FONT>         */<a name="line.453"></a>
+<FONT color="green">454</FONT>        public double getRSquare() {<a name="line.454"></a>
+<FONT color="green">455</FONT>            double ssto = getTotalSumSquares();<a name="line.455"></a>
+<FONT color="green">456</FONT>            return (ssto - getSumSquaredErrors()) / ssto;<a name="line.456"></a>
+<FONT color="green">457</FONT>        }<a name="line.457"></a>
+<FONT color="green">458</FONT>    <a name="line.458"></a>
+<FONT color="green">459</FONT>        /**<a name="line.459"></a>
+<FONT color="green">460</FONT>         * Returns the &lt;a href="http://www.xycoon.com/standarderrorb0.htm"&gt;<a name="line.460"></a>
+<FONT color="green">461</FONT>         * standard error of the intercept estimate&lt;/a&gt;,<a name="line.461"></a>
+<FONT color="green">462</FONT>         * usually denoted s(b0).<a name="line.462"></a>
+<FONT color="green">463</FONT>         * &lt;p&gt;<a name="line.463"></a>
+<FONT color="green">464</FONT>         * If there are fewer that &lt;strong&gt;three&lt;/strong&gt; observations in the<a name="line.464"></a>
+<FONT color="green">465</FONT>         * model, or if there is no variation in x, this returns<a name="line.465"></a>
+<FONT color="green">466</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.466"></a>
+<FONT color="green">467</FONT>         *<a name="line.467"></a>
+<FONT color="green">468</FONT>         * @return standard error associated with intercept estimate<a name="line.468"></a>
+<FONT color="green">469</FONT>         */<a name="line.469"></a>
+<FONT color="green">470</FONT>        public double getInterceptStdErr() {<a name="line.470"></a>
+<FONT color="green">471</FONT>            return Math.sqrt(<a name="line.471"></a>
+<FONT color="green">472</FONT>                getMeanSquareError() * ((1d / (double) n) + (xbar * xbar) / sumXX));<a name="line.472"></a>
+<FONT color="green">473</FONT>        }<a name="line.473"></a>
+<FONT color="green">474</FONT>    <a name="line.474"></a>
+<FONT color="green">475</FONT>        /**<a name="line.475"></a>
+<FONT color="green">476</FONT>         * Returns the &lt;a href="http://www.xycoon.com/standerrorb(1).htm"&gt;standard<a name="line.476"></a>
+<FONT color="green">477</FONT>         * error of the slope estimate&lt;/a&gt;,<a name="line.477"></a>
+<FONT color="green">478</FONT>         * usually denoted s(b1).<a name="line.478"></a>
+<FONT color="green">479</FONT>         * &lt;p&gt;<a name="line.479"></a>
+<FONT color="green">480</FONT>         * If there are fewer that &lt;strong&gt;three&lt;/strong&gt; data pairs in the model,<a name="line.480"></a>
+<FONT color="green">481</FONT>         * or if there is no variation in x, this returns &lt;code&gt;Double.NaN&lt;/code&gt;.<a name="line.481"></a>
+<FONT color="green">482</FONT>         * &lt;/p&gt;<a name="line.482"></a>
+<FONT color="green">483</FONT>         *<a name="line.483"></a>
+<FONT color="green">484</FONT>         * @return standard error associated with slope estimate<a name="line.484"></a>
+<FONT color="green">485</FONT>         */<a name="line.485"></a>
+<FONT color="green">486</FONT>        public double getSlopeStdErr() {<a name="line.486"></a>
+<FONT color="green">487</FONT>            return Math.sqrt(getMeanSquareError() / sumXX);<a name="line.487"></a>
+<FONT color="green">488</FONT>        }<a name="line.488"></a>
+<FONT color="green">489</FONT>    <a name="line.489"></a>
+<FONT color="green">490</FONT>        /**<a name="line.490"></a>
+<FONT color="green">491</FONT>         * Returns the half-width of a 95% confidence interval for the slope<a name="line.491"></a>
+<FONT color="green">492</FONT>         * estimate.<a name="line.492"></a>
+<FONT color="green">493</FONT>         * &lt;p&gt;<a name="line.493"></a>
+<FONT color="green">494</FONT>         * The 95% confidence interval is&lt;/p&gt;<a name="line.494"></a>
+<FONT color="green">495</FONT>         * &lt;p&gt;<a name="line.495"></a>
+<FONT color="green">496</FONT>         * &lt;code&gt;(getSlope() - getSlopeConfidenceInterval(),<a name="line.496"></a>
+<FONT color="green">497</FONT>         * getSlope() + getSlopeConfidenceInterval())&lt;/code&gt;&lt;/p&gt;<a name="line.497"></a>
+<FONT color="green">498</FONT>         * &lt;p&gt;<a name="line.498"></a>
+<FONT color="green">499</FONT>         * If there are fewer that &lt;strong&gt;three&lt;/strong&gt; observations in the<a name="line.499"></a>
+<FONT color="green">500</FONT>         * model, or if there is no variation in x, this returns<a name="line.500"></a>
+<FONT color="green">501</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.501"></a>
+<FONT color="green">502</FONT>         * &lt;p&gt;<a name="line.502"></a>
+<FONT color="green">503</FONT>         * &lt;strong&gt;Usage Note&lt;/strong&gt;:&lt;br&gt;<a name="line.503"></a>
+<FONT color="green">504</FONT>         * The validity of this statistic depends on the assumption that the<a name="line.504"></a>
+<FONT color="green">505</FONT>         * observations included in the model are drawn from a<a name="line.505"></a>
+<FONT color="green">506</FONT>         * &lt;a href="http://mathworld.wolfram.com/BivariateNormalDistribution.html"&gt;<a name="line.506"></a>
+<FONT color="green">507</FONT>         * Bivariate Normal Distribution&lt;/a&gt;.&lt;/p&gt;<a name="line.507"></a>
+<FONT color="green">508</FONT>         *<a name="line.508"></a>
+<FONT color="green">509</FONT>         * @return half-width of 95% confidence interval for the slope estimate<a name="line.509"></a>
+<FONT color="green">510</FONT>         * @throws MathException if the confidence interval can not be computed.<a name="line.510"></a>
+<FONT color="green">511</FONT>         */<a name="line.511"></a>
+<FONT color="green">512</FONT>        public double getSlopeConfidenceInterval() throws MathException {<a name="line.512"></a>
+<FONT color="green">513</FONT>            return getSlopeConfidenceInterval(0.05d);<a name="line.513"></a>
+<FONT color="green">514</FONT>        }<a name="line.514"></a>
+<FONT color="green">515</FONT>    <a name="line.515"></a>
+<FONT color="green">516</FONT>        /**<a name="line.516"></a>
+<FONT color="green">517</FONT>         * Returns the half-width of a (100-100*alpha)% confidence interval for<a name="line.517"></a>
+<FONT color="green">518</FONT>         * the slope estimate.<a name="line.518"></a>
+<FONT color="green">519</FONT>         * &lt;p&gt;<a name="line.519"></a>
+<FONT color="green">520</FONT>         * The (100-100*alpha)% confidence interval is &lt;/p&gt;<a name="line.520"></a>
+<FONT color="green">521</FONT>         * &lt;p&gt;<a name="line.521"></a>
+<FONT color="green">522</FONT>         * &lt;code&gt;(getSlope() - getSlopeConfidenceInterval(),<a name="line.522"></a>
+<FONT color="green">523</FONT>         * getSlope() + getSlopeConfidenceInterval())&lt;/code&gt;&lt;/p&gt;<a name="line.523"></a>
+<FONT color="green">524</FONT>         * &lt;p&gt;<a name="line.524"></a>
+<FONT color="green">525</FONT>         * To request, for example, a 99% confidence interval, use<a name="line.525"></a>
+<FONT color="green">526</FONT>         * &lt;code&gt;alpha = .01&lt;/code&gt;&lt;/p&gt;<a name="line.526"></a>
+<FONT color="green">527</FONT>         * &lt;p&gt;<a name="line.527"></a>
+<FONT color="green">528</FONT>         * &lt;strong&gt;Usage Note&lt;/strong&gt;:&lt;br&gt;<a name="line.528"></a>
+<FONT color="green">529</FONT>         * The validity of this statistic depends on the assumption that the<a name="line.529"></a>
+<FONT color="green">530</FONT>         * observations included in the model are drawn from a<a name="line.530"></a>
+<FONT color="green">531</FONT>         * &lt;a href="http://mathworld.wolfram.com/BivariateNormalDistribution.html"&gt;<a name="line.531"></a>
+<FONT color="green">532</FONT>         * Bivariate Normal Distribution&lt;/a&gt;.&lt;/p&gt;<a name="line.532"></a>
+<FONT color="green">533</FONT>         * &lt;p&gt;<a name="line.533"></a>
+<FONT color="green">534</FONT>         * &lt;strong&gt; Preconditions:&lt;/strong&gt;&lt;ul&gt;<a name="line.534"></a>
+<FONT color="green">535</FONT>         * &lt;li&gt;If there are fewer that &lt;strong&gt;three&lt;/strong&gt; observations in the<a name="line.535"></a>
+<FONT color="green">536</FONT>         * model, or if there is no variation in x, this returns<a name="line.536"></a>
+<FONT color="green">537</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt;.<a name="line.537"></a>
+<FONT color="green">538</FONT>         * &lt;/li&gt;<a name="line.538"></a>
+<FONT color="green">539</FONT>         * &lt;li&gt;&lt;code&gt;(0 &lt; alpha &lt; 1)&lt;/code&gt;; otherwise an<a name="line.539"></a>
+<FONT color="green">540</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown.<a name="line.540"></a>
+<FONT color="green">541</FONT>         * &lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;<a name="line.541"></a>
+<FONT color="green">542</FONT>         *<a name="line.542"></a>
+<FONT color="green">543</FONT>         * @param alpha the desired significance level<a name="line.543"></a>
+<FONT color="green">544</FONT>         * @return half-width of 95% confidence interval for the slope estimate<a name="line.544"></a>
+<FONT color="green">545</FONT>         * @throws MathException if the confidence interval can not be computed.<a name="line.545"></a>
+<FONT color="green">546</FONT>         */<a name="line.546"></a>
+<FONT color="green">547</FONT>        public double getSlopeConfidenceInterval(double alpha)<a name="line.547"></a>
+<FONT color="green">548</FONT>            throws MathException {<a name="line.548"></a>
+<FONT color="green">549</FONT>            if (alpha &gt;= 1 || alpha &lt;= 0) {<a name="line.549"></a>
+<FONT color="green">550</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.550"></a>
+<FONT color="green">551</FONT>                      "out of bounds significance level {0}, must be between {1} and {2}",<a name="line.551"></a>
+<FONT color="green">552</FONT>                      alpha, 0.0, 1.0);<a name="line.552"></a>
+<FONT color="green">553</FONT>            }<a name="line.553"></a>
+<FONT color="green">554</FONT>            return getSlopeStdErr() *<a name="line.554"></a>
+<FONT color="green">555</FONT>                distribution.inverseCumulativeProbability(1d - alpha / 2d);<a name="line.555"></a>
+<FONT color="green">556</FONT>        }<a name="line.556"></a>
+<FONT color="green">557</FONT>    <a name="line.557"></a>
+<FONT color="green">558</FONT>        /**<a name="line.558"></a>
+<FONT color="green">559</FONT>         * Returns the significance level of the slope (equiv) correlation.<a name="line.559"></a>
+<FONT color="green">560</FONT>         * &lt;p&gt;<a name="line.560"></a>
+<FONT color="green">561</FONT>         * Specifically, the returned value is the smallest &lt;code&gt;alpha&lt;/code&gt;<a name="line.561"></a>
+<FONT color="green">562</FONT>         * such that the slope confidence interval with significance level<a name="line.562"></a>
+<FONT color="green">563</FONT>         * equal to &lt;code&gt;alpha&lt;/code&gt; does not include &lt;code&gt;0&lt;/code&gt;.<a name="line.563"></a>
+<FONT color="green">564</FONT>         * On regression output, this is often denoted &lt;code&gt;Prob(|t| &gt; 0)&lt;/code&gt;<a name="line.564"></a>
+<FONT color="green">565</FONT>         * &lt;/p&gt;&lt;p&gt;<a name="line.565"></a>
+<FONT color="green">566</FONT>         * &lt;strong&gt;Usage Note&lt;/strong&gt;:&lt;br&gt;<a name="line.566"></a>
+<FONT color="green">567</FONT>         * The validity of this statistic depends on the assumption that the<a name="line.567"></a>
+<FONT color="green">568</FONT>         * observations included in the model are drawn from a<a name="line.568"></a>
+<FONT color="green">569</FONT>         * &lt;a href="http://mathworld.wolfram.com/BivariateNormalDistribution.html"&gt;<a name="line.569"></a>
+<FONT color="green">570</FONT>         * Bivariate Normal Distribution&lt;/a&gt;.&lt;/p&gt;<a name="line.570"></a>
+<FONT color="green">571</FONT>         * &lt;p&gt;<a name="line.571"></a>
+<FONT color="green">572</FONT>         * If there are fewer that &lt;strong&gt;three&lt;/strong&gt; observations in the<a name="line.572"></a>
+<FONT color="green">573</FONT>         * model, or if there is no variation in x, this returns<a name="line.573"></a>
+<FONT color="green">574</FONT>         * &lt;code&gt;Double.NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.574"></a>
+<FONT color="green">575</FONT>         *<a name="line.575"></a>
+<FONT color="green">576</FONT>         * @return significance level for slope/correlation<a name="line.576"></a>
+<FONT color="green">577</FONT>         * @throws MathException if the significance level can not be computed.<a name="line.577"></a>
+<FONT color="green">578</FONT>         */<a name="line.578"></a>
+<FONT color="green">579</FONT>        public double getSignificance() throws MathException {<a name="line.579"></a>
+<FONT color="green">580</FONT>            return 2d * (1.0 - distribution.cumulativeProbability(<a name="line.580"></a>
+<FONT color="green">581</FONT>                        Math.abs(getSlope()) / getSlopeStdErr()));<a name="line.581"></a>
+<FONT color="green">582</FONT>        }<a name="line.582"></a>
+<FONT color="green">583</FONT>    <a name="line.583"></a>
+<FONT color="green">584</FONT>        // ---------------------Private methods-----------------------------------<a name="line.584"></a>
+<FONT color="green">585</FONT>    <a name="line.585"></a>
+<FONT color="green">586</FONT>        /**<a name="line.586"></a>
+<FONT color="green">587</FONT>        * Returns the intercept of the estimated regression line, given the slope.<a name="line.587"></a>
+<FONT color="green">588</FONT>        * &lt;p&gt;<a name="line.588"></a>
+<FONT color="green">589</FONT>        * Will return &lt;code&gt;NaN&lt;/code&gt; if slope is &lt;code&gt;NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.589"></a>
+<FONT color="green">590</FONT>        *<a name="line.590"></a>
+<FONT color="green">591</FONT>        * @param slope current slope<a name="line.591"></a>
+<FONT color="green">592</FONT>        * @return the intercept of the regression line<a name="line.592"></a>
+<FONT color="green">593</FONT>        */<a name="line.593"></a>
+<FONT color="green">594</FONT>        private double getIntercept(double slope) {<a name="line.594"></a>
+<FONT color="green">595</FONT>            return (sumY - slope * sumX) / n;<a name="line.595"></a>
+<FONT color="green">596</FONT>        }<a name="line.596"></a>
+<FONT color="green">597</FONT>    <a name="line.597"></a>
+<FONT color="green">598</FONT>        /**<a name="line.598"></a>
+<FONT color="green">599</FONT>         * Computes SSR from b1.<a name="line.599"></a>
+<FONT color="green">600</FONT>         *<a name="line.600"></a>
+<FONT color="green">601</FONT>         * @param slope regression slope estimate<a name="line.601"></a>
+<FONT color="green">602</FONT>         * @return sum of squared deviations of predicted y values<a name="line.602"></a>
+<FONT color="green">603</FONT>         */<a name="line.603"></a>
+<FONT color="green">604</FONT>        private double getRegressionSumSquares(double slope) {<a name="line.604"></a>
+<FONT color="green">605</FONT>            return slope * slope * sumXX;<a name="line.605"></a>
+<FONT color="green">606</FONT>        }<a name="line.606"></a>
+<FONT color="green">607</FONT>    <a name="line.607"></a>
+<FONT color="green">608</FONT>        /**<a name="line.608"></a>
+<FONT color="green">609</FONT>         * Modify the distribution used to compute inference statistics.<a name="line.609"></a>
+<FONT color="green">610</FONT>         * @param value the new distribution<a name="line.610"></a>
+<FONT color="green">611</FONT>         * @since 1.2<a name="line.611"></a>
+<FONT color="green">612</FONT>         */<a name="line.612"></a>
+<FONT color="green">613</FONT>        public void setDistribution(TDistribution value) {<a name="line.613"></a>
+<FONT color="green">614</FONT>            distribution = value;<a name="line.614"></a>
+<FONT color="green">615</FONT>    <a name="line.615"></a>
+<FONT color="green">616</FONT>            // modify degrees of freedom<a name="line.616"></a>
+<FONT color="green">617</FONT>            if (n &gt; 2) {<a name="line.617"></a>
+<FONT color="green">618</FONT>                distribution.setDegreesOfFreedom(n - 2);<a name="line.618"></a>
+<FONT color="green">619</FONT>            }<a name="line.619"></a>
+<FONT color="green">620</FONT>        }<a name="line.620"></a>
+<FONT color="green">621</FONT>    }<a name="line.621"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/transform/FastCosineTransformer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,328 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.transform;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.complex.Complex;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Implements the &lt;a href="http://documents.wolfram.com/v5/Add-onsLinks/<a name="line.25"></a>
+<FONT color="green">026</FONT>     * StandardPackages/LinearAlgebra/FourierTrig.html"&gt;Fast Cosine Transform&lt;/a&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * for transformation of one-dimensional data sets. For reference, see<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;b&gt;Fast Fourier Transforms&lt;/b&gt;, ISBN 0849371635, chapter 3.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * FCT is its own inverse, up to a multiplier depending on conventions.<a name="line.30"></a>
+<FONT color="green">031</FONT>     * The equations are listed in the comments of the corresponding methods.&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * Different from FFT and FST, FCT requires the length of data set to be<a name="line.33"></a>
+<FONT color="green">034</FONT>     * power of 2 plus one. Users should especially pay attention to the<a name="line.34"></a>
+<FONT color="green">035</FONT>     * function transformation on how this affects the sampling.&lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;p&gt;As of version 2.0 this no longer implements Serializable&lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @version $Revision:670469 $ $Date:2008-06-23 10:01:38 +0200 (lun., 23 juin 2008) $<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @since 1.2<a name="line.39"></a>
+<FONT color="green">040</FONT>     */<a name="line.40"></a>
+<FONT color="green">041</FONT>    public class FastCosineTransformer implements RealTransformer {<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /**<a name="line.43"></a>
+<FONT color="green">044</FONT>         * Construct a default transformer.<a name="line.44"></a>
+<FONT color="green">045</FONT>         */<a name="line.45"></a>
+<FONT color="green">046</FONT>        public FastCosineTransformer() {<a name="line.46"></a>
+<FONT color="green">047</FONT>            super();<a name="line.47"></a>
+<FONT color="green">048</FONT>        }<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Transform the given real data set.<a name="line.51"></a>
+<FONT color="green">052</FONT>         * &lt;p&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>         * The formula is F&lt;sub&gt;n&lt;/sub&gt; = (1/2) [f&lt;sub&gt;0&lt;/sub&gt; + (-1)&lt;sup&gt;n&lt;/sup&gt; f&lt;sub&gt;N&lt;/sub&gt;] +<a name="line.53"></a>
+<FONT color="green">054</FONT>         *                        &amp;sum;&lt;sub&gt;k=1&lt;/sub&gt;&lt;sup&gt;N-1&lt;/sup&gt; f&lt;sub&gt;k&lt;/sub&gt; cos(&amp;pi; nk/N)<a name="line.54"></a>
+<FONT color="green">055</FONT>         * &lt;/p&gt;<a name="line.55"></a>
+<FONT color="green">056</FONT>         *<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @param f the real data array to be transformed<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @return the real transformed array<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.59"></a>
+<FONT color="green">060</FONT>         */<a name="line.60"></a>
+<FONT color="green">061</FONT>        public double[] transform(double f[]) throws IllegalArgumentException {<a name="line.61"></a>
+<FONT color="green">062</FONT>            return fct(f);<a name="line.62"></a>
+<FONT color="green">063</FONT>        }<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /**<a name="line.65"></a>
+<FONT color="green">066</FONT>         * Transform the given real function, sampled on the given interval.<a name="line.66"></a>
+<FONT color="green">067</FONT>         * &lt;p&gt;<a name="line.67"></a>
+<FONT color="green">068</FONT>         * The formula is F&lt;sub&gt;n&lt;/sub&gt; = (1/2) [f&lt;sub&gt;0&lt;/sub&gt; + (-1)&lt;sup&gt;n&lt;/sup&gt; f&lt;sub&gt;N&lt;/sub&gt;] +<a name="line.68"></a>
+<FONT color="green">069</FONT>         *                        &amp;sum;&lt;sub&gt;k=1&lt;/sub&gt;&lt;sup&gt;N-1&lt;/sup&gt; f&lt;sub&gt;k&lt;/sub&gt; cos(&amp;pi; nk/N)<a name="line.69"></a>
+<FONT color="green">070</FONT>         * &lt;/p&gt;<a name="line.70"></a>
+<FONT color="green">071</FONT>         *<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param f the function to be sampled and transformed<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @param min the lower bound for the interval<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @param max the upper bound for the interval<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @param n the number of sample points<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @return the real transformed array<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @throws FunctionEvaluationException if function cannot be evaluated<a name="line.77"></a>
+<FONT color="green">078</FONT>         * at some point<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.79"></a>
+<FONT color="green">080</FONT>         */<a name="line.80"></a>
+<FONT color="green">081</FONT>        public double[] transform(UnivariateRealFunction f,<a name="line.81"></a>
+<FONT color="green">082</FONT>                                  double min, double max, int n)<a name="line.82"></a>
+<FONT color="green">083</FONT>            throws FunctionEvaluationException, IllegalArgumentException {<a name="line.83"></a>
+<FONT color="green">084</FONT>            double data[] = FastFourierTransformer.sample(f, min, max, n);<a name="line.84"></a>
+<FONT color="green">085</FONT>            return fct(data);<a name="line.85"></a>
+<FONT color="green">086</FONT>        }<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>        /**<a name="line.88"></a>
+<FONT color="green">089</FONT>         * Transform the given real data set.<a name="line.89"></a>
+<FONT color="green">090</FONT>         * &lt;p&gt;<a name="line.90"></a>
+<FONT color="green">091</FONT>         * The formula is F&lt;sub&gt;n&lt;/sub&gt; = &amp;radic;(1/2N) [f&lt;sub&gt;0&lt;/sub&gt; + (-1)&lt;sup&gt;n&lt;/sup&gt; f&lt;sub&gt;N&lt;/sub&gt;] +<a name="line.91"></a>
+<FONT color="green">092</FONT>         *                        &amp;radic;(2/N) &amp;sum;&lt;sub&gt;k=1&lt;/sub&gt;&lt;sup&gt;N-1&lt;/sup&gt; f&lt;sub&gt;k&lt;/sub&gt; cos(&amp;pi; nk/N)<a name="line.92"></a>
+<FONT color="green">093</FONT>         * &lt;/p&gt;<a name="line.93"></a>
+<FONT color="green">094</FONT>         *<a name="line.94"></a>
+<FONT color="green">095</FONT>         * @param f the real data array to be transformed<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @return the real transformed array<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.97"></a>
+<FONT color="green">098</FONT>         */<a name="line.98"></a>
+<FONT color="green">099</FONT>        public double[] transform2(double f[]) throws IllegalArgumentException {<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>            double scaling_coefficient = Math.sqrt(2.0 / (f.length-1));<a name="line.101"></a>
+<FONT color="green">102</FONT>            return FastFourierTransformer.scaleArray(fct(f), scaling_coefficient);<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /**<a name="line.105"></a>
+<FONT color="green">106</FONT>         * Transform the given real function, sampled on the given interval.<a name="line.106"></a>
+<FONT color="green">107</FONT>         * &lt;p&gt;<a name="line.107"></a>
+<FONT color="green">108</FONT>         * The formula is F&lt;sub&gt;n&lt;/sub&gt; = &amp;radic;(1/2N) [f&lt;sub&gt;0&lt;/sub&gt; + (-1)&lt;sup&gt;n&lt;/sup&gt; f&lt;sub&gt;N&lt;/sub&gt;] +<a name="line.108"></a>
+<FONT color="green">109</FONT>         *                        &amp;radic;(2/N) &amp;sum;&lt;sub&gt;k=1&lt;/sub&gt;&lt;sup&gt;N-1&lt;/sup&gt; f&lt;sub&gt;k&lt;/sub&gt; cos(&amp;pi; nk/N)<a name="line.109"></a>
+<FONT color="green">110</FONT>         *<a name="line.110"></a>
+<FONT color="green">111</FONT>         * &lt;/p&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>         *<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param f the function to be sampled and transformed<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param min the lower bound for the interval<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @param max the upper bound for the interval<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @param n the number of sample points<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @return the real transformed array<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @throws FunctionEvaluationException if function cannot be evaluated<a name="line.118"></a>
+<FONT color="green">119</FONT>         * at some point<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.120"></a>
+<FONT color="green">121</FONT>         */<a name="line.121"></a>
+<FONT color="green">122</FONT>        public double[] transform2(UnivariateRealFunction f,<a name="line.122"></a>
+<FONT color="green">123</FONT>                                   double min, double max, int n)<a name="line.123"></a>
+<FONT color="green">124</FONT>            throws FunctionEvaluationException, IllegalArgumentException {<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>            double data[] = FastFourierTransformer.sample(f, min, max, n);<a name="line.126"></a>
+<FONT color="green">127</FONT>            double scaling_coefficient = Math.sqrt(2.0 / (n-1));<a name="line.127"></a>
+<FONT color="green">128</FONT>            return FastFourierTransformer.scaleArray(fct(data), scaling_coefficient);<a name="line.128"></a>
+<FONT color="green">129</FONT>        }<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>        /**<a name="line.131"></a>
+<FONT color="green">132</FONT>         * Inversely transform the given real data set.<a name="line.132"></a>
+<FONT color="green">133</FONT>         * &lt;p&gt;<a name="line.133"></a>
+<FONT color="green">134</FONT>         * The formula is f&lt;sub&gt;k&lt;/sub&gt; = (1/N) [F&lt;sub&gt;0&lt;/sub&gt; + (-1)&lt;sup&gt;k&lt;/sup&gt; F&lt;sub&gt;N&lt;/sub&gt;] +<a name="line.134"></a>
+<FONT color="green">135</FONT>         *                        (2/N) &amp;sum;&lt;sub&gt;n=1&lt;/sub&gt;&lt;sup&gt;N-1&lt;/sup&gt; F&lt;sub&gt;n&lt;/sub&gt; cos(&amp;pi; nk/N)<a name="line.135"></a>
+<FONT color="green">136</FONT>         * &lt;/p&gt;<a name="line.136"></a>
+<FONT color="green">137</FONT>         *<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @param f the real data array to be inversely transformed<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @return the real inversely transformed array<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.140"></a>
+<FONT color="green">141</FONT>         */<a name="line.141"></a>
+<FONT color="green">142</FONT>        public double[] inversetransform(double f[]) throws IllegalArgumentException {<a name="line.142"></a>
+<FONT color="green">143</FONT>    <a name="line.143"></a>
+<FONT color="green">144</FONT>            double scaling_coefficient = 2.0 / (f.length - 1);<a name="line.144"></a>
+<FONT color="green">145</FONT>            return FastFourierTransformer.scaleArray(fct(f), scaling_coefficient);<a name="line.145"></a>
+<FONT color="green">146</FONT>        }<a name="line.146"></a>
+<FONT color="green">147</FONT>    <a name="line.147"></a>
+<FONT color="green">148</FONT>        /**<a name="line.148"></a>
+<FONT color="green">149</FONT>         * Inversely transform the given real function, sampled on the given interval.<a name="line.149"></a>
+<FONT color="green">150</FONT>         * &lt;p&gt;<a name="line.150"></a>
+<FONT color="green">151</FONT>         * The formula is f&lt;sub&gt;k&lt;/sub&gt; = (1/N) [F&lt;sub&gt;0&lt;/sub&gt; + (-1)&lt;sup&gt;k&lt;/sup&gt; F&lt;sub&gt;N&lt;/sub&gt;] +<a name="line.151"></a>
+<FONT color="green">152</FONT>         *                        (2/N) &amp;sum;&lt;sub&gt;n=1&lt;/sub&gt;&lt;sup&gt;N-1&lt;/sup&gt; F&lt;sub&gt;n&lt;/sub&gt; cos(&amp;pi; nk/N)<a name="line.152"></a>
+<FONT color="green">153</FONT>         * &lt;/p&gt;<a name="line.153"></a>
+<FONT color="green">154</FONT>         *<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @param f the function to be sampled and inversely transformed<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @param min the lower bound for the interval<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @param max the upper bound for the interval<a name="line.157"></a>
+<FONT color="green">158</FONT>         * @param n the number of sample points<a name="line.158"></a>
+<FONT color="green">159</FONT>         * @return the real inversely transformed array<a name="line.159"></a>
+<FONT color="green">160</FONT>         * @throws FunctionEvaluationException if function cannot be evaluated<a name="line.160"></a>
+<FONT color="green">161</FONT>         * at some point<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.162"></a>
+<FONT color="green">163</FONT>         */<a name="line.163"></a>
+<FONT color="green">164</FONT>        public double[] inversetransform(UnivariateRealFunction f,<a name="line.164"></a>
+<FONT color="green">165</FONT>                                         double min, double max, int n)<a name="line.165"></a>
+<FONT color="green">166</FONT>            throws FunctionEvaluationException, IllegalArgumentException {<a name="line.166"></a>
+<FONT color="green">167</FONT>    <a name="line.167"></a>
+<FONT color="green">168</FONT>            double data[] = FastFourierTransformer.sample(f, min, max, n);<a name="line.168"></a>
+<FONT color="green">169</FONT>            double scaling_coefficient = 2.0 / (n - 1);<a name="line.169"></a>
+<FONT color="green">170</FONT>            return FastFourierTransformer.scaleArray(fct(data), scaling_coefficient);<a name="line.170"></a>
+<FONT color="green">171</FONT>        }<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>        /**<a name="line.173"></a>
+<FONT color="green">174</FONT>         * Inversely transform the given real data set.<a name="line.174"></a>
+<FONT color="green">175</FONT>         * &lt;p&gt;<a name="line.175"></a>
+<FONT color="green">176</FONT>         * The formula is f&lt;sub&gt;k&lt;/sub&gt; = &amp;radic;(1/2N) [F&lt;sub&gt;0&lt;/sub&gt; + (-1)&lt;sup&gt;k&lt;/sup&gt; F&lt;sub&gt;N&lt;/sub&gt;] +<a name="line.176"></a>
+<FONT color="green">177</FONT>         *                        &amp;radic;(2/N) &amp;sum;&lt;sub&gt;n=1&lt;/sub&gt;&lt;sup&gt;N-1&lt;/sup&gt; F&lt;sub&gt;n&lt;/sub&gt; cos(&amp;pi; nk/N)<a name="line.177"></a>
+<FONT color="green">178</FONT>         * &lt;/p&gt;<a name="line.178"></a>
+<FONT color="green">179</FONT>         *<a name="line.179"></a>
+<FONT color="green">180</FONT>         * @param f the real data array to be inversely transformed<a name="line.180"></a>
+<FONT color="green">181</FONT>         * @return the real inversely transformed array<a name="line.181"></a>
+<FONT color="green">182</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.182"></a>
+<FONT color="green">183</FONT>         */<a name="line.183"></a>
+<FONT color="green">184</FONT>        public double[] inversetransform2(double f[]) throws IllegalArgumentException {<a name="line.184"></a>
+<FONT color="green">185</FONT>            return transform2(f);<a name="line.185"></a>
+<FONT color="green">186</FONT>        }<a name="line.186"></a>
+<FONT color="green">187</FONT>    <a name="line.187"></a>
+<FONT color="green">188</FONT>        /**<a name="line.188"></a>
+<FONT color="green">189</FONT>         * Inversely transform the given real function, sampled on the given interval.<a name="line.189"></a>
+<FONT color="green">190</FONT>         * &lt;p&gt;<a name="line.190"></a>
+<FONT color="green">191</FONT>         * The formula is f&lt;sub&gt;k&lt;/sub&gt; = &amp;radic;(1/2N) [F&lt;sub&gt;0&lt;/sub&gt; + (-1)&lt;sup&gt;k&lt;/sup&gt; F&lt;sub&gt;N&lt;/sub&gt;] +<a name="line.191"></a>
+<FONT color="green">192</FONT>         *                        &amp;radic;(2/N) &amp;sum;&lt;sub&gt;n=1&lt;/sub&gt;&lt;sup&gt;N-1&lt;/sup&gt; F&lt;sub&gt;n&lt;/sub&gt; cos(&amp;pi; nk/N)<a name="line.192"></a>
+<FONT color="green">193</FONT>         * &lt;/p&gt;<a name="line.193"></a>
+<FONT color="green">194</FONT>         *<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @param f the function to be sampled and inversely transformed<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @param min the lower bound for the interval<a name="line.196"></a>
+<FONT color="green">197</FONT>         * @param max the upper bound for the interval<a name="line.197"></a>
+<FONT color="green">198</FONT>         * @param n the number of sample points<a name="line.198"></a>
+<FONT color="green">199</FONT>         * @return the real inversely transformed array<a name="line.199"></a>
+<FONT color="green">200</FONT>         * @throws FunctionEvaluationException if function cannot be evaluated<a name="line.200"></a>
+<FONT color="green">201</FONT>         * at some point<a name="line.201"></a>
+<FONT color="green">202</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.202"></a>
+<FONT color="green">203</FONT>         */<a name="line.203"></a>
+<FONT color="green">204</FONT>        public double[] inversetransform2(UnivariateRealFunction f,<a name="line.204"></a>
+<FONT color="green">205</FONT>                                          double min, double max, int n)<a name="line.205"></a>
+<FONT color="green">206</FONT>            throws FunctionEvaluationException, IllegalArgumentException {<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>            return transform2(f, min, max, n);<a name="line.208"></a>
+<FONT color="green">209</FONT>        }<a name="line.209"></a>
+<FONT color="green">210</FONT>    <a name="line.210"></a>
+<FONT color="green">211</FONT>        /**<a name="line.211"></a>
+<FONT color="green">212</FONT>         * Perform the FCT algorithm (including inverse).<a name="line.212"></a>
+<FONT color="green">213</FONT>         *<a name="line.213"></a>
+<FONT color="green">214</FONT>         * @param f the real data array to be transformed<a name="line.214"></a>
+<FONT color="green">215</FONT>         * @return the real transformed array<a name="line.215"></a>
+<FONT color="green">216</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.216"></a>
+<FONT color="green">217</FONT>         */<a name="line.217"></a>
+<FONT color="green">218</FONT>        protected double[] fct(double f[])<a name="line.218"></a>
+<FONT color="green">219</FONT>            throws IllegalArgumentException {<a name="line.219"></a>
+<FONT color="green">220</FONT>    <a name="line.220"></a>
+<FONT color="green">221</FONT>            final double transformed[] = new double[f.length];<a name="line.221"></a>
+<FONT color="green">222</FONT>    <a name="line.222"></a>
+<FONT color="green">223</FONT>            final int n = f.length - 1;<a name="line.223"></a>
+<FONT color="green">224</FONT>            if (!FastFourierTransformer.isPowerOf2(n)) {<a name="line.224"></a>
+<FONT color="green">225</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.225"></a>
+<FONT color="green">226</FONT>                        "{0} is not a power of 2 plus one",<a name="line.226"></a>
+<FONT color="green">227</FONT>                        f.length);<a name="line.227"></a>
+<FONT color="green">228</FONT>            }<a name="line.228"></a>
+<FONT color="green">229</FONT>            if (n == 1) {       // trivial case<a name="line.229"></a>
+<FONT color="green">230</FONT>                transformed[0] = 0.5 * (f[0] + f[1]);<a name="line.230"></a>
+<FONT color="green">231</FONT>                transformed[1] = 0.5 * (f[0] - f[1]);<a name="line.231"></a>
+<FONT color="green">232</FONT>                return transformed;<a name="line.232"></a>
+<FONT color="green">233</FONT>            }<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>            // construct a new array and perform FFT on it<a name="line.235"></a>
+<FONT color="green">236</FONT>            final double[] x = new double[n];<a name="line.236"></a>
+<FONT color="green">237</FONT>            x[0] = 0.5 * (f[0] + f[n]);<a name="line.237"></a>
+<FONT color="green">238</FONT>            x[n &gt;&gt; 1] = f[n &gt;&gt; 1];<a name="line.238"></a>
+<FONT color="green">239</FONT>            double t1 = 0.5 * (f[0] - f[n]);   // temporary variable for transformed[1]<a name="line.239"></a>
+<FONT color="green">240</FONT>            for (int i = 1; i &lt; (n &gt;&gt; 1); i++) {<a name="line.240"></a>
+<FONT color="green">241</FONT>                final double a = 0.5 * (f[i] + f[n-i]);<a name="line.241"></a>
+<FONT color="green">242</FONT>                final double b = Math.sin(i * Math.PI / n) * (f[i] - f[n-i]);<a name="line.242"></a>
+<FONT color="green">243</FONT>                final double c = Math.cos(i * Math.PI / n) * (f[i] - f[n-i]);<a name="line.243"></a>
+<FONT color="green">244</FONT>                x[i] = a - b;<a name="line.244"></a>
+<FONT color="green">245</FONT>                x[n-i] = a + b;<a name="line.245"></a>
+<FONT color="green">246</FONT>                t1 += c;<a name="line.246"></a>
+<FONT color="green">247</FONT>            }<a name="line.247"></a>
+<FONT color="green">248</FONT>            FastFourierTransformer transformer = new FastFourierTransformer();<a name="line.248"></a>
+<FONT color="green">249</FONT>            Complex y[] = transformer.transform(x);<a name="line.249"></a>
+<FONT color="green">250</FONT>    <a name="line.250"></a>
+<FONT color="green">251</FONT>            // reconstruct the FCT result for the original array<a name="line.251"></a>
+<FONT color="green">252</FONT>            transformed[0] = y[0].getReal();<a name="line.252"></a>
+<FONT color="green">253</FONT>            transformed[1] = t1;<a name="line.253"></a>
+<FONT color="green">254</FONT>            for (int i = 1; i &lt; (n &gt;&gt; 1); i++) {<a name="line.254"></a>
+<FONT color="green">255</FONT>                transformed[2 * i]     = y[i].getReal();<a name="line.255"></a>
+<FONT color="green">256</FONT>                transformed[2 * i + 1] = transformed[2 * i - 1] - y[i].getImaginary();<a name="line.256"></a>
+<FONT color="green">257</FONT>            }<a name="line.257"></a>
+<FONT color="green">258</FONT>            transformed[n] = y[n &gt;&gt; 1].getReal();<a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>            return transformed;<a name="line.260"></a>
+<FONT color="green">261</FONT>        }<a name="line.261"></a>
+<FONT color="green">262</FONT>    }<a name="line.262"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/transform/FastFourierTransformer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,997 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.transform;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.lang.reflect.Array;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.complex.Complex;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    /**<a name="line.27"></a>
+<FONT color="green">028</FONT>     * Implements the &lt;a href="http://mathworld.wolfram.com/FastFourierTransform.html"&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * Fast Fourier Transform&lt;/a&gt; for transformation of one-dimensional data sets.<a name="line.29"></a>
+<FONT color="green">030</FONT>     * For reference, see &lt;b&gt;Applied Numerical Linear Algebra&lt;/b&gt;, ISBN 0898713897,<a name="line.30"></a>
+<FONT color="green">031</FONT>     * chapter 6.<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * There are several conventions for the definition of FFT and inverse FFT,<a name="line.33"></a>
+<FONT color="green">034</FONT>     * mainly on different coefficient and exponent. Here the equations are listed<a name="line.34"></a>
+<FONT color="green">035</FONT>     * in the comments of the corresponding methods.&lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     * We require the length of data set to be power of 2, this greatly simplifies<a name="line.37"></a>
+<FONT color="green">038</FONT>     * and speeds up the code. Users can pad the data with zeros to meet this<a name="line.38"></a>
+<FONT color="green">039</FONT>     * requirement. There are other flavors of FFT, for reference, see S. Winograd,<a name="line.39"></a>
+<FONT color="green">040</FONT>     * &lt;i&gt;On computing the discrete Fourier transform&lt;/i&gt;, Mathematics of Computation,<a name="line.40"></a>
+<FONT color="green">041</FONT>     * 32 (1978), 175 - 199.&lt;/p&gt;<a name="line.41"></a>
+<FONT color="green">042</FONT>     *<a name="line.42"></a>
+<FONT color="green">043</FONT>     * @version $Revision: 885278 $ $Date: 2009-11-29 16:47:51 -0500 (Sun, 29 Nov 2009) $<a name="line.43"></a>
+<FONT color="green">044</FONT>     * @since 1.2<a name="line.44"></a>
+<FONT color="green">045</FONT>     */<a name="line.45"></a>
+<FONT color="green">046</FONT>    public class FastFourierTransformer implements Serializable {<a name="line.46"></a>
+<FONT color="green">047</FONT>    <a name="line.47"></a>
+<FONT color="green">048</FONT>        /** Serializable version identifier. */<a name="line.48"></a>
+<FONT color="green">049</FONT>        static final long serialVersionUID = 5138259215438106000L;<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        /** Message for not power of 2. */<a name="line.51"></a>
+<FONT color="green">052</FONT>        private static final String NOT_POWER_OF_TWO_MESSAGE =<a name="line.52"></a>
+<FONT color="green">053</FONT>            "{0} is not a power of 2, consider padding for fix";<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** Message for dimension mismatch. */<a name="line.55"></a>
+<FONT color="green">056</FONT>        private static final String DIMENSION_MISMATCH_MESSAGE =<a name="line.56"></a>
+<FONT color="green">057</FONT>            "some dimensions don't match: {0} != {1}";<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** Message for not computed roots of unity. */<a name="line.59"></a>
+<FONT color="green">060</FONT>        private static final String MISSING_ROOTS_OF_UNITY_MESSAGE =<a name="line.60"></a>
+<FONT color="green">061</FONT>            "roots of unity have not been computed yet";<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /** Message for out of range root index. */<a name="line.63"></a>
+<FONT color="green">064</FONT>        private static final String OUT_OF_RANGE_ROOT_INDEX_MESSAGE =<a name="line.64"></a>
+<FONT color="green">065</FONT>            "out of range root of unity index {0} (must be in [{1};{2}])";<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /** roots of unity */<a name="line.67"></a>
+<FONT color="green">068</FONT>        private RootsOfUnity roots = new RootsOfUnity();<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /**<a name="line.70"></a>
+<FONT color="green">071</FONT>         * Construct a default transformer.<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        public FastFourierTransformer() {<a name="line.73"></a>
+<FONT color="green">074</FONT>            super();<a name="line.74"></a>
+<FONT color="green">075</FONT>        }<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /**<a name="line.77"></a>
+<FONT color="green">078</FONT>         * Transform the given real data set.<a name="line.78"></a>
+<FONT color="green">079</FONT>         * &lt;p&gt;<a name="line.79"></a>
+<FONT color="green">080</FONT>         * The formula is $ y_n = \Sigma_{k=0}^{N-1} e^{-2 \pi i nk/N} x_k $<a name="line.80"></a>
+<FONT color="green">081</FONT>         * &lt;/p&gt;<a name="line.81"></a>
+<FONT color="green">082</FONT>         *<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param f the real data array to be transformed<a name="line.83"></a>
+<FONT color="green">084</FONT>         * @return the complex transformed array<a name="line.84"></a>
+<FONT color="green">085</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.85"></a>
+<FONT color="green">086</FONT>         */<a name="line.86"></a>
+<FONT color="green">087</FONT>        public Complex[] transform(double f[])<a name="line.87"></a>
+<FONT color="green">088</FONT>            throws IllegalArgumentException {<a name="line.88"></a>
+<FONT color="green">089</FONT>            return fft(f, false);<a name="line.89"></a>
+<FONT color="green">090</FONT>        }<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /**<a name="line.92"></a>
+<FONT color="green">093</FONT>         * Transform the given real function, sampled on the given interval.<a name="line.93"></a>
+<FONT color="green">094</FONT>         * &lt;p&gt;<a name="line.94"></a>
+<FONT color="green">095</FONT>         * The formula is $ y_n = \Sigma_{k=0}^{N-1} e^{-2 \pi i nk/N} x_k $<a name="line.95"></a>
+<FONT color="green">096</FONT>         * &lt;/p&gt;<a name="line.96"></a>
+<FONT color="green">097</FONT>         *<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @param f the function to be sampled and transformed<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @param min the lower bound for the interval<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @param max the upper bound for the interval<a name="line.100"></a>
+<FONT color="green">101</FONT>         * @param n the number of sample points<a name="line.101"></a>
+<FONT color="green">102</FONT>         * @return the complex transformed array<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @throws FunctionEvaluationException if function cannot be evaluated<a name="line.103"></a>
+<FONT color="green">104</FONT>         * at some point<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.105"></a>
+<FONT color="green">106</FONT>         */<a name="line.106"></a>
+<FONT color="green">107</FONT>        public Complex[] transform(UnivariateRealFunction f,<a name="line.107"></a>
+<FONT color="green">108</FONT>                                   double min, double max, int n)<a name="line.108"></a>
+<FONT color="green">109</FONT>            throws FunctionEvaluationException, IllegalArgumentException {<a name="line.109"></a>
+<FONT color="green">110</FONT>            double data[] = sample(f, min, max, n);<a name="line.110"></a>
+<FONT color="green">111</FONT>            return fft(data, false);<a name="line.111"></a>
+<FONT color="green">112</FONT>        }<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /**<a name="line.114"></a>
+<FONT color="green">115</FONT>         * Transform the given complex data set.<a name="line.115"></a>
+<FONT color="green">116</FONT>         * &lt;p&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * The formula is $ y_n = \Sigma_{k=0}^{N-1} e^{-2 \pi i nk/N} x_k $<a name="line.117"></a>
+<FONT color="green">118</FONT>         * &lt;/p&gt;<a name="line.118"></a>
+<FONT color="green">119</FONT>         *<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @param f the complex data array to be transformed<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @return the complex transformed array<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.122"></a>
+<FONT color="green">123</FONT>         */<a name="line.123"></a>
+<FONT color="green">124</FONT>        public Complex[] transform(Complex f[])<a name="line.124"></a>
+<FONT color="green">125</FONT>            throws IllegalArgumentException {<a name="line.125"></a>
+<FONT color="green">126</FONT>            roots.computeOmega(f.length);<a name="line.126"></a>
+<FONT color="green">127</FONT>            return fft(f);<a name="line.127"></a>
+<FONT color="green">128</FONT>        }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /**<a name="line.130"></a>
+<FONT color="green">131</FONT>         * Transform the given real data set.<a name="line.131"></a>
+<FONT color="green">132</FONT>         * &lt;p&gt;<a name="line.132"></a>
+<FONT color="green">133</FONT>         * The formula is $y_n = (1/\sqrt{N}) \Sigma_{k=0}^{N-1} e^{-2 \pi i nk/N} x_k$<a name="line.133"></a>
+<FONT color="green">134</FONT>         * &lt;/p&gt;<a name="line.134"></a>
+<FONT color="green">135</FONT>         *<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @param f the real data array to be transformed<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @return the complex transformed array<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.138"></a>
+<FONT color="green">139</FONT>         */<a name="line.139"></a>
+<FONT color="green">140</FONT>        public Complex[] transform2(double f[])<a name="line.140"></a>
+<FONT color="green">141</FONT>            throws IllegalArgumentException {<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>            double scaling_coefficient = 1.0 / Math.sqrt(f.length);<a name="line.143"></a>
+<FONT color="green">144</FONT>            return scaleArray(fft(f, false), scaling_coefficient);<a name="line.144"></a>
+<FONT color="green">145</FONT>        }<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>        /**<a name="line.147"></a>
+<FONT color="green">148</FONT>         * Transform the given real function, sampled on the given interval.<a name="line.148"></a>
+<FONT color="green">149</FONT>         * &lt;p&gt;<a name="line.149"></a>
+<FONT color="green">150</FONT>         * The formula is $y_n = (1/\sqrt{N}) \Sigma_{k=0}^{N-1} e^{-2 \pi i nk/N} x_k$<a name="line.150"></a>
+<FONT color="green">151</FONT>         * &lt;/p&gt;<a name="line.151"></a>
+<FONT color="green">152</FONT>         *<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @param f the function to be sampled and transformed<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @param min the lower bound for the interval<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @param max the upper bound for the interval<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @param n the number of sample points<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @return the complex transformed array<a name="line.157"></a>
+<FONT color="green">158</FONT>         * @throws FunctionEvaluationException if function cannot be evaluated<a name="line.158"></a>
+<FONT color="green">159</FONT>         * at some point<a name="line.159"></a>
+<FONT color="green">160</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.160"></a>
+<FONT color="green">161</FONT>         */<a name="line.161"></a>
+<FONT color="green">162</FONT>        public Complex[] transform2(UnivariateRealFunction f,<a name="line.162"></a>
+<FONT color="green">163</FONT>                                    double min, double max, int n)<a name="line.163"></a>
+<FONT color="green">164</FONT>            throws FunctionEvaluationException, IllegalArgumentException {<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>            double data[] = sample(f, min, max, n);<a name="line.166"></a>
+<FONT color="green">167</FONT>            double scaling_coefficient = 1.0 / Math.sqrt(n);<a name="line.167"></a>
+<FONT color="green">168</FONT>            return scaleArray(fft(data, false), scaling_coefficient);<a name="line.168"></a>
+<FONT color="green">169</FONT>        }<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>        /**<a name="line.171"></a>
+<FONT color="green">172</FONT>         * Transform the given complex data set.<a name="line.172"></a>
+<FONT color="green">173</FONT>         * &lt;p&gt;<a name="line.173"></a>
+<FONT color="green">174</FONT>         * The formula is $y_n = (1/\sqrt{N}) \Sigma_{k=0}^{N-1} e^{-2 \pi i nk/N} x_k$<a name="line.174"></a>
+<FONT color="green">175</FONT>         * &lt;/p&gt;<a name="line.175"></a>
+<FONT color="green">176</FONT>         *<a name="line.176"></a>
+<FONT color="green">177</FONT>         * @param f the complex data array to be transformed<a name="line.177"></a>
+<FONT color="green">178</FONT>         * @return the complex transformed array<a name="line.178"></a>
+<FONT color="green">179</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.179"></a>
+<FONT color="green">180</FONT>         */<a name="line.180"></a>
+<FONT color="green">181</FONT>        public Complex[] transform2(Complex f[])<a name="line.181"></a>
+<FONT color="green">182</FONT>            throws IllegalArgumentException {<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>            roots.computeOmega(f.length);<a name="line.184"></a>
+<FONT color="green">185</FONT>            double scaling_coefficient = 1.0 / Math.sqrt(f.length);<a name="line.185"></a>
+<FONT color="green">186</FONT>            return scaleArray(fft(f), scaling_coefficient);<a name="line.186"></a>
+<FONT color="green">187</FONT>        }<a name="line.187"></a>
+<FONT color="green">188</FONT>    <a name="line.188"></a>
+<FONT color="green">189</FONT>        /**<a name="line.189"></a>
+<FONT color="green">190</FONT>         * Inversely transform the given real data set.<a name="line.190"></a>
+<FONT color="green">191</FONT>         * &lt;p&gt;<a name="line.191"></a>
+<FONT color="green">192</FONT>         * The formula is $ x_k = (1/N) \Sigma_{n=0}^{N-1} e^{2 \pi i nk/N} y_n $<a name="line.192"></a>
+<FONT color="green">193</FONT>         * &lt;/p&gt;<a name="line.193"></a>
+<FONT color="green">194</FONT>         *<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @param f the real data array to be inversely transformed<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @return the complex inversely transformed array<a name="line.196"></a>
+<FONT color="green">197</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.197"></a>
+<FONT color="green">198</FONT>         */<a name="line.198"></a>
+<FONT color="green">199</FONT>        public Complex[] inversetransform(double f[])<a name="line.199"></a>
+<FONT color="green">200</FONT>            throws IllegalArgumentException {<a name="line.200"></a>
+<FONT color="green">201</FONT>    <a name="line.201"></a>
+<FONT color="green">202</FONT>            double scaling_coefficient = 1.0 / f.length;<a name="line.202"></a>
+<FONT color="green">203</FONT>            return scaleArray(fft(f, true), scaling_coefficient);<a name="line.203"></a>
+<FONT color="green">204</FONT>        }<a name="line.204"></a>
+<FONT color="green">205</FONT>    <a name="line.205"></a>
+<FONT color="green">206</FONT>        /**<a name="line.206"></a>
+<FONT color="green">207</FONT>         * Inversely transform the given real function, sampled on the given interval.<a name="line.207"></a>
+<FONT color="green">208</FONT>         * &lt;p&gt;<a name="line.208"></a>
+<FONT color="green">209</FONT>         * The formula is $ x_k = (1/N) \Sigma_{n=0}^{N-1} e^{2 \pi i nk/N} y_n $<a name="line.209"></a>
+<FONT color="green">210</FONT>         * &lt;/p&gt;<a name="line.210"></a>
+<FONT color="green">211</FONT>         *<a name="line.211"></a>
+<FONT color="green">212</FONT>         * @param f the function to be sampled and inversely transformed<a name="line.212"></a>
+<FONT color="green">213</FONT>         * @param min the lower bound for the interval<a name="line.213"></a>
+<FONT color="green">214</FONT>         * @param max the upper bound for the interval<a name="line.214"></a>
+<FONT color="green">215</FONT>         * @param n the number of sample points<a name="line.215"></a>
+<FONT color="green">216</FONT>         * @return the complex inversely transformed array<a name="line.216"></a>
+<FONT color="green">217</FONT>         * @throws FunctionEvaluationException if function cannot be evaluated<a name="line.217"></a>
+<FONT color="green">218</FONT>         * at some point<a name="line.218"></a>
+<FONT color="green">219</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.219"></a>
+<FONT color="green">220</FONT>         */<a name="line.220"></a>
+<FONT color="green">221</FONT>        public Complex[] inversetransform(UnivariateRealFunction f,<a name="line.221"></a>
+<FONT color="green">222</FONT>                                          double min, double max, int n)<a name="line.222"></a>
+<FONT color="green">223</FONT>            throws FunctionEvaluationException, IllegalArgumentException {<a name="line.223"></a>
+<FONT color="green">224</FONT>    <a name="line.224"></a>
+<FONT color="green">225</FONT>            double data[] = sample(f, min, max, n);<a name="line.225"></a>
+<FONT color="green">226</FONT>            double scaling_coefficient = 1.0 / n;<a name="line.226"></a>
+<FONT color="green">227</FONT>            return scaleArray(fft(data, true), scaling_coefficient);<a name="line.227"></a>
+<FONT color="green">228</FONT>        }<a name="line.228"></a>
+<FONT color="green">229</FONT>    <a name="line.229"></a>
+<FONT color="green">230</FONT>        /**<a name="line.230"></a>
+<FONT color="green">231</FONT>         * Inversely transform the given complex data set.<a name="line.231"></a>
+<FONT color="green">232</FONT>         * &lt;p&gt;<a name="line.232"></a>
+<FONT color="green">233</FONT>         * The formula is $ x_k = (1/N) \Sigma_{n=0}^{N-1} e^{2 \pi i nk/N} y_n $<a name="line.233"></a>
+<FONT color="green">234</FONT>         * &lt;/p&gt;<a name="line.234"></a>
+<FONT color="green">235</FONT>         *<a name="line.235"></a>
+<FONT color="green">236</FONT>         * @param f the complex data array to be inversely transformed<a name="line.236"></a>
+<FONT color="green">237</FONT>         * @return the complex inversely transformed array<a name="line.237"></a>
+<FONT color="green">238</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.238"></a>
+<FONT color="green">239</FONT>         */<a name="line.239"></a>
+<FONT color="green">240</FONT>        public Complex[] inversetransform(Complex f[])<a name="line.240"></a>
+<FONT color="green">241</FONT>            throws IllegalArgumentException {<a name="line.241"></a>
+<FONT color="green">242</FONT>    <a name="line.242"></a>
+<FONT color="green">243</FONT>            roots.computeOmega(-f.length);    // pass negative argument<a name="line.243"></a>
+<FONT color="green">244</FONT>            double scaling_coefficient = 1.0 / f.length;<a name="line.244"></a>
+<FONT color="green">245</FONT>            return scaleArray(fft(f), scaling_coefficient);<a name="line.245"></a>
+<FONT color="green">246</FONT>        }<a name="line.246"></a>
+<FONT color="green">247</FONT>    <a name="line.247"></a>
+<FONT color="green">248</FONT>        /**<a name="line.248"></a>
+<FONT color="green">249</FONT>         * Inversely transform the given real data set.<a name="line.249"></a>
+<FONT color="green">250</FONT>         * &lt;p&gt;<a name="line.250"></a>
+<FONT color="green">251</FONT>         * The formula is $x_k = (1/\sqrt{N}) \Sigma_{n=0}^{N-1} e^{2 \pi i nk/N} y_n$<a name="line.251"></a>
+<FONT color="green">252</FONT>         * &lt;/p&gt;<a name="line.252"></a>
+<FONT color="green">253</FONT>         *<a name="line.253"></a>
+<FONT color="green">254</FONT>         * @param f the real data array to be inversely transformed<a name="line.254"></a>
+<FONT color="green">255</FONT>         * @return the complex inversely transformed array<a name="line.255"></a>
+<FONT color="green">256</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.256"></a>
+<FONT color="green">257</FONT>         */<a name="line.257"></a>
+<FONT color="green">258</FONT>        public Complex[] inversetransform2(double f[])<a name="line.258"></a>
+<FONT color="green">259</FONT>            throws IllegalArgumentException {<a name="line.259"></a>
+<FONT color="green">260</FONT>    <a name="line.260"></a>
+<FONT color="green">261</FONT>            double scaling_coefficient = 1.0 / Math.sqrt(f.length);<a name="line.261"></a>
+<FONT color="green">262</FONT>            return scaleArray(fft(f, true), scaling_coefficient);<a name="line.262"></a>
+<FONT color="green">263</FONT>        }<a name="line.263"></a>
+<FONT color="green">264</FONT>    <a name="line.264"></a>
+<FONT color="green">265</FONT>        /**<a name="line.265"></a>
+<FONT color="green">266</FONT>         * Inversely transform the given real function, sampled on the given interval.<a name="line.266"></a>
+<FONT color="green">267</FONT>         * &lt;p&gt;<a name="line.267"></a>
+<FONT color="green">268</FONT>         * The formula is $x_k = (1/\sqrt{N}) \Sigma_{n=0}^{N-1} e^{2 \pi i nk/N} y_n$<a name="line.268"></a>
+<FONT color="green">269</FONT>         * &lt;/p&gt;<a name="line.269"></a>
+<FONT color="green">270</FONT>         *<a name="line.270"></a>
+<FONT color="green">271</FONT>         * @param f the function to be sampled and inversely transformed<a name="line.271"></a>
+<FONT color="green">272</FONT>         * @param min the lower bound for the interval<a name="line.272"></a>
+<FONT color="green">273</FONT>         * @param max the upper bound for the interval<a name="line.273"></a>
+<FONT color="green">274</FONT>         * @param n the number of sample points<a name="line.274"></a>
+<FONT color="green">275</FONT>         * @return the complex inversely transformed array<a name="line.275"></a>
+<FONT color="green">276</FONT>         * @throws FunctionEvaluationException if function cannot be evaluated<a name="line.276"></a>
+<FONT color="green">277</FONT>         * at some point<a name="line.277"></a>
+<FONT color="green">278</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.278"></a>
+<FONT color="green">279</FONT>         */<a name="line.279"></a>
+<FONT color="green">280</FONT>        public Complex[] inversetransform2(UnivariateRealFunction f,<a name="line.280"></a>
+<FONT color="green">281</FONT>                                           double min, double max, int n)<a name="line.281"></a>
+<FONT color="green">282</FONT>            throws FunctionEvaluationException, IllegalArgumentException {<a name="line.282"></a>
+<FONT color="green">283</FONT>    <a name="line.283"></a>
+<FONT color="green">284</FONT>            double data[] = sample(f, min, max, n);<a name="line.284"></a>
+<FONT color="green">285</FONT>            double scaling_coefficient = 1.0 / Math.sqrt(n);<a name="line.285"></a>
+<FONT color="green">286</FONT>            return scaleArray(fft(data, true), scaling_coefficient);<a name="line.286"></a>
+<FONT color="green">287</FONT>        }<a name="line.287"></a>
+<FONT color="green">288</FONT>    <a name="line.288"></a>
+<FONT color="green">289</FONT>        /**<a name="line.289"></a>
+<FONT color="green">290</FONT>         * Inversely transform the given complex data set.<a name="line.290"></a>
+<FONT color="green">291</FONT>         * &lt;p&gt;<a name="line.291"></a>
+<FONT color="green">292</FONT>         * The formula is $x_k = (1/\sqrt{N}) \Sigma_{n=0}^{N-1} e^{2 \pi i nk/N} y_n$<a name="line.292"></a>
+<FONT color="green">293</FONT>         * &lt;/p&gt;<a name="line.293"></a>
+<FONT color="green">294</FONT>         *<a name="line.294"></a>
+<FONT color="green">295</FONT>         * @param f the complex data array to be inversely transformed<a name="line.295"></a>
+<FONT color="green">296</FONT>         * @return the complex inversely transformed array<a name="line.296"></a>
+<FONT color="green">297</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.297"></a>
+<FONT color="green">298</FONT>         */<a name="line.298"></a>
+<FONT color="green">299</FONT>        public Complex[] inversetransform2(Complex f[])<a name="line.299"></a>
+<FONT color="green">300</FONT>            throws IllegalArgumentException {<a name="line.300"></a>
+<FONT color="green">301</FONT>    <a name="line.301"></a>
+<FONT color="green">302</FONT>            roots.computeOmega(-f.length);    // pass negative argument<a name="line.302"></a>
+<FONT color="green">303</FONT>            double scaling_coefficient = 1.0 / Math.sqrt(f.length);<a name="line.303"></a>
+<FONT color="green">304</FONT>            return scaleArray(fft(f), scaling_coefficient);<a name="line.304"></a>
+<FONT color="green">305</FONT>        }<a name="line.305"></a>
+<FONT color="green">306</FONT>    <a name="line.306"></a>
+<FONT color="green">307</FONT>        /**<a name="line.307"></a>
+<FONT color="green">308</FONT>         * Perform the base-4 Cooley-Tukey FFT algorithm (including inverse).<a name="line.308"></a>
+<FONT color="green">309</FONT>         *<a name="line.309"></a>
+<FONT color="green">310</FONT>         * @param f the real data array to be transformed<a name="line.310"></a>
+<FONT color="green">311</FONT>         * @param isInverse the indicator of forward or inverse transform<a name="line.311"></a>
+<FONT color="green">312</FONT>         * @return the complex transformed array<a name="line.312"></a>
+<FONT color="green">313</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.313"></a>
+<FONT color="green">314</FONT>         */<a name="line.314"></a>
+<FONT color="green">315</FONT>        protected Complex[] fft(double f[], boolean isInverse)<a name="line.315"></a>
+<FONT color="green">316</FONT>            throws IllegalArgumentException {<a name="line.316"></a>
+<FONT color="green">317</FONT>    <a name="line.317"></a>
+<FONT color="green">318</FONT>            verifyDataSet(f);<a name="line.318"></a>
+<FONT color="green">319</FONT>            Complex F[] = new Complex[f.length];<a name="line.319"></a>
+<FONT color="green">320</FONT>            if (f.length == 1) {<a name="line.320"></a>
+<FONT color="green">321</FONT>                F[0] = new Complex(f[0], 0.0);<a name="line.321"></a>
+<FONT color="green">322</FONT>                return F;<a name="line.322"></a>
+<FONT color="green">323</FONT>            }<a name="line.323"></a>
+<FONT color="green">324</FONT>    <a name="line.324"></a>
+<FONT color="green">325</FONT>            // Rather than the naive real to complex conversion, pack 2N<a name="line.325"></a>
+<FONT color="green">326</FONT>            // real numbers into N complex numbers for better performance.<a name="line.326"></a>
+<FONT color="green">327</FONT>            int N = f.length &gt;&gt; 1;<a name="line.327"></a>
+<FONT color="green">328</FONT>            Complex c[] = new Complex[N];<a name="line.328"></a>
+<FONT color="green">329</FONT>            for (int i = 0; i &lt; N; i++) {<a name="line.329"></a>
+<FONT color="green">330</FONT>                c[i] = new Complex(f[2*i], f[2*i+1]);<a name="line.330"></a>
+<FONT color="green">331</FONT>            }<a name="line.331"></a>
+<FONT color="green">332</FONT>            roots.computeOmega(isInverse ? -N : N);<a name="line.332"></a>
+<FONT color="green">333</FONT>            Complex z[] = fft(c);<a name="line.333"></a>
+<FONT color="green">334</FONT>    <a name="line.334"></a>
+<FONT color="green">335</FONT>            // reconstruct the FFT result for the original array<a name="line.335"></a>
+<FONT color="green">336</FONT>            roots.computeOmega(isInverse ? -2*N : 2*N);<a name="line.336"></a>
+<FONT color="green">337</FONT>            F[0] = new Complex(2 * (z[0].getReal() + z[0].getImaginary()), 0.0);<a name="line.337"></a>
+<FONT color="green">338</FONT>            F[N] = new Complex(2 * (z[0].getReal() - z[0].getImaginary()), 0.0);<a name="line.338"></a>
+<FONT color="green">339</FONT>            for (int i = 1; i &lt; N; i++) {<a name="line.339"></a>
+<FONT color="green">340</FONT>                Complex A = z[N-i].conjugate();<a name="line.340"></a>
+<FONT color="green">341</FONT>                Complex B = z[i].add(A);<a name="line.341"></a>
+<FONT color="green">342</FONT>                Complex C = z[i].subtract(A);<a name="line.342"></a>
+<FONT color="green">343</FONT>                //Complex D = roots.getOmega(i).multiply(Complex.I);<a name="line.343"></a>
+<FONT color="green">344</FONT>                Complex D = new Complex(-roots.getOmegaImaginary(i),<a name="line.344"></a>
+<FONT color="green">345</FONT>                                        roots.getOmegaReal(i));<a name="line.345"></a>
+<FONT color="green">346</FONT>                F[i] = B.subtract(C.multiply(D));<a name="line.346"></a>
+<FONT color="green">347</FONT>                F[2*N-i] = F[i].conjugate();<a name="line.347"></a>
+<FONT color="green">348</FONT>            }<a name="line.348"></a>
+<FONT color="green">349</FONT>    <a name="line.349"></a>
+<FONT color="green">350</FONT>            return scaleArray(F, 0.5);<a name="line.350"></a>
+<FONT color="green">351</FONT>        }<a name="line.351"></a>
+<FONT color="green">352</FONT>    <a name="line.352"></a>
+<FONT color="green">353</FONT>        /**<a name="line.353"></a>
+<FONT color="green">354</FONT>         * Perform the base-4 Cooley-Tukey FFT algorithm (including inverse).<a name="line.354"></a>
+<FONT color="green">355</FONT>         *<a name="line.355"></a>
+<FONT color="green">356</FONT>         * @param data the complex data array to be transformed<a name="line.356"></a>
+<FONT color="green">357</FONT>         * @return the complex transformed array<a name="line.357"></a>
+<FONT color="green">358</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.358"></a>
+<FONT color="green">359</FONT>         */<a name="line.359"></a>
+<FONT color="green">360</FONT>        protected Complex[] fft(Complex data[])<a name="line.360"></a>
+<FONT color="green">361</FONT>            throws IllegalArgumentException {<a name="line.361"></a>
+<FONT color="green">362</FONT>    <a name="line.362"></a>
+<FONT color="green">363</FONT>            final int n = data.length;<a name="line.363"></a>
+<FONT color="green">364</FONT>            final Complex f[] = new Complex[n];<a name="line.364"></a>
+<FONT color="green">365</FONT>    <a name="line.365"></a>
+<FONT color="green">366</FONT>            // initial simple cases<a name="line.366"></a>
+<FONT color="green">367</FONT>            verifyDataSet(data);<a name="line.367"></a>
+<FONT color="green">368</FONT>            if (n == 1) {<a name="line.368"></a>
+<FONT color="green">369</FONT>                f[0] = data[0];<a name="line.369"></a>
+<FONT color="green">370</FONT>                return f;<a name="line.370"></a>
+<FONT color="green">371</FONT>            }<a name="line.371"></a>
+<FONT color="green">372</FONT>            if (n == 2) {<a name="line.372"></a>
+<FONT color="green">373</FONT>                f[0] = data[0].add(data[1]);<a name="line.373"></a>
+<FONT color="green">374</FONT>                f[1] = data[0].subtract(data[1]);<a name="line.374"></a>
+<FONT color="green">375</FONT>                return f;<a name="line.375"></a>
+<FONT color="green">376</FONT>            }<a name="line.376"></a>
+<FONT color="green">377</FONT>    <a name="line.377"></a>
+<FONT color="green">378</FONT>            // permute original data array in bit-reversal order<a name="line.378"></a>
+<FONT color="green">379</FONT>            int ii = 0;<a name="line.379"></a>
+<FONT color="green">380</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.380"></a>
+<FONT color="green">381</FONT>                f[i] = data[ii];<a name="line.381"></a>
+<FONT color="green">382</FONT>                int k = n &gt;&gt; 1;<a name="line.382"></a>
+<FONT color="green">383</FONT>                while (ii &gt;= k &amp;&amp; k &gt; 0) {<a name="line.383"></a>
+<FONT color="green">384</FONT>                    ii -= k; k &gt;&gt;= 1;<a name="line.384"></a>
+<FONT color="green">385</FONT>                }<a name="line.385"></a>
+<FONT color="green">386</FONT>                ii += k;<a name="line.386"></a>
+<FONT color="green">387</FONT>            }<a name="line.387"></a>
+<FONT color="green">388</FONT>    <a name="line.388"></a>
+<FONT color="green">389</FONT>            // the bottom base-4 round<a name="line.389"></a>
+<FONT color="green">390</FONT>            for (int i = 0; i &lt; n; i += 4) {<a name="line.390"></a>
+<FONT color="green">391</FONT>                final Complex a = f[i].add(f[i+1]);<a name="line.391"></a>
+<FONT color="green">392</FONT>                final Complex b = f[i+2].add(f[i+3]);<a name="line.392"></a>
+<FONT color="green">393</FONT>                final Complex c = f[i].subtract(f[i+1]);<a name="line.393"></a>
+<FONT color="green">394</FONT>                final Complex d = f[i+2].subtract(f[i+3]);<a name="line.394"></a>
+<FONT color="green">395</FONT>                final Complex e1 = c.add(d.multiply(Complex.I));<a name="line.395"></a>
+<FONT color="green">396</FONT>                final Complex e2 = c.subtract(d.multiply(Complex.I));<a name="line.396"></a>
+<FONT color="green">397</FONT>                f[i] = a.add(b);<a name="line.397"></a>
+<FONT color="green">398</FONT>                f[i+2] = a.subtract(b);<a name="line.398"></a>
+<FONT color="green">399</FONT>                // omegaCount indicates forward or inverse transform<a name="line.399"></a>
+<FONT color="green">400</FONT>                f[i+1] = roots.isForward() ? e2 : e1;<a name="line.400"></a>
+<FONT color="green">401</FONT>                f[i+3] = roots.isForward() ? e1 : e2;<a name="line.401"></a>
+<FONT color="green">402</FONT>            }<a name="line.402"></a>
+<FONT color="green">403</FONT>    <a name="line.403"></a>
+<FONT color="green">404</FONT>            // iterations from bottom to top take O(N*logN) time<a name="line.404"></a>
+<FONT color="green">405</FONT>            for (int i = 4; i &lt; n; i &lt;&lt;= 1) {<a name="line.405"></a>
+<FONT color="green">406</FONT>                final int m = n / (i&lt;&lt;1);<a name="line.406"></a>
+<FONT color="green">407</FONT>                for (int j = 0; j &lt; n; j += i&lt;&lt;1) {<a name="line.407"></a>
+<FONT color="green">408</FONT>                    for (int k = 0; k &lt; i; k++) {<a name="line.408"></a>
+<FONT color="green">409</FONT>                        //z = f[i+j+k].multiply(roots.getOmega(k*m));<a name="line.409"></a>
+<FONT color="green">410</FONT>                        final int k_times_m = k*m;<a name="line.410"></a>
+<FONT color="green">411</FONT>                        final double omega_k_times_m_real = roots.getOmegaReal(k_times_m);<a name="line.411"></a>
+<FONT color="green">412</FONT>                        final double omega_k_times_m_imaginary = roots.getOmegaImaginary(k_times_m);<a name="line.412"></a>
+<FONT color="green">413</FONT>                        //z = f[i+j+k].multiply(omega[k*m]);<a name="line.413"></a>
+<FONT color="green">414</FONT>                        final Complex z = new Complex(<a name="line.414"></a>
+<FONT color="green">415</FONT>                            f[i+j+k].getReal() * omega_k_times_m_real -<a name="line.415"></a>
+<FONT color="green">416</FONT>                            f[i+j+k].getImaginary() * omega_k_times_m_imaginary,<a name="line.416"></a>
+<FONT color="green">417</FONT>                            f[i+j+k].getReal() * omega_k_times_m_imaginary +<a name="line.417"></a>
+<FONT color="green">418</FONT>                            f[i+j+k].getImaginary() * omega_k_times_m_real);<a name="line.418"></a>
+<FONT color="green">419</FONT>    <a name="line.419"></a>
+<FONT color="green">420</FONT>                        f[i+j+k] = f[j+k].subtract(z);<a name="line.420"></a>
+<FONT color="green">421</FONT>                        f[j+k] = f[j+k].add(z);<a name="line.421"></a>
+<FONT color="green">422</FONT>                    }<a name="line.422"></a>
+<FONT color="green">423</FONT>                }<a name="line.423"></a>
+<FONT color="green">424</FONT>            }<a name="line.424"></a>
+<FONT color="green">425</FONT>            return f;<a name="line.425"></a>
+<FONT color="green">426</FONT>        }<a name="line.426"></a>
+<FONT color="green">427</FONT>    <a name="line.427"></a>
+<FONT color="green">428</FONT>        /**<a name="line.428"></a>
+<FONT color="green">429</FONT>         * Sample the given univariate real function on the given interval.<a name="line.429"></a>
+<FONT color="green">430</FONT>         * &lt;p&gt;<a name="line.430"></a>
+<FONT color="green">431</FONT>         * The interval is divided equally into N sections and sample points<a name="line.431"></a>
+<FONT color="green">432</FONT>         * are taken from min to max-(max-min)/N. Usually f(x) is periodic<a name="line.432"></a>
+<FONT color="green">433</FONT>         * such that f(min) = f(max) (note max is not sampled), but we don't<a name="line.433"></a>
+<FONT color="green">434</FONT>         * require that.&lt;/p&gt;<a name="line.434"></a>
+<FONT color="green">435</FONT>         *<a name="line.435"></a>
+<FONT color="green">436</FONT>         * @param f the function to be sampled<a name="line.436"></a>
+<FONT color="green">437</FONT>         * @param min the lower bound for the interval<a name="line.437"></a>
+<FONT color="green">438</FONT>         * @param max the upper bound for the interval<a name="line.438"></a>
+<FONT color="green">439</FONT>         * @param n the number of sample points<a name="line.439"></a>
+<FONT color="green">440</FONT>         * @return the samples array<a name="line.440"></a>
+<FONT color="green">441</FONT>         * @throws FunctionEvaluationException if function cannot be evaluated<a name="line.441"></a>
+<FONT color="green">442</FONT>         * at some point<a name="line.442"></a>
+<FONT color="green">443</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.443"></a>
+<FONT color="green">444</FONT>         */<a name="line.444"></a>
+<FONT color="green">445</FONT>        public static double[] sample(UnivariateRealFunction f,<a name="line.445"></a>
+<FONT color="green">446</FONT>                                      double min, double max, int n)<a name="line.446"></a>
+<FONT color="green">447</FONT>            throws FunctionEvaluationException, IllegalArgumentException {<a name="line.447"></a>
+<FONT color="green">448</FONT>    <a name="line.448"></a>
+<FONT color="green">449</FONT>            if (n &lt;= 0) {<a name="line.449"></a>
+<FONT color="green">450</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.450"></a>
+<FONT color="green">451</FONT>                        "number of sample is not positive: {0}",<a name="line.451"></a>
+<FONT color="green">452</FONT>                        n);<a name="line.452"></a>
+<FONT color="green">453</FONT>            }<a name="line.453"></a>
+<FONT color="green">454</FONT>            verifyInterval(min, max);<a name="line.454"></a>
+<FONT color="green">455</FONT>    <a name="line.455"></a>
+<FONT color="green">456</FONT>            double s[] = new double[n];<a name="line.456"></a>
+<FONT color="green">457</FONT>            double h = (max - min) / n;<a name="line.457"></a>
+<FONT color="green">458</FONT>            for (int i = 0; i &lt; n; i++) {<a name="line.458"></a>
+<FONT color="green">459</FONT>                s[i] = f.value(min + i * h);<a name="line.459"></a>
+<FONT color="green">460</FONT>            }<a name="line.460"></a>
+<FONT color="green">461</FONT>            return s;<a name="line.461"></a>
+<FONT color="green">462</FONT>        }<a name="line.462"></a>
+<FONT color="green">463</FONT>    <a name="line.463"></a>
+<FONT color="green">464</FONT>        /**<a name="line.464"></a>
+<FONT color="green">465</FONT>         * Multiply every component in the given real array by the<a name="line.465"></a>
+<FONT color="green">466</FONT>         * given real number. The change is made in place.<a name="line.466"></a>
+<FONT color="green">467</FONT>         *<a name="line.467"></a>
+<FONT color="green">468</FONT>         * @param f the real array to be scaled<a name="line.468"></a>
+<FONT color="green">469</FONT>         * @param d the real scaling coefficient<a name="line.469"></a>
+<FONT color="green">470</FONT>         * @return a reference to the scaled array<a name="line.470"></a>
+<FONT color="green">471</FONT>         */<a name="line.471"></a>
+<FONT color="green">472</FONT>        public static double[] scaleArray(double f[], double d) {<a name="line.472"></a>
+<FONT color="green">473</FONT>            for (int i = 0; i &lt; f.length; i++) {<a name="line.473"></a>
+<FONT color="green">474</FONT>                f[i] *= d;<a name="line.474"></a>
+<FONT color="green">475</FONT>            }<a name="line.475"></a>
+<FONT color="green">476</FONT>            return f;<a name="line.476"></a>
+<FONT color="green">477</FONT>        }<a name="line.477"></a>
+<FONT color="green">478</FONT>    <a name="line.478"></a>
+<FONT color="green">479</FONT>        /**<a name="line.479"></a>
+<FONT color="green">480</FONT>         * Multiply every component in the given complex array by the<a name="line.480"></a>
+<FONT color="green">481</FONT>         * given real number. The change is made in place.<a name="line.481"></a>
+<FONT color="green">482</FONT>         *<a name="line.482"></a>
+<FONT color="green">483</FONT>         * @param f the complex array to be scaled<a name="line.483"></a>
+<FONT color="green">484</FONT>         * @param d the real scaling coefficient<a name="line.484"></a>
+<FONT color="green">485</FONT>         * @return a reference to the scaled array<a name="line.485"></a>
+<FONT color="green">486</FONT>         */<a name="line.486"></a>
+<FONT color="green">487</FONT>        public static Complex[] scaleArray(Complex f[], double d) {<a name="line.487"></a>
+<FONT color="green">488</FONT>            for (int i = 0; i &lt; f.length; i++) {<a name="line.488"></a>
+<FONT color="green">489</FONT>                f[i] = new Complex(d * f[i].getReal(), d * f[i].getImaginary());<a name="line.489"></a>
+<FONT color="green">490</FONT>            }<a name="line.490"></a>
+<FONT color="green">491</FONT>            return f;<a name="line.491"></a>
+<FONT color="green">492</FONT>        }<a name="line.492"></a>
+<FONT color="green">493</FONT>    <a name="line.493"></a>
+<FONT color="green">494</FONT>        /**<a name="line.494"></a>
+<FONT color="green">495</FONT>         * Returns true if the argument is power of 2.<a name="line.495"></a>
+<FONT color="green">496</FONT>         *<a name="line.496"></a>
+<FONT color="green">497</FONT>         * @param n the number to test<a name="line.497"></a>
+<FONT color="green">498</FONT>         * @return true if the argument is power of 2<a name="line.498"></a>
+<FONT color="green">499</FONT>         */<a name="line.499"></a>
+<FONT color="green">500</FONT>        public static boolean isPowerOf2(long n) {<a name="line.500"></a>
+<FONT color="green">501</FONT>            return (n &gt; 0) &amp;&amp; ((n &amp; (n - 1)) == 0);<a name="line.501"></a>
+<FONT color="green">502</FONT>        }<a name="line.502"></a>
+<FONT color="green">503</FONT>    <a name="line.503"></a>
+<FONT color="green">504</FONT>        /**<a name="line.504"></a>
+<FONT color="green">505</FONT>         * Verifies that the data set has length of power of 2.<a name="line.505"></a>
+<FONT color="green">506</FONT>         *<a name="line.506"></a>
+<FONT color="green">507</FONT>         * @param d the data array<a name="line.507"></a>
+<FONT color="green">508</FONT>         * @throws IllegalArgumentException if array length is not power of 2<a name="line.508"></a>
+<FONT color="green">509</FONT>         */<a name="line.509"></a>
+<FONT color="green">510</FONT>        public static void verifyDataSet(double d[]) throws IllegalArgumentException {<a name="line.510"></a>
+<FONT color="green">511</FONT>            if (!isPowerOf2(d.length)) {<a name="line.511"></a>
+<FONT color="green">512</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.512"></a>
+<FONT color="green">513</FONT>                        NOT_POWER_OF_TWO_MESSAGE, d.length);<a name="line.513"></a>
+<FONT color="green">514</FONT>            }<a name="line.514"></a>
+<FONT color="green">515</FONT>        }<a name="line.515"></a>
+<FONT color="green">516</FONT>    <a name="line.516"></a>
+<FONT color="green">517</FONT>        /**<a name="line.517"></a>
+<FONT color="green">518</FONT>         * Verifies that the data set has length of power of 2.<a name="line.518"></a>
+<FONT color="green">519</FONT>         *<a name="line.519"></a>
+<FONT color="green">520</FONT>         * @param o the data array<a name="line.520"></a>
+<FONT color="green">521</FONT>         * @throws IllegalArgumentException if array length is not power of 2<a name="line.521"></a>
+<FONT color="green">522</FONT>         */<a name="line.522"></a>
+<FONT color="green">523</FONT>        public static void verifyDataSet(Object o[]) throws IllegalArgumentException {<a name="line.523"></a>
+<FONT color="green">524</FONT>            if (!isPowerOf2(o.length)) {<a name="line.524"></a>
+<FONT color="green">525</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.525"></a>
+<FONT color="green">526</FONT>                        NOT_POWER_OF_TWO_MESSAGE, o.length);<a name="line.526"></a>
+<FONT color="green">527</FONT>            }<a name="line.527"></a>
+<FONT color="green">528</FONT>        }<a name="line.528"></a>
+<FONT color="green">529</FONT>    <a name="line.529"></a>
+<FONT color="green">530</FONT>        /**<a name="line.530"></a>
+<FONT color="green">531</FONT>         * Verifies that the endpoints specify an interval.<a name="line.531"></a>
+<FONT color="green">532</FONT>         *<a name="line.532"></a>
+<FONT color="green">533</FONT>         * @param lower lower endpoint<a name="line.533"></a>
+<FONT color="green">534</FONT>         * @param upper upper endpoint<a name="line.534"></a>
+<FONT color="green">535</FONT>         * @throws IllegalArgumentException if not interval<a name="line.535"></a>
+<FONT color="green">536</FONT>         */<a name="line.536"></a>
+<FONT color="green">537</FONT>        public static void verifyInterval(double lower, double upper)<a name="line.537"></a>
+<FONT color="green">538</FONT>            throws IllegalArgumentException {<a name="line.538"></a>
+<FONT color="green">539</FONT>    <a name="line.539"></a>
+<FONT color="green">540</FONT>            if (lower &gt;= upper) {<a name="line.540"></a>
+<FONT color="green">541</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.541"></a>
+<FONT color="green">542</FONT>                        "endpoints do not specify an interval: [{0}, {1}]",<a name="line.542"></a>
+<FONT color="green">543</FONT>                        lower, upper);<a name="line.543"></a>
+<FONT color="green">544</FONT>            }<a name="line.544"></a>
+<FONT color="green">545</FONT>        }<a name="line.545"></a>
+<FONT color="green">546</FONT>    <a name="line.546"></a>
+<FONT color="green">547</FONT>        /**<a name="line.547"></a>
+<FONT color="green">548</FONT>         * Performs a multi-dimensional Fourier transform on a given array.<a name="line.548"></a>
+<FONT color="green">549</FONT>         * Use {@link #inversetransform2(Complex[])} and<a name="line.549"></a>
+<FONT color="green">550</FONT>         * {@link #transform2(Complex[])} in a row-column implementation<a name="line.550"></a>
+<FONT color="green">551</FONT>         * in any number of dimensions with O(N&amp;times;log(N)) complexity with<a name="line.551"></a>
+<FONT color="green">552</FONT>         * N=n&lt;sub&gt;1&lt;/sub&gt;&amp;times;n&lt;sub&gt;2&lt;/sub&gt;&amp;times;n&lt;sub&gt;3&lt;/sub&gt;&amp;times;...&amp;times;n&lt;sub&gt;d&lt;/sub&gt;,<a name="line.552"></a>
+<FONT color="green">553</FONT>         * n&lt;sub&gt;x&lt;/sub&gt;=number of elements in dimension x,<a name="line.553"></a>
+<FONT color="green">554</FONT>         * and d=total number of dimensions.<a name="line.554"></a>
+<FONT color="green">555</FONT>         *<a name="line.555"></a>
+<FONT color="green">556</FONT>         * @param mdca Multi-Dimensional Complex Array id est Complex[][][][]<a name="line.556"></a>
+<FONT color="green">557</FONT>         * @param forward inverseTransform2 is preformed if this is false<a name="line.557"></a>
+<FONT color="green">558</FONT>         * @return transform of mdca as a Multi-Dimensional Complex Array id est Complex[][][][]<a name="line.558"></a>
+<FONT color="green">559</FONT>         * @throws IllegalArgumentException if any dimension is not a power of two<a name="line.559"></a>
+<FONT color="green">560</FONT>         */<a name="line.560"></a>
+<FONT color="green">561</FONT>        public Object mdfft(Object mdca, boolean forward)<a name="line.561"></a>
+<FONT color="green">562</FONT>            throws IllegalArgumentException {<a name="line.562"></a>
+<FONT color="green">563</FONT>            MultiDimensionalComplexMatrix mdcm = (MultiDimensionalComplexMatrix)<a name="line.563"></a>
+<FONT color="green">564</FONT>                    new MultiDimensionalComplexMatrix(mdca).clone();<a name="line.564"></a>
+<FONT color="green">565</FONT>            int[] dimensionSize = mdcm.getDimensionSizes();<a name="line.565"></a>
+<FONT color="green">566</FONT>            //cycle through each dimension<a name="line.566"></a>
+<FONT color="green">567</FONT>            for (int i = 0; i &lt; dimensionSize.length; i++) {<a name="line.567"></a>
+<FONT color="green">568</FONT>                mdfft(mdcm, forward, i, new int[0]);<a name="line.568"></a>
+<FONT color="green">569</FONT>            }<a name="line.569"></a>
+<FONT color="green">570</FONT>            return mdcm.getArray();<a name="line.570"></a>
+<FONT color="green">571</FONT>        }<a name="line.571"></a>
+<FONT color="green">572</FONT>    <a name="line.572"></a>
+<FONT color="green">573</FONT>        /**<a name="line.573"></a>
+<FONT color="green">574</FONT>         * Performs one dimension of a multi-dimensional Fourier transform.<a name="line.574"></a>
+<FONT color="green">575</FONT>         *<a name="line.575"></a>
+<FONT color="green">576</FONT>         * @param mdcm input matrix<a name="line.576"></a>
+<FONT color="green">577</FONT>         * @param forward inverseTransform2 is preformed if this is false<a name="line.577"></a>
+<FONT color="green">578</FONT>         * @param d index of the dimension to process<a name="line.578"></a>
+<FONT color="green">579</FONT>         * @param subVector recursion subvector<a name="line.579"></a>
+<FONT color="green">580</FONT>         * @throws IllegalArgumentException if any dimension is not a power of two<a name="line.580"></a>
+<FONT color="green">581</FONT>         */<a name="line.581"></a>
+<FONT color="green">582</FONT>        private void mdfft(MultiDimensionalComplexMatrix mdcm, boolean forward,<a name="line.582"></a>
+<FONT color="green">583</FONT>                           int d, int[] subVector)<a name="line.583"></a>
+<FONT color="green">584</FONT>            throws IllegalArgumentException {<a name="line.584"></a>
+<FONT color="green">585</FONT>            int[] dimensionSize = mdcm.getDimensionSizes();<a name="line.585"></a>
+<FONT color="green">586</FONT>            //if done<a name="line.586"></a>
+<FONT color="green">587</FONT>            if (subVector.length == dimensionSize.length) {<a name="line.587"></a>
+<FONT color="green">588</FONT>                Complex[] temp = new Complex[dimensionSize[d]];<a name="line.588"></a>
+<FONT color="green">589</FONT>                for (int i = 0; i &lt; dimensionSize[d]; i++) {<a name="line.589"></a>
+<FONT color="green">590</FONT>                    //fft along dimension d<a name="line.590"></a>
+<FONT color="green">591</FONT>                    subVector[d] = i;<a name="line.591"></a>
+<FONT color="green">592</FONT>                    temp[i] = mdcm.get(subVector);<a name="line.592"></a>
+<FONT color="green">593</FONT>                }<a name="line.593"></a>
+<FONT color="green">594</FONT>    <a name="line.594"></a>
+<FONT color="green">595</FONT>                if (forward)<a name="line.595"></a>
+<FONT color="green">596</FONT>                    temp = transform2(temp);<a name="line.596"></a>
+<FONT color="green">597</FONT>                else<a name="line.597"></a>
+<FONT color="green">598</FONT>                    temp = inversetransform2(temp);<a name="line.598"></a>
+<FONT color="green">599</FONT>    <a name="line.599"></a>
+<FONT color="green">600</FONT>                for (int i = 0; i &lt; dimensionSize[d]; i++) {<a name="line.600"></a>
+<FONT color="green">601</FONT>                    subVector[d] = i;<a name="line.601"></a>
+<FONT color="green">602</FONT>                    mdcm.set(temp[i], subVector);<a name="line.602"></a>
+<FONT color="green">603</FONT>                }<a name="line.603"></a>
+<FONT color="green">604</FONT>            } else {<a name="line.604"></a>
+<FONT color="green">605</FONT>                int[] vector = new int[subVector.length + 1];<a name="line.605"></a>
+<FONT color="green">606</FONT>                System.arraycopy(subVector, 0, vector, 0, subVector.length);<a name="line.606"></a>
+<FONT color="green">607</FONT>                if (subVector.length == d) {<a name="line.607"></a>
+<FONT color="green">608</FONT>                    //value is not important once the recursion is done.<a name="line.608"></a>
+<FONT color="green">609</FONT>                    //then an fft will be applied along the dimension d.<a name="line.609"></a>
+<FONT color="green">610</FONT>                    vector[d] = 0;<a name="line.610"></a>
+<FONT color="green">611</FONT>                    mdfft(mdcm, forward, d, vector);<a name="line.611"></a>
+<FONT color="green">612</FONT>                } else {<a name="line.612"></a>
+<FONT color="green">613</FONT>                    for (int i = 0; i &lt; dimensionSize[subVector.length]; i++) {<a name="line.613"></a>
+<FONT color="green">614</FONT>                        vector[subVector.length] = i;<a name="line.614"></a>
+<FONT color="green">615</FONT>                        //further split along the next dimension<a name="line.615"></a>
+<FONT color="green">616</FONT>                        mdfft(mdcm, forward, d, vector);<a name="line.616"></a>
+<FONT color="green">617</FONT>                    }<a name="line.617"></a>
+<FONT color="green">618</FONT>                }<a name="line.618"></a>
+<FONT color="green">619</FONT>            }<a name="line.619"></a>
+<FONT color="green">620</FONT>            return;<a name="line.620"></a>
+<FONT color="green">621</FONT>        }<a name="line.621"></a>
+<FONT color="green">622</FONT>    <a name="line.622"></a>
+<FONT color="green">623</FONT>        /**<a name="line.623"></a>
+<FONT color="green">624</FONT>         * Complex matrix implementation.<a name="line.624"></a>
+<FONT color="green">625</FONT>         * Not designed for synchronized access<a name="line.625"></a>
+<FONT color="green">626</FONT>         * may eventually be replaced by jsr-83 of the java community process<a name="line.626"></a>
+<FONT color="green">627</FONT>         * http://jcp.org/en/jsr/detail?id=83<a name="line.627"></a>
+<FONT color="green">628</FONT>         * may require additional exception throws for other basic requirements.<a name="line.628"></a>
+<FONT color="green">629</FONT>         */<a name="line.629"></a>
+<FONT color="green">630</FONT>        private static class MultiDimensionalComplexMatrix<a name="line.630"></a>
+<FONT color="green">631</FONT>            implements Cloneable {<a name="line.631"></a>
+<FONT color="green">632</FONT>    <a name="line.632"></a>
+<FONT color="green">633</FONT>            /** Size in all dimensions. */<a name="line.633"></a>
+<FONT color="green">634</FONT>            protected int[] dimensionSize;<a name="line.634"></a>
+<FONT color="green">635</FONT>    <a name="line.635"></a>
+<FONT color="green">636</FONT>            /** Storage array. */<a name="line.636"></a>
+<FONT color="green">637</FONT>            protected Object multiDimensionalComplexArray;<a name="line.637"></a>
+<FONT color="green">638</FONT>    <a name="line.638"></a>
+<FONT color="green">639</FONT>            /** Simple constructor.<a name="line.639"></a>
+<FONT color="green">640</FONT>             * @param multiDimensionalComplexArray array containing the matrix elements<a name="line.640"></a>
+<FONT color="green">641</FONT>             */<a name="line.641"></a>
+<FONT color="green">642</FONT>            public MultiDimensionalComplexMatrix(Object multiDimensionalComplexArray) {<a name="line.642"></a>
+<FONT color="green">643</FONT>    <a name="line.643"></a>
+<FONT color="green">644</FONT>                this.multiDimensionalComplexArray = multiDimensionalComplexArray;<a name="line.644"></a>
+<FONT color="green">645</FONT>    <a name="line.645"></a>
+<FONT color="green">646</FONT>                // count dimensions<a name="line.646"></a>
+<FONT color="green">647</FONT>                int numOfDimensions = 0;<a name="line.647"></a>
+<FONT color="green">648</FONT>                for (Object lastDimension = multiDimensionalComplexArray;<a name="line.648"></a>
+<FONT color="green">649</FONT>                     lastDimension instanceof Object[];) {<a name="line.649"></a>
+<FONT color="green">650</FONT>                    final Object[] array = (Object[]) lastDimension;<a name="line.650"></a>
+<FONT color="green">651</FONT>                    numOfDimensions++;<a name="line.651"></a>
+<FONT color="green">652</FONT>                    lastDimension = array[0];<a name="line.652"></a>
+<FONT color="green">653</FONT>                }<a name="line.653"></a>
+<FONT color="green">654</FONT>    <a name="line.654"></a>
+<FONT color="green">655</FONT>                // allocate array with exact count<a name="line.655"></a>
+<FONT color="green">656</FONT>                dimensionSize = new int[numOfDimensions];<a name="line.656"></a>
+<FONT color="green">657</FONT>    <a name="line.657"></a>
+<FONT color="green">658</FONT>                // fill array<a name="line.658"></a>
+<FONT color="green">659</FONT>                numOfDimensions = 0;<a name="line.659"></a>
+<FONT color="green">660</FONT>                for (Object lastDimension = multiDimensionalComplexArray;<a name="line.660"></a>
+<FONT color="green">661</FONT>                     lastDimension instanceof Object[];) {<a name="line.661"></a>
+<FONT color="green">662</FONT>                    final Object[] array = (Object[]) lastDimension;<a name="line.662"></a>
+<FONT color="green">663</FONT>                    dimensionSize[numOfDimensions++] = array.length;<a name="line.663"></a>
+<FONT color="green">664</FONT>                    lastDimension = array[0];<a name="line.664"></a>
+<FONT color="green">665</FONT>                }<a name="line.665"></a>
+<FONT color="green">666</FONT>    <a name="line.666"></a>
+<FONT color="green">667</FONT>            }<a name="line.667"></a>
+<FONT color="green">668</FONT>    <a name="line.668"></a>
+<FONT color="green">669</FONT>            /**<a name="line.669"></a>
+<FONT color="green">670</FONT>             * Get a matrix element.<a name="line.670"></a>
+<FONT color="green">671</FONT>             * @param vector indices of the element<a name="line.671"></a>
+<FONT color="green">672</FONT>             * @return matrix element<a name="line.672"></a>
+<FONT color="green">673</FONT>             * @exception IllegalArgumentException if dimensions do not match<a name="line.673"></a>
+<FONT color="green">674</FONT>             */<a name="line.674"></a>
+<FONT color="green">675</FONT>            public Complex get(int... vector)<a name="line.675"></a>
+<FONT color="green">676</FONT>                throws IllegalArgumentException {<a name="line.676"></a>
+<FONT color="green">677</FONT>                if (vector == null) {<a name="line.677"></a>
+<FONT color="green">678</FONT>                    if (dimensionSize.length &gt; 0) {<a name="line.678"></a>
+<FONT color="green">679</FONT>                        throw MathRuntimeException.createIllegalArgumentException(<a name="line.679"></a>
+<FONT color="green">680</FONT>                                DIMENSION_MISMATCH_MESSAGE, 0, dimensionSize.length);<a name="line.680"></a>
+<FONT color="green">681</FONT>                    }<a name="line.681"></a>
+<FONT color="green">682</FONT>                    return null;<a name="line.682"></a>
+<FONT color="green">683</FONT>                }<a name="line.683"></a>
+<FONT color="green">684</FONT>                if (vector.length != dimensionSize.length) {<a name="line.684"></a>
+<FONT color="green">685</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.685"></a>
+<FONT color="green">686</FONT>                            DIMENSION_MISMATCH_MESSAGE, vector.length, dimensionSize.length);<a name="line.686"></a>
+<FONT color="green">687</FONT>                }<a name="line.687"></a>
+<FONT color="green">688</FONT>    <a name="line.688"></a>
+<FONT color="green">689</FONT>                Object lastDimension = multiDimensionalComplexArray;<a name="line.689"></a>
+<FONT color="green">690</FONT>    <a name="line.690"></a>
+<FONT color="green">691</FONT>                for (int i = 0; i &lt; dimensionSize.length; i++) {<a name="line.691"></a>
+<FONT color="green">692</FONT>                    lastDimension = ((Object[]) lastDimension)[vector[i]];<a name="line.692"></a>
+<FONT color="green">693</FONT>                }<a name="line.693"></a>
+<FONT color="green">694</FONT>                return (Complex) lastDimension;<a name="line.694"></a>
+<FONT color="green">695</FONT>            }<a name="line.695"></a>
+<FONT color="green">696</FONT>    <a name="line.696"></a>
+<FONT color="green">697</FONT>            /**<a name="line.697"></a>
+<FONT color="green">698</FONT>             * Set a matrix element.<a name="line.698"></a>
+<FONT color="green">699</FONT>             * @param magnitude magnitude of the element<a name="line.699"></a>
+<FONT color="green">700</FONT>             * @param vector indices of the element<a name="line.700"></a>
+<FONT color="green">701</FONT>             * @return the previous value<a name="line.701"></a>
+<FONT color="green">702</FONT>             * @exception IllegalArgumentException if dimensions do not match<a name="line.702"></a>
+<FONT color="green">703</FONT>             */<a name="line.703"></a>
+<FONT color="green">704</FONT>            public Complex set(Complex magnitude, int... vector)<a name="line.704"></a>
+<FONT color="green">705</FONT>                throws IllegalArgumentException {<a name="line.705"></a>
+<FONT color="green">706</FONT>                if (vector == null) {<a name="line.706"></a>
+<FONT color="green">707</FONT>                    if (dimensionSize.length &gt; 0) {<a name="line.707"></a>
+<FONT color="green">708</FONT>                        throw MathRuntimeException.createIllegalArgumentException(<a name="line.708"></a>
+<FONT color="green">709</FONT>                                DIMENSION_MISMATCH_MESSAGE, 0, dimensionSize.length);<a name="line.709"></a>
+<FONT color="green">710</FONT>                    }<a name="line.710"></a>
+<FONT color="green">711</FONT>                    return null;<a name="line.711"></a>
+<FONT color="green">712</FONT>                }<a name="line.712"></a>
+<FONT color="green">713</FONT>                if (vector.length != dimensionSize.length) {<a name="line.713"></a>
+<FONT color="green">714</FONT>                    throw MathRuntimeException.createIllegalArgumentException(<a name="line.714"></a>
+<FONT color="green">715</FONT>                            DIMENSION_MISMATCH_MESSAGE, vector.length,dimensionSize.length);<a name="line.715"></a>
+<FONT color="green">716</FONT>                }<a name="line.716"></a>
+<FONT color="green">717</FONT>    <a name="line.717"></a>
+<FONT color="green">718</FONT>                Object[] lastDimension = (Object[]) multiDimensionalComplexArray;<a name="line.718"></a>
+<FONT color="green">719</FONT>                for (int i = 0; i &lt; dimensionSize.length - 1; i++) {<a name="line.719"></a>
+<FONT color="green">720</FONT>                    lastDimension = (Object[]) lastDimension[vector[i]];<a name="line.720"></a>
+<FONT color="green">721</FONT>                }<a name="line.721"></a>
+<FONT color="green">722</FONT>    <a name="line.722"></a>
+<FONT color="green">723</FONT>                Complex lastValue = (Complex) lastDimension[vector[dimensionSize.length - 1]];<a name="line.723"></a>
+<FONT color="green">724</FONT>                lastDimension[vector[dimensionSize.length - 1]] = magnitude;<a name="line.724"></a>
+<FONT color="green">725</FONT>    <a name="line.725"></a>
+<FONT color="green">726</FONT>                return lastValue;<a name="line.726"></a>
+<FONT color="green">727</FONT>            }<a name="line.727"></a>
+<FONT color="green">728</FONT>    <a name="line.728"></a>
+<FONT color="green">729</FONT>            /**<a name="line.729"></a>
+<FONT color="green">730</FONT>             * Get the size in all dimensions.<a name="line.730"></a>
+<FONT color="green">731</FONT>             * @return size in all dimensions<a name="line.731"></a>
+<FONT color="green">732</FONT>             */<a name="line.732"></a>
+<FONT color="green">733</FONT>            public int[] getDimensionSizes() {<a name="line.733"></a>
+<FONT color="green">734</FONT>                return dimensionSize.clone();<a name="line.734"></a>
+<FONT color="green">735</FONT>            }<a name="line.735"></a>
+<FONT color="green">736</FONT>    <a name="line.736"></a>
+<FONT color="green">737</FONT>            /**<a name="line.737"></a>
+<FONT color="green">738</FONT>             * Get the underlying storage array<a name="line.738"></a>
+<FONT color="green">739</FONT>             * @return underlying storage array<a name="line.739"></a>
+<FONT color="green">740</FONT>             */<a name="line.740"></a>
+<FONT color="green">741</FONT>            public Object getArray() {<a name="line.741"></a>
+<FONT color="green">742</FONT>                return multiDimensionalComplexArray;<a name="line.742"></a>
+<FONT color="green">743</FONT>            }<a name="line.743"></a>
+<FONT color="green">744</FONT>    <a name="line.744"></a>
+<FONT color="green">745</FONT>            /** {@inheritDoc} */<a name="line.745"></a>
+<FONT color="green">746</FONT>            @Override<a name="line.746"></a>
+<FONT color="green">747</FONT>            public Object clone() {<a name="line.747"></a>
+<FONT color="green">748</FONT>                MultiDimensionalComplexMatrix mdcm =<a name="line.748"></a>
+<FONT color="green">749</FONT>                        new MultiDimensionalComplexMatrix(Array.newInstance(<a name="line.749"></a>
+<FONT color="green">750</FONT>                        Complex.class, dimensionSize));<a name="line.750"></a>
+<FONT color="green">751</FONT>                clone(mdcm);<a name="line.751"></a>
+<FONT color="green">752</FONT>                return mdcm;<a name="line.752"></a>
+<FONT color="green">753</FONT>            }<a name="line.753"></a>
+<FONT color="green">754</FONT>    <a name="line.754"></a>
+<FONT color="green">755</FONT>            /**<a name="line.755"></a>
+<FONT color="green">756</FONT>             * Copy contents of current array into mdcm.<a name="line.756"></a>
+<FONT color="green">757</FONT>             * @param mdcm array where to copy data<a name="line.757"></a>
+<FONT color="green">758</FONT>             */<a name="line.758"></a>
+<FONT color="green">759</FONT>            private void clone(MultiDimensionalComplexMatrix mdcm) {<a name="line.759"></a>
+<FONT color="green">760</FONT>                int[] vector = new int[dimensionSize.length];<a name="line.760"></a>
+<FONT color="green">761</FONT>                int size = 1;<a name="line.761"></a>
+<FONT color="green">762</FONT>                for (int i = 0; i &lt; dimensionSize.length; i++) {<a name="line.762"></a>
+<FONT color="green">763</FONT>                    size *= dimensionSize[i];<a name="line.763"></a>
+<FONT color="green">764</FONT>                }<a name="line.764"></a>
+<FONT color="green">765</FONT>                int[][] vectorList = new int[size][dimensionSize.length];<a name="line.765"></a>
+<FONT color="green">766</FONT>                for (int[] nextVector: vectorList) {<a name="line.766"></a>
+<FONT color="green">767</FONT>                    System.arraycopy(vector, 0, nextVector, 0,<a name="line.767"></a>
+<FONT color="green">768</FONT>                                     dimensionSize.length);<a name="line.768"></a>
+<FONT color="green">769</FONT>                    for (int i = 0; i &lt; dimensionSize.length; i++) {<a name="line.769"></a>
+<FONT color="green">770</FONT>                        vector[i]++;<a name="line.770"></a>
+<FONT color="green">771</FONT>                        if (vector[i] &lt; dimensionSize[i]) {<a name="line.771"></a>
+<FONT color="green">772</FONT>                            break;<a name="line.772"></a>
+<FONT color="green">773</FONT>                        } else {<a name="line.773"></a>
+<FONT color="green">774</FONT>                            vector[i] = 0;<a name="line.774"></a>
+<FONT color="green">775</FONT>                        }<a name="line.775"></a>
+<FONT color="green">776</FONT>                    }<a name="line.776"></a>
+<FONT color="green">777</FONT>                }<a name="line.777"></a>
+<FONT color="green">778</FONT>    <a name="line.778"></a>
+<FONT color="green">779</FONT>                for (int[] nextVector: vectorList) {<a name="line.779"></a>
+<FONT color="green">780</FONT>                    mdcm.set(get(nextVector), nextVector);<a name="line.780"></a>
+<FONT color="green">781</FONT>                }<a name="line.781"></a>
+<FONT color="green">782</FONT>            }<a name="line.782"></a>
+<FONT color="green">783</FONT>        }<a name="line.783"></a>
+<FONT color="green">784</FONT>    <a name="line.784"></a>
+<FONT color="green">785</FONT>    <a name="line.785"></a>
+<FONT color="green">786</FONT>        /** Computes the n&lt;sup&gt;th&lt;/sup&gt; roots of unity.<a name="line.786"></a>
+<FONT color="green">787</FONT>         * A cache of already computed values is maintained.<a name="line.787"></a>
+<FONT color="green">788</FONT>         */<a name="line.788"></a>
+<FONT color="green">789</FONT>        private static class RootsOfUnity implements Serializable {<a name="line.789"></a>
+<FONT color="green">790</FONT>    <a name="line.790"></a>
+<FONT color="green">791</FONT>          /** Serializable version id. */<a name="line.791"></a>
+<FONT color="green">792</FONT>          private static final long serialVersionUID = 6404784357747329667L;<a name="line.792"></a>
+<FONT color="green">793</FONT>    <a name="line.793"></a>
+<FONT color="green">794</FONT>          /** Number of roots of unity. */<a name="line.794"></a>
+<FONT color="green">795</FONT>          private int      omegaCount;<a name="line.795"></a>
+<FONT color="green">796</FONT>    <a name="line.796"></a>
+<FONT color="green">797</FONT>          /** Real part of the roots. */<a name="line.797"></a>
+<FONT color="green">798</FONT>          private double[] omegaReal;<a name="line.798"></a>
+<FONT color="green">799</FONT>    <a name="line.799"></a>
+<FONT color="green">800</FONT>          /** Imaginary part of the roots for forward transform. */<a name="line.800"></a>
+<FONT color="green">801</FONT>          private double[] omegaImaginaryForward;<a name="line.801"></a>
+<FONT color="green">802</FONT>    <a name="line.802"></a>
+<FONT color="green">803</FONT>          /** Imaginary part of the roots for reverse transform. */<a name="line.803"></a>
+<FONT color="green">804</FONT>          private double[] omegaImaginaryInverse;<a name="line.804"></a>
+<FONT color="green">805</FONT>    <a name="line.805"></a>
+<FONT color="green">806</FONT>          /** Forward/reverse indicator. */<a name="line.806"></a>
+<FONT color="green">807</FONT>          private boolean  isForward;<a name="line.807"></a>
+<FONT color="green">808</FONT>    <a name="line.808"></a>
+<FONT color="green">809</FONT>          /**<a name="line.809"></a>
+<FONT color="green">810</FONT>           * Build an engine for computing then &lt;sup&gt;th&lt;/sup&gt; roots of unity<a name="line.810"></a>
+<FONT color="green">811</FONT>           */<a name="line.811"></a>
+<FONT color="green">812</FONT>          public RootsOfUnity() {<a name="line.812"></a>
+<FONT color="green">813</FONT>    <a name="line.813"></a>
+<FONT color="green">814</FONT>            omegaCount = 0;<a name="line.814"></a>
+<FONT color="green">815</FONT>            omegaReal = null;<a name="line.815"></a>
+<FONT color="green">816</FONT>            omegaImaginaryForward = null;<a name="line.816"></a>
+<FONT color="green">817</FONT>            omegaImaginaryInverse = null;<a name="line.817"></a>
+<FONT color="green">818</FONT>            isForward = true;<a name="line.818"></a>
+<FONT color="green">819</FONT>    <a name="line.819"></a>
+<FONT color="green">820</FONT>          }<a name="line.820"></a>
+<FONT color="green">821</FONT>    <a name="line.821"></a>
+<FONT color="green">822</FONT>          /**<a name="line.822"></a>
+<FONT color="green">823</FONT>           * Check if computation has been done for forward or reverse transform.<a name="line.823"></a>
+<FONT color="green">824</FONT>           * @return true if computation has been done for forward transform<a name="line.824"></a>
+<FONT color="green">825</FONT>           * @throws IllegalStateException if no roots of unity have been computed yet<a name="line.825"></a>
+<FONT color="green">826</FONT>           */<a name="line.826"></a>
+<FONT color="green">827</FONT>          public synchronized boolean isForward() throws IllegalStateException {<a name="line.827"></a>
+<FONT color="green">828</FONT>    <a name="line.828"></a>
+<FONT color="green">829</FONT>            if (omegaCount == 0) {<a name="line.829"></a>
+<FONT color="green">830</FONT>              throw MathRuntimeException.createIllegalStateException(<a name="line.830"></a>
+<FONT color="green">831</FONT>                      MISSING_ROOTS_OF_UNITY_MESSAGE);<a name="line.831"></a>
+<FONT color="green">832</FONT>            }<a name="line.832"></a>
+<FONT color="green">833</FONT>            return isForward;<a name="line.833"></a>
+<FONT color="green">834</FONT>    <a name="line.834"></a>
+<FONT color="green">835</FONT>          }<a name="line.835"></a>
+<FONT color="green">836</FONT>    <a name="line.836"></a>
+<FONT color="green">837</FONT>          /** Computes the n&lt;sup&gt;th&lt;/sup&gt; roots of unity.<a name="line.837"></a>
+<FONT color="green">838</FONT>           * &lt;p&gt;The computed omega[] = { 1, w, w&lt;sup&gt;2&lt;/sup&gt;, ... w&lt;sup&gt;(n-1)&lt;/sup&gt; } where<a name="line.838"></a>
+<FONT color="green">839</FONT>           * w = exp(-2 &amp;pi; i / n), i = &amp;sqrt;(-1).&lt;/p&gt;<a name="line.839"></a>
+<FONT color="green">840</FONT>           * &lt;p&gt;Note that n is positive for<a name="line.840"></a>
+<FONT color="green">841</FONT>           * forward transform and negative for inverse transform.&lt;/p&gt;<a name="line.841"></a>
+<FONT color="green">842</FONT>           * @param n number of roots of unity to compute,<a name="line.842"></a>
+<FONT color="green">843</FONT>           * positive for forward transform, negative for inverse transform<a name="line.843"></a>
+<FONT color="green">844</FONT>           * @throws IllegalArgumentException if n = 0<a name="line.844"></a>
+<FONT color="green">845</FONT>           */<a name="line.845"></a>
+<FONT color="green">846</FONT>          public synchronized void computeOmega(int n) throws IllegalArgumentException {<a name="line.846"></a>
+<FONT color="green">847</FONT>    <a name="line.847"></a>
+<FONT color="green">848</FONT>            if (n == 0) {<a name="line.848"></a>
+<FONT color="green">849</FONT>              throw MathRuntimeException.createIllegalArgumentException(<a name="line.849"></a>
+<FONT color="green">850</FONT>                      "cannot compute 0-th root of unity, indefinite result");<a name="line.850"></a>
+<FONT color="green">851</FONT>            }<a name="line.851"></a>
+<FONT color="green">852</FONT>    <a name="line.852"></a>
+<FONT color="green">853</FONT>            isForward = n &gt; 0;<a name="line.853"></a>
+<FONT color="green">854</FONT>    <a name="line.854"></a>
+<FONT color="green">855</FONT>            // avoid repetitive calculations<a name="line.855"></a>
+<FONT color="green">856</FONT>            final int absN = Math.abs(n);<a name="line.856"></a>
+<FONT color="green">857</FONT>    <a name="line.857"></a>
+<FONT color="green">858</FONT>            if (absN == omegaCount) {<a name="line.858"></a>
+<FONT color="green">859</FONT>                return;<a name="line.859"></a>
+<FONT color="green">860</FONT>            }<a name="line.860"></a>
+<FONT color="green">861</FONT>    <a name="line.861"></a>
+<FONT color="green">862</FONT>            // calculate everything from scratch, for both forward and inverse versions<a name="line.862"></a>
+<FONT color="green">863</FONT>            final double t    = 2.0 * Math.PI / absN;<a name="line.863"></a>
+<FONT color="green">864</FONT>            final double cosT = Math.cos(t);<a name="line.864"></a>
+<FONT color="green">865</FONT>            final double sinT = Math.sin(t);<a name="line.865"></a>
+<FONT color="green">866</FONT>            omegaReal             = new double[absN];<a name="line.866"></a>
+<FONT color="green">867</FONT>            omegaImaginaryForward = new double[absN];<a name="line.867"></a>
+<FONT color="green">868</FONT>            omegaImaginaryInverse = new double[absN];<a name="line.868"></a>
+<FONT color="green">869</FONT>            omegaReal[0]             = 1.0;<a name="line.869"></a>
+<FONT color="green">870</FONT>            omegaImaginaryForward[0] = 0.0;<a name="line.870"></a>
+<FONT color="green">871</FONT>            omegaImaginaryInverse[0] = 0.0;<a name="line.871"></a>
+<FONT color="green">872</FONT>            for (int i = 1; i &lt; absN; i++) {<a name="line.872"></a>
+<FONT color="green">873</FONT>              omegaReal[i] =<a name="line.873"></a>
+<FONT color="green">874</FONT>                omegaReal[i-1] * cosT + omegaImaginaryForward[i-1] * sinT;<a name="line.874"></a>
+<FONT color="green">875</FONT>              omegaImaginaryForward[i] =<a name="line.875"></a>
+<FONT color="green">876</FONT>                 omegaImaginaryForward[i-1] * cosT - omegaReal[i-1] * sinT;<a name="line.876"></a>
+<FONT color="green">877</FONT>              omegaImaginaryInverse[i] = -omegaImaginaryForward[i];<a name="line.877"></a>
+<FONT color="green">878</FONT>            }<a name="line.878"></a>
+<FONT color="green">879</FONT>            omegaCount = absN;<a name="line.879"></a>
+<FONT color="green">880</FONT>    <a name="line.880"></a>
+<FONT color="green">881</FONT>          }<a name="line.881"></a>
+<FONT color="green">882</FONT>    <a name="line.882"></a>
+<FONT color="green">883</FONT>          /**<a name="line.883"></a>
+<FONT color="green">884</FONT>           * Get the real part of the k&lt;sup&gt;th&lt;/sup&gt; n&lt;sup&gt;th&lt;/sup&gt; root of unity<a name="line.884"></a>
+<FONT color="green">885</FONT>           * @param k index of the n&lt;sup&gt;th&lt;/sup&gt; root of unity<a name="line.885"></a>
+<FONT color="green">886</FONT>           * @return real part of the k&lt;sup&gt;th&lt;/sup&gt; n&lt;sup&gt;th&lt;/sup&gt; root of unity<a name="line.886"></a>
+<FONT color="green">887</FONT>           * @throws IllegalStateException if no roots of unity have been computed yet<a name="line.887"></a>
+<FONT color="green">888</FONT>           * @throws IllegalArgumentException if k is out of range<a name="line.888"></a>
+<FONT color="green">889</FONT>           */<a name="line.889"></a>
+<FONT color="green">890</FONT>          public synchronized double getOmegaReal(int k)<a name="line.890"></a>
+<FONT color="green">891</FONT>            throws IllegalStateException, IllegalArgumentException {<a name="line.891"></a>
+<FONT color="green">892</FONT>    <a name="line.892"></a>
+<FONT color="green">893</FONT>            if (omegaCount == 0) {<a name="line.893"></a>
+<FONT color="green">894</FONT>                throw MathRuntimeException.createIllegalStateException(<a name="line.894"></a>
+<FONT color="green">895</FONT>                        MISSING_ROOTS_OF_UNITY_MESSAGE);<a name="line.895"></a>
+<FONT color="green">896</FONT>            }<a name="line.896"></a>
+<FONT color="green">897</FONT>            if ((k &lt; 0) || (k &gt;= omegaCount)) {<a name="line.897"></a>
+<FONT color="green">898</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.898"></a>
+<FONT color="green">899</FONT>                        OUT_OF_RANGE_ROOT_INDEX_MESSAGE, k, 0, omegaCount - 1);<a name="line.899"></a>
+<FONT color="green">900</FONT>            }<a name="line.900"></a>
+<FONT color="green">901</FONT>    <a name="line.901"></a>
+<FONT color="green">902</FONT>            return omegaReal[k];<a name="line.902"></a>
+<FONT color="green">903</FONT>    <a name="line.903"></a>
+<FONT color="green">904</FONT>          }<a name="line.904"></a>
+<FONT color="green">905</FONT>    <a name="line.905"></a>
+<FONT color="green">906</FONT>          /**<a name="line.906"></a>
+<FONT color="green">907</FONT>           * Get the imaginary part of the k&lt;sup&gt;th&lt;/sup&gt; n&lt;sup&gt;th&lt;/sup&gt; root of unity<a name="line.907"></a>
+<FONT color="green">908</FONT>           * @param k index of the n&lt;sup&gt;th&lt;/sup&gt; root of unity<a name="line.908"></a>
+<FONT color="green">909</FONT>           * @return imaginary part of the k&lt;sup&gt;th&lt;/sup&gt; n&lt;sup&gt;th&lt;/sup&gt; root of unity<a name="line.909"></a>
+<FONT color="green">910</FONT>           * @throws IllegalStateException if no roots of unity have been computed yet<a name="line.910"></a>
+<FONT color="green">911</FONT>           * @throws IllegalArgumentException if k is out of range<a name="line.911"></a>
+<FONT color="green">912</FONT>           */<a name="line.912"></a>
+<FONT color="green">913</FONT>          public synchronized double getOmegaImaginary(int k)<a name="line.913"></a>
+<FONT color="green">914</FONT>            throws IllegalStateException, IllegalArgumentException {<a name="line.914"></a>
+<FONT color="green">915</FONT>    <a name="line.915"></a>
+<FONT color="green">916</FONT>            if (omegaCount == 0) {<a name="line.916"></a>
+<FONT color="green">917</FONT>                throw MathRuntimeException.createIllegalStateException(<a name="line.917"></a>
+<FONT color="green">918</FONT>                        MISSING_ROOTS_OF_UNITY_MESSAGE);<a name="line.918"></a>
+<FONT color="green">919</FONT>            }<a name="line.919"></a>
+<FONT color="green">920</FONT>            if ((k &lt; 0) || (k &gt;= omegaCount)) {<a name="line.920"></a>
+<FONT color="green">921</FONT>              throw MathRuntimeException.createIllegalArgumentException(<a name="line.921"></a>
+<FONT color="green">922</FONT>                      OUT_OF_RANGE_ROOT_INDEX_MESSAGE, k, 0, omegaCount - 1);<a name="line.922"></a>
+<FONT color="green">923</FONT>            }<a name="line.923"></a>
+<FONT color="green">924</FONT>    <a name="line.924"></a>
+<FONT color="green">925</FONT>            return isForward ? omegaImaginaryForward[k] : omegaImaginaryInverse[k];<a name="line.925"></a>
+<FONT color="green">926</FONT>    <a name="line.926"></a>
+<FONT color="green">927</FONT>          }<a name="line.927"></a>
+<FONT color="green">928</FONT>    <a name="line.928"></a>
+<FONT color="green">929</FONT>        }<a name="line.929"></a>
+<FONT color="green">930</FONT>    <a name="line.930"></a>
+<FONT color="green">931</FONT>    }<a name="line.931"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/transform/FastHadamardTransformer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,317 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.transform;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Implements the &lt;a href="http://www.archive.chipcenter.com/dsp/DSP000517F1.html"&gt;Fast Hadamard Transform&lt;/a&gt; (FHT).<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Transformation of an input vector x to the output vector y.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;In addition to transformation of real vectors, the Hadamard transform can<a name="line.26"></a>
+<FONT color="green">027</FONT>     * transform integer vectors into integer vectors. However, this integer transform<a name="line.27"></a>
+<FONT color="green">028</FONT>     * cannot be inverted directly. Due to a scaling factor it may lead to rational results.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * As an example, the inverse transform of integer vector (0, 1, 0, 1) is rational<a name="line.29"></a>
+<FONT color="green">030</FONT>     * vector (1/2, -1/2, 0, 0).&lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 2.0<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public class FastHadamardTransformer implements RealTransformer {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** {@inheritDoc} */<a name="line.36"></a>
+<FONT color="green">037</FONT>        public double[] transform(double f[])<a name="line.37"></a>
+<FONT color="green">038</FONT>            throws IllegalArgumentException {<a name="line.38"></a>
+<FONT color="green">039</FONT>            return fht(f);<a name="line.39"></a>
+<FONT color="green">040</FONT>        }<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /** {@inheritDoc} */<a name="line.42"></a>
+<FONT color="green">043</FONT>        public double[] transform(UnivariateRealFunction f,<a name="line.43"></a>
+<FONT color="green">044</FONT>                                  double min, double max, int n)<a name="line.44"></a>
+<FONT color="green">045</FONT>            throws FunctionEvaluationException, IllegalArgumentException {<a name="line.45"></a>
+<FONT color="green">046</FONT>            return fht(FastFourierTransformer.sample(f, min, max, n));<a name="line.46"></a>
+<FONT color="green">047</FONT>        }<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** {@inheritDoc} */<a name="line.49"></a>
+<FONT color="green">050</FONT>        public double[] inversetransform(double f[])<a name="line.50"></a>
+<FONT color="green">051</FONT>        throws IllegalArgumentException {<a name="line.51"></a>
+<FONT color="green">052</FONT>            return FastFourierTransformer.scaleArray(fht(f), 1.0 / f.length);<a name="line.52"></a>
+<FONT color="green">053</FONT>       }<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** {@inheritDoc} */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public double[] inversetransform(UnivariateRealFunction f,<a name="line.56"></a>
+<FONT color="green">057</FONT>                                         double min, double max, int n)<a name="line.57"></a>
+<FONT color="green">058</FONT>            throws FunctionEvaluationException, IllegalArgumentException {<a name="line.58"></a>
+<FONT color="green">059</FONT>            final double[] unscaled =<a name="line.59"></a>
+<FONT color="green">060</FONT>                fht(FastFourierTransformer.sample(f, min, max, n));<a name="line.60"></a>
+<FONT color="green">061</FONT>            return FastFourierTransformer.scaleArray(unscaled, 1.0 / n);<a name="line.61"></a>
+<FONT color="green">062</FONT>        }<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /**<a name="line.64"></a>
+<FONT color="green">065</FONT>         * Transform the given real data set.<a name="line.65"></a>
+<FONT color="green">066</FONT>         * &lt;p&gt;The integer transform cannot be inverted directly, due to a scaling<a name="line.66"></a>
+<FONT color="green">067</FONT>         * factor it may lead to double results.&lt;/p&gt;<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param f the integer data array to be transformed (signal)<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @return the integer transformed array (spectrum)<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.70"></a>
+<FONT color="green">071</FONT>         */<a name="line.71"></a>
+<FONT color="green">072</FONT>        public int[] transform(int f[])<a name="line.72"></a>
+<FONT color="green">073</FONT>            throws IllegalArgumentException {<a name="line.73"></a>
+<FONT color="green">074</FONT>            return fht(f);<a name="line.74"></a>
+<FONT color="green">075</FONT>        }<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /**<a name="line.77"></a>
+<FONT color="green">078</FONT>         * The FHT (Fast Hadamard Transformation) which uses only subtraction and addition.<a name="line.78"></a>
+<FONT color="green">079</FONT>         * &lt;br&gt;<a name="line.79"></a>
+<FONT color="green">080</FONT>         * Requires &lt;b&gt;Nlog2N = n2&lt;/b&gt;&lt;sup&gt;n&lt;/sup&gt; additions.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * &lt;br&gt;<a name="line.81"></a>
+<FONT color="green">082</FONT>         * &lt;br&gt;<a name="line.82"></a>
+<FONT color="green">083</FONT>         * &lt;b&gt;&lt;u&gt;Short Table of manual calculation for N=8:&lt;/u&gt;&lt;/b&gt;<a name="line.83"></a>
+<FONT color="green">084</FONT>         * &lt;ol&gt;<a name="line.84"></a>
+<FONT color="green">085</FONT>         * &lt;li&gt;&lt;b&gt;x&lt;/b&gt; is the input vector we want to transform&lt;/li&gt;<a name="line.85"></a>
+<FONT color="green">086</FONT>         * &lt;li&gt;&lt;b&gt;y&lt;/b&gt; is the output vector which is our desired result&lt;/li&gt;<a name="line.86"></a>
+<FONT color="green">087</FONT>         * &lt;li&gt;a and b are just helper rows&lt;/li&gt;<a name="line.87"></a>
+<FONT color="green">088</FONT>         * &lt;/ol&gt;<a name="line.88"></a>
+<FONT color="green">089</FONT>         * &lt;pre&gt;<a name="line.89"></a>
+<FONT color="green">090</FONT>         * &lt;code&gt;<a name="line.90"></a>
+<FONT color="green">091</FONT>         * +----+----------+---------+----------+<a name="line.91"></a>
+<FONT color="green">092</FONT>         * | &lt;b&gt;x&lt;/b&gt;  |    &lt;b&gt;a&lt;/b&gt;     |    &lt;b&gt;b&lt;/b&gt;    |    &lt;b&gt;y&lt;/b&gt;     |<a name="line.92"></a>
+<FONT color="green">093</FONT>         * +----+----------+---------+----------+<a name="line.93"></a>
+<FONT color="green">094</FONT>         * | x&lt;sub&gt;0&lt;/sub&gt; | a&lt;sub&gt;0&lt;/sub&gt;=x&lt;sub&gt;0&lt;/sub&gt;+x&lt;sub&gt;1&lt;/sub&gt; | b&lt;sub&gt;0&lt;/sub&gt;=a&lt;sub&gt;0&lt;/sub&gt;+a&lt;sub&gt;1&lt;/sub&gt; | y&lt;sub&gt;0&lt;/sub&gt;=b&lt;sub&gt;0&lt;/sub&gt;+b&lt;sub&gt;1&lt;/sub&gt; |<a name="line.94"></a>
+<FONT color="green">095</FONT>         * +----+----------+---------+----------+<a name="line.95"></a>
+<FONT color="green">096</FONT>         * | x&lt;sub&gt;1&lt;/sub&gt; | a&lt;sub&gt;1&lt;/sub&gt;=x&lt;sub&gt;2&lt;/sub&gt;+x&lt;sub&gt;3&lt;/sub&gt; | b&lt;sub&gt;0&lt;/sub&gt;=a&lt;sub&gt;2&lt;/sub&gt;+a&lt;sub&gt;3&lt;/sub&gt; | y&lt;sub&gt;0&lt;/sub&gt;=b&lt;sub&gt;2&lt;/sub&gt;+b&lt;sub&gt;3&lt;/sub&gt; |<a name="line.96"></a>
+<FONT color="green">097</FONT>         * +----+----------+---------+----------+<a name="line.97"></a>
+<FONT color="green">098</FONT>         * | x&lt;sub&gt;2&lt;/sub&gt; | a&lt;sub&gt;2&lt;/sub&gt;=x&lt;sub&gt;4&lt;/sub&gt;+x&lt;sub&gt;5&lt;/sub&gt; | b&lt;sub&gt;0&lt;/sub&gt;=a&lt;sub&gt;4&lt;/sub&gt;+a&lt;sub&gt;5&lt;/sub&gt; | y&lt;sub&gt;0&lt;/sub&gt;=b&lt;sub&gt;4&lt;/sub&gt;+b&lt;sub&gt;5&lt;/sub&gt; |<a name="line.98"></a>
+<FONT color="green">099</FONT>         * +----+----------+---------+----------+<a name="line.99"></a>
+<FONT color="green">100</FONT>         * | x&lt;sub&gt;3&lt;/sub&gt; | a&lt;sub&gt;3&lt;/sub&gt;=x&lt;sub&gt;6&lt;/sub&gt;+x&lt;sub&gt;7&lt;/sub&gt; | b&lt;sub&gt;0&lt;/sub&gt;=a&lt;sub&gt;6&lt;/sub&gt;+a&lt;sub&gt;7&lt;/sub&gt; | y&lt;sub&gt;0&lt;/sub&gt;=b&lt;sub&gt;6&lt;/sub&gt;+b&lt;sub&gt;7&lt;/sub&gt; |<a name="line.100"></a>
+<FONT color="green">101</FONT>         * +----+----------+---------+----------+<a name="line.101"></a>
+<FONT color="green">102</FONT>         * | x&lt;sub&gt;4&lt;/sub&gt; | a&lt;sub&gt;0&lt;/sub&gt;=x&lt;sub&gt;0&lt;/sub&gt;-x&lt;sub&gt;1&lt;/sub&gt; | b&lt;sub&gt;0&lt;/sub&gt;=a&lt;sub&gt;0&lt;/sub&gt;-a&lt;sub&gt;1&lt;/sub&gt; | y&lt;sub&gt;0&lt;/sub&gt;=b&lt;sub&gt;0&lt;/sub&gt;-b&lt;sub&gt;1&lt;/sub&gt; |<a name="line.102"></a>
+<FONT color="green">103</FONT>         * +----+----------+---------+----------+<a name="line.103"></a>
+<FONT color="green">104</FONT>         * | x&lt;sub&gt;5&lt;/sub&gt; | a&lt;sub&gt;1&lt;/sub&gt;=x&lt;sub&gt;2&lt;/sub&gt;-x&lt;sub&gt;3&lt;/sub&gt; | b&lt;sub&gt;0&lt;/sub&gt;=a&lt;sub&gt;2&lt;/sub&gt;-a&lt;sub&gt;3&lt;/sub&gt; | y&lt;sub&gt;0&lt;/sub&gt;=b&lt;sub&gt;2&lt;/sub&gt;-b&lt;sub&gt;3&lt;/sub&gt; |<a name="line.104"></a>
+<FONT color="green">105</FONT>         * +----+----------+---------+----------+<a name="line.105"></a>
+<FONT color="green">106</FONT>         * | x&lt;sub&gt;6&lt;/sub&gt; | a&lt;sub&gt;2&lt;/sub&gt;=x&lt;sub&gt;4&lt;/sub&gt;-x&lt;sub&gt;5&lt;/sub&gt; | b&lt;sub&gt;0&lt;/sub&gt;=a&lt;sub&gt;4&lt;/sub&gt;-a&lt;sub&gt;5&lt;/sub&gt; | y&lt;sub&gt;0&lt;/sub&gt;=b&lt;sub&gt;4&lt;/sub&gt;-b&lt;sub&gt;5&lt;/sub&gt; |<a name="line.106"></a>
+<FONT color="green">107</FONT>         * +----+----------+---------+----------+<a name="line.107"></a>
+<FONT color="green">108</FONT>         * | x&lt;sub&gt;7&lt;/sub&gt; | a&lt;sub&gt;3&lt;/sub&gt;=x&lt;sub&gt;6&lt;/sub&gt;-x&lt;sub&gt;7&lt;/sub&gt; | b&lt;sub&gt;0&lt;/sub&gt;=a&lt;sub&gt;6&lt;/sub&gt;-a&lt;sub&gt;7&lt;/sub&gt; | y&lt;sub&gt;0&lt;/sub&gt;=b&lt;sub&gt;6&lt;/sub&gt;-b&lt;sub&gt;7&lt;/sub&gt; |<a name="line.108"></a>
+<FONT color="green">109</FONT>         * +----+----------+---------+----------+<a name="line.109"></a>
+<FONT color="green">110</FONT>         * &lt;/code&gt;<a name="line.110"></a>
+<FONT color="green">111</FONT>         * &lt;/pre&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>         *<a name="line.112"></a>
+<FONT color="green">113</FONT>         * &lt;b&gt;&lt;u&gt;How it works&lt;/u&gt;&lt;/b&gt;<a name="line.113"></a>
+<FONT color="green">114</FONT>         * &lt;ol&gt;<a name="line.114"></a>
+<FONT color="green">115</FONT>         * &lt;li&gt;Construct a matrix with N rows and n+1 columns&lt;br&gt;   &lt;b&gt;hadm[n+1][N]&lt;/b&gt;<a name="line.115"></a>
+<FONT color="green">116</FONT>         * &lt;br&gt;&lt;i&gt;(If I use [x][y] it always means [row-offset][column-offset] of a Matrix with n rows and m columns. Its entries go from M[0][0] to M[n][m])&lt;/i&gt;&lt;/li&gt;<a name="line.116"></a>
+<FONT color="green">117</FONT>         * &lt;li&gt;Place the input vector &lt;b&gt;x[N]&lt;/b&gt; in the first column of the matrix &lt;b&gt;hadm&lt;/b&gt;&lt;/li&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>         * &lt;li&gt;The entries of the submatrix D&lt;sub&gt;top&lt;/sub&gt; are calculated as follows.<a name="line.118"></a>
+<FONT color="green">119</FONT>         * &lt;br&gt;D&lt;sub&gt;top&lt;/sub&gt; goes from entry [0][1] to [N/2-1][n+1].<a name="line.119"></a>
+<FONT color="green">120</FONT>         * &lt;br&gt;The columns of D&lt;sub&gt;top&lt;/sub&gt; are the pairwise mutually exclusive sums of the previous column<a name="line.120"></a>
+<FONT color="green">121</FONT>         * &lt;/li&gt;<a name="line.121"></a>
+<FONT color="green">122</FONT>         * &lt;li&gt;The entries of the submatrix D&lt;sub&gt;bottom&lt;/sub&gt; are calculated as follows.<a name="line.122"></a>
+<FONT color="green">123</FONT>         * &lt;br&gt;D&lt;sub&gt;bottom&lt;/sub&gt; goes from entry [N/2][1] to [N][n+1].<a name="line.123"></a>
+<FONT color="green">124</FONT>         * &lt;br&gt;The columns of D&lt;sub&gt;bottom&lt;/sub&gt; are the pairwise differences of the previous column<a name="line.124"></a>
+<FONT color="green">125</FONT>         * &lt;/li&gt;<a name="line.125"></a>
+<FONT color="green">126</FONT>         * &lt;li&gt;How D&lt;sub&gt;top&lt;/sub&gt; and D&lt;sub&gt;bottom&lt;/sub&gt; you can understand best with the example for N=8 above.<a name="line.126"></a>
+<FONT color="green">127</FONT>         * &lt;li&gt;The output vector y is now in the last column of &lt;b&gt;hadm&lt;/b&gt;&lt;/li&gt;<a name="line.127"></a>
+<FONT color="green">128</FONT>         * &lt;li&gt;&lt;i&gt;Algorithm from: http://www.archive.chipcenter.com/dsp/DSP000517F1.html&lt;/i&gt;&lt;/li&gt;<a name="line.128"></a>
+<FONT color="green">129</FONT>         * &lt;/ol&gt;<a name="line.129"></a>
+<FONT color="green">130</FONT>         * &lt;br&gt;<a name="line.130"></a>
+<FONT color="green">131</FONT>         * &lt;b&gt;&lt;u&gt;Visually&lt;/u&gt;&lt;/b&gt;<a name="line.131"></a>
+<FONT color="green">132</FONT>         * &lt;pre&gt;<a name="line.132"></a>
+<FONT color="green">133</FONT>         *        +--------+---+---+---+-----+---+<a name="line.133"></a>
+<FONT color="green">134</FONT>         *        |   0    | 1 | 2 | 3 | ... |n+1|<a name="line.134"></a>
+<FONT color="green">135</FONT>         * +------+--------+---+---+---+-----+---+<a name="line.135"></a>
+<FONT color="green">136</FONT>         * |0     | x&lt;sub&gt;0&lt;/sub&gt;     |       /\            |<a name="line.136"></a>
+<FONT color="green">137</FONT>         * |1     | x&lt;sub&gt;1&lt;/sub&gt;     |       ||            |<a name="line.137"></a>
+<FONT color="green">138</FONT>         * |2     | x&lt;sub&gt;2&lt;/sub&gt;     |   &lt;= D&lt;sub&gt;top&lt;/sub&gt;  =&gt;       |<a name="line.138"></a>
+<FONT color="green">139</FONT>         * |...   | ...    |       ||            |<a name="line.139"></a>
+<FONT color="green">140</FONT>         * |N/2-1 | x&lt;sub&gt;N/2-1&lt;/sub&gt;  |       \/            |<a name="line.140"></a>
+<FONT color="green">141</FONT>         * +------+--------+---+---+---+-----+---+<a name="line.141"></a>
+<FONT color="green">142</FONT>         * |N/2   | x&lt;sub&gt;N/2&lt;/sub&gt;   |       /\            |<a name="line.142"></a>
+<FONT color="green">143</FONT>         * |N/2+1 | x&lt;sub&gt;N/2+1&lt;/sub&gt;  |       ||            |<a name="line.143"></a>
+<FONT color="green">144</FONT>         * |N/2+2 | x&lt;sub&gt;N/2+2&lt;/sub&gt;  |  &lt;= D&lt;sub&gt;bottom&lt;/sub&gt;  =&gt;      | which is in the last column of the matrix<a name="line.144"></a>
+<FONT color="green">145</FONT>         * |...   | ...    |       ||            |<a name="line.145"></a>
+<FONT color="green">146</FONT>         * |N     | x&lt;sub&gt;N/2&lt;/sub&gt;   |        \/           |<a name="line.146"></a>
+<FONT color="green">147</FONT>         * +------+--------+---+---+---+-----+---+<a name="line.147"></a>
+<FONT color="green">148</FONT>         * &lt;/pre&gt;<a name="line.148"></a>
+<FONT color="green">149</FONT>         *<a name="line.149"></a>
+<FONT color="green">150</FONT>         * @param x input vector<a name="line.150"></a>
+<FONT color="green">151</FONT>         * @return y output vector<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @exception IllegalArgumentException if input array is not a power of 2<a name="line.152"></a>
+<FONT color="green">153</FONT>         */<a name="line.153"></a>
+<FONT color="green">154</FONT>        protected double[] fht(double x[]) throws IllegalArgumentException {<a name="line.154"></a>
+<FONT color="green">155</FONT>    <a name="line.155"></a>
+<FONT color="green">156</FONT>            // n is the row count of the input vector x<a name="line.156"></a>
+<FONT color="green">157</FONT>            final int n     = x.length;<a name="line.157"></a>
+<FONT color="green">158</FONT>            final int halfN = n / 2;<a name="line.158"></a>
+<FONT color="green">159</FONT>    <a name="line.159"></a>
+<FONT color="green">160</FONT>            // n has to be of the form n = 2^p !!<a name="line.160"></a>
+<FONT color="green">161</FONT>            if (!FastFourierTransformer.isPowerOf2(n)) {<a name="line.161"></a>
+<FONT color="green">162</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.162"></a>
+<FONT color="green">163</FONT>                        "{0} is not a power of 2",<a name="line.163"></a>
+<FONT color="green">164</FONT>                        n);<a name="line.164"></a>
+<FONT color="green">165</FONT>            }<a name="line.165"></a>
+<FONT color="green">166</FONT>    <a name="line.166"></a>
+<FONT color="green">167</FONT>            // Instead of creating a matrix with p+1 columns and n rows<a name="line.167"></a>
+<FONT color="green">168</FONT>            // we will use two single dimension arrays which we will use in an alternating way.<a name="line.168"></a>
+<FONT color="green">169</FONT>            double[] yPrevious = new double[n];<a name="line.169"></a>
+<FONT color="green">170</FONT>            double[] yCurrent  = x.clone();<a name="line.170"></a>
+<FONT color="green">171</FONT>    <a name="line.171"></a>
+<FONT color="green">172</FONT>            // iterate from left to right (column)<a name="line.172"></a>
+<FONT color="green">173</FONT>            for (int j = 1; j &lt; n; j &lt;&lt;= 1) {<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>                // switch columns<a name="line.175"></a>
+<FONT color="green">176</FONT>                final double[] yTmp = yCurrent;<a name="line.176"></a>
+<FONT color="green">177</FONT>                yCurrent  = yPrevious;<a name="line.177"></a>
+<FONT color="green">178</FONT>                yPrevious = yTmp;<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>                // iterate from top to bottom (row)<a name="line.180"></a>
+<FONT color="green">181</FONT>                for (int i = 0; i &lt; halfN; ++i) {<a name="line.181"></a>
+<FONT color="green">182</FONT>                    // D&lt;sub&gt;top&lt;/sub&gt;<a name="line.182"></a>
+<FONT color="green">183</FONT>                    // The top part works with addition<a name="line.183"></a>
+<FONT color="green">184</FONT>                    final int twoI = 2 * i;<a name="line.184"></a>
+<FONT color="green">185</FONT>                    yCurrent[i] = yPrevious[twoI] + yPrevious[twoI + 1];<a name="line.185"></a>
+<FONT color="green">186</FONT>                }<a name="line.186"></a>
+<FONT color="green">187</FONT>                for (int i = halfN; i &lt; n; ++i) {<a name="line.187"></a>
+<FONT color="green">188</FONT>                    // D&lt;sub&gt;bottom&lt;/sub&gt;<a name="line.188"></a>
+<FONT color="green">189</FONT>                    // The bottom part works with subtraction<a name="line.189"></a>
+<FONT color="green">190</FONT>                    final int twoI = 2 * i;<a name="line.190"></a>
+<FONT color="green">191</FONT>                    yCurrent[i] = yPrevious[twoI - n] - yPrevious[twoI - n + 1];<a name="line.191"></a>
+<FONT color="green">192</FONT>                }<a name="line.192"></a>
+<FONT color="green">193</FONT>            }<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>            // return the last computed output vector y<a name="line.195"></a>
+<FONT color="green">196</FONT>            return yCurrent;<a name="line.196"></a>
+<FONT color="green">197</FONT>    <a name="line.197"></a>
+<FONT color="green">198</FONT>        }<a name="line.198"></a>
+<FONT color="green">199</FONT>        /**<a name="line.199"></a>
+<FONT color="green">200</FONT>         * The FHT (Fast Hadamard Transformation) which uses only subtraction and addition.<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @param x input vector<a name="line.201"></a>
+<FONT color="green">202</FONT>         * @return y output vector<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @exception IllegalArgumentException if input array is not a power of 2<a name="line.203"></a>
+<FONT color="green">204</FONT>         */<a name="line.204"></a>
+<FONT color="green">205</FONT>        protected int[] fht(int x[]) throws IllegalArgumentException {<a name="line.205"></a>
+<FONT color="green">206</FONT>    <a name="line.206"></a>
+<FONT color="green">207</FONT>            // n is the row count of the input vector x<a name="line.207"></a>
+<FONT color="green">208</FONT>            final int n     = x.length;<a name="line.208"></a>
+<FONT color="green">209</FONT>            final int halfN = n / 2;<a name="line.209"></a>
+<FONT color="green">210</FONT>    <a name="line.210"></a>
+<FONT color="green">211</FONT>            // n has to be of the form n = 2^p !!<a name="line.211"></a>
+<FONT color="green">212</FONT>            if (!FastFourierTransformer.isPowerOf2(n)) {<a name="line.212"></a>
+<FONT color="green">213</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.213"></a>
+<FONT color="green">214</FONT>                        "{0} is not a power of 2",<a name="line.214"></a>
+<FONT color="green">215</FONT>                        n);<a name="line.215"></a>
+<FONT color="green">216</FONT>            }<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>            // Instead of creating a matrix with p+1 columns and n rows<a name="line.218"></a>
+<FONT color="green">219</FONT>            // we will use two single dimension arrays which we will use in an alternating way.<a name="line.219"></a>
+<FONT color="green">220</FONT>            int[] yPrevious = new int[n];<a name="line.220"></a>
+<FONT color="green">221</FONT>            int[] yCurrent  = x.clone();<a name="line.221"></a>
+<FONT color="green">222</FONT>    <a name="line.222"></a>
+<FONT color="green">223</FONT>            // iterate from left to right (column)<a name="line.223"></a>
+<FONT color="green">224</FONT>            for (int j = 1; j &lt; n; j &lt;&lt;= 1) {<a name="line.224"></a>
+<FONT color="green">225</FONT>    <a name="line.225"></a>
+<FONT color="green">226</FONT>                // switch columns<a name="line.226"></a>
+<FONT color="green">227</FONT>                final int[] yTmp = yCurrent;<a name="line.227"></a>
+<FONT color="green">228</FONT>                yCurrent  = yPrevious;<a name="line.228"></a>
+<FONT color="green">229</FONT>                yPrevious = yTmp;<a name="line.229"></a>
+<FONT color="green">230</FONT>    <a name="line.230"></a>
+<FONT color="green">231</FONT>                // iterate from top to bottom (row)<a name="line.231"></a>
+<FONT color="green">232</FONT>                for (int i = 0; i &lt; halfN; ++i) {<a name="line.232"></a>
+<FONT color="green">233</FONT>                    // D&lt;sub&gt;top&lt;/sub&gt;<a name="line.233"></a>
+<FONT color="green">234</FONT>                    // The top part works with addition<a name="line.234"></a>
+<FONT color="green">235</FONT>                    final int twoI = 2 * i;<a name="line.235"></a>
+<FONT color="green">236</FONT>                    yCurrent[i] = yPrevious[twoI] + yPrevious[twoI + 1];<a name="line.236"></a>
+<FONT color="green">237</FONT>                }<a name="line.237"></a>
+<FONT color="green">238</FONT>                for (int i = halfN; i &lt; n; ++i) {<a name="line.238"></a>
+<FONT color="green">239</FONT>                    // D&lt;sub&gt;bottom&lt;/sub&gt;<a name="line.239"></a>
+<FONT color="green">240</FONT>                    // The bottom part works with subtraction<a name="line.240"></a>
+<FONT color="green">241</FONT>                    final int twoI = 2 * i;<a name="line.241"></a>
+<FONT color="green">242</FONT>                    yCurrent[i] = yPrevious[twoI - n] - yPrevious[twoI - n + 1];<a name="line.242"></a>
+<FONT color="green">243</FONT>                }<a name="line.243"></a>
+<FONT color="green">244</FONT>            }<a name="line.244"></a>
+<FONT color="green">245</FONT>    <a name="line.245"></a>
+<FONT color="green">246</FONT>            // return the last computed output vector y<a name="line.246"></a>
+<FONT color="green">247</FONT>            return yCurrent;<a name="line.247"></a>
+<FONT color="green">248</FONT>    <a name="line.248"></a>
+<FONT color="green">249</FONT>        }<a name="line.249"></a>
+<FONT color="green">250</FONT>    <a name="line.250"></a>
+<FONT color="green">251</FONT>    }<a name="line.251"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/transform/FastSineTransformer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,318 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.transform;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.complex.Complex;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Implements the &lt;a href="http://documents.wolfram.com/v5/Add-onsLinks/<a name="line.25"></a>
+<FONT color="green">026</FONT>     * StandardPackages/LinearAlgebra/FourierTrig.html"&gt;Fast Sine Transform&lt;/a&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * for transformation of one-dimensional data sets. For reference, see<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;b&gt;Fast Fourier Transforms&lt;/b&gt;, ISBN 0849371635, chapter 3.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * FST is its own inverse, up to a multiplier depending on conventions.<a name="line.30"></a>
+<FONT color="green">031</FONT>     * The equations are listed in the comments of the corresponding methods.&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * Similar to FFT, we also require the length of data set to be power of 2.<a name="line.33"></a>
+<FONT color="green">034</FONT>     * In addition, the first element must be 0 and it's enforced in function<a name="line.34"></a>
+<FONT color="green">035</FONT>     * transformation after sampling.&lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;p&gt;As of version 2.0 this no longer implements Serializable&lt;/p&gt;<a name="line.36"></a>
+<FONT color="green">037</FONT>     *<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @version $Revision: 825919 $ $Date: 2009-10-16 10:51:55 -0400 (Fri, 16 Oct 2009) $<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @since 1.2<a name="line.39"></a>
+<FONT color="green">040</FONT>     */<a name="line.40"></a>
+<FONT color="green">041</FONT>    public class FastSineTransformer implements RealTransformer {<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /**<a name="line.43"></a>
+<FONT color="green">044</FONT>         * Construct a default transformer.<a name="line.44"></a>
+<FONT color="green">045</FONT>         */<a name="line.45"></a>
+<FONT color="green">046</FONT>        public FastSineTransformer() {<a name="line.46"></a>
+<FONT color="green">047</FONT>            super();<a name="line.47"></a>
+<FONT color="green">048</FONT>        }<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /**<a name="line.50"></a>
+<FONT color="green">051</FONT>         * Transform the given real data set.<a name="line.51"></a>
+<FONT color="green">052</FONT>         * &lt;p&gt;<a name="line.52"></a>
+<FONT color="green">053</FONT>         * The formula is F&lt;sub&gt;n&lt;/sub&gt; = &amp;sum;&lt;sub&gt;k=0&lt;/sub&gt;&lt;sup&gt;N-1&lt;/sup&gt; f&lt;sub&gt;k&lt;/sub&gt; sin(&amp;pi; nk/N)<a name="line.53"></a>
+<FONT color="green">054</FONT>         * &lt;/p&gt;<a name="line.54"></a>
+<FONT color="green">055</FONT>         *<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param f the real data array to be transformed<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @return the real transformed array<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.58"></a>
+<FONT color="green">059</FONT>         */<a name="line.59"></a>
+<FONT color="green">060</FONT>        public double[] transform(double f[])<a name="line.60"></a>
+<FONT color="green">061</FONT>            throws IllegalArgumentException {<a name="line.61"></a>
+<FONT color="green">062</FONT>            return fst(f);<a name="line.62"></a>
+<FONT color="green">063</FONT>        }<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /**<a name="line.65"></a>
+<FONT color="green">066</FONT>         * Transform the given real function, sampled on the given interval.<a name="line.66"></a>
+<FONT color="green">067</FONT>         * &lt;p&gt;<a name="line.67"></a>
+<FONT color="green">068</FONT>         * The formula is F&lt;sub&gt;n&lt;/sub&gt; = &amp;sum;&lt;sub&gt;k=0&lt;/sub&gt;&lt;sup&gt;N-1&lt;/sup&gt; f&lt;sub&gt;k&lt;/sub&gt; sin(&amp;pi; nk/N)<a name="line.68"></a>
+<FONT color="green">069</FONT>         * &lt;/p&gt;<a name="line.69"></a>
+<FONT color="green">070</FONT>         *<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param f the function to be sampled and transformed<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param min the lower bound for the interval<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @param max the upper bound for the interval<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @param n the number of sample points<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @return the real transformed array<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @throws FunctionEvaluationException if function cannot be evaluated<a name="line.76"></a>
+<FONT color="green">077</FONT>         * at some point<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.78"></a>
+<FONT color="green">079</FONT>         */<a name="line.79"></a>
+<FONT color="green">080</FONT>        public double[] transform(UnivariateRealFunction f,<a name="line.80"></a>
+<FONT color="green">081</FONT>                                  double min, double max, int n)<a name="line.81"></a>
+<FONT color="green">082</FONT>            throws FunctionEvaluationException, IllegalArgumentException {<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>            double data[] = FastFourierTransformer.sample(f, min, max, n);<a name="line.84"></a>
+<FONT color="green">085</FONT>            data[0] = 0.0;<a name="line.85"></a>
+<FONT color="green">086</FONT>            return fst(data);<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /**<a name="line.89"></a>
+<FONT color="green">090</FONT>         * Transform the given real data set.<a name="line.90"></a>
+<FONT color="green">091</FONT>         * &lt;p&gt;<a name="line.91"></a>
+<FONT color="green">092</FONT>         * The formula is F&lt;sub&gt;n&lt;/sub&gt; = &amp;radic;(2/N) &amp;sum;&lt;sub&gt;k=0&lt;/sub&gt;&lt;sup&gt;N-1&lt;/sup&gt; f&lt;sub&gt;k&lt;/sub&gt; sin(&amp;pi; nk/N)<a name="line.92"></a>
+<FONT color="green">093</FONT>         * &lt;/p&gt;<a name="line.93"></a>
+<FONT color="green">094</FONT>         *<a name="line.94"></a>
+<FONT color="green">095</FONT>         * @param f the real data array to be transformed<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @return the real transformed array<a name="line.96"></a>
+<FONT color="green">097</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.97"></a>
+<FONT color="green">098</FONT>         */<a name="line.98"></a>
+<FONT color="green">099</FONT>        public double[] transform2(double f[]) throws IllegalArgumentException {<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>            double scaling_coefficient = Math.sqrt(2.0 / f.length);<a name="line.101"></a>
+<FONT color="green">102</FONT>            return FastFourierTransformer.scaleArray(fst(f), scaling_coefficient);<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /**<a name="line.105"></a>
+<FONT color="green">106</FONT>         * Transform the given real function, sampled on the given interval.<a name="line.106"></a>
+<FONT color="green">107</FONT>         * &lt;p&gt;<a name="line.107"></a>
+<FONT color="green">108</FONT>         * The formula is F&lt;sub&gt;n&lt;/sub&gt; = &amp;radic;(2/N) &amp;sum;&lt;sub&gt;k=0&lt;/sub&gt;&lt;sup&gt;N-1&lt;/sup&gt; f&lt;sub&gt;k&lt;/sub&gt; sin(&amp;pi; nk/N)<a name="line.108"></a>
+<FONT color="green">109</FONT>         * &lt;/p&gt;<a name="line.109"></a>
+<FONT color="green">110</FONT>         *<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @param f the function to be sampled and transformed<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @param min the lower bound for the interval<a name="line.112"></a>
+<FONT color="green">113</FONT>         * @param max the upper bound for the interval<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param n the number of sample points<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @return the real transformed array<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @throws FunctionEvaluationException if function cannot be evaluated<a name="line.116"></a>
+<FONT color="green">117</FONT>         * at some point<a name="line.117"></a>
+<FONT color="green">118</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.118"></a>
+<FONT color="green">119</FONT>         */<a name="line.119"></a>
+<FONT color="green">120</FONT>        public double[] transform2(<a name="line.120"></a>
+<FONT color="green">121</FONT>            UnivariateRealFunction f, double min, double max, int n)<a name="line.121"></a>
+<FONT color="green">122</FONT>            throws FunctionEvaluationException, IllegalArgumentException {<a name="line.122"></a>
+<FONT color="green">123</FONT>    <a name="line.123"></a>
+<FONT color="green">124</FONT>            double data[] = FastFourierTransformer.sample(f, min, max, n);<a name="line.124"></a>
+<FONT color="green">125</FONT>            data[0] = 0.0;<a name="line.125"></a>
+<FONT color="green">126</FONT>            double scaling_coefficient = Math.sqrt(2.0 / n);<a name="line.126"></a>
+<FONT color="green">127</FONT>            return FastFourierTransformer.scaleArray(fst(data), scaling_coefficient);<a name="line.127"></a>
+<FONT color="green">128</FONT>        }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /**<a name="line.130"></a>
+<FONT color="green">131</FONT>         * Inversely transform the given real data set.<a name="line.131"></a>
+<FONT color="green">132</FONT>         * &lt;p&gt;<a name="line.132"></a>
+<FONT color="green">133</FONT>         * The formula is f&lt;sub&gt;k&lt;/sub&gt; = (2/N) &amp;sum;&lt;sub&gt;n=0&lt;/sub&gt;&lt;sup&gt;N-1&lt;/sup&gt; F&lt;sub&gt;n&lt;/sub&gt; sin(&amp;pi; nk/N)<a name="line.133"></a>
+<FONT color="green">134</FONT>         * &lt;/p&gt;<a name="line.134"></a>
+<FONT color="green">135</FONT>         *<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @param f the real data array to be inversely transformed<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @return the real inversely transformed array<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.138"></a>
+<FONT color="green">139</FONT>         */<a name="line.139"></a>
+<FONT color="green">140</FONT>        public double[] inversetransform(double f[]) throws IllegalArgumentException {<a name="line.140"></a>
+<FONT color="green">141</FONT>    <a name="line.141"></a>
+<FONT color="green">142</FONT>            double scaling_coefficient = 2.0 / f.length;<a name="line.142"></a>
+<FONT color="green">143</FONT>            return FastFourierTransformer.scaleArray(fst(f), scaling_coefficient);<a name="line.143"></a>
+<FONT color="green">144</FONT>        }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>        /**<a name="line.146"></a>
+<FONT color="green">147</FONT>         * Inversely transform the given real function, sampled on the given interval.<a name="line.147"></a>
+<FONT color="green">148</FONT>         * &lt;p&gt;<a name="line.148"></a>
+<FONT color="green">149</FONT>         * The formula is f&lt;sub&gt;k&lt;/sub&gt; = (2/N) &amp;sum;&lt;sub&gt;n=0&lt;/sub&gt;&lt;sup&gt;N-1&lt;/sup&gt; F&lt;sub&gt;n&lt;/sub&gt; sin(&amp;pi; nk/N)<a name="line.149"></a>
+<FONT color="green">150</FONT>         * &lt;/p&gt;<a name="line.150"></a>
+<FONT color="green">151</FONT>         *<a name="line.151"></a>
+<FONT color="green">152</FONT>         * @param f the function to be sampled and inversely transformed<a name="line.152"></a>
+<FONT color="green">153</FONT>         * @param min the lower bound for the interval<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @param max the upper bound for the interval<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @param n the number of sample points<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @return the real inversely transformed array<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @throws FunctionEvaluationException if function cannot be evaluated<a name="line.157"></a>
+<FONT color="green">158</FONT>         * at some point<a name="line.158"></a>
+<FONT color="green">159</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.159"></a>
+<FONT color="green">160</FONT>         */<a name="line.160"></a>
+<FONT color="green">161</FONT>        public double[] inversetransform(UnivariateRealFunction f, double min, double max, int n)<a name="line.161"></a>
+<FONT color="green">162</FONT>            throws FunctionEvaluationException, IllegalArgumentException {<a name="line.162"></a>
+<FONT color="green">163</FONT>    <a name="line.163"></a>
+<FONT color="green">164</FONT>            double data[] = FastFourierTransformer.sample(f, min, max, n);<a name="line.164"></a>
+<FONT color="green">165</FONT>            data[0] = 0.0;<a name="line.165"></a>
+<FONT color="green">166</FONT>            double scaling_coefficient = 2.0 / n;<a name="line.166"></a>
+<FONT color="green">167</FONT>            return FastFourierTransformer.scaleArray(fst(data), scaling_coefficient);<a name="line.167"></a>
+<FONT color="green">168</FONT>        }<a name="line.168"></a>
+<FONT color="green">169</FONT>    <a name="line.169"></a>
+<FONT color="green">170</FONT>        /**<a name="line.170"></a>
+<FONT color="green">171</FONT>         * Inversely transform the given real data set.<a name="line.171"></a>
+<FONT color="green">172</FONT>         * &lt;p&gt;<a name="line.172"></a>
+<FONT color="green">173</FONT>         * The formula is f&lt;sub&gt;k&lt;/sub&gt; = &amp;radic;(2/N) &amp;sum;&lt;sub&gt;n=0&lt;/sub&gt;&lt;sup&gt;N-1&lt;/sup&gt; F&lt;sub&gt;n&lt;/sub&gt; sin(&amp;pi; nk/N)<a name="line.173"></a>
+<FONT color="green">174</FONT>         * &lt;/p&gt;<a name="line.174"></a>
+<FONT color="green">175</FONT>         *<a name="line.175"></a>
+<FONT color="green">176</FONT>         * @param f the real data array to be inversely transformed<a name="line.176"></a>
+<FONT color="green">177</FONT>         * @return the real inversely transformed array<a name="line.177"></a>
+<FONT color="green">178</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.178"></a>
+<FONT color="green">179</FONT>         */<a name="line.179"></a>
+<FONT color="green">180</FONT>        public double[] inversetransform2(double f[]) throws IllegalArgumentException {<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>            return transform2(f);<a name="line.182"></a>
+<FONT color="green">183</FONT>        }<a name="line.183"></a>
+<FONT color="green">184</FONT>    <a name="line.184"></a>
+<FONT color="green">185</FONT>        /**<a name="line.185"></a>
+<FONT color="green">186</FONT>         * Inversely transform the given real function, sampled on the given interval.<a name="line.186"></a>
+<FONT color="green">187</FONT>         * &lt;p&gt;<a name="line.187"></a>
+<FONT color="green">188</FONT>         * The formula is f&lt;sub&gt;k&lt;/sub&gt; = &amp;radic;(2/N) &amp;sum;&lt;sub&gt;n=0&lt;/sub&gt;&lt;sup&gt;N-1&lt;/sup&gt; F&lt;sub&gt;n&lt;/sub&gt; sin(&amp;pi; nk/N)<a name="line.188"></a>
+<FONT color="green">189</FONT>         * &lt;/p&gt;<a name="line.189"></a>
+<FONT color="green">190</FONT>         *<a name="line.190"></a>
+<FONT color="green">191</FONT>         * @param f the function to be sampled and inversely transformed<a name="line.191"></a>
+<FONT color="green">192</FONT>         * @param min the lower bound for the interval<a name="line.192"></a>
+<FONT color="green">193</FONT>         * @param max the upper bound for the interval<a name="line.193"></a>
+<FONT color="green">194</FONT>         * @param n the number of sample points<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @return the real inversely transformed array<a name="line.195"></a>
+<FONT color="green">196</FONT>         * @throws FunctionEvaluationException if function cannot be evaluated<a name="line.196"></a>
+<FONT color="green">197</FONT>         * at some point<a name="line.197"></a>
+<FONT color="green">198</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.198"></a>
+<FONT color="green">199</FONT>         */<a name="line.199"></a>
+<FONT color="green">200</FONT>        public double[] inversetransform2(UnivariateRealFunction f, double min, double max, int n)<a name="line.200"></a>
+<FONT color="green">201</FONT>            throws FunctionEvaluationException, IllegalArgumentException {<a name="line.201"></a>
+<FONT color="green">202</FONT>    <a name="line.202"></a>
+<FONT color="green">203</FONT>            return transform2(f, min, max, n);<a name="line.203"></a>
+<FONT color="green">204</FONT>        }<a name="line.204"></a>
+<FONT color="green">205</FONT>    <a name="line.205"></a>
+<FONT color="green">206</FONT>        /**<a name="line.206"></a>
+<FONT color="green">207</FONT>         * Perform the FST algorithm (including inverse).<a name="line.207"></a>
+<FONT color="green">208</FONT>         *<a name="line.208"></a>
+<FONT color="green">209</FONT>         * @param f the real data array to be transformed<a name="line.209"></a>
+<FONT color="green">210</FONT>         * @return the real transformed array<a name="line.210"></a>
+<FONT color="green">211</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.211"></a>
+<FONT color="green">212</FONT>         */<a name="line.212"></a>
+<FONT color="green">213</FONT>        protected double[] fst(double f[]) throws IllegalArgumentException {<a name="line.213"></a>
+<FONT color="green">214</FONT>    <a name="line.214"></a>
+<FONT color="green">215</FONT>            final double transformed[] = new double[f.length];<a name="line.215"></a>
+<FONT color="green">216</FONT>    <a name="line.216"></a>
+<FONT color="green">217</FONT>            FastFourierTransformer.verifyDataSet(f);<a name="line.217"></a>
+<FONT color="green">218</FONT>            if (f[0] != 0.0) {<a name="line.218"></a>
+<FONT color="green">219</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.219"></a>
+<FONT color="green">220</FONT>                        "first element is not 0: {0}",<a name="line.220"></a>
+<FONT color="green">221</FONT>                        f[0]);<a name="line.221"></a>
+<FONT color="green">222</FONT>            }<a name="line.222"></a>
+<FONT color="green">223</FONT>            final int n = f.length;<a name="line.223"></a>
+<FONT color="green">224</FONT>            if (n == 1) {       // trivial case<a name="line.224"></a>
+<FONT color="green">225</FONT>                transformed[0] = 0.0;<a name="line.225"></a>
+<FONT color="green">226</FONT>                return transformed;<a name="line.226"></a>
+<FONT color="green">227</FONT>            }<a name="line.227"></a>
+<FONT color="green">228</FONT>    <a name="line.228"></a>
+<FONT color="green">229</FONT>            // construct a new array and perform FFT on it<a name="line.229"></a>
+<FONT color="green">230</FONT>            final double[] x = new double[n];<a name="line.230"></a>
+<FONT color="green">231</FONT>            x[0] = 0.0;<a name="line.231"></a>
+<FONT color="green">232</FONT>            x[n &gt;&gt; 1] = 2.0 * f[n &gt;&gt; 1];<a name="line.232"></a>
+<FONT color="green">233</FONT>            for (int i = 1; i &lt; (n &gt;&gt; 1); i++) {<a name="line.233"></a>
+<FONT color="green">234</FONT>                final double a = Math.sin(i * Math.PI / n) * (f[i] + f[n-i]);<a name="line.234"></a>
+<FONT color="green">235</FONT>                final double b = 0.5 * (f[i] - f[n-i]);<a name="line.235"></a>
+<FONT color="green">236</FONT>                x[i]     = a + b;<a name="line.236"></a>
+<FONT color="green">237</FONT>                x[n - i] = a - b;<a name="line.237"></a>
+<FONT color="green">238</FONT>            }<a name="line.238"></a>
+<FONT color="green">239</FONT>            FastFourierTransformer transformer = new FastFourierTransformer();<a name="line.239"></a>
+<FONT color="green">240</FONT>            Complex y[] = transformer.transform(x);<a name="line.240"></a>
+<FONT color="green">241</FONT>    <a name="line.241"></a>
+<FONT color="green">242</FONT>            // reconstruct the FST result for the original array<a name="line.242"></a>
+<FONT color="green">243</FONT>            transformed[0] = 0.0;<a name="line.243"></a>
+<FONT color="green">244</FONT>            transformed[1] = 0.5 * y[0].getReal();<a name="line.244"></a>
+<FONT color="green">245</FONT>            for (int i = 1; i &lt; (n &gt;&gt; 1); i++) {<a name="line.245"></a>
+<FONT color="green">246</FONT>                transformed[2 * i]     = -y[i].getImaginary();<a name="line.246"></a>
+<FONT color="green">247</FONT>                transformed[2 * i + 1] = y[i].getReal() + transformed[2 * i - 1];<a name="line.247"></a>
+<FONT color="green">248</FONT>            }<a name="line.248"></a>
+<FONT color="green">249</FONT>    <a name="line.249"></a>
+<FONT color="green">250</FONT>            return transformed;<a name="line.250"></a>
+<FONT color="green">251</FONT>        }<a name="line.251"></a>
+<FONT color="green">252</FONT>    }<a name="line.252"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/transform/RealTransformer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,148 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.transform;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.FunctionEvaluationException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.analysis.UnivariateRealFunction;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    /**<a name="line.22"></a>
+<FONT color="green">023</FONT>     * Interface for one-dimensional data sets transformations producing real results.<a name="line.23"></a>
+<FONT color="green">024</FONT>     * &lt;p&gt;Such transforms include {@link FastSineTransformer sine transform},<a name="line.24"></a>
+<FONT color="green">025</FONT>     * {@link FastCosineTransformer cosine transform} or {@link<a name="line.25"></a>
+<FONT color="green">026</FONT>     * FastHadamardTransformer Hadamard transform}. {@link FastFourierTransformer<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Fourier transform} is of a different kind and does not implement this<a name="line.27"></a>
+<FONT color="green">028</FONT>     * interface since it produces {@link org.apache.commons.math.complex.Complex complex}<a name="line.28"></a>
+<FONT color="green">029</FONT>     * results instead of real ones.<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;/p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @since 2.0<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public interface RealTransformer  {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /**<a name="line.36"></a>
+<FONT color="green">037</FONT>         * Transform the given real data set.<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @param f the real data array to be transformed (signal)<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @return the real transformed array (spectrum)<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        double[] transform(double f[])<a name="line.42"></a>
+<FONT color="green">043</FONT>            throws IllegalArgumentException;<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**<a name="line.45"></a>
+<FONT color="green">046</FONT>         * Transform the given real function, sampled on the given interval.<a name="line.46"></a>
+<FONT color="green">047</FONT>         * @param f the function to be sampled and transformed<a name="line.47"></a>
+<FONT color="green">048</FONT>         * @param min the lower bound for the interval<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @param max the upper bound for the interval<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @param n the number of sample points<a name="line.50"></a>
+<FONT color="green">051</FONT>         * @return the real transformed array<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @throws FunctionEvaluationException if function cannot be evaluated<a name="line.52"></a>
+<FONT color="green">053</FONT>         * at some point<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        double[] transform(UnivariateRealFunction f, double min, double max, int n)<a name="line.56"></a>
+<FONT color="green">057</FONT>            throws FunctionEvaluationException, IllegalArgumentException;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /**<a name="line.59"></a>
+<FONT color="green">060</FONT>         * Inversely transform the given real data set.<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param f the real data array to be inversely transformed (spectrum)<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @return the real inversely transformed array (signal)<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.63"></a>
+<FONT color="green">064</FONT>         */<a name="line.64"></a>
+<FONT color="green">065</FONT>        double[] inversetransform(double f[])<a name="line.65"></a>
+<FONT color="green">066</FONT>            throws IllegalArgumentException;<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /**<a name="line.68"></a>
+<FONT color="green">069</FONT>         * Inversely transform the given real function, sampled on the given interval.<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @param f the function to be sampled and inversely transformed<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @param min the lower bound for the interval<a name="line.71"></a>
+<FONT color="green">072</FONT>         * @param max the upper bound for the interval<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @param n the number of sample points<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @return the real inversely transformed array<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @throws FunctionEvaluationException if function cannot be evaluated<a name="line.75"></a>
+<FONT color="green">076</FONT>         * at some point<a name="line.76"></a>
+<FONT color="green">077</FONT>         * @throws IllegalArgumentException if any parameters are invalid<a name="line.77"></a>
+<FONT color="green">078</FONT>         */<a name="line.78"></a>
+<FONT color="green">079</FONT>        double[] inversetransform(UnivariateRealFunction f, double min, double max, int n)<a name="line.79"></a>
+<FONT color="green">080</FONT>            throws FunctionEvaluationException, IllegalArgumentException;<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>    }<a name="line.82"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/BigReal.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,358 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.util;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.math.BigDecimal;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.math.BigInteger;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.math.MathContext;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import java.math.RoundingMode;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.Field;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.FieldElement;<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>    /**<a name="line.29"></a>
+<FONT color="green">030</FONT>     * Arbitrary precision decimal number.<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * This class is a simple wrapper around the standard &lt;code&gt;BigDecimal&lt;/code&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * in order to implement the {@link FieldElement} interface.<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;/p&gt;<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @since 2.0<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @version $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $<a name="line.36"></a>
+<FONT color="green">037</FONT>     */<a name="line.37"></a>
+<FONT color="green">038</FONT>    public class BigReal implements FieldElement&lt;BigReal&gt;, Comparable&lt;BigReal&gt;, Serializable {<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        /** A big real representing 0. */<a name="line.40"></a>
+<FONT color="green">041</FONT>        public static final BigReal ZERO = new BigReal(BigDecimal.ZERO);<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** A big real representing 1. */<a name="line.43"></a>
+<FONT color="green">044</FONT>        public static final BigReal ONE = new BigReal(BigDecimal.ONE);<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>        /** Serializable version identifier. */<a name="line.46"></a>
+<FONT color="green">047</FONT>        private static final long serialVersionUID = 4984534880991310382L;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /** Underlying BigDecimal. */<a name="line.49"></a>
+<FONT color="green">050</FONT>        private final BigDecimal d;<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>        /** Rounding mode for divisions. **/<a name="line.52"></a>
+<FONT color="green">053</FONT>        private RoundingMode roundingMode = RoundingMode.HALF_UP;<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /*** BigDecimal scale ***/<a name="line.55"></a>
+<FONT color="green">056</FONT>        private int scale = 64;<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /** Build an instance from a BigDecimal.<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @param val value of the instance<a name="line.59"></a>
+<FONT color="green">060</FONT>         */<a name="line.60"></a>
+<FONT color="green">061</FONT>        public BigReal(BigDecimal val) {<a name="line.61"></a>
+<FONT color="green">062</FONT>            d =  val;<a name="line.62"></a>
+<FONT color="green">063</FONT>        }<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Build an instance from a BigInteger.<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @param val value of the instance<a name="line.66"></a>
+<FONT color="green">067</FONT>         */<a name="line.67"></a>
+<FONT color="green">068</FONT>        public BigReal(BigInteger val) {<a name="line.68"></a>
+<FONT color="green">069</FONT>            d = new BigDecimal(val);<a name="line.69"></a>
+<FONT color="green">070</FONT>        }<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /** Build an instance from an unscaled BigInteger.<a name="line.72"></a>
+<FONT color="green">073</FONT>         * @param unscaledVal unscaled value<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @param scale scale to use<a name="line.74"></a>
+<FONT color="green">075</FONT>         */<a name="line.75"></a>
+<FONT color="green">076</FONT>        public BigReal(BigInteger unscaledVal, int scale) {<a name="line.76"></a>
+<FONT color="green">077</FONT>            d = new BigDecimal(unscaledVal, scale);<a name="line.77"></a>
+<FONT color="green">078</FONT>        }<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /** Build an instance from an unscaled BigInteger.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @param unscaledVal unscaled value<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @param scale scale to use<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @param mc to used<a name="line.83"></a>
+<FONT color="green">084</FONT>         */<a name="line.84"></a>
+<FONT color="green">085</FONT>        public BigReal(BigInteger unscaledVal, int scale, MathContext mc) {<a name="line.85"></a>
+<FONT color="green">086</FONT>            d = new BigDecimal(unscaledVal, scale, mc);<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /** Build an instance from a BigInteger.<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @param val value of the instance<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @param mc context to use<a name="line.91"></a>
+<FONT color="green">092</FONT>         */<a name="line.92"></a>
+<FONT color="green">093</FONT>        public BigReal(BigInteger val, MathContext mc) {<a name="line.93"></a>
+<FONT color="green">094</FONT>            d = new BigDecimal(val, mc);<a name="line.94"></a>
+<FONT color="green">095</FONT>        }<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /** Build an instance from a characters representation.<a name="line.97"></a>
+<FONT color="green">098</FONT>         * @param in character representation of the value<a name="line.98"></a>
+<FONT color="green">099</FONT>         */<a name="line.99"></a>
+<FONT color="green">100</FONT>        public BigReal(char[] in) {<a name="line.100"></a>
+<FONT color="green">101</FONT>            d = new BigDecimal(in);<a name="line.101"></a>
+<FONT color="green">102</FONT>        }<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /** Build an instance from a characters representation.<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @param in character representation of the value<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @param offset offset of the first character to analyze<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @param len length of the array slice to analyze<a name="line.107"></a>
+<FONT color="green">108</FONT>         */<a name="line.108"></a>
+<FONT color="green">109</FONT>        public BigReal(char[] in, int offset, int len) {<a name="line.109"></a>
+<FONT color="green">110</FONT>            d = new BigDecimal(in, offset, len);<a name="line.110"></a>
+<FONT color="green">111</FONT>        }<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>        /** Build an instance from a characters representation.<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param in character representation of the value<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @param offset offset of the first character to analyze<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @param len length of the array slice to analyze<a name="line.116"></a>
+<FONT color="green">117</FONT>         * @param mc context to use<a name="line.117"></a>
+<FONT color="green">118</FONT>         */<a name="line.118"></a>
+<FONT color="green">119</FONT>        public BigReal(char[] in, int offset, int len, MathContext mc) {<a name="line.119"></a>
+<FONT color="green">120</FONT>            d = new BigDecimal(in, offset, len, mc);<a name="line.120"></a>
+<FONT color="green">121</FONT>        }<a name="line.121"></a>
+<FONT color="green">122</FONT>    <a name="line.122"></a>
+<FONT color="green">123</FONT>        /** Build an instance from a characters representation.<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @param in character representation of the value<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @param mc context to use<a name="line.125"></a>
+<FONT color="green">126</FONT>         */<a name="line.126"></a>
+<FONT color="green">127</FONT>        public BigReal(char[] in, MathContext mc) {<a name="line.127"></a>
+<FONT color="green">128</FONT>            d = new BigDecimal(in, mc);<a name="line.128"></a>
+<FONT color="green">129</FONT>        }<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>        /** Build an instance from a double.<a name="line.131"></a>
+<FONT color="green">132</FONT>         * @param val value of the instance<a name="line.132"></a>
+<FONT color="green">133</FONT>         */<a name="line.133"></a>
+<FONT color="green">134</FONT>        public BigReal(double val) {<a name="line.134"></a>
+<FONT color="green">135</FONT>            d = new BigDecimal(val);<a name="line.135"></a>
+<FONT color="green">136</FONT>        }<a name="line.136"></a>
+<FONT color="green">137</FONT>    <a name="line.137"></a>
+<FONT color="green">138</FONT>        /** Build an instance from a double.<a name="line.138"></a>
+<FONT color="green">139</FONT>         * @param val value of the instance<a name="line.139"></a>
+<FONT color="green">140</FONT>         * @param mc context to use<a name="line.140"></a>
+<FONT color="green">141</FONT>         */<a name="line.141"></a>
+<FONT color="green">142</FONT>        public BigReal(double val, MathContext mc) {<a name="line.142"></a>
+<FONT color="green">143</FONT>            d = new BigDecimal(val, mc);<a name="line.143"></a>
+<FONT color="green">144</FONT>        }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>        /** Build an instance from an int.<a name="line.146"></a>
+<FONT color="green">147</FONT>         * @param val value of the instance<a name="line.147"></a>
+<FONT color="green">148</FONT>         */<a name="line.148"></a>
+<FONT color="green">149</FONT>        public BigReal(int val) {<a name="line.149"></a>
+<FONT color="green">150</FONT>            d = new BigDecimal(val);<a name="line.150"></a>
+<FONT color="green">151</FONT>        }<a name="line.151"></a>
+<FONT color="green">152</FONT>    <a name="line.152"></a>
+<FONT color="green">153</FONT>        /** Build an instance from an int.<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @param val value of the instance<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @param mc context to use<a name="line.155"></a>
+<FONT color="green">156</FONT>         */<a name="line.156"></a>
+<FONT color="green">157</FONT>        public BigReal(int val, MathContext mc) {<a name="line.157"></a>
+<FONT color="green">158</FONT>            d = new BigDecimal(val, mc);<a name="line.158"></a>
+<FONT color="green">159</FONT>        }<a name="line.159"></a>
+<FONT color="green">160</FONT>    <a name="line.160"></a>
+<FONT color="green">161</FONT>        /** Build an instance from a long.<a name="line.161"></a>
+<FONT color="green">162</FONT>         * @param val value of the instance<a name="line.162"></a>
+<FONT color="green">163</FONT>         */<a name="line.163"></a>
+<FONT color="green">164</FONT>        public BigReal(long val) {<a name="line.164"></a>
+<FONT color="green">165</FONT>            d = new BigDecimal(val);<a name="line.165"></a>
+<FONT color="green">166</FONT>        }<a name="line.166"></a>
+<FONT color="green">167</FONT>    <a name="line.167"></a>
+<FONT color="green">168</FONT>        /** Build an instance from a long.<a name="line.168"></a>
+<FONT color="green">169</FONT>         * @param val value of the instance<a name="line.169"></a>
+<FONT color="green">170</FONT>         * @param mc context to use<a name="line.170"></a>
+<FONT color="green">171</FONT>         */<a name="line.171"></a>
+<FONT color="green">172</FONT>        public BigReal(long val, MathContext mc) {<a name="line.172"></a>
+<FONT color="green">173</FONT>            d = new BigDecimal(val, mc);<a name="line.173"></a>
+<FONT color="green">174</FONT>        }<a name="line.174"></a>
+<FONT color="green">175</FONT>    <a name="line.175"></a>
+<FONT color="green">176</FONT>        /** Build an instance from a String representation.<a name="line.176"></a>
+<FONT color="green">177</FONT>         * @param val character representation of the value<a name="line.177"></a>
+<FONT color="green">178</FONT>         */<a name="line.178"></a>
+<FONT color="green">179</FONT>        public BigReal(String val) {<a name="line.179"></a>
+<FONT color="green">180</FONT>            d = new BigDecimal(val);<a name="line.180"></a>
+<FONT color="green">181</FONT>        }<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>        /** Build an instance from a String representation.<a name="line.183"></a>
+<FONT color="green">184</FONT>         * @param val character representation of the value<a name="line.184"></a>
+<FONT color="green">185</FONT>         * @param mc context to use<a name="line.185"></a>
+<FONT color="green">186</FONT>         */<a name="line.186"></a>
+<FONT color="green">187</FONT>        public BigReal(String val, MathContext mc)  {<a name="line.187"></a>
+<FONT color="green">188</FONT>            d = new BigDecimal(val, mc);<a name="line.188"></a>
+<FONT color="green">189</FONT>        }<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>        /***<a name="line.191"></a>
+<FONT color="green">192</FONT>         * Gets the rounding mode for division operations<a name="line.192"></a>
+<FONT color="green">193</FONT>         * The default is {@code RoundingMode.HALF_UP}<a name="line.193"></a>
+<FONT color="green">194</FONT>         * @return the rounding mode.<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @since 2.1<a name="line.195"></a>
+<FONT color="green">196</FONT>         */<a name="line.196"></a>
+<FONT color="green">197</FONT>        public RoundingMode getRoundingMode() {<a name="line.197"></a>
+<FONT color="green">198</FONT>            return roundingMode;<a name="line.198"></a>
+<FONT color="green">199</FONT>        }<a name="line.199"></a>
+<FONT color="green">200</FONT>    <a name="line.200"></a>
+<FONT color="green">201</FONT>        /***<a name="line.201"></a>
+<FONT color="green">202</FONT>         * Sets the rounding mode for decimal divisions.<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @param roundingMode rounding mode for decimal divisions<a name="line.203"></a>
+<FONT color="green">204</FONT>         * @since 2.1<a name="line.204"></a>
+<FONT color="green">205</FONT>         */<a name="line.205"></a>
+<FONT color="green">206</FONT>        public void setRoundingMode(RoundingMode roundingMode) {<a name="line.206"></a>
+<FONT color="green">207</FONT>            this.roundingMode = roundingMode;<a name="line.207"></a>
+<FONT color="green">208</FONT>        }<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>        /***<a name="line.210"></a>
+<FONT color="green">211</FONT>         * Sets the scale for division operations.<a name="line.211"></a>
+<FONT color="green">212</FONT>         * The default is 64<a name="line.212"></a>
+<FONT color="green">213</FONT>         * @return the scale<a name="line.213"></a>
+<FONT color="green">214</FONT>         * @since 2.1<a name="line.214"></a>
+<FONT color="green">215</FONT>         */<a name="line.215"></a>
+<FONT color="green">216</FONT>        public int getScale() {<a name="line.216"></a>
+<FONT color="green">217</FONT>            return scale;<a name="line.217"></a>
+<FONT color="green">218</FONT>        }<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>        /***<a name="line.220"></a>
+<FONT color="green">221</FONT>         * Sets the scale for division operations.<a name="line.221"></a>
+<FONT color="green">222</FONT>         * @param scale scale for division operations<a name="line.222"></a>
+<FONT color="green">223</FONT>         * @since 2.1<a name="line.223"></a>
+<FONT color="green">224</FONT>         */<a name="line.224"></a>
+<FONT color="green">225</FONT>        public void setScale(int scale) {<a name="line.225"></a>
+<FONT color="green">226</FONT>            this.scale = scale;<a name="line.226"></a>
+<FONT color="green">227</FONT>        }<a name="line.227"></a>
+<FONT color="green">228</FONT>    <a name="line.228"></a>
+<FONT color="green">229</FONT>        /** {@inheritDoc} */<a name="line.229"></a>
+<FONT color="green">230</FONT>        public BigReal add(BigReal a) {<a name="line.230"></a>
+<FONT color="green">231</FONT>            return new BigReal(d.add(a.d));<a name="line.231"></a>
+<FONT color="green">232</FONT>        }<a name="line.232"></a>
+<FONT color="green">233</FONT>    <a name="line.233"></a>
+<FONT color="green">234</FONT>        /** {@inheritDoc} */<a name="line.234"></a>
+<FONT color="green">235</FONT>        public BigReal subtract(BigReal a) {<a name="line.235"></a>
+<FONT color="green">236</FONT>            return new BigReal(d.subtract(a.d));<a name="line.236"></a>
+<FONT color="green">237</FONT>        }<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>        /** {@inheritDoc} */<a name="line.239"></a>
+<FONT color="green">240</FONT>        public BigReal divide(BigReal a) throws ArithmeticException {<a name="line.240"></a>
+<FONT color="green">241</FONT>            return new BigReal(d.divide(a.d, scale, roundingMode));<a name="line.241"></a>
+<FONT color="green">242</FONT>        }<a name="line.242"></a>
+<FONT color="green">243</FONT>    <a name="line.243"></a>
+<FONT color="green">244</FONT>        /** {@inheritDoc} */<a name="line.244"></a>
+<FONT color="green">245</FONT>        public BigReal multiply(BigReal a) {<a name="line.245"></a>
+<FONT color="green">246</FONT>            return new BigReal(d.multiply(a.d));<a name="line.246"></a>
+<FONT color="green">247</FONT>        }<a name="line.247"></a>
+<FONT color="green">248</FONT>    <a name="line.248"></a>
+<FONT color="green">249</FONT>        /** {@inheritDoc} */<a name="line.249"></a>
+<FONT color="green">250</FONT>        public int compareTo(BigReal a) {<a name="line.250"></a>
+<FONT color="green">251</FONT>            return d.compareTo(a.d);<a name="line.251"></a>
+<FONT color="green">252</FONT>        }<a name="line.252"></a>
+<FONT color="green">253</FONT>    <a name="line.253"></a>
+<FONT color="green">254</FONT>        /** Get the double value corresponding to the instance.<a name="line.254"></a>
+<FONT color="green">255</FONT>         * @return double value corresponding to the instance<a name="line.255"></a>
+<FONT color="green">256</FONT>         */<a name="line.256"></a>
+<FONT color="green">257</FONT>        public double doubleValue() {<a name="line.257"></a>
+<FONT color="green">258</FONT>            return d.doubleValue();<a name="line.258"></a>
+<FONT color="green">259</FONT>        }<a name="line.259"></a>
+<FONT color="green">260</FONT>    <a name="line.260"></a>
+<FONT color="green">261</FONT>        /** Get the BigDecimal value corresponding to the instance.<a name="line.261"></a>
+<FONT color="green">262</FONT>         * @return BigDecimal value corresponding to the instance<a name="line.262"></a>
+<FONT color="green">263</FONT>         */<a name="line.263"></a>
+<FONT color="green">264</FONT>        public BigDecimal bigDecimalValue() {<a name="line.264"></a>
+<FONT color="green">265</FONT>            return d;<a name="line.265"></a>
+<FONT color="green">266</FONT>        }<a name="line.266"></a>
+<FONT color="green">267</FONT>    <a name="line.267"></a>
+<FONT color="green">268</FONT>        /** {@inheritDoc} */<a name="line.268"></a>
+<FONT color="green">269</FONT>        @Override<a name="line.269"></a>
+<FONT color="green">270</FONT>        public boolean equals(Object other) {<a name="line.270"></a>
+<FONT color="green">271</FONT>            if (this == other){<a name="line.271"></a>
+<FONT color="green">272</FONT>                return true;<a name="line.272"></a>
+<FONT color="green">273</FONT>            }<a name="line.273"></a>
+<FONT color="green">274</FONT>    <a name="line.274"></a>
+<FONT color="green">275</FONT>            if (other instanceof BigReal){<a name="line.275"></a>
+<FONT color="green">276</FONT>                return d.equals(((BigReal) other).d);<a name="line.276"></a>
+<FONT color="green">277</FONT>            }<a name="line.277"></a>
+<FONT color="green">278</FONT>            return false;<a name="line.278"></a>
+<FONT color="green">279</FONT>        }<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>        /** {@inheritDoc} */<a name="line.281"></a>
+<FONT color="green">282</FONT>        @Override<a name="line.282"></a>
+<FONT color="green">283</FONT>        public int hashCode() {<a name="line.283"></a>
+<FONT color="green">284</FONT>            return d.hashCode();<a name="line.284"></a>
+<FONT color="green">285</FONT>        }<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>        /** {@inheritDoc} */<a name="line.287"></a>
+<FONT color="green">288</FONT>        public Field&lt;BigReal&gt; getField() {<a name="line.288"></a>
+<FONT color="green">289</FONT>            return BigRealField.getInstance();<a name="line.289"></a>
+<FONT color="green">290</FONT>        }<a name="line.290"></a>
+<FONT color="green">291</FONT>    <a name="line.291"></a>
+<FONT color="green">292</FONT>    }<a name="line.292"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/BigRealField.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,144 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.util;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.Field;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * Representation of real numbers with arbitrary precision field.<a name="line.25"></a>
+<FONT color="green">026</FONT>     * &lt;p&gt;<a name="line.26"></a>
+<FONT color="green">027</FONT>     * This class is a singleton.<a name="line.27"></a>
+<FONT color="green">028</FONT>     * &lt;/p&gt;<a name="line.28"></a>
+<FONT color="green">029</FONT>     * @see BigReal<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 811827 $ $Date: 2009-09-06 11:32:50 -0400 (Sun, 06 Sep 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     * @since 2.0<a name="line.31"></a>
+<FONT color="green">032</FONT>     */<a name="line.32"></a>
+<FONT color="green">033</FONT>    public class BigRealField implements Field&lt;BigReal&gt;, Serializable  {<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Serializable version identifier */<a name="line.35"></a>
+<FONT color="green">036</FONT>        private static final long serialVersionUID = 4756431066541037559L;<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        /** Private constructor for the singleton.<a name="line.38"></a>
+<FONT color="green">039</FONT>         */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private BigRealField() {<a name="line.40"></a>
+<FONT color="green">041</FONT>        }<a name="line.41"></a>
+<FONT color="green">042</FONT>    <a name="line.42"></a>
+<FONT color="green">043</FONT>        /** Get the unique instance.<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @return the unique instance<a name="line.44"></a>
+<FONT color="green">045</FONT>         */<a name="line.45"></a>
+<FONT color="green">046</FONT>        public static BigRealField getInstance() {<a name="line.46"></a>
+<FONT color="green">047</FONT>            return LazyHolder.INSTANCE;<a name="line.47"></a>
+<FONT color="green">048</FONT>        }<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** {@inheritDoc} */<a name="line.50"></a>
+<FONT color="green">051</FONT>        public BigReal getOne() {<a name="line.51"></a>
+<FONT color="green">052</FONT>            return BigReal.ONE;<a name="line.52"></a>
+<FONT color="green">053</FONT>        }<a name="line.53"></a>
+<FONT color="green">054</FONT>    <a name="line.54"></a>
+<FONT color="green">055</FONT>        /** {@inheritDoc} */<a name="line.55"></a>
+<FONT color="green">056</FONT>        public BigReal getZero() {<a name="line.56"></a>
+<FONT color="green">057</FONT>            return BigReal.ZERO;<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        // CHECKSTYLE: stop HideUtilityClassConstructor<a name="line.60"></a>
+<FONT color="green">061</FONT>        /** Holder for the instance.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * &lt;p&gt;We use here the Initialization On Demand Holder Idiom.&lt;/p&gt;<a name="line.62"></a>
+<FONT color="green">063</FONT>         */<a name="line.63"></a>
+<FONT color="green">064</FONT>        private static class LazyHolder {<a name="line.64"></a>
+<FONT color="green">065</FONT>            /** Cached field instance. */<a name="line.65"></a>
+<FONT color="green">066</FONT>            private static final BigRealField INSTANCE = new BigRealField();<a name="line.66"></a>
+<FONT color="green">067</FONT>        }<a name="line.67"></a>
+<FONT color="green">068</FONT>        // CHECKSTYLE: resume HideUtilityClassConstructor<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /** Handle deserialization of the singleton.<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @return the singleton instance<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        private Object readResolve() {<a name="line.73"></a>
+<FONT color="green">074</FONT>            // return the singleton instance<a name="line.74"></a>
+<FONT color="green">075</FONT>            return LazyHolder.INSTANCE;<a name="line.75"></a>
+<FONT color="green">076</FONT>        }<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>    }<a name="line.78"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/CompositeFormat.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,286 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.util;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.text.FieldPosition;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.text.Format;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.text.NumberFormat;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.text.ParsePosition;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.util.Locale;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    /**<a name="line.25"></a>
+<FONT color="green">026</FONT>     * Base class for formatters of composite objects (complex numbers, vectors ...).<a name="line.26"></a>
+<FONT color="green">027</FONT>     *<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @version $Revision: 811783 $ $Date: 2009-09-06 04:56:58 -0400 (Sun, 06 Sep 2009) $<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public abstract class CompositeFormat extends Format {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** Serializable version identifier. */<a name="line.32"></a>
+<FONT color="green">033</FONT>        private static final long serialVersionUID = 5358685519349262494L;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /**<a name="line.35"></a>
+<FONT color="green">036</FONT>         * Create a default number format.  The default number format is based on<a name="line.36"></a>
+<FONT color="green">037</FONT>         * {@link NumberFormat#getInstance()} with the only customizing that the<a name="line.37"></a>
+<FONT color="green">038</FONT>         * maximum number of fraction digits is set to 2.<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @return the default number format.<a name="line.39"></a>
+<FONT color="green">040</FONT>         */<a name="line.40"></a>
+<FONT color="green">041</FONT>        protected static NumberFormat getDefaultNumberFormat() {<a name="line.41"></a>
+<FONT color="green">042</FONT>            return getDefaultNumberFormat(Locale.getDefault());<a name="line.42"></a>
+<FONT color="green">043</FONT>        }<a name="line.43"></a>
+<FONT color="green">044</FONT>    <a name="line.44"></a>
+<FONT color="green">045</FONT>        /**<a name="line.45"></a>
+<FONT color="green">046</FONT>         * Create a default number format.  The default number format is based on<a name="line.46"></a>
+<FONT color="green">047</FONT>         * {@link NumberFormat#getInstance(java.util.Locale)} with the only<a name="line.47"></a>
+<FONT color="green">048</FONT>         * customizing that the maximum number of fraction digits is set to 2.<a name="line.48"></a>
+<FONT color="green">049</FONT>         * @param locale the specific locale used by the format.<a name="line.49"></a>
+<FONT color="green">050</FONT>         * @return the default number format specific to the given locale.<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        protected static NumberFormat getDefaultNumberFormat(final Locale locale) {<a name="line.52"></a>
+<FONT color="green">053</FONT>            final NumberFormat nf = NumberFormat.getInstance(locale);<a name="line.53"></a>
+<FONT color="green">054</FONT>            nf.setMaximumFractionDigits(2);<a name="line.54"></a>
+<FONT color="green">055</FONT>            return nf;<a name="line.55"></a>
+<FONT color="green">056</FONT>        }<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /**<a name="line.58"></a>
+<FONT color="green">059</FONT>         * Parses &lt;code&gt;source&lt;/code&gt; until a non-whitespace character is found.<a name="line.59"></a>
+<FONT color="green">060</FONT>         *<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param source the string to parse<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param pos input/ouput parsing parameter.  On output, &lt;code&gt;pos&lt;/code&gt;<a name="line.62"></a>
+<FONT color="green">063</FONT>         *        holds the index of the next non-whitespace character.<a name="line.63"></a>
+<FONT color="green">064</FONT>         */<a name="line.64"></a>
+<FONT color="green">065</FONT>        protected void parseAndIgnoreWhitespace(final String source,<a name="line.65"></a>
+<FONT color="green">066</FONT>                                                final ParsePosition pos) {<a name="line.66"></a>
+<FONT color="green">067</FONT>            parseNextCharacter(source, pos);<a name="line.67"></a>
+<FONT color="green">068</FONT>            pos.setIndex(pos.getIndex() - 1);<a name="line.68"></a>
+<FONT color="green">069</FONT>        }<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /**<a name="line.71"></a>
+<FONT color="green">072</FONT>         * Parses &lt;code&gt;source&lt;/code&gt; until a non-whitespace character is found.<a name="line.72"></a>
+<FONT color="green">073</FONT>         *<a name="line.73"></a>
+<FONT color="green">074</FONT>         * @param source the string to parse<a name="line.74"></a>
+<FONT color="green">075</FONT>         * @param pos input/ouput parsing parameter.<a name="line.75"></a>
+<FONT color="green">076</FONT>         * @return the first non-whitespace character.<a name="line.76"></a>
+<FONT color="green">077</FONT>         */<a name="line.77"></a>
+<FONT color="green">078</FONT>        protected char parseNextCharacter(final String source,<a name="line.78"></a>
+<FONT color="green">079</FONT>                                          final ParsePosition pos) {<a name="line.79"></a>
+<FONT color="green">080</FONT>             int index = pos.getIndex();<a name="line.80"></a>
+<FONT color="green">081</FONT>             final int n = source.length();<a name="line.81"></a>
+<FONT color="green">082</FONT>             char ret = 0;<a name="line.82"></a>
+<FONT color="green">083</FONT>    <a name="line.83"></a>
+<FONT color="green">084</FONT>             if (index &lt; n) {<a name="line.84"></a>
+<FONT color="green">085</FONT>                 char c;<a name="line.85"></a>
+<FONT color="green">086</FONT>                 do {<a name="line.86"></a>
+<FONT color="green">087</FONT>                     c = source.charAt(index++);<a name="line.87"></a>
+<FONT color="green">088</FONT>                 } while (Character.isWhitespace(c) &amp;&amp; index &lt; n);<a name="line.88"></a>
+<FONT color="green">089</FONT>                 pos.setIndex(index);<a name="line.89"></a>
+<FONT color="green">090</FONT>    <a name="line.90"></a>
+<FONT color="green">091</FONT>                 if (index &lt; n) {<a name="line.91"></a>
+<FONT color="green">092</FONT>                     ret = c;<a name="line.92"></a>
+<FONT color="green">093</FONT>                 }<a name="line.93"></a>
+<FONT color="green">094</FONT>             }<a name="line.94"></a>
+<FONT color="green">095</FONT>    <a name="line.95"></a>
+<FONT color="green">096</FONT>             return ret;<a name="line.96"></a>
+<FONT color="green">097</FONT>        }<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>        /**<a name="line.99"></a>
+<FONT color="green">100</FONT>         * Parses &lt;code&gt;source&lt;/code&gt; for special double values.  These values<a name="line.100"></a>
+<FONT color="green">101</FONT>         * include Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY.<a name="line.101"></a>
+<FONT color="green">102</FONT>         *<a name="line.102"></a>
+<FONT color="green">103</FONT>         * @param source the string to parse<a name="line.103"></a>
+<FONT color="green">104</FONT>         * @param value the special value to parse.<a name="line.104"></a>
+<FONT color="green">105</FONT>         * @param pos input/ouput parsing parameter.<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @return the special number.<a name="line.106"></a>
+<FONT color="green">107</FONT>         */<a name="line.107"></a>
+<FONT color="green">108</FONT>        private Number parseNumber(final String source, final double value,<a name="line.108"></a>
+<FONT color="green">109</FONT>                                   final ParsePosition pos) {<a name="line.109"></a>
+<FONT color="green">110</FONT>            Number ret = null;<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>            StringBuffer sb = new StringBuffer();<a name="line.112"></a>
+<FONT color="green">113</FONT>            sb.append('(');<a name="line.113"></a>
+<FONT color="green">114</FONT>            sb.append(value);<a name="line.114"></a>
+<FONT color="green">115</FONT>            sb.append(')');<a name="line.115"></a>
+<FONT color="green">116</FONT>    <a name="line.116"></a>
+<FONT color="green">117</FONT>            final int n = sb.length();<a name="line.117"></a>
+<FONT color="green">118</FONT>            final int startIndex = pos.getIndex();<a name="line.118"></a>
+<FONT color="green">119</FONT>            final int endIndex = startIndex + n;<a name="line.119"></a>
+<FONT color="green">120</FONT>            if (endIndex &lt; source.length()) {<a name="line.120"></a>
+<FONT color="green">121</FONT>                if (source.substring(startIndex, endIndex).compareTo(sb.toString()) == 0) {<a name="line.121"></a>
+<FONT color="green">122</FONT>                    ret = Double.valueOf(value);<a name="line.122"></a>
+<FONT color="green">123</FONT>                    pos.setIndex(endIndex);<a name="line.123"></a>
+<FONT color="green">124</FONT>                }<a name="line.124"></a>
+<FONT color="green">125</FONT>            }<a name="line.125"></a>
+<FONT color="green">126</FONT>    <a name="line.126"></a>
+<FONT color="green">127</FONT>            return ret;<a name="line.127"></a>
+<FONT color="green">128</FONT>        }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /**<a name="line.130"></a>
+<FONT color="green">131</FONT>         * Parses &lt;code&gt;source&lt;/code&gt; for a number.  This method can parse normal,<a name="line.131"></a>
+<FONT color="green">132</FONT>         * numeric values as well as special values.  These special values include<a name="line.132"></a>
+<FONT color="green">133</FONT>         * Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY.<a name="line.133"></a>
+<FONT color="green">134</FONT>         *<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @param source the string to parse<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @param format the number format used to parse normal, numeric values.<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @param pos input/ouput parsing parameter.<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @return the parsed number.<a name="line.138"></a>
+<FONT color="green">139</FONT>         */<a name="line.139"></a>
+<FONT color="green">140</FONT>        protected Number parseNumber(final String source, final NumberFormat format,<a name="line.140"></a>
+<FONT color="green">141</FONT>                                     final ParsePosition pos) {<a name="line.141"></a>
+<FONT color="green">142</FONT>            final int startIndex = pos.getIndex();<a name="line.142"></a>
+<FONT color="green">143</FONT>            Number number = format.parse(source, pos);<a name="line.143"></a>
+<FONT color="green">144</FONT>            final int endIndex = pos.getIndex();<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>            // check for error parsing number<a name="line.146"></a>
+<FONT color="green">147</FONT>            if (startIndex == endIndex) {<a name="line.147"></a>
+<FONT color="green">148</FONT>                // try parsing special numbers<a name="line.148"></a>
+<FONT color="green">149</FONT>                final double[] special = {<a name="line.149"></a>
+<FONT color="green">150</FONT>                    Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY<a name="line.150"></a>
+<FONT color="green">151</FONT>                };<a name="line.151"></a>
+<FONT color="green">152</FONT>                for (int i = 0; i &lt; special.length; ++i) {<a name="line.152"></a>
+<FONT color="green">153</FONT>                    number = parseNumber(source, special[i], pos);<a name="line.153"></a>
+<FONT color="green">154</FONT>                    if (number != null) {<a name="line.154"></a>
+<FONT color="green">155</FONT>                        break;<a name="line.155"></a>
+<FONT color="green">156</FONT>                    }<a name="line.156"></a>
+<FONT color="green">157</FONT>                }<a name="line.157"></a>
+<FONT color="green">158</FONT>            }<a name="line.158"></a>
+<FONT color="green">159</FONT>    <a name="line.159"></a>
+<FONT color="green">160</FONT>            return number;<a name="line.160"></a>
+<FONT color="green">161</FONT>        }<a name="line.161"></a>
+<FONT color="green">162</FONT>    <a name="line.162"></a>
+<FONT color="green">163</FONT>        /**<a name="line.163"></a>
+<FONT color="green">164</FONT>         * Parse &lt;code&gt;source&lt;/code&gt; for an expected fixed string.<a name="line.164"></a>
+<FONT color="green">165</FONT>         * @param source the string to parse<a name="line.165"></a>
+<FONT color="green">166</FONT>         * @param expected expected string<a name="line.166"></a>
+<FONT color="green">167</FONT>         * @param pos input/ouput parsing parameter.<a name="line.167"></a>
+<FONT color="green">168</FONT>         * @return true if the expected string was there<a name="line.168"></a>
+<FONT color="green">169</FONT>         */<a name="line.169"></a>
+<FONT color="green">170</FONT>        protected boolean parseFixedstring(final String source, final String expected,<a name="line.170"></a>
+<FONT color="green">171</FONT>                                           final ParsePosition pos) {<a name="line.171"></a>
+<FONT color="green">172</FONT>    <a name="line.172"></a>
+<FONT color="green">173</FONT>            final int startIndex = pos.getIndex();<a name="line.173"></a>
+<FONT color="green">174</FONT>            final int endIndex = startIndex + expected.length();<a name="line.174"></a>
+<FONT color="green">175</FONT>            if ((startIndex &gt;= source.length()) ||<a name="line.175"></a>
+<FONT color="green">176</FONT>                (endIndex &gt; source.length()) ||<a name="line.176"></a>
+<FONT color="green">177</FONT>                (source.substring(startIndex, endIndex).compareTo(expected) != 0)) {<a name="line.177"></a>
+<FONT color="green">178</FONT>                // set index back to start, error index should be the start index<a name="line.178"></a>
+<FONT color="green">179</FONT>                pos.setIndex(startIndex);<a name="line.179"></a>
+<FONT color="green">180</FONT>                pos.setErrorIndex(startIndex);<a name="line.180"></a>
+<FONT color="green">181</FONT>                return false;<a name="line.181"></a>
+<FONT color="green">182</FONT>            }<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>            // the string was here<a name="line.184"></a>
+<FONT color="green">185</FONT>            pos.setIndex(endIndex);<a name="line.185"></a>
+<FONT color="green">186</FONT>            return true;<a name="line.186"></a>
+<FONT color="green">187</FONT>    <a name="line.187"></a>
+<FONT color="green">188</FONT>        }<a name="line.188"></a>
+<FONT color="green">189</FONT>    <a name="line.189"></a>
+<FONT color="green">190</FONT>        /**<a name="line.190"></a>
+<FONT color="green">191</FONT>         * Formats a double value to produce a string.  In general, the value is<a name="line.191"></a>
+<FONT color="green">192</FONT>         * formatted using the formatting rules of &lt;code&gt;format&lt;/code&gt;.  There are<a name="line.192"></a>
+<FONT color="green">193</FONT>         * three exceptions to this:<a name="line.193"></a>
+<FONT color="green">194</FONT>         * &lt;ol&gt;<a name="line.194"></a>
+<FONT color="green">195</FONT>         * &lt;li&gt;NaN is formatted as '(NaN)'&lt;/li&gt;<a name="line.195"></a>
+<FONT color="green">196</FONT>         * &lt;li&gt;Positive infinity is formatted as '(Infinity)'&lt;/li&gt;<a name="line.196"></a>
+<FONT color="green">197</FONT>         * &lt;li&gt;Negative infinity is formatted as '(-Infinity)'&lt;/li&gt;<a name="line.197"></a>
+<FONT color="green">198</FONT>         * &lt;/ol&gt;<a name="line.198"></a>
+<FONT color="green">199</FONT>         *<a name="line.199"></a>
+<FONT color="green">200</FONT>         * @param value the double to format.<a name="line.200"></a>
+<FONT color="green">201</FONT>         * @param format the format used.<a name="line.201"></a>
+<FONT color="green">202</FONT>         * @param toAppendTo where the text is to be appended<a name="line.202"></a>
+<FONT color="green">203</FONT>         * @param pos On input: an alignment field, if desired. On output: the<a name="line.203"></a>
+<FONT color="green">204</FONT>         *            offsets of the alignment field<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @return the value passed in as toAppendTo.<a name="line.205"></a>
+<FONT color="green">206</FONT>         */<a name="line.206"></a>
+<FONT color="green">207</FONT>        protected StringBuffer formatDouble(final double value, final NumberFormat format,<a name="line.207"></a>
+<FONT color="green">208</FONT>                                            final StringBuffer toAppendTo,<a name="line.208"></a>
+<FONT color="green">209</FONT>                                            final FieldPosition pos) {<a name="line.209"></a>
+<FONT color="green">210</FONT>            if( Double.isNaN(value) || Double.isInfinite(value) ) {<a name="line.210"></a>
+<FONT color="green">211</FONT>                toAppendTo.append('(');<a name="line.211"></a>
+<FONT color="green">212</FONT>                toAppendTo.append(value);<a name="line.212"></a>
+<FONT color="green">213</FONT>                toAppendTo.append(')');<a name="line.213"></a>
+<FONT color="green">214</FONT>            } else {<a name="line.214"></a>
+<FONT color="green">215</FONT>                format.format(value, toAppendTo, pos);<a name="line.215"></a>
+<FONT color="green">216</FONT>            }<a name="line.216"></a>
+<FONT color="green">217</FONT>            return toAppendTo;<a name="line.217"></a>
+<FONT color="green">218</FONT>        }<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>    }<a name="line.220"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/ContinuedFraction.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,273 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.util;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.ConvergenceException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import org.apache.commons.math.MathException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import org.apache.commons.math.MaxIterationsExceededException;<a name="line.21"></a>
+<FONT color="green">022</FONT>    <a name="line.22"></a>
+<FONT color="green">023</FONT>    /**<a name="line.23"></a>
+<FONT color="green">024</FONT>     * Provides a generic means to evaluate continued fractions.  Subclasses simply<a name="line.24"></a>
+<FONT color="green">025</FONT>     * provided the a and b coefficients to evaluate the continued fraction.<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     * &lt;p&gt;<a name="line.27"></a>
+<FONT color="green">028</FONT>     * References:<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;ul&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;li&gt;&lt;a href="http://mathworld.wolfram.com/ContinuedFraction.html"&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     * Continued Fraction&lt;/a&gt;&lt;/li&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;/ul&gt;<a name="line.32"></a>
+<FONT color="green">033</FONT>     * &lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     *<a name="line.34"></a>
+<FONT color="green">035</FONT>     * @version $Revision: 920558 $ $Date: 2010-03-08 17:57:32 -0500 (Mon, 08 Mar 2010) $<a name="line.35"></a>
+<FONT color="green">036</FONT>     */<a name="line.36"></a>
+<FONT color="green">037</FONT>    public abstract class ContinuedFraction {<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /** Maximum allowed numerical error. */<a name="line.39"></a>
+<FONT color="green">040</FONT>        private static final double DEFAULT_EPSILON = 10e-9;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        /**<a name="line.42"></a>
+<FONT color="green">043</FONT>         * Default constructor.<a name="line.43"></a>
+<FONT color="green">044</FONT>         */<a name="line.44"></a>
+<FONT color="green">045</FONT>        protected ContinuedFraction() {<a name="line.45"></a>
+<FONT color="green">046</FONT>            super();<a name="line.46"></a>
+<FONT color="green">047</FONT>        }<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /**<a name="line.49"></a>
+<FONT color="green">050</FONT>         * Access the n-th a coefficient of the continued fraction.  Since a can be<a name="line.50"></a>
+<FONT color="green">051</FONT>         * a function of the evaluation point, x, that is passed in as well.<a name="line.51"></a>
+<FONT color="green">052</FONT>         * @param n the coefficient index to retrieve.<a name="line.52"></a>
+<FONT color="green">053</FONT>         * @param x the evaluation point.<a name="line.53"></a>
+<FONT color="green">054</FONT>         * @return the n-th a coefficient.<a name="line.54"></a>
+<FONT color="green">055</FONT>         */<a name="line.55"></a>
+<FONT color="green">056</FONT>        protected abstract double getA(int n, double x);<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        /**<a name="line.58"></a>
+<FONT color="green">059</FONT>         * Access the n-th b coefficient of the continued fraction.  Since b can be<a name="line.59"></a>
+<FONT color="green">060</FONT>         * a function of the evaluation point, x, that is passed in as well.<a name="line.60"></a>
+<FONT color="green">061</FONT>         * @param n the coefficient index to retrieve.<a name="line.61"></a>
+<FONT color="green">062</FONT>         * @param x the evaluation point.<a name="line.62"></a>
+<FONT color="green">063</FONT>         * @return the n-th b coefficient.<a name="line.63"></a>
+<FONT color="green">064</FONT>         */<a name="line.64"></a>
+<FONT color="green">065</FONT>        protected abstract double getB(int n, double x);<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /**<a name="line.67"></a>
+<FONT color="green">068</FONT>         * Evaluates the continued fraction at the value x.<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @param x the evaluation point.<a name="line.69"></a>
+<FONT color="green">070</FONT>         * @return the value of the continued fraction evaluated at x.<a name="line.70"></a>
+<FONT color="green">071</FONT>         * @throws MathException if the algorithm fails to converge.<a name="line.71"></a>
+<FONT color="green">072</FONT>         */<a name="line.72"></a>
+<FONT color="green">073</FONT>        public double evaluate(double x) throws MathException {<a name="line.73"></a>
+<FONT color="green">074</FONT>            return evaluate(x, DEFAULT_EPSILON, Integer.MAX_VALUE);<a name="line.74"></a>
+<FONT color="green">075</FONT>        }<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /**<a name="line.77"></a>
+<FONT color="green">078</FONT>         * Evaluates the continued fraction at the value x.<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @param x the evaluation point.<a name="line.79"></a>
+<FONT color="green">080</FONT>         * @param epsilon maximum error allowed.<a name="line.80"></a>
+<FONT color="green">081</FONT>         * @return the value of the continued fraction evaluated at x.<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @throws MathException if the algorithm fails to converge.<a name="line.82"></a>
+<FONT color="green">083</FONT>         */<a name="line.83"></a>
+<FONT color="green">084</FONT>        public double evaluate(double x, double epsilon) throws MathException {<a name="line.84"></a>
+<FONT color="green">085</FONT>            return evaluate(x, epsilon, Integer.MAX_VALUE);<a name="line.85"></a>
+<FONT color="green">086</FONT>        }<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>        /**<a name="line.88"></a>
+<FONT color="green">089</FONT>         * Evaluates the continued fraction at the value x.<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @param x the evaluation point.<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @param maxIterations maximum number of convergents<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @return the value of the continued fraction evaluated at x.<a name="line.92"></a>
+<FONT color="green">093</FONT>         * @throws MathException if the algorithm fails to converge.<a name="line.93"></a>
+<FONT color="green">094</FONT>         */<a name="line.94"></a>
+<FONT color="green">095</FONT>        public double evaluate(double x, int maxIterations) throws MathException {<a name="line.95"></a>
+<FONT color="green">096</FONT>            return evaluate(x, DEFAULT_EPSILON, maxIterations);<a name="line.96"></a>
+<FONT color="green">097</FONT>        }<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>        /**<a name="line.99"></a>
+<FONT color="green">100</FONT>         * &lt;p&gt;<a name="line.100"></a>
+<FONT color="green">101</FONT>         * Evaluates the continued fraction at the value x.<a name="line.101"></a>
+<FONT color="green">102</FONT>         * &lt;/p&gt;<a name="line.102"></a>
+<FONT color="green">103</FONT>         *<a name="line.103"></a>
+<FONT color="green">104</FONT>         * &lt;p&gt;<a name="line.104"></a>
+<FONT color="green">105</FONT>         * The implementation of this method is based on equations 14-17 of:<a name="line.105"></a>
+<FONT color="green">106</FONT>         * &lt;ul&gt;<a name="line.106"></a>
+<FONT color="green">107</FONT>         * &lt;li&gt;<a name="line.107"></a>
+<FONT color="green">108</FONT>         *   Eric W. Weisstein. "Continued Fraction." From MathWorld--A Wolfram Web<a name="line.108"></a>
+<FONT color="green">109</FONT>         *   Resource. &lt;a target="_blank"<a name="line.109"></a>
+<FONT color="green">110</FONT>         *   href="http://mathworld.wolfram.com/ContinuedFraction.html"&gt;<a name="line.110"></a>
+<FONT color="green">111</FONT>         *   http://mathworld.wolfram.com/ContinuedFraction.html&lt;/a&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>         * &lt;/li&gt;<a name="line.112"></a>
+<FONT color="green">113</FONT>         * &lt;/ul&gt;<a name="line.113"></a>
+<FONT color="green">114</FONT>         * The recurrence relationship defined in those equations can result in<a name="line.114"></a>
+<FONT color="green">115</FONT>         * very large intermediate results which can result in numerical overflow.<a name="line.115"></a>
+<FONT color="green">116</FONT>         * As a means to combat these overflow conditions, the intermediate results<a name="line.116"></a>
+<FONT color="green">117</FONT>         * are scaled whenever they threaten to become numerically unstable.&lt;/p&gt;<a name="line.117"></a>
+<FONT color="green">118</FONT>         *<a name="line.118"></a>
+<FONT color="green">119</FONT>         * @param x the evaluation point.<a name="line.119"></a>
+<FONT color="green">120</FONT>         * @param epsilon maximum error allowed.<a name="line.120"></a>
+<FONT color="green">121</FONT>         * @param maxIterations maximum number of convergents<a name="line.121"></a>
+<FONT color="green">122</FONT>         * @return the value of the continued fraction evaluated at x.<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @throws MathException if the algorithm fails to converge.<a name="line.123"></a>
+<FONT color="green">124</FONT>         */<a name="line.124"></a>
+<FONT color="green">125</FONT>        public double evaluate(double x, double epsilon, int maxIterations)<a name="line.125"></a>
+<FONT color="green">126</FONT>            throws MathException<a name="line.126"></a>
+<FONT color="green">127</FONT>        {<a name="line.127"></a>
+<FONT color="green">128</FONT>            double p0 = 1.0;<a name="line.128"></a>
+<FONT color="green">129</FONT>            double p1 = getA(0, x);<a name="line.129"></a>
+<FONT color="green">130</FONT>            double q0 = 0.0;<a name="line.130"></a>
+<FONT color="green">131</FONT>            double q1 = 1.0;<a name="line.131"></a>
+<FONT color="green">132</FONT>            double c = p1 / q1;<a name="line.132"></a>
+<FONT color="green">133</FONT>            int n = 0;<a name="line.133"></a>
+<FONT color="green">134</FONT>            double relativeError = Double.MAX_VALUE;<a name="line.134"></a>
+<FONT color="green">135</FONT>            while (n &lt; maxIterations &amp;&amp; relativeError &gt; epsilon) {<a name="line.135"></a>
+<FONT color="green">136</FONT>                ++n;<a name="line.136"></a>
+<FONT color="green">137</FONT>                double a = getA(n, x);<a name="line.137"></a>
+<FONT color="green">138</FONT>                double b = getB(n, x);<a name="line.138"></a>
+<FONT color="green">139</FONT>                double p2 = a * p1 + b * p0;<a name="line.139"></a>
+<FONT color="green">140</FONT>                double q2 = a * q1 + b * q0;<a name="line.140"></a>
+<FONT color="green">141</FONT>                boolean infinite = false;<a name="line.141"></a>
+<FONT color="green">142</FONT>                if (Double.isInfinite(p2) || Double.isInfinite(q2)) {<a name="line.142"></a>
+<FONT color="green">143</FONT>                    /*<a name="line.143"></a>
+<FONT color="green">144</FONT>                     * Need to scale. Try successive powers of the larger of a or b<a name="line.144"></a>
+<FONT color="green">145</FONT>                     * up to 5th power. Throw ConvergenceException if one or both<a name="line.145"></a>
+<FONT color="green">146</FONT>                     * of p2, q2 still overflow.<a name="line.146"></a>
+<FONT color="green">147</FONT>                     */<a name="line.147"></a>
+<FONT color="green">148</FONT>                    double scaleFactor = 1d;<a name="line.148"></a>
+<FONT color="green">149</FONT>                    double lastScaleFactor = 1d;<a name="line.149"></a>
+<FONT color="green">150</FONT>                    final int maxPower = 5;<a name="line.150"></a>
+<FONT color="green">151</FONT>                    final double scale = Math.max(a,b);<a name="line.151"></a>
+<FONT color="green">152</FONT>                    if (scale &lt;= 0) {  // Can't scale<a name="line.152"></a>
+<FONT color="green">153</FONT>                        throw new ConvergenceException(<a name="line.153"></a>
+<FONT color="green">154</FONT>                                "Continued fraction convergents diverged to +/- infinity for value {0}",<a name="line.154"></a>
+<FONT color="green">155</FONT>                                 x);<a name="line.155"></a>
+<FONT color="green">156</FONT>                    }<a name="line.156"></a>
+<FONT color="green">157</FONT>                    infinite = true;<a name="line.157"></a>
+<FONT color="green">158</FONT>                    for (int i = 0; i &lt; maxPower; i++) {<a name="line.158"></a>
+<FONT color="green">159</FONT>                        lastScaleFactor = scaleFactor;<a name="line.159"></a>
+<FONT color="green">160</FONT>                        scaleFactor *= scale;<a name="line.160"></a>
+<FONT color="green">161</FONT>                        if (a != 0.0 &amp;&amp; a &gt; b) {<a name="line.161"></a>
+<FONT color="green">162</FONT>                            p2 = p1 / lastScaleFactor + (b / scaleFactor * p0);<a name="line.162"></a>
+<FONT color="green">163</FONT>                            q2 = q1 / lastScaleFactor + (b / scaleFactor * q0);<a name="line.163"></a>
+<FONT color="green">164</FONT>                        } else if (b != 0) {<a name="line.164"></a>
+<FONT color="green">165</FONT>                            p2 = (a / scaleFactor * p1) + p0 / lastScaleFactor;<a name="line.165"></a>
+<FONT color="green">166</FONT>                            q2 = (a / scaleFactor * q1) + q0 / lastScaleFactor;<a name="line.166"></a>
+<FONT color="green">167</FONT>                        }<a name="line.167"></a>
+<FONT color="green">168</FONT>                        infinite = Double.isInfinite(p2) || Double.isInfinite(q2);<a name="line.168"></a>
+<FONT color="green">169</FONT>                        if (!infinite) {<a name="line.169"></a>
+<FONT color="green">170</FONT>                            break;<a name="line.170"></a>
+<FONT color="green">171</FONT>                        }<a name="line.171"></a>
+<FONT color="green">172</FONT>                    }<a name="line.172"></a>
+<FONT color="green">173</FONT>                }<a name="line.173"></a>
+<FONT color="green">174</FONT>    <a name="line.174"></a>
+<FONT color="green">175</FONT>                if (infinite) {<a name="line.175"></a>
+<FONT color="green">176</FONT>                   // Scaling failed<a name="line.176"></a>
+<FONT color="green">177</FONT>                   throw new ConvergenceException(<a name="line.177"></a>
+<FONT color="green">178</FONT>                     "Continued fraction convergents diverged to +/- infinity for value {0}",<a name="line.178"></a>
+<FONT color="green">179</FONT>                      x);<a name="line.179"></a>
+<FONT color="green">180</FONT>                }<a name="line.180"></a>
+<FONT color="green">181</FONT>    <a name="line.181"></a>
+<FONT color="green">182</FONT>                double r = p2 / q2;<a name="line.182"></a>
+<FONT color="green">183</FONT>    <a name="line.183"></a>
+<FONT color="green">184</FONT>                if (Double.isNaN(r)) {<a name="line.184"></a>
+<FONT color="green">185</FONT>                    throw new ConvergenceException(<a name="line.185"></a>
+<FONT color="green">186</FONT>                      "Continued fraction diverged to NaN for value {0}",<a name="line.186"></a>
+<FONT color="green">187</FONT>                      x);<a name="line.187"></a>
+<FONT color="green">188</FONT>                }<a name="line.188"></a>
+<FONT color="green">189</FONT>                relativeError = Math.abs(r / c - 1.0);<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>                // prepare for next iteration<a name="line.191"></a>
+<FONT color="green">192</FONT>                c = p2 / q2;<a name="line.192"></a>
+<FONT color="green">193</FONT>                p0 = p1;<a name="line.193"></a>
+<FONT color="green">194</FONT>                p1 = p2;<a name="line.194"></a>
+<FONT color="green">195</FONT>                q0 = q1;<a name="line.195"></a>
+<FONT color="green">196</FONT>                q1 = q2;<a name="line.196"></a>
+<FONT color="green">197</FONT>            }<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>            if (n &gt;= maxIterations) {<a name="line.199"></a>
+<FONT color="green">200</FONT>                throw new MaxIterationsExceededException(maxIterations,<a name="line.200"></a>
+<FONT color="green">201</FONT>                    "Continued fraction convergents failed to converge for value {0}",<a name="line.201"></a>
+<FONT color="green">202</FONT>                    x);<a name="line.202"></a>
+<FONT color="green">203</FONT>            }<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>            return c;<a name="line.205"></a>
+<FONT color="green">206</FONT>        }<a name="line.206"></a>
+<FONT color="green">207</FONT>    }<a name="line.207"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/DefaultTransformer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,147 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.util;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.Serializable;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * A Default NumberTransformer for java.lang.Numbers and Numeric Strings. This<a name="line.25"></a>
+<FONT color="green">026</FONT>     * provides some simple conversion capabilities to turn any java.lang.Number<a name="line.26"></a>
+<FONT color="green">027</FONT>     * into a primitive double or to turn a String representation of a Number into<a name="line.27"></a>
+<FONT color="green">028</FONT>     * a double.<a name="line.28"></a>
+<FONT color="green">029</FONT>     *<a name="line.29"></a>
+<FONT color="green">030</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.30"></a>
+<FONT color="green">031</FONT>     */<a name="line.31"></a>
+<FONT color="green">032</FONT>    public class DefaultTransformer implements NumberTransformer, Serializable {<a name="line.32"></a>
+<FONT color="green">033</FONT>    <a name="line.33"></a>
+<FONT color="green">034</FONT>        /** Serializable version identifier */<a name="line.34"></a>
+<FONT color="green">035</FONT>        private static final long serialVersionUID = 4019938025047800455L;<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /**<a name="line.37"></a>
+<FONT color="green">038</FONT>         * @param o  the object that gets transformed.<a name="line.38"></a>
+<FONT color="green">039</FONT>         * @return a double primitive representation of the Object o.<a name="line.39"></a>
+<FONT color="green">040</FONT>         * @throws org.apache.commons.math.MathException If it cannot successfully<a name="line.40"></a>
+<FONT color="green">041</FONT>         * be transformed or is null.<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @see &lt;a href="http://commons.apache.org/collections/api-release/org/apache/commons/collections/Transformer.html"/&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>         */<a name="line.43"></a>
+<FONT color="green">044</FONT>        public double transform(Object o) throws MathException{<a name="line.44"></a>
+<FONT color="green">045</FONT>    <a name="line.45"></a>
+<FONT color="green">046</FONT>            if (o == null) {<a name="line.46"></a>
+<FONT color="green">047</FONT>                throw new MathException("Conversion Exception in Transformation, Object is null");<a name="line.47"></a>
+<FONT color="green">048</FONT>            }<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>            if (o instanceof Number) {<a name="line.50"></a>
+<FONT color="green">051</FONT>                return ((Number)o).doubleValue();<a name="line.51"></a>
+<FONT color="green">052</FONT>            }<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>            try {<a name="line.54"></a>
+<FONT color="green">055</FONT>                return Double.valueOf(o.toString()).doubleValue();<a name="line.55"></a>
+<FONT color="green">056</FONT>            } catch (NumberFormatException e) {<a name="line.56"></a>
+<FONT color="green">057</FONT>                throw new MathException(e,<a name="line.57"></a>
+<FONT color="green">058</FONT>                                        "Conversion Exception in Transformation: {0}", e.getMessage());<a name="line.58"></a>
+<FONT color="green">059</FONT>            }<a name="line.59"></a>
+<FONT color="green">060</FONT>        }<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** {@inheritDoc} */<a name="line.62"></a>
+<FONT color="green">063</FONT>        @Override<a name="line.63"></a>
+<FONT color="green">064</FONT>        public boolean equals(Object other) {<a name="line.64"></a>
+<FONT color="green">065</FONT>            if (this == other) {<a name="line.65"></a>
+<FONT color="green">066</FONT>                return true;<a name="line.66"></a>
+<FONT color="green">067</FONT>            }<a name="line.67"></a>
+<FONT color="green">068</FONT>            if (other == null) {<a name="line.68"></a>
+<FONT color="green">069</FONT>                return false;<a name="line.69"></a>
+<FONT color="green">070</FONT>            }<a name="line.70"></a>
+<FONT color="green">071</FONT>            return other instanceof DefaultTransformer;<a name="line.71"></a>
+<FONT color="green">072</FONT>        }<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /** {@inheritDoc} */<a name="line.74"></a>
+<FONT color="green">075</FONT>        @Override<a name="line.75"></a>
+<FONT color="green">076</FONT>        public int hashCode() {<a name="line.76"></a>
+<FONT color="green">077</FONT>            // some arbitrary number ...<a name="line.77"></a>
+<FONT color="green">078</FONT>            return 401993047;<a name="line.78"></a>
+<FONT color="green">079</FONT>        }<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>    }<a name="line.81"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/DoubleArray.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,170 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.util;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    /**<a name="line.20"></a>
+<FONT color="green">021</FONT>     * Provides a standard interface for double arrays.  Allows different<a name="line.21"></a>
+<FONT color="green">022</FONT>     * array implementations to support various storage mechanisms<a name="line.22"></a>
+<FONT color="green">023</FONT>     * such as automatic expansion, contraction, and array "rolling".<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.25"></a>
+<FONT color="green">026</FONT>     */<a name="line.26"></a>
+<FONT color="green">027</FONT>    public interface DoubleArray {<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>        /**<a name="line.29"></a>
+<FONT color="green">030</FONT>         * Returns the number of elements currently in the array.  Please note<a name="line.30"></a>
+<FONT color="green">031</FONT>         * that this may be different from the length of the internal storage array.<a name="line.31"></a>
+<FONT color="green">032</FONT>         *<a name="line.32"></a>
+<FONT color="green">033</FONT>         * @return number of elements<a name="line.33"></a>
+<FONT color="green">034</FONT>         */<a name="line.34"></a>
+<FONT color="green">035</FONT>        int getNumElements();<a name="line.35"></a>
+<FONT color="green">036</FONT>    <a name="line.36"></a>
+<FONT color="green">037</FONT>        /**<a name="line.37"></a>
+<FONT color="green">038</FONT>         * Returns the element at the specified index.  Note that if an<a name="line.38"></a>
+<FONT color="green">039</FONT>         * out of bounds index is supplied a ArrayIndexOutOfBoundsException<a name="line.39"></a>
+<FONT color="green">040</FONT>         * will be thrown.<a name="line.40"></a>
+<FONT color="green">041</FONT>         *<a name="line.41"></a>
+<FONT color="green">042</FONT>         * @param index index to fetch a value from<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @return value stored at the specified index<a name="line.43"></a>
+<FONT color="green">044</FONT>         * @throws ArrayIndexOutOfBoundsException if &lt;code&gt;index&lt;/code&gt; is less than<a name="line.44"></a>
+<FONT color="green">045</FONT>         *         zero or is greater than &lt;code&gt;getNumElements() - 1&lt;/code&gt;.<a name="line.45"></a>
+<FONT color="green">046</FONT>         */<a name="line.46"></a>
+<FONT color="green">047</FONT>        double getElement(int index);<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /**<a name="line.49"></a>
+<FONT color="green">050</FONT>         * Sets the element at the specified index.  If the specified index is greater than<a name="line.50"></a>
+<FONT color="green">051</FONT>         * &lt;code&gt;getNumElements() - 1&lt;/code&gt;, the &lt;code&gt;numElements&lt;/code&gt; property<a name="line.51"></a>
+<FONT color="green">052</FONT>         * is increased to &lt;code&gt;index +1&lt;/code&gt; and additional storage is allocated<a name="line.52"></a>
+<FONT color="green">053</FONT>         * (if necessary) for the new element and all  (uninitialized) elements<a name="line.53"></a>
+<FONT color="green">054</FONT>         * between the new element and the previous end of the array).<a name="line.54"></a>
+<FONT color="green">055</FONT>         *<a name="line.55"></a>
+<FONT color="green">056</FONT>         * @param index index to store a value in<a name="line.56"></a>
+<FONT color="green">057</FONT>         * @param value value to store at the specified index<a name="line.57"></a>
+<FONT color="green">058</FONT>         * @throws ArrayIndexOutOfBoundsException if &lt;code&gt;index&lt;/code&gt; is less than<a name="line.58"></a>
+<FONT color="green">059</FONT>         *         zero.<a name="line.59"></a>
+<FONT color="green">060</FONT>         */<a name="line.60"></a>
+<FONT color="green">061</FONT>        void setElement(int index, double value);<a name="line.61"></a>
+<FONT color="green">062</FONT>    <a name="line.62"></a>
+<FONT color="green">063</FONT>        /**<a name="line.63"></a>
+<FONT color="green">064</FONT>         * Adds an element to the end of this expandable array<a name="line.64"></a>
+<FONT color="green">065</FONT>         *<a name="line.65"></a>
+<FONT color="green">066</FONT>         * @param value to be added to end of array<a name="line.66"></a>
+<FONT color="green">067</FONT>         */<a name="line.67"></a>
+<FONT color="green">068</FONT>        void addElement(double value);<a name="line.68"></a>
+<FONT color="green">069</FONT>    <a name="line.69"></a>
+<FONT color="green">070</FONT>        /**<a name="line.70"></a>
+<FONT color="green">071</FONT>         * &lt;p&gt;<a name="line.71"></a>
+<FONT color="green">072</FONT>         * Adds an element to the end of the array and removes the first<a name="line.72"></a>
+<FONT color="green">073</FONT>         * element in the array.  Returns the discarded first element.<a name="line.73"></a>
+<FONT color="green">074</FONT>         * The effect is similar to a push operation in a FIFO queue.<a name="line.74"></a>
+<FONT color="green">075</FONT>         * &lt;/p&gt;<a name="line.75"></a>
+<FONT color="green">076</FONT>         * &lt;p&gt;<a name="line.76"></a>
+<FONT color="green">077</FONT>         * Example: If the array contains the elements 1, 2, 3, 4 (in that order)<a name="line.77"></a>
+<FONT color="green">078</FONT>         * and addElementRolling(5) is invoked, the result is an array containing<a name="line.78"></a>
+<FONT color="green">079</FONT>         * the entries 2, 3, 4, 5 and the value returned is 1.<a name="line.79"></a>
+<FONT color="green">080</FONT>         * &lt;/p&gt;<a name="line.80"></a>
+<FONT color="green">081</FONT>         *<a name="line.81"></a>
+<FONT color="green">082</FONT>         * @param value the value to be added to the array<a name="line.82"></a>
+<FONT color="green">083</FONT>         * @return the value which has been discarded or "pushed" out of the array<a name="line.83"></a>
+<FONT color="green">084</FONT>         *         by this rolling insert<a name="line.84"></a>
+<FONT color="green">085</FONT>         */<a name="line.85"></a>
+<FONT color="green">086</FONT>        double addElementRolling(double value);<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>        /**<a name="line.88"></a>
+<FONT color="green">089</FONT>         * Returns a double[] array containing the elements of this<a name="line.89"></a>
+<FONT color="green">090</FONT>         * &lt;code&gt;DoubleArray&lt;/code&gt;.  If the underlying implementation is<a name="line.90"></a>
+<FONT color="green">091</FONT>         * array-based, this method should always return a copy, rather than a<a name="line.91"></a>
+<FONT color="green">092</FONT>         * reference to the underlying array so that changes made to the returned<a name="line.92"></a>
+<FONT color="green">093</FONT>         *  array have no effect on the &lt;code&gt;DoubleArray.&lt;/code&gt;<a name="line.93"></a>
+<FONT color="green">094</FONT>         *<a name="line.94"></a>
+<FONT color="green">095</FONT>         * @return all elements added to the array<a name="line.95"></a>
+<FONT color="green">096</FONT>         */<a name="line.96"></a>
+<FONT color="green">097</FONT>        double[] getElements();<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>        /**<a name="line.99"></a>
+<FONT color="green">100</FONT>         * Clear the double array<a name="line.100"></a>
+<FONT color="green">101</FONT>         */<a name="line.101"></a>
+<FONT color="green">102</FONT>        void clear();<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>    }<a name="line.104"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/MathUtils.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,1899 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.util;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.math.BigDecimal;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.math.BigInteger;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.util.Arrays;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    /**<a name="line.26"></a>
+<FONT color="green">027</FONT>     * Some useful additions to the built-in functions in {@link Math}.<a name="line.27"></a>
+<FONT color="green">028</FONT>     * @version $Revision: 927249 $ $Date: 2010-03-24 21:06:51 -0400 (Wed, 24 Mar 2010) $<a name="line.28"></a>
+<FONT color="green">029</FONT>     */<a name="line.29"></a>
+<FONT color="green">030</FONT>    public final class MathUtils {<a name="line.30"></a>
+<FONT color="green">031</FONT>    <a name="line.31"></a>
+<FONT color="green">032</FONT>        /** Smallest positive number such that 1 - EPSILON is not numerically equal to 1. */<a name="line.32"></a>
+<FONT color="green">033</FONT>        public static final double EPSILON = 0x1.0p-53;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>        /** Safe minimum, such that 1 / SAFE_MIN does not overflow.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * &lt;p&gt;In IEEE 754 arithmetic, this is also the smallest normalized<a name="line.36"></a>
+<FONT color="green">037</FONT>         * number 2&lt;sup&gt;-1022&lt;/sup&gt;.&lt;/p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>         */<a name="line.38"></a>
+<FONT color="green">039</FONT>        public static final double SAFE_MIN = 0x1.0p-1022;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /**<a name="line.41"></a>
+<FONT color="green">042</FONT>         * 2 &amp;pi;.<a name="line.42"></a>
+<FONT color="green">043</FONT>         * @since 2.1<a name="line.43"></a>
+<FONT color="green">044</FONT>         */<a name="line.44"></a>
+<FONT color="green">045</FONT>        public static final double TWO_PI = 2 * Math.PI;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** -1.0 cast as a byte. */<a name="line.47"></a>
+<FONT color="green">048</FONT>        private static final byte  NB = (byte)-1;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** -1.0 cast as a short. */<a name="line.50"></a>
+<FONT color="green">051</FONT>        private static final short NS = (short)-1;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** 1.0 cast as a byte. */<a name="line.53"></a>
+<FONT color="green">054</FONT>        private static final byte  PB = (byte)1;<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** 1.0 cast as a short. */<a name="line.56"></a>
+<FONT color="green">057</FONT>        private static final short PS = (short)1;<a name="line.57"></a>
+<FONT color="green">058</FONT>    <a name="line.58"></a>
+<FONT color="green">059</FONT>        /** 0.0 cast as a byte. */<a name="line.59"></a>
+<FONT color="green">060</FONT>        private static final byte  ZB = (byte)0;<a name="line.60"></a>
+<FONT color="green">061</FONT>    <a name="line.61"></a>
+<FONT color="green">062</FONT>        /** 0.0 cast as a short. */<a name="line.62"></a>
+<FONT color="green">063</FONT>        private static final short ZS = (short)0;<a name="line.63"></a>
+<FONT color="green">064</FONT>    <a name="line.64"></a>
+<FONT color="green">065</FONT>        /** Gap between NaN and regular numbers. */<a name="line.65"></a>
+<FONT color="green">066</FONT>        private static final int NAN_GAP = 4 * 1024 * 1024;<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        /** Offset to order signed double numbers lexicographically. */<a name="line.68"></a>
+<FONT color="green">069</FONT>        private static final long SGN_MASK = 0x8000000000000000L;<a name="line.69"></a>
+<FONT color="green">070</FONT>    <a name="line.70"></a>
+<FONT color="green">071</FONT>        /** All long-representable factorials */<a name="line.71"></a>
+<FONT color="green">072</FONT>        private static final long[] FACTORIALS = new long[] {<a name="line.72"></a>
+<FONT color="green">073</FONT>                           1l,                  1l,                   2l,<a name="line.73"></a>
+<FONT color="green">074</FONT>                           6l,                 24l,                 120l,<a name="line.74"></a>
+<FONT color="green">075</FONT>                         720l,               5040l,               40320l,<a name="line.75"></a>
+<FONT color="green">076</FONT>                      362880l,            3628800l,            39916800l,<a name="line.76"></a>
+<FONT color="green">077</FONT>                   479001600l,         6227020800l,         87178291200l,<a name="line.77"></a>
+<FONT color="green">078</FONT>               1307674368000l,     20922789888000l,     355687428096000l,<a name="line.78"></a>
+<FONT color="green">079</FONT>            6402373705728000l, 121645100408832000l, 2432902008176640000l };<a name="line.79"></a>
+<FONT color="green">080</FONT>    <a name="line.80"></a>
+<FONT color="green">081</FONT>        /**<a name="line.81"></a>
+<FONT color="green">082</FONT>         * Private Constructor<a name="line.82"></a>
+<FONT color="green">083</FONT>         */<a name="line.83"></a>
+<FONT color="green">084</FONT>        private MathUtils() {<a name="line.84"></a>
+<FONT color="green">085</FONT>            super();<a name="line.85"></a>
+<FONT color="green">086</FONT>        }<a name="line.86"></a>
+<FONT color="green">087</FONT>    <a name="line.87"></a>
+<FONT color="green">088</FONT>        /**<a name="line.88"></a>
+<FONT color="green">089</FONT>         * Add two integers, checking for overflow.<a name="line.89"></a>
+<FONT color="green">090</FONT>         *<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @param x an addend<a name="line.91"></a>
+<FONT color="green">092</FONT>         * @param y an addend<a name="line.92"></a>
+<FONT color="green">093</FONT>         * @return the sum &lt;code&gt;x+y&lt;/code&gt;<a name="line.93"></a>
+<FONT color="green">094</FONT>         * @throws ArithmeticException if the result can not be represented as an<a name="line.94"></a>
+<FONT color="green">095</FONT>         *         int<a name="line.95"></a>
+<FONT color="green">096</FONT>         * @since 1.1<a name="line.96"></a>
+<FONT color="green">097</FONT>         */<a name="line.97"></a>
+<FONT color="green">098</FONT>        public static int addAndCheck(int x, int y) {<a name="line.98"></a>
+<FONT color="green">099</FONT>            long s = (long)x + (long)y;<a name="line.99"></a>
+<FONT color="green">100</FONT>            if (s &lt; Integer.MIN_VALUE || s &gt; Integer.MAX_VALUE) {<a name="line.100"></a>
+<FONT color="green">101</FONT>                throw new ArithmeticException("overflow: add");<a name="line.101"></a>
+<FONT color="green">102</FONT>            }<a name="line.102"></a>
+<FONT color="green">103</FONT>            return (int)s;<a name="line.103"></a>
+<FONT color="green">104</FONT>        }<a name="line.104"></a>
+<FONT color="green">105</FONT>    <a name="line.105"></a>
+<FONT color="green">106</FONT>        /**<a name="line.106"></a>
+<FONT color="green">107</FONT>         * Add two long integers, checking for overflow.<a name="line.107"></a>
+<FONT color="green">108</FONT>         *<a name="line.108"></a>
+<FONT color="green">109</FONT>         * @param a an addend<a name="line.109"></a>
+<FONT color="green">110</FONT>         * @param b an addend<a name="line.110"></a>
+<FONT color="green">111</FONT>         * @return the sum &lt;code&gt;a+b&lt;/code&gt;<a name="line.111"></a>
+<FONT color="green">112</FONT>         * @throws ArithmeticException if the result can not be represented as an<a name="line.112"></a>
+<FONT color="green">113</FONT>         *         long<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @since 1.2<a name="line.114"></a>
+<FONT color="green">115</FONT>         */<a name="line.115"></a>
+<FONT color="green">116</FONT>        public static long addAndCheck(long a, long b) {<a name="line.116"></a>
+<FONT color="green">117</FONT>            return addAndCheck(a, b, "overflow: add");<a name="line.117"></a>
+<FONT color="green">118</FONT>        }<a name="line.118"></a>
+<FONT color="green">119</FONT>    <a name="line.119"></a>
+<FONT color="green">120</FONT>        /**<a name="line.120"></a>
+<FONT color="green">121</FONT>         * Add two long integers, checking for overflow.<a name="line.121"></a>
+<FONT color="green">122</FONT>         *<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @param a an addend<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @param b an addend<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @param msg the message to use for any thrown exception.<a name="line.125"></a>
+<FONT color="green">126</FONT>         * @return the sum &lt;code&gt;a+b&lt;/code&gt;<a name="line.126"></a>
+<FONT color="green">127</FONT>         * @throws ArithmeticException if the result can not be represented as an<a name="line.127"></a>
+<FONT color="green">128</FONT>         *         long<a name="line.128"></a>
+<FONT color="green">129</FONT>         * @since 1.2<a name="line.129"></a>
+<FONT color="green">130</FONT>         */<a name="line.130"></a>
+<FONT color="green">131</FONT>        private static long addAndCheck(long a, long b, String msg) {<a name="line.131"></a>
+<FONT color="green">132</FONT>            long ret;<a name="line.132"></a>
+<FONT color="green">133</FONT>            if (a &gt; b) {<a name="line.133"></a>
+<FONT color="green">134</FONT>                // use symmetry to reduce boundary cases<a name="line.134"></a>
+<FONT color="green">135</FONT>                ret = addAndCheck(b, a, msg);<a name="line.135"></a>
+<FONT color="green">136</FONT>            } else {<a name="line.136"></a>
+<FONT color="green">137</FONT>                // assert a &lt;= b<a name="line.137"></a>
+<FONT color="green">138</FONT>    <a name="line.138"></a>
+<FONT color="green">139</FONT>                if (a &lt; 0) {<a name="line.139"></a>
+<FONT color="green">140</FONT>                    if (b &lt; 0) {<a name="line.140"></a>
+<FONT color="green">141</FONT>                        // check for negative overflow<a name="line.141"></a>
+<FONT color="green">142</FONT>                        if (Long.MIN_VALUE - b &lt;= a) {<a name="line.142"></a>
+<FONT color="green">143</FONT>                            ret = a + b;<a name="line.143"></a>
+<FONT color="green">144</FONT>                        } else {<a name="line.144"></a>
+<FONT color="green">145</FONT>                            throw new ArithmeticException(msg);<a name="line.145"></a>
+<FONT color="green">146</FONT>                        }<a name="line.146"></a>
+<FONT color="green">147</FONT>                    } else {<a name="line.147"></a>
+<FONT color="green">148</FONT>                        // opposite sign addition is always safe<a name="line.148"></a>
+<FONT color="green">149</FONT>                        ret = a + b;<a name="line.149"></a>
+<FONT color="green">150</FONT>                    }<a name="line.150"></a>
+<FONT color="green">151</FONT>                } else {<a name="line.151"></a>
+<FONT color="green">152</FONT>                    // assert a &gt;= 0<a name="line.152"></a>
+<FONT color="green">153</FONT>                    // assert b &gt;= 0<a name="line.153"></a>
+<FONT color="green">154</FONT>    <a name="line.154"></a>
+<FONT color="green">155</FONT>                    // check for positive overflow<a name="line.155"></a>
+<FONT color="green">156</FONT>                    if (a &lt;= Long.MAX_VALUE - b) {<a name="line.156"></a>
+<FONT color="green">157</FONT>                        ret = a + b;<a name="line.157"></a>
+<FONT color="green">158</FONT>                    } else {<a name="line.158"></a>
+<FONT color="green">159</FONT>                        throw new ArithmeticException(msg);<a name="line.159"></a>
+<FONT color="green">160</FONT>                    }<a name="line.160"></a>
+<FONT color="green">161</FONT>                }<a name="line.161"></a>
+<FONT color="green">162</FONT>            }<a name="line.162"></a>
+<FONT color="green">163</FONT>            return ret;<a name="line.163"></a>
+<FONT color="green">164</FONT>        }<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>        /**<a name="line.166"></a>
+<FONT color="green">167</FONT>         * Returns an exact representation of the &lt;a<a name="line.167"></a>
+<FONT color="green">168</FONT>         * href="http://mathworld.wolfram.com/BinomialCoefficient.html"&gt; Binomial<a name="line.168"></a>
+<FONT color="green">169</FONT>         * Coefficient&lt;/a&gt;, "&lt;code&gt;n choose k&lt;/code&gt;", the number of<a name="line.169"></a>
+<FONT color="green">170</FONT>         * &lt;code&gt;k&lt;/code&gt;-element subsets that can be selected from an<a name="line.170"></a>
+<FONT color="green">171</FONT>         * &lt;code&gt;n&lt;/code&gt;-element set.<a name="line.171"></a>
+<FONT color="green">172</FONT>         * &lt;p&gt;<a name="line.172"></a>
+<FONT color="green">173</FONT>         * &lt;Strong&gt;Preconditions&lt;/strong&gt;:<a name="line.173"></a>
+<FONT color="green">174</FONT>         * &lt;ul&gt;<a name="line.174"></a>
+<FONT color="green">175</FONT>         * &lt;li&gt; &lt;code&gt;0 &lt;= k &lt;= n &lt;/code&gt; (otherwise<a name="line.175"></a>
+<FONT color="green">176</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown)&lt;/li&gt;<a name="line.176"></a>
+<FONT color="green">177</FONT>         * &lt;li&gt; The result is small enough to fit into a &lt;code&gt;long&lt;/code&gt;. The<a name="line.177"></a>
+<FONT color="green">178</FONT>         * largest value of &lt;code&gt;n&lt;/code&gt; for which all coefficients are<a name="line.178"></a>
+<FONT color="green">179</FONT>         * &lt;code&gt; &lt; Long.MAX_VALUE&lt;/code&gt; is 66. If the computed value exceeds<a name="line.179"></a>
+<FONT color="green">180</FONT>         * &lt;code&gt;Long.MAX_VALUE&lt;/code&gt; an &lt;code&gt;ArithMeticException&lt;/code&gt; is<a name="line.180"></a>
+<FONT color="green">181</FONT>         * thrown.&lt;/li&gt;<a name="line.181"></a>
+<FONT color="green">182</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.182"></a>
+<FONT color="green">183</FONT>         *<a name="line.183"></a>
+<FONT color="green">184</FONT>         * @param n the size of the set<a name="line.184"></a>
+<FONT color="green">185</FONT>         * @param k the size of the subsets to be counted<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @return &lt;code&gt;n choose k&lt;/code&gt;<a name="line.186"></a>
+<FONT color="green">187</FONT>         * @throws IllegalArgumentException if preconditions are not met.<a name="line.187"></a>
+<FONT color="green">188</FONT>         * @throws ArithmeticException if the result is too large to be represented<a name="line.188"></a>
+<FONT color="green">189</FONT>         *         by a long integer.<a name="line.189"></a>
+<FONT color="green">190</FONT>         */<a name="line.190"></a>
+<FONT color="green">191</FONT>        public static long binomialCoefficient(final int n, final int k) {<a name="line.191"></a>
+<FONT color="green">192</FONT>            checkBinomial(n, k);<a name="line.192"></a>
+<FONT color="green">193</FONT>            if ((n == k) || (k == 0)) {<a name="line.193"></a>
+<FONT color="green">194</FONT>                return 1;<a name="line.194"></a>
+<FONT color="green">195</FONT>            }<a name="line.195"></a>
+<FONT color="green">196</FONT>            if ((k == 1) || (k == n - 1)) {<a name="line.196"></a>
+<FONT color="green">197</FONT>                return n;<a name="line.197"></a>
+<FONT color="green">198</FONT>            }<a name="line.198"></a>
+<FONT color="green">199</FONT>            // Use symmetry for large k<a name="line.199"></a>
+<FONT color="green">200</FONT>            if (k &gt; n / 2)<a name="line.200"></a>
+<FONT color="green">201</FONT>                return binomialCoefficient(n, n - k);<a name="line.201"></a>
+<FONT color="green">202</FONT>    <a name="line.202"></a>
+<FONT color="green">203</FONT>            // We use the formula<a name="line.203"></a>
+<FONT color="green">204</FONT>            // (n choose k) = n! / (n-k)! / k!<a name="line.204"></a>
+<FONT color="green">205</FONT>            // (n choose k) == ((n-k+1)*...*n) / (1*...*k)<a name="line.205"></a>
+<FONT color="green">206</FONT>            // which could be written<a name="line.206"></a>
+<FONT color="green">207</FONT>            // (n choose k) == (n-1 choose k-1) * n / k<a name="line.207"></a>
+<FONT color="green">208</FONT>            long result = 1;<a name="line.208"></a>
+<FONT color="green">209</FONT>            if (n &lt;= 61) {<a name="line.209"></a>
+<FONT color="green">210</FONT>                // For n &lt;= 61, the naive implementation cannot overflow.<a name="line.210"></a>
+<FONT color="green">211</FONT>                int i = n - k + 1;<a name="line.211"></a>
+<FONT color="green">212</FONT>                for (int j = 1; j &lt;= k; j++) {<a name="line.212"></a>
+<FONT color="green">213</FONT>                    result = result * i / j;<a name="line.213"></a>
+<FONT color="green">214</FONT>                    i++;<a name="line.214"></a>
+<FONT color="green">215</FONT>                }<a name="line.215"></a>
+<FONT color="green">216</FONT>            } else if (n &lt;= 66) {<a name="line.216"></a>
+<FONT color="green">217</FONT>                // For n &gt; 61 but n &lt;= 66, the result cannot overflow,<a name="line.217"></a>
+<FONT color="green">218</FONT>                // but we must take care not to overflow intermediate values.<a name="line.218"></a>
+<FONT color="green">219</FONT>                int i = n - k + 1;<a name="line.219"></a>
+<FONT color="green">220</FONT>                for (int j = 1; j &lt;= k; j++) {<a name="line.220"></a>
+<FONT color="green">221</FONT>                    // We know that (result * i) is divisible by j,<a name="line.221"></a>
+<FONT color="green">222</FONT>                    // but (result * i) may overflow, so we split j:<a name="line.222"></a>
+<FONT color="green">223</FONT>                    // Filter out the gcd, d, so j/d and i/d are integer.<a name="line.223"></a>
+<FONT color="green">224</FONT>                    // result is divisible by (j/d) because (j/d)<a name="line.224"></a>
+<FONT color="green">225</FONT>                    // is relative prime to (i/d) and is a divisor of<a name="line.225"></a>
+<FONT color="green">226</FONT>                    // result * (i/d).<a name="line.226"></a>
+<FONT color="green">227</FONT>                    final long d = gcd(i, j);<a name="line.227"></a>
+<FONT color="green">228</FONT>                    result = (result / (j / d)) * (i / d);<a name="line.228"></a>
+<FONT color="green">229</FONT>                    i++;<a name="line.229"></a>
+<FONT color="green">230</FONT>                }<a name="line.230"></a>
+<FONT color="green">231</FONT>            } else {<a name="line.231"></a>
+<FONT color="green">232</FONT>                // For n &gt; 66, a result overflow might occur, so we check<a name="line.232"></a>
+<FONT color="green">233</FONT>                // the multiplication, taking care to not overflow<a name="line.233"></a>
+<FONT color="green">234</FONT>                // unnecessary.<a name="line.234"></a>
+<FONT color="green">235</FONT>                int i = n - k + 1;<a name="line.235"></a>
+<FONT color="green">236</FONT>                for (int j = 1; j &lt;= k; j++) {<a name="line.236"></a>
+<FONT color="green">237</FONT>                    final long d = gcd(i, j);<a name="line.237"></a>
+<FONT color="green">238</FONT>                    result = mulAndCheck(result / (j / d), i / d);<a name="line.238"></a>
+<FONT color="green">239</FONT>                    i++;<a name="line.239"></a>
+<FONT color="green">240</FONT>                }<a name="line.240"></a>
+<FONT color="green">241</FONT>            }<a name="line.241"></a>
+<FONT color="green">242</FONT>            return result;<a name="line.242"></a>
+<FONT color="green">243</FONT>        }<a name="line.243"></a>
+<FONT color="green">244</FONT>    <a name="line.244"></a>
+<FONT color="green">245</FONT>        /**<a name="line.245"></a>
+<FONT color="green">246</FONT>         * Returns a &lt;code&gt;double&lt;/code&gt; representation of the &lt;a<a name="line.246"></a>
+<FONT color="green">247</FONT>         * href="http://mathworld.wolfram.com/BinomialCoefficient.html"&gt; Binomial<a name="line.247"></a>
+<FONT color="green">248</FONT>         * Coefficient&lt;/a&gt;, "&lt;code&gt;n choose k&lt;/code&gt;", the number of<a name="line.248"></a>
+<FONT color="green">249</FONT>         * &lt;code&gt;k&lt;/code&gt;-element subsets that can be selected from an<a name="line.249"></a>
+<FONT color="green">250</FONT>         * &lt;code&gt;n&lt;/code&gt;-element set.<a name="line.250"></a>
+<FONT color="green">251</FONT>         * &lt;p&gt;<a name="line.251"></a>
+<FONT color="green">252</FONT>         * &lt;Strong&gt;Preconditions&lt;/strong&gt;:<a name="line.252"></a>
+<FONT color="green">253</FONT>         * &lt;ul&gt;<a name="line.253"></a>
+<FONT color="green">254</FONT>         * &lt;li&gt; &lt;code&gt;0 &lt;= k &lt;= n &lt;/code&gt; (otherwise<a name="line.254"></a>
+<FONT color="green">255</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown)&lt;/li&gt;<a name="line.255"></a>
+<FONT color="green">256</FONT>         * &lt;li&gt; The result is small enough to fit into a &lt;code&gt;double&lt;/code&gt;. The<a name="line.256"></a>
+<FONT color="green">257</FONT>         * largest value of &lt;code&gt;n&lt;/code&gt; for which all coefficients are &lt;<a name="line.257"></a>
+<FONT color="green">258</FONT>         * Double.MAX_VALUE is 1029. If the computed value exceeds Double.MAX_VALUE,<a name="line.258"></a>
+<FONT color="green">259</FONT>         * Double.POSITIVE_INFINITY is returned&lt;/li&gt;<a name="line.259"></a>
+<FONT color="green">260</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.260"></a>
+<FONT color="green">261</FONT>         *<a name="line.261"></a>
+<FONT color="green">262</FONT>         * @param n the size of the set<a name="line.262"></a>
+<FONT color="green">263</FONT>         * @param k the size of the subsets to be counted<a name="line.263"></a>
+<FONT color="green">264</FONT>         * @return &lt;code&gt;n choose k&lt;/code&gt;<a name="line.264"></a>
+<FONT color="green">265</FONT>         * @throws IllegalArgumentException if preconditions are not met.<a name="line.265"></a>
+<FONT color="green">266</FONT>         */<a name="line.266"></a>
+<FONT color="green">267</FONT>        public static double binomialCoefficientDouble(final int n, final int k) {<a name="line.267"></a>
+<FONT color="green">268</FONT>            checkBinomial(n, k);<a name="line.268"></a>
+<FONT color="green">269</FONT>            if ((n == k) || (k == 0)) {<a name="line.269"></a>
+<FONT color="green">270</FONT>                return 1d;<a name="line.270"></a>
+<FONT color="green">271</FONT>            }<a name="line.271"></a>
+<FONT color="green">272</FONT>            if ((k == 1) || (k == n - 1)) {<a name="line.272"></a>
+<FONT color="green">273</FONT>                return n;<a name="line.273"></a>
+<FONT color="green">274</FONT>            }<a name="line.274"></a>
+<FONT color="green">275</FONT>            if (k &gt; n/2) {<a name="line.275"></a>
+<FONT color="green">276</FONT>                return binomialCoefficientDouble(n, n - k);<a name="line.276"></a>
+<FONT color="green">277</FONT>            }<a name="line.277"></a>
+<FONT color="green">278</FONT>            if (n &lt; 67) {<a name="line.278"></a>
+<FONT color="green">279</FONT>                return binomialCoefficient(n,k);<a name="line.279"></a>
+<FONT color="green">280</FONT>            }<a name="line.280"></a>
+<FONT color="green">281</FONT>    <a name="line.281"></a>
+<FONT color="green">282</FONT>            double result = 1d;<a name="line.282"></a>
+<FONT color="green">283</FONT>            for (int i = 1; i &lt;= k; i++) {<a name="line.283"></a>
+<FONT color="green">284</FONT>                 result *= (double)(n - k + i) / (double)i;<a name="line.284"></a>
+<FONT color="green">285</FONT>            }<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>            return Math.floor(result + 0.5);<a name="line.287"></a>
+<FONT color="green">288</FONT>        }<a name="line.288"></a>
+<FONT color="green">289</FONT>    <a name="line.289"></a>
+<FONT color="green">290</FONT>        /**<a name="line.290"></a>
+<FONT color="green">291</FONT>         * Returns the natural &lt;code&gt;log&lt;/code&gt; of the &lt;a<a name="line.291"></a>
+<FONT color="green">292</FONT>         * href="http://mathworld.wolfram.com/BinomialCoefficient.html"&gt; Binomial<a name="line.292"></a>
+<FONT color="green">293</FONT>         * Coefficient&lt;/a&gt;, "&lt;code&gt;n choose k&lt;/code&gt;", the number of<a name="line.293"></a>
+<FONT color="green">294</FONT>         * &lt;code&gt;k&lt;/code&gt;-element subsets that can be selected from an<a name="line.294"></a>
+<FONT color="green">295</FONT>         * &lt;code&gt;n&lt;/code&gt;-element set.<a name="line.295"></a>
+<FONT color="green">296</FONT>         * &lt;p&gt;<a name="line.296"></a>
+<FONT color="green">297</FONT>         * &lt;Strong&gt;Preconditions&lt;/strong&gt;:<a name="line.297"></a>
+<FONT color="green">298</FONT>         * &lt;ul&gt;<a name="line.298"></a>
+<FONT color="green">299</FONT>         * &lt;li&gt; &lt;code&gt;0 &lt;= k &lt;= n &lt;/code&gt; (otherwise<a name="line.299"></a>
+<FONT color="green">300</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown)&lt;/li&gt;<a name="line.300"></a>
+<FONT color="green">301</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.301"></a>
+<FONT color="green">302</FONT>         *<a name="line.302"></a>
+<FONT color="green">303</FONT>         * @param n the size of the set<a name="line.303"></a>
+<FONT color="green">304</FONT>         * @param k the size of the subsets to be counted<a name="line.304"></a>
+<FONT color="green">305</FONT>         * @return &lt;code&gt;n choose k&lt;/code&gt;<a name="line.305"></a>
+<FONT color="green">306</FONT>         * @throws IllegalArgumentException if preconditions are not met.<a name="line.306"></a>
+<FONT color="green">307</FONT>         */<a name="line.307"></a>
+<FONT color="green">308</FONT>        public static double binomialCoefficientLog(final int n, final int k) {<a name="line.308"></a>
+<FONT color="green">309</FONT>            checkBinomial(n, k);<a name="line.309"></a>
+<FONT color="green">310</FONT>            if ((n == k) || (k == 0)) {<a name="line.310"></a>
+<FONT color="green">311</FONT>                return 0;<a name="line.311"></a>
+<FONT color="green">312</FONT>            }<a name="line.312"></a>
+<FONT color="green">313</FONT>            if ((k == 1) || (k == n - 1)) {<a name="line.313"></a>
+<FONT color="green">314</FONT>                return Math.log(n);<a name="line.314"></a>
+<FONT color="green">315</FONT>            }<a name="line.315"></a>
+<FONT color="green">316</FONT>    <a name="line.316"></a>
+<FONT color="green">317</FONT>            /*<a name="line.317"></a>
+<FONT color="green">318</FONT>             * For values small enough to do exact integer computation,<a name="line.318"></a>
+<FONT color="green">319</FONT>             * return the log of the exact value<a name="line.319"></a>
+<FONT color="green">320</FONT>             */<a name="line.320"></a>
+<FONT color="green">321</FONT>            if (n &lt; 67) {<a name="line.321"></a>
+<FONT color="green">322</FONT>                return Math.log(binomialCoefficient(n,k));<a name="line.322"></a>
+<FONT color="green">323</FONT>            }<a name="line.323"></a>
+<FONT color="green">324</FONT>    <a name="line.324"></a>
+<FONT color="green">325</FONT>            /*<a name="line.325"></a>
+<FONT color="green">326</FONT>             * Return the log of binomialCoefficientDouble for values that will not<a name="line.326"></a>
+<FONT color="green">327</FONT>             * overflow binomialCoefficientDouble<a name="line.327"></a>
+<FONT color="green">328</FONT>             */<a name="line.328"></a>
+<FONT color="green">329</FONT>            if (n &lt; 1030) {<a name="line.329"></a>
+<FONT color="green">330</FONT>                return Math.log(binomialCoefficientDouble(n, k));<a name="line.330"></a>
+<FONT color="green">331</FONT>            }<a name="line.331"></a>
+<FONT color="green">332</FONT>    <a name="line.332"></a>
+<FONT color="green">333</FONT>            if (k &gt; n / 2) {<a name="line.333"></a>
+<FONT color="green">334</FONT>                return binomialCoefficientLog(n, n - k);<a name="line.334"></a>
+<FONT color="green">335</FONT>            }<a name="line.335"></a>
+<FONT color="green">336</FONT>    <a name="line.336"></a>
+<FONT color="green">337</FONT>            /*<a name="line.337"></a>
+<FONT color="green">338</FONT>             * Sum logs for values that could overflow<a name="line.338"></a>
+<FONT color="green">339</FONT>             */<a name="line.339"></a>
+<FONT color="green">340</FONT>            double logSum = 0;<a name="line.340"></a>
+<FONT color="green">341</FONT>    <a name="line.341"></a>
+<FONT color="green">342</FONT>            // n!/(n-k)!<a name="line.342"></a>
+<FONT color="green">343</FONT>            for (int i = n - k + 1; i &lt;= n; i++) {<a name="line.343"></a>
+<FONT color="green">344</FONT>                logSum += Math.log(i);<a name="line.344"></a>
+<FONT color="green">345</FONT>            }<a name="line.345"></a>
+<FONT color="green">346</FONT>    <a name="line.346"></a>
+<FONT color="green">347</FONT>            // divide by k!<a name="line.347"></a>
+<FONT color="green">348</FONT>            for (int i = 2; i &lt;= k; i++) {<a name="line.348"></a>
+<FONT color="green">349</FONT>                logSum -= Math.log(i);<a name="line.349"></a>
+<FONT color="green">350</FONT>            }<a name="line.350"></a>
+<FONT color="green">351</FONT>    <a name="line.351"></a>
+<FONT color="green">352</FONT>            return logSum;<a name="line.352"></a>
+<FONT color="green">353</FONT>        }<a name="line.353"></a>
+<FONT color="green">354</FONT>    <a name="line.354"></a>
+<FONT color="green">355</FONT>        /**<a name="line.355"></a>
+<FONT color="green">356</FONT>         * Check binomial preconditions.<a name="line.356"></a>
+<FONT color="green">357</FONT>         * @param n the size of the set<a name="line.357"></a>
+<FONT color="green">358</FONT>         * @param k the size of the subsets to be counted<a name="line.358"></a>
+<FONT color="green">359</FONT>         * @exception IllegalArgumentException if preconditions are not met.<a name="line.359"></a>
+<FONT color="green">360</FONT>         */<a name="line.360"></a>
+<FONT color="green">361</FONT>        private static void checkBinomial(final int n, final int k)<a name="line.361"></a>
+<FONT color="green">362</FONT>            throws IllegalArgumentException {<a name="line.362"></a>
+<FONT color="green">363</FONT>            if (n &lt; k) {<a name="line.363"></a>
+<FONT color="green">364</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.364"></a>
+<FONT color="green">365</FONT>                    "must have n &gt;= k for binomial coefficient (n,k), got n = {0}, k = {1}",<a name="line.365"></a>
+<FONT color="green">366</FONT>                    n, k);<a name="line.366"></a>
+<FONT color="green">367</FONT>            }<a name="line.367"></a>
+<FONT color="green">368</FONT>            if (n &lt; 0) {<a name="line.368"></a>
+<FONT color="green">369</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.369"></a>
+<FONT color="green">370</FONT>                      "must have n &gt;= 0 for binomial coefficient (n,k), got n = {0}",<a name="line.370"></a>
+<FONT color="green">371</FONT>                      n);<a name="line.371"></a>
+<FONT color="green">372</FONT>            }<a name="line.372"></a>
+<FONT color="green">373</FONT>        }<a name="line.373"></a>
+<FONT color="green">374</FONT>    <a name="line.374"></a>
+<FONT color="green">375</FONT>        /**<a name="line.375"></a>
+<FONT color="green">376</FONT>         * Compares two numbers given some amount of allowed error.<a name="line.376"></a>
+<FONT color="green">377</FONT>         *<a name="line.377"></a>
+<FONT color="green">378</FONT>         * @param x the first number<a name="line.378"></a>
+<FONT color="green">379</FONT>         * @param y the second number<a name="line.379"></a>
+<FONT color="green">380</FONT>         * @param eps the amount of error to allow when checking for equality<a name="line.380"></a>
+<FONT color="green">381</FONT>         * @return &lt;ul&gt;&lt;li&gt;0 if  {@link #equals(double, double, double) equals(x, y, eps)}&lt;/li&gt;<a name="line.381"></a>
+<FONT color="green">382</FONT>         *       &lt;li&gt;&amp;lt; 0 if !{@link #equals(double, double, double) equals(x, y, eps)} &amp;amp;&amp;amp; x &amp;lt; y&lt;/li&gt;<a name="line.382"></a>
+<FONT color="green">383</FONT>         *       &lt;li&gt;&gt; 0 if !{@link #equals(double, double, double) equals(x, y, eps)} &amp;amp;&amp;amp; x &gt; y&lt;/li&gt;&lt;/ul&gt;<a name="line.383"></a>
+<FONT color="green">384</FONT>         */<a name="line.384"></a>
+<FONT color="green">385</FONT>        public static int compareTo(double x, double y, double eps) {<a name="line.385"></a>
+<FONT color="green">386</FONT>            if (equals(x, y, eps)) {<a name="line.386"></a>
+<FONT color="green">387</FONT>                return 0;<a name="line.387"></a>
+<FONT color="green">388</FONT>            } else if (x &lt; y) {<a name="line.388"></a>
+<FONT color="green">389</FONT>              return -1;<a name="line.389"></a>
+<FONT color="green">390</FONT>            }<a name="line.390"></a>
+<FONT color="green">391</FONT>            return 1;<a name="line.391"></a>
+<FONT color="green">392</FONT>        }<a name="line.392"></a>
+<FONT color="green">393</FONT>    <a name="line.393"></a>
+<FONT color="green">394</FONT>        /**<a name="line.394"></a>
+<FONT color="green">395</FONT>         * Returns the &lt;a href="http://mathworld.wolfram.com/HyperbolicCosine.html"&gt;<a name="line.395"></a>
+<FONT color="green">396</FONT>         * hyperbolic cosine&lt;/a&gt; of x.<a name="line.396"></a>
+<FONT color="green">397</FONT>         *<a name="line.397"></a>
+<FONT color="green">398</FONT>         * @param x double value for which to find the hyperbolic cosine<a name="line.398"></a>
+<FONT color="green">399</FONT>         * @return hyperbolic cosine of x<a name="line.399"></a>
+<FONT color="green">400</FONT>         */<a name="line.400"></a>
+<FONT color="green">401</FONT>        public static double cosh(double x) {<a name="line.401"></a>
+<FONT color="green">402</FONT>            return (Math.exp(x) + Math.exp(-x)) / 2.0;<a name="line.402"></a>
+<FONT color="green">403</FONT>        }<a name="line.403"></a>
+<FONT color="green">404</FONT>    <a name="line.404"></a>
+<FONT color="green">405</FONT>        /**<a name="line.405"></a>
+<FONT color="green">406</FONT>         * Returns true iff both arguments are NaN or neither is NaN and they are<a name="line.406"></a>
+<FONT color="green">407</FONT>         * equal<a name="line.407"></a>
+<FONT color="green">408</FONT>         *<a name="line.408"></a>
+<FONT color="green">409</FONT>         * @param x first value<a name="line.409"></a>
+<FONT color="green">410</FONT>         * @param y second value<a name="line.410"></a>
+<FONT color="green">411</FONT>         * @return true if the values are equal or both are NaN<a name="line.411"></a>
+<FONT color="green">412</FONT>         */<a name="line.412"></a>
+<FONT color="green">413</FONT>        public static boolean equals(double x, double y) {<a name="line.413"></a>
+<FONT color="green">414</FONT>            return (Double.isNaN(x) &amp;&amp; Double.isNaN(y)) || x == y;<a name="line.414"></a>
+<FONT color="green">415</FONT>        }<a name="line.415"></a>
+<FONT color="green">416</FONT>    <a name="line.416"></a>
+<FONT color="green">417</FONT>        /**<a name="line.417"></a>
+<FONT color="green">418</FONT>         * Returns true iff both arguments are equal or within the range of allowed<a name="line.418"></a>
+<FONT color="green">419</FONT>         * error (inclusive).<a name="line.419"></a>
+<FONT color="green">420</FONT>         * &lt;p&gt;<a name="line.420"></a>
+<FONT color="green">421</FONT>         * Two NaNs are considered equals, as are two infinities with same sign.<a name="line.421"></a>
+<FONT color="green">422</FONT>         * &lt;/p&gt;<a name="line.422"></a>
+<FONT color="green">423</FONT>         *<a name="line.423"></a>
+<FONT color="green">424</FONT>         * @param x first value<a name="line.424"></a>
+<FONT color="green">425</FONT>         * @param y second value<a name="line.425"></a>
+<FONT color="green">426</FONT>         * @param eps the amount of absolute error to allow<a name="line.426"></a>
+<FONT color="green">427</FONT>         * @return true if the values are equal or within range of each other<a name="line.427"></a>
+<FONT color="green">428</FONT>         */<a name="line.428"></a>
+<FONT color="green">429</FONT>        public static boolean equals(double x, double y, double eps) {<a name="line.429"></a>
+<FONT color="green">430</FONT>          return equals(x, y) || (Math.abs(y - x) &lt;= eps);<a name="line.430"></a>
+<FONT color="green">431</FONT>        }<a name="line.431"></a>
+<FONT color="green">432</FONT>    <a name="line.432"></a>
+<FONT color="green">433</FONT>        /**<a name="line.433"></a>
+<FONT color="green">434</FONT>         * Returns true iff both arguments are equal or within the range of allowed<a name="line.434"></a>
+<FONT color="green">435</FONT>         * error (inclusive).<a name="line.435"></a>
+<FONT color="green">436</FONT>         * Adapted from &lt;a<a name="line.436"></a>
+<FONT color="green">437</FONT>         * href="http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm"&gt;<a name="line.437"></a>
+<FONT color="green">438</FONT>         * Bruce Dawson&lt;/a&gt;<a name="line.438"></a>
+<FONT color="green">439</FONT>         *<a name="line.439"></a>
+<FONT color="green">440</FONT>         * @param x first value<a name="line.440"></a>
+<FONT color="green">441</FONT>         * @param y second value<a name="line.441"></a>
+<FONT color="green">442</FONT>         * @param maxUlps {@code (maxUlps - 1)} is the number of floating point<a name="line.442"></a>
+<FONT color="green">443</FONT>         * values between {@code x} and {@code y}.<a name="line.443"></a>
+<FONT color="green">444</FONT>         * @return {@code true} if there are less than {@code maxUlps} floating<a name="line.444"></a>
+<FONT color="green">445</FONT>         * point values between {@code x} and {@code y}<a name="line.445"></a>
+<FONT color="green">446</FONT>         */<a name="line.446"></a>
+<FONT color="green">447</FONT>        public static boolean equals(double x, double y, int maxUlps) {<a name="line.447"></a>
+<FONT color="green">448</FONT>            // Check that "maxUlps" is non-negative and small enough so that the<a name="line.448"></a>
+<FONT color="green">449</FONT>            // default NAN won't compare as equal to anything.<a name="line.449"></a>
+<FONT color="green">450</FONT>            assert maxUlps &gt; 0 &amp;&amp; maxUlps &lt; NAN_GAP;<a name="line.450"></a>
+<FONT color="green">451</FONT>    <a name="line.451"></a>
+<FONT color="green">452</FONT>            long xInt = Double.doubleToLongBits(x);<a name="line.452"></a>
+<FONT color="green">453</FONT>            long yInt = Double.doubleToLongBits(y);<a name="line.453"></a>
+<FONT color="green">454</FONT>    <a name="line.454"></a>
+<FONT color="green">455</FONT>            // Make lexicographically ordered as a two's-complement integer.<a name="line.455"></a>
+<FONT color="green">456</FONT>            if (xInt &lt; 0) {<a name="line.456"></a>
+<FONT color="green">457</FONT>                xInt = SGN_MASK - xInt;<a name="line.457"></a>
+<FONT color="green">458</FONT>            }<a name="line.458"></a>
+<FONT color="green">459</FONT>            if (yInt &lt; 0) {<a name="line.459"></a>
+<FONT color="green">460</FONT>                yInt = SGN_MASK - yInt;<a name="line.460"></a>
+<FONT color="green">461</FONT>            }<a name="line.461"></a>
+<FONT color="green">462</FONT>    <a name="line.462"></a>
+<FONT color="green">463</FONT>            return Math.abs(xInt - yInt) &lt;= maxUlps;<a name="line.463"></a>
+<FONT color="green">464</FONT>        }<a name="line.464"></a>
+<FONT color="green">465</FONT>    <a name="line.465"></a>
+<FONT color="green">466</FONT>        /**<a name="line.466"></a>
+<FONT color="green">467</FONT>         * Returns true iff both arguments are null or have same dimensions<a name="line.467"></a>
+<FONT color="green">468</FONT>         * and all their elements are {@link #equals(double,double) equals}<a name="line.468"></a>
+<FONT color="green">469</FONT>         *<a name="line.469"></a>
+<FONT color="green">470</FONT>         * @param x first array<a name="line.470"></a>
+<FONT color="green">471</FONT>         * @param y second array<a name="line.471"></a>
+<FONT color="green">472</FONT>         * @return true if the values are both null or have same dimension<a name="line.472"></a>
+<FONT color="green">473</FONT>         * and equal elements<a name="line.473"></a>
+<FONT color="green">474</FONT>         * @since 1.2<a name="line.474"></a>
+<FONT color="green">475</FONT>         */<a name="line.475"></a>
+<FONT color="green">476</FONT>        public static boolean equals(double[] x, double[] y) {<a name="line.476"></a>
+<FONT color="green">477</FONT>            if ((x == null) || (y == null)) {<a name="line.477"></a>
+<FONT color="green">478</FONT>                return !((x == null) ^ (y == null));<a name="line.478"></a>
+<FONT color="green">479</FONT>            }<a name="line.479"></a>
+<FONT color="green">480</FONT>            if (x.length != y.length) {<a name="line.480"></a>
+<FONT color="green">481</FONT>                return false;<a name="line.481"></a>
+<FONT color="green">482</FONT>            }<a name="line.482"></a>
+<FONT color="green">483</FONT>            for (int i = 0; i &lt; x.length; ++i) {<a name="line.483"></a>
+<FONT color="green">484</FONT>                if (!equals(x[i], y[i])) {<a name="line.484"></a>
+<FONT color="green">485</FONT>                    return false;<a name="line.485"></a>
+<FONT color="green">486</FONT>                }<a name="line.486"></a>
+<FONT color="green">487</FONT>            }<a name="line.487"></a>
+<FONT color="green">488</FONT>            return true;<a name="line.488"></a>
+<FONT color="green">489</FONT>        }<a name="line.489"></a>
+<FONT color="green">490</FONT>    <a name="line.490"></a>
+<FONT color="green">491</FONT>        /**<a name="line.491"></a>
+<FONT color="green">492</FONT>         * Returns n!. Shorthand for &lt;code&gt;n&lt;/code&gt; &lt;a<a name="line.492"></a>
+<FONT color="green">493</FONT>         * href="http://mathworld.wolfram.com/Factorial.html"&gt; Factorial&lt;/a&gt;, the<a name="line.493"></a>
+<FONT color="green">494</FONT>         * product of the numbers &lt;code&gt;1,...,n&lt;/code&gt;.<a name="line.494"></a>
+<FONT color="green">495</FONT>         * &lt;p&gt;<a name="line.495"></a>
+<FONT color="green">496</FONT>         * &lt;Strong&gt;Preconditions&lt;/strong&gt;:<a name="line.496"></a>
+<FONT color="green">497</FONT>         * &lt;ul&gt;<a name="line.497"></a>
+<FONT color="green">498</FONT>         * &lt;li&gt; &lt;code&gt;n &gt;= 0&lt;/code&gt; (otherwise<a name="line.498"></a>
+<FONT color="green">499</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown)&lt;/li&gt;<a name="line.499"></a>
+<FONT color="green">500</FONT>         * &lt;li&gt; The result is small enough to fit into a &lt;code&gt;long&lt;/code&gt;. The<a name="line.500"></a>
+<FONT color="green">501</FONT>         * largest value of &lt;code&gt;n&lt;/code&gt; for which &lt;code&gt;n!&lt;/code&gt; &lt;<a name="line.501"></a>
+<FONT color="green">502</FONT>         * Long.MAX_VALUE&lt;/code&gt; is 20. If the computed value exceeds &lt;code&gt;Long.MAX_VALUE&lt;/code&gt;<a name="line.502"></a>
+<FONT color="green">503</FONT>         * an &lt;code&gt;ArithMeticException &lt;/code&gt; is thrown.&lt;/li&gt;<a name="line.503"></a>
+<FONT color="green">504</FONT>         * &lt;/ul&gt;<a name="line.504"></a>
+<FONT color="green">505</FONT>         * &lt;/p&gt;<a name="line.505"></a>
+<FONT color="green">506</FONT>         *<a name="line.506"></a>
+<FONT color="green">507</FONT>         * @param n argument<a name="line.507"></a>
+<FONT color="green">508</FONT>         * @return &lt;code&gt;n!&lt;/code&gt;<a name="line.508"></a>
+<FONT color="green">509</FONT>         * @throws ArithmeticException if the result is too large to be represented<a name="line.509"></a>
+<FONT color="green">510</FONT>         *         by a long integer.<a name="line.510"></a>
+<FONT color="green">511</FONT>         * @throws IllegalArgumentException if n &lt; 0<a name="line.511"></a>
+<FONT color="green">512</FONT>         */<a name="line.512"></a>
+<FONT color="green">513</FONT>        public static long factorial(final int n) {<a name="line.513"></a>
+<FONT color="green">514</FONT>            if (n &lt; 0) {<a name="line.514"></a>
+<FONT color="green">515</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.515"></a>
+<FONT color="green">516</FONT>                      "must have n &gt;= 0 for n!, got n = {0}",<a name="line.516"></a>
+<FONT color="green">517</FONT>                      n);<a name="line.517"></a>
+<FONT color="green">518</FONT>            }<a name="line.518"></a>
+<FONT color="green">519</FONT>            if (n &gt; 20) {<a name="line.519"></a>
+<FONT color="green">520</FONT>                throw new ArithmeticException(<a name="line.520"></a>
+<FONT color="green">521</FONT>                        "factorial value is too large to fit in a long");<a name="line.521"></a>
+<FONT color="green">522</FONT>            }<a name="line.522"></a>
+<FONT color="green">523</FONT>            return FACTORIALS[n];<a name="line.523"></a>
+<FONT color="green">524</FONT>        }<a name="line.524"></a>
+<FONT color="green">525</FONT>    <a name="line.525"></a>
+<FONT color="green">526</FONT>        /**<a name="line.526"></a>
+<FONT color="green">527</FONT>         * Returns n!. Shorthand for &lt;code&gt;n&lt;/code&gt; &lt;a<a name="line.527"></a>
+<FONT color="green">528</FONT>         * href="http://mathworld.wolfram.com/Factorial.html"&gt; Factorial&lt;/a&gt;, the<a name="line.528"></a>
+<FONT color="green">529</FONT>         * product of the numbers &lt;code&gt;1,...,n&lt;/code&gt; as a &lt;code&gt;double&lt;/code&gt;.<a name="line.529"></a>
+<FONT color="green">530</FONT>         * &lt;p&gt;<a name="line.530"></a>
+<FONT color="green">531</FONT>         * &lt;Strong&gt;Preconditions&lt;/strong&gt;:<a name="line.531"></a>
+<FONT color="green">532</FONT>         * &lt;ul&gt;<a name="line.532"></a>
+<FONT color="green">533</FONT>         * &lt;li&gt; &lt;code&gt;n &gt;= 0&lt;/code&gt; (otherwise<a name="line.533"></a>
+<FONT color="green">534</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown)&lt;/li&gt;<a name="line.534"></a>
+<FONT color="green">535</FONT>         * &lt;li&gt; The result is small enough to fit into a &lt;code&gt;double&lt;/code&gt;. The<a name="line.535"></a>
+<FONT color="green">536</FONT>         * largest value of &lt;code&gt;n&lt;/code&gt; for which &lt;code&gt;n!&lt;/code&gt; &lt;<a name="line.536"></a>
+<FONT color="green">537</FONT>         * Double.MAX_VALUE&lt;/code&gt; is 170. If the computed value exceeds<a name="line.537"></a>
+<FONT color="green">538</FONT>         * Double.MAX_VALUE, Double.POSITIVE_INFINITY is returned&lt;/li&gt;<a name="line.538"></a>
+<FONT color="green">539</FONT>         * &lt;/ul&gt;<a name="line.539"></a>
+<FONT color="green">540</FONT>         * &lt;/p&gt;<a name="line.540"></a>
+<FONT color="green">541</FONT>         *<a name="line.541"></a>
+<FONT color="green">542</FONT>         * @param n argument<a name="line.542"></a>
+<FONT color="green">543</FONT>         * @return &lt;code&gt;n!&lt;/code&gt;<a name="line.543"></a>
+<FONT color="green">544</FONT>         * @throws IllegalArgumentException if n &lt; 0<a name="line.544"></a>
+<FONT color="green">545</FONT>         */<a name="line.545"></a>
+<FONT color="green">546</FONT>        public static double factorialDouble(final int n) {<a name="line.546"></a>
+<FONT color="green">547</FONT>            if (n &lt; 0) {<a name="line.547"></a>
+<FONT color="green">548</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.548"></a>
+<FONT color="green">549</FONT>                      "must have n &gt;= 0 for n!, got n = {0}",<a name="line.549"></a>
+<FONT color="green">550</FONT>                      n);<a name="line.550"></a>
+<FONT color="green">551</FONT>            }<a name="line.551"></a>
+<FONT color="green">552</FONT>            if (n &lt; 21) {<a name="line.552"></a>
+<FONT color="green">553</FONT>                return factorial(n);<a name="line.553"></a>
+<FONT color="green">554</FONT>            }<a name="line.554"></a>
+<FONT color="green">555</FONT>            return Math.floor(Math.exp(factorialLog(n)) + 0.5);<a name="line.555"></a>
+<FONT color="green">556</FONT>        }<a name="line.556"></a>
+<FONT color="green">557</FONT>    <a name="line.557"></a>
+<FONT color="green">558</FONT>        /**<a name="line.558"></a>
+<FONT color="green">559</FONT>         * Returns the natural logarithm of n!.<a name="line.559"></a>
+<FONT color="green">560</FONT>         * &lt;p&gt;<a name="line.560"></a>
+<FONT color="green">561</FONT>         * &lt;Strong&gt;Preconditions&lt;/strong&gt;:<a name="line.561"></a>
+<FONT color="green">562</FONT>         * &lt;ul&gt;<a name="line.562"></a>
+<FONT color="green">563</FONT>         * &lt;li&gt; &lt;code&gt;n &gt;= 0&lt;/code&gt; (otherwise<a name="line.563"></a>
+<FONT color="green">564</FONT>         * &lt;code&gt;IllegalArgumentException&lt;/code&gt; is thrown)&lt;/li&gt;<a name="line.564"></a>
+<FONT color="green">565</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.565"></a>
+<FONT color="green">566</FONT>         *<a name="line.566"></a>
+<FONT color="green">567</FONT>         * @param n argument<a name="line.567"></a>
+<FONT color="green">568</FONT>         * @return &lt;code&gt;n!&lt;/code&gt;<a name="line.568"></a>
+<FONT color="green">569</FONT>         * @throws IllegalArgumentException if preconditions are not met.<a name="line.569"></a>
+<FONT color="green">570</FONT>         */<a name="line.570"></a>
+<FONT color="green">571</FONT>        public static double factorialLog(final int n) {<a name="line.571"></a>
+<FONT color="green">572</FONT>            if (n &lt; 0) {<a name="line.572"></a>
+<FONT color="green">573</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.573"></a>
+<FONT color="green">574</FONT>                      "must have n &gt;= 0 for n!, got n = {0}",<a name="line.574"></a>
+<FONT color="green">575</FONT>                      n);<a name="line.575"></a>
+<FONT color="green">576</FONT>            }<a name="line.576"></a>
+<FONT color="green">577</FONT>            if (n &lt; 21) {<a name="line.577"></a>
+<FONT color="green">578</FONT>                return Math.log(factorial(n));<a name="line.578"></a>
+<FONT color="green">579</FONT>            }<a name="line.579"></a>
+<FONT color="green">580</FONT>            double logSum = 0;<a name="line.580"></a>
+<FONT color="green">581</FONT>            for (int i = 2; i &lt;= n; i++) {<a name="line.581"></a>
+<FONT color="green">582</FONT>                logSum += Math.log(i);<a name="line.582"></a>
+<FONT color="green">583</FONT>            }<a name="line.583"></a>
+<FONT color="green">584</FONT>            return logSum;<a name="line.584"></a>
+<FONT color="green">585</FONT>        }<a name="line.585"></a>
+<FONT color="green">586</FONT>    <a name="line.586"></a>
+<FONT color="green">587</FONT>        /**<a name="line.587"></a>
+<FONT color="green">588</FONT>         * &lt;p&gt;<a name="line.588"></a>
+<FONT color="green">589</FONT>         * Gets the greatest common divisor of the absolute value of two numbers,<a name="line.589"></a>
+<FONT color="green">590</FONT>         * using the "binary gcd" method which avoids division and modulo<a name="line.590"></a>
+<FONT color="green">591</FONT>         * operations. See Knuth 4.5.2 algorithm B. This algorithm is due to Josef<a name="line.591"></a>
+<FONT color="green">592</FONT>         * Stein (1961).<a name="line.592"></a>
+<FONT color="green">593</FONT>         * &lt;/p&gt;<a name="line.593"></a>
+<FONT color="green">594</FONT>         * Special cases:<a name="line.594"></a>
+<FONT color="green">595</FONT>         * &lt;ul&gt;<a name="line.595"></a>
+<FONT color="green">596</FONT>         * &lt;li&gt;The invocations<a name="line.596"></a>
+<FONT color="green">597</FONT>         * &lt;code&gt;gcd(Integer.MIN_VALUE, Integer.MIN_VALUE)&lt;/code&gt;,<a name="line.597"></a>
+<FONT color="green">598</FONT>         * &lt;code&gt;gcd(Integer.MIN_VALUE, 0)&lt;/code&gt; and<a name="line.598"></a>
+<FONT color="green">599</FONT>         * &lt;code&gt;gcd(0, Integer.MIN_VALUE)&lt;/code&gt; throw an<a name="line.599"></a>
+<FONT color="green">600</FONT>         * &lt;code&gt;ArithmeticException&lt;/code&gt;, because the result would be 2^31, which<a name="line.600"></a>
+<FONT color="green">601</FONT>         * is too large for an int value.&lt;/li&gt;<a name="line.601"></a>
+<FONT color="green">602</FONT>         * &lt;li&gt;The result of &lt;code&gt;gcd(x, x)&lt;/code&gt;, &lt;code&gt;gcd(0, x)&lt;/code&gt; and<a name="line.602"></a>
+<FONT color="green">603</FONT>         * &lt;code&gt;gcd(x, 0)&lt;/code&gt; is the absolute value of &lt;code&gt;x&lt;/code&gt;, except<a name="line.603"></a>
+<FONT color="green">604</FONT>         * for the special cases above.<a name="line.604"></a>
+<FONT color="green">605</FONT>         * &lt;li&gt;The invocation &lt;code&gt;gcd(0, 0)&lt;/code&gt; is the only one which returns<a name="line.605"></a>
+<FONT color="green">606</FONT>         * &lt;code&gt;0&lt;/code&gt;.&lt;/li&gt;<a name="line.606"></a>
+<FONT color="green">607</FONT>         * &lt;/ul&gt;<a name="line.607"></a>
+<FONT color="green">608</FONT>         *<a name="line.608"></a>
+<FONT color="green">609</FONT>         * @param p any number<a name="line.609"></a>
+<FONT color="green">610</FONT>         * @param q any number<a name="line.610"></a>
+<FONT color="green">611</FONT>         * @return the greatest common divisor, never negative<a name="line.611"></a>
+<FONT color="green">612</FONT>         * @throws ArithmeticException if the result cannot be represented as a<a name="line.612"></a>
+<FONT color="green">613</FONT>         * nonnegative int value<a name="line.613"></a>
+<FONT color="green">614</FONT>         * @since 1.1<a name="line.614"></a>
+<FONT color="green">615</FONT>         */<a name="line.615"></a>
+<FONT color="green">616</FONT>        public static int gcd(final int p, final int q) {<a name="line.616"></a>
+<FONT color="green">617</FONT>            int u = p;<a name="line.617"></a>
+<FONT color="green">618</FONT>            int v = q;<a name="line.618"></a>
+<FONT color="green">619</FONT>            if ((u == 0) || (v == 0)) {<a name="line.619"></a>
+<FONT color="green">620</FONT>                if ((u == Integer.MIN_VALUE) || (v == Integer.MIN_VALUE)) {<a name="line.620"></a>
+<FONT color="green">621</FONT>                    throw MathRuntimeException.createArithmeticException(<a name="line.621"></a>
+<FONT color="green">622</FONT>                            "overflow: gcd({0}, {1}) is 2^31",<a name="line.622"></a>
+<FONT color="green">623</FONT>                            p, q);<a name="line.623"></a>
+<FONT color="green">624</FONT>                }<a name="line.624"></a>
+<FONT color="green">625</FONT>                return Math.abs(u) + Math.abs(v);<a name="line.625"></a>
+<FONT color="green">626</FONT>            }<a name="line.626"></a>
+<FONT color="green">627</FONT>            // keep u and v negative, as negative integers range down to<a name="line.627"></a>
+<FONT color="green">628</FONT>            // -2^31, while positive numbers can only be as large as 2^31-1<a name="line.628"></a>
+<FONT color="green">629</FONT>            // (i.e. we can't necessarily negate a negative number without<a name="line.629"></a>
+<FONT color="green">630</FONT>            // overflow)<a name="line.630"></a>
+<FONT color="green">631</FONT>            /* assert u!=0 &amp;&amp; v!=0; */<a name="line.631"></a>
+<FONT color="green">632</FONT>            if (u &gt; 0) {<a name="line.632"></a>
+<FONT color="green">633</FONT>                u = -u;<a name="line.633"></a>
+<FONT color="green">634</FONT>            } // make u negative<a name="line.634"></a>
+<FONT color="green">635</FONT>            if (v &gt; 0) {<a name="line.635"></a>
+<FONT color="green">636</FONT>                v = -v;<a name="line.636"></a>
+<FONT color="green">637</FONT>            } // make v negative<a name="line.637"></a>
+<FONT color="green">638</FONT>            // B1. [Find power of 2]<a name="line.638"></a>
+<FONT color="green">639</FONT>            int k = 0;<a name="line.639"></a>
+<FONT color="green">640</FONT>            while ((u &amp; 1) == 0 &amp;&amp; (v &amp; 1) == 0 &amp;&amp; k &lt; 31) { // while u and v are<a name="line.640"></a>
+<FONT color="green">641</FONT>                                                                // both even...<a name="line.641"></a>
+<FONT color="green">642</FONT>                u /= 2;<a name="line.642"></a>
+<FONT color="green">643</FONT>                v /= 2;<a name="line.643"></a>
+<FONT color="green">644</FONT>                k++; // cast out twos.<a name="line.644"></a>
+<FONT color="green">645</FONT>            }<a name="line.645"></a>
+<FONT color="green">646</FONT>            if (k == 31) {<a name="line.646"></a>
+<FONT color="green">647</FONT>                throw MathRuntimeException.createArithmeticException(<a name="line.647"></a>
+<FONT color="green">648</FONT>                        "overflow: gcd({0}, {1}) is 2^31",<a name="line.648"></a>
+<FONT color="green">649</FONT>                        p, q);<a name="line.649"></a>
+<FONT color="green">650</FONT>            }<a name="line.650"></a>
+<FONT color="green">651</FONT>            // B2. Initialize: u and v have been divided by 2^k and at least<a name="line.651"></a>
+<FONT color="green">652</FONT>            // one is odd.<a name="line.652"></a>
+<FONT color="green">653</FONT>            int t = ((u &amp; 1) == 1) ? v : -(u / 2)/* B3 */;<a name="line.653"></a>
+<FONT color="green">654</FONT>            // t negative: u was odd, v may be even (t replaces v)<a name="line.654"></a>
+<FONT color="green">655</FONT>            // t positive: u was even, v is odd (t replaces u)<a name="line.655"></a>
+<FONT color="green">656</FONT>            do {<a name="line.656"></a>
+<FONT color="green">657</FONT>                /* assert u&lt;0 &amp;&amp; v&lt;0; */<a name="line.657"></a>
+<FONT color="green">658</FONT>                // B4/B3: cast out twos from t.<a name="line.658"></a>
+<FONT color="green">659</FONT>                while ((t &amp; 1) == 0) { // while t is even..<a name="line.659"></a>
+<FONT color="green">660</FONT>                    t /= 2; // cast out twos<a name="line.660"></a>
+<FONT color="green">661</FONT>                }<a name="line.661"></a>
+<FONT color="green">662</FONT>                // B5 [reset max(u,v)]<a name="line.662"></a>
+<FONT color="green">663</FONT>                if (t &gt; 0) {<a name="line.663"></a>
+<FONT color="green">664</FONT>                    u = -t;<a name="line.664"></a>
+<FONT color="green">665</FONT>                } else {<a name="line.665"></a>
+<FONT color="green">666</FONT>                    v = t;<a name="line.666"></a>
+<FONT color="green">667</FONT>                }<a name="line.667"></a>
+<FONT color="green">668</FONT>                // B6/B3. at this point both u and v should be odd.<a name="line.668"></a>
+<FONT color="green">669</FONT>                t = (v - u) / 2;<a name="line.669"></a>
+<FONT color="green">670</FONT>                // |u| larger: t positive (replace u)<a name="line.670"></a>
+<FONT color="green">671</FONT>                // |v| larger: t negative (replace v)<a name="line.671"></a>
+<FONT color="green">672</FONT>            } while (t != 0);<a name="line.672"></a>
+<FONT color="green">673</FONT>            return -u * (1 &lt;&lt; k); // gcd is u*2^k<a name="line.673"></a>
+<FONT color="green">674</FONT>        }<a name="line.674"></a>
+<FONT color="green">675</FONT>    <a name="line.675"></a>
+<FONT color="green">676</FONT>        /**<a name="line.676"></a>
+<FONT color="green">677</FONT>         * &lt;p&gt;<a name="line.677"></a>
+<FONT color="green">678</FONT>         * Gets the greatest common divisor of the absolute value of two numbers,<a name="line.678"></a>
+<FONT color="green">679</FONT>         * using the "binary gcd" method which avoids division and modulo<a name="line.679"></a>
+<FONT color="green">680</FONT>         * operations. See Knuth 4.5.2 algorithm B. This algorithm is due to Josef<a name="line.680"></a>
+<FONT color="green">681</FONT>         * Stein (1961).<a name="line.681"></a>
+<FONT color="green">682</FONT>         * &lt;/p&gt;<a name="line.682"></a>
+<FONT color="green">683</FONT>         * Special cases:<a name="line.683"></a>
+<FONT color="green">684</FONT>         * &lt;ul&gt;<a name="line.684"></a>
+<FONT color="green">685</FONT>         * &lt;li&gt;The invocations<a name="line.685"></a>
+<FONT color="green">686</FONT>         * &lt;code&gt;gcd(Long.MIN_VALUE, Long.MIN_VALUE)&lt;/code&gt;,<a name="line.686"></a>
+<FONT color="green">687</FONT>         * &lt;code&gt;gcd(Long.MIN_VALUE, 0L)&lt;/code&gt; and<a name="line.687"></a>
+<FONT color="green">688</FONT>         * &lt;code&gt;gcd(0L, Long.MIN_VALUE)&lt;/code&gt; throw an<a name="line.688"></a>
+<FONT color="green">689</FONT>         * &lt;code&gt;ArithmeticException&lt;/code&gt;, because the result would be 2^63, which<a name="line.689"></a>
+<FONT color="green">690</FONT>         * is too large for a long value.&lt;/li&gt;<a name="line.690"></a>
+<FONT color="green">691</FONT>         * &lt;li&gt;The result of &lt;code&gt;gcd(x, x)&lt;/code&gt;, &lt;code&gt;gcd(0L, x)&lt;/code&gt; and<a name="line.691"></a>
+<FONT color="green">692</FONT>         * &lt;code&gt;gcd(x, 0L)&lt;/code&gt; is the absolute value of &lt;code&gt;x&lt;/code&gt;, except<a name="line.692"></a>
+<FONT color="green">693</FONT>         * for the special cases above.<a name="line.693"></a>
+<FONT color="green">694</FONT>         * &lt;li&gt;The invocation &lt;code&gt;gcd(0L, 0L)&lt;/code&gt; is the only one which returns<a name="line.694"></a>
+<FONT color="green">695</FONT>         * &lt;code&gt;0L&lt;/code&gt;.&lt;/li&gt;<a name="line.695"></a>
+<FONT color="green">696</FONT>         * &lt;/ul&gt;<a name="line.696"></a>
+<FONT color="green">697</FONT>         *<a name="line.697"></a>
+<FONT color="green">698</FONT>         * @param p any number<a name="line.698"></a>
+<FONT color="green">699</FONT>         * @param q any number<a name="line.699"></a>
+<FONT color="green">700</FONT>         * @return the greatest common divisor, never negative<a name="line.700"></a>
+<FONT color="green">701</FONT>         * @throws ArithmeticException if the result cannot be represented as a nonnegative long<a name="line.701"></a>
+<FONT color="green">702</FONT>         * value<a name="line.702"></a>
+<FONT color="green">703</FONT>         * @since 2.1<a name="line.703"></a>
+<FONT color="green">704</FONT>         */<a name="line.704"></a>
+<FONT color="green">705</FONT>        public static long gcd(final long p, final long q) {<a name="line.705"></a>
+<FONT color="green">706</FONT>            long u = p;<a name="line.706"></a>
+<FONT color="green">707</FONT>            long v = q;<a name="line.707"></a>
+<FONT color="green">708</FONT>            if ((u == 0) || (v == 0)) {<a name="line.708"></a>
+<FONT color="green">709</FONT>                if ((u == Long.MIN_VALUE) || (v == Long.MIN_VALUE)){<a name="line.709"></a>
+<FONT color="green">710</FONT>                    throw MathRuntimeException.createArithmeticException(<a name="line.710"></a>
+<FONT color="green">711</FONT>                            "overflow: gcd({0}, {1}) is 2^63",<a name="line.711"></a>
+<FONT color="green">712</FONT>                            p, q);<a name="line.712"></a>
+<FONT color="green">713</FONT>                }<a name="line.713"></a>
+<FONT color="green">714</FONT>                return Math.abs(u) + Math.abs(v);<a name="line.714"></a>
+<FONT color="green">715</FONT>            }<a name="line.715"></a>
+<FONT color="green">716</FONT>            // keep u and v negative, as negative integers range down to<a name="line.716"></a>
+<FONT color="green">717</FONT>            // -2^63, while positive numbers can only be as large as 2^63-1<a name="line.717"></a>
+<FONT color="green">718</FONT>            // (i.e. we can't necessarily negate a negative number without<a name="line.718"></a>
+<FONT color="green">719</FONT>            // overflow)<a name="line.719"></a>
+<FONT color="green">720</FONT>            /* assert u!=0 &amp;&amp; v!=0; */<a name="line.720"></a>
+<FONT color="green">721</FONT>            if (u &gt; 0) {<a name="line.721"></a>
+<FONT color="green">722</FONT>                u = -u;<a name="line.722"></a>
+<FONT color="green">723</FONT>            } // make u negative<a name="line.723"></a>
+<FONT color="green">724</FONT>            if (v &gt; 0) {<a name="line.724"></a>
+<FONT color="green">725</FONT>                v = -v;<a name="line.725"></a>
+<FONT color="green">726</FONT>            } // make v negative<a name="line.726"></a>
+<FONT color="green">727</FONT>            // B1. [Find power of 2]<a name="line.727"></a>
+<FONT color="green">728</FONT>            int k = 0;<a name="line.728"></a>
+<FONT color="green">729</FONT>            while ((u &amp; 1) == 0 &amp;&amp; (v &amp; 1) == 0 &amp;&amp; k &lt; 63) { // while u and v are<a name="line.729"></a>
+<FONT color="green">730</FONT>                                                                // both even...<a name="line.730"></a>
+<FONT color="green">731</FONT>                u /= 2;<a name="line.731"></a>
+<FONT color="green">732</FONT>                v /= 2;<a name="line.732"></a>
+<FONT color="green">733</FONT>                k++; // cast out twos.<a name="line.733"></a>
+<FONT color="green">734</FONT>            }<a name="line.734"></a>
+<FONT color="green">735</FONT>            if (k == 63) {<a name="line.735"></a>
+<FONT color="green">736</FONT>                throw MathRuntimeException.createArithmeticException(<a name="line.736"></a>
+<FONT color="green">737</FONT>                        "overflow: gcd({0}, {1}) is 2^63",<a name="line.737"></a>
+<FONT color="green">738</FONT>                        p, q);<a name="line.738"></a>
+<FONT color="green">739</FONT>            }<a name="line.739"></a>
+<FONT color="green">740</FONT>            // B2. Initialize: u and v have been divided by 2^k and at least<a name="line.740"></a>
+<FONT color="green">741</FONT>            // one is odd.<a name="line.741"></a>
+<FONT color="green">742</FONT>            long t = ((u &amp; 1) == 1) ? v : -(u / 2)/* B3 */;<a name="line.742"></a>
+<FONT color="green">743</FONT>            // t negative: u was odd, v may be even (t replaces v)<a name="line.743"></a>
+<FONT color="green">744</FONT>            // t positive: u was even, v is odd (t replaces u)<a name="line.744"></a>
+<FONT color="green">745</FONT>            do {<a name="line.745"></a>
+<FONT color="green">746</FONT>                /* assert u&lt;0 &amp;&amp; v&lt;0; */<a name="line.746"></a>
+<FONT color="green">747</FONT>                // B4/B3: cast out twos from t.<a name="line.747"></a>
+<FONT color="green">748</FONT>                while ((t &amp; 1) == 0) { // while t is even..<a name="line.748"></a>
+<FONT color="green">749</FONT>                    t /= 2; // cast out twos<a name="line.749"></a>
+<FONT color="green">750</FONT>                }<a name="line.750"></a>
+<FONT color="green">751</FONT>                // B5 [reset max(u,v)]<a name="line.751"></a>
+<FONT color="green">752</FONT>                if (t &gt; 0) {<a name="line.752"></a>
+<FONT color="green">753</FONT>                    u = -t;<a name="line.753"></a>
+<FONT color="green">754</FONT>                } else {<a name="line.754"></a>
+<FONT color="green">755</FONT>                    v = t;<a name="line.755"></a>
+<FONT color="green">756</FONT>                }<a name="line.756"></a>
+<FONT color="green">757</FONT>                // B6/B3. at this point both u and v should be odd.<a name="line.757"></a>
+<FONT color="green">758</FONT>                t = (v - u) / 2;<a name="line.758"></a>
+<FONT color="green">759</FONT>                // |u| larger: t positive (replace u)<a name="line.759"></a>
+<FONT color="green">760</FONT>                // |v| larger: t negative (replace v)<a name="line.760"></a>
+<FONT color="green">761</FONT>            } while (t != 0);<a name="line.761"></a>
+<FONT color="green">762</FONT>            return -u * (1L &lt;&lt; k); // gcd is u*2^k<a name="line.762"></a>
+<FONT color="green">763</FONT>        }<a name="line.763"></a>
+<FONT color="green">764</FONT>    <a name="line.764"></a>
+<FONT color="green">765</FONT>        /**<a name="line.765"></a>
+<FONT color="green">766</FONT>         * Returns an integer hash code representing the given double value.<a name="line.766"></a>
+<FONT color="green">767</FONT>         *<a name="line.767"></a>
+<FONT color="green">768</FONT>         * @param value the value to be hashed<a name="line.768"></a>
+<FONT color="green">769</FONT>         * @return the hash code<a name="line.769"></a>
+<FONT color="green">770</FONT>         */<a name="line.770"></a>
+<FONT color="green">771</FONT>        public static int hash(double value) {<a name="line.771"></a>
+<FONT color="green">772</FONT>            return new Double(value).hashCode();<a name="line.772"></a>
+<FONT color="green">773</FONT>        }<a name="line.773"></a>
+<FONT color="green">774</FONT>    <a name="line.774"></a>
+<FONT color="green">775</FONT>        /**<a name="line.775"></a>
+<FONT color="green">776</FONT>         * Returns an integer hash code representing the given double array.<a name="line.776"></a>
+<FONT color="green">777</FONT>         *<a name="line.777"></a>
+<FONT color="green">778</FONT>         * @param value the value to be hashed (may be null)<a name="line.778"></a>
+<FONT color="green">779</FONT>         * @return the hash code<a name="line.779"></a>
+<FONT color="green">780</FONT>         * @since 1.2<a name="line.780"></a>
+<FONT color="green">781</FONT>         */<a name="line.781"></a>
+<FONT color="green">782</FONT>        public static int hash(double[] value) {<a name="line.782"></a>
+<FONT color="green">783</FONT>            return Arrays.hashCode(value);<a name="line.783"></a>
+<FONT color="green">784</FONT>        }<a name="line.784"></a>
+<FONT color="green">785</FONT>    <a name="line.785"></a>
+<FONT color="green">786</FONT>        /**<a name="line.786"></a>
+<FONT color="green">787</FONT>         * For a byte value x, this method returns (byte)(+1) if x &gt;= 0 and<a name="line.787"></a>
+<FONT color="green">788</FONT>         * (byte)(-1) if x &lt; 0.<a name="line.788"></a>
+<FONT color="green">789</FONT>         *<a name="line.789"></a>
+<FONT color="green">790</FONT>         * @param x the value, a byte<a name="line.790"></a>
+<FONT color="green">791</FONT>         * @return (byte)(+1) or (byte)(-1), depending on the sign of x<a name="line.791"></a>
+<FONT color="green">792</FONT>         */<a name="line.792"></a>
+<FONT color="green">793</FONT>        public static byte indicator(final byte x) {<a name="line.793"></a>
+<FONT color="green">794</FONT>            return (x &gt;= ZB) ? PB : NB;<a name="line.794"></a>
+<FONT color="green">795</FONT>        }<a name="line.795"></a>
+<FONT color="green">796</FONT>    <a name="line.796"></a>
+<FONT color="green">797</FONT>        /**<a name="line.797"></a>
+<FONT color="green">798</FONT>         * For a double precision value x, this method returns +1.0 if x &gt;= 0 and<a name="line.798"></a>
+<FONT color="green">799</FONT>         * -1.0 if x &lt; 0. Returns &lt;code&gt;NaN&lt;/code&gt; if &lt;code&gt;x&lt;/code&gt; is<a name="line.799"></a>
+<FONT color="green">800</FONT>         * &lt;code&gt;NaN&lt;/code&gt;.<a name="line.800"></a>
+<FONT color="green">801</FONT>         *<a name="line.801"></a>
+<FONT color="green">802</FONT>         * @param x the value, a double<a name="line.802"></a>
+<FONT color="green">803</FONT>         * @return +1.0 or -1.0, depending on the sign of x<a name="line.803"></a>
+<FONT color="green">804</FONT>         */<a name="line.804"></a>
+<FONT color="green">805</FONT>        public static double indicator(final double x) {<a name="line.805"></a>
+<FONT color="green">806</FONT>            if (Double.isNaN(x)) {<a name="line.806"></a>
+<FONT color="green">807</FONT>                return Double.NaN;<a name="line.807"></a>
+<FONT color="green">808</FONT>            }<a name="line.808"></a>
+<FONT color="green">809</FONT>            return (x &gt;= 0.0) ? 1.0 : -1.0;<a name="line.809"></a>
+<FONT color="green">810</FONT>        }<a name="line.810"></a>
+<FONT color="green">811</FONT>    <a name="line.811"></a>
+<FONT color="green">812</FONT>        /**<a name="line.812"></a>
+<FONT color="green">813</FONT>         * For a float value x, this method returns +1.0F if x &gt;= 0 and -1.0F if x &lt;<a name="line.813"></a>
+<FONT color="green">814</FONT>         * 0. Returns &lt;code&gt;NaN&lt;/code&gt; if &lt;code&gt;x&lt;/code&gt; is &lt;code&gt;NaN&lt;/code&gt;.<a name="line.814"></a>
+<FONT color="green">815</FONT>         *<a name="line.815"></a>
+<FONT color="green">816</FONT>         * @param x the value, a float<a name="line.816"></a>
+<FONT color="green">817</FONT>         * @return +1.0F or -1.0F, depending on the sign of x<a name="line.817"></a>
+<FONT color="green">818</FONT>         */<a name="line.818"></a>
+<FONT color="green">819</FONT>        public static float indicator(final float x) {<a name="line.819"></a>
+<FONT color="green">820</FONT>            if (Float.isNaN(x)) {<a name="line.820"></a>
+<FONT color="green">821</FONT>                return Float.NaN;<a name="line.821"></a>
+<FONT color="green">822</FONT>            }<a name="line.822"></a>
+<FONT color="green">823</FONT>            return (x &gt;= 0.0F) ? 1.0F : -1.0F;<a name="line.823"></a>
+<FONT color="green">824</FONT>        }<a name="line.824"></a>
+<FONT color="green">825</FONT>    <a name="line.825"></a>
+<FONT color="green">826</FONT>        /**<a name="line.826"></a>
+<FONT color="green">827</FONT>         * For an int value x, this method returns +1 if x &gt;= 0 and -1 if x &lt; 0.<a name="line.827"></a>
+<FONT color="green">828</FONT>         *<a name="line.828"></a>
+<FONT color="green">829</FONT>         * @param x the value, an int<a name="line.829"></a>
+<FONT color="green">830</FONT>         * @return +1 or -1, depending on the sign of x<a name="line.830"></a>
+<FONT color="green">831</FONT>         */<a name="line.831"></a>
+<FONT color="green">832</FONT>        public static int indicator(final int x) {<a name="line.832"></a>
+<FONT color="green">833</FONT>            return (x &gt;= 0) ? 1 : -1;<a name="line.833"></a>
+<FONT color="green">834</FONT>        }<a name="line.834"></a>
+<FONT color="green">835</FONT>    <a name="line.835"></a>
+<FONT color="green">836</FONT>        /**<a name="line.836"></a>
+<FONT color="green">837</FONT>         * For a long value x, this method returns +1L if x &gt;= 0 and -1L if x &lt; 0.<a name="line.837"></a>
+<FONT color="green">838</FONT>         *<a name="line.838"></a>
+<FONT color="green">839</FONT>         * @param x the value, a long<a name="line.839"></a>
+<FONT color="green">840</FONT>         * @return +1L or -1L, depending on the sign of x<a name="line.840"></a>
+<FONT color="green">841</FONT>         */<a name="line.841"></a>
+<FONT color="green">842</FONT>        public static long indicator(final long x) {<a name="line.842"></a>
+<FONT color="green">843</FONT>            return (x &gt;= 0L) ? 1L : -1L;<a name="line.843"></a>
+<FONT color="green">844</FONT>        }<a name="line.844"></a>
+<FONT color="green">845</FONT>    <a name="line.845"></a>
+<FONT color="green">846</FONT>        /**<a name="line.846"></a>
+<FONT color="green">847</FONT>         * For a short value x, this method returns (short)(+1) if x &gt;= 0 and<a name="line.847"></a>
+<FONT color="green">848</FONT>         * (short)(-1) if x &lt; 0.<a name="line.848"></a>
+<FONT color="green">849</FONT>         *<a name="line.849"></a>
+<FONT color="green">850</FONT>         * @param x the value, a short<a name="line.850"></a>
+<FONT color="green">851</FONT>         * @return (short)(+1) or (short)(-1), depending on the sign of x<a name="line.851"></a>
+<FONT color="green">852</FONT>         */<a name="line.852"></a>
+<FONT color="green">853</FONT>        public static short indicator(final short x) {<a name="line.853"></a>
+<FONT color="green">854</FONT>            return (x &gt;= ZS) ? PS : NS;<a name="line.854"></a>
+<FONT color="green">855</FONT>        }<a name="line.855"></a>
+<FONT color="green">856</FONT>    <a name="line.856"></a>
+<FONT color="green">857</FONT>        /**<a name="line.857"></a>
+<FONT color="green">858</FONT>         * &lt;p&gt;<a name="line.858"></a>
+<FONT color="green">859</FONT>         * Returns the least common multiple of the absolute value of two numbers,<a name="line.859"></a>
+<FONT color="green">860</FONT>         * using the formula &lt;code&gt;lcm(a,b) = (a / gcd(a,b)) * b&lt;/code&gt;.<a name="line.860"></a>
+<FONT color="green">861</FONT>         * &lt;/p&gt;<a name="line.861"></a>
+<FONT color="green">862</FONT>         * Special cases:<a name="line.862"></a>
+<FONT color="green">863</FONT>         * &lt;ul&gt;<a name="line.863"></a>
+<FONT color="green">864</FONT>         * &lt;li&gt;The invocations &lt;code&gt;lcm(Integer.MIN_VALUE, n)&lt;/code&gt; and<a name="line.864"></a>
+<FONT color="green">865</FONT>         * &lt;code&gt;lcm(n, Integer.MIN_VALUE)&lt;/code&gt;, where &lt;code&gt;abs(n)&lt;/code&gt; is a<a name="line.865"></a>
+<FONT color="green">866</FONT>         * power of 2, throw an &lt;code&gt;ArithmeticException&lt;/code&gt;, because the result<a name="line.866"></a>
+<FONT color="green">867</FONT>         * would be 2^31, which is too large for an int value.&lt;/li&gt;<a name="line.867"></a>
+<FONT color="green">868</FONT>         * &lt;li&gt;The result of &lt;code&gt;lcm(0, x)&lt;/code&gt; and &lt;code&gt;lcm(x, 0)&lt;/code&gt; is<a name="line.868"></a>
+<FONT color="green">869</FONT>         * &lt;code&gt;0&lt;/code&gt; for any &lt;code&gt;x&lt;/code&gt;.<a name="line.869"></a>
+<FONT color="green">870</FONT>         * &lt;/ul&gt;<a name="line.870"></a>
+<FONT color="green">871</FONT>         *<a name="line.871"></a>
+<FONT color="green">872</FONT>         * @param a any number<a name="line.872"></a>
+<FONT color="green">873</FONT>         * @param b any number<a name="line.873"></a>
+<FONT color="green">874</FONT>         * @return the least common multiple, never negative<a name="line.874"></a>
+<FONT color="green">875</FONT>         * @throws ArithmeticException<a name="line.875"></a>
+<FONT color="green">876</FONT>         *             if the result cannot be represented as a nonnegative int<a name="line.876"></a>
+<FONT color="green">877</FONT>         *             value<a name="line.877"></a>
+<FONT color="green">878</FONT>         * @since 1.1<a name="line.878"></a>
+<FONT color="green">879</FONT>         */<a name="line.879"></a>
+<FONT color="green">880</FONT>        public static int lcm(int a, int b) {<a name="line.880"></a>
+<FONT color="green">881</FONT>            if (a==0 || b==0){<a name="line.881"></a>
+<FONT color="green">882</FONT>                return 0;<a name="line.882"></a>
+<FONT color="green">883</FONT>            }<a name="line.883"></a>
+<FONT color="green">884</FONT>            int lcm = Math.abs(mulAndCheck(a / gcd(a, b), b));<a name="line.884"></a>
+<FONT color="green">885</FONT>            if (lcm == Integer.MIN_VALUE) {<a name="line.885"></a>
+<FONT color="green">886</FONT>                throw MathRuntimeException.createArithmeticException(<a name="line.886"></a>
+<FONT color="green">887</FONT>                    "overflow: lcm({0}, {1}) is 2^31",<a name="line.887"></a>
+<FONT color="green">888</FONT>                    a, b);<a name="line.888"></a>
+<FONT color="green">889</FONT>            }<a name="line.889"></a>
+<FONT color="green">890</FONT>            return lcm;<a name="line.890"></a>
+<FONT color="green">891</FONT>        }<a name="line.891"></a>
+<FONT color="green">892</FONT>    <a name="line.892"></a>
+<FONT color="green">893</FONT>        /**<a name="line.893"></a>
+<FONT color="green">894</FONT>         * &lt;p&gt;<a name="line.894"></a>
+<FONT color="green">895</FONT>         * Returns the least common multiple of the absolute value of two numbers,<a name="line.895"></a>
+<FONT color="green">896</FONT>         * using the formula &lt;code&gt;lcm(a,b) = (a / gcd(a,b)) * b&lt;/code&gt;.<a name="line.896"></a>
+<FONT color="green">897</FONT>         * &lt;/p&gt;<a name="line.897"></a>
+<FONT color="green">898</FONT>         * Special cases:<a name="line.898"></a>
+<FONT color="green">899</FONT>         * &lt;ul&gt;<a name="line.899"></a>
+<FONT color="green">900</FONT>         * &lt;li&gt;The invocations &lt;code&gt;lcm(Long.MIN_VALUE, n)&lt;/code&gt; and<a name="line.900"></a>
+<FONT color="green">901</FONT>         * &lt;code&gt;lcm(n, Long.MIN_VALUE)&lt;/code&gt;, where &lt;code&gt;abs(n)&lt;/code&gt; is a<a name="line.901"></a>
+<FONT color="green">902</FONT>         * power of 2, throw an &lt;code&gt;ArithmeticException&lt;/code&gt;, because the result<a name="line.902"></a>
+<FONT color="green">903</FONT>         * would be 2^63, which is too large for an int value.&lt;/li&gt;<a name="line.903"></a>
+<FONT color="green">904</FONT>         * &lt;li&gt;The result of &lt;code&gt;lcm(0L, x)&lt;/code&gt; and &lt;code&gt;lcm(x, 0L)&lt;/code&gt; is<a name="line.904"></a>
+<FONT color="green">905</FONT>         * &lt;code&gt;0L&lt;/code&gt; for any &lt;code&gt;x&lt;/code&gt;.<a name="line.905"></a>
+<FONT color="green">906</FONT>         * &lt;/ul&gt;<a name="line.906"></a>
+<FONT color="green">907</FONT>         *<a name="line.907"></a>
+<FONT color="green">908</FONT>         * @param a any number<a name="line.908"></a>
+<FONT color="green">909</FONT>         * @param b any number<a name="line.909"></a>
+<FONT color="green">910</FONT>         * @return the least common multiple, never negative<a name="line.910"></a>
+<FONT color="green">911</FONT>         * @throws ArithmeticException if the result cannot be represented as a nonnegative long<a name="line.911"></a>
+<FONT color="green">912</FONT>         * value<a name="line.912"></a>
+<FONT color="green">913</FONT>         * @since 2.1<a name="line.913"></a>
+<FONT color="green">914</FONT>         */<a name="line.914"></a>
+<FONT color="green">915</FONT>        public static long lcm(long a, long b) {<a name="line.915"></a>
+<FONT color="green">916</FONT>            if (a==0 || b==0){<a name="line.916"></a>
+<FONT color="green">917</FONT>                return 0;<a name="line.917"></a>
+<FONT color="green">918</FONT>            }<a name="line.918"></a>
+<FONT color="green">919</FONT>            long lcm = Math.abs(mulAndCheck(a / gcd(a, b), b));<a name="line.919"></a>
+<FONT color="green">920</FONT>            if (lcm == Long.MIN_VALUE){<a name="line.920"></a>
+<FONT color="green">921</FONT>                throw MathRuntimeException.createArithmeticException(<a name="line.921"></a>
+<FONT color="green">922</FONT>                    "overflow: lcm({0}, {1}) is 2^63",<a name="line.922"></a>
+<FONT color="green">923</FONT>                    a, b);<a name="line.923"></a>
+<FONT color="green">924</FONT>            }<a name="line.924"></a>
+<FONT color="green">925</FONT>            return lcm;<a name="line.925"></a>
+<FONT color="green">926</FONT>        }<a name="line.926"></a>
+<FONT color="green">927</FONT>    <a name="line.927"></a>
+<FONT color="green">928</FONT>        /**<a name="line.928"></a>
+<FONT color="green">929</FONT>         * &lt;p&gt;Returns the<a name="line.929"></a>
+<FONT color="green">930</FONT>         * &lt;a href="http://mathworld.wolfram.com/Logarithm.html"&gt;logarithm&lt;/a&gt;<a name="line.930"></a>
+<FONT color="green">931</FONT>         * for base &lt;code&gt;b&lt;/code&gt; of &lt;code&gt;x&lt;/code&gt;.<a name="line.931"></a>
+<FONT color="green">932</FONT>         * &lt;/p&gt;<a name="line.932"></a>
+<FONT color="green">933</FONT>         * &lt;p&gt;Returns &lt;code&gt;NaN&lt;code&gt; if either argument is negative.  If<a name="line.933"></a>
+<FONT color="green">934</FONT>         * &lt;code&gt;base&lt;/code&gt; is 0 and &lt;code&gt;x&lt;/code&gt; is positive, 0 is returned.<a name="line.934"></a>
+<FONT color="green">935</FONT>         * If &lt;code&gt;base&lt;/code&gt; is positive and &lt;code&gt;x&lt;/code&gt; is 0,<a name="line.935"></a>
+<FONT color="green">936</FONT>         * &lt;code&gt;Double.NEGATIVE_INFINITY&lt;/code&gt; is returned.  If both arguments<a name="line.936"></a>
+<FONT color="green">937</FONT>         * are 0, the result is &lt;code&gt;NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.937"></a>
+<FONT color="green">938</FONT>         *<a name="line.938"></a>
+<FONT color="green">939</FONT>         * @param base the base of the logarithm, must be greater than 0<a name="line.939"></a>
+<FONT color="green">940</FONT>         * @param x argument, must be greater than 0<a name="line.940"></a>
+<FONT color="green">941</FONT>         * @return the value of the logarithm - the number y such that base^y = x.<a name="line.941"></a>
+<FONT color="green">942</FONT>         * @since 1.2<a name="line.942"></a>
+<FONT color="green">943</FONT>         */<a name="line.943"></a>
+<FONT color="green">944</FONT>        public static double log(double base, double x) {<a name="line.944"></a>
+<FONT color="green">945</FONT>            return Math.log(x)/Math.log(base);<a name="line.945"></a>
+<FONT color="green">946</FONT>        }<a name="line.946"></a>
+<FONT color="green">947</FONT>    <a name="line.947"></a>
+<FONT color="green">948</FONT>        /**<a name="line.948"></a>
+<FONT color="green">949</FONT>         * Multiply two integers, checking for overflow.<a name="line.949"></a>
+<FONT color="green">950</FONT>         *<a name="line.950"></a>
+<FONT color="green">951</FONT>         * @param x a factor<a name="line.951"></a>
+<FONT color="green">952</FONT>         * @param y a factor<a name="line.952"></a>
+<FONT color="green">953</FONT>         * @return the product &lt;code&gt;x*y&lt;/code&gt;<a name="line.953"></a>
+<FONT color="green">954</FONT>         * @throws ArithmeticException if the result can not be represented as an<a name="line.954"></a>
+<FONT color="green">955</FONT>         *         int<a name="line.955"></a>
+<FONT color="green">956</FONT>         * @since 1.1<a name="line.956"></a>
+<FONT color="green">957</FONT>         */<a name="line.957"></a>
+<FONT color="green">958</FONT>        public static int mulAndCheck(int x, int y) {<a name="line.958"></a>
+<FONT color="green">959</FONT>            long m = ((long)x) * ((long)y);<a name="line.959"></a>
+<FONT color="green">960</FONT>            if (m &lt; Integer.MIN_VALUE || m &gt; Integer.MAX_VALUE) {<a name="line.960"></a>
+<FONT color="green">961</FONT>                throw new ArithmeticException("overflow: mul");<a name="line.961"></a>
+<FONT color="green">962</FONT>            }<a name="line.962"></a>
+<FONT color="green">963</FONT>            return (int)m;<a name="line.963"></a>
+<FONT color="green">964</FONT>        }<a name="line.964"></a>
+<FONT color="green">965</FONT>    <a name="line.965"></a>
+<FONT color="green">966</FONT>        /**<a name="line.966"></a>
+<FONT color="green">967</FONT>         * Multiply two long integers, checking for overflow.<a name="line.967"></a>
+<FONT color="green">968</FONT>         *<a name="line.968"></a>
+<FONT color="green">969</FONT>         * @param a first value<a name="line.969"></a>
+<FONT color="green">970</FONT>         * @param b second value<a name="line.970"></a>
+<FONT color="green">971</FONT>         * @return the product &lt;code&gt;a * b&lt;/code&gt;<a name="line.971"></a>
+<FONT color="green">972</FONT>         * @throws ArithmeticException if the result can not be represented as an<a name="line.972"></a>
+<FONT color="green">973</FONT>         *         long<a name="line.973"></a>
+<FONT color="green">974</FONT>         * @since 1.2<a name="line.974"></a>
+<FONT color="green">975</FONT>         */<a name="line.975"></a>
+<FONT color="green">976</FONT>        public static long mulAndCheck(long a, long b) {<a name="line.976"></a>
+<FONT color="green">977</FONT>            long ret;<a name="line.977"></a>
+<FONT color="green">978</FONT>            String msg = "overflow: multiply";<a name="line.978"></a>
+<FONT color="green">979</FONT>            if (a &gt; b) {<a name="line.979"></a>
+<FONT color="green">980</FONT>                // use symmetry to reduce boundary cases<a name="line.980"></a>
+<FONT color="green">981</FONT>                ret = mulAndCheck(b, a);<a name="line.981"></a>
+<FONT color="green">982</FONT>            } else {<a name="line.982"></a>
+<FONT color="green">983</FONT>                if (a &lt; 0) {<a name="line.983"></a>
+<FONT color="green">984</FONT>                    if (b &lt; 0) {<a name="line.984"></a>
+<FONT color="green">985</FONT>                        // check for positive overflow with negative a, negative b<a name="line.985"></a>
+<FONT color="green">986</FONT>                        if (a &gt;= Long.MAX_VALUE / b) {<a name="line.986"></a>
+<FONT color="green">987</FONT>                            ret = a * b;<a name="line.987"></a>
+<FONT color="green">988</FONT>                        } else {<a name="line.988"></a>
+<FONT color="green">989</FONT>                            throw new ArithmeticException(msg);<a name="line.989"></a>
+<FONT color="green">990</FONT>                        }<a name="line.990"></a>
+<FONT color="green">991</FONT>                    } else if (b &gt; 0) {<a name="line.991"></a>
+<FONT color="green">992</FONT>                        // check for negative overflow with negative a, positive b<a name="line.992"></a>
+<FONT color="green">993</FONT>                        if (Long.MIN_VALUE / b &lt;= a) {<a name="line.993"></a>
+<FONT color="green">994</FONT>                            ret = a * b;<a name="line.994"></a>
+<FONT color="green">995</FONT>                        } else {<a name="line.995"></a>
+<FONT color="green">996</FONT>                            throw new ArithmeticException(msg);<a name="line.996"></a>
+<FONT color="green">997</FONT>    <a name="line.997"></a>
+<FONT color="green">998</FONT>                        }<a name="line.998"></a>
+<FONT color="green">999</FONT>                    } else {<a name="line.999"></a>
+<FONT color="green">1000</FONT>                        // assert b == 0<a name="line.1000"></a>
+<FONT color="green">1001</FONT>                        ret = 0;<a name="line.1001"></a>
+<FONT color="green">1002</FONT>                    }<a name="line.1002"></a>
+<FONT color="green">1003</FONT>                } else if (a &gt; 0) {<a name="line.1003"></a>
+<FONT color="green">1004</FONT>                    // assert a &gt; 0<a name="line.1004"></a>
+<FONT color="green">1005</FONT>                    // assert b &gt; 0<a name="line.1005"></a>
+<FONT color="green">1006</FONT>    <a name="line.1006"></a>
+<FONT color="green">1007</FONT>                    // check for positive overflow with positive a, positive b<a name="line.1007"></a>
+<FONT color="green">1008</FONT>                    if (a &lt;= Long.MAX_VALUE / b) {<a name="line.1008"></a>
+<FONT color="green">1009</FONT>                        ret = a * b;<a name="line.1009"></a>
+<FONT color="green">1010</FONT>                    } else {<a name="line.1010"></a>
+<FONT color="green">1011</FONT>                        throw new ArithmeticException(msg);<a name="line.1011"></a>
+<FONT color="green">1012</FONT>                    }<a name="line.1012"></a>
+<FONT color="green">1013</FONT>                } else {<a name="line.1013"></a>
+<FONT color="green">1014</FONT>                    // assert a == 0<a name="line.1014"></a>
+<FONT color="green">1015</FONT>                    ret = 0;<a name="line.1015"></a>
+<FONT color="green">1016</FONT>                }<a name="line.1016"></a>
+<FONT color="green">1017</FONT>            }<a name="line.1017"></a>
+<FONT color="green">1018</FONT>            return ret;<a name="line.1018"></a>
+<FONT color="green">1019</FONT>        }<a name="line.1019"></a>
+<FONT color="green">1020</FONT>    <a name="line.1020"></a>
+<FONT color="green">1021</FONT>        /**<a name="line.1021"></a>
+<FONT color="green">1022</FONT>         * Get the next machine representable number after a number, moving<a name="line.1022"></a>
+<FONT color="green">1023</FONT>         * in the direction of another number.<a name="line.1023"></a>
+<FONT color="green">1024</FONT>         * &lt;p&gt;<a name="line.1024"></a>
+<FONT color="green">1025</FONT>         * If &lt;code&gt;direction&lt;/code&gt; is greater than or equal to&lt;code&gt;d&lt;/code&gt;,<a name="line.1025"></a>
+<FONT color="green">1026</FONT>         * the smallest machine representable number strictly greater than<a name="line.1026"></a>
+<FONT color="green">1027</FONT>         * &lt;code&gt;d&lt;/code&gt; is returned; otherwise the largest representable number<a name="line.1027"></a>
+<FONT color="green">1028</FONT>         * strictly less than &lt;code&gt;d&lt;/code&gt; is returned.&lt;/p&gt;<a name="line.1028"></a>
+<FONT color="green">1029</FONT>         * &lt;p&gt;<a name="line.1029"></a>
+<FONT color="green">1030</FONT>         * If &lt;code&gt;d&lt;/code&gt; is NaN or Infinite, it is returned unchanged.&lt;/p&gt;<a name="line.1030"></a>
+<FONT color="green">1031</FONT>         *<a name="line.1031"></a>
+<FONT color="green">1032</FONT>         * @param d base number<a name="line.1032"></a>
+<FONT color="green">1033</FONT>         * @param direction (the only important thing is whether<a name="line.1033"></a>
+<FONT color="green">1034</FONT>         * direction is greater or smaller than d)<a name="line.1034"></a>
+<FONT color="green">1035</FONT>         * @return the next machine representable number in the specified direction<a name="line.1035"></a>
+<FONT color="green">1036</FONT>         * @since 1.2<a name="line.1036"></a>
+<FONT color="green">1037</FONT>         */<a name="line.1037"></a>
+<FONT color="green">1038</FONT>        public static double nextAfter(double d, double direction) {<a name="line.1038"></a>
+<FONT color="green">1039</FONT>    <a name="line.1039"></a>
+<FONT color="green">1040</FONT>            // handling of some important special cases<a name="line.1040"></a>
+<FONT color="green">1041</FONT>            if (Double.isNaN(d) || Double.isInfinite(d)) {<a name="line.1041"></a>
+<FONT color="green">1042</FONT>                    return d;<a name="line.1042"></a>
+<FONT color="green">1043</FONT>            } else if (d == 0) {<a name="line.1043"></a>
+<FONT color="green">1044</FONT>                    return (direction &lt; 0) ? -Double.MIN_VALUE : Double.MIN_VALUE;<a name="line.1044"></a>
+<FONT color="green">1045</FONT>            }<a name="line.1045"></a>
+<FONT color="green">1046</FONT>            // special cases MAX_VALUE to infinity and  MIN_VALUE to 0<a name="line.1046"></a>
+<FONT color="green">1047</FONT>            // are handled just as normal numbers<a name="line.1047"></a>
+<FONT color="green">1048</FONT>    <a name="line.1048"></a>
+<FONT color="green">1049</FONT>            // split the double in raw components<a name="line.1049"></a>
+<FONT color="green">1050</FONT>            long bits     = Double.doubleToLongBits(d);<a name="line.1050"></a>
+<FONT color="green">1051</FONT>            long sign     = bits &amp; 0x8000000000000000L;<a name="line.1051"></a>
+<FONT color="green">1052</FONT>            long exponent = bits &amp; 0x7ff0000000000000L;<a name="line.1052"></a>
+<FONT color="green">1053</FONT>            long mantissa = bits &amp; 0x000fffffffffffffL;<a name="line.1053"></a>
+<FONT color="green">1054</FONT>    <a name="line.1054"></a>
+<FONT color="green">1055</FONT>            if (d * (direction - d) &gt;= 0) {<a name="line.1055"></a>
+<FONT color="green">1056</FONT>                    // we should increase the mantissa<a name="line.1056"></a>
+<FONT color="green">1057</FONT>                    if (mantissa == 0x000fffffffffffffL) {<a name="line.1057"></a>
+<FONT color="green">1058</FONT>                            return Double.longBitsToDouble(sign |<a name="line.1058"></a>
+<FONT color="green">1059</FONT>                                            (exponent + 0x0010000000000000L));<a name="line.1059"></a>
+<FONT color="green">1060</FONT>                    } else {<a name="line.1060"></a>
+<FONT color="green">1061</FONT>                            return Double.longBitsToDouble(sign |<a name="line.1061"></a>
+<FONT color="green">1062</FONT>                                            exponent | (mantissa + 1));<a name="line.1062"></a>
+<FONT color="green">1063</FONT>                    }<a name="line.1063"></a>
+<FONT color="green">1064</FONT>            } else {<a name="line.1064"></a>
+<FONT color="green">1065</FONT>                    // we should decrease the mantissa<a name="line.1065"></a>
+<FONT color="green">1066</FONT>                    if (mantissa == 0L) {<a name="line.1066"></a>
+<FONT color="green">1067</FONT>                            return Double.longBitsToDouble(sign |<a name="line.1067"></a>
+<FONT color="green">1068</FONT>                                            (exponent - 0x0010000000000000L) |<a name="line.1068"></a>
+<FONT color="green">1069</FONT>                                            0x000fffffffffffffL);<a name="line.1069"></a>
+<FONT color="green">1070</FONT>                    } else {<a name="line.1070"></a>
+<FONT color="green">1071</FONT>                            return Double.longBitsToDouble(sign |<a name="line.1071"></a>
+<FONT color="green">1072</FONT>                                            exponent | (mantissa - 1));<a name="line.1072"></a>
+<FONT color="green">1073</FONT>                    }<a name="line.1073"></a>
+<FONT color="green">1074</FONT>            }<a name="line.1074"></a>
+<FONT color="green">1075</FONT>    <a name="line.1075"></a>
+<FONT color="green">1076</FONT>        }<a name="line.1076"></a>
+<FONT color="green">1077</FONT>    <a name="line.1077"></a>
+<FONT color="green">1078</FONT>        /**<a name="line.1078"></a>
+<FONT color="green">1079</FONT>         * Scale a number by 2&lt;sup&gt;scaleFactor&lt;/sup&gt;.<a name="line.1079"></a>
+<FONT color="green">1080</FONT>         * &lt;p&gt;If &lt;code&gt;d&lt;/code&gt; is 0 or NaN or Infinite, it is returned unchanged.&lt;/p&gt;<a name="line.1080"></a>
+<FONT color="green">1081</FONT>         *<a name="line.1081"></a>
+<FONT color="green">1082</FONT>         * @param d base number<a name="line.1082"></a>
+<FONT color="green">1083</FONT>         * @param scaleFactor power of two by which d sould be multiplied<a name="line.1083"></a>
+<FONT color="green">1084</FONT>         * @return d &amp;times; 2&lt;sup&gt;scaleFactor&lt;/sup&gt;<a name="line.1084"></a>
+<FONT color="green">1085</FONT>         * @since 2.0<a name="line.1085"></a>
+<FONT color="green">1086</FONT>         */<a name="line.1086"></a>
+<FONT color="green">1087</FONT>        public static double scalb(final double d, final int scaleFactor) {<a name="line.1087"></a>
+<FONT color="green">1088</FONT>    <a name="line.1088"></a>
+<FONT color="green">1089</FONT>            // handling of some important special cases<a name="line.1089"></a>
+<FONT color="green">1090</FONT>            if ((d == 0) || Double.isNaN(d) || Double.isInfinite(d)) {<a name="line.1090"></a>
+<FONT color="green">1091</FONT>                return d;<a name="line.1091"></a>
+<FONT color="green">1092</FONT>            }<a name="line.1092"></a>
+<FONT color="green">1093</FONT>    <a name="line.1093"></a>
+<FONT color="green">1094</FONT>            // split the double in raw components<a name="line.1094"></a>
+<FONT color="green">1095</FONT>            final long bits     = Double.doubleToLongBits(d);<a name="line.1095"></a>
+<FONT color="green">1096</FONT>            final long exponent = bits &amp; 0x7ff0000000000000L;<a name="line.1096"></a>
+<FONT color="green">1097</FONT>            final long rest     = bits &amp; 0x800fffffffffffffL;<a name="line.1097"></a>
+<FONT color="green">1098</FONT>    <a name="line.1098"></a>
+<FONT color="green">1099</FONT>            // shift the exponent<a name="line.1099"></a>
+<FONT color="green">1100</FONT>            final long newBits = rest | (exponent + (((long) scaleFactor) &lt;&lt; 52));<a name="line.1100"></a>
+<FONT color="green">1101</FONT>            return Double.longBitsToDouble(newBits);<a name="line.1101"></a>
+<FONT color="green">1102</FONT>    <a name="line.1102"></a>
+<FONT color="green">1103</FONT>        }<a name="line.1103"></a>
+<FONT color="green">1104</FONT>    <a name="line.1104"></a>
+<FONT color="green">1105</FONT>        /**<a name="line.1105"></a>
+<FONT color="green">1106</FONT>         * Normalize an angle in a 2&amp;pi wide interval around a center value.<a name="line.1106"></a>
+<FONT color="green">1107</FONT>         * &lt;p&gt;This method has three main uses:&lt;/p&gt;<a name="line.1107"></a>
+<FONT color="green">1108</FONT>         * &lt;ul&gt;<a name="line.1108"></a>
+<FONT color="green">1109</FONT>         *   &lt;li&gt;normalize an angle between 0 and 2&amp;pi;:&lt;br/&gt;<a name="line.1109"></a>
+<FONT color="green">1110</FONT>         *       &lt;code&gt;a = MathUtils.normalizeAngle(a, Math.PI);&lt;/code&gt;&lt;/li&gt;<a name="line.1110"></a>
+<FONT color="green">1111</FONT>         *   &lt;li&gt;normalize an angle between -&amp;pi; and +&amp;pi;&lt;br/&gt;<a name="line.1111"></a>
+<FONT color="green">1112</FONT>         *       &lt;code&gt;a = MathUtils.normalizeAngle(a, 0.0);&lt;/code&gt;&lt;/li&gt;<a name="line.1112"></a>
+<FONT color="green">1113</FONT>         *   &lt;li&gt;compute the angle between two defining angular positions:&lt;br&gt;<a name="line.1113"></a>
+<FONT color="green">1114</FONT>         *       &lt;code&gt;angle = MathUtils.normalizeAngle(end, start) - start;&lt;/code&gt;&lt;/li&gt;<a name="line.1114"></a>
+<FONT color="green">1115</FONT>         * &lt;/ul&gt;<a name="line.1115"></a>
+<FONT color="green">1116</FONT>         * &lt;p&gt;Note that due to numerical accuracy and since &amp;pi; cannot be represented<a name="line.1116"></a>
+<FONT color="green">1117</FONT>         * exactly, the result interval is &lt;em&gt;closed&lt;/em&gt;, it cannot be half-closed<a name="line.1117"></a>
+<FONT color="green">1118</FONT>         * as would be more satisfactory in a purely mathematical view.&lt;/p&gt;<a name="line.1118"></a>
+<FONT color="green">1119</FONT>         * @param a angle to normalize<a name="line.1119"></a>
+<FONT color="green">1120</FONT>         * @param center center of the desired 2&amp;pi; interval for the result<a name="line.1120"></a>
+<FONT color="green">1121</FONT>         * @return a-2k&amp;pi; with integer k and center-&amp;pi; &amp;lt;= a-2k&amp;pi; &amp;lt;= center+&amp;pi;<a name="line.1121"></a>
+<FONT color="green">1122</FONT>         * @since 1.2<a name="line.1122"></a>
+<FONT color="green">1123</FONT>         */<a name="line.1123"></a>
+<FONT color="green">1124</FONT>         public static double normalizeAngle(double a, double center) {<a name="line.1124"></a>
+<FONT color="green">1125</FONT>             return a - TWO_PI * Math.floor((a + Math.PI - center) / TWO_PI);<a name="line.1125"></a>
+<FONT color="green">1126</FONT>         }<a name="line.1126"></a>
+<FONT color="green">1127</FONT>    <a name="line.1127"></a>
+<FONT color="green">1128</FONT>         /**<a name="line.1128"></a>
+<FONT color="green">1129</FONT>          * &lt;p&gt;Normalizes an array to make it sum to a specified value.<a name="line.1129"></a>
+<FONT color="green">1130</FONT>          * Returns the result of the transformation &lt;pre&gt;<a name="line.1130"></a>
+<FONT color="green">1131</FONT>          *    x |-&gt; x * normalizedSum / sum<a name="line.1131"></a>
+<FONT color="green">1132</FONT>          * &lt;/pre&gt;<a name="line.1132"></a>
+<FONT color="green">1133</FONT>          * applied to each non-NaN element x of the input array, where sum is the<a name="line.1133"></a>
+<FONT color="green">1134</FONT>          * sum of the non-NaN entries in the input array.&lt;/p&gt;<a name="line.1134"></a>
+<FONT color="green">1135</FONT>          *<a name="line.1135"></a>
+<FONT color="green">1136</FONT>          * &lt;p&gt;Throws IllegalArgumentException if &lt;code&gt;normalizedSum&lt;/code&gt; is infinite<a name="line.1136"></a>
+<FONT color="green">1137</FONT>          * or NaN and ArithmeticException if the input array contains any infinite elements<a name="line.1137"></a>
+<FONT color="green">1138</FONT>          * or sums to 0&lt;/p&gt;<a name="line.1138"></a>
+<FONT color="green">1139</FONT>          *<a name="line.1139"></a>
+<FONT color="green">1140</FONT>          * &lt;p&gt;Ignores (i.e., copies unchanged to the output array) NaNs in the input array.&lt;/p&gt;<a name="line.1140"></a>
+<FONT color="green">1141</FONT>          *<a name="line.1141"></a>
+<FONT color="green">1142</FONT>          * @param values input array to be normalized<a name="line.1142"></a>
+<FONT color="green">1143</FONT>          * @param normalizedSum target sum for the normalized array<a name="line.1143"></a>
+<FONT color="green">1144</FONT>          * @return normalized array<a name="line.1144"></a>
+<FONT color="green">1145</FONT>          * @throws ArithmeticException if the input array contains infinite elements or sums to zero<a name="line.1145"></a>
+<FONT color="green">1146</FONT>          * @throws IllegalArgumentException if the target sum is infinite or NaN<a name="line.1146"></a>
+<FONT color="green">1147</FONT>          * @since 2.1<a name="line.1147"></a>
+<FONT color="green">1148</FONT>          */<a name="line.1148"></a>
+<FONT color="green">1149</FONT>         public static double[] normalizeArray(double[] values, double normalizedSum)<a name="line.1149"></a>
+<FONT color="green">1150</FONT>           throws ArithmeticException, IllegalArgumentException {<a name="line.1150"></a>
+<FONT color="green">1151</FONT>             if (Double.isInfinite(normalizedSum)) {<a name="line.1151"></a>
+<FONT color="green">1152</FONT>                 throw MathRuntimeException.createIllegalArgumentException(<a name="line.1152"></a>
+<FONT color="green">1153</FONT>                         "Cannot normalize to an infinite value");<a name="line.1153"></a>
+<FONT color="green">1154</FONT>             }<a name="line.1154"></a>
+<FONT color="green">1155</FONT>             if (Double.isNaN(normalizedSum)) {<a name="line.1155"></a>
+<FONT color="green">1156</FONT>                 throw MathRuntimeException.createIllegalArgumentException(<a name="line.1156"></a>
+<FONT color="green">1157</FONT>                         "Cannot normalize to NaN");<a name="line.1157"></a>
+<FONT color="green">1158</FONT>             }<a name="line.1158"></a>
+<FONT color="green">1159</FONT>             double sum = 0d;<a name="line.1159"></a>
+<FONT color="green">1160</FONT>             final int len = values.length;<a name="line.1160"></a>
+<FONT color="green">1161</FONT>             double[] out = new double[len];<a name="line.1161"></a>
+<FONT color="green">1162</FONT>             for (int i = 0; i &lt; len; i++) {<a name="line.1162"></a>
+<FONT color="green">1163</FONT>                 if (Double.isInfinite(values[i])) {<a name="line.1163"></a>
+<FONT color="green">1164</FONT>                     throw MathRuntimeException.createArithmeticException(<a name="line.1164"></a>
+<FONT color="green">1165</FONT>                             "Array contains an infinite element, {0} at index {1}", values[i], i);<a name="line.1165"></a>
+<FONT color="green">1166</FONT>                 }<a name="line.1166"></a>
+<FONT color="green">1167</FONT>                 if (!Double.isNaN(values[i])) {<a name="line.1167"></a>
+<FONT color="green">1168</FONT>                     sum += values[i];<a name="line.1168"></a>
+<FONT color="green">1169</FONT>                 }<a name="line.1169"></a>
+<FONT color="green">1170</FONT>             }<a name="line.1170"></a>
+<FONT color="green">1171</FONT>             if (sum == 0) {<a name="line.1171"></a>
+<FONT color="green">1172</FONT>                 throw MathRuntimeException.createArithmeticException(<a name="line.1172"></a>
+<FONT color="green">1173</FONT>                         "Array sums to zero");<a name="line.1173"></a>
+<FONT color="green">1174</FONT>             }<a name="line.1174"></a>
+<FONT color="green">1175</FONT>             for (int i = 0; i &lt; len; i++) {<a name="line.1175"></a>
+<FONT color="green">1176</FONT>                 if (Double.isNaN(values[i])) {<a name="line.1176"></a>
+<FONT color="green">1177</FONT>                     out[i] = Double.NaN;<a name="line.1177"></a>
+<FONT color="green">1178</FONT>                 } else {<a name="line.1178"></a>
+<FONT color="green">1179</FONT>                     out[i] = values[i] * normalizedSum / sum;<a name="line.1179"></a>
+<FONT color="green">1180</FONT>                 }<a name="line.1180"></a>
+<FONT color="green">1181</FONT>             }<a name="line.1181"></a>
+<FONT color="green">1182</FONT>             return out;<a name="line.1182"></a>
+<FONT color="green">1183</FONT>         }<a name="line.1183"></a>
+<FONT color="green">1184</FONT>    <a name="line.1184"></a>
+<FONT color="green">1185</FONT>        /**<a name="line.1185"></a>
+<FONT color="green">1186</FONT>         * Round the given value to the specified number of decimal places. The<a name="line.1186"></a>
+<FONT color="green">1187</FONT>         * value is rounded using the {@link BigDecimal#ROUND_HALF_UP} method.<a name="line.1187"></a>
+<FONT color="green">1188</FONT>         *<a name="line.1188"></a>
+<FONT color="green">1189</FONT>         * @param x the value to round.<a name="line.1189"></a>
+<FONT color="green">1190</FONT>         * @param scale the number of digits to the right of the decimal point.<a name="line.1190"></a>
+<FONT color="green">1191</FONT>         * @return the rounded value.<a name="line.1191"></a>
+<FONT color="green">1192</FONT>         * @since 1.1<a name="line.1192"></a>
+<FONT color="green">1193</FONT>         */<a name="line.1193"></a>
+<FONT color="green">1194</FONT>        public static double round(double x, int scale) {<a name="line.1194"></a>
+<FONT color="green">1195</FONT>            return round(x, scale, BigDecimal.ROUND_HALF_UP);<a name="line.1195"></a>
+<FONT color="green">1196</FONT>        }<a name="line.1196"></a>
+<FONT color="green">1197</FONT>    <a name="line.1197"></a>
+<FONT color="green">1198</FONT>        /**<a name="line.1198"></a>
+<FONT color="green">1199</FONT>         * Round the given value to the specified number of decimal places. The<a name="line.1199"></a>
+<FONT color="green">1200</FONT>         * value is rounded using the given method which is any method defined in<a name="line.1200"></a>
+<FONT color="green">1201</FONT>         * {@link BigDecimal}.<a name="line.1201"></a>
+<FONT color="green">1202</FONT>         *<a name="line.1202"></a>
+<FONT color="green">1203</FONT>         * @param x the value to round.<a name="line.1203"></a>
+<FONT color="green">1204</FONT>         * @param scale the number of digits to the right of the decimal point.<a name="line.1204"></a>
+<FONT color="green">1205</FONT>         * @param roundingMethod the rounding method as defined in<a name="line.1205"></a>
+<FONT color="green">1206</FONT>         *        {@link BigDecimal}.<a name="line.1206"></a>
+<FONT color="green">1207</FONT>         * @return the rounded value.<a name="line.1207"></a>
+<FONT color="green">1208</FONT>         * @since 1.1<a name="line.1208"></a>
+<FONT color="green">1209</FONT>         */<a name="line.1209"></a>
+<FONT color="green">1210</FONT>        public static double round(double x, int scale, int roundingMethod) {<a name="line.1210"></a>
+<FONT color="green">1211</FONT>            try {<a name="line.1211"></a>
+<FONT color="green">1212</FONT>                return (new BigDecimal<a name="line.1212"></a>
+<FONT color="green">1213</FONT>                       (Double.toString(x))<a name="line.1213"></a>
+<FONT color="green">1214</FONT>                       .setScale(scale, roundingMethod))<a name="line.1214"></a>
+<FONT color="green">1215</FONT>                       .doubleValue();<a name="line.1215"></a>
+<FONT color="green">1216</FONT>            } catch (NumberFormatException ex) {<a name="line.1216"></a>
+<FONT color="green">1217</FONT>                if (Double.isInfinite(x)) {<a name="line.1217"></a>
+<FONT color="green">1218</FONT>                    return x;<a name="line.1218"></a>
+<FONT color="green">1219</FONT>                } else {<a name="line.1219"></a>
+<FONT color="green">1220</FONT>                    return Double.NaN;<a name="line.1220"></a>
+<FONT color="green">1221</FONT>                }<a name="line.1221"></a>
+<FONT color="green">1222</FONT>            }<a name="line.1222"></a>
+<FONT color="green">1223</FONT>        }<a name="line.1223"></a>
+<FONT color="green">1224</FONT>    <a name="line.1224"></a>
+<FONT color="green">1225</FONT>        /**<a name="line.1225"></a>
+<FONT color="green">1226</FONT>         * Round the given value to the specified number of decimal places. The<a name="line.1226"></a>
+<FONT color="green">1227</FONT>         * value is rounding using the {@link BigDecimal#ROUND_HALF_UP} method.<a name="line.1227"></a>
+<FONT color="green">1228</FONT>         *<a name="line.1228"></a>
+<FONT color="green">1229</FONT>         * @param x the value to round.<a name="line.1229"></a>
+<FONT color="green">1230</FONT>         * @param scale the number of digits to the right of the decimal point.<a name="line.1230"></a>
+<FONT color="green">1231</FONT>         * @return the rounded value.<a name="line.1231"></a>
+<FONT color="green">1232</FONT>         * @since 1.1<a name="line.1232"></a>
+<FONT color="green">1233</FONT>         */<a name="line.1233"></a>
+<FONT color="green">1234</FONT>        public static float round(float x, int scale) {<a name="line.1234"></a>
+<FONT color="green">1235</FONT>            return round(x, scale, BigDecimal.ROUND_HALF_UP);<a name="line.1235"></a>
+<FONT color="green">1236</FONT>        }<a name="line.1236"></a>
+<FONT color="green">1237</FONT>    <a name="line.1237"></a>
+<FONT color="green">1238</FONT>        /**<a name="line.1238"></a>
+<FONT color="green">1239</FONT>         * Round the given value to the specified number of decimal places. The<a name="line.1239"></a>
+<FONT color="green">1240</FONT>         * value is rounded using the given method which is any method defined in<a name="line.1240"></a>
+<FONT color="green">1241</FONT>         * {@link BigDecimal}.<a name="line.1241"></a>
+<FONT color="green">1242</FONT>         *<a name="line.1242"></a>
+<FONT color="green">1243</FONT>         * @param x the value to round.<a name="line.1243"></a>
+<FONT color="green">1244</FONT>         * @param scale the number of digits to the right of the decimal point.<a name="line.1244"></a>
+<FONT color="green">1245</FONT>         * @param roundingMethod the rounding method as defined in<a name="line.1245"></a>
+<FONT color="green">1246</FONT>         *        {@link BigDecimal}.<a name="line.1246"></a>
+<FONT color="green">1247</FONT>         * @return the rounded value.<a name="line.1247"></a>
+<FONT color="green">1248</FONT>         * @since 1.1<a name="line.1248"></a>
+<FONT color="green">1249</FONT>         */<a name="line.1249"></a>
+<FONT color="green">1250</FONT>        public static float round(float x, int scale, int roundingMethod) {<a name="line.1250"></a>
+<FONT color="green">1251</FONT>            float sign = indicator(x);<a name="line.1251"></a>
+<FONT color="green">1252</FONT>            float factor = (float)Math.pow(10.0f, scale) * sign;<a name="line.1252"></a>
+<FONT color="green">1253</FONT>            return (float)roundUnscaled(x * factor, sign, roundingMethod) / factor;<a name="line.1253"></a>
+<FONT color="green">1254</FONT>        }<a name="line.1254"></a>
+<FONT color="green">1255</FONT>    <a name="line.1255"></a>
+<FONT color="green">1256</FONT>        /**<a name="line.1256"></a>
+<FONT color="green">1257</FONT>         * Round the given non-negative, value to the "nearest" integer. Nearest is<a name="line.1257"></a>
+<FONT color="green">1258</FONT>         * determined by the rounding method specified. Rounding methods are defined<a name="line.1258"></a>
+<FONT color="green">1259</FONT>         * in {@link BigDecimal}.<a name="line.1259"></a>
+<FONT color="green">1260</FONT>         *<a name="line.1260"></a>
+<FONT color="green">1261</FONT>         * @param unscaled the value to round.<a name="line.1261"></a>
+<FONT color="green">1262</FONT>         * @param sign the sign of the original, scaled value.<a name="line.1262"></a>
+<FONT color="green">1263</FONT>         * @param roundingMethod the rounding method as defined in<a name="line.1263"></a>
+<FONT color="green">1264</FONT>         *        {@link BigDecimal}.<a name="line.1264"></a>
+<FONT color="green">1265</FONT>         * @return the rounded value.<a name="line.1265"></a>
+<FONT color="green">1266</FONT>         * @since 1.1<a name="line.1266"></a>
+<FONT color="green">1267</FONT>         */<a name="line.1267"></a>
+<FONT color="green">1268</FONT>        private static double roundUnscaled(double unscaled, double sign,<a name="line.1268"></a>
+<FONT color="green">1269</FONT>            int roundingMethod) {<a name="line.1269"></a>
+<FONT color="green">1270</FONT>            switch (roundingMethod) {<a name="line.1270"></a>
+<FONT color="green">1271</FONT>            case BigDecimal.ROUND_CEILING :<a name="line.1271"></a>
+<FONT color="green">1272</FONT>                if (sign == -1) {<a name="line.1272"></a>
+<FONT color="green">1273</FONT>                    unscaled = Math.floor(nextAfter(unscaled, Double.NEGATIVE_INFINITY));<a name="line.1273"></a>
+<FONT color="green">1274</FONT>                } else {<a name="line.1274"></a>
+<FONT color="green">1275</FONT>                    unscaled = Math.ceil(nextAfter(unscaled, Double.POSITIVE_INFINITY));<a name="line.1275"></a>
+<FONT color="green">1276</FONT>                }<a name="line.1276"></a>
+<FONT color="green">1277</FONT>                break;<a name="line.1277"></a>
+<FONT color="green">1278</FONT>            case BigDecimal.ROUND_DOWN :<a name="line.1278"></a>
+<FONT color="green">1279</FONT>                unscaled = Math.floor(nextAfter(unscaled, Double.NEGATIVE_INFINITY));<a name="line.1279"></a>
+<FONT color="green">1280</FONT>                break;<a name="line.1280"></a>
+<FONT color="green">1281</FONT>            case BigDecimal.ROUND_FLOOR :<a name="line.1281"></a>
+<FONT color="green">1282</FONT>                if (sign == -1) {<a name="line.1282"></a>
+<FONT color="green">1283</FONT>                    unscaled = Math.ceil(nextAfter(unscaled, Double.POSITIVE_INFINITY));<a name="line.1283"></a>
+<FONT color="green">1284</FONT>                } else {<a name="line.1284"></a>
+<FONT color="green">1285</FONT>                    unscaled = Math.floor(nextAfter(unscaled, Double.NEGATIVE_INFINITY));<a name="line.1285"></a>
+<FONT color="green">1286</FONT>                }<a name="line.1286"></a>
+<FONT color="green">1287</FONT>                break;<a name="line.1287"></a>
+<FONT color="green">1288</FONT>            case BigDecimal.ROUND_HALF_DOWN : {<a name="line.1288"></a>
+<FONT color="green">1289</FONT>                unscaled = nextAfter(unscaled, Double.NEGATIVE_INFINITY);<a name="line.1289"></a>
+<FONT color="green">1290</FONT>                double fraction = unscaled - Math.floor(unscaled);<a name="line.1290"></a>
+<FONT color="green">1291</FONT>                if (fraction &gt; 0.5) {<a name="line.1291"></a>
+<FONT color="green">1292</FONT>                    unscaled = Math.ceil(unscaled);<a name="line.1292"></a>
+<FONT color="green">1293</FONT>                } else {<a name="line.1293"></a>
+<FONT color="green">1294</FONT>                    unscaled = Math.floor(unscaled);<a name="line.1294"></a>
+<FONT color="green">1295</FONT>                }<a name="line.1295"></a>
+<FONT color="green">1296</FONT>                break;<a name="line.1296"></a>
+<FONT color="green">1297</FONT>            }<a name="line.1297"></a>
+<FONT color="green">1298</FONT>            case BigDecimal.ROUND_HALF_EVEN : {<a name="line.1298"></a>
+<FONT color="green">1299</FONT>                double fraction = unscaled - Math.floor(unscaled);<a name="line.1299"></a>
+<FONT color="green">1300</FONT>                if (fraction &gt; 0.5) {<a name="line.1300"></a>
+<FONT color="green">1301</FONT>                    unscaled = Math.ceil(unscaled);<a name="line.1301"></a>
+<FONT color="green">1302</FONT>                } else if (fraction &lt; 0.5) {<a name="line.1302"></a>
+<FONT color="green">1303</FONT>                    unscaled = Math.floor(unscaled);<a name="line.1303"></a>
+<FONT color="green">1304</FONT>                } else {<a name="line.1304"></a>
+<FONT color="green">1305</FONT>                    // The following equality test is intentional and needed for rounding purposes<a name="line.1305"></a>
+<FONT color="green">1306</FONT>                    if (Math.floor(unscaled) / 2.0 == Math.floor(Math<a name="line.1306"></a>
+<FONT color="green">1307</FONT>                        .floor(unscaled) / 2.0)) { // even<a name="line.1307"></a>
+<FONT color="green">1308</FONT>                        unscaled = Math.floor(unscaled);<a name="line.1308"></a>
+<FONT color="green">1309</FONT>                    } else { // odd<a name="line.1309"></a>
+<FONT color="green">1310</FONT>                        unscaled = Math.ceil(unscaled);<a name="line.1310"></a>
+<FONT color="green">1311</FONT>                    }<a name="line.1311"></a>
+<FONT color="green">1312</FONT>                }<a name="line.1312"></a>
+<FONT color="green">1313</FONT>                break;<a name="line.1313"></a>
+<FONT color="green">1314</FONT>            }<a name="line.1314"></a>
+<FONT color="green">1315</FONT>            case BigDecimal.ROUND_HALF_UP : {<a name="line.1315"></a>
+<FONT color="green">1316</FONT>                unscaled = nextAfter(unscaled, Double.POSITIVE_INFINITY);<a name="line.1316"></a>
+<FONT color="green">1317</FONT>                double fraction = unscaled - Math.floor(unscaled);<a name="line.1317"></a>
+<FONT color="green">1318</FONT>                if (fraction &gt;= 0.5) {<a name="line.1318"></a>
+<FONT color="green">1319</FONT>                    unscaled = Math.ceil(unscaled);<a name="line.1319"></a>
+<FONT color="green">1320</FONT>                } else {<a name="line.1320"></a>
+<FONT color="green">1321</FONT>                    unscaled = Math.floor(unscaled);<a name="line.1321"></a>
+<FONT color="green">1322</FONT>                }<a name="line.1322"></a>
+<FONT color="green">1323</FONT>                break;<a name="line.1323"></a>
+<FONT color="green">1324</FONT>            }<a name="line.1324"></a>
+<FONT color="green">1325</FONT>            case BigDecimal.ROUND_UNNECESSARY :<a name="line.1325"></a>
+<FONT color="green">1326</FONT>                if (unscaled != Math.floor(unscaled)) {<a name="line.1326"></a>
+<FONT color="green">1327</FONT>                    throw new ArithmeticException("Inexact result from rounding");<a name="line.1327"></a>
+<FONT color="green">1328</FONT>                }<a name="line.1328"></a>
+<FONT color="green">1329</FONT>                break;<a name="line.1329"></a>
+<FONT color="green">1330</FONT>            case BigDecimal.ROUND_UP :<a name="line.1330"></a>
+<FONT color="green">1331</FONT>                unscaled = Math.ceil(nextAfter(unscaled,  Double.POSITIVE_INFINITY));<a name="line.1331"></a>
+<FONT color="green">1332</FONT>                break;<a name="line.1332"></a>
+<FONT color="green">1333</FONT>            default :<a name="line.1333"></a>
+<FONT color="green">1334</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1334"></a>
+<FONT color="green">1335</FONT>                      "invalid rounding method {0}, valid methods: {1} ({2}), {3} ({4})," +<a name="line.1335"></a>
+<FONT color="green">1336</FONT>                      " {5} ({6}), {7} ({8}), {9} ({10}), {11} ({12}), {13} ({14}), {15} ({16})",<a name="line.1336"></a>
+<FONT color="green">1337</FONT>                      roundingMethod,<a name="line.1337"></a>
+<FONT color="green">1338</FONT>                      "ROUND_CEILING",     BigDecimal.ROUND_CEILING,<a name="line.1338"></a>
+<FONT color="green">1339</FONT>                      "ROUND_DOWN",        BigDecimal.ROUND_DOWN,<a name="line.1339"></a>
+<FONT color="green">1340</FONT>                      "ROUND_FLOOR",       BigDecimal.ROUND_FLOOR,<a name="line.1340"></a>
+<FONT color="green">1341</FONT>                      "ROUND_HALF_DOWN",   BigDecimal.ROUND_HALF_DOWN,<a name="line.1341"></a>
+<FONT color="green">1342</FONT>                      "ROUND_HALF_EVEN",   BigDecimal.ROUND_HALF_EVEN,<a name="line.1342"></a>
+<FONT color="green">1343</FONT>                      "ROUND_HALF_UP",     BigDecimal.ROUND_HALF_UP,<a name="line.1343"></a>
+<FONT color="green">1344</FONT>                      "ROUND_UNNECESSARY", BigDecimal.ROUND_UNNECESSARY,<a name="line.1344"></a>
+<FONT color="green">1345</FONT>                      "ROUND_UP",          BigDecimal.ROUND_UP);<a name="line.1345"></a>
+<FONT color="green">1346</FONT>            }<a name="line.1346"></a>
+<FONT color="green">1347</FONT>            return unscaled;<a name="line.1347"></a>
+<FONT color="green">1348</FONT>        }<a name="line.1348"></a>
+<FONT color="green">1349</FONT>    <a name="line.1349"></a>
+<FONT color="green">1350</FONT>        /**<a name="line.1350"></a>
+<FONT color="green">1351</FONT>         * Returns the &lt;a href="http://mathworld.wolfram.com/Sign.html"&gt; sign&lt;/a&gt;<a name="line.1351"></a>
+<FONT color="green">1352</FONT>         * for byte value &lt;code&gt;x&lt;/code&gt;.<a name="line.1352"></a>
+<FONT color="green">1353</FONT>         * &lt;p&gt;<a name="line.1353"></a>
+<FONT color="green">1354</FONT>         * For a byte value x, this method returns (byte)(+1) if x &gt; 0, (byte)(0) if<a name="line.1354"></a>
+<FONT color="green">1355</FONT>         * x = 0, and (byte)(-1) if x &lt; 0.&lt;/p&gt;<a name="line.1355"></a>
+<FONT color="green">1356</FONT>         *<a name="line.1356"></a>
+<FONT color="green">1357</FONT>         * @param x the value, a byte<a name="line.1357"></a>
+<FONT color="green">1358</FONT>         * @return (byte)(+1), (byte)(0), or (byte)(-1), depending on the sign of x<a name="line.1358"></a>
+<FONT color="green">1359</FONT>         */<a name="line.1359"></a>
+<FONT color="green">1360</FONT>        public static byte sign(final byte x) {<a name="line.1360"></a>
+<FONT color="green">1361</FONT>            return (x == ZB) ? ZB : (x &gt; ZB) ? PB : NB;<a name="line.1361"></a>
+<FONT color="green">1362</FONT>        }<a name="line.1362"></a>
+<FONT color="green">1363</FONT>    <a name="line.1363"></a>
+<FONT color="green">1364</FONT>        /**<a name="line.1364"></a>
+<FONT color="green">1365</FONT>         * Returns the &lt;a href="http://mathworld.wolfram.com/Sign.html"&gt; sign&lt;/a&gt;<a name="line.1365"></a>
+<FONT color="green">1366</FONT>         * for double precision &lt;code&gt;x&lt;/code&gt;.<a name="line.1366"></a>
+<FONT color="green">1367</FONT>         * &lt;p&gt;<a name="line.1367"></a>
+<FONT color="green">1368</FONT>         * For a double value &lt;code&gt;x&lt;/code&gt;, this method returns<a name="line.1368"></a>
+<FONT color="green">1369</FONT>         * &lt;code&gt;+1.0&lt;/code&gt; if &lt;code&gt;x &gt; 0&lt;/code&gt;, &lt;code&gt;0.0&lt;/code&gt; if<a name="line.1369"></a>
+<FONT color="green">1370</FONT>         * &lt;code&gt;x = 0.0&lt;/code&gt;, and &lt;code&gt;-1.0&lt;/code&gt; if &lt;code&gt;x &lt; 0&lt;/code&gt;.<a name="line.1370"></a>
+<FONT color="green">1371</FONT>         * Returns &lt;code&gt;NaN&lt;/code&gt; if &lt;code&gt;x&lt;/code&gt; is &lt;code&gt;NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.1371"></a>
+<FONT color="green">1372</FONT>         *<a name="line.1372"></a>
+<FONT color="green">1373</FONT>         * @param x the value, a double<a name="line.1373"></a>
+<FONT color="green">1374</FONT>         * @return +1.0, 0.0, or -1.0, depending on the sign of x<a name="line.1374"></a>
+<FONT color="green">1375</FONT>         */<a name="line.1375"></a>
+<FONT color="green">1376</FONT>        public static double sign(final double x) {<a name="line.1376"></a>
+<FONT color="green">1377</FONT>            if (Double.isNaN(x)) {<a name="line.1377"></a>
+<FONT color="green">1378</FONT>                return Double.NaN;<a name="line.1378"></a>
+<FONT color="green">1379</FONT>            }<a name="line.1379"></a>
+<FONT color="green">1380</FONT>            return (x == 0.0) ? 0.0 : (x &gt; 0.0) ? 1.0 : -1.0;<a name="line.1380"></a>
+<FONT color="green">1381</FONT>        }<a name="line.1381"></a>
+<FONT color="green">1382</FONT>    <a name="line.1382"></a>
+<FONT color="green">1383</FONT>        /**<a name="line.1383"></a>
+<FONT color="green">1384</FONT>         * Returns the &lt;a href="http://mathworld.wolfram.com/Sign.html"&gt; sign&lt;/a&gt;<a name="line.1384"></a>
+<FONT color="green">1385</FONT>         * for float value &lt;code&gt;x&lt;/code&gt;.<a name="line.1385"></a>
+<FONT color="green">1386</FONT>         * &lt;p&gt;<a name="line.1386"></a>
+<FONT color="green">1387</FONT>         * For a float value x, this method returns +1.0F if x &gt; 0, 0.0F if x =<a name="line.1387"></a>
+<FONT color="green">1388</FONT>         * 0.0F, and -1.0F if x &lt; 0. Returns &lt;code&gt;NaN&lt;/code&gt; if &lt;code&gt;x&lt;/code&gt;<a name="line.1388"></a>
+<FONT color="green">1389</FONT>         * is &lt;code&gt;NaN&lt;/code&gt;.&lt;/p&gt;<a name="line.1389"></a>
+<FONT color="green">1390</FONT>         *<a name="line.1390"></a>
+<FONT color="green">1391</FONT>         * @param x the value, a float<a name="line.1391"></a>
+<FONT color="green">1392</FONT>         * @return +1.0F, 0.0F, or -1.0F, depending on the sign of x<a name="line.1392"></a>
+<FONT color="green">1393</FONT>         */<a name="line.1393"></a>
+<FONT color="green">1394</FONT>        public static float sign(final float x) {<a name="line.1394"></a>
+<FONT color="green">1395</FONT>            if (Float.isNaN(x)) {<a name="line.1395"></a>
+<FONT color="green">1396</FONT>                return Float.NaN;<a name="line.1396"></a>
+<FONT color="green">1397</FONT>            }<a name="line.1397"></a>
+<FONT color="green">1398</FONT>            return (x == 0.0F) ? 0.0F : (x &gt; 0.0F) ? 1.0F : -1.0F;<a name="line.1398"></a>
+<FONT color="green">1399</FONT>        }<a name="line.1399"></a>
+<FONT color="green">1400</FONT>    <a name="line.1400"></a>
+<FONT color="green">1401</FONT>        /**<a name="line.1401"></a>
+<FONT color="green">1402</FONT>         * Returns the &lt;a href="http://mathworld.wolfram.com/Sign.html"&gt; sign&lt;/a&gt;<a name="line.1402"></a>
+<FONT color="green">1403</FONT>         * for int value &lt;code&gt;x&lt;/code&gt;.<a name="line.1403"></a>
+<FONT color="green">1404</FONT>         * &lt;p&gt;<a name="line.1404"></a>
+<FONT color="green">1405</FONT>         * For an int value x, this method returns +1 if x &gt; 0, 0 if x = 0, and -1<a name="line.1405"></a>
+<FONT color="green">1406</FONT>         * if x &lt; 0.&lt;/p&gt;<a name="line.1406"></a>
+<FONT color="green">1407</FONT>         *<a name="line.1407"></a>
+<FONT color="green">1408</FONT>         * @param x the value, an int<a name="line.1408"></a>
+<FONT color="green">1409</FONT>         * @return +1, 0, or -1, depending on the sign of x<a name="line.1409"></a>
+<FONT color="green">1410</FONT>         */<a name="line.1410"></a>
+<FONT color="green">1411</FONT>        public static int sign(final int x) {<a name="line.1411"></a>
+<FONT color="green">1412</FONT>            return (x == 0) ? 0 : (x &gt; 0) ? 1 : -1;<a name="line.1412"></a>
+<FONT color="green">1413</FONT>        }<a name="line.1413"></a>
+<FONT color="green">1414</FONT>    <a name="line.1414"></a>
+<FONT color="green">1415</FONT>        /**<a name="line.1415"></a>
+<FONT color="green">1416</FONT>         * Returns the &lt;a href="http://mathworld.wolfram.com/Sign.html"&gt; sign&lt;/a&gt;<a name="line.1416"></a>
+<FONT color="green">1417</FONT>         * for long value &lt;code&gt;x&lt;/code&gt;.<a name="line.1417"></a>
+<FONT color="green">1418</FONT>         * &lt;p&gt;<a name="line.1418"></a>
+<FONT color="green">1419</FONT>         * For a long value x, this method returns +1L if x &gt; 0, 0L if x = 0, and<a name="line.1419"></a>
+<FONT color="green">1420</FONT>         * -1L if x &lt; 0.&lt;/p&gt;<a name="line.1420"></a>
+<FONT color="green">1421</FONT>         *<a name="line.1421"></a>
+<FONT color="green">1422</FONT>         * @param x the value, a long<a name="line.1422"></a>
+<FONT color="green">1423</FONT>         * @return +1L, 0L, or -1L, depending on the sign of x<a name="line.1423"></a>
+<FONT color="green">1424</FONT>         */<a name="line.1424"></a>
+<FONT color="green">1425</FONT>        public static long sign(final long x) {<a name="line.1425"></a>
+<FONT color="green">1426</FONT>            return (x == 0L) ? 0L : (x &gt; 0L) ? 1L : -1L;<a name="line.1426"></a>
+<FONT color="green">1427</FONT>        }<a name="line.1427"></a>
+<FONT color="green">1428</FONT>    <a name="line.1428"></a>
+<FONT color="green">1429</FONT>        /**<a name="line.1429"></a>
+<FONT color="green">1430</FONT>         * Returns the &lt;a href="http://mathworld.wolfram.com/Sign.html"&gt; sign&lt;/a&gt;<a name="line.1430"></a>
+<FONT color="green">1431</FONT>         * for short value &lt;code&gt;x&lt;/code&gt;.<a name="line.1431"></a>
+<FONT color="green">1432</FONT>         * &lt;p&gt;<a name="line.1432"></a>
+<FONT color="green">1433</FONT>         * For a short value x, this method returns (short)(+1) if x &gt; 0, (short)(0)<a name="line.1433"></a>
+<FONT color="green">1434</FONT>         * if x = 0, and (short)(-1) if x &lt; 0.&lt;/p&gt;<a name="line.1434"></a>
+<FONT color="green">1435</FONT>         *<a name="line.1435"></a>
+<FONT color="green">1436</FONT>         * @param x the value, a short<a name="line.1436"></a>
+<FONT color="green">1437</FONT>         * @return (short)(+1), (short)(0), or (short)(-1), depending on the sign of<a name="line.1437"></a>
+<FONT color="green">1438</FONT>         *         x<a name="line.1438"></a>
+<FONT color="green">1439</FONT>         */<a name="line.1439"></a>
+<FONT color="green">1440</FONT>        public static short sign(final short x) {<a name="line.1440"></a>
+<FONT color="green">1441</FONT>            return (x == ZS) ? ZS : (x &gt; ZS) ? PS : NS;<a name="line.1441"></a>
+<FONT color="green">1442</FONT>        }<a name="line.1442"></a>
+<FONT color="green">1443</FONT>    <a name="line.1443"></a>
+<FONT color="green">1444</FONT>        /**<a name="line.1444"></a>
+<FONT color="green">1445</FONT>         * Returns the &lt;a href="http://mathworld.wolfram.com/HyperbolicSine.html"&gt;<a name="line.1445"></a>
+<FONT color="green">1446</FONT>         * hyperbolic sine&lt;/a&gt; of x.<a name="line.1446"></a>
+<FONT color="green">1447</FONT>         *<a name="line.1447"></a>
+<FONT color="green">1448</FONT>         * @param x double value for which to find the hyperbolic sine<a name="line.1448"></a>
+<FONT color="green">1449</FONT>         * @return hyperbolic sine of x<a name="line.1449"></a>
+<FONT color="green">1450</FONT>         */<a name="line.1450"></a>
+<FONT color="green">1451</FONT>        public static double sinh(double x) {<a name="line.1451"></a>
+<FONT color="green">1452</FONT>            return (Math.exp(x) - Math.exp(-x)) / 2.0;<a name="line.1452"></a>
+<FONT color="green">1453</FONT>        }<a name="line.1453"></a>
+<FONT color="green">1454</FONT>    <a name="line.1454"></a>
+<FONT color="green">1455</FONT>        /**<a name="line.1455"></a>
+<FONT color="green">1456</FONT>         * Subtract two integers, checking for overflow.<a name="line.1456"></a>
+<FONT color="green">1457</FONT>         *<a name="line.1457"></a>
+<FONT color="green">1458</FONT>         * @param x the minuend<a name="line.1458"></a>
+<FONT color="green">1459</FONT>         * @param y the subtrahend<a name="line.1459"></a>
+<FONT color="green">1460</FONT>         * @return the difference &lt;code&gt;x-y&lt;/code&gt;<a name="line.1460"></a>
+<FONT color="green">1461</FONT>         * @throws ArithmeticException if the result can not be represented as an<a name="line.1461"></a>
+<FONT color="green">1462</FONT>         *         int<a name="line.1462"></a>
+<FONT color="green">1463</FONT>         * @since 1.1<a name="line.1463"></a>
+<FONT color="green">1464</FONT>         */<a name="line.1464"></a>
+<FONT color="green">1465</FONT>        public static int subAndCheck(int x, int y) {<a name="line.1465"></a>
+<FONT color="green">1466</FONT>            long s = (long)x - (long)y;<a name="line.1466"></a>
+<FONT color="green">1467</FONT>            if (s &lt; Integer.MIN_VALUE || s &gt; Integer.MAX_VALUE) {<a name="line.1467"></a>
+<FONT color="green">1468</FONT>                throw new ArithmeticException("overflow: subtract");<a name="line.1468"></a>
+<FONT color="green">1469</FONT>            }<a name="line.1469"></a>
+<FONT color="green">1470</FONT>            return (int)s;<a name="line.1470"></a>
+<FONT color="green">1471</FONT>        }<a name="line.1471"></a>
+<FONT color="green">1472</FONT>    <a name="line.1472"></a>
+<FONT color="green">1473</FONT>        /**<a name="line.1473"></a>
+<FONT color="green">1474</FONT>         * Subtract two long integers, checking for overflow.<a name="line.1474"></a>
+<FONT color="green">1475</FONT>         *<a name="line.1475"></a>
+<FONT color="green">1476</FONT>         * @param a first value<a name="line.1476"></a>
+<FONT color="green">1477</FONT>         * @param b second value<a name="line.1477"></a>
+<FONT color="green">1478</FONT>         * @return the difference &lt;code&gt;a-b&lt;/code&gt;<a name="line.1478"></a>
+<FONT color="green">1479</FONT>         * @throws ArithmeticException if the result can not be represented as an<a name="line.1479"></a>
+<FONT color="green">1480</FONT>         *         long<a name="line.1480"></a>
+<FONT color="green">1481</FONT>         * @since 1.2<a name="line.1481"></a>
+<FONT color="green">1482</FONT>         */<a name="line.1482"></a>
+<FONT color="green">1483</FONT>        public static long subAndCheck(long a, long b) {<a name="line.1483"></a>
+<FONT color="green">1484</FONT>            long ret;<a name="line.1484"></a>
+<FONT color="green">1485</FONT>            String msg = "overflow: subtract";<a name="line.1485"></a>
+<FONT color="green">1486</FONT>            if (b == Long.MIN_VALUE) {<a name="line.1486"></a>
+<FONT color="green">1487</FONT>                if (a &lt; 0) {<a name="line.1487"></a>
+<FONT color="green">1488</FONT>                    ret = a - b;<a name="line.1488"></a>
+<FONT color="green">1489</FONT>                } else {<a name="line.1489"></a>
+<FONT color="green">1490</FONT>                    throw new ArithmeticException(msg);<a name="line.1490"></a>
+<FONT color="green">1491</FONT>                }<a name="line.1491"></a>
+<FONT color="green">1492</FONT>            } else {<a name="line.1492"></a>
+<FONT color="green">1493</FONT>                // use additive inverse<a name="line.1493"></a>
+<FONT color="green">1494</FONT>                ret = addAndCheck(a, -b, msg);<a name="line.1494"></a>
+<FONT color="green">1495</FONT>            }<a name="line.1495"></a>
+<FONT color="green">1496</FONT>            return ret;<a name="line.1496"></a>
+<FONT color="green">1497</FONT>        }<a name="line.1497"></a>
+<FONT color="green">1498</FONT>    <a name="line.1498"></a>
+<FONT color="green">1499</FONT>        /**<a name="line.1499"></a>
+<FONT color="green">1500</FONT>         * Raise an int to an int power.<a name="line.1500"></a>
+<FONT color="green">1501</FONT>         * @param k number to raise<a name="line.1501"></a>
+<FONT color="green">1502</FONT>         * @param e exponent (must be positive or null)<a name="line.1502"></a>
+<FONT color="green">1503</FONT>         * @return k&lt;sup&gt;e&lt;/sup&gt;<a name="line.1503"></a>
+<FONT color="green">1504</FONT>         * @exception IllegalArgumentException if e is negative<a name="line.1504"></a>
+<FONT color="green">1505</FONT>         */<a name="line.1505"></a>
+<FONT color="green">1506</FONT>        public static int pow(final int k, int e)<a name="line.1506"></a>
+<FONT color="green">1507</FONT>            throws IllegalArgumentException {<a name="line.1507"></a>
+<FONT color="green">1508</FONT>    <a name="line.1508"></a>
+<FONT color="green">1509</FONT>            if (e &lt; 0) {<a name="line.1509"></a>
+<FONT color="green">1510</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1510"></a>
+<FONT color="green">1511</FONT>                    "cannot raise an integral value to a negative power ({0}^{1})",<a name="line.1511"></a>
+<FONT color="green">1512</FONT>                    k, e);<a name="line.1512"></a>
+<FONT color="green">1513</FONT>            }<a name="line.1513"></a>
+<FONT color="green">1514</FONT>    <a name="line.1514"></a>
+<FONT color="green">1515</FONT>            int result = 1;<a name="line.1515"></a>
+<FONT color="green">1516</FONT>            int k2p    = k;<a name="line.1516"></a>
+<FONT color="green">1517</FONT>            while (e != 0) {<a name="line.1517"></a>
+<FONT color="green">1518</FONT>                if ((e &amp; 0x1) != 0) {<a name="line.1518"></a>
+<FONT color="green">1519</FONT>                    result *= k2p;<a name="line.1519"></a>
+<FONT color="green">1520</FONT>                }<a name="line.1520"></a>
+<FONT color="green">1521</FONT>                k2p *= k2p;<a name="line.1521"></a>
+<FONT color="green">1522</FONT>                e = e &gt;&gt; 1;<a name="line.1522"></a>
+<FONT color="green">1523</FONT>            }<a name="line.1523"></a>
+<FONT color="green">1524</FONT>    <a name="line.1524"></a>
+<FONT color="green">1525</FONT>            return result;<a name="line.1525"></a>
+<FONT color="green">1526</FONT>    <a name="line.1526"></a>
+<FONT color="green">1527</FONT>        }<a name="line.1527"></a>
+<FONT color="green">1528</FONT>    <a name="line.1528"></a>
+<FONT color="green">1529</FONT>        /**<a name="line.1529"></a>
+<FONT color="green">1530</FONT>         * Raise an int to a long power.<a name="line.1530"></a>
+<FONT color="green">1531</FONT>         * @param k number to raise<a name="line.1531"></a>
+<FONT color="green">1532</FONT>         * @param e exponent (must be positive or null)<a name="line.1532"></a>
+<FONT color="green">1533</FONT>         * @return k&lt;sup&gt;e&lt;/sup&gt;<a name="line.1533"></a>
+<FONT color="green">1534</FONT>         * @exception IllegalArgumentException if e is negative<a name="line.1534"></a>
+<FONT color="green">1535</FONT>         */<a name="line.1535"></a>
+<FONT color="green">1536</FONT>        public static int pow(final int k, long e)<a name="line.1536"></a>
+<FONT color="green">1537</FONT>            throws IllegalArgumentException {<a name="line.1537"></a>
+<FONT color="green">1538</FONT>    <a name="line.1538"></a>
+<FONT color="green">1539</FONT>            if (e &lt; 0) {<a name="line.1539"></a>
+<FONT color="green">1540</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1540"></a>
+<FONT color="green">1541</FONT>                    "cannot raise an integral value to a negative power ({0}^{1})",<a name="line.1541"></a>
+<FONT color="green">1542</FONT>                    k, e);<a name="line.1542"></a>
+<FONT color="green">1543</FONT>            }<a name="line.1543"></a>
+<FONT color="green">1544</FONT>    <a name="line.1544"></a>
+<FONT color="green">1545</FONT>            int result = 1;<a name="line.1545"></a>
+<FONT color="green">1546</FONT>            int k2p    = k;<a name="line.1546"></a>
+<FONT color="green">1547</FONT>            while (e != 0) {<a name="line.1547"></a>
+<FONT color="green">1548</FONT>                if ((e &amp; 0x1) != 0) {<a name="line.1548"></a>
+<FONT color="green">1549</FONT>                    result *= k2p;<a name="line.1549"></a>
+<FONT color="green">1550</FONT>                }<a name="line.1550"></a>
+<FONT color="green">1551</FONT>                k2p *= k2p;<a name="line.1551"></a>
+<FONT color="green">1552</FONT>                e = e &gt;&gt; 1;<a name="line.1552"></a>
+<FONT color="green">1553</FONT>            }<a name="line.1553"></a>
+<FONT color="green">1554</FONT>    <a name="line.1554"></a>
+<FONT color="green">1555</FONT>            return result;<a name="line.1555"></a>
+<FONT color="green">1556</FONT>    <a name="line.1556"></a>
+<FONT color="green">1557</FONT>        }<a name="line.1557"></a>
+<FONT color="green">1558</FONT>    <a name="line.1558"></a>
+<FONT color="green">1559</FONT>        /**<a name="line.1559"></a>
+<FONT color="green">1560</FONT>         * Raise a long to an int power.<a name="line.1560"></a>
+<FONT color="green">1561</FONT>         * @param k number to raise<a name="line.1561"></a>
+<FONT color="green">1562</FONT>         * @param e exponent (must be positive or null)<a name="line.1562"></a>
+<FONT color="green">1563</FONT>         * @return k&lt;sup&gt;e&lt;/sup&gt;<a name="line.1563"></a>
+<FONT color="green">1564</FONT>         * @exception IllegalArgumentException if e is negative<a name="line.1564"></a>
+<FONT color="green">1565</FONT>         */<a name="line.1565"></a>
+<FONT color="green">1566</FONT>        public static long pow(final long k, int e)<a name="line.1566"></a>
+<FONT color="green">1567</FONT>            throws IllegalArgumentException {<a name="line.1567"></a>
+<FONT color="green">1568</FONT>    <a name="line.1568"></a>
+<FONT color="green">1569</FONT>            if (e &lt; 0) {<a name="line.1569"></a>
+<FONT color="green">1570</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1570"></a>
+<FONT color="green">1571</FONT>                    "cannot raise an integral value to a negative power ({0}^{1})",<a name="line.1571"></a>
+<FONT color="green">1572</FONT>                    k, e);<a name="line.1572"></a>
+<FONT color="green">1573</FONT>            }<a name="line.1573"></a>
+<FONT color="green">1574</FONT>    <a name="line.1574"></a>
+<FONT color="green">1575</FONT>            long result = 1l;<a name="line.1575"></a>
+<FONT color="green">1576</FONT>            long k2p    = k;<a name="line.1576"></a>
+<FONT color="green">1577</FONT>            while (e != 0) {<a name="line.1577"></a>
+<FONT color="green">1578</FONT>                if ((e &amp; 0x1) != 0) {<a name="line.1578"></a>
+<FONT color="green">1579</FONT>                    result *= k2p;<a name="line.1579"></a>
+<FONT color="green">1580</FONT>                }<a name="line.1580"></a>
+<FONT color="green">1581</FONT>                k2p *= k2p;<a name="line.1581"></a>
+<FONT color="green">1582</FONT>                e = e &gt;&gt; 1;<a name="line.1582"></a>
+<FONT color="green">1583</FONT>            }<a name="line.1583"></a>
+<FONT color="green">1584</FONT>    <a name="line.1584"></a>
+<FONT color="green">1585</FONT>            return result;<a name="line.1585"></a>
+<FONT color="green">1586</FONT>    <a name="line.1586"></a>
+<FONT color="green">1587</FONT>        }<a name="line.1587"></a>
+<FONT color="green">1588</FONT>    <a name="line.1588"></a>
+<FONT color="green">1589</FONT>        /**<a name="line.1589"></a>
+<FONT color="green">1590</FONT>         * Raise a long to a long power.<a name="line.1590"></a>
+<FONT color="green">1591</FONT>         * @param k number to raise<a name="line.1591"></a>
+<FONT color="green">1592</FONT>         * @param e exponent (must be positive or null)<a name="line.1592"></a>
+<FONT color="green">1593</FONT>         * @return k&lt;sup&gt;e&lt;/sup&gt;<a name="line.1593"></a>
+<FONT color="green">1594</FONT>         * @exception IllegalArgumentException if e is negative<a name="line.1594"></a>
+<FONT color="green">1595</FONT>         */<a name="line.1595"></a>
+<FONT color="green">1596</FONT>        public static long pow(final long k, long e)<a name="line.1596"></a>
+<FONT color="green">1597</FONT>            throws IllegalArgumentException {<a name="line.1597"></a>
+<FONT color="green">1598</FONT>    <a name="line.1598"></a>
+<FONT color="green">1599</FONT>            if (e &lt; 0) {<a name="line.1599"></a>
+<FONT color="green">1600</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1600"></a>
+<FONT color="green">1601</FONT>                    "cannot raise an integral value to a negative power ({0}^{1})",<a name="line.1601"></a>
+<FONT color="green">1602</FONT>                    k, e);<a name="line.1602"></a>
+<FONT color="green">1603</FONT>            }<a name="line.1603"></a>
+<FONT color="green">1604</FONT>    <a name="line.1604"></a>
+<FONT color="green">1605</FONT>            long result = 1l;<a name="line.1605"></a>
+<FONT color="green">1606</FONT>            long k2p    = k;<a name="line.1606"></a>
+<FONT color="green">1607</FONT>            while (e != 0) {<a name="line.1607"></a>
+<FONT color="green">1608</FONT>                if ((e &amp; 0x1) != 0) {<a name="line.1608"></a>
+<FONT color="green">1609</FONT>                    result *= k2p;<a name="line.1609"></a>
+<FONT color="green">1610</FONT>                }<a name="line.1610"></a>
+<FONT color="green">1611</FONT>                k2p *= k2p;<a name="line.1611"></a>
+<FONT color="green">1612</FONT>                e = e &gt;&gt; 1;<a name="line.1612"></a>
+<FONT color="green">1613</FONT>            }<a name="line.1613"></a>
+<FONT color="green">1614</FONT>    <a name="line.1614"></a>
+<FONT color="green">1615</FONT>            return result;<a name="line.1615"></a>
+<FONT color="green">1616</FONT>    <a name="line.1616"></a>
+<FONT color="green">1617</FONT>        }<a name="line.1617"></a>
+<FONT color="green">1618</FONT>    <a name="line.1618"></a>
+<FONT color="green">1619</FONT>        /**<a name="line.1619"></a>
+<FONT color="green">1620</FONT>         * Raise a BigInteger to an int power.<a name="line.1620"></a>
+<FONT color="green">1621</FONT>         * @param k number to raise<a name="line.1621"></a>
+<FONT color="green">1622</FONT>         * @param e exponent (must be positive or null)<a name="line.1622"></a>
+<FONT color="green">1623</FONT>         * @return k&lt;sup&gt;e&lt;/sup&gt;<a name="line.1623"></a>
+<FONT color="green">1624</FONT>         * @exception IllegalArgumentException if e is negative<a name="line.1624"></a>
+<FONT color="green">1625</FONT>         */<a name="line.1625"></a>
+<FONT color="green">1626</FONT>        public static BigInteger pow(final BigInteger k, int e)<a name="line.1626"></a>
+<FONT color="green">1627</FONT>            throws IllegalArgumentException {<a name="line.1627"></a>
+<FONT color="green">1628</FONT>    <a name="line.1628"></a>
+<FONT color="green">1629</FONT>            if (e &lt; 0) {<a name="line.1629"></a>
+<FONT color="green">1630</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1630"></a>
+<FONT color="green">1631</FONT>                    "cannot raise an integral value to a negative power ({0}^{1})",<a name="line.1631"></a>
+<FONT color="green">1632</FONT>                    k, e);<a name="line.1632"></a>
+<FONT color="green">1633</FONT>            }<a name="line.1633"></a>
+<FONT color="green">1634</FONT>    <a name="line.1634"></a>
+<FONT color="green">1635</FONT>            return k.pow(e);<a name="line.1635"></a>
+<FONT color="green">1636</FONT>    <a name="line.1636"></a>
+<FONT color="green">1637</FONT>        }<a name="line.1637"></a>
+<FONT color="green">1638</FONT>    <a name="line.1638"></a>
+<FONT color="green">1639</FONT>        /**<a name="line.1639"></a>
+<FONT color="green">1640</FONT>         * Raise a BigInteger to a long power.<a name="line.1640"></a>
+<FONT color="green">1641</FONT>         * @param k number to raise<a name="line.1641"></a>
+<FONT color="green">1642</FONT>         * @param e exponent (must be positive or null)<a name="line.1642"></a>
+<FONT color="green">1643</FONT>         * @return k&lt;sup&gt;e&lt;/sup&gt;<a name="line.1643"></a>
+<FONT color="green">1644</FONT>         * @exception IllegalArgumentException if e is negative<a name="line.1644"></a>
+<FONT color="green">1645</FONT>         */<a name="line.1645"></a>
+<FONT color="green">1646</FONT>        public static BigInteger pow(final BigInteger k, long e)<a name="line.1646"></a>
+<FONT color="green">1647</FONT>            throws IllegalArgumentException {<a name="line.1647"></a>
+<FONT color="green">1648</FONT>    <a name="line.1648"></a>
+<FONT color="green">1649</FONT>            if (e &lt; 0) {<a name="line.1649"></a>
+<FONT color="green">1650</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1650"></a>
+<FONT color="green">1651</FONT>                    "cannot raise an integral value to a negative power ({0}^{1})",<a name="line.1651"></a>
+<FONT color="green">1652</FONT>                    k, e);<a name="line.1652"></a>
+<FONT color="green">1653</FONT>            }<a name="line.1653"></a>
+<FONT color="green">1654</FONT>    <a name="line.1654"></a>
+<FONT color="green">1655</FONT>            BigInteger result = BigInteger.ONE;<a name="line.1655"></a>
+<FONT color="green">1656</FONT>            BigInteger k2p    = k;<a name="line.1656"></a>
+<FONT color="green">1657</FONT>            while (e != 0) {<a name="line.1657"></a>
+<FONT color="green">1658</FONT>                if ((e &amp; 0x1) != 0) {<a name="line.1658"></a>
+<FONT color="green">1659</FONT>                    result = result.multiply(k2p);<a name="line.1659"></a>
+<FONT color="green">1660</FONT>                }<a name="line.1660"></a>
+<FONT color="green">1661</FONT>                k2p = k2p.multiply(k2p);<a name="line.1661"></a>
+<FONT color="green">1662</FONT>                e = e &gt;&gt; 1;<a name="line.1662"></a>
+<FONT color="green">1663</FONT>            }<a name="line.1663"></a>
+<FONT color="green">1664</FONT>    <a name="line.1664"></a>
+<FONT color="green">1665</FONT>            return result;<a name="line.1665"></a>
+<FONT color="green">1666</FONT>    <a name="line.1666"></a>
+<FONT color="green">1667</FONT>        }<a name="line.1667"></a>
+<FONT color="green">1668</FONT>    <a name="line.1668"></a>
+<FONT color="green">1669</FONT>        /**<a name="line.1669"></a>
+<FONT color="green">1670</FONT>         * Raise a BigInteger to a BigInteger power.<a name="line.1670"></a>
+<FONT color="green">1671</FONT>         * @param k number to raise<a name="line.1671"></a>
+<FONT color="green">1672</FONT>         * @param e exponent (must be positive or null)<a name="line.1672"></a>
+<FONT color="green">1673</FONT>         * @return k&lt;sup&gt;e&lt;/sup&gt;<a name="line.1673"></a>
+<FONT color="green">1674</FONT>         * @exception IllegalArgumentException if e is negative<a name="line.1674"></a>
+<FONT color="green">1675</FONT>         */<a name="line.1675"></a>
+<FONT color="green">1676</FONT>        public static BigInteger pow(final BigInteger k, BigInteger e)<a name="line.1676"></a>
+<FONT color="green">1677</FONT>            throws IllegalArgumentException {<a name="line.1677"></a>
+<FONT color="green">1678</FONT>    <a name="line.1678"></a>
+<FONT color="green">1679</FONT>            if (e.compareTo(BigInteger.ZERO) &lt; 0) {<a name="line.1679"></a>
+<FONT color="green">1680</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.1680"></a>
+<FONT color="green">1681</FONT>                    "cannot raise an integral value to a negative power ({0}^{1})",<a name="line.1681"></a>
+<FONT color="green">1682</FONT>                    k, e);<a name="line.1682"></a>
+<FONT color="green">1683</FONT>            }<a name="line.1683"></a>
+<FONT color="green">1684</FONT>    <a name="line.1684"></a>
+<FONT color="green">1685</FONT>            BigInteger result = BigInteger.ONE;<a name="line.1685"></a>
+<FONT color="green">1686</FONT>            BigInteger k2p    = k;<a name="line.1686"></a>
+<FONT color="green">1687</FONT>            while (!BigInteger.ZERO.equals(e)) {<a name="line.1687"></a>
+<FONT color="green">1688</FONT>                if (e.testBit(0)) {<a name="line.1688"></a>
+<FONT color="green">1689</FONT>                    result = result.multiply(k2p);<a name="line.1689"></a>
+<FONT color="green">1690</FONT>                }<a name="line.1690"></a>
+<FONT color="green">1691</FONT>                k2p = k2p.multiply(k2p);<a name="line.1691"></a>
+<FONT color="green">1692</FONT>                e = e.shiftRight(1);<a name="line.1692"></a>
+<FONT color="green">1693</FONT>            }<a name="line.1693"></a>
+<FONT color="green">1694</FONT>    <a name="line.1694"></a>
+<FONT color="green">1695</FONT>            return result;<a name="line.1695"></a>
+<FONT color="green">1696</FONT>    <a name="line.1696"></a>
+<FONT color="green">1697</FONT>        }<a name="line.1697"></a>
+<FONT color="green">1698</FONT>    <a name="line.1698"></a>
+<FONT color="green">1699</FONT>        /**<a name="line.1699"></a>
+<FONT color="green">1700</FONT>         * Calculates the L&lt;sub&gt;1&lt;/sub&gt; (sum of abs) distance between two points.<a name="line.1700"></a>
+<FONT color="green">1701</FONT>         *<a name="line.1701"></a>
+<FONT color="green">1702</FONT>         * @param p1 the first point<a name="line.1702"></a>
+<FONT color="green">1703</FONT>         * @param p2 the second point<a name="line.1703"></a>
+<FONT color="green">1704</FONT>         * @return the L&lt;sub&gt;1&lt;/sub&gt; distance between the two points<a name="line.1704"></a>
+<FONT color="green">1705</FONT>         */<a name="line.1705"></a>
+<FONT color="green">1706</FONT>        public static double distance1(double[] p1, double[] p2) {<a name="line.1706"></a>
+<FONT color="green">1707</FONT>            double sum = 0;<a name="line.1707"></a>
+<FONT color="green">1708</FONT>            for (int i = 0; i &lt; p1.length; i++) {<a name="line.1708"></a>
+<FONT color="green">1709</FONT>                sum += Math.abs(p1[i] - p2[i]);<a name="line.1709"></a>
+<FONT color="green">1710</FONT>            }<a name="line.1710"></a>
+<FONT color="green">1711</FONT>            return sum;<a name="line.1711"></a>
+<FONT color="green">1712</FONT>        }<a name="line.1712"></a>
+<FONT color="green">1713</FONT>    <a name="line.1713"></a>
+<FONT color="green">1714</FONT>        /**<a name="line.1714"></a>
+<FONT color="green">1715</FONT>         * Calculates the L&lt;sub&gt;1&lt;/sub&gt; (sum of abs) distance between two points.<a name="line.1715"></a>
+<FONT color="green">1716</FONT>         *<a name="line.1716"></a>
+<FONT color="green">1717</FONT>         * @param p1 the first point<a name="line.1717"></a>
+<FONT color="green">1718</FONT>         * @param p2 the second point<a name="line.1718"></a>
+<FONT color="green">1719</FONT>         * @return the L&lt;sub&gt;1&lt;/sub&gt; distance between the two points<a name="line.1719"></a>
+<FONT color="green">1720</FONT>         */<a name="line.1720"></a>
+<FONT color="green">1721</FONT>        public static int distance1(int[] p1, int[] p2) {<a name="line.1721"></a>
+<FONT color="green">1722</FONT>          int sum = 0;<a name="line.1722"></a>
+<FONT color="green">1723</FONT>          for (int i = 0; i &lt; p1.length; i++) {<a name="line.1723"></a>
+<FONT color="green">1724</FONT>              sum += Math.abs(p1[i] - p2[i]);<a name="line.1724"></a>
+<FONT color="green">1725</FONT>          }<a name="line.1725"></a>
+<FONT color="green">1726</FONT>          return sum;<a name="line.1726"></a>
+<FONT color="green">1727</FONT>        }<a name="line.1727"></a>
+<FONT color="green">1728</FONT>    <a name="line.1728"></a>
+<FONT color="green">1729</FONT>        /**<a name="line.1729"></a>
+<FONT color="green">1730</FONT>         * Calculates the L&lt;sub&gt;2&lt;/sub&gt; (Euclidean) distance between two points.<a name="line.1730"></a>
+<FONT color="green">1731</FONT>         *<a name="line.1731"></a>
+<FONT color="green">1732</FONT>         * @param p1 the first point<a name="line.1732"></a>
+<FONT color="green">1733</FONT>         * @param p2 the second point<a name="line.1733"></a>
+<FONT color="green">1734</FONT>         * @return the L&lt;sub&gt;2&lt;/sub&gt; distance between the two points<a name="line.1734"></a>
+<FONT color="green">1735</FONT>         */<a name="line.1735"></a>
+<FONT color="green">1736</FONT>        public static double distance(double[] p1, double[] p2) {<a name="line.1736"></a>
+<FONT color="green">1737</FONT>            double sum = 0;<a name="line.1737"></a>
+<FONT color="green">1738</FONT>            for (int i = 0; i &lt; p1.length; i++) {<a name="line.1738"></a>
+<FONT color="green">1739</FONT>                final double dp = p1[i] - p2[i];<a name="line.1739"></a>
+<FONT color="green">1740</FONT>                sum += dp * dp;<a name="line.1740"></a>
+<FONT color="green">1741</FONT>            }<a name="line.1741"></a>
+<FONT color="green">1742</FONT>            return Math.sqrt(sum);<a name="line.1742"></a>
+<FONT color="green">1743</FONT>        }<a name="line.1743"></a>
+<FONT color="green">1744</FONT>    <a name="line.1744"></a>
+<FONT color="green">1745</FONT>        /**<a name="line.1745"></a>
+<FONT color="green">1746</FONT>         * Calculates the L&lt;sub&gt;2&lt;/sub&gt; (Euclidean) distance between two points.<a name="line.1746"></a>
+<FONT color="green">1747</FONT>         *<a name="line.1747"></a>
+<FONT color="green">1748</FONT>         * @param p1 the first point<a name="line.1748"></a>
+<FONT color="green">1749</FONT>         * @param p2 the second point<a name="line.1749"></a>
+<FONT color="green">1750</FONT>         * @return the L&lt;sub&gt;2&lt;/sub&gt; distance between the two points<a name="line.1750"></a>
+<FONT color="green">1751</FONT>         */<a name="line.1751"></a>
+<FONT color="green">1752</FONT>        public static double distance(int[] p1, int[] p2) {<a name="line.1752"></a>
+<FONT color="green">1753</FONT>          double sum = 0;<a name="line.1753"></a>
+<FONT color="green">1754</FONT>          for (int i = 0; i &lt; p1.length; i++) {<a name="line.1754"></a>
+<FONT color="green">1755</FONT>              final double dp = p1[i] - p2[i];<a name="line.1755"></a>
+<FONT color="green">1756</FONT>              sum += dp * dp;<a name="line.1756"></a>
+<FONT color="green">1757</FONT>          }<a name="line.1757"></a>
+<FONT color="green">1758</FONT>          return Math.sqrt(sum);<a name="line.1758"></a>
+<FONT color="green">1759</FONT>        }<a name="line.1759"></a>
+<FONT color="green">1760</FONT>    <a name="line.1760"></a>
+<FONT color="green">1761</FONT>        /**<a name="line.1761"></a>
+<FONT color="green">1762</FONT>         * Calculates the L&lt;sub&gt;&amp;infin;&lt;/sub&gt; (max of abs) distance between two points.<a name="line.1762"></a>
+<FONT color="green">1763</FONT>         *<a name="line.1763"></a>
+<FONT color="green">1764</FONT>         * @param p1 the first point<a name="line.1764"></a>
+<FONT color="green">1765</FONT>         * @param p2 the second point<a name="line.1765"></a>
+<FONT color="green">1766</FONT>         * @return the L&lt;sub&gt;&amp;infin;&lt;/sub&gt; distance between the two points<a name="line.1766"></a>
+<FONT color="green">1767</FONT>         */<a name="line.1767"></a>
+<FONT color="green">1768</FONT>        public static double distanceInf(double[] p1, double[] p2) {<a name="line.1768"></a>
+<FONT color="green">1769</FONT>            double max = 0;<a name="line.1769"></a>
+<FONT color="green">1770</FONT>            for (int i = 0; i &lt; p1.length; i++) {<a name="line.1770"></a>
+<FONT color="green">1771</FONT>                max = Math.max(max, Math.abs(p1[i] - p2[i]));<a name="line.1771"></a>
+<FONT color="green">1772</FONT>            }<a name="line.1772"></a>
+<FONT color="green">1773</FONT>            return max;<a name="line.1773"></a>
+<FONT color="green">1774</FONT>        }<a name="line.1774"></a>
+<FONT color="green">1775</FONT>    <a name="line.1775"></a>
+<FONT color="green">1776</FONT>        /**<a name="line.1776"></a>
+<FONT color="green">1777</FONT>         * Calculates the L&lt;sub&gt;&amp;infin;&lt;/sub&gt; (max of abs) distance between two points.<a name="line.1777"></a>
+<FONT color="green">1778</FONT>         *<a name="line.1778"></a>
+<FONT color="green">1779</FONT>         * @param p1 the first point<a name="line.1779"></a>
+<FONT color="green">1780</FONT>         * @param p2 the second point<a name="line.1780"></a>
+<FONT color="green">1781</FONT>         * @return the L&lt;sub&gt;&amp;infin;&lt;/sub&gt; distance between the two points<a name="line.1781"></a>
+<FONT color="green">1782</FONT>         */<a name="line.1782"></a>
+<FONT color="green">1783</FONT>        public static int distanceInf(int[] p1, int[] p2) {<a name="line.1783"></a>
+<FONT color="green">1784</FONT>            int max = 0;<a name="line.1784"></a>
+<FONT color="green">1785</FONT>            for (int i = 0; i &lt; p1.length; i++) {<a name="line.1785"></a>
+<FONT color="green">1786</FONT>                max = Math.max(max, Math.abs(p1[i] - p2[i]));<a name="line.1786"></a>
+<FONT color="green">1787</FONT>            }<a name="line.1787"></a>
+<FONT color="green">1788</FONT>            return max;<a name="line.1788"></a>
+<FONT color="green">1789</FONT>        }<a name="line.1789"></a>
+<FONT color="green">1790</FONT>    <a name="line.1790"></a>
+<FONT color="green">1791</FONT>        /**<a name="line.1791"></a>
+<FONT color="green">1792</FONT>         * Checks that the given array is sorted.<a name="line.1792"></a>
+<FONT color="green">1793</FONT>         *<a name="line.1793"></a>
+<FONT color="green">1794</FONT>         * @param val Values<a name="line.1794"></a>
+<FONT color="green">1795</FONT>         * @param dir Order direction (-1 for decreasing, 1 for increasing)<a name="line.1795"></a>
+<FONT color="green">1796</FONT>         * @param strict Whether the order should be strict<a name="line.1796"></a>
+<FONT color="green">1797</FONT>         * @throws IllegalArgumentException if the array is not sorted.<a name="line.1797"></a>
+<FONT color="green">1798</FONT>         */<a name="line.1798"></a>
+<FONT color="green">1799</FONT>        public static void checkOrder(double[] val, int dir, boolean strict) {<a name="line.1799"></a>
+<FONT color="green">1800</FONT>            double previous = val[0];<a name="line.1800"></a>
+<FONT color="green">1801</FONT>    <a name="line.1801"></a>
+<FONT color="green">1802</FONT>            int max = val.length;<a name="line.1802"></a>
+<FONT color="green">1803</FONT>            for (int i = 1; i &lt; max; i++) {<a name="line.1803"></a>
+<FONT color="green">1804</FONT>                if (dir &gt; 0) {<a name="line.1804"></a>
+<FONT color="green">1805</FONT>                    if (strict) {<a name="line.1805"></a>
+<FONT color="green">1806</FONT>                        if (val[i] &lt;= previous) {<a name="line.1806"></a>
+<FONT color="green">1807</FONT>                            throw MathRuntimeException.createIllegalArgumentException("points {0} and {1} are not strictly increasing ({2} &gt;= {3})",<a name="line.1807"></a>
+<FONT color="green">1808</FONT>                                                                                      i - 1, i, previous, val[i]);<a name="line.1808"></a>
+<FONT color="green">1809</FONT>                        }<a name="line.1809"></a>
+<FONT color="green">1810</FONT>                    } else {<a name="line.1810"></a>
+<FONT color="green">1811</FONT>                        if (val[i] &lt; previous) {<a name="line.1811"></a>
+<FONT color="green">1812</FONT>                            throw MathRuntimeException.createIllegalArgumentException("points {0} and {1} are not increasing ({2} &gt; {3})",<a name="line.1812"></a>
+<FONT color="green">1813</FONT>                                                                                      i - 1, i, previous, val[i]);<a name="line.1813"></a>
+<FONT color="green">1814</FONT>                        }<a name="line.1814"></a>
+<FONT color="green">1815</FONT>                    }<a name="line.1815"></a>
+<FONT color="green">1816</FONT>                } else {<a name="line.1816"></a>
+<FONT color="green">1817</FONT>                    if (strict) {<a name="line.1817"></a>
+<FONT color="green">1818</FONT>                        if (val[i] &gt;= previous) {<a name="line.1818"></a>
+<FONT color="green">1819</FONT>                            throw MathRuntimeException.createIllegalArgumentException("points {0} and {1} are not strictly decreasing ({2} &lt;= {3})",<a name="line.1819"></a>
+<FONT color="green">1820</FONT>                                                                                      i - 1, i, previous, val[i]);<a name="line.1820"></a>
+<FONT color="green">1821</FONT>                        }<a name="line.1821"></a>
+<FONT color="green">1822</FONT>                    } else {<a name="line.1822"></a>
+<FONT color="green">1823</FONT>                        if (val[i] &gt; previous) {<a name="line.1823"></a>
+<FONT color="green">1824</FONT>                            throw MathRuntimeException.createIllegalArgumentException("points {0} and {1} are not decreasing ({2} &lt; {3})",<a name="line.1824"></a>
+<FONT color="green">1825</FONT>                                                                                      i - 1, i, previous, val[i]);<a name="line.1825"></a>
+<FONT color="green">1826</FONT>                        }<a name="line.1826"></a>
+<FONT color="green">1827</FONT>                    }<a name="line.1827"></a>
+<FONT color="green">1828</FONT>                }<a name="line.1828"></a>
+<FONT color="green">1829</FONT>    <a name="line.1829"></a>
+<FONT color="green">1830</FONT>                previous = val[i];<a name="line.1830"></a>
+<FONT color="green">1831</FONT>            }<a name="line.1831"></a>
+<FONT color="green">1832</FONT>        }<a name="line.1832"></a>
+<FONT color="green">1833</FONT>    }<a name="line.1833"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/NumberTransformer.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,105 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.util;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import org.apache.commons.math.MathException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    <a name="line.20"></a>
+<FONT color="green">021</FONT>    /**<a name="line.21"></a>
+<FONT color="green">022</FONT>     * Subclasses implementing this interface can transform Objects to doubles.<a name="line.22"></a>
+<FONT color="green">023</FONT>     * @version $Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $<a name="line.23"></a>
+<FONT color="green">024</FONT>     *<a name="line.24"></a>
+<FONT color="green">025</FONT>     * No longer extends Serializable since 2.0<a name="line.25"></a>
+<FONT color="green">026</FONT>     *<a name="line.26"></a>
+<FONT color="green">027</FONT>     */<a name="line.27"></a>
+<FONT color="green">028</FONT>    public interface NumberTransformer {<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>        /**<a name="line.30"></a>
+<FONT color="green">031</FONT>         * Implementing this interface provides a facility to transform<a name="line.31"></a>
+<FONT color="green">032</FONT>         * from Object to Double.<a name="line.32"></a>
+<FONT color="green">033</FONT>         *<a name="line.33"></a>
+<FONT color="green">034</FONT>         * @param o the Object to be transformed.<a name="line.34"></a>
+<FONT color="green">035</FONT>         * @return the double value of the Object.<a name="line.35"></a>
+<FONT color="green">036</FONT>         * @throws MathException if the Object can not be transformed into a Double.<a name="line.36"></a>
+<FONT color="green">037</FONT>         */<a name="line.37"></a>
+<FONT color="green">038</FONT>        double transform(Object o) throws MathException;<a name="line.38"></a>
+<FONT color="green">039</FONT>    }<a name="line.39"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/OpenIntToDoubleHashMap.Iterator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,676 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.util;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.IOException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.io.ObjectInputStream;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.io.Serializable;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.util.ConcurrentModificationException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import java.util.NoSuchElementException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    /**<a name="line.28"></a>
+<FONT color="green">029</FONT>     * Open addressed map from int to double.<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;p&gt;This class provides a dedicated map from integers to doubles with a<a name="line.30"></a>
+<FONT color="green">031</FONT>     * much smaller memory overhead than standard &lt;code&gt;java.util.Map&lt;/code&gt;.&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;This class is not synchronized. The specialized iterators returned by<a name="line.32"></a>
+<FONT color="green">033</FONT>     * {@link #iterator()} are fail-fast: they throw a<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;code&gt;ConcurrentModificationException&lt;/code&gt; when they detect the map has been<a name="line.34"></a>
+<FONT color="green">035</FONT>     * modified during iteration.&lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @version $Revision: 885278 $ $Date: 2009-11-29 16:47:51 -0500 (Sun, 29 Nov 2009) $<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @since 2.0<a name="line.37"></a>
+<FONT color="green">038</FONT>     */<a name="line.38"></a>
+<FONT color="green">039</FONT>    public class OpenIntToDoubleHashMap implements Serializable {<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Status indicator for free table entries. */<a name="line.41"></a>
+<FONT color="green">042</FONT>        protected static final byte FREE    = 0;<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Status indicator for full table entries. */<a name="line.44"></a>
+<FONT color="green">045</FONT>        protected static final byte FULL    = 1;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** Status indicator for removed table entries. */<a name="line.47"></a>
+<FONT color="green">048</FONT>        protected static final byte REMOVED = 2;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Serializable version identifier */<a name="line.50"></a>
+<FONT color="green">051</FONT>        private static final long serialVersionUID = -3646337053166149105L;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** Message for map modification during iteration. */<a name="line.53"></a>
+<FONT color="green">054</FONT>        private static final String CONCURRENT_MODIFICATION_MESSAGE =<a name="line.54"></a>
+<FONT color="green">055</FONT>            "map has been modified while iterating";<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /** Message for exhausted iterator. */<a name="line.57"></a>
+<FONT color="green">058</FONT>        private static final String EXHAUSTED_ITERATOR_MESSAGE =<a name="line.58"></a>
+<FONT color="green">059</FONT>            "iterator exhausted";<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /** Load factor for the map. */<a name="line.61"></a>
+<FONT color="green">062</FONT>        private static final float LOAD_FACTOR = 0.5f;<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /** Default starting size.<a name="line.64"></a>
+<FONT color="green">065</FONT>         * &lt;p&gt;This must be a power of two for bit mask to work properly. &lt;/p&gt;<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        private static final int DEFAULT_EXPECTED_SIZE = 16;<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /** Multiplier for size growth when map fills up.<a name="line.69"></a>
+<FONT color="green">070</FONT>         * &lt;p&gt;This must be a power of two for bit mask to work properly. &lt;/p&gt;<a name="line.70"></a>
+<FONT color="green">071</FONT>         */<a name="line.71"></a>
+<FONT color="green">072</FONT>        private static final int RESIZE_MULTIPLIER = 2;<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /** Number of bits to perturb the index when probing for collision resolution. */<a name="line.74"></a>
+<FONT color="green">075</FONT>        private static final int PERTURB_SHIFT = 5;<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** Keys table. */<a name="line.77"></a>
+<FONT color="green">078</FONT>        private int[] keys;<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /** Values table. */<a name="line.80"></a>
+<FONT color="green">081</FONT>        private double[] values;<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /** States table. */<a name="line.83"></a>
+<FONT color="green">084</FONT>        private byte[] states;<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /** Return value for missing entries. */<a name="line.86"></a>
+<FONT color="green">087</FONT>        private final double missingEntries;<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /** Current size of the map. */<a name="line.89"></a>
+<FONT color="green">090</FONT>        private int size;<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /** Bit mask for hash values. */<a name="line.92"></a>
+<FONT color="green">093</FONT>        private int mask;<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /** Modifications count. */<a name="line.95"></a>
+<FONT color="green">096</FONT>        private transient int count;<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /**<a name="line.98"></a>
+<FONT color="green">099</FONT>         * Build an empty map with default size and using NaN for missing entries.<a name="line.99"></a>
+<FONT color="green">100</FONT>         */<a name="line.100"></a>
+<FONT color="green">101</FONT>        public OpenIntToDoubleHashMap() {<a name="line.101"></a>
+<FONT color="green">102</FONT>            this(DEFAULT_EXPECTED_SIZE, Double.NaN);<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /**<a name="line.105"></a>
+<FONT color="green">106</FONT>         * Build an empty map with default size<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @param missingEntries value to return when a missing entry is fetched<a name="line.107"></a>
+<FONT color="green">108</FONT>         */<a name="line.108"></a>
+<FONT color="green">109</FONT>        public OpenIntToDoubleHashMap(final double missingEntries) {<a name="line.109"></a>
+<FONT color="green">110</FONT>            this(DEFAULT_EXPECTED_SIZE, missingEntries);<a name="line.110"></a>
+<FONT color="green">111</FONT>        }<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>        /**<a name="line.113"></a>
+<FONT color="green">114</FONT>         * Build an empty map with specified size and using NaN for missing entries.<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @param expectedSize expected number of elements in the map<a name="line.115"></a>
+<FONT color="green">116</FONT>         */<a name="line.116"></a>
+<FONT color="green">117</FONT>        public OpenIntToDoubleHashMap(final int expectedSize) {<a name="line.117"></a>
+<FONT color="green">118</FONT>            this(expectedSize, Double.NaN);<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /**<a name="line.121"></a>
+<FONT color="green">122</FONT>         * Build an empty map with specified size.<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @param expectedSize expected number of elements in the map<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @param missingEntries value to return when a missing entry is fetched<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        public OpenIntToDoubleHashMap(final int expectedSize,<a name="line.126"></a>
+<FONT color="green">127</FONT>                                      final double missingEntries) {<a name="line.127"></a>
+<FONT color="green">128</FONT>            final int capacity = computeCapacity(expectedSize);<a name="line.128"></a>
+<FONT color="green">129</FONT>            keys   = new int[capacity];<a name="line.129"></a>
+<FONT color="green">130</FONT>            values = new double[capacity];<a name="line.130"></a>
+<FONT color="green">131</FONT>            states = new byte[capacity];<a name="line.131"></a>
+<FONT color="green">132</FONT>            this.missingEntries = missingEntries;<a name="line.132"></a>
+<FONT color="green">133</FONT>            mask   = capacity - 1;<a name="line.133"></a>
+<FONT color="green">134</FONT>        }<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>        /**<a name="line.136"></a>
+<FONT color="green">137</FONT>         * Copy constructor.<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @param source map to copy<a name="line.138"></a>
+<FONT color="green">139</FONT>         */<a name="line.139"></a>
+<FONT color="green">140</FONT>        public OpenIntToDoubleHashMap(final OpenIntToDoubleHashMap source) {<a name="line.140"></a>
+<FONT color="green">141</FONT>            final int length = source.keys.length;<a name="line.141"></a>
+<FONT color="green">142</FONT>            keys = new int[length];<a name="line.142"></a>
+<FONT color="green">143</FONT>            System.arraycopy(source.keys, 0, keys, 0, length);<a name="line.143"></a>
+<FONT color="green">144</FONT>            values = new double[length];<a name="line.144"></a>
+<FONT color="green">145</FONT>            System.arraycopy(source.values, 0, values, 0, length);<a name="line.145"></a>
+<FONT color="green">146</FONT>            states = new byte[length];<a name="line.146"></a>
+<FONT color="green">147</FONT>            System.arraycopy(source.states, 0, states, 0, length);<a name="line.147"></a>
+<FONT color="green">148</FONT>            missingEntries = source.missingEntries;<a name="line.148"></a>
+<FONT color="green">149</FONT>            size  = source.size;<a name="line.149"></a>
+<FONT color="green">150</FONT>            mask  = source.mask;<a name="line.150"></a>
+<FONT color="green">151</FONT>            count = source.count;<a name="line.151"></a>
+<FONT color="green">152</FONT>        }<a name="line.152"></a>
+<FONT color="green">153</FONT>    <a name="line.153"></a>
+<FONT color="green">154</FONT>        /**<a name="line.154"></a>
+<FONT color="green">155</FONT>         * Compute the capacity needed for a given size.<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @param expectedSize expected size of the map<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @return capacity to use for the specified size<a name="line.157"></a>
+<FONT color="green">158</FONT>         */<a name="line.158"></a>
+<FONT color="green">159</FONT>        private static int computeCapacity(final int expectedSize) {<a name="line.159"></a>
+<FONT color="green">160</FONT>            if (expectedSize == 0) {<a name="line.160"></a>
+<FONT color="green">161</FONT>                return 1;<a name="line.161"></a>
+<FONT color="green">162</FONT>            }<a name="line.162"></a>
+<FONT color="green">163</FONT>            final int capacity   = (int) Math.ceil(expectedSize / LOAD_FACTOR);<a name="line.163"></a>
+<FONT color="green">164</FONT>            final int powerOfTwo = Integer.highestOneBit(capacity);<a name="line.164"></a>
+<FONT color="green">165</FONT>            if (powerOfTwo == capacity) {<a name="line.165"></a>
+<FONT color="green">166</FONT>                return capacity;<a name="line.166"></a>
+<FONT color="green">167</FONT>            }<a name="line.167"></a>
+<FONT color="green">168</FONT>            return nextPowerOfTwo(capacity);<a name="line.168"></a>
+<FONT color="green">169</FONT>        }<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>        /**<a name="line.171"></a>
+<FONT color="green">172</FONT>         * Find the smallest power of two greater than the input value<a name="line.172"></a>
+<FONT color="green">173</FONT>         * @param i input value<a name="line.173"></a>
+<FONT color="green">174</FONT>         * @return smallest power of two greater than the input value<a name="line.174"></a>
+<FONT color="green">175</FONT>         */<a name="line.175"></a>
+<FONT color="green">176</FONT>        private static int nextPowerOfTwo(final int i) {<a name="line.176"></a>
+<FONT color="green">177</FONT>            return Integer.highestOneBit(i) &lt;&lt; 1;<a name="line.177"></a>
+<FONT color="green">178</FONT>        }<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>        /**<a name="line.180"></a>
+<FONT color="green">181</FONT>         * Get the stored value associated with the given key<a name="line.181"></a>
+<FONT color="green">182</FONT>         * @param key key associated with the data<a name="line.182"></a>
+<FONT color="green">183</FONT>         * @return data associated with the key<a name="line.183"></a>
+<FONT color="green">184</FONT>         */<a name="line.184"></a>
+<FONT color="green">185</FONT>        public double get(final int key) {<a name="line.185"></a>
+<FONT color="green">186</FONT>    <a name="line.186"></a>
+<FONT color="green">187</FONT>            final int hash  = hashOf(key);<a name="line.187"></a>
+<FONT color="green">188</FONT>            int index = hash &amp; mask;<a name="line.188"></a>
+<FONT color="green">189</FONT>            if (containsKey(key, index)) {<a name="line.189"></a>
+<FONT color="green">190</FONT>                return values[index];<a name="line.190"></a>
+<FONT color="green">191</FONT>            }<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>            if (states[index] == FREE) {<a name="line.193"></a>
+<FONT color="green">194</FONT>                return missingEntries;<a name="line.194"></a>
+<FONT color="green">195</FONT>            }<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>            int j = index;<a name="line.197"></a>
+<FONT color="green">198</FONT>            for (int perturb = perturb(hash); states[index] != FREE; perturb &gt;&gt;= PERTURB_SHIFT) {<a name="line.198"></a>
+<FONT color="green">199</FONT>                j = probe(perturb, j);<a name="line.199"></a>
+<FONT color="green">200</FONT>                index = j &amp; mask;<a name="line.200"></a>
+<FONT color="green">201</FONT>                if (containsKey(key, index)) {<a name="line.201"></a>
+<FONT color="green">202</FONT>                    return values[index];<a name="line.202"></a>
+<FONT color="green">203</FONT>                }<a name="line.203"></a>
+<FONT color="green">204</FONT>            }<a name="line.204"></a>
+<FONT color="green">205</FONT>    <a name="line.205"></a>
+<FONT color="green">206</FONT>            return missingEntries;<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>        }<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>        /**<a name="line.210"></a>
+<FONT color="green">211</FONT>         * Check if a value is associated with a key.<a name="line.211"></a>
+<FONT color="green">212</FONT>         * @param key key to check<a name="line.212"></a>
+<FONT color="green">213</FONT>         * @return true if a value is associated with key<a name="line.213"></a>
+<FONT color="green">214</FONT>         */<a name="line.214"></a>
+<FONT color="green">215</FONT>        public boolean containsKey(final int key) {<a name="line.215"></a>
+<FONT color="green">216</FONT>    <a name="line.216"></a>
+<FONT color="green">217</FONT>            final int hash  = hashOf(key);<a name="line.217"></a>
+<FONT color="green">218</FONT>            int index = hash &amp; mask;<a name="line.218"></a>
+<FONT color="green">219</FONT>            if (containsKey(key, index)) {<a name="line.219"></a>
+<FONT color="green">220</FONT>                return true;<a name="line.220"></a>
+<FONT color="green">221</FONT>            }<a name="line.221"></a>
+<FONT color="green">222</FONT>    <a name="line.222"></a>
+<FONT color="green">223</FONT>            if (states[index] == FREE) {<a name="line.223"></a>
+<FONT color="green">224</FONT>                return false;<a name="line.224"></a>
+<FONT color="green">225</FONT>            }<a name="line.225"></a>
+<FONT color="green">226</FONT>    <a name="line.226"></a>
+<FONT color="green">227</FONT>            int j = index;<a name="line.227"></a>
+<FONT color="green">228</FONT>            for (int perturb = perturb(hash); states[index] != FREE; perturb &gt;&gt;= PERTURB_SHIFT) {<a name="line.228"></a>
+<FONT color="green">229</FONT>                j = probe(perturb, j);<a name="line.229"></a>
+<FONT color="green">230</FONT>                index = j &amp; mask;<a name="line.230"></a>
+<FONT color="green">231</FONT>                if (containsKey(key, index)) {<a name="line.231"></a>
+<FONT color="green">232</FONT>                    return true;<a name="line.232"></a>
+<FONT color="green">233</FONT>                }<a name="line.233"></a>
+<FONT color="green">234</FONT>            }<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>            return false;<a name="line.236"></a>
+<FONT color="green">237</FONT>    <a name="line.237"></a>
+<FONT color="green">238</FONT>        }<a name="line.238"></a>
+<FONT color="green">239</FONT>    <a name="line.239"></a>
+<FONT color="green">240</FONT>        /**<a name="line.240"></a>
+<FONT color="green">241</FONT>         * Get an iterator over map elements.<a name="line.241"></a>
+<FONT color="green">242</FONT>         * &lt;p&gt;The specialized iterators returned are fail-fast: they throw a<a name="line.242"></a>
+<FONT color="green">243</FONT>         * &lt;code&gt;ConcurrentModificationException&lt;/code&gt; when they detect the map<a name="line.243"></a>
+<FONT color="green">244</FONT>         * has been modified during iteration.&lt;/p&gt;<a name="line.244"></a>
+<FONT color="green">245</FONT>         * @return iterator over the map elements<a name="line.245"></a>
+<FONT color="green">246</FONT>         */<a name="line.246"></a>
+<FONT color="green">247</FONT>        public Iterator iterator() {<a name="line.247"></a>
+<FONT color="green">248</FONT>            return new Iterator();<a name="line.248"></a>
+<FONT color="green">249</FONT>        }<a name="line.249"></a>
+<FONT color="green">250</FONT>    <a name="line.250"></a>
+<FONT color="green">251</FONT>        /**<a name="line.251"></a>
+<FONT color="green">252</FONT>         * Perturb the hash for starting probing.<a name="line.252"></a>
+<FONT color="green">253</FONT>         * @param hash initial hash<a name="line.253"></a>
+<FONT color="green">254</FONT>         * @return perturbed hash<a name="line.254"></a>
+<FONT color="green">255</FONT>         */<a name="line.255"></a>
+<FONT color="green">256</FONT>        private static int perturb(final int hash) {<a name="line.256"></a>
+<FONT color="green">257</FONT>            return hash &amp; 0x7fffffff;<a name="line.257"></a>
+<FONT color="green">258</FONT>        }<a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>        /**<a name="line.260"></a>
+<FONT color="green">261</FONT>         * Find the index at which a key should be inserted<a name="line.261"></a>
+<FONT color="green">262</FONT>         * @param key key to lookup<a name="line.262"></a>
+<FONT color="green">263</FONT>         * @return index at which key should be inserted<a name="line.263"></a>
+<FONT color="green">264</FONT>         */<a name="line.264"></a>
+<FONT color="green">265</FONT>        private int findInsertionIndex(final int key) {<a name="line.265"></a>
+<FONT color="green">266</FONT>            return findInsertionIndex(keys, states, key, mask);<a name="line.266"></a>
+<FONT color="green">267</FONT>        }<a name="line.267"></a>
+<FONT color="green">268</FONT>    <a name="line.268"></a>
+<FONT color="green">269</FONT>        /**<a name="line.269"></a>
+<FONT color="green">270</FONT>         * Find the index at which a key should be inserted<a name="line.270"></a>
+<FONT color="green">271</FONT>         * @param keys keys table<a name="line.271"></a>
+<FONT color="green">272</FONT>         * @param states states table<a name="line.272"></a>
+<FONT color="green">273</FONT>         * @param key key to lookup<a name="line.273"></a>
+<FONT color="green">274</FONT>         * @param mask bit mask for hash values<a name="line.274"></a>
+<FONT color="green">275</FONT>         * @return index at which key should be inserted<a name="line.275"></a>
+<FONT color="green">276</FONT>         */<a name="line.276"></a>
+<FONT color="green">277</FONT>        private static int findInsertionIndex(final int[] keys, final byte[] states,<a name="line.277"></a>
+<FONT color="green">278</FONT>                                              final int key, final int mask) {<a name="line.278"></a>
+<FONT color="green">279</FONT>            final int hash = hashOf(key);<a name="line.279"></a>
+<FONT color="green">280</FONT>            int index = hash &amp; mask;<a name="line.280"></a>
+<FONT color="green">281</FONT>            if (states[index] == FREE) {<a name="line.281"></a>
+<FONT color="green">282</FONT>                return index;<a name="line.282"></a>
+<FONT color="green">283</FONT>            } else if (states[index] == FULL &amp;&amp; keys[index] == key) {<a name="line.283"></a>
+<FONT color="green">284</FONT>                return changeIndexSign(index);<a name="line.284"></a>
+<FONT color="green">285</FONT>            }<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>            int perturb = perturb(hash);<a name="line.287"></a>
+<FONT color="green">288</FONT>            int j = index;<a name="line.288"></a>
+<FONT color="green">289</FONT>            if (states[index] == FULL) {<a name="line.289"></a>
+<FONT color="green">290</FONT>                while (true) {<a name="line.290"></a>
+<FONT color="green">291</FONT>                    j = probe(perturb, j);<a name="line.291"></a>
+<FONT color="green">292</FONT>                    index = j &amp; mask;<a name="line.292"></a>
+<FONT color="green">293</FONT>                    perturb &gt;&gt;= PERTURB_SHIFT;<a name="line.293"></a>
+<FONT color="green">294</FONT>    <a name="line.294"></a>
+<FONT color="green">295</FONT>                    if (states[index] != FULL || keys[index] == key) {<a name="line.295"></a>
+<FONT color="green">296</FONT>                        break;<a name="line.296"></a>
+<FONT color="green">297</FONT>                    }<a name="line.297"></a>
+<FONT color="green">298</FONT>                }<a name="line.298"></a>
+<FONT color="green">299</FONT>            }<a name="line.299"></a>
+<FONT color="green">300</FONT>    <a name="line.300"></a>
+<FONT color="green">301</FONT>            if (states[index] == FREE) {<a name="line.301"></a>
+<FONT color="green">302</FONT>                return index;<a name="line.302"></a>
+<FONT color="green">303</FONT>            } else if (states[index] == FULL) {<a name="line.303"></a>
+<FONT color="green">304</FONT>                // due to the loop exit condition,<a name="line.304"></a>
+<FONT color="green">305</FONT>                // if (states[index] == FULL) then keys[index] == key<a name="line.305"></a>
+<FONT color="green">306</FONT>                return changeIndexSign(index);<a name="line.306"></a>
+<FONT color="green">307</FONT>            }<a name="line.307"></a>
+<FONT color="green">308</FONT>    <a name="line.308"></a>
+<FONT color="green">309</FONT>            final int firstRemoved = index;<a name="line.309"></a>
+<FONT color="green">310</FONT>            while (true) {<a name="line.310"></a>
+<FONT color="green">311</FONT>                j = probe(perturb, j);<a name="line.311"></a>
+<FONT color="green">312</FONT>                index = j &amp; mask;<a name="line.312"></a>
+<FONT color="green">313</FONT>    <a name="line.313"></a>
+<FONT color="green">314</FONT>                if (states[index] == FREE) {<a name="line.314"></a>
+<FONT color="green">315</FONT>                    return firstRemoved;<a name="line.315"></a>
+<FONT color="green">316</FONT>                } else if (states[index] == FULL &amp;&amp; keys[index] == key) {<a name="line.316"></a>
+<FONT color="green">317</FONT>                    return changeIndexSign(index);<a name="line.317"></a>
+<FONT color="green">318</FONT>                }<a name="line.318"></a>
+<FONT color="green">319</FONT>    <a name="line.319"></a>
+<FONT color="green">320</FONT>                perturb &gt;&gt;= PERTURB_SHIFT;<a name="line.320"></a>
+<FONT color="green">321</FONT>    <a name="line.321"></a>
+<FONT color="green">322</FONT>            }<a name="line.322"></a>
+<FONT color="green">323</FONT>    <a name="line.323"></a>
+<FONT color="green">324</FONT>        }<a name="line.324"></a>
+<FONT color="green">325</FONT>    <a name="line.325"></a>
+<FONT color="green">326</FONT>        /**<a name="line.326"></a>
+<FONT color="green">327</FONT>         * Compute next probe for collision resolution<a name="line.327"></a>
+<FONT color="green">328</FONT>         * @param perturb perturbed hash<a name="line.328"></a>
+<FONT color="green">329</FONT>         * @param j previous probe<a name="line.329"></a>
+<FONT color="green">330</FONT>         * @return next probe<a name="line.330"></a>
+<FONT color="green">331</FONT>         */<a name="line.331"></a>
+<FONT color="green">332</FONT>        private static int probe(final int perturb, final int j) {<a name="line.332"></a>
+<FONT color="green">333</FONT>            return (j &lt;&lt; 2) + j + perturb + 1;<a name="line.333"></a>
+<FONT color="green">334</FONT>        }<a name="line.334"></a>
+<FONT color="green">335</FONT>    <a name="line.335"></a>
+<FONT color="green">336</FONT>        /**<a name="line.336"></a>
+<FONT color="green">337</FONT>         * Change the index sign<a name="line.337"></a>
+<FONT color="green">338</FONT>         * @param index initial index<a name="line.338"></a>
+<FONT color="green">339</FONT>         * @return changed index<a name="line.339"></a>
+<FONT color="green">340</FONT>         */<a name="line.340"></a>
+<FONT color="green">341</FONT>        private static int changeIndexSign(final int index) {<a name="line.341"></a>
+<FONT color="green">342</FONT>            return -index - 1;<a name="line.342"></a>
+<FONT color="green">343</FONT>        }<a name="line.343"></a>
+<FONT color="green">344</FONT>    <a name="line.344"></a>
+<FONT color="green">345</FONT>        /**<a name="line.345"></a>
+<FONT color="green">346</FONT>         * Get the number of elements stored in the map.<a name="line.346"></a>
+<FONT color="green">347</FONT>         * @return number of elements stored in the map<a name="line.347"></a>
+<FONT color="green">348</FONT>         */<a name="line.348"></a>
+<FONT color="green">349</FONT>        public int size() {<a name="line.349"></a>
+<FONT color="green">350</FONT>            return size;<a name="line.350"></a>
+<FONT color="green">351</FONT>        }<a name="line.351"></a>
+<FONT color="green">352</FONT>    <a name="line.352"></a>
+<FONT color="green">353</FONT>    <a name="line.353"></a>
+<FONT color="green">354</FONT>        /**<a name="line.354"></a>
+<FONT color="green">355</FONT>         * Remove the value associated with a key.<a name="line.355"></a>
+<FONT color="green">356</FONT>         * @param key key to which the value is associated<a name="line.356"></a>
+<FONT color="green">357</FONT>         * @return removed value<a name="line.357"></a>
+<FONT color="green">358</FONT>         */<a name="line.358"></a>
+<FONT color="green">359</FONT>        public double remove(final int key) {<a name="line.359"></a>
+<FONT color="green">360</FONT>    <a name="line.360"></a>
+<FONT color="green">361</FONT>            final int hash  = hashOf(key);<a name="line.361"></a>
+<FONT color="green">362</FONT>            int index = hash &amp; mask;<a name="line.362"></a>
+<FONT color="green">363</FONT>            if (containsKey(key, index)) {<a name="line.363"></a>
+<FONT color="green">364</FONT>                return doRemove(index);<a name="line.364"></a>
+<FONT color="green">365</FONT>            }<a name="line.365"></a>
+<FONT color="green">366</FONT>    <a name="line.366"></a>
+<FONT color="green">367</FONT>            if (states[index] == FREE) {<a name="line.367"></a>
+<FONT color="green">368</FONT>                return missingEntries;<a name="line.368"></a>
+<FONT color="green">369</FONT>            }<a name="line.369"></a>
+<FONT color="green">370</FONT>    <a name="line.370"></a>
+<FONT color="green">371</FONT>            int j = index;<a name="line.371"></a>
+<FONT color="green">372</FONT>            for (int perturb = perturb(hash); states[index] != FREE; perturb &gt;&gt;= PERTURB_SHIFT) {<a name="line.372"></a>
+<FONT color="green">373</FONT>                j = probe(perturb, j);<a name="line.373"></a>
+<FONT color="green">374</FONT>                index = j &amp; mask;<a name="line.374"></a>
+<FONT color="green">375</FONT>                if (containsKey(key, index)) {<a name="line.375"></a>
+<FONT color="green">376</FONT>                    return doRemove(index);<a name="line.376"></a>
+<FONT color="green">377</FONT>                }<a name="line.377"></a>
+<FONT color="green">378</FONT>            }<a name="line.378"></a>
+<FONT color="green">379</FONT>    <a name="line.379"></a>
+<FONT color="green">380</FONT>            return missingEntries;<a name="line.380"></a>
+<FONT color="green">381</FONT>    <a name="line.381"></a>
+<FONT color="green">382</FONT>        }<a name="line.382"></a>
+<FONT color="green">383</FONT>    <a name="line.383"></a>
+<FONT color="green">384</FONT>        /**<a name="line.384"></a>
+<FONT color="green">385</FONT>         * Check if the tables contain an element associated with specified key<a name="line.385"></a>
+<FONT color="green">386</FONT>         * at specified index.<a name="line.386"></a>
+<FONT color="green">387</FONT>         * @param key key to check<a name="line.387"></a>
+<FONT color="green">388</FONT>         * @param index index to check<a name="line.388"></a>
+<FONT color="green">389</FONT>         * @return true if an element is associated with key at index<a name="line.389"></a>
+<FONT color="green">390</FONT>         */<a name="line.390"></a>
+<FONT color="green">391</FONT>        private boolean containsKey(final int key, final int index) {<a name="line.391"></a>
+<FONT color="green">392</FONT>            return (key != 0 || states[index] == FULL) &amp;&amp; keys[index] == key;<a name="line.392"></a>
+<FONT color="green">393</FONT>        }<a name="line.393"></a>
+<FONT color="green">394</FONT>    <a name="line.394"></a>
+<FONT color="green">395</FONT>        /**<a name="line.395"></a>
+<FONT color="green">396</FONT>         * Remove an element at specified index.<a name="line.396"></a>
+<FONT color="green">397</FONT>         * @param index index of the element to remove<a name="line.397"></a>
+<FONT color="green">398</FONT>         * @return removed value<a name="line.398"></a>
+<FONT color="green">399</FONT>         */<a name="line.399"></a>
+<FONT color="green">400</FONT>        private double doRemove(int index) {<a name="line.400"></a>
+<FONT color="green">401</FONT>            keys[index]   = 0;<a name="line.401"></a>
+<FONT color="green">402</FONT>            states[index] = REMOVED;<a name="line.402"></a>
+<FONT color="green">403</FONT>            final double previous = values[index];<a name="line.403"></a>
+<FONT color="green">404</FONT>            values[index] = missingEntries;<a name="line.404"></a>
+<FONT color="green">405</FONT>            --size;<a name="line.405"></a>
+<FONT color="green">406</FONT>            ++count;<a name="line.406"></a>
+<FONT color="green">407</FONT>            return previous;<a name="line.407"></a>
+<FONT color="green">408</FONT>        }<a name="line.408"></a>
+<FONT color="green">409</FONT>    <a name="line.409"></a>
+<FONT color="green">410</FONT>        /**<a name="line.410"></a>
+<FONT color="green">411</FONT>         * Put a value associated with a key in the map.<a name="line.411"></a>
+<FONT color="green">412</FONT>         * @param key key to which value is associated<a name="line.412"></a>
+<FONT color="green">413</FONT>         * @param value value to put in the map<a name="line.413"></a>
+<FONT color="green">414</FONT>         * @return previous value associated with the key<a name="line.414"></a>
+<FONT color="green">415</FONT>         */<a name="line.415"></a>
+<FONT color="green">416</FONT>        public double put(final int key, final double value) {<a name="line.416"></a>
+<FONT color="green">417</FONT>            int index = findInsertionIndex(key);<a name="line.417"></a>
+<FONT color="green">418</FONT>            double previous = missingEntries;<a name="line.418"></a>
+<FONT color="green">419</FONT>            boolean newMapping = true;<a name="line.419"></a>
+<FONT color="green">420</FONT>            if (index &lt; 0) {<a name="line.420"></a>
+<FONT color="green">421</FONT>                index = changeIndexSign(index);<a name="line.421"></a>
+<FONT color="green">422</FONT>                previous = values[index];<a name="line.422"></a>
+<FONT color="green">423</FONT>                newMapping = false;<a name="line.423"></a>
+<FONT color="green">424</FONT>            }<a name="line.424"></a>
+<FONT color="green">425</FONT>            keys[index]   = key;<a name="line.425"></a>
+<FONT color="green">426</FONT>            states[index] = FULL;<a name="line.426"></a>
+<FONT color="green">427</FONT>            values[index] = value;<a name="line.427"></a>
+<FONT color="green">428</FONT>            if (newMapping) {<a name="line.428"></a>
+<FONT color="green">429</FONT>                ++size;<a name="line.429"></a>
+<FONT color="green">430</FONT>                if (shouldGrowTable()) {<a name="line.430"></a>
+<FONT color="green">431</FONT>                    growTable();<a name="line.431"></a>
+<FONT color="green">432</FONT>                }<a name="line.432"></a>
+<FONT color="green">433</FONT>                ++count;<a name="line.433"></a>
+<FONT color="green">434</FONT>            }<a name="line.434"></a>
+<FONT color="green">435</FONT>            return previous;<a name="line.435"></a>
+<FONT color="green">436</FONT>    <a name="line.436"></a>
+<FONT color="green">437</FONT>        }<a name="line.437"></a>
+<FONT color="green">438</FONT>    <a name="line.438"></a>
+<FONT color="green">439</FONT>        /**<a name="line.439"></a>
+<FONT color="green">440</FONT>         * Grow the tables.<a name="line.440"></a>
+<FONT color="green">441</FONT>         */<a name="line.441"></a>
+<FONT color="green">442</FONT>        private void growTable() {<a name="line.442"></a>
+<FONT color="green">443</FONT>    <a name="line.443"></a>
+<FONT color="green">444</FONT>            final int oldLength      = states.length;<a name="line.444"></a>
+<FONT color="green">445</FONT>            final int[] oldKeys      = keys;<a name="line.445"></a>
+<FONT color="green">446</FONT>            final double[] oldValues = values;<a name="line.446"></a>
+<FONT color="green">447</FONT>            final byte[] oldStates   = states;<a name="line.447"></a>
+<FONT color="green">448</FONT>    <a name="line.448"></a>
+<FONT color="green">449</FONT>            final int newLength = RESIZE_MULTIPLIER * oldLength;<a name="line.449"></a>
+<FONT color="green">450</FONT>            final int[] newKeys = new int[newLength];<a name="line.450"></a>
+<FONT color="green">451</FONT>            final double[] newValues = new double[newLength];<a name="line.451"></a>
+<FONT color="green">452</FONT>            final byte[] newStates = new byte[newLength];<a name="line.452"></a>
+<FONT color="green">453</FONT>            final int newMask = newLength - 1;<a name="line.453"></a>
+<FONT color="green">454</FONT>            for (int i = 0; i &lt; oldLength; ++i) {<a name="line.454"></a>
+<FONT color="green">455</FONT>                if (oldStates[i] == FULL) {<a name="line.455"></a>
+<FONT color="green">456</FONT>                    final int key = oldKeys[i];<a name="line.456"></a>
+<FONT color="green">457</FONT>                    final int index = findInsertionIndex(newKeys, newStates, key, newMask);<a name="line.457"></a>
+<FONT color="green">458</FONT>                    newKeys[index]   = key;<a name="line.458"></a>
+<FONT color="green">459</FONT>                    newValues[index] = oldValues[i];<a name="line.459"></a>
+<FONT color="green">460</FONT>                    newStates[index] = FULL;<a name="line.460"></a>
+<FONT color="green">461</FONT>                }<a name="line.461"></a>
+<FONT color="green">462</FONT>            }<a name="line.462"></a>
+<FONT color="green">463</FONT>    <a name="line.463"></a>
+<FONT color="green">464</FONT>            mask   = newMask;<a name="line.464"></a>
+<FONT color="green">465</FONT>            keys   = newKeys;<a name="line.465"></a>
+<FONT color="green">466</FONT>            values = newValues;<a name="line.466"></a>
+<FONT color="green">467</FONT>            states = newStates;<a name="line.467"></a>
+<FONT color="green">468</FONT>    <a name="line.468"></a>
+<FONT color="green">469</FONT>        }<a name="line.469"></a>
+<FONT color="green">470</FONT>    <a name="line.470"></a>
+<FONT color="green">471</FONT>        /**<a name="line.471"></a>
+<FONT color="green">472</FONT>         * Check if tables should grow due to increased size.<a name="line.472"></a>
+<FONT color="green">473</FONT>         * @return true if  tables should grow<a name="line.473"></a>
+<FONT color="green">474</FONT>         */<a name="line.474"></a>
+<FONT color="green">475</FONT>        private boolean shouldGrowTable() {<a name="line.475"></a>
+<FONT color="green">476</FONT>            return size &gt; (mask + 1) * LOAD_FACTOR;<a name="line.476"></a>
+<FONT color="green">477</FONT>        }<a name="line.477"></a>
+<FONT color="green">478</FONT>    <a name="line.478"></a>
+<FONT color="green">479</FONT>        /**<a name="line.479"></a>
+<FONT color="green">480</FONT>         * Compute the hash value of a key<a name="line.480"></a>
+<FONT color="green">481</FONT>         * @param key key to hash<a name="line.481"></a>
+<FONT color="green">482</FONT>         * @return hash value of the key<a name="line.482"></a>
+<FONT color="green">483</FONT>         */<a name="line.483"></a>
+<FONT color="green">484</FONT>        private static int hashOf(final int key) {<a name="line.484"></a>
+<FONT color="green">485</FONT>            final int h = key ^ ((key &gt;&gt;&gt; 20) ^ (key &gt;&gt;&gt; 12));<a name="line.485"></a>
+<FONT color="green">486</FONT>            return h ^ (h &gt;&gt;&gt; 7) ^ (h &gt;&gt;&gt; 4);<a name="line.486"></a>
+<FONT color="green">487</FONT>        }<a name="line.487"></a>
+<FONT color="green">488</FONT>    <a name="line.488"></a>
+<FONT color="green">489</FONT>    <a name="line.489"></a>
+<FONT color="green">490</FONT>        /** Iterator class for the map. */<a name="line.490"></a>
+<FONT color="green">491</FONT>        public class Iterator {<a name="line.491"></a>
+<FONT color="green">492</FONT>    <a name="line.492"></a>
+<FONT color="green">493</FONT>            /** Reference modification count. */<a name="line.493"></a>
+<FONT color="green">494</FONT>            private final int referenceCount;<a name="line.494"></a>
+<FONT color="green">495</FONT>    <a name="line.495"></a>
+<FONT color="green">496</FONT>            /** Index of current element. */<a name="line.496"></a>
+<FONT color="green">497</FONT>            private int current;<a name="line.497"></a>
+<FONT color="green">498</FONT>    <a name="line.498"></a>
+<FONT color="green">499</FONT>            /** Index of next element. */<a name="line.499"></a>
+<FONT color="green">500</FONT>            private int next;<a name="line.500"></a>
+<FONT color="green">501</FONT>    <a name="line.501"></a>
+<FONT color="green">502</FONT>            /**<a name="line.502"></a>
+<FONT color="green">503</FONT>             * Simple constructor.<a name="line.503"></a>
+<FONT color="green">504</FONT>             */<a name="line.504"></a>
+<FONT color="green">505</FONT>            private Iterator() {<a name="line.505"></a>
+<FONT color="green">506</FONT>    <a name="line.506"></a>
+<FONT color="green">507</FONT>                // preserve the modification count of the map to detect concurrent modifications later<a name="line.507"></a>
+<FONT color="green">508</FONT>                referenceCount = count;<a name="line.508"></a>
+<FONT color="green">509</FONT>    <a name="line.509"></a>
+<FONT color="green">510</FONT>                // initialize current index<a name="line.510"></a>
+<FONT color="green">511</FONT>                next = -1;<a name="line.511"></a>
+<FONT color="green">512</FONT>                try {<a name="line.512"></a>
+<FONT color="green">513</FONT>                    advance();<a name="line.513"></a>
+<FONT color="green">514</FONT>                } catch (NoSuchElementException nsee) {<a name="line.514"></a>
+<FONT color="green">515</FONT>                    // ignored<a name="line.515"></a>
+<FONT color="green">516</FONT>                }<a name="line.516"></a>
+<FONT color="green">517</FONT>    <a name="line.517"></a>
+<FONT color="green">518</FONT>            }<a name="line.518"></a>
+<FONT color="green">519</FONT>    <a name="line.519"></a>
+<FONT color="green">520</FONT>            /**<a name="line.520"></a>
+<FONT color="green">521</FONT>             * Check if there is a next element in the map.<a name="line.521"></a>
+<FONT color="green">522</FONT>             * @return true if there is a next element<a name="line.522"></a>
+<FONT color="green">523</FONT>             */<a name="line.523"></a>
+<FONT color="green">524</FONT>            public boolean hasNext() {<a name="line.524"></a>
+<FONT color="green">525</FONT>                return next &gt;= 0;<a name="line.525"></a>
+<FONT color="green">526</FONT>            }<a name="line.526"></a>
+<FONT color="green">527</FONT>    <a name="line.527"></a>
+<FONT color="green">528</FONT>            /**<a name="line.528"></a>
+<FONT color="green">529</FONT>             * Get the key of current entry.<a name="line.529"></a>
+<FONT color="green">530</FONT>             * @return key of current entry<a name="line.530"></a>
+<FONT color="green">531</FONT>             * @exception ConcurrentModificationException if the map is modified during iteration<a name="line.531"></a>
+<FONT color="green">532</FONT>             * @exception NoSuchElementException if there is no element left in the map<a name="line.532"></a>
+<FONT color="green">533</FONT>             */<a name="line.533"></a>
+<FONT color="green">534</FONT>            public int key()<a name="line.534"></a>
+<FONT color="green">535</FONT>                throws ConcurrentModificationException, NoSuchElementException {<a name="line.535"></a>
+<FONT color="green">536</FONT>                if (referenceCount != count) {<a name="line.536"></a>
+<FONT color="green">537</FONT>                    throw MathRuntimeException.createConcurrentModificationException(<a name="line.537"></a>
+<FONT color="green">538</FONT>                          CONCURRENT_MODIFICATION_MESSAGE);<a name="line.538"></a>
+<FONT color="green">539</FONT>                }<a name="line.539"></a>
+<FONT color="green">540</FONT>                if (current &lt; 0) {<a name="line.540"></a>
+<FONT color="green">541</FONT>                    throw MathRuntimeException.createNoSuchElementException(EXHAUSTED_ITERATOR_MESSAGE);<a name="line.541"></a>
+<FONT color="green">542</FONT>                }<a name="line.542"></a>
+<FONT color="green">543</FONT>                return keys[current];<a name="line.543"></a>
+<FONT color="green">544</FONT>            }<a name="line.544"></a>
+<FONT color="green">545</FONT>    <a name="line.545"></a>
+<FONT color="green">546</FONT>            /**<a name="line.546"></a>
+<FONT color="green">547</FONT>             * Get the value of current entry.<a name="line.547"></a>
+<FONT color="green">548</FONT>             * @return value of current entry<a name="line.548"></a>
+<FONT color="green">549</FONT>             * @exception ConcurrentModificationException if the map is modified during iteration<a name="line.549"></a>
+<FONT color="green">550</FONT>             * @exception NoSuchElementException if there is no element left in the map<a name="line.550"></a>
+<FONT color="green">551</FONT>             */<a name="line.551"></a>
+<FONT color="green">552</FONT>            public double value()<a name="line.552"></a>
+<FONT color="green">553</FONT>                throws ConcurrentModificationException, NoSuchElementException {<a name="line.553"></a>
+<FONT color="green">554</FONT>                if (referenceCount != count) {<a name="line.554"></a>
+<FONT color="green">555</FONT>                    throw MathRuntimeException.createConcurrentModificationException(<a name="line.555"></a>
+<FONT color="green">556</FONT>                          CONCURRENT_MODIFICATION_MESSAGE);<a name="line.556"></a>
+<FONT color="green">557</FONT>                }<a name="line.557"></a>
+<FONT color="green">558</FONT>                if (current &lt; 0) {<a name="line.558"></a>
+<FONT color="green">559</FONT>                    throw MathRuntimeException.createNoSuchElementException(EXHAUSTED_ITERATOR_MESSAGE);<a name="line.559"></a>
+<FONT color="green">560</FONT>                }<a name="line.560"></a>
+<FONT color="green">561</FONT>                return values[current];<a name="line.561"></a>
+<FONT color="green">562</FONT>            }<a name="line.562"></a>
+<FONT color="green">563</FONT>    <a name="line.563"></a>
+<FONT color="green">564</FONT>            /**<a name="line.564"></a>
+<FONT color="green">565</FONT>             * Advance iterator one step further.<a name="line.565"></a>
+<FONT color="green">566</FONT>             * @exception ConcurrentModificationException if the map is modified during iteration<a name="line.566"></a>
+<FONT color="green">567</FONT>             * @exception NoSuchElementException if there is no element left in the map<a name="line.567"></a>
+<FONT color="green">568</FONT>             */<a name="line.568"></a>
+<FONT color="green">569</FONT>            public void advance()<a name="line.569"></a>
+<FONT color="green">570</FONT>                throws ConcurrentModificationException, NoSuchElementException {<a name="line.570"></a>
+<FONT color="green">571</FONT>    <a name="line.571"></a>
+<FONT color="green">572</FONT>                if (referenceCount != count) {<a name="line.572"></a>
+<FONT color="green">573</FONT>                    throw MathRuntimeException.createConcurrentModificationException(<a name="line.573"></a>
+<FONT color="green">574</FONT>                          CONCURRENT_MODIFICATION_MESSAGE);<a name="line.574"></a>
+<FONT color="green">575</FONT>                }<a name="line.575"></a>
+<FONT color="green">576</FONT>    <a name="line.576"></a>
+<FONT color="green">577</FONT>                // advance on step<a name="line.577"></a>
+<FONT color="green">578</FONT>                current = next;<a name="line.578"></a>
+<FONT color="green">579</FONT>    <a name="line.579"></a>
+<FONT color="green">580</FONT>                // prepare next step<a name="line.580"></a>
+<FONT color="green">581</FONT>                try {<a name="line.581"></a>
+<FONT color="green">582</FONT>                    while (states[++next] != FULL) {<a name="line.582"></a>
+<FONT color="green">583</FONT>                        // nothing to do<a name="line.583"></a>
+<FONT color="green">584</FONT>                    }<a name="line.584"></a>
+<FONT color="green">585</FONT>                } catch (ArrayIndexOutOfBoundsException e) {<a name="line.585"></a>
+<FONT color="green">586</FONT>                    next = -2;<a name="line.586"></a>
+<FONT color="green">587</FONT>                    if (current &lt; 0) {<a name="line.587"></a>
+<FONT color="green">588</FONT>                        throw MathRuntimeException.createNoSuchElementException(EXHAUSTED_ITERATOR_MESSAGE);<a name="line.588"></a>
+<FONT color="green">589</FONT>                    }<a name="line.589"></a>
+<FONT color="green">590</FONT>                }<a name="line.590"></a>
+<FONT color="green">591</FONT>    <a name="line.591"></a>
+<FONT color="green">592</FONT>            }<a name="line.592"></a>
+<FONT color="green">593</FONT>    <a name="line.593"></a>
+<FONT color="green">594</FONT>        }<a name="line.594"></a>
+<FONT color="green">595</FONT>    <a name="line.595"></a>
+<FONT color="green">596</FONT>        /**<a name="line.596"></a>
+<FONT color="green">597</FONT>         * Read a serialized object.<a name="line.597"></a>
+<FONT color="green">598</FONT>         * @param stream input stream<a name="line.598"></a>
+<FONT color="green">599</FONT>         * @throws IOException if object cannot be read<a name="line.599"></a>
+<FONT color="green">600</FONT>         * @throws ClassNotFoundException if the class corresponding<a name="line.600"></a>
+<FONT color="green">601</FONT>         * to the serialized object cannot be found<a name="line.601"></a>
+<FONT color="green">602</FONT>         */<a name="line.602"></a>
+<FONT color="green">603</FONT>        private void readObject(final ObjectInputStream stream)<a name="line.603"></a>
+<FONT color="green">604</FONT>            throws IOException, ClassNotFoundException {<a name="line.604"></a>
+<FONT color="green">605</FONT>            stream.defaultReadObject();<a name="line.605"></a>
+<FONT color="green">606</FONT>            count = 0;<a name="line.606"></a>
+<FONT color="green">607</FONT>        }<a name="line.607"></a>
+<FONT color="green">608</FONT>    <a name="line.608"></a>
+<FONT color="green">609</FONT>    <a name="line.609"></a>
+<FONT color="green">610</FONT>    }<a name="line.610"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/OpenIntToDoubleHashMap.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,676 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.math.util;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.IOException;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.io.ObjectInputStream;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.io.Serializable;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.util.ConcurrentModificationException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import java.util.NoSuchElementException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.26"></a>
+<FONT color="green">027</FONT>    <a name="line.27"></a>
+<FONT color="green">028</FONT>    /**<a name="line.28"></a>
+<FONT color="green">029</FONT>     * Open addressed map from int to double.<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;p&gt;This class provides a dedicated map from integers to doubles with a<a name="line.30"></a>
+<FONT color="green">031</FONT>     * much smaller memory overhead than standard &lt;code&gt;java.util.Map&lt;/code&gt;.&lt;/p&gt;<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;This class is not synchronized. The specialized iterators returned by<a name="line.32"></a>
+<FONT color="green">033</FONT>     * {@link #iterator()} are fail-fast: they throw a<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;code&gt;ConcurrentModificationException&lt;/code&gt; when they detect the map has been<a name="line.34"></a>
+<FONT color="green">035</FONT>     * modified during iteration.&lt;/p&gt;<a name="line.35"></a>
+<FONT color="green">036</FONT>     * @version $Revision: 885278 $ $Date: 2009-11-29 16:47:51 -0500 (Sun, 29 Nov 2009) $<a name="line.36"></a>
+<FONT color="green">037</FONT>     * @since 2.0<a name="line.37"></a>
+<FONT color="green">038</FONT>     */<a name="line.38"></a>
+<FONT color="green">039</FONT>    public class OpenIntToDoubleHashMap implements Serializable {<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>        /** Status indicator for free table entries. */<a name="line.41"></a>
+<FONT color="green">042</FONT>        protected static final byte FREE    = 0;<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Status indicator for full table entries. */<a name="line.44"></a>
+<FONT color="green">045</FONT>        protected static final byte FULL    = 1;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** Status indicator for removed table entries. */<a name="line.47"></a>
+<FONT color="green">048</FONT>        protected static final byte REMOVED = 2;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Serializable version identifier */<a name="line.50"></a>
+<FONT color="green">051</FONT>        private static final long serialVersionUID = -3646337053166149105L;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** Message for map modification during iteration. */<a name="line.53"></a>
+<FONT color="green">054</FONT>        private static final String CONCURRENT_MODIFICATION_MESSAGE =<a name="line.54"></a>
+<FONT color="green">055</FONT>            "map has been modified while iterating";<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /** Message for exhausted iterator. */<a name="line.57"></a>
+<FONT color="green">058</FONT>        private static final String EXHAUSTED_ITERATOR_MESSAGE =<a name="line.58"></a>
+<FONT color="green">059</FONT>            "iterator exhausted";<a name="line.59"></a>
+<FONT color="green">060</FONT>    <a name="line.60"></a>
+<FONT color="green">061</FONT>        /** Load factor for the map. */<a name="line.61"></a>
+<FONT color="green">062</FONT>        private static final float LOAD_FACTOR = 0.5f;<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /** Default starting size.<a name="line.64"></a>
+<FONT color="green">065</FONT>         * &lt;p&gt;This must be a power of two for bit mask to work properly. &lt;/p&gt;<a name="line.65"></a>
+<FONT color="green">066</FONT>         */<a name="line.66"></a>
+<FONT color="green">067</FONT>        private static final int DEFAULT_EXPECTED_SIZE = 16;<a name="line.67"></a>
+<FONT color="green">068</FONT>    <a name="line.68"></a>
+<FONT color="green">069</FONT>        /** Multiplier for size growth when map fills up.<a name="line.69"></a>
+<FONT color="green">070</FONT>         * &lt;p&gt;This must be a power of two for bit mask to work properly. &lt;/p&gt;<a name="line.70"></a>
+<FONT color="green">071</FONT>         */<a name="line.71"></a>
+<FONT color="green">072</FONT>        private static final int RESIZE_MULTIPLIER = 2;<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        /** Number of bits to perturb the index when probing for collision resolution. */<a name="line.74"></a>
+<FONT color="green">075</FONT>        private static final int PERTURB_SHIFT = 5;<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** Keys table. */<a name="line.77"></a>
+<FONT color="green">078</FONT>        private int[] keys;<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /** Values table. */<a name="line.80"></a>
+<FONT color="green">081</FONT>        private double[] values;<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /** States table. */<a name="line.83"></a>
+<FONT color="green">084</FONT>        private byte[] states;<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /** Return value for missing entries. */<a name="line.86"></a>
+<FONT color="green">087</FONT>        private final double missingEntries;<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /** Current size of the map. */<a name="line.89"></a>
+<FONT color="green">090</FONT>        private int size;<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /** Bit mask for hash values. */<a name="line.92"></a>
+<FONT color="green">093</FONT>        private int mask;<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /** Modifications count. */<a name="line.95"></a>
+<FONT color="green">096</FONT>        private transient int count;<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /**<a name="line.98"></a>
+<FONT color="green">099</FONT>         * Build an empty map with default size and using NaN for missing entries.<a name="line.99"></a>
+<FONT color="green">100</FONT>         */<a name="line.100"></a>
+<FONT color="green">101</FONT>        public OpenIntToDoubleHashMap() {<a name="line.101"></a>
+<FONT color="green">102</FONT>            this(DEFAULT_EXPECTED_SIZE, Double.NaN);<a name="line.102"></a>
+<FONT color="green">103</FONT>        }<a name="line.103"></a>
+<FONT color="green">104</FONT>    <a name="line.104"></a>
+<FONT color="green">105</FONT>        /**<a name="line.105"></a>
+<FONT color="green">106</FONT>         * Build an empty map with default size<a name="line.106"></a>
+<FONT color="green">107</FONT>         * @param missingEntries value to return when a missing entry is fetched<a name="line.107"></a>
+<FONT color="green">108</FONT>         */<a name="line.108"></a>
+<FONT color="green">109</FONT>        public OpenIntToDoubleHashMap(final double missingEntries) {<a name="line.109"></a>
+<FONT color="green">110</FONT>            this(DEFAULT_EXPECTED_SIZE, missingEntries);<a name="line.110"></a>
+<FONT color="green">111</FONT>        }<a name="line.111"></a>
+<FONT color="green">112</FONT>    <a name="line.112"></a>
+<FONT color="green">113</FONT>        /**<a name="line.113"></a>
+<FONT color="green">114</FONT>         * Build an empty map with specified size and using NaN for missing entries.<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @param expectedSize expected number of elements in the map<a name="line.115"></a>
+<FONT color="green">116</FONT>         */<a name="line.116"></a>
+<FONT color="green">117</FONT>        public OpenIntToDoubleHashMap(final int expectedSize) {<a name="line.117"></a>
+<FONT color="green">118</FONT>            this(expectedSize, Double.NaN);<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /**<a name="line.121"></a>
+<FONT color="green">122</FONT>         * Build an empty map with specified size.<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @param expectedSize expected number of elements in the map<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @param missingEntries value to return when a missing entry is fetched<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        public OpenIntToDoubleHashMap(final int expectedSize,<a name="line.126"></a>
+<FONT color="green">127</FONT>                                      final double missingEntries) {<a name="line.127"></a>
+<FONT color="green">128</FONT>            final int capacity = computeCapacity(expectedSize);<a name="line.128"></a>
+<FONT color="green">129</FONT>            keys   = new int[capacity];<a name="line.129"></a>
+<FONT color="green">130</FONT>            values = new double[capacity];<a name="line.130"></a>
+<FONT color="green">131</FONT>            states = new byte[capacity];<a name="line.131"></a>
+<FONT color="green">132</FONT>            this.missingEntries = missingEntries;<a name="line.132"></a>
+<FONT color="green">133</FONT>            mask   = capacity - 1;<a name="line.133"></a>
+<FONT color="green">134</FONT>        }<a name="line.134"></a>
+<FONT color="green">135</FONT>    <a name="line.135"></a>
+<FONT color="green">136</FONT>        /**<a name="line.136"></a>
+<FONT color="green">137</FONT>         * Copy constructor.<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @param source map to copy<a name="line.138"></a>
+<FONT color="green">139</FONT>         */<a name="line.139"></a>
+<FONT color="green">140</FONT>        public OpenIntToDoubleHashMap(final OpenIntToDoubleHashMap source) {<a name="line.140"></a>
+<FONT color="green">141</FONT>            final int length = source.keys.length;<a name="line.141"></a>
+<FONT color="green">142</FONT>            keys = new int[length];<a name="line.142"></a>
+<FONT color="green">143</FONT>            System.arraycopy(source.keys, 0, keys, 0, length);<a name="line.143"></a>
+<FONT color="green">144</FONT>            values = new double[length];<a name="line.144"></a>
+<FONT color="green">145</FONT>            System.arraycopy(source.values, 0, values, 0, length);<a name="line.145"></a>
+<FONT color="green">146</FONT>            states = new byte[length];<a name="line.146"></a>
+<FONT color="green">147</FONT>            System.arraycopy(source.states, 0, states, 0, length);<a name="line.147"></a>
+<FONT color="green">148</FONT>            missingEntries = source.missingEntries;<a name="line.148"></a>
+<FONT color="green">149</FONT>            size  = source.size;<a name="line.149"></a>
+<FONT color="green">150</FONT>            mask  = source.mask;<a name="line.150"></a>
+<FONT color="green">151</FONT>            count = source.count;<a name="line.151"></a>
+<FONT color="green">152</FONT>        }<a name="line.152"></a>
+<FONT color="green">153</FONT>    <a name="line.153"></a>
+<FONT color="green">154</FONT>        /**<a name="line.154"></a>
+<FONT color="green">155</FONT>         * Compute the capacity needed for a given size.<a name="line.155"></a>
+<FONT color="green">156</FONT>         * @param expectedSize expected size of the map<a name="line.156"></a>
+<FONT color="green">157</FONT>         * @return capacity to use for the specified size<a name="line.157"></a>
+<FONT color="green">158</FONT>         */<a name="line.158"></a>
+<FONT color="green">159</FONT>        private static int computeCapacity(final int expectedSize) {<a name="line.159"></a>
+<FONT color="green">160</FONT>            if (expectedSize == 0) {<a name="line.160"></a>
+<FONT color="green">161</FONT>                return 1;<a name="line.161"></a>
+<FONT color="green">162</FONT>            }<a name="line.162"></a>
+<FONT color="green">163</FONT>            final int capacity   = (int) Math.ceil(expectedSize / LOAD_FACTOR);<a name="line.163"></a>
+<FONT color="green">164</FONT>            final int powerOfTwo = Integer.highestOneBit(capacity);<a name="line.164"></a>
+<FONT color="green">165</FONT>            if (powerOfTwo == capacity) {<a name="line.165"></a>
+<FONT color="green">166</FONT>                return capacity;<a name="line.166"></a>
+<FONT color="green">167</FONT>            }<a name="line.167"></a>
+<FONT color="green">168</FONT>            return nextPowerOfTwo(capacity);<a name="line.168"></a>
+<FONT color="green">169</FONT>        }<a name="line.169"></a>
+<FONT color="green">170</FONT>    <a name="line.170"></a>
+<FONT color="green">171</FONT>        /**<a name="line.171"></a>
+<FONT color="green">172</FONT>         * Find the smallest power of two greater than the input value<a name="line.172"></a>
+<FONT color="green">173</FONT>         * @param i input value<a name="line.173"></a>
+<FONT color="green">174</FONT>         * @return smallest power of two greater than the input value<a name="line.174"></a>
+<FONT color="green">175</FONT>         */<a name="line.175"></a>
+<FONT color="green">176</FONT>        private static int nextPowerOfTwo(final int i) {<a name="line.176"></a>
+<FONT color="green">177</FONT>            return Integer.highestOneBit(i) &lt;&lt; 1;<a name="line.177"></a>
+<FONT color="green">178</FONT>        }<a name="line.178"></a>
+<FONT color="green">179</FONT>    <a name="line.179"></a>
+<FONT color="green">180</FONT>        /**<a name="line.180"></a>
+<FONT color="green">181</FONT>         * Get the stored value associated with the given key<a name="line.181"></a>
+<FONT color="green">182</FONT>         * @param key key associated with the data<a name="line.182"></a>
+<FONT color="green">183</FONT>         * @return data associated with the key<a name="line.183"></a>
+<FONT color="green">184</FONT>         */<a name="line.184"></a>
+<FONT color="green">185</FONT>        public double get(final int key) {<a name="line.185"></a>
+<FONT color="green">186</FONT>    <a name="line.186"></a>
+<FONT color="green">187</FONT>            final int hash  = hashOf(key);<a name="line.187"></a>
+<FONT color="green">188</FONT>            int index = hash &amp; mask;<a name="line.188"></a>
+<FONT color="green">189</FONT>            if (containsKey(key, index)) {<a name="line.189"></a>
+<FONT color="green">190</FONT>                return values[index];<a name="line.190"></a>
+<FONT color="green">191</FONT>            }<a name="line.191"></a>
+<FONT color="green">192</FONT>    <a name="line.192"></a>
+<FONT color="green">193</FONT>            if (states[index] == FREE) {<a name="line.193"></a>
+<FONT color="green">194</FONT>                return missingEntries;<a name="line.194"></a>
+<FONT color="green">195</FONT>            }<a name="line.195"></a>
+<FONT color="green">196</FONT>    <a name="line.196"></a>
+<FONT color="green">197</FONT>            int j = index;<a name="line.197"></a>
+<FONT color="green">198</FONT>            for (int perturb = perturb(hash); states[index] != FREE; perturb &gt;&gt;= PERTURB_SHIFT) {<a name="line.198"></a>
+<FONT color="green">199</FONT>                j = probe(perturb, j);<a name="line.199"></a>
+<FONT color="green">200</FONT>                index = j &amp; mask;<a name="line.200"></a>
+<FONT color="green">201</FONT>                if (containsKey(key, index)) {<a name="line.201"></a>
+<FONT color="green">202</FONT>                    return values[index];<a name="line.202"></a>
+<FONT color="green">203</FONT>                }<a name="line.203"></a>
+<FONT color="green">204</FONT>            }<a name="line.204"></a>
+<FONT color="green">205</FONT>    <a name="line.205"></a>
+<FONT color="green">206</FONT>            return missingEntries;<a name="line.206"></a>
+<FONT color="green">207</FONT>    <a name="line.207"></a>
+<FONT color="green">208</FONT>        }<a name="line.208"></a>
+<FONT color="green">209</FONT>    <a name="line.209"></a>
+<FONT color="green">210</FONT>        /**<a name="line.210"></a>
+<FONT color="green">211</FONT>         * Check if a value is associated with a key.<a name="line.211"></a>
+<FONT color="green">212</FONT>         * @param key key to check<a name="line.212"></a>
+<FONT color="green">213</FONT>         * @return true if a value is associated with key<a name="line.213"></a>
+<FONT color="green">214</FONT>         */<a name="line.214"></a>
+<FONT color="green">215</FONT>        public boolean containsKey(final int key) {<a name="line.215"></a>
+<FONT color="green">216</FONT>    <a name="line.216"></a>
+<FONT color="green">217</FONT>            final int hash  = hashOf(key);<a name="line.217"></a>
+<FONT color="green">218</FONT>            int index = hash &amp; mask;<a name="line.218"></a>
+<FONT color="green">219</FONT>            if (containsKey(key, index)) {<a name="line.219"></a>
+<FONT color="green">220</FONT>                return true;<a name="line.220"></a>
+<FONT color="green">221</FONT>            }<a name="line.221"></a>
+<FONT color="green">222</FONT>    <a name="line.222"></a>
+<FONT color="green">223</FONT>            if (states[index] == FREE) {<a name="line.223"></a>
+<FONT color="green">224</FONT>                return false;<a name="line.224"></a>
+<FONT color="green">225</FONT>            }<a name="line.225"></a>
+<FONT color="green">226</FONT>    <a name="line.226"></a>
+<FONT color="green">227</FONT>            int j = index;<a name="line.227"></a>
+<FONT color="green">228</FONT>            for (int perturb = perturb(hash); states[index] != FREE; perturb &gt;&gt;= PERTURB_SHIFT) {<a name="line.228"></a>
+<FONT color="green">229</FONT>                j = probe(perturb, j);<a name="line.229"></a>
+<FONT color="green">230</FONT>                index = j &amp; mask;<a name="line.230"></a>
+<FONT color="green">231</FONT>                if (containsKey(key, index)) {<a name="line.231"></a>
+<FONT color="green">232</FONT>                    return true;<a name="line.232"></a>
+<FONT color="green">233</FONT>                }<a name="line.233"></a>
+<FONT color="green">234</FONT>            }<a name="line.234"></a>
+<FONT color="green">235</FONT>    <a name="line.235"></a>
+<FONT color="green">236</FONT>            return false;<a name="line.236"></a>
+<FONT color="green">237</FONT>    <a name="line.237"></a>
+<FONT color="green">238</FONT>        }<a name="line.238"></a>
+<FONT color="green">239</FONT>    <a name="line.239"></a>
+<FONT color="green">240</FONT>        /**<a name="line.240"></a>
+<FONT color="green">241</FONT>         * Get an iterator over map elements.<a name="line.241"></a>
+<FONT color="green">242</FONT>         * &lt;p&gt;The specialized iterators returned are fail-fast: they throw a<a name="line.242"></a>
+<FONT color="green">243</FONT>         * &lt;code&gt;ConcurrentModificationException&lt;/code&gt; when they detect the map<a name="line.243"></a>
+<FONT color="green">244</FONT>         * has been modified during iteration.&lt;/p&gt;<a name="line.244"></a>
+<FONT color="green">245</FONT>         * @return iterator over the map elements<a name="line.245"></a>
+<FONT color="green">246</FONT>         */<a name="line.246"></a>
+<FONT color="green">247</FONT>        public Iterator iterator() {<a name="line.247"></a>
+<FONT color="green">248</FONT>            return new Iterator();<a name="line.248"></a>
+<FONT color="green">249</FONT>        }<a name="line.249"></a>
+<FONT color="green">250</FONT>    <a name="line.250"></a>
+<FONT color="green">251</FONT>        /**<a name="line.251"></a>
+<FONT color="green">252</FONT>         * Perturb the hash for starting probing.<a name="line.252"></a>
+<FONT color="green">253</FONT>         * @param hash initial hash<a name="line.253"></a>
+<FONT color="green">254</FONT>         * @return perturbed hash<a name="line.254"></a>
+<FONT color="green">255</FONT>         */<a name="line.255"></a>
+<FONT color="green">256</FONT>        private static int perturb(final int hash) {<a name="line.256"></a>
+<FONT color="green">257</FONT>            return hash &amp; 0x7fffffff;<a name="line.257"></a>
+<FONT color="green">258</FONT>        }<a name="line.258"></a>
+<FONT color="green">259</FONT>    <a name="line.259"></a>
+<FONT color="green">260</FONT>        /**<a name="line.260"></a>
+<FONT color="green">261</FONT>         * Find the index at which a key should be inserted<a name="line.261"></a>
+<FONT color="green">262</FONT>         * @param key key to lookup<a name="line.262"></a>
+<FONT color="green">263</FONT>         * @return index at which key should be inserted<a name="line.263"></a>
+<FONT color="green">264</FONT>         */<a name="line.264"></a>
+<FONT color="green">265</FONT>        private int findInsertionIndex(final int key) {<a name="line.265"></a>
+<FONT color="green">266</FONT>            return findInsertionIndex(keys, states, key, mask);<a name="line.266"></a>
+<FONT color="green">267</FONT>        }<a name="line.267"></a>
+<FONT color="green">268</FONT>    <a name="line.268"></a>
+<FONT color="green">269</FONT>        /**<a name="line.269"></a>
+<FONT color="green">270</FONT>         * Find the index at which a key should be inserted<a name="line.270"></a>
+<FONT color="green">271</FONT>         * @param keys keys table<a name="line.271"></a>
+<FONT color="green">272</FONT>         * @param states states table<a name="line.272"></a>
+<FONT color="green">273</FONT>         * @param key key to lookup<a name="line.273"></a>
+<FONT color="green">274</FONT>         * @param mask bit mask for hash values<a name="line.274"></a>
+<FONT color="green">275</FONT>         * @return index at which key should be inserted<a name="line.275"></a>
+<FONT color="green">276</FONT>         */<a name="line.276"></a>
+<FONT color="green">277</FONT>        private static int findInsertionIndex(final int[] keys, final byte[] states,<a name="line.277"></a>
+<FONT color="green">278</FONT>                                              final int key, final int mask) {<a name="line.278"></a>
+<FONT color="green">279</FONT>            final int hash = hashOf(key);<a name="line.279"></a>
+<FONT color="green">280</FONT>            int index = hash &amp; mask;<a name="line.280"></a>
+<FONT color="green">281</FONT>            if (states[index] == FREE) {<a name="line.281"></a>
+<FONT color="green">282</FONT>                return index;<a name="line.282"></a>
+<FONT color="green">283</FONT>            } else if (states[index] == FULL &amp;&amp; keys[index] == key) {<a name="line.283"></a>
+<FONT color="green">284</FONT>                return changeIndexSign(index);<a name="line.284"></a>
+<FONT color="green">285</FONT>            }<a name="line.285"></a>
+<FONT color="green">286</FONT>    <a name="line.286"></a>
+<FONT color="green">287</FONT>            int perturb = perturb(hash);<a name="line.287"></a>
+<FONT color="green">288</FONT>            int j = index;<a name="line.288"></a>
+<FONT color="green">289</FONT>            if (states[index] == FULL) {<a name="line.289"></a>
+<FONT color="green">290</FONT>                while (true) {<a name="line.290"></a>
+<FONT color="green">291</FONT>                    j = probe(perturb, j);<a name="line.291"></a>
+<FONT color="green">292</FONT>                    index = j &amp; mask;<a name="line.292"></a>
+<FONT color="green">293</FONT>                    perturb &gt;&gt;= PERTURB_SHIFT;<a name="line.293"></a>
+<FONT color="green">294</FONT>    <a name="line.294"></a>
+<FONT color="green">295</FONT>                    if (states[index] != FULL || keys[index] == key) {<a name="line.295"></a>
+<FONT color="green">296</FONT>                        break;<a name="line.296"></a>
+<FONT color="green">297</FONT>                    }<a name="line.297"></a>
+<FONT color="green">298</FONT>                }<a name="line.298"></a>
+<FONT color="green">299</FONT>            }<a name="line.299"></a>
+<FONT color="green">300</FONT>    <a name="line.300"></a>
+<FONT color="green">301</FONT>            if (states[index] == FREE) {<a name="line.301"></a>
+<FONT color="green">302</FONT>                return index;<a name="line.302"></a>
+<FONT color="green">303</FONT>            } else if (states[index] == FULL) {<a name="line.303"></a>
+<FONT color="green">304</FONT>                // due to the loop exit condition,<a name="line.304"></a>
+<FONT color="green">305</FONT>                // if (states[index] == FULL) then keys[index] == key<a name="line.305"></a>
+<FONT color="green">306</FONT>                return changeIndexSign(index);<a name="line.306"></a>
+<FONT color="green">307</FONT>            }<a name="line.307"></a>
+<FONT color="green">308</FONT>    <a name="line.308"></a>
+<FONT color="green">309</FONT>            final int firstRemoved = index;<a name="line.309"></a>
+<FONT color="green">310</FONT>            while (true) {<a name="line.310"></a>
+<FONT color="green">311</FONT>                j = probe(perturb, j);<a name="line.311"></a>
+<FONT color="green">312</FONT>                index = j &amp; mask;<a name="line.312"></a>
+<FONT color="green">313</FONT>    <a name="line.313"></a>
+<FONT color="green">314</FONT>                if (states[index] == FREE) {<a name="line.314"></a>
+<FONT color="green">315</FONT>                    return firstRemoved;<a name="line.315"></a>
+<FONT color="green">316</FONT>                } else if (states[index] == FULL &amp;&amp; keys[index] == key) {<a name="line.316"></a>
+<FONT color="green">317</FONT>                    return changeIndexSign(index);<a name="line.317"></a>
+<FONT color="green">318</FONT>                }<a name="line.318"></a>
+<FONT color="green">319</FONT>    <a name="line.319"></a>
+<FONT color="green">320</FONT>                perturb &gt;&gt;= PERTURB_SHIFT;<a name="line.320"></a>
+<FONT color="green">321</FONT>    <a name="line.321"></a>
+<FONT color="green">322</FONT>            }<a name="line.322"></a>
+<FONT color="green">323</FONT>    <a name="line.323"></a>
+<FONT color="green">324</FONT>        }<a name="line.324"></a>
+<FONT color="green">325</FONT>    <a name="line.325"></a>
+<FONT color="green">326</FONT>        /**<a name="line.326"></a>
+<FONT color="green">327</FONT>         * Compute next probe for collision resolution<a name="line.327"></a>
+<FONT color="green">328</FONT>         * @param perturb perturbed hash<a name="line.328"></a>
+<FONT color="green">329</FONT>         * @param j previous probe<a name="line.329"></a>
+<FONT color="green">330</FONT>         * @return next probe<a name="line.330"></a>
+<FONT color="green">331</FONT>         */<a name="line.331"></a>
+<FONT color="green">332</FONT>        private static int probe(final int perturb, final int j) {<a name="line.332"></a>
+<FONT color="green">333</FONT>            return (j &lt;&lt; 2) + j + perturb + 1;<a name="line.333"></a>
+<FONT color="green">334</FONT>        }<a name="line.334"></a>
+<FONT color="green">335</FONT>    <a name="line.335"></a>
+<FONT color="green">336</FONT>        /**<a name="line.336"></a>
+<FONT color="green">337</FONT>         * Change the index sign<a name="line.337"></a>
+<FONT color="green">338</FONT>         * @param index initial index<a name="line.338"></a>
+<FONT color="green">339</FONT>         * @return changed index<a name="line.339"></a>
+<FONT color="green">340</FONT>         */<a name="line.340"></a>
+<FONT color="green">341</FONT>        private static int changeIndexSign(final int index) {<a name="line.341"></a>
+<FONT color="green">342</FONT>            return -index - 1;<a name="line.342"></a>
+<FONT color="green">343</FONT>        }<a name="line.343"></a>
+<FONT color="green">344</FONT>    <a name="line.344"></a>
+<FONT color="green">345</FONT>        /**<a name="line.345"></a>
+<FONT color="green">346</FONT>         * Get the number of elements stored in the map.<a name="line.346"></a>
+<FONT color="green">347</FONT>         * @return number of elements stored in the map<a name="line.347"></a>
+<FONT color="green">348</FONT>         */<a name="line.348"></a>
+<FONT color="green">349</FONT>        public int size() {<a name="line.349"></a>
+<FONT color="green">350</FONT>            return size;<a name="line.350"></a>
+<FONT color="green">351</FONT>        }<a name="line.351"></a>
+<FONT color="green">352</FONT>    <a name="line.352"></a>
+<FONT color="green">353</FONT>    <a name="line.353"></a>
+<FONT color="green">354</FONT>        /**<a name="line.354"></a>
+<FONT color="green">355</FONT>         * Remove the value associated with a key.<a name="line.355"></a>
+<FONT color="green">356</FONT>         * @param key key to which the value is associated<a name="line.356"></a>
+<FONT color="green">357</FONT>         * @return removed value<a name="line.357"></a>
+<FONT color="green">358</FONT>         */<a name="line.358"></a>
+<FONT color="green">359</FONT>        public double remove(final int key) {<a name="line.359"></a>
+<FONT color="green">360</FONT>    <a name="line.360"></a>
+<FONT color="green">361</FONT>            final int hash  = hashOf(key);<a name="line.361"></a>
+<FONT color="green">362</FONT>            int index = hash &amp; mask;<a name="line.362"></a>
+<FONT color="green">363</FONT>            if (containsKey(key, index)) {<a name="line.363"></a>
+<FONT color="green">364</FONT>                return doRemove(index);<a name="line.364"></a>
+<FONT color="green">365</FONT>            }<a name="line.365"></a>
+<FONT color="green">366</FONT>    <a name="line.366"></a>
+<FONT color="green">367</FONT>            if (states[index] == FREE) {<a name="line.367"></a>
+<FONT color="green">368</FONT>                return missingEntries;<a name="line.368"></a>
+<FONT color="green">369</FONT>            }<a name="line.369"></a>
+<FONT color="green">370</FONT>    <a name="line.370"></a>
+<FONT color="green">371</FONT>            int j = index;<a name="line.371"></a>
+<FONT color="green">372</FONT>            for (int perturb = perturb(hash); states[index] != FREE; perturb &gt;&gt;= PERTURB_SHIFT) {<a name="line.372"></a>
+<FONT color="green">373</FONT>                j = probe(perturb, j);<a name="line.373"></a>
+<FONT color="green">374</FONT>                index = j &amp; mask;<a name="line.374"></a>
+<FONT color="green">375</FONT>                if (containsKey(key, index)) {<a name="line.375"></a>
+<FONT color="green">376</FONT>                    return doRemove(index);<a name="line.376"></a>
+<FONT color="green">377</FONT>                }<a name="line.377"></a>
+<FONT color="green">378</FONT>            }<a name="line.378"></a>
+<FONT color="green">379</FONT>    <a name="line.379"></a>
+<FONT color="green">380</FONT>            return missingEntries;<a name="line.380"></a>
+<FONT color="green">381</FONT>    <a name="line.381"></a>
+<FONT color="green">382</FONT>        }<a name="line.382"></a>
+<FONT color="green">383</FONT>    <a name="line.383"></a>
+<FONT color="green">384</FONT>        /**<a name="line.384"></a>
+<FONT color="green">385</FONT>         * Check if the tables contain an element associated with specified key<a name="line.385"></a>
+<FONT color="green">386</FONT>         * at specified index.<a name="line.386"></a>
+<FONT color="green">387</FONT>         * @param key key to check<a name="line.387"></a>
+<FONT color="green">388</FONT>         * @param index index to check<a name="line.388"></a>
+<FONT color="green">389</FONT>         * @return true if an element is associated with key at index<a name="line.389"></a>
+<FONT color="green">390</FONT>         */<a name="line.390"></a>
+<FONT color="green">391</FONT>        private boolean containsKey(final int key, final int index) {<a name="line.391"></a>
+<FONT color="green">392</FONT>            return (key != 0 || states[index] == FULL) &amp;&amp; keys[index] == key;<a name="line.392"></a>
+<FONT color="green">393</FONT>        }<a name="line.393"></a>
+<FONT color="green">394</FONT>    <a name="line.394"></a>
+<FONT color="green">395</FONT>        /**<a name="line.395"></a>
+<FONT color="green">396</FONT>         * Remove an element at specified index.<a name="line.396"></a>
+<FONT color="green">397</FONT>         * @param index index of the element to remove<a name="line.397"></a>
+<FONT color="green">398</FONT>         * @return removed value<a name="line.398"></a>
+<FONT color="green">399</FONT>         */<a name="line.399"></a>
+<FONT color="green">400</FONT>        private double doRemove(int index) {<a name="line.400"></a>
+<FONT color="green">401</FONT>            keys[index]   = 0;<a name="line.401"></a>
+<FONT color="green">402</FONT>            states[index] = REMOVED;<a name="line.402"></a>
+<FONT color="green">403</FONT>            final double previous = values[index];<a name="line.403"></a>
+<FONT color="green">404</FONT>            values[index] = missingEntries;<a name="line.404"></a>
+<FONT color="green">405</FONT>            --size;<a name="line.405"></a>
+<FONT color="green">406</FONT>            ++count;<a name="line.406"></a>
+<FONT color="green">407</FONT>            return previous;<a name="line.407"></a>
+<FONT color="green">408</FONT>        }<a name="line.408"></a>
+<FONT color="green">409</FONT>    <a name="line.409"></a>
+<FONT color="green">410</FONT>        /**<a name="line.410"></a>
+<FONT color="green">411</FONT>         * Put a value associated with a key in the map.<a name="line.411"></a>
+<FONT color="green">412</FONT>         * @param key key to which value is associated<a name="line.412"></a>
+<FONT color="green">413</FONT>         * @param value value to put in the map<a name="line.413"></a>
+<FONT color="green">414</FONT>         * @return previous value associated with the key<a name="line.414"></a>
+<FONT color="green">415</FONT>         */<a name="line.415"></a>
+<FONT color="green">416</FONT>        public double put(final int key, final double value) {<a name="line.416"></a>
+<FONT color="green">417</FONT>            int index = findInsertionIndex(key);<a name="line.417"></a>
+<FONT color="green">418</FONT>            double previous = missingEntries;<a name="line.418"></a>
+<FONT color="green">419</FONT>            boolean newMapping = true;<a name="line.419"></a>
+<FONT color="green">420</FONT>            if (index &lt; 0) {<a name="line.420"></a>
+<FONT color="green">421</FONT>                index = changeIndexSign(index);<a name="line.421"></a>
+<FONT color="green">422</FONT>                previous = values[index];<a name="line.422"></a>
+<FONT color="green">423</FONT>                newMapping = false;<a name="line.423"></a>
+<FONT color="green">424</FONT>            }<a name="line.424"></a>
+<FONT color="green">425</FONT>            keys[index]   = key;<a name="line.425"></a>
+<FONT color="green">426</FONT>            states[index] = FULL;<a name="line.426"></a>
+<FONT color="green">427</FONT>            values[index] = value;<a name="line.427"></a>
+<FONT color="green">428</FONT>            if (newMapping) {<a name="line.428"></a>
+<FONT color="green">429</FONT>                ++size;<a name="line.429"></a>
+<FONT color="green">430</FONT>                if (shouldGrowTable()) {<a name="line.430"></a>
+<FONT color="green">431</FONT>                    growTable();<a name="line.431"></a>
+<FONT color="green">432</FONT>                }<a name="line.432"></a>
+<FONT color="green">433</FONT>                ++count;<a name="line.433"></a>
+<FONT color="green">434</FONT>            }<a name="line.434"></a>
+<FONT color="green">435</FONT>            return previous;<a name="line.435"></a>
+<FONT color="green">436</FONT>    <a name="line.436"></a>
+<FONT color="green">437</FONT>        }<a name="line.437"></a>
+<FONT color="green">438</FONT>    <a name="line.438"></a>
+<FONT color="green">439</FONT>        /**<a name="line.439"></a>
+<FONT color="green">440</FONT>         * Grow the tables.<a name="line.440"></a>
+<FONT color="green">441</FONT>         */<a name="line.441"></a>
+<FONT color="green">442</FONT>        private void growTable() {<a name="line.442"></a>
+<FONT color="green">443</FONT>    <a name="line.443"></a>
+<FONT color="green">444</FONT>            final int oldLength      = states.length;<a name="line.444"></a>
+<FONT color="green">445</FONT>            final int[] oldKeys      = keys;<a name="line.445"></a>
+<FONT color="green">446</FONT>            final double[] oldValues = values;<a name="line.446"></a>
+<FONT color="green">447</FONT>            final byte[] oldStates   = states;<a name="line.447"></a>
+<FONT color="green">448</FONT>    <a name="line.448"></a>
+<FONT color="green">449</FONT>            final int newLength = RESIZE_MULTIPLIER * oldLength;<a name="line.449"></a>
+<FONT color="green">450</FONT>            final int[] newKeys = new int[newLength];<a name="line.450"></a>
+<FONT color="green">451</FONT>            final double[] newValues = new double[newLength];<a name="line.451"></a>
+<FONT color="green">452</FONT>            final byte[] newStates = new byte[newLength];<a name="line.452"></a>
+<FONT color="green">453</FONT>            final int newMask = newLength - 1;<a name="line.453"></a>
+<FONT color="green">454</FONT>            for (int i = 0; i &lt; oldLength; ++i) {<a name="line.454"></a>
+<FONT color="green">455</FONT>                if (oldStates[i] == FULL) {<a name="line.455"></a>
+<FONT color="green">456</FONT>                    final int key = oldKeys[i];<a name="line.456"></a>
+<FONT color="green">457</FONT>                    final int index = findInsertionIndex(newKeys, newStates, key, newMask);<a name="line.457"></a>
+<FONT color="green">458</FONT>                    newKeys[index]   = key;<a name="line.458"></a>
+<FONT color="green">459</FONT>                    newValues[index] = oldValues[i];<a name="line.459"></a>
+<FONT color="green">460</FONT>                    newStates[index] = FULL;<a name="line.460"></a>
+<FONT color="green">461</FONT>                }<a name="line.461"></a>
+<FONT color="green">462</FONT>            }<a name="line.462"></a>
+<FONT color="green">463</FONT>    <a name="line.463"></a>
+<FONT color="green">464</FONT>            mask   = newMask;<a name="line.464"></a>
+<FONT color="green">465</FONT>            keys   = newKeys;<a name="line.465"></a>
+<FONT color="green">466</FONT>            values = newValues;<a name="line.466"></a>
+<FONT color="green">467</FONT>            states = newStates;<a name="line.467"></a>
+<FONT color="green">468</FONT>    <a name="line.468"></a>
+<FONT color="green">469</FONT>        }<a name="line.469"></a>
+<FONT color="green">470</FONT>    <a name="line.470"></a>
+<FONT color="green">471</FONT>        /**<a name="line.471"></a>
+<FONT color="green">472</FONT>         * Check if tables should grow due to increased size.<a name="line.472"></a>
+<FONT color="green">473</FONT>         * @return true if  tables should grow<a name="line.473"></a>
+<FONT color="green">474</FONT>         */<a name="line.474"></a>
+<FONT color="green">475</FONT>        private boolean shouldGrowTable() {<a name="line.475"></a>
+<FONT color="green">476</FONT>            return size &gt; (mask + 1) * LOAD_FACTOR;<a name="line.476"></a>
+<FONT color="green">477</FONT>        }<a name="line.477"></a>
+<FONT color="green">478</FONT>    <a name="line.478"></a>
+<FONT color="green">479</FONT>        /**<a name="line.479"></a>
+<FONT color="green">480</FONT>         * Compute the hash value of a key<a name="line.480"></a>
+<FONT color="green">481</FONT>         * @param key key to hash<a name="line.481"></a>
+<FONT color="green">482</FONT>         * @return hash value of the key<a name="line.482"></a>
+<FONT color="green">483</FONT>         */<a name="line.483"></a>
+<FONT color="green">484</FONT>        private static int hashOf(final int key) {<a name="line.484"></a>
+<FONT color="green">485</FONT>            final int h = key ^ ((key &gt;&gt;&gt; 20) ^ (key &gt;&gt;&gt; 12));<a name="line.485"></a>
+<FONT color="green">486</FONT>            return h ^ (h &gt;&gt;&gt; 7) ^ (h &gt;&gt;&gt; 4);<a name="line.486"></a>
+<FONT color="green">487</FONT>        }<a name="line.487"></a>
+<FONT color="green">488</FONT>    <a name="line.488"></a>
+<FONT color="green">489</FONT>    <a name="line.489"></a>
+<FONT color="green">490</FONT>        /** Iterator class for the map. */<a name="line.490"></a>
+<FONT color="green">491</FONT>        public class Iterator {<a name="line.491"></a>
+<FONT color="green">492</FONT>    <a name="line.492"></a>
+<FONT color="green">493</FONT>            /** Reference modification count. */<a name="line.493"></a>
+<FONT color="green">494</FONT>            private final int referenceCount;<a name="line.494"></a>
+<FONT color="green">495</FONT>    <a name="line.495"></a>
+<FONT color="green">496</FONT>            /** Index of current element. */<a name="line.496"></a>
+<FONT color="green">497</FONT>            private int current;<a name="line.497"></a>
+<FONT color="green">498</FONT>    <a name="line.498"></a>
+<FONT color="green">499</FONT>            /** Index of next element. */<a name="line.499"></a>
+<FONT color="green">500</FONT>            private int next;<a name="line.500"></a>
+<FONT color="green">501</FONT>    <a name="line.501"></a>
+<FONT color="green">502</FONT>            /**<a name="line.502"></a>
+<FONT color="green">503</FONT>             * Simple constructor.<a name="line.503"></a>
+<FONT color="green">504</FONT>             */<a name="line.504"></a>
+<FONT color="green">505</FONT>            private Iterator() {<a name="line.505"></a>
+<FONT color="green">506</FONT>    <a name="line.506"></a>
+<FONT color="green">507</FONT>                // preserve the modification count of the map to detect concurrent modifications later<a name="line.507"></a>
+<FONT color="green">508</FONT>                referenceCount = count;<a name="line.508"></a>
+<FONT color="green">509</FONT>    <a name="line.509"></a>
+<FONT color="green">510</FONT>                // initialize current index<a name="line.510"></a>
+<FONT color="green">511</FONT>                next = -1;<a name="line.511"></a>
+<FONT color="green">512</FONT>                try {<a name="line.512"></a>
+<FONT color="green">513</FONT>                    advance();<a name="line.513"></a>
+<FONT color="green">514</FONT>                } catch (NoSuchElementException nsee) {<a name="line.514"></a>
+<FONT color="green">515</FONT>                    // ignored<a name="line.515"></a>
+<FONT color="green">516</FONT>                }<a name="line.516"></a>
+<FONT color="green">517</FONT>    <a name="line.517"></a>
+<FONT color="green">518</FONT>            }<a name="line.518"></a>
+<FONT color="green">519</FONT>    <a name="line.519"></a>
+<FONT color="green">520</FONT>            /**<a name="line.520"></a>
+<FONT color="green">521</FONT>             * Check if there is a next element in the map.<a name="line.521"></a>
+<FONT color="green">522</FONT>             * @return true if there is a next element<a name="line.522"></a>
+<FONT color="green">523</FONT>             */<a name="line.523"></a>
+<FONT color="green">524</FONT>            public boolean hasNext() {<a name="line.524"></a>
+<FONT color="green">525</FONT>                return next &gt;= 0;<a name="line.525"></a>
+<FONT color="green">526</FONT>            }<a name="line.526"></a>
+<FONT color="green">527</FONT>    <a name="line.527"></a>
+<FONT color="green">528</FONT>            /**<a name="line.528"></a>
+<FONT color="green">529</FONT>             * Get the key of current entry.<a name="line.529"></a>
+<FONT color="green">530</FONT>             * @return key of current entry<a name="line.530"></a>
+<FONT color="green">531</FONT>             * @exception ConcurrentModificationException if the map is modified during iteration<a name="line.531"></a>
+<FONT color="green">532</FONT>             * @exception NoSuchElementException if there is no element left in the map<a name="line.532"></a>
+<FONT color="green">533</FONT>             */<a name="line.533"></a>
+<FONT color="green">534</FONT>            public int key()<a name="line.534"></a>
+<FONT color="green">535</FONT>                throws ConcurrentModificationException, NoSuchElementException {<a name="line.535"></a>
+<FONT color="green">536</FONT>                if (referenceCount != count) {<a name="line.536"></a>
+<FONT color="green">537</FONT>                    throw MathRuntimeException.createConcurrentModificationException(<a name="line.537"></a>
+<FONT color="green">538</FONT>                          CONCURRENT_MODIFICATION_MESSAGE);<a name="line.538"></a>
+<FONT color="green">539</FONT>                }<a name="line.539"></a>
+<FONT color="green">540</FONT>                if (current &lt; 0) {<a name="line.540"></a>
+<FONT color="green">541</FONT>                    throw MathRuntimeException.createNoSuchElementException(EXHAUSTED_ITERATOR_MESSAGE);<a name="line.541"></a>
+<FONT color="green">542</FONT>                }<a name="line.542"></a>
+<FONT color="green">543</FONT>                return keys[current];<a name="line.543"></a>
+<FONT color="green">544</FONT>            }<a name="line.544"></a>
+<FONT color="green">545</FONT>    <a name="line.545"></a>
+<FONT color="green">546</FONT>            /**<a name="line.546"></a>
+<FONT color="green">547</FONT>             * Get the value of current entry.<a name="line.547"></a>
+<FONT color="green">548</FONT>             * @return value of current entry<a name="line.548"></a>
+<FONT color="green">549</FONT>             * @exception ConcurrentModificationException if the map is modified during iteration<a name="line.549"></a>
+<FONT color="green">550</FONT>             * @exception NoSuchElementException if there is no element left in the map<a name="line.550"></a>
+<FONT color="green">551</FONT>             */<a name="line.551"></a>
+<FONT color="green">552</FONT>            public double value()<a name="line.552"></a>
+<FONT color="green">553</FONT>                throws ConcurrentModificationException, NoSuchElementException {<a name="line.553"></a>
+<FONT color="green">554</FONT>                if (referenceCount != count) {<a name="line.554"></a>
+<FONT color="green">555</FONT>                    throw MathRuntimeException.createConcurrentModificationException(<a name="line.555"></a>
+<FONT color="green">556</FONT>                          CONCURRENT_MODIFICATION_MESSAGE);<a name="line.556"></a>
+<FONT color="green">557</FONT>                }<a name="line.557"></a>
+<FONT color="green">558</FONT>                if (current &lt; 0) {<a name="line.558"></a>
+<FONT color="green">559</FONT>                    throw MathRuntimeException.createNoSuchElementException(EXHAUSTED_ITERATOR_MESSAGE);<a name="line.559"></a>
+<FONT color="green">560</FONT>                }<a name="line.560"></a>
+<FONT color="green">561</FONT>                return values[current];<a name="line.561"></a>
+<FONT color="green">562</FONT>            }<a name="line.562"></a>
+<FONT color="green">563</FONT>    <a name="line.563"></a>
+<FONT color="green">564</FONT>            /**<a name="line.564"></a>
+<FONT color="green">565</FONT>             * Advance iterator one step further.<a name="line.565"></a>
+<FONT color="green">566</FONT>             * @exception ConcurrentModificationException if the map is modified during iteration<a name="line.566"></a>
+<FONT color="green">567</FONT>             * @exception NoSuchElementException if there is no element left in the map<a name="line.567"></a>
+<FONT color="green">568</FONT>             */<a name="line.568"></a>
+<FONT color="green">569</FONT>            public void advance()<a name="line.569"></a>
+<FONT color="green">570</FONT>                throws ConcurrentModificationException, NoSuchElementException {<a name="line.570"></a>
+<FONT color="green">571</FONT>    <a name="line.571"></a>
+<FONT color="green">572</FONT>                if (referenceCount != count) {<a name="line.572"></a>
+<FONT color="green">573</FONT>                    throw MathRuntimeException.createConcurrentModificationException(<a name="line.573"></a>
+<FONT color="green">574</FONT>                          CONCURRENT_MODIFICATION_MESSAGE);<a name="line.574"></a>
+<FONT color="green">575</FONT>                }<a name="line.575"></a>
+<FONT color="green">576</FONT>    <a name="line.576"></a>
+<FONT color="green">577</FONT>                // advance on step<a name="line.577"></a>
+<FONT color="green">578</FONT>                current = next;<a name="line.578"></a>
+<FONT color="green">579</FONT>    <a name="line.579"></a>
+<FONT color="green">580</FONT>                // prepare next step<a name="line.580"></a>
+<FONT color="green">581</FONT>                try {<a name="line.581"></a>
+<FONT color="green">582</FONT>                    while (states[++next] != FULL) {<a name="line.582"></a>
+<FONT color="green">583</FONT>                        // nothing to do<a name="line.583"></a>
+<FONT color="green">584</FONT>                    }<a name="line.584"></a>
+<FONT color="green">585</FONT>                } catch (ArrayIndexOutOfBoundsException e) {<a name="line.585"></a>
+<FONT color="green">586</FONT>                    next = -2;<a name="line.586"></a>
+<FONT color="green">587</FONT>                    if (current &lt; 0) {<a name="line.587"></a>
+<FONT color="green">588</FONT>                        throw MathRuntimeException.createNoSuchElementException(EXHAUSTED_ITERATOR_MESSAGE);<a name="line.588"></a>
+<FONT color="green">589</FONT>                    }<a name="line.589"></a>
+<FONT color="green">590</FONT>                }<a name="line.590"></a>
+<FONT color="green">591</FONT>    <a name="line.591"></a>
+<FONT color="green">592</FONT>            }<a name="line.592"></a>
+<FONT color="green">593</FONT>    <a name="line.593"></a>
+<FONT color="green">594</FONT>        }<a name="line.594"></a>
+<FONT color="green">595</FONT>    <a name="line.595"></a>
+<FONT color="green">596</FONT>        /**<a name="line.596"></a>
+<FONT color="green">597</FONT>         * Read a serialized object.<a name="line.597"></a>
+<FONT color="green">598</FONT>         * @param stream input stream<a name="line.598"></a>
+<FONT color="green">599</FONT>         * @throws IOException if object cannot be read<a name="line.599"></a>
+<FONT color="green">600</FONT>         * @throws ClassNotFoundException if the class corresponding<a name="line.600"></a>
+<FONT color="green">601</FONT>         * to the serialized object cannot be found<a name="line.601"></a>
+<FONT color="green">602</FONT>         */<a name="line.602"></a>
+<FONT color="green">603</FONT>        private void readObject(final ObjectInputStream stream)<a name="line.603"></a>
+<FONT color="green">604</FONT>            throws IOException, ClassNotFoundException {<a name="line.604"></a>
+<FONT color="green">605</FONT>            stream.defaultReadObject();<a name="line.605"></a>
+<FONT color="green">606</FONT>            count = 0;<a name="line.606"></a>
+<FONT color="green">607</FONT>        }<a name="line.607"></a>
+<FONT color="green">608</FONT>    <a name="line.608"></a>
+<FONT color="green">609</FONT>    <a name="line.609"></a>
+<FONT color="green">610</FONT>    }<a name="line.610"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/OpenIntToFieldHashMap.Iterator.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,696 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.util;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.IOException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.ObjectInputStream;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.io.Serializable;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.lang.reflect.Array;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.util.ConcurrentModificationException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import java.util.NoSuchElementException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.Field;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.FieldElement;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>    /**<a name="line.30"></a>
+<FONT color="green">031</FONT>     * Open addressed map from int to FieldElement.<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;This class provides a dedicated map from integers to FieldElements with a<a name="line.32"></a>
+<FONT color="green">033</FONT>     * much smaller memory overhead than standard &lt;code&gt;java.util.Map&lt;/code&gt;.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;p&gt;This class is not synchronized. The specialized iterators returned by<a name="line.34"></a>
+<FONT color="green">035</FONT>     * {@link #iterator()} are fail-fast: they throw a<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;code&gt;ConcurrentModificationException&lt;/code&gt; when they detect the map has been<a name="line.36"></a>
+<FONT color="green">037</FONT>     * modified during iteration.&lt;/p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @param &lt;T&gt; the type of the field elements<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @version $Revision: 903047 $ $Date: 2010-01-25 21:07:42 -0500 (Mon, 25 Jan 2010) $<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @since 2.0<a name="line.40"></a>
+<FONT color="green">041</FONT>     */<a name="line.41"></a>
+<FONT color="green">042</FONT>    public class OpenIntToFieldHashMap&lt;T extends FieldElement&lt;T&gt;&gt; implements Serializable {<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Status indicator for free table entries. */<a name="line.44"></a>
+<FONT color="green">045</FONT>        protected static final byte FREE    = 0;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** Status indicator for full table entries. */<a name="line.47"></a>
+<FONT color="green">048</FONT>        protected static final byte FULL    = 1;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Status indicator for removed table entries. */<a name="line.50"></a>
+<FONT color="green">051</FONT>        protected static final byte REMOVED = 2;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** Serializable version identifier. */<a name="line.53"></a>
+<FONT color="green">054</FONT>        private static final long serialVersionUID = -9179080286849120720L;<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** Message for map modification during iteration. */<a name="line.56"></a>
+<FONT color="green">057</FONT>        private static final String CONCURRENT_MODIFICATION_MESSAGE =<a name="line.57"></a>
+<FONT color="green">058</FONT>            "map has been modified while iterating";<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Message for exhausted iterator. */<a name="line.60"></a>
+<FONT color="green">061</FONT>        private static final String EXHAUSTED_ITERATOR_MESSAGE =<a name="line.61"></a>
+<FONT color="green">062</FONT>            "iterator exhausted";<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /** Load factor for the map. */<a name="line.64"></a>
+<FONT color="green">065</FONT>        private static final float LOAD_FACTOR = 0.5f;<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /** Default starting size.<a name="line.67"></a>
+<FONT color="green">068</FONT>         * &lt;p&gt;This must be a power of two for bit mask to work properly. &lt;/p&gt;<a name="line.68"></a>
+<FONT color="green">069</FONT>         */<a name="line.69"></a>
+<FONT color="green">070</FONT>        private static final int DEFAULT_EXPECTED_SIZE = 16;<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /** Multiplier for size growth when map fills up.<a name="line.72"></a>
+<FONT color="green">073</FONT>         * &lt;p&gt;This must be a power of two for bit mask to work properly. &lt;/p&gt;<a name="line.73"></a>
+<FONT color="green">074</FONT>         */<a name="line.74"></a>
+<FONT color="green">075</FONT>        private static final int RESIZE_MULTIPLIER = 2;<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** Number of bits to perturb the index when probing for collision resolution. */<a name="line.77"></a>
+<FONT color="green">078</FONT>        private static final int PERTURB_SHIFT = 5;<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /** Field to which the elements belong. */<a name="line.80"></a>
+<FONT color="green">081</FONT>        private final Field&lt;T&gt; field;<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /** Keys table. */<a name="line.83"></a>
+<FONT color="green">084</FONT>        private int[] keys;<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /** Values table. */<a name="line.86"></a>
+<FONT color="green">087</FONT>        private T[] values;<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /** States table. */<a name="line.89"></a>
+<FONT color="green">090</FONT>        private byte[] states;<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /** Return value for missing entries. */<a name="line.92"></a>
+<FONT color="green">093</FONT>        private final T missingEntries;<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /** Current size of the map. */<a name="line.95"></a>
+<FONT color="green">096</FONT>        private int size;<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /** Bit mask for hash values. */<a name="line.98"></a>
+<FONT color="green">099</FONT>        private int mask;<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /** Modifications count. */<a name="line.101"></a>
+<FONT color="green">102</FONT>        private transient int count;<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /**<a name="line.104"></a>
+<FONT color="green">105</FONT>         * Build an empty map with default size and using zero for missing entries.<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @param field field to which the elements belong<a name="line.106"></a>
+<FONT color="green">107</FONT>         */<a name="line.107"></a>
+<FONT color="green">108</FONT>        public OpenIntToFieldHashMap(final Field&lt;T&gt;field) {<a name="line.108"></a>
+<FONT color="green">109</FONT>            this(field, DEFAULT_EXPECTED_SIZE, field.getZero());<a name="line.109"></a>
+<FONT color="green">110</FONT>        }<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>        /**<a name="line.112"></a>
+<FONT color="green">113</FONT>         * Build an empty map with default size<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param field field to which the elements belong<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @param missingEntries value to return when a missing entry is fetched<a name="line.115"></a>
+<FONT color="green">116</FONT>         */<a name="line.116"></a>
+<FONT color="green">117</FONT>        public OpenIntToFieldHashMap(final Field&lt;T&gt;field, final T missingEntries) {<a name="line.117"></a>
+<FONT color="green">118</FONT>            this(field,DEFAULT_EXPECTED_SIZE, missingEntries);<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /**<a name="line.121"></a>
+<FONT color="green">122</FONT>         * Build an empty map with specified size and using zero for missing entries.<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @param field field to which the elements belong<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @param expectedSize expected number of elements in the map<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        public OpenIntToFieldHashMap(final Field&lt;T&gt; field,final int expectedSize) {<a name="line.126"></a>
+<FONT color="green">127</FONT>            this(field,expectedSize, field.getZero());<a name="line.127"></a>
+<FONT color="green">128</FONT>        }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /**<a name="line.130"></a>
+<FONT color="green">131</FONT>         * Build an empty map with specified size.<a name="line.131"></a>
+<FONT color="green">132</FONT>         * @param field field to which the elements belong<a name="line.132"></a>
+<FONT color="green">133</FONT>         * @param expectedSize expected number of elements in the map<a name="line.133"></a>
+<FONT color="green">134</FONT>         * @param missingEntries value to return when a missing entry is fetched<a name="line.134"></a>
+<FONT color="green">135</FONT>         */<a name="line.135"></a>
+<FONT color="green">136</FONT>        public OpenIntToFieldHashMap(final Field&lt;T&gt; field,final int expectedSize,<a name="line.136"></a>
+<FONT color="green">137</FONT>                                      final T missingEntries) {<a name="line.137"></a>
+<FONT color="green">138</FONT>            this.field = field;<a name="line.138"></a>
+<FONT color="green">139</FONT>            final int capacity = computeCapacity(expectedSize);<a name="line.139"></a>
+<FONT color="green">140</FONT>            keys   = new int[capacity];<a name="line.140"></a>
+<FONT color="green">141</FONT>            values = buildArray(capacity);<a name="line.141"></a>
+<FONT color="green">142</FONT>            states = new byte[capacity];<a name="line.142"></a>
+<FONT color="green">143</FONT>            this.missingEntries = missingEntries;<a name="line.143"></a>
+<FONT color="green">144</FONT>            mask   = capacity - 1;<a name="line.144"></a>
+<FONT color="green">145</FONT>        }<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>        /**<a name="line.147"></a>
+<FONT color="green">148</FONT>         * Copy constructor.<a name="line.148"></a>
+<FONT color="green">149</FONT>         * @param source map to copy<a name="line.149"></a>
+<FONT color="green">150</FONT>         */<a name="line.150"></a>
+<FONT color="green">151</FONT>        public OpenIntToFieldHashMap(final OpenIntToFieldHashMap&lt;T&gt; source) {<a name="line.151"></a>
+<FONT color="green">152</FONT>            field = source.field;<a name="line.152"></a>
+<FONT color="green">153</FONT>            final int length = source.keys.length;<a name="line.153"></a>
+<FONT color="green">154</FONT>            keys = new int[length];<a name="line.154"></a>
+<FONT color="green">155</FONT>            System.arraycopy(source.keys, 0, keys, 0, length);<a name="line.155"></a>
+<FONT color="green">156</FONT>            values = buildArray(length);<a name="line.156"></a>
+<FONT color="green">157</FONT>            System.arraycopy(source.values, 0, values, 0, length);<a name="line.157"></a>
+<FONT color="green">158</FONT>            states = new byte[length];<a name="line.158"></a>
+<FONT color="green">159</FONT>            System.arraycopy(source.states, 0, states, 0, length);<a name="line.159"></a>
+<FONT color="green">160</FONT>            missingEntries = source.missingEntries;<a name="line.160"></a>
+<FONT color="green">161</FONT>            size  = source.size;<a name="line.161"></a>
+<FONT color="green">162</FONT>            mask  = source.mask;<a name="line.162"></a>
+<FONT color="green">163</FONT>            count = source.count;<a name="line.163"></a>
+<FONT color="green">164</FONT>        }<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>        /**<a name="line.166"></a>
+<FONT color="green">167</FONT>         * Compute the capacity needed for a given size.<a name="line.167"></a>
+<FONT color="green">168</FONT>         * @param expectedSize expected size of the map<a name="line.168"></a>
+<FONT color="green">169</FONT>         * @return capacity to use for the specified size<a name="line.169"></a>
+<FONT color="green">170</FONT>         */<a name="line.170"></a>
+<FONT color="green">171</FONT>        private static int computeCapacity(final int expectedSize) {<a name="line.171"></a>
+<FONT color="green">172</FONT>            if (expectedSize == 0) {<a name="line.172"></a>
+<FONT color="green">173</FONT>                return 1;<a name="line.173"></a>
+<FONT color="green">174</FONT>            }<a name="line.174"></a>
+<FONT color="green">175</FONT>            final int capacity   = (int) Math.ceil(expectedSize / LOAD_FACTOR);<a name="line.175"></a>
+<FONT color="green">176</FONT>            final int powerOfTwo = Integer.highestOneBit(capacity);<a name="line.176"></a>
+<FONT color="green">177</FONT>            if (powerOfTwo == capacity) {<a name="line.177"></a>
+<FONT color="green">178</FONT>                return capacity;<a name="line.178"></a>
+<FONT color="green">179</FONT>            }<a name="line.179"></a>
+<FONT color="green">180</FONT>            return nextPowerOfTwo(capacity);<a name="line.180"></a>
+<FONT color="green">181</FONT>        }<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>        /**<a name="line.183"></a>
+<FONT color="green">184</FONT>         * Find the smallest power of two greater than the input value<a name="line.184"></a>
+<FONT color="green">185</FONT>         * @param i input value<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @return smallest power of two greater than the input value<a name="line.186"></a>
+<FONT color="green">187</FONT>         */<a name="line.187"></a>
+<FONT color="green">188</FONT>        private static int nextPowerOfTwo(final int i) {<a name="line.188"></a>
+<FONT color="green">189</FONT>            return Integer.highestOneBit(i) &lt;&lt; 1;<a name="line.189"></a>
+<FONT color="green">190</FONT>        }<a name="line.190"></a>
+<FONT color="green">191</FONT>    <a name="line.191"></a>
+<FONT color="green">192</FONT>        /**<a name="line.192"></a>
+<FONT color="green">193</FONT>         * Get the stored value associated with the given key<a name="line.193"></a>
+<FONT color="green">194</FONT>         * @param key key associated with the data<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @return data associated with the key<a name="line.195"></a>
+<FONT color="green">196</FONT>         */<a name="line.196"></a>
+<FONT color="green">197</FONT>        public T get(final int key) {<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>            final int hash  = hashOf(key);<a name="line.199"></a>
+<FONT color="green">200</FONT>            int index = hash &amp; mask;<a name="line.200"></a>
+<FONT color="green">201</FONT>            if (containsKey(key, index)) {<a name="line.201"></a>
+<FONT color="green">202</FONT>                return values[index];<a name="line.202"></a>
+<FONT color="green">203</FONT>            }<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>            if (states[index] == FREE) {<a name="line.205"></a>
+<FONT color="green">206</FONT>                return missingEntries;<a name="line.206"></a>
+<FONT color="green">207</FONT>            }<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>            int j = index;<a name="line.209"></a>
+<FONT color="green">210</FONT>            for (int perturb = perturb(hash); states[index] != FREE; perturb &gt;&gt;= PERTURB_SHIFT) {<a name="line.210"></a>
+<FONT color="green">211</FONT>                j = probe(perturb, j);<a name="line.211"></a>
+<FONT color="green">212</FONT>                index = j &amp; mask;<a name="line.212"></a>
+<FONT color="green">213</FONT>                if (containsKey(key, index)) {<a name="line.213"></a>
+<FONT color="green">214</FONT>                    return values[index];<a name="line.214"></a>
+<FONT color="green">215</FONT>                }<a name="line.215"></a>
+<FONT color="green">216</FONT>            }<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>            return missingEntries;<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>        }<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>        /**<a name="line.222"></a>
+<FONT color="green">223</FONT>         * Check if a value is associated with a key.<a name="line.223"></a>
+<FONT color="green">224</FONT>         * @param key key to check<a name="line.224"></a>
+<FONT color="green">225</FONT>         * @return true if a value is associated with key<a name="line.225"></a>
+<FONT color="green">226</FONT>         */<a name="line.226"></a>
+<FONT color="green">227</FONT>        public boolean containsKey(final int key) {<a name="line.227"></a>
+<FONT color="green">228</FONT>    <a name="line.228"></a>
+<FONT color="green">229</FONT>            final int hash  = hashOf(key);<a name="line.229"></a>
+<FONT color="green">230</FONT>            int index = hash &amp; mask;<a name="line.230"></a>
+<FONT color="green">231</FONT>            if (containsKey(key, index)) {<a name="line.231"></a>
+<FONT color="green">232</FONT>                return true;<a name="line.232"></a>
+<FONT color="green">233</FONT>            }<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>            if (states[index] == FREE) {<a name="line.235"></a>
+<FONT color="green">236</FONT>                return false;<a name="line.236"></a>
+<FONT color="green">237</FONT>            }<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>            int j = index;<a name="line.239"></a>
+<FONT color="green">240</FONT>            for (int perturb = perturb(hash); states[index] != FREE; perturb &gt;&gt;= PERTURB_SHIFT) {<a name="line.240"></a>
+<FONT color="green">241</FONT>                j = probe(perturb, j);<a name="line.241"></a>
+<FONT color="green">242</FONT>                index = j &amp; mask;<a name="line.242"></a>
+<FONT color="green">243</FONT>                if (containsKey(key, index)) {<a name="line.243"></a>
+<FONT color="green">244</FONT>                    return true;<a name="line.244"></a>
+<FONT color="green">245</FONT>                }<a name="line.245"></a>
+<FONT color="green">246</FONT>            }<a name="line.246"></a>
+<FONT color="green">247</FONT>    <a name="line.247"></a>
+<FONT color="green">248</FONT>            return false;<a name="line.248"></a>
+<FONT color="green">249</FONT>    <a name="line.249"></a>
+<FONT color="green">250</FONT>        }<a name="line.250"></a>
+<FONT color="green">251</FONT>    <a name="line.251"></a>
+<FONT color="green">252</FONT>        /**<a name="line.252"></a>
+<FONT color="green">253</FONT>         * Get an iterator over map elements.<a name="line.253"></a>
+<FONT color="green">254</FONT>         * &lt;p&gt;The specialized iterators returned are fail-fast: they throw a<a name="line.254"></a>
+<FONT color="green">255</FONT>         * &lt;code&gt;ConcurrentModificationException&lt;/code&gt; when they detect the map<a name="line.255"></a>
+<FONT color="green">256</FONT>         * has been modified during iteration.&lt;/p&gt;<a name="line.256"></a>
+<FONT color="green">257</FONT>         * @return iterator over the map elements<a name="line.257"></a>
+<FONT color="green">258</FONT>         */<a name="line.258"></a>
+<FONT color="green">259</FONT>        public Iterator iterator() {<a name="line.259"></a>
+<FONT color="green">260</FONT>            return new Iterator();<a name="line.260"></a>
+<FONT color="green">261</FONT>        }<a name="line.261"></a>
+<FONT color="green">262</FONT>    <a name="line.262"></a>
+<FONT color="green">263</FONT>        /**<a name="line.263"></a>
+<FONT color="green">264</FONT>         * Perturb the hash for starting probing.<a name="line.264"></a>
+<FONT color="green">265</FONT>         * @param hash initial hash<a name="line.265"></a>
+<FONT color="green">266</FONT>         * @return perturbed hash<a name="line.266"></a>
+<FONT color="green">267</FONT>         */<a name="line.267"></a>
+<FONT color="green">268</FONT>        private static int perturb(final int hash) {<a name="line.268"></a>
+<FONT color="green">269</FONT>            return hash &amp; 0x7fffffff;<a name="line.269"></a>
+<FONT color="green">270</FONT>        }<a name="line.270"></a>
+<FONT color="green">271</FONT>    <a name="line.271"></a>
+<FONT color="green">272</FONT>        /**<a name="line.272"></a>
+<FONT color="green">273</FONT>         * Find the index at which a key should be inserted<a name="line.273"></a>
+<FONT color="green">274</FONT>         * @param key key to lookup<a name="line.274"></a>
+<FONT color="green">275</FONT>         * @return index at which key should be inserted<a name="line.275"></a>
+<FONT color="green">276</FONT>         */<a name="line.276"></a>
+<FONT color="green">277</FONT>        private int findInsertionIndex(final int key) {<a name="line.277"></a>
+<FONT color="green">278</FONT>            return findInsertionIndex(keys, states, key, mask);<a name="line.278"></a>
+<FONT color="green">279</FONT>        }<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>        /**<a name="line.281"></a>
+<FONT color="green">282</FONT>         * Find the index at which a key should be inserted<a name="line.282"></a>
+<FONT color="green">283</FONT>         * @param keys keys table<a name="line.283"></a>
+<FONT color="green">284</FONT>         * @param states states table<a name="line.284"></a>
+<FONT color="green">285</FONT>         * @param key key to lookup<a name="line.285"></a>
+<FONT color="green">286</FONT>         * @param mask bit mask for hash values<a name="line.286"></a>
+<FONT color="green">287</FONT>         * @return index at which key should be inserted<a name="line.287"></a>
+<FONT color="green">288</FONT>         */<a name="line.288"></a>
+<FONT color="green">289</FONT>        private static int findInsertionIndex(final int[] keys, final byte[] states,<a name="line.289"></a>
+<FONT color="green">290</FONT>                                              final int key, final int mask) {<a name="line.290"></a>
+<FONT color="green">291</FONT>            final int hash = hashOf(key);<a name="line.291"></a>
+<FONT color="green">292</FONT>            int index = hash &amp; mask;<a name="line.292"></a>
+<FONT color="green">293</FONT>            if (states[index] == FREE) {<a name="line.293"></a>
+<FONT color="green">294</FONT>                return index;<a name="line.294"></a>
+<FONT color="green">295</FONT>            } else if (states[index] == FULL &amp;&amp; keys[index] == key) {<a name="line.295"></a>
+<FONT color="green">296</FONT>                return changeIndexSign(index);<a name="line.296"></a>
+<FONT color="green">297</FONT>            }<a name="line.297"></a>
+<FONT color="green">298</FONT>    <a name="line.298"></a>
+<FONT color="green">299</FONT>            int perturb = perturb(hash);<a name="line.299"></a>
+<FONT color="green">300</FONT>            int j = index;<a name="line.300"></a>
+<FONT color="green">301</FONT>            if (states[index] == FULL) {<a name="line.301"></a>
+<FONT color="green">302</FONT>                while (true) {<a name="line.302"></a>
+<FONT color="green">303</FONT>                    j = probe(perturb, j);<a name="line.303"></a>
+<FONT color="green">304</FONT>                    index = j &amp; mask;<a name="line.304"></a>
+<FONT color="green">305</FONT>                    perturb &gt;&gt;= PERTURB_SHIFT;<a name="line.305"></a>
+<FONT color="green">306</FONT>    <a name="line.306"></a>
+<FONT color="green">307</FONT>                    if (states[index] != FULL || keys[index] == key) {<a name="line.307"></a>
+<FONT color="green">308</FONT>                        break;<a name="line.308"></a>
+<FONT color="green">309</FONT>                    }<a name="line.309"></a>
+<FONT color="green">310</FONT>                }<a name="line.310"></a>
+<FONT color="green">311</FONT>            }<a name="line.311"></a>
+<FONT color="green">312</FONT>    <a name="line.312"></a>
+<FONT color="green">313</FONT>            if (states[index] == FREE) {<a name="line.313"></a>
+<FONT color="green">314</FONT>                return index;<a name="line.314"></a>
+<FONT color="green">315</FONT>            } else if (states[index] == FULL) {<a name="line.315"></a>
+<FONT color="green">316</FONT>                // due to the loop exit condition,<a name="line.316"></a>
+<FONT color="green">317</FONT>                // if (states[index] == FULL) then keys[index] == key<a name="line.317"></a>
+<FONT color="green">318</FONT>                return changeIndexSign(index);<a name="line.318"></a>
+<FONT color="green">319</FONT>            }<a name="line.319"></a>
+<FONT color="green">320</FONT>    <a name="line.320"></a>
+<FONT color="green">321</FONT>            final int firstRemoved = index;<a name="line.321"></a>
+<FONT color="green">322</FONT>            while (true) {<a name="line.322"></a>
+<FONT color="green">323</FONT>                j = probe(perturb, j);<a name="line.323"></a>
+<FONT color="green">324</FONT>                index = j &amp; mask;<a name="line.324"></a>
+<FONT color="green">325</FONT>    <a name="line.325"></a>
+<FONT color="green">326</FONT>                if (states[index] == FREE) {<a name="line.326"></a>
+<FONT color="green">327</FONT>                    return firstRemoved;<a name="line.327"></a>
+<FONT color="green">328</FONT>                } else if (states[index] == FULL &amp;&amp; keys[index] == key) {<a name="line.328"></a>
+<FONT color="green">329</FONT>                    return changeIndexSign(index);<a name="line.329"></a>
+<FONT color="green">330</FONT>                }<a name="line.330"></a>
+<FONT color="green">331</FONT>    <a name="line.331"></a>
+<FONT color="green">332</FONT>                perturb &gt;&gt;= PERTURB_SHIFT;<a name="line.332"></a>
+<FONT color="green">333</FONT>    <a name="line.333"></a>
+<FONT color="green">334</FONT>            }<a name="line.334"></a>
+<FONT color="green">335</FONT>    <a name="line.335"></a>
+<FONT color="green">336</FONT>        }<a name="line.336"></a>
+<FONT color="green">337</FONT>    <a name="line.337"></a>
+<FONT color="green">338</FONT>        /**<a name="line.338"></a>
+<FONT color="green">339</FONT>         * Compute next probe for collision resolution<a name="line.339"></a>
+<FONT color="green">340</FONT>         * @param perturb perturbed hash<a name="line.340"></a>
+<FONT color="green">341</FONT>         * @param j previous probe<a name="line.341"></a>
+<FONT color="green">342</FONT>         * @return next probe<a name="line.342"></a>
+<FONT color="green">343</FONT>         */<a name="line.343"></a>
+<FONT color="green">344</FONT>        private static int probe(final int perturb, final int j) {<a name="line.344"></a>
+<FONT color="green">345</FONT>            return (j &lt;&lt; 2) + j + perturb + 1;<a name="line.345"></a>
+<FONT color="green">346</FONT>        }<a name="line.346"></a>
+<FONT color="green">347</FONT>    <a name="line.347"></a>
+<FONT color="green">348</FONT>        /**<a name="line.348"></a>
+<FONT color="green">349</FONT>         * Change the index sign<a name="line.349"></a>
+<FONT color="green">350</FONT>         * @param index initial index<a name="line.350"></a>
+<FONT color="green">351</FONT>         * @return changed index<a name="line.351"></a>
+<FONT color="green">352</FONT>         */<a name="line.352"></a>
+<FONT color="green">353</FONT>        private static int changeIndexSign(final int index) {<a name="line.353"></a>
+<FONT color="green">354</FONT>            return -index - 1;<a name="line.354"></a>
+<FONT color="green">355</FONT>        }<a name="line.355"></a>
+<FONT color="green">356</FONT>    <a name="line.356"></a>
+<FONT color="green">357</FONT>        /**<a name="line.357"></a>
+<FONT color="green">358</FONT>         * Get the number of elements stored in the map.<a name="line.358"></a>
+<FONT color="green">359</FONT>         * @return number of elements stored in the map<a name="line.359"></a>
+<FONT color="green">360</FONT>         */<a name="line.360"></a>
+<FONT color="green">361</FONT>        public int size() {<a name="line.361"></a>
+<FONT color="green">362</FONT>            return size;<a name="line.362"></a>
+<FONT color="green">363</FONT>        }<a name="line.363"></a>
+<FONT color="green">364</FONT>    <a name="line.364"></a>
+<FONT color="green">365</FONT>    <a name="line.365"></a>
+<FONT color="green">366</FONT>        /**<a name="line.366"></a>
+<FONT color="green">367</FONT>         * Remove the value associated with a key.<a name="line.367"></a>
+<FONT color="green">368</FONT>         * @param key key to which the value is associated<a name="line.368"></a>
+<FONT color="green">369</FONT>         * @return removed value<a name="line.369"></a>
+<FONT color="green">370</FONT>         */<a name="line.370"></a>
+<FONT color="green">371</FONT>        public T remove(final int key) {<a name="line.371"></a>
+<FONT color="green">372</FONT>    <a name="line.372"></a>
+<FONT color="green">373</FONT>            final int hash  = hashOf(key);<a name="line.373"></a>
+<FONT color="green">374</FONT>            int index = hash &amp; mask;<a name="line.374"></a>
+<FONT color="green">375</FONT>            if (containsKey(key, index)) {<a name="line.375"></a>
+<FONT color="green">376</FONT>                return doRemove(index);<a name="line.376"></a>
+<FONT color="green">377</FONT>            }<a name="line.377"></a>
+<FONT color="green">378</FONT>    <a name="line.378"></a>
+<FONT color="green">379</FONT>            if (states[index] == FREE) {<a name="line.379"></a>
+<FONT color="green">380</FONT>                return missingEntries;<a name="line.380"></a>
+<FONT color="green">381</FONT>            }<a name="line.381"></a>
+<FONT color="green">382</FONT>    <a name="line.382"></a>
+<FONT color="green">383</FONT>            int j = index;<a name="line.383"></a>
+<FONT color="green">384</FONT>            for (int perturb = perturb(hash); states[index] != FREE; perturb &gt;&gt;= PERTURB_SHIFT) {<a name="line.384"></a>
+<FONT color="green">385</FONT>                j = probe(perturb, j);<a name="line.385"></a>
+<FONT color="green">386</FONT>                index = j &amp; mask;<a name="line.386"></a>
+<FONT color="green">387</FONT>                if (containsKey(key, index)) {<a name="line.387"></a>
+<FONT color="green">388</FONT>                    return doRemove(index);<a name="line.388"></a>
+<FONT color="green">389</FONT>                }<a name="line.389"></a>
+<FONT color="green">390</FONT>            }<a name="line.390"></a>
+<FONT color="green">391</FONT>    <a name="line.391"></a>
+<FONT color="green">392</FONT>            return missingEntries;<a name="line.392"></a>
+<FONT color="green">393</FONT>    <a name="line.393"></a>
+<FONT color="green">394</FONT>        }<a name="line.394"></a>
+<FONT color="green">395</FONT>    <a name="line.395"></a>
+<FONT color="green">396</FONT>        /**<a name="line.396"></a>
+<FONT color="green">397</FONT>         * Check if the tables contain an element associated with specified key<a name="line.397"></a>
+<FONT color="green">398</FONT>         * at specified index.<a name="line.398"></a>
+<FONT color="green">399</FONT>         * @param key key to check<a name="line.399"></a>
+<FONT color="green">400</FONT>         * @param index index to check<a name="line.400"></a>
+<FONT color="green">401</FONT>         * @return true if an element is associated with key at index<a name="line.401"></a>
+<FONT color="green">402</FONT>         */<a name="line.402"></a>
+<FONT color="green">403</FONT>        private boolean containsKey(final int key, final int index) {<a name="line.403"></a>
+<FONT color="green">404</FONT>            return (key != 0 || states[index] == FULL) &amp;&amp; keys[index] == key;<a name="line.404"></a>
+<FONT color="green">405</FONT>        }<a name="line.405"></a>
+<FONT color="green">406</FONT>    <a name="line.406"></a>
+<FONT color="green">407</FONT>        /**<a name="line.407"></a>
+<FONT color="green">408</FONT>         * Remove an element at specified index.<a name="line.408"></a>
+<FONT color="green">409</FONT>         * @param index index of the element to remove<a name="line.409"></a>
+<FONT color="green">410</FONT>         * @return removed value<a name="line.410"></a>
+<FONT color="green">411</FONT>         */<a name="line.411"></a>
+<FONT color="green">412</FONT>        private T doRemove(int index) {<a name="line.412"></a>
+<FONT color="green">413</FONT>            keys[index]   = 0;<a name="line.413"></a>
+<FONT color="green">414</FONT>            states[index] = REMOVED;<a name="line.414"></a>
+<FONT color="green">415</FONT>            final T previous = values[index];<a name="line.415"></a>
+<FONT color="green">416</FONT>            values[index] = missingEntries;<a name="line.416"></a>
+<FONT color="green">417</FONT>            --size;<a name="line.417"></a>
+<FONT color="green">418</FONT>            ++count;<a name="line.418"></a>
+<FONT color="green">419</FONT>            return previous;<a name="line.419"></a>
+<FONT color="green">420</FONT>        }<a name="line.420"></a>
+<FONT color="green">421</FONT>    <a name="line.421"></a>
+<FONT color="green">422</FONT>        /**<a name="line.422"></a>
+<FONT color="green">423</FONT>         * Put a value associated with a key in the map.<a name="line.423"></a>
+<FONT color="green">424</FONT>         * @param key key to which value is associated<a name="line.424"></a>
+<FONT color="green">425</FONT>         * @param value value to put in the map<a name="line.425"></a>
+<FONT color="green">426</FONT>         * @return previous value associated with the key<a name="line.426"></a>
+<FONT color="green">427</FONT>         */<a name="line.427"></a>
+<FONT color="green">428</FONT>        public T put(final int key, final T value) {<a name="line.428"></a>
+<FONT color="green">429</FONT>            int index = findInsertionIndex(key);<a name="line.429"></a>
+<FONT color="green">430</FONT>            T previous = missingEntries;<a name="line.430"></a>
+<FONT color="green">431</FONT>            boolean newMapping = true;<a name="line.431"></a>
+<FONT color="green">432</FONT>            if (index &lt; 0) {<a name="line.432"></a>
+<FONT color="green">433</FONT>                index = changeIndexSign(index);<a name="line.433"></a>
+<FONT color="green">434</FONT>                previous = values[index];<a name="line.434"></a>
+<FONT color="green">435</FONT>                newMapping = false;<a name="line.435"></a>
+<FONT color="green">436</FONT>            }<a name="line.436"></a>
+<FONT color="green">437</FONT>            keys[index]   = key;<a name="line.437"></a>
+<FONT color="green">438</FONT>            states[index] = FULL;<a name="line.438"></a>
+<FONT color="green">439</FONT>            values[index] = value;<a name="line.439"></a>
+<FONT color="green">440</FONT>            if (newMapping) {<a name="line.440"></a>
+<FONT color="green">441</FONT>                ++size;<a name="line.441"></a>
+<FONT color="green">442</FONT>                if (shouldGrowTable()) {<a name="line.442"></a>
+<FONT color="green">443</FONT>                    growTable();<a name="line.443"></a>
+<FONT color="green">444</FONT>                }<a name="line.444"></a>
+<FONT color="green">445</FONT>                ++count;<a name="line.445"></a>
+<FONT color="green">446</FONT>            }<a name="line.446"></a>
+<FONT color="green">447</FONT>            return previous;<a name="line.447"></a>
+<FONT color="green">448</FONT>    <a name="line.448"></a>
+<FONT color="green">449</FONT>        }<a name="line.449"></a>
+<FONT color="green">450</FONT>    <a name="line.450"></a>
+<FONT color="green">451</FONT>        /**<a name="line.451"></a>
+<FONT color="green">452</FONT>         * Grow the tables.<a name="line.452"></a>
+<FONT color="green">453</FONT>         */<a name="line.453"></a>
+<FONT color="green">454</FONT>        private void growTable() {<a name="line.454"></a>
+<FONT color="green">455</FONT>    <a name="line.455"></a>
+<FONT color="green">456</FONT>            final int oldLength      = states.length;<a name="line.456"></a>
+<FONT color="green">457</FONT>            final int[] oldKeys      = keys;<a name="line.457"></a>
+<FONT color="green">458</FONT>            final T[] oldValues = values;<a name="line.458"></a>
+<FONT color="green">459</FONT>            final byte[] oldStates   = states;<a name="line.459"></a>
+<FONT color="green">460</FONT>    <a name="line.460"></a>
+<FONT color="green">461</FONT>            final int newLength = RESIZE_MULTIPLIER * oldLength;<a name="line.461"></a>
+<FONT color="green">462</FONT>            final int[] newKeys = new int[newLength];<a name="line.462"></a>
+<FONT color="green">463</FONT>            final T[] newValues = buildArray(newLength);<a name="line.463"></a>
+<FONT color="green">464</FONT>            final byte[] newStates = new byte[newLength];<a name="line.464"></a>
+<FONT color="green">465</FONT>            final int newMask = newLength - 1;<a name="line.465"></a>
+<FONT color="green">466</FONT>            for (int i = 0; i &lt; oldLength; ++i) {<a name="line.466"></a>
+<FONT color="green">467</FONT>                if (oldStates[i] == FULL) {<a name="line.467"></a>
+<FONT color="green">468</FONT>                    final int key = oldKeys[i];<a name="line.468"></a>
+<FONT color="green">469</FONT>                    final int index = findInsertionIndex(newKeys, newStates, key, newMask);<a name="line.469"></a>
+<FONT color="green">470</FONT>                    newKeys[index]   = key;<a name="line.470"></a>
+<FONT color="green">471</FONT>                    newValues[index] = oldValues[i];<a name="line.471"></a>
+<FONT color="green">472</FONT>                    newStates[index] = FULL;<a name="line.472"></a>
+<FONT color="green">473</FONT>                }<a name="line.473"></a>
+<FONT color="green">474</FONT>            }<a name="line.474"></a>
+<FONT color="green">475</FONT>    <a name="line.475"></a>
+<FONT color="green">476</FONT>            mask   = newMask;<a name="line.476"></a>
+<FONT color="green">477</FONT>            keys   = newKeys;<a name="line.477"></a>
+<FONT color="green">478</FONT>            values = newValues;<a name="line.478"></a>
+<FONT color="green">479</FONT>            states = newStates;<a name="line.479"></a>
+<FONT color="green">480</FONT>    <a name="line.480"></a>
+<FONT color="green">481</FONT>        }<a name="line.481"></a>
+<FONT color="green">482</FONT>    <a name="line.482"></a>
+<FONT color="green">483</FONT>        /**<a name="line.483"></a>
+<FONT color="green">484</FONT>         * Check if tables should grow due to increased size.<a name="line.484"></a>
+<FONT color="green">485</FONT>         * @return true if  tables should grow<a name="line.485"></a>
+<FONT color="green">486</FONT>         */<a name="line.486"></a>
+<FONT color="green">487</FONT>        private boolean shouldGrowTable() {<a name="line.487"></a>
+<FONT color="green">488</FONT>            return size &gt; (mask + 1) * LOAD_FACTOR;<a name="line.488"></a>
+<FONT color="green">489</FONT>        }<a name="line.489"></a>
+<FONT color="green">490</FONT>    <a name="line.490"></a>
+<FONT color="green">491</FONT>        /**<a name="line.491"></a>
+<FONT color="green">492</FONT>         * Compute the hash value of a key<a name="line.492"></a>
+<FONT color="green">493</FONT>         * @param key key to hash<a name="line.493"></a>
+<FONT color="green">494</FONT>         * @return hash value of the key<a name="line.494"></a>
+<FONT color="green">495</FONT>         */<a name="line.495"></a>
+<FONT color="green">496</FONT>        private static int hashOf(final int key) {<a name="line.496"></a>
+<FONT color="green">497</FONT>            final int h = key ^ ((key &gt;&gt;&gt; 20) ^ (key &gt;&gt;&gt; 12));<a name="line.497"></a>
+<FONT color="green">498</FONT>            return h ^ (h &gt;&gt;&gt; 7) ^ (h &gt;&gt;&gt; 4);<a name="line.498"></a>
+<FONT color="green">499</FONT>        }<a name="line.499"></a>
+<FONT color="green">500</FONT>    <a name="line.500"></a>
+<FONT color="green">501</FONT>    <a name="line.501"></a>
+<FONT color="green">502</FONT>        /** Iterator class for the map. */<a name="line.502"></a>
+<FONT color="green">503</FONT>        public class Iterator {<a name="line.503"></a>
+<FONT color="green">504</FONT>    <a name="line.504"></a>
+<FONT color="green">505</FONT>            /** Reference modification count. */<a name="line.505"></a>
+<FONT color="green">506</FONT>            private final int referenceCount;<a name="line.506"></a>
+<FONT color="green">507</FONT>    <a name="line.507"></a>
+<FONT color="green">508</FONT>            /** Index of current element. */<a name="line.508"></a>
+<FONT color="green">509</FONT>            private int current;<a name="line.509"></a>
+<FONT color="green">510</FONT>    <a name="line.510"></a>
+<FONT color="green">511</FONT>            /** Index of next element. */<a name="line.511"></a>
+<FONT color="green">512</FONT>            private int next;<a name="line.512"></a>
+<FONT color="green">513</FONT>    <a name="line.513"></a>
+<FONT color="green">514</FONT>            /**<a name="line.514"></a>
+<FONT color="green">515</FONT>             * Simple constructor.<a name="line.515"></a>
+<FONT color="green">516</FONT>             */<a name="line.516"></a>
+<FONT color="green">517</FONT>            private Iterator() {<a name="line.517"></a>
+<FONT color="green">518</FONT>    <a name="line.518"></a>
+<FONT color="green">519</FONT>                // preserve the modification count of the map to detect concurrent modifications later<a name="line.519"></a>
+<FONT color="green">520</FONT>                referenceCount = count;<a name="line.520"></a>
+<FONT color="green">521</FONT>    <a name="line.521"></a>
+<FONT color="green">522</FONT>                // initialize current index<a name="line.522"></a>
+<FONT color="green">523</FONT>                next = -1;<a name="line.523"></a>
+<FONT color="green">524</FONT>                try {<a name="line.524"></a>
+<FONT color="green">525</FONT>                    advance();<a name="line.525"></a>
+<FONT color="green">526</FONT>                } catch (NoSuchElementException nsee) {<a name="line.526"></a>
+<FONT color="green">527</FONT>                    // ignored<a name="line.527"></a>
+<FONT color="green">528</FONT>                }<a name="line.528"></a>
+<FONT color="green">529</FONT>    <a name="line.529"></a>
+<FONT color="green">530</FONT>            }<a name="line.530"></a>
+<FONT color="green">531</FONT>    <a name="line.531"></a>
+<FONT color="green">532</FONT>            /**<a name="line.532"></a>
+<FONT color="green">533</FONT>             * Check if there is a next element in the map.<a name="line.533"></a>
+<FONT color="green">534</FONT>             * @return true if there is a next element<a name="line.534"></a>
+<FONT color="green">535</FONT>             */<a name="line.535"></a>
+<FONT color="green">536</FONT>            public boolean hasNext() {<a name="line.536"></a>
+<FONT color="green">537</FONT>                return next &gt;= 0;<a name="line.537"></a>
+<FONT color="green">538</FONT>            }<a name="line.538"></a>
+<FONT color="green">539</FONT>    <a name="line.539"></a>
+<FONT color="green">540</FONT>            /**<a name="line.540"></a>
+<FONT color="green">541</FONT>             * Get the key of current entry.<a name="line.541"></a>
+<FONT color="green">542</FONT>             * @return key of current entry<a name="line.542"></a>
+<FONT color="green">543</FONT>             * @exception ConcurrentModificationException if the map is modified during iteration<a name="line.543"></a>
+<FONT color="green">544</FONT>             * @exception NoSuchElementException if there is no element left in the map<a name="line.544"></a>
+<FONT color="green">545</FONT>             */<a name="line.545"></a>
+<FONT color="green">546</FONT>            public int key()<a name="line.546"></a>
+<FONT color="green">547</FONT>                throws ConcurrentModificationException, NoSuchElementException {<a name="line.547"></a>
+<FONT color="green">548</FONT>                if (referenceCount != count) {<a name="line.548"></a>
+<FONT color="green">549</FONT>                    throw MathRuntimeException.createConcurrentModificationException(<a name="line.549"></a>
+<FONT color="green">550</FONT>                          CONCURRENT_MODIFICATION_MESSAGE);<a name="line.550"></a>
+<FONT color="green">551</FONT>                }<a name="line.551"></a>
+<FONT color="green">552</FONT>                if (current &lt; 0) {<a name="line.552"></a>
+<FONT color="green">553</FONT>                    throw MathRuntimeException.createNoSuchElementException(EXHAUSTED_ITERATOR_MESSAGE);<a name="line.553"></a>
+<FONT color="green">554</FONT>                }<a name="line.554"></a>
+<FONT color="green">555</FONT>                return keys[current];<a name="line.555"></a>
+<FONT color="green">556</FONT>            }<a name="line.556"></a>
+<FONT color="green">557</FONT>    <a name="line.557"></a>
+<FONT color="green">558</FONT>            /**<a name="line.558"></a>
+<FONT color="green">559</FONT>             * Get the value of current entry.<a name="line.559"></a>
+<FONT color="green">560</FONT>             * @return value of current entry<a name="line.560"></a>
+<FONT color="green">561</FONT>             * @exception ConcurrentModificationException if the map is modified during iteration<a name="line.561"></a>
+<FONT color="green">562</FONT>             * @exception NoSuchElementException if there is no element left in the map<a name="line.562"></a>
+<FONT color="green">563</FONT>             */<a name="line.563"></a>
+<FONT color="green">564</FONT>            public T value()<a name="line.564"></a>
+<FONT color="green">565</FONT>                throws ConcurrentModificationException, NoSuchElementException {<a name="line.565"></a>
+<FONT color="green">566</FONT>                if (referenceCount != count) {<a name="line.566"></a>
+<FONT color="green">567</FONT>                    throw MathRuntimeException.createConcurrentModificationException(<a name="line.567"></a>
+<FONT color="green">568</FONT>                          CONCURRENT_MODIFICATION_MESSAGE);<a name="line.568"></a>
+<FONT color="green">569</FONT>                }<a name="line.569"></a>
+<FONT color="green">570</FONT>                if (current &lt; 0) {<a name="line.570"></a>
+<FONT color="green">571</FONT>                    throw MathRuntimeException.createNoSuchElementException(EXHAUSTED_ITERATOR_MESSAGE);<a name="line.571"></a>
+<FONT color="green">572</FONT>                }<a name="line.572"></a>
+<FONT color="green">573</FONT>                return values[current];<a name="line.573"></a>
+<FONT color="green">574</FONT>            }<a name="line.574"></a>
+<FONT color="green">575</FONT>    <a name="line.575"></a>
+<FONT color="green">576</FONT>            /**<a name="line.576"></a>
+<FONT color="green">577</FONT>             * Advance iterator one step further.<a name="line.577"></a>
+<FONT color="green">578</FONT>             * @exception ConcurrentModificationException if the map is modified during iteration<a name="line.578"></a>
+<FONT color="green">579</FONT>             * @exception NoSuchElementException if there is no element left in the map<a name="line.579"></a>
+<FONT color="green">580</FONT>             */<a name="line.580"></a>
+<FONT color="green">581</FONT>            public void advance()<a name="line.581"></a>
+<FONT color="green">582</FONT>                throws ConcurrentModificationException, NoSuchElementException {<a name="line.582"></a>
+<FONT color="green">583</FONT>    <a name="line.583"></a>
+<FONT color="green">584</FONT>                if (referenceCount != count) {<a name="line.584"></a>
+<FONT color="green">585</FONT>                    throw MathRuntimeException.createConcurrentModificationException(<a name="line.585"></a>
+<FONT color="green">586</FONT>                          CONCURRENT_MODIFICATION_MESSAGE);<a name="line.586"></a>
+<FONT color="green">587</FONT>                }<a name="line.587"></a>
+<FONT color="green">588</FONT>    <a name="line.588"></a>
+<FONT color="green">589</FONT>                // advance on step<a name="line.589"></a>
+<FONT color="green">590</FONT>                current = next;<a name="line.590"></a>
+<FONT color="green">591</FONT>    <a name="line.591"></a>
+<FONT color="green">592</FONT>                // prepare next step<a name="line.592"></a>
+<FONT color="green">593</FONT>                try {<a name="line.593"></a>
+<FONT color="green">594</FONT>                    while (states[++next] != FULL) {<a name="line.594"></a>
+<FONT color="green">595</FONT>                        // nothing to do<a name="line.595"></a>
+<FONT color="green">596</FONT>                    }<a name="line.596"></a>
+<FONT color="green">597</FONT>                } catch (ArrayIndexOutOfBoundsException e) {<a name="line.597"></a>
+<FONT color="green">598</FONT>                    next = -2;<a name="line.598"></a>
+<FONT color="green">599</FONT>                    if (current &lt; 0) {<a name="line.599"></a>
+<FONT color="green">600</FONT>                        throw MathRuntimeException.createNoSuchElementException(EXHAUSTED_ITERATOR_MESSAGE);<a name="line.600"></a>
+<FONT color="green">601</FONT>                    }<a name="line.601"></a>
+<FONT color="green">602</FONT>                }<a name="line.602"></a>
+<FONT color="green">603</FONT>    <a name="line.603"></a>
+<FONT color="green">604</FONT>            }<a name="line.604"></a>
+<FONT color="green">605</FONT>    <a name="line.605"></a>
+<FONT color="green">606</FONT>        }<a name="line.606"></a>
+<FONT color="green">607</FONT>    <a name="line.607"></a>
+<FONT color="green">608</FONT>        /**<a name="line.608"></a>
+<FONT color="green">609</FONT>         * Read a serialized object.<a name="line.609"></a>
+<FONT color="green">610</FONT>         * @param stream input stream<a name="line.610"></a>
+<FONT color="green">611</FONT>         * @throws IOException if object cannot be read<a name="line.611"></a>
+<FONT color="green">612</FONT>         * @throws ClassNotFoundException if the class corresponding<a name="line.612"></a>
+<FONT color="green">613</FONT>         * to the serialized object cannot be found<a name="line.613"></a>
+<FONT color="green">614</FONT>         */<a name="line.614"></a>
+<FONT color="green">615</FONT>        private void readObject(final ObjectInputStream stream)<a name="line.615"></a>
+<FONT color="green">616</FONT>            throws IOException, ClassNotFoundException {<a name="line.616"></a>
+<FONT color="green">617</FONT>            stream.defaultReadObject();<a name="line.617"></a>
+<FONT color="green">618</FONT>            count = 0;<a name="line.618"></a>
+<FONT color="green">619</FONT>        }<a name="line.619"></a>
+<FONT color="green">620</FONT>    <a name="line.620"></a>
+<FONT color="green">621</FONT>        /** Build an array of elements.<a name="line.621"></a>
+<FONT color="green">622</FONT>         * @param length size of the array to build<a name="line.622"></a>
+<FONT color="green">623</FONT>         * @return a new array<a name="line.623"></a>
+<FONT color="green">624</FONT>         */<a name="line.624"></a>
+<FONT color="green">625</FONT>        @SuppressWarnings("unchecked") // field is of type T<a name="line.625"></a>
+<FONT color="green">626</FONT>        private T[] buildArray(final int length) {<a name="line.626"></a>
+<FONT color="green">627</FONT>            return (T[]) Array.newInstance(field.getZero().getClass(), length);<a name="line.627"></a>
+<FONT color="green">628</FONT>        }<a name="line.628"></a>
+<FONT color="green">629</FONT>    <a name="line.629"></a>
+<FONT color="green">630</FONT>    }<a name="line.630"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/OpenIntToFieldHashMap.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,696 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.util;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.IOException;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.io.ObjectInputStream;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.io.Serializable;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.lang.reflect.Array;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.util.ConcurrentModificationException;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import java.util.NoSuchElementException;<a name="line.24"></a>
+<FONT color="green">025</FONT>    <a name="line.25"></a>
+<FONT color="green">026</FONT>    import org.apache.commons.math.Field;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import org.apache.commons.math.FieldElement;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.28"></a>
+<FONT color="green">029</FONT>    <a name="line.29"></a>
+<FONT color="green">030</FONT>    /**<a name="line.30"></a>
+<FONT color="green">031</FONT>     * Open addressed map from int to FieldElement.<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;p&gt;This class provides a dedicated map from integers to FieldElements with a<a name="line.32"></a>
+<FONT color="green">033</FONT>     * much smaller memory overhead than standard &lt;code&gt;java.util.Map&lt;/code&gt;.&lt;/p&gt;<a name="line.33"></a>
+<FONT color="green">034</FONT>     * &lt;p&gt;This class is not synchronized. The specialized iterators returned by<a name="line.34"></a>
+<FONT color="green">035</FONT>     * {@link #iterator()} are fail-fast: they throw a<a name="line.35"></a>
+<FONT color="green">036</FONT>     * &lt;code&gt;ConcurrentModificationException&lt;/code&gt; when they detect the map has been<a name="line.36"></a>
+<FONT color="green">037</FONT>     * modified during iteration.&lt;/p&gt;<a name="line.37"></a>
+<FONT color="green">038</FONT>     * @param &lt;T&gt; the type of the field elements<a name="line.38"></a>
+<FONT color="green">039</FONT>     * @version $Revision: 903047 $ $Date: 2010-01-25 21:07:42 -0500 (Mon, 25 Jan 2010) $<a name="line.39"></a>
+<FONT color="green">040</FONT>     * @since 2.0<a name="line.40"></a>
+<FONT color="green">041</FONT>     */<a name="line.41"></a>
+<FONT color="green">042</FONT>    public class OpenIntToFieldHashMap&lt;T extends FieldElement&lt;T&gt;&gt; implements Serializable {<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /** Status indicator for free table entries. */<a name="line.44"></a>
+<FONT color="green">045</FONT>        protected static final byte FREE    = 0;<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        /** Status indicator for full table entries. */<a name="line.47"></a>
+<FONT color="green">048</FONT>        protected static final byte FULL    = 1;<a name="line.48"></a>
+<FONT color="green">049</FONT>    <a name="line.49"></a>
+<FONT color="green">050</FONT>        /** Status indicator for removed table entries. */<a name="line.50"></a>
+<FONT color="green">051</FONT>        protected static final byte REMOVED = 2;<a name="line.51"></a>
+<FONT color="green">052</FONT>    <a name="line.52"></a>
+<FONT color="green">053</FONT>        /** Serializable version identifier. */<a name="line.53"></a>
+<FONT color="green">054</FONT>        private static final long serialVersionUID = -9179080286849120720L;<a name="line.54"></a>
+<FONT color="green">055</FONT>    <a name="line.55"></a>
+<FONT color="green">056</FONT>        /** Message for map modification during iteration. */<a name="line.56"></a>
+<FONT color="green">057</FONT>        private static final String CONCURRENT_MODIFICATION_MESSAGE =<a name="line.57"></a>
+<FONT color="green">058</FONT>            "map has been modified while iterating";<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        /** Message for exhausted iterator. */<a name="line.60"></a>
+<FONT color="green">061</FONT>        private static final String EXHAUSTED_ITERATOR_MESSAGE =<a name="line.61"></a>
+<FONT color="green">062</FONT>            "iterator exhausted";<a name="line.62"></a>
+<FONT color="green">063</FONT>    <a name="line.63"></a>
+<FONT color="green">064</FONT>        /** Load factor for the map. */<a name="line.64"></a>
+<FONT color="green">065</FONT>        private static final float LOAD_FACTOR = 0.5f;<a name="line.65"></a>
+<FONT color="green">066</FONT>    <a name="line.66"></a>
+<FONT color="green">067</FONT>        /** Default starting size.<a name="line.67"></a>
+<FONT color="green">068</FONT>         * &lt;p&gt;This must be a power of two for bit mask to work properly. &lt;/p&gt;<a name="line.68"></a>
+<FONT color="green">069</FONT>         */<a name="line.69"></a>
+<FONT color="green">070</FONT>        private static final int DEFAULT_EXPECTED_SIZE = 16;<a name="line.70"></a>
+<FONT color="green">071</FONT>    <a name="line.71"></a>
+<FONT color="green">072</FONT>        /** Multiplier for size growth when map fills up.<a name="line.72"></a>
+<FONT color="green">073</FONT>         * &lt;p&gt;This must be a power of two for bit mask to work properly. &lt;/p&gt;<a name="line.73"></a>
+<FONT color="green">074</FONT>         */<a name="line.74"></a>
+<FONT color="green">075</FONT>        private static final int RESIZE_MULTIPLIER = 2;<a name="line.75"></a>
+<FONT color="green">076</FONT>    <a name="line.76"></a>
+<FONT color="green">077</FONT>        /** Number of bits to perturb the index when probing for collision resolution. */<a name="line.77"></a>
+<FONT color="green">078</FONT>        private static final int PERTURB_SHIFT = 5;<a name="line.78"></a>
+<FONT color="green">079</FONT>    <a name="line.79"></a>
+<FONT color="green">080</FONT>        /** Field to which the elements belong. */<a name="line.80"></a>
+<FONT color="green">081</FONT>        private final Field&lt;T&gt; field;<a name="line.81"></a>
+<FONT color="green">082</FONT>    <a name="line.82"></a>
+<FONT color="green">083</FONT>        /** Keys table. */<a name="line.83"></a>
+<FONT color="green">084</FONT>        private int[] keys;<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        /** Values table. */<a name="line.86"></a>
+<FONT color="green">087</FONT>        private T[] values;<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        /** States table. */<a name="line.89"></a>
+<FONT color="green">090</FONT>        private byte[] states;<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /** Return value for missing entries. */<a name="line.92"></a>
+<FONT color="green">093</FONT>        private final T missingEntries;<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        /** Current size of the map. */<a name="line.95"></a>
+<FONT color="green">096</FONT>        private int size;<a name="line.96"></a>
+<FONT color="green">097</FONT>    <a name="line.97"></a>
+<FONT color="green">098</FONT>        /** Bit mask for hash values. */<a name="line.98"></a>
+<FONT color="green">099</FONT>        private int mask;<a name="line.99"></a>
+<FONT color="green">100</FONT>    <a name="line.100"></a>
+<FONT color="green">101</FONT>        /** Modifications count. */<a name="line.101"></a>
+<FONT color="green">102</FONT>        private transient int count;<a name="line.102"></a>
+<FONT color="green">103</FONT>    <a name="line.103"></a>
+<FONT color="green">104</FONT>        /**<a name="line.104"></a>
+<FONT color="green">105</FONT>         * Build an empty map with default size and using zero for missing entries.<a name="line.105"></a>
+<FONT color="green">106</FONT>         * @param field field to which the elements belong<a name="line.106"></a>
+<FONT color="green">107</FONT>         */<a name="line.107"></a>
+<FONT color="green">108</FONT>        public OpenIntToFieldHashMap(final Field&lt;T&gt;field) {<a name="line.108"></a>
+<FONT color="green">109</FONT>            this(field, DEFAULT_EXPECTED_SIZE, field.getZero());<a name="line.109"></a>
+<FONT color="green">110</FONT>        }<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>        /**<a name="line.112"></a>
+<FONT color="green">113</FONT>         * Build an empty map with default size<a name="line.113"></a>
+<FONT color="green">114</FONT>         * @param field field to which the elements belong<a name="line.114"></a>
+<FONT color="green">115</FONT>         * @param missingEntries value to return when a missing entry is fetched<a name="line.115"></a>
+<FONT color="green">116</FONT>         */<a name="line.116"></a>
+<FONT color="green">117</FONT>        public OpenIntToFieldHashMap(final Field&lt;T&gt;field, final T missingEntries) {<a name="line.117"></a>
+<FONT color="green">118</FONT>            this(field,DEFAULT_EXPECTED_SIZE, missingEntries);<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        /**<a name="line.121"></a>
+<FONT color="green">122</FONT>         * Build an empty map with specified size and using zero for missing entries.<a name="line.122"></a>
+<FONT color="green">123</FONT>         * @param field field to which the elements belong<a name="line.123"></a>
+<FONT color="green">124</FONT>         * @param expectedSize expected number of elements in the map<a name="line.124"></a>
+<FONT color="green">125</FONT>         */<a name="line.125"></a>
+<FONT color="green">126</FONT>        public OpenIntToFieldHashMap(final Field&lt;T&gt; field,final int expectedSize) {<a name="line.126"></a>
+<FONT color="green">127</FONT>            this(field,expectedSize, field.getZero());<a name="line.127"></a>
+<FONT color="green">128</FONT>        }<a name="line.128"></a>
+<FONT color="green">129</FONT>    <a name="line.129"></a>
+<FONT color="green">130</FONT>        /**<a name="line.130"></a>
+<FONT color="green">131</FONT>         * Build an empty map with specified size.<a name="line.131"></a>
+<FONT color="green">132</FONT>         * @param field field to which the elements belong<a name="line.132"></a>
+<FONT color="green">133</FONT>         * @param expectedSize expected number of elements in the map<a name="line.133"></a>
+<FONT color="green">134</FONT>         * @param missingEntries value to return when a missing entry is fetched<a name="line.134"></a>
+<FONT color="green">135</FONT>         */<a name="line.135"></a>
+<FONT color="green">136</FONT>        public OpenIntToFieldHashMap(final Field&lt;T&gt; field,final int expectedSize,<a name="line.136"></a>
+<FONT color="green">137</FONT>                                      final T missingEntries) {<a name="line.137"></a>
+<FONT color="green">138</FONT>            this.field = field;<a name="line.138"></a>
+<FONT color="green">139</FONT>            final int capacity = computeCapacity(expectedSize);<a name="line.139"></a>
+<FONT color="green">140</FONT>            keys   = new int[capacity];<a name="line.140"></a>
+<FONT color="green">141</FONT>            values = buildArray(capacity);<a name="line.141"></a>
+<FONT color="green">142</FONT>            states = new byte[capacity];<a name="line.142"></a>
+<FONT color="green">143</FONT>            this.missingEntries = missingEntries;<a name="line.143"></a>
+<FONT color="green">144</FONT>            mask   = capacity - 1;<a name="line.144"></a>
+<FONT color="green">145</FONT>        }<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>        /**<a name="line.147"></a>
+<FONT color="green">148</FONT>         * Copy constructor.<a name="line.148"></a>
+<FONT color="green">149</FONT>         * @param source map to copy<a name="line.149"></a>
+<FONT color="green">150</FONT>         */<a name="line.150"></a>
+<FONT color="green">151</FONT>        public OpenIntToFieldHashMap(final OpenIntToFieldHashMap&lt;T&gt; source) {<a name="line.151"></a>
+<FONT color="green">152</FONT>            field = source.field;<a name="line.152"></a>
+<FONT color="green">153</FONT>            final int length = source.keys.length;<a name="line.153"></a>
+<FONT color="green">154</FONT>            keys = new int[length];<a name="line.154"></a>
+<FONT color="green">155</FONT>            System.arraycopy(source.keys, 0, keys, 0, length);<a name="line.155"></a>
+<FONT color="green">156</FONT>            values = buildArray(length);<a name="line.156"></a>
+<FONT color="green">157</FONT>            System.arraycopy(source.values, 0, values, 0, length);<a name="line.157"></a>
+<FONT color="green">158</FONT>            states = new byte[length];<a name="line.158"></a>
+<FONT color="green">159</FONT>            System.arraycopy(source.states, 0, states, 0, length);<a name="line.159"></a>
+<FONT color="green">160</FONT>            missingEntries = source.missingEntries;<a name="line.160"></a>
+<FONT color="green">161</FONT>            size  = source.size;<a name="line.161"></a>
+<FONT color="green">162</FONT>            mask  = source.mask;<a name="line.162"></a>
+<FONT color="green">163</FONT>            count = source.count;<a name="line.163"></a>
+<FONT color="green">164</FONT>        }<a name="line.164"></a>
+<FONT color="green">165</FONT>    <a name="line.165"></a>
+<FONT color="green">166</FONT>        /**<a name="line.166"></a>
+<FONT color="green">167</FONT>         * Compute the capacity needed for a given size.<a name="line.167"></a>
+<FONT color="green">168</FONT>         * @param expectedSize expected size of the map<a name="line.168"></a>
+<FONT color="green">169</FONT>         * @return capacity to use for the specified size<a name="line.169"></a>
+<FONT color="green">170</FONT>         */<a name="line.170"></a>
+<FONT color="green">171</FONT>        private static int computeCapacity(final int expectedSize) {<a name="line.171"></a>
+<FONT color="green">172</FONT>            if (expectedSize == 0) {<a name="line.172"></a>
+<FONT color="green">173</FONT>                return 1;<a name="line.173"></a>
+<FONT color="green">174</FONT>            }<a name="line.174"></a>
+<FONT color="green">175</FONT>            final int capacity   = (int) Math.ceil(expectedSize / LOAD_FACTOR);<a name="line.175"></a>
+<FONT color="green">176</FONT>            final int powerOfTwo = Integer.highestOneBit(capacity);<a name="line.176"></a>
+<FONT color="green">177</FONT>            if (powerOfTwo == capacity) {<a name="line.177"></a>
+<FONT color="green">178</FONT>                return capacity;<a name="line.178"></a>
+<FONT color="green">179</FONT>            }<a name="line.179"></a>
+<FONT color="green">180</FONT>            return nextPowerOfTwo(capacity);<a name="line.180"></a>
+<FONT color="green">181</FONT>        }<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>        /**<a name="line.183"></a>
+<FONT color="green">184</FONT>         * Find the smallest power of two greater than the input value<a name="line.184"></a>
+<FONT color="green">185</FONT>         * @param i input value<a name="line.185"></a>
+<FONT color="green">186</FONT>         * @return smallest power of two greater than the input value<a name="line.186"></a>
+<FONT color="green">187</FONT>         */<a name="line.187"></a>
+<FONT color="green">188</FONT>        private static int nextPowerOfTwo(final int i) {<a name="line.188"></a>
+<FONT color="green">189</FONT>            return Integer.highestOneBit(i) &lt;&lt; 1;<a name="line.189"></a>
+<FONT color="green">190</FONT>        }<a name="line.190"></a>
+<FONT color="green">191</FONT>    <a name="line.191"></a>
+<FONT color="green">192</FONT>        /**<a name="line.192"></a>
+<FONT color="green">193</FONT>         * Get the stored value associated with the given key<a name="line.193"></a>
+<FONT color="green">194</FONT>         * @param key key associated with the data<a name="line.194"></a>
+<FONT color="green">195</FONT>         * @return data associated with the key<a name="line.195"></a>
+<FONT color="green">196</FONT>         */<a name="line.196"></a>
+<FONT color="green">197</FONT>        public T get(final int key) {<a name="line.197"></a>
+<FONT color="green">198</FONT>    <a name="line.198"></a>
+<FONT color="green">199</FONT>            final int hash  = hashOf(key);<a name="line.199"></a>
+<FONT color="green">200</FONT>            int index = hash &amp; mask;<a name="line.200"></a>
+<FONT color="green">201</FONT>            if (containsKey(key, index)) {<a name="line.201"></a>
+<FONT color="green">202</FONT>                return values[index];<a name="line.202"></a>
+<FONT color="green">203</FONT>            }<a name="line.203"></a>
+<FONT color="green">204</FONT>    <a name="line.204"></a>
+<FONT color="green">205</FONT>            if (states[index] == FREE) {<a name="line.205"></a>
+<FONT color="green">206</FONT>                return missingEntries;<a name="line.206"></a>
+<FONT color="green">207</FONT>            }<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>            int j = index;<a name="line.209"></a>
+<FONT color="green">210</FONT>            for (int perturb = perturb(hash); states[index] != FREE; perturb &gt;&gt;= PERTURB_SHIFT) {<a name="line.210"></a>
+<FONT color="green">211</FONT>                j = probe(perturb, j);<a name="line.211"></a>
+<FONT color="green">212</FONT>                index = j &amp; mask;<a name="line.212"></a>
+<FONT color="green">213</FONT>                if (containsKey(key, index)) {<a name="line.213"></a>
+<FONT color="green">214</FONT>                    return values[index];<a name="line.214"></a>
+<FONT color="green">215</FONT>                }<a name="line.215"></a>
+<FONT color="green">216</FONT>            }<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>            return missingEntries;<a name="line.218"></a>
+<FONT color="green">219</FONT>    <a name="line.219"></a>
+<FONT color="green">220</FONT>        }<a name="line.220"></a>
+<FONT color="green">221</FONT>    <a name="line.221"></a>
+<FONT color="green">222</FONT>        /**<a name="line.222"></a>
+<FONT color="green">223</FONT>         * Check if a value is associated with a key.<a name="line.223"></a>
+<FONT color="green">224</FONT>         * @param key key to check<a name="line.224"></a>
+<FONT color="green">225</FONT>         * @return true if a value is associated with key<a name="line.225"></a>
+<FONT color="green">226</FONT>         */<a name="line.226"></a>
+<FONT color="green">227</FONT>        public boolean containsKey(final int key) {<a name="line.227"></a>
+<FONT color="green">228</FONT>    <a name="line.228"></a>
+<FONT color="green">229</FONT>            final int hash  = hashOf(key);<a name="line.229"></a>
+<FONT color="green">230</FONT>            int index = hash &amp; mask;<a name="line.230"></a>
+<FONT color="green">231</FONT>            if (containsKey(key, index)) {<a name="line.231"></a>
+<FONT color="green">232</FONT>                return true;<a name="line.232"></a>
+<FONT color="green">233</FONT>            }<a name="line.233"></a>
+<FONT color="green">234</FONT>    <a name="line.234"></a>
+<FONT color="green">235</FONT>            if (states[index] == FREE) {<a name="line.235"></a>
+<FONT color="green">236</FONT>                return false;<a name="line.236"></a>
+<FONT color="green">237</FONT>            }<a name="line.237"></a>
+<FONT color="green">238</FONT>    <a name="line.238"></a>
+<FONT color="green">239</FONT>            int j = index;<a name="line.239"></a>
+<FONT color="green">240</FONT>            for (int perturb = perturb(hash); states[index] != FREE; perturb &gt;&gt;= PERTURB_SHIFT) {<a name="line.240"></a>
+<FONT color="green">241</FONT>                j = probe(perturb, j);<a name="line.241"></a>
+<FONT color="green">242</FONT>                index = j &amp; mask;<a name="line.242"></a>
+<FONT color="green">243</FONT>                if (containsKey(key, index)) {<a name="line.243"></a>
+<FONT color="green">244</FONT>                    return true;<a name="line.244"></a>
+<FONT color="green">245</FONT>                }<a name="line.245"></a>
+<FONT color="green">246</FONT>            }<a name="line.246"></a>
+<FONT color="green">247</FONT>    <a name="line.247"></a>
+<FONT color="green">248</FONT>            return false;<a name="line.248"></a>
+<FONT color="green">249</FONT>    <a name="line.249"></a>
+<FONT color="green">250</FONT>        }<a name="line.250"></a>
+<FONT color="green">251</FONT>    <a name="line.251"></a>
+<FONT color="green">252</FONT>        /**<a name="line.252"></a>
+<FONT color="green">253</FONT>         * Get an iterator over map elements.<a name="line.253"></a>
+<FONT color="green">254</FONT>         * &lt;p&gt;The specialized iterators returned are fail-fast: they throw a<a name="line.254"></a>
+<FONT color="green">255</FONT>         * &lt;code&gt;ConcurrentModificationException&lt;/code&gt; when they detect the map<a name="line.255"></a>
+<FONT color="green">256</FONT>         * has been modified during iteration.&lt;/p&gt;<a name="line.256"></a>
+<FONT color="green">257</FONT>         * @return iterator over the map elements<a name="line.257"></a>
+<FONT color="green">258</FONT>         */<a name="line.258"></a>
+<FONT color="green">259</FONT>        public Iterator iterator() {<a name="line.259"></a>
+<FONT color="green">260</FONT>            return new Iterator();<a name="line.260"></a>
+<FONT color="green">261</FONT>        }<a name="line.261"></a>
+<FONT color="green">262</FONT>    <a name="line.262"></a>
+<FONT color="green">263</FONT>        /**<a name="line.263"></a>
+<FONT color="green">264</FONT>         * Perturb the hash for starting probing.<a name="line.264"></a>
+<FONT color="green">265</FONT>         * @param hash initial hash<a name="line.265"></a>
+<FONT color="green">266</FONT>         * @return perturbed hash<a name="line.266"></a>
+<FONT color="green">267</FONT>         */<a name="line.267"></a>
+<FONT color="green">268</FONT>        private static int perturb(final int hash) {<a name="line.268"></a>
+<FONT color="green">269</FONT>            return hash &amp; 0x7fffffff;<a name="line.269"></a>
+<FONT color="green">270</FONT>        }<a name="line.270"></a>
+<FONT color="green">271</FONT>    <a name="line.271"></a>
+<FONT color="green">272</FONT>        /**<a name="line.272"></a>
+<FONT color="green">273</FONT>         * Find the index at which a key should be inserted<a name="line.273"></a>
+<FONT color="green">274</FONT>         * @param key key to lookup<a name="line.274"></a>
+<FONT color="green">275</FONT>         * @return index at which key should be inserted<a name="line.275"></a>
+<FONT color="green">276</FONT>         */<a name="line.276"></a>
+<FONT color="green">277</FONT>        private int findInsertionIndex(final int key) {<a name="line.277"></a>
+<FONT color="green">278</FONT>            return findInsertionIndex(keys, states, key, mask);<a name="line.278"></a>
+<FONT color="green">279</FONT>        }<a name="line.279"></a>
+<FONT color="green">280</FONT>    <a name="line.280"></a>
+<FONT color="green">281</FONT>        /**<a name="line.281"></a>
+<FONT color="green">282</FONT>         * Find the index at which a key should be inserted<a name="line.282"></a>
+<FONT color="green">283</FONT>         * @param keys keys table<a name="line.283"></a>
+<FONT color="green">284</FONT>         * @param states states table<a name="line.284"></a>
+<FONT color="green">285</FONT>         * @param key key to lookup<a name="line.285"></a>
+<FONT color="green">286</FONT>         * @param mask bit mask for hash values<a name="line.286"></a>
+<FONT color="green">287</FONT>         * @return index at which key should be inserted<a name="line.287"></a>
+<FONT color="green">288</FONT>         */<a name="line.288"></a>
+<FONT color="green">289</FONT>        private static int findInsertionIndex(final int[] keys, final byte[] states,<a name="line.289"></a>
+<FONT color="green">290</FONT>                                              final int key, final int mask) {<a name="line.290"></a>
+<FONT color="green">291</FONT>            final int hash = hashOf(key);<a name="line.291"></a>
+<FONT color="green">292</FONT>            int index = hash &amp; mask;<a name="line.292"></a>
+<FONT color="green">293</FONT>            if (states[index] == FREE) {<a name="line.293"></a>
+<FONT color="green">294</FONT>                return index;<a name="line.294"></a>
+<FONT color="green">295</FONT>            } else if (states[index] == FULL &amp;&amp; keys[index] == key) {<a name="line.295"></a>
+<FONT color="green">296</FONT>                return changeIndexSign(index);<a name="line.296"></a>
+<FONT color="green">297</FONT>            }<a name="line.297"></a>
+<FONT color="green">298</FONT>    <a name="line.298"></a>
+<FONT color="green">299</FONT>            int perturb = perturb(hash);<a name="line.299"></a>
+<FONT color="green">300</FONT>            int j = index;<a name="line.300"></a>
+<FONT color="green">301</FONT>            if (states[index] == FULL) {<a name="line.301"></a>
+<FONT color="green">302</FONT>                while (true) {<a name="line.302"></a>
+<FONT color="green">303</FONT>                    j = probe(perturb, j);<a name="line.303"></a>
+<FONT color="green">304</FONT>                    index = j &amp; mask;<a name="line.304"></a>
+<FONT color="green">305</FONT>                    perturb &gt;&gt;= PERTURB_SHIFT;<a name="line.305"></a>
+<FONT color="green">306</FONT>    <a name="line.306"></a>
+<FONT color="green">307</FONT>                    if (states[index] != FULL || keys[index] == key) {<a name="line.307"></a>
+<FONT color="green">308</FONT>                        break;<a name="line.308"></a>
+<FONT color="green">309</FONT>                    }<a name="line.309"></a>
+<FONT color="green">310</FONT>                }<a name="line.310"></a>
+<FONT color="green">311</FONT>            }<a name="line.311"></a>
+<FONT color="green">312</FONT>    <a name="line.312"></a>
+<FONT color="green">313</FONT>            if (states[index] == FREE) {<a name="line.313"></a>
+<FONT color="green">314</FONT>                return index;<a name="line.314"></a>
+<FONT color="green">315</FONT>            } else if (states[index] == FULL) {<a name="line.315"></a>
+<FONT color="green">316</FONT>                // due to the loop exit condition,<a name="line.316"></a>
+<FONT color="green">317</FONT>                // if (states[index] == FULL) then keys[index] == key<a name="line.317"></a>
+<FONT color="green">318</FONT>                return changeIndexSign(index);<a name="line.318"></a>
+<FONT color="green">319</FONT>            }<a name="line.319"></a>
+<FONT color="green">320</FONT>    <a name="line.320"></a>
+<FONT color="green">321</FONT>            final int firstRemoved = index;<a name="line.321"></a>
+<FONT color="green">322</FONT>            while (true) {<a name="line.322"></a>
+<FONT color="green">323</FONT>                j = probe(perturb, j);<a name="line.323"></a>
+<FONT color="green">324</FONT>                index = j &amp; mask;<a name="line.324"></a>
+<FONT color="green">325</FONT>    <a name="line.325"></a>
+<FONT color="green">326</FONT>                if (states[index] == FREE) {<a name="line.326"></a>
+<FONT color="green">327</FONT>                    return firstRemoved;<a name="line.327"></a>
+<FONT color="green">328</FONT>                } else if (states[index] == FULL &amp;&amp; keys[index] == key) {<a name="line.328"></a>
+<FONT color="green">329</FONT>                    return changeIndexSign(index);<a name="line.329"></a>
+<FONT color="green">330</FONT>                }<a name="line.330"></a>
+<FONT color="green">331</FONT>    <a name="line.331"></a>
+<FONT color="green">332</FONT>                perturb &gt;&gt;= PERTURB_SHIFT;<a name="line.332"></a>
+<FONT color="green">333</FONT>    <a name="line.333"></a>
+<FONT color="green">334</FONT>            }<a name="line.334"></a>
+<FONT color="green">335</FONT>    <a name="line.335"></a>
+<FONT color="green">336</FONT>        }<a name="line.336"></a>
+<FONT color="green">337</FONT>    <a name="line.337"></a>
+<FONT color="green">338</FONT>        /**<a name="line.338"></a>
+<FONT color="green">339</FONT>         * Compute next probe for collision resolution<a name="line.339"></a>
+<FONT color="green">340</FONT>         * @param perturb perturbed hash<a name="line.340"></a>
+<FONT color="green">341</FONT>         * @param j previous probe<a name="line.341"></a>
+<FONT color="green">342</FONT>         * @return next probe<a name="line.342"></a>
+<FONT color="green">343</FONT>         */<a name="line.343"></a>
+<FONT color="green">344</FONT>        private static int probe(final int perturb, final int j) {<a name="line.344"></a>
+<FONT color="green">345</FONT>            return (j &lt;&lt; 2) + j + perturb + 1;<a name="line.345"></a>
+<FONT color="green">346</FONT>        }<a name="line.346"></a>
+<FONT color="green">347</FONT>    <a name="line.347"></a>
+<FONT color="green">348</FONT>        /**<a name="line.348"></a>
+<FONT color="green">349</FONT>         * Change the index sign<a name="line.349"></a>
+<FONT color="green">350</FONT>         * @param index initial index<a name="line.350"></a>
+<FONT color="green">351</FONT>         * @return changed index<a name="line.351"></a>
+<FONT color="green">352</FONT>         */<a name="line.352"></a>
+<FONT color="green">353</FONT>        private static int changeIndexSign(final int index) {<a name="line.353"></a>
+<FONT color="green">354</FONT>            return -index - 1;<a name="line.354"></a>
+<FONT color="green">355</FONT>        }<a name="line.355"></a>
+<FONT color="green">356</FONT>    <a name="line.356"></a>
+<FONT color="green">357</FONT>        /**<a name="line.357"></a>
+<FONT color="green">358</FONT>         * Get the number of elements stored in the map.<a name="line.358"></a>
+<FONT color="green">359</FONT>         * @return number of elements stored in the map<a name="line.359"></a>
+<FONT color="green">360</FONT>         */<a name="line.360"></a>
+<FONT color="green">361</FONT>        public int size() {<a name="line.361"></a>
+<FONT color="green">362</FONT>            return size;<a name="line.362"></a>
+<FONT color="green">363</FONT>        }<a name="line.363"></a>
+<FONT color="green">364</FONT>    <a name="line.364"></a>
+<FONT color="green">365</FONT>    <a name="line.365"></a>
+<FONT color="green">366</FONT>        /**<a name="line.366"></a>
+<FONT color="green">367</FONT>         * Remove the value associated with a key.<a name="line.367"></a>
+<FONT color="green">368</FONT>         * @param key key to which the value is associated<a name="line.368"></a>
+<FONT color="green">369</FONT>         * @return removed value<a name="line.369"></a>
+<FONT color="green">370</FONT>         */<a name="line.370"></a>
+<FONT color="green">371</FONT>        public T remove(final int key) {<a name="line.371"></a>
+<FONT color="green">372</FONT>    <a name="line.372"></a>
+<FONT color="green">373</FONT>            final int hash  = hashOf(key);<a name="line.373"></a>
+<FONT color="green">374</FONT>            int index = hash &amp; mask;<a name="line.374"></a>
+<FONT color="green">375</FONT>            if (containsKey(key, index)) {<a name="line.375"></a>
+<FONT color="green">376</FONT>                return doRemove(index);<a name="line.376"></a>
+<FONT color="green">377</FONT>            }<a name="line.377"></a>
+<FONT color="green">378</FONT>    <a name="line.378"></a>
+<FONT color="green">379</FONT>            if (states[index] == FREE) {<a name="line.379"></a>
+<FONT color="green">380</FONT>                return missingEntries;<a name="line.380"></a>
+<FONT color="green">381</FONT>            }<a name="line.381"></a>
+<FONT color="green">382</FONT>    <a name="line.382"></a>
+<FONT color="green">383</FONT>            int j = index;<a name="line.383"></a>
+<FONT color="green">384</FONT>            for (int perturb = perturb(hash); states[index] != FREE; perturb &gt;&gt;= PERTURB_SHIFT) {<a name="line.384"></a>
+<FONT color="green">385</FONT>                j = probe(perturb, j);<a name="line.385"></a>
+<FONT color="green">386</FONT>                index = j &amp; mask;<a name="line.386"></a>
+<FONT color="green">387</FONT>                if (containsKey(key, index)) {<a name="line.387"></a>
+<FONT color="green">388</FONT>                    return doRemove(index);<a name="line.388"></a>
+<FONT color="green">389</FONT>                }<a name="line.389"></a>
+<FONT color="green">390</FONT>            }<a name="line.390"></a>
+<FONT color="green">391</FONT>    <a name="line.391"></a>
+<FONT color="green">392</FONT>            return missingEntries;<a name="line.392"></a>
+<FONT color="green">393</FONT>    <a name="line.393"></a>
+<FONT color="green">394</FONT>        }<a name="line.394"></a>
+<FONT color="green">395</FONT>    <a name="line.395"></a>
+<FONT color="green">396</FONT>        /**<a name="line.396"></a>
+<FONT color="green">397</FONT>         * Check if the tables contain an element associated with specified key<a name="line.397"></a>
+<FONT color="green">398</FONT>         * at specified index.<a name="line.398"></a>
+<FONT color="green">399</FONT>         * @param key key to check<a name="line.399"></a>
+<FONT color="green">400</FONT>         * @param index index to check<a name="line.400"></a>
+<FONT color="green">401</FONT>         * @return true if an element is associated with key at index<a name="line.401"></a>
+<FONT color="green">402</FONT>         */<a name="line.402"></a>
+<FONT color="green">403</FONT>        private boolean containsKey(final int key, final int index) {<a name="line.403"></a>
+<FONT color="green">404</FONT>            return (key != 0 || states[index] == FULL) &amp;&amp; keys[index] == key;<a name="line.404"></a>
+<FONT color="green">405</FONT>        }<a name="line.405"></a>
+<FONT color="green">406</FONT>    <a name="line.406"></a>
+<FONT color="green">407</FONT>        /**<a name="line.407"></a>
+<FONT color="green">408</FONT>         * Remove an element at specified index.<a name="line.408"></a>
+<FONT color="green">409</FONT>         * @param index index of the element to remove<a name="line.409"></a>
+<FONT color="green">410</FONT>         * @return removed value<a name="line.410"></a>
+<FONT color="green">411</FONT>         */<a name="line.411"></a>
+<FONT color="green">412</FONT>        private T doRemove(int index) {<a name="line.412"></a>
+<FONT color="green">413</FONT>            keys[index]   = 0;<a name="line.413"></a>
+<FONT color="green">414</FONT>            states[index] = REMOVED;<a name="line.414"></a>
+<FONT color="green">415</FONT>            final T previous = values[index];<a name="line.415"></a>
+<FONT color="green">416</FONT>            values[index] = missingEntries;<a name="line.416"></a>
+<FONT color="green">417</FONT>            --size;<a name="line.417"></a>
+<FONT color="green">418</FONT>            ++count;<a name="line.418"></a>
+<FONT color="green">419</FONT>            return previous;<a name="line.419"></a>
+<FONT color="green">420</FONT>        }<a name="line.420"></a>
+<FONT color="green">421</FONT>    <a name="line.421"></a>
+<FONT color="green">422</FONT>        /**<a name="line.422"></a>
+<FONT color="green">423</FONT>         * Put a value associated with a key in the map.<a name="line.423"></a>
+<FONT color="green">424</FONT>         * @param key key to which value is associated<a name="line.424"></a>
+<FONT color="green">425</FONT>         * @param value value to put in the map<a name="line.425"></a>
+<FONT color="green">426</FONT>         * @return previous value associated with the key<a name="line.426"></a>
+<FONT color="green">427</FONT>         */<a name="line.427"></a>
+<FONT color="green">428</FONT>        public T put(final int key, final T value) {<a name="line.428"></a>
+<FONT color="green">429</FONT>            int index = findInsertionIndex(key);<a name="line.429"></a>
+<FONT color="green">430</FONT>            T previous = missingEntries;<a name="line.430"></a>
+<FONT color="green">431</FONT>            boolean newMapping = true;<a name="line.431"></a>
+<FONT color="green">432</FONT>            if (index &lt; 0) {<a name="line.432"></a>
+<FONT color="green">433</FONT>                index = changeIndexSign(index);<a name="line.433"></a>
+<FONT color="green">434</FONT>                previous = values[index];<a name="line.434"></a>
+<FONT color="green">435</FONT>                newMapping = false;<a name="line.435"></a>
+<FONT color="green">436</FONT>            }<a name="line.436"></a>
+<FONT color="green">437</FONT>            keys[index]   = key;<a name="line.437"></a>
+<FONT color="green">438</FONT>            states[index] = FULL;<a name="line.438"></a>
+<FONT color="green">439</FONT>            values[index] = value;<a name="line.439"></a>
+<FONT color="green">440</FONT>            if (newMapping) {<a name="line.440"></a>
+<FONT color="green">441</FONT>                ++size;<a name="line.441"></a>
+<FONT color="green">442</FONT>                if (shouldGrowTable()) {<a name="line.442"></a>
+<FONT color="green">443</FONT>                    growTable();<a name="line.443"></a>
+<FONT color="green">444</FONT>                }<a name="line.444"></a>
+<FONT color="green">445</FONT>                ++count;<a name="line.445"></a>
+<FONT color="green">446</FONT>            }<a name="line.446"></a>
+<FONT color="green">447</FONT>            return previous;<a name="line.447"></a>
+<FONT color="green">448</FONT>    <a name="line.448"></a>
+<FONT color="green">449</FONT>        }<a name="line.449"></a>
+<FONT color="green">450</FONT>    <a name="line.450"></a>
+<FONT color="green">451</FONT>        /**<a name="line.451"></a>
+<FONT color="green">452</FONT>         * Grow the tables.<a name="line.452"></a>
+<FONT color="green">453</FONT>         */<a name="line.453"></a>
+<FONT color="green">454</FONT>        private void growTable() {<a name="line.454"></a>
+<FONT color="green">455</FONT>    <a name="line.455"></a>
+<FONT color="green">456</FONT>            final int oldLength      = states.length;<a name="line.456"></a>
+<FONT color="green">457</FONT>            final int[] oldKeys      = keys;<a name="line.457"></a>
+<FONT color="green">458</FONT>            final T[] oldValues = values;<a name="line.458"></a>
+<FONT color="green">459</FONT>            final byte[] oldStates   = states;<a name="line.459"></a>
+<FONT color="green">460</FONT>    <a name="line.460"></a>
+<FONT color="green">461</FONT>            final int newLength = RESIZE_MULTIPLIER * oldLength;<a name="line.461"></a>
+<FONT color="green">462</FONT>            final int[] newKeys = new int[newLength];<a name="line.462"></a>
+<FONT color="green">463</FONT>            final T[] newValues = buildArray(newLength);<a name="line.463"></a>
+<FONT color="green">464</FONT>            final byte[] newStates = new byte[newLength];<a name="line.464"></a>
+<FONT color="green">465</FONT>            final int newMask = newLength - 1;<a name="line.465"></a>
+<FONT color="green">466</FONT>            for (int i = 0; i &lt; oldLength; ++i) {<a name="line.466"></a>
+<FONT color="green">467</FONT>                if (oldStates[i] == FULL) {<a name="line.467"></a>
+<FONT color="green">468</FONT>                    final int key = oldKeys[i];<a name="line.468"></a>
+<FONT color="green">469</FONT>                    final int index = findInsertionIndex(newKeys, newStates, key, newMask);<a name="line.469"></a>
+<FONT color="green">470</FONT>                    newKeys[index]   = key;<a name="line.470"></a>
+<FONT color="green">471</FONT>                    newValues[index] = oldValues[i];<a name="line.471"></a>
+<FONT color="green">472</FONT>                    newStates[index] = FULL;<a name="line.472"></a>
+<FONT color="green">473</FONT>                }<a name="line.473"></a>
+<FONT color="green">474</FONT>            }<a name="line.474"></a>
+<FONT color="green">475</FONT>    <a name="line.475"></a>
+<FONT color="green">476</FONT>            mask   = newMask;<a name="line.476"></a>
+<FONT color="green">477</FONT>            keys   = newKeys;<a name="line.477"></a>
+<FONT color="green">478</FONT>            values = newValues;<a name="line.478"></a>
+<FONT color="green">479</FONT>            states = newStates;<a name="line.479"></a>
+<FONT color="green">480</FONT>    <a name="line.480"></a>
+<FONT color="green">481</FONT>        }<a name="line.481"></a>
+<FONT color="green">482</FONT>    <a name="line.482"></a>
+<FONT color="green">483</FONT>        /**<a name="line.483"></a>
+<FONT color="green">484</FONT>         * Check if tables should grow due to increased size.<a name="line.484"></a>
+<FONT color="green">485</FONT>         * @return true if  tables should grow<a name="line.485"></a>
+<FONT color="green">486</FONT>         */<a name="line.486"></a>
+<FONT color="green">487</FONT>        private boolean shouldGrowTable() {<a name="line.487"></a>
+<FONT color="green">488</FONT>            return size &gt; (mask + 1) * LOAD_FACTOR;<a name="line.488"></a>
+<FONT color="green">489</FONT>        }<a name="line.489"></a>
+<FONT color="green">490</FONT>    <a name="line.490"></a>
+<FONT color="green">491</FONT>        /**<a name="line.491"></a>
+<FONT color="green">492</FONT>         * Compute the hash value of a key<a name="line.492"></a>
+<FONT color="green">493</FONT>         * @param key key to hash<a name="line.493"></a>
+<FONT color="green">494</FONT>         * @return hash value of the key<a name="line.494"></a>
+<FONT color="green">495</FONT>         */<a name="line.495"></a>
+<FONT color="green">496</FONT>        private static int hashOf(final int key) {<a name="line.496"></a>
+<FONT color="green">497</FONT>            final int h = key ^ ((key &gt;&gt;&gt; 20) ^ (key &gt;&gt;&gt; 12));<a name="line.497"></a>
+<FONT color="green">498</FONT>            return h ^ (h &gt;&gt;&gt; 7) ^ (h &gt;&gt;&gt; 4);<a name="line.498"></a>
+<FONT color="green">499</FONT>        }<a name="line.499"></a>
+<FONT color="green">500</FONT>    <a name="line.500"></a>
+<FONT color="green">501</FONT>    <a name="line.501"></a>
+<FONT color="green">502</FONT>        /** Iterator class for the map. */<a name="line.502"></a>
+<FONT color="green">503</FONT>        public class Iterator {<a name="line.503"></a>
+<FONT color="green">504</FONT>    <a name="line.504"></a>
+<FONT color="green">505</FONT>            /** Reference modification count. */<a name="line.505"></a>
+<FONT color="green">506</FONT>            private final int referenceCount;<a name="line.506"></a>
+<FONT color="green">507</FONT>    <a name="line.507"></a>
+<FONT color="green">508</FONT>            /** Index of current element. */<a name="line.508"></a>
+<FONT color="green">509</FONT>            private int current;<a name="line.509"></a>
+<FONT color="green">510</FONT>    <a name="line.510"></a>
+<FONT color="green">511</FONT>            /** Index of next element. */<a name="line.511"></a>
+<FONT color="green">512</FONT>            private int next;<a name="line.512"></a>
+<FONT color="green">513</FONT>    <a name="line.513"></a>
+<FONT color="green">514</FONT>            /**<a name="line.514"></a>
+<FONT color="green">515</FONT>             * Simple constructor.<a name="line.515"></a>
+<FONT color="green">516</FONT>             */<a name="line.516"></a>
+<FONT color="green">517</FONT>            private Iterator() {<a name="line.517"></a>
+<FONT color="green">518</FONT>    <a name="line.518"></a>
+<FONT color="green">519</FONT>                // preserve the modification count of the map to detect concurrent modifications later<a name="line.519"></a>
+<FONT color="green">520</FONT>                referenceCount = count;<a name="line.520"></a>
+<FONT color="green">521</FONT>    <a name="line.521"></a>
+<FONT color="green">522</FONT>                // initialize current index<a name="line.522"></a>
+<FONT color="green">523</FONT>                next = -1;<a name="line.523"></a>
+<FONT color="green">524</FONT>                try {<a name="line.524"></a>
+<FONT color="green">525</FONT>                    advance();<a name="line.525"></a>
+<FONT color="green">526</FONT>                } catch (NoSuchElementException nsee) {<a name="line.526"></a>
+<FONT color="green">527</FONT>                    // ignored<a name="line.527"></a>
+<FONT color="green">528</FONT>                }<a name="line.528"></a>
+<FONT color="green">529</FONT>    <a name="line.529"></a>
+<FONT color="green">530</FONT>            }<a name="line.530"></a>
+<FONT color="green">531</FONT>    <a name="line.531"></a>
+<FONT color="green">532</FONT>            /**<a name="line.532"></a>
+<FONT color="green">533</FONT>             * Check if there is a next element in the map.<a name="line.533"></a>
+<FONT color="green">534</FONT>             * @return true if there is a next element<a name="line.534"></a>
+<FONT color="green">535</FONT>             */<a name="line.535"></a>
+<FONT color="green">536</FONT>            public boolean hasNext() {<a name="line.536"></a>
+<FONT color="green">537</FONT>                return next &gt;= 0;<a name="line.537"></a>
+<FONT color="green">538</FONT>            }<a name="line.538"></a>
+<FONT color="green">539</FONT>    <a name="line.539"></a>
+<FONT color="green">540</FONT>            /**<a name="line.540"></a>
+<FONT color="green">541</FONT>             * Get the key of current entry.<a name="line.541"></a>
+<FONT color="green">542</FONT>             * @return key of current entry<a name="line.542"></a>
+<FONT color="green">543</FONT>             * @exception ConcurrentModificationException if the map is modified during iteration<a name="line.543"></a>
+<FONT color="green">544</FONT>             * @exception NoSuchElementException if there is no element left in the map<a name="line.544"></a>
+<FONT color="green">545</FONT>             */<a name="line.545"></a>
+<FONT color="green">546</FONT>            public int key()<a name="line.546"></a>
+<FONT color="green">547</FONT>                throws ConcurrentModificationException, NoSuchElementException {<a name="line.547"></a>
+<FONT color="green">548</FONT>                if (referenceCount != count) {<a name="line.548"></a>
+<FONT color="green">549</FONT>                    throw MathRuntimeException.createConcurrentModificationException(<a name="line.549"></a>
+<FONT color="green">550</FONT>                          CONCURRENT_MODIFICATION_MESSAGE);<a name="line.550"></a>
+<FONT color="green">551</FONT>                }<a name="line.551"></a>
+<FONT color="green">552</FONT>                if (current &lt; 0) {<a name="line.552"></a>
+<FONT color="green">553</FONT>                    throw MathRuntimeException.createNoSuchElementException(EXHAUSTED_ITERATOR_MESSAGE);<a name="line.553"></a>
+<FONT color="green">554</FONT>                }<a name="line.554"></a>
+<FONT color="green">555</FONT>                return keys[current];<a name="line.555"></a>
+<FONT color="green">556</FONT>            }<a name="line.556"></a>
+<FONT color="green">557</FONT>    <a name="line.557"></a>
+<FONT color="green">558</FONT>            /**<a name="line.558"></a>
+<FONT color="green">559</FONT>             * Get the value of current entry.<a name="line.559"></a>
+<FONT color="green">560</FONT>             * @return value of current entry<a name="line.560"></a>
+<FONT color="green">561</FONT>             * @exception ConcurrentModificationException if the map is modified during iteration<a name="line.561"></a>
+<FONT color="green">562</FONT>             * @exception NoSuchElementException if there is no element left in the map<a name="line.562"></a>
+<FONT color="green">563</FONT>             */<a name="line.563"></a>
+<FONT color="green">564</FONT>            public T value()<a name="line.564"></a>
+<FONT color="green">565</FONT>                throws ConcurrentModificationException, NoSuchElementException {<a name="line.565"></a>
+<FONT color="green">566</FONT>                if (referenceCount != count) {<a name="line.566"></a>
+<FONT color="green">567</FONT>                    throw MathRuntimeException.createConcurrentModificationException(<a name="line.567"></a>
+<FONT color="green">568</FONT>                          CONCURRENT_MODIFICATION_MESSAGE);<a name="line.568"></a>
+<FONT color="green">569</FONT>                }<a name="line.569"></a>
+<FONT color="green">570</FONT>                if (current &lt; 0) {<a name="line.570"></a>
+<FONT color="green">571</FONT>                    throw MathRuntimeException.createNoSuchElementException(EXHAUSTED_ITERATOR_MESSAGE);<a name="line.571"></a>
+<FONT color="green">572</FONT>                }<a name="line.572"></a>
+<FONT color="green">573</FONT>                return values[current];<a name="line.573"></a>
+<FONT color="green">574</FONT>            }<a name="line.574"></a>
+<FONT color="green">575</FONT>    <a name="line.575"></a>
+<FONT color="green">576</FONT>            /**<a name="line.576"></a>
+<FONT color="green">577</FONT>             * Advance iterator one step further.<a name="line.577"></a>
+<FONT color="green">578</FONT>             * @exception ConcurrentModificationException if the map is modified during iteration<a name="line.578"></a>
+<FONT color="green">579</FONT>             * @exception NoSuchElementException if there is no element left in the map<a name="line.579"></a>
+<FONT color="green">580</FONT>             */<a name="line.580"></a>
+<FONT color="green">581</FONT>            public void advance()<a name="line.581"></a>
+<FONT color="green">582</FONT>                throws ConcurrentModificationException, NoSuchElementException {<a name="line.582"></a>
+<FONT color="green">583</FONT>    <a name="line.583"></a>
+<FONT color="green">584</FONT>                if (referenceCount != count) {<a name="line.584"></a>
+<FONT color="green">585</FONT>                    throw MathRuntimeException.createConcurrentModificationException(<a name="line.585"></a>
+<FONT color="green">586</FONT>                          CONCURRENT_MODIFICATION_MESSAGE);<a name="line.586"></a>
+<FONT color="green">587</FONT>                }<a name="line.587"></a>
+<FONT color="green">588</FONT>    <a name="line.588"></a>
+<FONT color="green">589</FONT>                // advance on step<a name="line.589"></a>
+<FONT color="green">590</FONT>                current = next;<a name="line.590"></a>
+<FONT color="green">591</FONT>    <a name="line.591"></a>
+<FONT color="green">592</FONT>                // prepare next step<a name="line.592"></a>
+<FONT color="green">593</FONT>                try {<a name="line.593"></a>
+<FONT color="green">594</FONT>                    while (states[++next] != FULL) {<a name="line.594"></a>
+<FONT color="green">595</FONT>                        // nothing to do<a name="line.595"></a>
+<FONT color="green">596</FONT>                    }<a name="line.596"></a>
+<FONT color="green">597</FONT>                } catch (ArrayIndexOutOfBoundsException e) {<a name="line.597"></a>
+<FONT color="green">598</FONT>                    next = -2;<a name="line.598"></a>
+<FONT color="green">599</FONT>                    if (current &lt; 0) {<a name="line.599"></a>
+<FONT color="green">600</FONT>                        throw MathRuntimeException.createNoSuchElementException(EXHAUSTED_ITERATOR_MESSAGE);<a name="line.600"></a>
+<FONT color="green">601</FONT>                    }<a name="line.601"></a>
+<FONT color="green">602</FONT>                }<a name="line.602"></a>
+<FONT color="green">603</FONT>    <a name="line.603"></a>
+<FONT color="green">604</FONT>            }<a name="line.604"></a>
+<FONT color="green">605</FONT>    <a name="line.605"></a>
+<FONT color="green">606</FONT>        }<a name="line.606"></a>
+<FONT color="green">607</FONT>    <a name="line.607"></a>
+<FONT color="green">608</FONT>        /**<a name="line.608"></a>
+<FONT color="green">609</FONT>         * Read a serialized object.<a name="line.609"></a>
+<FONT color="green">610</FONT>         * @param stream input stream<a name="line.610"></a>
+<FONT color="green">611</FONT>         * @throws IOException if object cannot be read<a name="line.611"></a>
+<FONT color="green">612</FONT>         * @throws ClassNotFoundException if the class corresponding<a name="line.612"></a>
+<FONT color="green">613</FONT>         * to the serialized object cannot be found<a name="line.613"></a>
+<FONT color="green">614</FONT>         */<a name="line.614"></a>
+<FONT color="green">615</FONT>        private void readObject(final ObjectInputStream stream)<a name="line.615"></a>
+<FONT color="green">616</FONT>            throws IOException, ClassNotFoundException {<a name="line.616"></a>
+<FONT color="green">617</FONT>            stream.defaultReadObject();<a name="line.617"></a>
+<FONT color="green">618</FONT>            count = 0;<a name="line.618"></a>
+<FONT color="green">619</FONT>        }<a name="line.619"></a>
+<FONT color="green">620</FONT>    <a name="line.620"></a>
+<FONT color="green">621</FONT>        /** Build an array of elements.<a name="line.621"></a>
+<FONT color="green">622</FONT>         * @param length size of the array to build<a name="line.622"></a>
+<FONT color="green">623</FONT>         * @return a new array<a name="line.623"></a>
+<FONT color="green">624</FONT>         */<a name="line.624"></a>
+<FONT color="green">625</FONT>        @SuppressWarnings("unchecked") // field is of type T<a name="line.625"></a>
+<FONT color="green">626</FONT>        private T[] buildArray(final int length) {<a name="line.626"></a>
+<FONT color="green">627</FONT>            return (T[]) Array.newInstance(field.getZero().getClass(), length);<a name="line.627"></a>
+<FONT color="green">628</FONT>        }<a name="line.628"></a>
+<FONT color="green">629</FONT>    <a name="line.629"></a>
+<FONT color="green">630</FONT>    }<a name="line.630"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/ResizableDoubleArray.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,962 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.util;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Arrays;<a name="line.20"></a>
+<FONT color="green">021</FONT>    <a name="line.21"></a>
+<FONT color="green">022</FONT>    import org.apache.commons.math.MathRuntimeException;<a name="line.22"></a>
+<FONT color="green">023</FONT>    <a name="line.23"></a>
+<FONT color="green">024</FONT>    /**<a name="line.24"></a>
+<FONT color="green">025</FONT>     * &lt;p&gt;<a name="line.25"></a>
+<FONT color="green">026</FONT>     * A variable length {@link DoubleArray} implementation that automatically<a name="line.26"></a>
+<FONT color="green">027</FONT>     * handles expanding and contracting its internal storage array as elements<a name="line.27"></a>
+<FONT color="green">028</FONT>     * are added and removed.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * &lt;/p&gt;<a name="line.29"></a>
+<FONT color="green">030</FONT>     * &lt;p&gt;<a name="line.30"></a>
+<FONT color="green">031</FONT>     *  The internal storage array starts with capacity determined by the<a name="line.31"></a>
+<FONT color="green">032</FONT>     * &lt;code&gt;initialCapacity&lt;/code&gt; property, which can be set by the constructor.<a name="line.32"></a>
+<FONT color="green">033</FONT>     * The default initial capacity is 16.  Adding elements using<a name="line.33"></a>
+<FONT color="green">034</FONT>     * {@link #addElement(double)} appends elements to the end of the array.  When<a name="line.34"></a>
+<FONT color="green">035</FONT>     * there are no open entries at the end of the internal storage array, the<a name="line.35"></a>
+<FONT color="green">036</FONT>     * array is expanded.  The size of the expanded array depends on the<a name="line.36"></a>
+<FONT color="green">037</FONT>     * &lt;code&gt;expansionMode&lt;/code&gt; and &lt;code&gt;expansionFactor&lt;/code&gt; properties.<a name="line.37"></a>
+<FONT color="green">038</FONT>     * The &lt;code&gt;expansionMode&lt;/code&gt; determines whether the size of the array is<a name="line.38"></a>
+<FONT color="green">039</FONT>     * multiplied by the &lt;code&gt;expansionFactor&lt;/code&gt; (MULTIPLICATIVE_MODE) or if<a name="line.39"></a>
+<FONT color="green">040</FONT>     * the expansion is additive (ADDITIVE_MODE -- &lt;code&gt;expansionFactor&lt;/code&gt;<a name="line.40"></a>
+<FONT color="green">041</FONT>     * storage locations added).  The default &lt;code&gt;expansionMode&lt;/code&gt; is<a name="line.41"></a>
+<FONT color="green">042</FONT>     * MULTIPLICATIVE_MODE and the default &lt;code&gt;expansionFactor&lt;/code&gt;<a name="line.42"></a>
+<FONT color="green">043</FONT>     * is 2.0.<a name="line.43"></a>
+<FONT color="green">044</FONT>     * &lt;/p&gt;<a name="line.44"></a>
+<FONT color="green">045</FONT>     * &lt;p&gt;<a name="line.45"></a>
+<FONT color="green">046</FONT>     * The {@link #addElementRolling(double)} method adds a new element to the end<a name="line.46"></a>
+<FONT color="green">047</FONT>     * of the internal storage array and adjusts the "usable window" of the<a name="line.47"></a>
+<FONT color="green">048</FONT>     * internal array forward by one position (effectively making what was the<a name="line.48"></a>
+<FONT color="green">049</FONT>     * second element the first, and so on).  Repeated activations of this method<a name="line.49"></a>
+<FONT color="green">050</FONT>     * (or activation of {@link #discardFrontElements(int)}) will effectively orphan<a name="line.50"></a>
+<FONT color="green">051</FONT>     * the storage locations at the beginning of the internal storage array.  To<a name="line.51"></a>
+<FONT color="green">052</FONT>     * reclaim this storage, each time one of these methods is activated, the size<a name="line.52"></a>
+<FONT color="green">053</FONT>     * of the internal storage array is compared to the number of addressable<a name="line.53"></a>
+<FONT color="green">054</FONT>     * elements (the &lt;code&gt;numElements&lt;/code&gt; property) and if the difference<a name="line.54"></a>
+<FONT color="green">055</FONT>     * is too large, the internal array is contracted to size<a name="line.55"></a>
+<FONT color="green">056</FONT>     * &lt;code&gt;numElements + 1.&lt;/code&gt;  The determination of when the internal<a name="line.56"></a>
+<FONT color="green">057</FONT>     * storage array is "too large" depends on the &lt;code&gt;expansionMode&lt;/code&gt; and<a name="line.57"></a>
+<FONT color="green">058</FONT>     * &lt;code&gt;contractionFactor&lt;/code&gt; properties.  If  the &lt;code&gt;expansionMode&lt;/code&gt;<a name="line.58"></a>
+<FONT color="green">059</FONT>     * is &lt;code&gt;MULTIPLICATIVE_MODE&lt;/code&gt;, contraction is triggered when the<a name="line.59"></a>
+<FONT color="green">060</FONT>     * ratio between storage array length and &lt;code&gt;numElements&lt;/code&gt; exceeds<a name="line.60"></a>
+<FONT color="green">061</FONT>     * &lt;code&gt;contractionFactor.&lt;/code&gt;  If the &lt;code&gt;expansionMode&lt;/code&gt;<a name="line.61"></a>
+<FONT color="green">062</FONT>     * is &lt;code&gt;ADDITIVE_MODE,&lt;/code&gt; the number of excess storage locations<a name="line.62"></a>
+<FONT color="green">063</FONT>     * is compared to &lt;code&gt;contractionFactor.&lt;/code&gt;<a name="line.63"></a>
+<FONT color="green">064</FONT>     * &lt;/p&gt;<a name="line.64"></a>
+<FONT color="green">065</FONT>     * &lt;p&gt;<a name="line.65"></a>
+<FONT color="green">066</FONT>     * To avoid cycles of expansions and contractions, the<a name="line.66"></a>
+<FONT color="green">067</FONT>     * &lt;code&gt;expansionFactor&lt;/code&gt; must not exceed the<a name="line.67"></a>
+<FONT color="green">068</FONT>     * &lt;code&gt;contractionFactor.&lt;/code&gt; Constructors and mutators for both of these<a name="line.68"></a>
+<FONT color="green">069</FONT>     * properties enforce this requirement, throwing IllegalArgumentException if it<a name="line.69"></a>
+<FONT color="green">070</FONT>     * is violated.<a name="line.70"></a>
+<FONT color="green">071</FONT>     * &lt;/p&gt;<a name="line.71"></a>
+<FONT color="green">072</FONT>     * @version $Revision: 811833 $ $Date: 2009-09-06 12:27:50 -0400 (Sun, 06 Sep 2009) $<a name="line.72"></a>
+<FONT color="green">073</FONT>     */<a name="line.73"></a>
+<FONT color="green">074</FONT>    public class ResizableDoubleArray implements DoubleArray, Serializable {<a name="line.74"></a>
+<FONT color="green">075</FONT>    <a name="line.75"></a>
+<FONT color="green">076</FONT>        /** additive expansion mode */<a name="line.76"></a>
+<FONT color="green">077</FONT>        public static final int ADDITIVE_MODE = 1;<a name="line.77"></a>
+<FONT color="green">078</FONT>    <a name="line.78"></a>
+<FONT color="green">079</FONT>        /** multiplicative expansion mode */<a name="line.79"></a>
+<FONT color="green">080</FONT>        public static final int MULTIPLICATIVE_MODE = 0;<a name="line.80"></a>
+<FONT color="green">081</FONT>    <a name="line.81"></a>
+<FONT color="green">082</FONT>        /** Serializable version identifier */<a name="line.82"></a>
+<FONT color="green">083</FONT>        private static final long serialVersionUID = -3485529955529426875L;<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>        /**<a name="line.85"></a>
+<FONT color="green">086</FONT>         * The contraction criteria determines when the internal array will be<a name="line.86"></a>
+<FONT color="green">087</FONT>         * contracted to fit the number of elements contained in the element<a name="line.87"></a>
+<FONT color="green">088</FONT>         *  array + 1.<a name="line.88"></a>
+<FONT color="green">089</FONT>         */<a name="line.89"></a>
+<FONT color="green">090</FONT>        protected float contractionCriteria = 2.5f;<a name="line.90"></a>
+<FONT color="green">091</FONT>    <a name="line.91"></a>
+<FONT color="green">092</FONT>        /**<a name="line.92"></a>
+<FONT color="green">093</FONT>         * The expansion factor of the array.  When the array needs to be expanded,<a name="line.93"></a>
+<FONT color="green">094</FONT>         * the new array size will be<a name="line.94"></a>
+<FONT color="green">095</FONT>         * &lt;code&gt;internalArray.length * expansionFactor&lt;/code&gt;<a name="line.95"></a>
+<FONT color="green">096</FONT>         * if &lt;code&gt;expansionMode&lt;/code&gt; is set to MULTIPLICATIVE_MODE, or<a name="line.96"></a>
+<FONT color="green">097</FONT>         * &lt;code&gt;internalArray.length + expansionFactor&lt;/code&gt; if<a name="line.97"></a>
+<FONT color="green">098</FONT>         * &lt;code&gt;expansionMode&lt;/code&gt; is set to ADDITIVE_MODE.<a name="line.98"></a>
+<FONT color="green">099</FONT>         */<a name="line.99"></a>
+<FONT color="green">100</FONT>        protected float expansionFactor = 2.0f;<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>        /**<a name="line.102"></a>
+<FONT color="green">103</FONT>         * Determines whether array expansion by &lt;code&gt;expansionFactor&lt;/code&gt;<a name="line.103"></a>
+<FONT color="green">104</FONT>         * is additive or multiplicative.<a name="line.104"></a>
+<FONT color="green">105</FONT>         */<a name="line.105"></a>
+<FONT color="green">106</FONT>        protected int expansionMode = MULTIPLICATIVE_MODE;<a name="line.106"></a>
+<FONT color="green">107</FONT>    <a name="line.107"></a>
+<FONT color="green">108</FONT>        /**<a name="line.108"></a>
+<FONT color="green">109</FONT>         * The initial capacity of the array.  Initial capacity is not exposed as a<a name="line.109"></a>
+<FONT color="green">110</FONT>         * property as it is only meaningful when passed to a constructor.<a name="line.110"></a>
+<FONT color="green">111</FONT>         */<a name="line.111"></a>
+<FONT color="green">112</FONT>        protected int initialCapacity = 16;<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /**<a name="line.114"></a>
+<FONT color="green">115</FONT>         * The internal storage array.<a name="line.115"></a>
+<FONT color="green">116</FONT>         */<a name="line.116"></a>
+<FONT color="green">117</FONT>        protected double[] internalArray;<a name="line.117"></a>
+<FONT color="green">118</FONT>    <a name="line.118"></a>
+<FONT color="green">119</FONT>        /**<a name="line.119"></a>
+<FONT color="green">120</FONT>         * The number of addressable elements in the array.  Note that this<a name="line.120"></a>
+<FONT color="green">121</FONT>         * has nothing to do with the length of the internal storage array.<a name="line.121"></a>
+<FONT color="green">122</FONT>         */<a name="line.122"></a>
+<FONT color="green">123</FONT>        protected int numElements = 0;<a name="line.123"></a>
+<FONT color="green">124</FONT>    <a name="line.124"></a>
+<FONT color="green">125</FONT>        /**<a name="line.125"></a>
+<FONT color="green">126</FONT>         * The position of the first addressable element in the internal storage<a name="line.126"></a>
+<FONT color="green">127</FONT>         * array.  The addressable elements in the array are &lt;code&gt;<a name="line.127"></a>
+<FONT color="green">128</FONT>         * internalArray[startIndex],...,internalArray[startIndex + numElements -1]<a name="line.128"></a>
+<FONT color="green">129</FONT>         * &lt;/code&gt;<a name="line.129"></a>
+<FONT color="green">130</FONT>         */<a name="line.130"></a>
+<FONT color="green">131</FONT>        protected int startIndex = 0;<a name="line.131"></a>
+<FONT color="green">132</FONT>    <a name="line.132"></a>
+<FONT color="green">133</FONT>        /**<a name="line.133"></a>
+<FONT color="green">134</FONT>         * Create a ResizableArray with default properties.<a name="line.134"></a>
+<FONT color="green">135</FONT>         * &lt;ul&gt;<a name="line.135"></a>
+<FONT color="green">136</FONT>         * &lt;li&gt;&lt;code&gt;initialCapacity = 16&lt;/code&gt;&lt;/li&gt;<a name="line.136"></a>
+<FONT color="green">137</FONT>         * &lt;li&gt;&lt;code&gt;expansionMode = MULTIPLICATIVE_MODE&lt;/code&gt;&lt;/li&gt;<a name="line.137"></a>
+<FONT color="green">138</FONT>         * &lt;li&gt;&lt;code&gt;expansionFactor = 2.5&lt;/code&gt;&lt;/li&gt;<a name="line.138"></a>
+<FONT color="green">139</FONT>         * &lt;li&gt;&lt;code&gt;contractionFactor = 2.0&lt;/code&gt;&lt;/li&gt;<a name="line.139"></a>
+<FONT color="green">140</FONT>         * &lt;/ul&gt;<a name="line.140"></a>
+<FONT color="green">141</FONT>         */<a name="line.141"></a>
+<FONT color="green">142</FONT>        public ResizableDoubleArray() {<a name="line.142"></a>
+<FONT color="green">143</FONT>            internalArray = new double[initialCapacity];<a name="line.143"></a>
+<FONT color="green">144</FONT>        }<a name="line.144"></a>
+<FONT color="green">145</FONT>    <a name="line.145"></a>
+<FONT color="green">146</FONT>        /**<a name="line.146"></a>
+<FONT color="green">147</FONT>         * Create a ResizableArray with the specified initial capacity.  Other<a name="line.147"></a>
+<FONT color="green">148</FONT>         * properties take default values:<a name="line.148"></a>
+<FONT color="green">149</FONT>          * &lt;ul&gt;<a name="line.149"></a>
+<FONT color="green">150</FONT>         * &lt;li&gt;&lt;code&gt;expansionMode = MULTIPLICATIVE_MODE&lt;/code&gt;&lt;/li&gt;<a name="line.150"></a>
+<FONT color="green">151</FONT>         * &lt;li&gt;&lt;code&gt;expansionFactor = 2.5&lt;/code&gt;&lt;/li&gt;<a name="line.151"></a>
+<FONT color="green">152</FONT>         * &lt;li&gt;&lt;code&gt;contractionFactor = 2.0&lt;/code&gt;&lt;/li&gt;<a name="line.152"></a>
+<FONT color="green">153</FONT>         * &lt;/ul&gt;<a name="line.153"></a>
+<FONT color="green">154</FONT>         * @param initialCapacity The initial size of the internal storage array<a name="line.154"></a>
+<FONT color="green">155</FONT>         * @throws IllegalArgumentException if initialCapacity is not &gt; 0<a name="line.155"></a>
+<FONT color="green">156</FONT>         */<a name="line.156"></a>
+<FONT color="green">157</FONT>        public ResizableDoubleArray(int initialCapacity) {<a name="line.157"></a>
+<FONT color="green">158</FONT>            setInitialCapacity(initialCapacity);<a name="line.158"></a>
+<FONT color="green">159</FONT>            internalArray = new double[this.initialCapacity];<a name="line.159"></a>
+<FONT color="green">160</FONT>        }<a name="line.160"></a>
+<FONT color="green">161</FONT>    <a name="line.161"></a>
+<FONT color="green">162</FONT>        /**<a name="line.162"></a>
+<FONT color="green">163</FONT>         * &lt;p&gt;<a name="line.163"></a>
+<FONT color="green">164</FONT>         * Create a ResizableArray with the specified initial capacity<a name="line.164"></a>
+<FONT color="green">165</FONT>         * and expansion factor.  The remaining properties take default<a name="line.165"></a>
+<FONT color="green">166</FONT>         * values:<a name="line.166"></a>
+<FONT color="green">167</FONT>         * &lt;ul&gt;<a name="line.167"></a>
+<FONT color="green">168</FONT>         * &lt;li&gt;&lt;code&gt;expansionMode = MULTIPLICATIVE_MODE&lt;/code&gt;&lt;/li&gt;<a name="line.168"></a>
+<FONT color="green">169</FONT>         * &lt;li&gt;&lt;code&gt;contractionFactor = 0.5 + expansionFactor&lt;/code&gt;&lt;/li&gt;<a name="line.169"></a>
+<FONT color="green">170</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.170"></a>
+<FONT color="green">171</FONT>         * &lt;p&gt;<a name="line.171"></a>
+<FONT color="green">172</FONT>         * Throws IllegalArgumentException if the following conditions are<a name="line.172"></a>
+<FONT color="green">173</FONT>         * not met:<a name="line.173"></a>
+<FONT color="green">174</FONT>         * &lt;ul&gt;<a name="line.174"></a>
+<FONT color="green">175</FONT>         * &lt;li&gt;&lt;code&gt;initialCapacity &gt; 0&lt;/code&gt;&lt;/li&gt;<a name="line.175"></a>
+<FONT color="green">176</FONT>         * &lt;li&gt;&lt;code&gt;expansionFactor &gt; 1&lt;/code&gt;&lt;/li&gt;<a name="line.176"></a>
+<FONT color="green">177</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.177"></a>
+<FONT color="green">178</FONT>         *<a name="line.178"></a>
+<FONT color="green">179</FONT>         * @param initialCapacity The initial size of the internal storage array<a name="line.179"></a>
+<FONT color="green">180</FONT>         * @param expansionFactor the array will be expanded based on this<a name="line.180"></a>
+<FONT color="green">181</FONT>         *                        parameter<a name="line.181"></a>
+<FONT color="green">182</FONT>         * @throws IllegalArgumentException if parameters are not valid<a name="line.182"></a>
+<FONT color="green">183</FONT>         */<a name="line.183"></a>
+<FONT color="green">184</FONT>        public ResizableDoubleArray(int initialCapacity, float expansionFactor) {<a name="line.184"></a>
+<FONT color="green">185</FONT>            this.expansionFactor = expansionFactor;<a name="line.185"></a>
+<FONT color="green">186</FONT>            setInitialCapacity(initialCapacity);<a name="line.186"></a>
+<FONT color="green">187</FONT>            internalArray = new double[initialCapacity];<a name="line.187"></a>
+<FONT color="green">188</FONT>            setContractionCriteria(expansionFactor +0.5f);<a name="line.188"></a>
+<FONT color="green">189</FONT>        }<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>        /**<a name="line.191"></a>
+<FONT color="green">192</FONT>         * &lt;p&gt;<a name="line.192"></a>
+<FONT color="green">193</FONT>         * Create a ResizableArray with the specified initialCapacity,<a name="line.193"></a>
+<FONT color="green">194</FONT>         * expansionFactor, and contractionCriteria. The &lt;code&gt;expansionMode&lt;/code&gt;<a name="line.194"></a>
+<FONT color="green">195</FONT>         * will default to &lt;code&gt;MULTIPLICATIVE_MODE.&lt;/code&gt;&lt;/p&gt;<a name="line.195"></a>
+<FONT color="green">196</FONT>         * &lt;p&gt;<a name="line.196"></a>
+<FONT color="green">197</FONT>         * Throws IllegalArgumentException if the following conditions are<a name="line.197"></a>
+<FONT color="green">198</FONT>         * not met:<a name="line.198"></a>
+<FONT color="green">199</FONT>         * &lt;ul&gt;<a name="line.199"></a>
+<FONT color="green">200</FONT>         * &lt;li&gt;&lt;code&gt;initialCapacity &gt; 0&lt;/code&gt;&lt;/li&gt;<a name="line.200"></a>
+<FONT color="green">201</FONT>         * &lt;li&gt;&lt;code&gt;expansionFactor &gt; 1&lt;/code&gt;&lt;/li&gt;<a name="line.201"></a>
+<FONT color="green">202</FONT>         * &lt;li&gt;&lt;code&gt;contractionFactor &gt;= expansionFactor&lt;/code&gt;&lt;/li&gt;<a name="line.202"></a>
+<FONT color="green">203</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.203"></a>
+<FONT color="green">204</FONT>         * @param initialCapacity The initial size of the internal storage array<a name="line.204"></a>
+<FONT color="green">205</FONT>         * @param expansionFactor the array will be expanded based on this<a name="line.205"></a>
+<FONT color="green">206</FONT>         *                        parameter<a name="line.206"></a>
+<FONT color="green">207</FONT>         * @param contractionCriteria The contraction Criteria.<a name="line.207"></a>
+<FONT color="green">208</FONT>         * @throws IllegalArgumentException if parameters are not valid<a name="line.208"></a>
+<FONT color="green">209</FONT>         */<a name="line.209"></a>
+<FONT color="green">210</FONT>        public ResizableDoubleArray(int initialCapacity, float expansionFactor,<a name="line.210"></a>
+<FONT color="green">211</FONT>            float contractionCriteria) {<a name="line.211"></a>
+<FONT color="green">212</FONT>            this.expansionFactor = expansionFactor;<a name="line.212"></a>
+<FONT color="green">213</FONT>            setContractionCriteria(contractionCriteria);<a name="line.213"></a>
+<FONT color="green">214</FONT>            setInitialCapacity(initialCapacity);<a name="line.214"></a>
+<FONT color="green">215</FONT>            internalArray = new double[initialCapacity];<a name="line.215"></a>
+<FONT color="green">216</FONT>        }<a name="line.216"></a>
+<FONT color="green">217</FONT>    <a name="line.217"></a>
+<FONT color="green">218</FONT>        /**<a name="line.218"></a>
+<FONT color="green">219</FONT>         * &lt;p&gt;<a name="line.219"></a>
+<FONT color="green">220</FONT>         * Create a ResizableArray with the specified properties.&lt;/p&gt;<a name="line.220"></a>
+<FONT color="green">221</FONT>        * &lt;p&gt;<a name="line.221"></a>
+<FONT color="green">222</FONT>         * Throws IllegalArgumentException if the following conditions are<a name="line.222"></a>
+<FONT color="green">223</FONT>         * not met:<a name="line.223"></a>
+<FONT color="green">224</FONT>         * &lt;ul&gt;<a name="line.224"></a>
+<FONT color="green">225</FONT>         * &lt;li&gt;&lt;code&gt;initialCapacity &gt; 0&lt;/code&gt;&lt;/li&gt;<a name="line.225"></a>
+<FONT color="green">226</FONT>         * &lt;li&gt;&lt;code&gt;expansionFactor &gt; 1&lt;/code&gt;&lt;/li&gt;<a name="line.226"></a>
+<FONT color="green">227</FONT>         * &lt;li&gt;&lt;code&gt;contractionFactor &gt;= expansionFactor&lt;/code&gt;&lt;/li&gt;<a name="line.227"></a>
+<FONT color="green">228</FONT>         * &lt;li&gt;&lt;code&gt;expansionMode in {MULTIPLICATIVE_MODE, ADDITIVE_MODE}&lt;/code&gt;<a name="line.228"></a>
+<FONT color="green">229</FONT>         * &lt;/li&gt;<a name="line.229"></a>
+<FONT color="green">230</FONT>         * &lt;/ul&gt;&lt;/p&gt;<a name="line.230"></a>
+<FONT color="green">231</FONT>         *<a name="line.231"></a>
+<FONT color="green">232</FONT>         * @param initialCapacity the initial size of the internal storage array<a name="line.232"></a>
+<FONT color="green">233</FONT>         * @param expansionFactor the array will be expanded based on this<a name="line.233"></a>
+<FONT color="green">234</FONT>         *                        parameter<a name="line.234"></a>
+<FONT color="green">235</FONT>         * @param contractionCriteria the contraction Criteria<a name="line.235"></a>
+<FONT color="green">236</FONT>         * @param expansionMode  the expansion mode<a name="line.236"></a>
+<FONT color="green">237</FONT>         * @throws IllegalArgumentException if parameters are not valid<a name="line.237"></a>
+<FONT color="green">238</FONT>         */<a name="line.238"></a>
+<FONT color="green">239</FONT>        public ResizableDoubleArray(int initialCapacity, float expansionFactor,<a name="line.239"></a>
+<FONT color="green">240</FONT>                float contractionCriteria, int expansionMode) {<a name="line.240"></a>
+<FONT color="green">241</FONT>            this.expansionFactor = expansionFactor;<a name="line.241"></a>
+<FONT color="green">242</FONT>            setContractionCriteria(contractionCriteria);<a name="line.242"></a>
+<FONT color="green">243</FONT>            setInitialCapacity(initialCapacity);<a name="line.243"></a>
+<FONT color="green">244</FONT>            setExpansionMode(expansionMode);<a name="line.244"></a>
+<FONT color="green">245</FONT>            internalArray = new double[initialCapacity];<a name="line.245"></a>
+<FONT color="green">246</FONT>        }<a name="line.246"></a>
+<FONT color="green">247</FONT>    <a name="line.247"></a>
+<FONT color="green">248</FONT>        /**<a name="line.248"></a>
+<FONT color="green">249</FONT>         * Copy constructor.  Creates a new ResizableDoubleArray that is a deep,<a name="line.249"></a>
+<FONT color="green">250</FONT>         * fresh copy of the original. Needs to acquire synchronization lock<a name="line.250"></a>
+<FONT color="green">251</FONT>         * on original.  Original may not be null; otherwise a NullPointerException<a name="line.251"></a>
+<FONT color="green">252</FONT>         * is thrown.<a name="line.252"></a>
+<FONT color="green">253</FONT>         *<a name="line.253"></a>
+<FONT color="green">254</FONT>         * @param original array to copy<a name="line.254"></a>
+<FONT color="green">255</FONT>         * @since 2.0<a name="line.255"></a>
+<FONT color="green">256</FONT>         */<a name="line.256"></a>
+<FONT color="green">257</FONT>        public ResizableDoubleArray(ResizableDoubleArray original) {<a name="line.257"></a>
+<FONT color="green">258</FONT>            copy(original, this);<a name="line.258"></a>
+<FONT color="green">259</FONT>        }<a name="line.259"></a>
+<FONT color="green">260</FONT>    <a name="line.260"></a>
+<FONT color="green">261</FONT>        /**<a name="line.261"></a>
+<FONT color="green">262</FONT>         * Adds an element to the end of this expandable array.<a name="line.262"></a>
+<FONT color="green">263</FONT>         *<a name="line.263"></a>
+<FONT color="green">264</FONT>         * @param value to be added to end of array<a name="line.264"></a>
+<FONT color="green">265</FONT>         */<a name="line.265"></a>
+<FONT color="green">266</FONT>        public synchronized void addElement(double value) {<a name="line.266"></a>
+<FONT color="green">267</FONT>            numElements++;<a name="line.267"></a>
+<FONT color="green">268</FONT>            if ((startIndex + numElements) &gt; internalArray.length) {<a name="line.268"></a>
+<FONT color="green">269</FONT>                expand();<a name="line.269"></a>
+<FONT color="green">270</FONT>            }<a name="line.270"></a>
+<FONT color="green">271</FONT>            internalArray[startIndex + (numElements - 1)] = value;<a name="line.271"></a>
+<FONT color="green">272</FONT>            if (shouldContract()) {<a name="line.272"></a>
+<FONT color="green">273</FONT>                contract();<a name="line.273"></a>
+<FONT color="green">274</FONT>            }<a name="line.274"></a>
+<FONT color="green">275</FONT>        }<a name="line.275"></a>
+<FONT color="green">276</FONT>    <a name="line.276"></a>
+<FONT color="green">277</FONT>        /**<a name="line.277"></a>
+<FONT color="green">278</FONT>         * &lt;p&gt;<a name="line.278"></a>
+<FONT color="green">279</FONT>         * Adds an element to the end of the array and removes the first<a name="line.279"></a>
+<FONT color="green">280</FONT>         * element in the array.  Returns the discarded first element.<a name="line.280"></a>
+<FONT color="green">281</FONT>         * The effect is similar to a push operation in a FIFO queue.<a name="line.281"></a>
+<FONT color="green">282</FONT>         * &lt;/p&gt;<a name="line.282"></a>
+<FONT color="green">283</FONT>         * &lt;p&gt;<a name="line.283"></a>
+<FONT color="green">284</FONT>         * Example: If the array contains the elements 1, 2, 3, 4 (in that order)<a name="line.284"></a>
+<FONT color="green">285</FONT>         * and addElementRolling(5) is invoked, the result is an array containing<a name="line.285"></a>
+<FONT color="green">286</FONT>         * the entries 2, 3, 4, 5 and the value returned is 1.<a name="line.286"></a>
+<FONT color="green">287</FONT>         * &lt;/p&gt;<a name="line.287"></a>
+<FONT color="green">288</FONT>         *<a name="line.288"></a>
+<FONT color="green">289</FONT>         * @param value the value to be added to the array<a name="line.289"></a>
+<FONT color="green">290</FONT>         * @return the value which has been discarded or "pushed" out of the array<a name="line.290"></a>
+<FONT color="green">291</FONT>         *         by this rolling insert<a name="line.291"></a>
+<FONT color="green">292</FONT>         */<a name="line.292"></a>
+<FONT color="green">293</FONT>        public synchronized double addElementRolling(double value) {<a name="line.293"></a>
+<FONT color="green">294</FONT>            double discarded = internalArray[startIndex];<a name="line.294"></a>
+<FONT color="green">295</FONT>    <a name="line.295"></a>
+<FONT color="green">296</FONT>            if ((startIndex + (numElements + 1)) &gt; internalArray.length) {<a name="line.296"></a>
+<FONT color="green">297</FONT>                expand();<a name="line.297"></a>
+<FONT color="green">298</FONT>            }<a name="line.298"></a>
+<FONT color="green">299</FONT>            // Increment the start index<a name="line.299"></a>
+<FONT color="green">300</FONT>            startIndex += 1;<a name="line.300"></a>
+<FONT color="green">301</FONT>    <a name="line.301"></a>
+<FONT color="green">302</FONT>            // Add the new value<a name="line.302"></a>
+<FONT color="green">303</FONT>            internalArray[startIndex + (numElements - 1)] = value;<a name="line.303"></a>
+<FONT color="green">304</FONT>    <a name="line.304"></a>
+<FONT color="green">305</FONT>            // Check the contraction criteria<a name="line.305"></a>
+<FONT color="green">306</FONT>            if (shouldContract()) {<a name="line.306"></a>
+<FONT color="green">307</FONT>                contract();<a name="line.307"></a>
+<FONT color="green">308</FONT>            }<a name="line.308"></a>
+<FONT color="green">309</FONT>            return discarded;<a name="line.309"></a>
+<FONT color="green">310</FONT>        }<a name="line.310"></a>
+<FONT color="green">311</FONT>    <a name="line.311"></a>
+<FONT color="green">312</FONT>        /**<a name="line.312"></a>
+<FONT color="green">313</FONT>         * Substitutes &lt;code&gt;value&lt;/code&gt; for the most recently added value.<a name="line.313"></a>
+<FONT color="green">314</FONT>         * Returns the value that has been replaced. If the array is empty (i.e.<a name="line.314"></a>
+<FONT color="green">315</FONT>         * if {@link #numElements} is zero), a MathRuntimeException is thrown.<a name="line.315"></a>
+<FONT color="green">316</FONT>         *<a name="line.316"></a>
+<FONT color="green">317</FONT>         * @param value new value to substitute for the most recently added value<a name="line.317"></a>
+<FONT color="green">318</FONT>         * @return value that has been replaced in the array<a name="line.318"></a>
+<FONT color="green">319</FONT>         * @since 2.0<a name="line.319"></a>
+<FONT color="green">320</FONT>         */<a name="line.320"></a>
+<FONT color="green">321</FONT>        public synchronized double substituteMostRecentElement(double value) {<a name="line.321"></a>
+<FONT color="green">322</FONT>            if (numElements &lt; 1) {<a name="line.322"></a>
+<FONT color="green">323</FONT>                throw MathRuntimeException.createArrayIndexOutOfBoundsException(<a name="line.323"></a>
+<FONT color="green">324</FONT>                        "cannot substitute an element from an empty array");<a name="line.324"></a>
+<FONT color="green">325</FONT>            }<a name="line.325"></a>
+<FONT color="green">326</FONT>    <a name="line.326"></a>
+<FONT color="green">327</FONT>            double discarded = internalArray[startIndex + (numElements - 1)];<a name="line.327"></a>
+<FONT color="green">328</FONT>    <a name="line.328"></a>
+<FONT color="green">329</FONT>            internalArray[startIndex + (numElements - 1)] = value;<a name="line.329"></a>
+<FONT color="green">330</FONT>    <a name="line.330"></a>
+<FONT color="green">331</FONT>            return discarded;<a name="line.331"></a>
+<FONT color="green">332</FONT>        }<a name="line.332"></a>
+<FONT color="green">333</FONT>    <a name="line.333"></a>
+<FONT color="green">334</FONT>    <a name="line.334"></a>
+<FONT color="green">335</FONT>        /**<a name="line.335"></a>
+<FONT color="green">336</FONT>         * Checks the expansion factor and the contraction criteria and throws an<a name="line.336"></a>
+<FONT color="green">337</FONT>         * IllegalArgumentException if the contractionCriteria is less than the<a name="line.337"></a>
+<FONT color="green">338</FONT>         * expansionCriteria<a name="line.338"></a>
+<FONT color="green">339</FONT>         *<a name="line.339"></a>
+<FONT color="green">340</FONT>         * @param expansion factor to be checked<a name="line.340"></a>
+<FONT color="green">341</FONT>         * @param contraction criteria to be checked<a name="line.341"></a>
+<FONT color="green">342</FONT>         * @throws IllegalArgumentException if the contractionCriteria is less than<a name="line.342"></a>
+<FONT color="green">343</FONT>         *         the expansionCriteria.<a name="line.343"></a>
+<FONT color="green">344</FONT>         */<a name="line.344"></a>
+<FONT color="green">345</FONT>        protected void checkContractExpand(float contraction, float expansion) {<a name="line.345"></a>
+<FONT color="green">346</FONT>    <a name="line.346"></a>
+<FONT color="green">347</FONT>            if (contraction &lt; expansion) {<a name="line.347"></a>
+<FONT color="green">348</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.348"></a>
+<FONT color="green">349</FONT>                        "contraction criteria ({0}) smaller than the expansion factor ({1}).  This would " +<a name="line.349"></a>
+<FONT color="green">350</FONT>                        "lead to a never ending loop of expansion and contraction as a newly expanded " +<a name="line.350"></a>
+<FONT color="green">351</FONT>                        "internal storage array would immediately satisfy the criteria for contraction",<a name="line.351"></a>
+<FONT color="green">352</FONT>                        contraction, expansion);<a name="line.352"></a>
+<FONT color="green">353</FONT>            }<a name="line.353"></a>
+<FONT color="green">354</FONT>    <a name="line.354"></a>
+<FONT color="green">355</FONT>            if (contraction &lt;= 1.0) {<a name="line.355"></a>
+<FONT color="green">356</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.356"></a>
+<FONT color="green">357</FONT>                        "contraction criteria smaller than one ({0}).  This would lead to a never ending " +<a name="line.357"></a>
+<FONT color="green">358</FONT>                        "loop of expansion and contraction as an internal storage array length equal " +<a name="line.358"></a>
+<FONT color="green">359</FONT>                        "to the number of elements would satisfy the contraction criteria.",<a name="line.359"></a>
+<FONT color="green">360</FONT>                        contraction);<a name="line.360"></a>
+<FONT color="green">361</FONT>            }<a name="line.361"></a>
+<FONT color="green">362</FONT>    <a name="line.362"></a>
+<FONT color="green">363</FONT>            if (expansion &lt;= 1.0) {<a name="line.363"></a>
+<FONT color="green">364</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.364"></a>
+<FONT color="green">365</FONT>                        "expansion factor smaller than one ({0})",<a name="line.365"></a>
+<FONT color="green">366</FONT>                        expansion);<a name="line.366"></a>
+<FONT color="green">367</FONT>            }<a name="line.367"></a>
+<FONT color="green">368</FONT>        }<a name="line.368"></a>
+<FONT color="green">369</FONT>    <a name="line.369"></a>
+<FONT color="green">370</FONT>        /**<a name="line.370"></a>
+<FONT color="green">371</FONT>         * Clear the array, reset the size to the initialCapacity and the number<a name="line.371"></a>
+<FONT color="green">372</FONT>         * of elements to zero.<a name="line.372"></a>
+<FONT color="green">373</FONT>         */<a name="line.373"></a>
+<FONT color="green">374</FONT>        public synchronized void clear() {<a name="line.374"></a>
+<FONT color="green">375</FONT>            numElements = 0;<a name="line.375"></a>
+<FONT color="green">376</FONT>            startIndex = 0;<a name="line.376"></a>
+<FONT color="green">377</FONT>            internalArray = new double[initialCapacity];<a name="line.377"></a>
+<FONT color="green">378</FONT>        }<a name="line.378"></a>
+<FONT color="green">379</FONT>    <a name="line.379"></a>
+<FONT color="green">380</FONT>        /**<a name="line.380"></a>
+<FONT color="green">381</FONT>         * Contracts the storage array to the (size of the element set) + 1 - to<a name="line.381"></a>
+<FONT color="green">382</FONT>         * avoid a zero length array. This function also resets the startIndex to<a name="line.382"></a>
+<FONT color="green">383</FONT>         * zero.<a name="line.383"></a>
+<FONT color="green">384</FONT>         */<a name="line.384"></a>
+<FONT color="green">385</FONT>        public synchronized void contract() {<a name="line.385"></a>
+<FONT color="green">386</FONT>            double[] tempArray = new double[numElements + 1];<a name="line.386"></a>
+<FONT color="green">387</FONT>    <a name="line.387"></a>
+<FONT color="green">388</FONT>            // Copy and swap - copy only the element array from the src array.<a name="line.388"></a>
+<FONT color="green">389</FONT>            System.arraycopy(internalArray, startIndex, tempArray, 0, numElements);<a name="line.389"></a>
+<FONT color="green">390</FONT>            internalArray = tempArray;<a name="line.390"></a>
+<FONT color="green">391</FONT>    <a name="line.391"></a>
+<FONT color="green">392</FONT>            // Reset the start index to zero<a name="line.392"></a>
+<FONT color="green">393</FONT>            startIndex = 0;<a name="line.393"></a>
+<FONT color="green">394</FONT>        }<a name="line.394"></a>
+<FONT color="green">395</FONT>    <a name="line.395"></a>
+<FONT color="green">396</FONT>        /**<a name="line.396"></a>
+<FONT color="green">397</FONT>         * Discards the &lt;code&gt;i&lt;code&gt; initial elements of the array.  For example,<a name="line.397"></a>
+<FONT color="green">398</FONT>         * if the array contains the elements 1,2,3,4, invoking<a name="line.398"></a>
+<FONT color="green">399</FONT>         * &lt;code&gt;discardFrontElements(2)&lt;/code&gt; will cause the first two elements<a name="line.399"></a>
+<FONT color="green">400</FONT>         * to be discarded, leaving 3,4 in the array.  Throws illegalArgumentException<a name="line.400"></a>
+<FONT color="green">401</FONT>         * if i exceeds numElements.<a name="line.401"></a>
+<FONT color="green">402</FONT>         *<a name="line.402"></a>
+<FONT color="green">403</FONT>         * @param i  the number of elements to discard from the front of the array<a name="line.403"></a>
+<FONT color="green">404</FONT>         * @throws IllegalArgumentException if i is greater than numElements.<a name="line.404"></a>
+<FONT color="green">405</FONT>         * @since 2.0<a name="line.405"></a>
+<FONT color="green">406</FONT>         */<a name="line.406"></a>
+<FONT color="green">407</FONT>        public synchronized void discardFrontElements(int i) {<a name="line.407"></a>
+<FONT color="green">408</FONT>    <a name="line.408"></a>
+<FONT color="green">409</FONT>            discardExtremeElements(i,true);<a name="line.409"></a>
+<FONT color="green">410</FONT>    <a name="line.410"></a>
+<FONT color="green">411</FONT>        }<a name="line.411"></a>
+<FONT color="green">412</FONT>    <a name="line.412"></a>
+<FONT color="green">413</FONT>        /**<a name="line.413"></a>
+<FONT color="green">414</FONT>         * Discards the &lt;code&gt;i&lt;code&gt; last elements of the array.  For example,<a name="line.414"></a>
+<FONT color="green">415</FONT>         * if the array contains the elements 1,2,3,4, invoking<a name="line.415"></a>
+<FONT color="green">416</FONT>         * &lt;code&gt;discardMostRecentElements(2)&lt;/code&gt; will cause the last two elements<a name="line.416"></a>
+<FONT color="green">417</FONT>         * to be discarded, leaving 1,2 in the array.  Throws illegalArgumentException<a name="line.417"></a>
+<FONT color="green">418</FONT>         * if i exceeds numElements.<a name="line.418"></a>
+<FONT color="green">419</FONT>         *<a name="line.419"></a>
+<FONT color="green">420</FONT>         * @param i  the number of elements to discard from the end of the array<a name="line.420"></a>
+<FONT color="green">421</FONT>         * @throws IllegalArgumentException if i is greater than numElements.<a name="line.421"></a>
+<FONT color="green">422</FONT>         * @since 2.0<a name="line.422"></a>
+<FONT color="green">423</FONT>         */<a name="line.423"></a>
+<FONT color="green">424</FONT>        public synchronized void discardMostRecentElements(int i) {<a name="line.424"></a>
+<FONT color="green">425</FONT>    <a name="line.425"></a>
+<FONT color="green">426</FONT>            discardExtremeElements(i,false);<a name="line.426"></a>
+<FONT color="green">427</FONT>    <a name="line.427"></a>
+<FONT color="green">428</FONT>        }<a name="line.428"></a>
+<FONT color="green">429</FONT>    <a name="line.429"></a>
+<FONT color="green">430</FONT>        /**<a name="line.430"></a>
+<FONT color="green">431</FONT>         * Discards the &lt;code&gt;i&lt;code&gt; first or last elements of the array,<a name="line.431"></a>
+<FONT color="green">432</FONT>         * depending on the value of &lt;code&gt;front&lt;/code&gt;.<a name="line.432"></a>
+<FONT color="green">433</FONT>         * For example, if the array contains the elements 1,2,3,4, invoking<a name="line.433"></a>
+<FONT color="green">434</FONT>         * &lt;code&gt;discardExtremeElements(2,false)&lt;/code&gt; will cause the last two elements<a name="line.434"></a>
+<FONT color="green">435</FONT>         * to be discarded, leaving 1,2 in the array.<a name="line.435"></a>
+<FONT color="green">436</FONT>         * For example, if the array contains the elements 1,2,3,4, invoking<a name="line.436"></a>
+<FONT color="green">437</FONT>         * &lt;code&gt;discardExtremeElements(2,true)&lt;/code&gt; will cause the first two elements<a name="line.437"></a>
+<FONT color="green">438</FONT>         * to be discarded, leaving 3,4 in the array.<a name="line.438"></a>
+<FONT color="green">439</FONT>         * Throws illegalArgumentException<a name="line.439"></a>
+<FONT color="green">440</FONT>         * if i exceeds numElements.<a name="line.440"></a>
+<FONT color="green">441</FONT>         *<a name="line.441"></a>
+<FONT color="green">442</FONT>         * @param i  the number of elements to discard from the front/end of the array<a name="line.442"></a>
+<FONT color="green">443</FONT>         * @param front true if elements are to be discarded from the front<a name="line.443"></a>
+<FONT color="green">444</FONT>         * of the array, false if elements are to be discarded from the end<a name="line.444"></a>
+<FONT color="green">445</FONT>         * of the array<a name="line.445"></a>
+<FONT color="green">446</FONT>         * @throws IllegalArgumentException if i is greater than numElements.<a name="line.446"></a>
+<FONT color="green">447</FONT>         * @since 2.0<a name="line.447"></a>
+<FONT color="green">448</FONT>         */<a name="line.448"></a>
+<FONT color="green">449</FONT>        private synchronized void discardExtremeElements(int i,boolean front) {<a name="line.449"></a>
+<FONT color="green">450</FONT>            if (i &gt; numElements) {<a name="line.450"></a>
+<FONT color="green">451</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.451"></a>
+<FONT color="green">452</FONT>                        "cannot discard {0} elements from a {1} elements array",<a name="line.452"></a>
+<FONT color="green">453</FONT>                        i, numElements);<a name="line.453"></a>
+<FONT color="green">454</FONT>           } else if (i &lt; 0) {<a name="line.454"></a>
+<FONT color="green">455</FONT>               throw MathRuntimeException.createIllegalArgumentException(<a name="line.455"></a>
+<FONT color="green">456</FONT>                       "cannot discard a negative number of elements ({0})",<a name="line.456"></a>
+<FONT color="green">457</FONT>                       i);<a name="line.457"></a>
+<FONT color="green">458</FONT>            } else {<a name="line.458"></a>
+<FONT color="green">459</FONT>                // "Subtract" this number of discarded from numElements<a name="line.459"></a>
+<FONT color="green">460</FONT>                numElements -= i;<a name="line.460"></a>
+<FONT color="green">461</FONT>                if (front) startIndex += i;<a name="line.461"></a>
+<FONT color="green">462</FONT>            }<a name="line.462"></a>
+<FONT color="green">463</FONT>            if (shouldContract()) {<a name="line.463"></a>
+<FONT color="green">464</FONT>                contract();<a name="line.464"></a>
+<FONT color="green">465</FONT>            }<a name="line.465"></a>
+<FONT color="green">466</FONT>        }<a name="line.466"></a>
+<FONT color="green">467</FONT>    <a name="line.467"></a>
+<FONT color="green">468</FONT>        /**<a name="line.468"></a>
+<FONT color="green">469</FONT>         * Expands the internal storage array using the expansion factor.<a name="line.469"></a>
+<FONT color="green">470</FONT>         * &lt;p&gt;<a name="line.470"></a>
+<FONT color="green">471</FONT>         * if &lt;code&gt;expansionMode&lt;/code&gt; is set to MULTIPLICATIVE_MODE,<a name="line.471"></a>
+<FONT color="green">472</FONT>         * the new array size will be &lt;code&gt;internalArray.length * expansionFactor.&lt;/code&gt;<a name="line.472"></a>
+<FONT color="green">473</FONT>         * If &lt;code&gt;expansionMode&lt;/code&gt; is set to ADDITIVE_MODE,  the length<a name="line.473"></a>
+<FONT color="green">474</FONT>         * after expansion will be &lt;code&gt;internalArray.length + expansionFactor&lt;/code&gt;<a name="line.474"></a>
+<FONT color="green">475</FONT>         * &lt;/p&gt;<a name="line.475"></a>
+<FONT color="green">476</FONT>         */<a name="line.476"></a>
+<FONT color="green">477</FONT>        protected synchronized void expand() {<a name="line.477"></a>
+<FONT color="green">478</FONT>    <a name="line.478"></a>
+<FONT color="green">479</FONT>            // notice the use of Math.ceil(), this guarantees that we will always<a name="line.479"></a>
+<FONT color="green">480</FONT>            // have an array of at least currentSize + 1.   Assume that the<a name="line.480"></a>
+<FONT color="green">481</FONT>            // current initial capacity is 1 and the expansion factor<a name="line.481"></a>
+<FONT color="green">482</FONT>            // is 1.000000000000000001.  The newly calculated size will be<a name="line.482"></a>
+<FONT color="green">483</FONT>            // rounded up to 2 after the multiplication is performed.<a name="line.483"></a>
+<FONT color="green">484</FONT>            int newSize = 0;<a name="line.484"></a>
+<FONT color="green">485</FONT>            if (expansionMode == MULTIPLICATIVE_MODE) {<a name="line.485"></a>
+<FONT color="green">486</FONT>                newSize = (int) Math.ceil(internalArray.length * expansionFactor);<a name="line.486"></a>
+<FONT color="green">487</FONT>            } else {<a name="line.487"></a>
+<FONT color="green">488</FONT>                newSize = internalArray.length + Math.round(expansionFactor);<a name="line.488"></a>
+<FONT color="green">489</FONT>            }<a name="line.489"></a>
+<FONT color="green">490</FONT>            double[] tempArray = new double[newSize];<a name="line.490"></a>
+<FONT color="green">491</FONT>    <a name="line.491"></a>
+<FONT color="green">492</FONT>            // Copy and swap<a name="line.492"></a>
+<FONT color="green">493</FONT>            System.arraycopy(internalArray, 0, tempArray, 0, internalArray.length);<a name="line.493"></a>
+<FONT color="green">494</FONT>            internalArray = tempArray;<a name="line.494"></a>
+<FONT color="green">495</FONT>        }<a name="line.495"></a>
+<FONT color="green">496</FONT>    <a name="line.496"></a>
+<FONT color="green">497</FONT>        /**<a name="line.497"></a>
+<FONT color="green">498</FONT>         * Expands the internal storage array to the specified size.<a name="line.498"></a>
+<FONT color="green">499</FONT>         *<a name="line.499"></a>
+<FONT color="green">500</FONT>         * @param size Size of the new internal storage array<a name="line.500"></a>
+<FONT color="green">501</FONT>         */<a name="line.501"></a>
+<FONT color="green">502</FONT>        private synchronized void expandTo(int size) {<a name="line.502"></a>
+<FONT color="green">503</FONT>            double[] tempArray = new double[size];<a name="line.503"></a>
+<FONT color="green">504</FONT>            // Copy and swap<a name="line.504"></a>
+<FONT color="green">505</FONT>            System.arraycopy(internalArray, 0, tempArray, 0, internalArray.length);<a name="line.505"></a>
+<FONT color="green">506</FONT>            internalArray = tempArray;<a name="line.506"></a>
+<FONT color="green">507</FONT>        }<a name="line.507"></a>
+<FONT color="green">508</FONT>    <a name="line.508"></a>
+<FONT color="green">509</FONT>        /**<a name="line.509"></a>
+<FONT color="green">510</FONT>         * The contraction criteria defines when the internal array will contract<a name="line.510"></a>
+<FONT color="green">511</FONT>         * to store only the number of elements in the element array.<a name="line.511"></a>
+<FONT color="green">512</FONT>         * If  the &lt;code&gt;expansionMode&lt;/code&gt; is &lt;code&gt;MULTIPLICATIVE_MODE&lt;/code&gt;,<a name="line.512"></a>
+<FONT color="green">513</FONT>         * contraction is triggered when the ratio between storage array length<a name="line.513"></a>
+<FONT color="green">514</FONT>         * and &lt;code&gt;numElements&lt;/code&gt; exceeds &lt;code&gt;contractionFactor&lt;/code&gt;.<a name="line.514"></a>
+<FONT color="green">515</FONT>         * If the &lt;code&gt;expansionMode&lt;/code&gt; is &lt;code&gt;ADDITIVE_MODE&lt;/code&gt;, the<a name="line.515"></a>
+<FONT color="green">516</FONT>         * number of excess storage locations is compared to<a name="line.516"></a>
+<FONT color="green">517</FONT>         * &lt;code&gt;contractionFactor.&lt;/code&gt;<a name="line.517"></a>
+<FONT color="green">518</FONT>         *<a name="line.518"></a>
+<FONT color="green">519</FONT>         * @return the contraction criteria used to reclaim memory.<a name="line.519"></a>
+<FONT color="green">520</FONT>         */<a name="line.520"></a>
+<FONT color="green">521</FONT>        public float getContractionCriteria() {<a name="line.521"></a>
+<FONT color="green">522</FONT>            return contractionCriteria;<a name="line.522"></a>
+<FONT color="green">523</FONT>        }<a name="line.523"></a>
+<FONT color="green">524</FONT>    <a name="line.524"></a>
+<FONT color="green">525</FONT>        /**<a name="line.525"></a>
+<FONT color="green">526</FONT>         * Returns the element at the specified index<a name="line.526"></a>
+<FONT color="green">527</FONT>         *<a name="line.527"></a>
+<FONT color="green">528</FONT>         * @param index index to fetch a value from<a name="line.528"></a>
+<FONT color="green">529</FONT>         * @return value stored at the specified index<a name="line.529"></a>
+<FONT color="green">530</FONT>         * @throws ArrayIndexOutOfBoundsException if &lt;code&gt;index&lt;/code&gt; is less than<a name="line.530"></a>
+<FONT color="green">531</FONT>         *         zero or is greater than &lt;code&gt;getNumElements() - 1&lt;/code&gt;.<a name="line.531"></a>
+<FONT color="green">532</FONT>         */<a name="line.532"></a>
+<FONT color="green">533</FONT>        public synchronized double getElement(int index) {<a name="line.533"></a>
+<FONT color="green">534</FONT>            if (index &gt;= numElements) {<a name="line.534"></a>
+<FONT color="green">535</FONT>                throw MathRuntimeException.createArrayIndexOutOfBoundsException(<a name="line.535"></a>
+<FONT color="green">536</FONT>                        "the index specified: {0} is larger than the current maximal index {1}",<a name="line.536"></a>
+<FONT color="green">537</FONT>                        index, numElements - 1);<a name="line.537"></a>
+<FONT color="green">538</FONT>            } else if (index &gt;= 0) {<a name="line.538"></a>
+<FONT color="green">539</FONT>                return internalArray[startIndex + index];<a name="line.539"></a>
+<FONT color="green">540</FONT>            } else {<a name="line.540"></a>
+<FONT color="green">541</FONT>                throw MathRuntimeException.createArrayIndexOutOfBoundsException(<a name="line.541"></a>
+<FONT color="green">542</FONT>                        "elements cannot be retrieved from a negative array index {0}",<a name="line.542"></a>
+<FONT color="green">543</FONT>                        index);<a name="line.543"></a>
+<FONT color="green">544</FONT>            }<a name="line.544"></a>
+<FONT color="green">545</FONT>        }<a name="line.545"></a>
+<FONT color="green">546</FONT>    <a name="line.546"></a>
+<FONT color="green">547</FONT>         /**<a name="line.547"></a>
+<FONT color="green">548</FONT>         * Returns a double array containing the elements of this<a name="line.548"></a>
+<FONT color="green">549</FONT>         * &lt;code&gt;ResizableArray&lt;/code&gt;.  This method returns a copy, not a<a name="line.549"></a>
+<FONT color="green">550</FONT>         * reference to the underlying array, so that changes made to the returned<a name="line.550"></a>
+<FONT color="green">551</FONT>         *  array have no effect on this &lt;code&gt;ResizableArray.&lt;/code&gt;<a name="line.551"></a>
+<FONT color="green">552</FONT>         * @return the double array.<a name="line.552"></a>
+<FONT color="green">553</FONT>         */<a name="line.553"></a>
+<FONT color="green">554</FONT>        public synchronized double[] getElements() {<a name="line.554"></a>
+<FONT color="green">555</FONT>            double[] elementArray = new double[numElements];<a name="line.555"></a>
+<FONT color="green">556</FONT>            System.arraycopy( internalArray, startIndex, elementArray, 0,<a name="line.556"></a>
+<FONT color="green">557</FONT>                    numElements);<a name="line.557"></a>
+<FONT color="green">558</FONT>            return elementArray;<a name="line.558"></a>
+<FONT color="green">559</FONT>        }<a name="line.559"></a>
+<FONT color="green">560</FONT>    <a name="line.560"></a>
+<FONT color="green">561</FONT>        /**<a name="line.561"></a>
+<FONT color="green">562</FONT>         * The expansion factor controls the size of a new array when an array<a name="line.562"></a>
+<FONT color="green">563</FONT>         * needs to be expanded.  The &lt;code&gt;expansionMode&lt;/code&gt;<a name="line.563"></a>
+<FONT color="green">564</FONT>         * determines whether the size of the array is multiplied by the<a name="line.564"></a>
+<FONT color="green">565</FONT>         * &lt;code&gt;expansionFactor&lt;/code&gt; (MULTIPLICATIVE_MODE) or if<a name="line.565"></a>
+<FONT color="green">566</FONT>         * the expansion is additive (ADDITIVE_MODE -- &lt;code&gt;expansionFactor&lt;/code&gt;<a name="line.566"></a>
+<FONT color="green">567</FONT>         * storage locations added).  The default &lt;code&gt;expansionMode&lt;/code&gt; is<a name="line.567"></a>
+<FONT color="green">568</FONT>         * MULTIPLICATIVE_MODE and the default &lt;code&gt;expansionFactor&lt;/code&gt;<a name="line.568"></a>
+<FONT color="green">569</FONT>         * is 2.0.<a name="line.569"></a>
+<FONT color="green">570</FONT>         *<a name="line.570"></a>
+<FONT color="green">571</FONT>         * @return the expansion factor of this expandable double array<a name="line.571"></a>
+<FONT color="green">572</FONT>         */<a name="line.572"></a>
+<FONT color="green">573</FONT>        public float getExpansionFactor() {<a name="line.573"></a>
+<FONT color="green">574</FONT>            return expansionFactor;<a name="line.574"></a>
+<FONT color="green">575</FONT>        }<a name="line.575"></a>
+<FONT color="green">576</FONT>    <a name="line.576"></a>
+<FONT color="green">577</FONT>        /**<a name="line.577"></a>
+<FONT color="green">578</FONT>         * The &lt;code&gt;expansionMode&lt;/code&gt; determines whether the internal storage<a name="line.578"></a>
+<FONT color="green">579</FONT>         * array grows additively (ADDITIVE_MODE) or multiplicatively<a name="line.579"></a>
+<FONT color="green">580</FONT>         * (MULTIPLICATIVE_MODE) when it is expanded.<a name="line.580"></a>
+<FONT color="green">581</FONT>         *<a name="line.581"></a>
+<FONT color="green">582</FONT>         * @return Returns the expansionMode.<a name="line.582"></a>
+<FONT color="green">583</FONT>         */<a name="line.583"></a>
+<FONT color="green">584</FONT>        public int getExpansionMode() {<a name="line.584"></a>
+<FONT color="green">585</FONT>            return expansionMode;<a name="line.585"></a>
+<FONT color="green">586</FONT>        }<a name="line.586"></a>
+<FONT color="green">587</FONT>    <a name="line.587"></a>
+<FONT color="green">588</FONT>        /**<a name="line.588"></a>
+<FONT color="green">589</FONT>         * Notice the package scope on this method.   This method is simply here<a name="line.589"></a>
+<FONT color="green">590</FONT>         * for the JUnit test, it allows us check if the expansion is working<a name="line.590"></a>
+<FONT color="green">591</FONT>         * properly after a number of expansions.  This is not meant to be a part<a name="line.591"></a>
+<FONT color="green">592</FONT>         * of the public interface of this class.<a name="line.592"></a>
+<FONT color="green">593</FONT>         *<a name="line.593"></a>
+<FONT color="green">594</FONT>         * @return the length of the internal storage array.<a name="line.594"></a>
+<FONT color="green">595</FONT>         */<a name="line.595"></a>
+<FONT color="green">596</FONT>        synchronized int getInternalLength() {<a name="line.596"></a>
+<FONT color="green">597</FONT>            return internalArray.length;<a name="line.597"></a>
+<FONT color="green">598</FONT>        }<a name="line.598"></a>
+<FONT color="green">599</FONT>    <a name="line.599"></a>
+<FONT color="green">600</FONT>        /**<a name="line.600"></a>
+<FONT color="green">601</FONT>         * Returns the number of elements currently in the array.  Please note<a name="line.601"></a>
+<FONT color="green">602</FONT>         * that this is different from the length of the internal storage array.<a name="line.602"></a>
+<FONT color="green">603</FONT>         *<a name="line.603"></a>
+<FONT color="green">604</FONT>         * @return number of elements<a name="line.604"></a>
+<FONT color="green">605</FONT>         */<a name="line.605"></a>
+<FONT color="green">606</FONT>        public synchronized int getNumElements() {<a name="line.606"></a>
+<FONT color="green">607</FONT>            return numElements;<a name="line.607"></a>
+<FONT color="green">608</FONT>        }<a name="line.608"></a>
+<FONT color="green">609</FONT>    <a name="line.609"></a>
+<FONT color="green">610</FONT>        /**<a name="line.610"></a>
+<FONT color="green">611</FONT>         * Returns the internal storage array.  Note that this method returns<a name="line.611"></a>
+<FONT color="green">612</FONT>         * a reference to the internal storage array, not a copy, and to correctly<a name="line.612"></a>
+<FONT color="green">613</FONT>         * address elements of the array, the &lt;code&gt;startIndex&lt;/code&gt; is<a name="line.613"></a>
+<FONT color="green">614</FONT>         * required (available via the {@link #start} method).  This method should<a name="line.614"></a>
+<FONT color="green">615</FONT>         * only be used in cases where copying the internal array is not practical.<a name="line.615"></a>
+<FONT color="green">616</FONT>         * The {@link #getElements} method should be used in all other cases.<a name="line.616"></a>
+<FONT color="green">617</FONT>         *<a name="line.617"></a>
+<FONT color="green">618</FONT>         *<a name="line.618"></a>
+<FONT color="green">619</FONT>         * @return the internal storage array used by this object<a name="line.619"></a>
+<FONT color="green">620</FONT>         * @deprecated replaced by {@link #getInternalValues()} as of 2.0<a name="line.620"></a>
+<FONT color="green">621</FONT>         */<a name="line.621"></a>
+<FONT color="green">622</FONT>        @Deprecated<a name="line.622"></a>
+<FONT color="green">623</FONT>        public synchronized double[] getValues() {<a name="line.623"></a>
+<FONT color="green">624</FONT>            return internalArray;<a name="line.624"></a>
+<FONT color="green">625</FONT>        }<a name="line.625"></a>
+<FONT color="green">626</FONT>    <a name="line.626"></a>
+<FONT color="green">627</FONT>        /**<a name="line.627"></a>
+<FONT color="green">628</FONT>         * Returns the internal storage array.  Note that this method returns<a name="line.628"></a>
+<FONT color="green">629</FONT>         * a reference to the internal storage array, not a copy, and to correctly<a name="line.629"></a>
+<FONT color="green">630</FONT>         * address elements of the array, the &lt;code&gt;startIndex&lt;/code&gt; is<a name="line.630"></a>
+<FONT color="green">631</FONT>         * required (available via the {@link #start} method).  This method should<a name="line.631"></a>
+<FONT color="green">632</FONT>         * only be used in cases where copying the internal array is not practical.<a name="line.632"></a>
+<FONT color="green">633</FONT>         * The {@link #getElements} method should be used in all other cases.<a name="line.633"></a>
+<FONT color="green">634</FONT>         *<a name="line.634"></a>
+<FONT color="green">635</FONT>         *<a name="line.635"></a>
+<FONT color="green">636</FONT>         * @return the internal storage array used by this object<a name="line.636"></a>
+<FONT color="green">637</FONT>         * @since 2.0<a name="line.637"></a>
+<FONT color="green">638</FONT>         */<a name="line.638"></a>
+<FONT color="green">639</FONT>        public synchronized double[] getInternalValues() {<a name="line.639"></a>
+<FONT color="green">640</FONT>            return internalArray;<a name="line.640"></a>
+<FONT color="green">641</FONT>        }<a name="line.641"></a>
+<FONT color="green">642</FONT>    <a name="line.642"></a>
+<FONT color="green">643</FONT>        /**<a name="line.643"></a>
+<FONT color="green">644</FONT>         * Sets the contraction criteria for this ExpandContractDoubleArray.<a name="line.644"></a>
+<FONT color="green">645</FONT>         *<a name="line.645"></a>
+<FONT color="green">646</FONT>         * @param contractionCriteria contraction criteria<a name="line.646"></a>
+<FONT color="green">647</FONT>         */<a name="line.647"></a>
+<FONT color="green">648</FONT>        public void setContractionCriteria(float contractionCriteria) {<a name="line.648"></a>
+<FONT color="green">649</FONT>            checkContractExpand(contractionCriteria, getExpansionFactor());<a name="line.649"></a>
+<FONT color="green">650</FONT>            synchronized(this) {<a name="line.650"></a>
+<FONT color="green">651</FONT>                this.contractionCriteria = contractionCriteria;<a name="line.651"></a>
+<FONT color="green">652</FONT>            }<a name="line.652"></a>
+<FONT color="green">653</FONT>        }<a name="line.653"></a>
+<FONT color="green">654</FONT>    <a name="line.654"></a>
+<FONT color="green">655</FONT>    <a name="line.655"></a>
+<FONT color="green">656</FONT>        /**<a name="line.656"></a>
+<FONT color="green">657</FONT>         * Sets the element at the specified index.  If the specified index is greater than<a name="line.657"></a>
+<FONT color="green">658</FONT>         * &lt;code&gt;getNumElements() - 1&lt;/code&gt;, the &lt;code&gt;numElements&lt;/code&gt; property<a name="line.658"></a>
+<FONT color="green">659</FONT>         * is increased to &lt;code&gt;index +1&lt;/code&gt; and additional storage is allocated<a name="line.659"></a>
+<FONT color="green">660</FONT>         * (if necessary) for the new element and all  (uninitialized) elements<a name="line.660"></a>
+<FONT color="green">661</FONT>         * between the new element and the previous end of the array).<a name="line.661"></a>
+<FONT color="green">662</FONT>         *<a name="line.662"></a>
+<FONT color="green">663</FONT>         * @param index index to store a value in<a name="line.663"></a>
+<FONT color="green">664</FONT>         * @param value value to store at the specified index<a name="line.664"></a>
+<FONT color="green">665</FONT>         * @throws ArrayIndexOutOfBoundsException if &lt;code&gt;index&lt;/code&gt; is less than<a name="line.665"></a>
+<FONT color="green">666</FONT>         *         zero.<a name="line.666"></a>
+<FONT color="green">667</FONT>         */<a name="line.667"></a>
+<FONT color="green">668</FONT>        public synchronized void setElement(int index, double value) {<a name="line.668"></a>
+<FONT color="green">669</FONT>            if (index &lt; 0) {<a name="line.669"></a>
+<FONT color="green">670</FONT>                throw MathRuntimeException.createArrayIndexOutOfBoundsException(<a name="line.670"></a>
+<FONT color="green">671</FONT>                        "cannot set an element at a negative index {0}",<a name="line.671"></a>
+<FONT color="green">672</FONT>                        index);<a name="line.672"></a>
+<FONT color="green">673</FONT>            }<a name="line.673"></a>
+<FONT color="green">674</FONT>            if (index + 1 &gt; numElements) {<a name="line.674"></a>
+<FONT color="green">675</FONT>                numElements = index + 1;<a name="line.675"></a>
+<FONT color="green">676</FONT>            }<a name="line.676"></a>
+<FONT color="green">677</FONT>            if ((startIndex + index) &gt;= internalArray.length) {<a name="line.677"></a>
+<FONT color="green">678</FONT>                expandTo(startIndex + (index + 1));<a name="line.678"></a>
+<FONT color="green">679</FONT>            }<a name="line.679"></a>
+<FONT color="green">680</FONT>            internalArray[startIndex + index] = value;<a name="line.680"></a>
+<FONT color="green">681</FONT>        }<a name="line.681"></a>
+<FONT color="green">682</FONT>    <a name="line.682"></a>
+<FONT color="green">683</FONT>        /**<a name="line.683"></a>
+<FONT color="green">684</FONT>         * Sets the expansionFactor.  Throws IllegalArgumentException if the<a name="line.684"></a>
+<FONT color="green">685</FONT>         * the following conditions are not met:<a name="line.685"></a>
+<FONT color="green">686</FONT>         * &lt;ul&gt;<a name="line.686"></a>
+<FONT color="green">687</FONT>         * &lt;li&gt;&lt;code&gt;expansionFactor &gt; 1&lt;/code&gt;&lt;/li&gt;<a name="line.687"></a>
+<FONT color="green">688</FONT>         * &lt;li&gt;&lt;code&gt;contractionFactor &gt;= expansionFactor&lt;/code&gt;&lt;/li&gt;<a name="line.688"></a>
+<FONT color="green">689</FONT>         * &lt;/ul&gt;<a name="line.689"></a>
+<FONT color="green">690</FONT>         * @param expansionFactor the new expansion factor value.<a name="line.690"></a>
+<FONT color="green">691</FONT>         * @throws IllegalArgumentException if expansionFactor is &lt;= 1 or greater<a name="line.691"></a>
+<FONT color="green">692</FONT>         * than contractionFactor<a name="line.692"></a>
+<FONT color="green">693</FONT>         */<a name="line.693"></a>
+<FONT color="green">694</FONT>        public void setExpansionFactor(float expansionFactor) {<a name="line.694"></a>
+<FONT color="green">695</FONT>            checkContractExpand(getContractionCriteria(), expansionFactor);<a name="line.695"></a>
+<FONT color="green">696</FONT>            // The check above verifies that the expansion factor is &gt; 1.0;<a name="line.696"></a>
+<FONT color="green">697</FONT>            synchronized(this) {<a name="line.697"></a>
+<FONT color="green">698</FONT>                this.expansionFactor = expansionFactor;<a name="line.698"></a>
+<FONT color="green">699</FONT>            }<a name="line.699"></a>
+<FONT color="green">700</FONT>        }<a name="line.700"></a>
+<FONT color="green">701</FONT>    <a name="line.701"></a>
+<FONT color="green">702</FONT>        /**<a name="line.702"></a>
+<FONT color="green">703</FONT>         * Sets the &lt;code&gt;expansionMode&lt;/code&gt;. The specified value must be one of<a name="line.703"></a>
+<FONT color="green">704</FONT>         * ADDITIVE_MODE, MULTIPLICATIVE_MODE.<a name="line.704"></a>
+<FONT color="green">705</FONT>         *<a name="line.705"></a>
+<FONT color="green">706</FONT>         * @param expansionMode The expansionMode to set.<a name="line.706"></a>
+<FONT color="green">707</FONT>         * @throws IllegalArgumentException if the specified mode value is not valid<a name="line.707"></a>
+<FONT color="green">708</FONT>         */<a name="line.708"></a>
+<FONT color="green">709</FONT>        public void setExpansionMode(int expansionMode) {<a name="line.709"></a>
+<FONT color="green">710</FONT>            if (expansionMode != MULTIPLICATIVE_MODE &amp;&amp;<a name="line.710"></a>
+<FONT color="green">711</FONT>                    expansionMode != ADDITIVE_MODE) {<a name="line.711"></a>
+<FONT color="green">712</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.712"></a>
+<FONT color="green">713</FONT>                        "unsupported expansion mode {0}, supported modes are {1} ({2}) and {3} ({4})",<a name="line.713"></a>
+<FONT color="green">714</FONT>                        expansionMode, MULTIPLICATIVE_MODE, "MULTIPLICATIVE_MODE",<a name="line.714"></a>
+<FONT color="green">715</FONT>                        ADDITIVE_MODE, "ADDITIVE_MODE");<a name="line.715"></a>
+<FONT color="green">716</FONT>            }<a name="line.716"></a>
+<FONT color="green">717</FONT>            synchronized(this) {<a name="line.717"></a>
+<FONT color="green">718</FONT>                this.expansionMode = expansionMode;<a name="line.718"></a>
+<FONT color="green">719</FONT>            }<a name="line.719"></a>
+<FONT color="green">720</FONT>        }<a name="line.720"></a>
+<FONT color="green">721</FONT>    <a name="line.721"></a>
+<FONT color="green">722</FONT>        /**<a name="line.722"></a>
+<FONT color="green">723</FONT>         * Sets the initial capacity.  Should only be invoked by constructors.<a name="line.723"></a>
+<FONT color="green">724</FONT>         *<a name="line.724"></a>
+<FONT color="green">725</FONT>         * @param initialCapacity of the array<a name="line.725"></a>
+<FONT color="green">726</FONT>         * @throws IllegalArgumentException if &lt;code&gt;initialCapacity&lt;/code&gt; is not<a name="line.726"></a>
+<FONT color="green">727</FONT>         *         positive.<a name="line.727"></a>
+<FONT color="green">728</FONT>         */<a name="line.728"></a>
+<FONT color="green">729</FONT>        protected void setInitialCapacity(int initialCapacity) {<a name="line.729"></a>
+<FONT color="green">730</FONT>            if (initialCapacity &gt; 0) {<a name="line.730"></a>
+<FONT color="green">731</FONT>                synchronized(this) {<a name="line.731"></a>
+<FONT color="green">732</FONT>                    this.initialCapacity = initialCapacity;<a name="line.732"></a>
+<FONT color="green">733</FONT>                }<a name="line.733"></a>
+<FONT color="green">734</FONT>            } else {<a name="line.734"></a>
+<FONT color="green">735</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.735"></a>
+<FONT color="green">736</FONT>                        "initial capacity ({0}) is not positive",<a name="line.736"></a>
+<FONT color="green">737</FONT>                        initialCapacity);<a name="line.737"></a>
+<FONT color="green">738</FONT>            }<a name="line.738"></a>
+<FONT color="green">739</FONT>        }<a name="line.739"></a>
+<FONT color="green">740</FONT>    <a name="line.740"></a>
+<FONT color="green">741</FONT>        /**<a name="line.741"></a>
+<FONT color="green">742</FONT>         * This function allows you to control the number of elements contained<a name="line.742"></a>
+<FONT color="green">743</FONT>         * in this array, and can be used to "throw out" the last n values in an<a name="line.743"></a>
+<FONT color="green">744</FONT>         * array. This function will also expand the internal array as needed.<a name="line.744"></a>
+<FONT color="green">745</FONT>         *<a name="line.745"></a>
+<FONT color="green">746</FONT>         * @param i a new number of elements<a name="line.746"></a>
+<FONT color="green">747</FONT>         * @throws IllegalArgumentException if &lt;code&gt;i&lt;/code&gt; is negative.<a name="line.747"></a>
+<FONT color="green">748</FONT>         */<a name="line.748"></a>
+<FONT color="green">749</FONT>        public synchronized void setNumElements(int i) {<a name="line.749"></a>
+<FONT color="green">750</FONT>    <a name="line.750"></a>
+<FONT color="green">751</FONT>            // If index is negative thrown an error<a name="line.751"></a>
+<FONT color="green">752</FONT>            if (i &lt; 0) {<a name="line.752"></a>
+<FONT color="green">753</FONT>                throw MathRuntimeException.createIllegalArgumentException(<a name="line.753"></a>
+<FONT color="green">754</FONT>                        "index ({0}) is not positive",<a name="line.754"></a>
+<FONT color="green">755</FONT>                        i);<a name="line.755"></a>
+<FONT color="green">756</FONT>            }<a name="line.756"></a>
+<FONT color="green">757</FONT>    <a name="line.757"></a>
+<FONT color="green">758</FONT>            // Test the new num elements, check to see if the array needs to be<a name="line.758"></a>
+<FONT color="green">759</FONT>            // expanded to accommodate this new number of elements<a name="line.759"></a>
+<FONT color="green">760</FONT>            if ((startIndex + i) &gt; internalArray.length) {<a name="line.760"></a>
+<FONT color="green">761</FONT>                expandTo(startIndex + i);<a name="line.761"></a>
+<FONT color="green">762</FONT>            }<a name="line.762"></a>
+<FONT color="green">763</FONT>    <a name="line.763"></a>
+<FONT color="green">764</FONT>            // Set the new number of elements to new value<a name="line.764"></a>
+<FONT color="green">765</FONT>            numElements = i;<a name="line.765"></a>
+<FONT color="green">766</FONT>        }<a name="line.766"></a>
+<FONT color="green">767</FONT>    <a name="line.767"></a>
+<FONT color="green">768</FONT>        /**<a name="line.768"></a>
+<FONT color="green">769</FONT>         * Returns true if the internal storage array has too many unused<a name="line.769"></a>
+<FONT color="green">770</FONT>         * storage positions.<a name="line.770"></a>
+<FONT color="green">771</FONT>         *<a name="line.771"></a>
+<FONT color="green">772</FONT>         * @return true if array satisfies the contraction criteria<a name="line.772"></a>
+<FONT color="green">773</FONT>         */<a name="line.773"></a>
+<FONT color="green">774</FONT>        private synchronized boolean shouldContract() {<a name="line.774"></a>
+<FONT color="green">775</FONT>            if (expansionMode == MULTIPLICATIVE_MODE) {<a name="line.775"></a>
+<FONT color="green">776</FONT>                return (internalArray.length / ((float) numElements)) &gt; contractionCriteria;<a name="line.776"></a>
+<FONT color="green">777</FONT>            } else {<a name="line.777"></a>
+<FONT color="green">778</FONT>                return (internalArray.length - numElements) &gt; contractionCriteria;<a name="line.778"></a>
+<FONT color="green">779</FONT>            }<a name="line.779"></a>
+<FONT color="green">780</FONT>        }<a name="line.780"></a>
+<FONT color="green">781</FONT>    <a name="line.781"></a>
+<FONT color="green">782</FONT>        /**<a name="line.782"></a>
+<FONT color="green">783</FONT>         * Returns the starting index of the internal array.  The starting index is<a name="line.783"></a>
+<FONT color="green">784</FONT>         * the position of the first addressable element in the internal storage<a name="line.784"></a>
+<FONT color="green">785</FONT>         * array.  The addressable elements in the array are &lt;code&gt;<a name="line.785"></a>
+<FONT color="green">786</FONT>         * internalArray[startIndex],...,internalArray[startIndex + numElements -1]<a name="line.786"></a>
+<FONT color="green">787</FONT>         * &lt;/code&gt;<a name="line.787"></a>
+<FONT color="green">788</FONT>         *<a name="line.788"></a>
+<FONT color="green">789</FONT>         * @return starting index<a name="line.789"></a>
+<FONT color="green">790</FONT>         */<a name="line.790"></a>
+<FONT color="green">791</FONT>        public synchronized int start() {<a name="line.791"></a>
+<FONT color="green">792</FONT>            return startIndex;<a name="line.792"></a>
+<FONT color="green">793</FONT>        }<a name="line.793"></a>
+<FONT color="green">794</FONT>    <a name="line.794"></a>
+<FONT color="green">795</FONT>        /**<a name="line.795"></a>
+<FONT color="green">796</FONT>         * &lt;p&gt;Copies source to dest, copying the underlying data, so dest is<a name="line.796"></a>
+<FONT color="green">797</FONT>         * a new, independent copy of source.  Does not contract before<a name="line.797"></a>
+<FONT color="green">798</FONT>         * the copy.&lt;/p&gt;<a name="line.798"></a>
+<FONT color="green">799</FONT>         *<a name="line.799"></a>
+<FONT color="green">800</FONT>         * &lt;p&gt;Obtains synchronization locks on both source and dest<a name="line.800"></a>
+<FONT color="green">801</FONT>         * (in that order) before performing the copy.&lt;/p&gt;<a name="line.801"></a>
+<FONT color="green">802</FONT>         *<a name="line.802"></a>
+<FONT color="green">803</FONT>         * &lt;p&gt;Neither source nor dest may be null; otherwise a NullPointerException<a name="line.803"></a>
+<FONT color="green">804</FONT>         * is thrown&lt;/p&gt;<a name="line.804"></a>
+<FONT color="green">805</FONT>         *<a name="line.805"></a>
+<FONT color="green">806</FONT>         * @param source ResizableDoubleArray to copy<a name="line.806"></a>
+<FONT color="green">807</FONT>         * @param dest ResizableArray to replace with a copy of the source array<a name="line.807"></a>
+<FONT color="green">808</FONT>         * @since 2.0<a name="line.808"></a>
+<FONT color="green">809</FONT>         *<a name="line.809"></a>
+<FONT color="green">810</FONT>         */<a name="line.810"></a>
+<FONT color="green">811</FONT>        public static void copy(ResizableDoubleArray source, ResizableDoubleArray dest) {<a name="line.811"></a>
+<FONT color="green">812</FONT>           synchronized(source) {<a name="line.812"></a>
+<FONT color="green">813</FONT>               synchronized(dest) {<a name="line.813"></a>
+<FONT color="green">814</FONT>                   dest.initialCapacity = source.initialCapacity;<a name="line.814"></a>
+<FONT color="green">815</FONT>                   dest.contractionCriteria = source.contractionCriteria;<a name="line.815"></a>
+<FONT color="green">816</FONT>                   dest.expansionFactor = source.expansionFactor;<a name="line.816"></a>
+<FONT color="green">817</FONT>                   dest.expansionMode = source.expansionMode;<a name="line.817"></a>
+<FONT color="green">818</FONT>                   dest.internalArray = new double[source.internalArray.length];<a name="line.818"></a>
+<FONT color="green">819</FONT>                   System.arraycopy(source.internalArray, 0, dest.internalArray,<a name="line.819"></a>
+<FONT color="green">820</FONT>                           0, dest.internalArray.length);<a name="line.820"></a>
+<FONT color="green">821</FONT>                   dest.numElements = source.numElements;<a name="line.821"></a>
+<FONT color="green">822</FONT>                   dest.startIndex = source.startIndex;<a name="line.822"></a>
+<FONT color="green">823</FONT>               }<a name="line.823"></a>
+<FONT color="green">824</FONT>           }<a name="line.824"></a>
+<FONT color="green">825</FONT>        }<a name="line.825"></a>
+<FONT color="green">826</FONT>    <a name="line.826"></a>
+<FONT color="green">827</FONT>        /**<a name="line.827"></a>
+<FONT color="green">828</FONT>         * Returns a copy of the ResizableDoubleArray.  Does not contract before<a name="line.828"></a>
+<FONT color="green">829</FONT>         * the copy, so the returned object is an exact copy of this.<a name="line.829"></a>
+<FONT color="green">830</FONT>         *<a name="line.830"></a>
+<FONT color="green">831</FONT>         * @return a new ResizableDoubleArray with the same data and configuration<a name="line.831"></a>
+<FONT color="green">832</FONT>         * properties as this<a name="line.832"></a>
+<FONT color="green">833</FONT>         * @since 2.0<a name="line.833"></a>
+<FONT color="green">834</FONT>         */<a name="line.834"></a>
+<FONT color="green">835</FONT>        public synchronized ResizableDoubleArray copy() {<a name="line.835"></a>
+<FONT color="green">836</FONT>            ResizableDoubleArray result = new ResizableDoubleArray();<a name="line.836"></a>
+<FONT color="green">837</FONT>            copy(this, result);<a name="line.837"></a>
+<FONT color="green">838</FONT>            return result;<a name="line.838"></a>
+<FONT color="green">839</FONT>        }<a name="line.839"></a>
+<FONT color="green">840</FONT>    <a name="line.840"></a>
+<FONT color="green">841</FONT>        /**<a name="line.841"></a>
+<FONT color="green">842</FONT>         * Returns true iff object is a ResizableDoubleArray with the same properties<a name="line.842"></a>
+<FONT color="green">843</FONT>         * as this and an identical internal storage array.<a name="line.843"></a>
+<FONT color="green">844</FONT>         *<a name="line.844"></a>
+<FONT color="green">845</FONT>         * @param object object to be compared for equality with this<a name="line.845"></a>
+<FONT color="green">846</FONT>         * @return true iff object is a ResizableDoubleArray with the same data and<a name="line.846"></a>
+<FONT color="green">847</FONT>         * properties as this<a name="line.847"></a>
+<FONT color="green">848</FONT>         * @since 2.0<a name="line.848"></a>
+<FONT color="green">849</FONT>         */<a name="line.849"></a>
+<FONT color="green">850</FONT>        @Override<a name="line.850"></a>
+<FONT color="green">851</FONT>        public boolean equals(Object object) {<a name="line.851"></a>
+<FONT color="green">852</FONT>            if (object == this ) {<a name="line.852"></a>
+<FONT color="green">853</FONT>                return true;<a name="line.853"></a>
+<FONT color="green">854</FONT>            }<a name="line.854"></a>
+<FONT color="green">855</FONT>           if (object instanceof ResizableDoubleArray == false) {<a name="line.855"></a>
+<FONT color="green">856</FONT>                return false;<a name="line.856"></a>
+<FONT color="green">857</FONT>            }<a name="line.857"></a>
+<FONT color="green">858</FONT>           synchronized(this) {<a name="line.858"></a>
+<FONT color="green">859</FONT>               synchronized(object) {<a name="line.859"></a>
+<FONT color="green">860</FONT>                   boolean result = true;<a name="line.860"></a>
+<FONT color="green">861</FONT>                   ResizableDoubleArray other = (ResizableDoubleArray) object;<a name="line.861"></a>
+<FONT color="green">862</FONT>                   result = result &amp;&amp; (other.initialCapacity == initialCapacity);<a name="line.862"></a>
+<FONT color="green">863</FONT>                   result = result &amp;&amp; (other.contractionCriteria == contractionCriteria);<a name="line.863"></a>
+<FONT color="green">864</FONT>                   result = result &amp;&amp; (other.expansionFactor == expansionFactor);<a name="line.864"></a>
+<FONT color="green">865</FONT>                   result = result &amp;&amp; (other.expansionMode == expansionMode);<a name="line.865"></a>
+<FONT color="green">866</FONT>                   result = result &amp;&amp; (other.numElements == numElements);<a name="line.866"></a>
+<FONT color="green">867</FONT>                   result = result &amp;&amp; (other.startIndex == startIndex);<a name="line.867"></a>
+<FONT color="green">868</FONT>                   if (!result) {<a name="line.868"></a>
+<FONT color="green">869</FONT>                       return false;<a name="line.869"></a>
+<FONT color="green">870</FONT>                   } else {<a name="line.870"></a>
+<FONT color="green">871</FONT>                       return Arrays.equals(internalArray, other.internalArray);<a name="line.871"></a>
+<FONT color="green">872</FONT>                   }<a name="line.872"></a>
+<FONT color="green">873</FONT>               }<a name="line.873"></a>
+<FONT color="green">874</FONT>           }<a name="line.874"></a>
+<FONT color="green">875</FONT>        }<a name="line.875"></a>
+<FONT color="green">876</FONT>    <a name="line.876"></a>
+<FONT color="green">877</FONT>        /**<a name="line.877"></a>
+<FONT color="green">878</FONT>         * Returns a hash code consistent with equals.<a name="line.878"></a>
+<FONT color="green">879</FONT>         *<a name="line.879"></a>
+<FONT color="green">880</FONT>         * @return hash code representing this ResizableDoubleArray<a name="line.880"></a>
+<FONT color="green">881</FONT>         * @since 2.0<a name="line.881"></a>
+<FONT color="green">882</FONT>         */<a name="line.882"></a>
+<FONT color="green">883</FONT>        @Override<a name="line.883"></a>
+<FONT color="green">884</FONT>        public synchronized int hashCode() {<a name="line.884"></a>
+<FONT color="green">885</FONT>            int[] hashData = new int[7];<a name="line.885"></a>
+<FONT color="green">886</FONT>            hashData[0] = new Float(expansionFactor).hashCode();<a name="line.886"></a>
+<FONT color="green">887</FONT>            hashData[1] = new Float(contractionCriteria).hashCode();<a name="line.887"></a>
+<FONT color="green">888</FONT>            hashData[2] = expansionMode;<a name="line.888"></a>
+<FONT color="green">889</FONT>                hashData[3] = Arrays.hashCode(internalArray);<a name="line.889"></a>
+<FONT color="green">890</FONT>                hashData[4] = initialCapacity;<a name="line.890"></a>
+<FONT color="green">891</FONT>                hashData[5] = numElements;<a name="line.891"></a>
+<FONT color="green">892</FONT>                hashData[6] = startIndex;<a name="line.892"></a>
+<FONT color="green">893</FONT>            return Arrays.hashCode(hashData);<a name="line.893"></a>
+<FONT color="green">894</FONT>        }<a name="line.894"></a>
+<FONT color="green">895</FONT>    <a name="line.895"></a>
+<FONT color="green">896</FONT>    }<a name="line.896"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/commons-math-2.1/docs/apidocs/src-html/org/apache/commons/math/util/TransformerMap.html	Tue Jan 04 10:02:07 2011 +0100
@@ -0,0 +1,255 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    package org.apache.commons.math.util;<a name="line.17"></a>
+<FONT color="green">018</FONT>    <a name="line.18"></a>
+<FONT color="green">019</FONT>    import java.io.Serializable;<a name="line.19"></a>
+<FONT color="green">020</FONT>    import java.util.Collection;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import java.util.HashMap;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import java.util.Map;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import java.util.Set;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    import org.apache.commons.math.MathException;<a name="line.25"></a>
+<FONT color="green">026</FONT>    <a name="line.26"></a>
+<FONT color="green">027</FONT>    /**<a name="line.27"></a>
+<FONT color="green">028</FONT>     * This TansformerMap automates the transformation of mixed object types.<a name="line.28"></a>
+<FONT color="green">029</FONT>     * It provides a means to set NumberTransformers that will be selected<a name="line.29"></a>
+<FONT color="green">030</FONT>     * based on the Class of the object handed to the Maps<a name="line.30"></a>
+<FONT color="green">031</FONT>     * &lt;code&gt;double transform(Object o)&lt;/code&gt; method.<a name="line.31"></a>
+<FONT color="green">032</FONT>     * @version $Revision: 922713 $ $Date: 2010-03-13 20:26:13 -0500 (Sat, 13 Mar 2010) $<a name="line.32"></a>
+<FONT color="green">033</FONT>     */<a name="line.33"></a>
+<FONT color="green">034</FONT>    public class TransformerMap implements NumberTransformer, Serializable {<a name="line.34"></a>
+<FONT color="green">035</FONT>    <a name="line.35"></a>
+<FONT color="green">036</FONT>        /** Serializable version identifier */<a name="line.36"></a>
+<FONT color="green">037</FONT>        private static final long serialVersionUID = 4605318041528645258L;<a name="line.37"></a>
+<FONT color="green">038</FONT>    <a name="line.38"></a>
+<FONT color="green">039</FONT>        /**<a name="line.39"></a>
+<FONT color="green">040</FONT>         * A default Number Transformer for Numbers and numeric Strings.<a name="line.40"></a>
+<FONT color="green">041</FONT>         */<a name="line.41"></a>
+<FONT color="green">042</FONT>        private NumberTransformer defaultTransformer = null;<a name="line.42"></a>
+<FONT color="green">043</FONT>    <a name="line.43"></a>
+<FONT color="green">044</FONT>        /**<a name="line.44"></a>
+<FONT color="green">045</FONT>         * The internal Map.<a name="line.45"></a>
+<FONT color="green">046</FONT>         */<a name="line.46"></a>
+<FONT color="green">047</FONT>        private Map&lt;Class&lt;?&gt;, NumberTransformer&gt; map = null;<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        /**<a name="line.49"></a>
+<FONT color="green">050</FONT>         * Build a map containing only the default transformer.<a name="line.50"></a>
+<FONT color="green">051</FONT>         */<a name="line.51"></a>
+<FONT color="green">052</FONT>        public TransformerMap() {<a name="line.52"></a>
+<FONT color="green">053</FONT>            map = new HashMap&lt;Class&lt;?&gt;, NumberTransformer&gt;();<a name="line.53"></a>
+<FONT color="green">054</FONT>            defaultTransformer = new DefaultTransformer();<a name="line.54"></a>
+<FONT color="green">055</FONT>        }<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>        /**<a name="line.57"></a>
+<FONT color="green">058</FONT>         * Tests if a Class is present in the TransformerMap.<a name="line.58"></a>
+<FONT color="green">059</FONT>         * @param key Class to check<a name="line.59"></a>
+<FONT color="green">060</FONT>         * @return true|false<a name="line.60"></a>
+<FONT color="green">061</FONT>         */<a name="line.61"></a>
+<FONT color="green">062</FONT>        public boolean containsClass(Class&lt;?&gt; key) {<a name="line.62"></a>
+<FONT color="green">063</FONT>            return map.containsKey(key);<a name="line.63"></a>
+<FONT color="green">064</FONT>        }<a name="line.64"></a>
+<FONT color="green">065</FONT>    <a name="line.65"></a>
+<FONT color="green">066</FONT>        /**<a name="line.66"></a>
+<FONT color="green">067</FONT>         * Tests if a NumberTransformer is present in the TransformerMap.<a name="line.67"></a>
+<FONT color="green">068</FONT>         * @param value NumberTransformer to check<a name="line.68"></a>
+<FONT color="green">069</FONT>         * @return true|false<a name="line.69"></a>
+<FONT color="green">070</FONT>         */<a name="line.70"></a>
+<FONT color="green">071</FONT>        public boolean containsTransformer(NumberTransformer value) {<a name="line.71"></a>
+<FONT color="green">072</FONT>            return map.containsValue(value);<a name="line.72"></a>
+<FONT color="green">073</FONT>        }<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>        /**<a name="line.75"></a>
+<FONT color="green">076</FONT>         * Returns the Transformer that is mapped to a class<a name="line.76"></a>
+<FONT color="green">077</FONT>         * if mapping is not present, this returns null.<a name="line.77"></a>
+<FONT color="green">078</FONT>         * @param key The Class of the object<a name="line.78"></a>
+<FONT color="green">079</FONT>         * @return the mapped NumberTransformer or null.<a name="line.79"></a>
+<FONT color="green">080</FONT>         */<a name="line.80"></a>
+<FONT color="green">081</FONT>        public NumberTransformer getTransformer(Class&lt;?&gt; key) {<a name="line.81"></a>
+<FONT color="green">082</FONT>            return map.get(key);<a name="line.82"></a>
+<FONT color="green">083</FONT>        }<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>        /**<a name="line.85"></a>
+<FONT color="green">086</FONT>         * Sets a Class to Transformer Mapping in the Map. If<a name="line.86"></a>
+<FONT color="green">087</FONT>         * the Class is already present, this overwrites that<a name="line.87"></a>
+<FONT color="green">088</FONT>         * mapping.<a name="line.88"></a>
+<FONT color="green">089</FONT>         * @param key The Class<a name="line.89"></a>
+<FONT color="green">090</FONT>         * @param transformer The NumberTransformer<a name="line.90"></a>
+<FONT color="green">091</FONT>         * @return the replaced transformer if one is present<a name="line.91"></a>
+<FONT color="green">092</FONT>         */<a name="line.92"></a>
+<FONT color="green">093</FONT>        public NumberTransformer putTransformer(Class&lt;?&gt; key, NumberTransformer transformer) {<a name="line.93"></a>
+<FONT color="green">094</FONT>            return map.put(key, transformer);<a name="line.94"></a>
+<FONT color="green">095</FONT>        }<a name="line.95"></a>
+<FONT color="green">096</FONT>    <a name="line.96"></a>
+<FONT color="green">097</FONT>        /**<a name="line.97"></a>
+<FONT color="green">098</FONT>         * Removes a Class to Transformer Mapping in the Map.<a name="line.98"></a>
+<FONT color="green">099</FONT>         * @param key The Class<a name="line.99"></a>
+<FONT color="green">100</FONT>         * @return the removed transformer if one is present or<a name="line.100"></a>
+<FONT color="green">101</FONT>         * null if none was present.<a name="line.101"></a>
+<FONT color="green">102</FONT>         */<a name="line.102"></a>
+<FONT color="green">103</FONT>        public NumberTransformer removeTransformer(Class&lt;?&gt; key) {<a name="line.103"></a>
+<FONT color="green">104</FONT>            return map.remove(key);<a name="line.104"></a>
+<FONT color="green">105</FONT>        }<a name="line.105"></a>
+<FONT color="green">106</FONT>    <a name="line.106"></a>
+<FONT color="green">107</FONT>        /**<a name="line.107"></a>
+<FONT color="green">108</FONT>         * Clears all the Class to Transformer mappings.<a name="line.108"></a>
+<FONT color="green">109</FONT>         */<a name="line.109"></a>
+<FONT color="green">110</FONT>        public void clear() {<a name="line.110"></a>
+<FONT color="green">111</FONT>            map.clear();<a name="line.111"></a>
+<FONT color="green">112</FONT>        }<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>        /**<a name="line.114"></a>
+<FONT color="green">115</FONT>         * Returns the Set of Classes used as keys in the map.<a name="line.115"></a>
+<FONT color="green">116</FONT>         * @return Set of Classes<a name="line.116"></a>
+<FONT color="green">117</FONT>         */<a name="line.117"></a>
+<FONT color="green">118</FONT>        public Set&lt;Class&lt;?&gt;&gt; classes() {<a name="line.118"></a>
+<FONT color="green">119</FONT>            return map.keySet();<a name="line.119"></a>
+<FONT color="green">120</FONT>        }<a name="line.120"></a>
+<FONT color="green">121</FONT>    <a name="line.121"></a>
+<FONT color="green">122</FONT>        /**<a name="line.122"></a>
+<FONT color="green">123</FONT>         * Returns the Set of NumberTransformers used as values<a name="line.123"></a>
+<FONT color="green">124</FONT>         * in the map.<a name="line.124"></a>
+<FONT color="green">125</FONT>         * @return Set of NumberTransformers<a name="line.125"></a>
+<FONT color="green">126</FONT>         */<a name="line.126"></a>
+<FONT color="green">127</FONT>        public Collection&lt;NumberTransformer&gt; transformers() {<a name="line.127"></a>
+<FONT color="green">128</FONT>            return map.values();<a name="line.128"></a>
+<FONT color="green">129</FONT>        }<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>        /**<a name="line.131"></a>
+<FONT color="green">132</FONT>         * Attempts to transform the Object against the map of<a name="line.132"></a>
+<FONT color="green">133</FONT>         * NumberTransformers. Otherwise it returns Double.NaN.<a name="line.133"></a>
+<FONT color="green">134</FONT>         *<a name="line.134"></a>
+<FONT color="green">135</FONT>         * @param o the Object to be transformed.<a name="line.135"></a>
+<FONT color="green">136</FONT>         * @return the double value of the Object.<a name="line.136"></a>
+<FONT color="green">137</FONT>         * @throws MathException if the Object can not be transformed into a Double.<a name="line.137"></a>
+<FONT color="green">138</FONT>         * @see org.apache.commons.math.util.NumberTransformer#transform(java.lang.Object)<a name="line.138"></a>
+<FONT color="green">139</FONT>         */<a name="line.139"></a>
+<FONT color="green">140</FONT>        public double transform(Object o) throws MathException {<a name="line.140"></a>
+<FONT color="green">141</FONT>            double value = Double.NaN;<a name="line.141"></a>
+<FONT color="green">142</FONT>    <a name="line.142"></a>
+<FONT color="green">143</FONT>            if (o instanceof Number || o instanceof String) {<a name="line.143"></a>
+<FONT color="green">144</FONT>                value = defaultTransformer.transform(o);<a name="line.144"></a>
+<FONT color="green">145</FONT>            } else {<a name="line.145"></a>
+<FONT color="green">146</FONT>                NumberTransformer trans = getTransformer(o.getClass());<a name="line.146"></a>
+<FONT color="green">147</FONT>                if (trans != null) {<a name="line.147"></a>
+<FONT color="green">148</FONT>                    value = trans.transform(o);<a name="line.148"></a>
+<FONT color="green">149</FONT>                }<a name="line.149"></a>
+<FONT color="green">150</FONT>            }<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>            return value;<a name="line.152"></a>
+<FONT color="green">153</FONT>        }<a name="line.153"></a>
+<FONT color="green">154</FONT>    <a name="line.154"></a>
+<FONT color="green">155</FONT>        /** {@inheritDoc} */<a name="line.155"></a>
+<FONT color="green">156</FONT>        @Override<a name="line.156"></a>
+<FONT color="green">157</FONT>        public boolean equals(Object other) {<a name="line.157"></a>
+<FONT color="green">158</FONT>            if (this == other) {<a name="line.158"></a>
+<FONT color="green">159</FONT>                return true;<a name="line.159"></a>
+<FONT color="green">160</FONT>            }<a name="line.160"></a>
+<FONT color="green">161</FONT>            if (other instanceof TransformerMap) {<a name="line.161"></a>
+<FONT color="green">162</FONT>                TransformerMap rhs = (TransformerMap) other;<a name="line.162"></a>
+<FONT color="green">163</FONT>                if (! defaultTransformer.equals(rhs.defaultTransformer)) {<a name="line.163"></a>
+<FONT color="green">164</FONT>                    return false;<a name="line.164"></a>
+<FONT color="green">165</FONT>                }<a name="line.165"></a>
+<FONT color="green">166</FONT>                if (map.size() != rhs.map.size()) {<a name="line.166"></a>
+<FONT color="green">167</FONT>                    return false;<a name="line.167"></a>
+<FONT color="green">168</FONT>                }<a name="line.168"></a>
+<FONT color="green">169</FONT>                for (Map.Entry&lt;Class&lt;?&gt;, NumberTransformer&gt; entry : map.entrySet()) {<a name="line.169"></a>
+<FONT color="green">170</FONT>                    if (! entry.getValue().equals(rhs.map.get(entry.getKey()))) {<a name="line.170"></a>
+<FONT color="green">171</FONT>                        return false;<a name="line.171"></a>
+<FONT color="green">172</FONT>                    }<a name="line.172"></a>
+<FONT color="green">173</FONT>                }<a name="line.173"></a>
+<FONT color="green">174</FONT>                return true;<a name="line.174"></a>
+<FONT color="green">175</FONT>            }<a name="line.175"></a>
+<FONT color="green">176</FONT>            return false;<a name="line.176"></a>
+<FONT color="green">177</FONT>        }<a name="line.177"></a>
+<FONT color="green">178</FONT>    <a name="line.178"></a>
+<FONT color="green">179</FONT>        /** {@inheritDoc} */<a name="line.179"></a>
+<FONT color="green">180</FONT>        @Override<a name="line.180"></a>
+<FONT color="green">181</FONT>        public int hashCode() {<a name="line.181"></a>
+<FONT color="green">182</FONT>            int hash = defaultTransformer.hashCode();<a name="line.182"></a>
+<FONT color="green">183</FONT>            for (NumberTransformer t : map.values()) {<a name="line.183"></a>
+<FONT color="green">184</FONT>                hash = hash * 31 + t.hashCode();<a name="line.184"></a>
+<FONT color="green">185</FONT>            }<a name="line.185"></a>
+<FONT color="green">186</FONT>            return hash;<a name="line.186"></a>
+<FONT color="green">187</FONT>        }<a name="line.187"></a>
+<FONT color="green">188</FONT>    <a name="line.188"></a>
+<FONT color="green">189</FONT>    }<a name="line.189"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>